npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@pearson-ux/alert

v5.0.0

Published

Alert web component

Downloads

44

Readme

Project Documentation

This document provides information on how to install dependencies, edit token styles, use the component, and create a new release of the project.

Installing Dependencies

Before you begin, make sure you have the following installed:

  • Node.js and npm: Ensure Node.js and npm are installed on your machine. You can verify this by running:

    node -v
    npm -v
  • npm Account: Ensure you have an npm account and are logged in. You can log in using:

    npm login

Once these prerequisites are met, install the project dependencies by running:

npm install

This command will install all necessary packages as defined in the package.json file.

Editing Token Styles

The pearson-accordion component uses token styles that are defined in the @pearson-ux/master-tokens package. However, customizations and overrides are done via the customTokens.js file.

To modify these styles:

  1. Open the customTokens.js file located in the project directory.
  2. The getCustomTokens function returns an object containing the styles used by the component. You can modify the values in this object to change the appearance of the component.

Example of customTokens.js:

export const getCustomTokens = (tokenModule = {}, isDarkMode = false) => {
    return {
        colorPrimary: isDarkMode
            ? tokenModule.TokenColorUi04
            : tokenModule.TokenColorUiBackgroundDark,
        colorSecondary: isDarkMode
            ? tokenModule.TokenColorIconLinkInverse
            : tokenModule.TokenColorIconLinkInverse,
        colorBackground: isDarkMode
            ? tokenModule.TokenColorUi04
            : tokenModule.TokenColorUi02,
        colorText: isDarkMode
            ? tokenModule.TokenColorTextPrimaryInverse
            : tokenModule.TokenColorTextPrimary,
        colorFocusBorder: tokenModule.TokenColorInteractiveFocus,
        colorSvgFill: isDarkMode
            ? tokenModule.TokenColorTextPrimaryInverse
            : tokenModule.TokenColorTextPrimary,
        // tokens below not found in master-tokens
        spacingSmall:  '8px',
        spacingMedium: '16px',
        spacingLarge:  '24px',
        fontFamilyOpenSans: `'Open Sans', sans-serif`,
        fontWeightNormal: 400,
        lineHeightSmall: '25.6px',
        lineHeightMedium: '26.4px',
        lineHeightLarge: '28px',
        accordionLabelFontSize: '22px',
        accordionLabelFontWeight: 400,
        accordionLabelLineHeight: '26.4px',
        accordionCopyFontSize: '16px',
        accordionCopyFontWeight: 400,
        accordionCopyLineHeight: '25.6px',
        accordionBoxShadow: '2px 2px 3px 0px rgba(218, 218, 218, 0.5)',
    };
};

By modifying the properties in the customTokens.js file, you can control the styling of the pearson-accordion component.

Usage

The pearson-accordion component allows you to create an accordion-style interface with different themes. The component requires a theme property to be specified, with three available themes to choose from:

  • ELL
  • p-com
  • p-plus

Example Usage:

<pearson-accordion theme="p-plus">
    <div label="First Item">
        Content for item 1.
    </div>
    <div label="Second Item">
        Content for item 2.
    </div>
    <div label="Third Item">
        Content for item 3.
    </div>
    <!-- Add more items as needed -->
</pearson-accordion>

Changing the Label Title

Each accordion item can have a custom label by using the label attribute on the child div elements. If the label attribute is not provided, a default label of "Accordion label" will be used.

Example:

<pearson-accordion theme="p-plus">
    <div label="Custom Label 1">
        Content for item 1.
    </div>
    <div label="Custom Label 2">
        Content for item 2.
    </div>
    <div label="Custom Label 3">
        Content for item 3.
    </div>
</pearson-accordion>

In this example, the labels of the accordion items will be "Custom Label 1", "Custom Label 2", and "Custom Label 3".

Steps to Release

Update the Version Number

The release process starts by updating the version number in package.json. This is done automatically by the release script. You must specify the new version number as an argument when running the script.

Example: To release version 1.0.1, run:

node release.js 1.0.1

Run the Release Script

The release script will:

  • Update the package.json version.
  • Create a release directory.
  • Modify and copy necessary files (list.js, customTokens.js, README.md, tokenHelper.js, package.json).
  • Update paths in list.js and tokenHelper.js.
  • Copy the @pearson-ux directory from node_modules.
  • Publish the release directory to npm.
  • Clean up the release directory after publishing.

Example command:

node release.js 1.0.1

Publish the Release to npm

The script will automatically publish the contents of the release directory to npm. Ensure you are logged in to npm before running the script.

If you need to manually publish, you can run:

cd release
npm publish

Clean Up

After a successful release, the release directory is automatically deleted by the script. If needed, you can manually delete it using:

rm -rf release

Troubleshooting

  • npm publish failed:

    • If the npm publish command fails, check the error message for details. Common issues include incorrect npm credentials or network problems.
  • Version Conflict:

    • If the specified version already exists on npm, you will need to increment the version number and try again.

Contributing

Please follow the established guidelines for contributing to the project. Before creating a pull request, ensure all tests pass and the code is formatted correctly.

License

This project is licensed under the MIT License.