@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/dist/index.cjs CHANGED
@@ -1,4 +1,5 @@
1
1
  "use client";
2
+
2
3
  'use strict';
3
4
 
4
5
  var react = require('react');
@@ -302,6 +303,171 @@ var formControlRecipe = defineRecipe({
302
303
  hasAdornment: false
303
304
  }
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/token/defineToken.ts
379
+ function defineToken(value) {
380
+ return {
381
+ value
382
+ };
383
+ }
384
+ __name(defineToken, "defineToken");
385
+ function defineSemanticToken(light, dark) {
386
+ return { value: { light, dark } };
387
+ }
388
+ __name(defineSemanticToken, "defineSemanticToken");
389
+ var BREAKPOINTS = {
390
+ sm: 640,
391
+ md: 768,
392
+ lg: 1024,
393
+ xl: 1280,
394
+ "2xl": 1536
395
+ };
396
+ function useBreakpoint(breakpoint) {
397
+ const query = `(min-width: ${BREAKPOINTS[breakpoint]}px)`;
398
+ const [matches, setMatches] = react.useState(
399
+ () => typeof window !== "undefined" && window.matchMedia(query).matches
400
+ );
401
+ react.useEffect(() => {
402
+ const mql = window.matchMedia(query);
403
+ const listener = /* @__PURE__ */ __name((e) => setMatches(e.matches), "listener");
404
+ mql.addEventListener("change", listener);
405
+ setMatches(mql.matches);
406
+ return () => mql.removeEventListener("change", listener);
407
+ }, [query]);
408
+ return matches;
409
+ }
410
+ __name(useBreakpoint, "useBreakpoint");
411
+ var VIEWPORT_PADDING = 8;
412
+ function useFloatingSide(triggerRef, open) {
413
+ const contentRef = react.useRef(null);
414
+ const [side, setSide] = react.useState("bottom");
415
+ react.useLayoutEffect(() => {
416
+ if (!open) return;
417
+ const trigger = triggerRef.current;
418
+ const content = contentRef.current;
419
+ if (!trigger || !content) return;
420
+ function measure() {
421
+ const triggerRect = trigger.getBoundingClientRect();
422
+ const contentHeight = content.offsetHeight;
423
+ const spaceBelow = window.innerHeight - triggerRect.bottom - VIEWPORT_PADDING;
424
+ const spaceAbove = triggerRect.top - VIEWPORT_PADDING;
425
+ setSide(contentHeight > spaceBelow && spaceAbove > spaceBelow ? "top" : "bottom");
426
+ }
427
+ __name(measure, "measure");
428
+ measure();
429
+ window.addEventListener("resize", measure);
430
+ window.addEventListener("scroll", measure, true);
431
+ return () => {
432
+ window.removeEventListener("resize", measure);
433
+ window.removeEventListener("scroll", measure, true);
434
+ };
435
+ }, [open, triggerRef]);
436
+ return { contentRef, side };
437
+ }
438
+ __name(useFloatingSide, "useFloatingSide");
439
+ var TRANSITION_DURATION = 1500;
440
+ function useStateTransition(state) {
441
+ const previousState = react.useRef(state);
442
+ const [transitionState, setTransitionState] = react.useState();
443
+ react.useEffect(() => {
444
+ if (state === previousState.current) {
445
+ return;
446
+ }
447
+ previousState.current = state;
448
+ if (state === "none") {
449
+ setTransitionState(void 0);
450
+ return;
451
+ }
452
+ setTransitionState(state);
453
+ const timeout = window.setTimeout(() => {
454
+ setTransitionState(void 0);
455
+ }, TRANSITION_DURATION);
456
+ return () => window.clearTimeout(timeout);
457
+ }, [state]);
458
+ return transitionState;
459
+ }
460
+ __name(useStateTransition, "useStateTransition");
461
+
462
+ // src/hooks/useTypography.ts
463
+ function useTypography(name) {
464
+ const { theme } = useTheme();
465
+ return resolveTypography(
466
+ name ? theme.typography[name] : void 0,
467
+ theme.tokens
468
+ );
469
+ }
470
+ __name(useTypography, "useTypography");
305
471
  var ACTIVATION_KEYS = /* @__PURE__ */ new Set(["Enter", " "]);
306
472
  var Button = react.forwardRef(
307
473
  ({
@@ -313,6 +479,7 @@ var Button = react.forwardRef(
313
479
  rightIcon,
314
480
  fullWidth = false,
315
481
  disabled,
482
+ typography: typographyName = "body",
316
483
  className,
317
484
  style,
318
485
  iconOnly,
@@ -323,6 +490,7 @@ var Button = react.forwardRef(
323
490
  ...rest
324
491
  }, ref) => {
325
492
  const { theme } = useTheme();
493
+ const typography = useTypography(typographyName);
326
494
  const { style: sizeStyle, iconSize } = useSizeStyle(
327
495
  size,
328
496
  iconOnly,
@@ -356,6 +524,7 @@ var Button = react.forwardRef(
356
524
  className
357
525
  );
358
526
  const resolvedStyle = {
527
+ ...typography,
359
528
  ...sizeStyle,
360
529
  ...style
361
530
  };
@@ -411,33 +580,6 @@ var Button = react.forwardRef(
411
580
  }
412
581
  );
413
582
  Button.displayName = "Button";
414
-
415
- // src/utils/color.ts
416
- var HEX_RE = /^#(?:[0-9a-f]{3}|[0-9a-f]{6})$/i;
417
- function rgbToHex(value) {
418
- const trimmed = value.trim();
419
- if (HEX_RE.test(trimmed)) {
420
- if (trimmed.length === 4) {
421
- return ("#" + [...trimmed.slice(1)].map((char) => char + char).join("")).toUpperCase();
422
- }
423
- return trimmed.toUpperCase();
424
- }
425
- const values = trimmed.replace(/[^\d,]/g, "").split(",").map(Number);
426
- if (values.length !== 3 || values.some(Number.isNaN)) {
427
- return "#000000";
428
- }
429
- return "#" + values.map((x) => x.toString(16).padStart(2, "0")).join("").toUpperCase();
430
- }
431
- __name(rgbToHex, "rgbToHex");
432
- function hexToRgbString(hex) {
433
- if (!HEX_RE.test(hex)) return null;
434
- const full = hex.length === 4 ? "#" + [...hex.slice(1)].map((c) => c + c).join("") : hex;
435
- const r = parseInt(full.slice(1, 3), 16);
436
- const g = parseInt(full.slice(3, 5), 16);
437
- const b = parseInt(full.slice(5, 7), 16);
438
- return `${r} ${g} ${b}`;
439
- }
440
- __name(hexToRgbString, "hexToRgbString");
441
583
  var defaultTransition = {
442
584
  type: "none",
443
585
  duration: 300,
@@ -619,28 +761,6 @@ function ThemeToggler({
619
761
  return /* @__PURE__ */ jsxRuntime.jsx("div", { role: "group", "aria-label": "Theme selector", className: containerClasses, children: buttons });
620
762
  }
621
763
  __name(ThemeToggler, "ThemeToggler");
622
- var BREAKPOINTS = {
623
- sm: 640,
624
- md: 768,
625
- lg: 1024,
626
- xl: 1280,
627
- "2xl": 1536
628
- };
629
- function useBreakpoint(breakpoint) {
630
- const query = `(min-width: ${BREAKPOINTS[breakpoint]}px)`;
631
- const [matches, setMatches] = react.useState(
632
- () => typeof window !== "undefined" && window.matchMedia(query).matches
633
- );
634
- react.useEffect(() => {
635
- const mql = window.matchMedia(query);
636
- const listener = /* @__PURE__ */ __name((e) => setMatches(e.matches), "listener");
637
- mql.addEventListener("change", listener);
638
- setMatches(mql.matches);
639
- return () => mql.removeEventListener("change", listener);
640
- }, [query]);
641
- return matches;
642
- }
643
- __name(useBreakpoint, "useBreakpoint");
644
764
  var inputKindIcons = {
645
765
  email: lucideReact.Mail,
646
766
  tel: lucideReact.Phone,
@@ -737,28 +857,6 @@ var inputKindDefaults = {
737
857
  placeholder: "YYYY-Www"
738
858
  }
739
859
  };
740
- var TRANSITION_DURATION = 1500;
741
- function useStateTransition(state) {
742
- const previousState = react.useRef(state);
743
- const [transitionState, setTransitionState] = react.useState();
744
- react.useEffect(() => {
745
- if (state === previousState.current) {
746
- return;
747
- }
748
- previousState.current = state;
749
- if (state === "none") {
750
- setTransitionState(void 0);
751
- return;
752
- }
753
- setTransitionState(state);
754
- const timeout = window.setTimeout(() => {
755
- setTransitionState(void 0);
756
- }, TRANSITION_DURATION);
757
- return () => window.clearTimeout(timeout);
758
- }, [state]);
759
- return transitionState;
760
- }
761
- __name(useStateTransition, "useStateTransition");
762
860
  var FormFieldContext = react.createContext(
763
861
  null
764
862
  );
@@ -1258,7 +1356,7 @@ var SelectTrigger = react.forwardRef(
1258
1356
  }
1259
1357
  );
1260
1358
  SelectTrigger.displayName = "SelectTrigger";
1261
- var VIEWPORT_PADDING = 8;
1359
+ var VIEWPORT_PADDING2 = 8;
1262
1360
  function SelectContent({
1263
1361
  className,
1264
1362
  children,
@@ -1275,8 +1373,8 @@ function SelectContent({
1275
1373
  function measure() {
1276
1374
  const triggerRect = trigger.getBoundingClientRect();
1277
1375
  const contentHeight = content?.offsetHeight;
1278
- const spaceBelow = window.innerHeight - triggerRect.bottom - VIEWPORT_PADDING;
1279
- const spaceAbove = triggerRect.top - VIEWPORT_PADDING;
1376
+ const spaceBelow = window.innerHeight - triggerRect.bottom - VIEWPORT_PADDING2;
1377
+ const spaceAbove = triggerRect.top - VIEWPORT_PADDING2;
1280
1378
  setSide(
1281
1379
  contentHeight && contentHeight > spaceBelow && spaceAbove > spaceBelow ? "top" : "bottom"
1282
1380
  );
@@ -2725,34 +2823,6 @@ function ComboboxItem({
2725
2823
  );
2726
2824
  }
2727
2825
  __name(ComboboxItem, "ComboboxItem");
2728
- var VIEWPORT_PADDING2 = 8;
2729
- function useFloatingSide(triggerRef, open) {
2730
- const contentRef = react.useRef(null);
2731
- const [side, setSide] = react.useState("bottom");
2732
- react.useLayoutEffect(() => {
2733
- if (!open) return;
2734
- const trigger = triggerRef.current;
2735
- const content = contentRef.current;
2736
- if (!trigger || !content) return;
2737
- function measure() {
2738
- const triggerRect = trigger.getBoundingClientRect();
2739
- const contentHeight = content.offsetHeight;
2740
- const spaceBelow = window.innerHeight - triggerRect.bottom - VIEWPORT_PADDING2;
2741
- const spaceAbove = triggerRect.top - VIEWPORT_PADDING2;
2742
- setSide(contentHeight > spaceBelow && spaceAbove > spaceBelow ? "top" : "bottom");
2743
- }
2744
- __name(measure, "measure");
2745
- measure();
2746
- window.addEventListener("resize", measure);
2747
- window.addEventListener("scroll", measure, true);
2748
- return () => {
2749
- window.removeEventListener("resize", measure);
2750
- window.removeEventListener("scroll", measure, true);
2751
- };
2752
- }, [open, triggerRef]);
2753
- return { contentRef, side };
2754
- }
2755
- __name(useFloatingSide, "useFloatingSide");
2756
2826
  function ComboboxContent({
2757
2827
  className,
2758
2828
  children
@@ -3312,235 +3382,185 @@ MultiSelect.Item = MultiSelectItem;
3312
3382
  var defaultTokens = {
3313
3383
  colors: {
3314
3384
  blue: {
3315
- 300: { value: "#5EA6ED" },
3316
- 400: { value: "#4799EB" },
3317
- 500: { value: "#1A80E6" },
3318
- 600: { value: "#1773CF" }
3385
+ 300: defineToken("#5EA6ED"),
3386
+ 400: defineToken("#4799EB"),
3387
+ 500: defineToken("#1A80E6"),
3388
+ 600: defineToken("#1773CF")
3319
3389
  },
3320
3390
  red: {
3321
- 300: { value: "#EB4747" },
3322
- 400: { value: "#E83030" },
3323
- 500: { value: "#E61A1A" },
3324
- 600: { value: "#CF1717" }
3391
+ 300: defineToken("#EB4747"),
3392
+ 400: defineToken("#E83030"),
3393
+ 500: defineToken("#E61A1A"),
3394
+ 600: defineToken("#CF1717")
3325
3395
  },
3326
3396
  green: {
3327
- 300: { value: "#26D997" },
3328
- 400: { value: "#22C388" },
3329
- 500: { value: "#16A249" },
3330
- 600: { value: "#12875C" }
3397
+ 300: defineToken("#26D997"),
3398
+ 400: defineToken("#22C388"),
3399
+ 500: defineToken("#16A249"),
3400
+ 600: defineToken("#12875C")
3331
3401
  },
3332
3402
  amber: {
3333
- 300: { value: "#F7B23B" },
3334
- 400: { value: "#F6A823" },
3335
- 500: { value: "#F59F0A" },
3336
- 600: { value: "#D38909" }
3403
+ 300: defineToken("#F7B23B"),
3404
+ 400: defineToken("#F6A823"),
3405
+ 500: defineToken("#F59F0A"),
3406
+ 600: defineToken("#D38909")
3337
3407
  },
3338
3408
  cyan: {
3339
- 300: { value: "#6CC3EF" },
3340
- 400: { value: "#47B4EB" },
3341
- 500: { value: "#1791CF" },
3342
- 600: { value: "#137BAE" }
3409
+ 300: defineToken("#6CC3EF"),
3410
+ 400: defineToken("#47B4EB"),
3411
+ 500: defineToken("#1791CF"),
3412
+ 600: defineToken("#137BAE")
3343
3413
  },
3344
3414
  gray: {
3345
- 50: { value: "#FAFAFA" },
3346
- 100: { value: "#EBEBEB" },
3347
- 200: { value: "#D9D9D9" },
3348
- 300: { value: "#BDBDBD" },
3349
- 400: { value: "#999999" },
3350
- 500: { value: "#666666" },
3351
- 600: { value: "#4D4D4D" },
3352
- 700: { value: "#333333" },
3353
- 800: { value: "#2E2E2E" },
3354
- 900: { value: "#1F1F1F" },
3355
- 950: { value: "#141414" },
3356
- 1e3: { value: "#0A0A0A" }
3357
- },
3358
- white: {
3359
- value: "#FFFFFF"
3415
+ 50: defineToken("#FAFAFA"),
3416
+ 100: defineToken("#EBEBEB"),
3417
+ 200: defineToken("#D9D9D9"),
3418
+ 300: defineToken("#BDBDBD"),
3419
+ 400: defineToken("#999999"),
3420
+ 500: defineToken("#666666"),
3421
+ 600: defineToken("#4D4D4D"),
3422
+ 700: defineToken("#333333"),
3423
+ 800: defineToken("#2E2E2E"),
3424
+ 900: defineToken("#1F1F1F"),
3425
+ 950: defineToken("#141414"),
3426
+ 1e3: defineToken("#0A0A0A")
3360
3427
  },
3361
- black: {
3362
- value: "#000000"
3363
- }
3428
+ white: defineToken("#FFFFFF"),
3429
+ black: defineToken("#000000")
3364
3430
  },
3365
3431
  spacing: {
3366
- 1: { value: "0.25rem" },
3367
- 2: { value: "0.5rem" },
3368
- 3: { value: "0.75rem" },
3369
- 4: { value: "1rem" },
3370
- 5: { value: "1.25rem" },
3371
- 6: { value: "1.5rem" },
3372
- 8: { value: "2rem" },
3373
- 10: { value: "2.5rem" },
3374
- 12: { value: "3rem" },
3375
- 16: { value: "4rem" }
3432
+ 1: defineToken("0.25rem"),
3433
+ 2: defineToken("0.5rem"),
3434
+ 3: defineToken("0.75rem"),
3435
+ 4: defineToken("1rem"),
3436
+ 5: defineToken("1.25rem"),
3437
+ 6: defineToken("1.5rem"),
3438
+ 8: defineToken("2rem"),
3439
+ 10: defineToken("2.5rem"),
3440
+ 12: defineToken("3rem"),
3441
+ 16: defineToken("4rem")
3376
3442
  },
3377
3443
  radii: {
3378
- none: { value: "0" },
3379
- sm: { value: "0.25rem" },
3380
- md: { value: "0.5rem" },
3381
- lg: { value: "0.75rem" },
3382
- xl: { value: "1rem" },
3383
- full: { value: "9999px" }
3444
+ none: defineToken("0"),
3445
+ sm: defineToken("0.25rem"),
3446
+ md: defineToken("0.5rem"),
3447
+ lg: defineToken("0.75rem"),
3448
+ xl: defineToken("1rem"),
3449
+ full: defineToken("9999px")
3384
3450
  },
3385
3451
  fonts: {
3386
- body: {
3387
- value: "Inter, sans-serif"
3388
- },
3389
- heading: {
3390
- value: "Inter, sans-serif"
3391
- },
3392
- mono: {
3393
- value: "ui-monospace, SFMono-Regular, Menlo, monospace"
3394
- }
3452
+ body: defineToken("Inter, sans-serif"),
3453
+ heading: defineToken("Inter, sans-serif"),
3454
+ mono: defineToken("ui-monospace, SFMono-Regular, Menlo, monospace")
3395
3455
  },
3396
3456
  fontSizes: {
3397
- xs: { value: "0.75rem" },
3398
- sm: { value: "0.875rem" },
3399
- md: { value: "1rem" },
3400
- lg: { value: "1.125rem" },
3401
- xl: { value: "1.25rem" },
3402
- "2xl": { value: "1.5rem" },
3403
- "3xl": { value: "1.875rem" },
3404
- "4xl": { value: "2.25rem" }
3457
+ xs: defineToken("0.75rem"),
3458
+ sm: defineToken("0.875rem"),
3459
+ md: defineToken("1rem"),
3460
+ lg: defineToken("1.125rem"),
3461
+ xl: defineToken("1.25rem"),
3462
+ "2xl": defineToken("1.5rem"),
3463
+ "3xl": defineToken("1.875rem"),
3464
+ "4xl": defineToken("2.25rem")
3405
3465
  },
3406
3466
  fontWeights: {
3407
- normal: { value: "400" },
3408
- medium: { value: "500" },
3409
- semibold: { value: "600" },
3410
- bold: { value: "700" }
3467
+ normal: defineToken("400"),
3468
+ medium: defineToken("500"),
3469
+ semibold: defineToken("600"),
3470
+ bold: defineToken("700")
3411
3471
  },
3412
3472
  lineHeights: {
3413
- tight: { value: "1.25" },
3414
- normal: { value: "1.5" },
3415
- relaxed: { value: "1.75" }
3473
+ tight: defineToken("1.25"),
3474
+ normal: defineToken("1.5"),
3475
+ relaxed: defineToken("1.75")
3416
3476
  },
3417
3477
  letterSpacings: {
3418
- tighter: { value: "-0.025em" },
3419
- tight: { value: "-0.01em" },
3420
- normal: { value: "0" },
3421
- wide: { value: "0.025em" }
3478
+ tighter: defineToken("-0.025em"),
3479
+ tight: defineToken("-0.01em"),
3480
+ normal: defineToken("0"),
3481
+ wide: defineToken("0.025em")
3422
3482
  },
3423
3483
  animations: {
3424
- "slide-in-right": {
3425
- value: "slide-in-right 0.5s ease-in-out"
3426
- }
3484
+ "slide-in-right": defineToken("slide-in-right 0.5s ease-in-out")
3427
3485
  }
3428
3486
  };
3429
3487
 
3430
3488
  // src/theme/defaults/semanticTokens.ts
3431
3489
  var defaultSemanticTokens = {
3432
3490
  colors: {
3433
- brand: {
3434
- value: {
3435
- light: "{colors.blue.500}",
3436
- dark: "{colors.blue.400}"
3437
- }
3438
- },
3439
- brandHover: {
3440
- value: {
3441
- light: "{colors.blue.600}",
3442
- dark: "{colors.blue.300}"
3443
- }
3444
- },
3445
- brandFg: {
3446
- value: "{colors.white}"
3447
- },
3448
- surface: {
3449
- value: {
3450
- light: "{colors.gray.50}",
3451
- dark: "{colors.gray.900}"
3452
- }
3453
- },
3454
- surfaceRaised: {
3455
- value: {
3456
- light: "{colors.white}",
3457
- dark: "{colors.gray.800}"
3458
- }
3459
- },
3460
- surfaceSunken: {
3461
- value: {
3462
- light: "{colors.gray.100}",
3463
- dark: "{colors.gray.950}"
3464
- }
3465
- },
3466
- border: {
3467
- value: {
3468
- light: "{colors.gray.200}",
3469
- dark: "{colors.gray.600}"
3470
- }
3471
- },
3472
- text: {
3473
- value: {
3474
- light: "{colors.gray.900}",
3475
- dark: "{colors.gray.50}"
3476
- }
3477
- },
3478
- textMuted: {
3479
- value: {
3480
- light: "{colors.gray.500}",
3481
- dark: "{colors.gray.400}"
3482
- }
3483
- },
3484
- destructive: {
3485
- value: {
3486
- light: "{colors.red.500}",
3487
- dark: "{colors.red.400}"
3488
- }
3489
- },
3490
- destructiveFg: {
3491
- value: "{colors.white}"
3492
- },
3493
- destructiveHover: {
3494
- value: {
3495
- light: "{colors.red.600}",
3496
- dark: "{colors.red.300}"
3497
- }
3498
- },
3499
- success: {
3500
- value: {
3501
- light: "{colors.green.500}",
3502
- dark: "{colors.green.400}"
3503
- }
3504
- },
3505
- successFg: {
3506
- value: "{colors.white}"
3507
- },
3508
- successHover: {
3509
- value: {
3510
- light: "{colors.green.600}",
3511
- dark: "{colors.green.300}"
3512
- }
3513
- },
3514
- warning: {
3515
- value: {
3516
- light: "{colors.amber.500}",
3517
- dark: "{colors.amber.400}"
3518
- }
3519
- },
3520
- warningFg: {
3521
- value: "{colors.black}"
3522
- },
3523
- warningHover: {
3524
- value: {
3525
- light: "{colors.amber.600}",
3526
- dark: "{colors.amber.300}"
3527
- }
3528
- },
3529
- info: {
3530
- value: {
3531
- light: "{colors.cyan.500}",
3532
- dark: "{colors.cyan.400}"
3533
- }
3534
- },
3535
- infoFg: {
3536
- value: "{colors.white}"
3537
- },
3538
- infoHover: {
3539
- value: {
3540
- light: "{colors.cyan.600}",
3541
- dark: "{colors.cyan.300}"
3542
- }
3543
- }
3491
+ brand: defineSemanticToken("{colors.blue.500}", "{colors.blue.400}"),
3492
+ brandHover: defineSemanticToken("{colors.blue.600}", "{colors.blue.300}"),
3493
+ brandFg: defineToken("{colors.white}"),
3494
+ surface: defineSemanticToken("{colors.gray.50}", "{colors.gray.900}"),
3495
+ surfaceRaised: defineSemanticToken("{colors.white}", "{colors.gray.800}"),
3496
+ surfaceSunken: defineSemanticToken(
3497
+ "{colors.gray.100}",
3498
+ "{colors.gray.950}"
3499
+ ),
3500
+ border: defineSemanticToken("{colors.gray.200}", "{colors.gray.600}"),
3501
+ text: defineSemanticToken("{colors.gray.900}", "{colors.gray.50}"),
3502
+ textMuted: defineSemanticToken("{colors.gray.500}", "{colors.gray.400}"),
3503
+ destructive: defineSemanticToken("{colors.red.500}", "{colors.red.400}"),
3504
+ destructiveFg: defineToken("{colors.white}"),
3505
+ destructiveHover: defineSemanticToken(
3506
+ "{colors.red.600}",
3507
+ "{colors.red.300}"
3508
+ ),
3509
+ success: defineSemanticToken("{colors.green.500}", "{colors.green.400}"),
3510
+ successFg: defineToken("{colors.white}"),
3511
+ successHover: defineSemanticToken(
3512
+ "{colors.green.600}",
3513
+ "{colors.green.300}"
3514
+ ),
3515
+ warning: defineSemanticToken("{colors.amber.500}", "{colors.amber.400}"),
3516
+ warningFg: defineToken("{colors.black}"),
3517
+ warningHover: defineSemanticToken(
3518
+ "{colors.amber.600}",
3519
+ "{colors.amber.300}"
3520
+ ),
3521
+ info: defineSemanticToken("{colors.cyan.500}", "{colors.cyan.400}"),
3522
+ infoFg: defineToken("{colors.white}"),
3523
+ infoHover: defineSemanticToken("{colors.cyan.600}", "{colors.cyan.300}")
3524
+ }
3525
+ };
3526
+
3527
+ // src/theme/defaults/typography.ts
3528
+ var defaultTypography = {
3529
+ body: {
3530
+ fontFamily: "{fonts.body}",
3531
+ fontSize: "{fontSizes.md}",
3532
+ fontWeight: "{fontWeights.normal}",
3533
+ lineHeight: "{lineHeights.normal}"
3534
+ },
3535
+ bodySmall: {
3536
+ fontFamily: "{fonts.body}",
3537
+ fontSize: "{fontSizes.sm}",
3538
+ fontWeight: "{fontWeights.normal}",
3539
+ lineHeight: "{lineHeights.normal}"
3540
+ },
3541
+ heading: {
3542
+ fontFamily: "{fonts.heading}",
3543
+ fontSize: "{fontSizes.2xl}",
3544
+ fontWeight: "{fontWeights.bold}",
3545
+ lineHeight: "{lineHeights.tight}"
3546
+ },
3547
+ headingSmall: {
3548
+ fontFamily: "{fonts.heading}",
3549
+ fontSize: "{fontSizes.xl}",
3550
+ fontWeight: "{fontWeights.semibold}",
3551
+ lineHeight: "{lineHeights.tight}"
3552
+ },
3553
+ caption: {
3554
+ fontFamily: "{fonts.body}",
3555
+ fontSize: "{fontSizes.xs}",
3556
+ fontWeight: "{fontWeights.normal}",
3557
+ lineHeight: "{lineHeights.normal}"
3558
+ },
3559
+ mono: {
3560
+ fontFamily: "{fonts.mono}",
3561
+ fontSize: "{fontSizes.xs}",
3562
+ fontWeight: "{fontWeights.normal}",
3563
+ lineHeight: "{lineHeights.normal}"
3544
3564
  }
3545
3565
  };
3546
3566
 
@@ -3579,38 +3599,6 @@ var defaultSizes = {
3579
3599
  radius: "1.15rem"
3580
3600
  }
3581
3601
  };
3582
- var defaultTextStyles = {
3583
- body: {
3584
- fontFamily: "{fonts.body}",
3585
- fontSize: "{fontSizes.md}",
3586
- fontWeight: "{fontWeights.normal}",
3587
- lineHeight: "{lineHeights.normal}"
3588
- },
3589
- bodySmall: {
3590
- fontFamily: "{fonts.body}",
3591
- fontSize: "{fontSizes.sm}",
3592
- fontWeight: "{fontWeights.normal}",
3593
- lineHeight: "{lineHeights.normal}"
3594
- },
3595
- heading: {
3596
- fontFamily: "{fonts.heading}",
3597
- fontSize: "{fontSizes.2xl}",
3598
- fontWeight: "{fontWeights.bold}",
3599
- lineHeight: "{lineHeights.tight}"
3600
- },
3601
- headingSmall: {
3602
- fontFamily: "{fonts.heading}",
3603
- fontSize: "{fontSizes.xl}",
3604
- fontWeight: "{fontWeights.semibold}",
3605
- lineHeight: "{lineHeights.tight}"
3606
- },
3607
- caption: {
3608
- fontFamily: "{fonts.body}",
3609
- fontSize: "{fontSizes.xs}",
3610
- fontWeight: "{fontWeights.normal}",
3611
- lineHeight: "{lineHeights.normal}"
3612
- }
3613
- };
3614
3602
  var defaultRecipes = {
3615
3603
  Button: buttonRecipe,
3616
3604
  FormControl: formControlRecipe,
@@ -3619,7 +3607,7 @@ var defaultRecipes = {
3619
3607
  var defaultTheme = {
3620
3608
  tokens: defaultTokens,
3621
3609
  semanticTokens: defaultSemanticTokens,
3622
- textStyles: defaultTextStyles,
3610
+ typography: defaultTypography,
3623
3611
  recipes: defaultRecipes,
3624
3612
  intensity: 50,
3625
3613
  sizes: defaultSizes
@@ -3893,10 +3881,10 @@ function mergeSemanticTokens(base, override) {
3893
3881
  return deepMerge(base, override);
3894
3882
  }
3895
3883
  __name(mergeSemanticTokens, "mergeSemanticTokens");
3896
- function mergeTextStyles(base, override) {
3884
+ function mergeTypography(base, override) {
3897
3885
  return deepMerge(base, override);
3898
3886
  }
3899
- __name(mergeTextStyles, "mergeTextStyles");
3887
+ __name(mergeTypography, "mergeTypography");
3900
3888
  function mergeSizes(base, override) {
3901
3889
  if (!override) {
3902
3890
  return base;
@@ -3925,7 +3913,7 @@ function mergeTheme(base, override) {
3925
3913
  base.semanticTokens,
3926
3914
  override.semanticTokens
3927
3915
  ),
3928
- textStyles: mergeTextStyles(base.textStyles, override.textStyles),
3916
+ typography: mergeTypography(base.typography, override.typography),
3929
3917
  recipes: mergeRecipes(base.recipes, override.recipes),
3930
3918
  intensity: override.intensity ?? base.intensity,
3931
3919
  sizes: mergeSizes(base.sizes, override.sizes)
@@ -3933,11 +3921,10 @@ function mergeTheme(base, override) {
3933
3921
  }
3934
3922
  __name(mergeTheme, "mergeTheme");
3935
3923
  function useSystemPrefersDark() {
3936
- const [prefersDark, setPrefersDark] = react.useState(
3937
- () => typeof window !== "undefined" && window.matchMedia("(prefers-color-scheme: dark)").matches
3938
- );
3924
+ const [prefersDark, setPrefersDark] = react.useState(false);
3939
3925
  react.useEffect(() => {
3940
3926
  const mediaQuery = window.matchMedia("(prefers-color-scheme: dark)");
3927
+ setPrefersDark(mediaQuery.matches);
3941
3928
  const handleChange = /* @__PURE__ */ __name((event) => {
3942
3929
  setPrefersDark(event.matches);
3943
3930
  }, "handleChange");
@@ -4039,16 +4026,18 @@ exports.UIProvider = UIProvider;
4039
4026
  exports.cn = cn;
4040
4027
  exports.defaultRecipes = defaultRecipes;
4041
4028
  exports.defaultSizes = defaultSizes;
4042
- exports.defaultTextStyles = defaultTextStyles;
4043
4029
  exports.defaultTheme = defaultTheme;
4044
4030
  exports.hexToRgbString = hexToRgbString;
4045
4031
  exports.inputKindDefaults = inputKindDefaults;
4046
4032
  exports.rgbToHex = rgbToHex;
4047
4033
  exports.tokensToCssVars = tokensToCssVars;
4048
4034
  exports.useBreakpoint = useBreakpoint;
4035
+ exports.useFloatingSide = useFloatingSide;
4049
4036
  exports.useMultiSelectContext = useMultiSelectContext;
4050
4037
  exports.useSelectContext = useSelectContext;
4051
4038
  exports.useSizeStyle = useSizeStyle;
4039
+ exports.useStateTransition = useStateTransition;
4052
4040
  exports.useTheme = useTheme;
4041
+ exports.useTypography = useTypography;
4053
4042
  //# sourceMappingURL=index.cjs.map
4054
4043
  //# sourceMappingURL=index.cjs.map