@karakuri-ui/react 0.3.3 → 0.3.4

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.
Files changed (148) hide show
  1. package/README.md +27 -4
  2. package/dist/components/ui/accordion.js +27 -24
  3. package/dist/components/ui/accordion.js.map +1 -1
  4. package/dist/components/ui/accordion.mjs +27 -24
  5. package/dist/components/ui/accordion.mjs.map +1 -1
  6. package/dist/components/ui/alert.js +45 -27
  7. package/dist/components/ui/alert.js.map +1 -1
  8. package/dist/components/ui/alert.mjs +45 -27
  9. package/dist/components/ui/alert.mjs.map +1 -1
  10. package/dist/components/ui/avatar.js +41 -32
  11. package/dist/components/ui/avatar.js.map +1 -1
  12. package/dist/components/ui/avatar.mjs +41 -32
  13. package/dist/components/ui/avatar.mjs.map +1 -1
  14. package/dist/components/ui/badge.js +46 -43
  15. package/dist/components/ui/badge.js.map +1 -1
  16. package/dist/components/ui/badge.mjs +46 -43
  17. package/dist/components/ui/badge.mjs.map +1 -1
  18. package/dist/components/ui/breadcrumb.js +30 -25
  19. package/dist/components/ui/breadcrumb.js.map +1 -1
  20. package/dist/components/ui/breadcrumb.mjs +30 -25
  21. package/dist/components/ui/breadcrumb.mjs.map +1 -1
  22. package/dist/components/ui/button-group.js +6 -5
  23. package/dist/components/ui/button-group.js.map +1 -1
  24. package/dist/components/ui/button-group.mjs +6 -5
  25. package/dist/components/ui/button-group.mjs.map +1 -1
  26. package/dist/components/ui/button.js +24 -14
  27. package/dist/components/ui/button.js.map +1 -1
  28. package/dist/components/ui/button.mjs +24 -14
  29. package/dist/components/ui/button.mjs.map +1 -1
  30. package/dist/components/ui/card.js +53 -39
  31. package/dist/components/ui/card.js.map +1 -1
  32. package/dist/components/ui/card.mjs +53 -39
  33. package/dist/components/ui/card.mjs.map +1 -1
  34. package/dist/components/ui/chart.d.mts +1 -1
  35. package/dist/components/ui/chart.d.ts +1 -1
  36. package/dist/components/ui/chart.js +154 -130
  37. package/dist/components/ui/chart.js.map +1 -1
  38. package/dist/components/ui/chart.mjs +154 -130
  39. package/dist/components/ui/chart.mjs.map +1 -1
  40. package/dist/components/ui/checkbox.js +47 -40
  41. package/dist/components/ui/checkbox.js.map +1 -1
  42. package/dist/components/ui/checkbox.mjs +47 -40
  43. package/dist/components/ui/checkbox.mjs.map +1 -1
  44. package/dist/components/ui/divider.js +16 -13
  45. package/dist/components/ui/divider.js.map +1 -1
  46. package/dist/components/ui/divider.mjs +16 -13
  47. package/dist/components/ui/divider.mjs.map +1 -1
  48. package/dist/components/ui/drawer.js +44 -35
  49. package/dist/components/ui/drawer.js.map +1 -1
  50. package/dist/components/ui/drawer.mjs +44 -35
  51. package/dist/components/ui/drawer.mjs.map +1 -1
  52. package/dist/components/ui/dropdown.js +31 -24
  53. package/dist/components/ui/dropdown.js.map +1 -1
  54. package/dist/components/ui/dropdown.mjs +31 -24
  55. package/dist/components/ui/dropdown.mjs.map +1 -1
  56. package/dist/components/ui/field.js +18 -15
  57. package/dist/components/ui/field.js.map +1 -1
  58. package/dist/components/ui/field.mjs +18 -15
  59. package/dist/components/ui/field.mjs.map +1 -1
  60. package/dist/components/ui/icon-button.js +17 -14
  61. package/dist/components/ui/icon-button.js.map +1 -1
  62. package/dist/components/ui/icon-button.mjs +17 -14
  63. package/dist/components/ui/icon-button.mjs.map +1 -1
  64. package/dist/components/ui/input.js +34 -29
  65. package/dist/components/ui/input.js.map +1 -1
  66. package/dist/components/ui/input.mjs +34 -29
  67. package/dist/components/ui/input.mjs.map +1 -1
  68. package/dist/components/ui/metric-card.js +24 -21
  69. package/dist/components/ui/metric-card.js.map +1 -1
  70. package/dist/components/ui/metric-card.mjs +24 -21
  71. package/dist/components/ui/metric-card.mjs.map +1 -1
  72. package/dist/components/ui/modal.js +91 -74
  73. package/dist/components/ui/modal.js.map +1 -1
  74. package/dist/components/ui/modal.mjs +91 -74
  75. package/dist/components/ui/modal.mjs.map +1 -1
  76. package/dist/components/ui/navigation-menu.js +114 -93
  77. package/dist/components/ui/navigation-menu.js.map +1 -1
  78. package/dist/components/ui/navigation-menu.mjs +114 -93
  79. package/dist/components/ui/navigation-menu.mjs.map +1 -1
  80. package/dist/components/ui/pagination.js +66 -55
  81. package/dist/components/ui/pagination.js.map +1 -1
  82. package/dist/components/ui/pagination.mjs +66 -55
  83. package/dist/components/ui/pagination.mjs.map +1 -1
  84. package/dist/components/ui/popover.js +39 -36
  85. package/dist/components/ui/popover.js.map +1 -1
  86. package/dist/components/ui/popover.mjs +39 -36
  87. package/dist/components/ui/popover.mjs.map +1 -1
  88. package/dist/components/ui/progress.js +73 -64
  89. package/dist/components/ui/progress.js.map +1 -1
  90. package/dist/components/ui/progress.mjs +73 -64
  91. package/dist/components/ui/progress.mjs.map +1 -1
  92. package/dist/components/ui/radio-group.js +23 -19
  93. package/dist/components/ui/radio-group.js.map +1 -1
  94. package/dist/components/ui/radio-group.mjs +23 -19
  95. package/dist/components/ui/radio-group.mjs.map +1 -1
  96. package/dist/components/ui/segmented.js +7 -6
  97. package/dist/components/ui/segmented.js.map +1 -1
  98. package/dist/components/ui/segmented.mjs +7 -6
  99. package/dist/components/ui/segmented.mjs.map +1 -1
  100. package/dist/components/ui/select.js +55 -48
  101. package/dist/components/ui/select.js.map +1 -1
  102. package/dist/components/ui/select.mjs +55 -48
  103. package/dist/components/ui/select.mjs.map +1 -1
  104. package/dist/components/ui/skeleton.js +20 -19
  105. package/dist/components/ui/skeleton.js.map +1 -1
  106. package/dist/components/ui/skeleton.mjs +20 -19
  107. package/dist/components/ui/skeleton.mjs.map +1 -1
  108. package/dist/components/ui/slider.js +68 -58
  109. package/dist/components/ui/slider.js.map +1 -1
  110. package/dist/components/ui/slider.mjs +68 -58
  111. package/dist/components/ui/slider.mjs.map +1 -1
  112. package/dist/components/ui/spinner.js +185 -176
  113. package/dist/components/ui/spinner.js.map +1 -1
  114. package/dist/components/ui/spinner.mjs +185 -176
  115. package/dist/components/ui/spinner.mjs.map +1 -1
  116. package/dist/components/ui/switch.js +39 -28
  117. package/dist/components/ui/switch.js.map +1 -1
  118. package/dist/components/ui/switch.mjs +39 -28
  119. package/dist/components/ui/switch.mjs.map +1 -1
  120. package/dist/components/ui/table.js +26 -23
  121. package/dist/components/ui/table.js.map +1 -1
  122. package/dist/components/ui/table.mjs +26 -23
  123. package/dist/components/ui/table.mjs.map +1 -1
  124. package/dist/components/ui/tabs.js +25 -9
  125. package/dist/components/ui/tabs.js.map +1 -1
  126. package/dist/components/ui/tabs.mjs +25 -9
  127. package/dist/components/ui/tabs.mjs.map +1 -1
  128. package/dist/components/ui/textarea.js +2 -1
  129. package/dist/components/ui/textarea.js.map +1 -1
  130. package/dist/components/ui/textarea.mjs +2 -1
  131. package/dist/components/ui/textarea.mjs.map +1 -1
  132. package/dist/components/ui/toast.js +104 -80
  133. package/dist/components/ui/toast.js.map +1 -1
  134. package/dist/components/ui/toast.mjs +104 -80
  135. package/dist/components/ui/toast.mjs.map +1 -1
  136. package/dist/components/ui/toggle-group.js +9 -8
  137. package/dist/components/ui/toggle-group.js.map +1 -1
  138. package/dist/components/ui/toggle-group.mjs +9 -8
  139. package/dist/components/ui/toggle-group.mjs.map +1 -1
  140. package/dist/components/ui/toggle.js +3 -2
  141. package/dist/components/ui/toggle.js.map +1 -1
  142. package/dist/components/ui/toggle.mjs +3 -2
  143. package/dist/components/ui/toggle.mjs.map +1 -1
  144. package/dist/components/ui/tooltip.js +18 -15
  145. package/dist/components/ui/tooltip.js.map +1 -1
  146. package/dist/components/ui/tooltip.mjs +18 -15
  147. package/dist/components/ui/tooltip.mjs.map +1 -1
  148. package/package.json +27 -19
@@ -33,6 +33,7 @@ __export(skeleton_exports, {
33
33
  skeletonVariants: () => skeletonVariants
34
34
  });
35
35
  module.exports = __toCommonJS(skeleton_exports);
36
+ var import_jsx_runtime = require("react/jsx-runtime");
36
37
  var React = __toESM(require("react"));
37
38
  var import_class_variance_authority = require("class-variance-authority");
