@kalink-ui/seedly 0.7.0 → 0.8.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/CHANGELOG.md +13 -0
- package/build-storybook.log +67 -0
- package/package.json +7 -18
- package/src/components/box/box.css.ts +13 -2
- package/src/components/box/box.tsx +8 -28
- package/src/components/button/button.css.ts +346 -13
- package/src/components/button/button.tsx +37 -22
- package/src/components/center/center.css.ts +10 -2
- package/src/components/center/center.tsx +6 -20
- package/src/components/cluster/cluster.css.ts +10 -2
- package/src/components/cluster/cluster.tsx +6 -21
- package/src/components/conditional-wrapper/conditional-wrapper.tsx +23 -0
- package/src/components/conditional-wrapper/index.ts +1 -0
- package/src/components/cover/cover.css.ts +4 -13
- package/src/components/cover/cover.tsx +12 -22
- package/src/components/frame/frame.css.ts +3 -0
- package/src/components/frame/frame.tsx +6 -10
- package/src/components/grid/grid.css.ts +4 -2
- package/src/components/grid/grid.tsx +11 -15
- package/src/components/heading/heading.css.ts +5 -0
- package/src/components/heading/heading.tsx +83 -0
- package/src/components/heading/index.ts +1 -0
- package/src/components/index.ts +14 -0
- package/src/{styles → components}/seed/seed.tsx +3 -6
- package/src/components/sidebar/sidebar.css.ts +7 -2
- package/src/components/sidebar/sidebar.tsx +6 -21
- package/src/components/stack/stack.css.ts +7 -2
- package/src/components/stack/stack.tsx +6 -15
- package/src/components/switcher/switcher.css.ts +1 -2
- package/src/components/switcher/switcher.tsx +6 -16
- package/src/components/text/index.ts +1 -1
- package/src/components/text/text.css.ts +12 -2
- package/src/components/text/text.tsx +41 -23
- package/src/index.ts +2 -0
- package/src/styles/index.ts +15 -2
- package/src/styles/reset.css.ts +1 -0
- package/src/styles/system-contract.css.ts +45 -31
- package/src/styles/transition.ts +26 -0
- package/src/styles/typography.css.ts +2 -4
- package/src/utils/arg-types/arg-types-from-recipe.ts +36 -0
- package/src/utils/arg-types/arg-types-from-sprinkles.ts +43 -0
- package/src/utils/arg-types/common/composable.ts +13 -0
- package/src/utils/arg-types/common/index.ts +4 -0
- package/src/utils/arg-types/common/polymorphic.ts +14 -0
- package/src/utils/arg-types/common/referable.ts +10 -0
- package/src/utils/arg-types/common/stylable.ts +14 -0
- package/src/utils/arg-types/common-args.ts +26 -0
- package/src/utils/arg-types/index.ts +3 -0
- package/src/utils/index.ts +6 -2
- /package/src/{styles → components}/seed/index.ts +0 -0
- /package/src/{utils → styles}/extract-sprinkles-props.ts +0 -0
- /package/src/{utils → styles}/map-contract-vars.ts +0 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,18 @@
|
|
|
1
1
|
# @kalink-ui/seedly
|
|
2
2
|
|
|
3
|
+
## 0.8.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- 6670251: Do not ignore arg-types files from npm package
|
|
8
|
+
|
|
9
|
+
## 0.8.0
|
|
10
|
+
|
|
11
|
+
### Minor Changes
|
|
12
|
+
|
|
13
|
+
- fb11f86: Simplify package exports
|
|
14
|
+
- abdbfa3: Create new Header and Button components
|
|
15
|
+
|
|
3
16
|
## 0.7.0
|
|
4
17
|
|
|
5
18
|
### Minor Changes
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
|
|
2
|
+
> @kalink-ui/seedly@0.8.0 build-storybook /Users/louis/dev/kalink-ui/packages/seedly
|
|
3
|
+
> storybook build --output-dir\=/tmp/chromatic--31226-9S6bTYf09Tsv --webpack-stats-json\=/tmp/chromatic--31226-9S6bTYf09Tsv
|
|
4
|
+
|
|
5
|
+
[1m@storybook/core v8.6.4
|
|
6
|
+
[22m
|
|
7
|
+
info => Cleaning outputDir: [36m../../../../../../tmp/chromatic--31226-9S6bTYf09Tsv[39m
|
|
8
|
+
info => Loading presets
|
|
9
|
+
info => Building manager..
|
|
10
|
+
info => Manager built ([38;2;181;126;229m106 ms[39m)
|
|
11
|
+
info => Building preview..
|
|
12
|
+
[36mvite v6.2.1 [32mbuilding for production...[36m[39m
|
|
13
|
+
transforming...
|
|
14
|
+
[32m✓[39m 172 modules transformed.
|
|
15
|
+
rendering chunks...
|
|
16
|
+
[2m../../../../../../tmp/chromatic--31226-9S6bTYf09Tsv/[22m[32miframe.html [39m[1m[2m 17.54 kB[22m[1m[22m
|
|
17
|
+
[2m../../../../../../tmp/chromatic--31226-9S6bTYf09Tsv/[22m[2massets/[22m[35mlayers.css.ts-C66eHa0l.css [39m[1m[2m 0.07 kB[22m[1m[22m
|
|
18
|
+
[2m../../../../../../tmp/chromatic--31226-9S6bTYf09Tsv/[22m[2massets/[22m[35mtext-or75WcbY.css [39m[1m[2m 0.11 kB[22m[1m[22m
|
|
19
|
+
[2m../../../../../../tmp/chromatic--31226-9S6bTYf09Tsv/[22m[2massets/[22m[35mframe-wUsZLpNa.css [39m[1m[2m 0.38 kB[22m[1m[22m
|
|
20
|
+
[2m../../../../../../tmp/chromatic--31226-9S6bTYf09Tsv/[22m[2massets/[22m[35mgrid-svOAN5eX.css [39m[1m[2m 0.84 kB[22m[1m[22m
|
|
21
|
+
[2m../../../../../../tmp/chromatic--31226-9S6bTYf09Tsv/[22m[2massets/[22m[35mseed-BSZyHzsv.css [39m[1m[2m 0.86 kB[22m[1m[22m
|
|
22
|
+
[2m../../../../../../tmp/chromatic--31226-9S6bTYf09Tsv/[22m[2massets/[22m[35mstack-fHq0j-Mf.css [39m[1m[2m 0.94 kB[22m[1m[22m
|
|
23
|
+
[2m../../../../../../tmp/chromatic--31226-9S6bTYf09Tsv/[22m[2massets/[22m[35msidebar-BfSQAuXb.css [39m[1m[2m 0.95 kB[22m[1m[22m
|
|
24
|
+
[2m../../../../../../tmp/chromatic--31226-9S6bTYf09Tsv/[22m[2massets/[22m[35mcenter-DXS2n_JN.css [39m[1m[2m 1.03 kB[22m[1m[22m
|
|
25
|
+
[2m../../../../../../tmp/chromatic--31226-9S6bTYf09Tsv/[22m[2massets/[22m[35mcover-ClXyrnXr.css [39m[1m[2m 1.03 kB[22m[1m[22m
|
|
26
|
+
[2m../../../../../../tmp/chromatic--31226-9S6bTYf09Tsv/[22m[2massets/[22m[35mcluster-BYRTQ7OR.css [39m[1m[2m 1.04 kB[22m[1m[22m
|
|
27
|
+
[2m../../../../../../tmp/chromatic--31226-9S6bTYf09Tsv/[22m[2massets/[22m[35mswitcher-CaEmo08Z.css [39m[1m[2m 1.15 kB[22m[1m[22m
|
|
28
|
+
[2m../../../../../../tmp/chromatic--31226-9S6bTYf09Tsv/[22m[2massets/[22m[35mbox-C2bbsHZY.css [39m[1m[2m 1.38 kB[22m[1m[22m
|
|
29
|
+
[2m../../../../../../tmp/chromatic--31226-9S6bTYf09Tsv/[22m[2massets/[22m[35mtypography.css.ts-SSimWp8t.css [39m[1m[2m 2.25 kB[22m[1m[22m
|
|
30
|
+
[2m../../../../../../tmp/chromatic--31226-9S6bTYf09Tsv/[22m[2massets/[22m[35mbutton-Bz5cKKrj.css [39m[1m[2m 2.70 kB[22m[1m[22m
|
|
31
|
+
[2m../../../../../../tmp/chromatic--31226-9S6bTYf09Tsv/[22m[2massets/[22m[36mpreview-CT6mYyLc.js [39m[1m[2m 0.16 kB[22m[1m[22m
|
|
32
|
+
[2m../../../../../../tmp/chromatic--31226-9S6bTYf09Tsv/[22m[2massets/[22m[36mpreview-BtThajRf.js [39m[1m[2m 0.17 kB[22m[1m[22m
|
|
33
|
+
[2m../../../../../../tmp/chromatic--31226-9S6bTYf09Tsv/[22m[2massets/[22m[36mpreview-DoMOH9fu.js [39m[1m[2m 0.23 kB[22m[1m[22m
|
|
34
|
+
[2m../../../../../../tmp/chromatic--31226-9S6bTYf09Tsv/[22m[2massets/[22m[36mvanilla-extract-dynamic.esm-BUlnp6I2.js [39m[1m[2m 0.31 kB[22m[1m[22m
|
|
35
|
+
[2m../../../../../../tmp/chromatic--31226-9S6bTYf09Tsv/[22m[2massets/[22m[36mpreview-caVMbCIR.js [39m[1m[2m 0.69 kB[22m[1m[22m
|
|
36
|
+
[2m../../../../../../tmp/chromatic--31226-9S6bTYf09Tsv/[22m[2massets/[22m[36mtypography.css-DQ-nfkim.js [39m[1m[2m 0.75 kB[22m[1m[22m
|
|
37
|
+
[2m../../../../../../tmp/chromatic--31226-9S6bTYf09Tsv/[22m[2massets/[22m[36mindex-ogSvIofg.js [39m[1m[2m 0.77 kB[22m[1m[22m
|
|
38
|
+
[2m../../../../../../tmp/chromatic--31226-9S6bTYf09Tsv/[22m[2massets/[22m[36mstack-CyXomRKS.js [39m[1m[2m 0.78 kB[22m[1m[22m
|
|
39
|
+
[2m../../../../../../tmp/chromatic--31226-9S6bTYf09Tsv/[22m[2massets/[22m[36mcluster.stories-CPq7agrP.js [39m[1m[2m 0.82 kB[22m[1m[22m
|
|
40
|
+
[2m../../../../../../tmp/chromatic--31226-9S6bTYf09Tsv/[22m[2massets/[22m[36mcluster-Dy3GR3gU.js [39m[1m[2m 0.94 kB[22m[1m[22m
|
|
41
|
+
[2m../../../../../../tmp/chromatic--31226-9S6bTYf09Tsv/[22m[2massets/[22m[36mframe.stories-5pt_eAa4.js [39m[1m[2m 0.98 kB[22m[1m[22m
|
|
42
|
+
[2m../../../../../../tmp/chromatic--31226-9S6bTYf09Tsv/[22m[2massets/[22m[36mclsx-yWx7DIeZ.js [39m[1m[2m 1.09 kB[22m[1m[22m
|
|
43
|
+
[2m../../../../../../tmp/chromatic--31226-9S6bTYf09Tsv/[22m[2massets/[22m[36mcommon-args-BxOi7vI0.js [39m[1m[2m 1.16 kB[22m[1m[22m
|
|
44
|
+
[2m../../../../../../tmp/chromatic--31226-9S6bTYf09Tsv/[22m[2massets/[22m[36mheading.stories-DnTp5v4g.js [39m[1m[2m 1.18 kB[22m[1m[22m
|
|
45
|
+
[2m../../../../../../tmp/chromatic--31226-9S6bTYf09Tsv/[22m[2massets/[22m[36mcenter.stories-DVx4loHB.js [39m[1m[2m 1.24 kB[22m[1m[22m
|
|
46
|
+
[2m../../../../../../tmp/chromatic--31226-9S6bTYf09Tsv/[22m[2massets/[22m[36mbox.stories-D4I0_iYq.js [39m[1m[2m 1.31 kB[22m[1m[22m
|
|
47
|
+
[2m../../../../../../tmp/chromatic--31226-9S6bTYf09Tsv/[22m[2massets/[22m[36mtext.stories-B94F4zrO.js [39m[1m[2m 1.38 kB[22m[1m[22m
|
|
48
|
+
[2m../../../../../../tmp/chromatic--31226-9S6bTYf09Tsv/[22m[2massets/[22m[36mcover.stories-D5Tpwx4p.js [39m[1m[2m 1.44 kB[22m[1m[22m
|
|
49
|
+
[2m../../../../../../tmp/chromatic--31226-9S6bTYf09Tsv/[22m[2massets/[22m[36mswitcher.stories-vZpJAqZC.js [39m[1m[2m 1.62 kB[22m[1m[22m
|
|
50
|
+
[2m../../../../../../tmp/chromatic--31226-9S6bTYf09Tsv/[22m[2massets/[22m[36mgrid.stories-Cg2miXZJ.js [39m[1m[2m 1.66 kB[22m[1m[22m
|
|
51
|
+
[2m../../../../../../tmp/chromatic--31226-9S6bTYf09Tsv/[22m[2massets/[22m[36msidebar.stories-BsY8S9Y-.js [39m[1m[2m 1.87 kB[22m[1m[22m
|
|
52
|
+
[2m../../../../../../tmp/chromatic--31226-9S6bTYf09Tsv/[22m[2massets/[22m[36mcreateRuntimeFn-62c9670f.esm-BmIeg6ni.js [39m[1m[2m 2.04 kB[22m[1m[22m
|
|
53
|
+
[2m../../../../../../tmp/chromatic--31226-9S6bTYf09Tsv/[22m[2massets/[22m[36mstack.stories-B3r3rUis.js [39m[1m[2m 2.14 kB[22m[1m[22m
|
|
54
|
+
[2m../../../../../../tmp/chromatic--31226-9S6bTYf09Tsv/[22m[2massets/[22m[36mpreview-A6H2BGQG.js [39m[1m[2m 3.40 kB[22m[1m[22m
|
|
55
|
+
[2m../../../../../../tmp/chromatic--31226-9S6bTYf09Tsv/[22m[2massets/[22m[36mpreview-xOAuwTm5.js [39m[1m[2m 4.87 kB[22m[1m[22m
|
|
56
|
+
[2m../../../../../../tmp/chromatic--31226-9S6bTYf09Tsv/[22m[2massets/[22m[36mseed.stories-OnvavYFI.js [39m[1m[2m 5.10 kB[22m[1m[22m
|
|
57
|
+
[2m../../../../../../tmp/chromatic--31226-9S6bTYf09Tsv/[22m[2massets/[22m[36mpreview-DY_pW_WS.js [39m[1m[2m 7.62 kB[22m[1m[22m
|
|
58
|
+
[2m../../../../../../tmp/chromatic--31226-9S6bTYf09Tsv/[22m[2massets/[22m[36mbutton.stories-CoUSjtPq.js [39m[1m[2m 7.87 kB[22m[1m[22m
|
|
59
|
+
[2m../../../../../../tmp/chromatic--31226-9S6bTYf09Tsv/[22m[2massets/[22m[36mpreview-CuLlOZat.js [39m[1m[2m 8.08 kB[22m[1m[22m
|
|
60
|
+
[2m../../../../../../tmp/chromatic--31226-9S6bTYf09Tsv/[22m[2massets/[22m[36mentry-preview-B0dZ39Bz.js [39m[1m[2m 38.10 kB[22m[1m[22m
|
|
61
|
+
[2m../../../../../../tmp/chromatic--31226-9S6bTYf09Tsv/[22m[2massets/[22m[36mreact-18-Uoay0tNS.js [39m[1m[2m177.34 kB[22m[1m[22m
|
|
62
|
+
[2m../../../../../../tmp/chromatic--31226-9S6bTYf09Tsv/[22m[2massets/[22m[36miframe-2U23pR0X.js [39m[1m[2m210.78 kB[22m[1m[22m
|
|
63
|
+
[2m../../../../../../tmp/chromatic--31226-9S6bTYf09Tsv/[22m[2massets/[22m[36mindex-0CFqCGht.js [39m[1m[33m658.80 kB[39m[22m
|
|
64
|
+
[32m✓ built in 1.79s[39m
|
|
65
|
+
info => Preview built ([38;2;181;126;229m2.14 s[39m)
|
|
66
|
+
info => preview stats written to [36m/tmp/chromatic--31226-9S6bTYf09Tsv/preview-stats.json[39m
|
|
67
|
+
info => Output directory: /tmp/chromatic--31226-9S6bTYf09Tsv
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kalink-ui/seedly",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.8.1",
|
|
4
4
|
"description": "A set of components for building UIs with React and TypeScript",
|
|
5
5
|
"sideEffects": false,
|
|
6
6
|
"license": "MIT",
|
|
@@ -10,22 +10,10 @@
|
|
|
10
10
|
"url": "git+https://github.com/Kalink/kalink-ui.git"
|
|
11
11
|
},
|
|
12
12
|
"exports": {
|
|
13
|
-
"
|
|
14
|
-
"./button": "./src/components/button/index.ts",
|
|
15
|
-
"./center": "./src/components/center/index.ts",
|
|
16
|
-
"./cluster": "./src/components/cluster/index.ts",
|
|
17
|
-
"./cover": "./src/components/cover/index.ts",
|
|
18
|
-
"./frame": "./src/components/frame/index.ts",
|
|
19
|
-
"./grid": "./src/components/grid/index.ts",
|
|
20
|
-
"./sidebar": "./src/components/sidebar/index.ts",
|
|
21
|
-
"./stack": "./src/components/stack/index.ts",
|
|
22
|
-
"./switcher": "./src/components/switcher/index.ts",
|
|
13
|
+
".": "./src/index.ts",
|
|
23
14
|
"./styles": "./src/styles/index.ts",
|
|
24
15
|
"./styles/reset": "./src/styles/reset.css.ts",
|
|
25
|
-
"./styles/layers": "./src/styles/layers.css.ts"
|
|
26
|
-
"./types": "./src/types/index.ts",
|
|
27
|
-
"./text": "./src/components/text/index.ts",
|
|
28
|
-
"./utils": "./src/utils/index.ts"
|
|
16
|
+
"./styles/layers": "./src/styles/layers.css.ts"
|
|
29
17
|
},
|
|
30
18
|
"devDependencies": {
|
|
31
19
|
"@chromatic-com/storybook": "^3.2.5",
|
|
@@ -50,6 +38,7 @@
|
|
|
50
38
|
"@vitejs/plugin-react": "^4.3.4",
|
|
51
39
|
"eslint": "^9.21.0",
|
|
52
40
|
"react": "^19.0.0",
|
|
41
|
+
"react-docgen-typescript": "^2.2.2",
|
|
53
42
|
"react-dom": "^19.0.0",
|
|
54
43
|
"storybook": "^8.6.4",
|
|
55
44
|
"type-fest": "^4.37.0",
|
|
@@ -57,9 +46,9 @@
|
|
|
57
46
|
"vite": "^6.2.1",
|
|
58
47
|
"vite-tsconfig-paths": "^5.1.4",
|
|
59
48
|
"vitest": "^3.0.8",
|
|
60
|
-
"@kalink-ui/
|
|
61
|
-
"@kalink-ui/eslint-config": "0.
|
|
62
|
-
"@kalink-ui/
|
|
49
|
+
"@kalink-ui/typescript-config": "0.4.0",
|
|
50
|
+
"@kalink-ui/eslint-config": "0.7.0",
|
|
51
|
+
"@kalink-ui/dibbly": "0.2.0"
|
|
63
52
|
},
|
|
64
53
|
"peerDependencies": {
|
|
65
54
|
"@vanilla-extract/css": "^1.17.1",
|
|
@@ -1,15 +1,17 @@
|
|
|
1
1
|
import { createVar } from '@vanilla-extract/css';
|
|
2
2
|
import { recipe, type RecipeVariants } from '@vanilla-extract/recipes';
|
|
3
3
|
|
|
4
|
+
import { mapContractVars, sys } from '../../styles';
|
|
4
5
|
import { components } from '../../styles/layers.css';
|
|
5
|
-
import { sys } from '../../styles/system-contract.css';
|
|
6
|
-
import { mapContractVars } from '../../utils/map-contract-vars';
|
|
7
6
|
|
|
8
7
|
export const colorForeground = createVar();
|
|
9
8
|
export const colorBackground = createVar();
|
|
10
9
|
|
|
11
10
|
export const boxRecipe = recipe({
|
|
12
11
|
variants: {
|
|
12
|
+
/**
|
|
13
|
+
* The main variation of the box
|
|
14
|
+
*/
|
|
13
15
|
variant: {
|
|
14
16
|
solid: {
|
|
15
17
|
'@layer': {
|
|
@@ -39,6 +41,9 @@ export const boxRecipe = recipe({
|
|
|
39
41
|
},
|
|
40
42
|
},
|
|
41
43
|
|
|
44
|
+
/**
|
|
45
|
+
* The spacing between the box borders and its contents
|
|
46
|
+
*/
|
|
42
47
|
spacing: mapContractVars(sys.spacing, (key) => ({
|
|
43
48
|
'@layer': {
|
|
44
49
|
[components]: {
|
|
@@ -47,6 +52,9 @@ export const boxRecipe = recipe({
|
|
|
47
52
|
},
|
|
48
53
|
})),
|
|
49
54
|
|
|
55
|
+
/**
|
|
56
|
+
* The elevation of the box
|
|
57
|
+
*/
|
|
50
58
|
elevation: mapContractVars(sys.elevation, (key) => ({
|
|
51
59
|
'@layer': {
|
|
52
60
|
[components]: {
|
|
@@ -55,6 +63,9 @@ export const boxRecipe = recipe({
|
|
|
55
63
|
},
|
|
56
64
|
})),
|
|
57
65
|
|
|
66
|
+
/**
|
|
67
|
+
* The radius of the box
|
|
68
|
+
*/
|
|
58
69
|
radius: mapContractVars(sys.shape.corner, (key) => ({
|
|
59
70
|
'@layer': {
|
|
60
71
|
[components]: {
|
|
@@ -1,31 +1,11 @@
|
|
|
1
|
+
import { PolymorphicComponentProps } from '@kalink-ui/dibbly';
|
|
1
2
|
import { clsx } from 'clsx';
|
|
3
|
+
import { ElementType } from 'react';
|
|
2
4
|
|
|
3
|
-
import {
|
|
5
|
+
import { BoxVariants, boxRecipe } from './box.css';
|
|
4
6
|
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
type BoxProps<TUse extends React.ElementType> =
|
|
8
|
-
PolymorphicComponentProps<TUse> & {
|
|
9
|
-
/**
|
|
10
|
-
* The main variation of the box
|
|
11
|
-
*/
|
|
12
|
-
variant?: BoxVariants['variant'];
|
|
13
|
-
|
|
14
|
-
/**
|
|
15
|
-
* The spacing between the box borders and its contents
|
|
16
|
-
*/
|
|
17
|
-
spacing?: BoxVariants['spacing'];
|
|
18
|
-
|
|
19
|
-
/**
|
|
20
|
-
* The elevation of the box
|
|
21
|
-
*/
|
|
22
|
-
elevation?: BoxVariants['elevation'];
|
|
23
|
-
|
|
24
|
-
/**
|
|
25
|
-
* The radius of the box
|
|
26
|
-
*/
|
|
27
|
-
radius?: BoxVariants['radius'];
|
|
28
|
-
};
|
|
7
|
+
type BoxProps<TUse extends ElementType> = PolymorphicComponentProps<TUse> &
|
|
8
|
+
BoxVariants;
|
|
29
9
|
|
|
30
10
|
/**
|
|
31
11
|
* A evenly spaced container for grouping related elements. Can
|
|
@@ -33,14 +13,14 @@ type BoxProps<TUse extends React.ElementType> =
|
|
|
33
13
|
*
|
|
34
14
|
* https://every-layout.dev/layouts/box
|
|
35
15
|
*/
|
|
36
|
-
export
|
|
16
|
+
export function Box<TUse extends ElementType = 'div'>({
|
|
37
17
|
spacing,
|
|
38
18
|
radius,
|
|
39
19
|
elevation,
|
|
40
20
|
className,
|
|
41
21
|
variant,
|
|
42
22
|
...props
|
|
43
|
-
}: BoxProps<TUse>)
|
|
23
|
+
}: BoxProps<TUse>) {
|
|
44
24
|
const { use: Comp = 'div', ...rest } = props;
|
|
45
25
|
|
|
46
26
|
return (
|
|
@@ -52,4 +32,4 @@ export const Box = <TUse extends React.ElementType = 'div'>({
|
|
|
52
32
|
{...rest}
|
|
53
33
|
/>
|
|
54
34
|
);
|
|
55
|
-
}
|
|
35
|
+
}
|
|
@@ -1,33 +1,366 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import {
|
|
2
|
+
assignVars,
|
|
3
|
+
createThemeContract,
|
|
4
|
+
fallbackVar,
|
|
5
|
+
style,
|
|
6
|
+
} from '@vanilla-extract/css';
|
|
2
7
|
import { recipe, type RecipeVariants } from '@vanilla-extract/recipes';
|
|
3
8
|
|
|
4
|
-
import { sys } from '../../styles
|
|
9
|
+
import { sys, typography } from '../../styles';
|
|
10
|
+
import { components } from '../../styles/layers.css';
|
|
11
|
+
import { transition } from '../../styles/transition';
|
|
5
12
|
|
|
6
|
-
export const
|
|
13
|
+
export const buttonVars = createThemeContract({
|
|
14
|
+
borderRadius: null,
|
|
15
|
+
textTransform: null,
|
|
16
|
+
});
|
|
17
|
+
|
|
18
|
+
const vars = createThemeContract({
|
|
7
19
|
color: {
|
|
8
|
-
|
|
9
|
-
|
|
20
|
+
text: null,
|
|
21
|
+
background: null,
|
|
22
|
+
},
|
|
23
|
+
spacing: {
|
|
24
|
+
block: null,
|
|
25
|
+
inline: null,
|
|
26
|
+
inner: null,
|
|
27
|
+
},
|
|
28
|
+
border: {
|
|
29
|
+
width: null,
|
|
30
|
+
style: null,
|
|
31
|
+
color: null,
|
|
32
|
+
},
|
|
33
|
+
shadow: {
|
|
34
|
+
level: null,
|
|
10
35
|
},
|
|
11
36
|
});
|
|
12
37
|
|
|
13
38
|
export const buttonRecipe = recipe({
|
|
14
39
|
base: {
|
|
15
|
-
|
|
40
|
+
'@layer': {
|
|
41
|
+
[components]: {
|
|
42
|
+
display: 'flex',
|
|
43
|
+
alignItems: 'center',
|
|
44
|
+
justifyContent: 'center',
|
|
45
|
+
gap: vars.spacing.inner,
|
|
46
|
+
|
|
47
|
+
paddingBlock: vars.spacing.block,
|
|
48
|
+
paddingInline: vars.spacing.inline,
|
|
49
|
+
|
|
50
|
+
color: vars.color.text,
|
|
51
|
+
textTransform: fallbackVar(buttonVars.textTransform, 'unset'),
|
|
52
|
+
backgroundColor: vars.color.background,
|
|
53
|
+
borderRadius: fallbackVar(
|
|
54
|
+
buttonVars.borderRadius,
|
|
55
|
+
sys.shape.corner.none,
|
|
56
|
+
),
|
|
57
|
+
borderWidth: vars.border.width,
|
|
58
|
+
borderStyle: vars.border.style,
|
|
59
|
+
borderColor: vars.border.color,
|
|
60
|
+
boxShadow: vars.shadow.level,
|
|
16
61
|
|
|
17
|
-
|
|
18
|
-
|
|
62
|
+
transition: transition(
|
|
63
|
+
['background-color', 'box-shadow', 'border-color', 'color'],
|
|
64
|
+
{ duration: 'short.3' },
|
|
65
|
+
),
|
|
19
66
|
|
|
20
|
-
|
|
67
|
+
':disabled': {
|
|
68
|
+
cursor: 'not-allowed',
|
|
69
|
+
},
|
|
70
|
+
},
|
|
71
|
+
},
|
|
21
72
|
},
|
|
73
|
+
|
|
22
74
|
variants: {
|
|
75
|
+
/**
|
|
76
|
+
* The main variation of the button
|
|
77
|
+
*/
|
|
23
78
|
variant: {
|
|
24
79
|
bare: {},
|
|
25
|
-
plain: {
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
80
|
+
plain: {
|
|
81
|
+
'@layer': {
|
|
82
|
+
[components]: {
|
|
83
|
+
vars: {
|
|
84
|
+
...assignVars(vars.color, {
|
|
85
|
+
text: sys.color.background,
|
|
86
|
+
background: sys.color.foreground,
|
|
87
|
+
}),
|
|
88
|
+
...assignVars(vars.border, {
|
|
89
|
+
width: '1px',
|
|
90
|
+
style: 'solid',
|
|
91
|
+
color: 'transparent',
|
|
92
|
+
}),
|
|
93
|
+
},
|
|
94
|
+
':hover': {
|
|
95
|
+
vars: {
|
|
96
|
+
[vars.color.background]:
|
|
97
|
+
`color-mix(in srgb, ${sys.color.foreground}, ${sys.color.background} calc(100% * ${sys.state.hovered.opacity}))`,
|
|
98
|
+
[vars.shadow.level]: sys.elevation.minimal,
|
|
99
|
+
},
|
|
100
|
+
},
|
|
101
|
+
':disabled': {
|
|
102
|
+
vars: {
|
|
103
|
+
...assignVars(vars.color, {
|
|
104
|
+
text: `color-mix(in srgb, ${sys.color.background} calc(100% * ${sys.state.muted.light}), transparent)`,
|
|
105
|
+
background: `color-mix(in srgb, ${sys.color.foreground} calc(100% * ${sys.state.muted.dark}), transparent)`,
|
|
106
|
+
}),
|
|
107
|
+
[vars.shadow.level]: sys.elevation.none,
|
|
108
|
+
[vars.border.color]: `transparent`,
|
|
109
|
+
},
|
|
110
|
+
},
|
|
111
|
+
},
|
|
112
|
+
},
|
|
113
|
+
},
|
|
114
|
+
outline: {
|
|
115
|
+
'@layer': {
|
|
116
|
+
[components]: {
|
|
117
|
+
vars: {
|
|
118
|
+
...assignVars(vars.color, {
|
|
119
|
+
text: sys.color.foreground,
|
|
120
|
+
background: 'unset',
|
|
121
|
+
}),
|
|
122
|
+
...assignVars(vars.border, {
|
|
123
|
+
width: '1px',
|
|
124
|
+
style: 'solid',
|
|
125
|
+
color: sys.color.foreground,
|
|
126
|
+
}),
|
|
127
|
+
},
|
|
128
|
+
selectors: {
|
|
129
|
+
'&:hover': {
|
|
130
|
+
vars: {
|
|
131
|
+
[vars.color.background]:
|
|
132
|
+
`color-mix(in srgb, ${sys.color.foreground} calc(100% * ${sys.state.hovered.opacity}), transparent)`,
|
|
133
|
+
},
|
|
134
|
+
},
|
|
135
|
+
'&:disabled': {
|
|
136
|
+
vars: {
|
|
137
|
+
[vars.color.background]: 'unset',
|
|
138
|
+
[vars.color.text]:
|
|
139
|
+
`color-mix(in srgb, ${sys.color.foreground} calc(100% * ${sys.state.muted.dark}), transparent)`,
|
|
140
|
+
[vars.border.color]:
|
|
141
|
+
`color-mix(in srgb, ${sys.color.foreground} calc(100% * ${sys.state.muted.dark}), transparent)`,
|
|
142
|
+
},
|
|
143
|
+
},
|
|
144
|
+
},
|
|
145
|
+
},
|
|
146
|
+
},
|
|
147
|
+
},
|
|
148
|
+
ghost: {
|
|
149
|
+
'@layer': {
|
|
150
|
+
[components]: {
|
|
151
|
+
vars: {
|
|
152
|
+
...assignVars(vars.color, {
|
|
153
|
+
text: sys.color.foreground,
|
|
154
|
+
background: 'unset',
|
|
155
|
+
}),
|
|
156
|
+
...assignVars(vars.border, {
|
|
157
|
+
width: '1px',
|
|
158
|
+
style: 'solid',
|
|
159
|
+
color: 'transparent',
|
|
160
|
+
}),
|
|
161
|
+
},
|
|
162
|
+
selectors: {
|
|
163
|
+
'&:hover': {
|
|
164
|
+
vars: {
|
|
165
|
+
[vars.color.background]:
|
|
166
|
+
`color-mix(in srgb, ${sys.color.foreground} calc(100% * ${sys.state.hovered.opacity}), transparent)`,
|
|
167
|
+
},
|
|
168
|
+
},
|
|
169
|
+
'&:disabled': {
|
|
170
|
+
vars: {
|
|
171
|
+
[vars.color.background]: 'unset',
|
|
172
|
+
[vars.color.text]:
|
|
173
|
+
`color-mix(in srgb, ${sys.color.foreground} calc(100% * ${sys.state.muted.dark}), transparent)`,
|
|
174
|
+
},
|
|
175
|
+
},
|
|
176
|
+
},
|
|
177
|
+
},
|
|
178
|
+
},
|
|
179
|
+
},
|
|
180
|
+
link: {
|
|
181
|
+
'@layer': {
|
|
182
|
+
[components]: {
|
|
183
|
+
display: 'inline-flex',
|
|
184
|
+
|
|
185
|
+
textDecoration: 'none',
|
|
186
|
+
|
|
187
|
+
vars: {
|
|
188
|
+
...assignVars(vars.color, {
|
|
189
|
+
text: sys.color.foreground,
|
|
190
|
+
background: 'unset',
|
|
191
|
+
}),
|
|
192
|
+
...assignVars(vars.spacing, {
|
|
193
|
+
block: '0',
|
|
194
|
+
inline: '0',
|
|
195
|
+
inner: '0',
|
|
196
|
+
}),
|
|
197
|
+
},
|
|
198
|
+
selectors: {
|
|
199
|
+
'&:hover': {
|
|
200
|
+
textDecoration: 'underline',
|
|
201
|
+
},
|
|
202
|
+
|
|
203
|
+
'&:disabled': {
|
|
204
|
+
textDecoration: 'none',
|
|
205
|
+
vars: {
|
|
206
|
+
[vars.color.text]:
|
|
207
|
+
`color-mix(in srgb, ${sys.color.foreground} calc(100% * ${sys.state.muted.dark}), transparent)`,
|
|
208
|
+
},
|
|
209
|
+
},
|
|
210
|
+
},
|
|
211
|
+
},
|
|
212
|
+
},
|
|
213
|
+
},
|
|
214
|
+
},
|
|
215
|
+
|
|
216
|
+
size: {
|
|
217
|
+
sm: {
|
|
218
|
+
'@layer': {
|
|
219
|
+
[components]: {
|
|
220
|
+
vars: assignVars(vars.spacing, {
|
|
221
|
+
block: sys.spacing[2],
|
|
222
|
+
inline: sys.spacing[3],
|
|
223
|
+
inner: sys.spacing[3],
|
|
224
|
+
}),
|
|
225
|
+
},
|
|
226
|
+
},
|
|
227
|
+
},
|
|
228
|
+
md: {
|
|
229
|
+
'@layer': {
|
|
230
|
+
[components]: {
|
|
231
|
+
vars: assignVars(vars.spacing, {
|
|
232
|
+
block: sys.spacing[2],
|
|
233
|
+
inline: sys.spacing[4],
|
|
234
|
+
inner: sys.spacing[4],
|
|
235
|
+
}),
|
|
236
|
+
},
|
|
237
|
+
},
|
|
238
|
+
},
|
|
239
|
+
lg: {
|
|
240
|
+
'@layer': {
|
|
241
|
+
[components]: {
|
|
242
|
+
vars: assignVars(vars.spacing, {
|
|
243
|
+
block: sys.spacing[3],
|
|
244
|
+
inline: sys.spacing[6],
|
|
245
|
+
inner: sys.spacing[6],
|
|
246
|
+
}),
|
|
247
|
+
},
|
|
248
|
+
},
|
|
249
|
+
},
|
|
29
250
|
},
|
|
30
251
|
},
|
|
252
|
+
|
|
253
|
+
compoundVariants: [
|
|
254
|
+
{
|
|
255
|
+
variants: {
|
|
256
|
+
variant: 'bare',
|
|
257
|
+
size: 'sm',
|
|
258
|
+
},
|
|
259
|
+
style: {
|
|
260
|
+
'@layer': {
|
|
261
|
+
[components]: {
|
|
262
|
+
vars: {
|
|
263
|
+
[vars.spacing.block]: '0',
|
|
264
|
+
[vars.spacing.inline]: '0',
|
|
265
|
+
},
|
|
266
|
+
},
|
|
267
|
+
},
|
|
268
|
+
},
|
|
269
|
+
},
|
|
270
|
+
{
|
|
271
|
+
variants: {
|
|
272
|
+
variant: 'bare',
|
|
273
|
+
size: 'md',
|
|
274
|
+
},
|
|
275
|
+
style: {
|
|
276
|
+
'@layer': {
|
|
277
|
+
[components]: {
|
|
278
|
+
vars: {
|
|
279
|
+
[vars.spacing.block]: '0',
|
|
280
|
+
[vars.spacing.inline]: '0',
|
|
281
|
+
},
|
|
282
|
+
},
|
|
283
|
+
},
|
|
284
|
+
},
|
|
285
|
+
},
|
|
286
|
+
{
|
|
287
|
+
variants: {
|
|
288
|
+
variant: 'bare',
|
|
289
|
+
size: 'lg',
|
|
290
|
+
},
|
|
291
|
+
style: {
|
|
292
|
+
'@layer': {
|
|
293
|
+
[components]: {
|
|
294
|
+
vars: {
|
|
295
|
+
[vars.spacing.block]: '0',
|
|
296
|
+
[vars.spacing.inline]: '0',
|
|
297
|
+
},
|
|
298
|
+
},
|
|
299
|
+
},
|
|
300
|
+
},
|
|
301
|
+
},
|
|
302
|
+
{
|
|
303
|
+
variants: {
|
|
304
|
+
variant: 'link',
|
|
305
|
+
size: 'sm',
|
|
306
|
+
},
|
|
307
|
+
style: {
|
|
308
|
+
'@layer': {
|
|
309
|
+
[components]: {
|
|
310
|
+
vars: {
|
|
311
|
+
[vars.spacing.block]: '0',
|
|
312
|
+
[vars.spacing.inline]: '0',
|
|
313
|
+
},
|
|
314
|
+
},
|
|
315
|
+
},
|
|
316
|
+
},
|
|
317
|
+
},
|
|
318
|
+
{
|
|
319
|
+
variants: {
|
|
320
|
+
variant: 'link',
|
|
321
|
+
size: 'md',
|
|
322
|
+
},
|
|
323
|
+
style: {
|
|
324
|
+
'@layer': {
|
|
325
|
+
[components]: {
|
|
326
|
+
vars: {
|
|
327
|
+
[vars.spacing.block]: '0',
|
|
328
|
+
[vars.spacing.inline]: '0',
|
|
329
|
+
},
|
|
330
|
+
},
|
|
331
|
+
},
|
|
332
|
+
},
|
|
333
|
+
},
|
|
334
|
+
{
|
|
335
|
+
variants: {
|
|
336
|
+
variant: 'link',
|
|
337
|
+
size: 'lg',
|
|
338
|
+
},
|
|
339
|
+
style: {
|
|
340
|
+
'@layer': {
|
|
341
|
+
[components]: {
|
|
342
|
+
vars: {
|
|
343
|
+
[vars.spacing.block]: '0',
|
|
344
|
+
[vars.spacing.inline]: '0',
|
|
345
|
+
},
|
|
346
|
+
},
|
|
347
|
+
},
|
|
348
|
+
},
|
|
349
|
+
},
|
|
350
|
+
],
|
|
31
351
|
});
|
|
32
352
|
|
|
353
|
+
export const buttonLabel = recipe({
|
|
354
|
+
variants: {
|
|
355
|
+
size: {
|
|
356
|
+
sm: [typography.label.small],
|
|
357
|
+
md: [typography.label.medium],
|
|
358
|
+
lg: [typography.label.large],
|
|
359
|
+
},
|
|
360
|
+
},
|
|
361
|
+
});
|
|
362
|
+
|
|
363
|
+
export const buttonStartSlot = style({});
|
|
364
|
+
export const buttonEndSlot = style({});
|
|
365
|
+
|
|
33
366
|
export type ButtonVariants = NonNullable<RecipeVariants<typeof buttonRecipe>>;
|