@sth87/shadcn-design-system 0.2.12 → 0.3.1

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 (76) hide show
  1. package/README.md +2 -3
  2. package/dist/AI_CONTEXT.md +4 -4
  3. package/dist/cjs/components/Calendar/Calendar.cjs +1 -1
  4. package/dist/cjs/components/Calendar/index.cjs +1 -1
  5. package/dist/cjs/components/Checkbox/Checkbox.cjs +1 -1
  6. package/dist/cjs/components/Checkbox/Confetti.cjs +1 -0
  7. package/dist/cjs/components/DatePicker/DatePicker.cjs +1 -1
  8. package/dist/cjs/components/DatePicker/RangePicker.cjs +1 -1
  9. package/dist/cjs/components/DatePicker/TimePicker.cjs +1 -1
  10. package/dist/cjs/components/Slider/Slider.cjs +1 -1
  11. package/dist/cjs/components/Slider/SpecSliderLabel.cjs +1 -0
  12. package/dist/cjs/components/Table/TableFilter/data-table-filter-popover.cjs +1 -1
  13. package/dist/cjs/components/Tabs/Tabs.cjs +1 -1
  14. package/dist/cjs/components/Tooltip/SpecTooltip.cjs +1 -0
  15. package/dist/cjs/components/Tooltip/Tooltip.cjs +1 -1
  16. package/dist/cjs/index.cjs +1 -1
  17. package/dist/cjs/packages/ui/src/components/calendar-logic.cjs +1 -0
  18. package/dist/cjs/packages/ui/src/components/calendar.cjs +1 -1
  19. package/dist/cjs/styles/index.css +1 -1
  20. package/dist/cjs/utils/animations.cjs +1 -1
  21. package/dist/cjs/utils/date-format.cjs +1 -0
  22. package/dist/esm/components/Calendar/Calendar.js +23 -19
  23. package/dist/esm/components/Calendar/index.js +7 -3
  24. package/dist/esm/components/Checkbox/Checkbox.js +46 -44
  25. package/dist/esm/components/Checkbox/Confetti.js +28 -0
  26. package/dist/esm/components/DatePicker/DatePicker.js +78 -81
  27. package/dist/esm/components/DatePicker/RangePicker.js +121 -124
  28. package/dist/esm/components/DatePicker/TimePicker.js +122 -124
  29. package/dist/esm/components/Slider/Slider.js +140 -199
  30. package/dist/esm/components/Slider/SpecSliderLabel.js +60 -0
  31. package/dist/esm/components/Table/TableFilter/data-table-filter-popover.js +30 -26
  32. package/dist/esm/components/Tabs/Tabs.js +80 -91
  33. package/dist/esm/components/Tooltip/SpecTooltip.js +69 -0
  34. package/dist/esm/components/Tooltip/Tooltip.js +42 -85
  35. package/dist/esm/index.js +162 -158
  36. package/dist/esm/packages/ui/src/components/calendar-logic.js +83 -0
  37. package/dist/esm/packages/ui/src/components/calendar.js +459 -184
  38. package/dist/esm/styles/index.css +1 -1
  39. package/dist/esm/utils/animations.js +36 -44
  40. package/dist/esm/utils/date-format.js +162 -0
  41. package/dist/types/components/Calendar/Calendar.d.ts +5 -5
  42. package/dist/types/components/Calendar/Calendar.d.ts.map +1 -1
  43. package/dist/types/components/Calendar/index.d.ts +1 -1
  44. package/dist/types/components/Calendar/index.d.ts.map +1 -1
  45. package/dist/types/components/Checkbox/Checkbox.d.ts.map +1 -1
  46. package/dist/types/components/Checkbox/Confetti.d.ts +2 -0
  47. package/dist/types/components/Checkbox/Confetti.d.ts.map +1 -0
  48. package/dist/types/components/DatePicker/DatePicker.d.ts.map +1 -1
  49. package/dist/types/components/DatePicker/RangePicker.d.ts.map +1 -1
  50. package/dist/types/components/DatePicker/TimePicker.d.ts.map +1 -1
  51. package/dist/types/components/Marquee/Marquee.d.ts +1 -1
  52. package/dist/types/components/Slider/Slider.d.ts +1 -1
  53. package/dist/types/components/Slider/Slider.d.ts.map +1 -1
  54. package/dist/types/components/Slider/SpecSliderLabel.d.ts +14 -0
  55. package/dist/types/components/Slider/SpecSliderLabel.d.ts.map +1 -0
  56. package/dist/types/components/Table/TableFilter/data-table-filter-popover.d.ts.map +1 -1
  57. package/dist/types/components/Tabs/Tabs.d.ts.map +1 -1
  58. package/dist/types/components/Tooltip/SpecTooltip.d.ts +11 -0
  59. package/dist/types/components/Tooltip/SpecTooltip.d.ts.map +1 -0
  60. package/dist/types/components/Tooltip/Tooltip.d.ts.map +1 -1
  61. package/dist/types/components/Upload/Upload.d.ts +1 -1
  62. package/dist/types/packages/ui/src/components/badge.d.ts +2 -2
  63. package/dist/types/packages/ui/src/components/button.d.ts +1 -1
  64. package/dist/types/packages/ui/src/components/calendar-logic.d.ts +72 -0
  65. package/dist/types/packages/ui/src/components/calendar-logic.d.ts.map +1 -0
  66. package/dist/types/packages/ui/src/components/calendar.d.ts +95 -6
  67. package/dist/types/packages/ui/src/components/calendar.d.ts.map +1 -1
  68. package/dist/types/utils/animations.d.ts +0 -19
  69. package/dist/types/utils/animations.d.ts.map +1 -1
  70. package/dist/types/utils/date-format.d.ts +24 -0
  71. package/dist/types/utils/date-format.d.ts.map +1 -0
  72. package/package.json +2 -3
  73. package/dist/cjs/utils/css.cjs +0 -1
  74. package/dist/esm/utils/css.js +0 -24
  75. package/dist/types/utils/css.d.ts +0 -4
  76. package/dist/types/utils/css.d.ts.map +0 -1