38
39
  var import_utils = require("../../lib/utils");
@@ -72,7 +73,7 @@ const SkeletonBlock = React.forwardRef(
72
73
  style,
73
74
  ...props
74
75
  }, ref) => {
75
- return /* @__PURE__ */ React.createElement(
76
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
76
77
  "div",
77
78
  {
78
79
  ref,
@@ -90,18 +91,18 @@ const SkeletonBlock = React.forwardRef(
90
91
  ...radius != null ? { borderRadius: radius } : {},
91
92
  ...animation === "pulse" ? { animationDuration: `${PULSE_DURATION_MS}ms` } : {}
92
93
  },
93
- ...props
94
- },
95
- animation === "wave" && /* @__PURE__ */ React.createElement(
96
- "div",
97
- {
98
- className: "absolute inset-0 animate-skeleton-wave",
99
- style: {
100
- animationDuration: `${WAVE_DURATION_MS}ms`,
101
- background: `linear-gradient(90deg, ${WAVE_GRADIENT})`
94
+ ...props,
95
+ children: animation === "wave" && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
96
+ "div",
97
+ {
98
+ className: "absolute inset-0 animate-skeleton-wave",
99
+ style: {
100
+ animationDuration: `${WAVE_DURATION_MS}ms`,
101
+ background: `linear-gradient(90deg, ${WAVE_GRADIENT})`
102
+ }
102
103
  }
103
- }
104
- )
104
+ )
105
+ }
105
106
  );
106
107
  }
107
108
  );
@@ -115,24 +116,24 @@ const Skeleton = React.forwardRef(
115
116
  ...rest
116
117
  }, ref) => {
117
118
  if (loading !== void 0) {
118
- if (!loading) return /* @__PURE__ */ React.createElement(React.Fragment, null, children);
119
+ if (!loading) return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_jsx_runtime.Fragment, { children });
119
120
  }
120
121
  if (count != null && count > 1 && variant === "text") {
121
- return /* @__PURE__ */ React.createElement("div", { ref, className: "space-y-2.5", "aria-hidden": "true" }, Array.from({ length: count }, (_, i) => {
122
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { ref, className: "space-y-2.5", "aria-hidden": "true", children: Array.from({ length: count }, (_, i) => {
122
123
  const widthPattern = MULTI_LINE_WIDTHS[i % MULTI_LINE_WIDTHS.length];
123
124
  const isLast = i === count - 1;
124
- return /* @__PURE__ */ React.createElement(
125
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
125
126
  SkeletonBlock,
126
127
  {
127
- key: i,
128
128
  variant: "text",
129
129
  style: { width: isLast ? "60%" : widthPattern },
130
130
  ...rest
131
- }
131
+ },
132
+ i
132
133
  );
133
- }));
134
+ }) });
134
135
  }
135
- return /* @__PURE__ */ React.createElement(SkeletonBlock, { ref, variant, ...rest });
136
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(SkeletonBlock, { ref, variant, ...rest });
136
137
  }
137
138
  );
