@nearform/quantum 0.0.1 → 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 (56) hide show
  1. package/dist/index.d.ts +13 -1
  2. package/dist/index.js +142 -8
  3. package/dist/index.js.map +1 -1
  4. package/package.json +5 -1
  5. package/.commitlintrc +0 -5
  6. package/.editorconfig +0 -6
  7. package/.eslintrc +0 -11
  8. package/.github/ISSUE_TEMPLATE/component-issue-template.md +0 -13
  9. package/.github/ISSUE_TEMPLATE/tailwind-config-customisation-issue.md +0 -11
  10. package/.github/dependabot.yml +0 -10
  11. package/.github/workflows/check-linked-issues.yml +0 -20
  12. package/.github/workflows/ci.yml +0 -31
  13. package/.github/workflows/deploy-github-pages.yml +0 -44
  14. package/.github/workflows/notify-release.yml +0 -19
  15. package/.github/workflows/release.yml +0 -29
  16. package/.husky/commit-msg +0 -4
  17. package/.husky/pre-commit +0 -4
  18. package/.nvmrc +0 -1
  19. package/.prettierrc +0 -6
  20. package/.storybook/main.ts +0 -34
  21. package/.storybook/manager.ts +0 -6
  22. package/.storybook/preview.ts +0 -21
  23. package/.storybook/theme.ts +0 -6
  24. package/.svg-to-tsrc +0 -18
  25. package/index.js +0 -0
  26. package/postcss.config.js +0 -3
  27. package/src/assets/build/check.icon.tsx +0 -16
  28. package/src/assets/build/minus.icon.tsx +0 -14
  29. package/src/assets/build/radioselected.icon.tsx +0 -7
  30. package/src/assets/index.ts +0 -3
  31. package/src/assets/svg-icons/check.svg +0 -5
  32. package/src/assets/svg-icons/minus.svg +0 -5
  33. package/src/assets/svg-icons/radio-selected.svg +0 -5
  34. package/src/colors.ts +0 -164
  35. package/src/components/Button/index.tsx +0 -72
  36. package/src/components/Checkbox/index.tsx +0 -32
  37. package/src/components/Label/index.tsx +0 -26
  38. package/src/components/Radio/RadioGroup.tsx +0 -20
  39. package/src/components/Radio/RadioGroupItem.tsx +0 -26
  40. package/src/components/Radio/index.tsx +0 -2
  41. package/src/global.css +0 -4
  42. package/src/index.ts +0 -2
  43. package/src/lib/utils.ts +0 -6
  44. package/stories/Button/Button.stories.tsx +0 -74
  45. package/stories/Checkbox/CheckBox.example.tsx +0 -16
  46. package/stories/Checkbox/Checkbox.stories.ts +0 -42
  47. package/stories/Colors.mdx +0 -49
  48. package/stories/Label/Label.example.tsx +0 -20
  49. package/stories/Label/Label.stories.ts +0 -27
  50. package/stories/Radio/Radio.example.tsx +0 -39
  51. package/stories/Radio/Radio.stories.ts +0 -32
  52. package/stories/global.css +0 -6
  53. package/stories/tailwind.config.js +0 -5
  54. package/tailwind.config.js +0 -47
  55. package/tsconfig.json +0 -14
  56. 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.1",
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 }