@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,346 @@
|
|
|
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
|
+
holdExit
|
|
10
|
+
} from "./components-hqeq3w9q.js";
|
|
11
|
+
import {
|
|
12
|
+
cn2
|
|
13
|
+
} from "./components-ezxhrmer.js";
|
|
14
|
+
import {
|
|
15
|
+
useShape
|
|
16
|
+
} from "./components-cv16mryv.js";
|
|
17
|
+
import {
|
|
18
|
+
sizeMap2
|
|
19
|
+
} from "./components-0sn7ypjw.js";
|
|
20
|
+
import {
|
|
21
|
+
slotRender
|
|
22
|
+
} from "./components-3ky44908.js";
|
|
23
|
+
import {
|
|
24
|
+
SURFACE_BG,
|
|
25
|
+
SURFACE_SHADOW,
|
|
26
|
+
useSurface2,
|
|
27
|
+
SurfaceProvider2
|
|
28
|
+
} from "./components-zx6b6yby.js";
|
|
29
|
+
import {
|
|
30
|
+
button_default
|
|
31
|
+
} from "./components-b2wyq2cq.js";
|
|
32
|
+
import {
|
|
33
|
+
spring2
|
|
34
|
+
} from "./components-1v7rxytx.js";
|
|
35
|
+
|
|
36
|
+
// components/overlays/toast/index.tsx
|
|
37
|
+
import { Toast as ToastPrimitive } from "@base-ui/react/toast";
|
|
38
|
+
import { ArrowRight, Check, CircleAlert, Info, LoaderCircle, X } from "lucide-react";
|
|
39
|
+
import { AnimatePresence, motion } from "motion/react";
|
|
40
|
+
import {
|
|
41
|
+
cloneElement,
|
|
42
|
+
createContext,
|
|
43
|
+
forwardRef,
|
|
44
|
+
useContext,
|
|
45
|
+
useEffect,
|
|
46
|
+
useId,
|
|
47
|
+
useLayoutEffect,
|
|
48
|
+
useMemo,
|
|
49
|
+
useRef,
|
|
50
|
+
useState
|
|
51
|
+
} from "react";
|
|
52
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
53
|
+
var ICONS = {
|
|
54
|
+
success: Check,
|
|
55
|
+
loading: LoaderCircle,
|
|
56
|
+
error: X,
|
|
57
|
+
warning: CircleAlert,
|
|
58
|
+
info: Info,
|
|
59
|
+
action: ArrowRight
|
|
60
|
+
};
|
|
61
|
+
var TONES = {
|
|
62
|
+
success: "text-status-success bg-status-success/16",
|
|
63
|
+
loading: "text-status-loading bg-status-loading/16",
|
|
64
|
+
error: "text-status-error bg-status-error/16",
|
|
65
|
+
warning: "text-status-warning bg-status-warning/16",
|
|
66
|
+
info: "text-status-info bg-status-info/16",
|
|
67
|
+
action: "text-status-action bg-status-action/16"
|
|
68
|
+
};
|
|
69
|
+
var VIEWPORT = {
|
|
70
|
+
"top-left": "top-4 left-4 items-start",
|
|
71
|
+
"top-center": "top-4 left-1/2 -translate-x-1/2 items-center",
|
|
72
|
+
"top-right": "top-4 right-4 items-end",
|
|
73
|
+
"bottom-left": "bottom-4 left-4 flex-col-reverse items-start",
|
|
74
|
+
"bottom-center": "bottom-4 left-1/2 -translate-x-1/2 flex-col-reverse items-center",
|
|
75
|
+
"bottom-right": "bottom-4 right-4 flex-col-reverse items-end"
|
|
76
|
+
};
|
|
77
|
+
var PILL = sizeMap2.default.controlHeight;
|
|
78
|
+
var BLUR = PILL / 2 * GOO_BLUR_RATIO;
|
|
79
|
+
var SNAP = { duration: 0 };
|
|
80
|
+
var AUTO_EXPAND_MS = 150;
|
|
81
|
+
var AUTO_COLLAPSE_BEFORE_MS = 2000;
|
|
82
|
+
var ToastSettings = createContext({
|
|
83
|
+
position: "top-right",
|
|
84
|
+
timeout: 6000
|
|
85
|
+
});
|
|
86
|
+
function useToast2() {
|
|
87
|
+
const manager = ToastPrimitive.useToastManager();
|
|
88
|
+
return useMemo(() => {
|
|
89
|
+
const options = ({ action, ...rest }, type) => ({
|
|
90
|
+
...rest,
|
|
91
|
+
type,
|
|
92
|
+
actionProps: action && { children: action.label, onClick: action.onClick }
|
|
93
|
+
});
|
|
94
|
+
const show = (o) => manager.add(options(o, o.type ?? "info"));
|
|
95
|
+
return {
|
|
96
|
+
show,
|
|
97
|
+
success: (o) => show({ ...o, type: "success" }),
|
|
98
|
+
error: (o) => show({ ...o, type: "error" }),
|
|
99
|
+
warning: (o) => show({ ...o, type: "warning" }),
|
|
100
|
+
info: (o) => show({ ...o, type: "info" }),
|
|
101
|
+
promise: (promise, o) => manager.promise(promise, {
|
|
102
|
+
loading: options(o.loading, "loading"),
|
|
103
|
+
success: options(o.success, "success"),
|
|
104
|
+
error: options(o.error, "error")
|
|
105
|
+
}),
|
|
106
|
+
close: manager.close
|
|
107
|
+
};
|
|
108
|
+
}, [manager]);
|
|
109
|
+
}
|
|
110
|
+
function Shape({ box, className, shapeRef }) {
|
|
111
|
+
const reduced = useReduceMotion();
|
|
112
|
+
return /* @__PURE__ */ jsx(motion.div, {
|
|
113
|
+
ref: shapeRef,
|
|
114
|
+
"aria-hidden": true,
|
|
115
|
+
className: cn2("pointer-events-none absolute top-0 left-0", className),
|
|
116
|
+
initial: false,
|
|
117
|
+
animate: { ...box },
|
|
118
|
+
transition: reduced ? SNAP : spring2.slow
|
|
119
|
+
});
|
|
120
|
+
}
|
|
121
|
+
function ToastItem({ toast }) {
|
|
122
|
+
const { position, timeout } = useContext(ToastSettings);
|
|
123
|
+
const shape = useShape();
|
|
124
|
+
const level = Math.min(useSurface2() + 2, 8);
|
|
125
|
+
const gooId = `toast-goo-${useId().replace(/:/g, "")}`;
|
|
126
|
+
const type = toast.type ?? "info";
|
|
127
|
+
const Icon = ICONS[type];
|
|
128
|
+
const top = position.startsWith("top");
|
|
129
|
+
const ending = toast.transitionStatus === "ending";
|
|
130
|
+
const hasBody = Boolean(toast.description || toast.actionProps);
|
|
131
|
+
const [hovered, setHovered] = useState(false);
|
|
132
|
+
const [auto, setAuto] = useState(false);
|
|
133
|
+
const expanded = hasBody && type !== "loading" && !ending && (hovered || auto);
|
|
134
|
+
const root = useRef(null);
|
|
135
|
+
const header = useRef(null);
|
|
136
|
+
const body = useRef(null);
|
|
137
|
+
const bodyShape = useRef(null);
|
|
138
|
+
const [size, setSize] = useState({ width: 0, pill: PILL, body: 0, radius: 0 });
|
|
139
|
+
useEffect(() => {
|
|
140
|
+
if (!hasBody || type === "loading")
|
|
141
|
+
return;
|
|
142
|
+
const life = toast.timeout ?? timeout;
|
|
143
|
+
const open = setTimeout(() => setAuto(true), AUTO_EXPAND_MS);
|
|
144
|
+
const close = life > 0 ? setTimeout(() => setAuto(false), Math.max(AUTO_EXPAND_MS, life - AUTO_COLLAPSE_BEFORE_MS)) : undefined;
|
|
145
|
+
return () => {
|
|
146
|
+
clearTimeout(open);
|
|
147
|
+
clearTimeout(close);
|
|
148
|
+
};
|
|
149
|
+
}, [hasBody, type, toast.timeout, timeout]);
|
|
150
|
+
useLayoutEffect(() => {
|
|
151
|
+
const measure = () => setSize({
|
|
152
|
+
width: root.current?.offsetWidth ?? 0,
|
|
153
|
+
pill: Math.max(PILL, header.current?.offsetWidth ?? 0),
|
|
154
|
+
body: body.current?.offsetHeight ?? 0,
|
|
155
|
+
radius: bodyShape.current ? Number.parseFloat(getComputedStyle(bodyShape.current).borderTopLeftRadius) || 0 : 0
|
|
156
|
+
});
|
|
157
|
+
const observer = new ResizeObserver(measure);
|
|
158
|
+
for (const el of [header.current, body.current])
|
|
159
|
+
if (el)
|
|
160
|
+
observer.observe(el);
|
|
161
|
+
measure();
|
|
162
|
+
return () => observer.disconnect();
|
|
163
|
+
}, [hasBody]);
|
|
164
|
+
useLayoutEffect(() => {
|
|
165
|
+
if (!ending || !root.current)
|
|
166
|
+
return;
|
|
167
|
+
const hold = holdExit(root.current, "moderate");
|
|
168
|
+
return () => hold.cancel();
|
|
169
|
+
}, [ending]);
|
|
170
|
+
const bodyHeight = expanded ? size.body : 0;
|
|
171
|
+
const height = PILL + bodyHeight;
|
|
172
|
+
const pillX = position.endsWith("left") ? 0 : position.endsWith("right") ? size.width - size.pill : (size.width - size.pill) / 2;
|
|
173
|
+
const pillHeight = PILL + Math.min(bodyHeight, size.radius);
|
|
174
|
+
const pill = { x: pillX, y: top ? 0 : height - pillHeight, width: size.pill, height: pillHeight };
|
|
175
|
+
const bodyBox = { x: 0, y: top ? PILL : 0, width: size.width, height: bodyHeight };
|
|
176
|
+
const reduced = useReduceMotion();
|
|
177
|
+
const away = reduced ? { opacity: 0 } : { opacity: 0, y: top ? -6 : 6, scale: 0.95 };
|
|
178
|
+
const move = reduced ? SNAP : spring2.slow;
|
|
179
|
+
return /* @__PURE__ */ jsxs(ToastPrimitive.Root, {
|
|
180
|
+
ref: root,
|
|
181
|
+
toast,
|
|
182
|
+
swipeDirection: [top ? "up" : "down", position.endsWith("left") ? "left" : "right"],
|
|
183
|
+
onMouseEnter: () => setHovered(true),
|
|
184
|
+
onMouseLeave: () => setHovered(false),
|
|
185
|
+
render: /* @__PURE__ */ jsx(motion.div, {
|
|
186
|
+
initial: { ...away, height: PILL },
|
|
187
|
+
animate: ending ? { ...away, height } : { opacity: 1, y: 0, scale: 1, height },
|
|
188
|
+
transition: ending ? spring2.moderate.exit : { ...spring2.moderate, height: move }
|
|
189
|
+
}),
|
|
190
|
+
className: "relative w-[min(22rem,calc(100vw-2rem))] select-none outline-none [translate:var(--toast-swipe-movement-x)_var(--toast-swipe-movement-y)]",
|
|
191
|
+
children: [
|
|
192
|
+
/* @__PURE__ */ jsx(GooFilter, {
|
|
193
|
+
id: gooId,
|
|
194
|
+
blur: BLUR
|
|
195
|
+
}),
|
|
196
|
+
/* @__PURE__ */ jsx(Shape, {
|
|
197
|
+
box: pill,
|
|
198
|
+
className: cn2("rounded-full", SURFACE_SHADOW[3])
|
|
199
|
+
}),
|
|
200
|
+
hasBody && /* @__PURE__ */ jsx(Shape, {
|
|
201
|
+
box: bodyBox,
|
|
202
|
+
className: cn2(shape.container, SURFACE_SHADOW[3])
|
|
203
|
+
}),
|
|
204
|
+
/* @__PURE__ */ jsxs("div", {
|
|
205
|
+
"aria-hidden": true,
|
|
206
|
+
className: "pointer-events-none absolute inset-0",
|
|
207
|
+
style: { filter: `url(#${gooId})` },
|
|
208
|
+
children: [
|
|
209
|
+
/* @__PURE__ */ jsx(Shape, {
|
|
210
|
+
box: pill,
|
|
211
|
+
className: cn2("rounded-full", SURFACE_BG[level])
|
|
212
|
+
}),
|
|
213
|
+
hasBody && /* @__PURE__ */ jsx(Shape, {
|
|
214
|
+
box: bodyBox,
|
|
215
|
+
shapeRef: bodyShape,
|
|
216
|
+
className: cn2(shape.container, SURFACE_BG[level])
|
|
217
|
+
})
|
|
218
|
+
]
|
|
219
|
+
}),
|
|
220
|
+
/* @__PURE__ */ jsxs(SurfaceProvider2, {
|
|
221
|
+
value: level,
|
|
222
|
+
children: [
|
|
223
|
+
/* @__PURE__ */ jsx(motion.div, {
|
|
224
|
+
ref: header,
|
|
225
|
+
className: "absolute top-0 left-0 flex h-9 w-max items-center py-1.5 pr-4 pl-1.5",
|
|
226
|
+
initial: false,
|
|
227
|
+
animate: { x: pillX, y: top ? 0 : height - PILL },
|
|
228
|
+
transition: move,
|
|
229
|
+
children: /* @__PURE__ */ jsx(ToastPrimitive.Title, {
|
|
230
|
+
className: "relative inline-flex items-center whitespace-nowrap",
|
|
231
|
+
children: /* @__PURE__ */ jsx(AnimatePresence, {
|
|
232
|
+
mode: "popLayout",
|
|
233
|
+
initial: false,
|
|
234
|
+
children: /* @__PURE__ */ jsxs(motion.span, {
|
|
235
|
+
className: "inline-flex items-center gap-2",
|
|
236
|
+
initial: { opacity: 0, filter: "blur(4px)" },
|
|
237
|
+
animate: { opacity: 1, filter: "blur(0px)" },
|
|
238
|
+
exit: { opacity: 0, filter: "blur(4px)", transition: spring2.moderate.exit },
|
|
239
|
+
transition: spring2.moderate,
|
|
240
|
+
children: [
|
|
241
|
+
/* @__PURE__ */ jsx("span", {
|
|
242
|
+
className: cn2("flex size-6 items-center justify-center rounded-full", TONES[type]),
|
|
243
|
+
children: /* @__PURE__ */ jsx(Icon, {
|
|
244
|
+
size: 14,
|
|
245
|
+
strokeWidth: 2.5,
|
|
246
|
+
className: type === "loading" ? "animate-spin" : undefined
|
|
247
|
+
})
|
|
248
|
+
}),
|
|
249
|
+
/* @__PURE__ */ jsx("span", {
|
|
250
|
+
className: "text-body weight-medium text-foreground",
|
|
251
|
+
children: toast.title
|
|
252
|
+
})
|
|
253
|
+
]
|
|
254
|
+
}, `${type}-${toast.title}`)
|
|
255
|
+
})
|
|
256
|
+
})
|
|
257
|
+
}),
|
|
258
|
+
hasBody && /* @__PURE__ */ jsx(motion.div, {
|
|
259
|
+
className: "absolute top-0 left-0 w-full overflow-hidden",
|
|
260
|
+
initial: false,
|
|
261
|
+
animate: { y: bodyBox.y, height: bodyHeight, opacity: expanded ? 1 : 0 },
|
|
262
|
+
transition: { ...move, opacity: expanded ? spring2.slow : spring2.slow.exit },
|
|
263
|
+
children: /* @__PURE__ */ jsxs("div", {
|
|
264
|
+
ref: body,
|
|
265
|
+
className: cn2("flex flex-col items-start gap-3 p-4", top ? "pt-6" : "pb-6"),
|
|
266
|
+
children: [
|
|
267
|
+
/* @__PURE__ */ jsx(ToastPrimitive.Description, {
|
|
268
|
+
className: "text-caption text-muted-foreground"
|
|
269
|
+
}),
|
|
270
|
+
toast.actionProps && /* @__PURE__ */ jsx(ToastPrimitive.Action, {
|
|
271
|
+
render: /* @__PURE__ */ jsx(button_default, {
|
|
272
|
+
size: "compact",
|
|
273
|
+
variant: "secondary"
|
|
274
|
+
})
|
|
275
|
+
})
|
|
276
|
+
]
|
|
277
|
+
})
|
|
278
|
+
})
|
|
279
|
+
]
|
|
280
|
+
})
|
|
281
|
+
]
|
|
282
|
+
});
|
|
283
|
+
}
|
|
284
|
+
function ToastList() {
|
|
285
|
+
const { toasts } = ToastPrimitive.useToastManager();
|
|
286
|
+
return toasts.map((toast) => /* @__PURE__ */ jsx(ToastItem, {
|
|
287
|
+
toast
|
|
288
|
+
}, toast.id));
|
|
289
|
+
}
|
|
290
|
+
var ToastTrigger2 = forwardRef(({
|
|
291
|
+
title,
|
|
292
|
+
description,
|
|
293
|
+
type,
|
|
294
|
+
timeout,
|
|
295
|
+
action,
|
|
296
|
+
promise,
|
|
297
|
+
success,
|
|
298
|
+
error,
|
|
299
|
+
render,
|
|
300
|
+
asChild,
|
|
301
|
+
children,
|
|
302
|
+
onClick,
|
|
303
|
+
...props
|
|
304
|
+
}, ref) => {
|
|
305
|
+
const toast = useToast2();
|
|
306
|
+
const el = slotRender(render, asChild, children);
|
|
307
|
+
const press = (event) => {
|
|
308
|
+
onClick?.(event);
|
|
309
|
+
if (promise) {
|
|
310
|
+
toast.promise(promise(), { loading: { title, description }, success: success ?? {}, error: error ?? {} }).catch(() => {});
|
|
311
|
+
return;
|
|
312
|
+
}
|
|
313
|
+
toast.show({ title, description, type, timeout, action });
|
|
314
|
+
};
|
|
315
|
+
return el ? cloneElement(el, { ...props, ref, onClick: press }) : /* @__PURE__ */ jsx("button", {
|
|
316
|
+
ref,
|
|
317
|
+
type: "button",
|
|
318
|
+
...props,
|
|
319
|
+
onClick: press,
|
|
320
|
+
children
|
|
321
|
+
});
|
|
322
|
+
});
|
|
323
|
+
ToastTrigger2.displayName = "ToastTrigger";
|
|
324
|
+
function Toast2({ position = "top-right", limit = 3, timeout = 6000, children }) {
|
|
325
|
+
const settings = useMemo(() => ({ position, timeout }), [position, timeout]);
|
|
326
|
+
return /* @__PURE__ */ jsx(ToastPrimitive.Provider, {
|
|
327
|
+
limit,
|
|
328
|
+
timeout,
|
|
329
|
+
children: /* @__PURE__ */ jsxs(ToastSettings.Provider, {
|
|
330
|
+
value: settings,
|
|
331
|
+
children: [
|
|
332
|
+
children,
|
|
333
|
+
/* @__PURE__ */ jsx(ToastPrimitive.Portal, {
|
|
334
|
+
children: /* @__PURE__ */ jsx(ToastPrimitive.Viewport, {
|
|
335
|
+
className: cn2("fixed z-[60] flex flex-col gap-2 outline-none", VIEWPORT[position]),
|
|
336
|
+
children: /* @__PURE__ */ jsx(ToastList, {})
|
|
337
|
+
})
|
|
338
|
+
})
|
|
339
|
+
]
|
|
340
|
+
})
|
|
341
|
+
});
|
|
342
|
+
}
|
|
343
|
+
Toast2.Trigger = ToastTrigger2;
|
|
344
|
+
var toast_default = Toast2;
|
|
345
|
+
|
|
346
|
+
export { useToast2, ToastTrigger2, Toast2, toast_default };
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import {
|
|
2
|
+
cn2
|
|
3
|
+
} from "./components-ezxhrmer.js";
|
|
4
|
+
import {
|
|
5
|
+
GooIndicator
|
|
6
|
+
} from "./components-chacnk61.js";
|
|
7
|
+
import {
|
|
8
|
+
spring2
|
|
9
|
+
} from "./components-1v7rxytx.js";
|
|
10
|
+
|
|
11
|
+
// lib/fluid-hover-highlight.tsx
|
|
12
|
+
import { AnimatePresence, motion, useReducedMotion } from "motion/react";
|
|
13
|
+
import { jsx } from "react/jsx-runtime";
|
|
14
|
+
var fade = { duration: 0.08 };
|
|
15
|
+
function resolveHighlightSource(props) {
|
|
16
|
+
if (props.hover) {
|
|
17
|
+
const { activeIndex, itemRects, isMeasured, sessionRef } = props.hover;
|
|
18
|
+
const rect = !props.hidden && isMeasured && activeIndex !== null ? itemRects[activeIndex] ?? null : null;
|
|
19
|
+
return { rect, session: sessionRef.current };
|
|
20
|
+
}
|
|
21
|
+
return { rect: props.rect, session: props.session };
|
|
22
|
+
}
|
|
23
|
+
function FluidHoverHighlight2(props) {
|
|
24
|
+
const { from, className, transition } = props;
|
|
25
|
+
const { rect, session } = resolveHighlightSource(props);
|
|
26
|
+
const reduceMotion = useReducedMotion() ?? false;
|
|
27
|
+
return /* @__PURE__ */ jsx(AnimatePresence, {
|
|
28
|
+
children: rect && /* @__PURE__ */ jsx(motion.div, {
|
|
29
|
+
"data-slot": "fluid-hover-highlight",
|
|
30
|
+
className: "pointer-events-none absolute top-0 left-0",
|
|
31
|
+
initial: { opacity: 0 },
|
|
32
|
+
animate: { opacity: 1 },
|
|
33
|
+
exit: { opacity: 0, transition: spring2.fast.exit },
|
|
34
|
+
transition: fade,
|
|
35
|
+
children: /* @__PURE__ */ jsx(GooIndicator, {
|
|
36
|
+
rect,
|
|
37
|
+
from,
|
|
38
|
+
className: cn2("bg-hover", className),
|
|
39
|
+
transition: transition === false || reduceMotion ? false : transition ?? spring2.fast
|
|
40
|
+
})
|
|
41
|
+
}, session)
|
|
42
|
+
});
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
export { FluidHoverHighlight2 };
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
// lib/reduced-motion.ts
|
|
2
|
+
import { useReducedMotion, useReducedMotionConfig } from "motion/react";
|
|
3
|
+
function useReduceMotion() {
|
|
4
|
+
const os = useReducedMotion() ?? false;
|
|
5
|
+
const config = useReducedMotionConfig() ?? false;
|
|
6
|
+
return os || config;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
export { useReduceMotion };
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
// lib/field-classes.ts
|
|
2
|
+
import { cva } from "class-variance-authority";
|
|
3
|
+
var fieldVariants = cva([
|
|
4
|
+
"group/field ring-1 cursor-text transition-[background-color,box-shadow,opacity] duration-fast",
|
|
5
|
+
"hover:bg-muted/50 hover:ring-border data-[active]:bg-muted/50 data-[active]:ring-border",
|
|
6
|
+
"focus-within:!bg-card focus-within:ring-border",
|
|
7
|
+
"data-[invalid]:!ring-destructive/50 data-[invalid]:hover:bg-destructive-light/60 data-[invalid]:data-[active]:bg-destructive-light/60",
|
|
8
|
+
"data-[disabled]:ring-border data-[disabled]:opacity-50 data-[disabled]:pointer-events-none"
|
|
9
|
+
], {
|
|
10
|
+
variants: {
|
|
11
|
+
variant: {
|
|
12
|
+
borderless: "bg-transparent ring-transparent",
|
|
13
|
+
bordered: "bg-transparent ring-border"
|
|
14
|
+
}
|
|
15
|
+
},
|
|
16
|
+
defaultVariants: {
|
|
17
|
+
variant: "borderless"
|
|
18
|
+
}
|
|
19
|
+
});
|
|
20
|
+
var fieldIconClasses = "shrink-0 text-muted-foreground transition-[color,stroke-width] duration-fast group-hover/field:text-foreground group-hover/field:stroke-[2] group-data-[active]/field:text-foreground group-data-[active]/field:stroke-[2] group-focus-within/field:text-foreground group-focus-within/field:stroke-[2]";
|
|
21
|
+
|
|
22
|
+
export { fieldVariants, fieldIconClasses };
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
// lib/use-controllable-state.ts
|
|
2
|
+
import { useCallback, useRef, useState } from "react";
|
|
3
|
+
function useControllableState(value, defaultValue, onChange) {
|
|
4
|
+
const [internal, setInternal] = useState(defaultValue);
|
|
5
|
+
const controlled = value !== undefined;
|
|
6
|
+
const current = controlled ? value : internal;
|
|
7
|
+
const currentRef = useRef(current);
|
|
8
|
+
currentRef.current = current;
|
|
9
|
+
const controlledRef = useRef(controlled);
|
|
10
|
+
controlledRef.current = controlled;
|
|
11
|
+
const onChangeRef = useRef(onChange);
|
|
12
|
+
onChangeRef.current = onChange;
|
|
13
|
+
const setValue = useCallback((next) => {
|
|
14
|
+
const prev = currentRef.current;
|
|
15
|
+
const resolved = typeof next === "function" ? next(prev) : next;
|
|
16
|
+
if (Object.is(resolved, prev))
|
|
17
|
+
return;
|
|
18
|
+
currentRef.current = resolved;
|
|
19
|
+
if (!controlledRef.current)
|
|
20
|
+
setInternal(resolved);
|
|
21
|
+
onChangeRef.current?.(resolved);
|
|
22
|
+
}, []);
|
|
23
|
+
return [current, setValue];
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
export { useControllableState };
|
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
import {
|
|
2
|
+
MorphSurface
|
|
3
|
+
} from "./components-0q0sqfh4.js";
|
|
4
|
+
import {
|
|
5
|
+
useMorphOrigin,
|
|
6
|
+
useMorph
|
|
7
|
+
} from "./components-hqeq3w9q.js";
|
|
8
|
+
import {
|
|
9
|
+
cn2
|
|
10
|
+
} from "./components-ezxhrmer.js";
|
|
11
|
+
import {
|
|
12
|
+
useShape
|
|
13
|
+
} from "./components-cv16mryv.js";
|
|
14
|
+
|
|
15
|
+
// components/overlays/tooltip/index.tsx
|
|
16
|
+
import { Tooltip as TooltipPrimitive } from "@base-ui/react/tooltip";
|
|
17
|
+
import { motion, useMotionValue } from "motion/react";
|
|
18
|
+
import { createContext, useContext, useEffect, useRef, useState } from "react";
|
|
19
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
20
|
+
var TooltipPortalContainerContext = createContext(null);
|
|
21
|
+
function TooltipPortalContainer2({ value, children }) {
|
|
22
|
+
return /* @__PURE__ */ jsx(TooltipPortalContainerContext.Provider, {
|
|
23
|
+
value,
|
|
24
|
+
children
|
|
25
|
+
});
|
|
26
|
+
}
|
|
27
|
+
var DEFAULT_DELAY = 200;
|
|
28
|
+
var TooltipGroupContext = createContext(false);
|
|
29
|
+
function TooltipProvider2({ children, delayDuration = DEFAULT_DELAY, skipDelayDuration = 300 }) {
|
|
30
|
+
return /* @__PURE__ */ jsx(TooltipGroupContext.Provider, {
|
|
31
|
+
value: true,
|
|
32
|
+
children: /* @__PURE__ */ jsx(TooltipPrimitive.Provider, {
|
|
33
|
+
delay: delayDuration,
|
|
34
|
+
timeout: skipDelayDuration,
|
|
35
|
+
children
|
|
36
|
+
})
|
|
37
|
+
});
|
|
38
|
+
}
|
|
39
|
+
function Tooltip2({
|
|
40
|
+
content,
|
|
41
|
+
children,
|
|
42
|
+
side = "top",
|
|
43
|
+
sideOffset = 8,
|
|
44
|
+
delayDuration,
|
|
45
|
+
className,
|
|
46
|
+
contentClassName,
|
|
47
|
+
forceOpen,
|
|
48
|
+
onOpenChange: onOpenChangeProp,
|
|
49
|
+
followCursor,
|
|
50
|
+
from,
|
|
51
|
+
effect = "goo",
|
|
52
|
+
tier = "moderate"
|
|
53
|
+
}) {
|
|
54
|
+
const [internalOpen, setInternalOpen] = useState(false);
|
|
55
|
+
const open = forceOpen !== undefined ? forceOpen : internalOpen;
|
|
56
|
+
const shape = useShape();
|
|
57
|
+
const portalContainer = useContext(TooltipPortalContainerContext);
|
|
58
|
+
const hasAmbientProvider = useContext(TooltipGroupContext);
|
|
59
|
+
const { origin, capture } = useMorphOrigin();
|
|
60
|
+
const handedOff = useRef(false);
|
|
61
|
+
const morph = useMorph(open, origin, {
|
|
62
|
+
from,
|
|
63
|
+
effect: followCursor ? "fade" : effect,
|
|
64
|
+
tier,
|
|
65
|
+
instant: (popup) => handedOff.current || popup.dataset.instant === "delay"
|
|
66
|
+
});
|
|
67
|
+
const followOffset = useMotionValue(0);
|
|
68
|
+
useEffect(() => {
|
|
69
|
+
if (forceOpen && followCursor)
|
|
70
|
+
followOffset.set(0);
|
|
71
|
+
}, [forceOpen, followCursor, followOffset]);
|
|
72
|
+
const handleFollowMove = (event) => {
|
|
73
|
+
if (!followCursor)
|
|
74
|
+
return;
|
|
75
|
+
const rect = event.currentTarget.getBoundingClientRect();
|
|
76
|
+
followOffset.set(followCursor === "y" ? event.clientY - (rect.top + rect.height / 2) : event.clientX - (rect.left + rect.width / 2));
|
|
77
|
+
};
|
|
78
|
+
const tooltip = /* @__PURE__ */ jsxs(TooltipPrimitive.Root, {
|
|
79
|
+
open,
|
|
80
|
+
onOpenChange: (v, details) => {
|
|
81
|
+
if (v)
|
|
82
|
+
capture(details);
|
|
83
|
+
handedOff.current = !v && details.reason === "none";
|
|
84
|
+
setInternalOpen(v);
|
|
85
|
+
onOpenChangeProp?.(v);
|
|
86
|
+
},
|
|
87
|
+
children: [
|
|
88
|
+
/* @__PURE__ */ jsx(TooltipPrimitive.Trigger, {
|
|
89
|
+
render: children,
|
|
90
|
+
delay: delayDuration,
|
|
91
|
+
onPointerMove: followCursor ? handleFollowMove : undefined
|
|
92
|
+
}),
|
|
93
|
+
/* @__PURE__ */ jsx(TooltipPrimitive.Portal, {
|
|
94
|
+
container: portalContainer ?? undefined,
|
|
95
|
+
children: /* @__PURE__ */ jsx(TooltipPrimitive.Positioner, {
|
|
96
|
+
side,
|
|
97
|
+
sideOffset,
|
|
98
|
+
className: cn2("z-50", contentClassName),
|
|
99
|
+
children: /* @__PURE__ */ jsx(TooltipPrimitive.Popup, {
|
|
100
|
+
ref: morph.popupRef,
|
|
101
|
+
className: "relative outline-none",
|
|
102
|
+
render: /* @__PURE__ */ jsx(motion.div, {
|
|
103
|
+
style: followCursor ? { [followCursor]: followOffset } : {}
|
|
104
|
+
}),
|
|
105
|
+
children: /* @__PURE__ */ jsx(MorphSurface, {
|
|
106
|
+
morph,
|
|
107
|
+
bg: "bg-foreground",
|
|
108
|
+
radius: shape.bg,
|
|
109
|
+
className: cn2("text-background text-caption px-2 py-1", "[text-box:trim-both_cap_alphabetic] supports-[text-box:trim-both]:py-2", "weight-medium", className),
|
|
110
|
+
children: content
|
|
111
|
+
})
|
|
112
|
+
})
|
|
113
|
+
})
|
|
114
|
+
})
|
|
115
|
+
]
|
|
116
|
+
});
|
|
117
|
+
if (hasAmbientProvider)
|
|
118
|
+
return tooltip;
|
|
119
|
+
return /* @__PURE__ */ jsx(TooltipPrimitive.Provider, {
|
|
120
|
+
delay: delayDuration ?? DEFAULT_DELAY,
|
|
121
|
+
children: tooltip
|
|
122
|
+
});
|
|
123
|
+
}
|
|
124
|
+
Tooltip2.Provider = TooltipProvider2;
|
|
125
|
+
Tooltip2.PortalContainer = TooltipPortalContainer2;
|
|
126
|
+
var tooltip_default = Tooltip2;
|
|
127
|
+
|
|
128
|
+
export { TooltipPortalContainer2, TooltipProvider2, Tooltip2, tooltip_default };
|