@justanarthur/modo-ui 0.0.0-stage → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/LICENSE.beui +21 -0
- package/LICENSE.fluid-functionalism +21 -0
- package/LICENSE.motion-primitives +21 -0
- package/LICENSE.sileo +21 -0
- package/README.md +608 -2
- package/dist/base.css +994 -0
- package/dist/blocks/sidebar-app/index.d.ts +34 -0
- package/dist/blocks/sidebar-app/index.js +31 -0
- package/dist/components/badge/index.d.ts +59 -0
- package/dist/components/badge/index.js +16 -0
- package/dist/components/button/index.d.ts +59 -0
- package/dist/components/button/index.js +14 -0
- package/dist/components/card/index.d.ts +141 -0
- package/dist/components/card/index.js +42 -0
- package/dist/components/inputs/checkbox-group/index.d.ts +50 -0
- package/dist/components/inputs/checkbox-group/index.js +21 -0
- package/dist/components/inputs/color-picker/index.d.ts +137 -0
- package/dist/components/inputs/color-picker/index.js +35 -0
- package/dist/components/inputs/combobox/index.d.ts +161 -0
- package/dist/components/inputs/combobox/index.js +38 -0
- package/dist/components/inputs/date-time/calendar/index.d.ts +45 -0
- package/dist/components/inputs/date-time/calendar/index.js +18 -0
- package/dist/components/inputs/date-time/date-picker/index.d.ts +82 -0
- package/dist/components/inputs/date-time/date-picker/index.js +32 -0
- package/dist/components/inputs/date-time/date-range-picker/index.d.ts +64 -0
- package/dist/components/inputs/date-time/date-range-picker/index.js +31 -0
- package/dist/components/inputs/date-time/duration-picker/index.d.ts +57 -0
- package/dist/components/inputs/date-time/duration-picker/index.js +31 -0
- package/dist/components/inputs/date-time/month-picker/index.d.ts +57 -0
- package/dist/components/inputs/date-time/month-picker/index.js +30 -0
- package/dist/components/inputs/date-time/time-picker/index.d.ts +59 -0
- package/dist/components/inputs/date-time/time-picker/index.js +31 -0
- package/dist/components/inputs/input/index.d.ts +84 -0
- package/dist/components/inputs/input/index.js +19 -0
- package/dist/components/inputs/input-copy/index.d.ts +44 -0
- package/dist/components/inputs/input-copy/index.js +16 -0
- package/dist/components/inputs/input-message/index.d.ts +125 -0
- package/dist/components/inputs/input-message/index.js +25 -0
- package/dist/components/inputs/radio-group/index.d.ts +58 -0
- package/dist/components/inputs/radio-group/index.js +20 -0
- package/dist/components/inputs/search/index.d.ts +83 -0
- package/dist/components/inputs/search/index.js +25 -0
- package/dist/components/inputs/select/index.d.ts +105 -0
- package/dist/components/inputs/select/index.js +34 -0
- package/dist/components/inputs/slider/index.d.ts +108 -0
- package/dist/components/inputs/slider/index.js +14 -0
- package/dist/components/inputs/switch/index.d.ts +43 -0
- package/dist/components/inputs/switch/index.js +14 -0
- package/dist/components/navigation/accordion/index.d.ts +117 -0
- package/dist/components/navigation/accordion/index.js +28 -0
- package/dist/components/navigation/sidebar/index.d.ts +388 -0
- package/dist/components/navigation/sidebar/index.js +99 -0
- package/dist/components/navigation/tabs/index.d.ts +70 -0
- package/dist/components/navigation/tabs/index.js +23 -0
- package/dist/components/navigation/tabs-subtle/index.d.ts +73 -0
- package/dist/components/navigation/tabs-subtle/index.js +21 -0
- package/dist/components/overlays/alert-dialog/index.d.ts +67 -0
- package/dist/components/overlays/alert-dialog/index.js +22 -0
- package/dist/components/overlays/command/index.d.ts +121 -0
- package/dist/components/overlays/command/index.js +36 -0
- package/dist/components/overlays/context-menu/index.d.ts +97 -0
- package/dist/components/overlays/context-menu/index.js +29 -0
- package/dist/components/overlays/dialog/index.d.ts +130 -0
- package/dist/components/overlays/dialog/index.js +37 -0
- package/dist/components/overlays/dropdown/index.d.ts +222 -0
- package/dist/components/overlays/dropdown/index.js +44 -0
- package/dist/components/overlays/popover/index.d.ts +87 -0
- package/dist/components/overlays/popover/index.js +26 -0
- package/dist/components/overlays/preview-card/index.d.ts +75 -0
- package/dist/components/overlays/preview-card/index.js +19 -0
- package/dist/components/overlays/sheet/index.d.ts +67 -0
- package/dist/components/overlays/sheet/index.js +24 -0
- package/dist/components/overlays/toast/index.d.ts +107 -0
- package/dist/components/overlays/toast/index.js +21 -0
- package/dist/components/overlays/tooltip/index.d.ts +75 -0
- package/dist/components/overlays/tooltip/index.js +17 -0
- package/dist/components/table/index.d.ts +44 -0
- package/dist/components/table/index.js +26 -0
- package/dist/components/thinking-indicator/index.d.ts +32 -0
- package/dist/components/thinking-indicator/index.js +13 -0
- package/dist/index.d.ts +3926 -0
- package/dist/index.js +511 -0
- package/dist/preset.d.ts +104 -0
- package/dist/preset.js +124 -0
- package/dist/primitives/code/index.d.ts +23 -0
- package/dist/primitives/code/index.js +11 -0
- package/dist/primitives/craft/index.d.ts +31 -0
- package/dist/primitives/craft/index.js +11 -0
- package/dist/primitives/fluid-hover/index.d.ts +233 -0
- package/dist/primitives/fluid-hover/index.js +25 -0
- package/dist/primitives/morph/index.d.ts +127 -0
- package/dist/primitives/morph/index.js +19 -0
- package/dist/primitives/motion/index.d.ts +115 -0
- package/dist/primitives/motion/index.js +19 -0
- package/dist/primitives/scroll-area/index.d.ts +41 -0
- package/dist/primitives/scroll-area/index.js +12 -0
- package/dist/primitives/sizes/index.d.ts +128 -0
- package/dist/primitives/sizes/index.js +21 -0
- package/dist/primitives/surface/index.d.ts +69 -0
- package/dist/primitives/surface/index.js +17 -0
- package/dist/shared/components-0ke6xada.js +123 -0
- package/dist/shared/components-0q0sqfh4.js +146 -0
- package/dist/shared/components-0sn7ypjw.js +61 -0
- package/dist/shared/components-1j9791sn.js +345 -0
- package/dist/shared/components-1rfwbyyc.js +361 -0
- package/dist/shared/components-1v7rxytx.js +30 -0
- package/dist/shared/components-1xekx2hx.js +215 -0
- package/dist/shared/components-39jq9va1.js +86 -0
- package/dist/shared/components-3gae8nta.js +719 -0
- package/dist/shared/components-3k8xpnpq.js +1759 -0
- package/dist/shared/components-3ky44908.js +9 -0
- package/dist/shared/components-3mkepka5.js +111 -0
- package/dist/shared/components-3wk0w46f.js +667 -0
- package/dist/shared/components-4cnjmgex.js +124 -0
- package/dist/shared/components-59efxjd9.js +298 -0
- package/dist/shared/components-5xc2j8jz.js +159 -0
- package/dist/shared/components-62ybc7t2.js +496 -0
- package/dist/shared/components-66mv71kx.js +262 -0
- package/dist/shared/components-7ans7ce5.js +120 -0
- package/dist/shared/components-7btqt08d.js +270 -0
- package/dist/shared/components-7r3etddy.js +171 -0
- package/dist/shared/components-7x9kawxv.js +152 -0
- package/dist/shared/components-8fpr3s4p.js +292 -0
- package/dist/shared/components-9jvzzvt1.js +198 -0
- package/dist/shared/components-apdwtweq.js +484 -0
- package/dist/shared/components-asr5pg50.js +191 -0
- package/dist/shared/components-b2wyq2cq.js +232 -0
- package/dist/shared/components-c6s6b43g.js +15 -0
- package/dist/shared/components-ca2c898n.js +1828 -0
- package/dist/shared/components-cbxjn9p8.js +141 -0
- package/dist/shared/components-chacnk61.js +216 -0
- package/dist/shared/components-cv16mryv.js +62 -0
- package/dist/shared/components-ez65vtbq.js +110 -0
- package/dist/shared/components-ezxhrmer.js +17 -0
- package/dist/shared/components-gc5vtq2f.js +149 -0
- package/dist/shared/components-gf5s6ap9.js +42 -0
- package/dist/shared/components-gvr9w41t.js +193 -0
- package/dist/shared/components-h2dpcwgc.js +137 -0
- package/dist/shared/components-hawvy2qz.js +105 -0
- package/dist/shared/components-hqeq3w9q.js +375 -0
- package/dist/shared/components-jjw69c4c.js +28 -0
- package/dist/shared/components-jwst3vtj.js +346 -0
- package/dist/shared/components-kvr7f9hy.js +45 -0
- package/dist/shared/components-men63rwj.js +9 -0
- package/dist/shared/components-mhd39z7x.js +22 -0
- package/dist/shared/components-n7mjr357.js +26 -0
- package/dist/shared/components-ng72k97e.js +128 -0
- package/dist/shared/components-nh8tma1n.js +986 -0
- package/dist/shared/components-njzgqdwy.js +445 -0
- package/dist/shared/components-ny774h8p.js +293 -0
- package/dist/shared/components-q4daerx0.js +58 -0
- package/dist/shared/components-q5xj5c16.js +79 -0
- package/dist/shared/components-rr7a6ja9.js +160 -0
- package/dist/shared/components-s2bz1xpk.js +63 -0
- package/dist/shared/components-tqvarbfv.js +288 -0
- package/dist/shared/components-v6xp325t.js +304 -0
- package/dist/shared/components-v7wtz8hk.js +144 -0
- package/dist/shared/components-vc7vq5nz.js +32 -0
- package/dist/shared/components-vfbhxf5r.js +58 -0
- package/dist/shared/components-vynjtrk6.js +19 -0
- package/dist/shared/components-wvp1m52g.js +1200 -0
- package/dist/shared/components-yh3kwdhr.js +981 -0
- package/dist/shared/components-ytb2tefr.js +291 -0
- package/dist/shared/components-zfnmn5d4.js +220 -0
- package/dist/shared/components-zrkzcayz.js +141 -0
- package/dist/shared/components-zx6b6yby.js +42 -0
- package/dist/styles.css +1949 -0
- package/dist/tailwind.css +219 -0
- package/dist/tokens.css +345 -0
- package/package.json +103 -4
|
@@ -0,0 +1,171 @@
|
|
|
1
|
+
import {
|
|
2
|
+
useReduceMotion
|
|
3
|
+
} from "./components-men63rwj.js";
|
|
4
|
+
import {
|
|
5
|
+
useShape
|
|
6
|
+
} from "./components-cv16mryv.js";
|
|
7
|
+
import {
|
|
8
|
+
useSizeVariant2
|
|
9
|
+
} from "./components-0sn7ypjw.js";
|
|
10
|
+
import {
|
|
11
|
+
cn2
|
|
12
|
+
} from "./components-ezxhrmer.js";
|
|
13
|
+
import {
|
|
14
|
+
spring2
|
|
15
|
+
} from "./components-1v7rxytx.js";
|
|
16
|
+
|
|
17
|
+
// components/badge/index.tsx
|
|
18
|
+
import { cva } from "class-variance-authority";
|
|
19
|
+
import { AnimatePresence, animate, motion } from "motion/react";
|
|
20
|
+
import { forwardRef, useLayoutEffect, useRef } from "react";
|
|
21
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
22
|
+
var badgeColors2 = {
|
|
23
|
+
gray: "var(--badge-gray)",
|
|
24
|
+
red: "var(--badge-red)",
|
|
25
|
+
orange: "var(--badge-orange)",
|
|
26
|
+
amber: "var(--badge-amber)",
|
|
27
|
+
yellow: "var(--badge-yellow)",
|
|
28
|
+
lime: "var(--badge-lime)",
|
|
29
|
+
green: "var(--badge-green)",
|
|
30
|
+
emerald: "var(--badge-emerald)",
|
|
31
|
+
teal: "var(--badge-teal)",
|
|
32
|
+
cyan: "var(--badge-cyan)",
|
|
33
|
+
blue: "var(--badge-blue)",
|
|
34
|
+
indigo: "var(--badge-indigo)",
|
|
35
|
+
violet: "var(--badge-violet)",
|
|
36
|
+
purple: "var(--badge-purple)",
|
|
37
|
+
fuchsia: "var(--badge-fuchsia)",
|
|
38
|
+
pink: "var(--badge-pink)",
|
|
39
|
+
rose: "var(--badge-rose)"
|
|
40
|
+
};
|
|
41
|
+
var badgeVariants2 = cva("inline-flex items-center weight-medium whitespace-nowrap", {
|
|
42
|
+
variants: {
|
|
43
|
+
variant: {
|
|
44
|
+
solid: "",
|
|
45
|
+
dot: "border border-border text-foreground"
|
|
46
|
+
},
|
|
47
|
+
size: {
|
|
48
|
+
default: "h-6 px-2.5 text-caption gap-1.5",
|
|
49
|
+
compact: "h-5 px-2 text-caption-compact gap-1"
|
|
50
|
+
}
|
|
51
|
+
},
|
|
52
|
+
defaultVariants: {
|
|
53
|
+
variant: "solid",
|
|
54
|
+
size: "default"
|
|
55
|
+
}
|
|
56
|
+
});
|
|
57
|
+
var legacySizeAliases = {
|
|
58
|
+
sm: "compact",
|
|
59
|
+
md: "default",
|
|
60
|
+
lg: "default"
|
|
61
|
+
};
|
|
62
|
+
var { exit: _exit, ...enter } = spring2.moderate;
|
|
63
|
+
function textOf(node) {
|
|
64
|
+
const parts = Array.isArray(node) ? node : [node];
|
|
65
|
+
if (parts.every((part) => typeof part === "string" || typeof part === "number"))
|
|
66
|
+
return parts.join("");
|
|
67
|
+
}
|
|
68
|
+
function useWidthMorph(change) {
|
|
69
|
+
const content = useRef(null);
|
|
70
|
+
const rest = useRef(0);
|
|
71
|
+
const live = useRef(null);
|
|
72
|
+
const reduced = useReduceMotion();
|
|
73
|
+
useLayoutEffect(() => {
|
|
74
|
+
const el = content.current;
|
|
75
|
+
if (!el)
|
|
76
|
+
return;
|
|
77
|
+
const observer = new ResizeObserver(() => {
|
|
78
|
+
if (live.current === null)
|
|
79
|
+
rest.current = el.offsetWidth;
|
|
80
|
+
});
|
|
81
|
+
observer.observe(el);
|
|
82
|
+
return () => observer.disconnect();
|
|
83
|
+
}, []);
|
|
84
|
+
useLayoutEffect(() => {
|
|
85
|
+
const el = content.current;
|
|
86
|
+
const from = live.current ?? rest.current;
|
|
87
|
+
if (!el || !from)
|
|
88
|
+
return;
|
|
89
|
+
el.style.width = "";
|
|
90
|
+
const to = el.offsetWidth;
|
|
91
|
+
rest.current = to;
|
|
92
|
+
live.current = null;
|
|
93
|
+
if (reduced || from === to)
|
|
94
|
+
return;
|
|
95
|
+
const write = (width) => {
|
|
96
|
+
live.current = width;
|
|
97
|
+
el.style.width = `${width}px`;
|
|
98
|
+
};
|
|
99
|
+
write(from);
|
|
100
|
+
const controls = animate(from, to, {
|
|
101
|
+
...enter,
|
|
102
|
+
onUpdate: write,
|
|
103
|
+
onComplete: () => {
|
|
104
|
+
live.current = null;
|
|
105
|
+
el.style.width = "";
|
|
106
|
+
}
|
|
107
|
+
});
|
|
108
|
+
return () => controls.stop();
|
|
109
|
+
}, [change, reduced]);
|
|
110
|
+
return content;
|
|
111
|
+
}
|
|
112
|
+
var Badge2 = forwardRef(({ className, variant = "solid", size: sizeProp, color = "gray", children, style, ...props }, ref) => {
|
|
113
|
+
const shape = useShape();
|
|
114
|
+
const contextSize = useSizeVariant2();
|
|
115
|
+
const size = sizeProp ? legacySizeAliases[sizeProp] ?? sizeProp : contextSize === "compact" ? "compact" : "default";
|
|
116
|
+
const colorValue = badgeColors2[color];
|
|
117
|
+
const isSolid = variant === "solid";
|
|
118
|
+
const dotSize = size === "compact" ? 6 : 7;
|
|
119
|
+
const colorStyle = isSolid ? color === "gray" ? { backgroundColor: "var(--accent)", color: "var(--foreground)" } : {
|
|
120
|
+
color: "var(--foreground)",
|
|
121
|
+
backgroundColor: `color-mix(in srgb, ${colorValue} 15%, var(--background))`
|
|
122
|
+
} : {};
|
|
123
|
+
const dotColor = color === "gray" ? "var(--muted-foreground)" : colorValue;
|
|
124
|
+
const label = textOf(children);
|
|
125
|
+
const content = useWidthMorph(`${variant} ${size} ${label}`);
|
|
126
|
+
return /* @__PURE__ */ jsx("span", {
|
|
127
|
+
ref,
|
|
128
|
+
className: cn2(badgeVariants2({ variant, size }), shape.item, "transition-[background-color] duration-moderate", className),
|
|
129
|
+
style: { ...colorStyle, ...style },
|
|
130
|
+
...props,
|
|
131
|
+
children: /* @__PURE__ */ jsxs("span", {
|
|
132
|
+
ref: content,
|
|
133
|
+
className: "relative inline-flex min-w-0 items-center gap-[inherit] overflow-x-clip",
|
|
134
|
+
children: [
|
|
135
|
+
/* @__PURE__ */ jsx(AnimatePresence, {
|
|
136
|
+
mode: "popLayout",
|
|
137
|
+
initial: false,
|
|
138
|
+
children: !isSolid && /* @__PURE__ */ jsx(motion.span, {
|
|
139
|
+
className: "shrink-0 rounded-full transition-[background-color] duration-moderate",
|
|
140
|
+
style: {
|
|
141
|
+
width: dotSize,
|
|
142
|
+
height: dotSize,
|
|
143
|
+
backgroundColor: dotColor
|
|
144
|
+
},
|
|
145
|
+
initial: { opacity: 0, scale: 0 },
|
|
146
|
+
animate: { opacity: 1, scale: 1 },
|
|
147
|
+
exit: { opacity: 0, scale: 0, transition: spring2.moderate.exit },
|
|
148
|
+
transition: enter
|
|
149
|
+
}, "dot")
|
|
150
|
+
}),
|
|
151
|
+
/* @__PURE__ */ jsx(AnimatePresence, {
|
|
152
|
+
mode: "popLayout",
|
|
153
|
+
initial: false,
|
|
154
|
+
children: /* @__PURE__ */ jsx(motion.span, {
|
|
155
|
+
layout: "position",
|
|
156
|
+
className: "[text-box:trim-both_cap_alphabetic]",
|
|
157
|
+
initial: { opacity: 0, filter: "blur(4px)" },
|
|
158
|
+
animate: { opacity: 1, filter: "blur(0px)", transitionEnd: { filter: "none" } },
|
|
159
|
+
exit: { opacity: 0, filter: "blur(4px)", transition: spring2.moderate.exit },
|
|
160
|
+
transition: enter,
|
|
161
|
+
children
|
|
162
|
+
}, label ?? "label")
|
|
163
|
+
})
|
|
164
|
+
]
|
|
165
|
+
})
|
|
166
|
+
});
|
|
167
|
+
});
|
|
168
|
+
Badge2.displayName = "Badge";
|
|
169
|
+
var badge_default = Badge2;
|
|
170
|
+
|
|
171
|
+
export { badgeColors2, badgeVariants2, Badge2, badge_default };
|
|
@@ -0,0 +1,152 @@
|
|
|
1
|
+
import {
|
|
2
|
+
useReduceMotion
|
|
3
|
+
} from "./components-men63rwj.js";
|
|
4
|
+
import {
|
|
5
|
+
GooFilter
|
|
6
|
+
} from "./components-0q0sqfh4.js";
|
|
7
|
+
import {
|
|
8
|
+
GOO_BLUR_RATIO
|
|
9
|
+
} from "./components-hqeq3w9q.js";
|
|
10
|
+
import {
|
|
11
|
+
cn2
|
|
12
|
+
} from "./components-ezxhrmer.js";
|
|
13
|
+
import {
|
|
14
|
+
useSize2
|
|
15
|
+
} from "./components-0sn7ypjw.js";
|
|
16
|
+
import {
|
|
17
|
+
spring2
|
|
18
|
+
} from "./components-1v7rxytx.js";
|
|
19
|
+
|
|
20
|
+
// components/thinking-indicator/index.tsx
|
|
21
|
+
import { AnimatePresence, motion } from "motion/react";
|
|
22
|
+
import { forwardRef, useEffect, useId, useState } from "react";
|
|
23
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
24
|
+
var circleA = "M 12 8 C 14.21 8 16 9.79 16 12 C 16 14.21 14.21 16 12 16 C 9.79 16 8 14.21 8 12 C 8 9.79 9.79 8 12 8 Z";
|
|
25
|
+
var infinity = "M 12 12 C 14 8.5 19 8.5 19 12 C 19 15.5 14 15.5 12 12 C 10 8.5 5 8.5 5 12 C 5 15.5 10 15.5 12 12 Z";
|
|
26
|
+
var circleB = "M 12 16 C 14.21 16 16 14.21 16 12 C 16 9.79 14.21 8 12 8 C 9.79 8 8 9.79 8 12 C 8 14.21 9.79 16 12 16 Z";
|
|
27
|
+
var words = ["Thinking", "Moonwalking", "Planning", "Refining"];
|
|
28
|
+
var DOTS = {
|
|
29
|
+
default: { box: "h-5 w-[26px]", dot: "size-1.5", radius: 3, gap: 10 },
|
|
30
|
+
compact: { box: "h-[18px] w-[23px]", dot: "size-[5px]", radius: 2.5, gap: 9 }
|
|
31
|
+
};
|
|
32
|
+
var MERGED = Math.sqrt(3);
|
|
33
|
+
function GooDots({ step, still }) {
|
|
34
|
+
const gooId = `thinking-goo-${useId().replace(/:/g, "")}`;
|
|
35
|
+
const { box, dot, radius, gap } = DOTS[step];
|
|
36
|
+
const loop = { duration: spring2.slow.duration * 8, ease: "easeInOut", repeat: Infinity };
|
|
37
|
+
return /* @__PURE__ */ jsxs("span", {
|
|
38
|
+
"aria-hidden": true,
|
|
39
|
+
className: cn2("relative shrink-0", box),
|
|
40
|
+
children: [
|
|
41
|
+
/* @__PURE__ */ jsx(GooFilter, {
|
|
42
|
+
id: gooId,
|
|
43
|
+
blur: radius * GOO_BLUR_RATIO
|
|
44
|
+
}),
|
|
45
|
+
/* @__PURE__ */ jsx("span", {
|
|
46
|
+
className: "absolute inset-0 flex items-center justify-center",
|
|
47
|
+
style: { filter: `url(#${gooId})` },
|
|
48
|
+
children: [-1, 0, 1].map((side) => /* @__PURE__ */ jsx(motion.span, {
|
|
49
|
+
className: cn2("absolute rounded-full bg-muted-foreground", dot),
|
|
50
|
+
animate: still ? { x: side * gap } : side ? { x: [side * gap, 0, side * gap] } : { scale: [1, MERGED, 1] },
|
|
51
|
+
transition: still ? { duration: 0 } : loop
|
|
52
|
+
}, side))
|
|
53
|
+
})
|
|
54
|
+
]
|
|
55
|
+
});
|
|
56
|
+
}
|
|
57
|
+
var ThinkingIndicator2 = forwardRef(({ className, variant = "shimmer", showIcon = true, size, ...props }, ref) => {
|
|
58
|
+
const step = useSize2(size).variant;
|
|
59
|
+
const compactStep = step === "compact";
|
|
60
|
+
const [index, setIndex] = useState(0);
|
|
61
|
+
const reduceMotion = useReduceMotion();
|
|
62
|
+
const label = variant === "goo" ? "text-muted-foreground" : "shimmer-text";
|
|
63
|
+
useEffect(() => {
|
|
64
|
+
if (reduceMotion)
|
|
65
|
+
return;
|
|
66
|
+
const interval = setInterval(() => {
|
|
67
|
+
setIndex((i) => (i + 1) % words.length);
|
|
68
|
+
}, 4000);
|
|
69
|
+
return () => clearInterval(interval);
|
|
70
|
+
}, [reduceMotion]);
|
|
71
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
72
|
+
ref,
|
|
73
|
+
role: "status",
|
|
74
|
+
className: cn2("flex items-center gap-2 px-3 py-2", className),
|
|
75
|
+
...props,
|
|
76
|
+
children: [
|
|
77
|
+
/* @__PURE__ */ jsx("span", {
|
|
78
|
+
className: "sr-only",
|
|
79
|
+
children: "Thinking…"
|
|
80
|
+
}),
|
|
81
|
+
showIcon && variant === "goo" && /* @__PURE__ */ jsx(GooDots, {
|
|
82
|
+
step,
|
|
83
|
+
still: reduceMotion
|
|
84
|
+
}),
|
|
85
|
+
showIcon && variant === "shimmer" && /* @__PURE__ */ jsx(motion.svg, {
|
|
86
|
+
"aria-hidden": true,
|
|
87
|
+
width: compactStep ? 18 : 20,
|
|
88
|
+
height: compactStep ? 18 : 20,
|
|
89
|
+
viewBox: "0 0 24 24",
|
|
90
|
+
fill: "none",
|
|
91
|
+
stroke: "currentColor",
|
|
92
|
+
strokeWidth: 1.5,
|
|
93
|
+
strokeLinecap: "round",
|
|
94
|
+
strokeLinejoin: "round",
|
|
95
|
+
className: "text-muted-foreground shrink-0",
|
|
96
|
+
children: reduceMotion ? /* @__PURE__ */ jsx("path", {
|
|
97
|
+
d: infinity
|
|
98
|
+
}) : /* @__PURE__ */ jsx(motion.path, {
|
|
99
|
+
d: circleA,
|
|
100
|
+
initial: { d: circleA },
|
|
101
|
+
animate: {
|
|
102
|
+
d: [circleA, infinity, circleB, infinity, circleA]
|
|
103
|
+
},
|
|
104
|
+
transition: {
|
|
105
|
+
d: {
|
|
106
|
+
duration: 6,
|
|
107
|
+
ease: "easeInOut",
|
|
108
|
+
repeat: Infinity,
|
|
109
|
+
times: [0, 0.25, 0.5, 0.75, 1]
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
})
|
|
113
|
+
}),
|
|
114
|
+
/* @__PURE__ */ jsxs("span", {
|
|
115
|
+
"aria-hidden": "true",
|
|
116
|
+
className: cn2("inline-grid overflow-hidden", compactStep ? "text-body-compact" : "text-body", "weight-medium"),
|
|
117
|
+
children: [
|
|
118
|
+
/* @__PURE__ */ jsx("span", {
|
|
119
|
+
className: cn2("col-start-1 row-start-1 invisible", label),
|
|
120
|
+
children: words.reduce((a, b) => a.length >= b.length ? a : b)
|
|
121
|
+
}),
|
|
122
|
+
reduceMotion ? /* @__PURE__ */ jsx("span", {
|
|
123
|
+
className: cn2("col-start-1 row-start-1", label),
|
|
124
|
+
children: words[0]
|
|
125
|
+
}) : /* @__PURE__ */ jsx(AnimatePresence, {
|
|
126
|
+
mode: "popLayout",
|
|
127
|
+
initial: false,
|
|
128
|
+
children: /* @__PURE__ */ jsx(motion.span, {
|
|
129
|
+
className: cn2("col-start-1 row-start-1", label),
|
|
130
|
+
initial: { y: "80%", opacity: 0 },
|
|
131
|
+
animate: {
|
|
132
|
+
y: 0,
|
|
133
|
+
opacity: 1,
|
|
134
|
+
transition: { duration: spring2.slow.duration, ease: [0.4, 0, 0.2, 1] }
|
|
135
|
+
},
|
|
136
|
+
exit: {
|
|
137
|
+
y: "-80%",
|
|
138
|
+
opacity: 0,
|
|
139
|
+
transition: { duration: spring2.slow.exit.duration, ease: [0.4, 0, 0.2, 1] }
|
|
140
|
+
},
|
|
141
|
+
children: words[index]
|
|
142
|
+
}, words[index])
|
|
143
|
+
})
|
|
144
|
+
]
|
|
145
|
+
})
|
|
146
|
+
]
|
|
147
|
+
});
|
|
148
|
+
});
|
|
149
|
+
ThinkingIndicator2.displayName = "ThinkingIndicator";
|
|
150
|
+
var thinking_indicator_default = ThinkingIndicator2;
|
|
151
|
+
|
|
152
|
+
export { ThinkingIndicator2, thinking_indicator_default };
|
|
@@ -0,0 +1,292 @@
|
|
|
1
|
+
import {
|
|
2
|
+
cn2
|
|
3
|
+
} from "./components-ezxhrmer.js";
|
|
4
|
+
import {
|
|
5
|
+
FluidHoverHighlight2
|
|
6
|
+
} from "./components-kvr7f9hy.js";
|
|
7
|
+
import {
|
|
8
|
+
useIcon
|
|
9
|
+
} from "./components-zrkzcayz.js";
|
|
10
|
+
import {
|
|
11
|
+
shapeMap
|
|
12
|
+
} from "./components-cv16mryv.js";
|
|
13
|
+
import {
|
|
14
|
+
useSize2
|
|
15
|
+
} from "./components-0sn7ypjw.js";
|
|
16
|
+
import {
|
|
17
|
+
useFluidHover2,
|
|
18
|
+
useRegisterFluidHoverItem2
|
|
19
|
+
} from "./components-59efxjd9.js";
|
|
20
|
+
import {
|
|
21
|
+
ScrollArea2
|
|
22
|
+
} from "./components-hawvy2qz.js";
|
|
23
|
+
import {
|
|
24
|
+
DialogTrigger2,
|
|
25
|
+
DialogContent2,
|
|
26
|
+
DialogState2
|
|
27
|
+
} from "./components-zfnmn5d4.js";
|
|
28
|
+
import {
|
|
29
|
+
popupScrollAreaClass,
|
|
30
|
+
popupViewportClass,
|
|
31
|
+
isDisabledRow
|
|
32
|
+
} from "./components-vynjtrk6.js";
|
|
33
|
+
|
|
34
|
+
// components/overlays/command/index.tsx
|
|
35
|
+
import { Autocomplete } from "@base-ui/react/autocomplete";
|
|
36
|
+
import { Dialog as DialogPrimitive } from "@base-ui/react/dialog";
|
|
37
|
+
import {
|
|
38
|
+
createContext,
|
|
39
|
+
forwardRef,
|
|
40
|
+
useContext,
|
|
41
|
+
useEffect,
|
|
42
|
+
useImperativeHandle,
|
|
43
|
+
useMemo,
|
|
44
|
+
useRef,
|
|
45
|
+
useState
|
|
46
|
+
} from "react";
|
|
47
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
48
|
+
var listShape = shapeMap.rounded;
|
|
49
|
+
var CommandContext = createContext({
|
|
50
|
+
trigger: { current: null },
|
|
51
|
+
close: () => {},
|
|
52
|
+
session: 0
|
|
53
|
+
});
|
|
54
|
+
var CommandHighlight = createContext(null);
|
|
55
|
+
var CommandRows = createContext(undefined);
|
|
56
|
+
var isGrouped = (items) => items[0] !== undefined && ("items" in items[0]);
|
|
57
|
+
function CommandListRoot2({ items, ...props }) {
|
|
58
|
+
const [highlight, setHighlight] = useState(null);
|
|
59
|
+
const { contains } = Autocomplete.useFilter();
|
|
60
|
+
return /* @__PURE__ */ jsx(CommandHighlight.Provider, {
|
|
61
|
+
value: highlight,
|
|
62
|
+
children: /* @__PURE__ */ jsx(Autocomplete.Root, {
|
|
63
|
+
...props,
|
|
64
|
+
items,
|
|
65
|
+
itemToStringValue: (item) => item.label,
|
|
66
|
+
filter: (item, query) => contains([item.label, ...item.keywords ?? []].join(" "), query),
|
|
67
|
+
onItemHighlighted: (item, details) => setHighlight(item ? details.index : null)
|
|
68
|
+
})
|
|
69
|
+
});
|
|
70
|
+
}
|
|
71
|
+
function CommandShortcut2({ className, ...props }) {
|
|
72
|
+
return /* @__PURE__ */ jsx("kbd", {
|
|
73
|
+
className: cn2("ml-auto shrink-0 font-sans text-caption text-muted-foreground", className),
|
|
74
|
+
...props
|
|
75
|
+
});
|
|
76
|
+
}
|
|
77
|
+
function CommandRow({
|
|
78
|
+
item,
|
|
79
|
+
index,
|
|
80
|
+
onPick
|
|
81
|
+
}) {
|
|
82
|
+
const registerItem = useContext(CommandRows);
|
|
83
|
+
const active = useContext(CommandHighlight) === index;
|
|
84
|
+
const ref = useRef(null);
|
|
85
|
+
const size = useSize2();
|
|
86
|
+
useRegisterFluidHoverItem2(registerItem, index, ref);
|
|
87
|
+
const Icon = item.icon;
|
|
88
|
+
return /* @__PURE__ */ jsxs(Autocomplete.Item, {
|
|
89
|
+
ref,
|
|
90
|
+
value: item,
|
|
91
|
+
disabled: item.disabled,
|
|
92
|
+
onClick: () => onPick(item),
|
|
93
|
+
className: cn2("relative z-10 flex shrink-0 cursor-pointer select-none items-center outline-none transition-[color] duration-fast", "data-[disabled]:pointer-events-none data-[disabled]:opacity-50", size.control, size.gap, size.itemPx, size.text, listShape.item, active ? "text-foreground" : "text-muted-foreground"),
|
|
94
|
+
children: [
|
|
95
|
+
Icon && /* @__PURE__ */ jsx(Icon, {
|
|
96
|
+
size: size.icon,
|
|
97
|
+
strokeWidth: active ? 2 : 1.5,
|
|
98
|
+
className: "shrink-0 transition-[color,stroke-width] duration-fast"
|
|
99
|
+
}),
|
|
100
|
+
/* @__PURE__ */ jsx("span", {
|
|
101
|
+
className: "min-w-0 flex-1 truncate [text-box:trim-both_cap_alphabetic] py-1 -my-1",
|
|
102
|
+
children: item.label
|
|
103
|
+
}),
|
|
104
|
+
item.shortcut && /* @__PURE__ */ jsx(CommandShortcut2, {
|
|
105
|
+
children: item.shortcut
|
|
106
|
+
})
|
|
107
|
+
]
|
|
108
|
+
});
|
|
109
|
+
}
|
|
110
|
+
function CommandList2({ onPick, emptyMessage, className }) {
|
|
111
|
+
const filtered = Autocomplete.useFilteredItems();
|
|
112
|
+
const highlight = useContext(CommandHighlight);
|
|
113
|
+
const compact = useSize2().variant === "compact";
|
|
114
|
+
const containerRef = useRef(null);
|
|
115
|
+
const { itemRects, isMeasured, registerItem } = useFluidHover2(containerRef, { isItemDisabled: isDisabledRow });
|
|
116
|
+
const rect = isMeasured && highlight !== null ? itemRects[highlight] ?? null : null;
|
|
117
|
+
const rows = (items, start) => items.map((item, i) => /* @__PURE__ */ jsx(CommandRow, {
|
|
118
|
+
item,
|
|
119
|
+
index: start + i,
|
|
120
|
+
onPick
|
|
121
|
+
}, item.label));
|
|
122
|
+
let start = 0;
|
|
123
|
+
return /* @__PURE__ */ jsx(CommandRows.Provider, {
|
|
124
|
+
value: registerItem,
|
|
125
|
+
children: /* @__PURE__ */ jsxs(ScrollArea2, {
|
|
126
|
+
className: cn2(popupScrollAreaClass, className),
|
|
127
|
+
viewportClassName: cn2(popupViewportClass, "scroll-fade"),
|
|
128
|
+
children: [
|
|
129
|
+
/* @__PURE__ */ jsx(Autocomplete.Empty, {
|
|
130
|
+
className: "px-4 py-6 text-center text-body text-muted-foreground empty:hidden",
|
|
131
|
+
children: emptyMessage
|
|
132
|
+
}),
|
|
133
|
+
/* @__PURE__ */ jsxs(Autocomplete.List, {
|
|
134
|
+
ref: containerRef,
|
|
135
|
+
className: "relative flex flex-col p-1 outline-none data-[empty]:p-0",
|
|
136
|
+
children: [
|
|
137
|
+
/* @__PURE__ */ jsx(FluidHoverHighlight2, {
|
|
138
|
+
rect,
|
|
139
|
+
session: 0,
|
|
140
|
+
className: listShape.bg
|
|
141
|
+
}),
|
|
142
|
+
isGrouped(filtered) ? filtered.map((group) => {
|
|
143
|
+
const first = start;
|
|
144
|
+
start += group.items.length;
|
|
145
|
+
return /* @__PURE__ */ jsxs(Autocomplete.Group, {
|
|
146
|
+
className: "flex flex-col",
|
|
147
|
+
children: [
|
|
148
|
+
/* @__PURE__ */ jsx(Autocomplete.GroupLabel, {
|
|
149
|
+
className: cn2("shrink-0 px-2 pt-2 pb-1 text-muted-foreground", compact ? "text-caption-compact" : "text-caption"),
|
|
150
|
+
children: group.label
|
|
151
|
+
}),
|
|
152
|
+
rows(group.items, first)
|
|
153
|
+
]
|
|
154
|
+
}, group.label);
|
|
155
|
+
}) : rows(filtered, 0)
|
|
156
|
+
]
|
|
157
|
+
})
|
|
158
|
+
]
|
|
159
|
+
})
|
|
160
|
+
});
|
|
161
|
+
}
|
|
162
|
+
function CommandPalette2({
|
|
163
|
+
items,
|
|
164
|
+
placeholder = "Type a command or search…",
|
|
165
|
+
emptyMessage = "No results found.",
|
|
166
|
+
className
|
|
167
|
+
}) {
|
|
168
|
+
const { close } = useContext(CommandContext);
|
|
169
|
+
const SearchIcon = useIcon("search");
|
|
170
|
+
const size = useSize2();
|
|
171
|
+
const [query, setQuery] = useState("");
|
|
172
|
+
return /* @__PURE__ */ jsx(CommandListRoot2, {
|
|
173
|
+
items,
|
|
174
|
+
inline: true,
|
|
175
|
+
open: true,
|
|
176
|
+
autoHighlight: "always",
|
|
177
|
+
keepHighlight: true,
|
|
178
|
+
value: query,
|
|
179
|
+
onValueChange: (next, details) => {
|
|
180
|
+
if (details.reason === "item-press")
|
|
181
|
+
return;
|
|
182
|
+
setQuery(next);
|
|
183
|
+
},
|
|
184
|
+
children: /* @__PURE__ */ jsxs("div", {
|
|
185
|
+
className: cn2("flex flex-col", className),
|
|
186
|
+
children: [
|
|
187
|
+
/* @__PURE__ */ jsxs("div", {
|
|
188
|
+
className: "flex h-12 shrink-0 items-center gap-2 border-b border-border px-4",
|
|
189
|
+
children: [
|
|
190
|
+
/* @__PURE__ */ jsx(SearchIcon, {
|
|
191
|
+
size: size.icon,
|
|
192
|
+
strokeWidth: 1.5,
|
|
193
|
+
className: "shrink-0 text-muted-foreground"
|
|
194
|
+
}),
|
|
195
|
+
/* @__PURE__ */ jsx(Autocomplete.Input, {
|
|
196
|
+
placeholder,
|
|
197
|
+
className: cn2("h-full min-w-0 flex-1 bg-transparent text-foreground outline-none placeholder:text-muted-foreground", size.text)
|
|
198
|
+
})
|
|
199
|
+
]
|
|
200
|
+
}),
|
|
201
|
+
/* @__PURE__ */ jsx(CommandList2, {
|
|
202
|
+
emptyMessage,
|
|
203
|
+
className: "max-h-80",
|
|
204
|
+
onPick: (item) => {
|
|
205
|
+
item.onSelect?.();
|
|
206
|
+
close();
|
|
207
|
+
}
|
|
208
|
+
})
|
|
209
|
+
]
|
|
210
|
+
})
|
|
211
|
+
});
|
|
212
|
+
}
|
|
213
|
+
var CommandTrigger2 = forwardRef((props, ref) => {
|
|
214
|
+
const { trigger } = useContext(CommandContext);
|
|
215
|
+
useImperativeHandle(ref, () => trigger.current);
|
|
216
|
+
return /* @__PURE__ */ jsx(DialogTrigger2, {
|
|
217
|
+
ref: trigger,
|
|
218
|
+
...props
|
|
219
|
+
});
|
|
220
|
+
});
|
|
221
|
+
CommandTrigger2.displayName = "CommandTrigger";
|
|
222
|
+
var CommandContent2 = forwardRef(({ items, placeholder, emptyMessage, className, label = "Command menu", ...morph }, ref) => {
|
|
223
|
+
const { session } = useContext(CommandContext);
|
|
224
|
+
return /* @__PURE__ */ jsx(DialogContent2, {
|
|
225
|
+
ref,
|
|
226
|
+
position: "top",
|
|
227
|
+
size: "lg",
|
|
228
|
+
showCloseButton: false,
|
|
229
|
+
"aria-label": label,
|
|
230
|
+
className: "p-0",
|
|
231
|
+
...morph,
|
|
232
|
+
children: /* @__PURE__ */ jsx(CommandPalette2, {
|
|
233
|
+
items,
|
|
234
|
+
placeholder,
|
|
235
|
+
emptyMessage,
|
|
236
|
+
className
|
|
237
|
+
}, session)
|
|
238
|
+
});
|
|
239
|
+
});
|
|
240
|
+
CommandContent2.displayName = "CommandContent";
|
|
241
|
+
function CommandScope({ open, onOpenChange, hotkey, children }) {
|
|
242
|
+
const trigger = useRef(null);
|
|
243
|
+
const change = useRef(onOpenChange);
|
|
244
|
+
change.current = onOpenChange;
|
|
245
|
+
const [session, setSession] = useState(0);
|
|
246
|
+
const [wasOpen, setWasOpen] = useState(open);
|
|
247
|
+
if (open !== wasOpen) {
|
|
248
|
+
setWasOpen(open);
|
|
249
|
+
if (open)
|
|
250
|
+
setSession(session + 1);
|
|
251
|
+
}
|
|
252
|
+
useEffect(() => {
|
|
253
|
+
if (!hotkey)
|
|
254
|
+
return;
|
|
255
|
+
const onKey = (event) => {
|
|
256
|
+
if (event.defaultPrevented || !(event.metaKey || event.ctrlKey) || event.key.toLowerCase() !== hotkey)
|
|
257
|
+
return;
|
|
258
|
+
event.preventDefault();
|
|
259
|
+
change.current(!open, { trigger: trigger.current ?? undefined });
|
|
260
|
+
};
|
|
261
|
+
window.addEventListener("keydown", onKey, open);
|
|
262
|
+
return () => window.removeEventListener("keydown", onKey, open);
|
|
263
|
+
}, [hotkey, open]);
|
|
264
|
+
const ctx = useMemo(() => ({ trigger, close: () => change.current(false, {}), session }), [session]);
|
|
265
|
+
return /* @__PURE__ */ jsx(CommandContext.Provider, {
|
|
266
|
+
value: ctx,
|
|
267
|
+
children: /* @__PURE__ */ jsx(DialogPrimitive.Root, {
|
|
268
|
+
open,
|
|
269
|
+
onOpenChange,
|
|
270
|
+
children
|
|
271
|
+
})
|
|
272
|
+
});
|
|
273
|
+
}
|
|
274
|
+
function Command2({ open, defaultOpen, onOpenChange, hotkey = "k", children }) {
|
|
275
|
+
return /* @__PURE__ */ jsx(DialogState2, {
|
|
276
|
+
open,
|
|
277
|
+
defaultOpen,
|
|
278
|
+
onOpenChange,
|
|
279
|
+
children: (root) => /* @__PURE__ */ jsx(CommandScope, {
|
|
280
|
+
...root,
|
|
281
|
+
hotkey,
|
|
282
|
+
children
|
|
283
|
+
})
|
|
284
|
+
});
|
|
285
|
+
}
|
|
286
|
+
Command2.Trigger = CommandTrigger2;
|
|
287
|
+
Command2.Content = CommandContent2;
|
|
288
|
+
Command2.Palette = CommandPalette2;
|
|
289
|
+
Command2.Shortcut = CommandShortcut2;
|
|
290
|
+
var command_default = Command2;
|
|
291
|
+
|
|
292
|
+
export { CommandListRoot2, CommandShortcut2, CommandList2, CommandPalette2, CommandTrigger2, CommandContent2, Command2, command_default };
|