@@ -1,11 +1,10 @@
1
- import { jsxs as B, jsx as e } from "react/jsx-runtime";
2
- import h, { useMemo as m } from "react";
3
- import * as p from "@radix-ui/react-slider";
1
+ import { jsx as o, jsxs as A } from "react/jsx-runtime";
2
+ import p, { useMemo as h } from "react";
3
+ import * as f from "@radix-ui/react-slider";
4
4
  import { cn as a } from "../../packages/ui/src/lib/utils.js";
5
- import { useMotionValue as Q, useSpring as U, motion as rt } from "motion/react";
6
- import W from "@number-flow/react";
7
- import st from "../Badge/Badge.js";
8
- const X = {
5
+ import q from "@number-flow/react";
6
+ import J from "../Badge/Badge.js";
7
+ const K = p.lazy(() => import("./SpecSliderLabel.js")), H = {
9
8
  primary: {
10
9
  range: "ds:bg-primary",
11
10
  thumb: "ds:border-primary/50",
@@ -54,7 +53,7 @@ const X = {
54
53
  labelBg: "ds:bg-accent",
55
54
  labelText: "ds:text-accent-foreground"
56
55
  }
57
- }, at = {
56
+ }, Q = {
58
57
  sm: {
59
58
  track: "ds:data-[orientation=horizontal]:h-1 ds:data-[orientation=vertical]:w-1",
60
59
  thumb: "ds:size-3"
@@ -67,7 +66,7 @@ const X = {
67
66
  track: "ds:data-[orientation=horizontal]:h-2 ds:data-[orientation=vertical]:w-2",
68
67
  thumb: "ds:size-5"
69
68
  }
70
- }, Y = (i, t) => i === "horizontal" ? t === "bottom" ? "bottom" : t === "left" ? "left" : t === "right" ? "right" : "top" : t === "right" ? "right" : t === "top" ? "top" : t === "bottom" ? "bottom" : "left", V = (i, t) => {
69
+ }, D = (n, t) => n === "horizontal" ? t === "bottom" ? "bottom" : t === "left" ? "left" : t === "right" ? "right" : "top" : t === "right" ? "right" : t === "top" ? "top" : t === "bottom" ? "bottom" : "left", L = (n, t) => {
71
70
  const s = t === "top" ? "t" : t === "bottom" ? "b" : t === "left" ? "l" : "r";
72
71
  return {
73
72
  primary: `ds:border-${s}-primary`,
@@ -78,8 +77,8 @@ const X = {
78
77
  glass: `ds:border-${s}-white/15`,
79
78
  muted: `ds:border-${s}-muted`,
80
79
  accent: `ds:border-${s}-accent`
81
- }[i];
82
- }, et = (i, t) => ({
80
+ }[n];
81
+ }, U = (n, t) => ({
83
82
  "horizontal-top": {
84
83
  badge: "ds:left-1/2 ds:-translate-x-1/2 ds:bottom-full ds:-translate-y-1/2",
85
84
  arrow: "ds:top-full left-1/2 ds:-translate-x-1/2 ds:border-t-[6px] ds:border-l-[6px] ds:border-r-[6px] ds:border-b-0 ds:border-l-transparent ds:border-r-transparent"
@@ -112,7 +111,7 @@ const X = {
112
111
  badge: "ds:left-1/2 ds:-translate-x-1/2 ds:top-full ds:translate-y-1/2",
113
112
  arrow: "ds:bottom-full ds:left-1/2 ds:-translate-x-1/2 ds:border-b-[6px] ds:border-l-[6px] ds:border-r-[6px] ds:border-t-0 ds:border-l-transparent ds:border-r-transparent"
114
113
  }
115
- })[`${i}-${t}`], dt = (i, t) => ({
114
+ })[`${n}-${t}`], W = (n, t) => ({
116
115
  "horizontal-top": "ds:data-[orientation=horizontal]:bottom-full ds:data-[orientation=horizontal]:left-1/2 ds:data-[orientation=horizontal]:-translate-x-1/2 ds:data-[orientation=horizontal]:-translate-y-1/2",
117
116
  "horizontal-bottom": "ds:data-[orientation=horizontal]:top-full ds:data-[orientation=horizontal]:left-1/2 ds:data-[orientation=horizontal]:-translate-x-1/2 ds:data-[orientation=horizontal]:translate-y-1/2",
118
117
  "horizontal-left": "ds:data-[orientation=horizontal]:top-1/2 ds:data-[orientation=horizontal]:right-full ds:data-[orientation=horizontal]:-translate-y-1/2 ds:data-[orientation=horizontal]:-translate-x-1/2",
@@ -121,168 +120,112 @@ const X = {
121
120
  "vertical-right": "ds:data-[orientation=vertical]:left-full ds:data-[orientation=vertical]:top-1/2 ds:data-[orientation=vertical]:translate-x-1/2 ds:data-[orientation=vertical]:-translate-y-1/2",
122
121
  "vertical-top": "ds:data-[orientation=vertical]:bottom-full ds:data-[orientation=vertical]:left-1/2 ds:data-[orientation=vertical]:-translate-x-1/2 ds:data-[orientation=vertical]:-translate-y-1/2",
123
122
  "vertical-bottom": "ds:data-[orientation=vertical]:top-full ds:data-[orientation=vertical]:left-1/2 ds:data-[orientation=vertical]:-translate-x-1/2 ds:data-[orientation=vertical]:translate-y-1/2"
124
- })[`${i}-${t}`], ot = h.forwardRef(
123
+ })[`${n}-${t}`], X = p.forwardRef(
125
124
  ({
126
- className: i,
125
+ className: n,
127
126
  color: t = "primary",
128
127
  size: s = "md",
129
- showLabel: c = !1,
130
- labelArrow: M = !1,
131
- labelAnimation: y = "none",
132
- labelFormatter: I = (n) => `${n}`,
133
- labelPosition: b = "top",
128
+ showLabel: g = !1,
129
+ labelArrow: k = !1,
130
+ labelAnimation: $ = "none",
131
+ labelFormatter: M = (u) => `${u}`,
132
+ labelPosition: l = "top",
134
133
  labelColor: d,
135
- labelTextColor: o,
136
- labelArrowColor: R,
137
- sliderColor: _,
138
- thumbBorderColor: A,
139
- defaultValue: u,
140
- value: f,
141
- min: z = 0,
142
- max: $ = 100,
143
- ...O
144
- }, j) => {
145
- const n = h.useMemo(
146
- () => Array.isArray(f) ? f : Array.isArray(u) ? u : [z, $],
147
- [f, u, z, $]
148
- ), [F, G] = h.useState(!1);
149
- h.useEffect(() => {
150
- f !== void 0 && !Array.isArray(f) && console.error(
134
+ labelTextColor: e,
135
+ labelArrowColor: N,
136
+ sliderColor: S,
137
+ thumbBorderColor: B,
138
+ defaultValue: b,
139
+ value: c,
140
+ min: v = 0,
141
+ max: x = 100,
142
+ ...R
143
+ }, I) => {
144
+ const u = p.useMemo(
145
+ () => Array.isArray(c) ? c : Array.isArray(b) ? b : [v, x],
146
+ [c, b, v, x]
147
+ ), [O, T] = p.useState(!1);
148
+ p.useEffect(() => {
149
+ c !== void 0 && !Array.isArray(c) && console.error(
151
150
  "[Slider] value prop must be an array of numbers, e.g., [50] or [25, 75]"
152
- ), u !== void 0 && !Array.isArray(u) && console.error(
151
+ ), b !== void 0 && !Array.isArray(b) && console.error(
153
152
  "[Slider] defaultValue prop must be an array of numbers, e.g., [50] or [25, 75]"
154
153
  );
155
- }, [f, u]);
156
- const l = O.orientation || "horizontal", H = Q(0), D = Q(0), P = h.useRef(0), Z = { stiffness: 150, damping: 15, mass: 1 }, v = U(0, Z), x = U(0, Z);
157
- h.useEffect(() => {
158
- if (y === "spec" && n.length > 0) {
159
- const r = n[0], g = r - P.current, w = 5, E = Math.max(
160
- -w,
161
- Math.min(w, g)
162
- );
163
- D.set(E), H.set(r);
164
- const C = -E * 12, tt = -E * 20;
165
- v.set(C), x.set(tt), setTimeout(() => {
166
- v.set(0), x.set(0);
167
- }, 100), P.current = r;
168
- }
169
- }, [
170
- n,
171
- y,
172
- D,
173
- H,
174
- v,
175
- x
176
- ]);
177
- const k = m(() => {
178
- if (_ || A)
154
+ }, [c, b]);
155
+ const i = R.orientation || "horizontal", y = h(() => {
156
+ if (S || B)
179
157
  return {
180
- range: _ || "ds:bg-primary",
181
- thumb: A || "ds:border-primary/50"
158
+ range: S || "ds:bg-primary",
159
+ thumb: B || "ds:border-primary/50"
182
160
  };
183
- const r = X[t];
161
+ const r = H[t];
184
162
  return {
185
163
  range: r.range,
186
164
  thumb: r.thumb
187
165
  };
188
- }, [t, _, A]), N = m(() => at[s], [s]), q = m(() => {
189
- if (d || o)
190
- return a(d, o);
191
- const r = X[t], g = Y(l, b), w = V(t, g);
192
- return t === "glass" ? `${r.labelBg} ${r.labelText} ds:backdrop-blur-sm ds:shadow-lg ds:[&>div.arrow]:${w}` : `${r.labelBg} ${r.labelText} ds:[&>div.arrow]:${w}`;
193
- }, [t, b, l, d, o]), T = m(() => {
194
- if (R) return R;
195
- const r = Y(l, b);
196
- return V(t, r);
197
- }, [t, b, l, R]), J = m(() => c === "hover" ? "ds:scale-0 ds:group-hover:scale-100" : c === "always" ? "ds:scale-100" : "ds:hidden", [c]), S = m(
198
- () => et(l, b),
199
- [b, l]
200
- ), K = m(
201
- () => dt(l, b),
202
- [b, l]
203
- ), L = h.useCallback(
204
- (r) => y === "spec" ? /* @__PURE__ */ B(
205
- rt.div,
166
+ }, [t, S, B]), w = h(() => Q[s], [s]), j = h(() => {
167
+ if (d || e)
168
+ return a(d, e);
169
+ const r = H[t], m = D(i, l), G = L(t, m);
170
+ return t === "glass" ? `${r.labelBg} ${r.labelText} ds:backdrop-blur-sm ds:shadow-lg ds:[&>div.arrow]:${G}` : `${r.labelBg} ${r.labelText} ds:[&>div.arrow]:${G}`;
171
+ }, [t, l, i, d, e]), _ = h(() => {
172
+ if (N) return N;
173
+ const r = D(i, l);
174
+ return L(t, r);
175
+ }, [t, l, i, N]), E = h(() => g === "hover" ? "ds:scale-0 ds:group-hover:scale-100" : g === "always" ? "ds:scale-100" : "ds:hidden", [g]), z = h(
176
+ () => U(i, l),
177
+ [l, i]
178
+ ), F = h(
179
+ () => W(i, l),
180
+ [l, i]
181
+ ), Z = p.useCallback(
182
+ (r) => $ === "spec" ? /* @__PURE__ */ o(p.Suspense, { fallback: null, children: /* @__PURE__ */ o(
183
+ K,
206
184
  {
185
+ values: u,
186
+ index: r,
207
187
  className: a(
208
188
  "ds:pointer-events-none ds:absolute ds:z-50 ds:flex ds:flex-col ds:items-center ds:justify-center ds:rounded-md ds:px-3 ds:py-1.5 ds:text-xs ds:shadow-xl",
209
- K,
189
+ F,
210
190
  d && d,
211
- o && o,
212
- !d && !o && q
191
+ e && e,
192
+ !d && !e && j
213
193
  ),
214
- "data-orientation": l,
215
- initial: c === "always" ? { opacity: 1, y: -5, scale: 1 } : { opacity: 0, y: 20, scale: 0 },
216
- animate: F && c === "hover" || c === "always" ? {
217
- opacity: 1,
218
- y: -5,
219
- scale: 1
220
- } : {
221
- opacity: 0,
222
- y: 20,
223
- scale: 0
224
- },
225
- transition: {
226
- type: "tween",
227
- duration: 0.2,
228
- ease: "easeOut"
229
- },
230
- style: {
231
- x: v,
232
- rotate: x,
233
- whiteSpace: "nowrap"
234
- },
235
- children: [
236
- /* @__PURE__ */ e("div", { className: "ds:relative ds:z-1", children: /* @__PURE__ */ e(
237
- W,
238
- {
239
- value: n[r],
240
- format: { notation: "standard" },
241
- isolate: !0
242
- }
243
- ) }),
244
- M && /* @__PURE__ */ e(
245
- "div",
246
- {
247
- className: a(
248
- "ds:arrow ds:absolute ds:border-transparent",
249
- S.arrow,
250
- T
251
- )
252
- }
253
- )
254
- ]
194
+ orientation: i,
195
+ showLabel: g,
196
+ isHovered: O,
197
+ arrowClassName: k ? a(z.arrow, _) : void 0
255
198
  }
256
- ) : /* @__PURE__ */ B(
257
- st,
199
+ ) }) : /* @__PURE__ */ A(
200
+ J,
258
201
  {
259
202
  size: "lg",
260
- color: d || o || t === "glass" ? "custom" : t === "muted" ? "muted" : t === "accent" ? "accent" : t,
203
+ color: d || e || t === "glass" ? "custom" : t === "muted" ? "muted" : t === "accent" ? "accent" : t,
261
204
  variant: "solid",
262
205
  className: a(
263
206
  "ds:transition-transform ds:absolute ds:px-3 ds:rounded-md",
264
- S.badge,
265
- J,
207
+ z.badge,
208
+ E,
266
209
  d && d,
267
- o && o,
268
- !d && !o && t === "glass" && "ds:bg-white/15 ds:text-foreground ds:backdrop-blur-sm ds:shadow-lg ds:[&>div.arrow]:border-t-white/15"
210
+ e && e,
211
+ !d && !e && t === "glass" && "ds:bg-white/15 ds:text-foreground ds:backdrop-blur-sm ds:shadow-lg ds:[&>div.arrow]:border-t-white/15"
269
212
  ),
270
213
  children: [
271
- y === "number-flow" ? /* @__PURE__ */ e(
272
- W,
214
+ $ === "number-flow" ? /* @__PURE__ */ o(
215
+ q,
273
216
  {
274
- value: n[r],
217
+ value: u[r],
275
218
  format: { notation: "standard" },
276
219
  isolate: !0
277
220
  }
278
- ) : /* @__PURE__ */ e("span", { children: I(n[r]) }),
279
- M && /* @__PURE__ */ e(
221
+ ) : /* @__PURE__ */ o("span", { children: M(u[r]) }),
222
+ k && /* @__PURE__ */ o(
280
223
  "div",
281
224
  {
282
225
  className: a(
283
226
  "ds:arrow ds:absolute ds:border-transparent",
284
- S.arrow,
285
- T
227
+ z.arrow,
228
+ _
286
229
  )
287
230
  }
288
231
  )
@@ -290,130 +233,128 @@ const X = {
290
233
  }
291
234
  ),
292
235
  [
293
- y,
294
- K,
236
+ $,
237
+ F,
295
238
  d,
296
- o,
297
- q,
298
- l,
299
- c,
300
- v,
301
- x,
302
- I,
303
- n,
304
- t,
305
- S,
306
- J,
239
+ e,
240
+ j,
241
+ i,
242
+ g,
307
243
  M,
308
- T,
309
- F
244
+ u,
245
+ t,
246
+ z,
247
+ E,
248
+ k,
249
+ _,
250
+ O
310
251
  ]
311
252
  );
312
- return c ? /* @__PURE__ */ B(
313
- p.Root,
253
+ return g ? /* @__PURE__ */ A(
254
+ f.Root,
314
255
  {
315
- ref: j,
256
+ ref: I,
316
257
  "data-slot": "slider",
317
- defaultValue: u,
318
- value: f,
319
- min: z,
320
- max: $,
258
+ defaultValue: b,
259
+ value: c,
260
+ min: v,
261
+ max: x,
321
262
  className: a(
322
263
  "ds:relative ds:flex ds:w-full ds:touch-none ds:items-center ds:select-none ds:data-disabled:opacity-50 ds:data-[orientation=vertical]:h-full ds:data-[orientation=vertical]:min-h-44 ds:data-[orientation=vertical]:w-auto ds:data-[orientation=vertical]:flex-col",
323
- i
264
+ n
324
265
  ),
325
- ...O,
266
+ ...R,
326
267
  children: [
327
- /* @__PURE__ */ e(
328
- p.Track,
268
+ /* @__PURE__ */ o(
269
+ f.Track,
329
270
  {
330
271
  "data-slot": "slider-track",
331
272
  className: a(
332
273
  "ds:bg-muted ds:relative ds:grow ds:overflow-hidden ds:rounded-full ds:data-[orientation=horizontal]:w-full ds:data-[orientation=vertical]:h-full",
333
- N.track
274
+ w.track
334
275
  ),
335
- children: /* @__PURE__ */ e(
336
- p.Range,
276
+ children: /* @__PURE__ */ o(
277
+ f.Range,
337
278
  {
338
279
  "data-slot": "slider-range",
339
280
  className: a(
340
281
  "ds:absolute ds:data-[orientation=horizontal]:h-full ds:data-[orientation=vertical]:w-full",
341
- k.range
282
+ y.range
342
283
  )
343
284
  }
344
285
  )
345
286
  }
346
287
  ),
347
- Array.from({ length: n.length }, (r, g) => /* @__PURE__ */ e(
348
- p.Thumb,
288
+ Array.from({ length: u.length }, (r, m) => /* @__PURE__ */ o(
289
+ f.Thumb,
349
290
  {
350
291
  "data-slot": "slider-thumb",
351
292
  className: a(
352
293
  "ds:group ds:block ds:shrink-0 ds:rounded-full ds:border ds:bg-white ds:shadow-sm ds:transition-[color,box-shadow] ds:hover:ring-4 ds:focus-visible:ring-4 ds:focus-visible:outline-hidden ds:disabled:pointer-events-none ds:disabled:opacity-50 ds:ring-ring/50",
353
- k.thumb,
354
- N.thumb
294
+ y.thumb,
295
+ w.thumb
355
296
  ),
356
- onMouseEnter: () => G(!0),
357
- onMouseLeave: () => G(!1),
358
- children: L(g)
297
+ onMouseEnter: () => T(!0),
298
+ onMouseLeave: () => T(!1),
299
+ children: Z(m)
359
300
  },
360
- g
301
+ m
361
302
  ))
362
303
  ]
363
304
  }
364
- ) : /* @__PURE__ */ B(
365
- p.Root,
305
+ ) : /* @__PURE__ */ A(
306
+ f.Root,
366
307
  {
367
- ref: j,
308
+ ref: I,
368
309
  "data-slot": "slider",
369
- defaultValue: u,
370
- value: f,
371
- min: z,
372
- max: $,
310
+ defaultValue: b,
311
+ value: c,
312
+ min: v,
313
+ max: x,
373
314
  className: a(
374
315
  "ds:relative ds:flex ds:w-full ds:touch-none ds:items-center ds:select-none ds:data-disabled:opacity-50 ds:data-[orientation=vertical]:h-full ds:data-[orientation=vertical]:min-h-44 ds:data-[orientation=vertical]:w-auto ds:data-[orientation=vertical]:flex-col",
375
- i
316
+ n
376
317
  ),
377
- ...O,
318
+ ...R,
378
319
  children: [
379
- /* @__PURE__ */ e(
380
- p.Track,
320
+ /* @__PURE__ */ o(
321
+ f.Track,
381
322
  {
382
323
  "data-slot": "slider-track",
383
324
  className: a(
384
325
  "ds:bg-muted ds:relative ds:grow ds:overflow-hidden ds:rounded-full ds:data-[orientation=horizontal]:w-full ds:data-[orientation=vertical]:h-full",
385
- N.track
326
+ w.track
386
327
  ),
387
- children: /* @__PURE__ */ e(
388
- p.Range,
328
+ children: /* @__PURE__ */ o(
329
+ f.Range,
389
330
  {
390
331
  "data-slot": "slider-range",
391
332
  className: a(
392
333
  "ds:absolute ds:data-[orientation=horizontal]:h-full ds:data-[orientation=vertical]:w-full",
393
- k.range
334
+ y.range
394
335
  )
395
336
  }
396
337
  )
397
338
  }
398
339
  ),
399
- Array.from({ length: n.length }, (r, g) => /* @__PURE__ */ e(
400
- p.Thumb,
340
+ Array.from({ length: u.length }, (r, m) => /* @__PURE__ */ o(
341
+ f.Thumb,
401
342
  {
402
343
  "data-slot": "slider-thumb",
403
344
  className: a(
404
345
  "ds:block ds:shrink-0 ds:rounded-full ds:border ds:bg-white ds:shadow-sm ds:transition-[color,box-shadow] ds:hover:ring-4 ds:focus-visible:ring-4 ds:focus-visible:outline-hidden ds:disabled:pointer-events-none ds:disabled:opacity-50 ds:ring-ring/50",
405
- k.thumb,
406
- N.thumb
346
+ y.thumb,
347
+ w.thumb
407
348
  )
408
349
  },
409
- g
350
+ m
410
351
  ))
411
352
  ]
412
353
  }
413
354
  );
414
355
  }
415
356
  );
416
- ot.displayName = "Slider";
357
+ X.displayName = "Slider";
417
358
  export {
418
- ot as default
359
+ X as default
419
360
  };
@@ -0,0 +1,60 @@
1
+ import { jsxs as S, jsx as o } from "react/jsx-runtime";
2
+ import * as l from "react";
3
+ import { useSpring as m, motion as w } from "motion/react";
4
+ import N from "@number-flow/react";
5
+ import { cn as O } from "../../packages/ui/src/lib/utils.js";
6
+ const d = { stiffness: 150, damping: 15, mass: 1 }, p = 5;
7
+ function P({
8
+ values: i,
9
+ index: u,
10
+ className: f,
11
+ orientation: y,
12
+ showLabel: a,
13
+ isHovered: v,
14
+ arrowClassName: r
15
+ }) {
16
+ const t = m(0, d), e = m(0, d), n = l.useRef(0), s = i[0];
17
+ l.useEffect(() => {
18
+ if (s === void 0) return;
19
+ const h = s - n.current, c = Math.max(-p, Math.min(p, h));
20
+ t.set(-c * 12), e.set(-c * 20), n.current = s;
21
+ const x = setTimeout(() => {
22
+ t.set(0), e.set(0);
23
+ }, 100);
24
+ return () => clearTimeout(x);
25
+ }, [s, t, e]);
26
+ const b = v && a === "hover" || a === "always";
27
+ return /* @__PURE__ */ S(
28
+ w.div,
29
+ {
30
+ className: f,
31
+ "data-orientation": y,
32
+ initial: a === "always" ? { opacity: 1, y: -5, scale: 1 } : { opacity: 0, y: 20, scale: 0 },
33
+ animate: b ? { opacity: 1, y: -5, scale: 1 } : { opacity: 0, y: 20, scale: 0 },
34
+ transition: {
35
+ type: "tween",
36
+ duration: 0.2,
37
+ ease: "easeOut"
38
+ },
39
+ style: {
40
+ x: t,
41
+ rotate: e,
42
+ whiteSpace: "nowrap"
43
+ },
44
+ children: [
45
+ /* @__PURE__ */ o("div", { className: "ds:relative ds:z-1", children: /* @__PURE__ */ o(
46
+ N,
47
+ {
48
+ value: i[u],
49
+ format: { notation: "standard" },
50
+ isolate: !0
51
+ }
52
+ ) }),
53
+ r ? /* @__PURE__ */ o("div", { className: O("ds:arrow ds:absolute ds:border-transparent", r) }) : null
54
+ ]
55
+ }
56
+ );
57
+ }
58
+ export {
59
+ P as default
60
+ };
@@ -1,21 +1,25 @@
1
- import { jsx as a, jsxs as i, Fragment as d } from "react/jsx-runtime";
2
- import { X as V } from "lucide-react";
3
- import * as C from "react";
4
- import { Popover as N } from "../../Popover/index.js";
1
+ import { jsx as a, jsxs as i, Fragment as c } from "react/jsx-runtime";
2
+ import { X as N } from "lucide-react";
3
+ import * as n from "react";
4
+ import { Popover as C } from "../../Popover/index.js";
5
5
  import { DataTableSliderFilter as x } from "./data-table-slider-filter.js";
6
- import { DataTableDateFilter as w } from "./data-table-date-filter.js";
7
6
  import D from "../../Separator/Separator.js";
8
- import O from "../../Button/Button.js";
7
+ import w from "../../Button/Button.js";
9
8
  import S from "../../Checkbox/Checkbox.js";
10
9
  import k from "../../Radio/Radio.js";
11
10
  import o from "../../Input/Input.js";
12
- function A({
11
+ const O = n.lazy(
12
+ () => import("./data-table-date-filter.js").then((e) => ({
13
+ default: e.DataTableDateFilter
14
+ }))
15
+ );
16
+ function q({
13
17
  column: e,
14
- trigger: c,
15
- open: n,
16
- onOpenChange: u
18
+ trigger: u,
19
+ open: d,
20
+ onOpenChange: m
17
21
  }) {
18
- const [m, p] = C.useState(!1), v = n !== void 0 ? n : m, h = u || p, t = e.columnDef.meta, f = () => {
22
+ const [p, h] = n.useState(!1), v = d !== void 0 ? d : p, f = m || h, t = e.columnDef.meta, b = () => {
19
23
  if (!t?.variant) return /* @__PURE__ */ a("div", { children: "No filter available" });
20
24
  switch (t.variant) {
21
25
  case "text":
@@ -41,14 +45,14 @@ function A({
41
45
  );
42
46
  case "date":
43
47
  case "dateRange":
44
- return /* @__PURE__ */ a(
45
- w,
48
+ return /* @__PURE__ */ a(n.Suspense, { fallback: /* @__PURE__ */ a("div", { className: "ds:h-8 ds:w-full" }), children: /* @__PURE__ */ a(
49
+ O,
46
50
  {
47
51
  column: e,
48
52
  title: t.label ?? e.id,
49
53
  multiple: t.variant === "dateRange"
50
54
  }
51
- );
55
+ ) });
52
56
  case "range":
53
57
  return /* @__PURE__ */ a(
54
58
  x,
@@ -62,7 +66,7 @@ function A({
62
66
  const r = t.options || [];
63
67
  if (t.variant === "multiSelect") {
64
68
  const s = e.getFilterValue() || [];
65
- return /* @__PURE__ */ a(d, { children: /* @__PURE__ */ a("div", { className: "ds:space-y-2 ds:max-h-48 ds:overflow-y-auto ds:text-sm", children: r.map((l) => /* @__PURE__ */ a(
69
+ return /* @__PURE__ */ a(c, { children: /* @__PURE__ */ a("div", { className: "ds:space-y-2 ds:max-h-48 ds:overflow-y-auto ds:text-sm", children: r.map((l) => /* @__PURE__ */ a(
66
70
  "div",
67
71
  {
68
72
  className: "ds:flex ds:items-center ds:space-x-2",
@@ -70,12 +74,12 @@ function A({
70
74
  S,
71
75
  {
72
76
  checked: s.includes(l.value),
73
- onCheckedChange: (b) => {
74
- b ? e.setFilterValue([
77
+ onCheckedChange: (g) => {
78
+ g ? e.setFilterValue([
75
79
  ...s,
76
80
  l.value
77
81
  ]) : e.setFilterValue(
78
- s.filter((g) => g !== l.value)
82
+ s.filter((V) => V !== l.value)
79
83
  );
80
84
  },
81
85
  label: l.label
@@ -105,23 +109,23 @@ function A({
105
109
  }
106
110
  }, F = e.getFilterValue() != null;
107
111
  return /* @__PURE__ */ a(
108
- N,
112
+ C,
109
113
  {
110
114
  open: v,
111
- onOpenChange: h,
112
- trigger: c,
115
+ onOpenChange: f,
116
+ trigger: u,
113
117
  content: /* @__PURE__ */ i("div", { className: "ds:p-2 ds:min-w-32", children: [
114
- f(),
115
- F && /* @__PURE__ */ i(d, { children: [
118
+ b(),
119
+ F && /* @__PURE__ */ i(c, { children: [
116
120
  /* @__PURE__ */ a(D, { className: "ds:mt-3 ds:mb-1" }),
117
121
  /* @__PURE__ */ i(
118
- O,
122
+ w,
119
123
  {
120
124
  variant: "ghost",
121
125
  size: "sm",
122
126
  onClick: () => e.setFilterValue(void 0),
123
127
  children: [
124
- /* @__PURE__ */ a(V, { className: "ds:size-3" }),
128
+ /* @__PURE__ */ a(N, { className: "ds:size-3" }),
125
129
  "Clear Filter"
126
130
  ]
127
131
  }
@@ -133,5 +137,5 @@ function A({
133
137
  );
134
138
  }
135
139
  export {
136
- A as DataTableFilterPopover
140
+ q as DataTableFilterPopover
137
141
  };