138
139
  Skeleton.displayName = "Skeleton";
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/components/ui/skeleton.tsx"],"sourcesContent":["'use client'\n\nimport * as React from 'react'\nimport { cva, type VariantProps } from 'class-variance-authority'\nimport { cn } from '../../lib/utils'\n\n// ============================================================================\n// Constants\n// ============================================================================\n\n/** Pulse animation duration in ms (slower = more premium) */\nconst PULSE_DURATION_MS = 2000\n/** Wave animation duration in ms */\nconst WAVE_DURATION_MS = 1800\n\n/**\n * Wave shimmer gradient — wide sweep with soft edges.\n * 5 gradient stops create a broader, smoother light band.\n */\nconst WAVE_GRADIENT = [\n 'transparent 0%',\n 'transparent 30%',\n 'var(--color-background-elevated) 50%',\n 'transparent 70%',\n 'transparent 100%',\n].join(', ')\n\n/**\n * Multi-line text width pattern.\n * Last line is always shorter for natural appearance.\n */\nconst MULTI_LINE_WIDTHS = ['100%', '92%', '100%', '85%', '75%'] as const\n\n// ============================================================================\n// Variants (CVA)\n// ============================================================================\n\nconst skeletonVariants = cva(\n 'bg-background-muted',\n {\n variants: {\n variant: {\n text: 'rounded-md h-4 w-full',\n circular: 'rounded-full w-10 h-10',\n rectangular: 'rounded-xl w-full h-24',\n },\n },\n defaultVariants: {\n variant: 'text',\n },\n }\n)\n\n// ============================================================================\n// Types\n// ============================================================================\n\nexport interface SkeletonProps\n extends React.HTMLAttributes<HTMLDivElement>,\n VariantProps<typeof skeletonVariants> {\n /** Animation style */\n animation?: 'pulse' | 'wave' | false\n /** Custom width */\n width?: string | number\n /** Custom height */\n height?: string | number\n /** Custom border radius */\n radius?: string | number\n /** Number of text lines (text variant only, generates stacked lines) */\n count?: number\n /** Conditional loading — true: show skeleton, false: render children */\n loading?: boolean\n /** Children to render when loading=false */\n children?: React.ReactNode\n}\n\n// ============================================================================\n// Component\n// ============================================================================\n\nconst SkeletonBlock = React.forwardRef<HTMLDivElement, Omit<SkeletonProps, 'count' | 'loading' | 'children'>>(\n ({\n className,\n variant = 'text',\n animation = 'pulse',\n width,\n height,\n radius,\n style,\n ...props\n }, ref) => {\n return (\n <div\n ref={ref}\n aria-hidden=\"true\"\n className={cn(\n skeletonVariants({ variant }),\n animation === 'pulse' && 'animate-skeleton-pulse',\n animation === 'wave' && 'relative overflow-hidden',\n className,\n )}\n style={{\n ...style,\n ...(width != null ? { width } : {}),\n ...(height != null ? { height } : {}),\n ...(radius != null ? { borderRadius: radius } : {}),\n ...(animation === 'pulse' ? { animationDuration: `${PULSE_DURATION_MS}ms` } : {}),\n }}\n {...props}\n >\n {animation === 'wave' && (\n <div\n className=\"absolute inset-0 animate-skeleton-wave\"\n style={{\n animationDuration: `${WAVE_DURATION_MS}ms`,\n background: `linear-gradient(90deg, ${WAVE_GRADIENT})`,\n }}\n />\n )}\n </div>\n )\n }\n)\nSkeletonBlock.displayName = 'SkeletonBlock'\n\nconst Skeleton = React.forwardRef<HTMLDivElement, SkeletonProps>(\n ({\n count,\n loading,\n children,\n variant = 'text',\n ...rest\n }, ref) => {\n // loading mode — show skeleton or children\n if (loading !== undefined) {\n if (!loading) return <>{children}</>\n // When loading, fall through to render skeleton\n }\n\n // count mode — render multiple text lines\n if (count != null && count > 1 && variant === 'text') {\n return (\n <div ref={ref} className=\"space-y-2.5\" aria-hidden=\"true\">\n {Array.from({ length: count }, (_, i) => {\n const widthPattern = MULTI_LINE_WIDTHS[i % MULTI_LINE_WIDTHS.length]\n const isLast = i === count - 1\n return (\n <SkeletonBlock\n key={i}\n variant=\"text\"\n style={{ width: isLast ? '60%' : widthPattern }}\n {...rest}\n />\n )\n })}\n </div>\n )\n }\n\n return <SkeletonBlock ref={ref} variant={variant} {...rest} />\n }\n)\nSkeleton.displayName = 'Skeleton'\n\nexport { Skeleton, skeletonVariants }\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAEA,YAAuB;AACvB,sCAAuC;AACvC,mBAAmB;AAOnB,MAAM,oBAAoB;AAE1B,MAAM,mBAAmB;AAMzB,MAAM,gBAAgB;AAAA,EACpB;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,EAAE,KAAK,IAAI;AAMX,MAAM,oBAAoB,CAAC,QAAQ,OAAO,QAAQ,OAAO,KAAK;AAM9D,MAAM,uBAAmB;AAAA,EACvB;AAAA,EACA;AAAA,IACE,UAAU;AAAA,MACR,SAAS;AAAA,QACP,MAAM;AAAA,QACN,UAAU;AAAA,QACV,aAAa;AAAA,MACf;AAAA,IACF;AAAA,IACA,iBAAiB;AAAA,MACf,SAAS;AAAA,IACX;AAAA,EACF;AACF;AA6BA,MAAM,gBAAgB,MAAM;AAAA,EAC1B,CAAC;AAAA,IACC;AAAA,IACA,UAAU;AAAA,IACV,YAAY;AAAA,IACZ;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA,GAAG;AAAA,EACL,GAAG,QAAQ;AACT,WACE;AAAA,MAAC;AAAA;AAAA,QACC;AAAA,QACA,eAAY;AAAA,QACZ,eAAW;AAAA,UACT,iBAAiB,EAAE,QAAQ,CAAC;AAAA,UAC5B,cAAc,WAAW;AAAA,UACzB,cAAc,UAAU;AAAA,UACxB;AAAA,QACF;AAAA,QACA,OAAO;AAAA,UACL,GAAG;AAAA,UACH,GAAI,SAAS,OAAO,EAAE,MAAM,IAAI,CAAC;AAAA,UACjC,GAAI,UAAU,OAAO,EAAE,OAAO,IAAI,CAAC;AAAA,UACnC,GAAI,UAAU,OAAO,EAAE,cAAc,OAAO,IAAI,CAAC;AAAA,UACjD,GAAI,cAAc,UAAU,EAAE,mBAAmB,GAAG,iBAAiB,KAAK,IAAI,CAAC;AAAA,QACjF;AAAA,QACC,GAAG;AAAA;AAAA,MAEH,cAAc,UACb;AAAA,QAAC;AAAA;AAAA,UACC,WAAU;AAAA,UACV,OAAO;AAAA,YACL,mBAAmB,GAAG,gBAAgB;AAAA,YACtC,YAAY,0BAA0B,aAAa;AAAA,UACrD;AAAA;AAAA,MACF;AAAA,IAEJ;AAAA,EAEJ;AACF;AACA,cAAc,cAAc;AAE5B,MAAM,WAAW,MAAM;AAAA,EACrB,CAAC;AAAA,IACC;AAAA,IACA;AAAA,IACA;AAAA,IACA,UAAU;AAAA,IACV,GAAG;AAAA,EACL,GAAG,QAAQ;AAET,QAAI,YAAY,QAAW;AACzB,UAAI,CAAC,QAAS,QAAO,0DAAG,QAAS;AAAA,IAEnC;AAGA,QAAI,SAAS,QAAQ,QAAQ,KAAK,YAAY,QAAQ;AACpD,aACE,oCAAC,SAAI,KAAU,WAAU,eAAc,eAAY,UAChD,MAAM,KAAK,EAAE,QAAQ,MAAM,GAAG,CAAC,GAAG,MAAM;AACvC,cAAM,eAAe,kBAAkB,IAAI,kBAAkB,MAAM;AACnE,cAAM,SAAS,MAAM,QAAQ;AAC7B,eACE;AAAA,UAAC;AAAA;AAAA,YACC,KAAK;AAAA,YACL,SAAQ;AAAA,YACR,OAAO,EAAE,OAAO,SAAS,QAAQ,aAAa;AAAA,YAC7C,GAAG;AAAA;AAAA,QACN;AAAA,MAEJ,CAAC,CACH;AAAA,IAEJ;AAEA,WAAO,oCAAC,iBAAc,KAAU,SAAmB,GAAG,MAAM;AAAA,EAC9D;AACF;AACA,SAAS,cAAc;","names":[]}
1
+ {"version":3,"sources":["../../../src/components/ui/skeleton.tsx"],"sourcesContent":["'use client'\n\nimport * as React from 'react'\nimport { cva, type VariantProps } from 'class-variance-authority'\nimport { cn } from '../../lib/utils'\n\n// ============================================================================\n// Constants\n// ============================================================================\n\n/** Pulse animation duration in ms (slower = more premium) */\nconst PULSE_DURATION_MS = 2000\n/** Wave animation duration in ms */\nconst WAVE_DURATION_MS = 1800\n\n/**\n * Wave shimmer gradient — wide sweep with soft edges.\n * 5 gradient stops create a broader, smoother light band.\n */\nconst WAVE_GRADIENT = [\n 'transparent 0%',\n 'transparent 30%',\n 'var(--color-background-elevated) 50%',\n 'transparent 70%',\n 'transparent 100%',\n].join(', ')\n\n/**\n * Multi-line text width pattern.\n * Last line is always shorter for natural appearance.\n */\nconst MULTI_LINE_WIDTHS = ['100%', '92%', '100%', '85%', '75%'] as const\n\n// ============================================================================\n// Variants (CVA)\n// ============================================================================\n\nconst skeletonVariants = cva(\n 'bg-background-muted',\n {\n variants: {\n variant: {\n text: 'rounded-md h-4 w-full',\n circular: 'rounded-full w-10 h-10',\n rectangular: 'rounded-xl w-full h-24',\n },\n },\n defaultVariants: {\n variant: 'text',\n },\n }\n)\n\n// ============================================================================\n// Types\n// ============================================================================\n\nexport interface SkeletonProps\n extends React.HTMLAttributes<HTMLDivElement>,\n VariantProps<typeof skeletonVariants> {\n /** Animation style */\n animation?: 'pulse' | 'wave' | false\n /** Custom width */\n width?: string | number\n /** Custom height */\n height?: string | number\n /** Custom border radius */\n radius?: string | number\n /** Number of text lines (text variant only, generates stacked lines) */\n count?: number\n /** Conditional loading — true: show skeleton, false: render children */\n loading?: boolean\n /** Children to render when loading=false */\n children?: React.ReactNode\n}\n\n// ============================================================================\n// Component\n// ============================================================================\n\nconst SkeletonBlock = React.forwardRef<HTMLDivElement, Omit<SkeletonProps, 'count' | 'loading' | 'children'>>(\n ({\n className,\n variant = 'text',\n animation = 'pulse',\n width,\n height,\n radius,\n style,\n ...props\n }, ref) => {\n return (\n <div\n ref={ref}\n aria-hidden=\"true\"\n className={cn(\n skeletonVariants({ variant }),\n animation === 'pulse' && 'animate-skeleton-pulse',\n animation === 'wave' && 'relative overflow-hidden',\n className,\n )}\n style={{\n ...style,\n ...(width != null ? { width } : {}),\n ...(height != null ? { height } : {}),\n ...(radius != null ? { borderRadius: radius } : {}),\n ...(animation === 'pulse' ? { animationDuration: `${PULSE_DURATION_MS}ms` } : {}),\n }}\n {...props}\n >\n {animation === 'wave' && (\n <div\n className=\"absolute inset-0 animate-skeleton-wave\"\n style={{\n animationDuration: `${WAVE_DURATION_MS}ms`,\n background: `linear-gradient(90deg, ${WAVE_GRADIENT})`,\n }}\n />\n )}\n </div>\n )\n }\n)\nSkeletonBlock.displayName = 'SkeletonBlock'\n\nconst Skeleton = React.forwardRef<HTMLDivElement, SkeletonProps>(\n ({\n count,\n loading,\n children,\n variant = 'text',\n ...rest\n }, ref) => {\n // loading mode — show skeleton or children\n if (loading !== undefined) {\n if (!loading) return <>{children}</>\n // When loading, fall through to render skeleton\n }\n\n // count mode — render multiple text lines\n if (count != null && count > 1 && variant === 'text') {\n return (\n <div ref={ref} className=\"space-y-2.5\" aria-hidden=\"true\">\n {Array.from({ length: count }, (_, i) => {\n const widthPattern = MULTI_LINE_WIDTHS[i % MULTI_LINE_WIDTHS.length]\n const isLast = i === count - 1\n return (\n <SkeletonBlock\n key={i}\n variant=\"text\"\n style={{ width: isLast ? '60%' : widthPattern }}\n {...rest}\n />\n )\n })}\n </div>\n )\n }\n\n return <SkeletonBlock ref={ref} variant={variant} {...rest} />\n }\n)\nSkeleton.displayName = 'Skeleton'\n\nexport { Skeleton, skeletonVariants }\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AA+GU;AA7GV,YAAuB;AACvB,sCAAuC;AACvC,mBAAmB;AAOnB,MAAM,oBAAoB;AAE1B,MAAM,mBAAmB;AAMzB,MAAM,gBAAgB;AAAA,EACpB;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,EAAE,KAAK,IAAI;AAMX,MAAM,oBAAoB,C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AU;AAAA,IACV,GAAG;AAAA,EACL,GAAG,QAAQ;AAET,QAAI,YAAY,QAAW;AACzB,UAAI,CAAC,QAAS,QAAO,2EAAG,UAAS;AAAA,IAEnC;AAGA,QAAI,SAAS,QAAQ,QAAQ,KAAK,YAAY,QAAQ;AACpD,aACE,4CAAC,SAAI,KAAU,WAAU,eAAc,eAAY,QAChD,gBAAM,KAAK,EAAE,QAAQ,MAAM,GAAG,CAAC,GAAG,MAAM;AACvC,cAAM,eAAe,kBAAkB,IAAI,kBAAkB,MAAM;AACnE,cAAM,SAAS,MAAM,QAAQ;AAC7B,eACE;AAAA,UAAC;AAAA;AAAA,YAEC,SAAQ;AAAA,YACR,OAAO,EAAE,OAAO,SAAS,QAAQ,aAAa;AAAA,YAC7C,GAAG;AAAA;AAAA,UAHC;AAAA,QAIP;AAAA,MAEJ,CAAC,GACH;AAAA,IAEJ;AAEA,WAAO,4CAAC,iBAAc,KAAU,SAAmB,GAAG,MAAM;AAAA,EAC9D;AACF;AACA,SAAS,cAAc;","names":[]}
@@ -1,4 +1,5 @@
1
1
  "use client";
2
+ import { Fragment, jsx } from "react/jsx-runtime";
2
3
  import * as React from "react";
3
4
  import { cva } from "class-variance-authority";
4
5
  import { cn } from "../../lib/utils";
@@ -38,7 +39,7 @@ const SkeletonBlock = React.forwardRef(
38
39
  style,
39
40
  ...props
40
41
  }, ref) => {
41
- return /* @__PURE__ */ React.createElement(
42
+ return /* @__PURE__ */ jsx(
42
43
  "div",
43
44
  {
44
45
  ref,
@@ -56,18 +57,18 @@ const SkeletonBlock = React.forwardRef(
56
57
  ...radius != null ? { borderRadius: radius } : {},
57
58
  ...animation === "pulse" ? { animationDuration: `${PULSE_DURATION_MS}ms` } : {}
58
59
  },
59
- ...props
60
- },
61
- animation === "wave" && /* @__PURE__ */ React.createElement(
62
- "div",
63
- {
64
- className: "absolute inset-0 animate-skeleton-wave",
65
- style: {
66
- animationDuration: `${WAVE_DURATION_MS}ms`,
67
- background: `linear-gradient(90deg, ${WAVE_GRADIENT})`
60
+ ...props,
61
+ children: animation === "wave" && /* @__PURE__ */ jsx(
62
+ "div",
63
+ {
64
+ className: "absolute inset-0 animate-skeleton-wave",
65
+ style: {
66
+ animationDuration: `${WAVE_DURATION_MS}ms`,
67
+ background: `linear-gradient(90deg, ${WAVE_GRADIENT})`
68
+ }
68
69
  }
69
- }
70
- )
70
+ )
71
+ }
71
72
  );
72
73
  }
73
74
  );
