doodleui-react 0.2.0 → 0.4.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/CHANGELOG.md +13 -0
- package/README.md +6 -2
- package/dist/index.cjs +2322 -292
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +406 -13
- package/dist/index.d.ts +406 -13
- package/dist/index.js +2259 -294
- package/dist/index.js.map +1 -1
- package/package.json +9 -1
package/dist/index.js
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { createContext, forwardRef, useState, useId,
|
|
2
|
+
import { createContext, forwardRef, useRef, useState, useId, useLayoutEffect, useContext, Children, isValidElement, cloneElement, useEffect, useSyncExternalStore, useCallback, useMemo } from 'react';
|
|
3
3
|
import rough from 'roughjs';
|
|
4
4
|
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
5
5
|
import * as CheckboxPrimitive from '@radix-ui/react-checkbox';
|
|
6
6
|
import * as RadioGroupPrimitive from '@radix-ui/react-radio-group';
|
|
7
7
|
import * as Dialog from '@radix-ui/react-dialog';
|
|
8
|
+
import { motion, AnimatePresence } from 'framer-motion';
|
|
8
9
|
import * as TooltipPrimitive from '@radix-ui/react-tooltip';
|
|
9
10
|
import * as SelectPrimitive from '@radix-ui/react-select';
|
|
10
11
|
import * as SwitchPrimitive from '@radix-ui/react-switch';
|
|
@@ -13,6 +14,12 @@ import * as ToastPrimitive from '@radix-ui/react-toast';
|
|
|
13
14
|
import * as AccordionPrimitive from '@radix-ui/react-accordion';
|
|
14
15
|
import * as AvatarPrimitive from '@radix-ui/react-avatar';
|
|
15
16
|
import * as SliderPrimitive from '@radix-ui/react-slider';
|
|
17
|
+
import * as LabelPrimitive from '@radix-ui/react-label';
|
|
18
|
+
import * as CollapsiblePrimitive from '@radix-ui/react-collapsible';
|
|
19
|
+
import * as PopoverPrimitive from '@radix-ui/react-popover';
|
|
20
|
+
import * as DropdownMenuPrimitive from '@radix-ui/react-dropdown-menu';
|
|
21
|
+
import * as AlertDialogPrimitive from '@radix-ui/react-alert-dialog';
|
|
22
|
+
import { Command as Command$1, CommandInput as CommandInput$1, CommandList as CommandList$1, CommandEmpty as CommandEmpty$1, CommandGroup as CommandGroup$1, CommandItem as CommandItem$1, CommandSeparator as CommandSeparator$1 } from 'cmdk';
|
|
16
23
|
|
|
17
24
|
// src/types.ts
|
|
18
25
|
function toRoughOptions(props) {
|
|
@@ -48,6 +55,11 @@ var SKETCH_COLORS = {
|
|
|
48
55
|
};
|
|
49
56
|
|
|
50
57
|
// src/utils.ts
|
|
58
|
+
function assignRef(ref, value) {
|
|
59
|
+
if (!ref) return;
|
|
60
|
+
if (typeof ref === "function") ref(value);
|
|
61
|
+
else ref.current = value;
|
|
62
|
+
}
|
|
51
63
|
function randomSeed() {
|
|
52
64
|
return Math.floor(Math.random() * 2 ** 31);
|
|
53
65
|
}
|
|
@@ -248,6 +260,177 @@ function RoughSvg({
|
|
|
248
260
|
}
|
|
249
261
|
);
|
|
250
262
|
}
|
|
263
|
+
var DoodleUIContext = createContext(null);
|
|
264
|
+
function DoodleUIProvider({
|
|
265
|
+
children,
|
|
266
|
+
animate = true,
|
|
267
|
+
forceAnimate = false
|
|
268
|
+
}) {
|
|
269
|
+
const value = useMemo(
|
|
270
|
+
() => ({ animate, forceAnimate }),
|
|
271
|
+
[animate, forceAnimate]
|
|
272
|
+
);
|
|
273
|
+
return /* @__PURE__ */ jsx(DoodleUIContext.Provider, { value, children });
|
|
274
|
+
}
|
|
275
|
+
function useDoodleUI() {
|
|
276
|
+
return useContext(DoodleUIContext) ?? { animate: true, forceAnimate: false };
|
|
277
|
+
}
|
|
278
|
+
|
|
279
|
+
// src/animations/resolveAnimate.ts
|
|
280
|
+
function resolveAnimate({
|
|
281
|
+
animate,
|
|
282
|
+
providerAnimate = true,
|
|
283
|
+
forceAnimate = false,
|
|
284
|
+
prefersReducedMotion = false
|
|
285
|
+
}) {
|
|
286
|
+
if (prefersReducedMotion && !forceAnimate) return false;
|
|
287
|
+
if (animate !== void 0) return animate;
|
|
288
|
+
return providerAnimate;
|
|
289
|
+
}
|
|
290
|
+
function subscribe(onStoreChange) {
|
|
291
|
+
const media = window.matchMedia("(prefers-reduced-motion: reduce)");
|
|
292
|
+
media.addEventListener("change", onStoreChange);
|
|
293
|
+
return () => media.removeEventListener("change", onStoreChange);
|
|
294
|
+
}
|
|
295
|
+
function getSnapshot() {
|
|
296
|
+
return window.matchMedia("(prefers-reduced-motion: reduce)").matches;
|
|
297
|
+
}
|
|
298
|
+
function getServerSnapshot() {
|
|
299
|
+
return false;
|
|
300
|
+
}
|
|
301
|
+
function usePrefersReducedMotion() {
|
|
302
|
+
return useSyncExternalStore(subscribe, getSnapshot, getServerSnapshot);
|
|
303
|
+
}
|
|
304
|
+
|
|
305
|
+
// src/animations/useAnimate.ts
|
|
306
|
+
function useAnimate(animate) {
|
|
307
|
+
const { animate: providerAnimate, forceAnimate } = useDoodleUI();
|
|
308
|
+
const prefersReducedMotion = usePrefersReducedMotion();
|
|
309
|
+
return resolveAnimate({
|
|
310
|
+
animate,
|
|
311
|
+
providerAnimate,
|
|
312
|
+
forceAnimate,
|
|
313
|
+
prefersReducedMotion
|
|
314
|
+
});
|
|
315
|
+
}
|
|
316
|
+
function useTweenNumber(target, enabled, duration = 400) {
|
|
317
|
+
const [value, setValue] = useState(target);
|
|
318
|
+
const valueRef = useRef(target);
|
|
319
|
+
valueRef.current = value;
|
|
320
|
+
useEffect(() => {
|
|
321
|
+
if (!enabled) {
|
|
322
|
+
valueRef.current = target;
|
|
323
|
+
setValue(target);
|
|
324
|
+
return;
|
|
325
|
+
}
|
|
326
|
+
const from = valueRef.current;
|
|
327
|
+
if (from === target) return;
|
|
328
|
+
const start = performance.now();
|
|
329
|
+
let frame = 0;
|
|
330
|
+
const tick = (now) => {
|
|
331
|
+
const t = Math.min(1, (now - start) / duration);
|
|
332
|
+
const eased = 1 - (1 - t) ** 3;
|
|
333
|
+
const next = from + (target - from) * eased;
|
|
334
|
+
valueRef.current = next;
|
|
335
|
+
setValue(next);
|
|
336
|
+
if (t < 1) frame = requestAnimationFrame(tick);
|
|
337
|
+
};
|
|
338
|
+
frame = requestAnimationFrame(tick);
|
|
339
|
+
return () => cancelAnimationFrame(frame);
|
|
340
|
+
}, [target, enabled, duration]);
|
|
341
|
+
return enabled ? value : target;
|
|
342
|
+
}
|
|
343
|
+
var DRAW_IN_DURATION_MS = 400;
|
|
344
|
+
var DRAW_IN_ALERT_MS = 200;
|
|
345
|
+
var DRAW_IN_TOOLTIP_MS = 180;
|
|
346
|
+
var DRAW_IN_MARK_MS = 240;
|
|
347
|
+
var TABLE_STAGGER_MS = 40;
|
|
348
|
+
var DRAW_IN_EASING = "ease-out";
|
|
349
|
+
var running = /* @__PURE__ */ new WeakMap();
|
|
350
|
+
function collectStrokePaths(root) {
|
|
351
|
+
const groups = root.querySelectorAll("g");
|
|
352
|
+
if (groups.length > 0) {
|
|
353
|
+
const paths = [];
|
|
354
|
+
groups.forEach((group) => {
|
|
355
|
+
const children = group.querySelectorAll(":scope > path");
|
|
356
|
+
if (children.length === 0) return;
|
|
357
|
+
paths.push(children[children.length - 1]);
|
|
358
|
+
});
|
|
359
|
+
return paths;
|
|
360
|
+
}
|
|
361
|
+
return Array.from(root.querySelectorAll("path"));
|
|
362
|
+
}
|
|
363
|
+
function getStrokePaths(target) {
|
|
364
|
+
if (target instanceof SVGPathElement) return [target];
|
|
365
|
+
if (target instanceof SVGSVGElement) return collectStrokePaths(target);
|
|
366
|
+
const svgs = target.querySelectorAll("svg");
|
|
367
|
+
if (svgs.length > 0) {
|
|
368
|
+
return Array.from(svgs).flatMap((svg) => collectStrokePaths(svg));
|
|
369
|
+
}
|
|
370
|
+
return collectStrokePaths(target);
|
|
371
|
+
}
|
|
372
|
+
function clearDash(path) {
|
|
373
|
+
path.style.strokeDasharray = "";
|
|
374
|
+
path.style.strokeDashoffset = "";
|
|
375
|
+
}
|
|
376
|
+
function cancelDrawIn(target) {
|
|
377
|
+
if (!target) return;
|
|
378
|
+
const animations = running.get(target);
|
|
379
|
+
animations?.forEach((animation) => animation.cancel());
|
|
380
|
+
running.delete(target);
|
|
381
|
+
getStrokePaths(target).forEach(clearDash);
|
|
382
|
+
}
|
|
383
|
+
function drawIn(target, duration = DRAW_IN_DURATION_MS, delay = 0) {
|
|
384
|
+
cancelDrawIn(target);
|
|
385
|
+
const paths = getStrokePaths(target);
|
|
386
|
+
const animations = [];
|
|
387
|
+
for (const path of paths) {
|
|
388
|
+
let length = 0;
|
|
389
|
+
try {
|
|
390
|
+
length = path.getTotalLength();
|
|
391
|
+
} catch {
|
|
392
|
+
continue;
|
|
393
|
+
}
|
|
394
|
+
if (length <= 0) continue;
|
|
395
|
+
path.style.strokeDasharray = `${length}`;
|
|
396
|
+
path.style.strokeDashoffset = `${length}`;
|
|
397
|
+
const animation = path.animate(
|
|
398
|
+
[{ strokeDashoffset: String(length) }, { strokeDashoffset: "0" }],
|
|
399
|
+
{ duration, delay, easing: DRAW_IN_EASING, fill: "forwards" }
|
|
400
|
+
);
|
|
401
|
+
animation.finished.then(() => {
|
|
402
|
+
clearDash(path);
|
|
403
|
+
}).catch(() => {
|
|
404
|
+
});
|
|
405
|
+
animations.push(animation);
|
|
406
|
+
}
|
|
407
|
+
running.set(target, animations);
|
|
408
|
+
}
|
|
409
|
+
function useDrawIn(pathRef, duration = DRAW_IN_DURATION_MS, enabled = true, replayKey, delay = 0) {
|
|
410
|
+
useLayoutEffect(() => {
|
|
411
|
+
const target = pathRef.current;
|
|
412
|
+
if (!target) return;
|
|
413
|
+
if (!enabled) {
|
|
414
|
+
cancelDrawIn(target);
|
|
415
|
+
return;
|
|
416
|
+
}
|
|
417
|
+
const apply = () => drawIn(target, duration, delay);
|
|
418
|
+
if (getStrokePaths(target).length > 0) {
|
|
419
|
+
apply();
|
|
420
|
+
return () => cancelDrawIn(target);
|
|
421
|
+
}
|
|
422
|
+
const observer = new MutationObserver(() => {
|
|
423
|
+
if (getStrokePaths(target).length === 0) return;
|
|
424
|
+
observer.disconnect();
|
|
425
|
+
apply();
|
|
426
|
+
});
|
|
427
|
+
observer.observe(target, { childList: true, subtree: true });
|
|
428
|
+
return () => {
|
|
429
|
+
observer.disconnect();
|
|
430
|
+
cancelDrawIn(target);
|
|
431
|
+
};
|
|
432
|
+
}, [pathRef, duration, enabled, replayKey, delay]);
|
|
433
|
+
}
|
|
251
434
|
var SketchBox = forwardRef(
|
|
252
435
|
function SketchBox2({
|
|
253
436
|
children,
|
|
@@ -266,12 +449,21 @@ var SketchBox = forwardRef(
|
|
|
266
449
|
strokeWidth,
|
|
267
450
|
inset,
|
|
268
451
|
path,
|
|
452
|
+
animate,
|
|
453
|
+
drawInDuration = DRAW_IN_DURATION_MS,
|
|
454
|
+
drawInKey,
|
|
269
455
|
...rest
|
|
270
456
|
}, ref) {
|
|
457
|
+
const rootRef = useRef(null);
|
|
458
|
+
const shouldAnimate = useAnimate(animate);
|
|
459
|
+
useDrawIn(rootRef, drawInDuration, shouldAnimate, drawInKey);
|
|
271
460
|
return /* @__PURE__ */ jsxs(
|
|
272
461
|
"div",
|
|
273
462
|
{
|
|
274
|
-
ref
|
|
463
|
+
ref: (node) => {
|
|
464
|
+
rootRef.current = node;
|
|
465
|
+
assignRef(ref, node);
|
|
466
|
+
},
|
|
275
467
|
className: cn(className),
|
|
276
468
|
style: { position: "relative", ...style },
|
|
277
469
|
...rest,
|
|
@@ -329,6 +521,10 @@ var SIZE_STYLES = {
|
|
|
329
521
|
md: { fontSize: 15, padding: "8px 16px", minHeight: 38 },
|
|
330
522
|
lg: { fontSize: 17, padding: "11px 22px", minHeight: 46 }
|
|
331
523
|
};
|
|
524
|
+
function assignRef2(ref, value) {
|
|
525
|
+
if (typeof ref === "function") ref(value);
|
|
526
|
+
else if (ref) ref.current = value;
|
|
527
|
+
}
|
|
332
528
|
var Button = forwardRef(
|
|
333
529
|
function Button2({
|
|
334
530
|
children,
|
|
@@ -343,18 +539,28 @@ var Button = forwardRef(
|
|
|
343
539
|
fillStyle,
|
|
344
540
|
strokeWidth,
|
|
345
541
|
disabled,
|
|
542
|
+
animate,
|
|
346
543
|
onMouseEnter,
|
|
347
544
|
onMouseLeave,
|
|
348
545
|
...rest
|
|
349
546
|
}, ref) {
|
|
547
|
+
const rootRef = useRef(null);
|
|
350
548
|
const [hovered, setHovered] = useState(false);
|
|
549
|
+
const shouldAnimate = useAnimate(animate);
|
|
550
|
+
const resolvedSeed = useResolvedSeed(seed);
|
|
551
|
+
const hoverSeed = deriveSeed(resolvedSeed, "hover");
|
|
552
|
+
const sketchSeed = shouldAnimate && hovered && !disabled ? hoverSeed : resolvedSeed;
|
|
351
553
|
const ink = sketchColor ?? SKETCH_COLORS.ink;
|
|
352
554
|
const fill = variant === "primary" ? SKETCH_COLORS.accentFill : variant === "secondary" ? SKETCH_COLORS.secondaryFill : void 0;
|
|
353
555
|
const stroke = variant === "ghost" && !hovered ? "transparent" : variant === "primary" ? sketchColor ?? SKETCH_COLORS.accent : ink;
|
|
556
|
+
useDrawIn(rootRef, DRAW_IN_DURATION_MS, shouldAnimate, sketchSeed);
|
|
354
557
|
return /* @__PURE__ */ jsxs(
|
|
355
558
|
"button",
|
|
356
559
|
{
|
|
357
|
-
ref
|
|
560
|
+
ref: (node) => {
|
|
561
|
+
rootRef.current = node;
|
|
562
|
+
assignRef2(ref, node);
|
|
563
|
+
},
|
|
358
564
|
type: "button",
|
|
359
565
|
className: cn(className),
|
|
360
566
|
disabled,
|
|
@@ -390,12 +596,12 @@ var Button = forwardRef(
|
|
|
390
596
|
{
|
|
391
597
|
shape: "rectangle",
|
|
392
598
|
roughness,
|
|
393
|
-
seed,
|
|
599
|
+
seed: sketchSeed,
|
|
394
600
|
sketchColor: stroke,
|
|
395
601
|
bowing,
|
|
396
602
|
fillStyle: fillStyle ?? "hachure",
|
|
397
603
|
fill,
|
|
398
|
-
strokeWidth: hovered ? (strokeWidth ?? 1.75) + 0.4 : strokeWidth
|
|
604
|
+
strokeWidth: !shouldAnimate && hovered ? (strokeWidth ?? 1.75) + 0.4 : strokeWidth
|
|
399
605
|
}
|
|
400
606
|
),
|
|
401
607
|
/* @__PURE__ */ jsx("span", { style: { position: "relative", zIndex: 1 }, children })
|
|
@@ -417,11 +623,18 @@ var Input = forwardRef(function Input2({
|
|
|
417
623
|
id,
|
|
418
624
|
onFocus,
|
|
419
625
|
onBlur,
|
|
626
|
+
animate,
|
|
420
627
|
...rest
|
|
421
628
|
}, ref) {
|
|
422
629
|
const [focused, setFocused] = useState(false);
|
|
630
|
+
const fieldRef = useRef(null);
|
|
631
|
+
const shouldAnimate = useAnimate(animate);
|
|
632
|
+
const resolvedSeed = useResolvedSeed(seed);
|
|
633
|
+
const focusSeed = deriveSeed(resolvedSeed, "focus");
|
|
634
|
+
const sketchSeed = shouldAnimate && focused ? focusSeed : resolvedSeed;
|
|
423
635
|
const ink = sketchColor ?? SKETCH_COLORS.ink;
|
|
424
636
|
const inputId = id;
|
|
637
|
+
useDrawIn(fieldRef, DRAW_IN_DURATION_MS, shouldAnimate, sketchSeed);
|
|
425
638
|
return /* @__PURE__ */ jsxs(
|
|
426
639
|
"label",
|
|
427
640
|
{
|
|
@@ -445,17 +658,17 @@ var Input = forwardRef(function Input2({
|
|
|
445
658
|
children: label
|
|
446
659
|
}
|
|
447
660
|
) : null,
|
|
448
|
-
/* @__PURE__ */ jsxs("span", { style: { position: "relative", display: "block" }, children: [
|
|
661
|
+
/* @__PURE__ */ jsxs("span", { ref: fieldRef, style: { position: "relative", display: "block" }, children: [
|
|
449
662
|
/* @__PURE__ */ jsx(
|
|
450
663
|
RoughSvg,
|
|
451
664
|
{
|
|
452
665
|
shape: "rectangle",
|
|
453
666
|
roughness,
|
|
454
|
-
seed,
|
|
667
|
+
seed: sketchSeed,
|
|
455
668
|
sketchColor: focused ? SKETCH_COLORS.accent : ink,
|
|
456
669
|
bowing,
|
|
457
670
|
fillStyle,
|
|
458
|
-
strokeWidth: focused ? (strokeWidth ?? 1.75) + 0.35 : strokeWidth
|
|
671
|
+
strokeWidth: focused && !shouldAnimate ? (strokeWidth ?? 1.75) + 0.35 : focused ? (strokeWidth ?? 1.75) + 0.2 : strokeWidth
|
|
459
672
|
}
|
|
460
673
|
),
|
|
461
674
|
/* @__PURE__ */ jsx(
|
|
@@ -509,10 +722,17 @@ var Textarea = forwardRef(
|
|
|
509
722
|
rows = 4,
|
|
510
723
|
onFocus,
|
|
511
724
|
onBlur,
|
|
725
|
+
animate,
|
|
512
726
|
...rest
|
|
513
727
|
}, ref) {
|
|
514
728
|
const [focused, setFocused] = useState(false);
|
|
729
|
+
const fieldRef = useRef(null);
|
|
730
|
+
const shouldAnimate = useAnimate(animate);
|
|
731
|
+
const resolvedSeed = useResolvedSeed(seed);
|
|
732
|
+
const focusSeed = deriveSeed(resolvedSeed, "focus");
|
|
733
|
+
const sketchSeed = shouldAnimate && focused ? focusSeed : resolvedSeed;
|
|
515
734
|
const ink = sketchColor ?? SKETCH_COLORS.ink;
|
|
735
|
+
useDrawIn(fieldRef, DRAW_IN_DURATION_MS, shouldAnimate, sketchSeed);
|
|
516
736
|
return /* @__PURE__ */ jsxs(
|
|
517
737
|
"label",
|
|
518
738
|
{
|
|
@@ -536,17 +756,17 @@ var Textarea = forwardRef(
|
|
|
536
756
|
children: label
|
|
537
757
|
}
|
|
538
758
|
) : null,
|
|
539
|
-
/* @__PURE__ */ jsxs("span", { style: { position: "relative", display: "block" }, children: [
|
|
759
|
+
/* @__PURE__ */ jsxs("span", { ref: fieldRef, style: { position: "relative", display: "block" }, children: [
|
|
540
760
|
/* @__PURE__ */ jsx(
|
|
541
761
|
RoughSvg,
|
|
542
762
|
{
|
|
543
763
|
shape: "rectangle",
|
|
544
764
|
roughness,
|
|
545
|
-
seed,
|
|
765
|
+
seed: sketchSeed,
|
|
546
766
|
sketchColor: focused ? SKETCH_COLORS.accent : ink,
|
|
547
767
|
bowing,
|
|
548
768
|
fillStyle,
|
|
549
|
-
strokeWidth: focused ? (strokeWidth ?? 1.75) + 0.35 : strokeWidth
|
|
769
|
+
strokeWidth: focused && !shouldAnimate ? (strokeWidth ?? 1.75) + 0.35 : focused ? (strokeWidth ?? 1.75) + 0.2 : strokeWidth
|
|
550
770
|
}
|
|
551
771
|
),
|
|
552
772
|
/* @__PURE__ */ jsx(
|
|
@@ -591,6 +811,36 @@ var Textarea = forwardRef(
|
|
|
591
811
|
);
|
|
592
812
|
var BOX = 20;
|
|
593
813
|
var CHECK_PATH = "M 4.5 10.5 L 8.5 14.5 L 15.5 5.5";
|
|
814
|
+
function CheckMark({
|
|
815
|
+
roughness,
|
|
816
|
+
seed,
|
|
817
|
+
bowing,
|
|
818
|
+
strokeWidth,
|
|
819
|
+
shouldAnimate
|
|
820
|
+
}) {
|
|
821
|
+
const ref = useRef(null);
|
|
822
|
+
useDrawIn(ref, DRAW_IN_MARK_MS, shouldAnimate);
|
|
823
|
+
return /* @__PURE__ */ jsx(
|
|
824
|
+
"span",
|
|
825
|
+
{
|
|
826
|
+
ref,
|
|
827
|
+
style: { position: "absolute", inset: 0, pointerEvents: "none" },
|
|
828
|
+
children: /* @__PURE__ */ jsx(
|
|
829
|
+
RoughSvg,
|
|
830
|
+
{
|
|
831
|
+
shape: "path",
|
|
832
|
+
path: CHECK_PATH,
|
|
833
|
+
roughness: (roughness ?? 1.5) * 0.7,
|
|
834
|
+
seed,
|
|
835
|
+
sketchColor: SKETCH_COLORS.accent,
|
|
836
|
+
bowing,
|
|
837
|
+
strokeWidth: (strokeWidth ?? 1.6) + 0.4,
|
|
838
|
+
inset: 0
|
|
839
|
+
}
|
|
840
|
+
)
|
|
841
|
+
}
|
|
842
|
+
);
|
|
843
|
+
}
|
|
594
844
|
var Checkbox = forwardRef(
|
|
595
845
|
function Checkbox2({
|
|
596
846
|
className,
|
|
@@ -606,11 +856,15 @@ var Checkbox = forwardRef(
|
|
|
606
856
|
defaultChecked,
|
|
607
857
|
onCheckedChange,
|
|
608
858
|
id,
|
|
859
|
+
animate,
|
|
609
860
|
...rest
|
|
610
861
|
}, ref) {
|
|
611
862
|
const ink = sketchColor ?? SKETCH_COLORS.ink;
|
|
612
863
|
const generatedId = useId();
|
|
613
864
|
const inputId = id ?? generatedId;
|
|
865
|
+
const boxRef = useRef(null);
|
|
866
|
+
const shouldAnimate = useAnimate(animate);
|
|
867
|
+
useDrawIn(boxRef, DRAW_IN_DURATION_MS, shouldAnimate);
|
|
614
868
|
return /* @__PURE__ */ jsxs(
|
|
615
869
|
"span",
|
|
616
870
|
{
|
|
@@ -645,16 +899,23 @@ var Checkbox = forwardRef(
|
|
|
645
899
|
...rest,
|
|
646
900
|
children: [
|
|
647
901
|
/* @__PURE__ */ jsx(
|
|
648
|
-
|
|
902
|
+
"span",
|
|
649
903
|
{
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
904
|
+
ref: boxRef,
|
|
905
|
+
style: { position: "absolute", inset: 0, pointerEvents: "none" },
|
|
906
|
+
children: /* @__PURE__ */ jsx(
|
|
907
|
+
RoughSvg,
|
|
908
|
+
{
|
|
909
|
+
shape: "rectangle",
|
|
910
|
+
roughness,
|
|
911
|
+
seed,
|
|
912
|
+
sketchColor: ink,
|
|
913
|
+
bowing,
|
|
914
|
+
fillStyle,
|
|
915
|
+
strokeWidth: strokeWidth ?? 1.6,
|
|
916
|
+
inset: 1.5
|
|
917
|
+
}
|
|
918
|
+
)
|
|
658
919
|
}
|
|
659
920
|
),
|
|
660
921
|
/* @__PURE__ */ jsx(
|
|
@@ -666,16 +927,13 @@ var Checkbox = forwardRef(
|
|
|
666
927
|
display: "block"
|
|
667
928
|
},
|
|
668
929
|
children: /* @__PURE__ */ jsx(
|
|
669
|
-
|
|
930
|
+
CheckMark,
|
|
670
931
|
{
|
|
671
|
-
|
|
672
|
-
path: CHECK_PATH,
|
|
673
|
-
roughness: (roughness ?? 1.5) * 0.7,
|
|
932
|
+
roughness,
|
|
674
933
|
seed,
|
|
675
|
-
sketchColor: SKETCH_COLORS.accent,
|
|
676
934
|
bowing,
|
|
677
|
-
strokeWidth
|
|
678
|
-
|
|
935
|
+
strokeWidth,
|
|
936
|
+
shouldAnimate
|
|
679
937
|
}
|
|
680
938
|
)
|
|
681
939
|
}
|
|
@@ -716,6 +974,53 @@ var RadioGroup = forwardRef(
|
|
|
716
974
|
}
|
|
717
975
|
);
|
|
718
976
|
var SIZE = 20;
|
|
977
|
+
function RadioDot({
|
|
978
|
+
roughness,
|
|
979
|
+
seed,
|
|
980
|
+
bowing,
|
|
981
|
+
shouldAnimate
|
|
982
|
+
}) {
|
|
983
|
+
const ref = useRef(null);
|
|
984
|
+
useDrawIn(ref, DRAW_IN_MARK_MS, shouldAnimate);
|
|
985
|
+
useLayoutEffect(() => {
|
|
986
|
+
const node = ref.current;
|
|
987
|
+
if (!node || !shouldAnimate) return;
|
|
988
|
+
const animation = node.animate(
|
|
989
|
+
[
|
|
990
|
+
{ transform: "scale(0.35)", opacity: 0 },
|
|
991
|
+
{ transform: "scale(1)", opacity: 1 }
|
|
992
|
+
],
|
|
993
|
+
{ duration: 180, easing: "ease-out", fill: "forwards" }
|
|
994
|
+
);
|
|
995
|
+
return () => animation.cancel();
|
|
996
|
+
}, [shouldAnimate]);
|
|
997
|
+
return /* @__PURE__ */ jsx(
|
|
998
|
+
"span",
|
|
999
|
+
{
|
|
1000
|
+
ref,
|
|
1001
|
+
style: {
|
|
1002
|
+
position: "absolute",
|
|
1003
|
+
inset: 0,
|
|
1004
|
+
pointerEvents: "none",
|
|
1005
|
+
display: "block"
|
|
1006
|
+
},
|
|
1007
|
+
children: /* @__PURE__ */ jsx(
|
|
1008
|
+
RoughSvg,
|
|
1009
|
+
{
|
|
1010
|
+
shape: "ellipse",
|
|
1011
|
+
roughness: (roughness ?? 1.5) + 0.2,
|
|
1012
|
+
seed,
|
|
1013
|
+
sketchColor: SKETCH_COLORS.accent,
|
|
1014
|
+
fill: SKETCH_COLORS.accent,
|
|
1015
|
+
fillStyle: "solid",
|
|
1016
|
+
bowing,
|
|
1017
|
+
strokeWidth: 1,
|
|
1018
|
+
inset: 6
|
|
1019
|
+
}
|
|
1020
|
+
)
|
|
1021
|
+
}
|
|
1022
|
+
);
|
|
1023
|
+
}
|
|
719
1024
|
var Radio = forwardRef(function Radio2({
|
|
720
1025
|
className,
|
|
721
1026
|
style,
|
|
@@ -727,11 +1032,15 @@ var Radio = forwardRef(function Radio2({
|
|
|
727
1032
|
fillStyle,
|
|
728
1033
|
strokeWidth,
|
|
729
1034
|
id,
|
|
1035
|
+
animate,
|
|
730
1036
|
...rest
|
|
731
1037
|
}, ref) {
|
|
732
1038
|
const ink = sketchColor ?? SKETCH_COLORS.ink;
|
|
733
1039
|
const generatedId = useId();
|
|
734
1040
|
const inputId = id ?? generatedId;
|
|
1041
|
+
const ringRef = useRef(null);
|
|
1042
|
+
const shouldAnimate = useAnimate(animate);
|
|
1043
|
+
useDrawIn(ringRef, DRAW_IN_DURATION_MS, shouldAnimate);
|
|
735
1044
|
return /* @__PURE__ */ jsxs(
|
|
736
1045
|
"span",
|
|
737
1046
|
{
|
|
@@ -764,16 +1073,23 @@ var Radio = forwardRef(function Radio2({
|
|
|
764
1073
|
...rest,
|
|
765
1074
|
children: [
|
|
766
1075
|
/* @__PURE__ */ jsx(
|
|
767
|
-
|
|
1076
|
+
"span",
|
|
768
1077
|
{
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
|
|
774
|
-
|
|
775
|
-
|
|
776
|
-
|
|
1078
|
+
ref: ringRef,
|
|
1079
|
+
style: { position: "absolute", inset: 0, pointerEvents: "none" },
|
|
1080
|
+
children: /* @__PURE__ */ jsx(
|
|
1081
|
+
RoughSvg,
|
|
1082
|
+
{
|
|
1083
|
+
shape: "ellipse",
|
|
1084
|
+
roughness,
|
|
1085
|
+
seed,
|
|
1086
|
+
sketchColor: ink,
|
|
1087
|
+
bowing,
|
|
1088
|
+
fillStyle,
|
|
1089
|
+
strokeWidth: strokeWidth ?? 1.6,
|
|
1090
|
+
inset: 1.5
|
|
1091
|
+
}
|
|
1092
|
+
)
|
|
777
1093
|
}
|
|
778
1094
|
),
|
|
779
1095
|
/* @__PURE__ */ jsx(
|
|
@@ -785,17 +1101,12 @@ var Radio = forwardRef(function Radio2({
|
|
|
785
1101
|
display: "block"
|
|
786
1102
|
},
|
|
787
1103
|
children: /* @__PURE__ */ jsx(
|
|
788
|
-
|
|
1104
|
+
RadioDot,
|
|
789
1105
|
{
|
|
790
|
-
|
|
791
|
-
roughness: (roughness ?? 1.5) + 0.2,
|
|
1106
|
+
roughness,
|
|
792
1107
|
seed,
|
|
793
|
-
sketchColor: SKETCH_COLORS.accent,
|
|
794
|
-
fill: SKETCH_COLORS.accent,
|
|
795
|
-
fillStyle: "solid",
|
|
796
1108
|
bowing,
|
|
797
|
-
|
|
798
|
-
inset: 6
|
|
1109
|
+
shouldAnimate
|
|
799
1110
|
}
|
|
800
1111
|
)
|
|
801
1112
|
}
|
|
@@ -829,6 +1140,7 @@ var Card = forwardRef(function Card2({
|
|
|
829
1140
|
bowing,
|
|
830
1141
|
fillStyle,
|
|
831
1142
|
strokeWidth,
|
|
1143
|
+
animate,
|
|
832
1144
|
...rest
|
|
833
1145
|
}, ref) {
|
|
834
1146
|
const boxProps = {
|
|
@@ -839,7 +1151,8 @@ var Card = forwardRef(function Card2({
|
|
|
839
1151
|
sketchColor: sketchColor ?? SKETCH_COLORS.ink,
|
|
840
1152
|
bowing,
|
|
841
1153
|
fillStyle,
|
|
842
|
-
strokeWidth
|
|
1154
|
+
strokeWidth,
|
|
1155
|
+
animate
|
|
843
1156
|
};
|
|
844
1157
|
return /* @__PURE__ */ jsxs(
|
|
845
1158
|
SketchBox,
|
|
@@ -879,6 +1192,7 @@ var Badge = forwardRef(function Badge2({
|
|
|
879
1192
|
bowing,
|
|
880
1193
|
fillStyle,
|
|
881
1194
|
strokeWidth,
|
|
1195
|
+
animate,
|
|
882
1196
|
...rest
|
|
883
1197
|
}, ref) {
|
|
884
1198
|
const ink = variant === "accent" ? sketchColor ?? SKETCH_COLORS.accent : sketchColor ?? SKETCH_COLORS.ink;
|
|
@@ -906,6 +1220,7 @@ var Badge = forwardRef(function Badge2({
|
|
|
906
1220
|
sketchColor: ink,
|
|
907
1221
|
bowing,
|
|
908
1222
|
strokeWidth: strokeWidth ?? 1.4,
|
|
1223
|
+
animate,
|
|
909
1224
|
...rest,
|
|
910
1225
|
children: /* @__PURE__ */ jsx("span", { ref, children })
|
|
911
1226
|
}
|
|
@@ -936,6 +1251,7 @@ var Alert = forwardRef(function Alert2({
|
|
|
936
1251
|
fillStyle,
|
|
937
1252
|
strokeWidth,
|
|
938
1253
|
role = "status",
|
|
1254
|
+
animate,
|
|
939
1255
|
...rest
|
|
940
1256
|
}, ref) {
|
|
941
1257
|
const color = sketchColor ?? VARIANT_COLOR[variant];
|
|
@@ -954,6 +1270,8 @@ var Alert = forwardRef(function Alert2({
|
|
|
954
1270
|
fillStyle: fillStyle ?? "hachure",
|
|
955
1271
|
fill: VARIANT_FILL[variant],
|
|
956
1272
|
strokeWidth,
|
|
1273
|
+
animate,
|
|
1274
|
+
drawInDuration: DRAW_IN_ALERT_MS,
|
|
957
1275
|
...rest,
|
|
958
1276
|
children: [
|
|
959
1277
|
title ? /* @__PURE__ */ jsx(
|
|
@@ -986,15 +1304,27 @@ function Modal({
|
|
|
986
1304
|
sketchColor,
|
|
987
1305
|
bowing,
|
|
988
1306
|
fillStyle,
|
|
989
|
-
strokeWidth
|
|
1307
|
+
strokeWidth,
|
|
1308
|
+
animate
|
|
990
1309
|
}) {
|
|
991
1310
|
const ink = sketchColor ?? SKETCH_COLORS.ink;
|
|
992
|
-
|
|
1311
|
+
const [uncontrolled, setUncontrolled] = useState(defaultOpen === true);
|
|
1312
|
+
const isOpen = open ?? uncontrolled;
|
|
1313
|
+
const shouldAnimate = useAnimate(animate);
|
|
1314
|
+
function handleOpenChange(next) {
|
|
1315
|
+
setUncontrolled(next);
|
|
1316
|
+
onOpenChange?.(next);
|
|
1317
|
+
}
|
|
1318
|
+
return /* @__PURE__ */ jsxs(Dialog.Root, { open: isOpen, onOpenChange: handleOpenChange, children: [
|
|
993
1319
|
trigger ? /* @__PURE__ */ jsx(Dialog.Trigger, { asChild: true, children: trigger }) : null,
|
|
994
|
-
/* @__PURE__ */ jsxs(Dialog.Portal, { children: [
|
|
995
|
-
/* @__PURE__ */ jsx(
|
|
996
|
-
|
|
1320
|
+
/* @__PURE__ */ jsx(AnimatePresence, { children: isOpen ? /* @__PURE__ */ jsxs(Dialog.Portal, { forceMount: true, children: [
|
|
1321
|
+
/* @__PURE__ */ jsx(Dialog.Overlay, { asChild: true, forceMount: true, children: /* @__PURE__ */ jsx(
|
|
1322
|
+
motion.div,
|
|
997
1323
|
{
|
|
1324
|
+
initial: shouldAnimate ? { opacity: 0 } : false,
|
|
1325
|
+
animate: { opacity: 1 },
|
|
1326
|
+
exit: shouldAnimate ? { opacity: 0 } : void 0,
|
|
1327
|
+
transition: shouldAnimate ? { duration: 0.2, ease: "easeOut" } : { duration: 0 },
|
|
998
1328
|
style: {
|
|
999
1329
|
position: "fixed",
|
|
1000
1330
|
inset: 0,
|
|
@@ -1002,92 +1332,121 @@ function Modal({
|
|
|
1002
1332
|
zIndex: 70
|
|
1003
1333
|
}
|
|
1004
1334
|
}
|
|
1005
|
-
),
|
|
1335
|
+
) }),
|
|
1006
1336
|
/* @__PURE__ */ jsx(
|
|
1007
|
-
|
|
1337
|
+
"div",
|
|
1008
1338
|
{
|
|
1009
|
-
className: cn(className),
|
|
1010
1339
|
style: {
|
|
1011
1340
|
position: "fixed",
|
|
1012
|
-
|
|
1013
|
-
top: "50%",
|
|
1014
|
-
transform: "translate(-50%, -50%)",
|
|
1341
|
+
inset: 0,
|
|
1015
1342
|
zIndex: 80,
|
|
1016
|
-
|
|
1017
|
-
|
|
1343
|
+
display: "flex",
|
|
1344
|
+
alignItems: "center",
|
|
1345
|
+
justifyContent: "center",
|
|
1346
|
+
pointerEvents: "none",
|
|
1347
|
+
padding: 16
|
|
1018
1348
|
},
|
|
1019
|
-
children: /* @__PURE__ */
|
|
1020
|
-
|
|
1349
|
+
children: /* @__PURE__ */ jsx(Dialog.Content, { asChild: true, forceMount: true, children: /* @__PURE__ */ jsx(
|
|
1350
|
+
motion.div,
|
|
1021
1351
|
{
|
|
1022
|
-
|
|
1023
|
-
|
|
1024
|
-
|
|
1025
|
-
|
|
1026
|
-
|
|
1027
|
-
|
|
1028
|
-
|
|
1029
|
-
|
|
1030
|
-
|
|
1031
|
-
|
|
1032
|
-
|
|
1033
|
-
|
|
1034
|
-
|
|
1035
|
-
|
|
1036
|
-
|
|
1037
|
-
|
|
1038
|
-
|
|
1039
|
-
|
|
1040
|
-
|
|
1041
|
-
|
|
1042
|
-
|
|
1043
|
-
|
|
1044
|
-
|
|
1045
|
-
|
|
1046
|
-
|
|
1047
|
-
|
|
1048
|
-
|
|
1049
|
-
|
|
1050
|
-
|
|
1051
|
-
|
|
1052
|
-
|
|
1053
|
-
|
|
1054
|
-
|
|
1055
|
-
|
|
1056
|
-
|
|
1057
|
-
|
|
1058
|
-
|
|
1059
|
-
|
|
1060
|
-
|
|
1061
|
-
|
|
1062
|
-
|
|
1063
|
-
|
|
1064
|
-
|
|
1065
|
-
|
|
1066
|
-
|
|
1067
|
-
|
|
1068
|
-
|
|
1069
|
-
|
|
1070
|
-
|
|
1071
|
-
|
|
1072
|
-
|
|
1073
|
-
|
|
1074
|
-
|
|
1075
|
-
|
|
1076
|
-
|
|
1077
|
-
|
|
1078
|
-
|
|
1079
|
-
|
|
1080
|
-
|
|
1081
|
-
|
|
1082
|
-
|
|
1083
|
-
|
|
1084
|
-
|
|
1085
|
-
|
|
1352
|
+
className: cn(className),
|
|
1353
|
+
initial: shouldAnimate ? { opacity: 0, scale: 0.96, y: 10 } : false,
|
|
1354
|
+
animate: { opacity: 1, scale: 1, y: 0 },
|
|
1355
|
+
exit: shouldAnimate ? { opacity: 0, scale: 0.96, y: 8 } : void 0,
|
|
1356
|
+
transition: shouldAnimate ? { duration: 0.22, ease: "easeOut" } : { duration: 0 },
|
|
1357
|
+
style: {
|
|
1358
|
+
width: "min(480px, calc(100vw - 32px))",
|
|
1359
|
+
outline: "none",
|
|
1360
|
+
pointerEvents: "auto"
|
|
1361
|
+
},
|
|
1362
|
+
children: /* @__PURE__ */ jsxs(
|
|
1363
|
+
SketchBox,
|
|
1364
|
+
{
|
|
1365
|
+
roughness,
|
|
1366
|
+
seed,
|
|
1367
|
+
sketchColor: ink,
|
|
1368
|
+
bowing,
|
|
1369
|
+
fillStyle: fillStyle ?? "solid",
|
|
1370
|
+
fill: "#f7f6f2",
|
|
1371
|
+
strokeWidth: strokeWidth ?? 2,
|
|
1372
|
+
shadow: true,
|
|
1373
|
+
animate,
|
|
1374
|
+
contentStyle: { padding: "20px 22px 18px" },
|
|
1375
|
+
children: [
|
|
1376
|
+
/* @__PURE__ */ jsxs(
|
|
1377
|
+
"div",
|
|
1378
|
+
{
|
|
1379
|
+
style: {
|
|
1380
|
+
display: "flex",
|
|
1381
|
+
alignItems: "flex-start",
|
|
1382
|
+
justifyContent: "space-between",
|
|
1383
|
+
gap: 12,
|
|
1384
|
+
marginBottom: title ? 10 : 0
|
|
1385
|
+
},
|
|
1386
|
+
children: [
|
|
1387
|
+
title ? /* @__PURE__ */ jsx(
|
|
1388
|
+
Dialog.Title,
|
|
1389
|
+
{
|
|
1390
|
+
style: {
|
|
1391
|
+
margin: 0,
|
|
1392
|
+
fontSize: 18,
|
|
1393
|
+
fontWeight: doodleUiFontWeight(700),
|
|
1394
|
+
fontFamily: doodleUiFontFamily,
|
|
1395
|
+
color: ink
|
|
1396
|
+
},
|
|
1397
|
+
children: title
|
|
1398
|
+
}
|
|
1399
|
+
) : /* @__PURE__ */ jsx(
|
|
1400
|
+
Dialog.Title,
|
|
1401
|
+
{
|
|
1402
|
+
style: {
|
|
1403
|
+
position: "absolute",
|
|
1404
|
+
width: 1,
|
|
1405
|
+
height: 1,
|
|
1406
|
+
overflow: "hidden",
|
|
1407
|
+
clip: "rect(0 0 0 0)"
|
|
1408
|
+
},
|
|
1409
|
+
children: "Dialog"
|
|
1410
|
+
}
|
|
1411
|
+
),
|
|
1412
|
+
/* @__PURE__ */ jsx(Dialog.Close, { asChild: true, children: /* @__PURE__ */ jsx(
|
|
1413
|
+
Button,
|
|
1414
|
+
{
|
|
1415
|
+
variant: "ghost",
|
|
1416
|
+
size: "sm",
|
|
1417
|
+
roughness,
|
|
1418
|
+
seed,
|
|
1419
|
+
sketchColor: ink,
|
|
1420
|
+
animate,
|
|
1421
|
+
"aria-label": "Close",
|
|
1422
|
+
children: "Close"
|
|
1423
|
+
}
|
|
1424
|
+
) })
|
|
1425
|
+
]
|
|
1426
|
+
}
|
|
1427
|
+
),
|
|
1428
|
+
description ? /* @__PURE__ */ jsx(
|
|
1429
|
+
Dialog.Description,
|
|
1430
|
+
{
|
|
1431
|
+
style: {
|
|
1432
|
+
margin: "0 0 14px",
|
|
1433
|
+
fontSize: 14,
|
|
1434
|
+
lineHeight: 1.5,
|
|
1435
|
+
color: ink,
|
|
1436
|
+
opacity: 0.8
|
|
1437
|
+
},
|
|
1438
|
+
children: description
|
|
1439
|
+
}
|
|
1440
|
+
) : null,
|
|
1441
|
+
/* @__PURE__ */ jsx("div", { children })
|
|
1442
|
+
]
|
|
1443
|
+
}
|
|
1444
|
+
)
|
|
1086
1445
|
}
|
|
1087
|
-
)
|
|
1446
|
+
) })
|
|
1088
1447
|
}
|
|
1089
1448
|
)
|
|
1090
|
-
] })
|
|
1449
|
+
] }) : null })
|
|
1091
1450
|
] });
|
|
1092
1451
|
}
|
|
1093
1452
|
var ModalRoot = Dialog.Root;
|
|
@@ -1105,13 +1464,20 @@ var Divider = forwardRef(
|
|
|
1105
1464
|
sketchColor,
|
|
1106
1465
|
bowing,
|
|
1107
1466
|
strokeWidth,
|
|
1467
|
+
animate,
|
|
1108
1468
|
...rest
|
|
1109
1469
|
}, ref) {
|
|
1470
|
+
const rootRef = useRef(null);
|
|
1471
|
+
const shouldAnimate = useAnimate(animate);
|
|
1110
1472
|
const horizontal = orientation === "horizontal";
|
|
1473
|
+
useDrawIn(rootRef, DRAW_IN_DURATION_MS, shouldAnimate);
|
|
1111
1474
|
return /* @__PURE__ */ jsx(
|
|
1112
1475
|
"div",
|
|
1113
1476
|
{
|
|
1114
|
-
ref
|
|
1477
|
+
ref: (node) => {
|
|
1478
|
+
rootRef.current = node;
|
|
1479
|
+
assignRef(ref, node);
|
|
1480
|
+
},
|
|
1115
1481
|
role: "separator",
|
|
1116
1482
|
"aria-orientation": orientation,
|
|
1117
1483
|
className: cn(className),
|
|
@@ -1151,15 +1517,27 @@ var Progress = forwardRef(
|
|
|
1151
1517
|
bowing,
|
|
1152
1518
|
fillStyle,
|
|
1153
1519
|
strokeWidth,
|
|
1520
|
+
animate,
|
|
1154
1521
|
...rest
|
|
1155
1522
|
}, ref) {
|
|
1523
|
+
const rootRef = useRef(null);
|
|
1524
|
+
const trackRef = useRef(null);
|
|
1156
1525
|
const ink = sketchColor ?? SKETCH_COLORS.accent;
|
|
1157
1526
|
const clamped = Math.min(max, Math.max(0, value));
|
|
1158
1527
|
const percent = max === 0 ? 0 : clamped / max * 100;
|
|
1528
|
+
const shouldAnimate = useAnimate(animate);
|
|
1529
|
+
const displayed = useTweenNumber(percent, shouldAnimate, 420);
|
|
1530
|
+
const resolvedSeed = useResolvedSeed(seed);
|
|
1531
|
+
const fillSeed = shouldAnimate ? deriveSeed(resolvedSeed, `fill-${Math.round(displayed / 6)}`) : resolvedSeed;
|
|
1532
|
+
const fillRoughness = (roughness ?? 1.5) + 0.4 + displayed / 100 * 0.7;
|
|
1533
|
+
useDrawIn(trackRef, DRAW_IN_DURATION_MS, shouldAnimate);
|
|
1159
1534
|
return /* @__PURE__ */ jsxs(
|
|
1160
1535
|
"div",
|
|
1161
1536
|
{
|
|
1162
|
-
ref
|
|
1537
|
+
ref: (node) => {
|
|
1538
|
+
rootRef.current = node;
|
|
1539
|
+
assignRef(ref, node);
|
|
1540
|
+
},
|
|
1163
1541
|
role: "progressbar",
|
|
1164
1542
|
"aria-valuemin": 0,
|
|
1165
1543
|
"aria-valuemax": max,
|
|
@@ -1174,18 +1552,25 @@ var Progress = forwardRef(
|
|
|
1174
1552
|
...rest,
|
|
1175
1553
|
children: [
|
|
1176
1554
|
/* @__PURE__ */ jsx(
|
|
1177
|
-
|
|
1555
|
+
"span",
|
|
1178
1556
|
{
|
|
1179
|
-
|
|
1180
|
-
|
|
1181
|
-
|
|
1182
|
-
|
|
1183
|
-
|
|
1184
|
-
|
|
1185
|
-
|
|
1557
|
+
ref: trackRef,
|
|
1558
|
+
style: { position: "absolute", inset: 0, pointerEvents: "none" },
|
|
1559
|
+
children: /* @__PURE__ */ jsx(
|
|
1560
|
+
RoughSvg,
|
|
1561
|
+
{
|
|
1562
|
+
shape: "rectangle",
|
|
1563
|
+
roughness,
|
|
1564
|
+
seed: resolvedSeed,
|
|
1565
|
+
sketchColor: SKETCH_COLORS.ink,
|
|
1566
|
+
bowing,
|
|
1567
|
+
strokeWidth: strokeWidth ?? 1.5,
|
|
1568
|
+
inset: 2
|
|
1569
|
+
}
|
|
1570
|
+
)
|
|
1186
1571
|
}
|
|
1187
1572
|
),
|
|
1188
|
-
|
|
1573
|
+
displayed > 0 ? /* @__PURE__ */ jsx(
|
|
1189
1574
|
"div",
|
|
1190
1575
|
{
|
|
1191
1576
|
style: {
|
|
@@ -1193,16 +1578,16 @@ var Progress = forwardRef(
|
|
|
1193
1578
|
left: 5,
|
|
1194
1579
|
top: 4,
|
|
1195
1580
|
bottom: 4,
|
|
1196
|
-
width: `calc(${
|
|
1197
|
-
minWidth:
|
|
1581
|
+
width: `calc(${displayed}% - 10px)`,
|
|
1582
|
+
minWidth: displayed > 0 ? 8 : 0,
|
|
1198
1583
|
overflow: "hidden"
|
|
1199
1584
|
},
|
|
1200
1585
|
children: /* @__PURE__ */ jsx(
|
|
1201
1586
|
RoughSvg,
|
|
1202
1587
|
{
|
|
1203
1588
|
shape: "rectangle",
|
|
1204
|
-
roughness:
|
|
1205
|
-
seed,
|
|
1589
|
+
roughness: fillRoughness,
|
|
1590
|
+
seed: fillSeed,
|
|
1206
1591
|
sketchColor: ink,
|
|
1207
1592
|
fill: ink,
|
|
1208
1593
|
fillStyle: fillStyle ?? "hachure",
|
|
@@ -1230,7 +1615,8 @@ function Tooltip({
|
|
|
1230
1615
|
sketchColor,
|
|
1231
1616
|
bowing,
|
|
1232
1617
|
fillStyle,
|
|
1233
|
-
strokeWidth
|
|
1618
|
+
strokeWidth,
|
|
1619
|
+
animate
|
|
1234
1620
|
}) {
|
|
1235
1621
|
const ink = sketchColor ?? SKETCH_COLORS.ink;
|
|
1236
1622
|
return /* @__PURE__ */ jsxs(TooltipPrimitive.Root, { delayDuration, children: [
|
|
@@ -1252,6 +1638,8 @@ function Tooltip({
|
|
|
1252
1638
|
fillStyle: fillStyle ?? "solid",
|
|
1253
1639
|
fill: "#f7f6f2",
|
|
1254
1640
|
strokeWidth: strokeWidth ?? 1.4,
|
|
1641
|
+
animate,
|
|
1642
|
+
drawInDuration: DRAW_IN_TOOLTIP_MS,
|
|
1255
1643
|
contentStyle: {
|
|
1256
1644
|
padding: "6px 10px",
|
|
1257
1645
|
fontSize: 13,
|
|
@@ -1293,6 +1681,7 @@ function Select({
|
|
|
1293
1681
|
value,
|
|
1294
1682
|
defaultValue,
|
|
1295
1683
|
onValueChange,
|
|
1684
|
+
animate,
|
|
1296
1685
|
"aria-label": ariaLabel,
|
|
1297
1686
|
...rest
|
|
1298
1687
|
}) {
|
|
@@ -1315,7 +1704,8 @@ function Select({
|
|
|
1315
1704
|
ink,
|
|
1316
1705
|
selectedValue,
|
|
1317
1706
|
selectedLabel,
|
|
1318
|
-
placeholder
|
|
1707
|
+
placeholder,
|
|
1708
|
+
animate
|
|
1319
1709
|
},
|
|
1320
1710
|
children: /* @__PURE__ */ jsxs(
|
|
1321
1711
|
SelectPrimitive.Root,
|
|
@@ -1356,10 +1746,16 @@ var SelectTrigger = forwardRef(
|
|
|
1356
1746
|
function SelectTrigger2({ className, style, placeholder, children, ...rest }, ref) {
|
|
1357
1747
|
const sketch = useSelectSketch();
|
|
1358
1748
|
const [openish, setOpenish] = useState(false);
|
|
1749
|
+
const rootRef = useRef(null);
|
|
1750
|
+
const shouldAnimate = useAnimate(sketch.animate);
|
|
1751
|
+
useDrawIn(rootRef, DRAW_IN_DURATION_MS, shouldAnimate);
|
|
1359
1752
|
return /* @__PURE__ */ jsxs(
|
|
1360
1753
|
SelectPrimitive.Trigger,
|
|
1361
1754
|
{
|
|
1362
|
-
ref
|
|
1755
|
+
ref: (node) => {
|
|
1756
|
+
rootRef.current = node;
|
|
1757
|
+
assignRef(ref, node);
|
|
1758
|
+
},
|
|
1363
1759
|
className: cn(className),
|
|
1364
1760
|
onPointerDown: () => setOpenish(true),
|
|
1365
1761
|
onBlur: () => setOpenish(false),
|
|
@@ -1468,6 +1864,7 @@ var SelectContent = forwardRef(
|
|
|
1468
1864
|
fillStyle: sketch.fillStyle ?? "solid",
|
|
1469
1865
|
fill: "#f7f6f2",
|
|
1470
1866
|
strokeWidth: sketch.strokeWidth ?? 1.5,
|
|
1867
|
+
animate: sketch.animate,
|
|
1471
1868
|
contentStyle: { padding: "6px 4px" },
|
|
1472
1869
|
children: /* @__PURE__ */ jsx(SelectPrimitive.Viewport, { children })
|
|
1473
1870
|
}
|
|
@@ -1558,12 +1955,17 @@ var Switch = forwardRef(
|
|
|
1558
1955
|
defaultChecked,
|
|
1559
1956
|
onCheckedChange,
|
|
1560
1957
|
id,
|
|
1958
|
+
animate,
|
|
1561
1959
|
...rest
|
|
1562
1960
|
}, ref) {
|
|
1563
1961
|
const [uncontrolled, setUncontrolled] = useState(defaultChecked === true);
|
|
1564
1962
|
const isOn = checked ?? uncontrolled;
|
|
1565
1963
|
const ink = sketchColor ?? SKETCH_COLORS.ink;
|
|
1566
1964
|
const resolvedSeed = useResolvedSeed(seed);
|
|
1965
|
+
const shouldAnimate = useAnimate(animate);
|
|
1966
|
+
const trackRef = useRef(null);
|
|
1967
|
+
const trackSeed = shouldAnimate ? deriveSeed(resolvedSeed, isOn ? "on" : "off") : resolvedSeed;
|
|
1968
|
+
useDrawIn(trackRef, DRAW_IN_DURATION_MS, shouldAnimate, trackSeed);
|
|
1567
1969
|
return /* @__PURE__ */ jsxs(
|
|
1568
1970
|
"span",
|
|
1569
1971
|
{
|
|
@@ -1602,22 +2004,32 @@ var Switch = forwardRef(
|
|
|
1602
2004
|
...rest,
|
|
1603
2005
|
children: [
|
|
1604
2006
|
/* @__PURE__ */ jsx(
|
|
1605
|
-
|
|
2007
|
+
"span",
|
|
1606
2008
|
{
|
|
1607
|
-
|
|
1608
|
-
|
|
1609
|
-
|
|
1610
|
-
|
|
1611
|
-
|
|
1612
|
-
|
|
1613
|
-
|
|
1614
|
-
|
|
1615
|
-
|
|
2009
|
+
ref: trackRef,
|
|
2010
|
+
style: { position: "absolute", inset: 0, pointerEvents: "none" },
|
|
2011
|
+
children: /* @__PURE__ */ jsx(
|
|
2012
|
+
RoughSvg,
|
|
2013
|
+
{
|
|
2014
|
+
shape: "rectangle",
|
|
2015
|
+
roughness,
|
|
2016
|
+
seed: trackSeed,
|
|
2017
|
+
sketchColor: isOn ? SKETCH_COLORS.accent : ink,
|
|
2018
|
+
bowing: bowing ?? 1.4,
|
|
2019
|
+
fillStyle: fillStyle ?? (isOn ? "hachure" : void 0),
|
|
2020
|
+
fill: isOn ? SKETCH_COLORS.accentFill : void 0,
|
|
2021
|
+
strokeWidth: strokeWidth ?? 1.6,
|
|
2022
|
+
inset: 1.5
|
|
2023
|
+
}
|
|
2024
|
+
)
|
|
1616
2025
|
}
|
|
1617
2026
|
),
|
|
1618
|
-
/* @__PURE__ */ jsx(
|
|
1619
|
-
|
|
2027
|
+
/* @__PURE__ */ jsx(SwitchPrimitive.Thumb, { asChild: true, children: /* @__PURE__ */ jsx(
|
|
2028
|
+
motion.span,
|
|
1620
2029
|
{
|
|
2030
|
+
initial: false,
|
|
2031
|
+
animate: { x: isOn ? THUMB_ON : THUMB_OFF },
|
|
2032
|
+
transition: shouldAnimate ? { type: "spring", stiffness: 420, damping: 30 } : { duration: 0 },
|
|
1621
2033
|
style: {
|
|
1622
2034
|
position: "absolute",
|
|
1623
2035
|
top: (TRACK_H - THUMB) / 2,
|
|
@@ -1625,8 +2037,6 @@ var Switch = forwardRef(
|
|
|
1625
2037
|
width: THUMB,
|
|
1626
2038
|
height: THUMB,
|
|
1627
2039
|
display: "block",
|
|
1628
|
-
transform: `translateX(${isOn ? THUMB_ON : THUMB_OFF}px)`,
|
|
1629
|
-
transition: "transform 160ms ease",
|
|
1630
2040
|
zIndex: 1
|
|
1631
2041
|
},
|
|
1632
2042
|
children: /* @__PURE__ */ jsx(
|
|
@@ -1644,7 +2054,7 @@ var Switch = forwardRef(
|
|
|
1644
2054
|
}
|
|
1645
2055
|
)
|
|
1646
2056
|
}
|
|
1647
|
-
)
|
|
2057
|
+
) })
|
|
1648
2058
|
]
|
|
1649
2059
|
}
|
|
1650
2060
|
),
|
|
@@ -1686,12 +2096,14 @@ var Tabs = forwardRef(function Tabs2({
|
|
|
1686
2096
|
bowing,
|
|
1687
2097
|
fillStyle,
|
|
1688
2098
|
strokeWidth,
|
|
2099
|
+
animate,
|
|
1689
2100
|
...rest
|
|
1690
2101
|
}, ref) {
|
|
1691
2102
|
const [uncontrolled, setUncontrolled] = useState(defaultValue);
|
|
1692
2103
|
const current = value ?? uncontrolled;
|
|
1693
2104
|
const resolvedSeed = useResolvedSeed(seed);
|
|
1694
2105
|
const ink = sketchColor ?? SKETCH_COLORS.ink;
|
|
2106
|
+
const shouldAnimate = useAnimate(animate);
|
|
1695
2107
|
return /* @__PURE__ */ jsx(
|
|
1696
2108
|
TabsSketchContext.Provider,
|
|
1697
2109
|
{
|
|
@@ -1704,7 +2116,8 @@ var Tabs = forwardRef(function Tabs2({
|
|
|
1704
2116
|
strokeWidth,
|
|
1705
2117
|
resolvedSeed,
|
|
1706
2118
|
ink,
|
|
1707
|
-
current
|
|
2119
|
+
current,
|
|
2120
|
+
shouldAnimate
|
|
1708
2121
|
},
|
|
1709
2122
|
children: /* @__PURE__ */ jsx(
|
|
1710
2123
|
TabsPrimitive.Root,
|
|
@@ -1725,29 +2138,102 @@ var Tabs = forwardRef(function Tabs2({
|
|
|
1725
2138
|
}
|
|
1726
2139
|
);
|
|
1727
2140
|
});
|
|
2141
|
+
function TabUnderline({
|
|
2142
|
+
box,
|
|
2143
|
+
seed,
|
|
2144
|
+
sketch
|
|
2145
|
+
}) {
|
|
2146
|
+
const ref = useRef(null);
|
|
2147
|
+
useDrawIn(ref, DRAW_IN_MARK_MS, sketch.shouldAnimate, seed);
|
|
2148
|
+
return /* @__PURE__ */ jsx(
|
|
2149
|
+
"span",
|
|
2150
|
+
{
|
|
2151
|
+
ref,
|
|
2152
|
+
"aria-hidden": "true",
|
|
2153
|
+
style: {
|
|
2154
|
+
position: "absolute",
|
|
2155
|
+
left: box.left,
|
|
2156
|
+
top: box.top,
|
|
2157
|
+
width: box.width,
|
|
2158
|
+
height: 10,
|
|
2159
|
+
pointerEvents: "none",
|
|
2160
|
+
transition: sketch.shouldAnimate ? "left 220ms ease, width 220ms ease, top 220ms ease" : void 0
|
|
2161
|
+
},
|
|
2162
|
+
children: /* @__PURE__ */ jsx(
|
|
2163
|
+
RoughSvg,
|
|
2164
|
+
{
|
|
2165
|
+
shape: "line",
|
|
2166
|
+
roughness: (sketch.roughness ?? 1.5) + 0.35,
|
|
2167
|
+
seed,
|
|
2168
|
+
sketchColor: SKETCH_COLORS.accent,
|
|
2169
|
+
bowing: sketch.bowing ?? 1.8,
|
|
2170
|
+
strokeWidth: (sketch.strokeWidth ?? 1.75) + 0.4,
|
|
2171
|
+
inset: 2
|
|
2172
|
+
}
|
|
2173
|
+
)
|
|
2174
|
+
}
|
|
2175
|
+
);
|
|
2176
|
+
}
|
|
1728
2177
|
var TabList = forwardRef(
|
|
1729
2178
|
function TabList2({ className, style, children, ...rest }, ref) {
|
|
1730
|
-
|
|
2179
|
+
const sketch = useTabsSketch();
|
|
2180
|
+
const listRef = useRef(null);
|
|
2181
|
+
const [underline, setUnderline] = useState(null);
|
|
2182
|
+
useLayoutEffect(() => {
|
|
2183
|
+
const list = listRef.current;
|
|
2184
|
+
if (!list) return;
|
|
2185
|
+
const measure = () => {
|
|
2186
|
+
const active = list.querySelector('[data-state="active"]');
|
|
2187
|
+
if (!active) {
|
|
2188
|
+
setUnderline(null);
|
|
2189
|
+
return;
|
|
2190
|
+
}
|
|
2191
|
+
setUnderline({
|
|
2192
|
+
left: active.offsetLeft + 8,
|
|
2193
|
+
top: active.offsetTop + active.offsetHeight - 10,
|
|
2194
|
+
width: Math.max(12, active.offsetWidth - 16)
|
|
2195
|
+
});
|
|
2196
|
+
};
|
|
2197
|
+
measure();
|
|
2198
|
+
const observer = new ResizeObserver(measure);
|
|
2199
|
+
observer.observe(list);
|
|
2200
|
+
return () => observer.disconnect();
|
|
2201
|
+
}, [sketch.current, children]);
|
|
2202
|
+
return /* @__PURE__ */ jsxs(
|
|
1731
2203
|
TabsPrimitive.List,
|
|
1732
2204
|
{
|
|
1733
|
-
ref
|
|
2205
|
+
ref: (node) => {
|
|
2206
|
+
listRef.current = node;
|
|
2207
|
+
assignRef(ref, node);
|
|
2208
|
+
},
|
|
1734
2209
|
className: cn(className),
|
|
1735
2210
|
style: {
|
|
1736
2211
|
display: "flex",
|
|
1737
2212
|
flexWrap: "wrap",
|
|
1738
2213
|
gap: 4,
|
|
2214
|
+
position: "relative",
|
|
1739
2215
|
...style
|
|
1740
2216
|
},
|
|
1741
2217
|
...rest,
|
|
1742
|
-
children
|
|
1743
|
-
|
|
1744
|
-
|
|
2218
|
+
children: [
|
|
2219
|
+
children,
|
|
2220
|
+
underline && sketch.current ? /* @__PURE__ */ jsx(
|
|
2221
|
+
TabUnderline,
|
|
2222
|
+
{
|
|
2223
|
+
box: underline,
|
|
2224
|
+
seed: deriveSeed(sketch.resolvedSeed, sketch.current),
|
|
2225
|
+
sketch
|
|
2226
|
+
}
|
|
2227
|
+
) : null
|
|
2228
|
+
]
|
|
2229
|
+
}
|
|
2230
|
+
);
|
|
1745
2231
|
}
|
|
1746
2232
|
);
|
|
1747
2233
|
var Tab = forwardRef(function Tab2({ className, style, children, value, ...rest }, ref) {
|
|
1748
2234
|
const sketch = useTabsSketch();
|
|
1749
2235
|
const active = sketch.current === value;
|
|
1750
|
-
return /* @__PURE__ */
|
|
2236
|
+
return /* @__PURE__ */ jsx(
|
|
1751
2237
|
TabsPrimitive.Trigger,
|
|
1752
2238
|
{
|
|
1753
2239
|
ref,
|
|
@@ -1767,34 +2253,7 @@ var Tab = forwardRef(function Tab2({ className, style, children, value, ...rest
|
|
|
1767
2253
|
...style
|
|
1768
2254
|
},
|
|
1769
2255
|
...rest,
|
|
1770
|
-
children:
|
|
1771
|
-
/* @__PURE__ */ jsx("span", { style: { position: "relative", zIndex: 1 }, children }),
|
|
1772
|
-
active ? /* @__PURE__ */ jsx(
|
|
1773
|
-
"span",
|
|
1774
|
-
{
|
|
1775
|
-
style: {
|
|
1776
|
-
position: "absolute",
|
|
1777
|
-
left: 8,
|
|
1778
|
-
right: 8,
|
|
1779
|
-
bottom: 2,
|
|
1780
|
-
height: 10,
|
|
1781
|
-
pointerEvents: "none"
|
|
1782
|
-
},
|
|
1783
|
-
children: /* @__PURE__ */ jsx(
|
|
1784
|
-
RoughSvg,
|
|
1785
|
-
{
|
|
1786
|
-
shape: "line",
|
|
1787
|
-
roughness: (sketch.roughness ?? 1.5) + 0.35,
|
|
1788
|
-
seed: deriveSeed(sketch.resolvedSeed, value),
|
|
1789
|
-
sketchColor: SKETCH_COLORS.accent,
|
|
1790
|
-
bowing: sketch.bowing ?? 1.8,
|
|
1791
|
-
strokeWidth: (sketch.strokeWidth ?? 1.75) + 0.4,
|
|
1792
|
-
inset: 2
|
|
1793
|
-
}
|
|
1794
|
-
)
|
|
1795
|
-
}
|
|
1796
|
-
) : null
|
|
1797
|
-
]
|
|
2256
|
+
children: /* @__PURE__ */ jsx("span", { style: { position: "relative", zIndex: 1 }, children })
|
|
1798
2257
|
}
|
|
1799
2258
|
);
|
|
1800
2259
|
});
|
|
@@ -1829,6 +2288,46 @@ function useTableSketch() {
|
|
|
1829
2288
|
}
|
|
1830
2289
|
return ctx;
|
|
1831
2290
|
}
|
|
2291
|
+
function TableRule({
|
|
2292
|
+
line,
|
|
2293
|
+
headerUnderline,
|
|
2294
|
+
roughness,
|
|
2295
|
+
resolvedSeed,
|
|
2296
|
+
ink,
|
|
2297
|
+
bowing,
|
|
2298
|
+
strokeWidth,
|
|
2299
|
+
shouldAnimate
|
|
2300
|
+
}) {
|
|
2301
|
+
const ref = useRef(null);
|
|
2302
|
+
const delay = shouldAnimate ? Math.min(line.index, 6) * TABLE_STAGGER_MS : 0;
|
|
2303
|
+
useDrawIn(ref, DRAW_IN_DURATION_MS, shouldAnimate, void 0, delay);
|
|
2304
|
+
if (line.header && !headerUnderline) return null;
|
|
2305
|
+
return /* @__PURE__ */ jsx(
|
|
2306
|
+
"div",
|
|
2307
|
+
{
|
|
2308
|
+
ref,
|
|
2309
|
+
style: {
|
|
2310
|
+
position: "absolute",
|
|
2311
|
+
left: 0,
|
|
2312
|
+
width: line.width,
|
|
2313
|
+
top: line.y - 6,
|
|
2314
|
+
height: 12
|
|
2315
|
+
},
|
|
2316
|
+
children: /* @__PURE__ */ jsx(
|
|
2317
|
+
RoughSvg,
|
|
2318
|
+
{
|
|
2319
|
+
shape: "line",
|
|
2320
|
+
roughness: line.header ? (roughness ?? 1.5) + 0.2 : roughness ?? 1.7,
|
|
2321
|
+
seed: deriveSeed(resolvedSeed, line.key),
|
|
2322
|
+
sketchColor: ink,
|
|
2323
|
+
bowing: bowing ?? (line.header ? 1.4 : 2),
|
|
2324
|
+
strokeWidth: line.header ? (strokeWidth ?? 1.75) + 0.35 : strokeWidth ?? 1.35,
|
|
2325
|
+
inset: 6
|
|
2326
|
+
}
|
|
2327
|
+
)
|
|
2328
|
+
}
|
|
2329
|
+
);
|
|
2330
|
+
}
|
|
1832
2331
|
var Table = forwardRef(function Table2({
|
|
1833
2332
|
className,
|
|
1834
2333
|
style,
|
|
@@ -1840,6 +2339,7 @@ var Table = forwardRef(function Table2({
|
|
|
1840
2339
|
bowing,
|
|
1841
2340
|
fillStyle,
|
|
1842
2341
|
strokeWidth,
|
|
2342
|
+
animate,
|
|
1843
2343
|
...rest
|
|
1844
2344
|
}, ref) {
|
|
1845
2345
|
const wrapperRef = useRef(null);
|
|
@@ -1847,6 +2347,7 @@ var Table = forwardRef(function Table2({
|
|
|
1847
2347
|
const [lines, setLines] = useState([]);
|
|
1848
2348
|
const resolvedSeed = useResolvedSeed(seed);
|
|
1849
2349
|
const ink = sketchColor ?? SKETCH_COLORS.ink;
|
|
2350
|
+
const shouldAnimate = useAnimate(animate);
|
|
1850
2351
|
useLayoutEffect(() => {
|
|
1851
2352
|
const wrapper = wrapperRef.current;
|
|
1852
2353
|
const table = tableRef.current;
|
|
@@ -1862,7 +2363,8 @@ var Table = forwardRef(function Table2({
|
|
|
1862
2363
|
y: row.offsetTop + row.offsetHeight,
|
|
1863
2364
|
width: table.offsetWidth,
|
|
1864
2365
|
key: isHeader ? `header-${index}` : `row-${index}`,
|
|
1865
|
-
header: Boolean(isHeader)
|
|
2366
|
+
header: Boolean(isHeader),
|
|
2367
|
+
index
|
|
1866
2368
|
});
|
|
1867
2369
|
});
|
|
1868
2370
|
setLines(next);
|
|
@@ -1884,7 +2386,8 @@ var Table = forwardRef(function Table2({
|
|
|
1884
2386
|
fillStyle,
|
|
1885
2387
|
strokeWidth,
|
|
1886
2388
|
resolvedSeed,
|
|
1887
|
-
ink
|
|
2389
|
+
ink,
|
|
2390
|
+
shouldAnimate
|
|
1888
2391
|
},
|
|
1889
2392
|
children: /* @__PURE__ */ jsxs(
|
|
1890
2393
|
"div",
|
|
@@ -1904,34 +2407,20 @@ var Table = forwardRef(function Table2({
|
|
|
1904
2407
|
zIndex: 1,
|
|
1905
2408
|
overflow: "visible"
|
|
1906
2409
|
},
|
|
1907
|
-
children: lines.map((line) =>
|
|
1908
|
-
|
|
1909
|
-
|
|
1910
|
-
|
|
1911
|
-
|
|
1912
|
-
|
|
1913
|
-
|
|
1914
|
-
|
|
1915
|
-
|
|
1916
|
-
|
|
1917
|
-
|
|
1918
|
-
|
|
1919
|
-
|
|
1920
|
-
|
|
1921
|
-
{
|
|
1922
|
-
shape: "line",
|
|
1923
|
-
roughness: line.header ? (roughness ?? 1.5) + 0.2 : roughness ?? 1.7,
|
|
1924
|
-
seed: deriveSeed(resolvedSeed, line.key),
|
|
1925
|
-
sketchColor: ink,
|
|
1926
|
-
bowing: bowing ?? (line.header ? 1.4 : 2),
|
|
1927
|
-
strokeWidth: line.header ? (strokeWidth ?? 1.75) + 0.35 : strokeWidth ?? 1.35,
|
|
1928
|
-
inset: 6
|
|
1929
|
-
}
|
|
1930
|
-
)
|
|
1931
|
-
},
|
|
1932
|
-
line.key
|
|
1933
|
-
);
|
|
1934
|
-
})
|
|
2410
|
+
children: lines.map((line) => /* @__PURE__ */ jsx(
|
|
2411
|
+
TableRule,
|
|
2412
|
+
{
|
|
2413
|
+
line,
|
|
2414
|
+
headerUnderline,
|
|
2415
|
+
roughness,
|
|
2416
|
+
resolvedSeed,
|
|
2417
|
+
ink,
|
|
2418
|
+
bowing,
|
|
2419
|
+
strokeWidth,
|
|
2420
|
+
shouldAnimate
|
|
2421
|
+
},
|
|
2422
|
+
line.key
|
|
2423
|
+
))
|
|
1935
2424
|
}
|
|
1936
2425
|
),
|
|
1937
2426
|
/* @__PURE__ */ jsx(
|
|
@@ -1939,8 +2428,7 @@ var Table = forwardRef(function Table2({
|
|
|
1939
2428
|
{
|
|
1940
2429
|
ref: (node) => {
|
|
1941
2430
|
tableRef.current = node;
|
|
1942
|
-
|
|
1943
|
-
else if (ref) ref.current = node;
|
|
2431
|
+
assignRef(ref, node);
|
|
1944
2432
|
},
|
|
1945
2433
|
style: {
|
|
1946
2434
|
width: "100%",
|
|
@@ -2102,84 +2590,89 @@ function Toast({
|
|
|
2102
2590
|
sketchColor,
|
|
2103
2591
|
bowing,
|
|
2104
2592
|
fillStyle,
|
|
2105
|
-
strokeWidth
|
|
2593
|
+
strokeWidth,
|
|
2594
|
+
animate
|
|
2106
2595
|
}) {
|
|
2107
2596
|
const position = useContext(ToastPositionContext);
|
|
2108
2597
|
const fromTop = position.startsWith("top");
|
|
2109
|
-
const [
|
|
2598
|
+
const [uncontrolled, setUncontrolled] = useState(defaultOpen ?? false);
|
|
2599
|
+
const isOpen = open ?? uncontrolled;
|
|
2600
|
+
const shouldAnimate = useAnimate(animate);
|
|
2110
2601
|
const color = sketchColor ?? VARIANT_COLOR2[variant];
|
|
2111
|
-
const
|
|
2112
|
-
|
|
2113
|
-
|
|
2114
|
-
|
|
2115
|
-
|
|
2116
|
-
|
|
2117
|
-
setEntered(false);
|
|
2118
|
-
const frame = requestAnimationFrame(() => {
|
|
2119
|
-
requestAnimationFrame(() => setEntered(true));
|
|
2120
|
-
});
|
|
2121
|
-
return () => cancelAnimationFrame(frame);
|
|
2122
|
-
}, [visible]);
|
|
2123
|
-
return /* @__PURE__ */ jsx(
|
|
2602
|
+
const offset = fromTop ? -14 : 14;
|
|
2603
|
+
function handleOpenChange(next) {
|
|
2604
|
+
setUncontrolled(next);
|
|
2605
|
+
onOpenChange?.(next);
|
|
2606
|
+
}
|
|
2607
|
+
return /* @__PURE__ */ jsx(AnimatePresence, { children: isOpen ? /* @__PURE__ */ jsx(
|
|
2124
2608
|
ToastPrimitive.Root,
|
|
2125
2609
|
{
|
|
2126
|
-
open,
|
|
2127
|
-
|
|
2128
|
-
onOpenChange,
|
|
2610
|
+
open: isOpen,
|
|
2611
|
+
onOpenChange: handleOpenChange,
|
|
2129
2612
|
duration,
|
|
2130
|
-
|
|
2131
|
-
|
|
2132
|
-
|
|
2133
|
-
|
|
2134
|
-
transition: "transform 200ms ease, opacity 200ms ease",
|
|
2135
|
-
outline: "none",
|
|
2136
|
-
...style
|
|
2137
|
-
},
|
|
2138
|
-
children: /* @__PURE__ */ jsxs(
|
|
2139
|
-
SketchBox,
|
|
2613
|
+
forceMount: true,
|
|
2614
|
+
asChild: true,
|
|
2615
|
+
children: /* @__PURE__ */ jsx(
|
|
2616
|
+
motion.li,
|
|
2140
2617
|
{
|
|
2141
|
-
|
|
2142
|
-
|
|
2143
|
-
|
|
2144
|
-
|
|
2145
|
-
|
|
2146
|
-
|
|
2147
|
-
|
|
2148
|
-
|
|
2149
|
-
|
|
2150
|
-
|
|
2151
|
-
|
|
2152
|
-
|
|
2153
|
-
|
|
2154
|
-
|
|
2155
|
-
|
|
2156
|
-
|
|
2157
|
-
|
|
2158
|
-
|
|
2159
|
-
|
|
2160
|
-
|
|
2161
|
-
|
|
2162
|
-
|
|
2163
|
-
}
|
|
2164
|
-
|
|
2165
|
-
|
|
2166
|
-
|
|
2167
|
-
|
|
2168
|
-
|
|
2169
|
-
|
|
2170
|
-
|
|
2171
|
-
|
|
2172
|
-
|
|
2173
|
-
|
|
2174
|
-
|
|
2175
|
-
|
|
2176
|
-
|
|
2177
|
-
|
|
2178
|
-
|
|
2618
|
+
className: cn(className),
|
|
2619
|
+
initial: shouldAnimate ? { y: offset, opacity: 0, rotate: -1.4 } : false,
|
|
2620
|
+
animate: shouldAnimate ? { y: 0, opacity: 1, rotate: [-1.2, 0.9, -0.35, 0] } : { y: 0, opacity: 1, rotate: 0 },
|
|
2621
|
+
exit: shouldAnimate ? { y: offset, opacity: 0, rotate: 1.2 } : { opacity: 0 },
|
|
2622
|
+
transition: shouldAnimate ? { duration: 0.38, ease: "easeOut" } : { duration: 0 },
|
|
2623
|
+
style: {
|
|
2624
|
+
listStyle: "none",
|
|
2625
|
+
outline: "none",
|
|
2626
|
+
...style
|
|
2627
|
+
},
|
|
2628
|
+
children: /* @__PURE__ */ jsxs(
|
|
2629
|
+
SketchBox,
|
|
2630
|
+
{
|
|
2631
|
+
roughness,
|
|
2632
|
+
seed,
|
|
2633
|
+
sketchColor: color,
|
|
2634
|
+
bowing,
|
|
2635
|
+
fillStyle: fillStyle ?? "hachure",
|
|
2636
|
+
fill: VARIANT_FILL2[variant],
|
|
2637
|
+
strokeWidth: strokeWidth ?? 1.7,
|
|
2638
|
+
shadow: true,
|
|
2639
|
+
animate,
|
|
2640
|
+
contentStyle: { padding: "12px 16px" },
|
|
2641
|
+
children: [
|
|
2642
|
+
title ? /* @__PURE__ */ jsx(
|
|
2643
|
+
ToastPrimitive.Title,
|
|
2644
|
+
{
|
|
2645
|
+
style: {
|
|
2646
|
+
margin: 0,
|
|
2647
|
+
fontWeight: doodleUiFontWeight(700),
|
|
2648
|
+
fontSize: 15,
|
|
2649
|
+
fontFamily: doodleUiFontFamily,
|
|
2650
|
+
color,
|
|
2651
|
+
marginBottom: children ? 4 : 0
|
|
2652
|
+
},
|
|
2653
|
+
children: title
|
|
2654
|
+
}
|
|
2655
|
+
) : null,
|
|
2656
|
+
children ? /* @__PURE__ */ jsx(
|
|
2657
|
+
ToastPrimitive.Description,
|
|
2658
|
+
{
|
|
2659
|
+
style: {
|
|
2660
|
+
margin: 0,
|
|
2661
|
+
fontSize: 14,
|
|
2662
|
+
lineHeight: 1.5,
|
|
2663
|
+
fontFamily: doodleUiFontFamily,
|
|
2664
|
+
color: SKETCH_COLORS.ink
|
|
2665
|
+
},
|
|
2666
|
+
children
|
|
2667
|
+
}
|
|
2668
|
+
) : null
|
|
2669
|
+
]
|
|
2670
|
+
}
|
|
2671
|
+
)
|
|
2179
2672
|
}
|
|
2180
2673
|
)
|
|
2181
2674
|
}
|
|
2182
|
-
);
|
|
2675
|
+
) : null });
|
|
2183
2676
|
}
|
|
2184
2677
|
var ToastRoot = ToastPrimitive.Root;
|
|
2185
2678
|
var ToastTitle = ToastPrimitive.Title;
|
|
@@ -3210,7 +3703,1479 @@ var Stepper = forwardRef(
|
|
|
3210
3703
|
);
|
|
3211
3704
|
}
|
|
3212
3705
|
);
|
|
3706
|
+
var Label2 = forwardRef(function Label3({
|
|
3707
|
+
className,
|
|
3708
|
+
style,
|
|
3709
|
+
children,
|
|
3710
|
+
required,
|
|
3711
|
+
roughness,
|
|
3712
|
+
seed,
|
|
3713
|
+
sketchColor,
|
|
3714
|
+
bowing,
|
|
3715
|
+
strokeWidth,
|
|
3716
|
+
animate,
|
|
3717
|
+
...rest
|
|
3718
|
+
}, ref) {
|
|
3719
|
+
const ink = sketchColor ?? SKETCH_COLORS.ink;
|
|
3720
|
+
const resolvedSeed = useResolvedSeed(seed);
|
|
3721
|
+
const shouldAnimate = useAnimate(animate);
|
|
3722
|
+
const markRef = useRef(null);
|
|
3723
|
+
useDrawIn(markRef, DRAW_IN_MARK_MS, shouldAnimate);
|
|
3724
|
+
return /* @__PURE__ */ jsxs(
|
|
3725
|
+
LabelPrimitive.Root,
|
|
3726
|
+
{
|
|
3727
|
+
ref,
|
|
3728
|
+
className: cn(className),
|
|
3729
|
+
style: {
|
|
3730
|
+
display: "inline-flex",
|
|
3731
|
+
alignItems: "center",
|
|
3732
|
+
gap: 4,
|
|
3733
|
+
fontFamily: doodleUiFontFamily,
|
|
3734
|
+
fontSize: 13,
|
|
3735
|
+
fontWeight: doodleUiFontWeight(600),
|
|
3736
|
+
color: ink,
|
|
3737
|
+
cursor: "default",
|
|
3738
|
+
...style
|
|
3739
|
+
},
|
|
3740
|
+
...rest,
|
|
3741
|
+
children: [
|
|
3742
|
+
children,
|
|
3743
|
+
required ? /* @__PURE__ */ jsx(
|
|
3744
|
+
"span",
|
|
3745
|
+
{
|
|
3746
|
+
ref: markRef,
|
|
3747
|
+
"aria-hidden": "true",
|
|
3748
|
+
style: { position: "relative", width: 10, height: 10, flexShrink: 0 },
|
|
3749
|
+
children: /* @__PURE__ */ jsx(
|
|
3750
|
+
RoughSvg,
|
|
3751
|
+
{
|
|
3752
|
+
shape: "ellipse",
|
|
3753
|
+
roughness: (roughness ?? 1.5) * 0.9,
|
|
3754
|
+
seed: resolvedSeed,
|
|
3755
|
+
sketchColor: SKETCH_COLORS.accent,
|
|
3756
|
+
bowing,
|
|
3757
|
+
fillStyle: "solid",
|
|
3758
|
+
fill: SKETCH_COLORS.accent,
|
|
3759
|
+
strokeWidth: strokeWidth ?? 1.2,
|
|
3760
|
+
inset: 1
|
|
3761
|
+
}
|
|
3762
|
+
)
|
|
3763
|
+
}
|
|
3764
|
+
) : null
|
|
3765
|
+
]
|
|
3766
|
+
}
|
|
3767
|
+
);
|
|
3768
|
+
});
|
|
3769
|
+
var CHEVRON_PATH4 = "M 6 4 L 12 10 L 6 16";
|
|
3770
|
+
var CollapsibleSketchContext = createContext(null);
|
|
3771
|
+
function useCollapsibleSketch() {
|
|
3772
|
+
const ctx = useContext(CollapsibleSketchContext);
|
|
3773
|
+
if (!ctx) {
|
|
3774
|
+
throw new Error(
|
|
3775
|
+
"Collapsible parts must be used inside <Collapsible>."
|
|
3776
|
+
);
|
|
3777
|
+
}
|
|
3778
|
+
return ctx;
|
|
3779
|
+
}
|
|
3780
|
+
var Collapsible = forwardRef(
|
|
3781
|
+
function Collapsible2({
|
|
3782
|
+
className,
|
|
3783
|
+
style,
|
|
3784
|
+
children,
|
|
3785
|
+
open,
|
|
3786
|
+
defaultOpen,
|
|
3787
|
+
onOpenChange,
|
|
3788
|
+
disabled,
|
|
3789
|
+
roughness,
|
|
3790
|
+
seed,
|
|
3791
|
+
sketchColor,
|
|
3792
|
+
bowing,
|
|
3793
|
+
fillStyle,
|
|
3794
|
+
strokeWidth,
|
|
3795
|
+
...rest
|
|
3796
|
+
}, ref) {
|
|
3797
|
+
const resolvedSeed = useResolvedSeed(seed);
|
|
3798
|
+
const ink = sketchColor ?? SKETCH_COLORS.ink;
|
|
3799
|
+
const [uncontrolled, setUncontrolled] = useState(defaultOpen ?? false);
|
|
3800
|
+
const isOpen = open ?? uncontrolled;
|
|
3801
|
+
return /* @__PURE__ */ jsx(
|
|
3802
|
+
CollapsibleSketchContext.Provider,
|
|
3803
|
+
{
|
|
3804
|
+
value: {
|
|
3805
|
+
roughness,
|
|
3806
|
+
seed: resolvedSeed,
|
|
3807
|
+
sketchColor,
|
|
3808
|
+
bowing,
|
|
3809
|
+
fillStyle,
|
|
3810
|
+
strokeWidth,
|
|
3811
|
+
resolvedSeed,
|
|
3812
|
+
ink,
|
|
3813
|
+
open: isOpen
|
|
3814
|
+
},
|
|
3815
|
+
children: /* @__PURE__ */ jsx(
|
|
3816
|
+
CollapsiblePrimitive.Root,
|
|
3817
|
+
{
|
|
3818
|
+
ref,
|
|
3819
|
+
open: isOpen,
|
|
3820
|
+
disabled,
|
|
3821
|
+
className: cn(className),
|
|
3822
|
+
style,
|
|
3823
|
+
onOpenChange: (next) => {
|
|
3824
|
+
setUncontrolled(next);
|
|
3825
|
+
onOpenChange?.(next);
|
|
3826
|
+
},
|
|
3827
|
+
...rest,
|
|
3828
|
+
children
|
|
3829
|
+
}
|
|
3830
|
+
)
|
|
3831
|
+
}
|
|
3832
|
+
);
|
|
3833
|
+
}
|
|
3834
|
+
);
|
|
3835
|
+
var CollapsibleTrigger = forwardRef(function CollapsibleTrigger2({ className, style, children, ...rest }, ref) {
|
|
3836
|
+
const sketch = useCollapsibleSketch();
|
|
3837
|
+
return /* @__PURE__ */ jsxs(
|
|
3838
|
+
CollapsiblePrimitive.Trigger,
|
|
3839
|
+
{
|
|
3840
|
+
ref,
|
|
3841
|
+
className: cn(className),
|
|
3842
|
+
style: {
|
|
3843
|
+
display: "flex",
|
|
3844
|
+
width: "100%",
|
|
3845
|
+
alignItems: "center",
|
|
3846
|
+
justifyContent: "space-between",
|
|
3847
|
+
gap: 12,
|
|
3848
|
+
padding: "10px 4px",
|
|
3849
|
+
border: "none",
|
|
3850
|
+
background: "transparent",
|
|
3851
|
+
cursor: "pointer",
|
|
3852
|
+
fontFamily: doodleUiFontFamily,
|
|
3853
|
+
fontSize: 15,
|
|
3854
|
+
fontWeight: doodleUiFontWeight(600),
|
|
3855
|
+
color: sketch.ink,
|
|
3856
|
+
textAlign: "left",
|
|
3857
|
+
outline: "none",
|
|
3858
|
+
...style
|
|
3859
|
+
},
|
|
3860
|
+
...rest,
|
|
3861
|
+
children: [
|
|
3862
|
+
/* @__PURE__ */ jsx("span", { children }),
|
|
3863
|
+
/* @__PURE__ */ jsx(
|
|
3864
|
+
"span",
|
|
3865
|
+
{
|
|
3866
|
+
style: {
|
|
3867
|
+
position: "relative",
|
|
3868
|
+
width: 18,
|
|
3869
|
+
height: 18,
|
|
3870
|
+
flexShrink: 0,
|
|
3871
|
+
transform: sketch.open ? "rotate(90deg)" : "rotate(0deg)",
|
|
3872
|
+
transition: "transform 180ms ease"
|
|
3873
|
+
},
|
|
3874
|
+
children: /* @__PURE__ */ jsx(
|
|
3875
|
+
RoughSvg,
|
|
3876
|
+
{
|
|
3877
|
+
shape: "path",
|
|
3878
|
+
path: CHEVRON_PATH4,
|
|
3879
|
+
roughness: (sketch.roughness ?? 1.5) * 0.7,
|
|
3880
|
+
seed: sketch.resolvedSeed,
|
|
3881
|
+
sketchColor: sketch.ink,
|
|
3882
|
+
bowing: sketch.bowing,
|
|
3883
|
+
strokeWidth: (sketch.strokeWidth ?? 1.6) + 0.2,
|
|
3884
|
+
inset: 0
|
|
3885
|
+
}
|
|
3886
|
+
)
|
|
3887
|
+
}
|
|
3888
|
+
)
|
|
3889
|
+
]
|
|
3890
|
+
}
|
|
3891
|
+
);
|
|
3892
|
+
});
|
|
3893
|
+
var CollapsibleContent = forwardRef(function CollapsibleContent2({ className, style, children, ...rest }, ref) {
|
|
3894
|
+
const sketch = useCollapsibleSketch();
|
|
3895
|
+
return /* @__PURE__ */ jsx(
|
|
3896
|
+
CollapsiblePrimitive.Content,
|
|
3897
|
+
{
|
|
3898
|
+
ref,
|
|
3899
|
+
className: cn(className),
|
|
3900
|
+
style: {
|
|
3901
|
+
padding: "0 4px 12px",
|
|
3902
|
+
fontFamily: doodleUiFontFamily,
|
|
3903
|
+
fontSize: 14,
|
|
3904
|
+
lineHeight: 1.5,
|
|
3905
|
+
color: sketch.ink,
|
|
3906
|
+
...style
|
|
3907
|
+
},
|
|
3908
|
+
...rest,
|
|
3909
|
+
children
|
|
3910
|
+
}
|
|
3911
|
+
);
|
|
3912
|
+
});
|
|
3913
|
+
var PopoverSketchContext = createContext(
|
|
3914
|
+
null
|
|
3915
|
+
);
|
|
3916
|
+
function usePopoverSketch() {
|
|
3917
|
+
const ctx = useContext(PopoverSketchContext);
|
|
3918
|
+
if (!ctx) {
|
|
3919
|
+
throw new Error("Popover parts must be used inside <Popover>.");
|
|
3920
|
+
}
|
|
3921
|
+
return ctx;
|
|
3922
|
+
}
|
|
3923
|
+
function Popover({
|
|
3924
|
+
children,
|
|
3925
|
+
roughness,
|
|
3926
|
+
seed,
|
|
3927
|
+
sketchColor,
|
|
3928
|
+
bowing,
|
|
3929
|
+
fillStyle,
|
|
3930
|
+
strokeWidth,
|
|
3931
|
+
animate,
|
|
3932
|
+
...rest
|
|
3933
|
+
}) {
|
|
3934
|
+
const resolvedSeed = useResolvedSeed(seed);
|
|
3935
|
+
const ink = sketchColor ?? SKETCH_COLORS.ink;
|
|
3936
|
+
return /* @__PURE__ */ jsx(
|
|
3937
|
+
PopoverSketchContext.Provider,
|
|
3938
|
+
{
|
|
3939
|
+
value: {
|
|
3940
|
+
roughness,
|
|
3941
|
+
seed: resolvedSeed,
|
|
3942
|
+
sketchColor,
|
|
3943
|
+
bowing,
|
|
3944
|
+
fillStyle,
|
|
3945
|
+
strokeWidth,
|
|
3946
|
+
resolvedSeed,
|
|
3947
|
+
ink,
|
|
3948
|
+
animate
|
|
3949
|
+
},
|
|
3950
|
+
children: /* @__PURE__ */ jsx(PopoverPrimitive.Root, { ...rest, children })
|
|
3951
|
+
}
|
|
3952
|
+
);
|
|
3953
|
+
}
|
|
3954
|
+
var PopoverTrigger = PopoverPrimitive.Trigger;
|
|
3955
|
+
var PopoverAnchor = PopoverPrimitive.Anchor;
|
|
3956
|
+
var PopoverClose = PopoverPrimitive.Close;
|
|
3957
|
+
var PopoverContent = forwardRef(
|
|
3958
|
+
function PopoverContent2({ className, style, children, sideOffset = 8, ...rest }, ref) {
|
|
3959
|
+
const sketch = usePopoverSketch();
|
|
3960
|
+
return /* @__PURE__ */ jsx(PopoverPrimitive.Portal, { children: /* @__PURE__ */ jsx(
|
|
3961
|
+
PopoverPrimitive.Content,
|
|
3962
|
+
{
|
|
3963
|
+
ref,
|
|
3964
|
+
sideOffset,
|
|
3965
|
+
className: cn(className),
|
|
3966
|
+
style: { zIndex: 80, outline: "none", ...style },
|
|
3967
|
+
...rest,
|
|
3968
|
+
children: /* @__PURE__ */ jsx(
|
|
3969
|
+
SketchBox,
|
|
3970
|
+
{
|
|
3971
|
+
roughness: sketch.roughness,
|
|
3972
|
+
seed: sketch.resolvedSeed,
|
|
3973
|
+
sketchColor: sketch.ink,
|
|
3974
|
+
bowing: sketch.bowing,
|
|
3975
|
+
fillStyle: sketch.fillStyle ?? "solid",
|
|
3976
|
+
fill: "#f7f6f2",
|
|
3977
|
+
strokeWidth: sketch.strokeWidth ?? 1.5,
|
|
3978
|
+
shadow: true,
|
|
3979
|
+
animate: sketch.animate,
|
|
3980
|
+
contentStyle: { padding: "14px 16px", minWidth: 200 },
|
|
3981
|
+
children
|
|
3982
|
+
}
|
|
3983
|
+
)
|
|
3984
|
+
}
|
|
3985
|
+
) });
|
|
3986
|
+
}
|
|
3987
|
+
);
|
|
3988
|
+
var PopoverArrow = forwardRef(
|
|
3989
|
+
function PopoverArrow2(props, ref) {
|
|
3990
|
+
const sketch = usePopoverSketch();
|
|
3991
|
+
return /* @__PURE__ */ jsx(PopoverPrimitive.Arrow, { ref, fill: sketch.ink, ...props });
|
|
3992
|
+
}
|
|
3993
|
+
);
|
|
3994
|
+
var DropdownMenuSketchContext = createContext(null);
|
|
3995
|
+
function useDropdownMenuSketch() {
|
|
3996
|
+
const ctx = useContext(DropdownMenuSketchContext);
|
|
3997
|
+
if (!ctx) {
|
|
3998
|
+
throw new Error(
|
|
3999
|
+
"DropdownMenu parts must be used inside <DropdownMenu>."
|
|
4000
|
+
);
|
|
4001
|
+
}
|
|
4002
|
+
return ctx;
|
|
4003
|
+
}
|
|
4004
|
+
function DropdownMenu({
|
|
4005
|
+
children,
|
|
4006
|
+
roughness,
|
|
4007
|
+
seed,
|
|
4008
|
+
sketchColor,
|
|
4009
|
+
bowing,
|
|
4010
|
+
fillStyle,
|
|
4011
|
+
strokeWidth,
|
|
4012
|
+
animate,
|
|
4013
|
+
...rest
|
|
4014
|
+
}) {
|
|
4015
|
+
const resolvedSeed = useResolvedSeed(seed);
|
|
4016
|
+
const ink = sketchColor ?? SKETCH_COLORS.ink;
|
|
4017
|
+
return /* @__PURE__ */ jsx(
|
|
4018
|
+
DropdownMenuSketchContext.Provider,
|
|
4019
|
+
{
|
|
4020
|
+
value: {
|
|
4021
|
+
roughness,
|
|
4022
|
+
seed: resolvedSeed,
|
|
4023
|
+
sketchColor,
|
|
4024
|
+
bowing,
|
|
4025
|
+
fillStyle,
|
|
4026
|
+
strokeWidth,
|
|
4027
|
+
resolvedSeed,
|
|
4028
|
+
ink,
|
|
4029
|
+
animate
|
|
4030
|
+
},
|
|
4031
|
+
children: /* @__PURE__ */ jsx(DropdownMenuPrimitive.Root, { ...rest, children })
|
|
4032
|
+
}
|
|
4033
|
+
);
|
|
4034
|
+
}
|
|
4035
|
+
var DropdownMenuTrigger = DropdownMenuPrimitive.Trigger;
|
|
4036
|
+
var DropdownMenuGroup = DropdownMenuPrimitive.Group;
|
|
4037
|
+
var DropdownMenuRadioGroup = DropdownMenuPrimitive.RadioGroup;
|
|
4038
|
+
var DropdownMenuSub = DropdownMenuPrimitive.Sub;
|
|
4039
|
+
var DropdownMenuContent = forwardRef(function DropdownMenuContent2({ className, style, children, sideOffset = 6, align = "start", ...rest }, ref) {
|
|
4040
|
+
const sketch = useDropdownMenuSketch();
|
|
4041
|
+
return /* @__PURE__ */ jsx(DropdownMenuPrimitive.Portal, { children: /* @__PURE__ */ jsx(
|
|
4042
|
+
DropdownMenuPrimitive.Content,
|
|
4043
|
+
{
|
|
4044
|
+
ref,
|
|
4045
|
+
sideOffset,
|
|
4046
|
+
align,
|
|
4047
|
+
className: cn(className),
|
|
4048
|
+
style: { zIndex: 80, outline: "none", minWidth: 180, ...style },
|
|
4049
|
+
...rest,
|
|
4050
|
+
children: /* @__PURE__ */ jsx(
|
|
4051
|
+
SketchBox,
|
|
4052
|
+
{
|
|
4053
|
+
roughness: sketch.roughness,
|
|
4054
|
+
seed: sketch.resolvedSeed,
|
|
4055
|
+
sketchColor: sketch.ink,
|
|
4056
|
+
bowing: sketch.bowing,
|
|
4057
|
+
fillStyle: sketch.fillStyle ?? "solid",
|
|
4058
|
+
fill: "#f7f6f2",
|
|
4059
|
+
strokeWidth: sketch.strokeWidth ?? 1.5,
|
|
4060
|
+
shadow: true,
|
|
4061
|
+
animate: sketch.animate,
|
|
4062
|
+
contentStyle: { padding: "6px 4px" },
|
|
4063
|
+
children
|
|
4064
|
+
}
|
|
4065
|
+
)
|
|
4066
|
+
}
|
|
4067
|
+
) });
|
|
4068
|
+
});
|
|
4069
|
+
function useMark(highlighted) {
|
|
4070
|
+
const sketch = useDropdownMenuSketch();
|
|
4071
|
+
return { sketch, mark: highlighted };
|
|
4072
|
+
}
|
|
4073
|
+
var DropdownMenuItem = forwardRef(function DropdownMenuItem2({ className, style, children, inset, ...rest }, ref) {
|
|
4074
|
+
const [highlighted, setHighlighted] = useState(false);
|
|
4075
|
+
const { sketch, mark } = useMark(highlighted);
|
|
4076
|
+
return /* @__PURE__ */ jsxs(
|
|
4077
|
+
DropdownMenuPrimitive.Item,
|
|
4078
|
+
{
|
|
4079
|
+
ref,
|
|
4080
|
+
className: cn(className),
|
|
4081
|
+
onPointerMove: () => setHighlighted(true),
|
|
4082
|
+
onPointerLeave: () => setHighlighted(false),
|
|
4083
|
+
onFocus: () => setHighlighted(true),
|
|
4084
|
+
onBlur: () => setHighlighted(false),
|
|
4085
|
+
style: {
|
|
4086
|
+
position: "relative",
|
|
4087
|
+
display: "flex",
|
|
4088
|
+
alignItems: "center",
|
|
4089
|
+
gap: 8,
|
|
4090
|
+
padding: inset ? "7px 12px 7px 26px" : "7px 12px",
|
|
4091
|
+
fontFamily: doodleUiFontFamily,
|
|
4092
|
+
fontSize: 14,
|
|
4093
|
+
color: sketch.ink,
|
|
4094
|
+
outline: "none",
|
|
4095
|
+
cursor: "pointer",
|
|
4096
|
+
userSelect: "none",
|
|
4097
|
+
...style
|
|
4098
|
+
},
|
|
4099
|
+
...rest,
|
|
4100
|
+
children: [
|
|
4101
|
+
mark ? /* @__PURE__ */ jsx(
|
|
4102
|
+
RoughSvg,
|
|
4103
|
+
{
|
|
4104
|
+
shape: "line",
|
|
4105
|
+
roughness: (sketch.roughness ?? 1.5) + 0.4,
|
|
4106
|
+
seed: sketch.resolvedSeed,
|
|
4107
|
+
sketchColor: sketch.ink,
|
|
4108
|
+
bowing: sketch.bowing ?? 1.6,
|
|
4109
|
+
strokeWidth: 1.3,
|
|
4110
|
+
inset: 4,
|
|
4111
|
+
style: { opacity: 0.4 }
|
|
4112
|
+
}
|
|
4113
|
+
) : null,
|
|
4114
|
+
/* @__PURE__ */ jsx("span", { style: { position: "relative", zIndex: 1 }, children })
|
|
4115
|
+
]
|
|
4116
|
+
}
|
|
4117
|
+
);
|
|
4118
|
+
});
|
|
4119
|
+
var CHECK_PATH2 = "M 2 6 L 5 9 L 10 3";
|
|
4120
|
+
var DropdownMenuCheckboxItem = forwardRef(function DropdownMenuCheckboxItem2({ className, style, children, checked, ...rest }, ref) {
|
|
4121
|
+
const [highlighted, setHighlighted] = useState(false);
|
|
4122
|
+
const { sketch, mark } = useMark(highlighted);
|
|
4123
|
+
return /* @__PURE__ */ jsxs(
|
|
4124
|
+
DropdownMenuPrimitive.CheckboxItem,
|
|
4125
|
+
{
|
|
4126
|
+
ref,
|
|
4127
|
+
checked,
|
|
4128
|
+
className: cn(className),
|
|
4129
|
+
onPointerMove: () => setHighlighted(true),
|
|
4130
|
+
onPointerLeave: () => setHighlighted(false),
|
|
4131
|
+
style: {
|
|
4132
|
+
position: "relative",
|
|
4133
|
+
display: "flex",
|
|
4134
|
+
alignItems: "center",
|
|
4135
|
+
gap: 8,
|
|
4136
|
+
padding: "7px 12px 7px 26px",
|
|
4137
|
+
fontFamily: doodleUiFontFamily,
|
|
4138
|
+
fontSize: 14,
|
|
4139
|
+
color: sketch.ink,
|
|
4140
|
+
outline: "none",
|
|
4141
|
+
cursor: "pointer",
|
|
4142
|
+
userSelect: "none",
|
|
4143
|
+
...style
|
|
4144
|
+
},
|
|
4145
|
+
...rest,
|
|
4146
|
+
children: [
|
|
4147
|
+
mark ? /* @__PURE__ */ jsx(
|
|
4148
|
+
RoughSvg,
|
|
4149
|
+
{
|
|
4150
|
+
shape: "line",
|
|
4151
|
+
roughness: (sketch.roughness ?? 1.5) + 0.4,
|
|
4152
|
+
seed: sketch.resolvedSeed,
|
|
4153
|
+
sketchColor: sketch.ink,
|
|
4154
|
+
bowing: sketch.bowing ?? 1.6,
|
|
4155
|
+
strokeWidth: 1.3,
|
|
4156
|
+
inset: 4,
|
|
4157
|
+
style: { opacity: 0.4 }
|
|
4158
|
+
}
|
|
4159
|
+
) : null,
|
|
4160
|
+
/* @__PURE__ */ jsx(
|
|
4161
|
+
"span",
|
|
4162
|
+
{
|
|
4163
|
+
style: {
|
|
4164
|
+
position: "relative",
|
|
4165
|
+
width: 12,
|
|
4166
|
+
height: 12,
|
|
4167
|
+
flexShrink: 0,
|
|
4168
|
+
marginLeft: -18
|
|
4169
|
+
},
|
|
4170
|
+
children: /* @__PURE__ */ jsx(DropdownMenuPrimitive.ItemIndicator, { children: /* @__PURE__ */ jsx(
|
|
4171
|
+
RoughSvg,
|
|
4172
|
+
{
|
|
4173
|
+
shape: "path",
|
|
4174
|
+
path: CHECK_PATH2,
|
|
4175
|
+
roughness: (sketch.roughness ?? 1.5) * 0.7,
|
|
4176
|
+
seed: deriveSeed(sketch.resolvedSeed, "checkbox-mark"),
|
|
4177
|
+
sketchColor: SKETCH_COLORS.accent,
|
|
4178
|
+
bowing: sketch.bowing,
|
|
4179
|
+
strokeWidth: 1.6,
|
|
4180
|
+
inset: 0
|
|
4181
|
+
}
|
|
4182
|
+
) })
|
|
4183
|
+
}
|
|
4184
|
+
),
|
|
4185
|
+
/* @__PURE__ */ jsx("span", { style: { position: "relative", zIndex: 1 }, children })
|
|
4186
|
+
]
|
|
4187
|
+
}
|
|
4188
|
+
);
|
|
4189
|
+
});
|
|
4190
|
+
var DropdownMenuRadioItem = forwardRef(function DropdownMenuRadioItem2({ className, style, children, ...rest }, ref) {
|
|
4191
|
+
const [highlighted, setHighlighted] = useState(false);
|
|
4192
|
+
const { sketch, mark } = useMark(highlighted);
|
|
4193
|
+
return /* @__PURE__ */ jsxs(
|
|
4194
|
+
DropdownMenuPrimitive.RadioItem,
|
|
4195
|
+
{
|
|
4196
|
+
ref,
|
|
4197
|
+
className: cn(className),
|
|
4198
|
+
onPointerMove: () => setHighlighted(true),
|
|
4199
|
+
onPointerLeave: () => setHighlighted(false),
|
|
4200
|
+
style: {
|
|
4201
|
+
position: "relative",
|
|
4202
|
+
display: "flex",
|
|
4203
|
+
alignItems: "center",
|
|
4204
|
+
gap: 8,
|
|
4205
|
+
padding: "7px 12px 7px 26px",
|
|
4206
|
+
fontFamily: doodleUiFontFamily,
|
|
4207
|
+
fontSize: 14,
|
|
4208
|
+
color: sketch.ink,
|
|
4209
|
+
outline: "none",
|
|
4210
|
+
cursor: "pointer",
|
|
4211
|
+
userSelect: "none",
|
|
4212
|
+
...style
|
|
4213
|
+
},
|
|
4214
|
+
...rest,
|
|
4215
|
+
children: [
|
|
4216
|
+
mark ? /* @__PURE__ */ jsx(
|
|
4217
|
+
RoughSvg,
|
|
4218
|
+
{
|
|
4219
|
+
shape: "line",
|
|
4220
|
+
roughness: (sketch.roughness ?? 1.5) + 0.4,
|
|
4221
|
+
seed: sketch.resolvedSeed,
|
|
4222
|
+
sketchColor: sketch.ink,
|
|
4223
|
+
bowing: sketch.bowing ?? 1.6,
|
|
4224
|
+
strokeWidth: 1.3,
|
|
4225
|
+
inset: 4,
|
|
4226
|
+
style: { opacity: 0.4 }
|
|
4227
|
+
}
|
|
4228
|
+
) : null,
|
|
4229
|
+
/* @__PURE__ */ jsx(
|
|
4230
|
+
"span",
|
|
4231
|
+
{
|
|
4232
|
+
style: {
|
|
4233
|
+
position: "relative",
|
|
4234
|
+
width: 8,
|
|
4235
|
+
height: 8,
|
|
4236
|
+
flexShrink: 0,
|
|
4237
|
+
marginLeft: -18
|
|
4238
|
+
},
|
|
4239
|
+
children: /* @__PURE__ */ jsx(DropdownMenuPrimitive.ItemIndicator, { children: /* @__PURE__ */ jsx(
|
|
4240
|
+
RoughSvg,
|
|
4241
|
+
{
|
|
4242
|
+
shape: "ellipse",
|
|
4243
|
+
roughness: (sketch.roughness ?? 1.5) * 0.8,
|
|
4244
|
+
seed: deriveSeed(sketch.resolvedSeed, "radio-mark"),
|
|
4245
|
+
sketchColor: SKETCH_COLORS.accent,
|
|
4246
|
+
bowing: sketch.bowing,
|
|
4247
|
+
fillStyle: "solid",
|
|
4248
|
+
fill: SKETCH_COLORS.accent,
|
|
4249
|
+
strokeWidth: 1.2,
|
|
4250
|
+
inset: 0
|
|
4251
|
+
}
|
|
4252
|
+
) })
|
|
4253
|
+
}
|
|
4254
|
+
),
|
|
4255
|
+
/* @__PURE__ */ jsx("span", { style: { position: "relative", zIndex: 1 }, children })
|
|
4256
|
+
]
|
|
4257
|
+
}
|
|
4258
|
+
);
|
|
4259
|
+
});
|
|
4260
|
+
var DropdownMenuLabel = forwardRef(function DropdownMenuLabel2({ className, style, children, ...rest }, ref) {
|
|
4261
|
+
const sketch = useDropdownMenuSketch();
|
|
4262
|
+
return /* @__PURE__ */ jsx(
|
|
4263
|
+
DropdownMenuPrimitive.Label,
|
|
4264
|
+
{
|
|
4265
|
+
ref,
|
|
4266
|
+
className: cn(className),
|
|
4267
|
+
style: {
|
|
4268
|
+
padding: "6px 12px",
|
|
4269
|
+
fontFamily: doodleUiFontFamily,
|
|
4270
|
+
fontSize: 12,
|
|
4271
|
+
fontWeight: 700,
|
|
4272
|
+
color: sketch.ink,
|
|
4273
|
+
opacity: 0.6,
|
|
4274
|
+
textTransform: "uppercase",
|
|
4275
|
+
letterSpacing: 0.4,
|
|
4276
|
+
...style
|
|
4277
|
+
},
|
|
4278
|
+
...rest,
|
|
4279
|
+
children
|
|
4280
|
+
}
|
|
4281
|
+
);
|
|
4282
|
+
});
|
|
4283
|
+
var DropdownMenuSeparator = forwardRef(function DropdownMenuSeparator2({ className, style, ...rest }, ref) {
|
|
4284
|
+
const sketch = useDropdownMenuSketch();
|
|
4285
|
+
return /* @__PURE__ */ jsx(
|
|
4286
|
+
DropdownMenuPrimitive.Separator,
|
|
4287
|
+
{
|
|
4288
|
+
ref,
|
|
4289
|
+
className: cn(className),
|
|
4290
|
+
style: { position: "relative", height: 10, margin: "2px 0", ...style },
|
|
4291
|
+
...rest,
|
|
4292
|
+
children: /* @__PURE__ */ jsx(
|
|
4293
|
+
RoughSvg,
|
|
4294
|
+
{
|
|
4295
|
+
shape: "line",
|
|
4296
|
+
roughness: (sketch.roughness ?? 1.5) + 0.2,
|
|
4297
|
+
seed: deriveSeed(sketch.resolvedSeed, "separator"),
|
|
4298
|
+
sketchColor: sketch.ink,
|
|
4299
|
+
bowing: sketch.bowing ?? 1.8,
|
|
4300
|
+
strokeWidth: 1.2,
|
|
4301
|
+
inset: 6,
|
|
4302
|
+
style: { opacity: 0.5 }
|
|
4303
|
+
}
|
|
4304
|
+
)
|
|
4305
|
+
}
|
|
4306
|
+
);
|
|
4307
|
+
});
|
|
4308
|
+
var DialogSketchContext = createContext(
|
|
4309
|
+
null
|
|
4310
|
+
);
|
|
4311
|
+
function useDialogSketch() {
|
|
4312
|
+
const ctx = useContext(DialogSketchContext);
|
|
4313
|
+
if (!ctx) {
|
|
4314
|
+
throw new Error("Dialog parts must be used inside <Dialog>.");
|
|
4315
|
+
}
|
|
4316
|
+
return ctx;
|
|
4317
|
+
}
|
|
4318
|
+
function Dialog2({
|
|
4319
|
+
children,
|
|
4320
|
+
open,
|
|
4321
|
+
defaultOpen,
|
|
4322
|
+
onOpenChange,
|
|
4323
|
+
roughness,
|
|
4324
|
+
seed,
|
|
4325
|
+
sketchColor,
|
|
4326
|
+
bowing,
|
|
4327
|
+
fillStyle,
|
|
4328
|
+
strokeWidth,
|
|
4329
|
+
animate,
|
|
4330
|
+
...rest
|
|
4331
|
+
}) {
|
|
4332
|
+
const resolvedSeed = useResolvedSeed(seed);
|
|
4333
|
+
const ink = sketchColor ?? SKETCH_COLORS.ink;
|
|
4334
|
+
const [uncontrolled, setUncontrolled] = useState(defaultOpen === true);
|
|
4335
|
+
const isOpen = open ?? uncontrolled;
|
|
4336
|
+
return /* @__PURE__ */ jsx(
|
|
4337
|
+
DialogSketchContext.Provider,
|
|
4338
|
+
{
|
|
4339
|
+
value: {
|
|
4340
|
+
roughness,
|
|
4341
|
+
seed: resolvedSeed,
|
|
4342
|
+
sketchColor,
|
|
4343
|
+
bowing,
|
|
4344
|
+
fillStyle,
|
|
4345
|
+
strokeWidth,
|
|
4346
|
+
resolvedSeed,
|
|
4347
|
+
ink,
|
|
4348
|
+
animate,
|
|
4349
|
+
open: isOpen
|
|
4350
|
+
},
|
|
4351
|
+
children: /* @__PURE__ */ jsx(
|
|
4352
|
+
Dialog.Root,
|
|
4353
|
+
{
|
|
4354
|
+
open: isOpen,
|
|
4355
|
+
onOpenChange: (next) => {
|
|
4356
|
+
setUncontrolled(next);
|
|
4357
|
+
onOpenChange?.(next);
|
|
4358
|
+
},
|
|
4359
|
+
...rest,
|
|
4360
|
+
children
|
|
4361
|
+
}
|
|
4362
|
+
)
|
|
4363
|
+
}
|
|
4364
|
+
);
|
|
4365
|
+
}
|
|
4366
|
+
var DialogTrigger = Dialog.Trigger;
|
|
4367
|
+
var DialogPortal = Dialog.Portal;
|
|
4368
|
+
var DialogClose = Dialog.Close;
|
|
4369
|
+
var DialogOverlay = forwardRef(
|
|
4370
|
+
function DialogOverlay2({ style, ...rest }, ref) {
|
|
4371
|
+
const sketch = useDialogSketch();
|
|
4372
|
+
const shouldAnimate = useAnimate(sketch.animate);
|
|
4373
|
+
return /* @__PURE__ */ jsx(Dialog.Overlay, { ref, asChild: true, forceMount: true, ...rest, children: /* @__PURE__ */ jsx(
|
|
4374
|
+
motion.div,
|
|
4375
|
+
{
|
|
4376
|
+
initial: shouldAnimate ? { opacity: 0 } : false,
|
|
4377
|
+
animate: { opacity: 1 },
|
|
4378
|
+
exit: shouldAnimate ? { opacity: 0 } : void 0,
|
|
4379
|
+
transition: shouldAnimate ? { duration: 0.2, ease: "easeOut" } : { duration: 0 },
|
|
4380
|
+
style: {
|
|
4381
|
+
position: "fixed",
|
|
4382
|
+
inset: 0,
|
|
4383
|
+
background: "rgba(31, 29, 26, 0.38)",
|
|
4384
|
+
zIndex: 70,
|
|
4385
|
+
...style
|
|
4386
|
+
}
|
|
4387
|
+
}
|
|
4388
|
+
) });
|
|
4389
|
+
}
|
|
4390
|
+
);
|
|
4391
|
+
var DialogContent = forwardRef(
|
|
4392
|
+
function DialogContent2({ className, style, contentStyle, children, ...rest }, ref) {
|
|
4393
|
+
const sketch = useDialogSketch();
|
|
4394
|
+
const shouldAnimate = useAnimate(sketch.animate);
|
|
4395
|
+
return /* @__PURE__ */ jsx(AnimatePresence, { children: sketch.open ? /* @__PURE__ */ jsxs(Dialog.Portal, { forceMount: true, children: [
|
|
4396
|
+
/* @__PURE__ */ jsx(DialogOverlay, {}),
|
|
4397
|
+
/* @__PURE__ */ jsx(
|
|
4398
|
+
"div",
|
|
4399
|
+
{
|
|
4400
|
+
style: {
|
|
4401
|
+
position: "fixed",
|
|
4402
|
+
inset: 0,
|
|
4403
|
+
zIndex: 80,
|
|
4404
|
+
display: "flex",
|
|
4405
|
+
alignItems: "center",
|
|
4406
|
+
justifyContent: "center",
|
|
4407
|
+
pointerEvents: "none",
|
|
4408
|
+
padding: 16
|
|
4409
|
+
},
|
|
4410
|
+
children: /* @__PURE__ */ jsx(Dialog.Content, { ref, asChild: true, forceMount: true, ...rest, children: /* @__PURE__ */ jsx(
|
|
4411
|
+
motion.div,
|
|
4412
|
+
{
|
|
4413
|
+
className: cn(className),
|
|
4414
|
+
initial: shouldAnimate ? { opacity: 0, scale: 0.96, y: 10 } : false,
|
|
4415
|
+
animate: { opacity: 1, scale: 1, y: 0 },
|
|
4416
|
+
exit: shouldAnimate ? { opacity: 0, scale: 0.96, y: 8 } : void 0,
|
|
4417
|
+
transition: shouldAnimate ? { duration: 0.22, ease: "easeOut" } : { duration: 0 },
|
|
4418
|
+
style: {
|
|
4419
|
+
width: "min(420px, calc(100vw - 32px))",
|
|
4420
|
+
outline: "none",
|
|
4421
|
+
pointerEvents: "auto",
|
|
4422
|
+
...style
|
|
4423
|
+
},
|
|
4424
|
+
children: /* @__PURE__ */ jsx(
|
|
4425
|
+
SketchBox,
|
|
4426
|
+
{
|
|
4427
|
+
roughness: sketch.roughness,
|
|
4428
|
+
seed: sketch.resolvedSeed,
|
|
4429
|
+
sketchColor: sketch.ink,
|
|
4430
|
+
bowing: sketch.bowing,
|
|
4431
|
+
fillStyle: sketch.fillStyle ?? "solid",
|
|
4432
|
+
fill: "#f7f6f2",
|
|
4433
|
+
strokeWidth: sketch.strokeWidth ?? 2,
|
|
4434
|
+
animate: sketch.animate,
|
|
4435
|
+
contentStyle: { padding: 20, ...contentStyle },
|
|
4436
|
+
children
|
|
4437
|
+
}
|
|
4438
|
+
)
|
|
4439
|
+
}
|
|
4440
|
+
) })
|
|
4441
|
+
}
|
|
4442
|
+
)
|
|
4443
|
+
] }) : null });
|
|
4444
|
+
}
|
|
4445
|
+
);
|
|
4446
|
+
function DialogHeader({ children, className, style }) {
|
|
4447
|
+
return /* @__PURE__ */ jsx(
|
|
4448
|
+
"div",
|
|
4449
|
+
{
|
|
4450
|
+
className: cn(className),
|
|
4451
|
+
style: {
|
|
4452
|
+
display: "flex",
|
|
4453
|
+
flexDirection: "column",
|
|
4454
|
+
gap: 6,
|
|
4455
|
+
marginBottom: 12,
|
|
4456
|
+
...style
|
|
4457
|
+
},
|
|
4458
|
+
children
|
|
4459
|
+
}
|
|
4460
|
+
);
|
|
4461
|
+
}
|
|
4462
|
+
function DialogFooter({ children, className, style }) {
|
|
4463
|
+
return /* @__PURE__ */ jsx(
|
|
4464
|
+
"div",
|
|
4465
|
+
{
|
|
4466
|
+
className: cn(className),
|
|
4467
|
+
style: {
|
|
4468
|
+
display: "flex",
|
|
4469
|
+
justifyContent: "flex-end",
|
|
4470
|
+
gap: 8,
|
|
4471
|
+
marginTop: 16,
|
|
4472
|
+
...style
|
|
4473
|
+
},
|
|
4474
|
+
children
|
|
4475
|
+
}
|
|
4476
|
+
);
|
|
4477
|
+
}
|
|
4478
|
+
var DialogTitle = forwardRef(
|
|
4479
|
+
function DialogTitle2({ style, ...rest }, ref) {
|
|
4480
|
+
const sketch = useDialogSketch();
|
|
4481
|
+
return /* @__PURE__ */ jsx(
|
|
4482
|
+
Dialog.Title,
|
|
4483
|
+
{
|
|
4484
|
+
ref,
|
|
4485
|
+
style: {
|
|
4486
|
+
margin: 0,
|
|
4487
|
+
fontSize: 18,
|
|
4488
|
+
fontWeight: doodleUiFontWeight(700),
|
|
4489
|
+
fontFamily: doodleUiFontFamily,
|
|
4490
|
+
color: sketch.ink,
|
|
4491
|
+
...style
|
|
4492
|
+
},
|
|
4493
|
+
...rest
|
|
4494
|
+
}
|
|
4495
|
+
);
|
|
4496
|
+
}
|
|
4497
|
+
);
|
|
4498
|
+
var DialogDescription = forwardRef(function DialogDescription2({ style, ...rest }, ref) {
|
|
4499
|
+
const sketch = useDialogSketch();
|
|
4500
|
+
return /* @__PURE__ */ jsx(
|
|
4501
|
+
Dialog.Description,
|
|
4502
|
+
{
|
|
4503
|
+
ref,
|
|
4504
|
+
style: {
|
|
4505
|
+
margin: 0,
|
|
4506
|
+
fontSize: 14,
|
|
4507
|
+
lineHeight: 1.5,
|
|
4508
|
+
fontFamily: doodleUiFontFamily,
|
|
4509
|
+
color: sketch.ink,
|
|
4510
|
+
opacity: 0.8,
|
|
4511
|
+
...style
|
|
4512
|
+
},
|
|
4513
|
+
...rest
|
|
4514
|
+
}
|
|
4515
|
+
);
|
|
4516
|
+
});
|
|
4517
|
+
var AlertDialogSketchContext = createContext(null);
|
|
4518
|
+
function useAlertDialogSketch() {
|
|
4519
|
+
const ctx = useContext(AlertDialogSketchContext);
|
|
4520
|
+
if (!ctx) {
|
|
4521
|
+
throw new Error(
|
|
4522
|
+
"AlertDialog parts must be used inside <AlertDialog>."
|
|
4523
|
+
);
|
|
4524
|
+
}
|
|
4525
|
+
return ctx;
|
|
4526
|
+
}
|
|
4527
|
+
function AlertDialog({
|
|
4528
|
+
children,
|
|
4529
|
+
open,
|
|
4530
|
+
defaultOpen,
|
|
4531
|
+
onOpenChange,
|
|
4532
|
+
roughness,
|
|
4533
|
+
seed,
|
|
4534
|
+
sketchColor,
|
|
4535
|
+
bowing,
|
|
4536
|
+
fillStyle,
|
|
4537
|
+
strokeWidth,
|
|
4538
|
+
animate,
|
|
4539
|
+
...rest
|
|
4540
|
+
}) {
|
|
4541
|
+
const resolvedSeed = useResolvedSeed(seed);
|
|
4542
|
+
const ink = sketchColor ?? SKETCH_COLORS.ink;
|
|
4543
|
+
const [uncontrolled, setUncontrolled] = useState(defaultOpen === true);
|
|
4544
|
+
const isOpen = open ?? uncontrolled;
|
|
4545
|
+
return /* @__PURE__ */ jsx(
|
|
4546
|
+
AlertDialogSketchContext.Provider,
|
|
4547
|
+
{
|
|
4548
|
+
value: {
|
|
4549
|
+
roughness,
|
|
4550
|
+
seed: resolvedSeed,
|
|
4551
|
+
sketchColor,
|
|
4552
|
+
bowing,
|
|
4553
|
+
fillStyle,
|
|
4554
|
+
strokeWidth,
|
|
4555
|
+
resolvedSeed,
|
|
4556
|
+
ink,
|
|
4557
|
+
animate,
|
|
4558
|
+
open: isOpen
|
|
4559
|
+
},
|
|
4560
|
+
children: /* @__PURE__ */ jsx(
|
|
4561
|
+
AlertDialogPrimitive.Root,
|
|
4562
|
+
{
|
|
4563
|
+
open: isOpen,
|
|
4564
|
+
onOpenChange: (next) => {
|
|
4565
|
+
setUncontrolled(next);
|
|
4566
|
+
onOpenChange?.(next);
|
|
4567
|
+
},
|
|
4568
|
+
...rest,
|
|
4569
|
+
children
|
|
4570
|
+
}
|
|
4571
|
+
)
|
|
4572
|
+
}
|
|
4573
|
+
);
|
|
4574
|
+
}
|
|
4575
|
+
var AlertDialogTrigger = AlertDialogPrimitive.Trigger;
|
|
4576
|
+
var AlertDialogPortal = AlertDialogPrimitive.Portal;
|
|
4577
|
+
var AlertDialogOverlay = forwardRef(function AlertDialogOverlay2({ style, ...rest }, ref) {
|
|
4578
|
+
const sketch = useAlertDialogSketch();
|
|
4579
|
+
const shouldAnimate = useAnimate(sketch.animate);
|
|
4580
|
+
return /* @__PURE__ */ jsx(AlertDialogPrimitive.Overlay, { ref, asChild: true, forceMount: true, ...rest, children: /* @__PURE__ */ jsx(
|
|
4581
|
+
motion.div,
|
|
4582
|
+
{
|
|
4583
|
+
initial: shouldAnimate ? { opacity: 0 } : false,
|
|
4584
|
+
animate: { opacity: 1 },
|
|
4585
|
+
exit: shouldAnimate ? { opacity: 0 } : void 0,
|
|
4586
|
+
transition: shouldAnimate ? { duration: 0.2, ease: "easeOut" } : { duration: 0 },
|
|
4587
|
+
style: {
|
|
4588
|
+
position: "fixed",
|
|
4589
|
+
inset: 0,
|
|
4590
|
+
background: "rgba(31, 29, 26, 0.38)",
|
|
4591
|
+
zIndex: 70,
|
|
4592
|
+
...style
|
|
4593
|
+
}
|
|
4594
|
+
}
|
|
4595
|
+
) });
|
|
4596
|
+
});
|
|
4597
|
+
var AlertDialogContent = forwardRef(function AlertDialogContent2({ className, style, contentStyle, children, ...rest }, ref) {
|
|
4598
|
+
const sketch = useAlertDialogSketch();
|
|
4599
|
+
const shouldAnimate = useAnimate(sketch.animate);
|
|
4600
|
+
return /* @__PURE__ */ jsx(AnimatePresence, { children: sketch.open ? /* @__PURE__ */ jsxs(AlertDialogPrimitive.Portal, { forceMount: true, children: [
|
|
4601
|
+
/* @__PURE__ */ jsx(AlertDialogOverlay, {}),
|
|
4602
|
+
/* @__PURE__ */ jsx(
|
|
4603
|
+
"div",
|
|
4604
|
+
{
|
|
4605
|
+
style: {
|
|
4606
|
+
position: "fixed",
|
|
4607
|
+
inset: 0,
|
|
4608
|
+
zIndex: 80,
|
|
4609
|
+
display: "flex",
|
|
4610
|
+
alignItems: "center",
|
|
4611
|
+
justifyContent: "center",
|
|
4612
|
+
pointerEvents: "none",
|
|
4613
|
+
padding: 16
|
|
4614
|
+
},
|
|
4615
|
+
children: /* @__PURE__ */ jsx(AlertDialogPrimitive.Content, { ref, asChild: true, forceMount: true, ...rest, children: /* @__PURE__ */ jsx(
|
|
4616
|
+
motion.div,
|
|
4617
|
+
{
|
|
4618
|
+
className: cn(className),
|
|
4619
|
+
initial: shouldAnimate ? { opacity: 0, scale: 0.96, y: 10 } : false,
|
|
4620
|
+
animate: { opacity: 1, scale: 1, y: 0 },
|
|
4621
|
+
exit: shouldAnimate ? { opacity: 0, scale: 0.96, y: 8 } : void 0,
|
|
4622
|
+
transition: shouldAnimate ? { duration: 0.22, ease: "easeOut" } : { duration: 0 },
|
|
4623
|
+
style: {
|
|
4624
|
+
width: "min(420px, calc(100vw - 32px))",
|
|
4625
|
+
outline: "none",
|
|
4626
|
+
pointerEvents: "auto",
|
|
4627
|
+
...style
|
|
4628
|
+
},
|
|
4629
|
+
children: /* @__PURE__ */ jsx(
|
|
4630
|
+
SketchBox,
|
|
4631
|
+
{
|
|
4632
|
+
roughness: sketch.roughness,
|
|
4633
|
+
seed: sketch.resolvedSeed,
|
|
4634
|
+
sketchColor: sketch.ink,
|
|
4635
|
+
bowing: sketch.bowing,
|
|
4636
|
+
fillStyle: sketch.fillStyle ?? "solid",
|
|
4637
|
+
fill: "#f7f6f2",
|
|
4638
|
+
strokeWidth: sketch.strokeWidth ?? 2,
|
|
4639
|
+
animate: sketch.animate,
|
|
4640
|
+
contentStyle: { padding: 20, ...contentStyle },
|
|
4641
|
+
children
|
|
4642
|
+
}
|
|
4643
|
+
)
|
|
4644
|
+
}
|
|
4645
|
+
) })
|
|
4646
|
+
}
|
|
4647
|
+
)
|
|
4648
|
+
] }) : null });
|
|
4649
|
+
});
|
|
4650
|
+
function AlertDialogHeader({
|
|
4651
|
+
children,
|
|
4652
|
+
className,
|
|
4653
|
+
style
|
|
4654
|
+
}) {
|
|
4655
|
+
return /* @__PURE__ */ jsx(
|
|
4656
|
+
"div",
|
|
4657
|
+
{
|
|
4658
|
+
className: cn(className),
|
|
4659
|
+
style: {
|
|
4660
|
+
display: "flex",
|
|
4661
|
+
flexDirection: "column",
|
|
4662
|
+
gap: 6,
|
|
4663
|
+
marginBottom: 12,
|
|
4664
|
+
...style
|
|
4665
|
+
},
|
|
4666
|
+
children
|
|
4667
|
+
}
|
|
4668
|
+
);
|
|
4669
|
+
}
|
|
4670
|
+
function AlertDialogFooter({
|
|
4671
|
+
children,
|
|
4672
|
+
className,
|
|
4673
|
+
style
|
|
4674
|
+
}) {
|
|
4675
|
+
return /* @__PURE__ */ jsx(
|
|
4676
|
+
"div",
|
|
4677
|
+
{
|
|
4678
|
+
className: cn(className),
|
|
4679
|
+
style: {
|
|
4680
|
+
display: "flex",
|
|
4681
|
+
justifyContent: "flex-end",
|
|
4682
|
+
gap: 8,
|
|
4683
|
+
marginTop: 16,
|
|
4684
|
+
...style
|
|
4685
|
+
},
|
|
4686
|
+
children
|
|
4687
|
+
}
|
|
4688
|
+
);
|
|
4689
|
+
}
|
|
4690
|
+
var AlertDialogTitle = forwardRef(function AlertDialogTitle2({ style, ...rest }, ref) {
|
|
4691
|
+
const sketch = useAlertDialogSketch();
|
|
4692
|
+
return /* @__PURE__ */ jsx(
|
|
4693
|
+
AlertDialogPrimitive.Title,
|
|
4694
|
+
{
|
|
4695
|
+
ref,
|
|
4696
|
+
style: {
|
|
4697
|
+
margin: 0,
|
|
4698
|
+
fontSize: 18,
|
|
4699
|
+
fontWeight: doodleUiFontWeight(700),
|
|
4700
|
+
fontFamily: doodleUiFontFamily,
|
|
4701
|
+
color: sketch.ink,
|
|
4702
|
+
...style
|
|
4703
|
+
},
|
|
4704
|
+
...rest
|
|
4705
|
+
}
|
|
4706
|
+
);
|
|
4707
|
+
});
|
|
4708
|
+
var AlertDialogDescription = forwardRef(function AlertDialogDescription2({ style, ...rest }, ref) {
|
|
4709
|
+
const sketch = useAlertDialogSketch();
|
|
4710
|
+
return /* @__PURE__ */ jsx(
|
|
4711
|
+
AlertDialogPrimitive.Description,
|
|
4712
|
+
{
|
|
4713
|
+
ref,
|
|
4714
|
+
style: {
|
|
4715
|
+
margin: 0,
|
|
4716
|
+
fontSize: 14,
|
|
4717
|
+
lineHeight: 1.5,
|
|
4718
|
+
fontFamily: doodleUiFontFamily,
|
|
4719
|
+
color: sketch.ink,
|
|
4720
|
+
opacity: 0.8,
|
|
4721
|
+
...style
|
|
4722
|
+
},
|
|
4723
|
+
...rest
|
|
4724
|
+
}
|
|
4725
|
+
);
|
|
4726
|
+
});
|
|
4727
|
+
var AlertDialogAction = forwardRef(function AlertDialogAction2({ children, ...rest }, ref) {
|
|
4728
|
+
const sketch = useAlertDialogSketch();
|
|
4729
|
+
return /* @__PURE__ */ jsx(AlertDialogPrimitive.Action, { asChild: true, children: /* @__PURE__ */ jsx(
|
|
4730
|
+
Button,
|
|
4731
|
+
{
|
|
4732
|
+
ref,
|
|
4733
|
+
variant: "primary",
|
|
4734
|
+
sketchColor: sketch.sketchColor,
|
|
4735
|
+
roughness: sketch.roughness,
|
|
4736
|
+
seed: sketch.resolvedSeed,
|
|
4737
|
+
bowing: sketch.bowing,
|
|
4738
|
+
animate: sketch.animate,
|
|
4739
|
+
...rest,
|
|
4740
|
+
children
|
|
4741
|
+
}
|
|
4742
|
+
) });
|
|
4743
|
+
});
|
|
4744
|
+
var AlertDialogCancel = forwardRef(function AlertDialogCancel2({ children, ...rest }, ref) {
|
|
4745
|
+
const sketch = useAlertDialogSketch();
|
|
4746
|
+
return /* @__PURE__ */ jsx(AlertDialogPrimitive.Cancel, { asChild: true, children: /* @__PURE__ */ jsx(
|
|
4747
|
+
Button,
|
|
4748
|
+
{
|
|
4749
|
+
ref,
|
|
4750
|
+
variant: "outline",
|
|
4751
|
+
sketchColor: sketch.sketchColor,
|
|
4752
|
+
roughness: sketch.roughness,
|
|
4753
|
+
seed: sketch.resolvedSeed,
|
|
4754
|
+
bowing: sketch.bowing,
|
|
4755
|
+
animate: sketch.animate,
|
|
4756
|
+
...rest,
|
|
4757
|
+
children
|
|
4758
|
+
}
|
|
4759
|
+
) });
|
|
4760
|
+
});
|
|
4761
|
+
var CommandSketchContext = createContext(
|
|
4762
|
+
null
|
|
4763
|
+
);
|
|
4764
|
+
function useCommandSketch() {
|
|
4765
|
+
const ctx = useContext(CommandSketchContext);
|
|
4766
|
+
if (!ctx) {
|
|
4767
|
+
throw new Error("Command parts must be used inside <Command>.");
|
|
4768
|
+
}
|
|
4769
|
+
return ctx;
|
|
4770
|
+
}
|
|
4771
|
+
var Command = forwardRef(
|
|
4772
|
+
function Command2({
|
|
4773
|
+
className,
|
|
4774
|
+
style,
|
|
4775
|
+
children,
|
|
4776
|
+
roughness,
|
|
4777
|
+
seed,
|
|
4778
|
+
sketchColor,
|
|
4779
|
+
bowing,
|
|
4780
|
+
fillStyle,
|
|
4781
|
+
strokeWidth,
|
|
4782
|
+
animate,
|
|
4783
|
+
...rest
|
|
4784
|
+
}, ref) {
|
|
4785
|
+
const resolvedSeed = useResolvedSeed(seed);
|
|
4786
|
+
const ink = sketchColor ?? SKETCH_COLORS.ink;
|
|
4787
|
+
return /* @__PURE__ */ jsx(
|
|
4788
|
+
CommandSketchContext.Provider,
|
|
4789
|
+
{
|
|
4790
|
+
value: {
|
|
4791
|
+
roughness,
|
|
4792
|
+
seed: resolvedSeed,
|
|
4793
|
+
sketchColor,
|
|
4794
|
+
bowing,
|
|
4795
|
+
fillStyle,
|
|
4796
|
+
strokeWidth,
|
|
4797
|
+
resolvedSeed,
|
|
4798
|
+
ink,
|
|
4799
|
+
animate
|
|
4800
|
+
},
|
|
4801
|
+
children: /* @__PURE__ */ jsx(
|
|
4802
|
+
SketchBox,
|
|
4803
|
+
{
|
|
4804
|
+
className: cn(className),
|
|
4805
|
+
style,
|
|
4806
|
+
roughness,
|
|
4807
|
+
seed: resolvedSeed,
|
|
4808
|
+
sketchColor: ink,
|
|
4809
|
+
bowing,
|
|
4810
|
+
fillStyle: fillStyle ?? "solid",
|
|
4811
|
+
fill: "#f7f6f2",
|
|
4812
|
+
strokeWidth: strokeWidth ?? 1.5,
|
|
4813
|
+
animate,
|
|
4814
|
+
contentStyle: { padding: 0, display: "flex", flexDirection: "column" },
|
|
4815
|
+
children: /* @__PURE__ */ jsx(Command$1, { ref, ...rest, children })
|
|
4816
|
+
}
|
|
4817
|
+
)
|
|
4818
|
+
}
|
|
4819
|
+
);
|
|
4820
|
+
}
|
|
4821
|
+
);
|
|
4822
|
+
var CommandInput = forwardRef(
|
|
4823
|
+
function CommandInput2({ className, style, ...rest }, ref) {
|
|
4824
|
+
const sketch = useCommandSketch();
|
|
4825
|
+
return /* @__PURE__ */ jsxs("div", { style: { position: "relative", padding: "10px 12px 12px" }, children: [
|
|
4826
|
+
/* @__PURE__ */ jsx(
|
|
4827
|
+
CommandInput$1,
|
|
4828
|
+
{
|
|
4829
|
+
ref,
|
|
4830
|
+
className: cn(className),
|
|
4831
|
+
style: {
|
|
4832
|
+
width: "100%",
|
|
4833
|
+
boxSizing: "border-box",
|
|
4834
|
+
border: "none",
|
|
4835
|
+
outline: "none",
|
|
4836
|
+
background: "transparent",
|
|
4837
|
+
color: sketch.ink,
|
|
4838
|
+
fontFamily: doodleUiFontFamily,
|
|
4839
|
+
fontSize: 15,
|
|
4840
|
+
padding: "2px 2px 8px",
|
|
4841
|
+
...style
|
|
4842
|
+
},
|
|
4843
|
+
...rest
|
|
4844
|
+
}
|
|
4845
|
+
),
|
|
4846
|
+
/* @__PURE__ */ jsx(
|
|
4847
|
+
RoughSvg,
|
|
4848
|
+
{
|
|
4849
|
+
shape: "line",
|
|
4850
|
+
roughness: (sketch.roughness ?? 1.5) + 0.2,
|
|
4851
|
+
seed: deriveSeed(sketch.resolvedSeed, "command-divider"),
|
|
4852
|
+
sketchColor: sketch.ink,
|
|
4853
|
+
bowing: sketch.bowing ?? 1.6,
|
|
4854
|
+
strokeWidth: 1.2,
|
|
4855
|
+
inset: 4,
|
|
4856
|
+
style: { position: "absolute", bottom: 0, left: 0, right: 0, height: 8, opacity: 0.4 }
|
|
4857
|
+
}
|
|
4858
|
+
)
|
|
4859
|
+
] });
|
|
4860
|
+
}
|
|
4861
|
+
);
|
|
4862
|
+
var CommandList = forwardRef(
|
|
4863
|
+
function CommandList2({ className, style, ...rest }, ref) {
|
|
4864
|
+
return /* @__PURE__ */ jsx(
|
|
4865
|
+
CommandList$1,
|
|
4866
|
+
{
|
|
4867
|
+
ref,
|
|
4868
|
+
className: cn(className),
|
|
4869
|
+
style: {
|
|
4870
|
+
maxHeight: 280,
|
|
4871
|
+
overflowY: "auto",
|
|
4872
|
+
padding: "4px 4px 8px",
|
|
4873
|
+
...style
|
|
4874
|
+
},
|
|
4875
|
+
...rest
|
|
4876
|
+
}
|
|
4877
|
+
);
|
|
4878
|
+
}
|
|
4879
|
+
);
|
|
4880
|
+
var CommandEmpty = forwardRef(
|
|
4881
|
+
function CommandEmpty2({ className, style, ...rest }, ref) {
|
|
4882
|
+
const sketch = useCommandSketch();
|
|
4883
|
+
return /* @__PURE__ */ jsx(
|
|
4884
|
+
CommandEmpty$1,
|
|
4885
|
+
{
|
|
4886
|
+
ref,
|
|
4887
|
+
className: cn(className),
|
|
4888
|
+
style: {
|
|
4889
|
+
padding: "16px 12px",
|
|
4890
|
+
textAlign: "center",
|
|
4891
|
+
fontFamily: doodleUiFontFamily,
|
|
4892
|
+
fontSize: 14,
|
|
4893
|
+
color: sketch.ink,
|
|
4894
|
+
opacity: 0.6,
|
|
4895
|
+
...style
|
|
4896
|
+
},
|
|
4897
|
+
...rest
|
|
4898
|
+
}
|
|
4899
|
+
);
|
|
4900
|
+
}
|
|
4901
|
+
);
|
|
4902
|
+
var CommandGroup = forwardRef(
|
|
4903
|
+
function CommandGroup2({ className, style, ...rest }, ref) {
|
|
4904
|
+
const sketch = useCommandSketch();
|
|
4905
|
+
return /* @__PURE__ */ jsx(
|
|
4906
|
+
CommandGroup$1,
|
|
4907
|
+
{
|
|
4908
|
+
ref,
|
|
4909
|
+
className: cn(className),
|
|
4910
|
+
style: { padding: "4px 2px", color: sketch.ink, ...style },
|
|
4911
|
+
...rest
|
|
4912
|
+
}
|
|
4913
|
+
);
|
|
4914
|
+
}
|
|
4915
|
+
);
|
|
4916
|
+
var CommandItem = forwardRef(
|
|
4917
|
+
function CommandItem2({ className, style, children, onMouseEnter, onMouseLeave, ...rest }, ref) {
|
|
4918
|
+
const sketch = useCommandSketch();
|
|
4919
|
+
const [highlighted, setHighlighted] = useState(false);
|
|
4920
|
+
return /* @__PURE__ */ jsxs(
|
|
4921
|
+
CommandItem$1,
|
|
4922
|
+
{
|
|
4923
|
+
ref,
|
|
4924
|
+
className: cn(className),
|
|
4925
|
+
onMouseEnter: (event) => {
|
|
4926
|
+
setHighlighted(true);
|
|
4927
|
+
onMouseEnter?.(event);
|
|
4928
|
+
},
|
|
4929
|
+
onMouseLeave: (event) => {
|
|
4930
|
+
setHighlighted(false);
|
|
4931
|
+
onMouseLeave?.(event);
|
|
4932
|
+
},
|
|
4933
|
+
style: {
|
|
4934
|
+
position: "relative",
|
|
4935
|
+
display: "flex",
|
|
4936
|
+
alignItems: "center",
|
|
4937
|
+
gap: 8,
|
|
4938
|
+
padding: "7px 10px",
|
|
4939
|
+
borderRadius: 4,
|
|
4940
|
+
fontFamily: doodleUiFontFamily,
|
|
4941
|
+
fontSize: 14,
|
|
4942
|
+
color: sketch.ink,
|
|
4943
|
+
cursor: "pointer",
|
|
4944
|
+
userSelect: "none",
|
|
4945
|
+
outline: "none",
|
|
4946
|
+
...style
|
|
4947
|
+
},
|
|
4948
|
+
...rest,
|
|
4949
|
+
children: [
|
|
4950
|
+
highlighted ? /* @__PURE__ */ jsx(
|
|
4951
|
+
RoughSvg,
|
|
4952
|
+
{
|
|
4953
|
+
shape: "line",
|
|
4954
|
+
roughness: (sketch.roughness ?? 1.5) + 0.4,
|
|
4955
|
+
seed: sketch.resolvedSeed,
|
|
4956
|
+
sketchColor: sketch.ink,
|
|
4957
|
+
bowing: sketch.bowing ?? 1.6,
|
|
4958
|
+
strokeWidth: 1.3,
|
|
4959
|
+
inset: 3,
|
|
4960
|
+
style: { opacity: 0.4 }
|
|
4961
|
+
}
|
|
4962
|
+
) : null,
|
|
4963
|
+
/* @__PURE__ */ jsx("span", { style: { position: "relative", zIndex: 1, flex: 1 }, children })
|
|
4964
|
+
]
|
|
4965
|
+
}
|
|
4966
|
+
);
|
|
4967
|
+
}
|
|
4968
|
+
);
|
|
4969
|
+
var CommandSeparator = forwardRef(function CommandSeparator2({ className, style, ...rest }, ref) {
|
|
4970
|
+
const sketch = useCommandSketch();
|
|
4971
|
+
return /* @__PURE__ */ jsx(
|
|
4972
|
+
CommandSeparator$1,
|
|
4973
|
+
{
|
|
4974
|
+
ref,
|
|
4975
|
+
className: cn(className),
|
|
4976
|
+
style: { position: "relative", height: 10, margin: "2px 4px", ...style },
|
|
4977
|
+
...rest,
|
|
4978
|
+
children: /* @__PURE__ */ jsx(
|
|
4979
|
+
RoughSvg,
|
|
4980
|
+
{
|
|
4981
|
+
shape: "line",
|
|
4982
|
+
roughness: (sketch.roughness ?? 1.5) + 0.2,
|
|
4983
|
+
seed: deriveSeed(sketch.resolvedSeed, "command-separator"),
|
|
4984
|
+
sketchColor: sketch.ink,
|
|
4985
|
+
bowing: sketch.bowing ?? 1.8,
|
|
4986
|
+
strokeWidth: 1.2,
|
|
4987
|
+
inset: 4,
|
|
4988
|
+
style: { opacity: 0.4 }
|
|
4989
|
+
}
|
|
4990
|
+
)
|
|
4991
|
+
}
|
|
4992
|
+
);
|
|
4993
|
+
});
|
|
4994
|
+
function CommandShortcut({
|
|
4995
|
+
children,
|
|
4996
|
+
className,
|
|
4997
|
+
style
|
|
4998
|
+
}) {
|
|
4999
|
+
const sketch = useCommandSketch();
|
|
5000
|
+
return /* @__PURE__ */ jsx(
|
|
5001
|
+
"span",
|
|
5002
|
+
{
|
|
5003
|
+
className: cn(className),
|
|
5004
|
+
style: {
|
|
5005
|
+
marginLeft: "auto",
|
|
5006
|
+
fontFamily: doodleUiFontFamily,
|
|
5007
|
+
fontSize: 12,
|
|
5008
|
+
color: sketch.ink,
|
|
5009
|
+
opacity: 0.5,
|
|
5010
|
+
letterSpacing: 0.4,
|
|
5011
|
+
...style
|
|
5012
|
+
},
|
|
5013
|
+
children
|
|
5014
|
+
}
|
|
5015
|
+
);
|
|
5016
|
+
}
|
|
5017
|
+
var CHEVRON_PATH5 = "M 4 6 L 10 12 L 16 6";
|
|
5018
|
+
function Combobox({
|
|
5019
|
+
options,
|
|
5020
|
+
placeholder = "Select\u2026",
|
|
5021
|
+
searchPlaceholder = "Search\u2026",
|
|
5022
|
+
emptyMessage = "No results.",
|
|
5023
|
+
value,
|
|
5024
|
+
defaultValue,
|
|
5025
|
+
onValueChange,
|
|
5026
|
+
disabled,
|
|
5027
|
+
className,
|
|
5028
|
+
style,
|
|
5029
|
+
roughness,
|
|
5030
|
+
seed,
|
|
5031
|
+
sketchColor,
|
|
5032
|
+
bowing,
|
|
5033
|
+
fillStyle,
|
|
5034
|
+
strokeWidth,
|
|
5035
|
+
animate,
|
|
5036
|
+
"aria-label": ariaLabel
|
|
5037
|
+
}) {
|
|
5038
|
+
const [open, setOpen] = useState(false);
|
|
5039
|
+
const [uncontrolled, setUncontrolled] = useState(defaultValue);
|
|
5040
|
+
const selectedValue = value ?? uncontrolled;
|
|
5041
|
+
const selectedOption = options.find(
|
|
5042
|
+
(option) => option.value === selectedValue
|
|
5043
|
+
);
|
|
5044
|
+
const ink = sketchColor ?? SKETCH_COLORS.ink;
|
|
5045
|
+
const resolvedSeed = useResolvedSeed(seed);
|
|
5046
|
+
const shouldAnimate = useAnimate(animate);
|
|
5047
|
+
const triggerRef = useRef(null);
|
|
5048
|
+
useDrawIn(triggerRef, DRAW_IN_DURATION_MS, shouldAnimate);
|
|
5049
|
+
function handleSelect(nextValue) {
|
|
5050
|
+
setUncontrolled(nextValue);
|
|
5051
|
+
onValueChange?.(nextValue);
|
|
5052
|
+
setOpen(false);
|
|
5053
|
+
}
|
|
5054
|
+
return /* @__PURE__ */ jsxs(PopoverPrimitive.Root, { open, onOpenChange: setOpen, children: [
|
|
5055
|
+
/* @__PURE__ */ jsx(PopoverPrimitive.Trigger, { asChild: true, children: /* @__PURE__ */ jsxs(
|
|
5056
|
+
"button",
|
|
5057
|
+
{
|
|
5058
|
+
ref: (node) => assignRef(triggerRef, node),
|
|
5059
|
+
type: "button",
|
|
5060
|
+
role: "combobox",
|
|
5061
|
+
"aria-expanded": open,
|
|
5062
|
+
"aria-label": ariaLabel,
|
|
5063
|
+
disabled,
|
|
5064
|
+
className: cn(className),
|
|
5065
|
+
style: {
|
|
5066
|
+
position: "relative",
|
|
5067
|
+
display: "inline-flex",
|
|
5068
|
+
alignItems: "center",
|
|
5069
|
+
justifyContent: "space-between",
|
|
5070
|
+
gap: 12,
|
|
5071
|
+
width: "100%",
|
|
5072
|
+
minWidth: 200,
|
|
5073
|
+
minHeight: 38,
|
|
5074
|
+
padding: "8px 12px",
|
|
5075
|
+
border: "none",
|
|
5076
|
+
background: "transparent",
|
|
5077
|
+
cursor: disabled ? "not-allowed" : "pointer",
|
|
5078
|
+
opacity: disabled ? 0.5 : 1,
|
|
5079
|
+
color: ink,
|
|
5080
|
+
fontFamily: doodleUiFontFamily,
|
|
5081
|
+
fontSize: 15,
|
|
5082
|
+
lineHeight: 1.2,
|
|
5083
|
+
outline: "none",
|
|
5084
|
+
textAlign: "left",
|
|
5085
|
+
...style
|
|
5086
|
+
},
|
|
5087
|
+
children: [
|
|
5088
|
+
/* @__PURE__ */ jsx(
|
|
5089
|
+
RoughSvg,
|
|
5090
|
+
{
|
|
5091
|
+
shape: "rectangle",
|
|
5092
|
+
roughness,
|
|
5093
|
+
seed: resolvedSeed,
|
|
5094
|
+
sketchColor: open ? SKETCH_COLORS.accent : ink,
|
|
5095
|
+
bowing,
|
|
5096
|
+
fillStyle,
|
|
5097
|
+
strokeWidth: open ? (strokeWidth ?? 1.75) + 0.35 : strokeWidth
|
|
5098
|
+
}
|
|
5099
|
+
),
|
|
5100
|
+
/* @__PURE__ */ jsx(
|
|
5101
|
+
"span",
|
|
5102
|
+
{
|
|
5103
|
+
style: {
|
|
5104
|
+
position: "relative",
|
|
5105
|
+
zIndex: 1,
|
|
5106
|
+
flex: 1,
|
|
5107
|
+
overflow: "hidden",
|
|
5108
|
+
textOverflow: "ellipsis",
|
|
5109
|
+
whiteSpace: "nowrap"
|
|
5110
|
+
},
|
|
5111
|
+
children: selectedOption?.label ?? placeholder
|
|
5112
|
+
}
|
|
5113
|
+
),
|
|
5114
|
+
/* @__PURE__ */ jsx(
|
|
5115
|
+
"span",
|
|
5116
|
+
{
|
|
5117
|
+
style: { position: "relative", zIndex: 1, width: 18, height: 18, flexShrink: 0 },
|
|
5118
|
+
children: /* @__PURE__ */ jsx(
|
|
5119
|
+
RoughSvg,
|
|
5120
|
+
{
|
|
5121
|
+
shape: "path",
|
|
5122
|
+
path: CHEVRON_PATH5,
|
|
5123
|
+
roughness: roughness ? roughness * 0.7 : 1.05,
|
|
5124
|
+
seed: resolvedSeed,
|
|
5125
|
+
sketchColor: ink,
|
|
5126
|
+
bowing,
|
|
5127
|
+
strokeWidth: (strokeWidth ?? 1.6) + 0.2,
|
|
5128
|
+
inset: 0
|
|
5129
|
+
}
|
|
5130
|
+
)
|
|
5131
|
+
}
|
|
5132
|
+
)
|
|
5133
|
+
]
|
|
5134
|
+
}
|
|
5135
|
+
) }),
|
|
5136
|
+
/* @__PURE__ */ jsx(PopoverPrimitive.Portal, { children: /* @__PURE__ */ jsx(
|
|
5137
|
+
PopoverPrimitive.Content,
|
|
5138
|
+
{
|
|
5139
|
+
align: "start",
|
|
5140
|
+
sideOffset: 8,
|
|
5141
|
+
style: {
|
|
5142
|
+
zIndex: 80,
|
|
5143
|
+
outline: "none",
|
|
5144
|
+
width: "var(--radix-popover-trigger-width)"
|
|
5145
|
+
},
|
|
5146
|
+
children: /* @__PURE__ */ jsxs(
|
|
5147
|
+
Command,
|
|
5148
|
+
{
|
|
5149
|
+
roughness,
|
|
5150
|
+
seed: resolvedSeed,
|
|
5151
|
+
sketchColor: ink,
|
|
5152
|
+
bowing,
|
|
5153
|
+
fillStyle,
|
|
5154
|
+
strokeWidth,
|
|
5155
|
+
animate,
|
|
5156
|
+
children: [
|
|
5157
|
+
/* @__PURE__ */ jsx(CommandInput, { placeholder: searchPlaceholder }),
|
|
5158
|
+
/* @__PURE__ */ jsxs(CommandList, { children: [
|
|
5159
|
+
/* @__PURE__ */ jsx(CommandEmpty, { children: emptyMessage }),
|
|
5160
|
+
/* @__PURE__ */ jsx(CommandGroup, { children: options.map((option) => /* @__PURE__ */ jsx(
|
|
5161
|
+
CommandItem,
|
|
5162
|
+
{
|
|
5163
|
+
value: option.value,
|
|
5164
|
+
disabled: option.disabled,
|
|
5165
|
+
onSelect: handleSelect,
|
|
5166
|
+
children: option.label
|
|
5167
|
+
},
|
|
5168
|
+
option.value
|
|
5169
|
+
)) })
|
|
5170
|
+
] })
|
|
5171
|
+
]
|
|
5172
|
+
}
|
|
5173
|
+
)
|
|
5174
|
+
}
|
|
5175
|
+
) })
|
|
5176
|
+
] });
|
|
5177
|
+
}
|
|
3213
5178
|
|
|
3214
|
-
export { Accordion, AccordionContent, AccordionItem, AccordionTrigger, Alert, Avatar, Badge, Breadcrumb, BreadcrumbItem, Button, Card, Checkbox, DEFAULT_BOWING, DEFAULT_INK, DEFAULT_ROUGHNESS, DEFAULT_STROKE_WIDTH, Divider, Input, Modal, ModalClose, ModalDescription, ModalRoot, ModalTitle, ModalTrigger, Pagination, Progress, Radio, RadioGroup, RoughSvg, SKETCH_COLORS, Select, SelectContent, SelectGroup, SelectItem, SelectLabel, SelectRoot, SelectSeparator, SelectTrigger, SelectValue, Skeleton, SketchBox, SketchSeedProvider, Slider, Stepper, Switch, Tab, TabList, TabPanel, Table, TableBody, TableCell, TableHead, TableHeaderCell, TableRow, Tabs, Textarea, Toast, ToastAction, ToastClose, ToastDescription, ToastProvider, ToastRoot, ToastTitle, ToastViewport, Tooltip, TooltipProvider, deriveSeed, toRoughOptions, useResolvedSeed, useSketchSeed };
|
|
5179
|
+
export { Accordion, AccordionContent, AccordionItem, AccordionTrigger, Alert, AlertDialog, AlertDialogAction, AlertDialogCancel, AlertDialogContent, AlertDialogDescription, AlertDialogFooter, AlertDialogHeader, AlertDialogOverlay, AlertDialogPortal, AlertDialogTitle, AlertDialogTrigger, Avatar, Badge, Breadcrumb, BreadcrumbItem, Button, Card, Checkbox, Collapsible, CollapsibleContent, CollapsibleTrigger, Combobox, Command, CommandEmpty, CommandGroup, CommandInput, CommandItem, CommandList, CommandSeparator, CommandShortcut, DEFAULT_BOWING, DEFAULT_INK, DEFAULT_ROUGHNESS, DEFAULT_STROKE_WIDTH, DRAW_IN_ALERT_MS, DRAW_IN_DURATION_MS, DRAW_IN_MARK_MS, DRAW_IN_TOOLTIP_MS, Dialog2 as Dialog, DialogClose, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogOverlay, DialogPortal, DialogTitle, DialogTrigger, Divider, DoodleUIProvider, DropdownMenu, DropdownMenuCheckboxItem, DropdownMenuContent, DropdownMenuGroup, DropdownMenuItem, DropdownMenuLabel, DropdownMenuRadioGroup, DropdownMenuRadioItem, DropdownMenuSeparator, DropdownMenuSub, DropdownMenuTrigger, Input, Label2 as Label, Modal, ModalClose, ModalDescription, ModalRoot, ModalTitle, ModalTrigger, Pagination, Popover, PopoverAnchor, PopoverArrow, PopoverClose, PopoverContent, PopoverTrigger, Progress, Radio, RadioGroup, RoughSvg, SKETCH_COLORS, Select, SelectContent, SelectGroup, SelectItem, SelectLabel, SelectRoot, SelectSeparator, SelectTrigger, SelectValue, Skeleton, SketchBox, SketchSeedProvider, Slider, Stepper, Switch, TABLE_STAGGER_MS, Tab, TabList, TabPanel, Table, TableBody, TableCell, TableHead, TableHeaderCell, TableRow, Tabs, Textarea, Toast, ToastAction, ToastClose, ToastDescription, ToastProvider, ToastRoot, ToastTitle, ToastViewport, Tooltip, TooltipProvider, deriveSeed, toRoughOptions, useAnimate, useDoodleUI, useDrawIn, useResolvedSeed, useSketchSeed };
|
|
3215
5180
|
//# sourceMappingURL=index.js.map
|
|
3216
5181
|
//# sourceMappingURL=index.js.map
|