@splenddev/kreativ-ui 0.2.4 → 0.2.6
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 +1586 -128
- package/dist/index.cjs +327 -338
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +27 -10
- package/dist/index.d.ts +27 -10
- package/dist/index.js +325 -338
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
"use client";
|
|
2
|
+
|
|
2
3
|
import { createContext, forwardRef, useState, useId, useRef, useEffect, useCallback, useLayoutEffect, useMemo, useContext, useReducer } from 'react';
|
|
3
4
|
import { useReducedMotion, motion, AnimatePresence } from 'framer-motion';
|
|
4
5
|
import { clsx } from 'clsx';
|
|
@@ -299,6 +300,171 @@ var formControlRecipe = defineRecipe({
|
|
|
299
300
|
hasAdornment: false
|
|
300
301
|
}
|
|
301
302
|
});
|
|
303
|
+
|
|
304
|
+
// src/utils/color.ts
|
|
305
|
+
var HEX_RE = /^#(?:[0-9a-f]{3}|[0-9a-f]{6})$/i;
|
|
306
|
+
function rgbToHex(value) {
|
|
307
|
+
const trimmed = value.trim();
|
|
308
|
+
if (HEX_RE.test(trimmed)) {
|
|
309
|
+
if (trimmed.length === 4) {
|
|
310
|
+
return ("#" + [...trimmed.slice(1)].map((char) => char + char).join("")).toUpperCase();
|
|
311
|
+
}
|
|
312
|
+
return trimmed.toUpperCase();
|
|
313
|
+
}
|
|
314
|
+
const values = trimmed.replace(/[^\d,]/g, "").split(",").map(Number);
|
|
315
|
+
if (values.length !== 3 || values.some(Number.isNaN)) {
|
|
316
|
+
return "#000000";
|
|
317
|
+
}
|
|
318
|
+
return "#" + values.map((x) => x.toString(16).padStart(2, "0")).join("").toUpperCase();
|
|
319
|
+
}
|
|
320
|
+
__name(rgbToHex, "rgbToHex");
|
|
321
|
+
function hexToRgbString(hex) {
|
|
322
|
+
if (!HEX_RE.test(hex)) return null;
|
|
323
|
+
const full = hex.length === 4 ? "#" + [...hex.slice(1)].map((c) => c + c).join("") : hex;
|
|
324
|
+
const r = parseInt(full.slice(1, 3), 16);
|
|
325
|
+
const g = parseInt(full.slice(3, 5), 16);
|
|
326
|
+
const b = parseInt(full.slice(5, 7), 16);
|
|
327
|
+
return `${r} ${g} ${b}`;
|
|
328
|
+
}
|
|
329
|
+
__name(hexToRgbString, "hexToRgbString");
|
|
330
|
+
|
|
331
|
+
// src/utils/resolveTokenReference.ts
|
|
332
|
+
function resolveTokenReference(value, tokens) {
|
|
333
|
+
if (typeof value !== "string") {
|
|
334
|
+
return typeof value === "number" ? value : "";
|
|
335
|
+
}
|
|
336
|
+
const match = value.match(/^\{(.+)\}$/);
|
|
337
|
+
if (!match) {
|
|
338
|
+
return value;
|
|
339
|
+
}
|
|
340
|
+
const path = match[1].split(".");
|
|
341
|
+
let current = tokens;
|
|
342
|
+
for (const key of path) {
|
|
343
|
+
if (typeof current !== "object" || current === null || !(key in current)) {
|
|
344
|
+
return "";
|
|
345
|
+
}
|
|
346
|
+
current = current[key];
|
|
347
|
+
}
|
|
348
|
+
if (typeof current === "object" && current !== null && "value" in current) {
|
|
349
|
+
const tokenValue = current.value;
|
|
350
|
+
if (typeof tokenValue === "string" || typeof tokenValue === "number") {
|
|
351
|
+
return tokenValue;
|
|
352
|
+
}
|
|
353
|
+
return "";
|
|
354
|
+
}
|
|
355
|
+
return typeof current === "string" || typeof current === "number" ? current : "";
|
|
356
|
+
}
|
|
357
|
+
__name(resolveTokenReference, "resolveTokenReference");
|
|
358
|
+
|
|
359
|
+
// src/theme/typography/resolveTypography.ts
|
|
360
|
+
function resolveTypography(typography, tokens) {
|
|
361
|
+
if (!typography) return {};
|
|
362
|
+
return {
|
|
363
|
+
fontFamily: resolveTokenReference(typography.fontFamily, tokens),
|
|
364
|
+
fontSize: resolveTokenReference(typography.fontSize, tokens),
|
|
365
|
+
fontWeight: resolveTokenReference(typography.fontWeight, tokens),
|
|
366
|
+
lineHeight: resolveTokenReference(typography.lineHeight, tokens),
|
|
367
|
+
letterSpacing: resolveTokenReference(
|
|
368
|
+
typography.letterSpacing,
|
|
369
|
+
tokens
|
|
370
|
+
)
|
|
371
|
+
};
|
|
372
|
+
}
|
|
373
|
+
__name(resolveTypography, "resolveTypography");
|
|
374
|
+
|
|
375
|
+
// src/theme/token/defineToken.ts
|
|
376
|
+
function defineToken(value) {
|
|
377
|
+
return {
|
|
378
|
+
value
|
|
379
|
+
};
|
|
380
|
+
}
|
|
381
|
+
__name(defineToken, "defineToken");
|
|
382
|
+
function defineSemanticToken(light, dark) {
|
|
383
|
+
return { value: { light, dark } };
|
|
384
|
+
}
|
|
385
|
+
__name(defineSemanticToken, "defineSemanticToken");
|
|
386
|
+
var BREAKPOINTS = {
|
|
387
|
+
sm: 640,
|
|
388
|
+
md: 768,
|
|
389
|
+
lg: 1024,
|
|
390
|
+
xl: 1280,
|
|
391
|
+
"2xl": 1536
|
|
392
|
+
};
|
|
393
|
+
function useBreakpoint(breakpoint) {
|
|
394
|
+
const query = `(min-width: ${BREAKPOINTS[breakpoint]}px)`;
|
|
395
|
+
const [matches, setMatches] = useState(
|
|
396
|
+
() => typeof window !== "undefined" && window.matchMedia(query).matches
|
|
397
|
+
);
|
|
398
|
+
useEffect(() => {
|
|
399
|
+
const mql = window.matchMedia(query);
|
|
400
|
+
const listener = /* @__PURE__ */ __name((e) => setMatches(e.matches), "listener");
|
|
401
|
+
mql.addEventListener("change", listener);
|
|
402
|
+
setMatches(mql.matches);
|
|
403
|
+
return () => mql.removeEventListener("change", listener);
|
|
404
|
+
}, [query]);
|
|
405
|
+
return matches;
|
|
406
|
+
}
|
|
407
|
+
__name(useBreakpoint, "useBreakpoint");
|
|
408
|
+
var VIEWPORT_PADDING = 8;
|
|
409
|
+
function useFloatingSide(triggerRef, open) {
|
|
410
|
+
const contentRef = useRef(null);
|
|
411
|
+
const [side, setSide] = useState("bottom");
|
|
412
|
+
useLayoutEffect(() => {
|
|
413
|
+
if (!open) return;
|
|
414
|
+
const trigger = triggerRef.current;
|
|
415
|
+
const content = contentRef.current;
|
|
416
|
+
if (!trigger || !content) return;
|
|
417
|
+
function measure() {
|
|
418
|
+
const triggerRect = trigger.getBoundingClientRect();
|
|
419
|
+
const contentHeight = content.offsetHeight;
|
|
420
|
+
const spaceBelow = window.innerHeight - triggerRect.bottom - VIEWPORT_PADDING;
|
|
421
|
+
const spaceAbove = triggerRect.top - VIEWPORT_PADDING;
|
|
422
|
+
setSide(contentHeight > spaceBelow && spaceAbove > spaceBelow ? "top" : "bottom");
|
|
423
|
+
}
|
|
424
|
+
__name(measure, "measure");
|
|
425
|
+
measure();
|
|
426
|
+
window.addEventListener("resize", measure);
|
|
427
|
+
window.addEventListener("scroll", measure, true);
|
|
428
|
+
return () => {
|
|
429
|
+
window.removeEventListener("resize", measure);
|
|
430
|
+
window.removeEventListener("scroll", measure, true);
|
|
431
|
+
};
|
|
432
|
+
}, [open, triggerRef]);
|
|
433
|
+
return { contentRef, side };
|
|
434
|
+
}
|
|
435
|
+
__name(useFloatingSide, "useFloatingSide");
|
|
436
|
+
var TRANSITION_DURATION = 1500;
|
|
437
|
+
function useStateTransition(state) {
|
|
438
|
+
const previousState = useRef(state);
|
|
439
|
+
const [transitionState, setTransitionState] = useState();
|
|
440
|
+
useEffect(() => {
|
|
441
|
+
if (state === previousState.current) {
|
|
442
|
+
return;
|
|
443
|
+
}
|
|
444
|
+
previousState.current = state;
|
|
445
|
+
if (state === "none") {
|
|
446
|
+
setTransitionState(void 0);
|
|
447
|
+
return;
|
|
448
|
+
}
|
|
449
|
+
setTransitionState(state);
|
|
450
|
+
const timeout = window.setTimeout(() => {
|
|
451
|
+
setTransitionState(void 0);
|
|
452
|
+
}, TRANSITION_DURATION);
|
|
453
|
+
return () => window.clearTimeout(timeout);
|
|
454
|
+
}, [state]);
|
|
455
|
+
return transitionState;
|
|
456
|
+
}
|
|
457
|
+
__name(useStateTransition, "useStateTransition");
|
|
458
|
+
|
|
459
|
+
// src/hooks/useTypography.ts
|
|
460
|
+
function useTypography(name) {
|
|
461
|
+
const { theme } = useTheme();
|
|
462
|
+
return resolveTypography(
|
|
463
|
+
name ? theme.typography[name] : void 0,
|
|
464
|
+
theme.tokens
|
|
465
|
+
);
|
|
466
|
+
}
|
|
467
|
+
__name(useTypography, "useTypography");
|
|
302
468
|
var ACTIVATION_KEYS = /* @__PURE__ */ new Set(["Enter", " "]);
|
|
303
469
|
var Button = forwardRef(
|
|
304
470
|
({
|
|
@@ -310,6 +476,7 @@ var Button = forwardRef(
|
|
|
310
476
|
rightIcon,
|
|
311
477
|
fullWidth = false,
|
|
312
478
|
disabled,
|
|
479
|
+
typography: typographyName = "body",
|
|
313
480
|
className,
|
|
314
481
|
style,
|
|
315
482
|
iconOnly,
|
|
@@ -320,6 +487,7 @@ var Button = forwardRef(
|
|
|
320
487
|
...rest
|
|
321
488
|
}, ref) => {
|
|
322
489
|
const { theme } = useTheme();
|
|
490
|
+
const typography = useTypography(typographyName);
|
|
323
491
|
const { style: sizeStyle, iconSize } = useSizeStyle(
|
|
324
492
|
size,
|
|
325
493
|
iconOnly,
|
|
@@ -353,6 +521,7 @@ var Button = forwardRef(
|
|
|
353
521
|
className
|
|
354
522
|
);
|
|
355
523
|
const resolvedStyle = {
|
|
524
|
+
...typography,
|
|
356
525
|
...sizeStyle,
|
|
357
526
|
...style
|
|
358
527
|
};
|
|
@@ -408,33 +577,6 @@ var Button = forwardRef(
|
|
|
408
577
|
}
|
|
409
578
|
);
|
|
410
579
|
Button.displayName = "Button";
|
|
411
|
-
|
|
412
|
-
// src/utils/color.ts
|
|
413
|
-
var HEX_RE = /^#(?:[0-9a-f]{3}|[0-9a-f]{6})$/i;
|
|
414
|
-
function rgbToHex(value) {
|
|
415
|
-
const trimmed = value.trim();
|
|
416
|
-
if (HEX_RE.test(trimmed)) {
|
|
417
|
-
if (trimmed.length === 4) {
|
|
418
|
-
return ("#" + [...trimmed.slice(1)].map((char) => char + char).join("")).toUpperCase();
|
|
419
|
-
}
|
|
420
|
-
return trimmed.toUpperCase();
|
|
421
|
-
}
|
|
422
|
-
const values = trimmed.replace(/[^\d,]/g, "").split(",").map(Number);
|
|
423
|
-
if (values.length !== 3 || values.some(Number.isNaN)) {
|
|
424
|
-
return "#000000";
|
|
425
|
-
}
|
|
426
|
-
return "#" + values.map((x) => x.toString(16).padStart(2, "0")).join("").toUpperCase();
|
|
427
|
-
}
|
|
428
|
-
__name(rgbToHex, "rgbToHex");
|
|
429
|
-
function hexToRgbString(hex) {
|
|
430
|
-
if (!HEX_RE.test(hex)) return null;
|
|
431
|
-
const full = hex.length === 4 ? "#" + [...hex.slice(1)].map((c) => c + c).join("") : hex;
|
|
432
|
-
const r = parseInt(full.slice(1, 3), 16);
|
|
433
|
-
const g = parseInt(full.slice(3, 5), 16);
|
|
434
|
-
const b = parseInt(full.slice(5, 7), 16);
|
|
435
|
-
return `${r} ${g} ${b}`;
|
|
436
|
-
}
|
|
437
|
-
__name(hexToRgbString, "hexToRgbString");
|
|
438
580
|
var defaultTransition = {
|
|
439
581
|
type: "none",
|
|
440
582
|
duration: 300,
|
|
@@ -616,28 +758,6 @@ function ThemeToggler({
|
|
|
616
758
|
return /* @__PURE__ */ jsx("div", { role: "group", "aria-label": "Theme selector", className: containerClasses, children: buttons });
|
|
617
759
|
}
|
|
618
760
|
__name(ThemeToggler, "ThemeToggler");
|
|
619
|
-
var BREAKPOINTS = {
|
|
620
|
-
sm: 640,
|
|
621
|
-
md: 768,
|
|
622
|
-
lg: 1024,
|
|
623
|
-
xl: 1280,
|
|
624
|
-
"2xl": 1536
|
|
625
|
-
};
|
|
626
|
-
function useBreakpoint(breakpoint) {
|
|
627
|
-
const query = `(min-width: ${BREAKPOINTS[breakpoint]}px)`;
|
|
628
|
-
const [matches, setMatches] = useState(
|
|
629
|
-
() => typeof window !== "undefined" && window.matchMedia(query).matches
|
|
630
|
-
);
|
|
631
|
-
useEffect(() => {
|
|
632
|
-
const mql = window.matchMedia(query);
|
|
633
|
-
const listener = /* @__PURE__ */ __name((e) => setMatches(e.matches), "listener");
|
|
634
|
-
mql.addEventListener("change", listener);
|
|
635
|
-
setMatches(mql.matches);
|
|
636
|
-
return () => mql.removeEventListener("change", listener);
|
|
637
|
-
}, [query]);
|
|
638
|
-
return matches;
|
|
639
|
-
}
|
|
640
|
-
__name(useBreakpoint, "useBreakpoint");
|
|
641
761
|
var inputKindIcons = {
|
|
642
762
|
email: Mail,
|
|
643
763
|
tel: Phone,
|
|
@@ -734,28 +854,6 @@ var inputKindDefaults = {
|
|
|
734
854
|
placeholder: "YYYY-Www"
|
|
735
855
|
}
|
|
736
856
|
};
|
|
737
|
-
var TRANSITION_DURATION = 1500;
|
|
738
|
-
function useStateTransition(state) {
|
|
739
|
-
const previousState = useRef(state);
|
|
740
|
-
const [transitionState, setTransitionState] = useState();
|
|
741
|
-
useEffect(() => {
|
|
742
|
-
if (state === previousState.current) {
|
|
743
|
-
return;
|
|
744
|
-
}
|
|
745
|
-
previousState.current = state;
|
|
746
|
-
if (state === "none") {
|
|
747
|
-
setTransitionState(void 0);
|
|
748
|
-
return;
|
|
749
|
-
}
|
|
750
|
-
setTransitionState(state);
|
|
751
|
-
const timeout = window.setTimeout(() => {
|
|
752
|
-
setTransitionState(void 0);
|
|
753
|
-
}, TRANSITION_DURATION);
|
|
754
|
-
return () => window.clearTimeout(timeout);
|
|
755
|
-
}, [state]);
|
|
756
|
-
return transitionState;
|
|
757
|
-
}
|
|
758
|
-
__name(useStateTransition, "useStateTransition");
|
|
759
857
|
var FormFieldContext = createContext(
|
|
760
858
|
null
|
|
761
859
|
);
|
|
@@ -1255,7 +1353,7 @@ var SelectTrigger = forwardRef(
|
|
|
1255
1353
|
}
|
|
1256
1354
|
);
|
|
1257
1355
|
SelectTrigger.displayName = "SelectTrigger";
|
|
1258
|
-
var
|
|
1356
|
+
var VIEWPORT_PADDING2 = 8;
|
|
1259
1357
|
function SelectContent({
|
|
1260
1358
|
className,
|
|
1261
1359
|
children,
|
|
@@ -1272,8 +1370,8 @@ function SelectContent({
|
|
|
1272
1370
|
function measure() {
|
|
1273
1371
|
const triggerRect = trigger.getBoundingClientRect();
|
|
1274
1372
|
const contentHeight = content?.offsetHeight;
|
|
1275
|
-
const spaceBelow = window.innerHeight - triggerRect.bottom -
|
|
1276
|
-
const spaceAbove = triggerRect.top -
|
|
1373
|
+
const spaceBelow = window.innerHeight - triggerRect.bottom - VIEWPORT_PADDING2;
|
|
1374
|
+
const spaceAbove = triggerRect.top - VIEWPORT_PADDING2;
|
|
1277
1375
|
setSide(
|
|
1278
1376
|
contentHeight && contentHeight > spaceBelow && spaceAbove > spaceBelow ? "top" : "bottom"
|
|
1279
1377
|
);
|
|
@@ -2722,34 +2820,6 @@ function ComboboxItem({
|
|
|
2722
2820
|
);
|
|
2723
2821
|
}
|
|
2724
2822
|
__name(ComboboxItem, "ComboboxItem");
|
|
2725
|
-
var VIEWPORT_PADDING2 = 8;
|
|
2726
|
-
function useFloatingSide(triggerRef, open) {
|
|
2727
|
-
const contentRef = useRef(null);
|
|
2728
|
-
const [side, setSide] = useState("bottom");
|
|
2729
|
-
useLayoutEffect(() => {
|
|
2730
|
-
if (!open) return;
|
|
2731
|
-
const trigger = triggerRef.current;
|
|
2732
|
-
const content = contentRef.current;
|
|
2733
|
-
if (!trigger || !content) return;
|
|
2734
|
-
function measure() {
|
|
2735
|
-
const triggerRect = trigger.getBoundingClientRect();
|
|
2736
|
-
const contentHeight = content.offsetHeight;
|
|
2737
|
-
const spaceBelow = window.innerHeight - triggerRect.bottom - VIEWPORT_PADDING2;
|
|
2738
|
-
const spaceAbove = triggerRect.top - VIEWPORT_PADDING2;
|
|
2739
|
-
setSide(contentHeight > spaceBelow && spaceAbove > spaceBelow ? "top" : "bottom");
|
|
2740
|
-
}
|
|
2741
|
-
__name(measure, "measure");
|
|
2742
|
-
measure();
|
|
2743
|
-
window.addEventListener("resize", measure);
|
|
2744
|
-
window.addEventListener("scroll", measure, true);
|
|
2745
|
-
return () => {
|
|
2746
|
-
window.removeEventListener("resize", measure);
|
|
2747
|
-
window.removeEventListener("scroll", measure, true);
|
|
2748
|
-
};
|
|
2749
|
-
}, [open, triggerRef]);
|
|
2750
|
-
return { contentRef, side };
|
|
2751
|
-
}
|
|
2752
|
-
__name(useFloatingSide, "useFloatingSide");
|
|
2753
2823
|
function ComboboxContent({
|
|
2754
2824
|
className,
|
|
2755
2825
|
children
|
|
@@ -3309,235 +3379,185 @@ MultiSelect.Item = MultiSelectItem;
|
|
|
3309
3379
|
var defaultTokens = {
|
|
3310
3380
|
colors: {
|
|
3311
3381
|
blue: {
|
|
3312
|
-
300:
|
|
3313
|
-
400:
|
|
3314
|
-
500:
|
|
3315
|
-
600:
|
|
3382
|
+
300: defineToken("#5EA6ED"),
|
|
3383
|
+
400: defineToken("#4799EB"),
|
|
3384
|
+
500: defineToken("#1A80E6"),
|
|
3385
|
+
600: defineToken("#1773CF")
|
|
3316
3386
|
},
|
|
3317
3387
|
red: {
|
|
3318
|
-
300:
|
|
3319
|
-
400:
|
|
3320
|
-
500:
|
|
3321
|
-
600:
|
|
3388
|
+
300: defineToken("#EB4747"),
|
|
3389
|
+
400: defineToken("#E83030"),
|
|
3390
|
+
500: defineToken("#E61A1A"),
|
|
3391
|
+
600: defineToken("#CF1717")
|
|
3322
3392
|
},
|
|
3323
3393
|
green: {
|
|
3324
|
-
300:
|
|
3325
|
-
400:
|
|
3326
|
-
500:
|
|
3327
|
-
600:
|
|
3394
|
+
300: defineToken("#26D997"),
|
|
3395
|
+
400: defineToken("#22C388"),
|
|
3396
|
+
500: defineToken("#16A249"),
|
|
3397
|
+
600: defineToken("#12875C")
|
|
3328
3398
|
},
|
|
3329
3399
|
amber: {
|
|
3330
|
-
300:
|
|
3331
|
-
400:
|
|
3332
|
-
500:
|
|
3333
|
-
600:
|
|
3400
|
+
300: defineToken("#F7B23B"),
|
|
3401
|
+
400: defineToken("#F6A823"),
|
|
3402
|
+
500: defineToken("#F59F0A"),
|
|
3403
|
+
600: defineToken("#D38909")
|
|
3334
3404
|
},
|
|
3335
3405
|
cyan: {
|
|
3336
|
-
300:
|
|
3337
|
-
400:
|
|
3338
|
-
500:
|
|
3339
|
-
600:
|
|
3406
|
+
300: defineToken("#6CC3EF"),
|
|
3407
|
+
400: defineToken("#47B4EB"),
|
|
3408
|
+
500: defineToken("#1791CF"),
|
|
3409
|
+
600: defineToken("#137BAE")
|
|
3340
3410
|
},
|
|
3341
3411
|
gray: {
|
|
3342
|
-
50:
|
|
3343
|
-
100:
|
|
3344
|
-
200:
|
|
3345
|
-
300:
|
|
3346
|
-
400:
|
|
3347
|
-
500:
|
|
3348
|
-
600:
|
|
3349
|
-
700:
|
|
3350
|
-
800:
|
|
3351
|
-
900:
|
|
3352
|
-
950:
|
|
3353
|
-
1e3:
|
|
3354
|
-
},
|
|
3355
|
-
white: {
|
|
3356
|
-
value: "#FFFFFF"
|
|
3412
|
+
50: defineToken("#FAFAFA"),
|
|
3413
|
+
100: defineToken("#EBEBEB"),
|
|
3414
|
+
200: defineToken("#D9D9D9"),
|
|
3415
|
+
300: defineToken("#BDBDBD"),
|
|
3416
|
+
400: defineToken("#999999"),
|
|
3417
|
+
500: defineToken("#666666"),
|
|
3418
|
+
600: defineToken("#4D4D4D"),
|
|
3419
|
+
700: defineToken("#333333"),
|
|
3420
|
+
800: defineToken("#2E2E2E"),
|
|
3421
|
+
900: defineToken("#1F1F1F"),
|
|
3422
|
+
950: defineToken("#141414"),
|
|
3423
|
+
1e3: defineToken("#0A0A0A")
|
|
3357
3424
|
},
|
|
3358
|
-
|
|
3359
|
-
|
|
3360
|
-
}
|
|
3425
|
+
white: defineToken("#FFFFFF"),
|
|
3426
|
+
black: defineToken("#000000")
|
|
3361
3427
|
},
|
|
3362
3428
|
spacing: {
|
|
3363
|
-
1:
|
|
3364
|
-
2:
|
|
3365
|
-
3:
|
|
3366
|
-
4:
|
|
3367
|
-
5:
|
|
3368
|
-
6:
|
|
3369
|
-
8:
|
|
3370
|
-
10:
|
|
3371
|
-
12:
|
|
3372
|
-
16:
|
|
3429
|
+
1: defineToken("0.25rem"),
|
|
3430
|
+
2: defineToken("0.5rem"),
|
|
3431
|
+
3: defineToken("0.75rem"),
|
|
3432
|
+
4: defineToken("1rem"),
|
|
3433
|
+
5: defineToken("1.25rem"),
|
|
3434
|
+
6: defineToken("1.5rem"),
|
|
3435
|
+
8: defineToken("2rem"),
|
|
3436
|
+
10: defineToken("2.5rem"),
|
|
3437
|
+
12: defineToken("3rem"),
|
|
3438
|
+
16: defineToken("4rem")
|
|
3373
3439
|
},
|
|
3374
3440
|
radii: {
|
|
3375
|
-
none:
|
|
3376
|
-
sm:
|
|
3377
|
-
md:
|
|
3378
|
-
lg:
|
|
3379
|
-
xl:
|
|
3380
|
-
full:
|
|
3441
|
+
none: defineToken("0"),
|
|
3442
|
+
sm: defineToken("0.25rem"),
|
|
3443
|
+
md: defineToken("0.5rem"),
|
|
3444
|
+
lg: defineToken("0.75rem"),
|
|
3445
|
+
xl: defineToken("1rem"),
|
|
3446
|
+
full: defineToken("9999px")
|
|
3381
3447
|
},
|
|
3382
3448
|
fonts: {
|
|
3383
|
-
body:
|
|
3384
|
-
|
|
3385
|
-
|
|
3386
|
-
heading: {
|
|
3387
|
-
value: "Inter, sans-serif"
|
|
3388
|
-
},
|
|
3389
|
-
mono: {
|
|
3390
|
-
value: "ui-monospace, SFMono-Regular, Menlo, monospace"
|
|
3391
|
-
}
|
|
3449
|
+
body: defineToken("Inter, sans-serif"),
|
|
3450
|
+
heading: defineToken("Inter, sans-serif"),
|
|
3451
|
+
mono: defineToken("ui-monospace, SFMono-Regular, Menlo, monospace")
|
|
3392
3452
|
},
|
|
3393
3453
|
fontSizes: {
|
|
3394
|
-
xs:
|
|
3395
|
-
sm:
|
|
3396
|
-
md:
|
|
3397
|
-
lg:
|
|
3398
|
-
xl:
|
|
3399
|
-
"2xl":
|
|
3400
|
-
"3xl":
|
|
3401
|
-
"4xl":
|
|
3454
|
+
xs: defineToken("0.75rem"),
|
|
3455
|
+
sm: defineToken("0.875rem"),
|
|
3456
|
+
md: defineToken("1rem"),
|
|
3457
|
+
lg: defineToken("1.125rem"),
|
|
3458
|
+
xl: defineToken("1.25rem"),
|
|
3459
|
+
"2xl": defineToken("1.5rem"),
|
|
3460
|
+
"3xl": defineToken("1.875rem"),
|
|
3461
|
+
"4xl": defineToken("2.25rem")
|
|
3402
3462
|
},
|
|
3403
3463
|
fontWeights: {
|
|
3404
|
-
normal:
|
|
3405
|
-
medium:
|
|
3406
|
-
semibold:
|
|
3407
|
-
bold:
|
|
3464
|
+
normal: defineToken("400"),
|
|
3465
|
+
medium: defineToken("500"),
|
|
3466
|
+
semibold: defineToken("600"),
|
|
3467
|
+
bold: defineToken("700")
|
|
3408
3468
|
},
|
|
3409
3469
|
lineHeights: {
|
|
3410
|
-
tight:
|
|
3411
|
-
normal:
|
|
3412
|
-
relaxed:
|
|
3470
|
+
tight: defineToken("1.25"),
|
|
3471
|
+
normal: defineToken("1.5"),
|
|
3472
|
+
relaxed: defineToken("1.75")
|
|
3413
3473
|
},
|
|
3414
3474
|
letterSpacings: {
|
|
3415
|
-
tighter:
|
|
3416
|
-
tight:
|
|
3417
|
-
normal:
|
|
3418
|
-
wide:
|
|
3475
|
+
tighter: defineToken("-0.025em"),
|
|
3476
|
+
tight: defineToken("-0.01em"),
|
|
3477
|
+
normal: defineToken("0"),
|
|
3478
|
+
wide: defineToken("0.025em")
|
|
3419
3479
|
},
|
|
3420
3480
|
animations: {
|
|
3421
|
-
"slide-in-right":
|
|
3422
|
-
value: "slide-in-right 0.5s ease-in-out"
|
|
3423
|
-
}
|
|
3481
|
+
"slide-in-right": defineToken("slide-in-right 0.5s ease-in-out")
|
|
3424
3482
|
}
|
|
3425
3483
|
};
|
|
3426
3484
|
|
|
3427
3485
|
// src/theme/defaults/semanticTokens.ts
|
|
3428
3486
|
var defaultSemanticTokens = {
|
|
3429
3487
|
colors: {
|
|
3430
|
-
brand: {
|
|
3431
|
-
|
|
3432
|
-
|
|
3433
|
-
|
|
3434
|
-
|
|
3435
|
-
|
|
3436
|
-
|
|
3437
|
-
|
|
3438
|
-
|
|
3439
|
-
|
|
3440
|
-
|
|
3441
|
-
},
|
|
3442
|
-
|
|
3443
|
-
|
|
3444
|
-
|
|
3445
|
-
|
|
3446
|
-
|
|
3447
|
-
|
|
3448
|
-
|
|
3449
|
-
|
|
3450
|
-
|
|
3451
|
-
|
|
3452
|
-
|
|
3453
|
-
|
|
3454
|
-
|
|
3455
|
-
|
|
3456
|
-
|
|
3457
|
-
|
|
3458
|
-
|
|
3459
|
-
|
|
3460
|
-
|
|
3461
|
-
|
|
3462
|
-
},
|
|
3463
|
-
|
|
3464
|
-
|
|
3465
|
-
|
|
3466
|
-
|
|
3467
|
-
|
|
3468
|
-
|
|
3469
|
-
|
|
3470
|
-
|
|
3471
|
-
|
|
3472
|
-
|
|
3473
|
-
|
|
3474
|
-
|
|
3475
|
-
|
|
3476
|
-
|
|
3477
|
-
|
|
3478
|
-
|
|
3479
|
-
|
|
3480
|
-
|
|
3481
|
-
|
|
3482
|
-
|
|
3483
|
-
|
|
3484
|
-
|
|
3485
|
-
|
|
3486
|
-
|
|
3487
|
-
|
|
3488
|
-
|
|
3489
|
-
},
|
|
3490
|
-
|
|
3491
|
-
|
|
3492
|
-
|
|
3493
|
-
|
|
3494
|
-
|
|
3495
|
-
},
|
|
3496
|
-
|
|
3497
|
-
|
|
3498
|
-
|
|
3499
|
-
|
|
3500
|
-
|
|
3501
|
-
},
|
|
3502
|
-
|
|
3503
|
-
value: "{colors.white}"
|
|
3504
|
-
},
|
|
3505
|
-
successHover: {
|
|
3506
|
-
value: {
|
|
3507
|
-
light: "{colors.green.600}",
|
|
3508
|
-
dark: "{colors.green.300}"
|
|
3509
|
-
}
|
|
3510
|
-
},
|
|
3511
|
-
warning: {
|
|
3512
|
-
value: {
|
|
3513
|
-
light: "{colors.amber.500}",
|
|
3514
|
-
dark: "{colors.amber.400}"
|
|
3515
|
-
}
|
|
3516
|
-
},
|
|
3517
|
-
warningFg: {
|
|
3518
|
-
value: "{colors.black}"
|
|
3519
|
-
},
|
|
3520
|
-
warningHover: {
|
|
3521
|
-
value: {
|
|
3522
|
-
light: "{colors.amber.600}",
|
|
3523
|
-
dark: "{colors.amber.300}"
|
|
3524
|
-
}
|
|
3525
|
-
},
|
|
3526
|
-
info: {
|
|
3527
|
-
value: {
|
|
3528
|
-
light: "{colors.cyan.500}",
|
|
3529
|
-
dark: "{colors.cyan.400}"
|
|
3530
|
-
}
|
|
3531
|
-
},
|
|
3532
|
-
infoFg: {
|
|
3533
|
-
value: "{colors.white}"
|
|
3534
|
-
},
|
|
3535
|
-
infoHover: {
|
|
3536
|
-
value: {
|
|
3537
|
-
light: "{colors.cyan.600}",
|
|
3538
|
-
dark: "{colors.cyan.300}"
|
|
3539
|
-
}
|
|
3540
|
-
}
|
|
3488
|
+
brand: defineSemanticToken("{colors.blue.500}", "{colors.blue.400}"),
|
|
3489
|
+
brandHover: defineSemanticToken("{colors.blue.600}", "{colors.blue.300}"),
|
|
3490
|
+
brandFg: defineToken("{colors.white}"),
|
|
3491
|
+
surface: defineSemanticToken("{colors.gray.50}", "{colors.gray.900}"),
|
|
3492
|
+
surfaceRaised: defineSemanticToken("{colors.white}", "{colors.gray.800}"),
|
|
3493
|
+
surfaceSunken: defineSemanticToken(
|
|
3494
|
+
"{colors.gray.100}",
|
|
3495
|
+
"{colors.gray.950}"
|
|
3496
|
+
),
|
|
3497
|
+
border: defineSemanticToken("{colors.gray.200}", "{colors.gray.600}"),
|
|
3498
|
+
text: defineSemanticToken("{colors.gray.900}", "{colors.gray.50}"),
|
|
3499
|
+
textMuted: defineSemanticToken("{colors.gray.500}", "{colors.gray.400}"),
|
|
3500
|
+
destructive: defineSemanticToken("{colors.red.500}", "{colors.red.400}"),
|
|
3501
|
+
destructiveFg: defineToken("{colors.white}"),
|
|
3502
|
+
destructiveHover: defineSemanticToken(
|
|
3503
|
+
"{colors.red.600}",
|
|
3504
|
+
"{colors.red.300}"
|
|
3505
|
+
),
|
|
3506
|
+
success: defineSemanticToken("{colors.green.500}", "{colors.green.400}"),
|
|
3507
|
+
successFg: defineToken("{colors.white}"),
|
|
3508
|
+
successHover: defineSemanticToken(
|
|
3509
|
+
"{colors.green.600}",
|
|
3510
|
+
"{colors.green.300}"
|
|
3511
|
+
),
|
|
3512
|
+
warning: defineSemanticToken("{colors.amber.500}", "{colors.amber.400}"),
|
|
3513
|
+
warningFg: defineToken("{colors.black}"),
|
|
3514
|
+
warningHover: defineSemanticToken(
|
|
3515
|
+
"{colors.amber.600}",
|
|
3516
|
+
"{colors.amber.300}"
|
|
3517
|
+
),
|
|
3518
|
+
info: defineSemanticToken("{colors.cyan.500}", "{colors.cyan.400}"),
|
|
3519
|
+
infoFg: defineToken("{colors.white}"),
|
|
3520
|
+
infoHover: defineSemanticToken("{colors.cyan.600}", "{colors.cyan.300}")
|
|
3521
|
+
}
|
|
3522
|
+
};
|
|
3523
|
+
|
|
3524
|
+
// src/theme/defaults/typography.ts
|
|
3525
|
+
var defaultTypography = {
|
|
3526
|
+
body: {
|
|
3527
|
+
fontFamily: "{fonts.body}",
|
|
3528
|
+
fontSize: "{fontSizes.md}",
|
|
3529
|
+
fontWeight: "{fontWeights.normal}",
|
|
3530
|
+
lineHeight: "{lineHeights.normal}"
|
|
3531
|
+
},
|
|
3532
|
+
bodySmall: {
|
|
3533
|
+
fontFamily: "{fonts.body}",
|
|
3534
|
+
fontSize: "{fontSizes.sm}",
|
|
3535
|
+
fontWeight: "{fontWeights.normal}",
|
|
3536
|
+
lineHeight: "{lineHeights.normal}"
|
|
3537
|
+
},
|
|
3538
|
+
heading: {
|
|
3539
|
+
fontFamily: "{fonts.heading}",
|
|
3540
|
+
fontSize: "{fontSizes.2xl}",
|
|
3541
|
+
fontWeight: "{fontWeights.bold}",
|
|
3542
|
+
lineHeight: "{lineHeights.tight}"
|
|
3543
|
+
},
|
|
3544
|
+
headingSmall: {
|
|
3545
|
+
fontFamily: "{fonts.heading}",
|
|
3546
|
+
fontSize: "{fontSizes.xl}",
|
|
3547
|
+
fontWeight: "{fontWeights.semibold}",
|
|
3548
|
+
lineHeight: "{lineHeights.tight}"
|
|
3549
|
+
},
|
|
3550
|
+
caption: {
|
|
3551
|
+
fontFamily: "{fonts.body}",
|
|
3552
|
+
fontSize: "{fontSizes.xs}",
|
|
3553
|
+
fontWeight: "{fontWeights.normal}",
|
|
3554
|
+
lineHeight: "{lineHeights.normal}"
|
|
3555
|
+
},
|
|
3556
|
+
mono: {
|
|
3557
|
+
fontFamily: "{fonts.mono}",
|
|
3558
|
+
fontSize: "{fontSizes.xs}",
|
|
3559
|
+
fontWeight: "{fontWeights.normal}",
|
|
3560
|
+
lineHeight: "{lineHeights.normal}"
|
|
3541
3561
|
}
|
|
3542
3562
|
};
|
|
3543
3563
|
|
|
@@ -3576,38 +3596,6 @@ var defaultSizes = {
|
|
|
3576
3596
|
radius: "1.15rem"
|
|
3577
3597
|
}
|
|
3578
3598
|
};
|
|
3579
|
-
var defaultTextStyles = {
|
|
3580
|
-
body: {
|
|
3581
|
-
fontFamily: "{fonts.body}",
|
|
3582
|
-
fontSize: "{fontSizes.md}",
|
|
3583
|
-
fontWeight: "{fontWeights.normal}",
|
|
3584
|
-
lineHeight: "{lineHeights.normal}"
|
|
3585
|
-
},
|
|
3586
|
-
bodySmall: {
|
|
3587
|
-
fontFamily: "{fonts.body}",
|
|
3588
|
-
fontSize: "{fontSizes.sm}",
|
|
3589
|
-
fontWeight: "{fontWeights.normal}",
|
|
3590
|
-
lineHeight: "{lineHeights.normal}"
|
|
3591
|
-
},
|
|
3592
|
-
heading: {
|
|
3593
|
-
fontFamily: "{fonts.heading}",
|
|
3594
|
-
fontSize: "{fontSizes.2xl}",
|
|
3595
|
-
fontWeight: "{fontWeights.bold}",
|
|
3596
|
-
lineHeight: "{lineHeights.tight}"
|
|
3597
|
-
},
|
|
3598
|
-
headingSmall: {
|
|
3599
|
-
fontFamily: "{fonts.heading}",
|
|
3600
|
-
fontSize: "{fontSizes.xl}",
|
|
3601
|
-
fontWeight: "{fontWeights.semibold}",
|
|
3602
|
-
lineHeight: "{lineHeights.tight}"
|
|
3603
|
-
},
|
|
3604
|
-
caption: {
|
|
3605
|
-
fontFamily: "{fonts.body}",
|
|
3606
|
-
fontSize: "{fontSizes.xs}",
|
|
3607
|
-
fontWeight: "{fontWeights.normal}",
|
|
3608
|
-
lineHeight: "{lineHeights.normal}"
|
|
3609
|
-
}
|
|
3610
|
-
};
|
|
3611
3599
|
var defaultRecipes = {
|
|
3612
3600
|
Button: buttonRecipe,
|
|
3613
3601
|
FormControl: formControlRecipe,
|
|
@@ -3616,7 +3604,7 @@ var defaultRecipes = {
|
|
|
3616
3604
|
var defaultTheme = {
|
|
3617
3605
|
tokens: defaultTokens,
|
|
3618
3606
|
semanticTokens: defaultSemanticTokens,
|
|
3619
|
-
|
|
3607
|
+
typography: defaultTypography,
|
|
3620
3608
|
recipes: defaultRecipes,
|
|
3621
3609
|
intensity: 50,
|
|
3622
3610
|
sizes: defaultSizes
|
|
@@ -3890,10 +3878,10 @@ function mergeSemanticTokens(base, override) {
|
|
|
3890
3878
|
return deepMerge(base, override);
|
|
3891
3879
|
}
|
|
3892
3880
|
__name(mergeSemanticTokens, "mergeSemanticTokens");
|
|
3893
|
-
function
|
|
3881
|
+
function mergeTypography(base, override) {
|
|
3894
3882
|
return deepMerge(base, override);
|
|
3895
3883
|
}
|
|
3896
|
-
__name(
|
|
3884
|
+
__name(mergeTypography, "mergeTypography");
|
|
3897
3885
|
function mergeSizes(base, override) {
|
|
3898
3886
|
if (!override) {
|
|
3899
3887
|
return base;
|
|
@@ -3922,7 +3910,7 @@ function mergeTheme(base, override) {
|
|
|
3922
3910
|
base.semanticTokens,
|
|
3923
3911
|
override.semanticTokens
|
|
3924
3912
|
),
|
|
3925
|
-
|
|
3913
|
+
typography: mergeTypography(base.typography, override.typography),
|
|
3926
3914
|
recipes: mergeRecipes(base.recipes, override.recipes),
|
|
3927
3915
|
intensity: override.intensity ?? base.intensity,
|
|
3928
3916
|
sizes: mergeSizes(base.sizes, override.sizes)
|
|
@@ -3930,11 +3918,10 @@ function mergeTheme(base, override) {
|
|
|
3930
3918
|
}
|
|
3931
3919
|
__name(mergeTheme, "mergeTheme");
|
|
3932
3920
|
function useSystemPrefersDark() {
|
|
3933
|
-
const [prefersDark, setPrefersDark] = useState(
|
|
3934
|
-
() => typeof window !== "undefined" && window.matchMedia("(prefers-color-scheme: dark)").matches
|
|
3935
|
-
);
|
|
3921
|
+
const [prefersDark, setPrefersDark] = useState(false);
|
|
3936
3922
|
useEffect(() => {
|
|
3937
3923
|
const mediaQuery = window.matchMedia("(prefers-color-scheme: dark)");
|
|
3924
|
+
setPrefersDark(mediaQuery.matches);
|
|
3938
3925
|
const handleChange = /* @__PURE__ */ __name((event) => {
|
|
3939
3926
|
setPrefersDark(event.matches);
|
|
3940
3927
|
}, "handleChange");
|
|
@@ -3999,6 +3986,6 @@ function UIProvider({
|
|
|
3999
3986
|
}
|
|
4000
3987
|
__name(UIProvider, "UIProvider");
|
|
4001
3988
|
|
|
4002
|
-
export { Button, Checkbox, Combobox, ComboboxContent, ComboboxInput, ComboboxItem, FormField, FormFieldControl, FormFieldDescription, FormFieldLabel, FormFieldMessage, Input, MarkdownEditor, MultiSelect, MultiSelectContent, MultiSelectContext, MultiSelectItem, MultiSelectTrigger, Radio, RadioGroup, Select, SelectContent, SelectContext, SelectGroup, SelectGroupContext, SelectItem, SelectTrigger, SelectValue, Switch, Textarea, TextareaCore, ThemeContext, ThemeToggler, UIProvider, cn, defaultRecipes, defaultSizes,
|
|
3989
|
+
export { Button, Checkbox, Combobox, ComboboxContent, ComboboxInput, ComboboxItem, FormField, FormFieldControl, FormFieldDescription, FormFieldLabel, FormFieldMessage, Input, MarkdownEditor, MultiSelect, MultiSelectContent, MultiSelectContext, MultiSelectItem, MultiSelectTrigger, Radio, RadioGroup, Select, SelectContent, SelectContext, SelectGroup, SelectGroupContext, SelectItem, SelectTrigger, SelectValue, Switch, Textarea, TextareaCore, ThemeContext, ThemeToggler, UIProvider, cn, defaultRecipes, defaultSizes, defaultTheme, hexToRgbString, inputKindDefaults, rgbToHex, tokensToCssVars, useBreakpoint, useFloatingSide, useMultiSelectContext, useSelectContext, useSizeStyle, useStateTransition, useTheme, useTypography };
|
|
4003
3990
|
//# sourceMappingURL=index.js.map
|
|
4004
3991
|
//# sourceMappingURL=index.js.map
|