@nearform/quantum 0.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (59) hide show
  1. package/.commitlintrc +5 -0
  2. package/.editorconfig +6 -0
  3. package/.eslintrc +11 -0
  4. package/.github/ISSUE_TEMPLATE/component-issue-template.md +13 -0
  5. package/.github/ISSUE_TEMPLATE/tailwind-config-customisation-issue.md +11 -0
  6. package/.github/dependabot.yml +10 -0
  7. package/.github/workflows/check-linked-issues.yml +20 -0
  8. package/.github/workflows/ci.yml +31 -0
  9. package/.github/workflows/deploy-github-pages.yml +44 -0
  10. package/.github/workflows/notify-release.yml +19 -0
  11. package/.github/workflows/release.yml +29 -0
  12. package/.husky/commit-msg +4 -0
  13. package/.husky/pre-commit +4 -0
  14. package/.nvmrc +1 -0
  15. package/.prettierrc +6 -0
  16. package/.storybook/main.ts +34 -0
  17. package/.storybook/manager.ts +6 -0
  18. package/.storybook/preview.ts +21 -0
  19. package/.storybook/theme.ts +6 -0
  20. package/.svg-to-tsrc +18 -0
  21. package/README.md +32 -0
  22. package/dist/global.css +678 -0
  23. package/dist/global.css.map +1 -0
  24. package/dist/index.d.ts +137 -0
  25. package/dist/index.js +3537 -0
  26. package/dist/index.js.map +1 -0
  27. package/index.js +0 -0
  28. package/package.json +68 -0
  29. package/postcss.config.js +3 -0
  30. package/src/assets/build/check.icon.tsx +16 -0
  31. package/src/assets/build/minus.icon.tsx +14 -0
  32. package/src/assets/build/radioselected.icon.tsx +7 -0
  33. package/src/assets/index.ts +3 -0
  34. package/src/assets/svg-icons/check.svg +5 -0
  35. package/src/assets/svg-icons/minus.svg +5 -0
  36. package/src/assets/svg-icons/radio-selected.svg +5 -0
  37. package/src/colors.ts +164 -0
  38. package/src/components/Button/index.tsx +72 -0
  39. package/src/components/Checkbox/index.tsx +32 -0
  40. package/src/components/Label/index.tsx +26 -0
  41. package/src/components/Radio/RadioGroup.tsx +20 -0
  42. package/src/components/Radio/RadioGroupItem.tsx +26 -0
  43. package/src/components/Radio/index.tsx +2 -0
  44. package/src/global.css +4 -0
  45. package/src/index.ts +2 -0
  46. package/src/lib/utils.ts +6 -0
  47. package/stories/Button/Button.stories.tsx +74 -0
  48. package/stories/Checkbox/CheckBox.example.tsx +16 -0
  49. package/stories/Checkbox/Checkbox.stories.ts +42 -0
  50. package/stories/Colors.mdx +49 -0
  51. package/stories/Label/Label.example.tsx +20 -0
  52. package/stories/Label/Label.stories.ts +27 -0
  53. package/stories/Radio/Radio.example.tsx +39 -0
  54. package/stories/Radio/Radio.stories.ts +32 -0
  55. package/stories/global.css +6 -0
  56. package/stories/tailwind.config.js +5 -0
  57. package/tailwind.config.js +47 -0
  58. package/tsconfig.json +14 -0
  59. package/tsup.config.ts +8 -0
