@justanarthur/modo-ui 0.1.0 → 0.3.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/README.md +18 -15
- package/dist/blocks/sidebar-app/index.d.ts +1 -1
- package/dist/blocks/sidebar-app/index.js +28 -31
- package/dist/components/{inputs → AI}/input-message/index.d.ts +1 -1
- package/dist/components/AI/input-message/index.js +25 -0
- package/dist/components/{thinking-indicator → AI/thinking-indicator}/index.d.ts +1 -1
- package/dist/components/AI/thinking-indicator/index.js +13 -0
- package/dist/components/{navigation/accordion → accordion}/index.d.ts +1 -1
- package/dist/components/accordion/index.js +28 -0
- 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/input-copy → copy}/index.d.ts +7 -7
- package/dist/components/copy/index.js +16 -0
- package/dist/components/inputs/checkbox/index.d.ts +62 -0
- package/dist/components/inputs/checkbox/index.js +22 -0
- 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 +2 -2
- 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/{radio-group → radio}/index.d.ts +30 -30
- package/dist/components/inputs/radio/index.js +21 -0
- 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 +27 -6
- package/dist/components/inputs/switch/index.js +17 -12
- 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 +3 -3
- 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/index.d.ts +828 -795
- package/dist/index.js +509 -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 +3 -3
- 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 +3 -3
- 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-jxgznftn.js → components-0q0sqfh4.js} +16 -16
- package/dist/shared/{components-x3rz4cyn.js → components-0sn7ypjw.js} +14 -14
- package/dist/shared/components-1434p1mh.js +123 -0
- package/dist/shared/{components-vc1k7yv2.js → components-1v7rxytx.js} +3 -3
- package/dist/shared/{components-6phwsry6.js → components-1z6tdadk.js} +25 -25
- package/dist/shared/{components-5zry9te1.js → components-27nnvrwe.js} +27 -27
- package/dist/shared/{components-ess3ch6w.js → components-2dxkv6zm.js} +23 -23
- package/dist/shared/{components-s5pkbjx1.js → components-2n3whx7z.js} +56 -56
- package/dist/shared/{components-v7es8aan.js → components-2nhgyh31.js} +15 -15
- package/dist/shared/{components-6t6nr33r.js → components-39jq9va1.js} +26 -26
- package/dist/shared/{components-4hh0gm0v.js → components-39vmfq9s.js} +61 -61
- package/dist/shared/{components-zx2hr57f.js → components-3fbbvq5j.js} +15 -15
- package/dist/shared/{components-6y1th6k4.js → components-3mkepka5.js} +31 -31
- 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-hzfp4tjb.js → components-7btqt08d.js} +42 -42
- package/dist/shared/{components-9p8s8n5q.js → components-7r3etddy.js} +22 -22
- package/dist/shared/{components-j65qt1mq.js → components-8ey44d79.js} +101 -101
- package/dist/shared/{components-hjkrv00c.js → components-8snj490h.js} +120 -23
- package/dist/shared/{components-40j34hdb.js → components-a86dytt0.js} +116 -116
- package/dist/shared/{components-tm88ghva.js → components-ar66gnt0.js} +58 -58
- package/dist/shared/{components-5pkcfprd.js → components-b2wyq2cq.js} +22 -22
- package/dist/shared/{components-vktws5r6.js → components-b3c5et5b.js} +73 -73
- package/dist/shared/{components-4xxtggzp.js → components-bshdmf75.js} +18 -18
- 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-gjfrycb5.js → components-d6xtjht3.js} +66 -69
- package/dist/shared/{components-aaq3yk4f.js → components-dk0gjr5a.js} +43 -43
- package/dist/shared/{components-0f0as45n.js → components-ezxhrmer.js} +2 -2
- package/dist/shared/{components-7gv95yfy.js → components-frw34b65.js} +83 -83
- 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-x2xyckd5.js → components-gz8zf3ec.js} +20 -20
- 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-zvb11ker.js → components-hw9yk32z.js} +47 -47
- package/dist/shared/{components-y3cqdrgy.js → components-hyq23phv.js} +73 -54
- package/dist/shared/{components-bf2d9k02.js → components-jbbmdr74.js} +94 -94
- package/dist/shared/{components-vb033rns.js → components-jjw69c4c.js} +6 -6
- package/dist/shared/{components-r2gke5p6.js → components-jthe1pwb.js} +125 -125
- package/dist/shared/{components-tad5h7ta.js → components-jwst3vtj.js} +48 -48
- package/dist/shared/{components-xszag63d.js → components-k809mbn0.js} +12 -12
- package/dist/shared/{components-r22vtgqc.js → components-kvr7f9hy.js} +11 -11
- package/dist/shared/{components-r4jt6hgd.js → components-mjthm1kf.js} +6 -6
- package/dist/shared/{components-nn6xezy2.js → components-nb87fjy4.js} +226 -226
- package/dist/shared/{components-gndm6am4.js → components-ng72k97e.js} +17 -17
- package/dist/shared/{components-54nf2x99.js → components-pbmqctfa.js} +52 -45
- package/dist/shared/{components-peg09pzs.js → components-q5xj5c16.js} +11 -11
- package/dist/shared/{components-taxmgbnh.js → components-re6rs21k.js} +17 -17
- package/dist/shared/{components-r43mqnd6.js → components-rr7a6ja9.js} +46 -46
- package/dist/shared/{components-p2vmyfe1.js → components-s083f38z.js} +43 -43
- package/dist/shared/{components-bkvb6nem.js → components-s2bz1xpk.js} +11 -11
- package/dist/shared/components-ta7shw28.js +19 -0
- 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-brnzrp2t.js → components-xxvdw7k1.js} +41 -41
- 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/components/inputs/checkbox-group/index.d.ts +0 -50
- package/dist/components/inputs/checkbox-group/index.js +0 -23
- package/dist/components/inputs/input-copy/index.js +0 -18
- package/dist/components/inputs/input-message/index.js +0 -27
- package/dist/components/inputs/radio-group/index.js +0 -22
- package/dist/components/navigation/accordion/index.js +0 -30
- package/dist/components/thinking-indicator/index.js +0 -15
- 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
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import {
|
|
2
2
|
useReduceMotion
|
|
3
|
-
} from "./components-
|
|
3
|
+
} from "./components-men63rwj.js";
|
|
4
4
|
import {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
} from "./components-
|
|
5
|
+
spring2,
|
|
6
|
+
exitFallbackMs2
|
|
7
|
+
} from "./components-1v7rxytx.js";
|
|
8
8
|
|
|
9
9
|
// lib/use-morph.ts
|
|
10
10
|
import { animate, clamp, useMotionValue } from "motion/react";
|
|
@@ -128,7 +128,7 @@ function inPlaceOffset({ side, anchor }) {
|
|
|
128
128
|
return side === "top" || side === "bottom" ? -anchor.height : -anchor.width;
|
|
129
129
|
}
|
|
130
130
|
function holdExit(el, tier) {
|
|
131
|
-
return el.animate(null, { duration:
|
|
131
|
+
return el.animate(null, { duration: exitFallbackMs2(spring2[tier]) });
|
|
132
132
|
}
|
|
133
133
|
function returnFocus(trigger) {
|
|
134
134
|
requestAnimationFrame(() => requestAnimationFrame(() => {
|
|
@@ -167,7 +167,7 @@ function useMorph(open, origin, { from = "trigger", effect = "goo", hideSource =
|
|
|
167
167
|
const reduced = useReduceMotion();
|
|
168
168
|
const resolve = (wanted) => reduced ? "fade" : wanted;
|
|
169
169
|
const resolved = resolve(effect);
|
|
170
|
-
const timing = (
|
|
170
|
+
const timing = (effect) => effect === "goo" ? "goo" : tier;
|
|
171
171
|
const progress = useMotionValue(0);
|
|
172
172
|
const gooId = `morph-goo-${useId().replace(/:/g, "")}`;
|
|
173
173
|
const geometry = useRef(null);
|
|
@@ -193,24 +193,24 @@ function useMorph(open, origin, { from = "trigger", effect = "goo", hideSource =
|
|
|
193
193
|
const g = geometry.current;
|
|
194
194
|
if (!g)
|
|
195
195
|
return;
|
|
196
|
-
const { bg, content, shadow, popup
|
|
197
|
-
const { effect
|
|
198
|
-
const shaped = drawsShape(
|
|
196
|
+
const { bg, content, shadow, popup, shape } = refs;
|
|
197
|
+
const { effect } = run.current;
|
|
198
|
+
const shaped = drawsShape(effect);
|
|
199
199
|
const slide = { ...g.target, x: g.offset.x * (1 - p), y: g.offset.y * (1 - p) };
|
|
200
|
-
const rect = clampRect(shaped ? lerpRect(g.source, g.target, p) :
|
|
200
|
+
const rect = clampRect(shaped ? lerpRect(g.source, g.target, p) : effect === "slide" ? slide : g.target);
|
|
201
201
|
place(shaped ? shape.current : bg.current, shaped ? within(rect, g.layer) : rect);
|
|
202
202
|
place(shadow.current, rect);
|
|
203
|
-
const melting =
|
|
203
|
+
const melting = effect === "goo" ? clamp(0, 1, (1 - p) / GOO_RELEASE) : 0;
|
|
204
204
|
refs.blur.current?.setAttribute("stdDeviation", String(g.blur * melting));
|
|
205
205
|
refs.outline.current?.setAttribute("flood-opacity", String(melting * clamp(0, 1, p / GOO_SETTLE)));
|
|
206
206
|
if (shadow.current)
|
|
207
|
-
shadow.current.style.opacity = String(
|
|
207
|
+
shadow.current.style.opacity = String(effect === "goo" ? 1 - melting : clamp(0, 1, p));
|
|
208
208
|
if (content.current) {
|
|
209
209
|
content.current.style.clipPath = shaped ? insetClip(rect, g.target) : "";
|
|
210
|
-
content.current.style.transform =
|
|
210
|
+
content.current.style.transform = effect === "slide" ? `translate(${rect.x}px, ${rect.y}px)` : "";
|
|
211
211
|
}
|
|
212
|
-
if (
|
|
213
|
-
|
|
212
|
+
if (popup.current)
|
|
213
|
+
popup.current.style.opacity = effect === "fade" ? String(p) : "";
|
|
214
214
|
};
|
|
215
215
|
const rest = () => {
|
|
216
216
|
refs.bg.current?.removeAttribute("style");
|
|
@@ -228,14 +228,14 @@ function useMorph(open, origin, { from = "trigger", effect = "goo", hideSource =
|
|
|
228
228
|
const el = refs.popup.current;
|
|
229
229
|
if (!el)
|
|
230
230
|
return;
|
|
231
|
-
const { effect
|
|
232
|
-
const shaped = drawsShape(
|
|
231
|
+
const { effect, from } = run.current;
|
|
232
|
+
const shaped = drawsShape(effect);
|
|
233
233
|
const box = el.getBoundingClientRect();
|
|
234
234
|
const target = { x: 0, y: 0, w: box.width, h: box.height, r: targetRadius.current };
|
|
235
|
-
const source = sourceRect(
|
|
236
|
-
const blur =
|
|
235
|
+
const source = sourceRect(from, origin.current ?? {}, box, target);
|
|
236
|
+
const blur = effect === "goo" ? Math.max(GOO_SURFACE_BLUR, target.r * GOO_BLUR_RATIO) : 0;
|
|
237
237
|
const layer = layerBox(source, target, blur * 3);
|
|
238
|
-
geometry.current = { source, target, layer, offset: slideOffset(
|
|
238
|
+
geometry.current = { source, target, layer, offset: slideOffset(from, source, target, box), blur };
|
|
239
239
|
const { shapes, copy, bg } = refs;
|
|
240
240
|
if (bg.current)
|
|
241
241
|
bg.current.style.opacity = shaped ? "0" : "";
|
|
@@ -245,7 +245,7 @@ function useMorph(open, origin, { from = "trigger", effect = "goo", hideSource =
|
|
|
245
245
|
if (!shaped)
|
|
246
246
|
return;
|
|
247
247
|
place(shapes.current, { ...layer, r: 0 });
|
|
248
|
-
if (
|
|
248
|
+
if (effect === "goo")
|
|
249
249
|
place(copy.current, within(source, layer));
|
|
250
250
|
const cut = source.w > 0 && source.h > 0 && !hideSource && !overlaps(source, target);
|
|
251
251
|
shapes.current.style.clipPath = cut ? `path(evenodd, "${roundedRectPath({ ...layer, x: 0, y: 0 })} ${roundedRectPath(within(source, layer))}")` : "";
|
|
@@ -264,36 +264,36 @@ function useMorph(open, origin, { from = "trigger", effect = "goo", hideSource =
|
|
|
264
264
|
el.style.opacity = "0";
|
|
265
265
|
};
|
|
266
266
|
const skip = (el) => instant?.(el);
|
|
267
|
-
const opening = (
|
|
267
|
+
const opening = (popup) => {
|
|
268
268
|
returnTo.current = null;
|
|
269
269
|
run.current = { effect: resolved, from };
|
|
270
270
|
const first = !geometry.current;
|
|
271
271
|
if (first && refs.bg.current) {
|
|
272
|
-
const box =
|
|
272
|
+
const box = popup.getBoundingClientRect();
|
|
273
273
|
targetRadius.current = radiusOf(refs.bg.current, box.width, box.height);
|
|
274
274
|
}
|
|
275
275
|
let controls;
|
|
276
276
|
const begin = () => {
|
|
277
277
|
measure();
|
|
278
278
|
hide(sourceElement(from, origin.current ?? {}));
|
|
279
|
-
if (skip(
|
|
279
|
+
if (skip(popup)) {
|
|
280
280
|
progress.jump(1);
|
|
281
281
|
rest();
|
|
282
282
|
return;
|
|
283
283
|
}
|
|
284
284
|
render(progress.get());
|
|
285
|
-
const { exit: _, ...enter } =
|
|
285
|
+
const { exit: _, ...enter } = spring2[timing(run.current.effect)];
|
|
286
286
|
controls = animate(progress, 1, {
|
|
287
287
|
...enter,
|
|
288
288
|
onUpdate: (p) => {
|
|
289
|
-
if (skip(
|
|
289
|
+
if (skip(popup))
|
|
290
290
|
controls?.complete();
|
|
291
291
|
render(p);
|
|
292
292
|
},
|
|
293
293
|
onComplete: rest
|
|
294
294
|
});
|
|
295
295
|
};
|
|
296
|
-
if (!first || skip(
|
|
296
|
+
if (!first || skip(popup) || !refs.bg.current) {
|
|
297
297
|
begin();
|
|
298
298
|
return () => controls?.stop();
|
|
299
299
|
}
|
|
@@ -308,8 +308,8 @@ function useMorph(open, origin, { from = "trigger", effect = "goo", hideSource =
|
|
|
308
308
|
controls?.stop();
|
|
309
309
|
};
|
|
310
310
|
};
|
|
311
|
-
const closing = (
|
|
312
|
-
returnTo.current =
|
|
311
|
+
const closing = (popup) => {
|
|
312
|
+
returnTo.current = popup.contains(document.activeElement) ? origin.current?.trigger ?? null : null;
|
|
313
313
|
if (!geometry.current) {
|
|
314
314
|
exited.current?.();
|
|
315
315
|
return;
|
|
@@ -319,23 +319,23 @@ function useMorph(open, origin, { from = "trigger", effect = "goo", hideSource =
|
|
|
319
319
|
geometry.current = null;
|
|
320
320
|
exited.current?.();
|
|
321
321
|
};
|
|
322
|
-
if (skip(
|
|
322
|
+
if (skip(popup)) {
|
|
323
323
|
progress.jump(0);
|
|
324
|
-
|
|
324
|
+
popup.style.opacity = "0";
|
|
325
325
|
done();
|
|
326
326
|
return;
|
|
327
327
|
}
|
|
328
328
|
run.current = { effect: resolve(exit?.effect ?? effect), from: exit?.from ?? from };
|
|
329
329
|
if (exit)
|
|
330
330
|
progress.jump(1);
|
|
331
|
-
const hold = holdExit(
|
|
331
|
+
const hold = holdExit(popup, timing(run.current.effect));
|
|
332
332
|
measure();
|
|
333
333
|
render(progress.get());
|
|
334
334
|
let controls;
|
|
335
335
|
controls = animate(progress, 0, {
|
|
336
|
-
...
|
|
336
|
+
...spring2[timing(run.current.effect)].exit,
|
|
337
337
|
onUpdate: (p) => {
|
|
338
|
-
if (skip(
|
|
338
|
+
if (skip(popup))
|
|
339
339
|
controls?.complete();
|
|
340
340
|
render(p);
|
|
341
341
|
},
|
|
@@ -1,29 +1,29 @@
|
|
|
1
1
|
import {
|
|
2
|
-
|
|
3
|
-
} from "./components-
|
|
2
|
+
cn2
|
|
3
|
+
} from "./components-ezxhrmer.js";
|
|
4
4
|
import {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
useSurface
|
|
8
|
-
} from "./components-csxz9f52.js";
|
|
9
|
-
import {
|
|
10
|
-
useFluidHover
|
|
11
|
-
} from "./components-e46kf6cp.js";
|
|
5
|
+
GooIndicator
|
|
6
|
+
} from "./components-chacnk61.js";
|
|
12
7
|
import {
|
|
13
8
|
useShape
|
|
14
|
-
} from "./components-
|
|
9
|
+
} from "./components-cv16mryv.js";
|
|
15
10
|
import {
|
|
16
|
-
|
|
17
|
-
} from "./components-
|
|
11
|
+
useSize2
|
|
12
|
+
} from "./components-0sn7ypjw.js";
|
|
13
|
+
import {
|
|
14
|
+
SURFACE_BG,
|
|
15
|
+
SURFACE_SHADOW,
|
|
16
|
+
useSurface2
|
|
17
|
+
} from "./components-zx6b6yby.js";
|
|
18
18
|
import {
|
|
19
|
-
|
|
20
|
-
} from "./components-
|
|
19
|
+
useFluidHover2
|
|
20
|
+
} from "./components-59efxjd9.js";
|
|
21
21
|
import {
|
|
22
|
-
|
|
23
|
-
} from "./components-
|
|
22
|
+
SizeProvider2
|
|
23
|
+
} from "./components-jjw69c4c.js";
|
|
24
24
|
import {
|
|
25
|
-
|
|
26
|
-
} from "./components-
|
|
25
|
+
spring2
|
|
26
|
+
} from "./components-1v7rxytx.js";
|
|
27
27
|
|
|
28
28
|
// components/navigation/tabs/index.tsx
|
|
29
29
|
import { Tabs as TabsPrimitive } from "@base-ui/react/tabs";
|
|
@@ -50,7 +50,7 @@ function useTabsList() {
|
|
|
50
50
|
throw new Error("TabItem must be used within a TabsList");
|
|
51
51
|
return ctx;
|
|
52
52
|
}
|
|
53
|
-
var
|
|
53
|
+
var Tabs2 = forwardRef(({ value, onValueChange, selectedIndex, onSelect, defaultValue, defaultSelectedIndex, size, children, ...props }, ref) => {
|
|
54
54
|
const [valueOrder, setValueOrder] = useState([]);
|
|
55
55
|
const [uncontrolledValue, setUncontrolledValue] = useState(defaultValue);
|
|
56
56
|
const updateValueOrder = useCallback((order) => {
|
|
@@ -88,18 +88,18 @@ var Tabs = forwardRef(({ value, onValueChange, selectedIndex, onSelect, defaultV
|
|
|
88
88
|
children
|
|
89
89
|
})
|
|
90
90
|
});
|
|
91
|
-
return size ? /* @__PURE__ */ jsx(
|
|
91
|
+
return size ? /* @__PURE__ */ jsx(SizeProvider2, {
|
|
92
92
|
size,
|
|
93
93
|
children: root
|
|
94
94
|
}) : root;
|
|
95
95
|
});
|
|
96
|
-
|
|
97
|
-
var
|
|
96
|
+
Tabs2.displayName = "Tabs";
|
|
97
|
+
var TabsList2 = forwardRef(({ children, className, ...props }, ref) => {
|
|
98
98
|
const containerRef = useRef(null);
|
|
99
99
|
const isMouseInside = useRef(false);
|
|
100
100
|
const shape = useShape();
|
|
101
|
-
const sizeClasses =
|
|
102
|
-
const substrate =
|
|
101
|
+
const sizeClasses = useSize2();
|
|
102
|
+
const substrate = useSurface2();
|
|
103
103
|
const indicatorLevel = Math.min(substrate + 3, 8);
|
|
104
104
|
const valueOrderCtx = useContext(TabsValueOrderContext);
|
|
105
105
|
const [optimisticIdx, setOptimisticIdx] = useState(null);
|
|
@@ -116,7 +116,7 @@ var TabsList = forwardRef(({ children, className, ...props }, ref) => {
|
|
|
116
116
|
handlers,
|
|
117
117
|
registerItem,
|
|
118
118
|
measureItems
|
|
119
|
-
} =
|
|
119
|
+
} = useFluidHover2(containerRef, { axis: "x" });
|
|
120
120
|
const registerTab = useCallback((index, _value, el) => {
|
|
121
121
|
registerItem(index, el);
|
|
122
122
|
}, [registerItem]);
|
|
@@ -186,24 +186,24 @@ var TabsList = forwardRef(({ children, className, ...props }, ref) => {
|
|
|
186
186
|
return;
|
|
187
187
|
setHoveredIndex(null);
|
|
188
188
|
},
|
|
189
|
-
className:
|
|
189
|
+
className: cn2("relative inline-flex items-center select-none bg-muted", sizeClasses.segmentPad, shape.container, className),
|
|
190
190
|
...props,
|
|
191
191
|
children: [
|
|
192
192
|
selectedRect && /* @__PURE__ */ jsx(GooIndicator, {
|
|
193
193
|
rect: selectedRect,
|
|
194
|
-
className:
|
|
194
|
+
className: cn2(SURFACE_BG[indicatorLevel], shape.bg),
|
|
195
195
|
shadow: SURFACE_SHADOW[indicatorLevel],
|
|
196
196
|
opacity: isHovering ? 0.85 : 1
|
|
197
197
|
}),
|
|
198
198
|
selectedRect && /* @__PURE__ */ jsx(GooIndicator, {
|
|
199
199
|
rect: isHovering && hoverRect ? hoverRect : selectedRect,
|
|
200
|
-
className:
|
|
201
|
-
transition:
|
|
200
|
+
className: cn2("bg-hover", shape.bg),
|
|
201
|
+
transition: spring2.fast,
|
|
202
202
|
opacity: isHovering ? 0.4 : 0
|
|
203
203
|
}),
|
|
204
204
|
/* @__PURE__ */ jsx(AnimatePresence, {
|
|
205
205
|
children: focusRect && /* @__PURE__ */ jsx(motion.div, {
|
|
206
|
-
className:
|
|
206
|
+
className: cn2("absolute pointer-events-none z-20 border border-focus-ring", shape.focusRing),
|
|
207
207
|
initial: false,
|
|
208
208
|
animate: {
|
|
209
209
|
left: focusRect.left - 2,
|
|
@@ -211,10 +211,10 @@ var TabsList = forwardRef(({ children, className, ...props }, ref) => {
|
|
|
211
211
|
width: focusRect.width + 4,
|
|
212
212
|
height: focusRect.height + 4
|
|
213
213
|
},
|
|
214
|
-
exit: { opacity: 0, transition:
|
|
214
|
+
exit: { opacity: 0, transition: spring2.fast.exit },
|
|
215
215
|
transition: {
|
|
216
|
-
...
|
|
217
|
-
opacity: { duration:
|
|
216
|
+
...spring2.fast,
|
|
217
|
+
opacity: { duration: spring2.fast.duration }
|
|
218
218
|
}
|
|
219
219
|
})
|
|
220
220
|
}),
|
|
@@ -223,10 +223,10 @@ var TabsList = forwardRef(({ children, className, ...props }, ref) => {
|
|
|
223
223
|
})
|
|
224
224
|
});
|
|
225
225
|
});
|
|
226
|
-
|
|
227
|
-
var
|
|
226
|
+
TabsList2.displayName = "TabsList";
|
|
227
|
+
var TabItem2 = forwardRef(({ value, icon: Icon, label, _index = 0, className, onClick, ...props }, ref) => {
|
|
228
228
|
const internalRef = useRef(null);
|
|
229
|
-
const sizeClasses =
|
|
229
|
+
const sizeClasses = useSize2();
|
|
230
230
|
const { registerTab, hoveredIndex, selectedValue, setOptimisticIdx } = useTabsList();
|
|
231
231
|
useEffect(() => {
|
|
232
232
|
registerTab(_index, value, internalRef.current);
|
|
@@ -248,16 +248,16 @@ var TabItem = forwardRef(({ value, icon: Icon, label, _index = 0, className, onC
|
|
|
248
248
|
},
|
|
249
249
|
value,
|
|
250
250
|
"data-fluid-hover-index": _index,
|
|
251
|
-
className:
|
|
251
|
+
className: cn2("relative z-10 flex items-center px-3 cursor-pointer bg-transparent border-none outline-none", sizeClasses.segmentItem, sizeClasses.gap, className),
|
|
252
252
|
...props,
|
|
253
253
|
children: [
|
|
254
254
|
Icon && /* @__PURE__ */ jsx(Icon, {
|
|
255
255
|
size: sizeClasses.icon,
|
|
256
256
|
strokeWidth: isActive ? 2 : 1.5,
|
|
257
|
-
className:
|
|
257
|
+
className: cn2("transition-[color,stroke-width] duration-fast", isActive ? "text-foreground" : "text-muted-foreground")
|
|
258
258
|
}),
|
|
259
259
|
/* @__PURE__ */ jsxs("span", {
|
|
260
|
-
className:
|
|
260
|
+
className: cn2("inline-grid whitespace-nowrap", sizeClasses.text),
|
|
261
261
|
children: [
|
|
262
262
|
/* @__PURE__ */ jsx("span", {
|
|
263
263
|
className: "col-start-1 row-start-1 invisible [text-box:trim-both_cap_alphabetic] weight-semibold",
|
|
@@ -265,7 +265,7 @@ var TabItem = forwardRef(({ value, icon: Icon, label, _index = 0, className, onC
|
|
|
265
265
|
children: label
|
|
266
266
|
}),
|
|
267
267
|
/* @__PURE__ */ jsx("span", {
|
|
268
|
-
className:
|
|
268
|
+
className: cn2("col-start-1 row-start-1 transition-[color,font-variation-settings] duration-fast [text-box:trim-both_cap_alphabetic]", isActive ? "text-foreground" : "text-muted-foreground", isSelected ? "weight-semibold" : "weight-normal"),
|
|
269
269
|
children: label
|
|
270
270
|
})
|
|
271
271
|
]
|
|
@@ -273,16 +273,16 @@ var TabItem = forwardRef(({ value, icon: Icon, label, _index = 0, className, onC
|
|
|
273
273
|
]
|
|
274
274
|
});
|
|
275
275
|
});
|
|
276
|
-
|
|
277
|
-
var
|
|
276
|
+
TabItem2.displayName = "TabItem";
|
|
277
|
+
var TabPanel2 = forwardRef(({ className, ...props }, ref) => {
|
|
278
278
|
return /* @__PURE__ */ jsx(TabsPrimitive.Panel, {
|
|
279
279
|
ref,
|
|
280
|
-
className:
|
|
280
|
+
className: cn2("outline-none", className),
|
|
281
281
|
...props
|
|
282
282
|
});
|
|
283
283
|
});
|
|
284
|
-
|
|
285
|
-
Object.assign(
|
|
286
|
-
var tabs_default =
|
|
284
|
+
TabPanel2.displayName = "TabPanel";
|
|
285
|
+
Object.assign(Tabs2, { List: TabsList2, Item: TabItem2, Panel: TabPanel2 });
|
|
286
|
+
var tabs_default = Tabs2;
|
|
287
287
|
|
|
288
|
-
export {
|
|
288
|
+
export { Tabs2, TabsList2, TabItem2, TabPanel2, tabs_default };
|
|
@@ -1,35 +1,39 @@
|
|
|
1
1
|
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
useSelectionRuns
|
|
5
|
-
} from "./components-rc63qsy6.js";
|
|
6
|
-
import {
|
|
7
|
-
SizeProvider
|
|
8
|
-
} from "./components-vb033rns.js";
|
|
2
|
+
cn2
|
|
3
|
+
} from "./components-ezxhrmer.js";
|
|
9
4
|
import {
|
|
10
|
-
|
|
11
|
-
} from "./components-
|
|
5
|
+
FluidHoverHighlight2
|
|
6
|
+
} from "./components-kvr7f9hy.js";
|
|
12
7
|
import {
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
} from "./components-
|
|
8
|
+
IndexedRows,
|
|
9
|
+
useRowIndex
|
|
10
|
+
} from "./components-ta7shw28.js";
|
|
16
11
|
import {
|
|
17
12
|
useShape
|
|
18
|
-
} from "./components-
|
|
13
|
+
} from "./components-cv16mryv.js";
|
|
14
|
+
import {
|
|
15
|
+
useSize2
|
|
16
|
+
} from "./components-0sn7ypjw.js";
|
|
19
17
|
import {
|
|
20
18
|
useControllableState
|
|
21
|
-
} from "./components-
|
|
19
|
+
} from "./components-n7mjr357.js";
|
|
22
20
|
import {
|
|
23
|
-
|
|
24
|
-
|
|
21
|
+
useFluidHover2,
|
|
22
|
+
useRegisterFluidHoverItem2
|
|
23
|
+
} from "./components-59efxjd9.js";
|
|
24
|
+
import {
|
|
25
|
+
useSelectionRuns,
|
|
26
|
+
useMergeSplitBlocks,
|
|
27
|
+
SelectionBackgrounds
|
|
28
|
+
} from "./components-5xc2j8jz.js";
|
|
25
29
|
import {
|
|
26
|
-
|
|
27
|
-
} from "./components-
|
|
30
|
+
SizeProvider2
|
|
31
|
+
} from "./components-jjw69c4c.js";
|
|
28
32
|
import {
|
|
29
|
-
|
|
30
|
-
} from "./components-
|
|
33
|
+
spring2
|
|
34
|
+
} from "./components-1v7rxytx.js";
|
|
31
35
|
|
|
32
|
-
// components/inputs/checkbox
|
|
36
|
+
// components/inputs/checkbox/index.tsx
|
|
33
37
|
import { Checkbox as CheckboxPrimitive } from "@base-ui/react/checkbox";
|
|
34
38
|
import { AnimatePresence, motion } from "motion/react";
|
|
35
39
|
import {
|
|
@@ -43,13 +47,7 @@ import {
|
|
|
43
47
|
} from "react";
|
|
44
48
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
45
49
|
var CheckboxGroupContext = createContext(null);
|
|
46
|
-
|
|
47
|
-
const ctx = useContext(CheckboxGroupContext);
|
|
48
|
-
if (!ctx)
|
|
49
|
-
throw new Error("useCheckboxGroup must be used within a CheckboxGroup");
|
|
50
|
-
return ctx;
|
|
51
|
-
}
|
|
52
|
-
var CheckboxGroup = forwardRef(({
|
|
50
|
+
var CheckboxGroup2 = forwardRef(({
|
|
53
51
|
children,
|
|
54
52
|
checkedIndices: checkedIndicesProp,
|
|
55
53
|
defaultCheckedIndices,
|
|
@@ -72,7 +70,7 @@ var CheckboxGroup = forwardRef(({
|
|
|
72
70
|
return next;
|
|
73
71
|
});
|
|
74
72
|
}, [setCheckedIndices]);
|
|
75
|
-
const hover =
|
|
73
|
+
const hover = useFluidHover2(containerRef);
|
|
76
74
|
const { activeIndex, setActiveIndex, itemRects, handlers, registerItem } = hover;
|
|
77
75
|
const checkedGroups = useSelectionRuns([...checkedIndices]);
|
|
78
76
|
const [focusedIndex, setFocusedIndex] = useState(null);
|
|
@@ -125,13 +123,13 @@ var CheckboxGroup = forwardRef(({
|
|
|
125
123
|
}
|
|
126
124
|
},
|
|
127
125
|
role: "group",
|
|
128
|
-
className:
|
|
126
|
+
className: cn2("relative flex flex-col w-72 max-w-full select-none", className),
|
|
129
127
|
...props,
|
|
130
128
|
children: [
|
|
131
129
|
/* @__PURE__ */ jsx(SelectionBackgrounds, {
|
|
132
130
|
blocks
|
|
133
131
|
}),
|
|
134
|
-
/* @__PURE__ */ jsx(
|
|
132
|
+
/* @__PURE__ */ jsx(FluidHoverHighlight2, {
|
|
135
133
|
hover,
|
|
136
134
|
className: shape.bg
|
|
137
135
|
}),
|
|
@@ -145,40 +143,56 @@ var CheckboxGroup = forwardRef(({
|
|
|
145
143
|
width: focusRect.width + 4,
|
|
146
144
|
height: focusRect.height + 4
|
|
147
145
|
},
|
|
148
|
-
exit: { opacity: 0, transition:
|
|
146
|
+
exit: { opacity: 0, transition: spring2.fast.exit },
|
|
149
147
|
transition: {
|
|
150
|
-
...
|
|
151
|
-
opacity: { duration:
|
|
148
|
+
...spring2.fast,
|
|
149
|
+
opacity: { duration: spring2.fast.duration }
|
|
152
150
|
}
|
|
153
151
|
})
|
|
154
152
|
}),
|
|
155
|
-
|
|
153
|
+
/* @__PURE__ */ jsx(IndexedRows, {
|
|
154
|
+
children
|
|
155
|
+
})
|
|
156
156
|
]
|
|
157
157
|
})
|
|
158
158
|
});
|
|
159
|
-
return size ? /* @__PURE__ */ jsx(
|
|
159
|
+
return size ? /* @__PURE__ */ jsx(SizeProvider2, {
|
|
160
160
|
size,
|
|
161
161
|
children: group
|
|
162
162
|
}) : group;
|
|
163
163
|
});
|
|
164
|
-
|
|
165
|
-
var
|
|
164
|
+
CheckboxGroup2.displayName = "CheckboxGroup";
|
|
165
|
+
var Checkbox2 = forwardRef(({
|
|
166
|
+
label,
|
|
167
|
+
checked: checkedProp,
|
|
168
|
+
defaultChecked = false,
|
|
169
|
+
onCheckedChange,
|
|
170
|
+
onToggle: onToggleProp,
|
|
171
|
+
index: indexProp,
|
|
172
|
+
size,
|
|
173
|
+
className,
|
|
174
|
+
...props
|
|
175
|
+
}, ref) => {
|
|
166
176
|
const internalRef = useRef(null);
|
|
167
177
|
const hasMounted = useRef(false);
|
|
168
|
-
const
|
|
169
|
-
const
|
|
178
|
+
const group = useContext(CheckboxGroupContext);
|
|
179
|
+
const index = useRowIndex(indexProp);
|
|
180
|
+
const [ownChecked, setOwnChecked] = useControllableState(checkedProp, defaultChecked, onCheckedChange);
|
|
181
|
+
const [hovered, setHovered] = useState(false);
|
|
182
|
+
const checked = checkedProp ?? (group ? group.checkedIndices.has(index) : ownChecked);
|
|
170
183
|
const onToggle = () => {
|
|
171
184
|
onToggleProp?.();
|
|
172
|
-
setItemChecked(index, !checked);
|
|
185
|
+
group?.setItemChecked(index, !checked);
|
|
186
|
+
setOwnChecked(!checked);
|
|
173
187
|
};
|
|
174
|
-
|
|
188
|
+
useRegisterFluidHoverItem2(group?.registerItem, index, internalRef);
|
|
175
189
|
useEffect(() => {
|
|
176
190
|
hasMounted.current = true;
|
|
177
191
|
}, []);
|
|
178
|
-
const isActive = activeIndex === index;
|
|
192
|
+
const isActive = group ? group.activeIndex === index : hovered;
|
|
179
193
|
const skipAnimation = !hasMounted.current;
|
|
180
194
|
const shape = useShape();
|
|
181
|
-
const sizeClasses =
|
|
195
|
+
const sizeClasses = useSize2(size);
|
|
182
196
|
const compact = sizeClasses.variant === "compact";
|
|
183
197
|
return /* @__PURE__ */ jsxs("div", {
|
|
184
198
|
ref: (node) => {
|
|
@@ -194,6 +208,11 @@ var CheckboxItem = forwardRef(({ label, index, checked: checkedProp, onToggle: o
|
|
|
194
208
|
"aria-checked": checked,
|
|
195
209
|
"aria-label": label,
|
|
196
210
|
onClick: onToggle,
|
|
211
|
+
onPointerEnter: (e) => {
|
|
212
|
+
if (e.pointerType === "mouse")
|
|
213
|
+
setHovered(true);
|
|
214
|
+
},
|
|
215
|
+
onPointerLeave: () => setHovered(false),
|
|
197
216
|
onMouseDown: (e) => {
|
|
198
217
|
const interactive = e.target.closest('button:not([tabindex="-1"]), a[href], input, select, textarea, [tabindex]:not([tabindex="-1"])');
|
|
199
218
|
if (interactive && interactive !== e.currentTarget)
|
|
@@ -207,7 +226,7 @@ var CheckboxItem = forwardRef(({ label, index, checked: checkedProp, onToggle: o
|
|
|
207
226
|
onToggle();
|
|
208
227
|
}
|
|
209
228
|
},
|
|
210
|
-
className:
|
|
229
|
+
className: cn2(`relative z-10 flex ${sizeClasses.control} items-center ${sizeClasses.gap} ${shape.item} ${sizeClasses.px} cursor-pointer outline-none`, !group && "focus-visible:ring-1 focus-visible:ring-focus-ring", className),
|
|
211
230
|
...props,
|
|
212
231
|
children: [
|
|
213
232
|
/* @__PURE__ */ jsxs(CheckboxPrimitive.Root, {
|
|
@@ -215,11 +234,11 @@ var CheckboxItem = forwardRef(({ label, index, checked: checkedProp, onToggle: o
|
|
|
215
234
|
onCheckedChange: () => onToggle(),
|
|
216
235
|
tabIndex: -1,
|
|
217
236
|
"aria-hidden": true,
|
|
218
|
-
className:
|
|
237
|
+
className: cn2("relative shrink-0 appearance-none bg-transparent p-0 border-0 outline-none cursor-pointer", compact ? "w-[14px] h-[14px]" : "w-[16px] h-[16px]"),
|
|
219
238
|
onClick: (e) => e.stopPropagation(),
|
|
220
239
|
children: [
|
|
221
240
|
/* @__PURE__ */ jsx("div", {
|
|
222
|
-
className:
|
|
241
|
+
className: cn2("absolute inset-0 border-solid transition-all duration-fast", compact ? "rounded-sm" : "rounded-box", checked ? "border-[1.5px] border-transparent" : isActive ? "border-[1.5px] border-control" : "border-[1.5px] border-border")
|
|
223
242
|
}),
|
|
224
243
|
/* @__PURE__ */ jsx(AnimatePresence, {
|
|
225
244
|
children: checked && /* @__PURE__ */ jsx(CheckboxPrimitive.Indicator, {
|
|
@@ -254,7 +273,7 @@ var CheckboxItem = forwardRef(({ label, index, checked: checkedProp, onToggle: o
|
|
|
254
273
|
initial: { pathLength: skipAnimation ? 1 : 0 },
|
|
255
274
|
animate: {
|
|
256
275
|
pathLength: 1,
|
|
257
|
-
transition: { duration:
|
|
276
|
+
transition: { duration: spring2.fast.duration, ease: "easeOut" }
|
|
258
277
|
},
|
|
259
278
|
exit: {
|
|
260
279
|
pathLength: 0,
|
|
@@ -268,7 +287,7 @@ var CheckboxItem = forwardRef(({ label, index, checked: checkedProp, onToggle: o
|
|
|
268
287
|
]
|
|
269
288
|
}),
|
|
270
289
|
/* @__PURE__ */ jsxs("span", {
|
|
271
|
-
className:
|
|
290
|
+
className: cn2("inline-grid", sizeClasses.text),
|
|
272
291
|
children: [
|
|
273
292
|
/* @__PURE__ */ jsx("span", {
|
|
274
293
|
className: "col-start-1 row-start-1 invisible [text-box:trim-both_cap_alphabetic] weight-semibold",
|
|
@@ -276,7 +295,7 @@ var CheckboxItem = forwardRef(({ label, index, checked: checkedProp, onToggle: o
|
|
|
276
295
|
children: label
|
|
277
296
|
}),
|
|
278
297
|
/* @__PURE__ */ jsx("span", {
|
|
279
|
-
className:
|
|
298
|
+
className: cn2("col-start-1 row-start-1 transition-[color,font-variation-settings] duration-fast [text-box:trim-both_cap_alphabetic]", checked || isActive ? "text-foreground" : "text-muted-foreground", checked ? "weight-semibold" : "weight-normal"),
|
|
280
299
|
children: label
|
|
281
300
|
})
|
|
282
301
|
]
|
|
@@ -284,8 +303,8 @@ var CheckboxItem = forwardRef(({ label, index, checked: checkedProp, onToggle: o
|
|
|
284
303
|
]
|
|
285
304
|
});
|
|
286
305
|
});
|
|
287
|
-
|
|
288
|
-
Object.assign(
|
|
289
|
-
var
|
|
306
|
+
Checkbox2.displayName = "Checkbox";
|
|
307
|
+
Object.assign(Checkbox2, { Group: CheckboxGroup2 });
|
|
308
|
+
var checkbox_default = Checkbox2;
|
|
290
309
|
|
|
291
|
-
export {
|
|
310
|
+
export { CheckboxGroup2, Checkbox2, checkbox_default };
|