@dashx/react 0.0.6 → 0.1.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.
- package/README.md +0 -70
- package/dist/cjs/components/button.d.ts +8 -0
- package/dist/cjs/components/button.js +2 -0
- package/dist/cjs/components/button.js.map +7 -0
- package/dist/cjs/components/card.d.ts +8 -0
- package/dist/cjs/components/card.js +2 -0
- package/dist/cjs/components/card.js.map +7 -0
- package/dist/cjs/components/flex.d.ts +210 -0
- package/dist/cjs/components/flex.js +2 -0
- package/dist/cjs/components/flex.js.map +7 -0
- package/dist/cjs/components/heading.d.ts +8 -0
- package/dist/cjs/components/heading.js +2 -0
- package/dist/cjs/components/heading.js.map +7 -0
- package/dist/cjs/components/icon-button.d.ts +3 -0
- package/dist/cjs/components/icon-button.js +2 -0
- package/dist/cjs/components/icon-button.js.map +7 -0
- package/dist/cjs/components/index.d.ts +11 -0
- package/dist/cjs/components/index.js +2 -0
- package/dist/cjs/components/index.js.map +7 -0
- package/dist/cjs/components/popover.d.ts +47 -0
- package/dist/cjs/components/popover.js +2 -0
- package/dist/cjs/components/popover.js.map +7 -0
- package/dist/cjs/components/text-field.d.ts +2 -0
- package/dist/cjs/components/text-field.js +2 -0
- package/dist/cjs/components/text-field.js.map +7 -0
- package/dist/cjs/components/text.d.ts +20 -0
- package/dist/cjs/components/text.js +2 -0
- package/dist/cjs/components/text.js.map +7 -0
- package/dist/cjs/components/theme.d.ts +17 -0
- package/dist/cjs/components/theme.js +2 -0
- package/dist/cjs/components/theme.js.map +7 -0
- package/dist/cjs/components/toast.d.ts +4 -0
- package/dist/cjs/components/toast.js +2 -0
- package/dist/cjs/components/toast.js.map +7 -0
- package/dist/cjs/components/tooltip.d.ts +13 -0
- package/dist/cjs/components/tooltip.js +2 -0
- package/dist/cjs/components/tooltip.js.map +7 -0
- package/dist/cjs/hooks/index.d.ts +2 -0
- package/dist/cjs/hooks/index.js +2 -0
- package/dist/cjs/hooks/index.js.map +7 -0
- package/dist/cjs/hooks/use-dashx-provider.d.ts +3 -0
- package/dist/cjs/hooks/use-dashx-provider.js +2 -0
- package/dist/cjs/hooks/use-dashx-provider.js.map +7 -0
- package/dist/cjs/hooks/use-in-app.d.ts +9 -0
- package/dist/cjs/hooks/use-in-app.js +2 -0
- package/dist/cjs/hooks/use-in-app.js.map +7 -0
- package/dist/cjs/icons/index.d.ts +1 -0
- package/dist/cjs/icons/index.js +2 -0
- package/dist/cjs/icons/index.js.map +7 -0
- package/dist/cjs/index.d.ts +3 -0
- package/dist/cjs/index.js +2 -0
- package/dist/cjs/index.js.map +7 -0
- package/dist/cjs/providers/DashXProvider.d.ts +6 -0
- package/dist/cjs/providers/DashXProvider.js +2 -0
- package/dist/cjs/providers/DashXProvider.js.map +7 -0
- package/dist/cjs/providers/index.d.ts +1 -0
- package/dist/cjs/providers/index.js +2 -0
- package/dist/cjs/providers/index.js.map +7 -0
- package/dist/cjs/tsconfig.tsbuildinfo +1 -0
- package/dist/cjs/utils/cn.d.ts +3 -0
- package/dist/cjs/utils/cn.js +2 -0
- package/dist/cjs/utils/cn.js.map +7 -0
- package/dist/cjs/variants/base-element.d.ts +58 -0
- package/dist/cjs/variants/base-element.js +2 -0
- package/dist/cjs/variants/base-element.js.map +7 -0
- package/dist/cjs/variants/button.d.ts +147 -0
- package/dist/cjs/variants/button.js +2 -0
- package/dist/cjs/variants/button.js.map +7 -0
- package/dist/cjs/variants/card.d.ts +117 -0
- package/dist/cjs/variants/card.js +2 -0
- package/dist/cjs/variants/card.js.map +7 -0
- package/dist/cjs/variants/heading.d.ts +377 -0
- package/dist/cjs/variants/heading.js +2 -0
- package/dist/cjs/variants/heading.js.map +7 -0
- package/dist/cjs/variants/index.d.ts +6 -0
- package/dist/cjs/variants/index.js +2 -0
- package/dist/cjs/variants/index.js.map +7 -0
- package/dist/cjs/variants/popover.d.ts +106 -0
- package/dist/cjs/variants/popover.js +2 -0
- package/dist/cjs/variants/popover.js.map +7 -0
- package/dist/cjs/variants/text-field.d.ts +93 -0
- package/dist/cjs/variants/text-field.js +2 -0
- package/dist/cjs/variants/text-field.js.map +7 -0
- package/dist/cjs/variants/text.d.ts +377 -0
- package/dist/cjs/variants/text.js +2 -0
- package/dist/cjs/variants/text.js.map +7 -0
- package/dist/cjs/variants/tooltip.d.ts +2 -0
- package/dist/cjs/variants/tooltip.js +2 -0
- package/dist/cjs/variants/tooltip.js.map +7 -0
- package/dist/cjs/variants/typography.d.ts +285 -0
- package/dist/cjs/variants/typography.js +2 -0
- package/dist/cjs/variants/typography.js.map +7 -0
- package/dist/cjs/widgets/NotificationBell.d.ts +2 -0
- package/dist/cjs/widgets/NotificationBell.js +2 -0
- package/dist/cjs/widgets/NotificationBell.js.map +7 -0
- package/dist/cjs/widgets/Preference.d.ts +15 -0
- package/dist/cjs/widgets/Preference.js +2 -0
- package/dist/cjs/widgets/Preference.js.map +7 -0
- package/dist/cjs/widgets/Preferences.d.ts +19 -0
- package/dist/cjs/widgets/Preferences.js +2 -0
- package/dist/cjs/widgets/Preferences.js.map +7 -0
- package/dist/cjs/widgets/Toast.d.ts +4 -0
- package/dist/cjs/widgets/Toast.js +2 -0
- package/dist/cjs/widgets/Toast.js.map +7 -0
- package/dist/cjs/widgets/index.d.ts +3 -0
- package/dist/cjs/widgets/index.js +2 -0
- package/dist/cjs/widgets/index.js.map +7 -0
- package/dist/esm/components/button.d.ts +8 -0
- package/dist/esm/components/button.js +2 -0
- package/dist/esm/components/button.js.map +7 -0
- package/dist/esm/components/card.d.ts +8 -0
- package/dist/esm/components/card.js +2 -0
- package/dist/esm/components/card.js.map +7 -0
- package/dist/esm/components/flex.d.ts +210 -0
- package/dist/esm/components/flex.js +2 -0
- package/dist/esm/components/flex.js.map +7 -0
- package/dist/esm/components/heading.d.ts +8 -0
- package/dist/esm/components/heading.js +2 -0
- package/dist/esm/components/heading.js.map +7 -0
- package/dist/esm/components/icon-button.d.ts +3 -0
- package/dist/esm/components/icon-button.js +2 -0
- package/dist/esm/components/icon-button.js.map +7 -0
- package/dist/esm/components/index.d.ts +11 -0
- package/dist/esm/components/index.js +2 -0
- package/dist/esm/components/index.js.map +7 -0
- package/dist/esm/components/popover.d.ts +47 -0
- package/dist/esm/components/popover.js +2 -0
- package/dist/esm/components/popover.js.map +7 -0
- package/dist/esm/components/text-field.d.ts +2 -0
- package/dist/esm/components/text-field.js +2 -0
- package/dist/esm/components/text-field.js.map +7 -0
- package/dist/esm/components/text.d.ts +20 -0
- package/dist/esm/components/text.js +2 -0
- package/dist/esm/components/text.js.map +7 -0
- package/dist/esm/components/theme.d.ts +17 -0
- package/dist/esm/components/theme.js +2 -0
- package/dist/esm/components/theme.js.map +7 -0
- package/dist/esm/components/toast.d.ts +4 -0
- package/dist/esm/components/toast.js +2 -0
- package/dist/esm/components/toast.js.map +7 -0
- package/dist/esm/components/tooltip.d.ts +13 -0
- package/dist/esm/components/tooltip.js +2 -0
- package/dist/esm/components/tooltip.js.map +7 -0
- package/dist/esm/hooks/index.d.ts +2 -0
- package/dist/esm/hooks/index.js +2 -0
- package/dist/esm/hooks/index.js.map +7 -0
- package/dist/esm/hooks/use-dashx-provider.d.ts +3 -0
- package/dist/esm/hooks/use-dashx-provider.js +2 -0
- package/dist/esm/hooks/use-dashx-provider.js.map +7 -0
- package/dist/esm/hooks/use-in-app.d.ts +9 -0
- package/dist/esm/hooks/use-in-app.js +2 -0
- package/dist/esm/hooks/use-in-app.js.map +7 -0
- package/dist/esm/icons/index.d.ts +1 -0
- package/dist/esm/icons/index.js +2 -0
- package/dist/esm/icons/index.js.map +7 -0
- package/dist/esm/index.d.ts +3 -0
- package/dist/esm/index.js +2 -0
- package/dist/esm/index.js.map +7 -0
- package/dist/esm/package.json +3 -0
- package/dist/esm/providers/DashXProvider.d.ts +6 -0
- package/dist/esm/providers/DashXProvider.js +2 -0
- package/dist/esm/providers/DashXProvider.js.map +7 -0
- package/dist/esm/providers/index.d.ts +1 -0
- package/dist/esm/providers/index.js +2 -0
- package/dist/esm/providers/index.js.map +7 -0
- package/dist/esm/tsconfig.tsbuildinfo +1 -0
- package/dist/esm/utils/cn.d.ts +3 -0
- package/dist/esm/utils/cn.js +2 -0
- package/dist/esm/utils/cn.js.map +7 -0
- package/dist/esm/variants/base-element.d.ts +58 -0
- package/dist/esm/variants/base-element.js +2 -0
- package/dist/esm/variants/base-element.js.map +7 -0
- package/dist/esm/variants/button.d.ts +147 -0
- package/dist/esm/variants/button.js +2 -0
- package/dist/esm/variants/button.js.map +7 -0
- package/dist/esm/variants/card.d.ts +117 -0
- package/dist/esm/variants/card.js +2 -0
- package/dist/esm/variants/card.js.map +7 -0
- package/dist/esm/variants/heading.d.ts +377 -0
- package/dist/esm/variants/heading.js +2 -0
- package/dist/esm/variants/heading.js.map +7 -0
- package/dist/esm/variants/index.d.ts +6 -0
- package/dist/esm/variants/index.js +2 -0
- package/dist/esm/variants/index.js.map +7 -0
- package/dist/esm/variants/popover.d.ts +106 -0
- package/dist/esm/variants/popover.js +2 -0
- package/dist/esm/variants/popover.js.map +7 -0
- package/dist/esm/variants/text-field.d.ts +93 -0
- package/dist/esm/variants/text-field.js +2 -0
- package/dist/esm/variants/text-field.js.map +7 -0
- package/dist/esm/variants/text.d.ts +377 -0
- package/dist/esm/variants/text.js +2 -0
- package/dist/esm/variants/text.js.map +7 -0
- package/dist/esm/variants/tooltip.d.ts +2 -0
- package/dist/esm/variants/tooltip.js +2 -0
- package/dist/esm/variants/tooltip.js.map +7 -0
- package/dist/esm/variants/typography.d.ts +285 -0
- package/dist/esm/variants/typography.js +2 -0
- package/dist/esm/variants/typography.js.map +7 -0
- package/dist/esm/widgets/NotificationBell.d.ts +2 -0
- package/dist/esm/widgets/NotificationBell.js +2 -0
- package/dist/esm/widgets/NotificationBell.js.map +7 -0
- package/dist/esm/widgets/Preference.d.ts +15 -0
- package/dist/esm/widgets/Preference.js +2 -0
- package/dist/esm/widgets/Preference.js.map +7 -0
- package/dist/esm/widgets/Preferences.d.ts +19 -0
- package/dist/esm/widgets/Preferences.js +2 -0
- package/dist/esm/widgets/Preferences.js.map +7 -0
- package/dist/esm/widgets/Toast.d.ts +4 -0
- package/dist/esm/widgets/Toast.js +2 -0
- package/dist/esm/widgets/Toast.js.map +7 -0
- package/dist/esm/widgets/index.d.ts +3 -0
- package/dist/esm/widgets/index.js +2 -0
- package/dist/esm/widgets/index.js.map +7 -0
- package/package.json +165 -34
- package/src/components/button.tsx +88 -0
- package/src/components/card.tsx +32 -0
- package/src/components/flex.tsx +61 -0
- package/src/components/heading.tsx +42 -0
- package/src/components/icon-button.tsx +24 -0
- package/src/components/index.ts +11 -0
- package/src/components/popover.tsx +145 -0
- package/src/components/text-field.tsx +7 -0
- package/src/components/text.tsx +42 -0
- package/src/components/theme.tsx +81 -0
- package/src/components/toast.tsx +19 -0
- package/src/components/tooltip.tsx +62 -0
- package/src/hooks/index.ts +2 -0
- package/src/hooks/use-dashx-provider.ts +17 -0
- package/src/hooks/use-in-app.ts +96 -0
- package/src/icons/index.ts +1 -0
- package/src/index.ts +3 -0
- package/src/providers/DashXProvider.tsx +30 -0
- package/src/providers/index.ts +1 -0
- package/src/styles/index.css +368 -0
- package/src/utils/cn.ts +8 -0
- package/src/variants/base-element.ts +15 -0
- package/src/variants/button.ts +191 -0
- package/src/variants/card.ts +40 -0
- package/src/variants/heading.ts +28 -0
- package/src/variants/index.ts +6 -0
- package/src/variants/popover.ts +42 -0
- package/src/variants/text-field.ts +15 -0
- package/src/variants/text.ts +28 -0
- package/src/variants/tooltip.ts +7 -0
- package/src/variants/typography.ts +100 -0
- package/src/widgets/NotificationBell.tsx +101 -0
- package/src/widgets/Preference.tsx +80 -0
- package/src/widgets/Preferences.tsx +109 -0
- package/src/widgets/Toast.tsx +19 -0
- package/src/widgets/index.ts +3 -0
- package/styles.css +1255 -0
- package/dist/index.d.ts +0 -65
- package/dist/index.es.js +0 -11779
- package/dist/index.umd.js +0 -238
- package/dist/style.css +0 -1
package/package.json
CHANGED
|
@@ -1,48 +1,179 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dashx/react",
|
|
3
|
-
"
|
|
4
|
-
"
|
|
5
|
-
"
|
|
6
|
-
"
|
|
7
|
-
"
|
|
8
|
-
"module": "./dist/index.
|
|
9
|
-
"
|
|
10
|
-
"files": [
|
|
11
|
-
"dist"
|
|
12
|
-
],
|
|
3
|
+
"version": "0.1.1",
|
|
4
|
+
"license": "UNLICENSED",
|
|
5
|
+
"type": "commonjs",
|
|
6
|
+
"main": "./dist/cjs/index.js",
|
|
7
|
+
"types": "./dist/cjs/index.d.ts",
|
|
8
|
+
"module": "./dist/esm/index.js",
|
|
9
|
+
"style": "./styles.css",
|
|
13
10
|
"exports": {
|
|
14
11
|
".": {
|
|
15
|
-
"
|
|
16
|
-
|
|
17
|
-
|
|
12
|
+
"require": {
|
|
13
|
+
"types": "./dist/cjs/index.d.ts",
|
|
14
|
+
"default": "./dist/cjs/index.js"
|
|
15
|
+
},
|
|
16
|
+
"import": {
|
|
17
|
+
"types": "./dist/esm/index.d.ts",
|
|
18
|
+
"default": "./dist/esm/index.js"
|
|
19
|
+
}
|
|
20
|
+
},
|
|
21
|
+
"./variants": {
|
|
22
|
+
"require": {
|
|
23
|
+
"types": "./dist/cjs/variants/index.d.ts",
|
|
24
|
+
"default": "./dist/cjs/variants/index.js"
|
|
25
|
+
},
|
|
26
|
+
"import": {
|
|
27
|
+
"types": "./dist/esm/variants/index.d.ts",
|
|
28
|
+
"default": "./dist/esm/variants/index.js"
|
|
29
|
+
}
|
|
30
|
+
},
|
|
31
|
+
"./icons": {
|
|
32
|
+
"require": {
|
|
33
|
+
"types": "./dist/cjs/icons/index.d.ts",
|
|
34
|
+
"default": "./dist/cjs/icons/index.js"
|
|
35
|
+
},
|
|
36
|
+
"import": {
|
|
37
|
+
"types": "./dist/esm/icons/index.d.ts",
|
|
38
|
+
"default": "./dist/esm/icons/index.js"
|
|
39
|
+
}
|
|
40
|
+
},
|
|
41
|
+
"./widgets": {
|
|
42
|
+
"require": {
|
|
43
|
+
"types": "./dist/cjs/widgets/index.d.ts",
|
|
44
|
+
"default": "./dist/cjs/widgets/index.js"
|
|
45
|
+
},
|
|
46
|
+
"import": {
|
|
47
|
+
"types": "./dist/esm/widgets/index.d.ts",
|
|
48
|
+
"default": "./dist/esm/widgets/index.js"
|
|
49
|
+
}
|
|
18
50
|
},
|
|
19
|
-
"
|
|
51
|
+
"./*": "./*"
|
|
20
52
|
},
|
|
53
|
+
"sideEffects": false,
|
|
54
|
+
"files": [
|
|
55
|
+
"src/**",
|
|
56
|
+
"dist/**",
|
|
57
|
+
"*.css"
|
|
58
|
+
],
|
|
21
59
|
"scripts": {
|
|
22
|
-
"
|
|
23
|
-
"build": "
|
|
60
|
+
"build": "yarn build:js && yarn build:css",
|
|
61
|
+
"build:js": "yarn build:js:cjs && yarn build:js:esm && yarn build:js:cjs:types && yarn build:js:esm:types",
|
|
62
|
+
"build:js:cjs": "node esbuild-cjs.mjs",
|
|
63
|
+
"build:js:cjs:types": "tsc --outdir dist/cjs",
|
|
64
|
+
"build:js:esm": "node esbuild-esm.mjs",
|
|
65
|
+
"build:js:esm:types": "tsc --outdir dist/esm",
|
|
66
|
+
"build:css": "postcss src/styles/index.css -o styles.css",
|
|
67
|
+
"dev": "yarn dev:js & yarn dev:css",
|
|
68
|
+
"dev:js": "yarn dev:js:cjs & yarn dev:js:esm & yarn dev:js:cjs:types & yarn dev:js:esm:types",
|
|
69
|
+
"dev:js:cjs": "node esbuild-cjs.mjs watch=true",
|
|
70
|
+
"dev:js:cjs:types": "tsc --watch --incremental --outdir dist/cjs",
|
|
71
|
+
"dev:js:esm": "node esbuild-esm.mjs watch=true",
|
|
72
|
+
"dev:js:esm:types": "tsc --watch --incremental --outdir dist/esm >/dev/null",
|
|
73
|
+
"dev:css": "postcss src/styles/index.css -o styles.css --watch",
|
|
74
|
+
"lint": "eslint \"src/**/*.ts*\"",
|
|
75
|
+
"clean": "rm -rf .turbo node_modules dist tokens layout *.css",
|
|
76
|
+
"prepublishOnly": "yarn lint"
|
|
24
77
|
},
|
|
25
|
-
"
|
|
26
|
-
"@
|
|
27
|
-
"@
|
|
28
|
-
"@
|
|
29
|
-
"
|
|
30
|
-
"
|
|
31
|
-
"
|
|
32
|
-
"
|
|
33
|
-
"
|
|
78
|
+
"dependencies": {
|
|
79
|
+
"@dashx/browser": "^0.2.1",
|
|
80
|
+
"@radix-ui/colors": "^3.0.0",
|
|
81
|
+
"@radix-ui/primitive": "^1.0.1",
|
|
82
|
+
"@radix-ui/react-accessible-icon": "^1.0.3",
|
|
83
|
+
"@radix-ui/react-alert-dialog": "^1.0.5",
|
|
84
|
+
"@radix-ui/react-aspect-ratio": "^1.0.3",
|
|
85
|
+
"@radix-ui/react-avatar": "^1.0.4",
|
|
86
|
+
"@radix-ui/react-checkbox": "^1.0.4",
|
|
87
|
+
"@radix-ui/react-compose-refs": "^1.0.1",
|
|
88
|
+
"@radix-ui/react-context": "^1.0.1",
|
|
89
|
+
"@radix-ui/react-context-menu": "^2.1.5",
|
|
90
|
+
"@radix-ui/react-dialog": "^1.0.5",
|
|
91
|
+
"@radix-ui/react-direction": "^1.0.1",
|
|
92
|
+
"@radix-ui/react-dropdown-menu": "^2.0.6",
|
|
93
|
+
"@radix-ui/react-form": "^0.0.3",
|
|
94
|
+
"@radix-ui/react-hover-card": "^1.0.7",
|
|
95
|
+
"@radix-ui/react-navigation-menu": "^1.1.4",
|
|
96
|
+
"@radix-ui/react-popover": "^1.0.7",
|
|
97
|
+
"@radix-ui/react-portal": "^1.0.4",
|
|
98
|
+
"@radix-ui/react-primitive": "^1.0.3",
|
|
99
|
+
"@radix-ui/react-progress": "^1.0.3",
|
|
100
|
+
"@radix-ui/react-radio-group": "^1.1.3",
|
|
101
|
+
"@radix-ui/react-roving-focus": "^1.0.4",
|
|
102
|
+
"@radix-ui/react-scroll-area": "^1.0.5",
|
|
103
|
+
"@radix-ui/react-select": "^2.0.0",
|
|
104
|
+
"@radix-ui/react-slider": "^1.1.2",
|
|
105
|
+
"@radix-ui/react-slot": "^1.0.2",
|
|
106
|
+
"@radix-ui/react-switch": "^1.0.3",
|
|
107
|
+
"@radix-ui/react-tabs": "^1.0.4",
|
|
108
|
+
"@radix-ui/react-toggle-group": "^1.0.4",
|
|
109
|
+
"@radix-ui/react-tooltip": "^1.0.7",
|
|
110
|
+
"@radix-ui/react-use-callback-ref": "^1.0.1",
|
|
111
|
+
"@radix-ui/react-use-controllable-state": "^1.0.1",
|
|
112
|
+
"@radix-ui/react-visually-hidden": "^1.0.3",
|
|
113
|
+
"@react-aria/utils": "^3.24.1",
|
|
114
|
+
"@react-spectrum/button": "^3.16.4",
|
|
115
|
+
"@react-spectrum/utils": "^3.11.7",
|
|
116
|
+
"@react-types/shared": "^3.23.1",
|
|
117
|
+
"@tailwindcss/postcss": "^4.0.0-alpha.15",
|
|
118
|
+
"class-variance-authority": "^0.7.0",
|
|
119
|
+
"classnames": "^2.5.1",
|
|
120
|
+
"date-fns": "^3.6.0",
|
|
121
|
+
"lucide-react": "^0.394.0",
|
|
122
|
+
"prettier": "^3.2.5",
|
|
123
|
+
"prettier-plugin-tailwindcss": "^0.6.0",
|
|
124
|
+
"react-aria": "^3.33.1",
|
|
125
|
+
"react-hot-toast": "^2.4.1",
|
|
126
|
+
"react-remove-scroll-bar": "2.3.4",
|
|
127
|
+
"react-use-websocket": "^4.8.1",
|
|
128
|
+
"tailwind-merge": "^2.3.0",
|
|
129
|
+
"tailwind-variants": "^0.2.1",
|
|
130
|
+
"tailwindcss": "^4.0.0-alpha.15",
|
|
131
|
+
"tailwindcss-animate": "^1.0.7",
|
|
132
|
+
"tailwindcss-react-aria-components": "^1.1.3"
|
|
34
133
|
},
|
|
35
134
|
"peerDependencies": {
|
|
135
|
+
"@types/react": "*",
|
|
136
|
+
"@types/react-dom": "*",
|
|
137
|
+
"react": "^16.8 || ^17.0 || ^18.0",
|
|
138
|
+
"react-dom": "^16.8 || ^17.0 || ^18.0"
|
|
139
|
+
},
|
|
140
|
+
"peerDependenciesMeta": {
|
|
141
|
+
"@types/react": {
|
|
142
|
+
"optional": true
|
|
143
|
+
},
|
|
144
|
+
"@types/react-dom": {
|
|
145
|
+
"optional": true
|
|
146
|
+
}
|
|
147
|
+
},
|
|
148
|
+
"devDependencies": {
|
|
149
|
+
"@types/react": "^18.2.53",
|
|
150
|
+
"@types/react-dom": "^18.2.18",
|
|
151
|
+
"esbuild": "^0.20.0",
|
|
152
|
+
"eslint": "^8.15.0",
|
|
153
|
+
"eslint-config-next": "^13.4.1",
|
|
154
|
+
"eslint-config-prettier": "^8.3.0",
|
|
155
|
+
"eslint-config-turbo": "^1.9.3",
|
|
156
|
+
"eslint-plugin-import": "^2.29.1",
|
|
157
|
+
"eslint-plugin-react": "7.28.0",
|
|
158
|
+
"eslint-plugin-require-extensions": "^0.1.3",
|
|
159
|
+
"postcss": "^8.4.35",
|
|
160
|
+
"postcss-cli": "^11.0.0",
|
|
161
|
+
"prettier": "^3.2.5",
|
|
162
|
+
"prettier-plugin-tailwindcss": "^0.6.0",
|
|
36
163
|
"react": "^18.2.0",
|
|
37
|
-
"react-dom": "^18.2.0"
|
|
164
|
+
"react-dom": "^18.2.0",
|
|
165
|
+
"stylelint": "^16.1.0",
|
|
166
|
+
"typescript": "^5.3.3"
|
|
38
167
|
},
|
|
39
|
-
"
|
|
40
|
-
"
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
"
|
|
45
|
-
"
|
|
46
|
-
|
|
168
|
+
"publishConfig": {
|
|
169
|
+
"access": "public"
|
|
170
|
+
},
|
|
171
|
+
"homepage": "https://radix-ui.com/themes",
|
|
172
|
+
"repository": {
|
|
173
|
+
"type": "git",
|
|
174
|
+
"url": "git+https://github.com/dashx/react.git"
|
|
175
|
+
},
|
|
176
|
+
"bugs": {
|
|
177
|
+
"url": "https://github.com/dashx/react/issues"
|
|
47
178
|
}
|
|
48
179
|
}
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
import { Slot } from '@radix-ui/react-slot';
|
|
2
|
+
import { filterDOMProps, mergeRefs } from '@react-aria/utils';
|
|
3
|
+
import React, { forwardRef, isValidElement, useRef } from 'react';
|
|
4
|
+
import { mergeProps, useButton, useFocusRing, useHover } from 'react-aria';
|
|
5
|
+
|
|
6
|
+
import { cn } from '../utils/cn.js';
|
|
7
|
+
import { button } from '../variants/button.js';
|
|
8
|
+
|
|
9
|
+
import type { ElementType } from 'react';
|
|
10
|
+
import type { AriaButtonProps, HoverEvents } from 'react-aria';
|
|
11
|
+
import type { ButtonVariantProps } from '../variants/button.js';
|
|
12
|
+
|
|
13
|
+
export interface ButtonProps
|
|
14
|
+
extends Omit<AriaButtonProps, 'elementType' | 'href' | 'target' | 'rel'>,
|
|
15
|
+
HoverEvents,
|
|
16
|
+
ButtonVariantProps {
|
|
17
|
+
asChild?: boolean;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
function _Button(props: ButtonProps, ref: React.ForwardedRef<HTMLButtonElement>) {
|
|
21
|
+
const { asChild, children, size, mode, variant, roundness, shape, inset } = props;
|
|
22
|
+
let elementType = asChild
|
|
23
|
+
? (isValidElement(children) && (children?.type as ElementType)) || 'button'
|
|
24
|
+
: 'button';
|
|
25
|
+
|
|
26
|
+
const fallbackEventTo = (event: any, fallbackEventName: any) => {
|
|
27
|
+
let anyProps: any = props;
|
|
28
|
+
if (fallbackEventName in props && !event) {
|
|
29
|
+
return [anyProps[fallbackEventName], undefined];
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
return [event, anyProps[fallbackEventName]];
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
const [onPress, onClick] = fallbackEventTo(props.onPress, 'onClick');
|
|
36
|
+
const [onPressStart, onPointerDown] = fallbackEventTo(props.onPressStart, 'onPointerDown');
|
|
37
|
+
const [onHoverStart, onPointerMove] = fallbackEventTo(props.onHoverStart, 'onPointerMove');
|
|
38
|
+
const [onHoverEnd, onPointerLeave] = fallbackEventTo(props.onHoverEnd, 'onPointerLeave');
|
|
39
|
+
const innerRef = useRef<HTMLButtonElement>(null);
|
|
40
|
+
let { buttonProps, isPressed } = useButton(
|
|
41
|
+
{
|
|
42
|
+
...props,
|
|
43
|
+
elementType,
|
|
44
|
+
onPress,
|
|
45
|
+
onPressStart,
|
|
46
|
+
// @ts-ignore
|
|
47
|
+
onClick,
|
|
48
|
+
// @ts-ignore
|
|
49
|
+
onPointerDown,
|
|
50
|
+
// @ts-ignore
|
|
51
|
+
onPointerMove,
|
|
52
|
+
// @ts-ignore
|
|
53
|
+
onPointerLeave,
|
|
54
|
+
},
|
|
55
|
+
innerRef,
|
|
56
|
+
);
|
|
57
|
+
let { focusProps, isFocused, isFocusVisible } = useFocusRing(props);
|
|
58
|
+
|
|
59
|
+
let { hoverProps, isHovered } = useHover({
|
|
60
|
+
...props,
|
|
61
|
+
onHoverStart,
|
|
62
|
+
onHoverEnd,
|
|
63
|
+
});
|
|
64
|
+
|
|
65
|
+
let Comp = asChild ? Slot : 'button';
|
|
66
|
+
|
|
67
|
+
return (
|
|
68
|
+
<Comp
|
|
69
|
+
{...filterDOMProps(props)}
|
|
70
|
+
{...mergeProps(buttonProps, focusProps, hoverProps)}
|
|
71
|
+
ref={mergeRefs(ref, innerRef)}
|
|
72
|
+
data-disabled={props.isDisabled || undefined}
|
|
73
|
+
data-pressed={isPressed || undefined}
|
|
74
|
+
data-hovered={isHovered || undefined}
|
|
75
|
+
data-focused={isFocused || undefined}
|
|
76
|
+
data-focus-visible={isFocusVisible || undefined}
|
|
77
|
+
className={cn('dr', button({ size, mode, variant, roundness, shape }))}
|
|
78
|
+
data-radius={roundness}
|
|
79
|
+
data-inset={inset}
|
|
80
|
+
>
|
|
81
|
+
{children}
|
|
82
|
+
</Comp>
|
|
83
|
+
);
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
const Button = forwardRef(_Button);
|
|
87
|
+
|
|
88
|
+
export { Button };
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { Slot } from '@radix-ui/react-slot';
|
|
3
|
+
|
|
4
|
+
import { SPACING, card } from '../variants/card.js';
|
|
5
|
+
import { cn } from '../utils/cn.js';
|
|
6
|
+
|
|
7
|
+
import type { CardVariantProps } from '../variants/card.js';
|
|
8
|
+
|
|
9
|
+
interface CardProps extends React.HTMLAttributes<HTMLDivElement>, CardVariantProps {
|
|
10
|
+
asChild?: boolean;
|
|
11
|
+
}
|
|
12
|
+
const Card = React.forwardRef<HTMLDivElement, CardProps>((props, ref) => {
|
|
13
|
+
const { asChild, className, spacing = 'medium', roundness, ...rest } = props;
|
|
14
|
+
const Comp = asChild ? Slot : 'div';
|
|
15
|
+
return (
|
|
16
|
+
<Comp
|
|
17
|
+
ref={ref}
|
|
18
|
+
{...rest}
|
|
19
|
+
className={cn('dr', card({ className, spacing, roundness }))}
|
|
20
|
+
data-radius={roundness}
|
|
21
|
+
style={{
|
|
22
|
+
// @ts-ignore
|
|
23
|
+
'--padding': SPACING[spacing],
|
|
24
|
+
}}
|
|
25
|
+
/>
|
|
26
|
+
);
|
|
27
|
+
});
|
|
28
|
+
|
|
29
|
+
Card.displayName = 'Card';
|
|
30
|
+
|
|
31
|
+
export { Card };
|
|
32
|
+
export type { CardProps };
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { tv } from 'tailwind-variants';
|
|
3
|
+
|
|
4
|
+
import { cn } from '../utils/cn.js';
|
|
5
|
+
|
|
6
|
+
import type { VariantProps } from 'tailwind-variants';
|
|
7
|
+
|
|
8
|
+
const flexVariants = tv({
|
|
9
|
+
base: 'flex',
|
|
10
|
+
variants: {
|
|
11
|
+
direction: {
|
|
12
|
+
column: ['flex-col'],
|
|
13
|
+
row: ['flex-row'],
|
|
14
|
+
},
|
|
15
|
+
gap: {
|
|
16
|
+
1: 'gap-1',
|
|
17
|
+
2: 'gap-2',
|
|
18
|
+
3: 'gap-3',
|
|
19
|
+
4: 'gap-4',
|
|
20
|
+
6: 'gap-6',
|
|
21
|
+
8: 'gap-8',
|
|
22
|
+
10: 'gap-10',
|
|
23
|
+
12: 'gap-12',
|
|
24
|
+
14: 'gap-14',
|
|
25
|
+
16: 'gap-16',
|
|
26
|
+
18: 'gap-18',
|
|
27
|
+
24: 'gap-24',
|
|
28
|
+
28: 'gap-28',
|
|
29
|
+
32: 'gap-32',
|
|
30
|
+
},
|
|
31
|
+
justify: {
|
|
32
|
+
center: 'justify-center',
|
|
33
|
+
between: 'justify-between',
|
|
34
|
+
},
|
|
35
|
+
align: {
|
|
36
|
+
baseline: 'items-baseline',
|
|
37
|
+
center: 'items-center',
|
|
38
|
+
},
|
|
39
|
+
},
|
|
40
|
+
});
|
|
41
|
+
|
|
42
|
+
type FlexProps = VariantProps<typeof flexVariants>;
|
|
43
|
+
|
|
44
|
+
const Flex = React.forwardRef<HTMLDivElement, React.HTMLAttributes<HTMLDivElement> & FlexProps>(
|
|
45
|
+
(props, ref) => {
|
|
46
|
+
const { className, direction, gap, justify, align, ...rest } = props;
|
|
47
|
+
|
|
48
|
+
return (
|
|
49
|
+
<div
|
|
50
|
+
className={cn(flexVariants({ direction, gap, justify, align }), className)}
|
|
51
|
+
ref={ref}
|
|
52
|
+
{...rest}
|
|
53
|
+
/>
|
|
54
|
+
);
|
|
55
|
+
},
|
|
56
|
+
);
|
|
57
|
+
|
|
58
|
+
Flex.displayName = 'Flex';
|
|
59
|
+
|
|
60
|
+
export type { FlexProps };
|
|
61
|
+
export { Flex };
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { Slot } from '@radix-ui/react-slot';
|
|
3
|
+
|
|
4
|
+
import { heading } from '../variants/heading.js';
|
|
5
|
+
|
|
6
|
+
import type { HeadingVariantProps } from '../variants/heading.js';
|
|
7
|
+
|
|
8
|
+
interface HeadingOwnProps extends HeadingVariantProps {
|
|
9
|
+
asChild?: boolean;
|
|
10
|
+
as?: 'h1' | 'h2' | 'h3' | 'h4' | 'h5' | 'h6';
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
type HeadingProps = HeadingOwnProps & React.HTMLAttributes<HTMLHeadingElement>;
|
|
14
|
+
|
|
15
|
+
const Heading = React.forwardRef<HTMLDivElement, HeadingProps>((props, ref) => {
|
|
16
|
+
const {
|
|
17
|
+
as: Tag = 'h1',
|
|
18
|
+
asChild,
|
|
19
|
+
children,
|
|
20
|
+
className,
|
|
21
|
+
size,
|
|
22
|
+
align,
|
|
23
|
+
color,
|
|
24
|
+
variant,
|
|
25
|
+
weight,
|
|
26
|
+
...rest
|
|
27
|
+
} = props;
|
|
28
|
+
|
|
29
|
+
return (
|
|
30
|
+
<Slot
|
|
31
|
+
className={heading({ size, align, color, variant, weight, className })}
|
|
32
|
+
ref={ref}
|
|
33
|
+
{...rest}
|
|
34
|
+
>
|
|
35
|
+
{asChild ? children : <Tag>{children}</Tag>}
|
|
36
|
+
</Slot>
|
|
37
|
+
);
|
|
38
|
+
});
|
|
39
|
+
|
|
40
|
+
Heading.displayName = 'Heading';
|
|
41
|
+
|
|
42
|
+
export { Heading };
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
|
|
3
|
+
import { cn } from '../utils/cn.js';
|
|
4
|
+
|
|
5
|
+
const IconButton = React.forwardRef<HTMLButtonElement, React.HTMLAttributes<HTMLButtonElement>>(
|
|
6
|
+
(props, ref) => {
|
|
7
|
+
const { className } = props;
|
|
8
|
+
|
|
9
|
+
return (
|
|
10
|
+
<button
|
|
11
|
+
className={cn(
|
|
12
|
+
'hover:bg-accent-300 border-accent-700 rounded-3 text-accent-700 border p-3 transition-all',
|
|
13
|
+
className,
|
|
14
|
+
)}
|
|
15
|
+
ref={ref}
|
|
16
|
+
{...props}
|
|
17
|
+
/>
|
|
18
|
+
);
|
|
19
|
+
},
|
|
20
|
+
);
|
|
21
|
+
|
|
22
|
+
IconButton.displayName = 'Button';
|
|
23
|
+
|
|
24
|
+
export { IconButton };
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export * from './button.js';
|
|
2
|
+
export * from './card.js';
|
|
3
|
+
export * from './flex.js';
|
|
4
|
+
export * from './heading.js';
|
|
5
|
+
export * from './icon-button.js';
|
|
6
|
+
export * as Popover from './popover.js';
|
|
7
|
+
export * from './toast.js';
|
|
8
|
+
export * from './text.js';
|
|
9
|
+
export * from './text-field.js';
|
|
10
|
+
export * from './theme.js';
|
|
11
|
+
export * as Tooltip from './tooltip.js';
|
|
@@ -0,0 +1,145 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import * as PopoverPrimitive from '@radix-ui/react-popover';
|
|
3
|
+
import { Slot } from '@radix-ui/react-slot';
|
|
4
|
+
|
|
5
|
+
import { cn } from '../utils/cn.js';
|
|
6
|
+
import { popover, popoverBody, popoverFooter, popoverHeader } from '../variants/popover.js';
|
|
7
|
+
import { SPACING } from '../variants/card.js';
|
|
8
|
+
import { Theme } from './theme.js';
|
|
9
|
+
|
|
10
|
+
import type { PopoverVariantProps } from '../variants/popover.js';
|
|
11
|
+
|
|
12
|
+
interface PopoverRootProps extends React.ComponentPropsWithoutRef<typeof PopoverPrimitive.Root> {}
|
|
13
|
+
const PopoverRoot: React.FC<PopoverRootProps> = (props: PopoverRootProps) => (
|
|
14
|
+
<PopoverPrimitive.Root {...props} />
|
|
15
|
+
);
|
|
16
|
+
PopoverRoot.displayName = 'Popover.Root';
|
|
17
|
+
|
|
18
|
+
type PopoverTriggerElement = React.ElementRef<typeof PopoverPrimitive.Trigger>;
|
|
19
|
+
interface PopoverTriggerProps extends React.PropsWithChildren<{}> {}
|
|
20
|
+
const PopoverTrigger = React.forwardRef<PopoverTriggerElement, PopoverTriggerProps>(
|
|
21
|
+
({ children, ...rest }, ref) => (
|
|
22
|
+
<PopoverPrimitive.Trigger {...rest} ref={ref} asChild>
|
|
23
|
+
<Slot>{children}</Slot>
|
|
24
|
+
</PopoverPrimitive.Trigger>
|
|
25
|
+
),
|
|
26
|
+
);
|
|
27
|
+
PopoverTrigger.displayName = 'Popover.Trigger';
|
|
28
|
+
|
|
29
|
+
type PopoverContentElement = React.ElementRef<typeof PopoverPrimitive.Content>;
|
|
30
|
+
interface PopoverContentProps
|
|
31
|
+
extends React.ComponentPropsWithoutRef<typeof PopoverPrimitive.Content>,
|
|
32
|
+
React.ComponentPropsWithoutRef<typeof PopoverPrimitive.Portal>,
|
|
33
|
+
PopoverVariantProps {
|
|
34
|
+
maxWidth?: number | string;
|
|
35
|
+
minWidth?: number | string;
|
|
36
|
+
width?: number | string;
|
|
37
|
+
maxHeight?: number | string;
|
|
38
|
+
minHeight?: number | string;
|
|
39
|
+
height?: number | string;
|
|
40
|
+
}
|
|
41
|
+
const PopoverContent = React.forwardRef<PopoverContentElement, PopoverContentProps>(
|
|
42
|
+
(props, ref) => {
|
|
43
|
+
const {
|
|
44
|
+
forceMount,
|
|
45
|
+
container,
|
|
46
|
+
roundness,
|
|
47
|
+
spacing = 'medium',
|
|
48
|
+
maxWidth,
|
|
49
|
+
minWidth,
|
|
50
|
+
width,
|
|
51
|
+
maxHeight,
|
|
52
|
+
minHeight,
|
|
53
|
+
height,
|
|
54
|
+
...rest
|
|
55
|
+
} = props;
|
|
56
|
+
return (
|
|
57
|
+
<PopoverPrimitive.Portal container={container} forceMount={forceMount}>
|
|
58
|
+
<Theme roundness={roundness} asChild>
|
|
59
|
+
<PopoverPrimitive.Content
|
|
60
|
+
align="start"
|
|
61
|
+
sideOffset={8}
|
|
62
|
+
collisionPadding={10}
|
|
63
|
+
{...rest}
|
|
64
|
+
ref={ref}
|
|
65
|
+
className={cn(popover({ roundness }))}
|
|
66
|
+
style={{
|
|
67
|
+
// @ts-ignore
|
|
68
|
+
'--padding': SPACING[spacing],
|
|
69
|
+
'--max-width': maxWidth,
|
|
70
|
+
'--min-width': minWidth,
|
|
71
|
+
'--width': width,
|
|
72
|
+
'--max-height': maxHeight,
|
|
73
|
+
'--min-height': minHeight,
|
|
74
|
+
'--height': height,
|
|
75
|
+
}}
|
|
76
|
+
/>
|
|
77
|
+
</Theme>
|
|
78
|
+
</PopoverPrimitive.Portal>
|
|
79
|
+
);
|
|
80
|
+
},
|
|
81
|
+
);
|
|
82
|
+
PopoverContent.displayName = 'Popover.Content';
|
|
83
|
+
|
|
84
|
+
type PopoverBodyProps = React.PropsWithChildren<{
|
|
85
|
+
asChild?: boolean;
|
|
86
|
+
}>;
|
|
87
|
+
const PopoverBody = React.forwardRef<HTMLDivElement, PopoverBodyProps>((props, ref) => {
|
|
88
|
+
let { asChild, ...rest } = props;
|
|
89
|
+
let Comp = asChild ? Slot : 'div';
|
|
90
|
+
|
|
91
|
+
return <Comp ref={ref} {...rest} className={cn(popoverBody())} />;
|
|
92
|
+
});
|
|
93
|
+
PopoverBody.displayName = 'Popover.Body';
|
|
94
|
+
|
|
95
|
+
type PopoverHeaderProps = React.PropsWithChildren<{
|
|
96
|
+
asChild?: boolean;
|
|
97
|
+
}>;
|
|
98
|
+
const PopoverHeader = React.forwardRef<HTMLDivElement, PopoverHeaderProps>((props, ref) => {
|
|
99
|
+
let { asChild, ...rest } = props;
|
|
100
|
+
let Comp = asChild ? Slot : 'div';
|
|
101
|
+
|
|
102
|
+
return <Comp ref={ref} {...rest} className={cn(popoverHeader())} />;
|
|
103
|
+
});
|
|
104
|
+
PopoverHeader.displayName = 'Popover.Header';
|
|
105
|
+
|
|
106
|
+
type PopoverFooterProps = React.PropsWithChildren<{
|
|
107
|
+
asChild?: boolean;
|
|
108
|
+
}>;
|
|
109
|
+
const PopoverFooter = React.forwardRef<HTMLDivElement, PopoverFooterProps>((props, ref) => {
|
|
110
|
+
let { asChild, ...rest } = props;
|
|
111
|
+
let Comp = asChild ? Slot : 'div';
|
|
112
|
+
|
|
113
|
+
return <Comp ref={ref} {...rest} className={cn(popoverFooter())} />;
|
|
114
|
+
});
|
|
115
|
+
PopoverFooter.displayName = 'Popover.Footer';
|
|
116
|
+
|
|
117
|
+
type PopoverCloseElement = React.ElementRef<typeof PopoverPrimitive.Close>;
|
|
118
|
+
interface PopoverCloseProps extends React.PropsWithChildren<{}> {}
|
|
119
|
+
const PopoverClose = React.forwardRef<PopoverCloseElement, PopoverCloseProps>(
|
|
120
|
+
({ children }, ref) => (
|
|
121
|
+
<PopoverPrimitive.Close ref={ref} asChild>
|
|
122
|
+
<Slot>{children}</Slot>
|
|
123
|
+
</PopoverPrimitive.Close>
|
|
124
|
+
),
|
|
125
|
+
);
|
|
126
|
+
PopoverClose.displayName = 'Popover.Close';
|
|
127
|
+
|
|
128
|
+
export {
|
|
129
|
+
PopoverRoot as Root,
|
|
130
|
+
PopoverContent as Content,
|
|
131
|
+
PopoverBody as Body,
|
|
132
|
+
PopoverHeader as Header,
|
|
133
|
+
PopoverFooter as Footer,
|
|
134
|
+
PopoverTrigger as Trigger,
|
|
135
|
+
PopoverClose as Close,
|
|
136
|
+
};
|
|
137
|
+
export type {
|
|
138
|
+
PopoverRootProps as RootProps,
|
|
139
|
+
PopoverContentProps as ContentProps,
|
|
140
|
+
PopoverBodyProps as BodyProps,
|
|
141
|
+
PopoverHeaderProps as HeaderProps,
|
|
142
|
+
PopoverFooterProps as FooterProps,
|
|
143
|
+
PopoverTriggerProps as TriggerProps,
|
|
144
|
+
PopoverCloseProps as CloseProps,
|
|
145
|
+
};
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { Slot } from '@radix-ui/react-slot';
|
|
3
|
+
|
|
4
|
+
import { text } from '../variants/text.js';
|
|
5
|
+
|
|
6
|
+
import type { TextVariantProps } from '../variants/text.js';
|
|
7
|
+
|
|
8
|
+
interface TextOwnProps extends TextVariantProps {
|
|
9
|
+
asChild?: boolean;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
type TextSpanProps = { as?: 'span' } & React.HTMLAttributes<HTMLSpanElement>;
|
|
13
|
+
type TextDivProps = { as: 'div' } & React.HTMLAttributes<HTMLDivElement>;
|
|
14
|
+
type TextLabelProps = { as: 'label' } & React.HTMLAttributes<HTMLLabelElement>;
|
|
15
|
+
type TextPProps = { as: 'p' } & React.HTMLAttributes<HTMLParagraphElement>;
|
|
16
|
+
|
|
17
|
+
type TextProps = TextOwnProps & (TextSpanProps | TextDivProps | TextLabelProps | TextPProps);
|
|
18
|
+
|
|
19
|
+
const Text = React.forwardRef<HTMLDivElement, TextProps>((props, ref) => {
|
|
20
|
+
const {
|
|
21
|
+
as: Tag = 'span',
|
|
22
|
+
asChild,
|
|
23
|
+
children,
|
|
24
|
+
className,
|
|
25
|
+
size,
|
|
26
|
+
align,
|
|
27
|
+
color,
|
|
28
|
+
variant,
|
|
29
|
+
weight,
|
|
30
|
+
...rest
|
|
31
|
+
} = props;
|
|
32
|
+
|
|
33
|
+
return (
|
|
34
|
+
<Slot className={text({ size, align, color, variant, className, weight })} ref={ref} {...rest}>
|
|
35
|
+
{asChild ? children : <Tag>{children}</Tag>}
|
|
36
|
+
</Slot>
|
|
37
|
+
);
|
|
38
|
+
});
|
|
39
|
+
|
|
40
|
+
Text.displayName = 'Text';
|
|
41
|
+
|
|
42
|
+
export { Text };
|