@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.
- package/README.md +2 -3
- package/dist/AI_CONTEXT.md +4 -4
- package/dist/cjs/components/Calendar/Calendar.cjs +1 -1
- package/dist/cjs/components/Calendar/index.cjs +1 -1
- package/dist/cjs/components/Checkbox/Checkbox.cjs +1 -1
- package/dist/cjs/components/Checkbox/Confetti.cjs +1 -0
- package/dist/cjs/components/DatePicker/DatePicker.cjs +1 -1
- package/dist/cjs/components/DatePicker/RangePicker.cjs +1 -1
- package/dist/cjs/components/DatePicker/TimePicker.cjs +1 -1
- package/dist/cjs/components/Slider/Slider.cjs +1 -1
- package/dist/cjs/components/Slider/SpecSliderLabel.cjs +1 -0
- package/dist/cjs/components/Table/TableFilter/data-table-filter-popover.cjs +1 -1
- package/dist/cjs/components/Tabs/Tabs.cjs +1 -1
- package/dist/cjs/components/Tooltip/SpecTooltip.cjs +1 -0
- package/dist/cjs/components/Tooltip/Tooltip.cjs +1 -1
- package/dist/cjs/index.cjs +1 -1
- package/dist/cjs/packages/ui/src/components/calendar-logic.cjs +1 -0
- package/dist/cjs/packages/ui/src/components/calendar.cjs +1 -1
- package/dist/cjs/styles/index.css +1 -1
- package/dist/cjs/utils/animations.cjs +1 -1
- package/dist/cjs/utils/date-format.cjs +1 -0
- package/dist/esm/components/Calendar/Calendar.js +23 -19
- package/dist/esm/components/Calendar/index.js +7 -3
- package/dist/esm/components/Checkbox/Checkbox.js +46 -44
- package/dist/esm/components/Checkbox/Confetti.js +28 -0
- package/dist/esm/components/DatePicker/DatePicker.js +78 -81
- package/dist/esm/components/DatePicker/RangePicker.js +121 -124
- package/dist/esm/components/DatePicker/TimePicker.js +122 -124
- package/dist/esm/components/Slider/Slider.js +140 -199
- package/dist/esm/components/Slider/SpecSliderLabel.js +60 -0
- package/dist/esm/components/Table/TableFilter/data-table-filter-popover.js +30 -26
- package/dist/esm/components/Tabs/Tabs.js +80 -91
- package/dist/esm/components/Tooltip/SpecTooltip.js +69 -0
- package/dist/esm/components/Tooltip/Tooltip.js +42 -85
- package/dist/esm/index.js +162 -158
- package/dist/esm/packages/ui/src/components/calendar-logic.js +83 -0
- package/dist/esm/packages/ui/src/components/calendar.js +459 -184
- package/dist/esm/styles/index.css +1 -1
- package/dist/esm/utils/animations.js +36 -44
- package/dist/esm/utils/date-format.js +162 -0
- package/dist/types/components/Calendar/Calendar.d.ts +5 -5
- package/dist/types/components/Calendar/Calendar.d.ts.map +1 -1
- package/dist/types/components/Calendar/index.d.ts +1 -1
- package/dist/types/components/Calendar/index.d.ts.map +1 -1
- package/dist/types/components/Checkbox/Checkbox.d.ts.map +1 -1
- package/dist/types/components/Checkbox/Confetti.d.ts +2 -0
- package/dist/types/components/Checkbox/Confetti.d.ts.map +1 -0
- package/dist/types/components/DatePicker/DatePicker.d.ts.map +1 -1
- package/dist/types/components/DatePicker/RangePicker.d.ts.map +1 -1
- package/dist/types/components/DatePicker/TimePicker.d.ts.map +1 -1
- package/dist/types/components/Marquee/Marquee.d.ts +1 -1
- package/dist/types/components/Slider/Slider.d.ts +1 -1
- package/dist/types/components/Slider/Slider.d.ts.map +1 -1
- package/dist/types/components/Slider/SpecSliderLabel.d.ts +14 -0
- package/dist/types/components/Slider/SpecSliderLabel.d.ts.map +1 -0
- package/dist/types/components/Table/TableFilter/data-table-filter-popover.d.ts.map +1 -1
- package/dist/types/components/Tabs/Tabs.d.ts.map +1 -1
- package/dist/types/components/Tooltip/SpecTooltip.d.ts +11 -0
- package/dist/types/components/Tooltip/SpecTooltip.d.ts.map +1 -0
- package/dist/types/components/Tooltip/Tooltip.d.ts.map +1 -1
- package/dist/types/components/Upload/Upload.d.ts +1 -1
- package/dist/types/packages/ui/src/components/badge.d.ts +2 -2
- package/dist/types/packages/ui/src/components/button.d.ts +1 -1
- package/dist/types/packages/ui/src/components/calendar-logic.d.ts +72 -0
- package/dist/types/packages/ui/src/components/calendar-logic.d.ts.map +1 -0
- package/dist/types/packages/ui/src/components/calendar.d.ts +95 -6
- package/dist/types/packages/ui/src/components/calendar.d.ts.map +1 -1
- package/dist/types/utils/animations.d.ts +0 -19
- package/dist/types/utils/animations.d.ts.map +1 -1
- package/dist/types/utils/date-format.d.ts +24 -0
- package/dist/types/utils/date-format.d.ts.map +1 -0
- package/package.json +2 -3
- package/dist/cjs/utils/css.cjs +0 -1
- package/dist/esm/utils/css.js +0 -24
- package/dist/types/utils/css.d.ts +0 -4
- package/dist/types/utils/css.d.ts.map +0 -1
|
@@ -1,11 +1,10 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import
|
|
3
|
-
import * as
|
|
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
|
|
6
|
-
import
|
|
7
|
-
|
|
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
|
-
},
|
|
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
|
-
},
|
|
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
|
-
}[
|
|
82
|
-
},
|
|
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
|
-
})[`${
|
|
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
|
-
})[`${
|
|
123
|
+
})[`${n}-${t}`], X = p.forwardRef(
|
|
125
124
|
({
|
|
126
|
-
className:
|
|
125
|
+
className: n,
|
|
127
126
|
color: t = "primary",
|
|
128
127
|
size: s = "md",
|
|
129
|
-
showLabel:
|
|
130
|
-
labelArrow:
|
|
131
|
-
labelAnimation:
|
|
132
|
-
labelFormatter:
|
|
133
|
-
labelPosition:
|
|
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:
|
|
136
|
-
labelArrowColor:
|
|
137
|
-
sliderColor:
|
|
138
|
-
thumbBorderColor:
|
|
139
|
-
defaultValue:
|
|
140
|
-
value:
|
|
141
|
-
min:
|
|
142
|
-
max:
|
|
143
|
-
...
|
|
144
|
-
},
|
|
145
|
-
const
|
|
146
|
-
() => Array.isArray(
|
|
147
|
-
[
|
|
148
|
-
), [
|
|
149
|
-
|
|
150
|
-
|
|
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
|
-
),
|
|
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
|
-
}, [
|
|
156
|
-
const
|
|
157
|
-
|
|
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:
|
|
181
|
-
thumb:
|
|
158
|
+
range: S || "ds:bg-primary",
|
|
159
|
+
thumb: B || "ds:border-primary/50"
|
|
182
160
|
};
|
|
183
|
-
const r =
|
|
161
|
+
const r = H[t];
|
|
184
162
|
return {
|
|
185
163
|
range: r.range,
|
|
186
164
|
thumb: r.thumb
|
|
187
165
|
};
|
|
188
|
-
}, [t,
|
|
189
|
-
if (d ||
|
|
190
|
-
return a(d,
|
|
191
|
-
const r =
|
|
192
|
-
return t === "glass" ? `${r.labelBg} ${r.labelText} ds:backdrop-blur-sm ds:shadow-lg ds:[&>div.arrow]:${
|
|
193
|
-
}, [t,
|
|
194
|
-
if (
|
|
195
|
-
const r =
|
|
196
|
-
return
|
|
197
|
-
}, [t,
|
|
198
|
-
() =>
|
|
199
|
-
[
|
|
200
|
-
),
|
|
201
|
-
() =>
|
|
202
|
-
[
|
|
203
|
-
),
|
|
204
|
-
(r) =>
|
|
205
|
-
|
|
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
|
-
|
|
189
|
+
F,
|
|
210
190
|
d && d,
|
|
211
|
-
|
|
212
|
-
!d && !
|
|
191
|
+
e && e,
|
|
192
|
+
!d && !e && j
|
|
213
193
|
),
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
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__ */
|
|
257
|
-
|
|
199
|
+
) }) : /* @__PURE__ */ A(
|
|
200
|
+
J,
|
|
258
201
|
{
|
|
259
202
|
size: "lg",
|
|
260
|
-
color: d ||
|
|
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
|
-
|
|
265
|
-
|
|
207
|
+
z.badge,
|
|
208
|
+
E,
|
|
266
209
|
d && d,
|
|
267
|
-
|
|
268
|
-
!d && !
|
|
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
|
-
|
|
272
|
-
|
|
214
|
+
$ === "number-flow" ? /* @__PURE__ */ o(
|
|
215
|
+
q,
|
|
273
216
|
{
|
|
274
|
-
value:
|
|
217
|
+
value: u[r],
|
|
275
218
|
format: { notation: "standard" },
|
|
276
219
|
isolate: !0
|
|
277
220
|
}
|
|
278
|
-
) : /* @__PURE__ */
|
|
279
|
-
|
|
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
|
-
|
|
285
|
-
|
|
227
|
+
z.arrow,
|
|
228
|
+
_
|
|
286
229
|
)
|
|
287
230
|
}
|
|
288
231
|
)
|
|
@@ -290,130 +233,128 @@ const X = {
|
|
|
290
233
|
}
|
|
291
234
|
),
|
|
292
235
|
[
|
|
293
|
-
|
|
294
|
-
|
|
236
|
+
$,
|
|
237
|
+
F,
|
|
295
238
|
d,
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
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
|
-
|
|
309
|
-
|
|
244
|
+
u,
|
|
245
|
+
t,
|
|
246
|
+
z,
|
|
247
|
+
E,
|
|
248
|
+
k,
|
|
249
|
+
_,
|
|
250
|
+
O
|
|
310
251
|
]
|
|
311
252
|
);
|
|
312
|
-
return
|
|
313
|
-
|
|
253
|
+
return g ? /* @__PURE__ */ A(
|
|
254
|
+
f.Root,
|
|
314
255
|
{
|
|
315
|
-
ref:
|
|
256
|
+
ref: I,
|
|
316
257
|
"data-slot": "slider",
|
|
317
|
-
defaultValue:
|
|
318
|
-
value:
|
|
319
|
-
min:
|
|
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
|
-
|
|
264
|
+
n
|
|
324
265
|
),
|
|
325
|
-
...
|
|
266
|
+
...R,
|
|
326
267
|
children: [
|
|
327
|
-
/* @__PURE__ */
|
|
328
|
-
|
|
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
|
-
|
|
274
|
+
w.track
|
|
334
275
|
),
|
|
335
|
-
children: /* @__PURE__ */
|
|
336
|
-
|
|
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
|
-
|
|
282
|
+
y.range
|
|
342
283
|
)
|
|
343
284
|
}
|
|
344
285
|
)
|
|
345
286
|
}
|
|
346
287
|
),
|
|
347
|
-
Array.from({ length:
|
|
348
|
-
|
|
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
|
-
|
|
354
|
-
|
|
294
|
+
y.thumb,
|
|
295
|
+
w.thumb
|
|
355
296
|
),
|
|
356
|
-
onMouseEnter: () =>
|
|
357
|
-
onMouseLeave: () =>
|
|
358
|
-
children:
|
|
297
|
+
onMouseEnter: () => T(!0),
|
|
298
|
+
onMouseLeave: () => T(!1),
|
|
299
|
+
children: Z(m)
|
|
359
300
|
},
|
|
360
|
-
|
|
301
|
+
m
|
|
361
302
|
))
|
|
362
303
|
]
|
|
363
304
|
}
|
|
364
|
-
) : /* @__PURE__ */
|
|
365
|
-
|
|
305
|
+
) : /* @__PURE__ */ A(
|
|
306
|
+
f.Root,
|
|
366
307
|
{
|
|
367
|
-
ref:
|
|
308
|
+
ref: I,
|
|
368
309
|
"data-slot": "slider",
|
|
369
|
-
defaultValue:
|
|
370
|
-
value:
|
|
371
|
-
min:
|
|
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
|
-
|
|
316
|
+
n
|
|
376
317
|
),
|
|
377
|
-
...
|
|
318
|
+
...R,
|
|
378
319
|
children: [
|
|
379
|
-
/* @__PURE__ */
|
|
380
|
-
|
|
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
|
-
|
|
326
|
+
w.track
|
|
386
327
|
),
|
|
387
|
-
children: /* @__PURE__ */
|
|
388
|
-
|
|
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
|
-
|
|
334
|
+
y.range
|
|
394
335
|
)
|
|
395
336
|
}
|
|
396
337
|
)
|
|
397
338
|
}
|
|
398
339
|
),
|
|
399
|
-
Array.from({ length:
|
|
400
|
-
|
|
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
|
-
|
|
406
|
-
|
|
346
|
+
y.thumb,
|
|
347
|
+
w.thumb
|
|
407
348
|
)
|
|
408
349
|
},
|
|
409
|
-
|
|
350
|
+
m
|
|
410
351
|
))
|
|
411
352
|
]
|
|
412
353
|
}
|
|
413
354
|
);
|
|
414
355
|
}
|
|
415
356
|
);
|
|
416
|
-
|
|
357
|
+
X.displayName = "Slider";
|
|
417
358
|
export {
|
|
418
|
-
|
|
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
|
|
2
|
-
import { X as
|
|
3
|
-
import * as
|
|
4
|
-
import { Popover as
|
|
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
|
|
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
|
-
|
|
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:
|
|
15
|
-
open:
|
|
16
|
-
onOpenChange:
|
|
18
|
+
trigger: u,
|
|
19
|
+
open: d,
|
|
20
|
+
onOpenChange: m
|
|
17
21
|
}) {
|
|
18
|
-
const [
|
|
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
|
-
|
|
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(
|
|
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: (
|
|
74
|
-
|
|
77
|
+
onCheckedChange: (g) => {
|
|
78
|
+
g ? e.setFilterValue([
|
|
75
79
|
...s,
|
|
76
80
|
l.value
|
|
77
81
|
]) : e.setFilterValue(
|
|
78
|
-
s.filter((
|
|
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
|
-
|
|
112
|
+
C,
|
|
109
113
|
{
|
|
110
114
|
open: v,
|
|
111
|
-
onOpenChange:
|
|
112
|
-
trigger:
|
|
115
|
+
onOpenChange: f,
|
|
116
|
+
trigger: u,
|
|
113
117
|
content: /* @__PURE__ */ i("div", { className: "ds:p-2 ds:min-w-32", children: [
|
|
114
|
-
|
|
115
|
-
F && /* @__PURE__ */ i(
|
|
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
|
-
|
|
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(
|
|
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
|
-
|
|
140
|
+
q as DataTableFilterPopover
|
|
137
141
|
};
|