@kalink-ui/seedly 0.25.0 → 0.26.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 +17 -1
- package/package.json +3 -3
- package/src/components/box/box.css.ts +21 -8
- package/src/components/box/box.responsive.ts +9 -0
- package/src/components/box/box.tsx +9 -3
- package/src/components/button/button.css.ts +199 -177
- package/src/components/button/button.responsive.ts +11 -0
- package/src/components/button/button.tsx +31 -10
- package/src/components/card/card.tsx +3 -1
- package/src/components/center/center.css.ts +23 -10
- package/src/components/center/center.responsive.ts +9 -0
- package/src/components/center/center.tsx +12 -3
- package/src/components/cluster/cluster.css.ts +116 -89
- package/src/components/cluster/cluster.responsive.ts +9 -0
- package/src/components/cluster/cluster.tsx +14 -3
- package/src/components/command/command-list.css.ts +24 -10
- package/src/components/command/command-list.responsive.ts +9 -0
- package/src/components/command/command-list.tsx +2 -2
- package/src/components/command/command.tsx +2 -2
- package/src/components/cover/cover.css.ts +23 -10
- package/src/components/cover/cover.responsive.ts +9 -0
- package/src/components/cover/cover.tsx +7 -3
- package/src/components/grid/grid.css.ts +21 -8
- package/src/components/grid/grid.responsive.ts +9 -0
- package/src/components/grid/grid.tsx +7 -3
- package/src/components/heading/heading.css.ts +75 -49
- package/src/components/heading/heading.responsive.ts +28 -0
- package/src/components/heading/heading.tsx +18 -9
- package/src/components/loader/loader.css.ts +31 -18
- package/src/components/loader/moon-loader.responsive.ts +9 -0
- package/src/components/loader/moon-loader.tsx +12 -3
- package/src/components/menu/menu-separator.css.ts +26 -10
- package/src/components/menu/menu-separator.responsive.ts +9 -0
- package/src/components/sidebar/sidebar.css.ts +21 -8
- package/src/components/sidebar/sidebar.responsive.ts +9 -0
- package/src/components/sidebar/sidebar.tsx +6 -3
- package/src/components/stack/stack.css.ts +61 -39
- package/src/components/stack/stack.responsive.ts +9 -0
- package/src/components/stack/stack.tsx +10 -3
- package/src/components/switcher/switcher.css.ts +21 -8
- package/src/components/switcher/switcher.responsive.ts +9 -0
- package/src/components/switcher/switcher.tsx +7 -3
- package/src/components/text/text.css.ts +78 -39
- package/src/components/text/text.responsive.ts +62 -0
- package/src/components/text/text.tsx +35 -8
- package/src/styles/breakpoints.ts +25 -0
- package/src/styles/index.ts +12 -0
- package/src/styles/responsive.ts +180 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,22 @@
|
|
|
1
1
|
# @kalink-ui/seedly
|
|
2
2
|
|
|
3
|
+
## 0.26.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- c0f588b: Enable responsive variants across layout components:
|
|
8
|
+
- Cluster: responsive `spacing`, `justify`, and `align`.
|
|
9
|
+
- Center: responsive `gutters`.
|
|
10
|
+
- Cover: responsive `spacing`.
|
|
11
|
+
- Grid: responsive `spacing`.
|
|
12
|
+
- Sidebar: responsive `spacing`.
|
|
13
|
+
- Switcher: responsive `spacing`.
|
|
14
|
+
|
|
15
|
+
These use `createResponsiveVariants` + `responsiveRecipe` to generate media-specific overrides.
|
|
16
|
+
|
|
17
|
+
- e451989: Typography + layout: enable responsive `variant` and `size` for `Text` and `Heading`. Also extend responsive recipes across supporting components (Button size/variant, MenuSeparator spacing, MoonLoader size).
|
|
18
|
+
- 29ce292: Stack: add responsive variants support and align with vanilla-extract recipes. Introduces responsive `spacing` and `align` props via `responsiveRecipe` utilities.
|
|
19
|
+
|
|
3
20
|
## 0.25.0
|
|
4
21
|
|
|
5
22
|
### Minor Changes
|
|
@@ -104,7 +121,6 @@
|
|
|
104
121
|
### Minor Changes
|
|
105
122
|
|
|
106
123
|
- 84903c1: Add multiple components
|
|
107
|
-
|
|
108
124
|
- ButtonIcon
|
|
109
125
|
- TextField
|
|
110
126
|
- Select
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kalink-ui/seedly",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.26.0",
|
|
4
4
|
"description": "A set of components for building UIs with React and TypeScript",
|
|
5
5
|
"sideEffects": false,
|
|
6
6
|
"license": "MIT",
|
|
@@ -44,8 +44,8 @@
|
|
|
44
44
|
"vite-tsconfig-paths": "^5.1.4",
|
|
45
45
|
"vitest": "^3.2.3",
|
|
46
46
|
"@kalink-ui/dibbly": "0.5.0",
|
|
47
|
-
"@kalink-ui/
|
|
48
|
-
"@kalink-ui/
|
|
47
|
+
"@kalink-ui/typescript-config": "0.4.0",
|
|
48
|
+
"@kalink-ui/eslint-config": "0.10.0"
|
|
49
49
|
},
|
|
50
50
|
"peerDependencies": {
|
|
51
51
|
"@vanilla-extract/css": "^1.17.1",
|
|
@@ -1,8 +1,22 @@
|
|
|
1
1
|
import { recipe, type RecipeVariants } from '@vanilla-extract/recipes';
|
|
2
2
|
|
|
3
|
-
import {
|
|
3
|
+
import {
|
|
4
|
+
createResponsiveVariants,
|
|
5
|
+
defaultMedia,
|
|
6
|
+
mapContractVars,
|
|
7
|
+
sys,
|
|
8
|
+
} from '@kalink-ui/seedly/styles';
|
|
4
9
|
import { components } from '@kalink-ui/seedly/styles/layers';
|
|
5
10
|
|
|
11
|
+
// Shared variant styles to support responsive overrides
|
|
12
|
+
export const boxSpacingStyles = mapContractVars(sys.spacing, (key) => ({
|
|
13
|
+
'@layer': {
|
|
14
|
+
[components]: {
|
|
15
|
+
padding: sys.spacing[key],
|
|
16
|
+
},
|
|
17
|
+
},
|
|
18
|
+
}));
|
|
19
|
+
|
|
6
20
|
export const boxRecipe = recipe({
|
|
7
21
|
variants: {
|
|
8
22
|
/**
|
|
@@ -35,13 +49,7 @@ export const boxRecipe = recipe({
|
|
|
35
49
|
/**
|
|
36
50
|
* The spacing between the box borders and its contents
|
|
37
51
|
*/
|
|
38
|
-
spacing:
|
|
39
|
-
'@layer': {
|
|
40
|
-
[components]: {
|
|
41
|
-
padding: sys.spacing[key],
|
|
42
|
-
},
|
|
43
|
-
},
|
|
44
|
-
})),
|
|
52
|
+
spacing: boxSpacingStyles,
|
|
45
53
|
|
|
46
54
|
/**
|
|
47
55
|
* The elevation of the box
|
|
@@ -68,3 +76,8 @@ export const boxRecipe = recipe({
|
|
|
68
76
|
});
|
|
69
77
|
|
|
70
78
|
export type BoxVariants = NonNullable<RecipeVariants<typeof boxRecipe>>;
|
|
79
|
+
|
|
80
|
+
export const spacingAt = createResponsiveVariants({
|
|
81
|
+
styles: boxSpacingStyles,
|
|
82
|
+
media: defaultMedia,
|
|
83
|
+
});
|
|
@@ -2,10 +2,16 @@ import { PolymorphicComponentProps } from '@kalink-ui/dibbly';
|
|
|
2
2
|
import { clsx } from 'clsx';
|
|
3
3
|
import { ElementType } from 'react';
|
|
4
4
|
|
|
5
|
-
import { BoxVariants
|
|
5
|
+
import { BoxVariants } from './box.css';
|
|
6
|
+
import { boxResponsive } from './box.responsive';
|
|
7
|
+
|
|
8
|
+
import type { Responsive } from '../../styles/responsive';
|
|
6
9
|
|
|
7
10
|
export type BoxProps<TUse extends ElementType> =
|
|
8
|
-
PolymorphicComponentProps<TUse> &
|
|
11
|
+
PolymorphicComponentProps<TUse> &
|
|
12
|
+
Omit<BoxVariants, 'spacing'> & {
|
|
13
|
+
spacing?: Responsive<NonNullable<BoxVariants['spacing']>>;
|
|
14
|
+
};
|
|
9
15
|
|
|
10
16
|
/**
|
|
11
17
|
* A evenly spaced container for grouping related elements. Can
|
|
@@ -26,7 +32,7 @@ export function Box<TUse extends ElementType = 'div'>({
|
|
|
26
32
|
return (
|
|
27
33
|
<Comp
|
|
28
34
|
className={clsx(
|
|
29
|
-
|
|
35
|
+
boxResponsive({ variant, spacing, radius, elevation }),
|
|
30
36
|
className,
|
|
31
37
|
)}
|
|
32
38
|
{...rest}
|
|
@@ -7,7 +7,12 @@ import {
|
|
|
7
7
|
import { calc } from '@vanilla-extract/css-utils';
|
|
8
8
|
import { recipe, type RecipeVariants } from '@vanilla-extract/recipes';
|
|
9
9
|
|
|
10
|
-
import {
|
|
10
|
+
import {
|
|
11
|
+
createResponsiveVariants,
|
|
12
|
+
defaultMedia,
|
|
13
|
+
sys,
|
|
14
|
+
typography,
|
|
15
|
+
} from '../../styles';
|
|
11
16
|
import { components } from '../../styles/layers.css';
|
|
12
17
|
import { transition } from '../../styles/transition';
|
|
13
18
|
|
|
@@ -33,6 +38,184 @@ export const buttonVars = createThemeContract({
|
|
|
33
38
|
},
|
|
34
39
|
});
|
|
35
40
|
|
|
41
|
+
// Extracted variant style maps for responsive overrides
|
|
42
|
+
export const buttonVariantStyles = {
|
|
43
|
+
/**
|
|
44
|
+
* The main variation of the button
|
|
45
|
+
*/
|
|
46
|
+
bare: {},
|
|
47
|
+
plain: {
|
|
48
|
+
'@layer': {
|
|
49
|
+
[components]: {
|
|
50
|
+
vars: {
|
|
51
|
+
...assignVars(buttonVars.color, {
|
|
52
|
+
text: sys.color.background,
|
|
53
|
+
background: sys.color.foreground,
|
|
54
|
+
}),
|
|
55
|
+
...assignVars(buttonVars.border, {
|
|
56
|
+
width: '1px',
|
|
57
|
+
style: 'solid',
|
|
58
|
+
color: 'transparent',
|
|
59
|
+
}),
|
|
60
|
+
},
|
|
61
|
+
':hover': {
|
|
62
|
+
vars: {
|
|
63
|
+
[buttonVars.color.background]:
|
|
64
|
+
`color-mix(in srgb, ${sys.color.foreground}, ${sys.color.background} calc(100% * ${sys.state.hovered.opacity}))`,
|
|
65
|
+
[buttonVars.shadow.level]: sys.elevation.minimal,
|
|
66
|
+
},
|
|
67
|
+
},
|
|
68
|
+
':disabled': {
|
|
69
|
+
vars: {
|
|
70
|
+
...assignVars(buttonVars.color, {
|
|
71
|
+
text: `color-mix(in srgb, ${sys.color.background} calc(100% * ${sys.state.muted.light}), transparent)`,
|
|
72
|
+
background: `color-mix(in srgb, ${sys.color.foreground} calc(100% * ${sys.state.muted.dark}), transparent)`,
|
|
73
|
+
}),
|
|
74
|
+
[buttonVars.shadow.level]: sys.elevation.none,
|
|
75
|
+
[buttonVars.border.color]: `transparent`,
|
|
76
|
+
},
|
|
77
|
+
},
|
|
78
|
+
},
|
|
79
|
+
},
|
|
80
|
+
},
|
|
81
|
+
outline: {
|
|
82
|
+
'@layer': {
|
|
83
|
+
[components]: {
|
|
84
|
+
vars: {
|
|
85
|
+
...assignVars(buttonVars.color, {
|
|
86
|
+
text: sys.color.foreground,
|
|
87
|
+
background: 'unset',
|
|
88
|
+
}),
|
|
89
|
+
...assignVars(buttonVars.border, {
|
|
90
|
+
width: '1px',
|
|
91
|
+
style: 'solid',
|
|
92
|
+
color: sys.color.foreground,
|
|
93
|
+
}),
|
|
94
|
+
},
|
|
95
|
+
selectors: {
|
|
96
|
+
'&:hover': {
|
|
97
|
+
vars: {
|
|
98
|
+
[buttonVars.color.background]:
|
|
99
|
+
`color-mix(in srgb, ${sys.color.foreground} calc(100% * ${sys.state.hovered.opacity}), transparent)`,
|
|
100
|
+
},
|
|
101
|
+
},
|
|
102
|
+
'&:disabled': {
|
|
103
|
+
vars: {
|
|
104
|
+
[buttonVars.color.background]: 'unset',
|
|
105
|
+
[buttonVars.color.text]:
|
|
106
|
+
`color-mix(in srgb, ${sys.color.foreground} calc(100% * ${sys.state.muted.dark}), transparent)`,
|
|
107
|
+
[buttonVars.border.color]:
|
|
108
|
+
`color-mix(in srgb, ${sys.color.foreground} calc(100% * ${sys.state.muted.dark}), transparent)`,
|
|
109
|
+
},
|
|
110
|
+
},
|
|
111
|
+
},
|
|
112
|
+
},
|
|
113
|
+
},
|
|
114
|
+
},
|
|
115
|
+
ghost: {
|
|
116
|
+
'@layer': {
|
|
117
|
+
[components]: {
|
|
118
|
+
vars: {
|
|
119
|
+
...assignVars(buttonVars.color, {
|
|
120
|
+
text: sys.color.foreground,
|
|
121
|
+
background: 'unset',
|
|
122
|
+
}),
|
|
123
|
+
...assignVars(buttonVars.border, {
|
|
124
|
+
width: '1px',
|
|
125
|
+
style: 'solid',
|
|
126
|
+
color: 'transparent',
|
|
127
|
+
}),
|
|
128
|
+
},
|
|
129
|
+
selectors: {
|
|
130
|
+
'&:hover': {
|
|
131
|
+
vars: {
|
|
132
|
+
[buttonVars.color.background]:
|
|
133
|
+
`color-mix(in srgb, ${sys.color.foreground} calc(100% * ${sys.state.hovered.opacity}), transparent)`,
|
|
134
|
+
},
|
|
135
|
+
},
|
|
136
|
+
'&:disabled': {
|
|
137
|
+
vars: {
|
|
138
|
+
[buttonVars.color.background]: 'unset',
|
|
139
|
+
[buttonVars.color.text]:
|
|
140
|
+
`color-mix(in srgb, ${sys.color.foreground} calc(100% * ${sys.state.muted.dark}), transparent)`,
|
|
141
|
+
},
|
|
142
|
+
},
|
|
143
|
+
},
|
|
144
|
+
},
|
|
145
|
+
},
|
|
146
|
+
},
|
|
147
|
+
link: {
|
|
148
|
+
'@layer': {
|
|
149
|
+
[components]: {
|
|
150
|
+
display: 'inline-flex',
|
|
151
|
+
|
|
152
|
+
textDecoration: 'none',
|
|
153
|
+
|
|
154
|
+
vars: {
|
|
155
|
+
...assignVars(buttonVars.color, {
|
|
156
|
+
text: sys.color.foreground,
|
|
157
|
+
background: 'unset',
|
|
158
|
+
}),
|
|
159
|
+
...assignVars(buttonVars.spacing, {
|
|
160
|
+
block: '0',
|
|
161
|
+
inline: '0',
|
|
162
|
+
inner: '0',
|
|
163
|
+
}),
|
|
164
|
+
},
|
|
165
|
+
selectors: {
|
|
166
|
+
'&:hover': {
|
|
167
|
+
textDecoration: 'underline',
|
|
168
|
+
},
|
|
169
|
+
|
|
170
|
+
'&:disabled': {
|
|
171
|
+
textDecoration: 'none',
|
|
172
|
+
vars: {
|
|
173
|
+
[buttonVars.color.text]:
|
|
174
|
+
`color-mix(in srgb, ${sys.color.foreground} calc(100% * ${sys.state.muted.dark}), transparent)`,
|
|
175
|
+
},
|
|
176
|
+
},
|
|
177
|
+
},
|
|
178
|
+
},
|
|
179
|
+
},
|
|
180
|
+
},
|
|
181
|
+
} as const;
|
|
182
|
+
|
|
183
|
+
export const buttonSizeStyles = {
|
|
184
|
+
sm: {
|
|
185
|
+
'@layer': {
|
|
186
|
+
[components]: {
|
|
187
|
+
vars: assignVars(buttonVars.spacing, {
|
|
188
|
+
block: sys.spacing[2],
|
|
189
|
+
inline: sys.spacing[3],
|
|
190
|
+
inner: sys.spacing[3],
|
|
191
|
+
}),
|
|
192
|
+
},
|
|
193
|
+
},
|
|
194
|
+
},
|
|
195
|
+
md: {
|
|
196
|
+
'@layer': {
|
|
197
|
+
[components]: {
|
|
198
|
+
vars: assignVars(buttonVars.spacing, {
|
|
199
|
+
block: sys.spacing[2],
|
|
200
|
+
inline: sys.spacing[4],
|
|
201
|
+
inner: sys.spacing[4],
|
|
202
|
+
}),
|
|
203
|
+
},
|
|
204
|
+
},
|
|
205
|
+
},
|
|
206
|
+
lg: {
|
|
207
|
+
'@layer': {
|
|
208
|
+
[components]: {
|
|
209
|
+
vars: assignVars(buttonVars.spacing, {
|
|
210
|
+
block: sys.spacing[3],
|
|
211
|
+
inline: sys.spacing[6],
|
|
212
|
+
inner: sys.spacing[6],
|
|
213
|
+
}),
|
|
214
|
+
},
|
|
215
|
+
},
|
|
216
|
+
},
|
|
217
|
+
} as const;
|
|
218
|
+
|
|
36
219
|
export const buttonRecipe = recipe({
|
|
37
220
|
base: {
|
|
38
221
|
'@layer': {
|
|
@@ -70,182 +253,8 @@ export const buttonRecipe = recipe({
|
|
|
70
253
|
},
|
|
71
254
|
|
|
72
255
|
variants: {
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
*/
|
|
76
|
-
variant: {
|
|
77
|
-
bare: {},
|
|
78
|
-
plain: {
|
|
79
|
-
'@layer': {
|
|
80
|
-
[components]: {
|
|
81
|
-
vars: {
|
|
82
|
-
...assignVars(buttonVars.color, {
|
|
83
|
-
text: sys.color.background,
|
|
84
|
-
background: sys.color.foreground,
|
|
85
|
-
}),
|
|
86
|
-
...assignVars(buttonVars.border, {
|
|
87
|
-
width: '1px',
|
|
88
|
-
style: 'solid',
|
|
89
|
-
color: 'transparent',
|
|
90
|
-
}),
|
|
91
|
-
},
|
|
92
|
-
':hover': {
|
|
93
|
-
vars: {
|
|
94
|
-
[buttonVars.color.background]:
|
|
95
|
-
`color-mix(in srgb, ${sys.color.foreground}, ${sys.color.background} calc(100% * ${sys.state.hovered.opacity}))`,
|
|
96
|
-
[buttonVars.shadow.level]: sys.elevation.minimal,
|
|
97
|
-
},
|
|
98
|
-
},
|
|
99
|
-
':disabled': {
|
|
100
|
-
vars: {
|
|
101
|
-
...assignVars(buttonVars.color, {
|
|
102
|
-
text: `color-mix(in srgb, ${sys.color.background} calc(100% * ${sys.state.muted.light}), transparent)`,
|
|
103
|
-
background: `color-mix(in srgb, ${sys.color.foreground} calc(100% * ${sys.state.muted.dark}), transparent)`,
|
|
104
|
-
}),
|
|
105
|
-
[buttonVars.shadow.level]: sys.elevation.none,
|
|
106
|
-
[buttonVars.border.color]: `transparent`,
|
|
107
|
-
},
|
|
108
|
-
},
|
|
109
|
-
},
|
|
110
|
-
},
|
|
111
|
-
},
|
|
112
|
-
outline: {
|
|
113
|
-
'@layer': {
|
|
114
|
-
[components]: {
|
|
115
|
-
vars: {
|
|
116
|
-
...assignVars(buttonVars.color, {
|
|
117
|
-
text: sys.color.foreground,
|
|
118
|
-
background: 'unset',
|
|
119
|
-
}),
|
|
120
|
-
...assignVars(buttonVars.border, {
|
|
121
|
-
width: '1px',
|
|
122
|
-
style: 'solid',
|
|
123
|
-
color: sys.color.foreground,
|
|
124
|
-
}),
|
|
125
|
-
},
|
|
126
|
-
selectors: {
|
|
127
|
-
'&:hover': {
|
|
128
|
-
vars: {
|
|
129
|
-
[buttonVars.color.background]:
|
|
130
|
-
`color-mix(in srgb, ${sys.color.foreground} calc(100% * ${sys.state.hovered.opacity}), transparent)`,
|
|
131
|
-
},
|
|
132
|
-
},
|
|
133
|
-
'&:disabled': {
|
|
134
|
-
vars: {
|
|
135
|
-
[buttonVars.color.background]: 'unset',
|
|
136
|
-
[buttonVars.color.text]:
|
|
137
|
-
`color-mix(in srgb, ${sys.color.foreground} calc(100% * ${sys.state.muted.dark}), transparent)`,
|
|
138
|
-
[buttonVars.border.color]:
|
|
139
|
-
`color-mix(in srgb, ${sys.color.foreground} calc(100% * ${sys.state.muted.dark}), transparent)`,
|
|
140
|
-
},
|
|
141
|
-
},
|
|
142
|
-
},
|
|
143
|
-
},
|
|
144
|
-
},
|
|
145
|
-
},
|
|
146
|
-
ghost: {
|
|
147
|
-
'@layer': {
|
|
148
|
-
[components]: {
|
|
149
|
-
vars: {
|
|
150
|
-
...assignVars(buttonVars.color, {
|
|
151
|
-
text: sys.color.foreground,
|
|
152
|
-
background: 'unset',
|
|
153
|
-
}),
|
|
154
|
-
...assignVars(buttonVars.border, {
|
|
155
|
-
width: '1px',
|
|
156
|
-
style: 'solid',
|
|
157
|
-
color: 'transparent',
|
|
158
|
-
}),
|
|
159
|
-
},
|
|
160
|
-
selectors: {
|
|
161
|
-
'&:hover': {
|
|
162
|
-
vars: {
|
|
163
|
-
[buttonVars.color.background]:
|
|
164
|
-
`color-mix(in srgb, ${sys.color.foreground} calc(100% * ${sys.state.hovered.opacity}), transparent)`,
|
|
165
|
-
},
|
|
166
|
-
},
|
|
167
|
-
'&:disabled': {
|
|
168
|
-
vars: {
|
|
169
|
-
[buttonVars.color.background]: 'unset',
|
|
170
|
-
[buttonVars.color.text]:
|
|
171
|
-
`color-mix(in srgb, ${sys.color.foreground} calc(100% * ${sys.state.muted.dark}), transparent)`,
|
|
172
|
-
},
|
|
173
|
-
},
|
|
174
|
-
},
|
|
175
|
-
},
|
|
176
|
-
},
|
|
177
|
-
},
|
|
178
|
-
link: {
|
|
179
|
-
'@layer': {
|
|
180
|
-
[components]: {
|
|
181
|
-
display: 'inline-flex',
|
|
182
|
-
|
|
183
|
-
textDecoration: 'none',
|
|
184
|
-
|
|
185
|
-
vars: {
|
|
186
|
-
...assignVars(buttonVars.color, {
|
|
187
|
-
text: sys.color.foreground,
|
|
188
|
-
background: 'unset',
|
|
189
|
-
}),
|
|
190
|
-
...assignVars(buttonVars.spacing, {
|
|
191
|
-
block: '0',
|
|
192
|
-
inline: '0',
|
|
193
|
-
inner: '0',
|
|
194
|
-
}),
|
|
195
|
-
},
|
|
196
|
-
selectors: {
|
|
197
|
-
'&:hover': {
|
|
198
|
-
textDecoration: 'underline',
|
|
199
|
-
},
|
|
200
|
-
|
|
201
|
-
'&:disabled': {
|
|
202
|
-
textDecoration: 'none',
|
|
203
|
-
vars: {
|
|
204
|
-
[buttonVars.color.text]:
|
|
205
|
-
`color-mix(in srgb, ${sys.color.foreground} calc(100% * ${sys.state.muted.dark}), transparent)`,
|
|
206
|
-
},
|
|
207
|
-
},
|
|
208
|
-
},
|
|
209
|
-
},
|
|
210
|
-
},
|
|
211
|
-
},
|
|
212
|
-
},
|
|
213
|
-
|
|
214
|
-
size: {
|
|
215
|
-
sm: {
|
|
216
|
-
'@layer': {
|
|
217
|
-
[components]: {
|
|
218
|
-
vars: assignVars(buttonVars.spacing, {
|
|
219
|
-
block: sys.spacing[2],
|
|
220
|
-
inline: sys.spacing[3],
|
|
221
|
-
inner: sys.spacing[3],
|
|
222
|
-
}),
|
|
223
|
-
},
|
|
224
|
-
},
|
|
225
|
-
},
|
|
226
|
-
md: {
|
|
227
|
-
'@layer': {
|
|
228
|
-
[components]: {
|
|
229
|
-
vars: assignVars(buttonVars.spacing, {
|
|
230
|
-
block: sys.spacing[2],
|
|
231
|
-
inline: sys.spacing[4],
|
|
232
|
-
inner: sys.spacing[4],
|
|
233
|
-
}),
|
|
234
|
-
},
|
|
235
|
-
},
|
|
236
|
-
},
|
|
237
|
-
lg: {
|
|
238
|
-
'@layer': {
|
|
239
|
-
[components]: {
|
|
240
|
-
vars: assignVars(buttonVars.spacing, {
|
|
241
|
-
block: sys.spacing[3],
|
|
242
|
-
inline: sys.spacing[6],
|
|
243
|
-
inner: sys.spacing[6],
|
|
244
|
-
}),
|
|
245
|
-
},
|
|
246
|
-
},
|
|
247
|
-
},
|
|
248
|
-
},
|
|
256
|
+
variant: buttonVariantStyles,
|
|
257
|
+
size: buttonSizeStyles,
|
|
249
258
|
},
|
|
250
259
|
|
|
251
260
|
compoundVariants: [
|
|
@@ -417,3 +426,16 @@ globalStyle(`${buttonRecipe.classNames.variants.size.lg} svg`, {
|
|
|
417
426
|
});
|
|
418
427
|
|
|
419
428
|
export type ButtonVariants = NonNullable<RecipeVariants<typeof buttonRecipe>>;
|
|
429
|
+
|
|
430
|
+
export const sizeAt = createResponsiveVariants({
|
|
431
|
+
styles: buttonSizeStyles,
|
|
432
|
+
media: defaultMedia,
|
|
433
|
+
});
|
|
434
|
+
|
|
435
|
+
export const variantAt = createResponsiveVariants({
|
|
436
|
+
styles: buttonVariantStyles,
|
|
437
|
+
media: defaultMedia,
|
|
438
|
+
});
|
|
439
|
+
|
|
440
|
+
// Note: buttonLabel uses typography class composition. For responsive
|
|
441
|
+
// behaviors on text, prefer driving size via the root button's size.
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { defaultOrder, responsiveRecipe } from '../../styles/responsive';
|
|
2
|
+
|
|
3
|
+
import { buttonRecipe, sizeAt, variantAt } from './button.css';
|
|
4
|
+
|
|
5
|
+
export const buttonResponsive = responsiveRecipe({
|
|
6
|
+
recipe: buttonRecipe,
|
|
7
|
+
at: { size: sizeAt, variant: variantAt },
|
|
8
|
+
order: defaultOrder,
|
|
9
|
+
});
|
|
10
|
+
|
|
11
|
+
// Button label uses typography classes; drive changes via root size.
|
|
@@ -2,22 +2,39 @@ import { PolymorphicComponentProps } from '@kalink-ui/dibbly';
|
|
|
2
2
|
import { clsx } from 'clsx';
|
|
3
3
|
import { ComponentType, ElementType, ReactNode } from 'react';
|
|
4
4
|
|
|
5
|
-
import {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
5
|
+
import { buttonLabel, buttonSlot, ButtonVariants } from './button.css';
|
|
6
|
+
import { buttonResponsive } from './button.responsive';
|
|
7
|
+
|
|
8
|
+
import type { Responsive } from '../../styles/responsive';
|
|
9
|
+
|
|
10
|
+
function getBase<T extends string | number>(value: Responsive<T> | undefined) {
|
|
11
|
+
if (value == null) {
|
|
12
|
+
return undefined as T | undefined;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
if (Array.isArray(value)) {
|
|
16
|
+
return (value[0] ?? undefined) as T | undefined;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
if (typeof value === 'object') {
|
|
20
|
+
const obj = value as Partial<Record<string, T>> & { xs?: T };
|
|
21
|
+
return obj.xs as T | undefined;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
return value as T;
|
|
25
|
+
}
|
|
11
26
|
|
|
12
27
|
/* eslint-disable-next-line @typescript-eslint/no-explicit-any */
|
|
13
28
|
export type ButtonTypes = 'button' | 'a' | ComponentType<any>;
|
|
14
29
|
|
|
15
30
|
export type ButtonProps<TUse extends ButtonTypes> =
|
|
16
31
|
PolymorphicComponentProps<TUse> &
|
|
17
|
-
ButtonVariants & {
|
|
32
|
+
Omit<ButtonVariants, 'size' | 'variant'> & {
|
|
18
33
|
startSlot?: ReactNode;
|
|
19
34
|
endSlot?: ReactNode;
|
|
20
35
|
children?: string;
|
|
36
|
+
size?: Responsive<NonNullable<ButtonVariants['size']>>;
|
|
37
|
+
variant?: Responsive<NonNullable<ButtonVariants['variant']>>;
|
|
21
38
|
};
|
|
22
39
|
|
|
23
40
|
export function Button<TUse extends ButtonTypes>(props: ButtonProps<TUse>) {
|
|
@@ -31,7 +48,7 @@ export function Button<TUse extends ButtonTypes>(props: ButtonProps<TUse>) {
|
|
|
31
48
|
</ButtonSlot>
|
|
32
49
|
)}
|
|
33
50
|
{children && (
|
|
34
|
-
<ButtonLabel use="span" size={size}>
|
|
51
|
+
<ButtonLabel use="span" size={getBase(size) ?? 'md'}>
|
|
35
52
|
{children}
|
|
36
53
|
</ButtonLabel>
|
|
37
54
|
)}
|
|
@@ -45,7 +62,11 @@ export function Button<TUse extends ButtonTypes>(props: ButtonProps<TUse>) {
|
|
|
45
62
|
}
|
|
46
63
|
|
|
47
64
|
export type ButtonRootProps<TUse extends ButtonTypes> =
|
|
48
|
-
PolymorphicComponentProps<TUse> &
|
|
65
|
+
PolymorphicComponentProps<TUse> &
|
|
66
|
+
Omit<ButtonVariants, 'size' | 'variant'> & {
|
|
67
|
+
size?: Responsive<NonNullable<ButtonVariants['size']>>;
|
|
68
|
+
variant?: Responsive<NonNullable<ButtonVariants['variant']>>;
|
|
69
|
+
};
|
|
49
70
|
|
|
50
71
|
export function ButtonRoot<TUse extends ButtonTypes>(
|
|
51
72
|
props: ButtonRootProps<TUse>,
|
|
@@ -54,7 +75,7 @@ export function ButtonRoot<TUse extends ButtonTypes>(
|
|
|
54
75
|
|
|
55
76
|
return (
|
|
56
77
|
<Comp
|
|
57
|
-
className={clsx(
|
|
78
|
+
className={clsx(buttonResponsive({ variant, size }), className)}
|
|
58
79
|
/* eslint-disable-next-line @typescript-eslint/no-explicit-any */
|
|
59
80
|
{...(rest as any)}
|
|
60
81
|
/>
|
|
@@ -10,11 +10,13 @@ import { ClusterProps } from '../cluster';
|
|
|
10
10
|
|
|
11
11
|
import { card, cardBody, cardFooter, cardHeader } from './card.css';
|
|
12
12
|
|
|
13
|
+
import type { Responsive } from '../../styles/responsive';
|
|
14
|
+
|
|
13
15
|
export type CardRootElement = 'article' | 'div';
|
|
14
16
|
|
|
15
17
|
export type CardProps<TUse extends CardRootElement = 'article'> =
|
|
16
18
|
BoxProps<TUse> & {
|
|
17
|
-
verticalSpacing?: Spacing
|
|
19
|
+
verticalSpacing?: Responsive<Spacing>;
|
|
18
20
|
};
|
|
19
21
|
|
|
20
22
|
export function Card<TUse extends CardRootElement = 'article'>(
|
|
@@ -1,11 +1,27 @@
|
|
|
1
1
|
import { createVar } from '@vanilla-extract/css';
|
|
2
2
|
import { recipe, type RecipeVariants } from '@vanilla-extract/recipes';
|
|
3
3
|
|
|
4
|
-
import {
|
|
4
|
+
import {
|
|
5
|
+
createResponsiveVariants,
|
|
6
|
+
defaultMedia,
|
|
7
|
+
mapContractVars,
|
|
8
|
+
sys,
|
|
9
|
+
} from '../../styles';
|
|
5
10
|
import { components } from '../../styles/layers.css';
|
|
6
11
|
|
|
7
12
|
export const gutterSize = createVar();
|
|
8
13
|
|
|
14
|
+
// Shared variant style maps to support responsive overrides
|
|
15
|
+
export const centerGuttersStyles = mapContractVars(sys.spacing, (key) => ({
|
|
16
|
+
'@layer': {
|
|
17
|
+
[components]: {
|
|
18
|
+
vars: {
|
|
19
|
+
[gutterSize]: sys.spacing[key],
|
|
20
|
+
},
|
|
21
|
+
},
|
|
22
|
+
},
|
|
23
|
+
}));
|
|
24
|
+
|
|
9
25
|
export const centerRecipe = recipe({
|
|
10
26
|
base: {
|
|
11
27
|
'@layer': {
|
|
@@ -51,16 +67,13 @@ export const centerRecipe = recipe({
|
|
|
51
67
|
/**
|
|
52
68
|
* The minimum space on either side of the content
|
|
53
69
|
*/
|
|
54
|
-
gutters:
|
|
55
|
-
'@layer': {
|
|
56
|
-
[components]: {
|
|
57
|
-
vars: {
|
|
58
|
-
[gutterSize]: sys.spacing[key],
|
|
59
|
-
},
|
|
60
|
-
},
|
|
61
|
-
},
|
|
62
|
-
})),
|
|
70
|
+
gutters: centerGuttersStyles,
|
|
63
71
|
},
|
|
64
72
|
});
|
|
65
73
|
|
|
66
74
|
export type CenterVariants = NonNullable<RecipeVariants<typeof centerRecipe>>;
|
|
75
|
+
|
|
76
|
+
export const guttersAt = createResponsiveVariants({
|
|
77
|
+
styles: centerGuttersStyles,
|
|
78
|
+
media: defaultMedia,
|
|
79
|
+
});
|