@nearform/quantum 0.0.2 → 0.0.3

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 (53) hide show
  1. package/package.json +5 -1
  2. package/.commitlintrc +0 -5
  3. package/.editorconfig +0 -6
  4. package/.eslintrc +0 -11
  5. package/.github/ISSUE_TEMPLATE/component-issue-template.md +0 -13
  6. package/.github/ISSUE_TEMPLATE/tailwind-config-customisation-issue.md +0 -11
  7. package/.github/dependabot.yml +0 -10
  8. package/.github/workflows/check-linked-issues.yml +0 -20
  9. package/.github/workflows/ci.yml +0 -31
  10. package/.github/workflows/deploy-github-pages.yml +0 -44
  11. package/.github/workflows/notify-release.yml +0 -19
  12. package/.github/workflows/release.yml +0 -29
  13. package/.husky/commit-msg +0 -4
  14. package/.husky/pre-commit +0 -4
  15. package/.nvmrc +0 -1
  16. package/.prettierrc +0 -6
  17. package/.storybook/main.ts +0 -34
  18. package/.storybook/manager.ts +0 -6
  19. package/.storybook/preview.ts +0 -21
  20. package/.storybook/theme.ts +0 -6
  21. package/.svg-to-tsrc +0 -18
  22. package/index.js +0 -0
  23. package/postcss.config.js +0 -3
  24. package/src/assets/build/check.icon.tsx +0 -16
  25. package/src/assets/build/minus.icon.tsx +0 -14
  26. package/src/assets/build/radioselected.icon.tsx +0 -7
  27. package/src/assets/index.ts +0 -3
  28. package/src/assets/svg-icons/check.svg +0 -5
  29. package/src/assets/svg-icons/minus.svg +0 -5
  30. package/src/assets/svg-icons/radio-selected.svg +0 -5
  31. package/src/colors.ts +0 -164
  32. package/src/components/Button/index.tsx +0 -72
  33. package/src/components/Checkbox/index.tsx +0 -32
  34. package/src/components/Label/index.tsx +0 -26
  35. package/src/components/Radio/RadioGroup.tsx +0 -20
  36. package/src/components/Radio/RadioGroupItem.tsx +0 -26
  37. package/src/components/Radio/index.tsx +0 -2
  38. package/src/global.css +0 -4
  39. package/src/index.ts +0 -5
  40. package/src/lib/utils.ts +0 -6
  41. package/stories/Button/Button.stories.tsx +0 -74
  42. package/stories/Checkbox/CheckBox.example.tsx +0 -16
  43. package/stories/Checkbox/Checkbox.stories.ts +0 -42
  44. package/stories/Colors.mdx +0 -49
  45. package/stories/Label/Label.example.tsx +0 -20
  46. package/stories/Label/Label.stories.ts +0 -27
  47. package/stories/Radio/Radio.example.tsx +0 -39
  48. package/stories/Radio/Radio.stories.ts +0 -32
  49. package/stories/global.css +0 -6
  50. package/stories/tailwind.config.js +0 -5
  51. package/tailwind.config.js +0 -47
  52. package/tsconfig.json +0 -14
  53. package/tsup.config.ts +0 -8
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nearform/quantum",
3
- "version": "0.0.2",
3
+ "version": "0.0.3",
4
4
  "description": "Component library based on the Quantum Design System",
5
5
  "main": "dist/index.js",
6
6
  "scripts": {
@@ -11,6 +11,10 @@
11
11
  "storybook": "storybook dev -p 6006",
12
12
  "build-storybook": "storybook build"
13
13
  },
