@splenddev/kreativ-ui 0.2.5 → 0.2.7

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