@justanarthur/modo-ui 0.1.0 → 0.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/dist/blocks/sidebar-app/index.d.ts +1 -1
- package/dist/blocks/sidebar-app/index.js +28 -31
- package/dist/components/badge/index.d.ts +1 -1
- package/dist/components/badge/index.js +12 -14
- package/dist/components/button/index.d.ts +1 -1
- package/dist/components/button/index.js +10 -12
- package/dist/components/card/index.d.ts +1 -1
- package/dist/components/card/index.js +38 -40
- package/dist/components/inputs/checkbox-group/index.d.ts +1 -1
- package/dist/components/inputs/checkbox-group/index.js +17 -19
- package/dist/components/inputs/color-picker/index.d.ts +1 -1
- package/dist/components/inputs/color-picker/index.js +31 -33
- package/dist/components/inputs/combobox/index.d.ts +1 -1
- package/dist/components/inputs/combobox/index.js +31 -34
- package/dist/components/inputs/date-time/calendar/index.d.ts +1 -1
- package/dist/components/inputs/date-time/calendar/index.js +14 -16
- package/dist/components/inputs/date-time/date-picker/index.d.ts +1 -1
- package/dist/components/inputs/date-time/date-picker/index.js +28 -30
- package/dist/components/inputs/date-time/date-range-picker/index.d.ts +1 -1
- package/dist/components/inputs/date-time/date-range-picker/index.js +27 -29
- package/dist/components/inputs/date-time/duration-picker/index.d.ts +1 -1
- package/dist/components/inputs/date-time/duration-picker/index.js +27 -29
- package/dist/components/inputs/date-time/month-picker/index.d.ts +1 -1
- package/dist/components/inputs/date-time/month-picker/index.js +26 -28
- package/dist/components/inputs/date-time/time-picker/index.d.ts +1 -1
- package/dist/components/inputs/date-time/time-picker/index.js +27 -29
- package/dist/components/inputs/input/index.d.ts +1 -1
- package/dist/components/inputs/input/index.js +15 -16
- package/dist/components/inputs/input-copy/index.d.ts +1 -1
- package/dist/components/inputs/input-copy/index.js +12 -14
- package/dist/components/inputs/input-message/index.d.ts +1 -1
- package/dist/components/inputs/input-message/index.js +21 -23
- package/dist/components/inputs/radio-group/index.d.ts +1 -1
- package/dist/components/inputs/radio-group/index.js +16 -18
- package/dist/components/inputs/search/index.d.ts +1 -1
- package/dist/components/inputs/search/index.js +21 -24
- package/dist/components/inputs/select/index.d.ts +1 -1
- package/dist/components/inputs/select/index.js +30 -33
- package/dist/components/inputs/slider/index.d.ts +1 -1
- package/dist/components/inputs/slider/index.js +10 -12
- package/dist/components/inputs/switch/index.d.ts +1 -1
- package/dist/components/inputs/switch/index.js +10 -12
- package/dist/components/navigation/accordion/index.d.ts +1 -1
- package/dist/components/navigation/accordion/index.js +24 -26
- package/dist/components/navigation/sidebar/index.d.ts +3 -3
- package/dist/components/navigation/sidebar/index.js +95 -97
- package/dist/components/navigation/tabs/index.d.ts +1 -1
- package/dist/components/navigation/tabs/index.js +19 -21
- package/dist/components/navigation/tabs-subtle/index.d.ts +1 -1
- package/dist/components/navigation/tabs-subtle/index.js +17 -19
- package/dist/components/overlays/alert-dialog/index.d.ts +2 -2
- package/dist/components/overlays/alert-dialog/index.js +18 -20
- package/dist/components/overlays/command/index.d.ts +1 -1
- package/dist/components/overlays/command/index.js +32 -35
- package/dist/components/overlays/context-menu/index.d.ts +1 -1
- package/dist/components/overlays/context-menu/index.js +25 -28
- package/dist/components/overlays/dialog/index.d.ts +1 -1
- package/dist/components/overlays/dialog/index.js +33 -35
- package/dist/components/overlays/dropdown/index.d.ts +1 -1
- package/dist/components/overlays/dropdown/index.js +40 -43
- package/dist/components/overlays/popover/index.d.ts +1 -1
- package/dist/components/overlays/popover/index.js +22 -24
- package/dist/components/overlays/preview-card/index.d.ts +1 -1
- package/dist/components/overlays/preview-card/index.js +15 -17
- package/dist/components/overlays/sheet/index.d.ts +1 -1
- package/dist/components/overlays/sheet/index.js +20 -22
- package/dist/components/overlays/toast/index.d.ts +1 -1
- package/dist/components/overlays/toast/index.js +17 -19
- package/dist/components/overlays/tooltip/index.d.ts +1 -1
- package/dist/components/overlays/tooltip/index.js +13 -15
- package/dist/components/table/index.d.ts +1 -1
- package/dist/components/table/index.js +22 -24
- package/dist/components/thinking-indicator/index.d.ts +1 -1
- package/dist/components/thinking-indicator/index.js +9 -11
- package/dist/index.d.ts +51 -51
- package/dist/index.js +506 -508
- package/dist/preset.d.ts +1 -1
- package/dist/preset.js +5 -5
- package/dist/primitives/code/index.d.ts +1 -1
- package/dist/primitives/code/index.js +8 -9
- package/dist/primitives/craft/index.d.ts +1 -1
- package/dist/primitives/craft/index.js +6 -8
- package/dist/primitives/fluid-hover/index.d.ts +1 -1
- package/dist/primitives/fluid-hover/index.js +18 -20
- package/dist/primitives/morph/index.d.ts +1 -1
- package/dist/primitives/morph/index.js +15 -17
- package/dist/primitives/motion/index.d.ts +1 -1
- package/dist/primitives/motion/index.js +15 -16
- package/dist/primitives/scroll-area/index.d.ts +1 -1
- package/dist/primitives/scroll-area/index.js +8 -9
- package/dist/primitives/sizes/index.d.ts +1 -1
- package/dist/primitives/sizes/index.js +17 -18
- package/dist/primitives/surface/index.d.ts +1 -1
- package/dist/primitives/surface/index.js +11 -12
- package/dist/shared/components-0ke6xada.js +123 -0
- package/dist/shared/{components-jxgznftn.js → components-0q0sqfh4.js} +16 -16
- package/dist/shared/{components-x3rz4cyn.js → components-0sn7ypjw.js} +14 -14
- package/dist/shared/{components-p2vmyfe1.js → components-1j9791sn.js} +42 -42
- package/dist/shared/{components-6phwsry6.js → components-1rfwbyyc.js} +25 -25
- package/dist/shared/{components-vc1k7yv2.js → components-1v7rxytx.js} +3 -3
- package/dist/shared/{components-tm88ghva.js → components-1xekx2hx.js} +58 -58
- package/dist/shared/{components-6t6nr33r.js → components-39jq9va1.js} +26 -26
- package/dist/shared/{components-j65qt1mq.js → components-3gae8nta.js} +101 -101
- package/dist/shared/{components-r2gke5p6.js → components-3k8xpnpq.js} +125 -125
- package/dist/shared/{components-6y1th6k4.js → components-3mkepka5.js} +31 -31
- package/dist/shared/{components-vktws5r6.js → components-3wk0w46f.js} +72 -72
- package/dist/shared/{components-zx2hr57f.js → components-4cnjmgex.js} +15 -15
- package/dist/shared/{components-e46kf6cp.js → components-59efxjd9.js} +8 -8
- package/dist/shared/{components-rc63qsy6.js → components-5xc2j8jz.js} +10 -10
- package/dist/shared/{components-7gv95yfy.js → components-62ybc7t2.js} +83 -83
- package/dist/shared/{components-brnzrp2t.js → components-66mv71kx.js} +41 -41
- package/dist/shared/{components-taxmgbnh.js → components-7ans7ce5.js} +17 -17
- package/dist/shared/{components-hzfp4tjb.js → components-7btqt08d.js} +42 -42
- package/dist/shared/{components-9p8s8n5q.js → components-7r3etddy.js} +22 -22
- package/dist/shared/{components-5zry9te1.js → components-7x9kawxv.js} +26 -26
- package/dist/shared/{components-4hh0gm0v.js → components-8fpr3s4p.js} +61 -61
- package/dist/shared/{components-x2xyckd5.js → components-9jvzzvt1.js} +20 -20
- package/dist/shared/{components-bf2d9k02.js → components-apdwtweq.js} +94 -94
- package/dist/shared/{components-hjkrv00c.js → components-asr5pg50.js} +18 -18
- package/dist/shared/{components-5pkcfprd.js → components-b2wyq2cq.js} +22 -22
- package/dist/shared/{components-nn6xezy2.js → components-ca2c898n.js} +226 -226
- package/dist/shared/{components-xszag63d.js → components-cbxjn9p8.js} +12 -12
- package/dist/shared/{components-kf2ehztc.js → components-chacnk61.js} +16 -16
- package/dist/shared/{components-7zp99w5d.js → components-cv16mryv.js} +2 -2
- package/dist/shared/{components-4xxtggzp.js → components-ez65vtbq.js} +18 -18
- package/dist/shared/{components-0f0as45n.js → components-ezxhrmer.js} +2 -2
- package/dist/shared/{components-s3yfvfkr.js → components-gc5vtq2f.js} +42 -42
- package/dist/shared/components-gf5s6ap9.js +42 -0
- package/dist/shared/{components-7cqq1sqy.js → components-gvr9w41t.js} +40 -40
- package/dist/shared/{components-ess3ch6w.js → components-h2dpcwgc.js} +23 -23
- package/dist/shared/{components-ed7cmssr.js → components-hawvy2qz.js} +18 -18
- package/dist/shared/{components-7nww01w4.js → components-hqeq3w9q.js} +34 -34
- package/dist/shared/{components-vb033rns.js → components-jjw69c4c.js} +6 -6
- package/dist/shared/{components-tad5h7ta.js → components-jwst3vtj.js} +48 -48
- package/dist/shared/{components-r22vtgqc.js → components-kvr7f9hy.js} +11 -11
- package/dist/shared/{components-gndm6am4.js → components-ng72k97e.js} +17 -17
- package/dist/shared/{components-40j34hdb.js → components-nh8tma1n.js} +116 -116
- package/dist/shared/{components-s5pkbjx1.js → components-njzgqdwy.js} +56 -56
- package/dist/shared/{components-54nf2x99.js → components-ny774h8p.js} +42 -42
- package/dist/shared/{components-r4jt6hgd.js → components-q4daerx0.js} +6 -6
- package/dist/shared/{components-peg09pzs.js → components-q5xj5c16.js} +11 -11
- package/dist/shared/{components-r43mqnd6.js → components-rr7a6ja9.js} +46 -46
- package/dist/shared/{components-bkvb6nem.js → components-s2bz1xpk.js} +11 -11
- package/dist/shared/{components-zvb11ker.js → components-tqvarbfv.js} +47 -47
- package/dist/shared/{components-aaq3yk4f.js → components-v6xp325t.js} +43 -43
- package/dist/shared/{components-v7es8aan.js → components-v7wtz8hk.js} +15 -15
- package/dist/shared/components-vc7vq5nz.js +32 -0
- package/dist/shared/{components-6hzwfmfd.js → components-vfbhxf5r.js} +8 -8
- package/dist/shared/{components-8hk9ve3r.js → components-wvp1m52g.js} +57 -57
- package/dist/shared/{components-gjfrycb5.js → components-yh3kwdhr.js} +63 -66
- package/dist/shared/{components-y3cqdrgy.js → components-ytb2tefr.js} +43 -43
- package/dist/shared/{components-61ckf42z.js → components-zfnmn5d4.js} +64 -64
- package/dist/shared/{components-m5br529r.js → components-zrkzcayz.js} +2 -2
- package/dist/shared/{components-csxz9f52.js → components-zx6b6yby.js} +4 -4
- package/dist/styles.css +1 -1
- package/package.json +3 -3
- package/dist/shared/components-74c20v2f.js +0 -32
- package/dist/shared/components-8hzbsfbd.js +0 -123
- package/dist/shared/components-dphg9gjr.js +0 -42
- package/dist/shared/components-kpbcms10.js +0 -9
- /package/dist/shared/{components-5vxtcp88.js → components-3ky44908.js} +0 -0
- /package/dist/shared/{components-4xxddc44.js → components-c6s6b43g.js} +0 -0
- /package/dist/shared/{components-nnnd2xef.js → components-men63rwj.js} +0 -0
- /package/dist/shared/{components-de8xsm9y.js → components-mhd39z7x.js} +0 -0
- /package/dist/shared/{components-dg0w8g5p.js → components-n7mjr357.js} +0 -0
- /package/dist/shared/{components-jw16snbn.js → components-vynjtrk6.js} +0 -0
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import {
|
|
2
|
+
surfaceClasses2,
|
|
3
|
+
useSurface2,
|
|
4
|
+
SurfaceProvider2
|
|
5
|
+
} from "./components-zx6b6yby.js";
|
|
6
|
+
import {
|
|
7
|
+
cn2
|
|
8
|
+
} from "./components-ezxhrmer.js";
|
|
9
|
+
|
|
10
|
+
// primitives/surface/index.tsx
|
|
11
|
+
import {
|
|
12
|
+
forwardRef
|
|
13
|
+
} from "react";
|
|
14
|
+
import { jsx } from "react/jsx-runtime";
|
|
15
|
+
var Elevated2 = forwardRef(({ offset, shadowLevel, className, children, ...props }, ref) => {
|
|
16
|
+
const substrate = useSurface2();
|
|
17
|
+
const level = Math.min(substrate + offset, 8);
|
|
18
|
+
return /* @__PURE__ */ jsx(SurfaceProvider2, {
|
|
19
|
+
value: level,
|
|
20
|
+
children: /* @__PURE__ */ jsx("div", {
|
|
21
|
+
ref,
|
|
22
|
+
className: cn2(surfaceClasses2(level, shadowLevel ?? level), className),
|
|
23
|
+
...props,
|
|
24
|
+
children
|
|
25
|
+
})
|
|
26
|
+
});
|
|
27
|
+
});
|
|
28
|
+
Elevated2.displayName = "Elevated";
|
|
29
|
+
Object.assign(Elevated2, { Provider: SurfaceProvider2 });
|
|
30
|
+
var surface_default = Elevated2;
|
|
31
|
+
|
|
32
|
+
export { Elevated2, surface_default };
|
|
@@ -1,19 +1,19 @@
|
|
|
1
|
-
import {
|
|
2
|
-
badge_default
|
|
3
|
-
} from "./components-9p8s8n5q.js";
|
|
4
1
|
import {
|
|
5
2
|
useShape
|
|
6
|
-
} from "./components-
|
|
3
|
+
} from "./components-cv16mryv.js";
|
|
7
4
|
import {
|
|
8
|
-
|
|
9
|
-
} from "./components-
|
|
5
|
+
cn2
|
|
6
|
+
} from "./components-ezxhrmer.js";
|
|
7
|
+
import {
|
|
8
|
+
badge_default
|
|
9
|
+
} from "./components-7r3etddy.js";
|
|
10
10
|
|
|
11
11
|
// primitives/craft/index.tsx
|
|
12
12
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
13
13
|
function Pane({ verdict, note, children }) {
|
|
14
14
|
const shape = useShape();
|
|
15
15
|
return /* @__PURE__ */ jsxs("figure", {
|
|
16
|
-
className:
|
|
16
|
+
className: cn2("row-span-2 m-0 grid min-w-0 grid-rows-subgrid gap-0 ring-1 ring-border", shape.container),
|
|
17
17
|
children: [
|
|
18
18
|
/* @__PURE__ */ jsx("div", {
|
|
19
19
|
className: "flex min-h-40 items-center justify-center p-4",
|
|
@@ -39,7 +39,7 @@ function Pane({ verdict, note, children }) {
|
|
|
39
39
|
}
|
|
40
40
|
function Craft({ bad, good, badNote, goodNote, className }) {
|
|
41
41
|
return /* @__PURE__ */ jsxs("div", {
|
|
42
|
-
className:
|
|
42
|
+
className: cn2("grid w-full gap-3 sm:grid-cols-2", className),
|
|
43
43
|
children: [
|
|
44
44
|
/* @__PURE__ */ jsx(Pane, {
|
|
45
45
|
verdict: "bad",
|
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
import {
|
|
2
2
|
useShape
|
|
3
|
-
} from "./components-
|
|
3
|
+
} from "./components-cv16mryv.js";
|
|
4
4
|
import {
|
|
5
|
-
|
|
6
|
-
} from "./components-
|
|
5
|
+
useSizeVariant2
|
|
6
|
+
} from "./components-0sn7ypjw.js";
|
|
7
7
|
import {
|
|
8
|
-
|
|
9
|
-
} from "./components-
|
|
8
|
+
useControllableState
|
|
9
|
+
} from "./components-n7mjr357.js";
|
|
10
10
|
import {
|
|
11
|
-
|
|
12
|
-
} from "./components-
|
|
11
|
+
cn2
|
|
12
|
+
} from "./components-ezxhrmer.js";
|
|
13
13
|
import {
|
|
14
|
-
|
|
15
|
-
} from "./components-
|
|
14
|
+
spring2
|
|
15
|
+
} from "./components-1v7rxytx.js";
|
|
16
16
|
|
|
17
17
|
// components/inputs/slider/index.tsx
|
|
18
18
|
import { Slider as SliderPrimitive } from "@base-ui/react/slider";
|
|
@@ -133,7 +133,7 @@ function ValueDisplay({
|
|
|
133
133
|
onCancelEdit();
|
|
134
134
|
},
|
|
135
135
|
"aria-label": `Edit slider value${isRange ? index === 0 ? " (start)" : " (end)" : ""}`,
|
|
136
|
-
className:
|
|
136
|
+
className: cn2("w-[5ch] bg-transparent text-foreground outline-none border-b border-border text-center", shape.input, "weight-medium")
|
|
137
137
|
})
|
|
138
138
|
]
|
|
139
139
|
})
|
|
@@ -148,7 +148,7 @@ function ValueDisplay({
|
|
|
148
148
|
};
|
|
149
149
|
const widestValue = isRange ? `${label ? `${label}: ` : ""}${formatValue(max)} — ${formatValue(max)}` : `${label ? `${label}: ` : ""}${formatValue(max)}`;
|
|
150
150
|
return /* @__PURE__ */ jsxs("span", {
|
|
151
|
-
className:
|
|
151
|
+
className: cn2("inline-grid shrink-0 text-body leading-none text-muted-foreground transition-[font-variation-settings] duration-100", "tabular-nums", isInteracting ? "weight-medium" : "weight-normal"),
|
|
152
152
|
children: [
|
|
153
153
|
/* @__PURE__ */ jsx("span", {
|
|
154
154
|
className: "col-start-1 row-start-1 invisible whitespace-nowrap weight-medium",
|
|
@@ -191,10 +191,10 @@ function TooltipValue({ value, formatValue, motionX }) {
|
|
|
191
191
|
},
|
|
192
192
|
initial: { opacity: 0, y: 4 },
|
|
193
193
|
animate: { opacity: 1, y: 0 },
|
|
194
|
-
exit: { opacity: 0, y: 4, transition:
|
|
195
|
-
transition:
|
|
194
|
+
exit: { opacity: 0, y: 4, transition: spring2.fast.exit },
|
|
195
|
+
transition: spring2.fast,
|
|
196
196
|
children: /* @__PURE__ */ jsx("span", {
|
|
197
|
-
className:
|
|
197
|
+
className: cn2("text-caption text-background tabular-nums whitespace-nowrap bg-foreground px-2 py-1", shape.bg, "weight-medium"),
|
|
198
198
|
children: formatValue(value)
|
|
199
199
|
})
|
|
200
200
|
});
|
|
@@ -326,10 +326,10 @@ var CompactSlider = forwardRef(({
|
|
|
326
326
|
const mn = minRef.current;
|
|
327
327
|
const mx = maxRef.current;
|
|
328
328
|
const px0 = valueToPixel(v[0], mn, mx, w);
|
|
329
|
-
animate(motionX0, px0,
|
|
329
|
+
animate(motionX0, px0, spring2.moderate);
|
|
330
330
|
if (isRange && v[1] !== undefined) {
|
|
331
331
|
const px1 = valueToPixel(v[1], mn, mx, w);
|
|
332
|
-
animate(motionX1, px1,
|
|
332
|
+
animate(motionX1, px1, spring2.moderate);
|
|
333
333
|
}
|
|
334
334
|
}
|
|
335
335
|
});
|
|
@@ -347,10 +347,10 @@ var CompactSlider = forwardRef(({
|
|
|
347
347
|
return;
|
|
348
348
|
const v = valuesRef.current;
|
|
349
349
|
const px0 = valueToPixel(v[0], min, max, tw);
|
|
350
|
-
animate(motionX0, px0,
|
|
350
|
+
animate(motionX0, px0, spring2.moderate);
|
|
351
351
|
if (isRange && v[1] !== undefined) {
|
|
352
352
|
const px1 = valueToPixel(v[1], min, max, tw);
|
|
353
|
-
animate(motionX1, px1,
|
|
353
|
+
animate(motionX1, px1, spring2.moderate);
|
|
354
354
|
}
|
|
355
355
|
}, [valuesKey, min, max, isRange, motionX0, motionX1]);
|
|
356
356
|
const clampForRange = useCallback((px, thumbIndex) => {
|
|
@@ -400,7 +400,7 @@ var CompactSlider = forwardRef(({
|
|
|
400
400
|
const snappedValue = pixelToValue(clamped, min, max, step, layoutWidth, stepValues);
|
|
401
401
|
const snappedPx = valueToPixel(snappedValue, min, max, layoutWidth);
|
|
402
402
|
const finalPx = clampForRange(snappedPx, activeDragThumb.current);
|
|
403
|
-
animate(motionX, finalPx,
|
|
403
|
+
animate(motionX, finalPx, spring2.moderate);
|
|
404
404
|
const finalValue = pixelToValue(finalPx, min, max, step, layoutWidth, stepValues);
|
|
405
405
|
emitChange(activeDragThumb.current, finalValue);
|
|
406
406
|
e.currentTarget.setPointerCapture(e.pointerId);
|
|
@@ -438,7 +438,7 @@ var CompactSlider = forwardRef(({
|
|
|
438
438
|
const currentPx = motionX.get();
|
|
439
439
|
const snapped = pixelToValue(currentPx, min, max, step, tw, stepValues);
|
|
440
440
|
const snappedPx = valueToPixel(snapped, min, max, tw);
|
|
441
|
-
animate(motionX, snappedPx,
|
|
441
|
+
animate(motionX, snappedPx, spring2.moderate);
|
|
442
442
|
}, [min, max, step, stepValues, motionX0, motionX1]);
|
|
443
443
|
const handleRadixChange = useCallback((newValues) => {
|
|
444
444
|
if (dragging.current)
|
|
@@ -508,13 +508,13 @@ var CompactSlider = forwardRef(({
|
|
|
508
508
|
initial: false,
|
|
509
509
|
children: [
|
|
510
510
|
/* @__PURE__ */ jsx(motion.span, {
|
|
511
|
-
className:
|
|
511
|
+
className: cn2("block rounded-full shadow-thumb", !thumbColor && "bg-thumb"),
|
|
512
512
|
initial: false,
|
|
513
513
|
animate: {
|
|
514
514
|
width: THUMB_SIZE_REST,
|
|
515
515
|
height: THUMB_SIZE_REST
|
|
516
516
|
},
|
|
517
|
-
transition:
|
|
517
|
+
transition: spring2.fast,
|
|
518
518
|
style: {
|
|
519
519
|
backgroundColor: thumbColor,
|
|
520
520
|
border: thumbBorderColor ? `1px solid ${thumbBorderColor}` : undefined
|
|
@@ -528,14 +528,14 @@ var CompactSlider = forwardRef(({
|
|
|
528
528
|
width: THUMB_SIZE + 4,
|
|
529
529
|
height: THUMB_SIZE + 4
|
|
530
530
|
},
|
|
531
|
-
transition:
|
|
531
|
+
transition: spring2.fast
|
|
532
532
|
})
|
|
533
533
|
]
|
|
534
534
|
}, `visual-thumb-${index}`);
|
|
535
535
|
};
|
|
536
536
|
return /* @__PURE__ */ jsxs("div", {
|
|
537
537
|
ref,
|
|
538
|
-
className:
|
|
538
|
+
className: cn2("flex flex-col gap-0 w-full select-none touch-none overflow-visible", valuePosition === "left" || valuePosition === "right" ? "flex-row items-center gap-2 mb-2" : "flex-col", disabled && "opacity-50 pointer-events-none", className),
|
|
539
539
|
...props,
|
|
540
540
|
children: [
|
|
541
541
|
(valuePosition === "top" || valuePosition === "left") && valueDisplay,
|
|
@@ -645,26 +645,26 @@ var CompactSlider = forwardRef(({
|
|
|
645
645
|
className: "absolute -translate-x-1/2 pointer-events-none z-20",
|
|
646
646
|
initial: { opacity: 0, y: 4 },
|
|
647
647
|
animate: { opacity: 1, y: 0 },
|
|
648
|
-
exit: { opacity: 0, y: 4, transition:
|
|
649
|
-
transition:
|
|
648
|
+
exit: { opacity: 0, y: 4, transition: spring2.fast.exit },
|
|
649
|
+
transition: spring2.fast,
|
|
650
650
|
style: {
|
|
651
651
|
left: hoverPreview.cursorX,
|
|
652
652
|
top: -20
|
|
653
653
|
},
|
|
654
654
|
children: /* @__PURE__ */ jsx("span", {
|
|
655
|
-
className:
|
|
655
|
+
className: cn2("text-caption text-background tabular-nums whitespace-nowrap bg-foreground px-2 py-1", shape.bg, "weight-medium"),
|
|
656
656
|
children: formatValue(hoverPreview.snappedValue)
|
|
657
657
|
})
|
|
658
658
|
}, "hover-tooltip")
|
|
659
659
|
}),
|
|
660
660
|
/* @__PURE__ */ jsxs(motion.div, {
|
|
661
|
-
className:
|
|
661
|
+
className: cn2("absolute bg-transparent border border-border overflow-hidden rounded-full", trackClassName),
|
|
662
662
|
initial: false,
|
|
663
663
|
animate: {
|
|
664
664
|
height: TRACK_BG_HEIGHT,
|
|
665
665
|
top: 8 + (THUMB_SIZE - TRACK_BG_HEIGHT) / 2
|
|
666
666
|
},
|
|
667
|
-
transition:
|
|
667
|
+
transition: spring2.fast,
|
|
668
668
|
style: {
|
|
669
669
|
left: TRACK_INSET,
|
|
670
670
|
right: TRACK_INSET,
|
|
@@ -672,7 +672,7 @@ var CompactSlider = forwardRef(({
|
|
|
672
672
|
},
|
|
673
673
|
children: [
|
|
674
674
|
!hideFill && /* @__PURE__ */ jsx(motion.div, {
|
|
675
|
-
className:
|
|
675
|
+
className: cn2("absolute h-full bg-selected/50 dark:bg-accent/40", fillClassName),
|
|
676
676
|
style: {
|
|
677
677
|
left: fillLeft,
|
|
678
678
|
width: fillWidth,
|
|
@@ -719,7 +719,7 @@ var CompactSlider = forwardRef(({
|
|
|
719
719
|
width: isHovered ? DOT_SIZE * 1.25 : DOT_SIZE,
|
|
720
720
|
height: isHovered ? DOT_SIZE * 1.25 : DOT_SIZE
|
|
721
721
|
},
|
|
722
|
-
transition:
|
|
722
|
+
transition: spring2.moderate
|
|
723
723
|
})
|
|
724
724
|
}, v))
|
|
725
725
|
}),
|
|
@@ -833,8 +833,8 @@ var ComfortableSlider = forwardRef(({
|
|
|
833
833
|
if (dragging.current || handleDragging.current)
|
|
834
834
|
return;
|
|
835
835
|
const percent = max === min ? 0 : Math.max(0, Math.min(1, (value - min) / (max - min)));
|
|
836
|
-
animate(fillPercent, percent,
|
|
837
|
-
animate(zeroOffset, value === min ? zeroTarget : 0,
|
|
836
|
+
animate(fillPercent, percent, spring2.fast);
|
|
837
|
+
animate(zeroOffset, value === min ? zeroTarget : 0, spring2.fast);
|
|
838
838
|
}, [value, min, max, variant, fillPercent, zeroOffset, zeroTarget]);
|
|
839
839
|
const getValueFromX = useCallback((clientX) => {
|
|
840
840
|
const rect = containerRef.current?.getBoundingClientRect();
|
|
@@ -863,8 +863,8 @@ var ComfortableSlider = forwardRef(({
|
|
|
863
863
|
const newVal = getValueFromX(e.clientX);
|
|
864
864
|
onChange(newVal);
|
|
865
865
|
const newPercent = Math.max(0, Math.min(1, (newVal - min) / (max - min)));
|
|
866
|
-
animate(fillPercent, newPercent,
|
|
867
|
-
animate(zeroOffset, newVal === min ? zeroTarget : 0,
|
|
866
|
+
animate(fillPercent, newPercent, spring2.fast);
|
|
867
|
+
animate(zeroOffset, newVal === min ? zeroTarget : 0, spring2.fast);
|
|
868
868
|
e.currentTarget.setPointerCapture(e.pointerId);
|
|
869
869
|
}, [disabled, getValueFromX, onChange, fillPercent, zeroOffset, zeroTarget, min, max]);
|
|
870
870
|
const handlePointerMove = useCallback((e) => {
|
|
@@ -876,9 +876,9 @@ var ComfortableSlider = forwardRef(({
|
|
|
876
876
|
if (variant === "scrubber") {
|
|
877
877
|
fillPercent.set(newPercent);
|
|
878
878
|
} else {
|
|
879
|
-
animate(fillPercent, newPercent,
|
|
879
|
+
animate(fillPercent, newPercent, spring2.fast);
|
|
880
880
|
}
|
|
881
|
-
animate(zeroOffset, newVal === min ? zeroTarget : 0,
|
|
881
|
+
animate(zeroOffset, newVal === min ? zeroTarget : 0, spring2.fast);
|
|
882
882
|
}, [getValueFromX, onChange, variant, fillPercent, zeroOffset, zeroTarget, min, max]);
|
|
883
883
|
const handlePointerUp = useCallback(() => {
|
|
884
884
|
dragging.current = false;
|
|
@@ -897,7 +897,7 @@ var ComfortableSlider = forwardRef(({
|
|
|
897
897
|
const newVal = getValueFromX(e.clientX);
|
|
898
898
|
onChange(newVal);
|
|
899
899
|
fillPercent.set(Math.max(0, Math.min(1, (newVal - min) / (max - min))));
|
|
900
|
-
animate(zeroOffset, newVal === min ? zeroTarget : 0,
|
|
900
|
+
animate(zeroOffset, newVal === min ? zeroTarget : 0, spring2.fast);
|
|
901
901
|
e.currentTarget.setPointerCapture(e.pointerId);
|
|
902
902
|
}, [disabled, getValueFromX, onChange, fillPercent, zeroOffset, zeroTarget, min, max]);
|
|
903
903
|
const handleResizePointerMove = useCallback((e) => {
|
|
@@ -906,7 +906,7 @@ var ComfortableSlider = forwardRef(({
|
|
|
906
906
|
const newVal = getValueFromX(e.clientX);
|
|
907
907
|
onChange(newVal);
|
|
908
908
|
fillPercent.set(Math.max(0, Math.min(1, (newVal - min) / (max - min))));
|
|
909
|
-
animate(zeroOffset, newVal === min ? zeroTarget : 0,
|
|
909
|
+
animate(zeroOffset, newVal === min ? zeroTarget : 0, spring2.fast);
|
|
910
910
|
}, [getValueFromX, onChange, fillPercent, zeroOffset, zeroTarget, min, max]);
|
|
911
911
|
const handleResizePointerUp = useCallback(() => {
|
|
912
912
|
handleDragging.current = false;
|
|
@@ -948,26 +948,26 @@ var ComfortableSlider = forwardRef(({
|
|
|
948
948
|
className: "absolute -translate-x-1/2 pointer-events-none z-20",
|
|
949
949
|
initial: { opacity: 0, y: 4 },
|
|
950
950
|
animate: { opacity: 1, y: 0 },
|
|
951
|
-
exit: { opacity: 0, y: 4, transition:
|
|
952
|
-
transition:
|
|
951
|
+
exit: { opacity: 0, y: 4, transition: spring2.fast.exit },
|
|
952
|
+
transition: spring2.fast,
|
|
953
953
|
style: {
|
|
954
954
|
left: hoverPreview.cursorX,
|
|
955
955
|
top: -30
|
|
956
956
|
},
|
|
957
957
|
children: /* @__PURE__ */ jsx("span", {
|
|
958
|
-
className:
|
|
958
|
+
className: cn2("text-caption text-background tabular-nums whitespace-nowrap bg-foreground px-2 py-1", shape.bg, "weight-medium"),
|
|
959
959
|
children: formatValue(hoverPreview.snappedValue)
|
|
960
960
|
})
|
|
961
961
|
}, "hover-tooltip")
|
|
962
962
|
}),
|
|
963
963
|
/* @__PURE__ */ jsxs(motion.div, {
|
|
964
964
|
ref: mergedRef,
|
|
965
|
-
className:
|
|
965
|
+
className: cn2("relative w-full h-8 select-none touch-none border border-border overflow-hidden outline-offset-2", variant === "scrubber" ? "flex items-center gap-3 px-4 cursor-ew-resize" : "cursor-ew-resize", shape.bg, disabled && "opacity-50 pointer-events-none", className),
|
|
966
966
|
initial: false,
|
|
967
967
|
animate: {
|
|
968
968
|
outline: isFocused ? "1px solid var(--focus-ring)" : "1px solid transparent"
|
|
969
969
|
},
|
|
970
|
-
transition:
|
|
970
|
+
transition: spring2.fast,
|
|
971
971
|
onPointerDown: handlePointerDown,
|
|
972
972
|
onPointerMove: handlePointerMove,
|
|
973
973
|
onPointerUp: handlePointerUp,
|
|
@@ -1029,7 +1029,7 @@ var ComfortableSlider = forwardRef(({
|
|
|
1029
1029
|
backgroundColor: isActivePip ? "var(--foreground)" : "var(--muted-foreground)",
|
|
1030
1030
|
opacity: isActivePip ? 1 : 0.3
|
|
1031
1031
|
},
|
|
1032
|
-
transition:
|
|
1032
|
+
transition: spring2.fast,
|
|
1033
1033
|
style: { width: PIP_SIZE, height: PIP_SIZE }
|
|
1034
1034
|
})
|
|
1035
1035
|
}, pipValue);
|
|
@@ -1064,7 +1064,7 @@ var ComfortableSlider = forwardRef(({
|
|
|
1064
1064
|
bottom: isActive ? 7 : 8,
|
|
1065
1065
|
backgroundColor: isFocused ? "var(--foreground)" : isHovered ? "color-mix(in srgb, var(--foreground) 50%, transparent)" : "color-mix(in srgb, var(--foreground) 25%, transparent)"
|
|
1066
1066
|
},
|
|
1067
|
-
transition:
|
|
1067
|
+
transition: spring2.fast,
|
|
1068
1068
|
style: {
|
|
1069
1069
|
left: pipsHandleLineLeftStyle,
|
|
1070
1070
|
width: 2
|
|
@@ -1077,14 +1077,14 @@ var ComfortableSlider = forwardRef(({
|
|
|
1077
1077
|
className: "text-body px-2",
|
|
1078
1078
|
initial: false,
|
|
1079
1079
|
animate: { color: isActive ? "var(--foreground)" : "var(--muted-foreground)" },
|
|
1080
|
-
transition:
|
|
1080
|
+
transition: spring2.fast,
|
|
1081
1081
|
children: label
|
|
1082
1082
|
}),
|
|
1083
1083
|
/* @__PURE__ */ jsx(motion.span, {
|
|
1084
1084
|
className: "text-body tabular-nums ml-auto px-2",
|
|
1085
1085
|
initial: false,
|
|
1086
1086
|
animate: { color: isActive ? "var(--foreground)" : "var(--muted-foreground)" },
|
|
1087
|
-
transition:
|
|
1087
|
+
transition: spring2.fast,
|
|
1088
1088
|
style: { minWidth: `${String(formatValue(max)).length}ch`, textAlign: "right" },
|
|
1089
1089
|
children: formatValue(value)
|
|
1090
1090
|
})
|
|
@@ -1104,7 +1104,7 @@ var ComfortableSlider = forwardRef(({
|
|
|
1104
1104
|
bottom: isActive ? 7 : 8,
|
|
1105
1105
|
backgroundColor: isFocused ? "var(--foreground)" : isHovered ? "color-mix(in srgb, var(--foreground) 50%, transparent)" : "color-mix(in srgb, var(--foreground) 25%, transparent)"
|
|
1106
1106
|
},
|
|
1107
|
-
transition:
|
|
1107
|
+
transition: spring2.fast,
|
|
1108
1108
|
style: {
|
|
1109
1109
|
left: handleLineLeftStyle,
|
|
1110
1110
|
width: 2
|
|
@@ -1114,7 +1114,7 @@ var ComfortableSlider = forwardRef(({
|
|
|
1114
1114
|
className: "text-body shrink-0 z-10",
|
|
1115
1115
|
initial: false,
|
|
1116
1116
|
animate: { color: isActive ? "var(--foreground)" : "var(--muted-foreground)" },
|
|
1117
|
-
transition:
|
|
1117
|
+
transition: spring2.fast,
|
|
1118
1118
|
children: label
|
|
1119
1119
|
}),
|
|
1120
1120
|
variant === "scrubber" && /* @__PURE__ */ jsxs(Fragment, {
|
|
@@ -1126,7 +1126,7 @@ var ComfortableSlider = forwardRef(({
|
|
|
1126
1126
|
className: "text-body shrink-0 tabular-nums text-right z-10",
|
|
1127
1127
|
initial: false,
|
|
1128
1128
|
animate: { color: isActive ? "var(--foreground)" : "var(--muted-foreground)" },
|
|
1129
|
-
transition:
|
|
1129
|
+
transition: spring2.fast,
|
|
1130
1130
|
style: { minWidth: `${String(formatValue(max)).length}ch` },
|
|
1131
1131
|
children: formatValue(value)
|
|
1132
1132
|
})
|
|
@@ -1146,10 +1146,10 @@ var ComfortableSlider = forwardRef(({
|
|
|
1146
1146
|
});
|
|
1147
1147
|
});
|
|
1148
1148
|
ComfortableSlider.displayName = "SliderComfortable";
|
|
1149
|
-
var
|
|
1149
|
+
var Slider2 = forwardRef(({ size, variant = "pips", value: valueProp, defaultValue, onChange: onChangeProp, ...rest }, ref) => {
|
|
1150
1150
|
const [value, onChange] = useControllableState(valueProp, defaultValue ?? (rest.steps && rest.steps.length > 0 ? Math.min(...rest.steps) : rest.min ?? 0), onChangeProp);
|
|
1151
1151
|
const props = { ...rest, value, onChange };
|
|
1152
|
-
const resolved =
|
|
1152
|
+
const resolved = useSizeVariant2(size);
|
|
1153
1153
|
const needsCompactEngine = Array.isArray(props.value) || props.steps !== undefined || props.showSteps !== undefined || props.showValue !== undefined || props.valuePosition !== undefined || props.trackClassName !== undefined || props.trackStyle !== undefined || props.fillClassName !== undefined || props.fillStyle !== undefined || props.hideFill !== undefined || props.thumbColor !== undefined || props.thumbBorderColor !== undefined;
|
|
1154
1154
|
if (resolved === "compact" || needsCompactEngine) {
|
|
1155
1155
|
return /* @__PURE__ */ jsx(CompactSlider, {
|
|
@@ -1193,8 +1193,8 @@ var Slider = forwardRef(({ size, variant = "pips", value: valueProp, defaultValu
|
|
|
1193
1193
|
...html
|
|
1194
1194
|
});
|
|
1195
1195
|
});
|
|
1196
|
-
|
|
1197
|
-
var
|
|
1198
|
-
var slider_default =
|
|
1196
|
+
Slider2.displayName = "Slider";
|
|
1197
|
+
var SliderComfortable2 = ComfortableSlider;
|
|
1198
|
+
var slider_default = Slider2;
|
|
1199
1199
|
|
|
1200
|
-
export {
|
|
1200
|
+
export { Slider2, SliderComfortable2, slider_default };
|