14
+ "files": [
15
+ "dist/",
16
+ "README.md"
17
+ ],
14
18
  "repository": {
15
19
  "type": "git",
16
20
  "url": "git+https://github.com/nearform/quantum.git"
package/.commitlintrc DELETED
@@ -1,5 +0,0 @@
1
- {
2
- "extends": [
3
- "@commitlint/config-conventional"
4
- ]
5
- }
package/.editorconfig DELETED
@@ -1,6 +0,0 @@
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 DELETED
@@ -1,11 +0,0 @@
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
- }
@@ -1,13 +0,0 @@
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
@@ -1,11 +0,0 @@
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
@@ -1,10 +0,0 @@
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
@@ -1,20 +0,0 @@
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/**
@@ -1,31 +0,0 @@
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
@@ -1,44 +0,0 @@
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
@@ -1,19 +0,0 @@
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
@@ -1,29 +0,0 @@
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
package/.husky/commit-msg DELETED
@@ -1,4 +0,0 @@
1
- #!/usr/bin/env sh
2
- . "$(dirname -- "$0")/_/husky.sh"
3
-
4
- npx --no -- commitlint --edit $1
package/.husky/pre-commit DELETED
@@ -1,4 +0,0 @@
1
- #!/usr/bin/env sh
2
- . "$(dirname -- "$0")/_/husky.sh"
3
-
4
- npx lint-staged
package/.nvmrc DELETED
@@ -1 +0,0 @@
1
- lts/*
package/.prettierrc DELETED
@@ -1,6 +0,0 @@
1
- {
2
- "semi": false,
3
- "singleQuote": true,
4
- "arrowParens": "avoid",
5
- "trailingComma": "none"
6
- }
@@ -1,34 +0,0 @@
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
@@ -1,6 +0,0 @@
1
- import { addons } from '@storybook/manager-api';
2
- import theme from './theme';
3
-
4
- addons.setConfig({
5
- theme,
6
- });
@@ -1,21 +0,0 @@
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
@@ -1,6 +0,0 @@
1
- import { create } from '@storybook/theming/create';
2
-
3
- export default create({
4
- base: 'light',
5
- brandTitle: 'NearForm Quantum'
6
- });
package/.svg-to-tsrc DELETED
@@ -1,18 +0,0 @@
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/index.js DELETED
File without changes
package/postcss.config.js DELETED
@@ -1,3 +0,0 @@
1
- module.exports = {
2
- plugins: [require('tailwindcss')(), require('autoprefixer')()]
3
- }
@@ -1,16 +0,0 @@
1
- /* 🤖 this file was generated by svg-to-ts */
2
- export const Check = (props: any) => (
3
- <svg
4
- viewBox="0 0 24 24"
5
- fill="none"
6
- xmlns="http://www.w3.org/2000/svg"
7
- {...props}
8
- >
9
- <g id="check">
10
- <path
11
- id="Vector"
12
- d="M9.72648 17.5L9.72217 17.5C9.60611 17.5005 9.4852 17.4519 9.38785 17.3489L4.66647 12.3507C4.66633 12.3506 4.6662 12.3504 4.66607 12.3503C4.6169 12.2978 4.57557 12.233 4.54633 12.1585L4.08221 12.3408L4.54633 12.1585C4.517 12.0838 4.50096 12.0022 4.50004 11.9186C4.49817 11.748 4.55898 11.5911 4.65755 11.481C4.75482 11.3723 4.87789 11.3197 4.99627 11.3182C5.11455 11.3166 5.23805 11.3658 5.33701 11.4712L5.33813 11.4724L9.36492 15.7335L9.72855 16.1183L10.0919 15.7333L18.6614 6.65376L18.662 6.65306C18.7612 6.54761 18.8849 6.4984 19.0033 6.50004C19.1219 6.50168 19.2451 6.55443 19.3425 6.66337C19.4412 6.77376 19.5019 6.93091 19.5 7.10171C19.498 7.27229 19.4337 7.42694 19.3334 7.53385C19.3333 7.53398 19.3332 7.5341 19.3331 7.53423L10.0608 17.3489C9.96345 17.4519 9.84254 17.5005 9.72648 17.5Z"
13
- />
14
- </g>
15
- </svg>
16
- )
@@ -1,14 +0,0 @@
1
- /* 🤖 this file was generated by svg-to-ts */
2
- export const Minus = (props: any) => (
3
- <svg viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg" {...props}>
4
- <g id="minus">
5
- <path
6
- id="Vector"
7
- d="M19 12L5 12"
8
- strokeWidth="inherit"
9
- strokeLinecap="round"
10
- strokeLinejoin="round"
11
- />
12
- </g>
13
- </svg>
14
- )
@@ -1,7 +0,0 @@
1
- export const RadioSelected = (props: any) => (
2
- <svg xmlns="http://www.w3.org/2000/svg" {...props} viewBox="0 0 20 20">
3
- <g id="State=Selected">
4
- <circle id="Ellipse 1" cx={10} cy={10} r={4} />
5
- </g>
6
- </svg>
7
- )
@@ -1,3 +0,0 @@
1
- export * from './build/check.icon'
2
- export * from './build/minus.icon'
3
- export * from './build/radioselected.icon'
@@ -1,5 +0,0 @@
1
- <svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
2
- <g id="check">
3
- <path id="Vector" d="M9.72648 17.5L9.72217 17.5C9.60611 17.5005 9.4852 17.4519 9.38785 17.3489L4.66647 12.3507C4.66633 12.3506 4.6662 12.3504 4.66607 12.3503C4.6169 12.2978 4.57557 12.233 4.54633 12.1585L4.08221 12.3408L4.54633 12.1585C4.517 12.0838 4.50096 12.0022 4.50004 11.9186C4.49817 11.748 4.55898 11.5911 4.65755 11.481C4.75482 11.3723 4.87789 11.3197 4.99627 11.3182C5.11455 11.3166 5.23805 11.3658 5.33701 11.4712L5.33813 11.4724L9.36492 15.7335L9.72855 16.1183L10.0919 15.7333L18.6614 6.65376L18.662 6.65306C18.7612 6.54761 18.8849 6.4984 19.0033 6.50004C19.1219 6.50168 19.2451 6.55443 19.3425 6.66337C19.4412 6.77376 19.5019 6.93091 19.5 7.10171C19.498 7.27229 19.4337 7.42694 19.3334 7.53385C19.3333 7.53398 19.3332 7.5341 19.3331 7.53423L10.0608 17.3489C9.96345 17.4519 9.84254 17.5005 9.72648 17.5Z" fill="#111928" stroke="#111928"/>
4
- </g>
5
- </svg>
@@ -1,5 +0,0 @@
1
- <svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
2
- <g id="minus">
3
- <path id="Vector" d="M19 12L5 12" stroke="#111928" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>
4
- </g>
5
- </svg>
@@ -1,5 +0,0 @@
1
- <svg width="20" height="20" viewBox="0 0 20 20" fill="none" xmlns="http://www.w3.org/2000/svg">
2
- <g id="State=Selected">
3
- <circle id="Ellipse 1" cx="10" cy="10" r="4" fill="white"/>
4
- </g>
5
- </svg>
package/src/colors.ts DELETED
@@ -1,164 +0,0 @@
1
- export const colors = {
2
- grey: {
3
- 50: '#F9FAFB',
4
- 100: '#F3F4F6',
5
- 200: '#E5E7EB',
6
- 300: '#D1D5DB',
7
- 400: '#9CA3AF',
8
- 500: '#6B7280',
9
- 600: '#4B5563',
10
- 700: '#374151',
11
- 800: '#1F2A37',
12
- 900: '#111928'
13
- },
14
- blue: {
15
- 50: '#F5FAFF',
16
- 100: '#E1EFFE',
17
- 200: '#C3DDFD',
18
- 300: '#A4CAFE',
19
- 400: '#76A9FA',
20
- 500: '#3F83F8',
21
- 600: '#2165E3',
22
- 700: '#1A56DB',
23
- 800: '#1E429F',
24
- 900: '#233876'
25
- },
26
- red: {
27
- 50: '#FDF2F2',
28
- 100: '#FDE8E8',
29
- 200: '#FBD5D5',
30
- 300: '#F8B4B4',
31
- 400: '#F98080',
32
- 500: '#F05252',
33
- 600: '#E02424',
34
- 700: '#C81E1E',
35
- 800: '#9B1C1C',
36
- 900: '#771D1D'
37
- },
38
- orange: {
39
- 50: '#FFF8F1',
40
- 100: '#FEECDC',
41
- 200: '#FCD9BD',
42
- 300: '#FDBA8C',
43
- 400: '#FF8A4C',
44
- 500: '#FF5A1F',
45
- 600: '#D03801',
46
- 700: '#B43403',
47
- 800: '#8A2C0D',
48
- 900: '#771D1D'
49
- },
50
- yellow: {
51
- 50: '#FDFDEA',
52
- 100: '#FDF6B2',
53
- 200: '#FCE96A',
54
- 300: '#FACA15',
55
- 400: '#E3A008',
56
- 500: '#C27803',
57
- 600: '#9F580A',
58
- 700: '#8E4B10',
59
- 800: '#723B13',
60
- 900: '#633112'
61
- },
62
- green: {
63
- 50: '#F3FAF7',
64
- 100: '#DEF7EC',
65
- 200: '#BCF0DA',
66
- 300: '#84E1BC',
67
- 400: '#31C48D',
68
- 500: '#0E9F6E',
69
- 600: '#057A55',
70
- 700: '#046C4E',
71
- 800: '#03543F',
72
- 900: '#014737'
73
- },
74
- teal: {
75
- 50: '#EDFAFA',
76
- 100: '#D5F5F6',
77
- 200: '#AFECEF',
78
- 300: '#7EDCE2',
79
- 400: '#16BDCA',
80
- 500: '#0694A2',
81
- 600: '#047481',
82
- 700: '#036672',
83
- 800: '#05505C',
84
- 900: '#014451'
85
- },
86
- indigo: {
87
- 50: '#F0F5FF',
88
- 100: '#E5EDFF',
89
- 200: '#CDDBFE',
90
- 300: '#B4C6FC',
91
- 400: '#8DA2FB',
92
- 500: '#6875F5',
93
- 600: '#5850EC',
94
- 700: '#5145CD',
95
- 800: '#42389D',
96
- 900: '#362F78'
97
- },
98
- purple: {
99
- 50: '#F6F5FF',
100
- 100: '#EDEBFE',
101
- 200: '#DCD7FE',
102
- 300: '#CABFFD',
103
- 400: '#AC94FA',
104
- 500: '#9061F9',
105
- 600: '#7E3AF2',
106
- 700: '#6C2BD9',
107
- 800: '#5521B5',
108
- 900: '#4A1D96'
109
- },
110
- pink: {
111
- 50: '#FFF6F9',
112
- 100: '#FFF1F5',
113
- 200: '#FFE8EE',
114
- 300: '#FFD9E3',
115
- 400: '#FFBFD0',
116
- 500: '#FF9DB7',
117
- 600: '#FB7A9C',
118
- 700: '#D95477',
119
- 800: '#A02042',
120
- 900: '#731837'
121
- }
122
- };
123
-
124
- export default {
125
- transparent: 'transparent',
126
- current: 'currentColor',
127
- primary: colors.blue,
128
- secondary: colors.pink,
129
- foreground: {
130
- DEFAULT: colors.grey['900'],
131
- muted: colors.grey['500'],
132
- subtle: colors.grey['400'],
133
- inverse: '#FFF'
134
- },
135
- accent: {
136
- DEFAULT: colors.blue['700'],
137
- hover: colors.grey['900'],
138
- focus: '#000'
139
- },
140
- border: {
141
- DEFAULT: colors.grey['300'],
142
- hover: colors.grey['400'],
143
- subtle: colors.grey['200']
144
- },
145
- feedback: {
146
- green: colors.green['400'],
147
- yellow: colors.yellow['300'],
148
- orange: colors.orange['400'],
149
- red: colors.red['600']
150
- },
151
- button: {
152
- active: colors.blue['700'],
153
- hover: colors.grey['900'],
154
- focus: '#000',
155
- disabled: colors.purple['50']
156
- },
157
- white: {
158
- DEFAULT: '#fff'
159
- },
160
- black: {
161
- DEFAULT: '#000'
162
- },
163
- ...colors
164
- };
@@ -1,72 +0,0 @@
1
- import * as React from 'react'
2
- import { Slot } from '@radix-ui/react-slot'
3
- import { cva, type VariantProps } from 'class-variance-authority'
4
-
5
- import { cn } from '@/lib/utils'
6
-
7
- const buttonVariants = cva(
8
- 'inline-flex items-center justify-center whitespace-nowrap rounded-lg transition-colors focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:pointer-events-none border-2',
9
- {
10
- variants: {
11
- variant: {
12
- primary:
13
- 'bg-button-active border-button-active text-white ' +
14
- 'hover:bg-button-hover hover:border-button-hover ' +
15
- 'focus:bg-button-focus focus:border-button-focus ' +
16
- 'disabled:bg-button-disabled disabled:text-foreground-subtle disabled:border-button-disabled',
17
- secondary:
18
- 'bg-white text-grey-900 border-border ' +
19
- 'hover:bg-button-disabled hover:border-border ' +
20
- 'focus:bg-primary-50 focus:border-foreground-muted ' +
21
- 'disabled:bg-button-disabled disabled:border-border-subtle disabled:text-foreground-subtle',
22
- tertiary:
23
- 'bg-transparent border-transparent text-foreground ' +
24
- 'hover:bg-purple-50 hover:border-purple-50 ' +
25
- 'focus:bg-blue-50 focus:border-blue-50 ' +
26
- 'disabled:text-foreground-subtle',
27
- success:
28
- 'bg-green-400 border-green-400 text-black ' +
29
- 'hover:bg-green-500 hover:border-green-500 ' +
30
- 'focus:bg-green-600 focus:border-green-600 ' +
31
- 'disabled:bg-button-disabled disabled:border-button-disabled disabled:text-foreground-subtle',
32
- danger:
33
- 'bg-red-600 border-red-600 text-white ' +
34
- 'hover:bg-red-700 hover:border-red-700 ' +
35
- 'focus:bg-red-800 focus:border-red-800 ' +
36
- 'disabled:bg-button-disabled disabled:border-button-disabled disabled:text-foreground-subtle',
37
- },
38
- size: {
39
- lg: 'px-4 py-3 text-base',
40
- md: 'p-2.5 text-sm',
41
- sm: 'px-2.5 py-2 text-sm',
42
- xs: 'px-2 py-2.5 text-xs',
43
- }
44
- },
45
- defaultVariants: {
46
- variant: 'primary',
47
- size: 'md'
48
- }
49
- }
50
- )
51
-
52
- export interface ButtonProps
53
- extends React.ButtonHTMLAttributes<HTMLButtonElement>,
54
- VariantProps<typeof buttonVariants> {
55
- asChild?: boolean
56
- }
57
-
58
- const Button = React.forwardRef<HTMLButtonElement, ButtonProps>(
59
- ({ className, variant, size, asChild = false, ...props }, ref) => {
60
- const Comp = asChild ? Slot : 'button'
61
- return (
62
- <Comp
63
- className={cn(buttonVariants({ variant, size, className }))}
64
- ref={ref}
65
- {...props}
66
- />
67
- )
68
- }
69
- )
70
- Button.displayName = 'Button'
71
-
72
- export { Button, buttonVariants }
@@ -1,32 +0,0 @@
1
- import * as React from 'react'
2
- import * as CheckboxPrimitive from '@radix-ui/react-checkbox'
3
- import { cn } from '@/lib/utils'
4
- import { Check, Minus } from '@/assets/index'
5
-
6
- const Checkbox = React.forwardRef<
7
- React.ElementRef<typeof CheckboxPrimitive.Root>,
8
- React.ComponentPropsWithoutRef<typeof CheckboxPrimitive.Root>
9
- >(({ className, ...props }, ref) => (
10
- <CheckboxPrimitive.Root
11
- ref={ref}
12
- className={cn(
13
- 'peer h-5 w-5 p-0.5 shrink-0 gap-0 rounded border border-border-default data-[state=checked]:border-blue-600 data-[state=checked]:bg-blue-600 data-[state=checked]:text-foreground-inverse data-[state=indeterminate]:border-blue-600 data-[state=indeterminate]:bg-blue-600 data-[state=indeterminate]:text-foreground-inverse',
14
- className
15
- )}
16
- {...props}
17
- >
18
- <CheckboxPrimitive.Indicator
19
- className={cn('flex items-center justify-center text-inherit')}
20
- >
21
- {(props.checked === true || props.checked === undefined) && (
22
- <Check className="text-inherit stroke-current stroke-1 fill-current" />
23
- )}
24
- {props.checked === 'indeterminate' && (
25
- <Minus className="text-inherit stroke-current stroke-3 fill-current" />
26
- )}
27
- </CheckboxPrimitive.Indicator>
28
- </CheckboxPrimitive.Root>
29
- ))
30
- Checkbox.displayName = CheckboxPrimitive.Root.displayName
31
-
32
- export { Checkbox }
@@ -1,26 +0,0 @@
1
- 'use client'
2
-
3
- import * as React from 'react'
4
- import * as LabelPrimitive from '@radix-ui/react-label'
5
- import type { LabelProps } from '@radix-ui/react-label'
6
- import { cva, type VariantProps } from 'class-variance-authority'
7
-
8
- import { cn } from '@/lib/utils'
9
-
10
- const labelVariants = cva(
11
- 'text-sm font-medium leading-normal peer-disabled:cursor-not-allowed peer-disabled:opacity-70 dark:text-foreground-inverse'
12
- )
13
- const Label = React.forwardRef<
14
- React.ElementRef<typeof LabelPrimitive.Root>,
15
- React.ComponentPropsWithoutRef<typeof LabelPrimitive.Root> &
16
- VariantProps<typeof labelVariants>
17
- >(({ className, ...props }, ref) => (
18
- <LabelPrimitive.Root
19
- ref={ref}
20
- className={cn(labelVariants(), className)}
21
- {...props}
22
- />
23
- ))
24
- Label.displayName = LabelPrimitive.Root.displayName
25
-
26
- export { Label, LabelProps }
@@ -1,20 +0,0 @@
1
- import * as React from 'react'
2
- import * as RadioGroupPrimitive from '@radix-ui/react-radio-group'
3
-
4
- import { cn } from '@/lib/utils'
5
-
6
- const RadioGroup = React.forwardRef<
7
- React.ElementRef<typeof RadioGroupPrimitive.Root>,
8
- React.ComponentPropsWithoutRef<typeof RadioGroupPrimitive.Root>
9
- >(({ className, ...props }, ref) => {
10
- return (
11
- <RadioGroupPrimitive.Root
12
- className={cn('grid gap-2', className)}
13
- {...props}
14
- ref={ref}
15
- />
16
- )
17
- })
18
- RadioGroup.displayName = RadioGroupPrimitive.Root.displayName
19
-
20
- export { RadioGroup }
@@ -1,26 +0,0 @@
1
- import * as React from 'react'
2
- import * as RadioGroupPrimitive from '@radix-ui/react-radio-group'
3
- import { cn } from '@/lib/utils'
4
- import { RadioSelected } from '@/assets'
5
- const RadioGroupItem = React.forwardRef<
6
- React.ElementRef<typeof RadioGroupPrimitive.Item>,
7
- React.ComponentPropsWithoutRef<typeof RadioGroupPrimitive.Item>
8
- >(({ className, children, ...props }, ref) => {
9
- return (
10
- <RadioGroupPrimitive.Item
11
- ref={ref}
12
- className={cn(
13
- 'h-5 w-5 rounded-full border-[0.67px] border-border-default bg-grey-50 disabled:opacity-50 data-[state=checked]:border-primary-600 data-[state=checked]:bg-primary-600 text-foreground-inverse',
14
- className
15
- )}
16
- {...props}
17
- >
18
- <RadioGroupPrimitive.Indicator className="flex items-center justify-center">
19
- <RadioSelected className="text-inherit stroke-current stroke-1 fill-current" />
20
- </RadioGroupPrimitive.Indicator>
21
- </RadioGroupPrimitive.Item>
22
- )
23
- })
24
- RadioGroupItem.displayName = RadioGroupPrimitive.Item.displayName
25
-
26
- export { RadioGroupItem as Radio }
@@ -1,2 +0,0 @@
1
- export { RadioGroup } from './RadioGroup'
2
- export { Radio } from './RadioGroupItem'
package/src/global.css DELETED
@@ -1,4 +0,0 @@
1
- @import url('https://fonts.googleapis.com/css2?family=Inter&display=swap');
2
- @tailwind base;
3
- @tailwind components;
4
- @tailwind utilities;
package/src/index.ts DELETED
@@ -1,5 +0,0 @@
1
- export { colors } from './colors'
2
- export * from './components/Button'
3
- export * from './components/Checkbox'
4
- export * from './components/Label'
5
- export * from './components/Radio'
package/src/lib/utils.ts DELETED
@@ -1,6 +0,0 @@
1
- import { clsx, type ClassValue } from 'clsx'
2
- import { twMerge } from 'tailwind-merge'
3
-
4
- export function cn(...inputs: ClassValue[]) {
5
- return twMerge(clsx(inputs))
6
- }
@@ -1,74 +0,0 @@
1
- import type { Meta, StoryObj } from '@storybook/react'
2
- import { Button } from '@/components/Button'
3
-
4
- // More on how to set up stories at: https://storybook.js.org/docs/react/writing-stories/introduction#default-export
5
- const meta = {
6
- title: 'Components/Button',
7
- component: Button,
8
- parameters: {
9
- // Optional parameter to center the component in the Canvas. More info: https://storybook.js.org/docs/react/configure/story-layout
10
- layout: 'centered',
11
- controls: {
12
- hideNoControlsWarning: true
13
- }
14
- },
15
- args: {
16
- children: 'Button Text',
17
- size: 'md',
18
- },
19
- argTypes: {
20
- variant: {
21
- control: 'radio',
22
- options: ['primary', 'secondary', 'tertiary', 'success', 'danger']
23
- },
24
- size: {
25
- control: 'radio',
26
- options: ['xs', 'sm', 'md', 'lg']
27
- },
28
- disabled: {
29
- control: 'boolean'
30
- },
31
- asChild: {
32
- table: {
33
- disable: true
34
- }
35
- }
36
- },
37
- // This component will have an automatically generated Autodocs entry: https://storybook.js.org/docs/react/writing-docs/autodocs
38
- tags: ['autodocs']
39
- // More on argTypes: https://storybook.js.org/docs/react/api/argtypes
40
- } satisfies Meta<typeof Button>
41
-
42
- export default meta
43
- type Story = StoryObj<typeof meta>
44
-
45
- // More on writing stories with args: https://storybook.js.org/docs/react/writing-stories/args
46
- export const Primary: Story = {
47
- args: {
48
- variant: 'primary',
49
- },
50
- }
51
-
52
- export const Secondary: Story = {
53
- args: {
54
- variant: 'secondary',
55
- },
56
- }
57
-
58
- export const Tertiary: Story = {
59
- args: {
60
- variant: 'tertiary',
61
- },
62
- }
63
-
64
- export const Success: Story = {
65
- args: {
66
- variant: 'success',
67
- },
68
- }
69
-
70
- export const Danger: Story = {
71
- args: {
72
- variant: 'danger',
73
- },
74
- }
@@ -1,16 +0,0 @@
1
- import { Checkbox } from '@/components/Checkbox'
2
- import { CheckboxProps } from '@radix-ui/react-checkbox'
3
- import { useState } from 'react'
4
- export const CheckboxDemo = ({
5
- checked
6
- }: {
7
- checked: CheckboxProps['checked']
8
- }): JSX.Element => {
9
- const [check, setCheck] = useState<typeof checked>(checked)
10
- const handleOnCheckChanged = () => {
11
- if (check !== 'indeterminate') {
12
- setCheck(!check)
13
- }
14
- }
15
- return <Checkbox checked={check} onCheckedChange={handleOnCheckChanged} />
16
- }
@@ -1,42 +0,0 @@
1
- import type { Meta, StoryObj } from '@storybook/react'
2
-
3
- import { CheckboxDemo } from './CheckBox.example'
4
-
5
- // More on how to set up stories at: https://storybook.js.org/docs/react/writing-stories/introduction#default-export
6
- const meta = {
7
- title: 'Components/Checkbox',
8
- component: CheckboxDemo,
9
- parameters: {
10
- // Optional parameter to center the component in the Canvas. More info: https://storybook.js.org/docs/react/configure/story-layout
11
- layout: 'centered'
12
- },
13
- // This component will have an automatically generated Autodocs entry: https://storybook.js.org/docs/react/writing-docs/autodocs
14
- tags: ['autodocs'],
15
- argTypes: {
16
- checked: {
17
- options: [true, false, 'indeterminate'],
18
- control: { type: 'radio' }
19
- }
20
- }
21
- // More on argTypes: https://storybook.js.org/docs/react/api/argtypes
22
- } satisfies Meta<typeof CheckboxDemo>
23
-
24
- export default meta
25
- type Story = StoryObj<typeof meta>
26
-
27
- // More on writing stories with args: https://storybook.js.org/docs/react/writing-stories/args
28
- export const CheckBoxUnchecked: Story = {
29
- args: {
30
- checked: false
31
- }
32
- }
33
- export const CheckBoxChecked: Story = {
34
- args: {
35
- checked: true
36
- }
37
- }
38
- export const CheckBoxIndeterminate: Story = {
39
- args: {
40
- checked: 'indeterminate'
41
- }
42
- }
@@ -1,49 +0,0 @@
1
- import { Meta, ColorPalette, ColorItem } from '@storybook/blocks';
2
- import { colors, default as aliasColors } from '@/colors.ts';
3
-
4
- <Meta title="Colors" />
5
-
6
- # Colours
7
-
8
- Base colours provide a full colour spectrum of dark to light hues, and are used as aliases in the [brand theme](#brand-theme-and-ui-colours).
9
-
10
- ## Base Colours
11
- #
12
-
13
- <ColorPalette>
14
-
15
- {Object.keys(colors).map((token, index) => {
16
- const color = colors[token];
17
- return (
18
- <ColorItem
19
- key={index}
20
- index={index}
21
- title={`${token}`}
22
- colors={color}
23
- />
24
- );
25
- })}
26
-
27
- </ColorPalette>
28
-
29
- ## Brand Theme and UI Colours
30
- #
31
-
32
- <ColorPalette>
33
-
34
- {Object.keys(aliasColors).map((token, index) => {
35
- const color = aliasColors[token];
36
- if (typeof color === 'object' && !colors[token]) {
37
- return (
38
- <ColorItem
39
- key={index}
40
- index={index}
41
- title={`${token}`}
42
- colors={color}
43
- />
44
- )
45
- }
46
- })}
47
-
48
- </ColorPalette>
49
-
@@ -1,20 +0,0 @@
1
- import { Checkbox } from '@/components/Checkbox'
2
- import { Label, LabelProps } from '@/components/Label'
3
-
4
- interface LabelDemoProps extends LabelProps {
5
- labelText: string
6
- }
7
- const LabelDemo = (props: LabelDemoProps) => {
8
- return (
9
- <>
10
- <div className="space-x-2">
11
- <Label htmlFor={'checkbox'} className="dark:">
12
- {props.labelText}
13
- </Label>
14
- <Checkbox id="checkbox" />
15
- </div>
16
- </>
17
- )
18
- }
19
-
20
- export { LabelDemo }
@@ -1,27 +0,0 @@
1
- import type { Meta, StoryObj } from '@storybook/react'
2
-
3
- import { LabelDemo } from './Label.example'
4
-
5
- // More on how to set up stories at: https://storybook.js.org/docs/react/writing-stories/introduction#default-export
6
- const meta = {
7
- title: 'Components/Label',
8
- component: LabelDemo,
9
- parameters: {
10
- // Optional parameter to center the component in the Canvas. More info: https://storybook.js.org/docs/react/configure/story-layout
11
- layout: 'centered'
12
- },
13
- // This component will have an automatically generated Autodocs entry: https://storybook.js.org/docs/react/writing-docs/autodocs
14
- tags: ['autodocs']
15
- // More on argTypes: https://storybook.js.org/docs/react/api/argtypes
16
- } satisfies Meta<typeof LabelDemo>
17
-
18
- export default meta
19
- type Story = StoryObj<typeof meta>
20
-
21
- // More on writing stories with args: https://storybook.js.org/docs/react/writing-stories/args
22
- export const Default: Story = {
23
- args: {
24
- labelText: 'A Label with a Checkbox',
25
- htmlFor: 'checkbox'
26
- }
27
- }
@@ -1,39 +0,0 @@
1
- import { Label } from '@/components/Label'
2
- import { Radio, RadioGroup } from '@/components/Radio'
3
- import { useState } from 'react'
4
- export const RadioGroupDemo = ({
5
- defaultValue,
6
- disabled,
7
- loop
8
- }: {
9
- defaultValue?: string
10
- disabled?: boolean
11
- loop?: boolean
12
- }): JSX.Element => {
13
- const [value, setValue] = useState(defaultValue)
14
- const handleValueChange = (newValue: string) => {
15
- console.log(newValue)
16
- setValue(newValue)
17
- }
18
- return (
19
- <RadioGroup
20
- defaultValue={defaultValue}
21
- onValueChange={handleValueChange}
22
- disabled={disabled}
23
- loop={loop}
24
- >
25
- <RadioWithLabel value="hello" />
26
- <RadioWithLabel value="world" />
27
- <RadioWithLabel value="goodbye" />
28
- <RadioWithLabel value="friend" />
29
- </RadioGroup>
30
- )
31
- }
32
- const RadioWithLabel = ({ value }: { value: string }) => {
33
- return (
34
- <span className="flex items-center space-x-1">
35
- <Radio value={value} />
36
- <Label htmlFor={value}>{value}</Label>
37
- </span>
38
- )
39
- }
@@ -1,32 +0,0 @@
1
- import type { Meta, StoryObj } from '@storybook/react'
2
-
3
- import { RadioGroupDemo } from './Radio.example'
4
-
5
- // More on how to set up stories at: https://storybook.js.org/docs/react/writing-stories/introduction#default-export
6
- const meta = {
7
- title: 'Components/RadioGroup',
8
- component: RadioGroupDemo,
9
- parameters: {
10
- // Optional parameter to center the component in the Canvas. More info: https://storybook.js.org/docs/react/configure/story-layout
11
- layout: 'centered'
12
- },
13
- // This component will have an automatically generated Autodocs entry: https://storybook.js.org/docs/react/writing-docs/autodocs
14
- tags: ['autodocs']
15
- // More on argTypes: https://storybook.js.org/docs/react/api/argtypes
16
- } satisfies Meta<typeof RadioGroupDemo>
17
-
18
- export default meta
19
- type Story = StoryObj<typeof meta>
20
-
21
- // More on writing stories with args: https://storybook.js.org/docs/react/writing-stories/args
22
- export const NoDefault: Story = {}
23
- export const DefaultSet: Story = {
24
- args: {
25
- defaultValue: 'goodbye'
26
- }
27
- }
28
- export const RadioButtonDisabled: Story = {
29
- args: {
30
- disabled: true
31
- }
32
- }
@@ -1,6 +0,0 @@
1
- @import url('https://fonts.googleapis.com/css2?family=Inter&display=swap');
2
- @config "./tailwind.config.js";
3
-
4
- @tailwind base;
5
- @tailwind components;
6
- @tailwind utilities;
@@ -1,5 +0,0 @@
1
- const config = require('../tailwind.config')
2
-
3
- config.content.push('./stories/**/*.{tsx, ts}')
4
-
5
- module.exports = config
@@ -1,47 +0,0 @@
1
- /** @type {import('tailwindcss').Config} */
2
- import colors from './src/colors'
3
- import defaultTheme from 'tailwindcss/defaultTheme'
4
-
5
- module.exports = {
6
- content: ['./src/**/*.tsx'],
7
- darkMode: 'class',
8
- plugins: [],
9
- theme: {
10
- colors: colors,
11
- boxShadow: {
12
- sm: '0px 1px 2px 0px',
13
- DEFAULT: '0px 1px 2px -1px',
14
- md: '0px 2px 4px -2px',
15
- lg: '0px 4px 6px 0px',
16
- xl: '0px 20px 25px -5px',
17
- '2xl': '0px 25px 50px -12px',
18
- none: '0px 0px'
19
- },
20
- fontFamily: {
21
- sans: ['"Inter"', ...defaultTheme.fontFamily.sans]
22
- },
23
- strokeWidth: {
24
- 0: '0px',
25
- 1: '1px',
26
- 2: '2px',
27
- 3: '4px',
28
- 4: '6px'
29
- },
30
- extend: {
31
- keyframes: {
32
- 'accordion-down': {
33
- from: { height: '0' },
34
- to: { height: 'var(--radix-accordion-content-height)' }
35
- },
36
- 'accordion-up': {
37
- from: { height: 'var(--radix-accordion-content-height)' },
38
- to: { height: '0' }
39
- }
40
- },
41
- animation: {
42
- 'accordion-down': 'accordion-down 0.2s ease-out',
43
- 'accordion-up': 'accordion-up 0.2s ease-out'
44
- }
45
- }
46
- }
47
- }
package/tsconfig.json DELETED
@@ -1,14 +0,0 @@
1
- {
2
- "compilerOptions": {
3
- "target": "es2016" /* Set the JavaScript language version for emitted JavaScript and include compatible library declarations. */,
4
- "module": "commonjs" /* Specify what module code is generated. */,
5
- "esModuleInterop": true /* Emit additional JavaScript to ease support for importing CommonJS modules. This enables 'allowSyntheticDefaultImports' for type compatibility. */,
6
- "forceConsistentCasingInFileNames": true /* Ensure that casing is correct in imports. */,
7
- "strict": true /* Enable all strict type-checking options. */,
8
- "skipLibCheck": true /* Skip type checking all .d.ts files. */,
9
- "jsx": "react-jsx",
10
- "paths": {
11
- "@/*": ["./src/*"]
12
- }
13
- }
14
- }
package/tsup.config.ts DELETED
@@ -1,8 +0,0 @@
1
- import { defineConfig } from 'tsup'
2
-
3
- export default defineConfig({
4
- entry: ['src/index.ts', 'src/global.css'],
5
- dts: { entry: ['src/index.ts'] },
6
- clean: true,
7
- sourcemap: true
8
- })