@tomny-dev/uzi 0.2.4 → 0.2.5
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/index.cjs +1925 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +1145 -881
- package/dist/index.js.map +1 -1
- package/dist/style.css +2025 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1,17 +1,17 @@
|
|
|
1
|
-
import * as
|
|
2
|
-
import { createContext
|
|
3
|
-
import { Slot
|
|
4
|
-
import { Fragment
|
|
5
|
-
import * as
|
|
6
|
-
import * as
|
|
7
|
-
import * as
|
|
8
|
-
import * as
|
|
9
|
-
import * as
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import { createContext, useCallback, useContext, useEffect, useId, useMemo, useRef, useState } from "react";
|
|
3
|
+
import { Slot } from "@radix-ui/react-slot";
|
|
4
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
5
|
+
import * as AvatarPrimitive from "@radix-ui/react-avatar";
|
|
6
|
+
import * as DialogPrimitive from "@radix-ui/react-dialog";
|
|
7
|
+
import * as ToastPrimitive from "@radix-ui/react-toast";
|
|
8
|
+
import * as DropdownMenuPrimitive from "@radix-ui/react-dropdown-menu";
|
|
9
|
+
import * as SelectPrimitive from "@radix-ui/react-select";
|
|
10
10
|
//#region src/utils/cx.ts
|
|
11
|
-
function
|
|
12
|
-
return
|
|
11
|
+
function cx(...values) {
|
|
12
|
+
return values.filter(Boolean).join(" ");
|
|
13
13
|
}
|
|
14
|
-
var
|
|
14
|
+
var button_module_default = {
|
|
15
15
|
button: "uzi-button-module__button__5dzDN",
|
|
16
16
|
sizeSm: "uzi-button-module__sizeSm__jb544",
|
|
17
17
|
sizeMd: "uzi-button-module__sizeMd__lIo8M",
|
|
@@ -23,7 +23,10 @@ var y = {
|
|
|
23
23
|
variantGhost: "uzi-button-module__variantGhost__-OEB8",
|
|
24
24
|
variantDestructive: "uzi-button-module__variantDestructive__5IeYA",
|
|
25
25
|
variantLink: "uzi-button-module__variantLink__Olx4I"
|
|
26
|
-
}
|
|
26
|
+
};
|
|
27
|
+
//#endregion
|
|
28
|
+
//#region src/components/button/Button.tsx
|
|
29
|
+
var variantClass = {
|
|
27
30
|
default: "variantPrimary",
|
|
28
31
|
primary: "variantPrimary",
|
|
29
32
|
secondary: "variantSecondary",
|
|
@@ -31,31 +34,34 @@ var y = {
|
|
|
31
34
|
ghost: "variantGhost",
|
|
32
35
|
destructive: "variantDestructive",
|
|
33
36
|
link: "variantLink"
|
|
34
|
-
}
|
|
37
|
+
};
|
|
38
|
+
var sizeClass = {
|
|
35
39
|
default: "sizeMd",
|
|
36
40
|
sm: "sizeSm",
|
|
37
41
|
md: "sizeMd",
|
|
38
42
|
lg: "sizeLg",
|
|
39
43
|
icon: "sizeIcon"
|
|
40
44
|
};
|
|
41
|
-
function
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
className:
|
|
45
|
-
...
|
|
46
|
-
children
|
|
47
|
-
})
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
45
|
+
function Button({ as, variant = "default", size = "default", className, children, asChild = false, ...rest }) {
|
|
46
|
+
const classes = cx(button_module_default.button, button_module_default[variantClass[variant]], button_module_default[sizeClass[size]], className);
|
|
47
|
+
if (asChild) return /* @__PURE__ */ jsx(Slot, {
|
|
48
|
+
className: classes,
|
|
49
|
+
...rest,
|
|
50
|
+
children
|
|
51
|
+
});
|
|
52
|
+
if (as === "a") return /* @__PURE__ */ jsx("a", {
|
|
53
|
+
className: classes,
|
|
54
|
+
...rest,
|
|
55
|
+
children
|
|
56
|
+
});
|
|
57
|
+
return /* @__PURE__ */ jsx("button", {
|
|
52
58
|
type: "button",
|
|
53
|
-
className:
|
|
54
|
-
...
|
|
55
|
-
children
|
|
59
|
+
className: classes,
|
|
60
|
+
...rest,
|
|
61
|
+
children
|
|
56
62
|
});
|
|
57
63
|
}
|
|
58
|
-
var
|
|
64
|
+
var avatar_module_default = {
|
|
59
65
|
avatar: "uzi-avatar-module__avatar__yPIOs",
|
|
60
66
|
"size-sm": "uzi-avatar-module__size-sm__v5riJ",
|
|
61
67
|
"size-md": "uzi-avatar-module__size-md__g7IQS",
|
|
@@ -66,26 +72,26 @@ var C = {
|
|
|
66
72
|
};
|
|
67
73
|
//#endregion
|
|
68
74
|
//#region src/components/avatar/Avatar.tsx
|
|
69
|
-
function
|
|
70
|
-
|
|
71
|
-
return /* @__PURE__ */
|
|
72
|
-
className:
|
|
73
|
-
...
|
|
75
|
+
function Avatar({ className, size = "md", ...props }) {
|
|
76
|
+
const sizeClass = size === "sm" ? avatar_module_default["size-sm"] : size === "lg" ? avatar_module_default["size-lg"] : size === "xl" ? avatar_module_default["size-xl"] : avatar_module_default["size-md"];
|
|
77
|
+
return /* @__PURE__ */ jsx(AvatarPrimitive.Root, {
|
|
78
|
+
className: cx(avatar_module_default.avatar, sizeClass, className),
|
|
79
|
+
...props
|
|
74
80
|
});
|
|
75
81
|
}
|
|
76
|
-
function
|
|
77
|
-
return /* @__PURE__ */
|
|
78
|
-
className:
|
|
79
|
-
...
|
|
82
|
+
function AvatarImage({ className, ...props }) {
|
|
83
|
+
return /* @__PURE__ */ jsx(AvatarPrimitive.Image, {
|
|
84
|
+
className: cx(avatar_module_default.image, className),
|
|
85
|
+
...props
|
|
80
86
|
});
|
|
81
87
|
}
|
|
82
|
-
function
|
|
83
|
-
return /* @__PURE__ */
|
|
84
|
-
className:
|
|
85
|
-
...
|
|
88
|
+
function AvatarFallback({ className, ...props }) {
|
|
89
|
+
return /* @__PURE__ */ jsx(AvatarPrimitive.Fallback, {
|
|
90
|
+
className: cx(avatar_module_default.fallback, className),
|
|
91
|
+
...props
|
|
86
92
|
});
|
|
87
93
|
}
|
|
88
|
-
var
|
|
94
|
+
var card_module_default = {
|
|
89
95
|
card: "uzi-card-module__card__ZPFTz",
|
|
90
96
|
"tone-default": "uzi-card-module__tone-default__7Ujf9",
|
|
91
97
|
"tone-muted": "uzi-card-module__tone-muted__RQy5B",
|
|
@@ -98,24 +104,25 @@ var D = {
|
|
|
98
104
|
};
|
|
99
105
|
//#endregion
|
|
100
106
|
//#region src/components/card/Card.tsx
|
|
101
|
-
function
|
|
102
|
-
|
|
107
|
+
function Card({ as, tone = "default", padding = "md", interactive = false, className, children, ...rest }) {
|
|
108
|
+
const Component = as ?? "div";
|
|
109
|
+
const TONE_CLASS = {
|
|
103
110
|
default: null,
|
|
104
111
|
muted: "tone-muted",
|
|
105
112
|
contrast: "tone-contrast"
|
|
106
113
|
};
|
|
107
|
-
return /* @__PURE__ */
|
|
108
|
-
className:
|
|
114
|
+
return /* @__PURE__ */ jsx(Component, {
|
|
115
|
+
className: cx(card_module_default.card, TONE_CLASS[tone] ? card_module_default[TONE_CLASS[tone]] : null, card_module_default[{
|
|
109
116
|
none: "padding-none",
|
|
110
117
|
sm: "padding-sm",
|
|
111
118
|
md: "padding-md",
|
|
112
119
|
lg: "padding-lg"
|
|
113
|
-
}[
|
|
114
|
-
...
|
|
115
|
-
children
|
|
120
|
+
}[padding]], interactive && card_module_default.interactive, className),
|
|
121
|
+
...rest,
|
|
122
|
+
children
|
|
116
123
|
});
|
|
117
124
|
}
|
|
118
|
-
var
|
|
125
|
+
var pill_module_default = {
|
|
119
126
|
pill: "uzi-pill-module__pill__uCKcP",
|
|
120
127
|
"size-sm": "uzi-pill-module__size-sm__JANOQ",
|
|
121
128
|
"size-md": "uzi-pill-module__size-md__fdsqR",
|
|
@@ -128,21 +135,21 @@ var k = {
|
|
|
128
135
|
};
|
|
129
136
|
//#endregion
|
|
130
137
|
//#region src/components/pill/Pill.tsx
|
|
131
|
-
function
|
|
132
|
-
return /* @__PURE__ */
|
|
133
|
-
className:
|
|
134
|
-
...
|
|
135
|
-
children: [
|
|
136
|
-
className:
|
|
138
|
+
function Pill({ as, tone = "neutral", size = "md", icon, className, children, ...rest }) {
|
|
139
|
+
return /* @__PURE__ */ jsxs(as ?? "span", {
|
|
140
|
+
className: cx(pill_module_default.pill, pill_module_default[`tone-${tone}`], pill_module_default[`size-${size}`], className),
|
|
141
|
+
...rest,
|
|
142
|
+
children: [icon ? /* @__PURE__ */ jsx("span", {
|
|
143
|
+
className: pill_module_default.icon,
|
|
137
144
|
"aria-hidden": "true",
|
|
138
|
-
children:
|
|
139
|
-
}) : null, /* @__PURE__ */
|
|
140
|
-
className:
|
|
141
|
-
children
|
|
145
|
+
children: icon
|
|
146
|
+
}) : null, /* @__PURE__ */ jsx("span", {
|
|
147
|
+
className: pill_module_default.content,
|
|
148
|
+
children
|
|
142
149
|
})]
|
|
143
150
|
});
|
|
144
151
|
}
|
|
145
|
-
var
|
|
152
|
+
var modal_module_default = {
|
|
146
153
|
portalLayer: "uzi-modal-module__portalLayer__t7blc",
|
|
147
154
|
backdrop: "uzi-modal-module__backdrop__IMd3b",
|
|
148
155
|
backdropFadeIn: "uzi-modal-module__backdropFadeIn__GNJdx",
|
|
@@ -165,45 +172,45 @@ var j = {
|
|
|
165
172
|
};
|
|
166
173
|
//#endregion
|
|
167
174
|
//#region src/components/modal/Modal.tsx
|
|
168
|
-
function
|
|
169
|
-
return /* @__PURE__ */
|
|
170
|
-
open
|
|
171
|
-
onOpenChange: (
|
|
172
|
-
|
|
175
|
+
function ModalOverlay({ open, onClose, className, children }) {
|
|
176
|
+
return /* @__PURE__ */ jsx(DialogPrimitive.Root, {
|
|
177
|
+
open,
|
|
178
|
+
onOpenChange: (nextOpen) => {
|
|
179
|
+
if (!nextOpen) onClose();
|
|
173
180
|
},
|
|
174
|
-
children: /* @__PURE__ */
|
|
175
|
-
className:
|
|
176
|
-
children: [/* @__PURE__ */
|
|
177
|
-
className:
|
|
178
|
-
children
|
|
181
|
+
children: /* @__PURE__ */ jsx(DialogPrimitive.Portal, { children: /* @__PURE__ */ jsxs("div", {
|
|
182
|
+
className: modal_module_default.portalLayer,
|
|
183
|
+
children: [/* @__PURE__ */ jsx(DialogPrimitive.Overlay, { className: cx(modal_module_default.backdrop, className) }), /* @__PURE__ */ jsx(DialogPrimitive.Content, {
|
|
184
|
+
className: modal_module_default.overlayContent,
|
|
185
|
+
children
|
|
179
186
|
})]
|
|
180
187
|
}) })
|
|
181
188
|
});
|
|
182
189
|
}
|
|
183
|
-
function
|
|
184
|
-
return /* @__PURE__ */
|
|
185
|
-
open
|
|
186
|
-
onClose
|
|
187
|
-
children: /* @__PURE__ */
|
|
188
|
-
className:
|
|
190
|
+
function Modal({ open, onClose, title, subtitle, size = "md", children, footer }) {
|
|
191
|
+
return /* @__PURE__ */ jsx(ModalOverlay, {
|
|
192
|
+
open,
|
|
193
|
+
onClose,
|
|
194
|
+
children: /* @__PURE__ */ jsxs("div", {
|
|
195
|
+
className: cx(modal_module_default.modal, modal_module_default[`size-${size}`]),
|
|
189
196
|
children: [
|
|
190
|
-
/* @__PURE__ */
|
|
191
|
-
className:
|
|
192
|
-
children: [/* @__PURE__ */
|
|
193
|
-
className:
|
|
194
|
-
children: [/* @__PURE__ */
|
|
195
|
-
className:
|
|
196
|
-
children:
|
|
197
|
-
}),
|
|
198
|
-
className:
|
|
199
|
-
children:
|
|
197
|
+
/* @__PURE__ */ jsxs("div", {
|
|
198
|
+
className: modal_module_default.header,
|
|
199
|
+
children: [/* @__PURE__ */ jsxs("div", {
|
|
200
|
+
className: modal_module_default.titles,
|
|
201
|
+
children: [/* @__PURE__ */ jsx(DialogPrimitive.Title, {
|
|
202
|
+
className: modal_module_default.title,
|
|
203
|
+
children: title
|
|
204
|
+
}), subtitle ? /* @__PURE__ */ jsx(DialogPrimitive.Description, {
|
|
205
|
+
className: modal_module_default.subtitle,
|
|
206
|
+
children: subtitle
|
|
200
207
|
}) : null]
|
|
201
|
-
}), /* @__PURE__ */
|
|
202
|
-
asChild:
|
|
203
|
-
children: /* @__PURE__ */
|
|
204
|
-
className:
|
|
208
|
+
}), /* @__PURE__ */ jsx(DialogPrimitive.Close, {
|
|
209
|
+
asChild: true,
|
|
210
|
+
children: /* @__PURE__ */ jsx("button", {
|
|
211
|
+
className: modal_module_default.closeButton,
|
|
205
212
|
"aria-label": "Close",
|
|
206
|
-
children: /* @__PURE__ */
|
|
213
|
+
children: /* @__PURE__ */ jsxs("svg", {
|
|
207
214
|
width: "14",
|
|
208
215
|
height: "14",
|
|
209
216
|
viewBox: "0 0 24 24",
|
|
@@ -212,12 +219,12 @@ function N({ open: e, onClose: t, title: n, subtitle: r, size: i = "md", childre
|
|
|
212
219
|
strokeWidth: "2.5",
|
|
213
220
|
strokeLinecap: "round",
|
|
214
221
|
strokeLinejoin: "round",
|
|
215
|
-
children: [/* @__PURE__ */
|
|
222
|
+
children: [/* @__PURE__ */ jsx("line", {
|
|
216
223
|
x1: "18",
|
|
217
224
|
y1: "6",
|
|
218
225
|
x2: "6",
|
|
219
226
|
y2: "18"
|
|
220
|
-
}), /* @__PURE__ */
|
|
227
|
+
}), /* @__PURE__ */ jsx("line", {
|
|
221
228
|
x1: "6",
|
|
222
229
|
y1: "6",
|
|
223
230
|
x2: "18",
|
|
@@ -227,19 +234,19 @@ function N({ open: e, onClose: t, title: n, subtitle: r, size: i = "md", childre
|
|
|
227
234
|
})
|
|
228
235
|
})]
|
|
229
236
|
}),
|
|
230
|
-
/* @__PURE__ */
|
|
231
|
-
className:
|
|
232
|
-
children
|
|
237
|
+
/* @__PURE__ */ jsx("div", {
|
|
238
|
+
className: modal_module_default.body,
|
|
239
|
+
children
|
|
233
240
|
}),
|
|
234
|
-
|
|
235
|
-
className:
|
|
236
|
-
children:
|
|
241
|
+
footer && /* @__PURE__ */ jsx("div", {
|
|
242
|
+
className: modal_module_default.footer,
|
|
243
|
+
children: footer
|
|
237
244
|
})
|
|
238
245
|
]
|
|
239
246
|
})
|
|
240
247
|
});
|
|
241
248
|
}
|
|
242
|
-
var
|
|
249
|
+
var alert_module_default = {
|
|
243
250
|
alert: "uzi-alert-module__alert__7Bt6c",
|
|
244
251
|
success: "uzi-alert-module__success__apdFG",
|
|
245
252
|
error: "uzi-alert-module__error__KLgi1",
|
|
@@ -248,14 +255,14 @@ var P = {
|
|
|
248
255
|
};
|
|
249
256
|
//#endregion
|
|
250
257
|
//#region src/components/alert/Alert.tsx
|
|
251
|
-
function
|
|
252
|
-
return /* @__PURE__ */
|
|
253
|
-
className:
|
|
258
|
+
function Alert({ tone, children, className }) {
|
|
259
|
+
return /* @__PURE__ */ jsx("div", {
|
|
260
|
+
className: cx(alert_module_default.alert, alert_module_default[tone], className),
|
|
254
261
|
role: "alert",
|
|
255
|
-
children
|
|
262
|
+
children
|
|
256
263
|
});
|
|
257
264
|
}
|
|
258
|
-
var
|
|
265
|
+
var toast_module_default = {
|
|
259
266
|
stack: "uzi-toast-module__stack__SRrda",
|
|
260
267
|
topRight: "uzi-toast-module__topRight__WiZzM",
|
|
261
268
|
topLeft: "uzi-toast-module__topLeft__SzFS9",
|
|
@@ -275,94 +282,133 @@ var I = {
|
|
|
275
282
|
controls: "uzi-toast-module__controls__LqA4Q",
|
|
276
283
|
iconButton: "uzi-toast-module__iconButton__FOsOp",
|
|
277
284
|
iconButtonError: "uzi-toast-module__iconButtonError__NJsLX"
|
|
278
|
-
}
|
|
285
|
+
};
|
|
286
|
+
//#endregion
|
|
287
|
+
//#region src/components/toast/ToastContext.tsx
|
|
288
|
+
/** Default provider configuration. */
|
|
289
|
+
var DEFAULT_CONFIG = {
|
|
279
290
|
position: "top-right",
|
|
280
291
|
maxToasts: 5,
|
|
281
292
|
defaultDuration: 4e3,
|
|
282
|
-
pauseOnHover:
|
|
283
|
-
pauseOnFocusLoss:
|
|
284
|
-
}
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
293
|
+
pauseOnHover: true,
|
|
294
|
+
pauseOnFocusLoss: true
|
|
295
|
+
};
|
|
296
|
+
var ToastContext = createContext(void 0);
|
|
297
|
+
var toastIdCounter = 0;
|
|
298
|
+
var generateToastId = () => `toast-${++toastIdCounter}-${Date.now()}`;
|
|
299
|
+
/**
|
|
300
|
+
* Toast notification context provider.
|
|
301
|
+
*
|
|
302
|
+
* @remarks
|
|
303
|
+
* Wrap your app (or a section) to enable `useToast` calls. Supports configurable placement,
|
|
304
|
+
* maximum visible toasts, and pause behavior on hover or window blur.
|
|
305
|
+
*
|
|
306
|
+
* @param props.children - React subtree that can consume the toast context.
|
|
307
|
+
* @param props.config - Optional provider configuration overrides.
|
|
308
|
+
*/
|
|
309
|
+
function ToastProvider({ children, config }) {
|
|
310
|
+
const [toasts, setToasts] = useState([]);
|
|
311
|
+
const [isPaused, setIsPaused] = useState(false);
|
|
312
|
+
const merged = useMemo(() => ({
|
|
313
|
+
...DEFAULT_CONFIG,
|
|
314
|
+
...config
|
|
315
|
+
}), [config]);
|
|
316
|
+
const push = useCallback((message, options = {}) => {
|
|
317
|
+
const id = generateToastId();
|
|
318
|
+
setToasts((prev) => {
|
|
319
|
+
const next = [...prev, {
|
|
320
|
+
id,
|
|
321
|
+
message,
|
|
322
|
+
type: options.type ?? "info",
|
|
323
|
+
duration: options.duration ?? (options.type === "error" ? 6e3 : merged.defaultDuration),
|
|
324
|
+
dismissible: options.dismissible ?? true,
|
|
325
|
+
copyable: options.copyable ?? false,
|
|
326
|
+
action: options.action
|
|
300
327
|
}];
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
328
|
+
if (next.length > merged.maxToasts) next.shift();
|
|
329
|
+
return next;
|
|
330
|
+
});
|
|
331
|
+
return id;
|
|
332
|
+
}, [merged.defaultDuration, merged.maxToasts]);
|
|
333
|
+
const success = useCallback((message, options) => push(message, {
|
|
334
|
+
...options,
|
|
305
335
|
type: "success"
|
|
306
|
-
}), [
|
|
307
|
-
|
|
308
|
-
|
|
336
|
+
}), [push]);
|
|
337
|
+
const error = useCallback((message, options) => push(message, {
|
|
338
|
+
copyable: true,
|
|
339
|
+
...options,
|
|
309
340
|
type: "error"
|
|
310
|
-
}), [
|
|
311
|
-
|
|
341
|
+
}), [push]);
|
|
342
|
+
const warning = useCallback((message, options) => push(message, {
|
|
343
|
+
...options,
|
|
312
344
|
type: "warning"
|
|
313
|
-
}), [
|
|
314
|
-
|
|
345
|
+
}), [push]);
|
|
346
|
+
const info = useCallback((message, options) => push(message, {
|
|
347
|
+
...options,
|
|
315
348
|
type: "info"
|
|
316
|
-
}), [
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
349
|
+
}), [push]);
|
|
350
|
+
const dismiss = useCallback((id) => {
|
|
351
|
+
setToasts((prev) => prev.filter((t) => t.id !== id));
|
|
352
|
+
}, []);
|
|
353
|
+
const dismissAll = useCallback(() => setToasts([]), []);
|
|
354
|
+
useEffect(() => {
|
|
355
|
+
if (!merged.pauseOnFocusLoss) return;
|
|
356
|
+
const handleVisibility = () => setIsPaused(document.visibilityState !== "visible");
|
|
357
|
+
document.addEventListener("visibilitychange", handleVisibility);
|
|
358
|
+
return () => document.removeEventListener("visibilitychange", handleVisibility);
|
|
359
|
+
}, [merged.pauseOnFocusLoss]);
|
|
360
|
+
const value = useMemo(() => ({
|
|
361
|
+
toasts,
|
|
362
|
+
push,
|
|
363
|
+
success,
|
|
364
|
+
error,
|
|
365
|
+
warning,
|
|
366
|
+
info,
|
|
367
|
+
dismiss,
|
|
368
|
+
dismissAll
|
|
333
369
|
}), [
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
370
|
+
toasts,
|
|
371
|
+
push,
|
|
372
|
+
success,
|
|
373
|
+
error,
|
|
374
|
+
warning,
|
|
375
|
+
info,
|
|
376
|
+
dismiss,
|
|
377
|
+
dismissAll
|
|
342
378
|
]);
|
|
343
|
-
return /* @__PURE__ */
|
|
344
|
-
value
|
|
345
|
-
children: /* @__PURE__ */
|
|
379
|
+
return /* @__PURE__ */ jsx(ToastContext.Provider, {
|
|
380
|
+
value,
|
|
381
|
+
children: /* @__PURE__ */ jsxs(ToastPrimitive.Provider, {
|
|
346
382
|
swipeDirection: "right",
|
|
347
|
-
children: [
|
|
348
|
-
toasts
|
|
349
|
-
position:
|
|
350
|
-
pauseOnHover:
|
|
351
|
-
isPaused
|
|
352
|
-
onDismiss:
|
|
353
|
-
onPauseChange:
|
|
383
|
+
children: [children, /* @__PURE__ */ jsx(ToastContainer, {
|
|
384
|
+
toasts,
|
|
385
|
+
position: merged.position,
|
|
386
|
+
pauseOnHover: merged.pauseOnHover,
|
|
387
|
+
isPaused,
|
|
388
|
+
onDismiss: dismiss,
|
|
389
|
+
onPauseChange: setIsPaused
|
|
354
390
|
})]
|
|
355
391
|
})
|
|
356
392
|
});
|
|
357
393
|
}
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
394
|
+
/**
|
|
395
|
+
* Hook to access the toast API.
|
|
396
|
+
*
|
|
397
|
+
* @remarks
|
|
398
|
+
* Exposes `push`, intent helpers (`success`, `error`, `warning`, `info`), and dismissal helpers.
|
|
399
|
+
* Must be called within a `ToastProvider`.
|
|
400
|
+
*
|
|
401
|
+
* @throws Error if used outside of a `ToastProvider`.
|
|
402
|
+
*/
|
|
403
|
+
function useToast() {
|
|
404
|
+
const ctx = useContext(ToastContext);
|
|
405
|
+
if (!ctx) throw new Error("useToast must be used within a ToastProvider");
|
|
406
|
+
return ctx;
|
|
362
407
|
}
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
408
|
+
/** Renders the positioned toast stack. */
|
|
409
|
+
function ToastContainer({ toasts, position, pauseOnHover, isPaused, onDismiss, onPauseChange }) {
|
|
410
|
+
const posClass = (() => {
|
|
411
|
+
switch (position) {
|
|
366
412
|
case "top-left": return "topLeft";
|
|
367
413
|
case "top-center": return "topCenter";
|
|
368
414
|
case "bottom-right": return "bottomRight";
|
|
@@ -371,134 +417,166 @@ function te({ toasts: e, position: t, pauseOnHover: n, isPaused: r, onDismiss: i
|
|
|
371
417
|
default: return "topRight";
|
|
372
418
|
}
|
|
373
419
|
})();
|
|
374
|
-
return /* @__PURE__ */
|
|
375
|
-
toast
|
|
376
|
-
isPaused
|
|
377
|
-
onDismiss
|
|
378
|
-
},
|
|
379
|
-
className:
|
|
420
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [toasts.map((toast) => /* @__PURE__ */ jsx(ToastItem, {
|
|
421
|
+
toast,
|
|
422
|
+
isPaused,
|
|
423
|
+
onDismiss
|
|
424
|
+
}, toast.id)), /* @__PURE__ */ jsx(ToastPrimitive.Viewport, {
|
|
425
|
+
className: cx(toast_module_default.stack, toast_module_default[posClass]),
|
|
380
426
|
label: "Notifications",
|
|
381
|
-
onMouseEnter: () =>
|
|
382
|
-
onMouseLeave: () =>
|
|
427
|
+
onMouseEnter: () => pauseOnHover && onPauseChange(true),
|
|
428
|
+
onMouseLeave: () => pauseOnHover && onPauseChange(false)
|
|
383
429
|
})] });
|
|
384
430
|
}
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
431
|
+
/** Individual toast item with timers and actions. */
|
|
432
|
+
function ToastItem({ toast, isPaused, onDismiss }) {
|
|
433
|
+
const [open, setOpen] = useState(true);
|
|
434
|
+
const [copyState, setCopyState] = useState("idle");
|
|
435
|
+
const copyTimerRef = useRef(null);
|
|
436
|
+
const timerRef = useRef(null);
|
|
437
|
+
const startRef = useRef(0);
|
|
438
|
+
const remainingRef = useRef(toast.duration ?? 0);
|
|
439
|
+
const closingRef = useRef(false);
|
|
440
|
+
const palette = getPalette(toast.type);
|
|
441
|
+
const styleVars = {
|
|
442
|
+
["--toast-bg"]: palette.background,
|
|
443
|
+
["--toast-border"]: palette.border,
|
|
444
|
+
["--toast-accent"]: palette.accent,
|
|
445
|
+
["--toast-text"]: palette.text,
|
|
446
|
+
["--toast-action-bg"]: palette.actionBg,
|
|
447
|
+
["--toast-action-border"]: palette.actionBorder
|
|
448
|
+
};
|
|
449
|
+
const stopTimer = () => {
|
|
450
|
+
if (timerRef.current) {
|
|
451
|
+
window.clearTimeout(timerRef.current);
|
|
452
|
+
timerRef.current = null;
|
|
453
|
+
}
|
|
454
|
+
};
|
|
455
|
+
const triggerDismiss = useCallback(() => {
|
|
456
|
+
if (closingRef.current) return;
|
|
457
|
+
closingRef.current = true;
|
|
458
|
+
setOpen(false);
|
|
459
|
+
stopTimer();
|
|
460
|
+
window.setTimeout(() => onDismiss(toast.id), 160);
|
|
461
|
+
}, [onDismiss, toast.id]);
|
|
462
|
+
const schedule = useCallback((delay) => {
|
|
463
|
+
if (!delay || delay <= 0) {
|
|
464
|
+
triggerDismiss();
|
|
400
465
|
return;
|
|
401
466
|
}
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
if (!
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
467
|
+
startRef.current = performance.now();
|
|
468
|
+
stopTimer();
|
|
469
|
+
timerRef.current = window.setTimeout(() => triggerDismiss(), delay);
|
|
470
|
+
}, [triggerDismiss]);
|
|
471
|
+
useEffect(() => {
|
|
472
|
+
if (!toast.duration || toast.duration <= 0) return void 0;
|
|
473
|
+
schedule(toast.duration);
|
|
474
|
+
return stopTimer;
|
|
475
|
+
}, [schedule, toast.duration]);
|
|
476
|
+
useEffect(() => {
|
|
477
|
+
if (!toast.duration || toast.duration <= 0) return;
|
|
478
|
+
if (isPaused) {
|
|
479
|
+
const elapsed = performance.now() - startRef.current;
|
|
480
|
+
remainingRef.current = Math.max(0, remainingRef.current - elapsed);
|
|
481
|
+
stopTimer();
|
|
482
|
+
} else schedule(remainingRef.current);
|
|
411
483
|
}, [
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
])
|
|
416
|
-
|
|
484
|
+
isPaused,
|
|
485
|
+
schedule,
|
|
486
|
+
toast.duration
|
|
487
|
+
]);
|
|
488
|
+
useEffect(() => {
|
|
489
|
+
return () => {
|
|
490
|
+
if (copyTimerRef.current) window.clearTimeout(copyTimerRef.current);
|
|
491
|
+
};
|
|
417
492
|
}, []);
|
|
418
|
-
|
|
419
|
-
|
|
493
|
+
const handleCopy = useCallback(async () => {
|
|
494
|
+
if (copyTimerRef.current) window.clearTimeout(copyTimerRef.current);
|
|
420
495
|
try {
|
|
421
|
-
if (!navigator.clipboard) throw Error("Clipboard API unavailable");
|
|
422
|
-
await navigator.clipboard.writeText(
|
|
496
|
+
if (!navigator.clipboard) throw new Error("Clipboard API unavailable");
|
|
497
|
+
await navigator.clipboard.writeText(toast.message);
|
|
498
|
+
setCopyState("copied");
|
|
423
499
|
} catch {
|
|
424
|
-
|
|
500
|
+
setCopyState("failed");
|
|
425
501
|
}
|
|
426
|
-
|
|
427
|
-
}, [
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
502
|
+
copyTimerRef.current = window.setTimeout(() => setCopyState("idle"), 1800);
|
|
503
|
+
}, [toast.message]);
|
|
504
|
+
const icon = getIcon(toast.type);
|
|
505
|
+
return /* @__PURE__ */ jsxs(ToastPrimitive.Root, {
|
|
506
|
+
open,
|
|
507
|
+
onOpenChange: (nextOpen) => {
|
|
508
|
+
if (!nextOpen) triggerDismiss();
|
|
432
509
|
},
|
|
433
510
|
duration: 2147483647,
|
|
434
|
-
className:
|
|
435
|
-
style:
|
|
511
|
+
className: toast_module_default.toast,
|
|
512
|
+
style: styleVars,
|
|
436
513
|
children: [
|
|
437
|
-
/* @__PURE__ */
|
|
438
|
-
className:
|
|
439
|
-
"aria-hidden":
|
|
440
|
-
children:
|
|
514
|
+
/* @__PURE__ */ jsx("span", {
|
|
515
|
+
className: toast_module_default.icon,
|
|
516
|
+
"aria-hidden": true,
|
|
517
|
+
children: icon
|
|
441
518
|
}),
|
|
442
|
-
/* @__PURE__ */
|
|
443
|
-
className:
|
|
444
|
-
children: [/* @__PURE__ */
|
|
445
|
-
className:
|
|
446
|
-
children:
|
|
447
|
-
}),
|
|
448
|
-
className:
|
|
449
|
-
children: /* @__PURE__ */
|
|
450
|
-
asChild:
|
|
451
|
-
altText:
|
|
452
|
-
children: /* @__PURE__ */
|
|
519
|
+
/* @__PURE__ */ jsxs("div", {
|
|
520
|
+
className: toast_module_default.body,
|
|
521
|
+
children: [/* @__PURE__ */ jsx(ToastPrimitive.Description, {
|
|
522
|
+
className: toast_module_default.message,
|
|
523
|
+
children: toast.message
|
|
524
|
+
}), toast.action && /* @__PURE__ */ jsx("div", {
|
|
525
|
+
className: toast_module_default.actions,
|
|
526
|
+
children: /* @__PURE__ */ jsx(ToastPrimitive.Action, {
|
|
527
|
+
asChild: true,
|
|
528
|
+
altText: toast.action.label,
|
|
529
|
+
children: /* @__PURE__ */ jsx("button", {
|
|
453
530
|
type: "button",
|
|
454
|
-
className:
|
|
531
|
+
className: toast_module_default.actionButton,
|
|
455
532
|
onClick: () => {
|
|
456
|
-
|
|
533
|
+
toast.action?.onClick();
|
|
534
|
+
triggerDismiss();
|
|
457
535
|
},
|
|
458
|
-
children:
|
|
536
|
+
children: toast.action.label
|
|
459
537
|
})
|
|
460
538
|
})
|
|
461
539
|
})]
|
|
462
540
|
}),
|
|
463
|
-
/* @__PURE__ */
|
|
464
|
-
className:
|
|
465
|
-
children: [
|
|
541
|
+
/* @__PURE__ */ jsxs("div", {
|
|
542
|
+
className: toast_module_default.controls,
|
|
543
|
+
children: [toast.copyable && /* @__PURE__ */ jsx("button", {
|
|
466
544
|
type: "button",
|
|
467
|
-
className:
|
|
545
|
+
className: cx(toast_module_default.iconButton, copyState === "failed" && toast_module_default.iconButtonError),
|
|
468
546
|
"aria-label": "Copy message",
|
|
469
|
-
onClick:
|
|
470
|
-
children:
|
|
547
|
+
onClick: handleCopy,
|
|
548
|
+
children: copyState === "copied" ? /* @__PURE__ */ jsx("svg", {
|
|
471
549
|
width: "13",
|
|
472
550
|
height: "13",
|
|
473
551
|
viewBox: "0 0 13 13",
|
|
474
552
|
fill: "none",
|
|
475
|
-
"aria-hidden":
|
|
476
|
-
children: /* @__PURE__ */
|
|
553
|
+
"aria-hidden": true,
|
|
554
|
+
children: /* @__PURE__ */ jsx("path", {
|
|
477
555
|
d: "M2 6.5l3 3 6-6",
|
|
478
556
|
stroke: "currentColor",
|
|
479
557
|
strokeWidth: "1.5",
|
|
480
558
|
strokeLinecap: "round",
|
|
481
559
|
strokeLinejoin: "round"
|
|
482
560
|
})
|
|
483
|
-
}) :
|
|
561
|
+
}) : copyState === "failed" ? /* @__PURE__ */ jsx("svg", {
|
|
484
562
|
width: "13",
|
|
485
563
|
height: "13",
|
|
486
564
|
viewBox: "0 0 13 13",
|
|
487
565
|
fill: "none",
|
|
488
|
-
"aria-hidden":
|
|
489
|
-
children: /* @__PURE__ */
|
|
566
|
+
"aria-hidden": true,
|
|
567
|
+
children: /* @__PURE__ */ jsx("path", {
|
|
490
568
|
d: "M10 3L3 10M3 3l7 7",
|
|
491
569
|
stroke: "currentColor",
|
|
492
570
|
strokeWidth: "1.5",
|
|
493
571
|
strokeLinecap: "round"
|
|
494
572
|
})
|
|
495
|
-
}) : /* @__PURE__ */
|
|
573
|
+
}) : /* @__PURE__ */ jsxs("svg", {
|
|
496
574
|
width: "13",
|
|
497
575
|
height: "13",
|
|
498
576
|
viewBox: "0 0 13 13",
|
|
499
577
|
fill: "none",
|
|
500
|
-
"aria-hidden":
|
|
501
|
-
children: [/* @__PURE__ */
|
|
578
|
+
"aria-hidden": true,
|
|
579
|
+
children: [/* @__PURE__ */ jsx("rect", {
|
|
502
580
|
x: "4.5",
|
|
503
581
|
y: "1.5",
|
|
504
582
|
width: "7",
|
|
@@ -506,26 +584,26 @@ function ne({ toast: e, isPaused: t, onDismiss: r }) {
|
|
|
506
584
|
rx: "1.5",
|
|
507
585
|
stroke: "currentColor",
|
|
508
586
|
strokeWidth: "1.25"
|
|
509
|
-
}), /* @__PURE__ */
|
|
587
|
+
}), /* @__PURE__ */ jsx("path", {
|
|
510
588
|
d: "M1.5 5.5v5a1.5 1.5 0 001.5 1.5h5",
|
|
511
589
|
stroke: "currentColor",
|
|
512
590
|
strokeWidth: "1.25",
|
|
513
591
|
strokeLinecap: "round"
|
|
514
592
|
})]
|
|
515
593
|
})
|
|
516
|
-
}),
|
|
517
|
-
asChild:
|
|
518
|
-
children: /* @__PURE__ */
|
|
594
|
+
}), toast.dismissible !== false && /* @__PURE__ */ jsx(ToastPrimitive.Close, {
|
|
595
|
+
asChild: true,
|
|
596
|
+
children: /* @__PURE__ */ jsx("button", {
|
|
519
597
|
type: "button",
|
|
520
|
-
className:
|
|
598
|
+
className: toast_module_default.iconButton,
|
|
521
599
|
"aria-label": "Dismiss notification",
|
|
522
|
-
children: /* @__PURE__ */
|
|
600
|
+
children: /* @__PURE__ */ jsx("svg", {
|
|
523
601
|
width: "13",
|
|
524
602
|
height: "13",
|
|
525
603
|
viewBox: "0 0 13 13",
|
|
526
604
|
fill: "none",
|
|
527
|
-
"aria-hidden":
|
|
528
|
-
children: /* @__PURE__ */
|
|
605
|
+
"aria-hidden": true,
|
|
606
|
+
children: /* @__PURE__ */ jsx("path", {
|
|
529
607
|
d: "M10 3L3 10M3 3l7 7",
|
|
530
608
|
stroke: "currentColor",
|
|
531
609
|
strokeWidth: "1.5",
|
|
@@ -538,8 +616,8 @@ function ne({ toast: e, isPaused: t, onDismiss: r }) {
|
|
|
538
616
|
]
|
|
539
617
|
});
|
|
540
618
|
}
|
|
541
|
-
function
|
|
542
|
-
switch (
|
|
619
|
+
function getPalette(type) {
|
|
620
|
+
switch (type) {
|
|
543
621
|
case "success": return {
|
|
544
622
|
background: "color-mix(in srgb, var(--success) 12%, var(--popover))",
|
|
545
623
|
border: "color-mix(in srgb, var(--success) 30%, transparent)",
|
|
@@ -574,15 +652,15 @@ function re(e) {
|
|
|
574
652
|
};
|
|
575
653
|
}
|
|
576
654
|
}
|
|
577
|
-
function
|
|
578
|
-
switch (
|
|
579
|
-
case "success": return /* @__PURE__ */
|
|
655
|
+
function getIcon(type) {
|
|
656
|
+
switch (type) {
|
|
657
|
+
case "success": return /* @__PURE__ */ jsx("svg", {
|
|
580
658
|
width: "16",
|
|
581
659
|
height: "16",
|
|
582
660
|
viewBox: "0 0 16 16",
|
|
583
661
|
fill: "none",
|
|
584
|
-
"aria-hidden":
|
|
585
|
-
children: /* @__PURE__ */
|
|
662
|
+
"aria-hidden": true,
|
|
663
|
+
children: /* @__PURE__ */ jsx("path", {
|
|
586
664
|
d: "M3 8l3.5 3.5L13 4.5",
|
|
587
665
|
stroke: "currentColor",
|
|
588
666
|
strokeWidth: "1.75",
|
|
@@ -590,39 +668,39 @@ function ie(e) {
|
|
|
590
668
|
strokeLinejoin: "round"
|
|
591
669
|
})
|
|
592
670
|
});
|
|
593
|
-
case "error": return /* @__PURE__ */
|
|
671
|
+
case "error": return /* @__PURE__ */ jsx("svg", {
|
|
594
672
|
width: "16",
|
|
595
673
|
height: "16",
|
|
596
674
|
viewBox: "0 0 16 16",
|
|
597
675
|
fill: "none",
|
|
598
|
-
"aria-hidden":
|
|
599
|
-
children: /* @__PURE__ */
|
|
676
|
+
"aria-hidden": true,
|
|
677
|
+
children: /* @__PURE__ */ jsx("path", {
|
|
600
678
|
d: "M4 4l8 8M12 4l-8 8",
|
|
601
679
|
stroke: "currentColor",
|
|
602
680
|
strokeWidth: "1.75",
|
|
603
681
|
strokeLinecap: "round"
|
|
604
682
|
})
|
|
605
683
|
});
|
|
606
|
-
case "warning": return /* @__PURE__ */
|
|
684
|
+
case "warning": return /* @__PURE__ */ jsx("svg", {
|
|
607
685
|
width: "16",
|
|
608
686
|
height: "16",
|
|
609
687
|
viewBox: "0 0 16 16",
|
|
610
688
|
fill: "none",
|
|
611
|
-
"aria-hidden":
|
|
612
|
-
children: /* @__PURE__ */
|
|
689
|
+
"aria-hidden": true,
|
|
690
|
+
children: /* @__PURE__ */ jsx("path", {
|
|
613
691
|
d: "M8 3v6M8 11.5v1",
|
|
614
692
|
stroke: "currentColor",
|
|
615
693
|
strokeWidth: "1.75",
|
|
616
694
|
strokeLinecap: "round"
|
|
617
695
|
})
|
|
618
696
|
});
|
|
619
|
-
default: return /* @__PURE__ */
|
|
697
|
+
default: return /* @__PURE__ */ jsx("svg", {
|
|
620
698
|
width: "16",
|
|
621
699
|
height: "16",
|
|
622
700
|
viewBox: "0 0 16 16",
|
|
623
701
|
fill: "none",
|
|
624
|
-
"aria-hidden":
|
|
625
|
-
children: /* @__PURE__ */
|
|
702
|
+
"aria-hidden": true,
|
|
703
|
+
children: /* @__PURE__ */ jsx("path", {
|
|
626
704
|
d: "M8 7v5M8 4.5v.5",
|
|
627
705
|
stroke: "currentColor",
|
|
628
706
|
strokeWidth: "1.75",
|
|
@@ -631,27 +709,40 @@ function ie(e) {
|
|
|
631
709
|
});
|
|
632
710
|
}
|
|
633
711
|
}
|
|
634
|
-
var
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
712
|
+
var input_module_default = { input: "uzi-input-module__input__-ipHD" };
|
|
713
|
+
//#endregion
|
|
714
|
+
//#region src/components/input/Input.tsx
|
|
715
|
+
var Input = React.forwardRef(({ className, type, ...props }, ref) => {
|
|
716
|
+
return /* @__PURE__ */ jsx("input", {
|
|
717
|
+
ref,
|
|
718
|
+
type,
|
|
719
|
+
className: cx(input_module_default.input, className),
|
|
720
|
+
...props
|
|
721
|
+
});
|
|
722
|
+
});
|
|
723
|
+
Input.displayName = "Input";
|
|
724
|
+
var label_module_default = { label: "uzi-label-module__label__gKflt" };
|
|
725
|
+
//#endregion
|
|
726
|
+
//#region src/components/label/Label.tsx
|
|
727
|
+
var Label = React.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx("label", {
|
|
728
|
+
ref,
|
|
729
|
+
className: cx(label_module_default.label, className),
|
|
730
|
+
...props
|
|
652
731
|
}));
|
|
653
|
-
|
|
654
|
-
var
|
|
732
|
+
Label.displayName = "Label";
|
|
733
|
+
var checkbox_module_default = { checkbox: "uzi-checkbox-module__checkbox__zAB1y" };
|
|
734
|
+
//#endregion
|
|
735
|
+
//#region src/components/checkbox/Checkbox.tsx
|
|
736
|
+
var Checkbox = React.forwardRef(({ className, ...props }, ref) => {
|
|
737
|
+
return /* @__PURE__ */ jsx("input", {
|
|
738
|
+
ref,
|
|
739
|
+
type: "checkbox",
|
|
740
|
+
className: cx(checkbox_module_default.checkbox, className),
|
|
741
|
+
...props
|
|
742
|
+
});
|
|
743
|
+
});
|
|
744
|
+
Checkbox.displayName = "Checkbox";
|
|
745
|
+
var multi_select_module_default = {
|
|
655
746
|
wrapper: "uzi-multi-select-module__wrapper__Izj2x",
|
|
656
747
|
wrapperFullWidth: "uzi-multi-select-module__wrapperFullWidth__eH8pf",
|
|
657
748
|
trigger: "uzi-multi-select-module__trigger__r3816",
|
|
@@ -669,54 +760,62 @@ var G = {
|
|
|
669
760
|
indicator: "uzi-multi-select-module__indicator__NO-WE",
|
|
670
761
|
indicatorSelected: "uzi-multi-select-module__indicatorSelected__9sEAy",
|
|
671
762
|
indicatorDisabled: "uzi-multi-select-module__indicatorDisabled__vqdiH"
|
|
672
|
-
}
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
763
|
+
};
|
|
764
|
+
//#endregion
|
|
765
|
+
//#region src/components/multi-select/MultiSelect.tsx
|
|
766
|
+
var MultiSelect = React.forwardRef(({ options, value, onChange, placeholder = "Select options", fullWidth = true, maxVisibleValues = 2, className, disabled = false, name, "aria-label": ariaLabel, "aria-labelledby": ariaLabelledBy }, ref) => {
|
|
767
|
+
const selectedSet = React.useMemo(() => new Set(value), [value]);
|
|
768
|
+
const selectedOptions = React.useMemo(() => options.filter((opt) => selectedSet.has(opt.value)), [options, selectedSet]);
|
|
769
|
+
const toggleValue = React.useCallback((nextValue) => {
|
|
770
|
+
if (selectedSet.has(nextValue)) {
|
|
771
|
+
onChange(value.filter((entry) => entry !== nextValue));
|
|
676
772
|
return;
|
|
677
773
|
}
|
|
678
|
-
|
|
774
|
+
onChange([...value, nextValue]);
|
|
679
775
|
}, [
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
])
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
776
|
+
onChange,
|
|
777
|
+
selectedSet,
|
|
778
|
+
value
|
|
779
|
+
]);
|
|
780
|
+
const visibleCount = Math.max(1, maxVisibleValues);
|
|
781
|
+
const visibleOptions = selectedOptions.slice(0, visibleCount);
|
|
782
|
+
const overflowCount = Math.max(0, selectedOptions.length - visibleOptions.length);
|
|
783
|
+
return /* @__PURE__ */ jsx(DropdownMenuPrimitive.Root, {
|
|
784
|
+
modal: false,
|
|
785
|
+
children: /* @__PURE__ */ jsxs("div", {
|
|
786
|
+
className: cx(multi_select_module_default.wrapper, fullWidth && multi_select_module_default.wrapperFullWidth, className),
|
|
688
787
|
children: [
|
|
689
|
-
/* @__PURE__ */
|
|
690
|
-
asChild:
|
|
691
|
-
children: /* @__PURE__ */
|
|
692
|
-
ref
|
|
788
|
+
/* @__PURE__ */ jsx(DropdownMenuPrimitive.Trigger, {
|
|
789
|
+
asChild: true,
|
|
790
|
+
children: /* @__PURE__ */ jsxs("button", {
|
|
791
|
+
ref,
|
|
693
792
|
type: "button",
|
|
694
|
-
className:
|
|
695
|
-
"aria-label":
|
|
696
|
-
"aria-labelledby":
|
|
697
|
-
disabled
|
|
698
|
-
children: [/* @__PURE__ */
|
|
699
|
-
className:
|
|
700
|
-
children:
|
|
701
|
-
className:
|
|
702
|
-
children:
|
|
703
|
-
}) : /* @__PURE__ */
|
|
704
|
-
className:
|
|
705
|
-
children:
|
|
706
|
-
},
|
|
707
|
-
className:
|
|
708
|
-
children: ["+",
|
|
793
|
+
className: multi_select_module_default.trigger,
|
|
794
|
+
"aria-label": ariaLabel,
|
|
795
|
+
"aria-labelledby": ariaLabelledBy,
|
|
796
|
+
disabled,
|
|
797
|
+
children: [/* @__PURE__ */ jsx("span", {
|
|
798
|
+
className: multi_select_module_default.value,
|
|
799
|
+
children: selectedOptions.length === 0 ? /* @__PURE__ */ jsx("span", {
|
|
800
|
+
className: multi_select_module_default.placeholder,
|
|
801
|
+
children: placeholder
|
|
802
|
+
}) : /* @__PURE__ */ jsxs(Fragment, { children: [visibleOptions.map((option) => /* @__PURE__ */ jsx("span", {
|
|
803
|
+
className: multi_select_module_default.chip,
|
|
804
|
+
children: option.label
|
|
805
|
+
}, option.value)), overflowCount > 0 ? /* @__PURE__ */ jsxs("span", {
|
|
806
|
+
className: cx(multi_select_module_default.chip, multi_select_module_default.chipSummary),
|
|
807
|
+
children: ["+", overflowCount]
|
|
709
808
|
}) : null] })
|
|
710
|
-
}), /* @__PURE__ */
|
|
711
|
-
className:
|
|
809
|
+
}), /* @__PURE__ */ jsx("span", {
|
|
810
|
+
className: multi_select_module_default.chevron,
|
|
712
811
|
"aria-hidden": "true",
|
|
713
|
-
children: /* @__PURE__ */
|
|
812
|
+
children: /* @__PURE__ */ jsx("svg", {
|
|
714
813
|
viewBox: "0 0 10 10",
|
|
715
814
|
fill: "none",
|
|
716
815
|
xmlns: "http://www.w3.org/2000/svg",
|
|
717
816
|
width: "10",
|
|
718
817
|
height: "10",
|
|
719
|
-
children: /* @__PURE__ */
|
|
818
|
+
children: /* @__PURE__ */ jsx("path", {
|
|
720
819
|
d: "M2 3.5L5 6.5L8 3.5",
|
|
721
820
|
stroke: "currentColor",
|
|
722
821
|
strokeWidth: "1.5",
|
|
@@ -727,35 +826,35 @@ var G = {
|
|
|
727
826
|
})]
|
|
728
827
|
})
|
|
729
828
|
}),
|
|
730
|
-
|
|
829
|
+
name ? value.map((entry) => /* @__PURE__ */ jsx("input", {
|
|
731
830
|
type: "hidden",
|
|
732
|
-
name
|
|
733
|
-
value:
|
|
734
|
-
},
|
|
735
|
-
/* @__PURE__ */
|
|
736
|
-
className:
|
|
831
|
+
name,
|
|
832
|
+
value: entry
|
|
833
|
+
}, entry)) : null,
|
|
834
|
+
/* @__PURE__ */ jsx(DropdownMenuPrimitive.Portal, { children: /* @__PURE__ */ jsx(DropdownMenuPrimitive.Content, {
|
|
835
|
+
className: multi_select_module_default.menu,
|
|
737
836
|
sideOffset: 4,
|
|
738
837
|
align: "start",
|
|
739
|
-
children:
|
|
740
|
-
|
|
741
|
-
return /* @__PURE__ */
|
|
742
|
-
className:
|
|
743
|
-
checked:
|
|
744
|
-
disabled:
|
|
745
|
-
onCheckedChange: () =>
|
|
746
|
-
onSelect: (
|
|
747
|
-
children: [/* @__PURE__ */
|
|
748
|
-
className:
|
|
838
|
+
children: options.map((option) => {
|
|
839
|
+
const selected = selectedSet.has(option.value);
|
|
840
|
+
return /* @__PURE__ */ jsxs(DropdownMenuPrimitive.CheckboxItem, {
|
|
841
|
+
className: cx(multi_select_module_default.option, selected && multi_select_module_default.optionSelected, option.disabled && multi_select_module_default.optionDisabled),
|
|
842
|
+
checked: selected,
|
|
843
|
+
disabled: option.disabled,
|
|
844
|
+
onCheckedChange: () => toggleValue(option.value),
|
|
845
|
+
onSelect: (event) => event.preventDefault(),
|
|
846
|
+
children: [/* @__PURE__ */ jsx("span", {
|
|
847
|
+
className: cx(multi_select_module_default.indicator, selected && multi_select_module_default.indicatorSelected, option.disabled && multi_select_module_default.indicatorDisabled),
|
|
749
848
|
"aria-hidden": "true",
|
|
750
|
-
children: /* @__PURE__ */
|
|
751
|
-
forceMount:
|
|
752
|
-
children: /* @__PURE__ */
|
|
849
|
+
children: /* @__PURE__ */ jsx(DropdownMenuPrimitive.ItemIndicator, {
|
|
850
|
+
forceMount: true,
|
|
851
|
+
children: /* @__PURE__ */ jsx("svg", {
|
|
753
852
|
viewBox: "0 0 16 16",
|
|
754
853
|
width: "16",
|
|
755
854
|
height: "16",
|
|
756
855
|
fill: "none",
|
|
757
856
|
xmlns: "http://www.w3.org/2000/svg",
|
|
758
|
-
children: /* @__PURE__ */
|
|
857
|
+
children: /* @__PURE__ */ jsx("path", {
|
|
759
858
|
d: "M3.5 8.5 6.5 11.5 12.5 4.5",
|
|
760
859
|
stroke: "currentColor",
|
|
761
860
|
strokeWidth: "1.8",
|
|
@@ -764,19 +863,19 @@ var G = {
|
|
|
764
863
|
})
|
|
765
864
|
})
|
|
766
865
|
})
|
|
767
|
-
}), /* @__PURE__ */
|
|
768
|
-
className:
|
|
769
|
-
children:
|
|
866
|
+
}), /* @__PURE__ */ jsx("span", {
|
|
867
|
+
className: multi_select_module_default.optionLabel,
|
|
868
|
+
children: option.label
|
|
770
869
|
})]
|
|
771
|
-
},
|
|
870
|
+
}, option.value);
|
|
772
871
|
})
|
|
773
872
|
}) })
|
|
774
873
|
]
|
|
775
874
|
})
|
|
776
875
|
});
|
|
777
876
|
});
|
|
778
|
-
|
|
779
|
-
var
|
|
877
|
+
MultiSelect.displayName = "MultiSelect";
|
|
878
|
+
var select_module_default = {
|
|
780
879
|
wrapper: "uzi-select-module__wrapper__7szq0",
|
|
781
880
|
wrapperFullWidth: "uzi-select-module__wrapperFullWidth__IyOIG",
|
|
782
881
|
trigger: "uzi-select-module__trigger__ldh8w",
|
|
@@ -788,116 +887,128 @@ var K = {
|
|
|
788
887
|
item: "uzi-select-module__item__6uM6-",
|
|
789
888
|
indicator: "uzi-select-module__indicator__ZHcg5",
|
|
790
889
|
indicatorIcon: "uzi-select-module__indicatorIcon__kOV2G"
|
|
791
|
-
}
|
|
792
|
-
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
|
|
797
|
-
|
|
798
|
-
|
|
799
|
-
|
|
800
|
-
|
|
801
|
-
|
|
802
|
-
|
|
803
|
-
|
|
804
|
-
|
|
805
|
-
|
|
806
|
-
|
|
807
|
-
|
|
808
|
-
|
|
809
|
-
|
|
810
|
-
|
|
811
|
-
|
|
812
|
-
|
|
813
|
-
|
|
814
|
-
|
|
815
|
-
|
|
816
|
-
|
|
817
|
-
|
|
818
|
-
|
|
819
|
-
|
|
820
|
-
|
|
821
|
-
|
|
822
|
-
|
|
823
|
-
|
|
824
|
-
|
|
825
|
-
|
|
826
|
-
|
|
827
|
-
|
|
890
|
+
};
|
|
891
|
+
//#endregion
|
|
892
|
+
//#region src/components/select/Select.tsx
|
|
893
|
+
var EMPTY_OPTION_VALUE = "__uzi_select_empty__";
|
|
894
|
+
var Select = React.forwardRef(({ options, value, onChange, placeholder, allowEmptyOption = false, fullWidth = true, className, id, name, disabled, required, autoComplete, form, title, "aria-label": ariaLabel, "aria-labelledby": ariaLabelledBy, onBlur, onFocus }, ref) => {
|
|
895
|
+
return /* @__PURE__ */ jsx("div", {
|
|
896
|
+
className: cx(select_module_default.wrapper, fullWidth && select_module_default.wrapperFullWidth, className),
|
|
897
|
+
children: /* @__PURE__ */ jsxs(SelectPrimitive.Root, {
|
|
898
|
+
value,
|
|
899
|
+
onValueChange: (nextValue) => onChange(nextValue === EMPTY_OPTION_VALUE ? "" : nextValue),
|
|
900
|
+
name,
|
|
901
|
+
disabled,
|
|
902
|
+
required,
|
|
903
|
+
autoComplete,
|
|
904
|
+
form,
|
|
905
|
+
children: [/* @__PURE__ */ jsxs(SelectPrimitive.Trigger, {
|
|
906
|
+
ref,
|
|
907
|
+
id,
|
|
908
|
+
className: select_module_default.trigger,
|
|
909
|
+
title,
|
|
910
|
+
"aria-label": ariaLabel,
|
|
911
|
+
"aria-labelledby": ariaLabelledBy,
|
|
912
|
+
onBlur,
|
|
913
|
+
onFocus,
|
|
914
|
+
children: [/* @__PURE__ */ jsx(SelectPrimitive.Value, {
|
|
915
|
+
className: select_module_default.value,
|
|
916
|
+
placeholder
|
|
917
|
+
}), /* @__PURE__ */ jsx(SelectPrimitive.Icon, {
|
|
918
|
+
className: select_module_default.chevron,
|
|
919
|
+
"aria-hidden": "true",
|
|
920
|
+
children: /* @__PURE__ */ jsx("svg", {
|
|
921
|
+
viewBox: "0 0 10 10",
|
|
922
|
+
fill: "none",
|
|
923
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
924
|
+
width: "10",
|
|
925
|
+
height: "10",
|
|
926
|
+
children: /* @__PURE__ */ jsx("path", {
|
|
927
|
+
d: "M2 3.5L5 6.5L8 3.5",
|
|
928
|
+
stroke: "currentColor",
|
|
929
|
+
strokeWidth: "1.5",
|
|
930
|
+
strokeLinecap: "round",
|
|
931
|
+
strokeLinejoin: "round"
|
|
932
|
+
})
|
|
828
933
|
})
|
|
934
|
+
})]
|
|
935
|
+
}), /* @__PURE__ */ jsx(SelectPrimitive.Portal, { children: /* @__PURE__ */ jsx(SelectPrimitive.Content, {
|
|
936
|
+
className: select_module_default.content,
|
|
937
|
+
position: "popper",
|
|
938
|
+
sideOffset: 4,
|
|
939
|
+
align: "start",
|
|
940
|
+
children: /* @__PURE__ */ jsxs(SelectPrimitive.Viewport, {
|
|
941
|
+
className: select_module_default.viewport,
|
|
942
|
+
children: [placeholder && allowEmptyOption ? /* @__PURE__ */ jsxs(SelectPrimitive.Item, {
|
|
943
|
+
value: EMPTY_OPTION_VALUE,
|
|
944
|
+
className: select_module_default.item,
|
|
945
|
+
children: [/* @__PURE__ */ jsx("span", {
|
|
946
|
+
className: select_module_default.indicator,
|
|
947
|
+
children: /* @__PURE__ */ jsx(SelectPrimitive.ItemIndicator, { children: /* @__PURE__ */ jsx("svg", {
|
|
948
|
+
viewBox: "0 0 16 16",
|
|
949
|
+
width: "16",
|
|
950
|
+
height: "16",
|
|
951
|
+
"aria-hidden": "true",
|
|
952
|
+
className: select_module_default.indicatorIcon,
|
|
953
|
+
children: /* @__PURE__ */ jsx("path", {
|
|
954
|
+
d: "M3.5 8.5 6.5 11.5 12.5 4.5",
|
|
955
|
+
fill: "none",
|
|
956
|
+
stroke: "currentColor",
|
|
957
|
+
strokeWidth: "1.8",
|
|
958
|
+
strokeLinecap: "round",
|
|
959
|
+
strokeLinejoin: "round"
|
|
960
|
+
})
|
|
961
|
+
}) })
|
|
962
|
+
}), /* @__PURE__ */ jsx(SelectPrimitive.ItemText, { children: placeholder })]
|
|
963
|
+
}) : null, options.map((opt) => /* @__PURE__ */ jsxs(SelectPrimitive.Item, {
|
|
964
|
+
value: opt.value,
|
|
965
|
+
disabled: opt.disabled,
|
|
966
|
+
className: select_module_default.item,
|
|
967
|
+
children: [/* @__PURE__ */ jsx("span", {
|
|
968
|
+
className: select_module_default.indicator,
|
|
969
|
+
children: /* @__PURE__ */ jsx(SelectPrimitive.ItemIndicator, { children: /* @__PURE__ */ jsx("svg", {
|
|
970
|
+
viewBox: "0 0 16 16",
|
|
971
|
+
width: "16",
|
|
972
|
+
height: "16",
|
|
973
|
+
"aria-hidden": "true",
|
|
974
|
+
className: select_module_default.indicatorIcon,
|
|
975
|
+
children: /* @__PURE__ */ jsx("path", {
|
|
976
|
+
d: "M3.5 8.5 6.5 11.5 12.5 4.5",
|
|
977
|
+
fill: "none",
|
|
978
|
+
stroke: "currentColor",
|
|
979
|
+
strokeWidth: "1.8",
|
|
980
|
+
strokeLinecap: "round",
|
|
981
|
+
strokeLinejoin: "round"
|
|
982
|
+
})
|
|
983
|
+
}) })
|
|
984
|
+
}), /* @__PURE__ */ jsx(SelectPrimitive.ItemText, { children: opt.label })]
|
|
985
|
+
}, opt.value))]
|
|
829
986
|
})
|
|
830
|
-
})]
|
|
831
|
-
})
|
|
832
|
-
|
|
833
|
-
|
|
834
|
-
|
|
835
|
-
align: "start",
|
|
836
|
-
children: /* @__PURE__ */ f(_.Viewport, {
|
|
837
|
-
className: K.viewport,
|
|
838
|
-
children: [r && i ? /* @__PURE__ */ f(_.Item, {
|
|
839
|
-
value: le,
|
|
840
|
-
className: K.item,
|
|
841
|
-
children: [/* @__PURE__ */ d("span", {
|
|
842
|
-
className: K.indicator,
|
|
843
|
-
children: /* @__PURE__ */ d(_.ItemIndicator, { children: /* @__PURE__ */ d("svg", {
|
|
844
|
-
viewBox: "0 0 16 16",
|
|
845
|
-
width: "16",
|
|
846
|
-
height: "16",
|
|
847
|
-
"aria-hidden": "true",
|
|
848
|
-
className: K.indicatorIcon,
|
|
849
|
-
children: /* @__PURE__ */ d("path", {
|
|
850
|
-
d: "M3.5 8.5 6.5 11.5 12.5 4.5",
|
|
851
|
-
fill: "none",
|
|
852
|
-
stroke: "currentColor",
|
|
853
|
-
strokeWidth: "1.8",
|
|
854
|
-
strokeLinecap: "round",
|
|
855
|
-
strokeLinejoin: "round"
|
|
856
|
-
})
|
|
857
|
-
}) })
|
|
858
|
-
}), /* @__PURE__ */ d(_.ItemText, { children: r })]
|
|
859
|
-
}) : null, e.map((e) => /* @__PURE__ */ f(_.Item, {
|
|
860
|
-
value: e.value,
|
|
861
|
-
disabled: e.disabled,
|
|
862
|
-
className: K.item,
|
|
863
|
-
children: [/* @__PURE__ */ d("span", {
|
|
864
|
-
className: K.indicator,
|
|
865
|
-
children: /* @__PURE__ */ d(_.ItemIndicator, { children: /* @__PURE__ */ d("svg", {
|
|
866
|
-
viewBox: "0 0 16 16",
|
|
867
|
-
width: "16",
|
|
868
|
-
height: "16",
|
|
869
|
-
"aria-hidden": "true",
|
|
870
|
-
className: K.indicatorIcon,
|
|
871
|
-
children: /* @__PURE__ */ d("path", {
|
|
872
|
-
d: "M3.5 8.5 6.5 11.5 12.5 4.5",
|
|
873
|
-
fill: "none",
|
|
874
|
-
stroke: "currentColor",
|
|
875
|
-
strokeWidth: "1.8",
|
|
876
|
-
strokeLinecap: "round",
|
|
877
|
-
strokeLinejoin: "round"
|
|
878
|
-
})
|
|
879
|
-
}) })
|
|
880
|
-
}), /* @__PURE__ */ d(_.ItemText, { children: e.label })]
|
|
881
|
-
}, e.value))]
|
|
882
|
-
})
|
|
883
|
-
}) })]
|
|
884
|
-
})
|
|
885
|
-
}));
|
|
886
|
-
q.displayName = "Select";
|
|
987
|
+
}) })]
|
|
988
|
+
})
|
|
989
|
+
});
|
|
990
|
+
});
|
|
991
|
+
Select.displayName = "Select";
|
|
887
992
|
//#endregion
|
|
888
993
|
//#region src/components/dropdown/Dropdown.tsx
|
|
889
|
-
|
|
890
|
-
|
|
891
|
-
|
|
892
|
-
|
|
893
|
-
|
|
894
|
-
|
|
895
|
-
|
|
896
|
-
|
|
897
|
-
|
|
898
|
-
|
|
899
|
-
|
|
900
|
-
|
|
994
|
+
/**
|
|
995
|
+
* @deprecated Use Select for value selection and DropdownMenu for action menus.
|
|
996
|
+
* Dropdown remains as a compatibility alias during migration.
|
|
997
|
+
*/
|
|
998
|
+
var Dropdown = React.forwardRef(({ options, value, onChange, placeholder = "All", allowClear = true, ...rest }, ref) => {
|
|
999
|
+
return /* @__PURE__ */ jsx(Select, {
|
|
1000
|
+
ref,
|
|
1001
|
+
options,
|
|
1002
|
+
value,
|
|
1003
|
+
onChange,
|
|
1004
|
+
placeholder,
|
|
1005
|
+
allowEmptyOption: allowClear,
|
|
1006
|
+
fullWidth: false,
|
|
1007
|
+
...rest
|
|
1008
|
+
});
|
|
1009
|
+
});
|
|
1010
|
+
Dropdown.displayName = "Dropdown";
|
|
1011
|
+
var dropdown_menu_module_default = {
|
|
901
1012
|
content: "uzi-dropdown-menu-module__content__n-ElH",
|
|
902
1013
|
menuFadeIn: "uzi-dropdown-menu-module__menuFadeIn__ITxMo",
|
|
903
1014
|
item: "uzi-dropdown-menu-module__item__tBNtW",
|
|
@@ -912,51 +1023,51 @@ var J = {
|
|
|
912
1023
|
};
|
|
913
1024
|
//#endregion
|
|
914
1025
|
//#region src/components/dropdown-menu/DropdownMenu.tsx
|
|
915
|
-
function
|
|
916
|
-
return /* @__PURE__ */
|
|
1026
|
+
function DropdownMenu(props) {
|
|
1027
|
+
return /* @__PURE__ */ jsx(DropdownMenuPrimitive.Root, { ...props });
|
|
917
1028
|
}
|
|
918
|
-
function
|
|
919
|
-
return /* @__PURE__ */
|
|
1029
|
+
function DropdownMenuTrigger(props) {
|
|
1030
|
+
return /* @__PURE__ */ jsx(DropdownMenuPrimitive.Trigger, { ...props });
|
|
920
1031
|
}
|
|
921
|
-
function
|
|
922
|
-
return /* @__PURE__ */
|
|
1032
|
+
function DropdownMenuGroup(props) {
|
|
1033
|
+
return /* @__PURE__ */ jsx(DropdownMenuPrimitive.Group, { ...props });
|
|
923
1034
|
}
|
|
924
|
-
function
|
|
925
|
-
return /* @__PURE__ */
|
|
1035
|
+
function DropdownMenuPortal(props) {
|
|
1036
|
+
return /* @__PURE__ */ jsx(DropdownMenuPrimitive.Portal, { ...props });
|
|
926
1037
|
}
|
|
927
|
-
function
|
|
928
|
-
return /* @__PURE__ */
|
|
1038
|
+
function DropdownMenuSub(props) {
|
|
1039
|
+
return /* @__PURE__ */ jsx(DropdownMenuPrimitive.Sub, { ...props });
|
|
929
1040
|
}
|
|
930
|
-
function
|
|
931
|
-
return /* @__PURE__ */
|
|
1041
|
+
function DropdownMenuRadioGroup(props) {
|
|
1042
|
+
return /* @__PURE__ */ jsx(DropdownMenuPrimitive.RadioGroup, { ...props });
|
|
932
1043
|
}
|
|
933
|
-
function
|
|
934
|
-
return /* @__PURE__ */
|
|
935
|
-
sideOffset
|
|
936
|
-
className:
|
|
937
|
-
...
|
|
1044
|
+
function DropdownMenuContent({ className, sideOffset = 4, ...props }) {
|
|
1045
|
+
return /* @__PURE__ */ jsx(DropdownMenuPrimitive.Portal, { children: /* @__PURE__ */ jsx(DropdownMenuPrimitive.Content, {
|
|
1046
|
+
sideOffset,
|
|
1047
|
+
className: cx(dropdown_menu_module_default.content, className),
|
|
1048
|
+
...props
|
|
938
1049
|
}) });
|
|
939
1050
|
}
|
|
940
|
-
function
|
|
941
|
-
return /* @__PURE__ */
|
|
942
|
-
"data-inset":
|
|
943
|
-
className:
|
|
944
|
-
...
|
|
1051
|
+
function DropdownMenuItem({ className, inset, variant = "default", ...props }) {
|
|
1052
|
+
return /* @__PURE__ */ jsx(DropdownMenuPrimitive.Item, {
|
|
1053
|
+
"data-inset": inset ? "true" : void 0,
|
|
1054
|
+
className: cx(dropdown_menu_module_default.item, variant === "destructive" && dropdown_menu_module_default.itemDestructive, className),
|
|
1055
|
+
...props
|
|
945
1056
|
});
|
|
946
1057
|
}
|
|
947
|
-
function
|
|
948
|
-
return /* @__PURE__ */
|
|
949
|
-
className:
|
|
950
|
-
...
|
|
951
|
-
children: [/* @__PURE__ */
|
|
952
|
-
className:
|
|
953
|
-
children: /* @__PURE__ */
|
|
1058
|
+
function DropdownMenuCheckboxItem({ className, children, ...props }) {
|
|
1059
|
+
return /* @__PURE__ */ jsxs(DropdownMenuPrimitive.CheckboxItem, {
|
|
1060
|
+
className: cx(dropdown_menu_module_default.item, dropdown_menu_module_default.insetItem, className),
|
|
1061
|
+
...props,
|
|
1062
|
+
children: [/* @__PURE__ */ jsx("span", {
|
|
1063
|
+
className: dropdown_menu_module_default.indicator,
|
|
1064
|
+
children: /* @__PURE__ */ jsx(DropdownMenuPrimitive.ItemIndicator, { children: /* @__PURE__ */ jsx("svg", {
|
|
954
1065
|
viewBox: "0 0 16 16",
|
|
955
1066
|
width: "16",
|
|
956
1067
|
height: "16",
|
|
957
1068
|
"aria-hidden": "true",
|
|
958
|
-
className:
|
|
959
|
-
children: /* @__PURE__ */
|
|
1069
|
+
className: dropdown_menu_module_default.indicatorIcon,
|
|
1070
|
+
children: /* @__PURE__ */ jsx("path", {
|
|
960
1071
|
d: "M3.5 8.5 6.5 11.5 12.5 4.5",
|
|
961
1072
|
fill: "none",
|
|
962
1073
|
stroke: "currentColor",
|
|
@@ -965,44 +1076,44 @@ function ye({ className: e, children: t, ...n }) {
|
|
|
965
1076
|
strokeLinejoin: "round"
|
|
966
1077
|
})
|
|
967
1078
|
}) })
|
|
968
|
-
}),
|
|
1079
|
+
}), children]
|
|
969
1080
|
});
|
|
970
1081
|
}
|
|
971
|
-
function
|
|
972
|
-
return /* @__PURE__ */
|
|
973
|
-
className:
|
|
974
|
-
...
|
|
975
|
-
children: [/* @__PURE__ */
|
|
976
|
-
className:
|
|
977
|
-
children: /* @__PURE__ */
|
|
978
|
-
}),
|
|
1082
|
+
function DropdownMenuRadioItem({ className, children, ...props }) {
|
|
1083
|
+
return /* @__PURE__ */ jsxs(DropdownMenuPrimitive.RadioItem, {
|
|
1084
|
+
className: cx(dropdown_menu_module_default.item, dropdown_menu_module_default.insetItem, className),
|
|
1085
|
+
...props,
|
|
1086
|
+
children: [/* @__PURE__ */ jsx("span", {
|
|
1087
|
+
className: dropdown_menu_module_default.indicator,
|
|
1088
|
+
children: /* @__PURE__ */ jsx(DropdownMenuPrimitive.ItemIndicator, { children: /* @__PURE__ */ jsx("span", { className: dropdown_menu_module_default.radioDot }) })
|
|
1089
|
+
}), children]
|
|
979
1090
|
});
|
|
980
1091
|
}
|
|
981
|
-
function
|
|
982
|
-
return /* @__PURE__ */
|
|
983
|
-
"data-inset":
|
|
984
|
-
className:
|
|
985
|
-
...
|
|
1092
|
+
function DropdownMenuLabel({ className, inset, ...props }) {
|
|
1093
|
+
return /* @__PURE__ */ jsx(DropdownMenuPrimitive.Label, {
|
|
1094
|
+
"data-inset": inset ? "true" : void 0,
|
|
1095
|
+
className: cx(dropdown_menu_module_default.label, className),
|
|
1096
|
+
...props
|
|
986
1097
|
});
|
|
987
1098
|
}
|
|
988
|
-
function
|
|
989
|
-
return /* @__PURE__ */
|
|
990
|
-
className:
|
|
991
|
-
...
|
|
1099
|
+
function DropdownMenuSeparator({ className, ...props }) {
|
|
1100
|
+
return /* @__PURE__ */ jsx(DropdownMenuPrimitive.Separator, {
|
|
1101
|
+
className: cx(dropdown_menu_module_default.separator, className),
|
|
1102
|
+
...props
|
|
992
1103
|
});
|
|
993
1104
|
}
|
|
994
|
-
function
|
|
995
|
-
return /* @__PURE__ */
|
|
996
|
-
"data-inset":
|
|
997
|
-
className:
|
|
998
|
-
...
|
|
999
|
-
children: [
|
|
1105
|
+
function DropdownMenuSubTrigger({ className, inset, children, ...props }) {
|
|
1106
|
+
return /* @__PURE__ */ jsxs(DropdownMenuPrimitive.SubTrigger, {
|
|
1107
|
+
"data-inset": inset ? "true" : void 0,
|
|
1108
|
+
className: cx(dropdown_menu_module_default.item, className),
|
|
1109
|
+
...props,
|
|
1110
|
+
children: [children, /* @__PURE__ */ jsx("svg", {
|
|
1000
1111
|
viewBox: "0 0 16 16",
|
|
1001
1112
|
width: "16",
|
|
1002
1113
|
height: "16",
|
|
1003
1114
|
"aria-hidden": "true",
|
|
1004
|
-
className:
|
|
1005
|
-
children: /* @__PURE__ */
|
|
1115
|
+
className: dropdown_menu_module_default.chevron,
|
|
1116
|
+
children: /* @__PURE__ */ jsx("path", {
|
|
1006
1117
|
d: "M6 3.5 10.5 8 6 12.5",
|
|
1007
1118
|
fill: "none",
|
|
1008
1119
|
stroke: "currentColor",
|
|
@@ -1013,114 +1124,146 @@ function Ce({ className: e, inset: t, children: n, ...r }) {
|
|
|
1013
1124
|
})]
|
|
1014
1125
|
});
|
|
1015
1126
|
}
|
|
1016
|
-
function
|
|
1017
|
-
return /* @__PURE__ */
|
|
1018
|
-
className:
|
|
1019
|
-
...
|
|
1127
|
+
function DropdownMenuSubContent({ className, ...props }) {
|
|
1128
|
+
return /* @__PURE__ */ jsx(DropdownMenuPrimitive.SubContent, {
|
|
1129
|
+
className: cx(dropdown_menu_module_default.content, className),
|
|
1130
|
+
...props
|
|
1020
1131
|
});
|
|
1021
1132
|
}
|
|
1022
1133
|
//#endregion
|
|
1023
1134
|
//#region src/theme/constants.ts
|
|
1024
|
-
var
|
|
1135
|
+
var UZI_THEMES = [
|
|
1025
1136
|
"light",
|
|
1026
1137
|
"dark",
|
|
1027
1138
|
"system"
|
|
1028
|
-
]
|
|
1139
|
+
];
|
|
1140
|
+
var UZI_ACCENTS = [
|
|
1029
1141
|
"blue",
|
|
1030
1142
|
"cyan",
|
|
1031
1143
|
"violet",
|
|
1032
1144
|
"emerald",
|
|
1033
1145
|
"amber",
|
|
1034
1146
|
"rose"
|
|
1035
|
-
]
|
|
1036
|
-
|
|
1037
|
-
|
|
1147
|
+
];
|
|
1148
|
+
var THEME_STORAGE_KEY$1 = "uzi-theme";
|
|
1149
|
+
var ACCENT_STORAGE_KEY$1 = "uzi-accent";
|
|
1150
|
+
//#endregion
|
|
1151
|
+
//#region src/theme/ThemeProvider.tsx
|
|
1152
|
+
var THEME_STORAGE_KEY = THEME_STORAGE_KEY$1;
|
|
1153
|
+
var ACCENT_STORAGE_KEY = ACCENT_STORAGE_KEY$1;
|
|
1154
|
+
var THEME_ATTRIBUTE = "data-uzi-theme";
|
|
1155
|
+
var ACCENT_ATTRIBUTE = "data-uzi-accent";
|
|
1156
|
+
var ThemeContext = createContext(void 0);
|
|
1157
|
+
function isTheme(value) {
|
|
1158
|
+
return UZI_THEMES.includes(value);
|
|
1038
1159
|
}
|
|
1039
|
-
function
|
|
1040
|
-
return
|
|
1160
|
+
function isAccent(value) {
|
|
1161
|
+
return UZI_ACCENTS.includes(value);
|
|
1041
1162
|
}
|
|
1042
|
-
function
|
|
1043
|
-
|
|
1163
|
+
function getSystemTheme() {
|
|
1164
|
+
if (typeof window === "undefined") return "light";
|
|
1165
|
+
return window.matchMedia("(prefers-color-scheme: dark)").matches ? "dark" : "light";
|
|
1044
1166
|
}
|
|
1045
|
-
function
|
|
1046
|
-
|
|
1047
|
-
|
|
1048
|
-
|
|
1049
|
-
|
|
1050
|
-
|
|
1051
|
-
|
|
1052
|
-
|
|
1167
|
+
function ThemeProvider({ children, theme, defaultTheme = "system", accent, defaultAccent = "blue", onThemeChange, onAccentChange, storageKey = THEME_STORAGE_KEY, accentStorageKey = ACCENT_STORAGE_KEY, disableStorage = false, toastConfig }) {
|
|
1168
|
+
const [internalTheme, setInternalTheme] = useState(defaultTheme);
|
|
1169
|
+
const [internalAccent, setInternalAccent] = useState(defaultAccent);
|
|
1170
|
+
const [systemTheme, setSystemTheme] = useState("light");
|
|
1171
|
+
useEffect(() => {
|
|
1172
|
+
setSystemTheme(getSystemTheme());
|
|
1173
|
+
if (!disableStorage) {
|
|
1174
|
+
const storedTheme = window.localStorage.getItem(storageKey);
|
|
1175
|
+
if (isTheme(storedTheme)) setInternalTheme(storedTheme);
|
|
1176
|
+
const storedAccent = window.localStorage.getItem(accentStorageKey);
|
|
1177
|
+
if (isAccent(storedAccent)) setInternalAccent(storedAccent);
|
|
1053
1178
|
}
|
|
1054
1179
|
}, [
|
|
1055
|
-
|
|
1056
|
-
|
|
1057
|
-
|
|
1180
|
+
disableStorage,
|
|
1181
|
+
storageKey,
|
|
1182
|
+
accentStorageKey
|
|
1058
1183
|
]);
|
|
1059
|
-
|
|
1060
|
-
|
|
1061
|
-
|
|
1062
|
-
|
|
1063
|
-
|
|
1064
|
-
|
|
1065
|
-
if (typeof
|
|
1066
|
-
|
|
1067
|
-
|
|
1068
|
-
|
|
1069
|
-
|
|
1070
|
-
|
|
1184
|
+
const isThemeControlled = theme !== void 0;
|
|
1185
|
+
const isAccentControlled = accent !== void 0;
|
|
1186
|
+
const currentTheme = isThemeControlled ? theme : internalTheme;
|
|
1187
|
+
const currentAccent = isAccentControlled ? accent : internalAccent;
|
|
1188
|
+
const resolvedTheme = currentTheme === "system" ? systemTheme : currentTheme;
|
|
1189
|
+
useEffect(() => {
|
|
1190
|
+
if (typeof window === "undefined") return;
|
|
1191
|
+
const mediaQuery = window.matchMedia("(prefers-color-scheme: dark)");
|
|
1192
|
+
const handleChange = () => setSystemTheme(mediaQuery.matches ? "dark" : "light");
|
|
1193
|
+
handleChange();
|
|
1194
|
+
mediaQuery.addEventListener("change", handleChange);
|
|
1195
|
+
return () => mediaQuery.removeEventListener("change", handleChange);
|
|
1196
|
+
}, []);
|
|
1197
|
+
useEffect(() => {
|
|
1198
|
+
if (typeof document === "undefined") return;
|
|
1199
|
+
const root = document.documentElement;
|
|
1200
|
+
root.setAttribute(THEME_ATTRIBUTE, resolvedTheme);
|
|
1201
|
+
root.setAttribute(ACCENT_ATTRIBUTE, currentAccent);
|
|
1202
|
+
root.style.colorScheme = resolvedTheme;
|
|
1203
|
+
root.classList.toggle("dark", resolvedTheme === "dark");
|
|
1204
|
+
}, [currentAccent, resolvedTheme]);
|
|
1205
|
+
const setTheme = useCallback((nextTheme) => {
|
|
1206
|
+
if (!isThemeControlled) setInternalTheme(nextTheme);
|
|
1207
|
+
if (!disableStorage && typeof window !== "undefined") window.localStorage.setItem(storageKey, nextTheme);
|
|
1208
|
+
onThemeChange?.(nextTheme);
|
|
1071
1209
|
}, [
|
|
1072
|
-
|
|
1073
|
-
|
|
1074
|
-
|
|
1075
|
-
|
|
1076
|
-
])
|
|
1077
|
-
|
|
1210
|
+
disableStorage,
|
|
1211
|
+
isThemeControlled,
|
|
1212
|
+
onThemeChange,
|
|
1213
|
+
storageKey
|
|
1214
|
+
]);
|
|
1215
|
+
const setAccent = useCallback((nextAccent) => {
|
|
1216
|
+
if (!isAccentControlled) setInternalAccent(nextAccent);
|
|
1217
|
+
if (!disableStorage && typeof window !== "undefined") window.localStorage.setItem(accentStorageKey, nextAccent);
|
|
1218
|
+
onAccentChange?.(nextAccent);
|
|
1078
1219
|
}, [
|
|
1079
|
-
|
|
1080
|
-
|
|
1081
|
-
|
|
1082
|
-
|
|
1083
|
-
])
|
|
1084
|
-
|
|
1085
|
-
|
|
1086
|
-
|
|
1087
|
-
|
|
1088
|
-
|
|
1089
|
-
|
|
1090
|
-
|
|
1091
|
-
|
|
1220
|
+
accentStorageKey,
|
|
1221
|
+
disableStorage,
|
|
1222
|
+
isAccentControlled,
|
|
1223
|
+
onAccentChange
|
|
1224
|
+
]);
|
|
1225
|
+
const toggleTheme = useCallback(() => {
|
|
1226
|
+
setTheme(resolvedTheme === "dark" ? "light" : "dark");
|
|
1227
|
+
}, [resolvedTheme, setTheme]);
|
|
1228
|
+
const value = useMemo(() => ({
|
|
1229
|
+
theme: currentTheme,
|
|
1230
|
+
resolvedTheme,
|
|
1231
|
+
accent: currentAccent,
|
|
1232
|
+
setTheme,
|
|
1233
|
+
setAccent,
|
|
1234
|
+
toggleTheme
|
|
1092
1235
|
}), [
|
|
1093
|
-
|
|
1094
|
-
|
|
1095
|
-
|
|
1096
|
-
|
|
1097
|
-
|
|
1098
|
-
|
|
1236
|
+
currentAccent,
|
|
1237
|
+
currentTheme,
|
|
1238
|
+
resolvedTheme,
|
|
1239
|
+
setAccent,
|
|
1240
|
+
setTheme,
|
|
1241
|
+
toggleTheme
|
|
1099
1242
|
]);
|
|
1100
|
-
return /* @__PURE__ */
|
|
1101
|
-
value
|
|
1102
|
-
children: /* @__PURE__ */
|
|
1103
|
-
config:
|
|
1104
|
-
children
|
|
1243
|
+
return /* @__PURE__ */ jsx(ThemeContext.Provider, {
|
|
1244
|
+
value,
|
|
1245
|
+
children: /* @__PURE__ */ jsx(ToastProvider, {
|
|
1246
|
+
config: toastConfig,
|
|
1247
|
+
children
|
|
1105
1248
|
})
|
|
1106
1249
|
});
|
|
1107
1250
|
}
|
|
1108
|
-
function
|
|
1109
|
-
|
|
1110
|
-
if (!
|
|
1111
|
-
return
|
|
1251
|
+
function useTheme() {
|
|
1252
|
+
const context = useContext(ThemeContext);
|
|
1253
|
+
if (!context) throw new Error("useTheme must be used within a ThemeProvider");
|
|
1254
|
+
return context;
|
|
1112
1255
|
}
|
|
1113
|
-
var
|
|
1256
|
+
var theme_toggle_button_module_default = { withLabel: "uzi-theme-toggle-button-module__withLabel__KqtDj" };
|
|
1114
1257
|
//#endregion
|
|
1115
1258
|
//#region src/components/theme-toggle-button/ThemeToggleButton.tsx
|
|
1116
|
-
function
|
|
1117
|
-
return /* @__PURE__ */
|
|
1259
|
+
function MoonIcon() {
|
|
1260
|
+
return /* @__PURE__ */ jsx("svg", {
|
|
1118
1261
|
viewBox: "0 0 24 24",
|
|
1119
1262
|
"aria-hidden": "true",
|
|
1120
1263
|
width: "16",
|
|
1121
1264
|
height: "16",
|
|
1122
1265
|
fill: "none",
|
|
1123
|
-
children: /* @__PURE__ */
|
|
1266
|
+
children: /* @__PURE__ */ jsx("path", {
|
|
1124
1267
|
d: "M20 15.2A8.5 8.5 0 0 1 8.8 4 9 9 0 1 0 20 15.2Z",
|
|
1125
1268
|
stroke: "currentColor",
|
|
1126
1269
|
strokeWidth: "1.8",
|
|
@@ -1129,20 +1272,20 @@ function Be() {
|
|
|
1129
1272
|
})
|
|
1130
1273
|
});
|
|
1131
1274
|
}
|
|
1132
|
-
function
|
|
1133
|
-
return /* @__PURE__ */
|
|
1275
|
+
function SunIcon() {
|
|
1276
|
+
return /* @__PURE__ */ jsxs("svg", {
|
|
1134
1277
|
viewBox: "0 0 24 24",
|
|
1135
1278
|
"aria-hidden": "true",
|
|
1136
1279
|
width: "16",
|
|
1137
1280
|
height: "16",
|
|
1138
1281
|
fill: "none",
|
|
1139
|
-
children: [/* @__PURE__ */
|
|
1282
|
+
children: [/* @__PURE__ */ jsx("circle", {
|
|
1140
1283
|
cx: "12",
|
|
1141
1284
|
cy: "12",
|
|
1142
1285
|
r: "4",
|
|
1143
1286
|
stroke: "currentColor",
|
|
1144
1287
|
strokeWidth: "1.8"
|
|
1145
|
-
}), /* @__PURE__ */
|
|
1288
|
+
}), /* @__PURE__ */ jsx("path", {
|
|
1146
1289
|
d: "M12 2.75v2.5M12 18.75v2.5M21.25 12h-2.5M5.25 12h-2.5M18.54 5.46l-1.77 1.77M7.23 16.77l-1.77 1.77M18.54 18.54l-1.77-1.77M7.23 7.23 5.46 5.46",
|
|
1147
1290
|
stroke: "currentColor",
|
|
1148
1291
|
strokeWidth: "1.8",
|
|
@@ -1150,23 +1293,25 @@ function Ve() {
|
|
|
1150
1293
|
})]
|
|
1151
1294
|
});
|
|
1152
1295
|
}
|
|
1153
|
-
function
|
|
1154
|
-
|
|
1155
|
-
|
|
1296
|
+
function ThemeToggleButton({ showLabel = false, lightLabel = "Light mode", darkLabel = "Dark mode", className, onClick, ...rest }) {
|
|
1297
|
+
const { resolvedTheme, toggleTheme } = useTheme();
|
|
1298
|
+
const nextThemeLabel = resolvedTheme === "dark" ? lightLabel : darkLabel;
|
|
1299
|
+
return /* @__PURE__ */ jsxs(Button, {
|
|
1156
1300
|
type: "button",
|
|
1157
1301
|
variant: "ghost",
|
|
1158
|
-
size:
|
|
1159
|
-
className:
|
|
1160
|
-
"aria-label": `Switch to ${
|
|
1161
|
-
title: `Switch to ${
|
|
1162
|
-
onClick: (
|
|
1163
|
-
|
|
1302
|
+
size: showLabel ? "sm" : "icon",
|
|
1303
|
+
className: cx(showLabel && theme_toggle_button_module_default.withLabel, className),
|
|
1304
|
+
"aria-label": `Switch to ${nextThemeLabel.toLowerCase()}`,
|
|
1305
|
+
title: `Switch to ${nextThemeLabel.toLowerCase()}`,
|
|
1306
|
+
onClick: (event) => {
|
|
1307
|
+
onClick?.(event);
|
|
1308
|
+
if (!event.defaultPrevented) toggleTheme();
|
|
1164
1309
|
},
|
|
1165
|
-
...
|
|
1166
|
-
children: [
|
|
1310
|
+
...rest,
|
|
1311
|
+
children: [resolvedTheme === "dark" ? /* @__PURE__ */ jsx(SunIcon, {}) : /* @__PURE__ */ jsx(MoonIcon, {}), showLabel && /* @__PURE__ */ jsx("span", { children: nextThemeLabel })]
|
|
1167
1312
|
});
|
|
1168
1313
|
}
|
|
1169
|
-
var
|
|
1314
|
+
var top_bar_module_default = {
|
|
1170
1315
|
topBar: "uzi-top-bar-module__topBar__MJ-7S",
|
|
1171
1316
|
topBarStatic: "uzi-top-bar-module__topBarStatic__JvEwt",
|
|
1172
1317
|
topBarInner: "uzi-top-bar-module__topBarInner__PBbi8",
|
|
@@ -1179,51 +1324,52 @@ var Y = {
|
|
|
1179
1324
|
};
|
|
1180
1325
|
//#endregion
|
|
1181
1326
|
//#region src/components/top-bar/TopBar.tsx
|
|
1182
|
-
function
|
|
1183
|
-
|
|
1184
|
-
|
|
1185
|
-
|
|
1186
|
-
|
|
1187
|
-
|
|
1188
|
-
|
|
1327
|
+
function TopBar({ leading, brand, brandHref, brandingLocation = "left", start, center, actions, showThemeToggle = false, themeToggleProps, className, innerClassName, isSticky, sticky = true, children, ...rest }) {
|
|
1328
|
+
const shouldStick = isSticky ?? sticky;
|
|
1329
|
+
const brandNode = !brand ? null : brandHref ? /* @__PURE__ */ jsx("a", {
|
|
1330
|
+
href: brandHref,
|
|
1331
|
+
className: top_bar_module_default.topBarBrand,
|
|
1332
|
+
children: /* @__PURE__ */ jsx("span", {
|
|
1333
|
+
className: top_bar_module_default.topBarBrandContent,
|
|
1334
|
+
children: brand
|
|
1189
1335
|
})
|
|
1190
|
-
}) : /* @__PURE__ */
|
|
1191
|
-
className:
|
|
1192
|
-
children: /* @__PURE__ */
|
|
1193
|
-
className:
|
|
1194
|
-
children:
|
|
1336
|
+
}) : /* @__PURE__ */ jsx("div", {
|
|
1337
|
+
className: top_bar_module_default.topBarBrand,
|
|
1338
|
+
children: /* @__PURE__ */ jsx("span", {
|
|
1339
|
+
className: top_bar_module_default.topBarBrandContent,
|
|
1340
|
+
children: brand
|
|
1195
1341
|
})
|
|
1196
|
-
})
|
|
1197
|
-
return /* @__PURE__ */
|
|
1198
|
-
className:
|
|
1199
|
-
...
|
|
1200
|
-
children: /* @__PURE__ */
|
|
1201
|
-
className:
|
|
1342
|
+
});
|
|
1343
|
+
return /* @__PURE__ */ jsx("header", {
|
|
1344
|
+
className: cx(top_bar_module_default.topBar, !shouldStick && top_bar_module_default.topBarStatic, className),
|
|
1345
|
+
...rest,
|
|
1346
|
+
children: /* @__PURE__ */ jsxs("div", {
|
|
1347
|
+
className: cx(top_bar_module_default.topBarInner, innerClassName),
|
|
1202
1348
|
children: [
|
|
1203
|
-
/* @__PURE__ */
|
|
1204
|
-
className:
|
|
1349
|
+
/* @__PURE__ */ jsxs("div", {
|
|
1350
|
+
className: top_bar_module_default.topBarStart,
|
|
1205
1351
|
children: [
|
|
1206
|
-
|
|
1207
|
-
|
|
1208
|
-
|
|
1352
|
+
leading,
|
|
1353
|
+
brandingLocation === "left" && brandNode,
|
|
1354
|
+
start
|
|
1209
1355
|
]
|
|
1210
1356
|
}),
|
|
1211
|
-
|
|
1212
|
-
className:
|
|
1213
|
-
children: /* @__PURE__ */
|
|
1214
|
-
className:
|
|
1215
|
-
children: [
|
|
1357
|
+
brandNode && brandingLocation === "center" || center || children ? /* @__PURE__ */ jsx("div", {
|
|
1358
|
+
className: top_bar_module_default.topBarCenter,
|
|
1359
|
+
children: /* @__PURE__ */ jsxs("div", {
|
|
1360
|
+
className: top_bar_module_default.topBarCenterGroup,
|
|
1361
|
+
children: [brandingLocation === "center" && brandNode, center ?? children]
|
|
1216
1362
|
})
|
|
1217
1363
|
}) : null,
|
|
1218
|
-
/* @__PURE__ */
|
|
1219
|
-
className:
|
|
1220
|
-
children: [
|
|
1364
|
+
/* @__PURE__ */ jsxs("div", {
|
|
1365
|
+
className: top_bar_module_default.topBarActions,
|
|
1366
|
+
children: [showThemeToggle && /* @__PURE__ */ jsx(ThemeToggleButton, { ...themeToggleProps }), actions]
|
|
1221
1367
|
})
|
|
1222
1368
|
]
|
|
1223
1369
|
})
|
|
1224
1370
|
});
|
|
1225
1371
|
}
|
|
1226
|
-
var
|
|
1372
|
+
var app_shell_module_default = {
|
|
1227
1373
|
appShell: "uzi-app-shell-module__appShell__S0cVI",
|
|
1228
1374
|
appShellAnimated: "uzi-app-shell-module__appShellAnimated__-CRIl",
|
|
1229
1375
|
appShellOpen: "uzi-app-shell-module__appShellOpen__1rZUl",
|
|
@@ -1238,62 +1384,112 @@ var X = {
|
|
|
1238
1384
|
appShellMain: "uzi-app-shell-module__appShellMain__eHP2r",
|
|
1239
1385
|
appShellBackdrop: "uzi-app-shell-module__appShellBackdrop__y31xs",
|
|
1240
1386
|
appShellSidebarOpen: "uzi-app-shell-module__appShellSidebarOpen__Z5AIo"
|
|
1241
|
-
}
|
|
1242
|
-
|
|
1243
|
-
|
|
1387
|
+
};
|
|
1388
|
+
//#endregion
|
|
1389
|
+
//#region src/components/app-shell/AppShell.tsx
|
|
1390
|
+
var DESKTOP_BREAKPOINT = 960;
|
|
1391
|
+
function getIsDesktop() {
|
|
1392
|
+
if (typeof window === "undefined") return false;
|
|
1393
|
+
return window.innerWidth >= DESKTOP_BREAKPOINT;
|
|
1244
1394
|
}
|
|
1245
|
-
|
|
1246
|
-
|
|
1247
|
-
|
|
1248
|
-
|
|
1249
|
-
|
|
1250
|
-
|
|
1251
|
-
|
|
1252
|
-
|
|
1253
|
-
|
|
1254
|
-
|
|
1395
|
+
/**
|
|
1396
|
+
* Responsive application shell with a collapsible sidebar and sticky top bar.
|
|
1397
|
+
*
|
|
1398
|
+
* - Sidebar opens by default on desktop, collapses on mobile.
|
|
1399
|
+
* - Closes on outside click/scroll/touch when in mobile mode.
|
|
1400
|
+
* - Provides optional hook to close the sidebar when a prop value changes
|
|
1401
|
+
* (e.g., route transitions).
|
|
1402
|
+
*/
|
|
1403
|
+
function AppShell({ children, sidebar, brand, brandHref, topbarStart, topbarEnd, showThemeToggle = false, themeToggleProps, topBarBrandingLocation = "left", className, sidebarClassName, topbarClassName, mainClassName, sidebarWidth, closeSidebarOnChangeKey, hamburgerLabel = "Toggle navigation", onSidebarToggle }) {
|
|
1404
|
+
const [isDesktop, setIsDesktop] = useState(false);
|
|
1405
|
+
const [sidebarOpen, setSidebarOpen] = useState(false);
|
|
1406
|
+
const [transitionsReady, setTransitionsReady] = useState(false);
|
|
1407
|
+
const prevIsDesktopRef = useRef(false);
|
|
1408
|
+
const closeKeyRef = useRef(closeSidebarOnChangeKey);
|
|
1409
|
+
const sidebarRef = useRef(null);
|
|
1410
|
+
const hamburgerRef = useRef(null);
|
|
1411
|
+
const mainRef = useRef(null);
|
|
1412
|
+
const sidebarId = useId();
|
|
1413
|
+
useEffect(() => {
|
|
1414
|
+
const desktop = getIsDesktop();
|
|
1415
|
+
setIsDesktop(desktop);
|
|
1416
|
+
setSidebarOpen(desktop);
|
|
1417
|
+
prevIsDesktopRef.current = desktop;
|
|
1418
|
+
const transitionFrame = window.requestAnimationFrame(() => {
|
|
1419
|
+
setTransitionsReady(true);
|
|
1420
|
+
});
|
|
1421
|
+
const handleResize = () => {
|
|
1422
|
+
const nowDesktop = getIsDesktop();
|
|
1423
|
+
setIsDesktop(nowDesktop);
|
|
1424
|
+
if (nowDesktop !== prevIsDesktopRef.current) {
|
|
1425
|
+
setSidebarOpen(nowDesktop);
|
|
1426
|
+
prevIsDesktopRef.current = nowDesktop;
|
|
1427
|
+
}
|
|
1255
1428
|
};
|
|
1256
|
-
|
|
1257
|
-
|
|
1429
|
+
window.addEventListener("resize", handleResize);
|
|
1430
|
+
return () => {
|
|
1431
|
+
window.cancelAnimationFrame(transitionFrame);
|
|
1432
|
+
window.removeEventListener("resize", handleResize);
|
|
1433
|
+
};
|
|
1434
|
+
}, []);
|
|
1435
|
+
useEffect(() => {
|
|
1436
|
+
if (isDesktop || !sidebarOpen) return;
|
|
1437
|
+
const mainElement = mainRef.current;
|
|
1438
|
+
const closeSidebar = () => setSidebarOpen(false);
|
|
1439
|
+
const onPointerDown = (e) => {
|
|
1440
|
+
const target = e.target;
|
|
1441
|
+
if (!target) return;
|
|
1442
|
+
if (sidebarRef.current?.contains(target)) return;
|
|
1443
|
+
if (hamburgerRef.current?.contains(target)) return;
|
|
1444
|
+
closeSidebar();
|
|
1258
1445
|
};
|
|
1259
|
-
|
|
1260
|
-
|
|
1261
|
-
|
|
1262
|
-
|
|
1263
|
-
|
|
1264
|
-
}, r = window.setTimeout(() => {
|
|
1265
|
-
document.addEventListener("pointerdown", n), window.addEventListener("scroll", t, { passive: !0 }), e?.addEventListener("scroll", t, { passive: !0 }), document.addEventListener("touchmove", t, { passive: !0 });
|
|
1446
|
+
const timeoutId = window.setTimeout(() => {
|
|
1447
|
+
document.addEventListener("pointerdown", onPointerDown);
|
|
1448
|
+
window.addEventListener("scroll", closeSidebar, { passive: true });
|
|
1449
|
+
mainElement?.addEventListener("scroll", closeSidebar, { passive: true });
|
|
1450
|
+
document.addEventListener("touchmove", closeSidebar, { passive: true });
|
|
1266
1451
|
}, 10);
|
|
1267
1452
|
return () => {
|
|
1268
|
-
window.clearTimeout(
|
|
1453
|
+
window.clearTimeout(timeoutId);
|
|
1454
|
+
document.removeEventListener("pointerdown", onPointerDown);
|
|
1455
|
+
window.removeEventListener("scroll", closeSidebar);
|
|
1456
|
+
mainElement?.removeEventListener("scroll", closeSidebar);
|
|
1457
|
+
document.removeEventListener("touchmove", closeSidebar);
|
|
1269
1458
|
};
|
|
1270
|
-
}, [
|
|
1271
|
-
|
|
1272
|
-
|
|
1273
|
-
|
|
1274
|
-
}, [
|
|
1275
|
-
|
|
1276
|
-
|
|
1277
|
-
|
|
1278
|
-
|
|
1279
|
-
|
|
1280
|
-
|
|
1281
|
-
|
|
1459
|
+
}, [sidebarOpen, isDesktop]);
|
|
1460
|
+
useEffect(() => {
|
|
1461
|
+
if (!isDesktop && closeKeyRef.current !== closeSidebarOnChangeKey) setSidebarOpen(false);
|
|
1462
|
+
closeKeyRef.current = closeSidebarOnChangeKey;
|
|
1463
|
+
}, [closeSidebarOnChangeKey, isDesktop]);
|
|
1464
|
+
useEffect(() => {
|
|
1465
|
+
onSidebarToggle?.(sidebarOpen);
|
|
1466
|
+
}, [sidebarOpen, onSidebarToggle]);
|
|
1467
|
+
const toggleSidebar = () => setSidebarOpen((open) => !open);
|
|
1468
|
+
const sidebarWidthValue = sidebarWidth === void 0 ? void 0 : typeof sidebarWidth === "number" ? `${sidebarWidth}px` : sidebarWidth;
|
|
1469
|
+
const shellStyle = sidebarWidthValue ? { ["--app-shell-sidebar-width"]: sidebarWidthValue } : void 0;
|
|
1470
|
+
const shellClasses = cx(app_shell_module_default.appShell, transitionsReady && app_shell_module_default.appShellAnimated, sidebarOpen ? app_shell_module_default.appShellOpen : app_shell_module_default.appShellCollapsed, className);
|
|
1471
|
+
const sidebarClasses = cx(app_shell_module_default.appShellSidebar, sidebarOpen && app_shell_module_default.appShellSidebarOpen, sidebarClassName);
|
|
1472
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
1473
|
+
className: shellClasses,
|
|
1474
|
+
style: shellStyle,
|
|
1475
|
+
"data-app-shell": true,
|
|
1476
|
+
"data-desktop": isDesktop ? "true" : "false",
|
|
1477
|
+
"data-sidebar-open": sidebarOpen ? "true" : "false",
|
|
1282
1478
|
children: [
|
|
1283
|
-
/* @__PURE__ */
|
|
1284
|
-
className:
|
|
1285
|
-
leading: /* @__PURE__ */
|
|
1286
|
-
ref:
|
|
1479
|
+
/* @__PURE__ */ jsx(TopBar, {
|
|
1480
|
+
className: cx(app_shell_module_default.appShellTopbar, topbarClassName),
|
|
1481
|
+
leading: /* @__PURE__ */ jsx("button", {
|
|
1482
|
+
ref: hamburgerRef,
|
|
1287
1483
|
type: "button",
|
|
1288
|
-
className:
|
|
1289
|
-
onClick:
|
|
1290
|
-
"aria-label":
|
|
1291
|
-
"aria-expanded":
|
|
1292
|
-
"aria-controls":
|
|
1293
|
-
children: /* @__PURE__ */
|
|
1484
|
+
className: app_shell_module_default.appShellHamburger,
|
|
1485
|
+
onClick: toggleSidebar,
|
|
1486
|
+
"aria-label": hamburgerLabel,
|
|
1487
|
+
"aria-expanded": sidebarOpen,
|
|
1488
|
+
"aria-controls": sidebarId,
|
|
1489
|
+
children: /* @__PURE__ */ jsx("svg", {
|
|
1294
1490
|
viewBox: "0 0 24 24",
|
|
1295
1491
|
"aria-hidden": "true",
|
|
1296
|
-
children: /* @__PURE__ */
|
|
1492
|
+
children: /* @__PURE__ */ jsx("path", {
|
|
1297
1493
|
d: "M3 6h18M3 12h18M3 18h18",
|
|
1298
1494
|
stroke: "currentColor",
|
|
1299
1495
|
strokeWidth: "2.5",
|
|
@@ -1301,36 +1497,36 @@ function Ke({ children: e, sidebar: t, brand: n, brandHref: r, topbarStart: o, t
|
|
|
1301
1497
|
})
|
|
1302
1498
|
})
|
|
1303
1499
|
}),
|
|
1304
|
-
brand
|
|
1305
|
-
brandHref
|
|
1306
|
-
brandingLocation:
|
|
1307
|
-
start:
|
|
1308
|
-
actions:
|
|
1309
|
-
showThemeToggle
|
|
1310
|
-
themeToggleProps
|
|
1500
|
+
brand,
|
|
1501
|
+
brandHref,
|
|
1502
|
+
brandingLocation: topBarBrandingLocation,
|
|
1503
|
+
start: topbarStart,
|
|
1504
|
+
actions: topbarEnd,
|
|
1505
|
+
showThemeToggle,
|
|
1506
|
+
themeToggleProps
|
|
1311
1507
|
}),
|
|
1312
|
-
!
|
|
1313
|
-
className:
|
|
1314
|
-
onClick: () =>
|
|
1315
|
-
onTouchStart: () =>
|
|
1508
|
+
!isDesktop && sidebarOpen && /* @__PURE__ */ jsx("div", {
|
|
1509
|
+
className: app_shell_module_default.appShellBackdrop,
|
|
1510
|
+
onClick: () => setSidebarOpen(false),
|
|
1511
|
+
onTouchStart: () => setSidebarOpen(false),
|
|
1316
1512
|
"aria-hidden": "true"
|
|
1317
1513
|
}),
|
|
1318
|
-
/* @__PURE__ */
|
|
1319
|
-
ref:
|
|
1320
|
-
id:
|
|
1321
|
-
className:
|
|
1514
|
+
/* @__PURE__ */ jsx("aside", {
|
|
1515
|
+
ref: sidebarRef,
|
|
1516
|
+
id: sidebarId,
|
|
1517
|
+
className: sidebarClasses,
|
|
1322
1518
|
"aria-label": "Sidebar navigation",
|
|
1323
|
-
children:
|
|
1519
|
+
children: sidebar
|
|
1324
1520
|
}),
|
|
1325
|
-
/* @__PURE__ */
|
|
1326
|
-
ref:
|
|
1327
|
-
className:
|
|
1328
|
-
children
|
|
1521
|
+
/* @__PURE__ */ jsx("main", {
|
|
1522
|
+
ref: mainRef,
|
|
1523
|
+
className: cx(app_shell_module_default.appShellMain, mainClassName),
|
|
1524
|
+
children
|
|
1329
1525
|
})
|
|
1330
1526
|
]
|
|
1331
1527
|
});
|
|
1332
1528
|
}
|
|
1333
|
-
var
|
|
1529
|
+
var sidebar_nav_module_default = {
|
|
1334
1530
|
sidebarNav: "uzi-sidebar-nav-module__sidebarNav__eUI5c",
|
|
1335
1531
|
sidebarNavCollapsed: "uzi-sidebar-nav-module__sidebarNavCollapsed__xTM9s",
|
|
1336
1532
|
header: "uzi-sidebar-nav-module__header__Y4NLy",
|
|
@@ -1349,124 +1545,173 @@ var Z = {
|
|
|
1349
1545
|
label: "uzi-sidebar-nav-module__label__A-nt6",
|
|
1350
1546
|
description: "uzi-sidebar-nav-module__description__Xf3Si",
|
|
1351
1547
|
badge: "uzi-sidebar-nav-module__badge__-hnFd"
|
|
1352
|
-
}
|
|
1353
|
-
|
|
1354
|
-
|
|
1355
|
-
|
|
1356
|
-
|
|
1357
|
-
|
|
1358
|
-
|
|
1359
|
-
|
|
1360
|
-
|
|
1361
|
-
|
|
1362
|
-
|
|
1363
|
-
|
|
1364
|
-
|
|
1365
|
-
|
|
1366
|
-
|
|
1367
|
-
|
|
1548
|
+
};
|
|
1549
|
+
//#endregion
|
|
1550
|
+
//#region src/components/sidebar-nav/SidebarNav.tsx
|
|
1551
|
+
var isActivePrefix = (item, path) => {
|
|
1552
|
+
if (item.active !== void 0) return item.active;
|
|
1553
|
+
if (!item.href) return false;
|
|
1554
|
+
if (!path) return false;
|
|
1555
|
+
if (item.href === "/") return path === "/";
|
|
1556
|
+
return path.startsWith(item.href);
|
|
1557
|
+
};
|
|
1558
|
+
var isActiveExact = (item, path) => {
|
|
1559
|
+
if (item.active !== void 0) return item.active;
|
|
1560
|
+
if (!item.href) return false;
|
|
1561
|
+
if (!path) return false;
|
|
1562
|
+
if (item.href === "/") return path === "/";
|
|
1563
|
+
const normalizedHref = item.href.endsWith("/") ? item.href.slice(0, -1) : item.href;
|
|
1564
|
+
return normalizedHref === path || path.startsWith(`${normalizedHref}/`);
|
|
1565
|
+
};
|
|
1566
|
+
var isNaturalPrefixMatch = (href, path) => {
|
|
1567
|
+
if (href === "/") return path === "/";
|
|
1568
|
+
return path.startsWith(href);
|
|
1569
|
+
};
|
|
1570
|
+
var isNaturalExactMatch = (href, path) => {
|
|
1571
|
+
if (href === "/") return path === "/";
|
|
1572
|
+
return (href.endsWith("/") ? href.slice(0, -1) : href) === path;
|
|
1573
|
+
};
|
|
1574
|
+
var hrefLength = (href) => href.endsWith("/") ? href.length - 1 : href.length;
|
|
1575
|
+
var findMostSpecific = (items, currentPath) => {
|
|
1576
|
+
const result = /* @__PURE__ */ new Set();
|
|
1577
|
+
if (!currentPath) return result;
|
|
1578
|
+
const matchingItems = items.filter((item) => {
|
|
1579
|
+
if (item.disabled || !item.href) return false;
|
|
1580
|
+
return item.exact ? isNaturalExactMatch(item.href, currentPath) : isNaturalPrefixMatch(item.href, currentPath);
|
|
1581
|
+
});
|
|
1582
|
+
if (matchingItems.length === 0) return result;
|
|
1583
|
+
let maxLen = 0;
|
|
1584
|
+
for (const item of matchingItems) {
|
|
1585
|
+
if (!item.href) continue;
|
|
1586
|
+
const len = hrefLength(item.href);
|
|
1587
|
+
if (len > maxLen) maxLen = len;
|
|
1588
|
+
}
|
|
1589
|
+
for (const item of matchingItems) {
|
|
1590
|
+
if (!item.href) continue;
|
|
1591
|
+
if (hrefLength(item.href) === maxLen) result.add(item.href);
|
|
1368
1592
|
}
|
|
1369
|
-
|
|
1370
|
-
return n;
|
|
1593
|
+
return result;
|
|
1371
1594
|
};
|
|
1372
|
-
function
|
|
1373
|
-
|
|
1374
|
-
|
|
1375
|
-
|
|
1376
|
-
|
|
1377
|
-
|
|
1378
|
-
|
|
1379
|
-
|
|
1380
|
-
|
|
1595
|
+
function SidebarNav({ items = [], sections, currentPath, getIsActive, matchStrategy = "prefix", onItemClick, header, footer, ariaLabel = "Sidebar navigation", collapsed = false, iconSize, className, itemClassName, sectionClassName }) {
|
|
1596
|
+
const resolvedSections = useMemo(() => {
|
|
1597
|
+
return sections?.length ? sections : [{
|
|
1598
|
+
id: "default",
|
|
1599
|
+
items
|
|
1600
|
+
}];
|
|
1601
|
+
}, [sections, items]);
|
|
1602
|
+
const allItems = useMemo(() => resolvedSections.flatMap((section) => section.items), [resolvedSections]);
|
|
1603
|
+
const defaultIsActiveFn = useMemo(() => {
|
|
1604
|
+
if (matchStrategy === "most-specific") {
|
|
1605
|
+
const mostSpecificHrefs = findMostSpecific(allItems, currentPath);
|
|
1606
|
+
return (item) => {
|
|
1607
|
+
if (item.active !== void 0) return item.active;
|
|
1608
|
+
if (!item.href) return false;
|
|
1609
|
+
return mostSpecificHrefs.has(item.href);
|
|
1610
|
+
};
|
|
1611
|
+
} else return (item, path) => {
|
|
1612
|
+
if (item.active !== void 0) return item.active;
|
|
1613
|
+
if (item.exact) return isActiveExact(item, path);
|
|
1614
|
+
return isActivePrefix(item, path);
|
|
1615
|
+
};
|
|
1381
1616
|
}, [
|
|
1382
|
-
|
|
1383
|
-
|
|
1384
|
-
|
|
1385
|
-
])
|
|
1386
|
-
|
|
1387
|
-
|
|
1388
|
-
|
|
1389
|
-
|
|
1617
|
+
matchStrategy,
|
|
1618
|
+
allItems,
|
|
1619
|
+
currentPath
|
|
1620
|
+
]);
|
|
1621
|
+
const resolvedGetIsActive = getIsActive ?? defaultIsActiveFn;
|
|
1622
|
+
const style = iconSize !== void 0 ? { ["--sidebar-nav-icon-size"]: typeof iconSize === "number" ? `${iconSize}px` : iconSize } : void 0;
|
|
1623
|
+
return /* @__PURE__ */ jsxs("nav", {
|
|
1624
|
+
className: cx(sidebar_nav_module_default.sidebarNav, collapsed && sidebar_nav_module_default.sidebarNavCollapsed, className),
|
|
1625
|
+
"aria-label": ariaLabel,
|
|
1626
|
+
style,
|
|
1390
1627
|
children: [
|
|
1391
|
-
|
|
1392
|
-
className:
|
|
1393
|
-
children:
|
|
1628
|
+
header ? /* @__PURE__ */ jsx("div", {
|
|
1629
|
+
className: sidebar_nav_module_default.header,
|
|
1630
|
+
children: header
|
|
1394
1631
|
}) : null,
|
|
1395
|
-
/* @__PURE__ */
|
|
1396
|
-
className:
|
|
1397
|
-
children:
|
|
1398
|
-
className:
|
|
1399
|
-
children: [
|
|
1400
|
-
className:
|
|
1401
|
-
children:
|
|
1402
|
-
}) : null, /* @__PURE__ */
|
|
1403
|
-
className:
|
|
1404
|
-
children:
|
|
1405
|
-
item
|
|
1406
|
-
active:
|
|
1407
|
-
collapsed
|
|
1408
|
-
itemClassName
|
|
1409
|
-
onItemClick
|
|
1410
|
-
}, `${
|
|
1632
|
+
/* @__PURE__ */ jsx("div", {
|
|
1633
|
+
className: sidebar_nav_module_default.sections,
|
|
1634
|
+
children: resolvedSections.map((section, sectionIndex) => /* @__PURE__ */ jsxs("div", {
|
|
1635
|
+
className: cx(sidebar_nav_module_default.section, sectionClassName),
|
|
1636
|
+
children: [section.label && !collapsed ? /* @__PURE__ */ jsx("div", {
|
|
1637
|
+
className: sidebar_nav_module_default.sectionLabel,
|
|
1638
|
+
children: section.label
|
|
1639
|
+
}) : null, /* @__PURE__ */ jsx("div", {
|
|
1640
|
+
className: sidebar_nav_module_default.sectionItems,
|
|
1641
|
+
children: section.items.map((item, itemIndex) => /* @__PURE__ */ jsx(SidebarNavEntry, {
|
|
1642
|
+
item,
|
|
1643
|
+
active: resolvedGetIsActive(item, currentPath),
|
|
1644
|
+
collapsed,
|
|
1645
|
+
itemClassName,
|
|
1646
|
+
onItemClick
|
|
1647
|
+
}, `${section.id ?? sectionIndex}-${item.href ?? item.title ?? itemIndex}`))
|
|
1411
1648
|
})]
|
|
1412
|
-
},
|
|
1649
|
+
}, section.id ?? `section-${sectionIndex}`))
|
|
1413
1650
|
}),
|
|
1414
|
-
|
|
1415
|
-
className:
|
|
1416
|
-
children:
|
|
1651
|
+
footer ? /* @__PURE__ */ jsx("div", {
|
|
1652
|
+
className: sidebar_nav_module_default.footer,
|
|
1653
|
+
children: footer
|
|
1417
1654
|
}) : null
|
|
1418
1655
|
]
|
|
1419
1656
|
});
|
|
1420
1657
|
}
|
|
1421
|
-
function
|
|
1422
|
-
|
|
1423
|
-
|
|
1424
|
-
|
|
1425
|
-
|
|
1426
|
-
className:
|
|
1427
|
-
children:
|
|
1428
|
-
|
|
1429
|
-
|
|
1430
|
-
|
|
1431
|
-
|
|
1432
|
-
|
|
1433
|
-
className:
|
|
1434
|
-
children:
|
|
1658
|
+
function SidebarNavEntry({ item, active, collapsed, itemClassName, onItemClick }) {
|
|
1659
|
+
const rel = item.rel ?? (item.target === "_blank" ? "noreferrer" : void 0);
|
|
1660
|
+
const title = item.title ?? (typeof item.label === "string" ? item.label : void 0);
|
|
1661
|
+
const classes = cx(sidebar_nav_module_default.item, active && sidebar_nav_module_default.itemActive, collapsed && sidebar_nav_module_default.itemCollapsed, item.disabled && sidebar_nav_module_default.itemDisabled, itemClassName);
|
|
1662
|
+
const content = /* @__PURE__ */ jsxs(Fragment, { children: [item.icon && /* @__PURE__ */ jsx("span", {
|
|
1663
|
+
className: sidebar_nav_module_default.icon,
|
|
1664
|
+
children: item.icon
|
|
1665
|
+
}), !collapsed ? /* @__PURE__ */ jsxs("span", {
|
|
1666
|
+
className: sidebar_nav_module_default.itemBody,
|
|
1667
|
+
children: [/* @__PURE__ */ jsxs("span", {
|
|
1668
|
+
className: sidebar_nav_module_default.labelRow,
|
|
1669
|
+
children: [/* @__PURE__ */ jsx("span", {
|
|
1670
|
+
className: sidebar_nav_module_default.label,
|
|
1671
|
+
children: item.label
|
|
1672
|
+
}), item.badge && /* @__PURE__ */ jsx("span", {
|
|
1673
|
+
className: sidebar_nav_module_default.badge,
|
|
1674
|
+
children: item.badge
|
|
1435
1675
|
})]
|
|
1436
|
-
}),
|
|
1437
|
-
className:
|
|
1438
|
-
children:
|
|
1676
|
+
}), item.description ? /* @__PURE__ */ jsx("span", {
|
|
1677
|
+
className: sidebar_nav_module_default.description,
|
|
1678
|
+
children: item.description
|
|
1439
1679
|
}) : null]
|
|
1440
|
-
})] })
|
|
1441
|
-
|
|
1680
|
+
}) : null] });
|
|
1681
|
+
const handleClick = () => {
|
|
1682
|
+
if (item.disabled) return;
|
|
1683
|
+
item.onClick?.();
|
|
1684
|
+
onItemClick?.(item);
|
|
1442
1685
|
};
|
|
1443
|
-
|
|
1444
|
-
className: s,
|
|
1445
|
-
"aria-current": t ? "page" : void 0,
|
|
1446
|
-
"aria-disabled": "true",
|
|
1447
|
-
title: n ? o : void 0,
|
|
1448
|
-
children: c
|
|
1449
|
-
}) : /* @__PURE__ */ d("a", {
|
|
1450
|
-
className: s,
|
|
1451
|
-
href: e.href,
|
|
1452
|
-
target: e.target,
|
|
1453
|
-
rel: a,
|
|
1454
|
-
"aria-current": t ? "page" : void 0,
|
|
1455
|
-
title: n ? o : void 0,
|
|
1456
|
-
onClick: l,
|
|
1457
|
-
children: c
|
|
1458
|
-
}) : /* @__PURE__ */ d("button", {
|
|
1686
|
+
if (!item.href) return /* @__PURE__ */ jsx("button", {
|
|
1459
1687
|
type: "button",
|
|
1460
|
-
className:
|
|
1461
|
-
"aria-current":
|
|
1462
|
-
"aria-disabled":
|
|
1463
|
-
disabled:
|
|
1464
|
-
title:
|
|
1465
|
-
onClick:
|
|
1466
|
-
children:
|
|
1688
|
+
className: classes,
|
|
1689
|
+
"aria-current": active ? "page" : void 0,
|
|
1690
|
+
"aria-disabled": item.disabled ? "true" : void 0,
|
|
1691
|
+
disabled: item.disabled,
|
|
1692
|
+
title: collapsed ? title : void 0,
|
|
1693
|
+
onClick: handleClick,
|
|
1694
|
+
children: content
|
|
1695
|
+
});
|
|
1696
|
+
if (item.disabled) return /* @__PURE__ */ jsx("div", {
|
|
1697
|
+
className: classes,
|
|
1698
|
+
"aria-current": active ? "page" : void 0,
|
|
1699
|
+
"aria-disabled": "true",
|
|
1700
|
+
title: collapsed ? title : void 0,
|
|
1701
|
+
children: content
|
|
1702
|
+
});
|
|
1703
|
+
return /* @__PURE__ */ jsx("a", {
|
|
1704
|
+
className: classes,
|
|
1705
|
+
href: item.href,
|
|
1706
|
+
target: item.target,
|
|
1707
|
+
rel,
|
|
1708
|
+
"aria-current": active ? "page" : void 0,
|
|
1709
|
+
title: collapsed ? title : void 0,
|
|
1710
|
+
onClick: handleClick,
|
|
1711
|
+
children: content
|
|
1467
1712
|
});
|
|
1468
1713
|
}
|
|
1469
|
-
var
|
|
1714
|
+
var skeleton_module_default = {
|
|
1470
1715
|
skeleton: "uzi-skeleton-module__skeleton__fula5",
|
|
1471
1716
|
"skeleton-pulse": "uzi-skeleton-module__skeleton-pulse__Yp45W",
|
|
1472
1717
|
"radius-sm": "uzi-skeleton-module__radius-sm__FdccD",
|
|
@@ -1476,19 +1721,19 @@ var tt = {
|
|
|
1476
1721
|
};
|
|
1477
1722
|
//#endregion
|
|
1478
1723
|
//#region src/components/skeleton/Skeleton.tsx
|
|
1479
|
-
function
|
|
1480
|
-
return /* @__PURE__ */
|
|
1481
|
-
className:
|
|
1724
|
+
function Skeleton({ width, height, radius = "md", className, style, ...rest }) {
|
|
1725
|
+
return /* @__PURE__ */ jsx("div", {
|
|
1726
|
+
className: cx(skeleton_module_default.skeleton, skeleton_module_default[`radius-${radius}`], className),
|
|
1482
1727
|
style: {
|
|
1483
|
-
width
|
|
1484
|
-
height
|
|
1485
|
-
...
|
|
1728
|
+
width,
|
|
1729
|
+
height,
|
|
1730
|
+
...style
|
|
1486
1731
|
},
|
|
1487
1732
|
"aria-hidden": "true",
|
|
1488
|
-
...
|
|
1733
|
+
...rest
|
|
1489
1734
|
});
|
|
1490
1735
|
}
|
|
1491
|
-
var
|
|
1736
|
+
var progress_module_default = {
|
|
1492
1737
|
track: "uzi-progress-module__track__gM0oV",
|
|
1493
1738
|
fill: "uzi-progress-module__fill__aLAbp",
|
|
1494
1739
|
"tone-default": "uzi-progress-module__tone-default__fhf7o",
|
|
@@ -1498,97 +1743,116 @@ var Q = {
|
|
|
1498
1743
|
};
|
|
1499
1744
|
//#endregion
|
|
1500
1745
|
//#region src/components/progress/Progress.tsx
|
|
1501
|
-
function
|
|
1502
|
-
|
|
1503
|
-
return /* @__PURE__ */
|
|
1504
|
-
className:
|
|
1746
|
+
function Progress({ value, tone = "default", className, "aria-label": ariaLabel, ...rest }) {
|
|
1747
|
+
const clamped = Math.max(0, Math.min(100, value));
|
|
1748
|
+
return /* @__PURE__ */ jsx("div", {
|
|
1749
|
+
className: cx(progress_module_default.track, className),
|
|
1505
1750
|
role: "progressbar",
|
|
1506
|
-
"aria-valuenow":
|
|
1751
|
+
"aria-valuenow": clamped,
|
|
1507
1752
|
"aria-valuemin": 0,
|
|
1508
1753
|
"aria-valuemax": 100,
|
|
1509
|
-
"aria-label":
|
|
1510
|
-
...
|
|
1511
|
-
children: /* @__PURE__ */
|
|
1512
|
-
className:
|
|
1513
|
-
style: { width: `${
|
|
1754
|
+
"aria-label": ariaLabel,
|
|
1755
|
+
...rest,
|
|
1756
|
+
children: /* @__PURE__ */ jsx("div", {
|
|
1757
|
+
className: cx(progress_module_default.fill, progress_module_default[`tone-${tone}`]),
|
|
1758
|
+
style: { width: `${clamped}%` }
|
|
1514
1759
|
})
|
|
1515
1760
|
});
|
|
1516
1761
|
}
|
|
1517
|
-
var
|
|
1762
|
+
var segmented_toggle_module_default = {
|
|
1518
1763
|
track: "uzi-segmented-toggle-module__track__M4fjm",
|
|
1519
1764
|
option: "uzi-segmented-toggle-module__option__7cEZJ",
|
|
1520
1765
|
label: "uzi-segmented-toggle-module__label__bDAIv"
|
|
1521
1766
|
};
|
|
1522
1767
|
//#endregion
|
|
1523
1768
|
//#region src/components/segmented-toggle/SegmentedToggle.tsx
|
|
1524
|
-
function
|
|
1525
|
-
|
|
1526
|
-
|
|
1527
|
-
|
|
1769
|
+
function SegmentedToggle({ options, value, onChange, "aria-label": ariaLabel, "aria-labelledby": ariaLabelledBy, className }) {
|
|
1770
|
+
const itemRefs = React.useRef([]);
|
|
1771
|
+
const selectedIndex = options.findIndex((opt) => opt.value === value);
|
|
1772
|
+
const fallbackIndex = options.findIndex((opt) => !opt.disabled);
|
|
1773
|
+
let lastEnabledIndex = -1;
|
|
1774
|
+
for (let index = options.length - 1; index >= 0; index -= 1) if (!options[index]?.disabled) {
|
|
1775
|
+
lastEnabledIndex = index;
|
|
1528
1776
|
break;
|
|
1529
1777
|
}
|
|
1530
|
-
|
|
1531
|
-
|
|
1532
|
-
|
|
1533
|
-
|
|
1534
|
-
|
|
1535
|
-
|
|
1536
|
-
|
|
1537
|
-
|
|
1538
|
-
|
|
1539
|
-
|
|
1540
|
-
|
|
1541
|
-
|
|
1778
|
+
const tabbableIndex = selectedIndex >= 0 && !options[selectedIndex]?.disabled ? selectedIndex : fallbackIndex;
|
|
1779
|
+
const focusItem = (index) => {
|
|
1780
|
+
itemRefs.current[index]?.focus();
|
|
1781
|
+
};
|
|
1782
|
+
const findEnabledIndex = (startIndex, direction) => {
|
|
1783
|
+
if (options.length === 0) return -1;
|
|
1784
|
+
let nextIndex = startIndex;
|
|
1785
|
+
for (let i = 0; i < options.length; i += 1) {
|
|
1786
|
+
nextIndex = (nextIndex + direction + options.length) % options.length;
|
|
1787
|
+
if (!options[nextIndex]?.disabled) return nextIndex;
|
|
1788
|
+
}
|
|
1789
|
+
return startIndex;
|
|
1790
|
+
};
|
|
1791
|
+
const selectIndex = (index) => {
|
|
1792
|
+
const nextOption = options[index];
|
|
1793
|
+
if (!nextOption || nextOption.disabled || nextOption.value === value) return;
|
|
1794
|
+
onChange(nextOption.value);
|
|
1795
|
+
};
|
|
1796
|
+
const handleKeyDown = (event, index) => {
|
|
1797
|
+
switch (event.key) {
|
|
1542
1798
|
case "ArrowRight":
|
|
1543
1799
|
case "ArrowDown": {
|
|
1544
|
-
|
|
1545
|
-
|
|
1546
|
-
|
|
1800
|
+
event.preventDefault();
|
|
1801
|
+
const nextIndex = findEnabledIndex(index, 1);
|
|
1802
|
+
focusItem(nextIndex);
|
|
1803
|
+
selectIndex(nextIndex);
|
|
1547
1804
|
break;
|
|
1548
1805
|
}
|
|
1549
1806
|
case "ArrowLeft":
|
|
1550
1807
|
case "ArrowUp": {
|
|
1551
|
-
|
|
1552
|
-
|
|
1553
|
-
|
|
1808
|
+
event.preventDefault();
|
|
1809
|
+
const nextIndex = findEnabledIndex(index, -1);
|
|
1810
|
+
focusItem(nextIndex);
|
|
1811
|
+
selectIndex(nextIndex);
|
|
1554
1812
|
break;
|
|
1555
1813
|
}
|
|
1556
1814
|
case "Home":
|
|
1557
|
-
|
|
1815
|
+
event.preventDefault();
|
|
1816
|
+
focusItem(fallbackIndex);
|
|
1817
|
+
if (fallbackIndex >= 0) selectIndex(fallbackIndex);
|
|
1558
1818
|
break;
|
|
1559
1819
|
case "End":
|
|
1560
|
-
|
|
1820
|
+
event.preventDefault();
|
|
1821
|
+
if (lastEnabledIndex >= 0) {
|
|
1822
|
+
focusItem(lastEnabledIndex);
|
|
1823
|
+
selectIndex(lastEnabledIndex);
|
|
1824
|
+
}
|
|
1561
1825
|
break;
|
|
1562
1826
|
default: break;
|
|
1563
1827
|
}
|
|
1564
1828
|
};
|
|
1565
|
-
return /* @__PURE__ */
|
|
1566
|
-
className:
|
|
1829
|
+
return /* @__PURE__ */ jsx("div", {
|
|
1830
|
+
className: cx(segmented_toggle_module_default.track, className),
|
|
1567
1831
|
role: "radiogroup",
|
|
1568
|
-
"aria-label":
|
|
1569
|
-
"aria-labelledby":
|
|
1570
|
-
children:
|
|
1571
|
-
ref: (
|
|
1572
|
-
|
|
1832
|
+
"aria-label": ariaLabel,
|
|
1833
|
+
"aria-labelledby": ariaLabelledBy,
|
|
1834
|
+
children: options.map((opt, index) => /* @__PURE__ */ jsx("button", {
|
|
1835
|
+
ref: (node) => {
|
|
1836
|
+
itemRefs.current[index] = node;
|
|
1573
1837
|
},
|
|
1574
1838
|
type: "button",
|
|
1575
1839
|
role: "radio",
|
|
1576
|
-
"aria-checked":
|
|
1577
|
-
disabled:
|
|
1578
|
-
tabIndex:
|
|
1840
|
+
"aria-checked": opt.value === value,
|
|
1841
|
+
disabled: opt.disabled,
|
|
1842
|
+
tabIndex: opt.disabled ? -1 : index === tabbableIndex ? 0 : -1,
|
|
1579
1843
|
onClick: () => {
|
|
1580
|
-
|
|
1844
|
+
if (opt.value !== value) onChange(opt.value);
|
|
1581
1845
|
},
|
|
1582
|
-
onKeyDown: (
|
|
1583
|
-
className:
|
|
1584
|
-
children: /* @__PURE__ */
|
|
1585
|
-
className:
|
|
1586
|
-
children:
|
|
1846
|
+
onKeyDown: (event) => handleKeyDown(event, index),
|
|
1847
|
+
className: cx(segmented_toggle_module_default.option),
|
|
1848
|
+
children: /* @__PURE__ */ jsx("span", {
|
|
1849
|
+
className: segmented_toggle_module_default.label,
|
|
1850
|
+
children: opt.label
|
|
1587
1851
|
})
|
|
1588
|
-
},
|
|
1852
|
+
}, opt.value))
|
|
1589
1853
|
});
|
|
1590
1854
|
}
|
|
1591
1855
|
//#endregion
|
|
1592
|
-
export {
|
|
1856
|
+
export { Alert, AppShell, Avatar, AvatarFallback, AvatarImage, Button, Card, Checkbox, Dropdown, DropdownMenu, DropdownMenuCheckboxItem, DropdownMenuContent, DropdownMenuGroup, DropdownMenuItem, DropdownMenuLabel, DropdownMenuPortal, DropdownMenuRadioGroup, DropdownMenuRadioItem, DropdownMenuSeparator, DropdownMenuSub, DropdownMenuSubContent, DropdownMenuSubTrigger, DropdownMenuTrigger, Input, Label, Modal, ModalOverlay, MultiSelect, Pill, Progress, SegmentedToggle, Select, SidebarNav, Skeleton, ThemeProvider, ThemeToggleButton, ToastProvider, TopBar, cx, useTheme, useToast };
|
|
1593
1857
|
|
|
1594
1858
|
//# sourceMappingURL=index.js.map
|