@@ -81,24 +82,24 @@ const Skeleton = React.forwardRef(
81
82
  ...rest
82
83
  }, ref) => {
83
84
  if (loading !== void 0) {
84
- if (!loading) return /* @__PURE__ */ React.createElement(React.Fragment, null, children);
85
+ if (!loading) return /* @__PURE__ */ jsx(Fragment, { children });
85
86
  }
86
87
  if (count != null && count > 1 && variant === "text") {
87
- return /* @__PURE__ */ React.createElement("div", { ref, className: "space-y-2.5", "aria-hidden": "true" }, Array.from({ length: count }, (_, i) => {
88
+ return /* @__PURE__ */ jsx("div", { ref, className: "space-y-2.5", "aria-hidden": "true", children: Array.from({ length: count }, (_, i) => {
88
89
  const widthPattern = MULTI_LINE_WIDTHS[i % MULTI_LINE_WIDTHS.length];
89
90
  const isLast = i === count - 1;
90
- return /* @__PURE__ */ React.createElement(
91
+ return /* @__PURE__ */ jsx(
91
92
  SkeletonBlock,
92
93
  {
93
- key: i,
94
94
  variant: "text",
95
95
  style: { width: isLast ? "60%" : widthPattern },
96
96
  ...rest
97
- }
97
+ },
98
+ i
98
99
  );
99
- }));
100
+ }) });
100
101
  }
101
- return /* @__PURE__ */ React.createElement(SkeletonBlock, { ref, variant, ...rest });
102
+ return /* @__PURE__ */ jsx(SkeletonBlock, { ref, variant, ...rest });
102
103
  }
103
104
  );
104
105
  Skeleton.displayName = "Skeleton";
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/components/ui/skeleton.tsx"],"sourcesContent":["'use client'\n\nimport * as React from 'react'\nimport { cva, type VariantProps } from 'class-variance-authority'\nimport { cn } from '../../lib/utils'\n\n// ============================================================================\n// Constants\n// ============================================================================\n\n/** Pulse animation duration in ms (slower = more premium) */\nconst PULSE_DURATION_MS = 2000\n/** Wave animation duration in ms */\nconst WAVE_DURATION_MS = 1800\n\n/**\n * Wave shimmer gradient — wide sweep with soft edges.\n * 5 gradient stops create a broader, smoother light band.\n */\nconst WAVE_GRADIENT = [\n 'transparent 0%',\n 'transparent 30%',\n 'var(--color-background-elevated) 50%',\n 'transparent 70%',\n 'transparent 100%',\n].join(', ')\n\n/**\n * Multi-line text width pattern.\n * Last line is always shorter for natural appearance.\n */\nconst MULTI_LINE_WIDTHS = ['100%', '92%', '100%', '85%', '75%'] as const\n\n// ============================================================================\n// Variants (CVA)\n// ============================================================================\n\nconst skeletonVariants = cva(\n 'bg-background-muted',\n {\n variants: {\n variant: {\n text: 'rounded-md h-4 w-full',\n circular: 'rounded-full w-10 h-10',\n rectangular: 'rounded-xl w-full h-24',\n },\n },\n defaultVariants: {\n variant: 'text',\n },\n }\n)\n\n// ============================================================================\n// Types\n// ============================================================================\n\nexport interface SkeletonProps\n extends React.HTMLAttributes<HTMLDivElement>,\n VariantProps<typeof skeletonVariants> {\n /** Animation style */\n animation?: 'pulse' | 'wave' | false\n /** Custom width */\n width?: string | number\n /** Custom height */\n height?: string | number\n /** Custom border radius */\n radius?: string | number\n /** Number of text lines (text variant only, generates stacked lines) */\n count?: number\n /** Conditional loading — true: show skeleton, false: render children */\n loading?: boolean\n /** Children to render when loading=false */\n children?: React.ReactNode\n}\n\n// ============================================================================\n// Component\n// ============================================================================\n\nconst SkeletonBlock = React.forwardRef<HTMLDivElement, Omit<SkeletonProps, 'count' | 'loading' | 'children'>>(\n ({\n className,\n variant = 'text',\n animation = 'pulse',\n width,\n height,\n radius,\n style,\n ...props\n }, ref) => {\n return (\n <div\n ref={ref}\n aria-hidden=\"true\"\n className={cn(\n skeletonVariants({ variant }),\n animation === 'pulse' && 'animate-skeleton-pulse',\n animation === 'wave' && 'relative overflow-hidden',\n className,\n )}\n style={{\n ...style,\n ...(width != null ? { width } : {}),\n ...(height != null ? { height } : {}),\n ...(radius != null ? { borderRadius: radius } : {}),\n ...(animation === 'pulse' ? { animationDuration: `${PULSE_DURATION_MS}ms` } : {}),\n }}\n {...props}\n >\n {animation === 'wave' && (\n <div\n className=\"absolute inset-0 animate-skeleton-wave\"\n style={{\n animationDuration: `${WAVE_DURATION_MS}ms`,\n background: `linear-gradient(90deg, ${WAVE_GRADIENT})`,\n }}\n />\n )}\n </div>\n )\n }\n)\nSkeletonBlock.displayName = 'SkeletonBlock'\n\nconst Skeleton = React.forwardRef<HTMLDivElement, SkeletonProps>(\n ({\n count,\n loading,\n children,\n variant = 'text',\n ...rest\n }, ref) => {\n // loading mode — show skeleton or children\n if (loading !== undefined) {\n if (!loading) return <>{children}</>\n // When loading, fall through to render skeleton\n }\n\n // count mode — render multiple text lines\n if (count != null && count > 1 && variant === 'text') {\n return (\n <div ref={ref} className=\"space-y-2.5\" aria-hidden=\"true\">\n {Array.from({ length: count }, (_, i) => {\n const widthPattern = MULTI_LINE_WIDTHS[i % MULTI_LINE_WIDTHS.length]\n const isLast = i === count - 1\n return (\n <SkeletonBlock\n key={i}\n variant=\"text\"\n style={{ width: isLast ? '60%' : widthPattern }}\n {...rest}\n />\n )\n })}\n </div>\n )\n }\n\n return <SkeletonBlock ref={ref} variant={variant} {...rest} />\n }\n)\nSkeleton.displayName = 'Skeleton'\n\nexport { Skeleton, skeletonVariants }\n"],"mappings":";AAEA,YAAY,WAAW;AACvB,SAAS,WAA8B;AACvC,SAAS,UAAU;AAOnB,MAAM,oBAAoB;AAE1B,MAAM,mBAAmB;AAMzB,MAAM,gBAAgB;AAAA,EACpB;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,EAAE,KAAK,IAAI;AAMX,MAAM,oBAAoB,CAAC,QAAQ,OAAO,QAAQ,OAAO,KAAK;AAM9D,MAAM,mBAAmB;AAAA,EACvB;AAAA,EACA;AAAA,IACE,UAAU;AAAA,MACR,SA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AA,IAEnC;AAGA,QAAI,SAAS,QAAQ,QAAQ,KAAK,YAAY,QAAQ;AACpD,aACE,oCAAC,SAAI,KAAU,WAAU,eAAc,eAAY,UAChD,MAAM,KAAK,EAAE,QAAQ,MAAM,GAAG,CAAC,GAAG,MAAM;AACvC,cAAM,eAAe,kBAAkB,IAAI,kBAAkB,MAAM;AACnE,cAAM,SAAS,MAAM,QAAQ;AAC7B,eACE;AAAA,UAAC;AAAA;AAAA,YACC,KAAK;AAAA,YACL,SAAQ;AAAA,YACR,OAAO,EAAE,OAAO,SAAS,QAAQ,aAAa;AAAA,YAC7C,GAAG;AAAA;AAAA,QACN;AAAA,MAEJ,CAAC,CACH;AAAA,IAEJ;AAEA,WAAO,oCAAC,iBAAc,KAAU,SAAmB,GAAG,MAAM;AAAA,EAC9D;AACF;AACA,SAAS,cAAc;","names":[]}
1
+ {"version":3,"sources":["../../../src/components/ui/skeleton.tsx"],"sourcesContent":["'use client'\n\nimport * as React from 'react'\nimport { cva, type VariantProps } from 'class-variance-authority'\nimport { cn } from '../../lib/utils'\n\n// ============================================================================\n// Constants\n// ============================================================================\n\n/** Pulse animation duration in ms (slower = more premium) */\nconst PULSE_DURATION_MS = 2000\n/** Wave animation duration in ms */\nconst WAVE_DURATION_MS = 1800\n\n/**\n * Wave shimmer gradient — wide sweep with soft edges.\n * 5 gradient stops create a broader, smoother light band.\n */\nconst WAVE_GRADIENT = [\n 'transparent 0%',\n 'transparent 30%',\n 'var(--color-background-elevated) 50%',\n 'transparent 70%',\n 'transparent 100%',\n].join(', ')\n\n/**\n * Multi-line text width pattern.\n * Last line is always shorter for natural appearance.\n */\nconst MULTI_LINE_WIDTHS = ['100%', '92%', '100%', '85%', '75%'] as const\n\n// ============================================================================\n// Variants (CVA)\n// ============================================================================\n\nconst skeletonVariants = cva(\n 'bg-background-muted',\n {\n variants: {\n variant: {\n text: 'rounded-md h-4 w-full',\n circular: 'rounded-full w-10 h-10',\n rectangular: 'rounded-xl w-full h-24',\n },\n },\n defaultVariants: {\n variant: 'text',\n },\n }\n)\n\n// ============================================================================\n// Types\n// ============================================================================\n\nexport interface SkeletonProps\n extends React.HTMLAttributes<HTMLDivElement>,\n VariantProps<typeof skeletonVariants> {\n /** Animation style */\n animation?: 'pulse' | 'wave' | false\n /** Custom width */\n width?: string | number\n /** Custom height */\n height?: string | number\n /** Custom border radius */\n radius?: string | number\n /** Number of text lines (text variant only, generates stacked lines) */\n count?: number\n /** Conditional loading — true: show skeleton, false: render children */\n loading?: boolean\n /** Children to render when loading=false */\n children?: React.ReactNode\n}\n\n// ============================================================================\n// Component\n// ============================================================================\n\nconst SkeletonBlock = React.forwardRef<HTMLDivElement, Omit<SkeletonProps, 'count' | 'loading' | 'children'>>(\n ({\n className,\n variant = 'text',\n animation = 'pulse',\n width,\n height,\n radius,\n style,\n ...props\n }, ref) => {\n return (\n <div\n ref={ref}\n aria-hidden=\"true\"\n className={cn(\n skeletonVariants({ variant }),\n animation === 'pulse' && 'animate-skeleton-pulse',\n animation === 'wave' && 'relative overflow-hidden',\n className,\n )}\n style={{\n ...style,\n ...(width != null ? { width } : {}),\n ...(height != null ? { height } : {}),\n ...(radius != null ? { borderRadius: radius } : {}),\n ...(animation === 'pulse' ? { animationDuration: `${PULSE_DURATION_MS}ms` } : {}),\n }}\n {...props}\n >\n {animation === 'wave' && (\n <div\n className=\"absolute inset-0 animate-skeleton-wave\"\n style={{\n animationDuration: `${WAVE_DURATION_MS}ms`,\n background: `linear-gradient(90deg, ${WAVE_GRADIENT})`,\n }}\n />\n )}\n </div>\n )\n }\n)\nSkeletonBlock.displayName = 'SkeletonBlock'\n\nconst Skeleton = React.forwardRef<HTMLDivElement, SkeletonProps>(\n ({\n count,\n loading,\n children,\n variant = 'text',\n ...rest\n }, ref) => {\n // loading mode — show skeleton or children\n if (loading !== undefined) {\n if (!loading) return <>{children}</>\n // When loading, fall through to render skeleton\n }\n\n // count mode — render multiple text lines\n if (count != null && count > 1 && variant === 'text') {\n return (\n <div ref={ref} className=\"space-y-2.5\" aria-hidden=\"true\">\n {Array.from({ length: count }, (_, i) => {\n const widthPattern = MULTI_LINE_WIDTHS[i % MULTI_LINE_WIDTHS.length]\n const isLast = i === count - 1\n return (\n <SkeletonBlock\n key={i}\n variant=\"text\"\n style={{ width: isLast ? '60%' : widthPattern }}\n {...rest}\n />\n )\n })}\n </div>\n )\n }\n\n return <SkeletonBlock ref={ref} variant={variant} {...rest} />\n }\n)\nSkeleton.displayName = 'Skeleton'\n\nexport { Skeleton, skeletonVariants }\n"],"mappings":";AA+GU,SAwBiB,UAxBjB;AA7GV,YAAY,WAAW;AACvB,SAAS,WAA8B;AACvC,SAAS,UAAU;AAOnB,MAAM,oBAAoB;AAE1B,MAAM,mBAAmB;AAMzB,MAAM,gBAAgB;AAAA,EACpB;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,EAAE,KAAK,IAAI;AAMX,MAAM,oBAAoB,CAAC,QAAQ,OAAO,QAAQ,OAAO,KAAK;AAM9D,MAAM,mBAAmB;AAAA,EACvB;AAAA,EACA;AAAA,IACE,UAAU;AAAA,MACR,SAAS;AAAA,QACP,MAAM;AAAA,QACN,UAAU;AAAA,QACV,aAAa;AAAA,MACf;AAAA,IACF;AAAA,IACA,iBAAiB;AAAA,MACf,SAAS;AAAA,IACX;AAAA,EACF;AACF;AA6BA,MAAM,gBAAgB,MAAM;AAAA,EAC1B,CAAC;AAAA,IACC;AAAA,IACA,UAAU;AAAA,IACV,YAAY;AAAA,IACZ;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA,GAAG;AAAA,EACL,GAAG,QAAQ;AACT,WACE;AAAA,MAAC;AAAA;AAAA,QACC;AAAA,QACA,eAAY;AAAA,QACZ,WAAW;AAAA,UACT,iBAAiB,EAAE,QAAQ,CAAC;AAAA,UAC5B,cAAc,WAAW;AAAA,UACzB,cAAc,UAAU;AAAA,UACxB;AAAA,QACF;AAAA,QACA,OAAO;AAAA,UACL,GAAG;AAAA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,6 +33,7 @@ __export(slider_exports, {
33
33
  sliderVariants: () => sliderVariants
34
34
  });
