@kalink-ui/seedly 0.9.0 → 0.10.0
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 +14 -0
- package/package.json +12 -6
- package/src/components/box/box.css.ts +2 -2
- package/src/components/button/button.css.ts +45 -48
- package/src/components/button/button.tsx +11 -8
- package/src/components/button/index.ts +1 -1
- package/src/components/button-icon/button-icon.css.ts +90 -0
- package/src/components/button-icon/button-icon.tsx +23 -0
- package/src/components/button-icon/index.ts +1 -0
- package/src/components/card/card.tsx +7 -4
- package/src/components/card/index.ts +1 -1
- package/src/components/center/center.tsx +2 -2
- package/src/components/center/index.ts +1 -1
- package/src/components/cluster/cluster.css.ts +17 -0
- package/src/components/divider/divider.css.ts +11 -0
- package/src/components/divider/divider.tsx +11 -0
- package/src/components/divider/index.ts +1 -0
- package/src/components/form-field/form-field-context.ts +18 -0
- package/src/components/form-field/form-field-control.tsx +34 -0
- package/src/components/form-field/form-field-description.tsx +16 -0
- package/src/components/form-field/form-field-error.tsx +22 -0
- package/src/components/form-field/form-field-item-context.ts +6 -0
- package/src/components/form-field/form-field-item.tsx +28 -0
- package/src/components/form-field/form-field-label.tsx +27 -0
- package/src/components/form-field/form-field-message.tsx +33 -0
- package/src/components/form-field/form-field.css.ts +97 -0
- package/src/components/form-field/form-field.tsx +56 -0
- package/src/components/form-field/index.ts +9 -0
- package/src/components/frame/frame.css.ts +8 -8
- package/src/components/frame/frame.tsx +2 -6
- package/src/components/frame/index.ts +1 -1
- package/src/components/heading/heading.tsx +43 -8
- package/src/components/index.ts +27 -15
- package/src/components/input/index.ts +2 -0
- package/src/components/input/input-wrapper.tsx +58 -0
- package/src/components/input/input.css.ts +250 -0
- package/src/components/input/input.tsx +56 -0
- package/src/components/label/index.ts +1 -0
- package/src/components/label/label.css.ts +37 -0
- package/src/components/label/label.tsx +23 -0
- package/src/components/loader/index.ts +1 -0
- package/src/components/loader/loader.css.ts +109 -0
- package/src/components/loader/moon-loader.tsx +43 -0
- package/src/components/loader-overlay/index.ts +1 -0
- package/src/components/loader-overlay/loader-overlay.css.ts +35 -0
- package/src/components/loader-overlay/loader-overlay.tsx +28 -0
- package/src/components/menu/index.ts +2 -0
- package/src/components/menu/menu-item.css.ts +79 -0
- package/src/components/menu/menu-separator.css.ts +53 -0
- package/src/components/popover/index.ts +3 -0
- package/src/components/popover/popover-content.css.ts +107 -0
- package/src/components/popover/popover-content.tsx +78 -0
- package/src/components/popover/popover.tsx +6 -0
- package/src/components/scroll-area/index.ts +1 -0
- package/src/components/scroll-area/scroll-area.css.ts +72 -0
- package/src/components/scroll-area/scroll-area.tsx +39 -0
- package/src/components/scroll-area/scroll-bar.tsx +37 -0
- package/src/components/seed/seed.tsx +4 -4
- package/src/components/select/index.ts +5 -0
- package/src/components/select/select-content.css.ts +22 -0
- package/src/components/select/select-content.tsx +51 -0
- package/src/components/select/select-item.css.ts +24 -0
- package/src/components/select/select-item.tsx +24 -0
- package/src/components/select/select-root.tsx +14 -0
- package/src/components/select/select-trigger.css.ts +75 -0
- package/src/components/select/select-trigger.tsx +47 -0
- package/src/components/select/select.tsx +85 -0
- package/src/components/sheet/index.ts +5 -0
- package/src/components/sheet/sheet-content.css.ts +143 -0
- package/src/components/sheet/sheet-content.tsx +43 -0
- package/src/components/sheet/sheet-description.tsx +21 -0
- package/src/components/sheet/sheet-footer.tsx +15 -0
- package/src/components/sheet/sheet-header.css.ts +35 -0
- package/src/components/sheet/sheet-header.tsx +32 -0
- package/src/components/sheet/sheet-overlay.css.ts +43 -0
- package/src/components/sheet/sheet-overlay.tsx +14 -0
- package/src/components/sheet/sheet-title.tsx +31 -0
- package/src/components/sheet/sheet.tsx +8 -0
- package/src/components/stack/index.ts +1 -1
- package/src/components/stack/stack.tsx +2 -2
- package/src/components/text/index.ts +6 -0
- package/src/components/text/text.css.ts +31 -4
- package/src/components/text-field/index.ts +1 -0
- package/src/components/text-field/text-field.css.ts +3 -0
- package/src/components/text-field/text-field.tsx +64 -0
- package/src/components/textarea/index.ts +1 -0
- package/src/components/textarea/textarea-input.tsx +20 -0
- package/src/components/textarea/textarea.css.ts +10 -0
- package/src/components/textarea/textarea.tsx +69 -0
- package/src/styles/define-responsive-properties.ts +242 -0
- package/src/styles/extract-sprinkles-props.ts +29 -35
- package/src/styles/index.ts +9 -0
- package/src/styles/reset.css.ts +1 -0
- package/src/styles/visually-hidden.css.ts +21 -0
package/CHANGELOG.md
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kalink-ui/seedly",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.10.0",
|
|
4
4
|
"description": "A set of components for building UIs with React and TypeScript",
|
|
5
5
|
"sideEffects": false,
|
|
6
6
|
"license": "MIT",
|
|
@@ -42,13 +42,13 @@
|
|
|
42
42
|
"react-dom": "^19.0.0",
|
|
43
43
|
"storybook": "^8.6.9",
|
|
44
44
|
"type-fest": "^4.37.0",
|
|
45
|
-
"typescript": "5.8.2",
|
|
45
|
+
"typescript": "^5.8.2",
|
|
46
46
|
"vite": "^6.2.1",
|
|
47
47
|
"vite-tsconfig-paths": "^5.1.4",
|
|
48
48
|
"vitest": "^3.0.8",
|
|
49
|
-
"@kalink-ui/dibbly": "0.
|
|
50
|
-
"@kalink-ui/
|
|
51
|
-
"@kalink-ui/
|
|
49
|
+
"@kalink-ui/dibbly": "0.4.0",
|
|
50
|
+
"@kalink-ui/eslint-config": "0.9.0",
|
|
51
|
+
"@kalink-ui/typescript-config": "0.4.0"
|
|
52
52
|
},
|
|
53
53
|
"peerDependencies": {
|
|
54
54
|
"@vanilla-extract/css": "^1.17.1",
|
|
@@ -57,9 +57,15 @@
|
|
|
57
57
|
"@vanilla-extract/recipes": "^0.5.5",
|
|
58
58
|
"@vanilla-extract/sprinkles": "^1.6.3",
|
|
59
59
|
"react": "^19.0.0",
|
|
60
|
-
"react-dom": "^19.0.0"
|
|
60
|
+
"react-dom": "^19.0.0",
|
|
61
|
+
"typescript": "^5.8.2"
|
|
61
62
|
},
|
|
62
63
|
"dependencies": {
|
|
64
|
+
"@radix-ui/react-dialog": "^1.1.11",
|
|
65
|
+
"@radix-ui/react-popover": "^1.1.13",
|
|
66
|
+
"@radix-ui/react-scroll-area": "^1.2.6",
|
|
67
|
+
"@radix-ui/react-select": "^2.2.4",
|
|
68
|
+
"@radix-ui/react-slot": "^1.2.0",
|
|
63
69
|
"clsx": "^2.1.1"
|
|
64
70
|
},
|
|
65
71
|
"publishConfig": {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { recipe, type RecipeVariants } from '@vanilla-extract/recipes';
|
|
2
2
|
|
|
3
|
-
import { mapContractVars, sys } from '
|
|
4
|
-
import { components } from '
|
|
3
|
+
import { mapContractVars, sys } from '@kalink-ui/seedly/styles';
|
|
4
|
+
import { components } from '@kalink-ui/seedly/styles/layers';
|
|
5
5
|
|
|
6
6
|
export const boxRecipe = recipe({
|
|
7
7
|
variants: {
|
|
@@ -13,9 +13,6 @@ import { transition } from '../../styles/transition';
|
|
|
13
13
|
export const buttonVars = createThemeContract({
|
|
14
14
|
borderRadius: null,
|
|
15
15
|
textTransform: null,
|
|
16
|
-
});
|
|
17
|
-
|
|
18
|
-
const vars = createThemeContract({
|
|
19
16
|
color: {
|
|
20
17
|
text: null,
|
|
21
18
|
background: null,
|
|
@@ -42,22 +39,22 @@ export const buttonRecipe = recipe({
|
|
|
42
39
|
display: 'flex',
|
|
43
40
|
alignItems: 'center',
|
|
44
41
|
justifyContent: 'center',
|
|
45
|
-
gap:
|
|
42
|
+
gap: buttonVars.spacing.inner,
|
|
46
43
|
|
|
47
|
-
paddingBlock:
|
|
48
|
-
paddingInline:
|
|
44
|
+
paddingBlock: buttonVars.spacing.block,
|
|
45
|
+
paddingInline: buttonVars.spacing.inline,
|
|
49
46
|
|
|
50
|
-
color:
|
|
47
|
+
color: buttonVars.color.text,
|
|
51
48
|
textTransform: fallbackVar(buttonVars.textTransform, 'unset'),
|
|
52
|
-
backgroundColor:
|
|
49
|
+
backgroundColor: buttonVars.color.background,
|
|
53
50
|
borderRadius: fallbackVar(
|
|
54
51
|
buttonVars.borderRadius,
|
|
55
52
|
sys.shape.corner.none,
|
|
56
53
|
),
|
|
57
|
-
borderWidth:
|
|
58
|
-
borderStyle:
|
|
59
|
-
borderColor:
|
|
60
|
-
boxShadow:
|
|
54
|
+
borderWidth: buttonVars.border.width,
|
|
55
|
+
borderStyle: buttonVars.border.style,
|
|
56
|
+
borderColor: buttonVars.border.color,
|
|
57
|
+
boxShadow: buttonVars.shadow.level,
|
|
61
58
|
|
|
62
59
|
transition: transition(
|
|
63
60
|
['background-color', 'box-shadow', 'border-color', 'color'],
|
|
@@ -81,11 +78,11 @@ export const buttonRecipe = recipe({
|
|
|
81
78
|
'@layer': {
|
|
82
79
|
[components]: {
|
|
83
80
|
vars: {
|
|
84
|
-
...assignVars(
|
|
81
|
+
...assignVars(buttonVars.color, {
|
|
85
82
|
text: sys.color.background,
|
|
86
83
|
background: sys.color.foreground,
|
|
87
84
|
}),
|
|
88
|
-
...assignVars(
|
|
85
|
+
...assignVars(buttonVars.border, {
|
|
89
86
|
width: '1px',
|
|
90
87
|
style: 'solid',
|
|
91
88
|
color: 'transparent',
|
|
@@ -93,19 +90,19 @@ export const buttonRecipe = recipe({
|
|
|
93
90
|
},
|
|
94
91
|
':hover': {
|
|
95
92
|
vars: {
|
|
96
|
-
[
|
|
93
|
+
[buttonVars.color.background]:
|
|
97
94
|
`color-mix(in srgb, ${sys.color.foreground}, ${sys.color.background} calc(100% * ${sys.state.hovered.opacity}))`,
|
|
98
|
-
[
|
|
95
|
+
[buttonVars.shadow.level]: sys.elevation.minimal,
|
|
99
96
|
},
|
|
100
97
|
},
|
|
101
98
|
':disabled': {
|
|
102
99
|
vars: {
|
|
103
|
-
...assignVars(
|
|
100
|
+
...assignVars(buttonVars.color, {
|
|
104
101
|
text: `color-mix(in srgb, ${sys.color.background} calc(100% * ${sys.state.muted.light}), transparent)`,
|
|
105
102
|
background: `color-mix(in srgb, ${sys.color.foreground} calc(100% * ${sys.state.muted.dark}), transparent)`,
|
|
106
103
|
}),
|
|
107
|
-
[
|
|
108
|
-
[
|
|
104
|
+
[buttonVars.shadow.level]: sys.elevation.none,
|
|
105
|
+
[buttonVars.border.color]: `transparent`,
|
|
109
106
|
},
|
|
110
107
|
},
|
|
111
108
|
},
|
|
@@ -115,11 +112,11 @@ export const buttonRecipe = recipe({
|
|
|
115
112
|
'@layer': {
|
|
116
113
|
[components]: {
|
|
117
114
|
vars: {
|
|
118
|
-
...assignVars(
|
|
115
|
+
...assignVars(buttonVars.color, {
|
|
119
116
|
text: sys.color.foreground,
|
|
120
117
|
background: 'unset',
|
|
121
118
|
}),
|
|
122
|
-
...assignVars(
|
|
119
|
+
...assignVars(buttonVars.border, {
|
|
123
120
|
width: '1px',
|
|
124
121
|
style: 'solid',
|
|
125
122
|
color: sys.color.foreground,
|
|
@@ -128,16 +125,16 @@ export const buttonRecipe = recipe({
|
|
|
128
125
|
selectors: {
|
|
129
126
|
'&:hover': {
|
|
130
127
|
vars: {
|
|
131
|
-
[
|
|
128
|
+
[buttonVars.color.background]:
|
|
132
129
|
`color-mix(in srgb, ${sys.color.foreground} calc(100% * ${sys.state.hovered.opacity}), transparent)`,
|
|
133
130
|
},
|
|
134
131
|
},
|
|
135
132
|
'&:disabled': {
|
|
136
133
|
vars: {
|
|
137
|
-
[
|
|
138
|
-
[
|
|
134
|
+
[buttonVars.color.background]: 'unset',
|
|
135
|
+
[buttonVars.color.text]:
|
|
139
136
|
`color-mix(in srgb, ${sys.color.foreground} calc(100% * ${sys.state.muted.dark}), transparent)`,
|
|
140
|
-
[
|
|
137
|
+
[buttonVars.border.color]:
|
|
141
138
|
`color-mix(in srgb, ${sys.color.foreground} calc(100% * ${sys.state.muted.dark}), transparent)`,
|
|
142
139
|
},
|
|
143
140
|
},
|
|
@@ -149,11 +146,11 @@ export const buttonRecipe = recipe({
|
|
|
149
146
|
'@layer': {
|
|
150
147
|
[components]: {
|
|
151
148
|
vars: {
|
|
152
|
-
...assignVars(
|
|
149
|
+
...assignVars(buttonVars.color, {
|
|
153
150
|
text: sys.color.foreground,
|
|
154
151
|
background: 'unset',
|
|
155
152
|
}),
|
|
156
|
-
...assignVars(
|
|
153
|
+
...assignVars(buttonVars.border, {
|
|
157
154
|
width: '1px',
|
|
158
155
|
style: 'solid',
|
|
159
156
|
color: 'transparent',
|
|
@@ -162,14 +159,14 @@ export const buttonRecipe = recipe({
|
|
|
162
159
|
selectors: {
|
|
163
160
|
'&:hover': {
|
|
164
161
|
vars: {
|
|
165
|
-
[
|
|
162
|
+
[buttonVars.color.background]:
|
|
166
163
|
`color-mix(in srgb, ${sys.color.foreground} calc(100% * ${sys.state.hovered.opacity}), transparent)`,
|
|
167
164
|
},
|
|
168
165
|
},
|
|
169
166
|
'&:disabled': {
|
|
170
167
|
vars: {
|
|
171
|
-
[
|
|
172
|
-
[
|
|
168
|
+
[buttonVars.color.background]: 'unset',
|
|
169
|
+
[buttonVars.color.text]:
|
|
173
170
|
`color-mix(in srgb, ${sys.color.foreground} calc(100% * ${sys.state.muted.dark}), transparent)`,
|
|
174
171
|
},
|
|
175
172
|
},
|
|
@@ -185,11 +182,11 @@ export const buttonRecipe = recipe({
|
|
|
185
182
|
textDecoration: 'none',
|
|
186
183
|
|
|
187
184
|
vars: {
|
|
188
|
-
...assignVars(
|
|
185
|
+
...assignVars(buttonVars.color, {
|
|
189
186
|
text: sys.color.foreground,
|
|
190
187
|
background: 'unset',
|
|
191
188
|
}),
|
|
192
|
-
...assignVars(
|
|
189
|
+
...assignVars(buttonVars.spacing, {
|
|
193
190
|
block: '0',
|
|
194
191
|
inline: '0',
|
|
195
192
|
inner: '0',
|
|
@@ -203,7 +200,7 @@ export const buttonRecipe = recipe({
|
|
|
203
200
|
'&:disabled': {
|
|
204
201
|
textDecoration: 'none',
|
|
205
202
|
vars: {
|
|
206
|
-
[
|
|
203
|
+
[buttonVars.color.text]:
|
|
207
204
|
`color-mix(in srgb, ${sys.color.foreground} calc(100% * ${sys.state.muted.dark}), transparent)`,
|
|
208
205
|
},
|
|
209
206
|
},
|
|
@@ -217,7 +214,7 @@ export const buttonRecipe = recipe({
|
|
|
217
214
|
sm: {
|
|
218
215
|
'@layer': {
|
|
219
216
|
[components]: {
|
|
220
|
-
vars: assignVars(
|
|
217
|
+
vars: assignVars(buttonVars.spacing, {
|
|
221
218
|
block: sys.spacing[2],
|
|
222
219
|
inline: sys.spacing[3],
|
|
223
220
|
inner: sys.spacing[3],
|
|
@@ -228,7 +225,7 @@ export const buttonRecipe = recipe({
|
|
|
228
225
|
md: {
|
|
229
226
|
'@layer': {
|
|
230
227
|
[components]: {
|
|
231
|
-
vars: assignVars(
|
|
228
|
+
vars: assignVars(buttonVars.spacing, {
|
|
232
229
|
block: sys.spacing[2],
|
|
233
230
|
inline: sys.spacing[4],
|
|
234
231
|
inner: sys.spacing[4],
|
|
@@ -239,7 +236,7 @@ export const buttonRecipe = recipe({
|
|
|
239
236
|
lg: {
|
|
240
237
|
'@layer': {
|
|
241
238
|
[components]: {
|
|
242
|
-
vars: assignVars(
|
|
239
|
+
vars: assignVars(buttonVars.spacing, {
|
|
243
240
|
block: sys.spacing[3],
|
|
244
241
|
inline: sys.spacing[6],
|
|
245
242
|
inner: sys.spacing[6],
|
|
@@ -260,8 +257,8 @@ export const buttonRecipe = recipe({
|
|
|
260
257
|
'@layer': {
|
|
261
258
|
[components]: {
|
|
262
259
|
vars: {
|
|
263
|
-
[
|
|
264
|
-
[
|
|
260
|
+
[buttonVars.spacing.block]: '0',
|
|
261
|
+
[buttonVars.spacing.inline]: '0',
|
|
265
262
|
},
|
|
266
263
|
},
|
|
267
264
|
},
|
|
@@ -276,8 +273,8 @@ export const buttonRecipe = recipe({
|
|
|
276
273
|
'@layer': {
|
|
277
274
|
[components]: {
|
|
278
275
|
vars: {
|
|
279
|
-
[
|
|
280
|
-
[
|
|
276
|
+
[buttonVars.spacing.block]: '0',
|
|
277
|
+
[buttonVars.spacing.inline]: '0',
|
|
281
278
|
},
|
|
282
279
|
},
|
|
283
280
|
},
|
|
@@ -292,8 +289,8 @@ export const buttonRecipe = recipe({
|
|
|
292
289
|
'@layer': {
|
|
293
290
|
[components]: {
|
|
294
291
|
vars: {
|
|
295
|
-
[
|
|
296
|
-
[
|
|
292
|
+
[buttonVars.spacing.block]: '0',
|
|
293
|
+
[buttonVars.spacing.inline]: '0',
|
|
297
294
|
},
|
|
298
295
|
},
|
|
299
296
|
},
|
|
@@ -308,8 +305,8 @@ export const buttonRecipe = recipe({
|
|
|
308
305
|
'@layer': {
|
|
309
306
|
[components]: {
|
|
310
307
|
vars: {
|
|
311
|
-
[
|
|
312
|
-
[
|
|
308
|
+
[buttonVars.spacing.block]: '0',
|
|
309
|
+
[buttonVars.spacing.inline]: '0',
|
|
313
310
|
},
|
|
314
311
|
},
|
|
315
312
|
},
|
|
@@ -324,8 +321,8 @@ export const buttonRecipe = recipe({
|
|
|
324
321
|
'@layer': {
|
|
325
322
|
[components]: {
|
|
326
323
|
vars: {
|
|
327
|
-
[
|
|
328
|
-
[
|
|
324
|
+
[buttonVars.spacing.block]: '0',
|
|
325
|
+
[buttonVars.spacing.inline]: '0',
|
|
329
326
|
},
|
|
330
327
|
},
|
|
331
328
|
},
|
|
@@ -340,8 +337,8 @@ export const buttonRecipe = recipe({
|
|
|
340
337
|
'@layer': {
|
|
341
338
|
[components]: {
|
|
342
339
|
vars: {
|
|
343
|
-
[
|
|
344
|
-
[
|
|
340
|
+
[buttonVars.spacing.block]: '0',
|
|
341
|
+
[buttonVars.spacing.inline]: '0',
|
|
345
342
|
},
|
|
346
343
|
},
|
|
347
344
|
},
|
|
@@ -11,14 +11,15 @@ import {
|
|
|
11
11
|
} from './button.css';
|
|
12
12
|
|
|
13
13
|
/* eslint-disable-next-line @typescript-eslint/no-explicit-any */
|
|
14
|
-
type ButtonTypes = 'button' | 'a' | ComponentType<any>;
|
|
14
|
+
export type ButtonTypes = 'button' | 'a' | ComponentType<any>;
|
|
15
15
|
|
|
16
|
-
type ButtonProps<TUse extends ButtonTypes> =
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
16
|
+
export type ButtonProps<TUse extends ButtonTypes> =
|
|
17
|
+
PolymorphicComponentProps<TUse> &
|
|
18
|
+
ButtonVariants & {
|
|
19
|
+
startSlot?: ReactNode;
|
|
20
|
+
endSlot?: ReactNode;
|
|
21
|
+
children?: string;
|
|
22
|
+
};
|
|
22
23
|
|
|
23
24
|
export function Button<TUse extends ButtonTypes>(props: ButtonProps<TUse>) {
|
|
24
25
|
const {
|
|
@@ -39,7 +40,9 @@ export function Button<TUse extends ButtonTypes>(props: ButtonProps<TUse>) {
|
|
|
39
40
|
{...(rest as any)}
|
|
40
41
|
>
|
|
41
42
|
{startSlot && <span className={clsx(buttonStartSlot)}>{startSlot}</span>}
|
|
42
|
-
|
|
43
|
+
{children && (
|
|
44
|
+
<span className={clsx(buttonLabel({ size }))}>{children}</span>
|
|
45
|
+
)}
|
|
43
46
|
{endSlot && <span className={clsx(buttonEndSlot)}>{endSlot}</span>}
|
|
44
47
|
</Comp>
|
|
45
48
|
);
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export { Button } from './button';
|
|
1
|
+
export { Button, type ButtonProps, type ButtonTypes } from './button';
|
|
2
2
|
export { buttonRecipe, type ButtonVariants } from './button.css';
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
import { assignVars, globalStyle } from '@vanilla-extract/css';
|
|
2
|
+
import { calc } from '@vanilla-extract/css-utils';
|
|
3
|
+
import { recipe, RecipeVariants } from '@vanilla-extract/recipes';
|
|
4
|
+
|
|
5
|
+
import { sys } from '../../styles';
|
|
6
|
+
import { components } from '../../styles/layers.css';
|
|
7
|
+
import { buttonRecipe, buttonVars } from '../button/button.css';
|
|
8
|
+
|
|
9
|
+
export const buttonIcon = recipe({
|
|
10
|
+
base: [buttonRecipe.classNames.base],
|
|
11
|
+
|
|
12
|
+
variants: {
|
|
13
|
+
variant: buttonRecipe.classNames.variants.variant,
|
|
14
|
+
size: {
|
|
15
|
+
sm: {
|
|
16
|
+
'@layer': {
|
|
17
|
+
[components]: {
|
|
18
|
+
vars: assignVars(buttonVars.spacing, {
|
|
19
|
+
block: sys.spacing[2],
|
|
20
|
+
inline: sys.spacing[2],
|
|
21
|
+
inner: sys.spacing[2],
|
|
22
|
+
}),
|
|
23
|
+
},
|
|
24
|
+
},
|
|
25
|
+
},
|
|
26
|
+
md: {
|
|
27
|
+
'@layer': {
|
|
28
|
+
[components]: {
|
|
29
|
+
vars: assignVars(buttonVars.spacing, {
|
|
30
|
+
block: sys.spacing[2],
|
|
31
|
+
inline: sys.spacing[2],
|
|
32
|
+
inner: sys.spacing[2],
|
|
33
|
+
}),
|
|
34
|
+
},
|
|
35
|
+
},
|
|
36
|
+
},
|
|
37
|
+
lg: {
|
|
38
|
+
'@layer': {
|
|
39
|
+
[components]: {
|
|
40
|
+
vars: assignVars(buttonVars.spacing, {
|
|
41
|
+
block: sys.spacing[3],
|
|
42
|
+
inline: sys.spacing[3],
|
|
43
|
+
inner: sys.spacing[3],
|
|
44
|
+
}),
|
|
45
|
+
},
|
|
46
|
+
},
|
|
47
|
+
},
|
|
48
|
+
},
|
|
49
|
+
},
|
|
50
|
+
|
|
51
|
+
defaultVariants: {
|
|
52
|
+
variant: 'ghost',
|
|
53
|
+
size: 'md',
|
|
54
|
+
},
|
|
55
|
+
});
|
|
56
|
+
|
|
57
|
+
globalStyle(`${buttonIcon.classNames.variants.size.sm} > svg`, {
|
|
58
|
+
width: calc.multiply(
|
|
59
|
+
sys.typography.label.small.lineHeight,
|
|
60
|
+
sys.typography.label.small.size,
|
|
61
|
+
),
|
|
62
|
+
height: calc.multiply(
|
|
63
|
+
sys.typography.label.small.lineHeight,
|
|
64
|
+
sys.typography.label.small.size,
|
|
65
|
+
),
|
|
66
|
+
});
|
|
67
|
+
|
|
68
|
+
globalStyle(`${buttonIcon.classNames.variants.size.md} > svg`, {
|
|
69
|
+
width: calc.multiply(
|
|
70
|
+
sys.typography.label.medium.lineHeight,
|
|
71
|
+
sys.typography.label.medium.size,
|
|
72
|
+
),
|
|
73
|
+
height: calc.multiply(
|
|
74
|
+
sys.typography.label.medium.lineHeight,
|
|
75
|
+
sys.typography.label.medium.size,
|
|
76
|
+
),
|
|
77
|
+
});
|
|
78
|
+
|
|
79
|
+
globalStyle(`${buttonIcon.classNames.variants.size.lg} > svg`, {
|
|
80
|
+
width: calc.multiply(
|
|
81
|
+
sys.typography.label.large.lineHeight,
|
|
82
|
+
sys.typography.label.large.size,
|
|
83
|
+
),
|
|
84
|
+
height: calc.multiply(
|
|
85
|
+
sys.typography.label.large.lineHeight,
|
|
86
|
+
sys.typography.label.large.size,
|
|
87
|
+
),
|
|
88
|
+
});
|
|
89
|
+
|
|
90
|
+
export type ButtonIconVariants = NonNullable<RecipeVariants<typeof buttonIcon>>;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { PolymorphicComponentProps } from '@kalink-ui/dibbly';
|
|
2
|
+
import { clsx } from 'clsx';
|
|
3
|
+
|
|
4
|
+
import { ButtonTypes } from '../button/button';
|
|
5
|
+
|
|
6
|
+
import { buttonIcon, ButtonIconVariants } from './button-icon.css';
|
|
7
|
+
|
|
8
|
+
export type ButtonIconProps<TUse extends ButtonTypes> =
|
|
9
|
+
PolymorphicComponentProps<TUse> & ButtonIconVariants;
|
|
10
|
+
|
|
11
|
+
export function ButtonIcon<TUse extends ButtonTypes>(
|
|
12
|
+
props: ButtonIconProps<TUse>,
|
|
13
|
+
) {
|
|
14
|
+
const { use: Comp = 'button', className, variant, size, ...rest } = props;
|
|
15
|
+
|
|
16
|
+
return (
|
|
17
|
+
<Comp
|
|
18
|
+
className={clsx(buttonIcon({ variant, size }), buttonIcon, className)}
|
|
19
|
+
/* eslint-disable-next-line @typescript-eslint/no-explicit-any */
|
|
20
|
+
{...(rest as any)}
|
|
21
|
+
/>
|
|
22
|
+
);
|
|
23
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { ButtonIcon, type ButtonIconProps } from './button-icon';
|
|
@@ -10,11 +10,14 @@ import { ClusterProps } from '../cluster';
|
|
|
10
10
|
|
|
11
11
|
import { card, cardBody, cardFooter, cardHeader } from './card.css';
|
|
12
12
|
|
|
13
|
-
export type
|
|
14
|
-
|
|
15
|
-
|
|
13
|
+
export type CardRootElement = 'article' | 'div';
|
|
14
|
+
|
|
15
|
+
export type CardProps<TUse extends CardRootElement = 'article'> =
|
|
16
|
+
BoxProps<TUse> & {
|
|
17
|
+
verticalSpacing?: Spacing;
|
|
18
|
+
};
|
|
16
19
|
|
|
17
|
-
export function Card<TUse extends
|
|
20
|
+
export function Card<TUse extends CardRootElement = 'article'>(
|
|
18
21
|
props: CardProps<TUse>,
|
|
19
22
|
) {
|
|
20
23
|
const {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export { Card } from './card';
|
|
1
|
+
export { Card, type CardProps, type CardRootElement } from './card';
|
|
@@ -4,8 +4,8 @@ import { ElementType } from 'react';
|
|
|
4
4
|
|
|
5
5
|
import { centerRecipe, CenterVariants } from './center.css';
|
|
6
6
|
|
|
7
|
-
type CenterProps<TUse extends ElementType> =
|
|
8
|
-
CenterVariants;
|
|
7
|
+
export type CenterProps<TUse extends ElementType> =
|
|
8
|
+
PolymorphicComponentProps<TUse> & CenterVariants;
|
|
9
9
|
|
|
10
10
|
/**
|
|
11
11
|
* A custom element for centering a block-level element horizontally,
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export { Center } from './center';
|
|
1
|
+
export { Center, type CenterProps } from './center';
|
|
2
2
|
export { centerRecipe, type CenterVariants } from './center.css';
|
|
@@ -115,6 +115,23 @@ export const clusterRecipe = recipe({
|
|
|
115
115
|
},
|
|
116
116
|
},
|
|
117
117
|
},
|
|
118
|
+
|
|
119
|
+
direction: {
|
|
120
|
+
row: {
|
|
121
|
+
'@layer': {
|
|
122
|
+
[components]: {
|
|
123
|
+
flexDirection: 'row',
|
|
124
|
+
},
|
|
125
|
+
},
|
|
126
|
+
},
|
|
127
|
+
rowReverse: {
|
|
128
|
+
'@layer': {
|
|
129
|
+
[components]: {
|
|
130
|
+
flexDirection: 'row-reverse',
|
|
131
|
+
},
|
|
132
|
+
},
|
|
133
|
+
},
|
|
134
|
+
},
|
|
118
135
|
},
|
|
119
136
|
});
|
|
120
137
|
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { Divider, type DividerProps } from './divider';
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
3
|
+
import { createRequiredContext } from '@kalink-ui/dibbly';
|
|
4
|
+
|
|
5
|
+
interface FormFieldContext {
|
|
6
|
+
name: string;
|
|
7
|
+
registerMessageId: (id: string) => void;
|
|
8
|
+
unRegisterMessageId: (id: string) => void;
|
|
9
|
+
messageIds: string[];
|
|
10
|
+
errors?: string | null;
|
|
11
|
+
hideErrorMessage: boolean;
|
|
12
|
+
label: string;
|
|
13
|
+
disabled?: boolean;
|
|
14
|
+
hideLabel: boolean;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export const [useFormFieldContext, FormFieldContextProvider] =
|
|
18
|
+
createRequiredContext<FormFieldContext>();
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
3
|
+
import {
|
|
4
|
+
cloneElement,
|
|
5
|
+
HTMLAttributes,
|
|
6
|
+
isValidElement,
|
|
7
|
+
ReactElement,
|
|
8
|
+
} from 'react';
|
|
9
|
+
|
|
10
|
+
import { useFormFieldContext } from './form-field-context';
|
|
11
|
+
import { useFormFieldItemContext } from './form-field-item-context';
|
|
12
|
+
|
|
13
|
+
export interface FormFieldControlProps extends HTMLAttributes<HTMLElement> {
|
|
14
|
+
children: ReactElement;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export function FormFieldControl({
|
|
18
|
+
children,
|
|
19
|
+
...props
|
|
20
|
+
}: FormFieldControlProps) {
|
|
21
|
+
const { messageIds, errors } = useFormFieldContext();
|
|
22
|
+
const { id } = useFormFieldItemContext();
|
|
23
|
+
|
|
24
|
+
if (!isValidElement(children)) {
|
|
25
|
+
throw new Error('FormFieldControl must have a valid child');
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
return cloneElement(children, {
|
|
29
|
+
id,
|
|
30
|
+
'aria-describedby': messageIds.join(' ') || undefined,
|
|
31
|
+
'aria-invalid': !!errors || undefined,
|
|
32
|
+
...props,
|
|
33
|
+
});
|
|
34
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
3
|
+
import { useFormFieldItemContext } from './form-field-item-context';
|
|
4
|
+
import { FormFieldMessage, FormFieldMessageProps } from './form-field-message';
|
|
5
|
+
|
|
6
|
+
export type FormFieldDescriptionProps = Omit<FormFieldMessageProps, 'id'>;
|
|
7
|
+
|
|
8
|
+
export function FormFieldDescription(props: FormFieldDescriptionProps) {
|
|
9
|
+
const { id } = useFormFieldItemContext();
|
|
10
|
+
|
|
11
|
+
if (!props.children) {
|
|
12
|
+
return;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
return <FormFieldMessage id={`${id}-description`} {...props} />;
|
|
16
|
+
}
|