@justanarthur/modo-ui 2.0.0 → 2.2.0
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/blocks/desktop-shell/index.tsx +2 -1
- package/components/data-display/sparkline/examples.mdx +79 -0
- package/components/data-display/sparkline/index.tsx +158 -0
- package/components/data-display/sparkline/live-demo.tsx +36 -0
- package/components/feedback/meter/examples.mdx +25 -0
- package/components/feedback/meter/index.tsx +23 -7
- package/components/feedback/meter/timer-demo.tsx +37 -0
- package/components/inputs/checkbox/index.tsx +5 -0
- package/components/inputs/combobox/index.tsx +9 -4
- package/components/inputs/radio/index.tsx +5 -0
- package/components/inputs/select/index.tsx +23 -3
- package/components/inputs/slider/comfortable.tsx +10 -4
- package/components/inputs/slider/compact.tsx +153 -71
- package/components/inputs/slider/examples.mdx +24 -0
- package/components/inputs/slider/geometry.ts +18 -6
- package/components/inputs/slider/index.tsx +30 -8
- package/components/inputs/slider/value-display.tsx +16 -9
- package/components/inputs/switch/index.tsx +7 -2
- package/components/inputs/textarea/examples.mdx +19 -0
- package/components/inputs/textarea/index.tsx +42 -5
- package/components/navigation/sidebar/sidebar-group.tsx +2 -1
- package/components/navigation/sidebar/sidebar-menu-sub.tsx +2 -1
- package/components/navigation/sidebar/sidebar-shell.tsx +2 -1
- package/components/navigation/tree/index.tsx +2 -1
- package/components/overlays/dropdown/index.tsx +50 -8
- package/components/overlays/dropdown/submenu.tsx +41 -10
- package/components/overlays/tooltip/examples.mdx +13 -0
- package/components/overlays/tooltip/index.tsx +58 -16
- package/dist/base.css +4 -0
- package/dist/blocks/desktop-shell/index.js +28 -27
- package/dist/blocks/sidebar-app/index.js +38 -37
- package/dist/components/actions/button/index.js +4 -4
- package/dist/components/actions/copy/index.js +12 -12
- package/dist/components/containers/accordion/index.d.ts +1 -1
- package/dist/components/containers/accordion/index.js +16 -16
- package/dist/components/containers/card/index.js +14 -14
- package/dist/components/data-display/avatar/index.js +3 -3
- package/dist/components/data-display/badge/index.js +2 -2
- package/dist/components/data-display/diff/index.js +4 -4
- package/dist/components/data-display/list/index.js +3 -3
- package/dist/components/data-display/log-view/index.js +8 -8
- package/dist/components/data-display/markdown/index.js +15 -15
- package/dist/components/data-display/sparkline/index.d.ts +44 -0
- package/dist/components/data-display/sparkline/index.js +11 -0
- package/dist/components/data-display/table/index.js +9 -9
- package/dist/components/feedback/empty-state/index.js +3 -3
- package/dist/components/feedback/meter/index.d.ts +9 -1
- package/dist/components/feedback/meter/index.js +2 -2
- package/dist/components/feedback/progress/index.js +2 -2
- package/dist/components/inputs/checkbox/index.d.ts +2 -0
- package/dist/components/inputs/checkbox/index.js +13 -13
- package/dist/components/inputs/choice-list/index.js +10 -10
- package/dist/components/inputs/color-picker/index.js +22 -22
- package/dist/components/inputs/combobox/index.d.ts +1 -1
- package/dist/components/inputs/combobox/index.js +21 -21
- package/dist/components/inputs/date-time/calendar/index.js +9 -9
- package/dist/components/inputs/date-time/date-picker/index.js +28 -28
- package/dist/components/inputs/date-time/date-range-picker/index.js +28 -28
- package/dist/components/inputs/date-time/duration-picker/index.js +27 -27
- package/dist/components/inputs/date-time/month-picker/index.js +26 -26
- package/dist/components/inputs/date-time/time-picker/index.js +27 -27
- package/dist/components/inputs/editable-text/index.js +2 -2
- package/dist/components/inputs/field/index.js +5 -5
- package/dist/components/inputs/file-dropzone/index.js +8 -8
- package/dist/components/inputs/input/index.js +6 -6
- package/dist/components/inputs/key-value/index.js +12 -12
- package/dist/components/inputs/number-input/index.js +7 -7
- package/dist/components/inputs/radio/index.d.ts +2 -0
- package/dist/components/inputs/radio/index.js +12 -12
- package/dist/components/inputs/search/index.js +23 -23
- package/dist/components/inputs/select/index.d.ts +22 -4
- package/dist/components/inputs/select/index.js +22 -22
- package/dist/components/inputs/slider/index.d.ts +12 -3
- package/dist/components/inputs/slider/index.js +4 -4
- package/dist/components/inputs/switch/index.d.ts +2 -0
- package/dist/components/inputs/switch/index.js +9 -9
- package/dist/components/inputs/textarea/index.d.ts +8 -1
- package/dist/components/inputs/textarea/index.js +4 -4
- package/dist/components/navigation/breadcrumb/index.js +25 -25
- package/dist/components/navigation/navigation-menu/index.js +17 -17
- package/dist/components/navigation/pagination/index.js +16 -16
- package/dist/components/navigation/sidebar/index.js +26 -25
- package/dist/components/navigation/tabs/index.js +13 -13
- package/dist/components/navigation/tree/index.js +10 -9
- package/dist/components/overlays/alert-dialog/index.d.ts +3 -3
- package/dist/components/overlays/alert-dialog/index.js +15 -15
- package/dist/components/overlays/command/index.d.ts +1 -1
- package/dist/components/overlays/command/index.js +21 -21
- package/dist/components/overlays/context-menu/index.d.ts +20 -1
- package/dist/components/overlays/context-menu/index.js +25 -25
- package/dist/components/overlays/dialog/index.d.ts +3 -3
- package/dist/components/overlays/dialog/index.js +14 -14
- package/dist/components/overlays/dropdown/index.d.ts +30 -8
- package/dist/components/overlays/dropdown/index.js +24 -24
- package/dist/components/overlays/lightbox/index.js +12 -12
- package/dist/components/overlays/popover/index.d.ts +6 -6
- package/dist/components/overlays/popover/index.js +11 -11
- package/dist/components/overlays/preview-card/index.js +10 -10
- package/dist/components/overlays/sheet/index.d.ts +3 -3
- package/dist/components/overlays/sheet/index.js +15 -15
- package/dist/components/overlays/toast/index.d.ts +1 -1
- package/dist/components/overlays/toast/index.js +11 -11
- package/dist/components/overlays/tooltip/index.d.ts +35 -10
- package/dist/components/overlays/tooltip/index.js +8 -8
- package/dist/docs/index.js +18 -17
- package/dist/index.d.ts +330 -228
- package/dist/index.js +82 -77
- package/dist/lib/fluid-hover-highlight.js +4 -4
- package/dist/lib/focus-ring.js +2 -2
- package/dist/lib/goo-indicator.js +3 -3
- package/dist/lib/inert.d.ts +7 -0
- package/dist/lib/inert.js +6 -0
- package/dist/lib/morph-layers.js +4 -4
- package/dist/lib/morph-part.js +2 -2
- package/dist/lib/overlay.d.ts +20 -13
- package/dist/lib/overlay.js +5 -4
- package/dist/lib/popup-rows.js +2 -2
- package/dist/lib/popup-surface.js +7 -7
- package/dist/lib/scroll-column.js +6 -6
- package/dist/lib/slot.d.ts +5 -2
- package/dist/lib/slot.js +1 -1
- package/dist/lib/use-merge-split.js +4 -4
- package/dist/lib/use-morph.js +2 -2
- package/dist/preset.d.ts +1 -0
- package/dist/preset.js +1 -0
- package/dist/primitives/content/code/index.js +3 -3
- package/dist/primitives/layout/resizable/index.js +2 -2
- package/dist/primitives/layout/sortable/index.js +5 -5
- package/dist/primitives/systems/craft/index.js +3 -3
- package/dist/primitives/systems/fluid-hover/index.js +6 -6
- package/dist/primitives/systems/morph/index.js +14 -14
- package/dist/primitives/systems/motion/index.js +7 -7
- package/dist/primitives/systems/sizes/index.js +2 -2
- package/dist/shared/{components-280grw6q.js → components-09n5hgmx.js} +2 -2
- package/dist/shared/{components-1f3a7gmg.js → components-151vndgm.js} +3 -3
- package/dist/shared/{components-14wzcym0.js → components-16wx5av1.js} +6 -6
- package/dist/shared/{components-yf2gtq68.js → components-19e2wpxc.js} +9 -6
- package/dist/shared/{components-rzy6h7s4.js → components-1nqp7wqr.js} +1 -1
- package/dist/shared/components-2myjk2zf.js +8 -0
- package/dist/shared/{components-9rebr89j.js → components-2q0m4mxf.js} +2 -2
- package/dist/shared/{components-1asw2ph0.js → components-2zr49v82.js} +3 -3
- package/dist/shared/{components-wq9hrera.js → components-313rmbxy.js} +2 -2
- package/dist/shared/{components-0h2mng6m.js → components-31pkxwfz.js} +1 -1
- package/dist/shared/{components-w2at9ntm.js → components-3cvwrzc1.js} +3 -3
- package/dist/shared/{components-n0gbyp5a.js → components-4xd21p2p.js} +6 -6
- package/dist/shared/{components-t0c1rw40.js → components-7v6869ga.js} +1 -1
- package/dist/shared/{components-kwxye0an.js → components-7wjkag2j.js} +4 -2
- package/dist/shared/{components-fqsgd07c.js → components-85dz3xx3.js} +4 -4
- package/dist/shared/{components-3rvrdsa9.js → components-8qkd3659.js} +1 -1
- package/dist/shared/{components-me742146.js → components-8qwbwtv9.js} +5 -5
- package/dist/shared/{components-nxqrw789.js → components-90sfqz5t.js} +1 -1
- package/dist/shared/{components-b9bj65j3.js → components-90y8qwxv.js} +9 -9
- package/dist/shared/{components-g35n8tzm.js → components-95kp19zn.js} +1 -1
- package/dist/shared/{components-nhmgr5xc.js → components-9e5fpy3v.js} +14 -11
- package/dist/shared/{components-a1ms36qq.js → components-9hysh6d3.js} +1 -1
- package/dist/shared/{components-hcftn5r8.js → components-9s9vb2w0.js} +7 -4
- package/dist/shared/{components-vfreweq3.js → components-a3edrqpb.js} +3 -3
- package/dist/shared/{components-ee09xmkh.js → components-afj2ajea.js} +8 -5
- package/dist/shared/{components-ev0ytbqb.js → components-ajgwbabq.js} +4 -4
- package/dist/shared/{components-62510420.js → components-dr5c27yd.js} +6 -6
- package/dist/shared/{components-s90v3jpr.js → components-fqdh9ysk.js} +68 -19
- package/dist/shared/{components-2m2hg11x.js → components-gfw4zk8b.js} +8 -8
- package/dist/shared/{components-z0kz9rxj.js → components-gvwxswpr.js} +1 -1
- package/dist/shared/{components-p32aqk3q.js → components-h9se5cz5.js} +110 -73
- package/dist/shared/{components-464zs8v6.js → components-hbqyf35a.js} +41 -34
- package/dist/shared/{components-77gxngmc.js → components-jd21f3mb.js} +8 -8
- package/dist/shared/{components-xnkc892z.js → components-mamtvenk.js} +2 -2
- package/dist/shared/{components-1hga6pkn.js → components-mcnyaaep.js} +3 -3
- package/dist/shared/{components-h0x2pj2y.js → components-mpx3yq5c.js} +24 -10
- package/dist/shared/{components-j79a6jqa.js → components-nc8wggew.js} +3 -3
- package/dist/shared/{components-r5q9gdh4.js → components-nd3f803g.js} +7 -7
- package/dist/shared/{components-9ca0c92a.js → components-nehs80xd.js} +1 -1
- package/dist/shared/components-nw2k1pg9.js +98 -0
- package/dist/shared/{components-4t2cjav8.js → components-pgs3p035.js} +1 -1
- package/dist/shared/{components-91mmbrw3.js → components-ppc2dmxs.js} +2 -2
- package/dist/shared/{components-b2kjsn1s.js → components-qc1fae2s.js} +6 -6
- package/dist/shared/{components-fmyvz4r2.js → components-qd27dvgj.js} +6 -6
- package/dist/shared/{components-9z7bq8gn.js → components-qe8yp3vf.js} +3 -3
- package/dist/shared/{components-wx1dcp2n.js → components-qhk2m7fj.js} +2 -2
- package/dist/shared/{components-a1mwqxsv.js → components-qkt4h7x4.js} +8 -8
- package/dist/shared/{components-6rtawx8y.js → components-qs0cwe8p.js} +10 -10
- package/dist/shared/{components-y8m64zdw.js → components-r6ejdtpr.js} +3 -3
- package/dist/shared/{components-1bnf96sr.js → components-rj4nnqkz.js} +39 -11
- package/dist/shared/{components-gd8gmr6w.js → components-rmhdr4g1.js} +1 -1
- package/dist/shared/{components-e7zxwja1.js → components-rts2mggt.js} +1 -1
- package/dist/shared/{components-ta4e10mx.js → components-s25rehbv.js} +1 -1
- package/dist/shared/{components-chda6b23.js → components-sxstx1x7.js} +33 -4
- package/dist/shared/{components-b7p1pjcm.js → components-t4eb37vd.js} +2 -2
- package/dist/shared/{components-7xc2dne4.js → components-v3c3madd.js} +2 -2
- package/dist/shared/{components-22h8dvt1.js → components-v81eejq6.js} +3 -3
- package/dist/shared/{components-w1ysefg1.js → components-veaxns17.js} +2 -2
- package/dist/shared/{components-czvraaw9.js → components-vkrp4nb9.js} +4 -4
- package/dist/shared/{components-gsstwhtv.js → components-vv420geb.js} +6 -3
- package/dist/shared/{components-5xs8pkkj.js → components-w5p7mfb4.js} +1 -1
- package/dist/shared/{components-rgng034x.js → components-xvf8jcza.js} +25 -4
- package/dist/shared/{components-q7zk70tx.js → components-y07de1qv.js} +1 -1
- package/dist/shared/{components-0cpte6s1.js → components-yn8bw8tv.js} +11 -10
- package/dist/shared/{components-xa9fvd5b.js → components-z9gc2weg.js} +3 -3
- package/dist/shared/{components-twyj2y8c.js → components-zk1tj5za.js} +3 -3
- package/dist/shared/{components-hz6armxa.js → components-zktkxnzq.js} +7 -4
- package/dist/styles.css +10 -1
- package/dist/tailwind.css +1 -0
- package/dist/tokens.css +4 -0
- package/index.ts +1 -0
- package/lib/inert.ts +15 -0
- package/lib/overlay.tsx +49 -5
- package/lib/slot.tsx +9 -3
- package/package.json +7 -2
- package/tokens/colors.css +4 -0
- /package/dist/shared/{components-jw45ck66.js → components-02683eqd.js} +0 -0
- /package/dist/shared/{components-q0hs5rqn.js → components-6c52v58g.js} +0 -0
- /package/dist/shared/{components-y4gsk1jt.js → components-fa61vwag.js} +0 -0
- /package/dist/shared/{components-nz14rwtd.js → components-ffng9rpa.js} +0 -0
- /package/dist/shared/{components-7mj5wsv3.js → components-k9qbcmaa.js} +0 -0
- /package/dist/shared/{components-8pnvkrbw.js → components-mp7en54n.js} +0 -0
- /package/dist/shared/{components-h8v9nh5r.js → components-pbx77hzb.js} +0 -0
- /package/dist/shared/{components-c515d6xr.js → components-v1m0xjbw.js} +0 -0
- /package/dist/shared/{components-pa43g2r2.js → components-wddr0r6a.js} +0 -0
- /package/dist/shared/{components-ymq8tbq9.js → components-wqac4434.js} +0 -0
- /package/dist/shared/{components-m3vxpz2z.js → components-yy0a9b02.js} +0 -0
- /package/dist/shared/{components-92mvpt9h.js → components-zwgxvktt.js} +0 -0
|
@@ -20,7 +20,7 @@ import {
|
|
|
20
20
|
} from "./components-xnp09586.js";
|
|
21
21
|
|
|
22
22
|
// components/inputs/slider/index.tsx
|
|
23
|
-
import { forwardRef as forwardRef3 } from "react";
|
|
23
|
+
import { forwardRef as forwardRef3, useRef as useRef4 } from "react";
|
|
24
24
|
|
|
25
25
|
// components/inputs/slider/comfortable.tsx
|
|
26
26
|
import { Slider as SliderPrimitive } from "@base-ui/react/slider";
|
|
@@ -67,11 +67,16 @@ function pixelToValue(px, min, max, step, trackWidth, stepValues = null) {
|
|
|
67
67
|
function toRadixValue(value) {
|
|
68
68
|
return Array.isArray(value) ? value : [value];
|
|
69
69
|
}
|
|
70
|
-
function
|
|
70
|
+
function axisLength(el, vertical = false) {
|
|
71
|
+
return vertical ? el.offsetHeight : el.offsetWidth;
|
|
72
|
+
}
|
|
73
|
+
function layoutPos({ clientX, clientY }, el, vertical = false) {
|
|
71
74
|
const rect = el.getBoundingClientRect();
|
|
72
|
-
|
|
75
|
+
const length = axisLength(el, vertical);
|
|
76
|
+
const visual = vertical ? rect.height : rect.width;
|
|
77
|
+
if (length <= 0 || visual <= 0)
|
|
73
78
|
return null;
|
|
74
|
-
return (clientX - rect.left) * (
|
|
79
|
+
return (vertical ? rect.bottom - clientY : clientX - rect.left) * (length / visual);
|
|
75
80
|
}
|
|
76
81
|
function useDelayedFlag(flag, delay) {
|
|
77
82
|
const [delayed, setDelayed] = useState(false);
|
|
@@ -219,17 +224,15 @@ function ValueDisplay({
|
|
|
219
224
|
]
|
|
220
225
|
});
|
|
221
226
|
}
|
|
222
|
-
function TooltipValue({ value, formatValue, motionX }) {
|
|
227
|
+
function TooltipValue({ value, formatValue, motionX, vertical = false }) {
|
|
223
228
|
const tooltipX = useTransform(motionX, (x) => x + THUMB_SIZE / 2);
|
|
229
|
+
const tooltipY = useTransform(motionX, (x) => -x);
|
|
224
230
|
return /* @__PURE__ */ jsx(motion.div, {
|
|
225
|
-
className: "absolute -translate-
|
|
226
|
-
style: {
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
},
|
|
230
|
-
initial: { opacity: 0, y: 4 },
|
|
231
|
-
animate: { opacity: 1, y: 0 },
|
|
232
|
-
exit: { opacity: 0, y: 4, transition: spring2.fast.exit },
|
|
231
|
+
className: cn2("absolute pointer-events-none z-20", vertical ? "translate-y-1/2" : "-translate-x-1/2"),
|
|
232
|
+
style: vertical ? { y: tooltipY, bottom: THUMB_SIZE / 2, left: `calc(50% + ${THUMB_SIZE}px)` } : { x: tooltipX, top: -16 },
|
|
233
|
+
initial: vertical ? { opacity: 0, x: -4 } : { opacity: 0, y: 4 },
|
|
234
|
+
animate: vertical ? { opacity: 1, x: 0 } : { opacity: 1, y: 0 },
|
|
235
|
+
exit: vertical ? { opacity: 0, x: -4, transition: spring2.fast.exit } : { opacity: 0, y: 4, transition: spring2.fast.exit },
|
|
233
236
|
transition: spring2.fast,
|
|
234
237
|
children: /* @__PURE__ */ jsx(ValueBubble, {
|
|
235
238
|
children: formatValue(value)
|
|
@@ -254,6 +257,7 @@ var ComfortableSlider = forwardRef(({
|
|
|
254
257
|
formatValue = String,
|
|
255
258
|
disabled = false,
|
|
256
259
|
name,
|
|
260
|
+
onCommit,
|
|
257
261
|
className,
|
|
258
262
|
...props
|
|
259
263
|
}, ref) => {
|
|
@@ -285,7 +289,7 @@ var ComfortableSlider = forwardRef(({
|
|
|
285
289
|
if (!el)
|
|
286
290
|
return;
|
|
287
291
|
const w = el.clientWidth;
|
|
288
|
-
const x =
|
|
292
|
+
const x = layoutPos({ clientX, clientY: 0 }, el);
|
|
289
293
|
if (w <= 0 || x === null)
|
|
290
294
|
return;
|
|
291
295
|
const borderLeft = (el.offsetWidth - w) / 2;
|
|
@@ -364,10 +368,12 @@ var ComfortableSlider = forwardRef(({
|
|
|
364
368
|
animate(zeroOffset, newVal === min ? zeroTarget : 0, spring2.fast);
|
|
365
369
|
}, [getValueFromX, onValueChange, variant, fillPercent, zeroOffset, zeroTarget, min, max]);
|
|
366
370
|
const handlePointerUp = useCallback2(() => {
|
|
371
|
+
if (dragging.current)
|
|
372
|
+
onCommit?.();
|
|
367
373
|
dragging.current = false;
|
|
368
374
|
setIsPressed(false);
|
|
369
375
|
setHoverPreview(null);
|
|
370
|
-
}, []);
|
|
376
|
+
}, [onCommit]);
|
|
371
377
|
const handleResizePointerDown = useCallback2((e) => {
|
|
372
378
|
if (disabled)
|
|
373
379
|
return;
|
|
@@ -392,10 +398,12 @@ var ComfortableSlider = forwardRef(({
|
|
|
392
398
|
animate(zeroOffset, newVal === min ? zeroTarget : 0, spring2.fast);
|
|
393
399
|
}, [getValueFromX, onValueChange, fillPercent, zeroOffset, zeroTarget, min, max]);
|
|
394
400
|
const handleResizePointerUp = useCallback2(() => {
|
|
401
|
+
if (handleDragging.current)
|
|
402
|
+
onCommit?.();
|
|
395
403
|
handleDragging.current = false;
|
|
396
404
|
setIsPressed(false);
|
|
397
405
|
setHoverPreview(null);
|
|
398
|
-
}, []);
|
|
406
|
+
}, [onCommit]);
|
|
399
407
|
const handleRadixChange = useCallback2((newValues) => {
|
|
400
408
|
onValueChange(newValues[0]);
|
|
401
409
|
}, [onValueChange]);
|
|
@@ -459,6 +467,7 @@ var ComfortableSlider = forwardRef(({
|
|
|
459
467
|
/* @__PURE__ */ jsx2(SliderPrimitive.Root, {
|
|
460
468
|
value: [value],
|
|
461
469
|
onValueChange: (v) => handleRadixChange(v),
|
|
470
|
+
onValueCommitted: () => onCommit?.(),
|
|
462
471
|
name,
|
|
463
472
|
min,
|
|
464
473
|
max,
|
|
@@ -656,7 +665,7 @@ var CompactSlider = forwardRef2(({
|
|
|
656
665
|
steps,
|
|
657
666
|
showSteps = false,
|
|
658
667
|
showValue = true,
|
|
659
|
-
valuePosition
|
|
668
|
+
valuePosition: valuePositionProp,
|
|
660
669
|
formatValue = String,
|
|
661
670
|
label,
|
|
662
671
|
disabled = false,
|
|
@@ -668,9 +677,13 @@ var CompactSlider = forwardRef2(({
|
|
|
668
677
|
hideFill = false,
|
|
669
678
|
thumbColor,
|
|
670
679
|
thumbBorderColor,
|
|
680
|
+
orientation = "horizontal",
|
|
681
|
+
onCommit,
|
|
671
682
|
className,
|
|
672
683
|
...props
|
|
673
684
|
}, ref) => {
|
|
685
|
+
const vertical = orientation === "vertical";
|
|
686
|
+
const valuePosition = valuePositionProp ?? (vertical ? "top" : "left");
|
|
674
687
|
const isRange = Array.isArray(value);
|
|
675
688
|
const values = toRadixValue(value);
|
|
676
689
|
const stepsKey = steps ? steps.join(",") : "";
|
|
@@ -704,14 +717,17 @@ var CompactSlider = forwardRef2(({
|
|
|
704
717
|
const fillWidthSingle = useTransform3(motionX0, (x) => x + THUMB_SIZE / 2 - TRACK_INSET);
|
|
705
718
|
const fillWidthRange = useTransform3([motionX0, motionX1], ([x0, x1]) => x1 - x0);
|
|
706
719
|
const fillWidth = isRange ? fillWidthRange : fillWidthSingle;
|
|
720
|
+
const thumbY0 = useTransform3(motionX0, (x) => -x);
|
|
721
|
+
const thumbY1 = useTransform3(motionX1, (x) => -x);
|
|
722
|
+
const maskDir = vertical ? "to top" : "to right";
|
|
707
723
|
const stepDotsMaskSingle = useTransform3(motionX0, (x) => {
|
|
708
724
|
const edge = x + THUMB_SIZE / 2;
|
|
709
|
-
return `linear-gradient(
|
|
725
|
+
return `linear-gradient(${maskDir}, transparent ${edge}px, black ${edge + 2}px)`;
|
|
710
726
|
});
|
|
711
727
|
const stepDotsMaskRange = useTransform3([motionX0, motionX1], ([x0, x1]) => {
|
|
712
728
|
const left = x0 + THUMB_SIZE / 2;
|
|
713
729
|
const right = x1 + THUMB_SIZE / 2;
|
|
714
|
-
return `linear-gradient(
|
|
730
|
+
return `linear-gradient(${maskDir}, black ${left - 2}px, transparent ${left}px, transparent ${right}px, black ${right + 2}px)`;
|
|
715
731
|
});
|
|
716
732
|
const stepDotsMask = isRange ? stepDotsMaskRange : stepDotsMaskSingle;
|
|
717
733
|
const computeHoverPreview = useCallback3((cursorX, trackWidth) => {
|
|
@@ -737,7 +753,7 @@ var CompactSlider = forwardRef2(({
|
|
|
737
753
|
const el = trackRef.current;
|
|
738
754
|
if (!el || initialSyncDone.current)
|
|
739
755
|
return;
|
|
740
|
-
const w = el
|
|
756
|
+
const w = axisLength(el, vertical);
|
|
741
757
|
trackWidthRef.current = w;
|
|
742
758
|
const px0 = valueToPixel(values[0], min, max, w);
|
|
743
759
|
motionX0.set(px0);
|
|
@@ -753,7 +769,7 @@ var CompactSlider = forwardRef2(({
|
|
|
753
769
|
if (!el)
|
|
754
770
|
return;
|
|
755
771
|
const ro = new ResizeObserver(([entry]) => {
|
|
756
|
-
const w = entry.contentRect.width;
|
|
772
|
+
const w = vertical ? entry.contentRect.height : entry.contentRect.width;
|
|
757
773
|
trackWidthRef.current = w;
|
|
758
774
|
if (!dragging.current && initialSyncDone.current) {
|
|
759
775
|
const v = valuesRef.current;
|
|
@@ -769,7 +785,7 @@ var CompactSlider = forwardRef2(({
|
|
|
769
785
|
});
|
|
770
786
|
ro.observe(el);
|
|
771
787
|
return () => ro.disconnect();
|
|
772
|
-
}, [isRange, motionX0, motionX1]);
|
|
788
|
+
}, [isRange, vertical, motionX0, motionX1]);
|
|
773
789
|
const valuesKey = values.join(",");
|
|
774
790
|
useEffect4(() => {
|
|
775
791
|
if (!initialSyncDone.current)
|
|
@@ -814,10 +830,10 @@ var CompactSlider = forwardRef2(({
|
|
|
814
830
|
const trackEl = trackRef.current;
|
|
815
831
|
if (!trackEl)
|
|
816
832
|
return;
|
|
817
|
-
const x =
|
|
833
|
+
const x = layoutPos(e, trackEl, vertical);
|
|
818
834
|
if (x === null)
|
|
819
835
|
return;
|
|
820
|
-
const layoutWidth = trackEl
|
|
836
|
+
const layoutWidth = axisLength(trackEl, vertical);
|
|
821
837
|
const clamped = Math.max(0, Math.min(layoutWidth - THUMB_SIZE, x - THUMB_SIZE / 2));
|
|
822
838
|
if (isRange) {
|
|
823
839
|
const dist0 = Math.abs(clamped - motionX0.get());
|
|
@@ -836,7 +852,7 @@ var CompactSlider = forwardRef2(({
|
|
|
836
852
|
const finalValue = pixelToValue(finalPx, min, max, step, layoutWidth, stepValues);
|
|
837
853
|
emitChange(activeDragThumb.current, finalValue);
|
|
838
854
|
e.currentTarget.setPointerCapture(e.pointerId);
|
|
839
|
-
}, [disabled, isRange, min, max, step, stepValues, motionX0, motionX1, clampForRange, emitChange]);
|
|
855
|
+
}, [disabled, vertical, isRange, min, max, step, stepValues, motionX0, motionX1, clampForRange, emitChange]);
|
|
840
856
|
const handlePointerMove = useCallback3((e) => {
|
|
841
857
|
if (!dragging.current)
|
|
842
858
|
return;
|
|
@@ -844,10 +860,10 @@ var CompactSlider = forwardRef2(({
|
|
|
844
860
|
const trackEl = trackRef.current;
|
|
845
861
|
if (!trackEl)
|
|
846
862
|
return;
|
|
847
|
-
const x =
|
|
863
|
+
const x = layoutPos(e, trackEl, vertical);
|
|
848
864
|
if (x === null)
|
|
849
865
|
return;
|
|
850
|
-
const layoutWidth = trackEl
|
|
866
|
+
const layoutWidth = axisLength(trackEl, vertical);
|
|
851
867
|
const clamped = Math.max(0, Math.min(layoutWidth - THUMB_SIZE, x - THUMB_SIZE / 2));
|
|
852
868
|
const motionX = activeDragThumb.current === 0 ? motionX0 : motionX1;
|
|
853
869
|
const snappedValue = pixelToValue(clamped, min, max, step, layoutWidth, stepValues);
|
|
@@ -856,11 +872,12 @@ var CompactSlider = forwardRef2(({
|
|
|
856
872
|
motionX.set(finalPx);
|
|
857
873
|
const finalValue = pixelToValue(finalPx, min, max, step, layoutWidth, stepValues);
|
|
858
874
|
emitChange(activeDragThumb.current, finalValue);
|
|
859
|
-
}, [min, max, step, stepValues, motionX0, motionX1, clampForRange, emitChange]);
|
|
875
|
+
}, [vertical, min, max, step, stepValues, motionX0, motionX1, clampForRange, emitChange]);
|
|
860
876
|
const handlePointerUp = useCallback3(() => {
|
|
861
877
|
if (!dragging.current)
|
|
862
878
|
return;
|
|
863
879
|
dragging.current = false;
|
|
880
|
+
onCommit?.();
|
|
864
881
|
setIsPressed(false);
|
|
865
882
|
setHoverPreview(null);
|
|
866
883
|
const tw = trackWidthRef.current;
|
|
@@ -869,7 +886,7 @@ var CompactSlider = forwardRef2(({
|
|
|
869
886
|
const snapped = pixelToValue(currentPx, min, max, step, tw, stepValues);
|
|
870
887
|
const snappedPx = valueToPixel(snapped, min, max, tw);
|
|
871
888
|
animate2(motionX, snappedPx, spring2.moderate);
|
|
872
|
-
}, [min, max, step, stepValues, motionX0, motionX1]);
|
|
889
|
+
}, [min, max, step, stepValues, motionX0, motionX1, onCommit]);
|
|
873
890
|
const handleRadixChange = useCallback3((newValues) => {
|
|
874
891
|
if (dragging.current)
|
|
875
892
|
return;
|
|
@@ -885,8 +902,9 @@ var CompactSlider = forwardRef2(({
|
|
|
885
902
|
}, []);
|
|
886
903
|
const handleCommitEdit = useCallback3((index, v) => {
|
|
887
904
|
emitChange(index, v);
|
|
905
|
+
onCommit?.();
|
|
888
906
|
setEditingIndex(null);
|
|
889
|
-
}, [emitChange]);
|
|
907
|
+
}, [emitChange, onCommit]);
|
|
890
908
|
const handleCancelEdit = useCallback3(() => {
|
|
891
909
|
setEditingIndex(null);
|
|
892
910
|
}, []);
|
|
@@ -925,7 +943,16 @@ var CompactSlider = forwardRef2(({
|
|
|
925
943
|
const motionX = index === 0 ? motionX0 : motionX1;
|
|
926
944
|
return /* @__PURE__ */ jsxs3(motion3.span, {
|
|
927
945
|
className: "flex items-center justify-center pointer-events-none",
|
|
928
|
-
style: {
|
|
946
|
+
style: vertical ? {
|
|
947
|
+
width: THUMB_SIZE,
|
|
948
|
+
height: THUMB_SIZE,
|
|
949
|
+
marginLeft: -THUMB_SIZE / 2,
|
|
950
|
+
y: index === 0 ? thumbY0 : thumbY1,
|
|
951
|
+
position: "absolute",
|
|
952
|
+
left: "50%",
|
|
953
|
+
bottom: 0,
|
|
954
|
+
zIndex: 10
|
|
955
|
+
} : {
|
|
929
956
|
width: THUMB_SIZE,
|
|
930
957
|
height: THUMB_SIZE,
|
|
931
958
|
marginTop: -THUMB_SIZE / 2,
|
|
@@ -965,13 +992,13 @@ var CompactSlider = forwardRef2(({
|
|
|
965
992
|
};
|
|
966
993
|
return /* @__PURE__ */ jsxs3("div", {
|
|
967
994
|
ref,
|
|
968
|
-
className: cn2("flex
|
|
995
|
+
className: cn2("flex gap-0 select-none touch-none overflow-visible", vertical ? "h-40 w-fit items-center" : "flex-col w-full", valuePosition === "left" || valuePosition === "right" ? vertical ? "flex-row gap-2" : "flex-row items-center gap-2 mb-2" : "flex-col", vertical && (valuePosition === "top" || valuePosition === "bottom" || valuePosition === "tooltip") && "gap-2", disabled && "opacity-50 pointer-events-none", className),
|
|
969
996
|
...props,
|
|
970
997
|
children: [
|
|
971
998
|
(valuePosition === "top" || valuePosition === "left") && valueDisplay,
|
|
972
999
|
/* @__PURE__ */ jsxs3("div", {
|
|
973
|
-
className: "relative flex-1
|
|
974
|
-
style: {
|
|
1000
|
+
className: cn2("relative overflow-visible", vertical ? "min-h-0 min-w-0" : "flex-1", vertical && (valuePosition === "left" || valuePosition === "right" ? "h-full" : "flex-1")),
|
|
1001
|
+
style: vertical ? { width: THUMB_SIZE + 16 } : {
|
|
975
1002
|
height: valuePosition === "left" || valuePosition === "right" ? THUMB_SIZE + 16 : THUMB_SIZE + (valuePosition === "tooltip" ? 16 : 0),
|
|
976
1003
|
paddingTop: valuePosition === "tooltip" ? 16 : 0
|
|
977
1004
|
},
|
|
@@ -986,10 +1013,11 @@ var CompactSlider = forwardRef2(({
|
|
|
986
1013
|
const trackEl = trackRef.current;
|
|
987
1014
|
if (!trackEl)
|
|
988
1015
|
return;
|
|
989
|
-
const x =
|
|
1016
|
+
const x = layoutPos(e, trackEl, vertical);
|
|
990
1017
|
if (x === null)
|
|
991
1018
|
return;
|
|
992
|
-
|
|
1019
|
+
const length = axisLength(trackEl, vertical);
|
|
1020
|
+
computeHoverPreview(Math.max(0, Math.min(length, x)), length);
|
|
993
1021
|
},
|
|
994
1022
|
children: [
|
|
995
1023
|
showValue && valuePosition === "tooltip" && /* @__PURE__ */ jsxs3(AnimatePresence2, {
|
|
@@ -997,25 +1025,29 @@ var CompactSlider = forwardRef2(({
|
|
|
997
1025
|
isInteracting && /* @__PURE__ */ jsx3(TooltipValue, {
|
|
998
1026
|
value: values[0],
|
|
999
1027
|
formatValue,
|
|
1000
|
-
motionX: motionX0
|
|
1028
|
+
motionX: motionX0,
|
|
1029
|
+
vertical
|
|
1001
1030
|
}, "tooltip-0"),
|
|
1002
1031
|
isInteracting && isRange && values[1] !== undefined && /* @__PURE__ */ jsx3(TooltipValue, {
|
|
1003
1032
|
value: values[1],
|
|
1004
1033
|
formatValue,
|
|
1005
|
-
motionX: motionX1
|
|
1034
|
+
motionX: motionX1,
|
|
1035
|
+
vertical
|
|
1006
1036
|
}, "tooltip-1")
|
|
1007
1037
|
]
|
|
1008
1038
|
}),
|
|
1009
1039
|
/* @__PURE__ */ jsx3(SliderPrimitive2.Root, {
|
|
1010
1040
|
value: stepValues ? values.map((v) => nearestStepIndex(v, stepValues)) : values,
|
|
1011
1041
|
onValueChange: (v) => handleRadixChange(v),
|
|
1042
|
+
onValueCommitted: () => onCommit?.(),
|
|
1012
1043
|
name,
|
|
1013
1044
|
min: stepValues ? 0 : min,
|
|
1014
1045
|
max: stepValues ? stepValues.length - 1 : max,
|
|
1015
1046
|
step: stepValues ? 1 : step,
|
|
1047
|
+
orientation,
|
|
1016
1048
|
disabled,
|
|
1017
1049
|
className: "absolute inset-0 opacity-0 pointer-events-none",
|
|
1018
|
-
style: { height: THUMB_SIZE },
|
|
1050
|
+
style: vertical ? { width: THUMB_SIZE } : { height: THUMB_SIZE },
|
|
1019
1051
|
children: /* @__PURE__ */ jsxs3(SliderPrimitive2.Control, {
|
|
1020
1052
|
className: "w-full h-full",
|
|
1021
1053
|
children: [
|
|
@@ -1052,16 +1084,16 @@ var CompactSlider = forwardRef2(({
|
|
|
1052
1084
|
}),
|
|
1053
1085
|
/* @__PURE__ */ jsxs3("div", {
|
|
1054
1086
|
ref: trackRef,
|
|
1055
|
-
className: "relative w-full cursor-ew-resize py-2",
|
|
1056
|
-
style: { height: THUMB_SIZE + 16, opacity: ready ? 1 : 0 },
|
|
1087
|
+
className: cn2("relative", vertical ? "h-full cursor-ns-resize px-2" : "w-full cursor-ew-resize py-2"),
|
|
1088
|
+
style: vertical ? { width: THUMB_SIZE + 16, opacity: ready ? 1 : 0 } : { height: THUMB_SIZE + 16, opacity: ready ? 1 : 0 },
|
|
1057
1089
|
onPointerDown: handlePointerDown,
|
|
1058
1090
|
onPointerMove: handlePointerMove,
|
|
1059
1091
|
onPointerUp: handlePointerUp,
|
|
1060
1092
|
onPointerCancel: handlePointerUp,
|
|
1061
1093
|
children: [
|
|
1062
1094
|
/* @__PURE__ */ jsx3("div", {
|
|
1063
|
-
className: "absolute cursor-ew-resize",
|
|
1064
|
-
style: { left: -8, right: -8, top: 0, bottom: 0 },
|
|
1095
|
+
className: cn2("absolute", vertical ? "cursor-ns-resize" : "cursor-ew-resize"),
|
|
1096
|
+
style: vertical ? { left: 0, right: 0, top: -8, bottom: -8 } : { left: -8, right: -8, top: 0, bottom: 0 },
|
|
1065
1097
|
onPointerDown: handlePointerDown,
|
|
1066
1098
|
onPointerMove: handlePointerMove,
|
|
1067
1099
|
onPointerUp: handlePointerUp,
|
|
@@ -1069,15 +1101,12 @@ var CompactSlider = forwardRef2(({
|
|
|
1069
1101
|
}),
|
|
1070
1102
|
/* @__PURE__ */ jsx3(AnimatePresence2, {
|
|
1071
1103
|
children: hoverPreview && showHoverTooltip && !isPressed && valuePosition !== "tooltip" && /* @__PURE__ */ jsx3(motion3.div, {
|
|
1072
|
-
className: "absolute -translate-
|
|
1073
|
-
initial: { opacity: 0, y: 4 },
|
|
1074
|
-
animate: { opacity: 1, y: 0 },
|
|
1075
|
-
exit: { opacity: 0, y: 4, transition: spring2.fast.exit },
|
|
1104
|
+
className: cn2("absolute pointer-events-none z-20", vertical ? "translate-y-1/2" : "-translate-x-1/2"),
|
|
1105
|
+
initial: vertical ? { opacity: 0, x: -4 } : { opacity: 0, y: 4 },
|
|
1106
|
+
animate: vertical ? { opacity: 1, x: 0 } : { opacity: 1, y: 0 },
|
|
1107
|
+
exit: vertical ? { opacity: 0, x: -4, transition: spring2.fast.exit } : { opacity: 0, y: 4, transition: spring2.fast.exit },
|
|
1076
1108
|
transition: spring2.fast,
|
|
1077
|
-
style: {
|
|
1078
|
-
left: hoverPreview.cursorX,
|
|
1079
|
-
top: -20
|
|
1080
|
-
},
|
|
1109
|
+
style: vertical ? { bottom: hoverPreview.cursorX, left: "calc(100% + 4px)" } : { left: hoverPreview.cursorX, top: -20 },
|
|
1081
1110
|
children: /* @__PURE__ */ jsx3(ValueBubble, {
|
|
1082
1111
|
children: formatValue(hoverPreview.snappedValue)
|
|
1083
1112
|
})
|
|
@@ -1086,27 +1115,22 @@ var CompactSlider = forwardRef2(({
|
|
|
1086
1115
|
/* @__PURE__ */ jsxs3(motion3.div, {
|
|
1087
1116
|
className: cn2("absolute bg-transparent border border-border overflow-hidden rounded-full", trackClassName),
|
|
1088
1117
|
initial: false,
|
|
1089
|
-
animate: {
|
|
1090
|
-
height: TRACK_BG_HEIGHT,
|
|
1091
|
-
top: 8 + (THUMB_SIZE - TRACK_BG_HEIGHT) / 2
|
|
1092
|
-
},
|
|
1118
|
+
animate: vertical ? { width: TRACK_BG_HEIGHT, left: 8 + (THUMB_SIZE - TRACK_BG_HEIGHT) / 2 } : { height: TRACK_BG_HEIGHT, top: 8 + (THUMB_SIZE - TRACK_BG_HEIGHT) / 2 },
|
|
1093
1119
|
transition: spring2.fast,
|
|
1094
1120
|
style: {
|
|
1095
|
-
left: TRACK_INSET,
|
|
1096
|
-
right: TRACK_INSET,
|
|
1121
|
+
...vertical ? { top: TRACK_INSET, bottom: TRACK_INSET } : { left: TRACK_INSET, right: TRACK_INSET },
|
|
1097
1122
|
...trackStyle
|
|
1098
1123
|
},
|
|
1099
1124
|
children: [
|
|
1100
1125
|
!hideFill && /* @__PURE__ */ jsx3(motion3.div, {
|
|
1101
|
-
className: cn2("absolute
|
|
1126
|
+
className: cn2("absolute bg-selected/50 dark:bg-accent/40", vertical ? "w-full" : "h-full", fillClassName),
|
|
1102
1127
|
style: {
|
|
1103
|
-
left: fillLeft,
|
|
1104
|
-
width: fillWidth,
|
|
1128
|
+
...vertical ? { bottom: fillLeft, height: fillWidth } : { left: fillLeft, width: fillWidth },
|
|
1105
1129
|
...fillStyle
|
|
1106
1130
|
}
|
|
1107
1131
|
}),
|
|
1108
1132
|
/* @__PURE__ */ jsx3(motion3.div, {
|
|
1109
|
-
className: "absolute
|
|
1133
|
+
className: cn2("absolute bg-accent/40 pointer-events-none z-[2]", vertical ? "w-full" : "h-full"),
|
|
1110
1134
|
initial: false,
|
|
1111
1135
|
animate: {
|
|
1112
1136
|
opacity: hoverPreview && !isPressed ? 1 : 0
|
|
@@ -1115,26 +1139,29 @@ var CompactSlider = forwardRef2(({
|
|
|
1115
1139
|
opacity: { duration: 0.15 }
|
|
1116
1140
|
},
|
|
1117
1141
|
style: {
|
|
1118
|
-
|
|
1119
|
-
|
|
1120
|
-
|
|
1142
|
+
...vertical ? {
|
|
1143
|
+
bottom: hoverPreview ? hoverPreview.left - TRACK_INSET : 0,
|
|
1144
|
+
height: hoverPreview ? hoverPreview.width : 0
|
|
1145
|
+
} : {
|
|
1146
|
+
left: hoverPreview ? hoverPreview.left - TRACK_INSET : 0,
|
|
1147
|
+
width: hoverPreview ? hoverPreview.width : 0
|
|
1148
|
+
},
|
|
1149
|
+
borderRadius: hoverPreview && hoverPreview.cursorX > hoverPreview.left ? vertical ? "9999px 9999px 0 0" : "0 9999px 9999px 0" : vertical ? "0 0 9999px 9999px" : "9999px 0 0 9999px"
|
|
1121
1150
|
}
|
|
1122
1151
|
})
|
|
1123
1152
|
]
|
|
1124
1153
|
}),
|
|
1125
1154
|
stepDots.length > 0 && /* @__PURE__ */ jsx3(motion3.div, {
|
|
1126
|
-
className: "absolute
|
|
1155
|
+
className: cn2("absolute pointer-events-none", vertical ? "top-0 bottom-0" : "left-0 right-0"),
|
|
1127
1156
|
style: {
|
|
1128
|
-
top: 8 + (THUMB_SIZE - TRACK_BG_HEIGHT) / 2,
|
|
1129
|
-
height: TRACK_BG_HEIGHT,
|
|
1157
|
+
...vertical ? { left: 8 + (THUMB_SIZE - TRACK_BG_HEIGHT) / 2, width: TRACK_BG_HEIGHT } : { top: 8 + (THUMB_SIZE - TRACK_BG_HEIGHT) / 2, height: TRACK_BG_HEIGHT },
|
|
1130
1158
|
WebkitMaskImage: stepDotsMask,
|
|
1131
1159
|
maskImage: stepDotsMask
|
|
1132
1160
|
},
|
|
1133
1161
|
children: stepDots.map(({ value: v, percent }) => /* @__PURE__ */ jsx3("div", {
|
|
1134
1162
|
className: "absolute pointer-events-none flex items-center justify-center",
|
|
1135
1163
|
style: {
|
|
1136
|
-
left: `calc(${THUMB_SIZE / 2}px + ${percent} * (100% - ${THUMB_SIZE}px))`,
|
|
1137
|
-
top: "50%",
|
|
1164
|
+
...vertical ? { bottom: `calc(${THUMB_SIZE / 2}px + ${percent} * (100% - ${THUMB_SIZE}px))`, left: "50%" } : { left: `calc(${THUMB_SIZE / 2}px + ${percent} * (100% - ${THUMB_SIZE}px))`, top: "50%" },
|
|
1138
1165
|
width: 0,
|
|
1139
1166
|
height: 0
|
|
1140
1167
|
},
|
|
@@ -1182,15 +1209,23 @@ var COMPACT_ONLY = [
|
|
|
1182
1209
|
"thumbColor",
|
|
1183
1210
|
"thumbBorderColor"
|
|
1184
1211
|
];
|
|
1185
|
-
var Slider2 = forwardRef3(({ size, variant = "pips", value: valueProp, defaultValue, onValueChange, ...rest }, ref) => {
|
|
1212
|
+
var Slider2 = forwardRef3(({ size, variant = "pips", value: valueProp, defaultValue, onValueChange, onValueCommit, ...rest }, ref) => {
|
|
1186
1213
|
const [value, setValue] = useControllableState2(valueProp, defaultValue ?? (rest.steps && rest.steps.length > 0 ? Math.min(...rest.steps) : rest.min ?? 0), onValueChange);
|
|
1187
1214
|
const resolved = useSizeVariant2(size);
|
|
1188
|
-
|
|
1215
|
+
const latest = useRef4(value);
|
|
1216
|
+
latest.current = value;
|
|
1217
|
+
const change = (next) => {
|
|
1218
|
+
latest.current = next;
|
|
1219
|
+
setValue(next);
|
|
1220
|
+
};
|
|
1221
|
+
const onCommit = onValueCommit && (() => onValueCommit(latest.current));
|
|
1222
|
+
if (resolved === "compact" || Array.isArray(value) || rest.orientation === "vertical" || COMPACT_ONLY.some((key) => rest[key] !== undefined)) {
|
|
1189
1223
|
return /* @__PURE__ */ jsx4(CompactSlider, {
|
|
1190
1224
|
ref,
|
|
1191
1225
|
...rest,
|
|
1192
1226
|
value,
|
|
1193
|
-
onValueChange:
|
|
1227
|
+
onValueChange: change,
|
|
1228
|
+
onCommit
|
|
1194
1229
|
});
|
|
1195
1230
|
}
|
|
1196
1231
|
const {
|
|
@@ -1205,13 +1240,15 @@ var Slider2 = forwardRef3(({ size, variant = "pips", value: valueProp, defaultVa
|
|
|
1205
1240
|
hideFill,
|
|
1206
1241
|
thumbColor,
|
|
1207
1242
|
thumbBorderColor,
|
|
1243
|
+
orientation,
|
|
1208
1244
|
...comfortable
|
|
1209
1245
|
} = rest;
|
|
1210
1246
|
return /* @__PURE__ */ jsx4(ComfortableSlider, {
|
|
1211
1247
|
ref,
|
|
1212
1248
|
...comfortable,
|
|
1213
1249
|
value,
|
|
1214
|
-
onValueChange:
|
|
1250
|
+
onValueChange: change,
|
|
1251
|
+
onCommit,
|
|
1215
1252
|
variant
|
|
1216
1253
|
});
|
|
1217
1254
|
});
|
|
@@ -29,7 +29,7 @@ var RING_FILL = {
|
|
|
29
29
|
warning: "text-status-warning",
|
|
30
30
|
error: "text-status-error"
|
|
31
31
|
};
|
|
32
|
-
var RING_SIZE = { default:
|
|
32
|
+
var RING_SIZE = { default: "size-4", compact: "size-3.5" };
|
|
33
33
|
var CAPTION = { default: "text-caption", compact: "text-caption-compact" };
|
|
34
34
|
var enter = springEnter2(spring2.moderate);
|
|
35
35
|
function toneOf(share, warnAt, errorAt) {
|
|
@@ -49,6 +49,8 @@ var Meter2 = forwardRef(({
|
|
|
49
49
|
errorAt = 0.9,
|
|
50
50
|
tone: toneProp,
|
|
51
51
|
marker,
|
|
52
|
+
animate = true,
|
|
53
|
+
children,
|
|
52
54
|
size: sizeProp,
|
|
53
55
|
className
|
|
54
56
|
}, ref) => {
|
|
@@ -56,42 +58,47 @@ var Meter2 = forwardRef(({
|
|
|
56
58
|
const reduceMotion = useReduceMotion2();
|
|
57
59
|
const share = Math.min(Math.max(value / max, 0), 1);
|
|
58
60
|
const tone = toneProp ?? toneOf(share, warnAt, errorAt);
|
|
59
|
-
const transition = reduceMotion ? { duration: 0 } : enter;
|
|
61
|
+
const transition = reduceMotion || !animate ? { duration: 0 } : enter;
|
|
60
62
|
const root = { ref, value, max, "aria-label": label };
|
|
61
63
|
if (variant === "ring") {
|
|
62
|
-
const
|
|
63
|
-
return /* @__PURE__ */
|
|
64
|
+
const valueText = typeof children === "string" ? children : undefined;
|
|
65
|
+
return /* @__PURE__ */ jsxs(MeterPrimitive.Root, {
|
|
64
66
|
...root,
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
67
|
+
getAriaValueText: valueText === undefined ? undefined : () => valueText,
|
|
68
|
+
className: cn2("relative inline-grid shrink-0 place-items-center", RING_SIZE[size.variant], className),
|
|
69
|
+
children: [
|
|
70
|
+
/* @__PURE__ */ jsxs("svg", {
|
|
71
|
+
viewBox: "0 0 20 20",
|
|
72
|
+
"aria-hidden": "true",
|
|
73
|
+
className: "absolute inset-0 size-full -rotate-90",
|
|
74
|
+
children: [
|
|
75
|
+
/* @__PURE__ */ jsx("circle", {
|
|
76
|
+
cx: "10",
|
|
77
|
+
cy: "10",
|
|
78
|
+
r: "7",
|
|
79
|
+
fill: "none",
|
|
80
|
+
strokeWidth: "2.5",
|
|
81
|
+
className: "stroke-current text-border"
|
|
82
|
+
}),
|
|
83
|
+
/* @__PURE__ */ jsx(motion.circle, {
|
|
84
|
+
cx: "10",
|
|
85
|
+
cy: "10",
|
|
86
|
+
r: "7",
|
|
87
|
+
fill: "none",
|
|
88
|
+
strokeWidth: "2.5",
|
|
89
|
+
strokeLinecap: "round",
|
|
90
|
+
className: cn2("stroke-current transition-[color] duration-fast", RING_FILL[tone]),
|
|
91
|
+
initial: false,
|
|
92
|
+
animate: { pathLength: share },
|
|
93
|
+
transition
|
|
94
|
+
})
|
|
95
|
+
]
|
|
96
|
+
}),
|
|
97
|
+
children !== undefined && /* @__PURE__ */ jsx("span", {
|
|
98
|
+
className: "relative tabular-nums",
|
|
99
|
+
children
|
|
100
|
+
})
|
|
101
|
+
]
|
|
95
102
|
});
|
|
96
103
|
}
|
|
97
104
|
const track = /* @__PURE__ */ jsxs("div", {
|
|
@@ -14,17 +14,17 @@ import {
|
|
|
14
14
|
} from "./components-45r18egt.js";
|
|
15
15
|
import {
|
|
16
16
|
useMorph2
|
|
17
|
-
} from "./components-
|
|
17
|
+
} from "./components-mp7en54n.js";
|
|
18
|
+
import {
|
|
19
|
+
cn2
|
|
20
|
+
} from "./components-xnp09586.js";
|
|
18
21
|
import {
|
|
19
22
|
positionerProps2,
|
|
20
23
|
usePortalContainer2
|
|
21
|
-
} from "./components-
|
|
24
|
+
} from "./components-xvf8jcza.js";
|
|
22
25
|
import {
|
|
23
26
|
POPUP_SHAPE2
|
|
24
27
|
} from "./components-mse06t0x.js";
|
|
25
|
-
import {
|
|
26
|
-
cn2
|
|
27
|
-
} from "./components-xnp09586.js";
|
|
28
28
|
import {
|
|
29
29
|
useShape2
|
|
30
30
|
} from "./components-kxpcj2ry.js";
|
|
@@ -37,18 +37,18 @@ import {
|
|
|
37
37
|
} from "./components-nwa2a9tq.js";
|
|
38
38
|
import {
|
|
39
39
|
PopupSurface2
|
|
40
|
-
} from "./components-
|
|
40
|
+
} from "./components-90sfqz5t.js";
|
|
41
41
|
import {
|
|
42
42
|
useSize2
|
|
43
43
|
} from "./components-znspksk0.js";
|
|
44
44
|
import {
|
|
45
45
|
SizeScope2
|
|
46
|
-
} from "./components-
|
|
46
|
+
} from "./components-ffng9rpa.js";
|
|
47
47
|
import {
|
|
48
48
|
CommandListRoot2,
|
|
49
49
|
CommandShortcut2,
|
|
50
50
|
CommandList2
|
|
51
|
-
} from "./components-
|
|
51
|
+
} from "./components-nc8wggew.js";
|
|
52
52
|
|
|
53
53
|
// components/inputs/search/index.tsx
|
|
54
54
|
import { Autocomplete } from "@base-ui/react/autocomplete";
|
|
@@ -26,11 +26,11 @@ import {
|
|
|
26
26
|
} from "./components-45r18egt.js";
|
|
27
27
|
import {
|
|
28
28
|
button_default
|
|
29
|
-
} from "./components-
|
|
29
|
+
} from "./components-31pkxwfz.js";
|
|
30
30
|
import {
|
|
31
31
|
Spinner2,
|
|
32
32
|
progress_default
|
|
33
|
-
} from "./components-
|
|
33
|
+
} from "./components-wqac4434.js";
|
|
34
34
|
import {
|
|
35
35
|
formatFileSize2,
|
|
36
36
|
dragVerdict2,
|
|
@@ -11,7 +11,7 @@ import {
|
|
|
11
11
|
} from "./components-znspksk0.js";
|
|
12
12
|
import {
|
|
13
13
|
SizeScope2
|
|
14
|
-
} from "./components-
|
|
14
|
+
} from "./components-ffng9rpa.js";
|
|
15
15
|
import {
|
|
16
16
|
useMergeRefs2
|
|
17
17
|
} from "./components-bkwjvvkh.js";
|
|
@@ -30,10 +30,10 @@ import {
|
|
|
30
30
|
} from "./components-y09nr7fe.js";
|
|
31
31
|
import {
|
|
32
32
|
FocusRing2
|
|
33
|
-
} from "./components-
|
|
33
|
+
} from "./components-v1m0xjbw.js";
|
|
34
34
|
import {
|
|
35
35
|
GooIndicator2
|
|
36
|
-
} from "./components-
|
|
36
|
+
} from "./components-gvwxswpr.js";
|
|
37
37
|
import {
|
|
38
38
|
useRowFocus2
|
|
39
39
|
} from "./components-vcte8p75.js";
|