Paprika is the React component library for the generic UI components of the Starling Design System by Galvanize.
Quick Links: NPM | Storybook | Component Status | Contributing Guidelines
If you want to spice up your application with Paprika, you will need to start by adding the required dependencies. Paprika has a peerDependency on React v16.8, styled-components and most packages also have a peerDependency on the Paprika L10n component (@paprika/l10n) for localization.
You will need to include them as dependencies in your project.
$ yarn add react styled-components @paprika/l10nFor example, to install the <Button> component:
$ yarn add @paprika/buttonThen, to use the component in your project:
import React from "react";
import Button from "@paprika/button";
export default () => <Button>Hello</Button>;For more information about using Paprika in your project, including code examples and FAQs, visit the Using Paprika wiki pages.
Paprika components are individually versioned and distributed packages in a Lerna monorepo. To browse a list of components, open the Storybook, view the source code, visit the NPM registry, or refer to the AirTable summary.
Before contributing, please read our Code of Conduct Contributors are welcome to submit a bug report, make a feature request, or open a pull request. If youโre just getting started, check out the Help Wanted or Good First Issues.
In order to commit code : 1) your branch name must start with a JIRA ticket:
ABC-123--updating-whatever #valid
xx-0000--updating-whatever #valid
updating-whatever #invalid2) your commit must follow Conventional commits pattern:
git commit -m "feat(ListBox): added feature x" #valid
git commit -m "fix(Button): made it work in IE9" #valid
git commit -m "bug(Button): made it work in IE9" #invalid (invalid type)
git commit -m "feat: added feature x" #invalid (missing scope)
git commit -m "added feature x" #invalid (missing type and scope)The valid "types" are: feat, fix, style, test, docs, build, chore, ci, perf, refactor, revert
If you are experiencing difficulty, you may need to:
- overwrite your existing commit-msg file with the husky one:
cp ~/src/paprika/.git/hooks/applypatch-msg ~/src/paprika/.git/hooks/commit-msg - update the commit-msg file permissions:
chmod 755 ~/src/paprika/.git/hooks/commit-msg
Paprika uses Changesets to manage versioning and publishing. When you make changes that should be released, you need to create a changeset file describing your changes.
Creating a Changeset:
- Run
yarn changesetin the root directory - Select the packages that have changed
- Choose the version bump type (patch, minor, or major)
- Write a summary of your changes
Automatic Publishing:
Packages are automatically published via scheduled GitHub Actions workflows:
- Pre-releases: Published automatically every 6 hours (at :00 past the hour, between 03:00 AM and 09:59 PM UTC, daily). These are pre-release versions (e.g.,
1.0.0-next.0) available for testing. - Stable releases: Published automatically every Saturday at 9:00 PM UTC. All changesets merged to
masterwill be versioned and published as stable releases.
Release Process:
- Create a changeset file describing your changes
- Merge your PR to
master(the changeset file will be included) - Pre-release versions will be available within 6 hours for testing
- Stable versions will be published on the next Saturday at 9 PM UTC
The GitHub Actions release workflow (.github/workflows/publish.yml) will:
- Bump package versions based on merged changesets
- Publish packages to NPM using npm Trusted Publishing (OIDC) for secure, token-less authentication
- Push version tags back to the repository
Manual Release: You can also trigger a release manually via GitHub Actions:
- Go to the "Actions" tab in the repository
- Select "Automatic Publish Packages" workflow
- Click "Run workflow" and choose either "pre-release" or "stable"
For more information please check out our Contributing Guidelines. You may want to start with the Getting Started Guide
Common yarn commands for development:
Code Quality:
yarn lint- Run ESLint to check code qualityyarn lint:fix- Automatically fix ESLint issuesyarn lint:jss- Lint styled-components filesyarn prettier- Check code formattingyarn prettier:formatoryarn prettier --write- Format code with Prettieryarn validate:ts- Validate TypeScript types
Testing:
yarn test- Run Jest unit testsyarn jest:watch- Run tests in watch modeyarn test:debug- Run tests with Node.js debuggeryarn test:a11y- Run accessibility tests with Axeyarn cypress:open- Open Cypress test runneryarn cypress:run- Run Cypress tests headlesslyyarn cypress:ci- Run Cypress tests in CI mode (starts Storybook automatically)yarn cypress:dev- Start Storybook and open Cypress (development mode)
Storybook:
yarn storybook- Start Storybook development serveryarn storybook:build- Build static Storybook for deploymentyarn storybook:start- Start Storybook without upload serveryarn storybook:startWithoutHMR- Start Storybook without hot module reload
Build & Transpilation:
yarn prepare- Full build: cleanup, transpile, generate types and READMEsyarn prepare:esm- Build ESM versions of packagesyarn transpile- Transpile packages to CommonJSyarn transpile:esm- Transpile packages to ESMyarn cleanup- Remove compiledlibdirectories
Code Generation:
yarn generateReadMe- Generate README files for packagesyarn generateTypeDefinitionsForJS- Generate TypeScript definitions for JS packagesyarn generateDocStories- Generate Storybook stories from documentationyarn build:translations- Build translation files
Component Creation:
yarn pestle- Interactive CLI tool for creating new components
Status & Metrics:
yarn paprika-status- Generate component health metrics (test coverage, commit stats, versions) and save tostatus.jsonyarn paprika-status:a11y- Generate accessibility status metrics and save tostatus-a11y.json(requires Storybook to be running)
Other:
yarn license- Generatelicense.xlsfile with all dependency licenses
There are a few layers to the testing pyramid in Paprika.
- Static analysis โ ESLint (with several plugins, namely airbnb)
- Unit testing โ Jest
- Component testing โ React Testing Library
- End-to-end testing โ Cypress
- Visual regresstion testing โ Screener
Paprika components are built with accessibility in mind from design through implementation. Compliance with WCAG 2.0 level AA by following WAI-ARIA Authoring Practices is a priority.
In practice this ensures the usability of Paprika components:
- with keyboard, mouse or touch inputs
- at various zoom levels up to 200% on a variety of screen sizes
- with sufficent colour contrast for all essential elements
- with meaningful and semantic markup
- with support for assistive technology (screen readers like VoiceOver, NVDA, and Jaws)
For more information about how these goals are achieved, please read our guidelines for developers.
Have a question for the development team? Ask us.
To list all licenses of paprika dependencies run
yarn licenseit will create a license.xls file at the root of the repository
The following packages has been deprecated and they have moved into a new name space
Before (deprecated)
- @paprika/listbox
- @paprika/listbox-browser
- @paprika/dropdownmenu
- @paprika/sidepanel
Now
- @paprika/list-box
- @paprika/list-box-browser
- @paprika/overflow-menu
- @paprika/panel