35
35
  module.exports = __toCommonJS(slider_exports);
36
+ var import_jsx_runtime = require("react/jsx-runtime");
36
37
  var React = __toESM(require("react"));
37
38
  var SliderPrimitive = __toESM(require("@radix-ui/react-slider"));
38
39
  var import_class_variance_authority = require("class-variance-authority");
@@ -95,7 +96,7 @@ const Slider = React.forwardRef(({ className, size, color = "default", value, de
95
96
  setInternalValue(newValue);
96
97
  onValueChange?.(newValue);
97
98
  }, [onValueChange]);
98
- const sliderRoot = /* @__PURE__ */ React.createElement(
99
+ const sliderRoot = /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
99
100
  SliderPrimitive.Root,
100
101
  {
101
102
  ref,
@@ -109,67 +110,76 @@ const Slider = React.forwardRef(({ className, size, color = "default", value, de
109
110
  defaultValue,
110
111
  onValueChange: hasTooltip ? handleValueChange : onValueChange,
111
112
  orientation,
112
- ...props
113
- },
114
- /* @__PURE__ */ React.createElement(
115
- SliderPrimitive.Track,
116
- {
117
- className: (0, import_utils.cn)(
118
- "relative grow overflow-hidden rounded-full bg-border",
119
- isVertical ? "h-full" : "w-full",
120
- trackSizes[resolvedSize]
121
- )
122
- },
123
- /* @__PURE__ */ React.createElement(
124
- SliderPrimitive.Range,
125
- {
126
- className: (0, import_utils.cn)(
127
- "absolute rounded-full",
128
- sliderColorMap[color].range,
129
- isVertical ? "w-full transition-[top,bottom] duration-fast ease-out" : "h-full transition-[left,right] duration-fast ease-out"
130
- )
131
- }
132
- )
133
- ),
134
- Array.from({ length: thumbCount }).map((_, i) => /* @__PURE__ */ React.createElement(
135
- SliderPrimitive.Thumb,
136
- {
137
- key: i,
138
- className: (0, import_utils.cn)(
139
- "group/thumb block rounded-full border-2 shadow-sm",
140
- sliderColorMap[color].thumb,
141
- isVertical ? "transition-[top,box-shadow,border-color] duration-fast ease-out" : "transition-[left,box-shadow,border-color] duration-fast ease-out",
142
- sliderColorMap[color].thumbHover,
143
- sliderColorMap[color].thumbActive,
144
- "focus-visible:focus-ring",
145
- "disabled:pointer-events-none disabled:opacity-50",
146
- thumbSizes[resolvedSize]
147
- )
148
- },
149
- hasTooltip && /* @__PURE__ */ React.createElement(
150
- "div",
151
- {
152
- className: (0, import_utils.cn)(
153
- "absolute pointer-events-none",
154
- "transition-all duration-fast ease-out",
155
- isVertical ? "right-full top-1/2 -translate-y-1/2 mr-2 origin-right" : "bottom-full left-1/2 -translate-x-1/2 mb-2 origin-bottom",
156
- showTooltip === "always" ? "opacity-100 scale-100" : [
157
- "opacity-0 scale-95",
158
- "group-hover/thumb:opacity-100 group-hover/thumb:scale-100",
159
- "group-active/thumb:opacity-100 group-active/thumb:scale-100",
160
- "group-focus-visible/thumb:opacity-100 group-focus-visible/thumb:scale-100"
161
- ]
162
- )
163
- },
164
- /* @__PURE__ */ React.createElement("div", { className: "relative bg-foreground text-background text-xs font-semibold font-mono tabular-nums px-2.5 py-1 rounded-md shadow-lg whitespace-nowrap" }, formatLabel ? formatLabel(displayValues[i]) : displayValues[i], isVertical ? /* @__PURE__ */ React.createElement("div", { className: "absolute left-full top-1/2 -translate-y-1/2 border-4 border-transparent border-l-foreground" }) : /* @__PURE__ */ React.createElement("div", { className: "absolute top-full left-1/2 -translate-x-1/2 border-4 border-transparent border-t-foreground" }))
165
- )
166
- ))
113
+ ...props,
114
+ children: [
115
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
116
+ SliderPrimitive.Track,
117
+ {
118
+ className: (0, import_utils.cn)(
119
+ "relative grow overflow-hidden rounded-full bg-border",
120
+ isVertical ? "h-full" : "w-full",
121
+ trackSizes[resolvedSize]
122
+ ),
123
+ children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
124
+ SliderPrimitive.Range,
125
+ {
126
+ className: (0, import_utils.cn)(
127
+ "absolute rounded-full",
128
+ sliderColorMap[color].range,
129
+ isVertical ? "w-full transition-[top,bottom] duration-fast ease-out" : "h-full transition-[left,right] duration-fast ease-out"
130
+ )
131
+ }
132
+ )
133
+ }
134
+ ),
135
+ Array.from({ length: thumbCount }).map((_, i) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
136
+ SliderPrimitive.Thumb,
137
+ {
138
+ className: (0, import_utils.cn)(
139
+ "group/thumb block rounded-full border-2 shadow-sm",
140
+ sliderColorMap[color].thumb,
141
+ isVertical ? "transition-[top,box-shadow,border-color] duration-fast ease-out" : "transition-[left,box-shadow,border-color] duration-fast ease-out",
142
+ sliderColorMap[color].thumbHover,
143
+ sliderColorMap[color].thumbActive,
144
+ "focus-visible:focus-ring",
145
+ "disabled:pointer-events-none disabled:opacity-50",
146
+ thumbSizes[resolvedSize]
147
+ ),
148
+ children: hasTooltip && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
149
+ "div",
150
+ {
151
+ className: (0, import_utils.cn)(
152
+ "absolute pointer-events-none",
153
+ "transition-all duration-fast ease-out",
154
+ isVertical ? "right-full top-1/2 -translate-y-1/2 mr-2 origin-right" : "bottom-full left-1/2 -translate-x-1/2 mb-2 origin-bottom",
155
+ showTooltip === "always" ? "opacity-100 scale-100" : [
156
+ "opacity-0 scale-95",
157
+ "group-hover/thumb:opacity-100 group-hover/thumb:scale-100",
158
+ "group-active/thumb:opacity-100 group-active/thumb:scale-100",
159
+ "group-focus-visible/thumb:opacity-100 group-focus-visible/thumb:scale-100"
160
+ ]
161
+ ),
162
+ children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "relative bg-foreground text-background text-xs font-semibold font-mono tabular-nums px-2.5 py-1 rounded-md shadow-lg whitespace-nowrap", children: [
163
+ formatLabel ? formatLabel(displayValues[i]) : displayValues[i],
164
+ isVertical ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "absolute left-full top-1/2 -translate-y-1/2 border-4 border-transparent border-l-foreground" }) : /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "absolute top-full left-1/2 -translate-x-1/2 border-4 border-transparent border-t-foreground" })
165
+ ] })
166
+ }
167
+ )
168
+ },
169
+ i
170
+ ))
171
+ ]
172
+ }
167
173
  );
