@nexub/react 2.0.0 → 2.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{chunk-4MEV2WHD.js → chunk-2BAXCPQF.js} +1 -1
- package/dist/{chunk-7BAIEYUW.js → chunk-3FX3FBHE.js} +1 -1
- package/dist/chunk-4GVGS5N4.js +468 -0
- package/dist/{chunk-ZTI4MK3L.js → chunk-5JOKHG4L.js} +1 -1
- package/dist/{chunk-HSM7RXUF.js → chunk-5QZVFW4H.js} +1 -1
- package/dist/{chunk-UVWQPDOV.js → chunk-6ALDF3XF.js} +2 -2
- package/dist/{chunk-V6CMWCJH.js → chunk-6FRG6NMM.js} +2 -2
- package/dist/{chunk-ENB7X3W4.js → chunk-7JXJOYM6.js} +1 -1
- package/dist/{chunk-JVOSMXD5.js → chunk-AKV4GMIY.js} +1 -1
- package/dist/{chunk-FT2S7N64.js → chunk-BSS7QNC5.js} +1 -1
- package/dist/{chunk-OS4NOWEI.js → chunk-D6HHYT2S.js} +1 -1
- package/dist/{chunk-ESMIBOF5.js → chunk-D7HMUIA5.js} +1 -1
- package/dist/{chunk-ETWFHIAE.js → chunk-EA4JBLWK.js} +1 -1
- package/dist/{chunk-UAQRQNOB.js → chunk-EILMNNTT.js} +1 -1
- package/dist/{chunk-IDIS7Z6H.js → chunk-F3DRJSZL.js} +1 -1
- package/dist/{chunk-GSA7NBEG.js → chunk-I6ELDWZE.js} +1 -1
- package/dist/{chunk-OTZBGMYH.js → chunk-IPCB5HU7.js} +1 -1
- package/dist/{chunk-6U5WQERX.js → chunk-KFU2ENV6.js} +2 -2
- package/dist/{chunk-ZRBLASQE.js → chunk-MX6NYEOW.js} +1 -1
- package/dist/{chunk-GG5HDX7J.js → chunk-NITVUZ4L.js} +1 -1
- package/dist/{chunk-XHLSYHAV.js → chunk-NN7SNECM.js} +1 -1
- package/dist/{chunk-BIAYWCDE.js → chunk-O2DSTHXA.js} +1 -1
- package/dist/{chunk-L4BSKMLK.js → chunk-P37ABUFD.js} +1 -1
- package/dist/{chunk-5GN2GFW3.js → chunk-Q4CEJZY6.js} +1 -1
- package/dist/chunk-R3SUPKKI.js +12 -0
- package/dist/{chunk-UV5O2BMW.js → chunk-TSBBWYDO.js} +1 -1
- package/dist/{chunk-RVWQROFK.js → chunk-TXIJMUD5.js} +1 -1
- package/dist/{chunk-O6J6HXVT.js → chunk-VMMZHSZL.js} +1 -1
- package/dist/chunk-VMSWIC3O.js +40 -0
- package/dist/{chunk-WECNLNIA.js → chunk-WASCNEIQ.js} +1 -1
- package/dist/{chunk-RSBJBQPG.js → chunk-WXE6QRHB.js} +1 -1
- package/dist/{chunk-KRHD7VI6.js → chunk-ZVQYAIOA.js} +1 -1
- package/dist/{chunk-PC7YGDNL.js → chunk-ZYR3R36N.js} +3 -3
- package/dist/components/Alert/index.js +2 -2
- package/dist/components/Amount/index.js +4 -4
- package/dist/components/Autocomplete/index.js +2 -2
- package/dist/components/AvatarGroup/index.js +2 -2
- package/dist/components/Banner/index.js +2 -2
- package/dist/components/Breadcrumb/index.js +2 -2
- package/dist/components/Chip/index.js +2 -2
- package/dist/components/Citation/index.js +2 -2
- package/dist/components/CommandPalette/index.js +2 -2
- package/dist/components/DataTable/index.js +2 -2
- package/dist/components/DatePicker/index.js +2 -2
- package/dist/components/DateRangePicker/index.js +3 -3
- package/dist/components/Drawer/index.js +1 -1
- package/dist/components/FileUpload/index.js +2 -2
- package/dist/components/FilterChip/index.js +2 -2
- package/dist/components/FormField/index.js +3 -3
- package/dist/components/MessageBubble/index.js +2 -2
- package/dist/components/MoneyInput/index.js +3 -3
- package/dist/components/Motion/index.js +9 -3
- package/dist/components/NavigationRail/index.js +2 -2
- package/dist/components/NexubProvider/index.js +1 -1
- package/dist/components/NumberInput/index.js +2 -2
- package/dist/components/NumberTicker/index.js +2 -2
- package/dist/components/Pagination/index.js +2 -2
- package/dist/components/PasswordInput/index.js +2 -2
- package/dist/components/PromptInput/index.js +2 -2
- package/dist/components/Rating/index.js +2 -2
- package/dist/components/SearchInput/index.js +2 -2
- package/dist/components/Sidebar/index.js +2 -2
- package/dist/components/Spinner/index.js +2 -2
- package/dist/components/ThinkingIndicator/index.js +2 -2
- package/dist/components/Toast/index.js +2 -2
- package/dist/components/TopNav/index.js +2 -2
- package/dist/index.d.ts +65 -106
- package/dist/index.js +67 -75
- package/package.json +6 -5
- package/dist/chunk-3MSIO7KM.js +0 -129
- package/dist/chunk-CIQHFMF6.js +0 -44
- package/dist/chunk-FS4XKWFA.js +0 -308
- package/dist/{chunk-GLQOEW57.js → chunk-G4RLUGE3.js} +4 -4
|
@@ -0,0 +1,468 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
3
|
+
// src/components/Motion/Fade.tsx
|
|
4
|
+
import * as React2 from "react";
|
|
5
|
+
|
|
6
|
+
// src/components/Motion/useMotion.ts
|
|
7
|
+
import * as React from "react";
|
|
8
|
+
|
|
9
|
+
// src/hooks/useMediaQuery.ts
|
|
10
|
+
import { useState, useEffect } from "react";
|
|
11
|
+
function useMediaQuery(query) {
|
|
12
|
+
const [matches, setMatches] = useState(false);
|
|
13
|
+
useEffect(() => {
|
|
14
|
+
if (typeof window === "undefined") return;
|
|
15
|
+
const mql = window.matchMedia(query);
|
|
16
|
+
const handler = (e) => setMatches(e.matches);
|
|
17
|
+
mql.addEventListener("change", handler);
|
|
18
|
+
setMatches(mql.matches);
|
|
19
|
+
return () => mql.removeEventListener("change", handler);
|
|
20
|
+
}, [query]);
|
|
21
|
+
return matches;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
// src/components/Motion/useMotion.ts
|
|
25
|
+
var DURATION_MS = {
|
|
26
|
+
instant: 0,
|
|
27
|
+
fast: 150,
|
|
28
|
+
normal: 200,
|
|
29
|
+
slow: 300,
|
|
30
|
+
slower: 500
|
|
31
|
+
};
|
|
32
|
+
var SPRING_SPEED = {
|
|
33
|
+
fast: "fast",
|
|
34
|
+
normal: "default",
|
|
35
|
+
slow: "slow",
|
|
36
|
+
slower: "slow"
|
|
37
|
+
};
|
|
38
|
+
var SPRING_MS = {
|
|
39
|
+
spatial: { fast: 224, default: 317, slow: 484 },
|
|
40
|
+
effects: { fast: 150, default: 231, slow: 327 },
|
|
41
|
+
expressive: { fast: 364, default: 435, slow: 600 }
|
|
42
|
+
};
|
|
43
|
+
var FALLBACK_MARGIN_MS = 50;
|
|
44
|
+
var spring = (property, family, speed) => `${property} var(--motion-spring-${family}-${speed}-duration) var(--motion-spring-${family}-${speed}-easing)`;
|
|
45
|
+
function usePrefersReducedMotion() {
|
|
46
|
+
return useMediaQuery("(prefers-reduced-motion: reduce)");
|
|
47
|
+
}
|
|
48
|
+
function useMotion({
|
|
49
|
+
visible,
|
|
50
|
+
duration = "normal",
|
|
51
|
+
easing,
|
|
52
|
+
unmountOnExit = false
|
|
53
|
+
}) {
|
|
54
|
+
const [phase, setPhase] = React.useState(
|
|
55
|
+
visible ? "entered" : "exited"
|
|
56
|
+
);
|
|
57
|
+
const reduced = usePrefersReducedMotion();
|
|
58
|
+
const rafRef = React.useRef(null);
|
|
59
|
+
const isMounted = React.useRef(true);
|
|
60
|
+
React.useEffect(() => {
|
|
61
|
+
isMounted.current = true;
|
|
62
|
+
return () => {
|
|
63
|
+
isMounted.current = false;
|
|
64
|
+
if (rafRef.current !== null) cancelAnimationFrame(rafRef.current);
|
|
65
|
+
};
|
|
66
|
+
}, []);
|
|
67
|
+
const prevVisible = React.useRef(visible);
|
|
68
|
+
React.useEffect(() => {
|
|
69
|
+
if (prevVisible.current === visible) return;
|
|
70
|
+
prevVisible.current = visible;
|
|
71
|
+
if (visible) {
|
|
72
|
+
setPhase("entering");
|
|
73
|
+
rafRef.current = requestAnimationFrame(() => {
|
|
74
|
+
rafRef.current = requestAnimationFrame(() => {
|
|
75
|
+
if (isMounted.current) setPhase("entered");
|
|
76
|
+
});
|
|
77
|
+
});
|
|
78
|
+
} else {
|
|
79
|
+
setPhase("exiting");
|
|
80
|
+
}
|
|
81
|
+
}, [visible]);
|
|
82
|
+
const legacy = easing !== void 0;
|
|
83
|
+
const exitMs = duration === "instant" ? 0 : legacy ? DURATION_MS[duration] : SPRING_MS.effects.fast;
|
|
84
|
+
React.useEffect(() => {
|
|
85
|
+
if (phase !== "exiting") return;
|
|
86
|
+
const t = setTimeout(() => setPhase("exited"), exitMs + FALLBACK_MARGIN_MS);
|
|
87
|
+
return () => clearTimeout(t);
|
|
88
|
+
}, [phase, exitMs]);
|
|
89
|
+
const handleTransitionEnd = React.useCallback((e) => {
|
|
90
|
+
if (!isMounted.current) return;
|
|
91
|
+
if (e && e.target !== e.currentTarget) return;
|
|
92
|
+
setPhase((prev) => prev === "exiting" ? "exited" : prev);
|
|
93
|
+
}, []);
|
|
94
|
+
const mounted = unmountOnExit ? phase !== "exited" : true;
|
|
95
|
+
let transitionStyle;
|
|
96
|
+
if (duration === "instant") {
|
|
97
|
+
transitionStyle = { transition: "none" };
|
|
98
|
+
} else if (legacy) {
|
|
99
|
+
transitionStyle = {
|
|
100
|
+
transitionDuration: `var(--duration-${duration})`,
|
|
101
|
+
transitionTimingFunction: `var(--ease-${easing})`,
|
|
102
|
+
transitionProperty: "opacity, transform"
|
|
103
|
+
};
|
|
104
|
+
} else if (phase === "exiting" || phase === "exited") {
|
|
105
|
+
transitionStyle = {
|
|
106
|
+
transition: [spring("opacity", "effects", "fast"), spring("transform", "effects", "fast")].join(", ")
|
|
107
|
+
};
|
|
108
|
+
} else {
|
|
109
|
+
const speed = SPRING_SPEED[duration];
|
|
110
|
+
transitionStyle = {
|
|
111
|
+
transition: [spring("opacity", "effects", speed), spring("transform", "spatial", speed)].join(", ")
|
|
112
|
+
};
|
|
113
|
+
}
|
|
114
|
+
return { phase, mounted, reduced, transitionStyle, handleTransitionEnd };
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
// src/components/Motion/Fade.tsx
|
|
118
|
+
import { jsx } from "react/jsx-runtime";
|
|
119
|
+
var Fade = React2.forwardRef(function Fade2({
|
|
120
|
+
in: visible,
|
|
121
|
+
duration = "normal",
|
|
122
|
+
easing,
|
|
123
|
+
unmountOnExit = false,
|
|
124
|
+
children,
|
|
125
|
+
style,
|
|
126
|
+
as: Tag = "div",
|
|
127
|
+
...rest
|
|
128
|
+
}, ref) {
|
|
129
|
+
const { phase, mounted, transitionStyle, handleTransitionEnd } = useMotion({
|
|
130
|
+
visible,
|
|
131
|
+
duration,
|
|
132
|
+
easing,
|
|
133
|
+
unmountOnExit
|
|
134
|
+
});
|
|
135
|
+
if (!mounted) return null;
|
|
136
|
+
const opacity = phase === "entered" ? 1 : 0;
|
|
137
|
+
return /* @__PURE__ */ jsx(
|
|
138
|
+
Tag,
|
|
139
|
+
{
|
|
140
|
+
ref,
|
|
141
|
+
onTransitionEnd: handleTransitionEnd,
|
|
142
|
+
style: {
|
|
143
|
+
opacity,
|
|
144
|
+
willChange: "opacity",
|
|
145
|
+
...transitionStyle,
|
|
146
|
+
...style
|
|
147
|
+
},
|
|
148
|
+
...rest,
|
|
149
|
+
children
|
|
150
|
+
}
|
|
151
|
+
);
|
|
152
|
+
});
|
|
153
|
+
Fade.displayName = "Fade";
|
|
154
|
+
|
|
155
|
+
// src/components/Motion/Slide.tsx
|
|
156
|
+
import * as React3 from "react";
|
|
157
|
+
import { jsx as jsx2 } from "react/jsx-runtime";
|
|
158
|
+
var directionTransform = {
|
|
159
|
+
up: { from: "translateY(12px)", to: "translateY(0)" },
|
|
160
|
+
down: { from: "translateY(-12px)", to: "translateY(0)" },
|
|
161
|
+
left: { from: "translateX(12px)", to: "translateX(0)" },
|
|
162
|
+
right: { from: "translateX(-12px)", to: "translateX(0)" }
|
|
163
|
+
};
|
|
164
|
+
var Slide = React3.forwardRef(function Slide2({
|
|
165
|
+
in: visible,
|
|
166
|
+
duration = "normal",
|
|
167
|
+
easing,
|
|
168
|
+
unmountOnExit = false,
|
|
169
|
+
direction = "up",
|
|
170
|
+
distance,
|
|
171
|
+
children,
|
|
172
|
+
style,
|
|
173
|
+
as: Tag = "div",
|
|
174
|
+
...rest
|
|
175
|
+
}, ref) {
|
|
176
|
+
const { phase, mounted, reduced, transitionStyle, handleTransitionEnd } = useMotion({
|
|
177
|
+
visible,
|
|
178
|
+
duration,
|
|
179
|
+
easing,
|
|
180
|
+
unmountOnExit
|
|
181
|
+
});
|
|
182
|
+
if (!mounted) return null;
|
|
183
|
+
const isEntered = phase === "entered";
|
|
184
|
+
const dt = directionTransform[direction];
|
|
185
|
+
let fromTransform = dt.from;
|
|
186
|
+
if (distance) {
|
|
187
|
+
if (direction === "up") fromTransform = `translateY(${distance})`;
|
|
188
|
+
if (direction === "down") fromTransform = `translateY(-${distance})`;
|
|
189
|
+
if (direction === "left") fromTransform = `translateX(${distance})`;
|
|
190
|
+
if (direction === "right") fromTransform = `translateX(-${distance})`;
|
|
191
|
+
}
|
|
192
|
+
return /* @__PURE__ */ jsx2(
|
|
193
|
+
Tag,
|
|
194
|
+
{
|
|
195
|
+
ref,
|
|
196
|
+
onTransitionEnd: handleTransitionEnd,
|
|
197
|
+
style: {
|
|
198
|
+
opacity: isEntered ? 1 : 0,
|
|
199
|
+
transform: isEntered || reduced ? dt.to : fromTransform,
|
|
200
|
+
willChange: "opacity, transform",
|
|
201
|
+
...transitionStyle,
|
|
202
|
+
...style
|
|
203
|
+
},
|
|
204
|
+
...rest,
|
|
205
|
+
children
|
|
206
|
+
}
|
|
207
|
+
);
|
|
208
|
+
});
|
|
209
|
+
Slide.displayName = "Slide";
|
|
210
|
+
|
|
211
|
+
// src/components/Motion/Scale.tsx
|
|
212
|
+
import * as React4 from "react";
|
|
213
|
+
import { jsx as jsx3 } from "react/jsx-runtime";
|
|
214
|
+
var Scale = React4.forwardRef(function Scale2({
|
|
215
|
+
in: visible,
|
|
216
|
+
duration = "fast",
|
|
217
|
+
easing,
|
|
218
|
+
unmountOnExit = false,
|
|
219
|
+
initialScale = 0.95,
|
|
220
|
+
children,
|
|
221
|
+
style,
|
|
222
|
+
as: Tag = "div",
|
|
223
|
+
...rest
|
|
224
|
+
}, ref) {
|
|
225
|
+
const { phase, mounted, reduced, transitionStyle, handleTransitionEnd } = useMotion({
|
|
226
|
+
visible,
|
|
227
|
+
duration,
|
|
228
|
+
easing,
|
|
229
|
+
unmountOnExit
|
|
230
|
+
});
|
|
231
|
+
if (!mounted) return null;
|
|
232
|
+
const isEntered = phase === "entered";
|
|
233
|
+
return /* @__PURE__ */ jsx3(
|
|
234
|
+
Tag,
|
|
235
|
+
{
|
|
236
|
+
ref,
|
|
237
|
+
onTransitionEnd: handleTransitionEnd,
|
|
238
|
+
style: {
|
|
239
|
+
opacity: isEntered ? 1 : 0,
|
|
240
|
+
transform: isEntered || reduced ? "scale(1)" : `scale(${initialScale})`,
|
|
241
|
+
transformOrigin: "top center",
|
|
242
|
+
willChange: "opacity, transform",
|
|
243
|
+
...transitionStyle,
|
|
244
|
+
...style
|
|
245
|
+
},
|
|
246
|
+
...rest,
|
|
247
|
+
children
|
|
248
|
+
}
|
|
249
|
+
);
|
|
250
|
+
});
|
|
251
|
+
Scale.displayName = "Scale";
|
|
252
|
+
|
|
253
|
+
// src/components/Motion/Collapse.tsx
|
|
254
|
+
import * as React5 from "react";
|
|
255
|
+
import { jsx as jsx4 } from "react/jsx-runtime";
|
|
256
|
+
var Collapse = React5.forwardRef(function Collapse2({
|
|
257
|
+
in: visible,
|
|
258
|
+
duration = "normal",
|
|
259
|
+
easing,
|
|
260
|
+
unmountOnExit = false,
|
|
261
|
+
collapsedHeight = 0,
|
|
262
|
+
children,
|
|
263
|
+
style,
|
|
264
|
+
as: Tag = "div",
|
|
265
|
+
...rest
|
|
266
|
+
}, ref) {
|
|
267
|
+
const innerRef = React5.useRef(null);
|
|
268
|
+
const reduced = usePrefersReducedMotion();
|
|
269
|
+
const legacy = easing !== void 0;
|
|
270
|
+
const settleMs = duration === "instant" || reduced ? 0 : legacy ? DURATION_MS[duration] : SPRING_MS.spatial[SPRING_SPEED[duration]];
|
|
271
|
+
const [height, setHeight] = React5.useState(visible ? "auto" : 0);
|
|
272
|
+
const [overflow, setOverflow] = React5.useState(
|
|
273
|
+
visible ? "visible" : "hidden"
|
|
274
|
+
);
|
|
275
|
+
const [mounted, setMounted] = React5.useState(unmountOnExit ? visible : true);
|
|
276
|
+
const prevVisible = React5.useRef(visible);
|
|
277
|
+
React5.useEffect(() => {
|
|
278
|
+
const changed = prevVisible.current !== visible;
|
|
279
|
+
prevVisible.current = visible;
|
|
280
|
+
if (!changed) return;
|
|
281
|
+
let raf1 = 0;
|
|
282
|
+
let raf2 = 0;
|
|
283
|
+
if (visible) {
|
|
284
|
+
setMounted(true);
|
|
285
|
+
raf1 = requestAnimationFrame(() => {
|
|
286
|
+
const el = innerRef.current;
|
|
287
|
+
if (el) {
|
|
288
|
+
setHeight(el.scrollHeight);
|
|
289
|
+
setOverflow("hidden");
|
|
290
|
+
}
|
|
291
|
+
});
|
|
292
|
+
} else {
|
|
293
|
+
const el = innerRef.current;
|
|
294
|
+
if (el) {
|
|
295
|
+
setHeight(el.scrollHeight);
|
|
296
|
+
setOverflow("hidden");
|
|
297
|
+
raf1 = requestAnimationFrame(() => {
|
|
298
|
+
raf2 = requestAnimationFrame(() => {
|
|
299
|
+
setHeight(typeof collapsedHeight === "number" ? collapsedHeight : 0);
|
|
300
|
+
});
|
|
301
|
+
});
|
|
302
|
+
}
|
|
303
|
+
}
|
|
304
|
+
return () => {
|
|
305
|
+
cancelAnimationFrame(raf1);
|
|
306
|
+
cancelAnimationFrame(raf2);
|
|
307
|
+
};
|
|
308
|
+
}, [visible, collapsedHeight]);
|
|
309
|
+
const finish = React5.useCallback(() => {
|
|
310
|
+
if (visible) {
|
|
311
|
+
setHeight("auto");
|
|
312
|
+
setOverflow("visible");
|
|
313
|
+
} else if (unmountOnExit) {
|
|
314
|
+
setMounted(false);
|
|
315
|
+
}
|
|
316
|
+
}, [visible, unmountOnExit]);
|
|
317
|
+
const handleTransitionEnd = React5.useCallback(
|
|
318
|
+
(e) => {
|
|
319
|
+
if (e.target !== e.currentTarget || e.propertyName !== "max-height") return;
|
|
320
|
+
finish();
|
|
321
|
+
},
|
|
322
|
+
[finish]
|
|
323
|
+
);
|
|
324
|
+
const firstRender = React5.useRef(true);
|
|
325
|
+
React5.useEffect(() => {
|
|
326
|
+
if (firstRender.current) {
|
|
327
|
+
firstRender.current = false;
|
|
328
|
+
return;
|
|
329
|
+
}
|
|
330
|
+
const t = setTimeout(finish, settleMs + 100);
|
|
331
|
+
return () => clearTimeout(t);
|
|
332
|
+
}, [visible, settleMs, finish]);
|
|
333
|
+
if (!mounted) return null;
|
|
334
|
+
const maxHeight = height === "auto" ? "none" : `${height}px`;
|
|
335
|
+
return /* @__PURE__ */ jsx4(
|
|
336
|
+
Tag,
|
|
337
|
+
{
|
|
338
|
+
ref,
|
|
339
|
+
style: {
|
|
340
|
+
maxHeight,
|
|
341
|
+
overflow,
|
|
342
|
+
transition: duration === "instant" || reduced ? "none" : legacy ? `max-height var(--duration-${duration}) var(--ease-${easing})` : spring("max-height", "spatial", SPRING_SPEED[duration]),
|
|
343
|
+
...style
|
|
344
|
+
},
|
|
345
|
+
onTransitionEnd: handleTransitionEnd,
|
|
346
|
+
...rest,
|
|
347
|
+
children: /* @__PURE__ */ jsx4("div", { ref: innerRef, children })
|
|
348
|
+
}
|
|
349
|
+
);
|
|
350
|
+
});
|
|
351
|
+
Collapse.displayName = "Collapse";
|
|
352
|
+
|
|
353
|
+
// src/components/Motion/ListTransition.tsx
|
|
354
|
+
import * as React6 from "react";
|
|
355
|
+
import { jsx as jsx5, jsxs } from "react/jsx-runtime";
|
|
356
|
+
var EXIT_FALLBACK_MS = SPRING_MS.effects.default + 50;
|
|
357
|
+
function keyed(children) {
|
|
358
|
+
const out = [];
|
|
359
|
+
React6.Children.forEach(children, (child, i) => {
|
|
360
|
+
const key = React6.isValidElement(child) && child.key != null ? child.key : `__nx-${i}`;
|
|
361
|
+
out.push({ key, node: child });
|
|
362
|
+
});
|
|
363
|
+
return out;
|
|
364
|
+
}
|
|
365
|
+
function merge(prev, next) {
|
|
366
|
+
const before = new Map(prev.map((p) => [p.key, p]));
|
|
367
|
+
const nextKeys = new Set(next.map((n) => n.key));
|
|
368
|
+
const result = next.map((n) => {
|
|
369
|
+
const old = before.get(n.key);
|
|
370
|
+
return { ...n, state: !old || old.state === "exit" ? "enter" : old.state };
|
|
371
|
+
});
|
|
372
|
+
prev.forEach((p, i) => {
|
|
373
|
+
if (nextKeys.has(p.key)) return;
|
|
374
|
+
let at = 0;
|
|
375
|
+
for (let j = i - 1; j >= 0; j--) {
|
|
376
|
+
const idx = result.findIndex((r) => r.key === prev[j].key);
|
|
377
|
+
if (idx !== -1) {
|
|
378
|
+
at = idx + 1;
|
|
379
|
+
break;
|
|
380
|
+
}
|
|
381
|
+
}
|
|
382
|
+
result.splice(at, 0, { ...p, state: "exit" });
|
|
383
|
+
});
|
|
384
|
+
return result;
|
|
385
|
+
}
|
|
386
|
+
var ListTransition = React6.forwardRef(function ListTransition2({ as: Tag = "div", itemAs: Item = "div", appear = false, children, ...rest }, ref) {
|
|
387
|
+
const next = keyed(children);
|
|
388
|
+
const [entries, setEntries] = React6.useState(
|
|
389
|
+
() => next.map((n) => ({ ...n, state: appear ? "enter" : "idle" }))
|
|
390
|
+
);
|
|
391
|
+
const [prevChildren, setPrevChildren] = React6.useState(children);
|
|
392
|
+
let rendered = entries;
|
|
393
|
+
if (children !== prevChildren) {
|
|
394
|
+
rendered = merge(entries, next);
|
|
395
|
+
setPrevChildren(children);
|
|
396
|
+
setEntries(rendered);
|
|
397
|
+
}
|
|
398
|
+
const remove = React6.useCallback((key) => {
|
|
399
|
+
setEntries((list) => list.filter((e) => !(e.key === key && e.state === "exit")));
|
|
400
|
+
}, []);
|
|
401
|
+
const settle = React6.useCallback((key) => {
|
|
402
|
+
setEntries((list) => list.map((e) => e.key === key && e.state === "enter" ? { ...e, state: "idle" } : e));
|
|
403
|
+
}, []);
|
|
404
|
+
const exiting = rendered.filter((e) => e.state === "exit").map((e) => e.key).join("|");
|
|
405
|
+
React6.useEffect(() => {
|
|
406
|
+
if (!exiting) return;
|
|
407
|
+
const keys = rendered.filter((e) => e.state === "exit").map((e) => e.key);
|
|
408
|
+
const t = setTimeout(() => keys.forEach(remove), EXIT_FALLBACK_MS);
|
|
409
|
+
return () => clearTimeout(t);
|
|
410
|
+
}, [exiting, remove]);
|
|
411
|
+
return /* @__PURE__ */ jsx5(Tag, { ref, ...rest, children: rendered.map((e) => /* @__PURE__ */ jsx5(
|
|
412
|
+
Item,
|
|
413
|
+
{
|
|
414
|
+
className: "nx-list-item",
|
|
415
|
+
"data-state": e.state === "idle" ? void 0 : e.state,
|
|
416
|
+
"aria-hidden": e.state === "exit" ? true : void 0,
|
|
417
|
+
onAnimationEnd: (ev) => {
|
|
418
|
+
if (ev.target !== ev.currentTarget) return;
|
|
419
|
+
if (e.state === "exit") remove(e.key);
|
|
420
|
+
else if (e.state === "enter") settle(e.key);
|
|
421
|
+
},
|
|
422
|
+
children: /* @__PURE__ */ jsx5("div", { className: "nx-list-item-inner", children: e.node })
|
|
423
|
+
},
|
|
424
|
+
e.key
|
|
425
|
+
)) });
|
|
426
|
+
});
|
|
427
|
+
ListTransition.displayName = "ListTransition";
|
|
428
|
+
var SkeletonSwap = React6.forwardRef(function SkeletonSwap2({ loading, skeleton, children, className, ...rest }, ref) {
|
|
429
|
+
const [phase, setPhase] = React6.useState(loading ? "loading" : "done");
|
|
430
|
+
const [prevLoading, setPrevLoading] = React6.useState(loading);
|
|
431
|
+
let current = phase;
|
|
432
|
+
if (loading !== prevLoading) {
|
|
433
|
+
current = loading ? "loading" : "out";
|
|
434
|
+
setPrevLoading(loading);
|
|
435
|
+
setPhase(current);
|
|
436
|
+
}
|
|
437
|
+
React6.useEffect(() => {
|
|
438
|
+
if (current !== "out") return;
|
|
439
|
+
const t = setTimeout(() => setPhase("done"), SPRING_MS.effects.default + 50);
|
|
440
|
+
return () => clearTimeout(t);
|
|
441
|
+
}, [current]);
|
|
442
|
+
return /* @__PURE__ */ jsxs("div", { ref, className: className ? `nx-swap ${className}` : "nx-swap", "aria-busy": loading || void 0, ...rest, children: [
|
|
443
|
+
current !== "loading" && /* @__PURE__ */ jsx5("div", { className: current === "out" ? "nx-swap-in" : void 0, children }),
|
|
444
|
+
current !== "done" && /* @__PURE__ */ jsx5(
|
|
445
|
+
"div",
|
|
446
|
+
{
|
|
447
|
+
className: current === "out" ? "nx-swap-out" : void 0,
|
|
448
|
+
"aria-hidden": "true",
|
|
449
|
+
onAnimationEnd: (e) => {
|
|
450
|
+
if (e.target === e.currentTarget) setPhase("done");
|
|
451
|
+
},
|
|
452
|
+
children: skeleton
|
|
453
|
+
}
|
|
454
|
+
)
|
|
455
|
+
] });
|
|
456
|
+
});
|
|
457
|
+
SkeletonSwap.displayName = "SkeletonSwap";
|
|
458
|
+
|
|
459
|
+
export {
|
|
460
|
+
useMediaQuery,
|
|
461
|
+
usePrefersReducedMotion,
|
|
462
|
+
Fade,
|
|
463
|
+
Slide,
|
|
464
|
+
Scale,
|
|
465
|
+
Collapse,
|
|
466
|
+
ListTransition,
|
|
467
|
+
SkeletonSwap
|
|
468
|
+
};
|
|
@@ -1546,7 +1546,7 @@ var ClassLockOverlay = React2.forwardRef(
|
|
|
1546
1546
|
var Overlay3 = React2.forwardRef(
|
|
1547
1547
|
({ className, ...props }, ref) => {
|
|
1548
1548
|
const { scrollLock, open, modal } = React2.useContext(DrawerContext2);
|
|
1549
|
-
const classes = cn("fixed inset-0 z-[var(--z-modal)]", scrim, className);
|
|
1549
|
+
const classes = cn("nx-drawer-overlay fixed inset-0 z-[var(--z-modal)]", scrim, className);
|
|
1550
1550
|
if (scrollLock === "class") {
|
|
1551
1551
|
if (!modal) return null;
|
|
1552
1552
|
return /* @__PURE__ */ jsx(ClassLockOverlay, { ref, open, className: cn("pointer-events-auto", classes), ...props });
|
|
@@ -1567,7 +1567,7 @@ var Content3 = React2.forwardRef(({ className, children, side = "right", surface
|
|
|
1567
1567
|
{
|
|
1568
1568
|
ref,
|
|
1569
1569
|
className: cn(
|
|
1570
|
-
"fixed z-[var(--z-modal)] flex flex-col bg-[var(--color-surface-elevated)] text-[var(--color-on-surface)] shadow-elevation-3 focus:outline-none",
|
|
1570
|
+
"nx-drawer fixed z-[var(--z-modal)] flex flex-col bg-[var(--color-surface-elevated)] text-[var(--color-on-surface)] shadow-elevation-3 focus:outline-none",
|
|
1571
1571
|
sideMap[side],
|
|
1572
1572
|
surface === "glass" && glassSurfaceClass,
|
|
1573
1573
|
className
|
|
@@ -10,10 +10,10 @@ import {
|
|
|
10
10
|
formatForDisplay,
|
|
11
11
|
formatForEditing,
|
|
12
12
|
parseMoney
|
|
13
|
-
} from "./chunk-
|
|
13
|
+
} from "./chunk-R3SUPKKI.js";
|
|
14
14
|
import {
|
|
15
15
|
useIntlLocale
|
|
16
|
-
} from "./chunk-
|
|
16
|
+
} from "./chunk-VMSWIC3O.js";
|
|
17
17
|
import {
|
|
18
18
|
cn
|
|
19
19
|
} from "./chunk-Q7G5WGYV.js";
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
import {
|
|
3
3
|
useCalendarLocale
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-5QZVFW4H.js";
|
|
5
5
|
import {
|
|
6
6
|
floatingSurface
|
|
7
7
|
} from "./chunk-5FWJXSXT.js";
|
|
@@ -11,7 +11,7 @@ import {
|
|
|
11
11
|
} from "./chunk-5W3AOOYS.js";
|
|
12
12
|
import {
|
|
13
13
|
useNexubMessages
|
|
14
|
-
} from "./chunk-
|
|
14
|
+
} from "./chunk-VMSWIC3O.js";
|
|
15
15
|
import {
|
|
16
16
|
cn
|
|
17
17
|
} from "./chunk-Q7G5WGYV.js";
|