@kalink-ui/seedly 0.34.4 → 0.35.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 +12 -0
- package/README.md +34 -0
- package/docs/component-theming.md +295 -0
- package/docs/theming-strategy.md +69 -0
- package/docs/tone-system.md +139 -0
- package/docs/value-and-scope.md +65 -0
- package/package.json +4 -3
- package/src/components/alert-dialog/alert-dialog-action.tsx +0 -2
- package/src/components/alert-dialog/alert-dialog-cancel.tsx +0 -1
- package/src/components/alert-dialog/alert-dialog-content.css.ts +1 -1
- package/src/components/alert-dialog/alert-dialog-content.tsx +13 -6
- package/src/components/alert-dialog/alert-dialog-footer.css.ts +3 -3
- package/src/components/alert-dialog/alert-dialog-footer.tsx +2 -2
- package/src/components/alert-dialog/alert-dialog-header.tsx +4 -4
- package/src/components/alert-dialog/index.ts +9 -0
- package/src/components/box/box.css.ts +137 -39
- package/src/components/box/box.responsive.ts +2 -2
- package/src/components/box/box.tsx +2 -3
- package/src/components/box/index.ts +1 -1
- package/src/components/button/button.css.ts +142 -149
- package/src/components/button/button.responsive.ts +2 -2
- package/src/components/button/button.tsx +44 -31
- package/src/components/button/index.ts +2 -2
- package/src/components/button-icon/button-icon.css.ts +26 -62
- package/src/components/button-icon/button-icon.responsive.ts +2 -2
- package/src/components/button-icon/button-icon.tsx +5 -7
- package/src/components/card/card.css.ts +1 -5
- package/src/components/card/card.tsx +11 -11
- package/src/components/center/center.css.ts +61 -21
- package/src/components/center/center.responsive.ts +2 -2
- package/src/components/center/center.tsx +4 -6
- package/src/components/center/index.ts +1 -1
- package/src/components/cluster/cluster.css.ts +37 -99
- package/src/components/cluster/cluster.responsive.ts +13 -2
- package/src/components/cluster/cluster.tsx +6 -5
- package/src/components/cluster/index.ts +5 -1
- package/src/components/command/command-empty.tsx +36 -4
- package/src/components/command/command-group.css.ts +23 -7
- package/src/components/command/command-group.tsx +30 -6
- package/src/components/command/command-input.css.ts +2 -2
- package/src/components/command/command-item.tsx +26 -2
- package/src/components/command/command-list.css.ts +2 -2
- package/src/components/command/command-list.responsive.ts +2 -2
- package/src/components/command/command-list.tsx +1 -2
- package/src/components/command/command-separator.tsx +7 -5
- package/src/components/cover/cover.css.ts +29 -8
- package/src/components/cover/cover.tsx +13 -13
- package/src/components/cover/index.ts +2 -2
- package/src/components/divider/divider.css.ts +9 -4
- package/src/components/form-field/form-field-context.ts +3 -0
- package/src/components/form-field/form-field-item.tsx +3 -3
- package/src/components/form-field/form-field-message.tsx +34 -3
- package/src/components/form-field/form-field.css.ts +78 -16
- package/src/components/form-field/form-field.tsx +5 -0
- package/src/components/form-field/index.ts +1 -1
- package/src/components/frame/frame.css.ts +96 -59
- package/src/components/frame/frame.responsive.ts +9 -0
- package/src/components/frame/frame.tsx +11 -5
- package/src/components/frame/index.ts +1 -1
- package/src/components/grid/grid-child.tsx +14 -10
- package/src/components/grid/grid.css.ts +56 -148
- package/src/components/grid/grid.tsx +40 -18
- package/src/components/grid/index.ts +4 -3
- package/src/components/heading/heading.css.ts +4 -4
- package/src/components/heading/heading.responsive.ts +6 -6
- package/src/components/heading/heading.tsx +3 -4
- package/src/components/heading/index.ts +1 -1
- package/src/components/input/index.ts +4 -1
- package/src/components/input/input-wrapper.tsx +20 -8
- package/src/components/input/input.css.ts +121 -93
- package/src/components/input/input.responsive.ts +9 -0
- package/src/components/input/input.tsx +7 -1
- package/src/components/label/label.css.ts +2 -2
- package/src/components/label/label.tsx +23 -3
- package/src/components/layout-maps.ts +120 -0
- package/src/components/loader/index.ts +2 -1
- package/src/components/loader/loader.css.ts +91 -54
- package/src/components/loader/moon-loader.responsive.ts +2 -2
- package/src/components/loader/moon-loader.tsx +4 -5
- package/src/components/loader-overlay/loader-overlay.css.ts +3 -3
- package/src/components/loader-overlay/loader-overlay.tsx +5 -2
- package/src/components/menu/index.ts +2 -2
- package/src/components/menu/menu-item.css.ts +102 -46
- package/src/components/menu/menu-separator.css.ts +27 -15
- package/src/components/menu/menu-separator.responsive.ts +2 -2
- package/src/components/overlay/overlay.css.ts +1 -1
- package/src/components/popover/index.ts +1 -1
- package/src/components/popover/popover-content.css.ts +69 -52
- package/src/components/popover/popover-content.tsx +22 -6
- package/src/components/scroll-area/scroll-area.css.ts +3 -3
- package/src/components/scroll-area/scroll-bar.tsx +2 -2
- package/src/components/select/index.ts +4 -5
- package/src/components/select/select-content.css.ts +1 -1
- package/src/components/select/select-content.tsx +2 -2
- package/src/components/select/select-item.tsx +11 -3
- package/src/components/select/select-trigger.css.ts +14 -18
- package/src/components/select/select-trigger.tsx +18 -8
- package/src/components/select/select.tsx +10 -6
- package/src/components/sheet/index.ts +9 -0
- package/src/components/sheet/sheet-content.css.ts +2 -2
- package/src/components/sheet/sheet-content.tsx +25 -7
- package/src/components/sheet/sheet-description.tsx +5 -7
- package/src/components/sheet/sheet-footer.tsx +3 -1
- package/src/components/sheet/sheet-header.css.ts +1 -1
- package/src/components/sheet/sheet-header.tsx +3 -3
- package/src/components/sheet/sheet-overlay.tsx +3 -4
- package/src/components/sheet/sheet-title.tsx +1 -1
- package/src/components/sidebar/index.ts +5 -1
- package/src/components/sidebar/sidebar.css.ts +35 -9
- package/src/components/sidebar/sidebar.tsx +7 -10
- package/src/components/skeleton/skeleton.css.ts +23 -14
- package/src/components/skeleton/skeleton.tsx +26 -7
- package/src/components/stack/index.ts +1 -1
- package/src/components/stack/stack.css.ts +18 -46
- package/src/components/stack/stack.tsx +1 -2
- package/src/components/switcher/index.ts +5 -1
- package/src/components/switcher/switcher.css.ts +105 -72
- package/src/components/switcher/switcher.responsive.ts +2 -2
- package/src/components/switcher/switcher.tsx +5 -5
- package/src/components/text/text.css.ts +93 -105
- package/src/components/text/text.responsive.ts +3 -63
- package/src/components/text/text.tsx +16 -28
- package/src/components/text-field/index.ts +1 -2
- package/src/components/text-field/text-field.tsx +5 -7
- package/src/components/textarea/textarea-input.tsx +30 -3
- package/src/components/textarea/textarea.css.ts +12 -7
- package/src/components/textarea/textarea.tsx +9 -3
- package/src/components/visually-hidden/visually-hidden.css.ts +16 -10
- package/src/styles/define-responsive-properties.ts +5 -1
- package/src/styles/index.ts +12 -0
- package/src/styles/responsive.ts +72 -43
- package/src/styles/system-contract.css.ts +22 -3
- package/src/styles/theme/sprout-ref.css.ts +107 -0
- package/src/styles/theme/sprout.css.ts +259 -0
- package/src/styles/tone.ts +69 -0
- package/src/styles/typography.responsive.css.ts +35 -0
- package/src/styles/typography.responsive.ts +104 -0
- package/src/utils/arg-types/index.ts +1 -0
- package/src/utils/arg-types/responsive-arg.ts +28 -0
- package/src/utils/index.ts +1 -0
- package/src/components/command/command-item.css.ts +0 -32
- package/src/components/select/select.css.ts +0 -3
- package/src/components/sheet/sheet-body.css.ts +0 -68
- package/src/components/text-field/text-field.css.ts +0 -3
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import { createVar, style, type StyleRule } from '@vanilla-extract/css';
|
|
2
2
|
import { recipe, type RecipeVariants } from '@vanilla-extract/recipes';
|
|
3
3
|
|
|
4
|
-
import { createResponsiveVariants, defaultMedia
|
|
4
|
+
import { createResponsiveVariants, defaultMedia } from '../../styles';
|
|
5
5
|
import { components } from '../../styles/layers.css';
|
|
6
6
|
|
|
7
7
|
export const lineClampNumber = createVar();
|
|
8
8
|
export const textAlign = createVar();
|
|
9
9
|
|
|
10
|
-
const lineClamp =
|
|
10
|
+
const lineClamp = {
|
|
11
11
|
'@layer': {
|
|
12
12
|
[components]: {
|
|
13
13
|
display: '-webkit-box',
|
|
@@ -16,7 +16,7 @@ const lineClamp = style({
|
|
|
16
16
|
overflow: 'hidden',
|
|
17
17
|
},
|
|
18
18
|
},
|
|
19
|
-
}
|
|
19
|
+
} satisfies StyleRule;
|
|
20
20
|
|
|
21
21
|
// Extract align styles for responsive overrides
|
|
22
22
|
export const textAlignStyles = {
|
|
@@ -58,52 +58,107 @@ export const textAlignStyles = {
|
|
|
58
58
|
},
|
|
59
59
|
} as const;
|
|
60
60
|
|
|
61
|
-
export const
|
|
62
|
-
|
|
61
|
+
export const textWrapStyles = {
|
|
62
|
+
true: {
|
|
63
63
|
'@layer': {
|
|
64
64
|
[components]: {
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
vars: {
|
|
68
|
-
[textAlign]: 'inherit',
|
|
69
|
-
},
|
|
65
|
+
textWrap: 'wrap',
|
|
70
66
|
},
|
|
71
67
|
},
|
|
72
68
|
},
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
69
|
+
false: {
|
|
70
|
+
'@layer': {
|
|
71
|
+
[components]: {
|
|
72
|
+
textWrap: 'nowrap',
|
|
73
|
+
},
|
|
74
|
+
},
|
|
75
|
+
},
|
|
76
|
+
balance: {
|
|
77
|
+
'@layer': {
|
|
78
|
+
[components]: {
|
|
79
|
+
textWrap: 'balance',
|
|
80
|
+
},
|
|
81
|
+
},
|
|
82
|
+
},
|
|
83
|
+
pretty: {
|
|
84
|
+
'@layer': {
|
|
85
|
+
[components]: {
|
|
86
|
+
textWrap: 'pretty',
|
|
87
|
+
},
|
|
88
|
+
},
|
|
89
|
+
},
|
|
90
|
+
} satisfies Record<'true' | 'false' | 'balance' | 'pretty', StyleRule>;
|
|
91
|
+
|
|
92
|
+
export const textLineClampStyles = {
|
|
93
|
+
2: [
|
|
94
|
+
lineClamp,
|
|
95
|
+
{
|
|
96
|
+
'@layer': {
|
|
97
|
+
[components]: {
|
|
98
|
+
vars: {
|
|
99
|
+
[lineClampNumber]: '2',
|
|
82
100
|
},
|
|
83
101
|
},
|
|
84
102
|
},
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
103
|
+
},
|
|
104
|
+
],
|
|
105
|
+
3: [
|
|
106
|
+
lineClamp,
|
|
107
|
+
{
|
|
108
|
+
'@layer': {
|
|
109
|
+
[components]: {
|
|
110
|
+
vars: {
|
|
111
|
+
[lineClampNumber]: '3',
|
|
89
112
|
},
|
|
90
113
|
},
|
|
91
114
|
},
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
115
|
+
},
|
|
116
|
+
],
|
|
117
|
+
4: [
|
|
118
|
+
lineClamp,
|
|
119
|
+
{
|
|
120
|
+
'@layer': {
|
|
121
|
+
[components]: {
|
|
122
|
+
vars: {
|
|
123
|
+
[lineClampNumber]: '4',
|
|
96
124
|
},
|
|
97
125
|
},
|
|
98
126
|
},
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
127
|
+
},
|
|
128
|
+
],
|
|
129
|
+
5: [
|
|
130
|
+
lineClamp,
|
|
131
|
+
{
|
|
132
|
+
'@layer': {
|
|
133
|
+
[components]: {
|
|
134
|
+
vars: {
|
|
135
|
+
[lineClampNumber]: '5',
|
|
103
136
|
},
|
|
104
137
|
},
|
|
105
138
|
},
|
|
106
139
|
},
|
|
140
|
+
],
|
|
141
|
+
} satisfies Record<2 | 3 | 4 | 5, StyleRule | StyleRule[]>;
|
|
142
|
+
|
|
143
|
+
export const textRecipe = recipe({
|
|
144
|
+
base: {
|
|
145
|
+
'@layer': {
|
|
146
|
+
[components]: {
|
|
147
|
+
textAlign,
|
|
148
|
+
|
|
149
|
+
vars: {
|
|
150
|
+
[textAlign]: 'inherit',
|
|
151
|
+
},
|
|
152
|
+
},
|
|
153
|
+
},
|
|
154
|
+
},
|
|
155
|
+
variants: {
|
|
156
|
+
/**
|
|
157
|
+
* Controls the wrapping of the text.
|
|
158
|
+
*/
|
|
159
|
+
wrap: {
|
|
160
|
+
...textWrapStyles,
|
|
161
|
+
},
|
|
107
162
|
|
|
108
163
|
/**
|
|
109
164
|
* If true, use an ellipsis when the text overflows the element.
|
|
@@ -127,54 +182,7 @@ export const textRecipe = recipe({
|
|
|
127
182
|
* the provided number of lines.
|
|
128
183
|
*/
|
|
129
184
|
lineClamp: {
|
|
130
|
-
|
|
131
|
-
lineClamp,
|
|
132
|
-
{
|
|
133
|
-
'@layer': {
|
|
134
|
-
[components]: {
|
|
135
|
-
vars: {
|
|
136
|
-
[lineClampNumber]: '2',
|
|
137
|
-
},
|
|
138
|
-
},
|
|
139
|
-
},
|
|
140
|
-
},
|
|
141
|
-
],
|
|
142
|
-
3: [
|
|
143
|
-
lineClamp,
|
|
144
|
-
{
|
|
145
|
-
'@layer': {
|
|
146
|
-
[components]: {
|
|
147
|
-
vars: {
|
|
148
|
-
[lineClampNumber]: '3',
|
|
149
|
-
},
|
|
150
|
-
},
|
|
151
|
-
},
|
|
152
|
-
},
|
|
153
|
-
],
|
|
154
|
-
4: [
|
|
155
|
-
lineClamp,
|
|
156
|
-
{
|
|
157
|
-
'@layer': {
|
|
158
|
-
[components]: {
|
|
159
|
-
vars: {
|
|
160
|
-
[lineClampNumber]: '4',
|
|
161
|
-
},
|
|
162
|
-
},
|
|
163
|
-
},
|
|
164
|
-
},
|
|
165
|
-
],
|
|
166
|
-
5: [
|
|
167
|
-
lineClamp,
|
|
168
|
-
{
|
|
169
|
-
'@layer': {
|
|
170
|
-
[components]: {
|
|
171
|
-
vars: {
|
|
172
|
-
[lineClampNumber]: '5',
|
|
173
|
-
},
|
|
174
|
-
},
|
|
175
|
-
},
|
|
176
|
-
},
|
|
177
|
-
],
|
|
185
|
+
...textLineClampStyles,
|
|
178
186
|
},
|
|
179
187
|
|
|
180
188
|
/**
|
|
@@ -199,32 +207,12 @@ export const alignAt = createResponsiveVariants({
|
|
|
199
207
|
media: defaultMedia,
|
|
200
208
|
});
|
|
201
209
|
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
const k = `${variantKey}.${sizeKey}`;
|
|
207
|
-
const rule: StyleRule = {
|
|
208
|
-
'@layer': {
|
|
209
|
-
[components]: {
|
|
210
|
-
fontFamily: v.font,
|
|
211
|
-
fontWeight: v.weight,
|
|
212
|
-
lineHeight: v.lineHeight,
|
|
213
|
-
letterSpacing: v.tracking,
|
|
214
|
-
fontSize: v.size,
|
|
215
|
-
},
|
|
216
|
-
},
|
|
217
|
-
};
|
|
218
|
-
|
|
219
|
-
return [k, rule] as const;
|
|
220
|
-
});
|
|
221
|
-
},
|
|
222
|
-
);
|
|
210
|
+
export const wrapAt = createResponsiveVariants({
|
|
211
|
+
styles: textWrapStyles,
|
|
212
|
+
media: defaultMedia,
|
|
213
|
+
});
|
|
223
214
|
|
|
224
|
-
export const
|
|
225
|
-
styles:
|
|
226
|
-
string,
|
|
227
|
-
StyleRule
|
|
228
|
-
>,
|
|
215
|
+
export const lineClampAt = createResponsiveVariants({
|
|
216
|
+
styles: textLineClampStyles,
|
|
229
217
|
media: defaultMedia,
|
|
230
218
|
});
|
|
@@ -1,69 +1,9 @@
|
|
|
1
|
-
import {
|
|
2
|
-
defaultOrder,
|
|
3
|
-
resolveResponsive,
|
|
4
|
-
responsiveRecipe,
|
|
5
|
-
TypographySize,
|
|
6
|
-
TypographyVariant,
|
|
7
|
-
type BreakpointWithBase,
|
|
8
|
-
type Responsive,
|
|
9
|
-
} from '../../styles';
|
|
1
|
+
import { defaultOrder, responsiveRecipe } from '../../styles/responsive';
|
|
10
2
|
|
|
11
|
-
import { alignAt, textRecipe,
|
|
3
|
+
import { alignAt, lineClampAt, textRecipe, wrapAt } from './text.css';
|
|
12
4
|
|
|
13
5
|
export const textResponsive = responsiveRecipe({
|
|
14
6
|
recipe: textRecipe,
|
|
15
|
-
at: { align: alignAt },
|
|
7
|
+
at: { align: alignAt, wrap: wrapAt, lineClamp: lineClampAt },
|
|
16
8
|
order: defaultOrder,
|
|
17
9
|
});
|
|
18
|
-
|
|
19
|
-
export function buildTypographyOverrides(opts: {
|
|
20
|
-
variant?: Responsive<TypographyVariant>;
|
|
21
|
-
size?: Responsive<TypographySize>;
|
|
22
|
-
}) {
|
|
23
|
-
const { variant, size } = opts;
|
|
24
|
-
const varMap = resolveResponsive<TypographyVariant, BreakpointWithBase>(
|
|
25
|
-
variant,
|
|
26
|
-
defaultOrder,
|
|
27
|
-
);
|
|
28
|
-
const sizeMap = resolveResponsive<TypographySize, BreakpointWithBase>(
|
|
29
|
-
size,
|
|
30
|
-
defaultOrder,
|
|
31
|
-
);
|
|
32
|
-
|
|
33
|
-
// Carry forward variant/size values across breakpoints so that
|
|
34
|
-
// a value set at md persists to lg/xl/... unless overridden again.
|
|
35
|
-
let currentVariant = varMap.xs ?? (variant as TypographyVariant | undefined);
|
|
36
|
-
let currentSize = sizeMap.xs ?? (size as TypographySize | undefined);
|
|
37
|
-
|
|
38
|
-
const classes: string[] = [];
|
|
39
|
-
|
|
40
|
-
for (const bp of defaultOrder) {
|
|
41
|
-
if (bp === 'xs') {
|
|
42
|
-
continue;
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
if (varMap[bp] != null) {
|
|
46
|
-
currentVariant = varMap[bp];
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
if (sizeMap[bp] != null) {
|
|
50
|
-
currentSize = sizeMap[bp];
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
if (currentVariant && currentSize) {
|
|
54
|
-
const key = `${String(currentVariant)}.${String(currentSize)}`;
|
|
55
|
-
const cls = (
|
|
56
|
-
typographyAt as Record<
|
|
57
|
-
Exclude<BreakpointWithBase, 'xs'>,
|
|
58
|
-
Record<string, string>
|
|
59
|
-
>
|
|
60
|
-
)[bp]?.[key];
|
|
61
|
-
|
|
62
|
-
if (cls) {
|
|
63
|
-
classes.push(cls);
|
|
64
|
-
}
|
|
65
|
-
}
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
return classes;
|
|
69
|
-
}
|
|
@@ -1,35 +1,21 @@
|
|
|
1
1
|
import { PolymorphicComponentProps, getProp } from '@kalink-ui/dibbly';
|
|
2
|
-
import { clsx } from 'clsx';
|
|
3
2
|
import { ElementType } from 'react';
|
|
4
3
|
|
|
5
|
-
import {
|
|
4
|
+
import {
|
|
5
|
+
TypographySize,
|
|
6
|
+
TypographyVariant,
|
|
7
|
+
buildTypographyOverrides,
|
|
8
|
+
getResponsiveBase,
|
|
9
|
+
typography,
|
|
10
|
+
type Responsive,
|
|
11
|
+
} from '../../styles';
|
|
6
12
|
|
|
7
13
|
import { TextVariants, textEllipsisWrapper } from './text.css';
|
|
8
|
-
import {
|
|
9
|
-
|
|
10
|
-
import type { Responsive } from '../../styles/responsive';
|
|
11
|
-
|
|
12
|
-
function getBase<T extends string | number>(value: Responsive<T> | undefined) {
|
|
13
|
-
if (value == null) {
|
|
14
|
-
return undefined;
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
if (Array.isArray(value)) {
|
|
18
|
-
return value[0] ?? undefined;
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
if (typeof value === 'object') {
|
|
22
|
-
const obj = value as Partial<Record<string, T>> & { xs?: T };
|
|
23
|
-
|
|
24
|
-
return obj.xs;
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
return value;
|
|
28
|
-
}
|
|
14
|
+
import { textResponsive } from './text.responsive';
|
|
29
15
|
|
|
30
16
|
export type TextProps<TUse extends React.ElementType> =
|
|
31
17
|
PolymorphicComponentProps<TUse> &
|
|
32
|
-
Omit<TextVariants, 'align'> & {
|
|
18
|
+
Omit<TextVariants, 'align' | 'wrap' | 'lineClamp'> & {
|
|
33
19
|
/**
|
|
34
20
|
* The size of the typography used to render the text.
|
|
35
21
|
*/
|
|
@@ -40,6 +26,8 @@ export type TextProps<TUse extends React.ElementType> =
|
|
|
40
26
|
*/
|
|
41
27
|
variant?: Responsive<TypographyVariant>;
|
|
42
28
|
align?: Responsive<NonNullable<TextVariants['align']>>;
|
|
29
|
+
wrap?: Responsive<NonNullable<TextVariants['wrap']>>;
|
|
30
|
+
lineClamp?: Responsive<NonNullable<TextVariants['lineClamp']>>;
|
|
43
31
|
};
|
|
44
32
|
|
|
45
33
|
export function Text<TUse extends ElementType>(props: TextProps<TUse>) {
|
|
@@ -57,15 +45,15 @@ export function Text<TUse extends ElementType>(props: TextProps<TUse>) {
|
|
|
57
45
|
} = props;
|
|
58
46
|
|
|
59
47
|
const typographyOverrides = buildTypographyOverrides({ variant, size });
|
|
60
|
-
const baseVariant =
|
|
61
|
-
const baseSize =
|
|
48
|
+
const baseVariant = getResponsiveBase(variant) ?? 'body';
|
|
49
|
+
const baseSize = getResponsiveBase(size) ?? 'medium';
|
|
62
50
|
|
|
63
51
|
return (
|
|
64
52
|
<Comp
|
|
65
|
-
className={
|
|
53
|
+
className={textResponsive(
|
|
54
|
+
{ truncate, lineClamp, align, wrap },
|
|
66
55
|
getProp(typography, `${baseVariant}.${baseSize}`),
|
|
67
56
|
typographyOverrides,
|
|
68
|
-
textResponsive({ truncate, lineClamp, align, wrap }),
|
|
69
57
|
className,
|
|
70
58
|
)}
|
|
71
59
|
{...rest}
|
|
@@ -1,2 +1 @@
|
|
|
1
|
-
export { TextField } from './text-field';
|
|
2
|
-
export { textFieldStyle } from './text-field.css';
|
|
1
|
+
export { TextField, type TextFieldProps } from './text-field';
|
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
|
|
3
|
-
import { clsx } from 'clsx';
|
|
4
|
-
|
|
5
3
|
import {
|
|
6
4
|
FormField,
|
|
7
5
|
FormFieldControl,
|
|
@@ -12,8 +10,6 @@ import {
|
|
|
12
10
|
} from '../form-field';
|
|
13
11
|
import { Input, InputProps } from '../input';
|
|
14
12
|
|
|
15
|
-
import { textFieldStyle } from './text-field.css';
|
|
16
|
-
|
|
17
13
|
export type TextFieldProps = InputProps & {
|
|
18
14
|
name: string;
|
|
19
15
|
label: string;
|
|
@@ -35,6 +31,7 @@ export function TextField({
|
|
|
35
31
|
hideErrorMessage = false,
|
|
36
32
|
size = 'md',
|
|
37
33
|
className,
|
|
34
|
+
tone,
|
|
38
35
|
...rest
|
|
39
36
|
}: TextFieldProps) {
|
|
40
37
|
return (
|
|
@@ -45,8 +42,9 @@ export function TextField({
|
|
|
45
42
|
hideErrorMessage={hideErrorMessage}
|
|
46
43
|
disabled={disabled}
|
|
47
44
|
hideLabel={hideLabel}
|
|
45
|
+
tone={tone}
|
|
48
46
|
>
|
|
49
|
-
<FormFieldItem className={
|
|
47
|
+
<FormFieldItem className={className}>
|
|
50
48
|
<FormFieldLabel required={required} disabled={disabled} size={size}>
|
|
51
49
|
{label}
|
|
52
50
|
</FormFieldLabel>
|
|
@@ -61,8 +59,8 @@ export function TextField({
|
|
|
61
59
|
/>
|
|
62
60
|
</FormFieldControl>
|
|
63
61
|
|
|
64
|
-
<FormFieldDescription>{description}</FormFieldDescription>
|
|
65
|
-
<FormFieldError />
|
|
62
|
+
<FormFieldDescription size={size}>{description}</FormFieldDescription>
|
|
63
|
+
<FormFieldError size={size} />
|
|
66
64
|
</FormFieldItem>
|
|
67
65
|
</FormField>
|
|
68
66
|
);
|
|
@@ -1,18 +1,45 @@
|
|
|
1
|
-
import { clsx } from 'clsx';
|
|
2
1
|
import { TextareaHTMLAttributes } from 'react';
|
|
3
2
|
|
|
3
|
+
import {
|
|
4
|
+
buildTypographyOverrides,
|
|
5
|
+
mapResponsiveSizeToTypography,
|
|
6
|
+
type Responsive,
|
|
7
|
+
} from '../../styles';
|
|
4
8
|
import { useFormFieldContext } from '../form-field/form-field-context';
|
|
9
|
+
import { type InputAppearanceVariants } from '../input';
|
|
10
|
+
import { inputAppearanceResponsive } from '../input/input.responsive';
|
|
5
11
|
import { textarea } from '../textarea/textarea.css';
|
|
6
12
|
|
|
13
|
+
export type TextareaInputProps = Omit<
|
|
14
|
+
TextareaHTMLAttributes<HTMLTextAreaElement>,
|
|
15
|
+
'size'
|
|
16
|
+
> &
|
|
17
|
+
Omit<InputAppearanceVariants, 'size'> & {
|
|
18
|
+
size?: Responsive<NonNullable<InputAppearanceVariants['size']>>;
|
|
19
|
+
};
|
|
20
|
+
|
|
7
21
|
export function TextareaInput({
|
|
8
22
|
className,
|
|
23
|
+
size = 'md',
|
|
24
|
+
variant = 'outlined',
|
|
25
|
+
tone = 'neutral',
|
|
9
26
|
...props
|
|
10
|
-
}:
|
|
27
|
+
}: TextareaInputProps) {
|
|
11
28
|
const { errors } = useFormFieldContext();
|
|
29
|
+
const typographySize = mapResponsiveSizeToTypography(size);
|
|
30
|
+
const typographyOverrides = buildTypographyOverrides({
|
|
31
|
+
variant: 'body',
|
|
32
|
+
size: typographySize,
|
|
33
|
+
});
|
|
12
34
|
|
|
13
35
|
return (
|
|
14
36
|
<textarea
|
|
15
|
-
className={
|
|
37
|
+
className={inputAppearanceResponsive(
|
|
38
|
+
{ variant, size, tone },
|
|
39
|
+
typographyOverrides,
|
|
40
|
+
textarea,
|
|
41
|
+
className,
|
|
42
|
+
)}
|
|
16
43
|
aria-invalid={errors ? 'true' : undefined}
|
|
17
44
|
{...props}
|
|
18
45
|
/>
|
|
@@ -1,12 +1,17 @@
|
|
|
1
1
|
import { style } from '@vanilla-extract/css';
|
|
2
2
|
|
|
3
|
-
import {
|
|
3
|
+
import { components } from '../../styles/layers.css';
|
|
4
4
|
|
|
5
|
-
export const textareaStyle = style({
|
|
5
|
+
export const textareaStyle = style({
|
|
6
|
+
'@layer': {
|
|
7
|
+
[components]: {},
|
|
8
|
+
},
|
|
9
|
+
});
|
|
6
10
|
|
|
7
|
-
export const textarea = style(
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
+
export const textarea = style({
|
|
12
|
+
'@layer': {
|
|
13
|
+
[components]: {
|
|
14
|
+
lineHeight: 'normal',
|
|
15
|
+
},
|
|
11
16
|
},
|
|
12
|
-
|
|
17
|
+
});
|
|
@@ -17,7 +17,7 @@ import { TextareaInput } from './textarea-input';
|
|
|
17
17
|
import { textareaStyle } from './textarea.css';
|
|
18
18
|
|
|
19
19
|
export type TextareaProps = TextareaHTMLAttributes<HTMLTextAreaElement> &
|
|
20
|
-
InputProps & {
|
|
20
|
+
Omit<InputProps, 'type' | 'startAdornment' | 'endAdornment' | 'inputRef'> & {
|
|
21
21
|
name: string;
|
|
22
22
|
label: string;
|
|
23
23
|
description?: string;
|
|
@@ -37,6 +37,8 @@ export function Textarea({
|
|
|
37
37
|
required,
|
|
38
38
|
hideErrorMessage = false,
|
|
39
39
|
size = 'md',
|
|
40
|
+
variant = 'outlined',
|
|
41
|
+
tone = 'neutral',
|
|
40
42
|
...rest
|
|
41
43
|
}: TextareaProps) {
|
|
42
44
|
return (
|
|
@@ -47,6 +49,7 @@ export function Textarea({
|
|
|
47
49
|
hideErrorMessage={hideErrorMessage}
|
|
48
50
|
disabled={disabled}
|
|
49
51
|
hideLabel={hideLabel}
|
|
52
|
+
tone={tone}
|
|
50
53
|
>
|
|
51
54
|
<FormFieldItem className={clsx(textareaStyle, className)}>
|
|
52
55
|
<FormFieldLabel disabled={disabled} required={required} size={size}>
|
|
@@ -59,12 +62,15 @@ export function Textarea({
|
|
|
59
62
|
className={className}
|
|
60
63
|
disabled={disabled}
|
|
61
64
|
aria-label={hideLabel ? label : undefined}
|
|
65
|
+
size={size}
|
|
66
|
+
variant={variant}
|
|
67
|
+
tone={tone}
|
|
62
68
|
{...rest}
|
|
63
69
|
/>
|
|
64
70
|
</FormFieldControl>
|
|
65
71
|
|
|
66
|
-
<FormFieldDescription>{description}</FormFieldDescription>
|
|
67
|
-
<FormFieldError />
|
|
72
|
+
<FormFieldDescription size={size}>{description}</FormFieldDescription>
|
|
73
|
+
<FormFieldError size={size} />
|
|
68
74
|
</FormFieldItem>
|
|
69
75
|
</FormField>
|
|
70
76
|
);
|
|
@@ -1,17 +1,23 @@
|
|
|
1
1
|
import { style } from '@vanilla-extract/css';
|
|
2
2
|
|
|
3
|
+
import { components } from '../../styles/layers.css';
|
|
4
|
+
|
|
3
5
|
export const visuallyHiddenStyle = style({
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
6
|
+
'@layer': {
|
|
7
|
+
[components]: {
|
|
8
|
+
width: 1,
|
|
9
|
+
height: 1,
|
|
10
|
+
padding: 0,
|
|
11
|
+
margin: -1,
|
|
12
|
+
overflow: 'hidden',
|
|
13
|
+
clip: 'rect(0, 0, 0, 0)',
|
|
10
14
|
|
|
11
|
-
|
|
15
|
+
position: 'absolute',
|
|
12
16
|
|
|
13
|
-
|
|
14
|
-
|
|
17
|
+
whiteSpace: 'nowrap',
|
|
18
|
+
wordWrap: 'normal',
|
|
15
19
|
|
|
16
|
-
|
|
20
|
+
border: 0,
|
|
21
|
+
},
|
|
22
|
+
},
|
|
17
23
|
});
|
|
@@ -11,6 +11,8 @@ interface ScreenMediaQueries {
|
|
|
11
11
|
md: `screen and (min-width: ${string}px)`;
|
|
12
12
|
lg: `screen and (min-width: ${string}px)`;
|
|
13
13
|
xl: `screen and (min-width: ${string}px)`;
|
|
14
|
+
'2xl': `screen and (min-width: ${string}px)`;
|
|
15
|
+
'3xl': `screen and (min-width: ${string}px)`;
|
|
14
16
|
}
|
|
15
17
|
|
|
16
18
|
interface DefineResponsivePropertiesArgs {
|
|
@@ -29,10 +31,12 @@ export const defineResponsiveProperties = ({
|
|
|
29
31
|
md: { '@media': screen.md },
|
|
30
32
|
lg: { '@media': screen.lg },
|
|
31
33
|
xl: { '@media': screen.xl },
|
|
34
|
+
'2xl': { '@media': screen['2xl'] },
|
|
35
|
+
'3xl': { '@media': screen['3xl'] },
|
|
32
36
|
},
|
|
33
37
|
|
|
34
38
|
defaultCondition: 'xs',
|
|
35
|
-
responsiveArray: ['xs', 'sm', 'md', 'lg', 'xl'],
|
|
39
|
+
responsiveArray: ['xs', 'sm', 'md', 'lg', 'xl', '2xl', '3xl'],
|
|
36
40
|
|
|
37
41
|
properties: {
|
|
38
42
|
display: [
|
package/src/styles/index.ts
CHANGED
|
@@ -1,11 +1,15 @@
|
|
|
1
1
|
export {
|
|
2
2
|
sys,
|
|
3
3
|
type Spacing,
|
|
4
|
+
type Tone,
|
|
4
5
|
type TypographySize,
|
|
5
6
|
type TypographyVariant,
|
|
6
7
|
} from './system-contract.css';
|
|
7
8
|
export { typography } from './typography.css';
|
|
8
9
|
|
|
10
|
+
export { sprout } from './theme/sprout.css';
|
|
11
|
+
export { refs as sproutRefs } from './theme/sprout-ref.css';
|
|
12
|
+
|
|
9
13
|
export {
|
|
10
14
|
extractSprinklesProps,
|
|
11
15
|
type GetSprinkles,
|
|
@@ -27,12 +31,18 @@ export {
|
|
|
27
31
|
responsiveRecipe,
|
|
28
32
|
createResponsiveVariants,
|
|
29
33
|
resolveResponsive,
|
|
34
|
+
getResponsiveBase,
|
|
30
35
|
defaultMedia,
|
|
31
36
|
defaultOrder,
|
|
32
37
|
type Responsive,
|
|
33
38
|
type BreakpointWithBase,
|
|
34
39
|
} from './responsive';
|
|
35
40
|
|
|
41
|
+
export {
|
|
42
|
+
buildTypographyOverrides,
|
|
43
|
+
mapResponsiveSizeToTypography,
|
|
44
|
+
} from './typography.responsive';
|
|
45
|
+
|
|
36
46
|
export { breakpoints, screen, type BreakpointKey } from './breakpoints';
|
|
37
47
|
|
|
38
48
|
export {
|
|
@@ -45,3 +55,5 @@ export {
|
|
|
45
55
|
type FluidClampOptions,
|
|
46
56
|
type FluidClampForOptions,
|
|
47
57
|
} from './scale';
|
|
58
|
+
|
|
59
|
+
export { createToneAssignments, createToneStyles } from './tone';
|