@splenddev/kreativ-ui 0.2.7 → 0.2.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +987 -1965
- package/dist/index.cjs +1428 -1055
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +235 -269
- package/dist/index.d.ts +235 -269
- package/dist/index.js +1423 -1033
- package/dist/index.js.map +1 -1
- package/dist/styles/index.css +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -31,20 +31,24 @@ function useTheme() {
|
|
|
31
31
|
return ctx;
|
|
32
32
|
}
|
|
33
33
|
__name(useTheme, "useTheme");
|
|
34
|
-
|
|
35
|
-
|
|
34
|
+
var applySizeOffset = /* @__PURE__ */ __name((value, offset) => {
|
|
35
|
+
if (!value || !offset) return value;
|
|
36
|
+
return `calc(${value} - ${offset})`;
|
|
37
|
+
}, "applySizeOffset");
|
|
38
|
+
function useSizeStyle(size, iconOnly = false, componentName = "componentName", options = {}) {
|
|
39
|
+
const { widthFromHeight = false, includeHeight = true, sizeOffset, fontSizeOffset } = options;
|
|
36
40
|
const { theme, fallbackSize } = useTheme();
|
|
37
41
|
return react.useMemo(() => {
|
|
38
42
|
const scale = theme.sizes;
|
|
39
43
|
const token = scale[size] ?? scale[fallbackSize] ?? Object.values(scale)[0] ?? {};
|
|
40
44
|
const style = {};
|
|
41
45
|
if (includeHeight && token.height) {
|
|
42
|
-
style.height = token.height;
|
|
46
|
+
style.height = applySizeOffset(token.height, sizeOffset);
|
|
43
47
|
}
|
|
44
48
|
if (token.width) {
|
|
45
|
-
style.width = token.width;
|
|
46
|
-
} else if (iconOnly && includeHeight && token.height) {
|
|
47
|
-
style.width = token.height;
|
|
49
|
+
style.width = applySizeOffset(token.width, sizeOffset);
|
|
50
|
+
} else if ((iconOnly || widthFromHeight) && includeHeight && token.height) {
|
|
51
|
+
style.width = applySizeOffset(token.height, sizeOffset);
|
|
48
52
|
}
|
|
49
53
|
if (!iconOnly && token.paddingX) {
|
|
50
54
|
style.paddingLeft = token.paddingX;
|
|
@@ -55,343 +59,32 @@ function useSizeStyle(size, iconOnly = false, component = "button", options = {}
|
|
|
55
59
|
style.paddingBottom = token.paddingY;
|
|
56
60
|
}
|
|
57
61
|
if (token.fontSize) {
|
|
58
|
-
style.fontSize = token.fontSize;
|
|
62
|
+
style.fontSize = applySizeOffset(token.fontSize, fontSizeOffset);
|
|
59
63
|
}
|
|
60
64
|
if (token.gap) {
|
|
61
65
|
style.gap = iconOnly ? 0 : token.gap;
|
|
62
66
|
}
|
|
63
67
|
if (token.radius) {
|
|
64
|
-
const varName = `--kui-${
|
|
68
|
+
const varName = `--kui-${componentName}-radius`;
|
|
65
69
|
style[varName] = token.radius;
|
|
66
70
|
}
|
|
67
71
|
return {
|
|
68
72
|
style,
|
|
69
|
-
iconSize: token.iconSize
|
|
73
|
+
iconSize: token.iconSize,
|
|
74
|
+
fontSize: applySizeOffset(token.fontSize, fontSizeOffset),
|
|
75
|
+
gap: token.gap
|
|
70
76
|
};
|
|
71
|
-
}, [
|
|
77
|
+
}, [
|
|
78
|
+
theme.sizes,
|
|
79
|
+
size,
|
|
80
|
+
fallbackSize,
|
|
81
|
+
iconOnly,
|
|
82
|
+
includeHeight,
|
|
83
|
+
componentName,
|
|
84
|
+
widthFromHeight
|
|
85
|
+
]);
|
|
72
86
|
}
|
|
73
87
|
__name(useSizeStyle, "useSizeStyle");
|
|
74
|
-
|
|
75
|
-
// src/theme/recipes/defineRecipe.ts
|
|
76
|
-
function defineRecipe(recipe) {
|
|
77
|
-
return recipe;
|
|
78
|
-
}
|
|
79
|
-
__name(defineRecipe, "defineRecipe");
|
|
80
|
-
|
|
81
|
-
// src/theme/recipes/mergeRecipes.ts
|
|
82
|
-
function mergeRecipeDefinition(base, override) {
|
|
83
|
-
return {
|
|
84
|
-
...base,
|
|
85
|
-
base: override.base ?? base.base,
|
|
86
|
-
variants: {
|
|
87
|
-
...base.variants,
|
|
88
|
-
...override.variants
|
|
89
|
-
},
|
|
90
|
-
defaultVariants: {
|
|
91
|
-
...base.defaultVariants,
|
|
92
|
-
...override.defaultVariants
|
|
93
|
-
},
|
|
94
|
-
compoundVariants: override.compoundVariants ?? base.compoundVariants
|
|
95
|
-
};
|
|
96
|
-
}
|
|
97
|
-
__name(mergeRecipeDefinition, "mergeRecipeDefinition");
|
|
98
|
-
function mergeRecipes(base, override) {
|
|
99
|
-
if (!override) {
|
|
100
|
-
return base;
|
|
101
|
-
}
|
|
102
|
-
const result = {
|
|
103
|
-
...base
|
|
104
|
-
};
|
|
105
|
-
for (const [name, recipeOverride] of Object.entries(override)) {
|
|
106
|
-
const baseRecipe = base[name];
|
|
107
|
-
if (!baseRecipe) {
|
|
108
|
-
result[name] = recipeOverride;
|
|
109
|
-
continue;
|
|
110
|
-
}
|
|
111
|
-
result[name] = mergeRecipeDefinition(
|
|
112
|
-
baseRecipe,
|
|
113
|
-
recipeOverride
|
|
114
|
-
);
|
|
115
|
-
}
|
|
116
|
-
return result;
|
|
117
|
-
}
|
|
118
|
-
__name(mergeRecipes, "mergeRecipes");
|
|
119
|
-
|
|
120
|
-
// src/theme/recipes/resolveRecipe.ts
|
|
121
|
-
function matchesConditions(conditions, props) {
|
|
122
|
-
return Object.entries(conditions).every(
|
|
123
|
-
([key, expected]) => props[key] === expected
|
|
124
|
-
);
|
|
125
|
-
}
|
|
126
|
-
__name(matchesConditions, "matchesConditions");
|
|
127
|
-
function resolveRecipe(recipe, props = {}) {
|
|
128
|
-
if (!recipe) return "";
|
|
129
|
-
const resolvedProps = {
|
|
130
|
-
...recipe.defaultVariants,
|
|
131
|
-
...props
|
|
132
|
-
};
|
|
133
|
-
const classes = [];
|
|
134
|
-
if (recipe.base) {
|
|
135
|
-
classes.push(recipe.base);
|
|
136
|
-
}
|
|
137
|
-
if (recipe.variants) {
|
|
138
|
-
for (const [variantName, variantValues] of Object.entries(
|
|
139
|
-
recipe.variants
|
|
140
|
-
)) {
|
|
141
|
-
const value = resolvedProps[variantName];
|
|
142
|
-
if (value === void 0) continue;
|
|
143
|
-
const variantClass = variantValues[String(value)];
|
|
144
|
-
if (variantClass) {
|
|
145
|
-
classes.push(variantClass);
|
|
146
|
-
}
|
|
147
|
-
}
|
|
148
|
-
}
|
|
149
|
-
if (recipe.compoundVariants) {
|
|
150
|
-
for (const compound of recipe.compoundVariants) {
|
|
151
|
-
if (matchesConditions(compound.conditions, resolvedProps)) {
|
|
152
|
-
classes.push(compound.className);
|
|
153
|
-
}
|
|
154
|
-
}
|
|
155
|
-
}
|
|
156
|
-
return cn(...classes);
|
|
157
|
-
}
|
|
158
|
-
__name(resolveRecipe, "resolveRecipe");
|
|
159
|
-
|
|
160
|
-
// src/theme/defaults/recipes/button.ts
|
|
161
|
-
var buttonBase = "inline-flex items-center justify-center rounded-[var(--kui-button-radius,var(--kui-radius))] font-medium transition-colors duration-150 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-brand focus-visible:ring-offset-2 focus-visible:ring-offset-surface disabled:opacity-60 disabled:pointer-events-none";
|
|
162
|
-
var buttonVariants = {
|
|
163
|
-
solid: "",
|
|
164
|
-
outline: "border bg-transparent",
|
|
165
|
-
ghost: "bg-transparent",
|
|
166
|
-
soft: "",
|
|
167
|
-
link: "bg-transparent p-0 h-auto hover:underline"
|
|
168
|
-
};
|
|
169
|
-
var buttonColors = {
|
|
170
|
-
brand: {
|
|
171
|
-
solid: "bg-brand text-brand-fg hover:bg-brand-hover",
|
|
172
|
-
outline: "border-brand text-brand hover:bg-brand/10",
|
|
173
|
-
ghost: "text-brand hover:bg-brand/10",
|
|
174
|
-
soft: "bg-brand/10 text-brand hover:bg-brand/20",
|
|
175
|
-
link: "text-brand"
|
|
176
|
-
},
|
|
177
|
-
destructive: {
|
|
178
|
-
solid: "bg-destructive text-destructive-fg hover:bg-destructive-hover",
|
|
179
|
-
outline: "border-destructive text-destructive hover:bg-destructive/10",
|
|
180
|
-
ghost: "text-destructive hover:bg-destructive/10",
|
|
181
|
-
soft: "bg-destructive/10 text-destructive hover:bg-destructive/20",
|
|
182
|
-
link: "text-destructive"
|
|
183
|
-
},
|
|
184
|
-
success: {
|
|
185
|
-
solid: "bg-success text-success-fg hover:bg-success-hover",
|
|
186
|
-
outline: "border-success text-success hover:bg-success/10",
|
|
187
|
-
ghost: "text-success hover:bg-success/10",
|
|
188
|
-
soft: "bg-success/10 text-success hover:bg-success/20",
|
|
189
|
-
link: "text-success"
|
|
190
|
-
},
|
|
191
|
-
warning: {
|
|
192
|
-
solid: "bg-warning text-warning-fg hover:bg-warning-hover",
|
|
193
|
-
outline: "border-warning text-warning hover:bg-warning/10",
|
|
194
|
-
ghost: "text-warning hover:bg-warning/10",
|
|
195
|
-
soft: "bg-warning/10 text-warning hover:bg-warning/20",
|
|
196
|
-
link: "text-warning"
|
|
197
|
-
},
|
|
198
|
-
info: {
|
|
199
|
-
solid: "bg-info text-info-fg hover:bg-info-hover",
|
|
200
|
-
outline: "border-info text-info hover:bg-info/10",
|
|
201
|
-
ghost: "text-info hover:bg-info/10",
|
|
202
|
-
soft: "bg-info/10 text-info hover:bg-info/20",
|
|
203
|
-
link: "text-info"
|
|
204
|
-
},
|
|
205
|
-
white: {
|
|
206
|
-
solid: "bg-white text-black hover:bg-gray-50",
|
|
207
|
-
outline: "border-white/30 text-white hover:bg-white/10",
|
|
208
|
-
ghost: "text-white hover:bg-white/10",
|
|
209
|
-
soft: "bg-white/10 text-white hover:bg-white/20",
|
|
210
|
-
link: "text-white"
|
|
211
|
-
},
|
|
212
|
-
neutral: {
|
|
213
|
-
solid: "bg-surface-raised text-text hover:bg-surface-sunken",
|
|
214
|
-
outline: "border-border text-text hover:bg-surface-raised",
|
|
215
|
-
ghost: "text-text hover:bg-surface-raised",
|
|
216
|
-
soft: "bg-surface-raised text-text hover:bg-surface-sunken",
|
|
217
|
-
link: "text-text"
|
|
218
|
-
}
|
|
219
|
-
};
|
|
220
|
-
var buildCompoundVariants = /* @__PURE__ */ __name(() => {
|
|
221
|
-
const compounds = [];
|
|
222
|
-
for (const [color, variantMap] of Object.entries(buttonColors)) {
|
|
223
|
-
for (const [variant, className] of Object.entries(variantMap)) {
|
|
224
|
-
compounds.push({
|
|
225
|
-
conditions: { color, variant },
|
|
226
|
-
className
|
|
227
|
-
});
|
|
228
|
-
}
|
|
229
|
-
}
|
|
230
|
-
return compounds;
|
|
231
|
-
}, "buildCompoundVariants");
|
|
232
|
-
var buttonRecipe = defineRecipe({
|
|
233
|
-
base: buttonBase,
|
|
234
|
-
variants: {
|
|
235
|
-
variant: buttonVariants,
|
|
236
|
-
color: Object.fromEntries(
|
|
237
|
-
Object.keys(buttonColors).map((color) => [color, ""])
|
|
238
|
-
)
|
|
239
|
-
},
|
|
240
|
-
defaultVariants: {
|
|
241
|
-
variant: "solid",
|
|
242
|
-
color: "brand"
|
|
243
|
-
},
|
|
244
|
-
compoundVariants: buildCompoundVariants()
|
|
245
|
-
});
|
|
246
|
-
|
|
247
|
-
// src/theme/defaults/recipes/input.ts
|
|
248
|
-
var inputBase = "flex min-w-0 flex-1 font-sans bg-transparent border-0 outline-none transition-colors duration-[var(--kui-duration-fast)] placeholder:text-text-muted disabled:pointer-events-none disabled:cursor-not-allowed";
|
|
249
|
-
var inputRecipe = defineRecipe({
|
|
250
|
-
base: inputBase,
|
|
251
|
-
variants: {
|
|
252
|
-
variant: {
|
|
253
|
-
outline: "",
|
|
254
|
-
filled: "",
|
|
255
|
-
ghost: ""
|
|
256
|
-
}
|
|
257
|
-
},
|
|
258
|
-
defaultVariants: {
|
|
259
|
-
variant: "outline"
|
|
260
|
-
}
|
|
261
|
-
});
|
|
262
|
-
|
|
263
|
-
// src/theme/defaults/recipes/formControl.ts
|
|
264
|
-
var formControlBase = "group relative inline-flex items-center rounded-[var(--kui-radii-md)] transition-colors duration-[var(--kui-duration-fast)] focus-within:outline-none focus-within:ring-2 ";
|
|
265
|
-
var formControlVariants = {
|
|
266
|
-
outline: "border border-border bg-transparent text-text hover:border-brand",
|
|
267
|
-
filled: "border border-transparent bg-surface-raised text-text hover:bg-surface",
|
|
268
|
-
ghost: "border border-transparent bg-transparent text-text hover:bg-surface-raised"
|
|
269
|
-
};
|
|
270
|
-
var formControlStates = {
|
|
271
|
-
none: "focus-within:ring-brand/20",
|
|
272
|
-
error: "border-destructive focus-within:ring-destructive/20",
|
|
273
|
-
success: "border-success focus-within:ring-success/20"
|
|
274
|
-
};
|
|
275
|
-
var formControlRecipe = defineRecipe({
|
|
276
|
-
base: formControlBase,
|
|
277
|
-
variants: {
|
|
278
|
-
variant: formControlVariants,
|
|
279
|
-
state: formControlStates,
|
|
280
|
-
rounded: {
|
|
281
|
-
true: "rounded-full",
|
|
282
|
-
false: ""
|
|
283
|
-
},
|
|
284
|
-
fullWidth: {
|
|
285
|
-
true: "w-full",
|
|
286
|
-
false: ""
|
|
287
|
-
},
|
|
288
|
-
disabled: {
|
|
289
|
-
true: "pointer-events-none cursor-not-allowed opacity-50",
|
|
290
|
-
false: ""
|
|
291
|
-
},
|
|
292
|
-
hasAdornment: {
|
|
293
|
-
true: "px-2",
|
|
294
|
-
false: ""
|
|
295
|
-
}
|
|
296
|
-
},
|
|
297
|
-
defaultVariants: {
|
|
298
|
-
variant: "outline",
|
|
299
|
-
state: "none",
|
|
300
|
-
rounded: false,
|
|
301
|
-
fullWidth: true,
|
|
302
|
-
disabled: false,
|
|
303
|
-
hasAdornment: false
|
|
304
|
-
}
|
|
305
|
-
});
|
|
306
|
-
|
|
307
|
-
// src/utils/color.ts
|
|
308
|
-
var HEX_RE = /^#(?:[0-9a-f]{3}|[0-9a-f]{6})$/i;
|
|
309
|
-
function rgbToHex(value) {
|
|
310
|
-
const trimmed = value.trim();
|
|
311
|
-
if (HEX_RE.test(trimmed)) {
|
|
312
|
-
if (trimmed.length === 4) {
|
|
313
|
-
return ("#" + [...trimmed.slice(1)].map((char) => char + char).join("")).toUpperCase();
|
|
314
|
-
}
|
|
315
|
-
return trimmed.toUpperCase();
|
|
316
|
-
}
|
|
317
|
-
const values = trimmed.replace(/[^\d,]/g, "").split(",").map(Number);
|
|
318
|
-
if (values.length !== 3 || values.some(Number.isNaN)) {
|
|
319
|
-
return "#000000";
|
|
320
|
-
}
|
|
321
|
-
return "#" + values.map((x) => x.toString(16).padStart(2, "0")).join("").toUpperCase();
|
|
322
|
-
}
|
|
323
|
-
__name(rgbToHex, "rgbToHex");
|
|
324
|
-
function hexToRgbString(hex) {
|
|
325
|
-
if (!HEX_RE.test(hex)) return null;
|
|
326
|
-
const full = hex.length === 4 ? "#" + [...hex.slice(1)].map((c) => c + c).join("") : hex;
|
|
327
|
-
const r = parseInt(full.slice(1, 3), 16);
|
|
328
|
-
const g = parseInt(full.slice(3, 5), 16);
|
|
329
|
-
const b = parseInt(full.slice(5, 7), 16);
|
|
330
|
-
return `${r} ${g} ${b}`;
|
|
331
|
-
}
|
|
332
|
-
__name(hexToRgbString, "hexToRgbString");
|
|
333
|
-
|
|
334
|
-
// src/utils/resolveTokenReference.ts
|
|
335
|
-
function resolveTokenReference(value, tokens) {
|
|
336
|
-
if (typeof value !== "string") {
|
|
337
|
-
return typeof value === "number" ? value : "";
|
|
338
|
-
}
|
|
339
|
-
const match = value.match(/^\{(.+)\}$/);
|
|
340
|
-
if (!match) {
|
|
341
|
-
return value;
|
|
342
|
-
}
|
|
343
|
-
const path = match[1].split(".");
|
|
344
|
-
let current = tokens;
|
|
345
|
-
for (const key of path) {
|
|
346
|
-
if (typeof current !== "object" || current === null || !(key in current)) {
|
|
347
|
-
return "";
|
|
348
|
-
}
|
|
349
|
-
current = current[key];
|
|
350
|
-
}
|
|
351
|
-
if (typeof current === "object" && current !== null && "value" in current) {
|
|
352
|
-
const tokenValue = current.value;
|
|
353
|
-
if (typeof tokenValue === "string" || typeof tokenValue === "number") {
|
|
354
|
-
return tokenValue;
|
|
355
|
-
}
|
|
356
|
-
return "";
|
|
357
|
-
}
|
|
358
|
-
return typeof current === "string" || typeof current === "number" ? current : "";
|
|
359
|
-
}
|
|
360
|
-
__name(resolveTokenReference, "resolveTokenReference");
|
|
361
|
-
|
|
362
|
-
// src/theme/typography/resolveTypography.ts
|
|
363
|
-
function resolveTypography(typography, tokens) {
|
|
364
|
-
if (!typography) return {};
|
|
365
|
-
return {
|
|
366
|
-
fontFamily: resolveTokenReference(typography.fontFamily, tokens),
|
|
367
|
-
fontSize: resolveTokenReference(typography.fontSize, tokens),
|
|
368
|
-
fontWeight: resolveTokenReference(typography.fontWeight, tokens),
|
|
369
|
-
lineHeight: resolveTokenReference(typography.lineHeight, tokens),
|
|
370
|
-
letterSpacing: resolveTokenReference(
|
|
371
|
-
typography.letterSpacing,
|
|
372
|
-
tokens
|
|
373
|
-
)
|
|
374
|
-
};
|
|
375
|
-
}
|
|
376
|
-
__name(resolveTypography, "resolveTypography");
|
|
377
|
-
|
|
378
|
-
// src/theme/typography/defineTypography.ts
|
|
379
|
-
function defineTypography(typography) {
|
|
380
|
-
return typography;
|
|
381
|
-
}
|
|
382
|
-
__name(defineTypography, "defineTypography");
|
|
383
|
-
|
|
384
|
-
// src/theme/token/defineToken.ts
|
|
385
|
-
function defineToken(value) {
|
|
386
|
-
return {
|
|
387
|
-
value
|
|
388
|
-
};
|
|
389
|
-
}
|
|
390
|
-
__name(defineToken, "defineToken");
|
|
391
|
-
function defineSemanticToken(light, dark) {
|
|
392
|
-
return { value: { light, dark } };
|
|
393
|
-
}
|
|
394
|
-
__name(defineSemanticToken, "defineSemanticToken");
|
|
395
88
|
var BREAKPOINTS = {
|
|
396
89
|
sm: 640,
|
|
397
90
|
md: 768,
|
|
@@ -443,27 +136,71 @@ function useFloatingSide(triggerRef, open) {
|
|
|
443
136
|
}
|
|
444
137
|
__name(useFloatingSide, "useFloatingSide");
|
|
445
138
|
var TRANSITION_DURATION = 1500;
|
|
446
|
-
function
|
|
447
|
-
const
|
|
448
|
-
const [
|
|
139
|
+
function useStatusTransition(status) {
|
|
140
|
+
const previousStatus = react.useRef(status);
|
|
141
|
+
const [transitionStatus, setTransitionStatus] = react.useState();
|
|
449
142
|
react.useEffect(() => {
|
|
450
|
-
if (
|
|
143
|
+
if (status === previousStatus.current) {
|
|
451
144
|
return;
|
|
452
145
|
}
|
|
453
|
-
|
|
454
|
-
if (
|
|
455
|
-
|
|
146
|
+
previousStatus.current = status;
|
|
147
|
+
if (status === "none") {
|
|
148
|
+
setTransitionStatus(void 0);
|
|
456
149
|
return;
|
|
457
150
|
}
|
|
458
|
-
|
|
151
|
+
setTransitionStatus(status);
|
|
459
152
|
const timeout = window.setTimeout(() => {
|
|
460
|
-
|
|
153
|
+
setTransitionStatus(void 0);
|
|
461
154
|
}, TRANSITION_DURATION);
|
|
462
155
|
return () => window.clearTimeout(timeout);
|
|
463
|
-
}, [
|
|
464
|
-
return
|
|
156
|
+
}, [status]);
|
|
157
|
+
return transitionStatus;
|
|
158
|
+
}
|
|
159
|
+
__name(useStatusTransition, "useStatusTransition");
|
|
160
|
+
|
|
161
|
+
// src/utils/resolveTokenReference.ts
|
|
162
|
+
function resolveTokenReference(value, tokens) {
|
|
163
|
+
if (typeof value !== "string") {
|
|
164
|
+
return typeof value === "number" ? value : "";
|
|
165
|
+
}
|
|
166
|
+
const match = value.match(/^\{(.+)\}$/);
|
|
167
|
+
if (!match) {
|
|
168
|
+
return value;
|
|
169
|
+
}
|
|
170
|
+
const path = match[1].split(".");
|
|
171
|
+
let current = tokens;
|
|
172
|
+
for (const key of path) {
|
|
173
|
+
if (typeof current !== "object" || current === null || !(key in current)) {
|
|
174
|
+
return "";
|
|
175
|
+
}
|
|
176
|
+
current = current[key];
|
|
177
|
+
}
|
|
178
|
+
if (typeof current === "object" && current !== null && "value" in current) {
|
|
179
|
+
const tokenValue = current.value;
|
|
180
|
+
if (typeof tokenValue === "string" || typeof tokenValue === "number") {
|
|
181
|
+
return tokenValue;
|
|
182
|
+
}
|
|
183
|
+
return "";
|
|
184
|
+
}
|
|
185
|
+
return typeof current === "string" || typeof current === "number" ? current : "";
|
|
465
186
|
}
|
|
466
|
-
__name(
|
|
187
|
+
__name(resolveTokenReference, "resolveTokenReference");
|
|
188
|
+
|
|
189
|
+
// src/theme/typography/resolveTypography.ts
|
|
190
|
+
function resolveTypography(typography, tokens) {
|
|
191
|
+
if (!typography) return {};
|
|
192
|
+
return {
|
|
193
|
+
fontFamily: resolveTokenReference(typography.fontFamily, tokens),
|
|
194
|
+
fontSize: resolveTokenReference(typography.fontSize, tokens),
|
|
195
|
+
fontWeight: resolveTokenReference(typography.fontWeight, tokens),
|
|
196
|
+
lineHeight: resolveTokenReference(typography.lineHeight, tokens),
|
|
197
|
+
letterSpacing: resolveTokenReference(
|
|
198
|
+
typography.letterSpacing,
|
|
199
|
+
tokens
|
|
200
|
+
)
|
|
201
|
+
};
|
|
202
|
+
}
|
|
203
|
+
__name(resolveTypography, "resolveTypography");
|
|
467
204
|
|
|
468
205
|
// src/hooks/useTypography.ts
|
|
469
206
|
function useTypography(name) {
|
|
@@ -474,6 +211,62 @@ function useTypography(name) {
|
|
|
474
211
|
);
|
|
475
212
|
}
|
|
476
213
|
__name(useTypography, "useTypography");
|
|
214
|
+
function useClearableField(elementRef, initialValue, onClear) {
|
|
215
|
+
const [hasValue, setHasValue] = react.useState(() => Boolean(initialValue ?? ""));
|
|
216
|
+
const clear = react.useCallback(() => {
|
|
217
|
+
const element = elementRef.current;
|
|
218
|
+
if (!element) return;
|
|
219
|
+
const prototype = element instanceof HTMLTextAreaElement ? window.HTMLTextAreaElement.prototype : window.HTMLInputElement.prototype;
|
|
220
|
+
const setter = Object.getOwnPropertyDescriptor(prototype, "value")?.set;
|
|
221
|
+
setter?.call(element, "");
|
|
222
|
+
element.dispatchEvent(new Event("input", { bubbles: true }));
|
|
223
|
+
element.focus();
|
|
224
|
+
setHasValue(false);
|
|
225
|
+
onClear?.();
|
|
226
|
+
}, [elementRef, onClear]);
|
|
227
|
+
return { hasValue, setHasValue, clear };
|
|
228
|
+
}
|
|
229
|
+
__name(useClearableField, "useClearableField");
|
|
230
|
+
|
|
231
|
+
// src/theme/recipes/resolveRecipe.ts
|
|
232
|
+
function matchesConditions(conditions, props) {
|
|
233
|
+
return Object.entries(conditions).every(
|
|
234
|
+
([key, expected]) => props[key] === expected
|
|
235
|
+
);
|
|
236
|
+
}
|
|
237
|
+
__name(matchesConditions, "matchesConditions");
|
|
238
|
+
function resolveRecipe(recipe, props = {}) {
|
|
239
|
+
if (!recipe) return "";
|
|
240
|
+
const resolvedProps = {
|
|
241
|
+
...recipe.defaultVariants,
|
|
242
|
+
...props
|
|
243
|
+
};
|
|
244
|
+
const classes = [];
|
|
245
|
+
if (recipe.base) {
|
|
246
|
+
classes.push(recipe.base);
|
|
247
|
+
}
|
|
248
|
+
if (recipe.variants) {
|
|
249
|
+
for (const [variantName, variantValues] of Object.entries(
|
|
250
|
+
recipe.variants
|
|
251
|
+
)) {
|
|
252
|
+
const value = resolvedProps[variantName];
|
|
253
|
+
if (value === void 0) continue;
|
|
254
|
+
const variantClass = variantValues[String(value)];
|
|
255
|
+
if (variantClass) {
|
|
256
|
+
classes.push(variantClass);
|
|
257
|
+
}
|
|
258
|
+
}
|
|
259
|
+
}
|
|
260
|
+
if (recipe.compoundVariants) {
|
|
261
|
+
for (const compound of recipe.compoundVariants) {
|
|
262
|
+
if (matchesConditions(compound.conditions, resolvedProps)) {
|
|
263
|
+
classes.push(compound.className);
|
|
264
|
+
}
|
|
265
|
+
}
|
|
266
|
+
}
|
|
267
|
+
return cn(...classes);
|
|
268
|
+
}
|
|
269
|
+
__name(resolveRecipe, "resolveRecipe");
|
|
477
270
|
var ACTIVATION_KEYS = /* @__PURE__ */ new Set(["Enter", " "]);
|
|
478
271
|
var Button = react.forwardRef(
|
|
479
272
|
({
|
|
@@ -555,6 +348,7 @@ var Button = react.forwardRef(
|
|
|
555
348
|
className: resolvedClassName,
|
|
556
349
|
style: resolvedStyle,
|
|
557
350
|
disabled: disabled || isLoading,
|
|
351
|
+
"aria-disabled": disabled || isLoading,
|
|
558
352
|
"aria-busy": isLoading || void 0,
|
|
559
353
|
children: content
|
|
560
354
|
});
|
|
@@ -567,9 +361,11 @@ var Button = react.forwardRef(
|
|
|
567
361
|
className: resolvedClassName,
|
|
568
362
|
style: resolvedStyle,
|
|
569
363
|
"aria-busy": isLoading || void 0,
|
|
364
|
+
"aria-disabled": disabled,
|
|
570
365
|
animate: {
|
|
571
366
|
scale: isKeyboardPressed ? 0.975 : 1
|
|
572
367
|
},
|
|
368
|
+
type: "button",
|
|
573
369
|
whileHover: isInteractive ? { scale: 1.015 } : void 0,
|
|
574
370
|
whileTap: isInteractive ? { scale: 0.975 } : void 0,
|
|
575
371
|
transition: prefersReducedMotion ? { duration: 0 } : {
|
|
@@ -586,6 +382,33 @@ var Button = react.forwardRef(
|
|
|
586
382
|
}
|
|
587
383
|
);
|
|
588
384
|
Button.displayName = "Button";
|
|
385
|
+
|
|
386
|
+
// src/utils/color.ts
|
|
387
|
+
var HEX_RE = /^#(?:[0-9a-f]{3}|[0-9a-f]{6})$/i;
|
|
388
|
+
function rgbToHex(value) {
|
|
389
|
+
const trimmed = value.trim();
|
|
390
|
+
if (HEX_RE.test(trimmed)) {
|
|
391
|
+
if (trimmed.length === 4) {
|
|
392
|
+
return ("#" + [...trimmed.slice(1)].map((char) => char + char).join("")).toUpperCase();
|
|
393
|
+
}
|
|
394
|
+
return trimmed.toUpperCase();
|
|
395
|
+
}
|
|
396
|
+
const values = trimmed.replace(/[^\d,]/g, "").split(",").map(Number);
|
|
397
|
+
if (values.length !== 3 || values.some(Number.isNaN)) {
|
|
398
|
+
return "#000000";
|
|
399
|
+
}
|
|
400
|
+
return "#" + values.map((x) => x.toString(16).padStart(2, "0")).join("").toUpperCase();
|
|
401
|
+
}
|
|
402
|
+
__name(rgbToHex, "rgbToHex");
|
|
403
|
+
function hexToRgbString(hex) {
|
|
404
|
+
if (!HEX_RE.test(hex)) return null;
|
|
405
|
+
const full = hex.length === 4 ? "#" + [...hex.slice(1)].map((c) => c + c).join("") : hex;
|
|
406
|
+
const r = parseInt(full.slice(1, 3), 16);
|
|
407
|
+
const g = parseInt(full.slice(3, 5), 16);
|
|
408
|
+
const b = parseInt(full.slice(5, 7), 16);
|
|
409
|
+
return `${r} ${g} ${b}`;
|
|
410
|
+
}
|
|
411
|
+
__name(hexToRgbString, "hexToRgbString");
|
|
589
412
|
var defaultTransition = {
|
|
590
413
|
type: "none",
|
|
591
414
|
duration: 300,
|
|
@@ -878,6 +701,8 @@ function useOptionalFormField() {
|
|
|
878
701
|
return react.useContext(FormFieldContext);
|
|
879
702
|
}
|
|
880
703
|
__name(useOptionalFormField, "useOptionalFormField");
|
|
704
|
+
|
|
705
|
+
// src/utils/mergeRef.ts
|
|
881
706
|
function mergeRefs(...refs) {
|
|
882
707
|
return (node) => {
|
|
883
708
|
refs.forEach((ref) => {
|
|
@@ -899,10 +724,11 @@ var Input = react.forwardRef(
|
|
|
899
724
|
size = "md",
|
|
900
725
|
error,
|
|
901
726
|
success,
|
|
727
|
+
warning,
|
|
902
728
|
startIcon,
|
|
903
729
|
endIcon,
|
|
904
730
|
fullWidth = true,
|
|
905
|
-
disabled,
|
|
731
|
+
disabled = false,
|
|
906
732
|
rounded = false,
|
|
907
733
|
isLoading = false,
|
|
908
734
|
clearable = false,
|
|
@@ -910,42 +736,62 @@ var Input = react.forwardRef(
|
|
|
910
736
|
kind = "text",
|
|
911
737
|
hideKindIcon = false,
|
|
912
738
|
id: externalId,
|
|
739
|
+
trim = false,
|
|
913
740
|
type: typeProp,
|
|
914
741
|
inputMode: inputModeProp,
|
|
915
742
|
autoComplete: autoCompleteProp,
|
|
916
743
|
placeholder: placeholderProp,
|
|
917
744
|
onChange: onChangeProp,
|
|
918
|
-
|
|
745
|
+
onValueChange: onValueChangeProp,
|
|
746
|
+
onBlur: onBlurProp,
|
|
919
747
|
value,
|
|
920
748
|
defaultValue,
|
|
921
749
|
style,
|
|
922
750
|
...props
|
|
923
751
|
}, ref) => {
|
|
924
752
|
const autoId = react.useId();
|
|
753
|
+
const internalRef = react.useRef(null);
|
|
925
754
|
const { theme } = useTheme();
|
|
926
755
|
const field = useOptionalFormField();
|
|
927
756
|
const id = externalId ?? field?.id ?? autoId;
|
|
928
|
-
const isInvalid = error || field?.invalid || false;
|
|
929
|
-
const describedBy = field?.describedBy ?? void 0;
|
|
930
757
|
const isRequired = field?.required ?? props.required;
|
|
931
|
-
const
|
|
758
|
+
const describedBy = field?.describedBy;
|
|
759
|
+
const state = error ? "error" : success ? "success" : warning ? "warning" : field?.status ?? "none";
|
|
760
|
+
const isInvalid = state === "error";
|
|
761
|
+
const statusTransition = useStatusTransition(state);
|
|
932
762
|
const { style: sizeStyle, iconSize } = useSizeStyle(size, false, "input");
|
|
933
|
-
const [hasValue, setHasValue] = react.useState(
|
|
934
|
-
() => Boolean(value ?? defaultValue ?? "")
|
|
935
|
-
);
|
|
936
763
|
const [visible, setVisible] = react.useState(false);
|
|
764
|
+
const { hasValue, setHasValue, clear } = useClearableField(
|
|
765
|
+
internalRef,
|
|
766
|
+
value ?? defaultValue,
|
|
767
|
+
onClear
|
|
768
|
+
);
|
|
937
769
|
react.useEffect(() => {
|
|
938
770
|
if (value !== void 0) {
|
|
939
771
|
setHasValue(Boolean(value));
|
|
940
772
|
}
|
|
941
|
-
}, [value]);
|
|
773
|
+
}, [value, setHasValue]);
|
|
942
774
|
const kindDefaults = inputKindDefaults[kind];
|
|
943
775
|
const resolvedType = typeProp ?? kindDefaults.type;
|
|
944
776
|
const isPasswordField = resolvedType === "password";
|
|
945
777
|
const effectiveType = isPasswordField ? visible ? "text" : "password" : resolvedType;
|
|
946
778
|
const KindIcon = inputKindIcons[kind];
|
|
947
|
-
const defaultStartIcon = !hideKindIcon && KindIcon ? /* @__PURE__ */ jsxRuntime.jsx(KindIcon, {
|
|
948
|
-
const
|
|
779
|
+
const defaultStartIcon = !hideKindIcon && KindIcon ? /* @__PURE__ */ jsxRuntime.jsx(KindIcon, {}) : void 0;
|
|
780
|
+
const startAdornment = react.useMemo(() => {
|
|
781
|
+
const icon = startIcon ?? defaultStartIcon;
|
|
782
|
+
if (!icon) return null;
|
|
783
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
784
|
+
"span",
|
|
785
|
+
{
|
|
786
|
+
className: "flex shrink-0 items-center justify-center",
|
|
787
|
+
style: {
|
|
788
|
+
width: iconSize,
|
|
789
|
+
height: iconSize
|
|
790
|
+
},
|
|
791
|
+
children: icon
|
|
792
|
+
}
|
|
793
|
+
);
|
|
794
|
+
}, [startIcon, defaultStartIcon, iconSize]);
|
|
949
795
|
const builtInEnd = [];
|
|
950
796
|
if (isPasswordField) {
|
|
951
797
|
builtInEnd.push(
|
|
@@ -953,11 +799,27 @@ var Input = react.forwardRef(
|
|
|
953
799
|
"button",
|
|
954
800
|
{
|
|
955
801
|
type: "button",
|
|
956
|
-
tabIndex: -1,
|
|
957
802
|
onClick: () => setVisible((current) => !current),
|
|
958
803
|
"aria-label": visible ? "Hide password" : "Show password",
|
|
959
|
-
|
|
960
|
-
|
|
804
|
+
"aria-pressed": visible,
|
|
805
|
+
className: "\r\n flex items-center justify-center\r\n text-text-muted\r\n transition-colors\r\n hover:text-text\r\n focus-visible:outline\r\n focus-visible:outline-2\r\n focus-visible:outline-offset-2\r\n ",
|
|
806
|
+
children: visible ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
807
|
+
lucideReact.EyeOff,
|
|
808
|
+
{
|
|
809
|
+
style: {
|
|
810
|
+
width: iconSize,
|
|
811
|
+
height: iconSize
|
|
812
|
+
}
|
|
813
|
+
}
|
|
814
|
+
) : /* @__PURE__ */ jsxRuntime.jsx(
|
|
815
|
+
lucideReact.Eye,
|
|
816
|
+
{
|
|
817
|
+
style: {
|
|
818
|
+
width: iconSize,
|
|
819
|
+
height: iconSize
|
|
820
|
+
}
|
|
821
|
+
}
|
|
822
|
+
)
|
|
961
823
|
},
|
|
962
824
|
"toggle-visibility"
|
|
963
825
|
)
|
|
@@ -969,28 +831,46 @@ var Input = react.forwardRef(
|
|
|
969
831
|
"button",
|
|
970
832
|
{
|
|
971
833
|
type: "button",
|
|
972
|
-
|
|
973
|
-
onClick: handleClear,
|
|
834
|
+
onClick: clear,
|
|
974
835
|
"aria-label": "Clear input",
|
|
975
|
-
className: "flex items-center justify-center
|
|
976
|
-
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
836
|
+
className: "\r\n flex items-center justify-center\r\n text-text-muted\r\n transition-colors\r\n hover:text-text\r\n focus-visible:outline\r\n focus-visible:outline-2\r\n focus-visible:outline-offset-2\r\n ",
|
|
837
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
838
|
+
lucideReact.X,
|
|
839
|
+
{
|
|
840
|
+
style: {
|
|
841
|
+
width: iconSize,
|
|
842
|
+
height: iconSize
|
|
843
|
+
}
|
|
844
|
+
}
|
|
845
|
+
)
|
|
977
846
|
},
|
|
978
847
|
"clear"
|
|
979
848
|
)
|
|
980
849
|
);
|
|
981
850
|
}
|
|
982
|
-
const
|
|
983
|
-
|
|
984
|
-
|
|
985
|
-
|
|
851
|
+
const endAdornment = isLoading ? /* @__PURE__ */ jsxRuntime.jsx(Spinner, { size: iconSize || 14 }) : endIcon || builtInEnd.length > 0 ? /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex shrink-0 items-center gap-1.5", children: [
|
|
852
|
+
endIcon && /* @__PURE__ */ jsxRuntime.jsx(
|
|
853
|
+
"span",
|
|
854
|
+
{
|
|
855
|
+
className: "flex items-center justify-center",
|
|
856
|
+
style: {
|
|
857
|
+
width: iconSize,
|
|
858
|
+
height: iconSize
|
|
859
|
+
},
|
|
860
|
+
children: endIcon
|
|
861
|
+
}
|
|
862
|
+
),
|
|
863
|
+
builtInEnd
|
|
864
|
+
] }) : null;
|
|
865
|
+
const hasAdornment = Boolean(startAdornment) || Boolean(endAdornment);
|
|
986
866
|
const wrapperClasses = cn(
|
|
987
867
|
resolveRecipe(theme.recipes.FormControl, {
|
|
988
868
|
variant,
|
|
989
869
|
state,
|
|
990
870
|
rounded,
|
|
991
871
|
fullWidth,
|
|
992
|
-
disabled:
|
|
993
|
-
|
|
872
|
+
disabled: disabled || isLoading,
|
|
873
|
+
hasAdornment
|
|
994
874
|
}),
|
|
995
875
|
className
|
|
996
876
|
);
|
|
@@ -1007,44 +887,42 @@ var Input = react.forwardRef(
|
|
|
1007
887
|
function handleChange(event) {
|
|
1008
888
|
setHasValue(Boolean(event.target.value));
|
|
1009
889
|
onChangeProp?.(event);
|
|
890
|
+
onValueChangeProp?.(event.target.value);
|
|
1010
891
|
}
|
|
1011
892
|
__name(handleChange, "handleChange");
|
|
1012
|
-
function
|
|
1013
|
-
|
|
1014
|
-
|
|
1015
|
-
|
|
1016
|
-
|
|
1017
|
-
|
|
1018
|
-
|
|
1019
|
-
|
|
1020
|
-
|
|
1021
|
-
|
|
1022
|
-
bubbles: true
|
|
1023
|
-
})
|
|
1024
|
-
);
|
|
1025
|
-
element.focus();
|
|
1026
|
-
setHasValue(false);
|
|
1027
|
-
onClear?.();
|
|
893
|
+
function handleBlur(event) {
|
|
894
|
+
if (trim && !disabled && !isLoading) {
|
|
895
|
+
const trimmedValue = event.currentTarget.value.trim();
|
|
896
|
+
if (trimmedValue !== event.currentTarget.value) {
|
|
897
|
+
event.currentTarget.value = trimmedValue;
|
|
898
|
+
setHasValue(Boolean(trimmedValue));
|
|
899
|
+
onValueChangeProp?.(trimmedValue);
|
|
900
|
+
}
|
|
901
|
+
}
|
|
902
|
+
onBlurProp?.(event);
|
|
1028
903
|
}
|
|
1029
|
-
__name(
|
|
904
|
+
__name(handleBlur, "handleBlur");
|
|
905
|
+
const wasInvalidRef = react.useRef(isInvalid);
|
|
1030
906
|
react.useEffect(() => {
|
|
1031
|
-
|
|
1032
|
-
|
|
1033
|
-
if (!
|
|
1034
|
-
|
|
907
|
+
const justBecameInvalid = isInvalid && !wasInvalidRef.current;
|
|
908
|
+
wasInvalidRef.current = isInvalid;
|
|
909
|
+
if (!justBecameInvalid) {
|
|
910
|
+
return;
|
|
911
|
+
}
|
|
912
|
+
internalRef.current?.scrollIntoView({
|
|
1035
913
|
behavior: "smooth",
|
|
1036
914
|
block: "center"
|
|
1037
915
|
});
|
|
1038
|
-
}, [
|
|
916
|
+
}, [isInvalid]);
|
|
1039
917
|
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
1040
918
|
"div",
|
|
1041
919
|
{
|
|
1042
920
|
className: wrapperClasses,
|
|
1043
921
|
style: resolvedStyle,
|
|
1044
922
|
"data-state": state,
|
|
1045
|
-
"data-state-transition":
|
|
923
|
+
"data-state-transition": statusTransition,
|
|
1046
924
|
children: [
|
|
1047
|
-
|
|
925
|
+
startAdornment,
|
|
1048
926
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1049
927
|
"input",
|
|
1050
928
|
{
|
|
@@ -1058,31 +936,54 @@ var Input = react.forwardRef(
|
|
|
1058
936
|
value,
|
|
1059
937
|
defaultValue,
|
|
1060
938
|
onChange: handleChange,
|
|
1061
|
-
|
|
1062
|
-
disabled:
|
|
939
|
+
onBlur: handleBlur,
|
|
940
|
+
disabled: disabled || isLoading,
|
|
1063
941
|
"aria-busy": isLoading || void 0,
|
|
1064
942
|
"aria-invalid": isInvalid || void 0,
|
|
1065
943
|
"aria-describedby": describedBy,
|
|
1066
944
|
"aria-required": isRequired || void 0,
|
|
1067
945
|
className: inputClasses,
|
|
1068
|
-
"data-variant": variant,
|
|
1069
|
-
"data-size": size,
|
|
1070
|
-
"data-success": success || void 0,
|
|
1071
946
|
"data-disabled": disabled || void 0,
|
|
1072
|
-
"data-loading": isLoading || void 0
|
|
947
|
+
"data-loading": isLoading || void 0,
|
|
948
|
+
"data-size": size,
|
|
949
|
+
"data-state": state,
|
|
950
|
+
"data-variant": variant
|
|
1073
951
|
}
|
|
1074
952
|
),
|
|
1075
|
-
|
|
953
|
+
endAdornment
|
|
1076
954
|
]
|
|
1077
|
-
}
|
|
1078
|
-
stateTransition ?? "idle"
|
|
955
|
+
}
|
|
1079
956
|
);
|
|
1080
957
|
}
|
|
1081
958
|
);
|
|
1082
959
|
Input.displayName = "Input";
|
|
960
|
+
|
|
961
|
+
// src/utils/env.ts
|
|
962
|
+
function readProcessEnv() {
|
|
963
|
+
try {
|
|
964
|
+
return typeof process !== "undefined" ? process.env?.NODE_ENV : void 0;
|
|
965
|
+
} catch {
|
|
966
|
+
return void 0;
|
|
967
|
+
}
|
|
968
|
+
}
|
|
969
|
+
__name(readProcessEnv, "readProcessEnv");
|
|
970
|
+
function readImportMetaEnv() {
|
|
971
|
+
try {
|
|
972
|
+
return typeof ({ url: (typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('index.cjs', document.baseURI).href)) }) !== "undefined" ? undefined?.MODE : void 0;
|
|
973
|
+
} catch {
|
|
974
|
+
return void 0;
|
|
975
|
+
}
|
|
976
|
+
}
|
|
977
|
+
__name(readImportMetaEnv, "readImportMetaEnv");
|
|
978
|
+
function isDev() {
|
|
979
|
+
const mode = readProcessEnv() ?? readImportMetaEnv();
|
|
980
|
+
return mode !== void 0 && mode !== "production";
|
|
981
|
+
}
|
|
982
|
+
__name(isDev, "isDev");
|
|
1083
983
|
function FormField({
|
|
1084
984
|
id: externalId,
|
|
1085
|
-
|
|
985
|
+
status = "none",
|
|
986
|
+
message: formMessage,
|
|
1086
987
|
required = false,
|
|
1087
988
|
className,
|
|
1088
989
|
children
|
|
@@ -1092,24 +993,52 @@ function FormField({
|
|
|
1092
993
|
const labelId = `${id}-label`;
|
|
1093
994
|
const descriptionId = `${id}-description`;
|
|
1094
995
|
const messageId = `${id}-message`;
|
|
1095
|
-
const [
|
|
1096
|
-
|
|
1097
|
-
|
|
996
|
+
const [reportedValidity, setReportedValidity] = react.useState(null);
|
|
997
|
+
const reportValidity = react.useCallback((result) => {
|
|
998
|
+
setReportedValidity(result);
|
|
999
|
+
}, []);
|
|
1000
|
+
const reportedMessage = reportedValidity?.invalid ? reportedValidity.message : void 0;
|
|
1098
1001
|
const [labelCount, setLabelCount] = react.useState(0);
|
|
1099
|
-
|
|
1100
|
-
|
|
1101
|
-
|
|
1102
|
-
|
|
1103
|
-
|
|
1104
|
-
|
|
1105
|
-
|
|
1002
|
+
function countMessageComponents(children2) {
|
|
1003
|
+
let count = 0;
|
|
1004
|
+
react.Children.forEach(children2, (child) => {
|
|
1005
|
+
if (!react.isValidElement(child)) {
|
|
1006
|
+
return;
|
|
1007
|
+
}
|
|
1008
|
+
if (child.type === FormFieldMessage) {
|
|
1009
|
+
count += 1;
|
|
1010
|
+
return;
|
|
1011
|
+
}
|
|
1012
|
+
if (child.props.children) {
|
|
1013
|
+
count += countMessageComponents(child.props.children);
|
|
1014
|
+
}
|
|
1015
|
+
});
|
|
1016
|
+
return count;
|
|
1017
|
+
}
|
|
1018
|
+
__name(countMessageComponents, "countMessageComponents");
|
|
1106
1019
|
const registerLabel = react.useCallback(() => {
|
|
1107
|
-
setLabelCount((
|
|
1108
|
-
return () =>
|
|
1020
|
+
setLabelCount((count) => count + 1);
|
|
1021
|
+
return () => {
|
|
1022
|
+
setLabelCount((count) => count - 1);
|
|
1023
|
+
};
|
|
1109
1024
|
}, []);
|
|
1110
1025
|
const hasExternalLabel = labelCount > 0;
|
|
1111
|
-
const displayedMessage =
|
|
1112
|
-
const
|
|
1026
|
+
const displayedMessage = formMessage ?? reportedMessage;
|
|
1027
|
+
const message = displayedMessage;
|
|
1028
|
+
const invalid = status === "error" || Boolean(formMessage) || Boolean(reportedValidity?.invalid);
|
|
1029
|
+
const messageCount = countMessageComponents(children);
|
|
1030
|
+
const hasCustomMessage = messageCount > 0;
|
|
1031
|
+
const describedBy = [descriptionId, message || hasCustomMessage ? messageId : void 0].filter(Boolean).join(" ") || void 0;
|
|
1032
|
+
react.useEffect(() => {
|
|
1033
|
+
if (!isDev()) {
|
|
1034
|
+
return;
|
|
1035
|
+
}
|
|
1036
|
+
if (messageCount > 1) {
|
|
1037
|
+
console.warn(
|
|
1038
|
+
"[Kreativ UI] Multiple <FormField.Message /> components were detected inside the same <FormField>. Only one custom message should be provided."
|
|
1039
|
+
);
|
|
1040
|
+
}
|
|
1041
|
+
}, [messageCount]);
|
|
1113
1042
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
1114
1043
|
FormFieldContext.Provider,
|
|
1115
1044
|
{
|
|
@@ -1118,9 +1047,10 @@ function FormField({
|
|
|
1118
1047
|
labelId,
|
|
1119
1048
|
descriptionId,
|
|
1120
1049
|
messageId,
|
|
1121
|
-
|
|
1122
|
-
|
|
1123
|
-
|
|
1050
|
+
message,
|
|
1051
|
+
status,
|
|
1052
|
+
describedBy,
|
|
1053
|
+
invalid,
|
|
1124
1054
|
required,
|
|
1125
1055
|
reportValidity,
|
|
1126
1056
|
registerLabel,
|
|
@@ -1128,7 +1058,7 @@ function FormField({
|
|
|
1128
1058
|
},
|
|
1129
1059
|
children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: cn("flex flex-col gap-2", className), children: [
|
|
1130
1060
|
children,
|
|
1131
|
-
|
|
1061
|
+
!hasCustomMessage && /* @__PURE__ */ jsxRuntime.jsx(FormFieldMessage, {})
|
|
1132
1062
|
] })
|
|
1133
1063
|
}
|
|
1134
1064
|
);
|
|
@@ -1151,7 +1081,7 @@ function FormFieldLabel({
|
|
|
1151
1081
|
{
|
|
1152
1082
|
id: field.labelId,
|
|
1153
1083
|
htmlFor: field.id,
|
|
1154
|
-
className: cn("
|
|
1084
|
+
className: cn("font-medium text-text text-sm", className),
|
|
1155
1085
|
children: [
|
|
1156
1086
|
children,
|
|
1157
1087
|
field.required && /* @__PURE__ */ jsxRuntime.jsx("span", { "aria-hidden": true, className: "ml-1 text-destructive", children: "*" })
|
|
@@ -1176,15 +1106,30 @@ function FormFieldDescription({
|
|
|
1176
1106
|
);
|
|
1177
1107
|
}
|
|
1178
1108
|
__name(FormFieldDescription, "FormFieldDescription");
|
|
1109
|
+
var statusClasses = {
|
|
1110
|
+
error: "text-destructive animate-kui-shake [animation-delay:500ms]",
|
|
1111
|
+
success: "text-success",
|
|
1112
|
+
warning: "text-warning"
|
|
1113
|
+
};
|
|
1179
1114
|
function FormFieldMessage({ children }) {
|
|
1180
|
-
const { messageId } = useFormField();
|
|
1115
|
+
const { messageId, message, status, invalid } = useFormField();
|
|
1116
|
+
const content = children ?? message;
|
|
1117
|
+
if (!content) {
|
|
1118
|
+
return null;
|
|
1119
|
+
}
|
|
1120
|
+
const effectiveStatus = status !== "none" ? status : invalid ? "error" : "none";
|
|
1181
1121
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
1182
1122
|
"p",
|
|
1183
1123
|
{
|
|
1184
1124
|
id: messageId,
|
|
1185
|
-
role: "alert",
|
|
1186
|
-
|
|
1187
|
-
|
|
1125
|
+
role: effectiveStatus === "error" ? "alert" : void 0,
|
|
1126
|
+
"aria-live": effectiveStatus === "error" ? "assertive" : "polite",
|
|
1127
|
+
"data-status": effectiveStatus,
|
|
1128
|
+
className: cn(
|
|
1129
|
+
"text-sm",
|
|
1130
|
+
effectiveStatus !== "none" && statusClasses[effectiveStatus]
|
|
1131
|
+
),
|
|
1132
|
+
children: content
|
|
1188
1133
|
}
|
|
1189
1134
|
);
|
|
1190
1135
|
}
|
|
@@ -1653,38 +1598,48 @@ Select.Item = SelectItem;
|
|
|
1653
1598
|
Select.Value = SelectValue;
|
|
1654
1599
|
Select.Group = SelectGroup;
|
|
1655
1600
|
Select.Label = SelectLabel;
|
|
1656
|
-
|
|
1657
|
-
// src/components/Textarea/Textarea.styles.ts
|
|
1658
|
-
var textareaBase = cn(
|
|
1659
|
-
"flex w-full min-w-0 bg-transparent font-sans outline-none border-0",
|
|
1660
|
-
"text-text placeholder:text-text-muted",
|
|
1661
|
-
"transition-colors duration-[var(--kui-duration-fast)]",
|
|
1662
|
-
"disabled:opacity-50 disabled:pointer-events-none disabled:cursor-not-allowed"
|
|
1663
|
-
);
|
|
1664
|
-
var textareaResizeVariants = {
|
|
1665
|
-
none: "resize-none",
|
|
1666
|
-
both: "resize",
|
|
1667
|
-
horizontal: "resize-x",
|
|
1668
|
-
vertical: "resize-y"
|
|
1669
|
-
};
|
|
1670
1601
|
function mergeRefs2(...refs) {
|
|
1671
1602
|
return (node) => {
|
|
1672
|
-
refs.forEach((
|
|
1673
|
-
if (!
|
|
1674
|
-
if (typeof
|
|
1675
|
-
|
|
1603
|
+
refs.forEach((ref) => {
|
|
1604
|
+
if (!ref) return;
|
|
1605
|
+
if (typeof ref === "function") {
|
|
1606
|
+
ref(node);
|
|
1607
|
+
} else {
|
|
1608
|
+
ref.current = node;
|
|
1609
|
+
}
|
|
1676
1610
|
});
|
|
1677
1611
|
};
|
|
1678
1612
|
}
|
|
1679
1613
|
__name(mergeRefs2, "mergeRefs");
|
|
1614
|
+
function resolveFieldState({
|
|
1615
|
+
error,
|
|
1616
|
+
success,
|
|
1617
|
+
warning,
|
|
1618
|
+
hasReachedMaxLength,
|
|
1619
|
+
internalInvalid,
|
|
1620
|
+
fieldInvalid
|
|
1621
|
+
}) {
|
|
1622
|
+
const isInvalid = error === true || hasReachedMaxLength || internalInvalid === true || fieldInvalid === true;
|
|
1623
|
+
const isSuccess = !isInvalid && (success ?? internalInvalid === false);
|
|
1624
|
+
const isWarning = !isInvalid && !isSuccess && warning === true;
|
|
1625
|
+
const state = isInvalid ? "error" : isSuccess ? "success" : isWarning ? "warning" : "none";
|
|
1626
|
+
return { isInvalid, isSuccess, isWarning, state };
|
|
1627
|
+
}
|
|
1628
|
+
__name(resolveFieldState, "resolveFieldState");
|
|
1680
1629
|
var TextareaCore = react.forwardRef(
|
|
1681
1630
|
({
|
|
1682
|
-
className,
|
|
1683
1631
|
value: valueProp,
|
|
1684
1632
|
defaultValue,
|
|
1633
|
+
onValueChange: onValueChangeProp,
|
|
1634
|
+
onChange: onChangeProp,
|
|
1635
|
+
onBlur: onBlurProp,
|
|
1636
|
+
className,
|
|
1637
|
+
style: customStyle,
|
|
1685
1638
|
size = "md",
|
|
1686
|
-
|
|
1639
|
+
variant = "outline",
|
|
1687
1640
|
resize = "vertical",
|
|
1641
|
+
fullWidth = true,
|
|
1642
|
+
embedded = false,
|
|
1688
1643
|
autoResize = false,
|
|
1689
1644
|
minRows,
|
|
1690
1645
|
maxRows,
|
|
@@ -1692,43 +1647,71 @@ var TextareaCore = react.forwardRef(
|
|
|
1692
1647
|
onClear,
|
|
1693
1648
|
characterCounter = false,
|
|
1694
1649
|
debounceDelay = 0,
|
|
1695
|
-
|
|
1650
|
+
trim = false,
|
|
1696
1651
|
error,
|
|
1697
1652
|
success,
|
|
1698
|
-
|
|
1653
|
+
warning,
|
|
1654
|
+
validate,
|
|
1655
|
+
validateOn = "blur",
|
|
1699
1656
|
disabled,
|
|
1700
1657
|
id: externalId,
|
|
1658
|
+
required,
|
|
1701
1659
|
maxLength,
|
|
1702
|
-
variant = "outline",
|
|
1703
|
-
onValueChange: onValueChangeProp,
|
|
1704
|
-
onChange: onChangeProp,
|
|
1705
|
-
onBlur: onBlurProp,
|
|
1706
1660
|
rows,
|
|
1707
1661
|
...props
|
|
1708
1662
|
}, ref) => {
|
|
1709
1663
|
const autoId = react.useId();
|
|
1710
1664
|
const field = useOptionalFormField();
|
|
1711
|
-
const id = field?.id ?? externalId ?? autoId;
|
|
1712
1665
|
const { theme } = useTheme();
|
|
1666
|
+
const id = field?.id ?? externalId ?? autoId;
|
|
1713
1667
|
const internalRef = react.useRef(null);
|
|
1714
1668
|
const debounceTimer = react.useRef(null);
|
|
1669
|
+
const typography = useTypography("body");
|
|
1670
|
+
const { style: sizeStyle } = useSizeStyle(size, false, "textarea", {
|
|
1671
|
+
includeHeight: false
|
|
1672
|
+
});
|
|
1715
1673
|
const [draft, setDraft] = react.useState(() => valueProp ?? defaultValue ?? "");
|
|
1716
1674
|
react.useEffect(() => {
|
|
1717
|
-
if (valueProp !== void 0)
|
|
1675
|
+
if (valueProp !== void 0) {
|
|
1676
|
+
setDraft(valueProp);
|
|
1677
|
+
}
|
|
1718
1678
|
}, [valueProp]);
|
|
1719
1679
|
const [internalValidation, setInternalValidation] = react.useState({});
|
|
1720
|
-
const
|
|
1721
|
-
const
|
|
1722
|
-
const
|
|
1723
|
-
|
|
1724
|
-
|
|
1725
|
-
|
|
1726
|
-
|
|
1727
|
-
|
|
1680
|
+
const maxLengthExceeded = maxLength !== void 0 && draft.length > maxLength;
|
|
1681
|
+
const hasValue = draft.length > 0;
|
|
1682
|
+
const hasMaxLength = typeof maxLength === "number";
|
|
1683
|
+
const hasReachedMaxLength = hasMaxLength && draft.length >= maxLength;
|
|
1684
|
+
const maxLengthMessage = hasReachedMaxLength ? `Maximum length of ${maxLength} characters reached.` : void 0;
|
|
1685
|
+
const { isInvalid, isSuccess, isWarning, state } = react.useMemo(
|
|
1686
|
+
() => resolveFieldState({
|
|
1687
|
+
error,
|
|
1688
|
+
success,
|
|
1689
|
+
warning,
|
|
1690
|
+
hasReachedMaxLength,
|
|
1691
|
+
internalInvalid: internalValidation.invalid,
|
|
1692
|
+
fieldInvalid: field?.invalid
|
|
1693
|
+
}),
|
|
1694
|
+
[
|
|
1695
|
+
error,
|
|
1696
|
+
success,
|
|
1697
|
+
warning,
|
|
1698
|
+
hasReachedMaxLength,
|
|
1699
|
+
internalValidation.invalid,
|
|
1700
|
+
field?.invalid
|
|
1701
|
+
]
|
|
1728
1702
|
);
|
|
1703
|
+
react.useEffect(() => {
|
|
1704
|
+
return () => {
|
|
1705
|
+
if (debounceTimer.current) {
|
|
1706
|
+
clearTimeout(debounceTimer.current);
|
|
1707
|
+
}
|
|
1708
|
+
};
|
|
1709
|
+
}, []);
|
|
1729
1710
|
function commitValue(next, { immediate = false } = {}) {
|
|
1730
1711
|
setDraft(next);
|
|
1731
|
-
if (debounceTimer.current)
|
|
1712
|
+
if (debounceTimer.current) {
|
|
1713
|
+
clearTimeout(debounceTimer.current);
|
|
1714
|
+
}
|
|
1732
1715
|
if (debounceDelay > 0 && !immediate) {
|
|
1733
1716
|
debounceTimer.current = setTimeout(() => {
|
|
1734
1717
|
onValueChangeProp?.(next);
|
|
@@ -1738,84 +1721,137 @@ var TextareaCore = react.forwardRef(
|
|
|
1738
1721
|
}
|
|
1739
1722
|
}
|
|
1740
1723
|
__name(commitValue, "commitValue");
|
|
1741
|
-
function
|
|
1742
|
-
|
|
1743
|
-
|
|
1724
|
+
function getValidationResult(value) {
|
|
1725
|
+
if (maxLength !== void 0 && value.length >= maxLength) {
|
|
1726
|
+
return {
|
|
1727
|
+
invalid: true,
|
|
1728
|
+
message: maxLengthMessage
|
|
1729
|
+
};
|
|
1730
|
+
}
|
|
1731
|
+
if (!validate) {
|
|
1732
|
+
return null;
|
|
1733
|
+
}
|
|
1734
|
+
const result = validate(value);
|
|
1735
|
+
if (result === true) {
|
|
1736
|
+
return {
|
|
1737
|
+
invalid: false,
|
|
1738
|
+
message: void 0
|
|
1739
|
+
};
|
|
1740
|
+
}
|
|
1741
|
+
if (result === false) {
|
|
1742
|
+
return {
|
|
1743
|
+
invalid: true,
|
|
1744
|
+
message: void 0
|
|
1745
|
+
};
|
|
1746
|
+
}
|
|
1747
|
+
return {
|
|
1748
|
+
invalid: true,
|
|
1749
|
+
message: result
|
|
1750
|
+
};
|
|
1744
1751
|
}
|
|
1745
|
-
__name(
|
|
1746
|
-
function runValidation(
|
|
1747
|
-
|
|
1748
|
-
|
|
1749
|
-
|
|
1750
|
-
setInternalValidation(parsed);
|
|
1751
|
-
field?.reportValidity(parsed.invalid ? parsed : null);
|
|
1752
|
+
__name(getValidationResult, "getValidationResult");
|
|
1753
|
+
function runValidation(value) {
|
|
1754
|
+
const result = getValidationResult(value);
|
|
1755
|
+
setInternalValidation(result ?? {});
|
|
1756
|
+
field?.reportValidity(result?.invalid ? result : null);
|
|
1752
1757
|
}
|
|
1753
1758
|
__name(runValidation, "runValidation");
|
|
1754
|
-
function
|
|
1759
|
+
function handleChange(event) {
|
|
1760
|
+
const next = event.target.value;
|
|
1761
|
+
commitValue(next);
|
|
1762
|
+
onChangeProp?.(event);
|
|
1763
|
+
const shouldValidate = validateOn === "change" || validateOn === "both";
|
|
1764
|
+
if (shouldValidate) {
|
|
1765
|
+
runValidation(next);
|
|
1766
|
+
} else if (internalValidation.invalid) {
|
|
1767
|
+
setInternalValidation({});
|
|
1768
|
+
field?.reportValidity(null);
|
|
1769
|
+
}
|
|
1770
|
+
}
|
|
1771
|
+
__name(handleChange, "handleChange");
|
|
1772
|
+
function handleBlur(event) {
|
|
1755
1773
|
let finalValue = draft;
|
|
1756
|
-
if (
|
|
1774
|
+
if (trim) {
|
|
1757
1775
|
const trimmed = draft.trim();
|
|
1758
1776
|
if (trimmed !== draft) {
|
|
1759
|
-
commitValue(trimmed, {
|
|
1777
|
+
commitValue(trimmed, {
|
|
1778
|
+
immediate: true
|
|
1779
|
+
});
|
|
1760
1780
|
finalValue = trimmed;
|
|
1761
1781
|
}
|
|
1762
1782
|
}
|
|
1763
|
-
|
|
1764
|
-
|
|
1783
|
+
if (validateOn === "blur" || validateOn === "both") {
|
|
1784
|
+
runValidation(finalValue);
|
|
1785
|
+
}
|
|
1786
|
+
onBlurProp?.(event);
|
|
1765
1787
|
}
|
|
1766
1788
|
__name(handleBlur, "handleBlur");
|
|
1767
1789
|
function handleClear() {
|
|
1768
|
-
commitValue("", {
|
|
1769
|
-
|
|
1790
|
+
commitValue("", {
|
|
1791
|
+
immediate: true
|
|
1792
|
+
});
|
|
1770
1793
|
setInternalValidation({});
|
|
1771
1794
|
field?.reportValidity(null);
|
|
1795
|
+
internalRef.current?.focus();
|
|
1772
1796
|
onClear?.();
|
|
1773
1797
|
}
|
|
1774
1798
|
__name(handleClear, "handleClear");
|
|
1775
1799
|
react.useLayoutEffect(() => {
|
|
1776
1800
|
if (!autoResize) return;
|
|
1777
|
-
const
|
|
1778
|
-
if (!
|
|
1779
|
-
const computed = window.getComputedStyle(
|
|
1801
|
+
const element = internalRef.current;
|
|
1802
|
+
if (!element) return;
|
|
1803
|
+
const computed = window.getComputedStyle(element);
|
|
1780
1804
|
const lineHeight = parseFloat(computed.lineHeight) || parseFloat(computed.fontSize) * 1.2;
|
|
1781
1805
|
const paddingY = parseFloat(computed.paddingTop) + parseFloat(computed.paddingBottom);
|
|
1782
1806
|
const borderY = parseFloat(computed.borderTopWidth) + parseFloat(computed.borderBottomWidth);
|
|
1783
|
-
const minHeight = minRows ? lineHeight * minRows + paddingY + borderY : void 0;
|
|
1784
|
-
const maxHeight = maxRows ? lineHeight * maxRows + paddingY + borderY : void 0;
|
|
1785
|
-
|
|
1786
|
-
let
|
|
1787
|
-
if (minHeight
|
|
1788
|
-
|
|
1789
|
-
|
|
1790
|
-
|
|
1807
|
+
const minHeight = minRows !== void 0 ? lineHeight * minRows + paddingY + borderY : void 0;
|
|
1808
|
+
const maxHeight = maxRows !== void 0 ? lineHeight * maxRows + paddingY + borderY : void 0;
|
|
1809
|
+
element.style.height = "auto";
|
|
1810
|
+
let nextHeight = element.scrollHeight;
|
|
1811
|
+
if (minHeight !== void 0) {
|
|
1812
|
+
nextHeight = Math.max(nextHeight, minHeight);
|
|
1813
|
+
}
|
|
1814
|
+
if (maxHeight !== void 0) {
|
|
1815
|
+
nextHeight = Math.min(nextHeight, maxHeight);
|
|
1816
|
+
}
|
|
1817
|
+
element.style.height = `${nextHeight}px`;
|
|
1818
|
+
element.style.overflowY = maxHeight !== void 0 && element.scrollHeight > maxHeight ? "auto" : "hidden";
|
|
1791
1819
|
}, [autoResize, draft, minRows, maxRows]);
|
|
1792
|
-
const hasValue = draft.length > 0;
|
|
1793
1820
|
const showClear = clearable && hasValue && !disabled;
|
|
1794
1821
|
const showCounter = characterCounter;
|
|
1795
|
-
const nearLimit =
|
|
1822
|
+
const nearLimit = hasMaxLength && draft.length >= Math.max(0, maxLength - 10);
|
|
1796
1823
|
const needsBottomSpace = showClear || showCounter;
|
|
1797
1824
|
const messageId = !field?.describedBy && (isInvalid || isSuccess) ? `${id}-message` : void 0;
|
|
1798
1825
|
const counterId = showCounter ? `${id}-counter` : void 0;
|
|
1799
1826
|
const describedBy = cn(field?.describedBy, messageId, counterId).trim() || void 0;
|
|
1800
|
-
const wrapperClassName =
|
|
1801
|
-
|
|
1802
|
-
|
|
1803
|
-
|
|
1804
|
-
|
|
1805
|
-
|
|
1806
|
-
|
|
1807
|
-
|
|
1808
|
-
|
|
1809
|
-
|
|
1810
|
-
|
|
1811
|
-
includeHeight: false
|
|
1827
|
+
const wrapperClassName = resolveRecipe(theme.recipes.FormControl, {
|
|
1828
|
+
variant,
|
|
1829
|
+
state,
|
|
1830
|
+
fullWidth,
|
|
1831
|
+
disabled: !!disabled,
|
|
1832
|
+
embedded
|
|
1833
|
+
});
|
|
1834
|
+
const textareaClasses = resolveRecipe(theme.recipes.Textarea, {
|
|
1835
|
+
variant,
|
|
1836
|
+
resize,
|
|
1837
|
+
autoResize
|
|
1812
1838
|
});
|
|
1813
|
-
const textareaStyle = {
|
|
1839
|
+
const textareaStyle = {
|
|
1840
|
+
...typography,
|
|
1841
|
+
...sizeStyle,
|
|
1842
|
+
...customStyle
|
|
1843
|
+
};
|
|
1814
1844
|
if (needsBottomSpace) {
|
|
1815
1845
|
const existingBottom = sizeStyle.paddingBottom;
|
|
1816
1846
|
textareaStyle.paddingBottom = existingBottom ? `calc(${existingBottom} + 1.25rem)` : "1.5rem";
|
|
1817
1847
|
}
|
|
1818
|
-
|
|
1848
|
+
const counterClassName = cn(
|
|
1849
|
+
"pointer-events-none absolute",
|
|
1850
|
+
"bottom-1.5 right-2.5",
|
|
1851
|
+
"font-mono text-[11px]",
|
|
1852
|
+
maxLengthExceeded ? "text-destructive" : hasReachedMaxLength ? "text-warning" : nearLimit ? "text-warning" : "text-text-muted"
|
|
1853
|
+
);
|
|
1854
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: cn(wrapperClassName, "items-start"), children: [
|
|
1819
1855
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1820
1856
|
"textarea",
|
|
1821
1857
|
{
|
|
@@ -1829,17 +1865,17 @@ var TextareaCore = react.forwardRef(
|
|
|
1829
1865
|
rows: autoResize ? void 0 : rows ?? minRows,
|
|
1830
1866
|
"aria-invalid": isInvalid || void 0,
|
|
1831
1867
|
"aria-describedby": describedBy,
|
|
1868
|
+
"aria-required": required,
|
|
1869
|
+
required,
|
|
1832
1870
|
style: textareaStyle,
|
|
1833
|
-
className: cn(
|
|
1834
|
-
textareaBase,
|
|
1835
|
-
!autoResize && textareaResizeVariants[resize],
|
|
1836
|
-
autoResize && "resize-none overflow-hidden"
|
|
1837
|
-
),
|
|
1871
|
+
className: cn(textareaClasses, "py-3", className),
|
|
1838
1872
|
"data-size": size,
|
|
1839
1873
|
"data-invalid": isInvalid || void 0,
|
|
1840
1874
|
"data-success": isSuccess || void 0,
|
|
1875
|
+
"data-warning": isWarning || void 0,
|
|
1841
1876
|
"data-disabled": disabled || void 0,
|
|
1842
1877
|
"data-autoresize": autoResize || void 0,
|
|
1878
|
+
"data-maxlength-reached": hasReachedMaxLength || void 0,
|
|
1843
1879
|
...props
|
|
1844
1880
|
}
|
|
1845
1881
|
),
|
|
@@ -1849,30 +1885,26 @@ var TextareaCore = react.forwardRef(
|
|
|
1849
1885
|
type: "button",
|
|
1850
1886
|
"aria-label": "Clear textarea",
|
|
1851
1887
|
onClick: handleClear,
|
|
1852
|
-
className: "absolute right-2 top-2 flex items-center justify-center text-text-muted transition-colors hover:text-text",
|
|
1853
|
-
children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.X, { size: 14 })
|
|
1854
|
-
}
|
|
1855
|
-
),
|
|
1856
|
-
showCounter && /* @__PURE__ */ jsxRuntime.jsxs(
|
|
1857
|
-
"div",
|
|
1858
|
-
{
|
|
1859
|
-
id: counterId,
|
|
1860
1888
|
className: cn(
|
|
1861
|
-
"
|
|
1862
|
-
|
|
1889
|
+
"absolute right-2 top-2",
|
|
1890
|
+
"flex items-center justify-center",
|
|
1891
|
+
"text-text-muted",
|
|
1892
|
+
"transition-colors",
|
|
1893
|
+
"hover:text-text"
|
|
1863
1894
|
),
|
|
1864
|
-
children:
|
|
1865
|
-
draft.length,
|
|
1866
|
-
maxLength ? `/${maxLength}` : ""
|
|
1867
|
-
]
|
|
1895
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.X, { size: 14 })
|
|
1868
1896
|
}
|
|
1869
1897
|
),
|
|
1898
|
+
showCounter && /* @__PURE__ */ jsxRuntime.jsxs("div", { id: counterId, className: counterClassName, children: [
|
|
1899
|
+
draft.length,
|
|
1900
|
+
maxLength ? `/${maxLength}` : ""
|
|
1901
|
+
] }),
|
|
1870
1902
|
internalValidation.message && !field && /* @__PURE__ */ jsxRuntime.jsx(
|
|
1871
1903
|
"p",
|
|
1872
1904
|
{
|
|
1873
1905
|
id: messageId,
|
|
1874
1906
|
role: "alert",
|
|
1875
|
-
className: "mt-1.5 px-0.5 text-xs text-
|
|
1907
|
+
className: cn("mt-1.5 px-0.5", "text-xs text-destructive"),
|
|
1876
1908
|
children: internalValidation.message
|
|
1877
1909
|
}
|
|
1878
1910
|
)
|
|
@@ -1964,29 +1996,6 @@ function insertLink(value, start, end) {
|
|
|
1964
1996
|
return { value: next, selectionStart: urlStart, selectionEnd: urlStart + 3 };
|
|
1965
1997
|
}
|
|
1966
1998
|
__name(insertLink, "insertLink");
|
|
1967
|
-
|
|
1968
|
-
// src/utils/env.ts
|
|
1969
|
-
function readProcessEnv() {
|
|
1970
|
-
try {
|
|
1971
|
-
return typeof process !== "undefined" ? process.env?.NODE_ENV : void 0;
|
|
1972
|
-
} catch {
|
|
1973
|
-
return void 0;
|
|
1974
|
-
}
|
|
1975
|
-
}
|
|
1976
|
-
__name(readProcessEnv, "readProcessEnv");
|
|
1977
|
-
function readImportMetaEnv() {
|
|
1978
|
-
try {
|
|
1979
|
-
return typeof ({ url: (typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('index.cjs', document.baseURI).href)) }) !== "undefined" ? undefined?.MODE : void 0;
|
|
1980
|
-
} catch {
|
|
1981
|
-
return void 0;
|
|
1982
|
-
}
|
|
1983
|
-
}
|
|
1984
|
-
__name(readImportMetaEnv, "readImportMetaEnv");
|
|
1985
|
-
function isDev() {
|
|
1986
|
-
const mode = readProcessEnv() ?? readImportMetaEnv();
|
|
1987
|
-
return mode !== void 0 && mode !== "production";
|
|
1988
|
-
}
|
|
1989
|
-
__name(isDev, "isDev");
|
|
1990
1999
|
var TOOLBAR = [
|
|
1991
2000
|
{
|
|
1992
2001
|
label: "Heading",
|
|
@@ -2027,6 +2036,13 @@ var MarkdownEditor = react.forwardRef(
|
|
|
2027
2036
|
defaultValue,
|
|
2028
2037
|
onValueChange,
|
|
2029
2038
|
className,
|
|
2039
|
+
fullWidth,
|
|
2040
|
+
variant,
|
|
2041
|
+
success,
|
|
2042
|
+
error,
|
|
2043
|
+
warning,
|
|
2044
|
+
disabled,
|
|
2045
|
+
maxLength,
|
|
2030
2046
|
...textareaProps
|
|
2031
2047
|
}, ref) => {
|
|
2032
2048
|
const baseId = react.useId();
|
|
@@ -2035,8 +2051,22 @@ var MarkdownEditor = react.forwardRef(
|
|
|
2035
2051
|
defaultTab
|
|
2036
2052
|
);
|
|
2037
2053
|
const tab = tabProp ?? uncontrolledTab;
|
|
2054
|
+
const { theme } = useTheme();
|
|
2055
|
+
const field = useOptionalFormField();
|
|
2056
|
+
const footerMessage = hint;
|
|
2038
2057
|
const [draft, setDraft] = react.useState(() => valueProp ?? defaultValue ?? "");
|
|
2039
2058
|
const value = valueProp ?? draft;
|
|
2059
|
+
const maxLengthReached = typeof maxLength === "number" && value.length >= maxLength;
|
|
2060
|
+
const state = error || maxLengthReached ? "error" : success ? "success" : warning ? "warning" : field?.status ?? "none";
|
|
2061
|
+
const editorClasses = cn(
|
|
2062
|
+
resolveRecipe(theme.recipes.MarkdownEditor, {
|
|
2063
|
+
variant,
|
|
2064
|
+
state,
|
|
2065
|
+
fullWidth,
|
|
2066
|
+
disabled: !!disabled
|
|
2067
|
+
}),
|
|
2068
|
+
className
|
|
2069
|
+
);
|
|
2040
2070
|
function setTab(next) {
|
|
2041
2071
|
if (tabProp === void 0) setUncontrolledTab(next);
|
|
2042
2072
|
onTabChange?.(next);
|
|
@@ -2048,6 +2078,7 @@ var MarkdownEditor = react.forwardRef(
|
|
|
2048
2078
|
}
|
|
2049
2079
|
__name(commit, "commit");
|
|
2050
2080
|
function runAction(action) {
|
|
2081
|
+
if (disabled) return;
|
|
2051
2082
|
const el = textareaRef.current;
|
|
2052
2083
|
if (!el) return;
|
|
2053
2084
|
const { selectionStart, selectionEnd } = el;
|
|
@@ -2077,94 +2108,91 @@ var MarkdownEditor = react.forwardRef(
|
|
|
2077
2108
|
);
|
|
2078
2109
|
}
|
|
2079
2110
|
}, [renderMarkdown]);
|
|
2080
|
-
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
2081
|
-
|
|
2082
|
-
|
|
2083
|
-
|
|
2084
|
-
|
|
2085
|
-
|
|
2086
|
-
|
|
2087
|
-
|
|
2088
|
-
|
|
2089
|
-
"
|
|
2090
|
-
|
|
2091
|
-
|
|
2092
|
-
|
|
2093
|
-
|
|
2094
|
-
|
|
2095
|
-
|
|
2096
|
-
|
|
2097
|
-
|
|
2098
|
-
|
|
2099
|
-
|
|
2100
|
-
|
|
2101
|
-
|
|
2102
|
-
|
|
2103
|
-
|
|
2104
|
-
|
|
2105
|
-
|
|
2106
|
-
|
|
2107
|
-
|
|
2108
|
-
|
|
2109
|
-
|
|
2110
|
-
|
|
2111
|
-
|
|
2112
|
-
|
|
2113
|
-
|
|
2114
|
-
|
|
2115
|
-
|
|
2116
|
-
|
|
2117
|
-
|
|
2118
|
-
|
|
2119
|
-
|
|
2120
|
-
|
|
2121
|
-
|
|
2122
|
-
|
|
2123
|
-
|
|
2124
|
-
|
|
2125
|
-
|
|
2126
|
-
|
|
2127
|
-
|
|
2128
|
-
|
|
2111
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: editorClasses, children: [
|
|
2112
|
+
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
2113
|
+
"div",
|
|
2114
|
+
{
|
|
2115
|
+
role: "tablist",
|
|
2116
|
+
"aria-label": "Markdown editor mode",
|
|
2117
|
+
id: tablistId,
|
|
2118
|
+
className: "flex items-center gap-4 border-b border-border px-3",
|
|
2119
|
+
children: [
|
|
2120
|
+
["write", "preview"].map((t) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
2121
|
+
"button",
|
|
2122
|
+
{
|
|
2123
|
+
type: "button",
|
|
2124
|
+
role: "tab",
|
|
2125
|
+
id: `${baseId}-${t}-tab`,
|
|
2126
|
+
"aria-selected": tab === t,
|
|
2127
|
+
"aria-controls": t === "write" ? writePanelId : previewPanelId,
|
|
2128
|
+
onClick: () => setTab(t),
|
|
2129
|
+
disabled,
|
|
2130
|
+
className: cn(
|
|
2131
|
+
"border-b-2 py-2.5 text-sm capitalize transition-colors",
|
|
2132
|
+
"disabled:pointer-events-none disabled:cursor-not-allowed",
|
|
2133
|
+
tab === t ? "border-brand text-text" : "border-transparent text-text-muted hover:text-text"
|
|
2134
|
+
),
|
|
2135
|
+
children: t
|
|
2136
|
+
},
|
|
2137
|
+
t
|
|
2138
|
+
)),
|
|
2139
|
+
tab === "write" && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "ml-auto flex items-center gap-1 py-1.5", children: TOOLBAR.map(({ label, icon: Icon, action }) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
2140
|
+
"button",
|
|
2141
|
+
{
|
|
2142
|
+
type: "button",
|
|
2143
|
+
"aria-label": label,
|
|
2144
|
+
onClick: () => runAction(action),
|
|
2145
|
+
disabled,
|
|
2146
|
+
className: "rounded-(--kui-radii-sm) p-1.5 text-text-muted transition-colors hover:bg-surface-raised hover:text-text disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50",
|
|
2147
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(Icon, { size: 15 })
|
|
2148
|
+
},
|
|
2149
|
+
label
|
|
2150
|
+
)) })
|
|
2151
|
+
]
|
|
2152
|
+
}
|
|
2153
|
+
),
|
|
2154
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
2155
|
+
"div",
|
|
2156
|
+
{
|
|
2157
|
+
id: writePanelId,
|
|
2158
|
+
role: "tabpanel",
|
|
2159
|
+
"aria-labelledby": `${baseId}-write-tab`,
|
|
2160
|
+
hidden: tab !== "write",
|
|
2161
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
2162
|
+
TextareaCore,
|
|
2129
2163
|
{
|
|
2130
|
-
|
|
2131
|
-
|
|
2132
|
-
|
|
2133
|
-
|
|
2134
|
-
|
|
2135
|
-
|
|
2136
|
-
{
|
|
2137
|
-
ref: (node) => {
|
|
2138
|
-
textareaRef.current = node;
|
|
2139
|
-
if (typeof ref === "function") ref(node);
|
|
2140
|
-
else if (ref)
|
|
2141
|
-
ref.current = node;
|
|
2142
|
-
},
|
|
2143
|
-
value,
|
|
2144
|
-
onValueChange: commit,
|
|
2145
|
-
resize: "vertical",
|
|
2146
|
-
variant: "ghost",
|
|
2147
|
-
className: "rounded-none border-0",
|
|
2148
|
-
...textareaProps
|
|
2164
|
+
ref: (node) => {
|
|
2165
|
+
textareaRef.current = node;
|
|
2166
|
+
if (typeof ref === "function") {
|
|
2167
|
+
ref(node);
|
|
2168
|
+
} else if (ref) {
|
|
2169
|
+
ref.current = node;
|
|
2149
2170
|
}
|
|
2150
|
-
|
|
2151
|
-
|
|
2152
|
-
|
|
2153
|
-
|
|
2154
|
-
|
|
2155
|
-
|
|
2156
|
-
|
|
2157
|
-
|
|
2158
|
-
"aria-labelledby": `${baseId}-preview-tab`,
|
|
2159
|
-
hidden: tab !== "preview",
|
|
2160
|
-
className: "min-h-32 p-3 text-sm text-text",
|
|
2161
|
-
children: renderMarkdown ? renderedPreview : /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-text-muted", children: "No renderMarkdown provided \u2014 showing raw text." })
|
|
2171
|
+
},
|
|
2172
|
+
value,
|
|
2173
|
+
onValueChange: commit,
|
|
2174
|
+
embedded: true,
|
|
2175
|
+
resize: "vertical",
|
|
2176
|
+
disabled,
|
|
2177
|
+
maxLength,
|
|
2178
|
+
...textareaProps
|
|
2162
2179
|
}
|
|
2163
|
-
)
|
|
2164
|
-
|
|
2165
|
-
|
|
2166
|
-
|
|
2167
|
-
|
|
2180
|
+
)
|
|
2181
|
+
}
|
|
2182
|
+
),
|
|
2183
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
2184
|
+
"div",
|
|
2185
|
+
{
|
|
2186
|
+
id: previewPanelId,
|
|
2187
|
+
role: "tabpanel",
|
|
2188
|
+
"aria-labelledby": `${baseId}-preview-tab`,
|
|
2189
|
+
hidden: tab !== "preview",
|
|
2190
|
+
className: "min-h-32 p-3 text-sm text-text",
|
|
2191
|
+
children: renderMarkdown ? renderedPreview : /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-text-muted", children: "No renderMarkdown provided \u2014 showing raw text." })
|
|
2192
|
+
}
|
|
2193
|
+
),
|
|
2194
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex items-center gap-2 border-t border-border px-3 py-2 text-xs z-1", children: footerMessage })
|
|
2195
|
+
] });
|
|
2168
2196
|
}
|
|
2169
2197
|
);
|
|
2170
2198
|
MarkdownEditor.displayName = "MarkdownEditor";
|
|
@@ -2177,60 +2205,6 @@ var Textarea = react.forwardRef(
|
|
|
2177
2205
|
}
|
|
2178
2206
|
);
|
|
2179
2207
|
Textarea.displayName = "Textarea";
|
|
2180
|
-
var checkboxBoxVariants = classVarianceAuthority.cva(
|
|
2181
|
-
"flex shrink-0 items-center justify-center rounded-[calc(var(--kui-radii-md)-2px)] border transition-colors duration-[var(--kui-duration-fast)]",
|
|
2182
|
-
{
|
|
2183
|
-
variants: {
|
|
2184
|
-
size: {
|
|
2185
|
-
sm: "h-4 w-4",
|
|
2186
|
-
md: "h-5 w-5",
|
|
2187
|
-
lg: "h-6 w-6"
|
|
2188
|
-
},
|
|
2189
|
-
state: {
|
|
2190
|
-
none: "",
|
|
2191
|
-
error: "border-danger",
|
|
2192
|
-
success: "border-success"
|
|
2193
|
-
},
|
|
2194
|
-
checked: {
|
|
2195
|
-
true: "bg-brand border-brand text-brand-fg",
|
|
2196
|
-
false: "border-border bg-transparent"
|
|
2197
|
-
},
|
|
2198
|
-
disabled: {
|
|
2199
|
-
true: "cursor-not-allowed",
|
|
2200
|
-
false: "cursor-pointer"
|
|
2201
|
-
}
|
|
2202
|
-
},
|
|
2203
|
-
defaultVariants: {
|
|
2204
|
-
size: "md",
|
|
2205
|
-
state: "none",
|
|
2206
|
-
checked: false,
|
|
2207
|
-
disabled: false
|
|
2208
|
-
},
|
|
2209
|
-
compoundVariants: [
|
|
2210
|
-
{ checked: false, state: "error", class: "border-danger" },
|
|
2211
|
-
{ checked: false, state: "success", class: "border-success" }
|
|
2212
|
-
]
|
|
2213
|
-
}
|
|
2214
|
-
);
|
|
2215
|
-
var checkboxIconSizes = {
|
|
2216
|
-
sm: 10,
|
|
2217
|
-
md: 12,
|
|
2218
|
-
lg: 14
|
|
2219
|
-
};
|
|
2220
|
-
function DashIcon({ size }) {
|
|
2221
|
-
return /* @__PURE__ */ jsxRuntime.jsx("svg", { width: size, height: size, viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: 3, strokeLinecap: "round", "aria-hidden": "true", children: /* @__PURE__ */ jsxRuntime.jsx("line", { x1: "5", y1: "12", x2: "19", y2: "12" }) });
|
|
2222
|
-
}
|
|
2223
|
-
__name(DashIcon, "DashIcon");
|
|
2224
|
-
function mergeRefs3(...refs) {
|
|
2225
|
-
return (node) => {
|
|
2226
|
-
refs.forEach((r) => {
|
|
2227
|
-
if (!r) return;
|
|
2228
|
-
if (typeof r === "function") r(node);
|
|
2229
|
-
else r.current = node;
|
|
2230
|
-
});
|
|
2231
|
-
};
|
|
2232
|
-
}
|
|
2233
|
-
__name(mergeRefs3, "mergeRefs");
|
|
2234
2208
|
var Checkbox = react.forwardRef(
|
|
2235
2209
|
({
|
|
2236
2210
|
className,
|
|
@@ -2238,9 +2212,10 @@ var Checkbox = react.forwardRef(
|
|
|
2238
2212
|
defaultChecked,
|
|
2239
2213
|
onCheckedChange,
|
|
2240
2214
|
indeterminate = false,
|
|
2241
|
-
size = "
|
|
2215
|
+
size = "sm",
|
|
2242
2216
|
error,
|
|
2243
2217
|
success,
|
|
2218
|
+
status,
|
|
2244
2219
|
disabled,
|
|
2245
2220
|
label,
|
|
2246
2221
|
description,
|
|
@@ -2251,97 +2226,136 @@ var Checkbox = react.forwardRef(
|
|
|
2251
2226
|
}, ref) => {
|
|
2252
2227
|
const autoId = react.useId();
|
|
2253
2228
|
const field = useOptionalFormField();
|
|
2229
|
+
const { theme } = useTheme();
|
|
2254
2230
|
const id = field?.id ?? externalId ?? autoId;
|
|
2255
|
-
const
|
|
2231
|
+
const inputRef = react.useRef(null);
|
|
2256
2232
|
const [internalChecked, setInternalChecked] = react.useState(
|
|
2257
2233
|
defaultChecked ?? false
|
|
2258
2234
|
);
|
|
2259
|
-
const
|
|
2235
|
+
const isControlled = checkedProp !== void 0;
|
|
2236
|
+
const checked = isControlled ? checkedProp : internalChecked;
|
|
2260
2237
|
const hasWarned = react.useRef(false);
|
|
2261
2238
|
react.useEffect(() => {
|
|
2262
|
-
if (
|
|
2263
|
-
if (hasWarned.current) return;
|
|
2239
|
+
if (!isDev() || hasWarned.current) return;
|
|
2264
2240
|
if (label && field?.hasExternalLabel) {
|
|
2265
2241
|
console.warn(
|
|
2266
|
-
"[kreativ-ui/Checkbox] This checkbox has both a `label` prop and a <FormField.Label> ancestor.
|
|
2242
|
+
"[kreativ-ui/Checkbox] This checkbox has both a `label` prop and a <FormField.Label> ancestor. Checkbox owns its label. Use the Checkbox `label` prop instead of <FormField.Label>."
|
|
2267
2243
|
);
|
|
2268
2244
|
hasWarned.current = true;
|
|
2269
2245
|
}
|
|
2270
2246
|
}, [label, field?.hasExternalLabel]);
|
|
2271
2247
|
react.useEffect(() => {
|
|
2272
|
-
if (
|
|
2273
|
-
|
|
2248
|
+
if (inputRef.current) {
|
|
2249
|
+
inputRef.current.indeterminate = indeterminate;
|
|
2250
|
+
}
|
|
2274
2251
|
}, [indeterminate]);
|
|
2275
2252
|
const isInvalid = error ?? field?.invalid ?? false;
|
|
2276
2253
|
const isSuccess = success ?? false;
|
|
2277
|
-
const state = isInvalid ? "error" : isSuccess ? "success" : "none";
|
|
2278
|
-
|
|
2279
|
-
|
|
2280
|
-
|
|
2281
|
-
|
|
2282
|
-
|
|
2254
|
+
const state = status ? status : isInvalid ? "error" : isSuccess ? "success" : "none";
|
|
2255
|
+
const hasLabels = label || description;
|
|
2256
|
+
const {
|
|
2257
|
+
style: sizeStyle,
|
|
2258
|
+
iconSize,
|
|
2259
|
+
fontSize
|
|
2260
|
+
} = useSizeStyle(size, !hasLabels, "checkbox", {
|
|
2261
|
+
widthFromHeight: true,
|
|
2262
|
+
sizeOffset: "7px"
|
|
2263
|
+
});
|
|
2264
|
+
const checkboxClasses = resolveRecipe(theme.recipes.Checkbox, {
|
|
2265
|
+
state,
|
|
2266
|
+
checked: checked || indeterminate,
|
|
2267
|
+
disabled: !!disabled
|
|
2268
|
+
});
|
|
2269
|
+
const statusTransition = useStatusTransition(state);
|
|
2270
|
+
const descriptionId = description ? `${id}-description` : void 0;
|
|
2271
|
+
const describedBy = [field?.describedBy, descriptionId].filter(Boolean).join(" ") || void 0;
|
|
2272
|
+
function handleChange(event) {
|
|
2273
|
+
const nextChecked = event.target.checked;
|
|
2274
|
+
if (!isControlled) {
|
|
2275
|
+
setInternalChecked(nextChecked);
|
|
2276
|
+
}
|
|
2277
|
+
onCheckedChange?.(nextChecked);
|
|
2278
|
+
onChangeProp?.(event);
|
|
2283
2279
|
}
|
|
2284
2280
|
__name(handleChange, "handleChange");
|
|
2285
|
-
const
|
|
2286
|
-
|
|
2281
|
+
const wasInvalidRef = react.useRef(isInvalid);
|
|
2282
|
+
react.useEffect(() => {
|
|
2283
|
+
const justBecameInvalid = isInvalid && !wasInvalidRef.current;
|
|
2284
|
+
wasInvalidRef.current = isInvalid;
|
|
2285
|
+
if (!justBecameInvalid) {
|
|
2286
|
+
return;
|
|
2287
|
+
}
|
|
2288
|
+
inputRef.current?.scrollIntoView({
|
|
2289
|
+
behavior: "smooth",
|
|
2290
|
+
block: "center"
|
|
2291
|
+
});
|
|
2292
|
+
}, [isInvalid]);
|
|
2287
2293
|
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
2288
2294
|
"div",
|
|
2289
2295
|
{
|
|
2290
2296
|
className: cn(
|
|
2291
|
-
"flex gap-2
|
|
2297
|
+
"inline-flex items-start gap-2",
|
|
2292
2298
|
disabled && "cursor-not-allowed opacity-50",
|
|
2293
2299
|
className
|
|
2294
2300
|
),
|
|
2295
2301
|
children: [
|
|
2296
|
-
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "relative
|
|
2302
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "relative inline-flex shrink-0", children: [
|
|
2297
2303
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
2298
2304
|
"input",
|
|
2299
2305
|
{
|
|
2300
|
-
|
|
2301
|
-
|
|
2306
|
+
...props,
|
|
2307
|
+
ref: mergeRefs(inputRef, ref),
|
|
2302
2308
|
id,
|
|
2309
|
+
type: "checkbox",
|
|
2303
2310
|
checked,
|
|
2304
2311
|
disabled,
|
|
2305
2312
|
required: required ?? field?.required,
|
|
2306
2313
|
onChange: handleChange,
|
|
2307
2314
|
"aria-invalid": isInvalid || void 0,
|
|
2308
2315
|
"aria-describedby": describedBy,
|
|
2309
|
-
className: "peer absolute inset-0 z-10 m-0 h-full w-full cursor-pointer opacity-0 disabled:cursor-not-allowed",
|
|
2310
2316
|
"data-invalid": isInvalid || void 0,
|
|
2311
|
-
|
|
2317
|
+
className: cn(
|
|
2318
|
+
"peer absolute inset-0 z-10 m-0 h-full w-full",
|
|
2319
|
+
"cursor-pointer opacity-0",
|
|
2320
|
+
"disabled:cursor-not-allowed"
|
|
2321
|
+
)
|
|
2312
2322
|
}
|
|
2313
2323
|
),
|
|
2314
2324
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
2315
|
-
"
|
|
2325
|
+
"span",
|
|
2316
2326
|
{
|
|
2317
2327
|
"aria-hidden": "true",
|
|
2318
|
-
className:
|
|
2319
|
-
|
|
2320
|
-
|
|
2321
|
-
|
|
2322
|
-
checked: checked || indeterminate,
|
|
2323
|
-
disabled: !!disabled
|
|
2324
|
-
}),
|
|
2325
|
-
"peer-focus-visible:ring-2 peer-focus-visible:ring-brand peer-focus-visible:ring-offset-1"
|
|
2326
|
-
),
|
|
2327
|
-
children: indeterminate ? /* @__PURE__ */ jsxRuntime.jsx(DashIcon, { size: checkboxIconSizes[size] }) : checked ? /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Check, { size: checkboxIconSizes[size] }) : null
|
|
2328
|
+
className: checkboxClasses,
|
|
2329
|
+
style: sizeStyle,
|
|
2330
|
+
"data-state-transition": statusTransition,
|
|
2331
|
+
children: /* @__PURE__ */ jsxRuntime.jsx("span", { className: "absolute inset-0 flex items-center justify-center shrink-0", children: indeterminate ? /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Minus, { strokeWidth: 3, size: iconSize }) : checked ? /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Check, { strokeWidth: 3, size: iconSize }) : null })
|
|
2328
2332
|
}
|
|
2329
2333
|
)
|
|
2330
2334
|
] }),
|
|
2331
|
-
|
|
2332
|
-
label
|
|
2333
|
-
|
|
2334
|
-
|
|
2335
|
-
|
|
2336
|
-
|
|
2337
|
-
|
|
2338
|
-
|
|
2339
|
-
|
|
2340
|
-
children: label
|
|
2341
|
-
|
|
2342
|
-
|
|
2343
|
-
|
|
2344
|
-
|
|
2335
|
+
hasLabels && /* @__PURE__ */ jsxRuntime.jsxs(
|
|
2336
|
+
"label",
|
|
2337
|
+
{
|
|
2338
|
+
htmlFor: id,
|
|
2339
|
+
className: cn(
|
|
2340
|
+
"flex flex-col gap-px",
|
|
2341
|
+
!disabled && "cursor-pointer"
|
|
2342
|
+
),
|
|
2343
|
+
children: [
|
|
2344
|
+
label && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-text", style: { fontSize }, children: label }),
|
|
2345
|
+
description && /* @__PURE__ */ jsxRuntime.jsx(
|
|
2346
|
+
"span",
|
|
2347
|
+
{
|
|
2348
|
+
id: descriptionId,
|
|
2349
|
+
className: "text-text-muted",
|
|
2350
|
+
style: {
|
|
2351
|
+
fontSize: fontSize ? `calc(${fontSize} - 1px)` : void 0
|
|
2352
|
+
},
|
|
2353
|
+
children: description
|
|
2354
|
+
}
|
|
2355
|
+
)
|
|
2356
|
+
]
|
|
2357
|
+
}
|
|
2358
|
+
)
|
|
2345
2359
|
]
|
|
2346
2360
|
}
|
|
2347
2361
|
);
|
|
@@ -2422,7 +2436,7 @@ var radioBubbleVariants = classVarianceAuthority.cva(
|
|
|
2422
2436
|
},
|
|
2423
2437
|
state: {
|
|
2424
2438
|
none: "",
|
|
2425
|
-
error: "border-
|
|
2439
|
+
error: "border-destructive",
|
|
2426
2440
|
success: "border-success"
|
|
2427
2441
|
},
|
|
2428
2442
|
checked: {
|
|
@@ -2434,9 +2448,14 @@ var radioBubbleVariants = classVarianceAuthority.cva(
|
|
|
2434
2448
|
false: "cursor-pointer"
|
|
2435
2449
|
}
|
|
2436
2450
|
},
|
|
2437
|
-
defaultVariants: {
|
|
2451
|
+
defaultVariants: {
|
|
2452
|
+
size: "md",
|
|
2453
|
+
state: "none",
|
|
2454
|
+
checked: false,
|
|
2455
|
+
disabled: false
|
|
2456
|
+
},
|
|
2438
2457
|
compoundVariants: [
|
|
2439
|
-
{ checked: false, state: "error", class: "border-
|
|
2458
|
+
{ checked: false, state: "error", class: "border-destructive" },
|
|
2440
2459
|
{ checked: false, state: "success", class: "border-success" }
|
|
2441
2460
|
]
|
|
2442
2461
|
}
|
|
@@ -2518,6 +2537,7 @@ var switchTrackVariants = classVarianceAuthority.cva(
|
|
|
2518
2537
|
}
|
|
2519
2538
|
);
|
|
2520
2539
|
var switchThumbConfig = {
|
|
2540
|
+
xs: { thumb: "h-3 w-3", translate: "translate-x-3" },
|
|
2521
2541
|
sm: { thumb: "h-3 w-3", translate: "translate-x-3" },
|
|
2522
2542
|
md: { thumb: "h-4 w-4", translate: "translate-x-4" },
|
|
2523
2543
|
lg: { thumb: "h-5 w-5", translate: "translate-x-5" }
|
|
@@ -2570,7 +2590,7 @@ function Switch({
|
|
|
2570
2590
|
{
|
|
2571
2591
|
"aria-hidden": "true",
|
|
2572
2592
|
className: cn(
|
|
2573
|
-
switchTrackVariants({
|
|
2593
|
+
switchTrackVariants({ checked, disabled: !!disabled }),
|
|
2574
2594
|
"peer-focus-visible:ring-2 peer-focus-visible:ring-brand peer-focus-visible:ring-offset-1"
|
|
2575
2595
|
),
|
|
2576
2596
|
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
@@ -2600,7 +2620,7 @@ function useComboboxContext(componentName) {
|
|
|
2600
2620
|
return ctx;
|
|
2601
2621
|
}
|
|
2602
2622
|
__name(useComboboxContext, "useComboboxContext");
|
|
2603
|
-
var
|
|
2623
|
+
var inputBase = [
|
|
2604
2624
|
"flex",
|
|
2605
2625
|
"items-center",
|
|
2606
2626
|
"font-sans",
|
|
@@ -2623,7 +2643,7 @@ var inputWrapperVariants = classVarianceAuthority.cva(
|
|
|
2623
2643
|
},
|
|
2624
2644
|
state: {
|
|
2625
2645
|
none: "focus-within:ring-2 focus-within:ring-brand/20",
|
|
2626
|
-
error: "border-
|
|
2646
|
+
error: "border-destructive focus-within:ring-2 focus-within:ring-destructive/20",
|
|
2627
2647
|
success: "border-success focus-within:ring-2 focus-within:ring-success/20"
|
|
2628
2648
|
},
|
|
2629
2649
|
rounded: {
|
|
@@ -2654,6 +2674,7 @@ var inputWrapperVariants = classVarianceAuthority.cva(
|
|
|
2654
2674
|
}
|
|
2655
2675
|
);
|
|
2656
2676
|
var inputSizeVariants = {
|
|
2677
|
+
xs: "h-8 px-2 text-xs",
|
|
2657
2678
|
sm: "h-8 px-2 text-xs",
|
|
2658
2679
|
md: "h-10 px-3 text-sm",
|
|
2659
2680
|
lg: "h-12 px-4 text-base"
|
|
@@ -2759,7 +2780,7 @@ var ComboboxInput = react.forwardRef(
|
|
|
2759
2780
|
onKeyDown: handleKeyDown,
|
|
2760
2781
|
onBlur: handleBlur,
|
|
2761
2782
|
"data-state": ctx.open ? "open" : "closed",
|
|
2762
|
-
className: cn(
|
|
2783
|
+
className: cn(inputBase, "flex-1 border-0 bg-transparent outline-none", inputSizeVariants[size], "px-0")
|
|
2763
2784
|
}
|
|
2764
2785
|
),
|
|
2765
2786
|
showClear && /* @__PURE__ */ jsxRuntime.jsx(
|
|
@@ -3104,7 +3125,7 @@ var MultiSelectTrigger = react.forwardRef(
|
|
|
3104
3125
|
ref: ctx.triggerRef,
|
|
3105
3126
|
className: cn(
|
|
3106
3127
|
inputWrapperVariants({ variant: ctx.variant, state, fullWidth: true, disabled: ctx.disabled, rounded: ctx.rounded }),
|
|
3107
|
-
multiSelectSizeVariants({
|
|
3128
|
+
multiSelectSizeVariants({}),
|
|
3108
3129
|
"flex flex-wrap items-center gap-1",
|
|
3109
3130
|
className
|
|
3110
3131
|
),
|
|
@@ -3134,7 +3155,7 @@ var MultiSelectTrigger = react.forwardRef(
|
|
|
3134
3155
|
"span",
|
|
3135
3156
|
{
|
|
3136
3157
|
className: cn(
|
|
3137
|
-
chipSizeVariants({
|
|
3158
|
+
chipSizeVariants({}),
|
|
3138
3159
|
"bg-brand/15 text-brand"
|
|
3139
3160
|
),
|
|
3140
3161
|
children: [
|
|
@@ -3374,15 +3395,235 @@ function MultiSelect({
|
|
|
3374
3395
|
}),
|
|
3375
3396
|
[value, toggleValue, removeValue, disabled, variant, size, open, triggerId, contentId, field?.invalid, field?.describedBy, field?.required, required, placeholder, maxVisibleChips, activeValue, registerItem, optionId, error, success, rounded, clearable, handleClear]
|
|
3376
3397
|
);
|
|
3377
|
-
return /* @__PURE__ */ jsxRuntime.jsx(MultiSelectContext.Provider, { value: ctxValue, children: /* @__PURE__ */ jsxRuntime.jsxs("div", { ref: rootRef, className: className ?? "relative w-full", children: [
|
|
3378
|
-
children,
|
|
3379
|
-
name && value.map((v) => /* @__PURE__ */ jsxRuntime.jsx("input", { type: "hidden", name: `${name}[]`, value: v, disabled }, v))
|
|
3380
|
-
] }) });
|
|
3398
|
+
return /* @__PURE__ */ jsxRuntime.jsx(MultiSelectContext.Provider, { value: ctxValue, children: /* @__PURE__ */ jsxRuntime.jsxs("div", { ref: rootRef, className: className ?? "relative w-full", children: [
|
|
3399
|
+
children,
|
|
3400
|
+
name && value.map((v) => /* @__PURE__ */ jsxRuntime.jsx("input", { type: "hidden", name: `${name}[]`, value: v, disabled }, v))
|
|
3401
|
+
] }) });
|
|
3402
|
+
}
|
|
3403
|
+
__name(MultiSelect, "MultiSelect");
|
|
3404
|
+
MultiSelect.Trigger = MultiSelectTrigger;
|
|
3405
|
+
MultiSelect.Content = MultiSelectContent;
|
|
3406
|
+
MultiSelect.Item = MultiSelectItem;
|
|
3407
|
+
var InputField = react.forwardRef(
|
|
3408
|
+
({
|
|
3409
|
+
id,
|
|
3410
|
+
label,
|
|
3411
|
+
description,
|
|
3412
|
+
message,
|
|
3413
|
+
required,
|
|
3414
|
+
optional,
|
|
3415
|
+
labelStart,
|
|
3416
|
+
labelEnd,
|
|
3417
|
+
labelClassName,
|
|
3418
|
+
status = "none",
|
|
3419
|
+
...inputProps
|
|
3420
|
+
}, ref) => {
|
|
3421
|
+
const error = status === "error";
|
|
3422
|
+
const success = status === "success";
|
|
3423
|
+
const warning = status === "warning";
|
|
3424
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(FormField, { id, message, required, children: [
|
|
3425
|
+
label && /* @__PURE__ */ jsxRuntime.jsxs(FormField.Label, { className: labelClassName, children: [
|
|
3426
|
+
labelStart,
|
|
3427
|
+
label,
|
|
3428
|
+
optional && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-text-muted", children: " (optional)" }),
|
|
3429
|
+
labelEnd
|
|
3430
|
+
] }),
|
|
3431
|
+
/* @__PURE__ */ jsxRuntime.jsx(FormField.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
3432
|
+
Input,
|
|
3433
|
+
{
|
|
3434
|
+
...inputProps,
|
|
3435
|
+
ref,
|
|
3436
|
+
id,
|
|
3437
|
+
error,
|
|
3438
|
+
success,
|
|
3439
|
+
warning,
|
|
3440
|
+
required
|
|
3441
|
+
}
|
|
3442
|
+
) }),
|
|
3443
|
+
description && /* @__PURE__ */ jsxRuntime.jsx(FormField.Description, { children: description }),
|
|
3444
|
+
/* @__PURE__ */ jsxRuntime.jsx(FormField.Message, { children: message })
|
|
3445
|
+
] });
|
|
3446
|
+
}
|
|
3447
|
+
);
|
|
3448
|
+
InputField.displayName = "InputField";
|
|
3449
|
+
|
|
3450
|
+
// src/provider/cssVariables.ts
|
|
3451
|
+
function toKebabCase(str) {
|
|
3452
|
+
return str.replace(/([a-z0-9])([A-Z])/g, "$1-$2").toLowerCase();
|
|
3453
|
+
}
|
|
3454
|
+
__name(toKebabCase, "toKebabCase");
|
|
3455
|
+
function colorToRgbChannels(value) {
|
|
3456
|
+
const trimmed = value.trim();
|
|
3457
|
+
const rgbMatch = trimmed.match(
|
|
3458
|
+
/^rgba?\(\s*(\d+(?:\.\d+)?)\s*[,\s]\s*(\d+(?:\.\d+)?)\s*[,\s]\s*(\d+(?:\.\d+)?)(?:\s*[/,]\s*[\d.]+%?)?\s*\)$/i
|
|
3459
|
+
);
|
|
3460
|
+
if (rgbMatch) {
|
|
3461
|
+
return `${rgbMatch[1]} ${rgbMatch[2]} ${rgbMatch[3]}`;
|
|
3462
|
+
}
|
|
3463
|
+
if (trimmed.startsWith("#")) {
|
|
3464
|
+
const hex = trimmed.slice(1);
|
|
3465
|
+
if (hex.length === 3) {
|
|
3466
|
+
const r = parseInt(hex[0] + hex[0], 16);
|
|
3467
|
+
const g = parseInt(hex[1] + hex[1], 16);
|
|
3468
|
+
const b = parseInt(hex[2] + hex[2], 16);
|
|
3469
|
+
return `${r} ${g} ${b}`;
|
|
3470
|
+
}
|
|
3471
|
+
if (hex.length === 6) {
|
|
3472
|
+
const r = parseInt(hex.slice(0, 2), 16);
|
|
3473
|
+
const g = parseInt(hex.slice(2, 4), 16);
|
|
3474
|
+
const b = parseInt(hex.slice(4, 6), 16);
|
|
3475
|
+
return `${r} ${g} ${b}`;
|
|
3476
|
+
}
|
|
3477
|
+
}
|
|
3478
|
+
if (/^\d+(?:\.\d+)?\s+\d+(?:\.\d+)?\s+\d+(?:\.\d+)?$/.test(trimmed)) {
|
|
3479
|
+
return trimmed;
|
|
3480
|
+
}
|
|
3481
|
+
return value;
|
|
3482
|
+
}
|
|
3483
|
+
__name(colorToRgbChannels, "colorToRgbChannels");
|
|
3484
|
+
function getTokenValue(reference, tokens) {
|
|
3485
|
+
const path = reference.replace(/^\{/, "").replace(/\}$/, "").split(".");
|
|
3486
|
+
let current = tokens;
|
|
3487
|
+
for (const segment of path) {
|
|
3488
|
+
if (typeof current !== "object" || current === null || !(segment in current)) {
|
|
3489
|
+
return void 0;
|
|
3490
|
+
}
|
|
3491
|
+
current = current[segment];
|
|
3492
|
+
}
|
|
3493
|
+
if (typeof current === "object" && current !== null && "value" in current) {
|
|
3494
|
+
const value = current.value;
|
|
3495
|
+
if (typeof value === "string" || typeof value === "number") {
|
|
3496
|
+
return value;
|
|
3497
|
+
}
|
|
3498
|
+
}
|
|
3499
|
+
return void 0;
|
|
3500
|
+
}
|
|
3501
|
+
__name(getTokenValue, "getTokenValue");
|
|
3502
|
+
function resolveReference(reference, tokens, seen = /* @__PURE__ */ new Set()) {
|
|
3503
|
+
if (seen.has(reference)) {
|
|
3504
|
+
console.error(
|
|
3505
|
+
`[kreativ-ui] Circular token reference detected: ${reference}`
|
|
3506
|
+
);
|
|
3507
|
+
return void 0;
|
|
3508
|
+
}
|
|
3509
|
+
const nextSeen = new Set(seen);
|
|
3510
|
+
nextSeen.add(reference);
|
|
3511
|
+
const value = getTokenValue(reference, tokens);
|
|
3512
|
+
if (value === void 0) {
|
|
3513
|
+
console.warn(
|
|
3514
|
+
`[kreativ-ui] Unable to resolve token reference: ${reference}`
|
|
3515
|
+
);
|
|
3516
|
+
return void 0;
|
|
3517
|
+
}
|
|
3518
|
+
if (typeof value === "number") {
|
|
3519
|
+
return String(value);
|
|
3520
|
+
}
|
|
3521
|
+
if (value.startsWith("{") && value.endsWith("}")) {
|
|
3522
|
+
return resolveReference(value, tokens, nextSeen);
|
|
3523
|
+
}
|
|
3524
|
+
return value;
|
|
3525
|
+
}
|
|
3526
|
+
__name(resolveReference, "resolveReference");
|
|
3527
|
+
function resolveValue(value, tokens) {
|
|
3528
|
+
if (typeof value === "number") {
|
|
3529
|
+
return String(value);
|
|
3530
|
+
}
|
|
3531
|
+
if (typeof value !== "string") {
|
|
3532
|
+
return void 0;
|
|
3533
|
+
}
|
|
3534
|
+
if (value.startsWith("{") && value.endsWith("}")) {
|
|
3535
|
+
return resolveReference(value, tokens);
|
|
3536
|
+
}
|
|
3537
|
+
return value;
|
|
3538
|
+
}
|
|
3539
|
+
__name(resolveValue, "resolveValue");
|
|
3540
|
+
function flattenTokens(value, path, result, tokens) {
|
|
3541
|
+
if (typeof value !== "object" || value === null) {
|
|
3542
|
+
return;
|
|
3543
|
+
}
|
|
3544
|
+
if ("value" in value) {
|
|
3545
|
+
const tokenValue = value.value;
|
|
3546
|
+
const resolved = resolveValue(tokenValue, tokens);
|
|
3547
|
+
if (resolved !== void 0) {
|
|
3548
|
+
result[path.join(".")] = resolved;
|
|
3549
|
+
}
|
|
3550
|
+
return;
|
|
3551
|
+
}
|
|
3552
|
+
for (const [key, child] of Object.entries(value)) {
|
|
3553
|
+
flattenTokens(child, [...path, key], result, tokens);
|
|
3554
|
+
}
|
|
3555
|
+
}
|
|
3556
|
+
__name(flattenTokens, "flattenTokens");
|
|
3557
|
+
function resolveSemanticValue(value, mode, tokens) {
|
|
3558
|
+
if (typeof value === "object" && value !== null && "light" in value && "dark" in value) {
|
|
3559
|
+
const modeValue = value[mode];
|
|
3560
|
+
return resolveValue(modeValue, tokens);
|
|
3561
|
+
}
|
|
3562
|
+
return resolveValue(value, tokens);
|
|
3563
|
+
}
|
|
3564
|
+
__name(resolveSemanticValue, "resolveSemanticValue");
|
|
3565
|
+
function resolveSemanticTokens(semanticTokens, tokens, mode) {
|
|
3566
|
+
const result = {};
|
|
3567
|
+
function walk(value, path) {
|
|
3568
|
+
if (typeof value !== "object" || value === null) {
|
|
3569
|
+
return;
|
|
3570
|
+
}
|
|
3571
|
+
if ("value" in value) {
|
|
3572
|
+
const semanticValue = value.value;
|
|
3573
|
+
const resolved = resolveSemanticValue(semanticValue, mode, tokens);
|
|
3574
|
+
if (resolved !== void 0) {
|
|
3575
|
+
result[path.join(".")] = resolved;
|
|
3576
|
+
}
|
|
3577
|
+
return;
|
|
3578
|
+
}
|
|
3579
|
+
for (const [key, child] of Object.entries(
|
|
3580
|
+
value
|
|
3581
|
+
)) {
|
|
3582
|
+
walk(child, [...path, key]);
|
|
3583
|
+
}
|
|
3584
|
+
}
|
|
3585
|
+
__name(walk, "walk");
|
|
3586
|
+
walk(semanticTokens, []);
|
|
3587
|
+
return result;
|
|
3588
|
+
}
|
|
3589
|
+
__name(resolveSemanticTokens, "resolveSemanticTokens");
|
|
3590
|
+
function resolveTokens(tokens, semanticTokens, mode) {
|
|
3591
|
+
const primitiveTokens = {};
|
|
3592
|
+
flattenTokens(tokens, [], primitiveTokens, tokens);
|
|
3593
|
+
const resolvedSemanticTokens = resolveSemanticTokens(
|
|
3594
|
+
semanticTokens,
|
|
3595
|
+
tokens,
|
|
3596
|
+
mode
|
|
3597
|
+
);
|
|
3598
|
+
return {
|
|
3599
|
+
...primitiveTokens,
|
|
3600
|
+
...resolvedSemanticTokens
|
|
3601
|
+
};
|
|
3381
3602
|
}
|
|
3382
|
-
__name(
|
|
3383
|
-
|
|
3384
|
-
|
|
3385
|
-
|
|
3603
|
+
__name(resolveTokens, "resolveTokens");
|
|
3604
|
+
function tokensToCssVars(tokens, mode, intensity) {
|
|
3605
|
+
const cssVars = {};
|
|
3606
|
+
for (const [path, value] of Object.entries(tokens)) {
|
|
3607
|
+
const parts = path.split(".");
|
|
3608
|
+
const isSemanticColor = parts.length === 2 && parts[0] === "colors";
|
|
3609
|
+
const isPrimitiveColor = parts.length >= 3 && parts[0] === "colors";
|
|
3610
|
+
const varName = isSemanticColor ? `--kui-${toKebabCase(parts[1])}` : `--kui-${parts.map(toKebabCase).join("-")}`;
|
|
3611
|
+
const outputValue = isSemanticColor || isPrimitiveColor ? colorToRgbChannels(value) : value;
|
|
3612
|
+
cssVars[varName] = outputValue;
|
|
3613
|
+
}
|
|
3614
|
+
return {
|
|
3615
|
+
...cssVars,
|
|
3616
|
+
"--kui-mode": mode,
|
|
3617
|
+
"--kui-intensity": String(intensity)
|
|
3618
|
+
};
|
|
3619
|
+
}
|
|
3620
|
+
__name(tokensToCssVars, "tokensToCssVars");
|
|
3621
|
+
|
|
3622
|
+
// src/theme/recipes/defineRecipe.ts
|
|
3623
|
+
function defineRecipe(recipe) {
|
|
3624
|
+
return recipe;
|
|
3625
|
+
}
|
|
3626
|
+
__name(defineRecipe, "defineRecipe");
|
|
3386
3627
|
|
|
3387
3628
|
// src/theme/defaults/tokens.ts
|
|
3388
3629
|
var defaultTokens = {
|
|
@@ -3530,17 +3771,38 @@ var defaultSemanticTokens = {
|
|
|
3530
3771
|
}
|
|
3531
3772
|
};
|
|
3532
3773
|
|
|
3774
|
+
// src/theme/typography/defineTypography.ts
|
|
3775
|
+
function defineTypography(typography) {
|
|
3776
|
+
return typography;
|
|
3777
|
+
}
|
|
3778
|
+
__name(defineTypography, "defineTypography");
|
|
3779
|
+
|
|
3780
|
+
// src/theme/typography/extendTypography.ts
|
|
3781
|
+
function extendTypography(override) {
|
|
3782
|
+
if (!override) {
|
|
3783
|
+
return { ...defaultTypography };
|
|
3784
|
+
}
|
|
3785
|
+
const result = { ...defaultTypography };
|
|
3786
|
+
for (const key of Object.keys(override)) {
|
|
3787
|
+
const variant = key;
|
|
3788
|
+
result[variant] = {
|
|
3789
|
+
...defaultTypography[variant],
|
|
3790
|
+
...override[variant]
|
|
3791
|
+
};
|
|
3792
|
+
}
|
|
3793
|
+
return result;
|
|
3794
|
+
}
|
|
3795
|
+
__name(extendTypography, "extendTypography");
|
|
3796
|
+
|
|
3533
3797
|
// src/theme/defaults/typography.ts
|
|
3534
|
-
var defaultTypography = {
|
|
3798
|
+
var defaultTypography = defineTypography({
|
|
3535
3799
|
body: {
|
|
3536
3800
|
fontFamily: "{fonts.body}",
|
|
3537
|
-
fontSize: "{fontSizes.md}",
|
|
3538
3801
|
fontWeight: "{fontWeights.normal}",
|
|
3539
3802
|
lineHeight: "{lineHeights.normal}"
|
|
3540
3803
|
},
|
|
3541
3804
|
bodySmall: {
|
|
3542
3805
|
fontFamily: "{fonts.body}",
|
|
3543
|
-
fontSize: "{fontSizes.sm}",
|
|
3544
3806
|
fontWeight: "{fontWeights.normal}",
|
|
3545
3807
|
lineHeight: "{lineHeights.normal}"
|
|
3546
3808
|
},
|
|
@@ -3556,22 +3818,290 @@ var defaultTypography = {
|
|
|
3556
3818
|
fontWeight: "{fontWeights.semibold}",
|
|
3557
3819
|
lineHeight: "{lineHeights.tight}"
|
|
3558
3820
|
},
|
|
3821
|
+
label: {
|
|
3822
|
+
fontFamily: "{fonts.body}",
|
|
3823
|
+
fontWeight: "{fontWeights.medium}",
|
|
3824
|
+
lineHeight: "{lineHeights.normal}"
|
|
3825
|
+
},
|
|
3559
3826
|
caption: {
|
|
3560
3827
|
fontFamily: "{fonts.body}",
|
|
3561
3828
|
fontSize: "{fontSizes.xs}",
|
|
3562
3829
|
fontWeight: "{fontWeights.normal}",
|
|
3563
3830
|
lineHeight: "{lineHeights.normal}"
|
|
3564
3831
|
},
|
|
3565
|
-
mono: {
|
|
3566
|
-
fontFamily: "{fonts.mono}",
|
|
3567
|
-
fontSize: "{fontSizes.xs}",
|
|
3568
|
-
fontWeight: "{fontWeights.normal}",
|
|
3569
|
-
lineHeight: "{lineHeights.normal}"
|
|
3832
|
+
mono: {
|
|
3833
|
+
fontFamily: "{fonts.mono}",
|
|
3834
|
+
fontSize: "{fontSizes.xs}",
|
|
3835
|
+
fontWeight: "{fontWeights.normal}",
|
|
3836
|
+
lineHeight: "{lineHeights.normal}"
|
|
3837
|
+
}
|
|
3838
|
+
});
|
|
3839
|
+
|
|
3840
|
+
// src/theme/defaults/recipes/button.ts
|
|
3841
|
+
var buttonBase = "inline-flex items-center justify-center rounded-[var(--kui-button-radius,var(--kui-radius))] font-medium transition-colors duration-150 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-brand focus-visible:ring-offset-2 focus-visible:ring-offset-surface disabled:opacity-60 disabled:pointer-events-none";
|
|
3842
|
+
var buttonVariants = {
|
|
3843
|
+
solid: "",
|
|
3844
|
+
outline: "border bg-transparent",
|
|
3845
|
+
ghost: "bg-transparent",
|
|
3846
|
+
soft: "",
|
|
3847
|
+
link: "bg-transparent p-0 h-auto hover:underline"
|
|
3848
|
+
};
|
|
3849
|
+
var buttonColors = {
|
|
3850
|
+
brand: {
|
|
3851
|
+
solid: "bg-brand text-brand-fg hover:bg-brand-hover",
|
|
3852
|
+
outline: "border-brand text-brand hover:bg-brand/10",
|
|
3853
|
+
ghost: "text-brand hover:bg-brand/10",
|
|
3854
|
+
soft: "bg-brand/10 text-brand hover:bg-brand/20",
|
|
3855
|
+
link: "text-brand"
|
|
3856
|
+
},
|
|
3857
|
+
destructive: {
|
|
3858
|
+
solid: "bg-destructive text-destructive-fg hover:bg-destructive-hover",
|
|
3859
|
+
outline: "border-destructive text-destructive hover:bg-destructive/10",
|
|
3860
|
+
ghost: "text-destructive hover:bg-destructive/10",
|
|
3861
|
+
soft: "bg-destructive/10 text-destructive hover:bg-destructive/20",
|
|
3862
|
+
link: "text-destructive"
|
|
3863
|
+
},
|
|
3864
|
+
success: {
|
|
3865
|
+
solid: "bg-success text-success-fg hover:bg-success-hover",
|
|
3866
|
+
outline: "border-success text-success hover:bg-success/10",
|
|
3867
|
+
ghost: "text-success hover:bg-success/10",
|
|
3868
|
+
soft: "bg-success/10 text-success hover:bg-success/20",
|
|
3869
|
+
link: "text-success"
|
|
3870
|
+
},
|
|
3871
|
+
warning: {
|
|
3872
|
+
solid: "bg-warning text-warning-fg hover:bg-warning-hover",
|
|
3873
|
+
outline: "border-warning text-warning hover:bg-warning/10",
|
|
3874
|
+
ghost: "text-warning hover:bg-warning/10",
|
|
3875
|
+
soft: "bg-warning/10 text-warning hover:bg-warning/20",
|
|
3876
|
+
link: "text-warning"
|
|
3877
|
+
},
|
|
3878
|
+
info: {
|
|
3879
|
+
solid: "bg-info text-info-fg hover:bg-info-hover",
|
|
3880
|
+
outline: "border-info text-info hover:bg-info/10",
|
|
3881
|
+
ghost: "text-info hover:bg-info/10",
|
|
3882
|
+
soft: "bg-info/10 text-info hover:bg-info/20",
|
|
3883
|
+
link: "text-info"
|
|
3884
|
+
},
|
|
3885
|
+
white: {
|
|
3886
|
+
solid: "bg-white text-black hover:bg-gray-50",
|
|
3887
|
+
outline: "border-white/30 text-white hover:bg-white/10",
|
|
3888
|
+
ghost: "text-white hover:bg-white/10",
|
|
3889
|
+
soft: "bg-white/10 text-white hover:bg-white/20",
|
|
3890
|
+
link: "text-white"
|
|
3891
|
+
},
|
|
3892
|
+
neutral: {
|
|
3893
|
+
solid: "bg-surface-raised text-text hover:bg-surface-sunken",
|
|
3894
|
+
outline: "border-border text-text hover:bg-surface-raised",
|
|
3895
|
+
ghost: "text-text hover:bg-surface-raised",
|
|
3896
|
+
soft: "bg-surface-raised text-text hover:bg-surface-sunken",
|
|
3897
|
+
link: "text-text"
|
|
3898
|
+
}
|
|
3899
|
+
};
|
|
3900
|
+
var buildCompoundVariants = /* @__PURE__ */ __name(() => {
|
|
3901
|
+
const compounds = [];
|
|
3902
|
+
for (const [color, variantMap] of Object.entries(buttonColors)) {
|
|
3903
|
+
for (const [variant, className] of Object.entries(variantMap)) {
|
|
3904
|
+
compounds.push({
|
|
3905
|
+
conditions: { color, variant },
|
|
3906
|
+
className
|
|
3907
|
+
});
|
|
3908
|
+
}
|
|
3909
|
+
}
|
|
3910
|
+
return compounds;
|
|
3911
|
+
}, "buildCompoundVariants");
|
|
3912
|
+
var buttonRecipe = defineRecipe({
|
|
3913
|
+
base: buttonBase,
|
|
3914
|
+
variants: {
|
|
3915
|
+
variant: buttonVariants,
|
|
3916
|
+
color: Object.fromEntries(
|
|
3917
|
+
Object.keys(buttonColors).map((color) => [color, ""])
|
|
3918
|
+
)
|
|
3919
|
+
},
|
|
3920
|
+
defaultVariants: {
|
|
3921
|
+
variant: "solid",
|
|
3922
|
+
color: "brand"
|
|
3923
|
+
},
|
|
3924
|
+
compoundVariants: buildCompoundVariants()
|
|
3925
|
+
});
|
|
3926
|
+
|
|
3927
|
+
// src/theme/defaults/recipes/formControl.ts
|
|
3928
|
+
var formControlBase = "group relative inline-flex items-center rounded-[var(--kui-radii-md)] transition-[border-color,box-shadow] duration-[var(--kui-duration-fast)] focus-within:outline-none focus-within:ring-offset-2 focus-within:ring-offset-surface";
|
|
3929
|
+
var formControlVariants = {
|
|
3930
|
+
outline: "border border-border bg-transparent text-text",
|
|
3931
|
+
filled: "border border-transparent bg-surface-raised text-text",
|
|
3932
|
+
ghost: "border border-transparent bg-transparent text-text"
|
|
3933
|
+
};
|
|
3934
|
+
var standaloneStates = {
|
|
3935
|
+
none: "hover:border-brand focus-within:ring-2 focus-within:ring-brand/20",
|
|
3936
|
+
error: "border-destructive hover:border-destructive focus-within:ring-2 focus-within:ring-destructive/20",
|
|
3937
|
+
success: "border-success hover:border-success focus-within:ring-2 focus-within:ring-success/20",
|
|
3938
|
+
warning: "border-warning hover:border-warning focus-within:ring-2 focus-within:ring-warning/20"
|
|
3939
|
+
};
|
|
3940
|
+
var formControlRecipe = defineRecipe({
|
|
3941
|
+
base: formControlBase,
|
|
3942
|
+
variants: {
|
|
3943
|
+
variant: formControlVariants,
|
|
3944
|
+
embedded: {
|
|
3945
|
+
true: "rounded-none border-0 shadow-none hover:border-0 hover:bg-transparent focus-within:ring-0 focus-within:ring-offset-0",
|
|
3946
|
+
false: ""
|
|
3947
|
+
},
|
|
3948
|
+
state: standaloneStates,
|
|
3949
|
+
rounded: {
|
|
3950
|
+
true: "rounded-full",
|
|
3951
|
+
false: ""
|
|
3952
|
+
},
|
|
3953
|
+
fullWidth: {
|
|
3954
|
+
true: "w-full",
|
|
3955
|
+
false: ""
|
|
3956
|
+
},
|
|
3957
|
+
disabled: {
|
|
3958
|
+
true: "cursor-not-allowed opacity-50 border-border hover:border-border focus-within:ring-0",
|
|
3959
|
+
false: ""
|
|
3960
|
+
},
|
|
3961
|
+
hasAdornment: {
|
|
3962
|
+
true: "px-2",
|
|
3963
|
+
false: ""
|
|
3964
|
+
}
|
|
3965
|
+
},
|
|
3966
|
+
compoundVariants: [
|
|
3967
|
+
{
|
|
3968
|
+
conditions: { embedded: true, state: "none" },
|
|
3969
|
+
className: "border-0! shadow-none! focus-within:ring-0! hover:border-0!"
|
|
3970
|
+
},
|
|
3971
|
+
{
|
|
3972
|
+
conditions: { embedded: true, state: "error" },
|
|
3973
|
+
className: "border-0! shadow-none! focus-within:ring-0! hover:border-0!"
|
|
3974
|
+
},
|
|
3975
|
+
{
|
|
3976
|
+
conditions: { embedded: true, state: "success" },
|
|
3977
|
+
className: "border-0! shadow-none! focus-within:ring-0! hover:border-0!"
|
|
3978
|
+
},
|
|
3979
|
+
{
|
|
3980
|
+
conditions: { embedded: true, state: "warning" },
|
|
3981
|
+
className: "border-0! shadow-none! focus-within:ring-0! hover:border-0!"
|
|
3982
|
+
},
|
|
3983
|
+
{
|
|
3984
|
+
conditions: {
|
|
3985
|
+
disabled: true,
|
|
3986
|
+
state: "error"
|
|
3987
|
+
},
|
|
3988
|
+
className: "border-border hover:border-border focus-within:ring-0"
|
|
3989
|
+
},
|
|
3990
|
+
{
|
|
3991
|
+
conditions: {
|
|
3992
|
+
disabled: true,
|
|
3993
|
+
state: "success"
|
|
3994
|
+
},
|
|
3995
|
+
className: "border-border hover:border-border focus-within:ring-0"
|
|
3996
|
+
},
|
|
3997
|
+
{
|
|
3998
|
+
conditions: {
|
|
3999
|
+
disabled: true,
|
|
4000
|
+
state: "warning"
|
|
4001
|
+
},
|
|
4002
|
+
className: "border-border hover:border-border focus-within:ring-0"
|
|
4003
|
+
},
|
|
4004
|
+
{
|
|
4005
|
+
conditions: {
|
|
4006
|
+
embedded: true,
|
|
4007
|
+
disabled: true
|
|
4008
|
+
},
|
|
4009
|
+
className: "border-0! hover:border-0! focus-within:ring-0! cursor-default"
|
|
4010
|
+
}
|
|
4011
|
+
],
|
|
4012
|
+
defaultVariants: {
|
|
4013
|
+
variant: "outline",
|
|
4014
|
+
state: "none",
|
|
4015
|
+
embedded: false,
|
|
4016
|
+
rounded: false,
|
|
4017
|
+
fullWidth: true,
|
|
4018
|
+
disabled: false,
|
|
4019
|
+
hasAdornment: false
|
|
4020
|
+
}
|
|
4021
|
+
});
|
|
4022
|
+
|
|
4023
|
+
// src/theme/defaults/recipes/input.ts
|
|
4024
|
+
var inputBase2 = "flex min-w-0 flex-1 font-sans bg-transparent border-0 outline-none transition-colors duration-[var(--kui-duration-fast)] placeholder:text-text-muted disabled:cursor-not-allowed";
|
|
4025
|
+
var inputRecipe = defineRecipe({
|
|
4026
|
+
base: inputBase2,
|
|
4027
|
+
variants: {
|
|
4028
|
+
variant: {
|
|
4029
|
+
outline: "",
|
|
4030
|
+
filled: "",
|
|
4031
|
+
ghost: ""
|
|
4032
|
+
}
|
|
4033
|
+
},
|
|
4034
|
+
defaultVariants: {
|
|
4035
|
+
variant: "outline"
|
|
4036
|
+
}
|
|
4037
|
+
});
|
|
4038
|
+
|
|
4039
|
+
// src/theme/defaults/recipes/textarea.ts
|
|
4040
|
+
var textareaRecipe = defineRecipe({
|
|
4041
|
+
base: "flex w-full min-w-0 bg-transparent outline-none border-0 text-text placeholder:text-text-muted transition-colors duration-[var(--kui-duration-fast)] disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50 kui-scrollbar",
|
|
4042
|
+
variants: {
|
|
4043
|
+
variant: {
|
|
4044
|
+
outline: "",
|
|
4045
|
+
filled: "",
|
|
4046
|
+
ghost: ""
|
|
4047
|
+
},
|
|
4048
|
+
resize: {
|
|
4049
|
+
none: "resize-none",
|
|
4050
|
+
both: "resize",
|
|
4051
|
+
horizontal: "resize-x",
|
|
4052
|
+
vertical: "resize-y"
|
|
4053
|
+
},
|
|
4054
|
+
autoResize: {
|
|
4055
|
+
true: "resize-none overflow-hidden",
|
|
4056
|
+
false: ""
|
|
4057
|
+
}
|
|
4058
|
+
},
|
|
4059
|
+
defaultVariants: {
|
|
4060
|
+
variant: "outline",
|
|
4061
|
+
resize: "vertical",
|
|
4062
|
+
autoResize: false
|
|
4063
|
+
}
|
|
4064
|
+
});
|
|
4065
|
+
|
|
4066
|
+
// src/theme/defaults/recipes/markdownEditor.ts
|
|
4067
|
+
var markdownEditorRecipe = defineRecipe({
|
|
4068
|
+
base: "group relative w-full overflow-hidden rounded-[var(--kui-radii-md)] transition-[border-color,box-shadow] duration-[var(--kui-duration-fast)]",
|
|
4069
|
+
variants: {
|
|
4070
|
+
variant: {
|
|
4071
|
+
outline: "border border-border bg-transparent",
|
|
4072
|
+
filled: "border border-transparent bg-surface-raised",
|
|
4073
|
+
ghost: "border border-transparent bg-transparent"
|
|
4074
|
+
},
|
|
4075
|
+
state: {
|
|
4076
|
+
none: "hover:border-brand focus-within:ring-2 focus-within:ring-brand/20",
|
|
4077
|
+
error: "border-destructive focus-within:ring-2 focus-within:ring-destructive/20",
|
|
4078
|
+
success: "border-success focus-within:ring-2 focus-within:ring-success/20",
|
|
4079
|
+
warning: "border-warning focus-within:ring-2 focus-within:ring-warning/20"
|
|
4080
|
+
},
|
|
4081
|
+
disabled: {
|
|
4082
|
+
true: "cursor-not-allowed opacity-50 border-border hover:border-border focus-within:ring-0",
|
|
4083
|
+
false: ""
|
|
4084
|
+
},
|
|
4085
|
+
fullWidth: {
|
|
4086
|
+
true: "w-full",
|
|
4087
|
+
false: ""
|
|
4088
|
+
}
|
|
4089
|
+
},
|
|
4090
|
+
defaultVariants: {
|
|
4091
|
+
variant: "outline",
|
|
4092
|
+
state: "none",
|
|
4093
|
+
fullWidth: true
|
|
3570
4094
|
}
|
|
3571
|
-
};
|
|
4095
|
+
});
|
|
3572
4096
|
|
|
3573
|
-
// src/theme/
|
|
3574
|
-
|
|
4097
|
+
// src/theme/size/defineSize.ts
|
|
4098
|
+
function defineSizes(sizes) {
|
|
4099
|
+
return sizes;
|
|
4100
|
+
}
|
|
4101
|
+
__name(defineSizes, "defineSizes");
|
|
4102
|
+
|
|
4103
|
+
// src/theme/defaults/sizes.ts
|
|
4104
|
+
var defaultSizes = defineSizes({
|
|
3575
4105
|
xs: {
|
|
3576
4106
|
height: "1.75rem",
|
|
3577
4107
|
paddingX: "0.5rem",
|
|
@@ -3597,18 +4127,77 @@ var defaultSizes = {
|
|
|
3597
4127
|
radius: "1rem"
|
|
3598
4128
|
},
|
|
3599
4129
|
lg: {
|
|
3600
|
-
height: "
|
|
4130
|
+
height: "3.5rem",
|
|
3601
4131
|
paddingX: "1.5rem",
|
|
3602
4132
|
fontSize: "1rem",
|
|
3603
4133
|
gap: "0.625rem",
|
|
3604
4134
|
iconSize: "1.25rem",
|
|
3605
4135
|
radius: "1.15rem"
|
|
3606
4136
|
}
|
|
3607
|
-
};
|
|
4137
|
+
});
|
|
4138
|
+
|
|
4139
|
+
// src/theme/defaults/recipes/checkbox.ts
|
|
4140
|
+
var checkboxRecipe = defineRecipe({
|
|
4141
|
+
base: "relative inline-flex shrink-0 items-center justify-center border transition-colors duration-[var(--kui-duration-fast)] peer-focus-visible:ring-2 peer-focus-visible:ring-brand peer-focus-visible:ring-offset-1",
|
|
4142
|
+
variants: {
|
|
4143
|
+
state: {
|
|
4144
|
+
none: "border-border",
|
|
4145
|
+
error: "border-destructive",
|
|
4146
|
+
success: "border-success",
|
|
4147
|
+
warning: "border-warning"
|
|
4148
|
+
},
|
|
4149
|
+
checked: {
|
|
4150
|
+
true: "border-brand bg-brand text-brand-fg",
|
|
4151
|
+
false: "bg-transparent"
|
|
4152
|
+
},
|
|
4153
|
+
disabled: {
|
|
4154
|
+
true: "cursor-not-allowed",
|
|
4155
|
+
false: "cursor-pointer"
|
|
4156
|
+
},
|
|
4157
|
+
rounded: {
|
|
4158
|
+
true: "rounded-full",
|
|
4159
|
+
false: "rounded-[calc(var(--kui-checkbox-radius)-4px)]"
|
|
4160
|
+
}
|
|
4161
|
+
},
|
|
4162
|
+
compoundVariants: [
|
|
4163
|
+
{
|
|
4164
|
+
conditions: {
|
|
4165
|
+
checked: false,
|
|
4166
|
+
state: "error"
|
|
4167
|
+
},
|
|
4168
|
+
className: "border-destructive"
|
|
4169
|
+
},
|
|
4170
|
+
{
|
|
4171
|
+
conditions: {
|
|
4172
|
+
checked: false,
|
|
4173
|
+
state: "success"
|
|
4174
|
+
},
|
|
4175
|
+
className: "border-success"
|
|
4176
|
+
},
|
|
4177
|
+
{
|
|
4178
|
+
conditions: {
|
|
4179
|
+
checked: false,
|
|
4180
|
+
state: "warning"
|
|
4181
|
+
},
|
|
4182
|
+
className: "border-warning"
|
|
4183
|
+
}
|
|
4184
|
+
],
|
|
4185
|
+
defaultVariants: {
|
|
4186
|
+
state: "none",
|
|
4187
|
+
checked: false,
|
|
4188
|
+
disabled: false,
|
|
4189
|
+
rounded: false
|
|
4190
|
+
}
|
|
4191
|
+
});
|
|
4192
|
+
|
|
4193
|
+
// src/theme/defaults/theme.ts
|
|
3608
4194
|
var defaultRecipes = {
|
|
3609
4195
|
Button: buttonRecipe,
|
|
3610
4196
|
FormControl: formControlRecipe,
|
|
3611
|
-
Input: inputRecipe
|
|
4197
|
+
Input: inputRecipe,
|
|
4198
|
+
Textarea: textareaRecipe,
|
|
4199
|
+
MarkdownEditor: markdownEditorRecipe,
|
|
4200
|
+
Checkbox: checkboxRecipe
|
|
3612
4201
|
};
|
|
3613
4202
|
var defaultTheme = {
|
|
3614
4203
|
tokens: defaultTokens,
|
|
@@ -3619,241 +4208,49 @@ var defaultTheme = {
|
|
|
3619
4208
|
sizes: defaultSizes
|
|
3620
4209
|
};
|
|
3621
4210
|
|
|
3622
|
-
// src/
|
|
3623
|
-
function
|
|
3624
|
-
|
|
3625
|
-
|
|
3626
|
-
__name(toKebabCase, "toKebabCase");
|
|
3627
|
-
function colorToRgbChannels(value) {
|
|
3628
|
-
const trimmed = value.trim();
|
|
3629
|
-
const rgbMatch = trimmed.match(
|
|
3630
|
-
/^rgba?\(\s*(\d+(?:\.\d+)?)\s*[,\s]\s*(\d+(?:\.\d+)?)\s*[,\s]\s*(\d+(?:\.\d+)?)(?:\s*[/,]\s*[\d.]+%?)?\s*\)$/i
|
|
3631
|
-
);
|
|
3632
|
-
if (rgbMatch) {
|
|
3633
|
-
return `${rgbMatch[1]} ${rgbMatch[2]} ${rgbMatch[3]}`;
|
|
3634
|
-
}
|
|
3635
|
-
if (trimmed.startsWith("#")) {
|
|
3636
|
-
const hex = trimmed.slice(1);
|
|
3637
|
-
if (hex.length === 3) {
|
|
3638
|
-
const r = parseInt(hex[0] + hex[0], 16);
|
|
3639
|
-
const g = parseInt(hex[1] + hex[1], 16);
|
|
3640
|
-
const b = parseInt(hex[2] + hex[2], 16);
|
|
3641
|
-
return `${r} ${g} ${b}`;
|
|
3642
|
-
}
|
|
3643
|
-
if (hex.length === 6) {
|
|
3644
|
-
const r = parseInt(hex.slice(0, 2), 16);
|
|
3645
|
-
const g = parseInt(hex.slice(2, 4), 16);
|
|
3646
|
-
const b = parseInt(hex.slice(4, 6), 16);
|
|
3647
|
-
return `${r} ${g} ${b}`;
|
|
3648
|
-
}
|
|
3649
|
-
}
|
|
3650
|
-
if (/^\d+(?:\.\d+)?\s+\d+(?:\.\d+)?\s+\d+(?:\.\d+)?$/.test(trimmed)) {
|
|
3651
|
-
return trimmed;
|
|
3652
|
-
}
|
|
3653
|
-
return value;
|
|
3654
|
-
}
|
|
3655
|
-
__name(colorToRgbChannels, "colorToRgbChannels");
|
|
3656
|
-
function getTokenValue(reference, tokens) {
|
|
3657
|
-
const path = reference.replace(/^\{/, "").replace(/\}$/, "").split(".");
|
|
3658
|
-
let current = tokens;
|
|
3659
|
-
for (const segment of path) {
|
|
3660
|
-
if (typeof current !== "object" || current === null || !(segment in current)) {
|
|
3661
|
-
return void 0;
|
|
3662
|
-
}
|
|
3663
|
-
current = current[segment];
|
|
3664
|
-
}
|
|
3665
|
-
if (typeof current === "object" && current !== null && "value" in current) {
|
|
3666
|
-
const value = current.value;
|
|
3667
|
-
if (typeof value === "string" || typeof value === "number") {
|
|
3668
|
-
return value;
|
|
3669
|
-
}
|
|
3670
|
-
}
|
|
3671
|
-
return void 0;
|
|
3672
|
-
}
|
|
3673
|
-
__name(getTokenValue, "getTokenValue");
|
|
3674
|
-
function resolveReference(reference, tokens, seen = /* @__PURE__ */ new Set()) {
|
|
3675
|
-
if (seen.has(reference)) {
|
|
3676
|
-
console.error(
|
|
3677
|
-
`[kreativ-ui] Circular token reference detected: ${reference}`
|
|
3678
|
-
);
|
|
3679
|
-
return void 0;
|
|
3680
|
-
}
|
|
3681
|
-
const nextSeen = new Set(seen);
|
|
3682
|
-
nextSeen.add(reference);
|
|
3683
|
-
const value = getTokenValue(reference, tokens);
|
|
3684
|
-
if (value === void 0) {
|
|
3685
|
-
console.warn(
|
|
3686
|
-
`[kreativ-ui] Unable to resolve token reference: ${reference}`
|
|
3687
|
-
);
|
|
3688
|
-
return void 0;
|
|
3689
|
-
}
|
|
3690
|
-
if (typeof value === "number") {
|
|
3691
|
-
return String(value);
|
|
3692
|
-
}
|
|
3693
|
-
if (value.startsWith("{") && value.endsWith("}")) {
|
|
3694
|
-
return resolveReference(value, tokens, nextSeen);
|
|
3695
|
-
}
|
|
3696
|
-
return value;
|
|
3697
|
-
}
|
|
3698
|
-
__name(resolveReference, "resolveReference");
|
|
3699
|
-
function resolveValue(value, tokens) {
|
|
3700
|
-
if (typeof value === "number") {
|
|
3701
|
-
return String(value);
|
|
3702
|
-
}
|
|
3703
|
-
if (typeof value !== "string") {
|
|
3704
|
-
return void 0;
|
|
3705
|
-
}
|
|
3706
|
-
if (value.startsWith("{") && value.endsWith("}")) {
|
|
3707
|
-
return resolveReference(value, tokens);
|
|
3708
|
-
}
|
|
3709
|
-
return value;
|
|
3710
|
-
}
|
|
3711
|
-
__name(resolveValue, "resolveValue");
|
|
3712
|
-
function flattenTokens(value, path, result, tokens) {
|
|
3713
|
-
if (typeof value !== "object" || value === null) {
|
|
3714
|
-
return;
|
|
3715
|
-
}
|
|
3716
|
-
if ("value" in value) {
|
|
3717
|
-
const tokenValue = value.value;
|
|
3718
|
-
const resolved = resolveValue(tokenValue, tokens);
|
|
3719
|
-
if (resolved !== void 0) {
|
|
3720
|
-
result[path.join(".")] = resolved;
|
|
3721
|
-
}
|
|
3722
|
-
return;
|
|
3723
|
-
}
|
|
3724
|
-
for (const [key, child] of Object.entries(value)) {
|
|
3725
|
-
flattenTokens(child, [...path, key], result, tokens);
|
|
3726
|
-
}
|
|
3727
|
-
}
|
|
3728
|
-
__name(flattenTokens, "flattenTokens");
|
|
3729
|
-
function resolveSemanticValue(value, mode, tokens) {
|
|
3730
|
-
if (typeof value === "object" && value !== null && "light" in value && "dark" in value) {
|
|
3731
|
-
const modeValue = value[mode];
|
|
3732
|
-
return resolveValue(modeValue, tokens);
|
|
4211
|
+
// src/theme/recipes/extendRecipe.ts
|
|
4212
|
+
function extendRecipes(override) {
|
|
4213
|
+
if (!override) {
|
|
4214
|
+
return defaultRecipes;
|
|
3733
4215
|
}
|
|
3734
|
-
|
|
3735
|
-
|
|
3736
|
-
|
|
3737
|
-
|
|
3738
|
-
|
|
3739
|
-
|
|
3740
|
-
|
|
3741
|
-
|
|
3742
|
-
|
|
3743
|
-
|
|
3744
|
-
|
|
3745
|
-
|
|
3746
|
-
|
|
3747
|
-
|
|
3748
|
-
|
|
3749
|
-
|
|
3750
|
-
|
|
3751
|
-
|
|
3752
|
-
|
|
3753
|
-
|
|
3754
|
-
walk(child, [...path, key]);
|
|
3755
|
-
}
|
|
4216
|
+
const result = { ...defaultRecipes };
|
|
4217
|
+
for (const [name, recipeOverride] of Object.entries(override)) {
|
|
4218
|
+
const key = name;
|
|
4219
|
+
const base = defaultRecipes[key];
|
|
4220
|
+
result[key] = {
|
|
4221
|
+
...base,
|
|
4222
|
+
...recipeOverride,
|
|
4223
|
+
...base?.compoundVariants || recipeOverride?.compoundVariants ? {
|
|
4224
|
+
compoundVariants: [
|
|
4225
|
+
...base?.compoundVariants ?? [],
|
|
4226
|
+
...recipeOverride?.compoundVariants ?? []
|
|
4227
|
+
]
|
|
4228
|
+
} : {},
|
|
4229
|
+
...base?.variants || recipeOverride?.variants ? {
|
|
4230
|
+
variants: {
|
|
4231
|
+
...base?.variants,
|
|
4232
|
+
...recipeOverride?.variants
|
|
4233
|
+
}
|
|
4234
|
+
} : {}
|
|
4235
|
+
};
|
|
3756
4236
|
}
|
|
3757
|
-
__name(walk, "walk");
|
|
3758
|
-
walk(semanticTokens, []);
|
|
3759
4237
|
return result;
|
|
3760
4238
|
}
|
|
3761
|
-
__name(
|
|
3762
|
-
|
|
3763
|
-
|
|
3764
|
-
|
|
3765
|
-
const resolvedSemanticTokens = resolveSemanticTokens(
|
|
3766
|
-
semanticTokens,
|
|
3767
|
-
tokens,
|
|
3768
|
-
mode
|
|
3769
|
-
);
|
|
4239
|
+
__name(extendRecipes, "extendRecipes");
|
|
4240
|
+
|
|
4241
|
+
// src/theme/token/defineToken.ts
|
|
4242
|
+
function defineToken(value) {
|
|
3770
4243
|
return {
|
|
3771
|
-
|
|
3772
|
-
...resolvedSemanticTokens
|
|
4244
|
+
value
|
|
3773
4245
|
};
|
|
3774
4246
|
}
|
|
3775
|
-
__name(
|
|
3776
|
-
function
|
|
3777
|
-
|
|
3778
|
-
for (const [path, value] of Object.entries(tokens)) {
|
|
3779
|
-
const parts = path.split(".");
|
|
3780
|
-
const isSemanticColor = parts.length === 2 && parts[0] === "colors";
|
|
3781
|
-
const isPrimitiveColor = parts.length >= 3 && parts[0] === "colors";
|
|
3782
|
-
const varName = isSemanticColor ? `--kui-${toKebabCase(parts[1])}` : `--kui-${parts.map(toKebabCase).join("-")}`;
|
|
3783
|
-
const outputValue = isSemanticColor || isPrimitiveColor ? colorToRgbChannels(value) : value;
|
|
3784
|
-
cssVars[varName] = outputValue;
|
|
3785
|
-
}
|
|
3786
|
-
return {
|
|
3787
|
-
...cssVars,
|
|
3788
|
-
"--kui-mode": mode,
|
|
3789
|
-
"--kui-intensity": String(intensity)
|
|
3790
|
-
};
|
|
4247
|
+
__name(defineToken, "defineToken");
|
|
4248
|
+
function defineSemanticToken(light, dark) {
|
|
4249
|
+
return { value: { light, dark } };
|
|
3791
4250
|
}
|
|
3792
|
-
__name(
|
|
4251
|
+
__name(defineSemanticToken, "defineSemanticToken");
|
|
3793
4252
|
|
|
3794
|
-
// src/
|
|
3795
|
-
var CSS_SIZE = /^-?\d*\.?\d+(px|rem|em|%|vh|vw|vmin|vmax|ch|ex|cm|mm|in|pt|pc|fr)$|^(auto|min-content|max-content|fit-content)$/;
|
|
3796
|
-
var CSS_KEYWORDS = /* @__PURE__ */ new Set([
|
|
3797
|
-
"auto",
|
|
3798
|
-
"min-content",
|
|
3799
|
-
"max-content",
|
|
3800
|
-
"fit-content"
|
|
3801
|
-
]);
|
|
3802
|
-
var SIZE_FIELDS = [
|
|
3803
|
-
"height",
|
|
3804
|
-
"width",
|
|
3805
|
-
"paddingX",
|
|
3806
|
-
"paddingY",
|
|
3807
|
-
"fontSize",
|
|
3808
|
-
"gap",
|
|
3809
|
-
"iconSize",
|
|
3810
|
-
"radius"
|
|
3811
|
-
];
|
|
3812
|
-
function isCssKeyword(value) {
|
|
3813
|
-
return CSS_KEYWORDS.has(value);
|
|
3814
|
-
}
|
|
3815
|
-
__name(isCssKeyword, "isCssKeyword");
|
|
3816
|
-
function toPx(value) {
|
|
3817
|
-
if (isCssKeyword(value)) return void 0;
|
|
3818
|
-
const num = parseFloat(value);
|
|
3819
|
-
if (Number.isNaN(num)) return void 0;
|
|
3820
|
-
if (value.endsWith("px")) return num;
|
|
3821
|
-
if (value.endsWith("rem") || value.endsWith("em")) {
|
|
3822
|
-
return num * 16;
|
|
3823
|
-
}
|
|
3824
|
-
return void 0;
|
|
3825
|
-
}
|
|
3826
|
-
__name(toPx, "toPx");
|
|
3827
|
-
function validateSizeToken(key, token) {
|
|
3828
|
-
SIZE_FIELDS.forEach((field) => {
|
|
3829
|
-
const value = token[field];
|
|
3830
|
-
if (value === void 0) return;
|
|
3831
|
-
if (!CSS_SIZE.test(value)) {
|
|
3832
|
-
console.error(
|
|
3833
|
-
`[kreativ-ui] Invalid size "${key}.${field}": "${value}" is not a valid CSS size.`
|
|
3834
|
-
);
|
|
3835
|
-
return;
|
|
3836
|
-
}
|
|
3837
|
-
if (isCssKeyword(value)) return;
|
|
3838
|
-
const num = parseFloat(value);
|
|
3839
|
-
if (num < 0) {
|
|
3840
|
-
console.error(
|
|
3841
|
-
`[kreativ-ui] Invalid size "${key}.${field}": "${value}" is negative.`
|
|
3842
|
-
);
|
|
3843
|
-
}
|
|
3844
|
-
});
|
|
3845
|
-
if (token.height && token.fontSize) {
|
|
3846
|
-
const heightPx = toPx(token.height);
|
|
3847
|
-
const fontSizePx = toPx(token.fontSize);
|
|
3848
|
-
if (heightPx !== void 0 && fontSizePx !== void 0 && fontSizePx >= heightPx) {
|
|
3849
|
-
console.warn(
|
|
3850
|
-
`[kreativ-ui] Size "${key}" has conflicting dimensions: height=${token.height} (${heightPx}px), fontSize=${token.fontSize} (${fontSizePx}px).
|
|
3851
|
-
Font size meets or exceeds the box height \u2014 text may clip or overflow.`
|
|
3852
|
-
);
|
|
3853
|
-
}
|
|
3854
|
-
}
|
|
3855
|
-
}
|
|
3856
|
-
__name(validateSizeToken, "validateSizeToken");
|
|
4253
|
+
// src/utils/deepMerge.ts
|
|
3857
4254
|
function isPlainObject(value) {
|
|
3858
4255
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
3859
4256
|
}
|
|
@@ -3879,53 +4276,49 @@ function deepMerge(base, override) {
|
|
|
3879
4276
|
return result;
|
|
3880
4277
|
}
|
|
3881
4278
|
__name(deepMerge, "deepMerge");
|
|
3882
|
-
|
|
3883
|
-
|
|
3884
|
-
|
|
3885
|
-
|
|
3886
|
-
function mergeSemanticTokens(base, override) {
|
|
3887
|
-
return deepMerge(base, override);
|
|
4279
|
+
|
|
4280
|
+
// src/theme/token/extendTokens.ts
|
|
4281
|
+
function extendTokens(override) {
|
|
4282
|
+
return deepMerge(defaultTokens, override);
|
|
3888
4283
|
}
|
|
3889
|
-
__name(
|
|
3890
|
-
function
|
|
3891
|
-
return deepMerge(
|
|
4284
|
+
__name(extendTokens, "extendTokens");
|
|
4285
|
+
function extendSemanticTokens(override) {
|
|
4286
|
+
return deepMerge(defaultSemanticTokens, override);
|
|
3892
4287
|
}
|
|
3893
|
-
__name(
|
|
3894
|
-
|
|
4288
|
+
__name(extendSemanticTokens, "extendSemanticTokens");
|
|
4289
|
+
|
|
4290
|
+
// src/theme/size/extendSize.ts
|
|
4291
|
+
function extendSizes(override) {
|
|
4292
|
+
const result = {
|
|
4293
|
+
...defaultSizes
|
|
4294
|
+
};
|
|
3895
4295
|
if (!override) {
|
|
3896
|
-
return
|
|
4296
|
+
return result;
|
|
3897
4297
|
}
|
|
3898
|
-
const
|
|
3899
|
-
|
|
3900
|
-
|
|
3901
|
-
|
|
3902
|
-
const next = {
|
|
3903
|
-
...merged[key],
|
|
3904
|
-
...overrideToken
|
|
4298
|
+
for (const [key, value] of Object.entries(override)) {
|
|
4299
|
+
result[key] = {
|
|
4300
|
+
...defaultSizes[key] ?? {},
|
|
4301
|
+
...value
|
|
3905
4302
|
};
|
|
3906
|
-
validateSizeToken(key, next);
|
|
3907
|
-
merged[key] = next;
|
|
3908
4303
|
}
|
|
3909
|
-
return
|
|
4304
|
+
return result;
|
|
3910
4305
|
}
|
|
3911
|
-
__name(
|
|
3912
|
-
|
|
4306
|
+
__name(extendSizes, "extendSizes");
|
|
4307
|
+
|
|
4308
|
+
// src/theme/extendTheme.ts
|
|
4309
|
+
function extendTheme(override) {
|
|
3913
4310
|
if (!override) {
|
|
3914
|
-
return
|
|
4311
|
+
return defaultTheme;
|
|
3915
4312
|
}
|
|
3916
4313
|
return {
|
|
3917
|
-
|
|
3918
|
-
|
|
3919
|
-
|
|
3920
|
-
|
|
3921
|
-
)
|
|
3922
|
-
typography: mergeTypography(base.typography, override.typography),
|
|
3923
|
-
recipes: mergeRecipes(base.recipes, override.recipes),
|
|
3924
|
-
intensity: override.intensity ?? base.intensity,
|
|
3925
|
-
sizes: mergeSizes(base.sizes, override.sizes)
|
|
4314
|
+
...defaultTheme,
|
|
4315
|
+
...override,
|
|
4316
|
+
sizes: extendSizes(override.sizes),
|
|
4317
|
+
typography: extendTypography(override.typography),
|
|
4318
|
+
recipes: extendRecipes(override.recipes)
|
|
3926
4319
|
};
|
|
3927
4320
|
}
|
|
3928
|
-
__name(
|
|
4321
|
+
__name(extendTheme, "extendTheme");
|
|
3929
4322
|
function useSystemPrefersDark() {
|
|
3930
4323
|
const [prefersDark, setPrefersDark] = react.useState(false);
|
|
3931
4324
|
react.useEffect(() => {
|
|
@@ -3952,10 +4345,7 @@ function UIProvider({
|
|
|
3952
4345
|
const [mode, setMode] = react.useState(defaultMode);
|
|
3953
4346
|
const systemPrefersDark = useSystemPrefersDark();
|
|
3954
4347
|
const resolvedMode = mode === "system" ? systemPrefersDark ? "dark" : "light" : mode;
|
|
3955
|
-
const theme = react.useMemo(
|
|
3956
|
-
() => mergeTheme(defaultTheme, themeOverride),
|
|
3957
|
-
[themeOverride]
|
|
3958
|
-
);
|
|
4348
|
+
const theme = react.useMemo(() => extendTheme(themeOverride), [themeOverride]);
|
|
3959
4349
|
const resolvedTokens = react.useMemo(
|
|
3960
4350
|
() => resolveTokens(theme.tokens, theme.semanticTokens, resolvedMode),
|
|
3961
4351
|
[theme.tokens, theme.semanticTokens, resolvedMode]
|
|
@@ -4007,59 +4397,42 @@ exports.FormFieldDescription = FormFieldDescription;
|
|
|
4007
4397
|
exports.FormFieldLabel = FormFieldLabel;
|
|
4008
4398
|
exports.FormFieldMessage = FormFieldMessage;
|
|
4009
4399
|
exports.Input = Input;
|
|
4400
|
+
exports.InputField = InputField;
|
|
4010
4401
|
exports.MarkdownEditor = MarkdownEditor;
|
|
4011
4402
|
exports.MultiSelect = MultiSelect;
|
|
4012
4403
|
exports.MultiSelectContent = MultiSelectContent;
|
|
4013
|
-
exports.MultiSelectContext = MultiSelectContext;
|
|
4014
4404
|
exports.MultiSelectItem = MultiSelectItem;
|
|
4015
4405
|
exports.MultiSelectTrigger = MultiSelectTrigger;
|
|
4016
4406
|
exports.Radio = Radio;
|
|
4017
4407
|
exports.RadioGroup = RadioGroup;
|
|
4018
4408
|
exports.Select = Select;
|
|
4019
4409
|
exports.SelectContent = SelectContent;
|
|
4020
|
-
exports.SelectContext = SelectContext;
|
|
4021
4410
|
exports.SelectGroup = SelectGroup;
|
|
4022
|
-
exports.SelectGroupContext = SelectGroupContext;
|
|
4023
4411
|
exports.SelectItem = SelectItem;
|
|
4024
4412
|
exports.SelectTrigger = SelectTrigger;
|
|
4025
4413
|
exports.SelectValue = SelectValue;
|
|
4026
4414
|
exports.Switch = Switch;
|
|
4027
4415
|
exports.Textarea = Textarea;
|
|
4028
|
-
exports.TextareaCore = TextareaCore;
|
|
4029
4416
|
exports.ThemeContext = ThemeContext;
|
|
4030
4417
|
exports.ThemeToggler = ThemeToggler;
|
|
4031
4418
|
exports.UIProvider = UIProvider;
|
|
4032
|
-
exports.buttonBase = buttonBase;
|
|
4033
|
-
exports.buttonColors = buttonColors;
|
|
4034
|
-
exports.buttonRecipe = buttonRecipe;
|
|
4035
|
-
exports.buttonVariants = buttonVariants;
|
|
4036
4419
|
exports.cn = cn;
|
|
4037
|
-
exports.defaultRecipes = defaultRecipes;
|
|
4038
|
-
exports.defaultSizes = defaultSizes;
|
|
4039
|
-
exports.defaultTheme = defaultTheme;
|
|
4040
4420
|
exports.defineRecipe = defineRecipe;
|
|
4041
4421
|
exports.defineSemanticToken = defineSemanticToken;
|
|
4042
4422
|
exports.defineToken = defineToken;
|
|
4043
4423
|
exports.defineTypography = defineTypography;
|
|
4044
|
-
exports.
|
|
4045
|
-
exports.
|
|
4046
|
-
exports.
|
|
4047
|
-
exports.
|
|
4424
|
+
exports.extendRecipes = extendRecipes;
|
|
4425
|
+
exports.extendSemanticTokens = extendSemanticTokens;
|
|
4426
|
+
exports.extendTheme = extendTheme;
|
|
4427
|
+
exports.extendTokens = extendTokens;
|
|
4428
|
+
exports.extendTypography = extendTypography;
|
|
4048
4429
|
exports.hexToRgbString = hexToRgbString;
|
|
4049
|
-
exports.inputBase = inputBase;
|
|
4050
|
-
exports.inputKindDefaults = inputKindDefaults;
|
|
4051
|
-
exports.inputRecipe = inputRecipe;
|
|
4052
|
-
exports.mergeRecipes = mergeRecipes;
|
|
4053
|
-
exports.resolveRecipe = resolveRecipe;
|
|
4054
|
-
exports.resolveTypography = resolveTypography;
|
|
4055
4430
|
exports.rgbToHex = rgbToHex;
|
|
4056
|
-
exports.tokensToCssVars = tokensToCssVars;
|
|
4057
4431
|
exports.useBreakpoint = useBreakpoint;
|
|
4432
|
+
exports.useClearableField = useClearableField;
|
|
4058
4433
|
exports.useFloatingSide = useFloatingSide;
|
|
4059
|
-
exports.useMultiSelectContext = useMultiSelectContext;
|
|
4060
|
-
exports.useSelectContext = useSelectContext;
|
|
4061
4434
|
exports.useSizeStyle = useSizeStyle;
|
|
4062
|
-
exports.
|
|
4435
|
+
exports.useStatusTransition = useStatusTransition;
|
|
4063
4436
|
exports.useTheme = useTheme;
|
|
4064
4437
|
exports.useTypography = useTypography;
|
|
4065
4438
|
//# sourceMappingURL=index.cjs.map
|