168
174
  if (!hasWrapper) return sliderRoot;
169
- return /* @__PURE__ */ React.createElement("div", { className: (0, import_utils.cn)(
175
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: (0, import_utils.cn)(
170
176
  isVertical ? "inline-flex flex-col items-center gap-2 h-full" : "flex items-center gap-3",
171
177
  className
172
- ) }, startContent && /* @__PURE__ */ React.createElement("span", { className: (0, import_utils.cn)("shrink-0 text-text-muted select-none", contentSizes[resolvedSize], props.disabled && "opacity-50") }, startContent), sliderRoot, endContent && /* @__PURE__ */ React.createElement("span", { className: (0, import_utils.cn)("shrink-0 text-text-muted select-none", contentSizes[resolvedSize], props.disabled && "opacity-50") }, endContent));
178
+ ), children: [
179
+ startContent && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: (0, import_utils.cn)("shrink-0 text-text-muted select-none", contentSizes[resolvedSize], props.disabled && "opacity-50"), children: startContent }),
180
+ sliderRoot,
181
+ endContent && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: (0, import_utils.cn)("shrink-0 text-text-muted select-none", contentSizes[resolvedSize], props.disabled && "opacity-50"), children: endContent })
182
+ ] });
173
183
  });
174
184
  Slider.displayName = "Slider";