package/.commitlintrc ADDED
@@ -0,0 +1,5 @@
1
+ {
2
+ "extends": [
3
+ "@commitlint/config-conventional"
4
+ ]
5
+ }
package/.editorconfig ADDED
@@ -0,0 +1,6 @@
1
+ [*]
2
+ end_of_line = lf
3
+ insert_final_newline = true
4
+ charset = utf-8
5
+ indent_style = space
6
+ indent_size = 2
package/.eslintrc ADDED
@@ -0,0 +1,11 @@
1
+ {
2
+ "extends": ["eslint:recommended", "plugin:prettier/recommended"],
3
+ "env": {
4
+ "node": true,
5
+ "es2021": true
6
+ },
7
+ "parserOptions": {
8
+ "ecmaVersion": 2022,
9
+ "sourceType": "module"
10
+ }
11
+ }
@@ -0,0 +1,13 @@
1
+ ---
2
+ name: Component Issue Template
3
+ about: Issue template for creating a new component for the library
4
+ title: "[Component] - Name"
5
+ labels: enhancement
6
+ assignees: ''
7
+
8
+ ---
9
+
10
+ - [ ] Create component
11
+ - [ ] Create Storybook demo
12
+ - [ ] Write Storybook docs
13
+ - [ ] Implement dark mode
@@ -0,0 +1,11 @@
1
+ ---
2
+ name: Tailwind Config Customisation Issue
3
+ about: Issue template for making a Tailwind customisation
4
+ title: ''
5
+ labels: ''
6
+ assignees: ''
7
+
8
+ ---
9
+
10
+ - [ ] Change the config
11
+ - [ ] Document the change in Storybook
@@ -0,0 +1,10 @@
1
+ version: 2
2
+ updates:
3
+ - package-ecosystem: npm
4
+ directory: /
5
+ schedule:
6
+ interval: weekly
7
+ - package-ecosystem: github-actions
8
+ directory: /
9
+ schedule:
10
+ interval: weekly
@@ -0,0 +1,20 @@
1
+ name: Check linked issues
2
+ 'on':
3
+ pull_request_target:
4
+ types:
5
+ - opened
6
+ - edited
7
+ - reopened
8
+ - synchronize
9
+ jobs:
10
+ check_pull_requests:
11
+ runs-on: ubuntu-latest
12
+ name: Check linked issues
13
+ permissions:
14
+ issues: read
15
+ pull-requests: write
16
+ steps:
17
+ - uses: nearform-actions/github-action-check-linked-issues@v1
18
+ id: check-linked-issues
19
+ with:
20
+ exclude-branches: release/**, dependabot/**
@@ -0,0 +1,31 @@
1
+ name: Continuous Integration
2
+
3
+ on:
4
+ push:
5
+ branches:
6
+ - master
7
+ pull_request:
8
+
9
+ jobs:
10
+ test:
11
+ name: Lint and test
12
+ runs-on: ubuntu-latest
13
+ steps:
14
+ - uses: actions/checkout@v4
15
+ - uses: actions/setup-node@v4
16
+ with:
17
+ node-version-file: '.nvmrc'
18
+ - run: |
19
+ npm ci
20
+ npm run lint
21
+ npm test
22
+
23
+ automerge:
24
+ name: Merge dependabot's PRs
25
+ needs: test
26
+ runs-on: ubuntu-latest
27
+ permissions:
28
+ pull-requests: write
29
+ contents: write
30
+ steps:
31
+ - uses: fastify/github-action-merge-dependabot@v3
@@ -0,0 +1,44 @@
1
+ # Simple workflow for deploying static content to GitHub Pages
2
+ name: Deploy to GitHub Pages
3
+
4
+ on:
5
+ # Runs on pushes targeting the default branch
6
+ push:
7
+ branches: ["main"]
8
+
9
+ # Allows you to run this workflow manually from the Actions tab
10
+ workflow_dispatch:
11
+
12
+ # Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
13
+ permissions:
14
+ contents: read
15
+ pages: write
16
+ id-token: write
17
+
18
+ # Allow only one concurrent deployment, skipping runs queued between the run in-progress and latest queued.
19
+ # However, do NOT cancel in-progress runs as we want to allow these production deployments to complete.
20
+ concurrency:
21
+ group: "pages"
22
+ cancel-in-progress: false
23
+
24
+ jobs:
25
+ # Single deploy job since we're just deploying
26
+ deploy:
27
+ environment:
28
+ name: github-pages
29
+ url: ${{ steps.deployment.outputs.page_url }}
30
+ runs-on: ubuntu-latest
31
+ steps:
32
+ - name: Checkout
33
+ uses: actions/checkout@v4
34
+ - run: npm ci
35
+ - run: npm run build-storybook
36
+ - name: Setup Pages
37
+ uses: actions/configure-pages@v3
38
+ - name: Upload artifact
39
+ uses: actions/upload-pages-artifact@v2
40
+ with:
41
+ path: "./storybook-static"
42
+ - name: Deploy to GitHub Pages
43
+ id: deployment
44
+ uses: actions/deploy-pages@v2
@@ -0,0 +1,19 @@
1
+ name: Notify release
2
+ 'on':
3
+ workflow_dispatch:
4
+ schedule:
5
+ - cron: 30 8 * * *
6
+ release:
7
+ types:
8
+ - published
9
+ issues:
10
+ types:
11
+ - closed
12
+ jobs:
13
+ setup:
14
+ runs-on: ubuntu-latest
15
+ permissions:
16
+ issues: write
17
+ contents: read
18
+ steps:
19
+ - uses: nearform-actions/github-action-notify-release@v1
@@ -0,0 +1,29 @@
1
+ name: release
2
+ on:
3
+ workflow_dispatch:
4
+ inputs:
5
+ semver:
6
+ description: The semver to use
7
+ required: true
8
+ default: patch
9
+ type: choice
10
+ options:
11
+ - patch
12
+ - minor
13
+ - major
14
+ pull_request:
15
+ types: [closed]
16
+
17
+ jobs:
18
+ release:
19
+ runs-on: ubuntu-latest
20
+ permissions:
21
+ contents: write
22
+ issues: write
23
+ pull-requests: write
24
+ steps:
25
+ - uses: nearform-actions/optic-release-automation-action@v4
26
+ with:
27
+ semver: ${{ github.event.inputs.semver }}
28
+ commit-message: 'chore: release {version}'
29
+ build-command: npm ci
@@ -0,0 +1,4 @@
1
+ #!/usr/bin/env sh
2
+ . "$(dirname -- "$0")/_/husky.sh"
3
+
4
+ npx --no -- commitlint --edit $1
@@ -0,0 +1,4 @@
1
+ #!/usr/bin/env sh
2
+ . "$(dirname -- "$0")/_/husky.sh"
3
+
4
+ npx lint-staged
package/.nvmrc ADDED
@@ -0,0 +1 @@
1
+ lts/*
package/.prettierrc ADDED
@@ -0,0 +1,6 @@
1
+ {
2
+ "semi": false,
3
+ "singleQuote": true,
4
+ "arrowParens": "avoid",
5
+ "trailingComma": "none"
6
+ }
@@ -0,0 +1,34 @@
1
+ import path from 'path'
2
+ import type { StorybookConfig } from '@storybook/react-vite'
3
+ const config: StorybookConfig = {
4
+ stories: [
5
+ '../stories/**/*.mdx',
6
+ '../src/**/*.jsx',
7
+ '../stories/**/*.stories.@(js|jsx|mjs|ts|tsx)'
8
+ ],
9
+
10
+ addons: [
11
+ '@storybook/addon-links',
12
+ '@storybook/addon-essentials',
13
+ '@storybook/addon-interactions',
14
+ 'storybook-tailwind-dark-mode'
15
+ ],
16
+ framework: {
17
+ name: '@storybook/react-vite',
18
+ options: {}
19
+ },
20
+ docs: {
21
+ autodocs: 'tag'
22
+ },
23
+ async viteFinal(config) {
24
+ if (config && config.resolve) {
25
+ config.resolve.alias = {
26
+ ...config.resolve.alias,
27
+ '@': path.join(__dirname, '../src')
28
+ }
29
+ }
30
+
31
+ return config
32
+ }
33
+ }
34
+ export default config
@@ -0,0 +1,6 @@
1
+ import { addons } from '@storybook/manager-api';
2
+ import theme from './theme';
3
+
4
+ addons.setConfig({
5
+ theme,
6
+ });
@@ -0,0 +1,21 @@
1
+ import type { Preview } from '@storybook/react'
2
+ import '../stories/global.css'
3
+
4
+ const preview: Preview = {
5
+ globalTypes: {
6
+ darkMode: {
7
+ defaultValue: false
8
+ }
9
+ },
10
+ parameters: {
11
+ actions: { argTypesRegex: '^on[A-Z].*' },
12
+ controls: {
13
+ matchers: {
14
+ color: /(background|color)$/i,
15
+ date: /Date$/i
16
+ }
17
+ }
18
+ }
19
+ }
20
+
21
+ export default preview
@@ -0,0 +1,6 @@
1
+ import { create } from '@storybook/theming/create';
2
+
3
+ export default create({
4
+ base: 'light',
5
+ brandTitle: 'NearForm Quantum'
6
+ });
package/.svg-to-tsrc ADDED
@@ -0,0 +1,18 @@
1
+ {
2
+ "srcFiles": [
3
+ "./src/assets/svg-icons/*.svg"
4
+ ],
5
+ "tsx": true,
6
+ "objectName": "Icons",
7
+ "outputDirectory": "./src/assets/",
8
+ "interfaceName": "Icons",
9
+ "typeName": "Icons",
10
+ "prefix": "",
11
+ "fileName": "index",
12
+ "svgoConfig": {
13
+ "plugins": [
14
+ "cleanupAttrs"
15
+ ]
16
+ },
17
+ "compileSources": true
18
+ }
package/README.md ADDED
@@ -0,0 +1,32 @@
1
+ # Quantum Component Library
2
+
3
+ ![CI](https://github.com/nearform/quantum/actions/workflows/ci.yml/badge.svg?event=push) [![Figma](https://img.shields.io/badge/figma-designs-f24e1e?logo=figma)](https://www.figma.com/file/XFbhstkgQFz8ZefAU3w2p4/1.-Quantum-Design-System?type=design&node-id=1-5&mode=design&t=Zjds6CFL8asuPc4a-0)
4
+
5
+ > A React component library based on the Quantum Design System
6
+
7
+ ## Installation
8
+
9
+ ```
10
+ npm install --save @nearform/quantum
11
+ ```
12
+
13
+ ## Configuration
14
+
15
+ #### With Tailwind
16
+
17
+ ```js
18
+ // tailwind.config.js
19
+
20
+ module.exports = {
21
+ content: [
22
+ "./node_modules/@nearform/quantum/**/*.js"
23
+ ]
24
+ };
25
+ ```
26
+
27
+ #### Without Tailwind
28
+
29
+ ```js
30
+ import '@nearform/quantum/dist/library.css';
31
+ import { Navbar } from '@nearform/quantum';
32
+ ```