175
185
  // Annotate the CommonJS export names for ESM import in node:
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/components/ui/slider.tsx"],"sourcesContent":["'use client'\n\nimport * as React from 'react'\nimport * as SliderPrimitive from '@radix-ui/react-slider'\nimport { cva, type VariantProps } from 'class-variance-authority'\nimport { cn } from '../../lib/utils'\n\n// Slider root variants\nconst sliderVariants = cva(\n 'relative flex touch-none select-none',\n {\n variants: {\n size: {\n sm: '',\n default: '',\n lg: '',\n },\n },\n defaultVariants: {\n size: 'default',\n },\n }\n)\n\n// Track sizes per orientation\nconst trackSizes = {\n sm: 'h-1 data-[orientation=vertical]:h-auto data-[orientation=vertical]:w-1',\n default: 'h-1.5 data-[orientation=vertical]:h-auto data-[orientation=vertical]:w-1.5',\n lg: 'h-2 data-[orientation=vertical]:h-auto data-[orientation=vertical]:w-2',\n}\n\n// Thumb sizes\nconst thumbSizes = {\n sm: 'w-[var(--component-slider-thumb-sm)] h-[var(--component-slider-thumb-sm)]',\n default: 'w-[var(--component-slider-thumb-default)] h-[var(--component-slider-thumb-default)]',\n lg: 'w-[var(--component-slider-thumb-lg)] h-[var(--component-slider-thumb-lg)]',\n}\n\n// Content font sizes (for startContent / endContent)\nconst contentSizes = {\n sm: 'text-xs',\n default: 'text-sm',\n lg: 'text-base',\n}\n\n// Color maps for range and thumb\nconst sliderColorMap = {\n default: {\n range: 'bg-foreground',\n thumb: 'bg-background border-foreground',\n thumbHover: 'hover:shadow-[0_0_0_4px_color-mix(in_srgb,var(--color-text)_16%,transparent)] hover:border-foreground',\n thumbActive: 'active:shadow-[0_0_0_6px_color-mix(in_srgb,var(--color-text)_16%,transparent)]',\n },\n primary: {\n range: 'bg-primary',\n thumb: 'bg-primary-foreground border-primary',\n thumbHover: 'hover:shadow-primary-glow hover:border-primary-hover',\n thumbActive: 'active:shadow-[0_0_0_6px_color-mix(in_srgb,var(--color-primary)_16%,transparent)]',\n },\n} as const\n\nexport type SliderColor = keyof typeof sliderColorMap\n\nexport interface SliderProps\n extends React.ComponentPropsWithoutRef<typeof SliderPrimitive.Root>,\n VariantProps<typeof sliderVariants> {\n /** Track and thumb color */\n color?: SliderColor\n /** Tooltip display mode: auto (hover/drag), always, never */\n showTooltip?: 'auto' | 'always' | 'never'\n /** Custom formatter for tooltip value */\n formatLabel?: (value: number) => string\n /** Content to display before the slider (icon, label, etc.) */\n startContent?: React.ReactNode\n /** Content to display after the slider */\n endContent?: React.ReactNode\n}\n\nconst Slider = React.forwardRef<\n React.ElementRef<typeof SliderPrimitive.Root>,\n SliderProps\n>(({ className, size, color = 'default', value, defaultValue, onValueChange, showTooltip = 'never', formatLabel, startContent, endContent, orientation, ...props }, ref) => {\n const resolvedSize = size || 'default'\n const thumbCount = value?.length ?? defaultValue?.length ?? 1\n const hasTooltip = showTooltip !== 'never'\n const hasWrapper = !!(startContent || endContent)\n const isVertical = orientation === 'vertical'\n\n // Track value internally for tooltip display\n const [internalValue, setInternalValue] = React.useState(\n () => value ?? defaultValue ?? Array(thumbCount).fill(props.min ?? 0)\n )\n const displayValues = value ?? internalValue\n\n const handleValueChange = React.useCallback((newValue: number[]) => {\n setInternalValue(newValue)\n onValueChange?.(newValue)\n }, [onValueChange])\n\n const sliderRoot = (\n <SliderPrimitive.Root\n ref={ref}\n className={cn(\n sliderVariants({ size }),\n isVertical\n ? 'h-full w-auto flex-col items-center'\n : 'w-full items-center',\n hasWrapper && (isVertical ? 'flex-1 min-h-0' : 'flex-1 min-w-0'),\n !hasWrapper && className\n )}\n value={value}\n defaultValue={defaultValue}\n onValueChange={hasTooltip ? handleValueChange : onValueChange}\n orientation={orientation}\n {...props}\n >\n <SliderPrimitive.Track\n className={cn(\n 'relative grow overflow-hidden rounded-full bg-border',\n isVertical ? 'h-full' : 'w-full',\n trackSizes[resolvedSize]\n )}\n >\n <SliderPrimitive.Range\n className={cn(\n 'absolute rounded-full', sliderColorMap[color].range,\n isVertical\n ? 'w-full transition-[top,bottom] duration-fast ease-out'\n : 'h-full transition-[left,right] duration-fast ease-out'\n )}\n />\n </SliderPrimitive.Track>\n {Array.from({ length: thumbCount }).map((_, i) => (\n <SliderPrimitive.Thumb\n key={i}\n className={cn(\n 'group/thumb block rounded-full border-2 shadow-sm', sliderColorMap[color].thumb,\n isVertical\n ? 'transition-[top,box-shadow,border-color] duration-fast ease-out'\n : 'transition-[left,box-shadow,border-color] duration-fast ease-out',\n sliderColorMap[color].thumbHover,\n sliderColorMap[color].thumbActive,\n 'focus-visible:focus-ring',\n 'disabled:pointer-events-none disabled:opacity-50',\n thumbSizes[resolvedSize]\n )}\n >\n {hasTooltip && (\n <div\n className={cn(\n 'absolute pointer-events-none',\n 'transition-all duration-fast ease-out',\n isVertical\n ? 'right-full top-1/2 -translate-y-1/2 mr-2 origin-right'\n : 'bottom-full left-1/2 -translate-x-1/2 mb-2 origin-bottom',\n showTooltip === 'always'\n ? 'opacity-100 scale-100'\n : [\n 'opacity-0 scale-95',\n 'group-hover/thumb:opacity-100 group-hover/thumb:scale-100',\n 'group-active/thumb:opacity-100 group-active/thumb:scale-100',\n 'group-focus-visible/thumb:opacity-100 group-focus-visible/thumb:scale-100',\n ]\n )}\n >\n <div className=\"relative bg-foreground text-background text-xs font-semibold font-mono tabular-nums px-2.5 py-1 rounded-md shadow-lg whitespace-nowrap\">\n {formatLabel ? formatLabel(displayValues[i]) : displayValues[i]}\n {/* Arrow */}\n {isVertical ? (\n <div className=\"absolute left-full top-1/2 -translate-y-1/2 border-4 border-transparent border-l-foreground\" />\n ) : (\n <div className=\"absolute top-full left-1/2 -translate-x-1/2 border-4 border-transparent border-t-foreground\" />\n )}\n </div>\n </div>\n )}\n </SliderPrimitive.Thumb>\n ))}\n </SliderPrimitive.Root>\n )\n\n if (!hasWrapper) return sliderRoot\n\n return (\n <div className={cn(\n isVertical ? 'inline-flex flex-col items-center gap-2 h-full' : 'flex items-center gap-3',\n className\n )}>\n {startContent && (\n <span className={cn('shrink-0 text-text-muted select-none', contentSizes[resolvedSize], props.disabled && 'opacity-50')}>\n {startContent}\n </span>\n )}\n {sliderRoot}\n {endContent && (\n <span className={cn('shrink-0 text-text-muted select-none', contentSizes[resolvedSize], props.disabled && 'opacity-50')}>\n {endContent}\n </span>\n )}\n </div>\n )\n})\nSlider.displayName = 'Slider'\n\nexport { Slider, sliderVariants }\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAEA,YAAuB;AACvB,sBAAiC;AACjC,sCAAuC;AACvC,mBAAmB;AAGnB,MAAM,qBAAiB;AAAA,EACrB;AAAA,EACA;AAAA,IACE,UAAU;AAAA,MACR,MAAM;AAAA,QACJ,IAAI;AA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H;AAAA,MACF;AAAA,IAEJ,CACD;AAAA,EACH;AAGF,MAAI,CAAC,WAAY,QAAO;AAExB,SACE,oCAAC,SAAI,eAAW;AAAA,IACd,aAAa,mDAAmD;AAAA,IAChE;AAAA,EACF,KACG,gBACC,oCAAC,UAAK,eAAW,iBAAG,wCAAwC,aAAa,YAAY,GAAG,MAAM,YAAY,YAAY,KACnH,YACH,GAED,YACA,cACC,oCAAC,UAAK,eAAW,iBAAG,wCAAwC,aAAa,YAAY,GAAG,MAAM,YAAY,YAAY,KACnH,UACH,CAEJ;AAEJ,CAAC;AACD,OAAO,cAAc;","names":[]}
1
+ {"version":3,"sources":["../../../src/components/ui/slider.tsx"],"sourcesContent":["'use client'\n\nimport * as React from 'react'\nimport * as SliderPrimitive from '@radix-ui/react-slider'\nimport { cva, type VariantProps } from 'class-variance-authority'\nimport { cn } from '../../lib/utils'\n\n// Slider root variants\nconst sliderVariants = cva(\n 'relative flex touch-none select-none',\n {\n variants: {\n size: {\n sm: '',\n default: '',\n lg: '',\n },\n },\n defaultVariants: {\n size: 'default',\n },\n }\n)\n\n// Track sizes per orientation\nconst trackSizes = {\n sm: 'h-1 data-[orientation=vertical]:h-auto data-[orientation=vertical]:w-1',\n default: 'h-1.5 data-[orientation=vertical]:h-auto data-[orientation=vertical]:w-1.5',\n lg: 'h-2 data-[orientation=vertical]:h-auto data-[orientation=vertical]:w-2',\n}\n\n// Thumb sizes\nconst thumbSizes = {\n sm: 'w-[var(--component-slider-thumb-sm)] h-[var(--component-slider-thumb-sm)]',\n default: 'w-[var(--component-slider-thumb-default)] h-[var(--component-slider-thumb-default)]',\n lg: 'w-[var(--component-slider-thumb-lg)] h-[var(--component-slider-thumb-lg)]',\n}\n\n// Content font sizes (for startContent / endContent)\nconst contentSizes = {\n sm: 'text-xs',\n default: 'text-sm',\n lg: 'text-base',\n}\n\n// Color maps for range and thumb\nconst sliderColorMap = {\n default: {\n range: 'bg-foreground',\n thumb: 'bg-background border-foreground',\n thumbHover: 'hover:shadow-[0_0_0_4px_color-mix(in_srgb,var(--color-text)_16%,transparent)] hover:border-foreground',\n thumbActive: 'active:shadow-[0_0_0_6px_color-mix(in_srgb,var(--color-text)_16%,transparent)]',\n },\n primary: {\n range: 'bg-primary',\n thumb: 'bg-primary-foreground border-primary',\n thumbHover: 'hover:shadow-primary-glow hover:border-primary-hover',\n thumbActive: 'active:shadow-[0_0_0_6px_color-mix(in_srgb,var(--color-primary)_16%,transparent)]',\n },\n} as const\n\nexport type SliderColor = keyof typeof sliderColorMap\n\nexport interface SliderProps\n extends React.ComponentPropsWithoutRef<typeof SliderPrimitive.Root>,\n VariantProps<typeof sliderVariants> {\n /** Track and thumb color */\n color?: SliderColor\n /** Tooltip display mode: auto (hover/drag), always, never */\n showTooltip?: 'auto' | 'always' | 'never'\n /** Custom formatter for tooltip value */\n formatLabel?: (value: number) => string\n /** Content to display before the slider (icon, label, etc.) */\n startContent?: React.ReactNode\n /** Content to display after the slider */\n endContent?: React.ReactNode\n}\n\nconst Slider = React.forwardRef<\n React.ElementRef<typeof SliderPrimitive.Root>,\n SliderProps\n>(({ className, size, color = 'default', value, defaultValue, onValueChange, showTooltip = 'never', formatLabel, startContent, endContent, orientation, ...props }, ref) => {\n const resolvedSize = size || 'default'\n const thumbCount = value?.length ?? defaultValue?.length ?? 1\n const hasTooltip = showTooltip !== 'never'\n const hasWrapper = !!(startContent || endContent)\n const isVertical = orientation === 'vertical'\n\n // Track value internally for tooltip display\n const [internalValue, setInternalValue] = React.useState(\n () => value ?? defaultValue ?? Array(thumbCount).fill(props.min ?? 0)\n )\n const displayValues = value ?? internalValue\n\n const handleValueChange = React.useCallback((newValue: number[]) => {\n setInternalValue(newValue)\n onValueChange?.(newValue)\n }, [onValueChange])\n\n const sliderRoot = (\n <SliderPrimitive.Root\n ref={ref}\n className={cn(\n sliderVariants({ size }),\n isVertical\n ? 'h-full w-auto flex-col items-center'\n : 'w-full items-center',\n hasWrapper && (isVertical ? 'flex-1 min-h-0' : 'flex-1 min-w-0'),\n !hasWrapper && className\n )}\n value={value}\n defaultValue={defaultValue}\n onValueChange={hasTooltip ? handleValueChange : onValueChange}\n orientation={orientation}\n {...props}\n >\n <SliderPrimitive.Track\n className={cn(\n 'relative grow overflow-hidden rounded-full bg-border',\n isVertical ? 'h-full' : 'w-full',\n trackSizes[resolvedSize]\n )}\n >\n <SliderPrimitive.Range\n className={cn(\n 'absolute rounded-full', sliderColorMap[color].range,\n isVertical\n ? 'w-full transition-[top,bottom] duration-fast ease-out'\n : 'h-full transition-[left,right] duration-fast ease-out'\n )}\n />\n </SliderPrimitive.Track>\n {Array.from({ length: thumbCount }).map((_, i) => (\n <SliderPrimitive.Thumb\n key={i}\n className={cn(\n 'group/thumb block rounded-full border-2 shadow-sm', sliderColorMap[color].thumb,\n isVertical\n ? 'transition-[top,box-shadow,border-color] duration-fast ease-out'\n : 'transition-[left,box-shadow,border-color] duration-fast ease-out',\n sliderColorMap[color].thumbHover,\n sliderColorMap[color].thumbActive,\n 'focus-visible:focus-ring',\n 'disabled:pointer-events-none disabled:opacity-50',\n thumbSizes[resolvedSize]\n )}\n >\n {hasTooltip && (\n <div\n className={cn(\n 'absolute pointer-events-none',\n 'transition-all duration-fast ease-out',\n isVertical\n ? 'right-full top-1/2 -translate-y-1/2 mr-2 origin-right'\n : 'bottom-full left-1/2 -translate-x-1/2 mb-2 origin-bottom',\n showTooltip === 'always'\n ? 'opacity-100 scale-100'\n : [\n 'opacity-0 scale-95',\n 'group-hover/thumb:opacity-100 group-hover/thumb:scale-100',\n 'group-active/thumb:opacity-100 group-active/thumb:scale-100',\n 'group-focus-visible/thumb:opacity-100 group-focus-visible/thumb:scale-100',\n ]\n )}\n >\n <div className=\"relative bg-foreground text-background text-xs font-semibold font-mono tabular-nums px-2.5 py-1 rounded-md shadow-lg whitespace-nowrap\">\n {formatLabel ? formatLabel(displayValues[i]) : displayValues[i]}\n {/* Arrow */}\n {isVertical ? (\n <div className=\"absolute left-full top-1/2 -translate-y-1/2 border-4 border-transparent border-l-foreground\" />\n ) : (\n <div className=\"absolute top-full left-1/2 -translate-x-1/2 border-4 border-transparent border-t-foreground\" />\n )}\n </div>\n </div>\n )}\n </SliderPrimitive.Thumb>\n ))}\n </SliderPrimitive.Root>\n )\n\n if (!hasWrapper) return sliderRoot\n\n return (\n <div className={cn(\n isVertical ? 'inline-flex flex-col items-center gap-2 h-full' : 'flex items-center gap-3',\n className\n )}>\n {startContent && (\n <span className={cn('shrink-0 text-text-muted select-none', contentSizes[resolvedSize], props.disabled && 'opacity-50')}>\n {startContent}\n </span>\n )}\n {sliderRoot}\n {endContent && (\n <span className={cn('shrink-0 text-text-muted select-none', contentSizes[resolvedSize], props.disabled && 'opacity-50')}>\n {endContent}\n </span>\n )}\n </div>\n )\n})\nSlider.displayName = 'Slider'\n\nexport { Slider, sliderVariants }\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AA2HQ;AAzHR,YAAuB;AACvB,sBAAiC;AACjC,sCAAuC;AACvC,mBAAmB;AAGnB,MAAM,qBAAiB;AAAA,EACrB;AAAA,EACA;AAAA,IACE,UAAU;AAAA,MACR,MAAM;AAAA,QACJ,IAAI;AAAA,QACJ,SAAS;AAAA,QACT,IAAI;AAAA,MACN;AAAA,IACF;AAAA,IACA,iBAAiB;AAAA,MACf,MAAM;AAAA,IACR;AAAA,EACF;AACF;AAGA,MAAM,aAAa;AAAA,EACjB,IAAI;AAAA,EACJ,SAAS;AAAA,EACT,IAAI;AACN;AAGA,MAAM,aAAa;AAAA,EACjB,IAAI;AAAA,EACJ,SAAS;AAAA,EACT,IAAI;AACN;AAGA,MAAM,eAAe;AAAA,EACnB,IAAI;AAAA,EACJ,SAAS;AAAA,EACT,IAAI;AACN;AAGA,MAAM,iBAAiB;AAAA,EACrB,SAAS;AAAA,IACP,OAAO;AAAA,IACP,OAAO;AAAA,IACP,YAAY;AAAA,IACZ,aAAa;AAAA,EACf;A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
@@ -1,4 +1,5 @@
1
1
  "use client";
2
+ import { jsx, jsxs } from "react/jsx-runtime";
2
3
  import * as React from "react";
3
4
  import * as SliderPrimitive from "@radix-ui/react-slider";
4
5
  import { cva } from "class-variance-authority";
@@ -61,7 +62,7 @@ const Slider = React.forwardRef(({ className, size, color = "default", value, de
61
62
  setInternalValue(newValue);
62
63
  onValueChange?.(newValue);
63
64
  }, [onValueChange]);
64
- const sliderRoot = /* @__PURE__ */ React.createElement(
65
+ const sliderRoot = /* @__PURE__ */ jsxs(
65
66
  SliderPrimitive.Root,
66
67
  {
67
68
  ref,
@@ -75,67 +76,76 @@ const Slider = React.forwardRef(({ className, size, color = "default", value, de
75
76
  defaultValue,
76
77
  onValueChange: hasTooltip ? handleValueChange : onValueChange,
77
78
  orientation,
78
- ...props
79
- },
80
- /* @__PURE__ */ React.createElement(
81
- SliderPrimitive.Track,
82
- {
83
- className: cn(
84
- "relative grow overflow-hidden rounded-full bg-border",
85
- isVertical ? "h-full" : "w-full",
86
- trackSizes[resolvedSize]
87
- )
88
- },
89
- /* @__PURE__ */ React.createElement(
90
- SliderPrimitive.Range,
91
- {
92
- className: cn(
93
- "absolute rounded-full",
94
- sliderColorMap[color].range,
95
- isVertical ? "w-full transition-[top,bottom] duration-fast ease-out" : "h-full transition-[left,right] duration-fast ease-out"
96
- )
97
- }
98
- )
99
- ),
100
- Array.from({ length: thumbCount }).map((_, i) => /* @__PURE__ */ React.createElement(
101
- SliderPrimitive.Thumb,
102
- {
103
- key: i,
104
- className: cn(
105
- "group/thumb block rounded-full border-2 shadow-sm",
106
- sliderColorMap[color].thumb,
107
- isVertical ? "transition-[top,box-shadow,border-color] duration-fast ease-out" : "transition-[left,box-shadow,border-color] duration-fast ease-out",
108
- sliderColorMap[color].thumbHover,
109
- sliderColorMap[color].thumbActive,
110
- "focus-visible:focus-ring",
111
- "disabled:pointer-events-none disabled:opacity-50",
112
- thumbSizes[resolvedSize]
113
- )
114
- },
115
- hasTooltip && /* @__PURE__ */ React.createElement(
116
- "div",
117
- {
118
- className: cn(
119
- "absolute pointer-events-none",
120
- "transition-all duration-fast ease-out",
121
- isVertical ? "right-full top-1/2 -translate-y-1/2 mr-2 origin-right" : "bottom-full left-1/2 -translate-x-1/2 mb-2 origin-bottom",
122
- showTooltip === "always" ? "opacity-100 scale-100" : [
123
- "opacity-0 scale-95",
124
- "group-hover/thumb:opacity-100 group-hover/thumb:scale-100",
125
- "group-active/thumb:opacity-100 group-active/thumb:scale-100",
126
- "group-focus-visible/thumb:opacity-100 group-focus-visible/thumb:scale-100"
127
- ]
128
- )
129
- },
130
- /* @__PURE__ */ React.createElement("div", { className: "relative bg-foreground text-background text-xs font-semibold font-mono tabular-nums px-2.5 py-1 rounded-md shadow-lg whitespace-nowrap" }, formatLabel ? formatLabel(displayValues[i]) : displayValues[i], isVertical ? /* @__PURE__ */ React.createElement("div", { className: "absolute left-full top-1/2 -translate-y-1/2 border-4 border-transparent border-l-foreground" }) : /* @__PURE__ */ React.createElement("div", { className: "absolute top-full left-1/2 -translate-x-1/2 border-4 border-transparent border-t-foreground" }))
131
- )
132
- ))
79
+ ...props,
80
+ children: [
81
+ /* @__PURE__ */ jsx(
82
+ SliderPrimitive.Track,
83
+ {
84
+ className: cn(
85
+ "relative grow overflow-hidden rounded-full bg-border",
86
+ isVertical ? "h-full" : "w-full",
87
+ trackSizes[resolvedSize]
88
+ ),
89
+ children: /* @__PURE__ */ jsx(
90
+ SliderPrimitive.Range,
91
+ {
92
+ className: cn(
93
+ "absolute rounded-full",
94
+ sliderColorMap[color].range,
95
+ isVertical ? "w-full transition-[top,bottom] duration-fast ease-out" : "h-full transition-[left,right] duration-fast ease-out"
96
+ )
97
+ }
98
+ )
99
+ }
100
+ ),
101
+ Array.from({ length: thumbCount }).map((_, i) => /* @__PURE__ */ jsx(
102
+ SliderPrimitive.Thumb,
103
+ {
104
+ className: cn(
105
+ "group/thumb block rounded-full border-2 shadow-sm",
106
+ sliderColorMap[color].thumb,
107
+ isVertical ? "transition-[top,box-shadow,border-color] duration-fast ease-out" : "transition-[left,box-shadow,border-color] duration-fast ease-out",
108
+ sliderColorMap[color].thumbHover,
109
+ sliderColorMap[color].thumbActive,
110
+ "focus-visible:focus-ring",
111
+ "disabled:pointer-events-none disabled:opacity-50",
112
+ thumbSizes[resolvedSize]
113
+ ),
114
+ children: hasTooltip && /* @__PURE__ */ jsx(
115
+ "div",
116
+ {
117
+ className: cn(
118
+ "absolute pointer-events-none",
119
+ "transition-all duration-fast ease-out",
120
+ isVertical ? "right-full top-1/2 -translate-y-1/2 mr-2 origin-right" : "bottom-full left-1/2 -translate-x-1/2 mb-2 origin-bottom",
121
+ showTooltip === "always" ? "opacity-100 scale-100" : [
122
+ "opacity-0 scale-95",
123
+ "group-hover/thumb:opacity-100 group-hover/thumb:scale-100",
124
+ "group-active/thumb:opacity-100 group-active/thumb:scale-100",
125
+ "group-focus-visible/thumb:opacity-100 group-focus-visible/thumb:scale-100"
126
+ ]
127
+ ),
128
+ children: /* @__PURE__ */ jsxs("div", { className: "relative bg-foreground text-background text-xs font-semibold font-mono tabular-nums px-2.5 py-1 rounded-md shadow-lg whitespace-nowrap", children: [
129
+ formatLabel ? formatLabel(displayValues[i]) : displayValues[i],
130
+ isVertical ? /* @__PURE__ */ jsx("div", { className: "absolute left-full top-1/2 -translate-y-1/2 border-4 border-transparent border-l-foreground" }) : /* @__PURE__ */ jsx("div", { className: "absolute top-full left-1/2 -translate-x-1/2 border-4 border-transparent border-t-foreground" })
131
+ ] })
132
+ }
133
+ )
134
+ },
135
+ i
136
+ ))
137
+ ]
138
+ }
133
139
  );
134
140
  if (!hasWrapper) return sliderRoot;
135
- return /* @__PURE__ */ React.createElement("div", { className: cn(
141
+ return /* @__PURE__ */ jsxs("div", { className: cn(
136
142
  isVertical ? "inline-flex flex-col items-center gap-2 h-full" : "flex items-center gap-3",
137
143
  className
138
- ) }, startContent && /* @__PURE__ */ React.createElement("span", { className: cn("shrink-0 text-text-muted select-none", contentSizes[resolvedSize], props.disabled && "opacity-50") }, startContent), sliderRoot, endContent && /* @__PURE__ */ React.createElement("span", { className: cn("shrink-0 text-text-muted select-none", contentSizes[resolvedSize], props.disabled && "opacity-50") }, endContent));
144
+ ), children: [
145
+ startContent && /* @__PURE__ */ jsx("span", { className: cn("shrink-0 text-text-muted select-none", contentSizes[resolvedSize], props.disabled && "opacity-50"), children: startContent }),
146
+ sliderRoot,
147
+ endContent && /* @__PURE__ */ jsx("span", { className: cn("shrink-0 text-text-muted select-none", contentSizes[resolvedSize], props.disabled && "opacity-50"), children: endContent })
148
+ ] });
139
149
  });
140
150
  Slider.displayName = "Slider";
141
151
  export {