@yuhuanowo/yunui 0.2.14 → 0.2.16
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/README.md +19 -1
- package/README.zh-CN.md +17 -1
- package/README.zh-TW.md +17 -1
- package/dist/adapters.js +1 -1
- package/dist/ai.js +142 -103
- package/dist/ai.js.map +1 -1
- package/dist/chat.d.ts +133 -0
- package/dist/chat.js +268 -0
- package/dist/chat.js.map +1 -0
- package/dist/{chunk-U2LNRVMI.js → chunk-3RT24MSH.js} +4 -3
- package/dist/chunk-3RT24MSH.js.map +1 -0
- package/dist/chunk-5E3O6ANF.js +1154 -0
- package/dist/chunk-5E3O6ANF.js.map +1 -0
- package/dist/{chunk-VXFEANVX.js → chunk-5TOGZTAO.js} +333 -875
- package/dist/chunk-5TOGZTAO.js.map +1 -0
- package/dist/chunk-AV5TGEJS.js +54 -0
- package/dist/chunk-AV5TGEJS.js.map +1 -0
- package/dist/{chunk-GHO4RCDR.js → chunk-GSPJ5YI6.js} +57 -28
- package/dist/chunk-GSPJ5YI6.js.map +1 -0
- package/dist/chunk-QEIBYOG2.js +188 -0
- package/dist/chunk-QEIBYOG2.js.map +1 -0
- package/dist/{chunk-N53PNMPJ.js → chunk-UYYG4XDW.js} +3 -3
- package/dist/{chunk-N53PNMPJ.js.map → chunk-UYYG4XDW.js.map} +1 -1
- package/dist/content.d.ts +144 -0
- package/dist/content.js +890 -0
- package/dist/content.js.map +1 -0
- package/dist/index.d.ts +273 -6
- package/dist/index.js +5 -3
- package/dist/patterns.d.ts +107 -1
- package/dist/patterns.js +463 -10
- package/dist/patterns.js.map +1 -1
- package/package.json +77 -5
- package/styles/content.css +129 -0
- package/styles/tokens.css +704 -352
- package/styles/yunui.css +126 -4
- package/dist/chunk-GHO4RCDR.js.map +0 -1
- package/dist/chunk-U2LNRVMI.js.map +0 -1
- package/dist/chunk-VXFEANVX.js.map +0 -1
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { cn } from './chunk-
|
|
3
|
-
import { useYunUI } from './chunk-
|
|
2
|
+
import { cn, useAnchoredPosition } from './chunk-AV5TGEJS.js';
|
|
3
|
+
import { useYunUI } from './chunk-3RT24MSH.js';
|
|
4
4
|
import * as React7 from 'react';
|
|
5
|
-
import { forwardRef,
|
|
5
|
+
import { forwardRef, useRef, useCallback, useEffect, useState, useId } from 'react';
|
|
6
|
+
import { createPortal } from 'react-dom';
|
|
7
|
+
import { Minus, Check, ChevronDown, ChevronLeft, ChevronRight, Loader2, AlertCircle, EyeOff, Eye, Plus, Search, X, ChevronUp, CheckCircle2, CheckCircle, Info, RefreshCw, Trash2, AlertTriangle } from 'lucide-react';
|
|
6
8
|
import * as DialogPrimitive from '@radix-ui/react-dialog';
|
|
7
9
|
import * as TooltipPrimitive from '@radix-ui/react-tooltip';
|
|
8
10
|
import * as DropdownMenuPrimitive from '@radix-ui/react-dropdown-menu';
|
|
@@ -11,15 +13,10 @@ import * as SliderPrimitive from '@radix-ui/react-slider';
|
|
|
11
13
|
import * as ProgressPrimitive from '@radix-ui/react-progress';
|
|
12
14
|
import * as TabsPrimitive from '@radix-ui/react-tabs';
|
|
13
15
|
import * as AvatarPrimitive from '@radix-ui/react-avatar';
|
|
14
|
-
import { motion, AnimatePresence
|
|
15
|
-
import { Minus, Check, ChevronDown, ChevronLeft, ChevronRight, Loader2, AlertCircle, EyeOff, Eye, Plus, Search, X, CheckCircle2, CheckCircle, Info, RefreshCw, Trash2, ArrowRight, AlertTriangle } from 'lucide-react';
|
|
16
|
-
import { createPortal } from 'react-dom';
|
|
16
|
+
import { motion, AnimatePresence } from 'framer-motion';
|
|
17
17
|
import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
|
18
18
|
import * as AccordionPrimitive from '@radix-ui/react-accordion';
|
|
19
19
|
import * as RadioGroupPrimitive from '@radix-ui/react-radio-group';
|
|
20
|
-
import * as Primitive from '@radix-ui/react-collapsible';
|
|
21
|
-
import * as PopoverPrimitive from '@radix-ui/react-popover';
|
|
22
|
-
import { Toaster as Toaster$1, toast as toast$1 } from 'sonner';
|
|
23
20
|
|
|
24
21
|
function useEscapeKey(onEscape, enabled = true) {
|
|
25
22
|
const onEscapeRef = useRef(onEscape);
|
|
@@ -152,163 +149,6 @@ var SIZE_CLASSES = {
|
|
|
152
149
|
var ANIMATION_DURATION = 150;
|
|
153
150
|
var DEFAULT_MAX_HEIGHT = "85vh";
|
|
154
151
|
var closeIdCounter = 0;
|
|
155
|
-
function Modal({
|
|
156
|
-
isOpen,
|
|
157
|
-
onClose,
|
|
158
|
-
title,
|
|
159
|
-
subtitle,
|
|
160
|
-
children,
|
|
161
|
-
footer,
|
|
162
|
-
size = "lg",
|
|
163
|
-
className,
|
|
164
|
-
showCloseButton = true,
|
|
165
|
-
isClosing: externalIsClosing,
|
|
166
|
-
setIsClosing: externalSetIsClosing,
|
|
167
|
-
showUnsavedBadge = false,
|
|
168
|
-
maxHeight = DEFAULT_MAX_HEIGHT,
|
|
169
|
-
onBackdropClick
|
|
170
|
-
}) {
|
|
171
|
-
const t = useYunUI().useT("components.modal");
|
|
172
|
-
const modalRef = useRef(null);
|
|
173
|
-
const timeoutRef = useRef(null);
|
|
174
|
-
const closeIdRef = useRef(0);
|
|
175
|
-
const [internalIsClosing, setInternalIsClosing] = useState(false);
|
|
176
|
-
const [mounted, setMounted] = useState(false);
|
|
177
|
-
const isClosing = externalIsClosing ?? internalIsClosing;
|
|
178
|
-
useEffect(() => {
|
|
179
|
-
setMounted(true);
|
|
180
|
-
return () => setMounted(false);
|
|
181
|
-
}, []);
|
|
182
|
-
useEffect(() => {
|
|
183
|
-
return () => {
|
|
184
|
-
if (timeoutRef.current) {
|
|
185
|
-
clearTimeout(timeoutRef.current);
|
|
186
|
-
timeoutRef.current = null;
|
|
187
|
-
}
|
|
188
|
-
};
|
|
189
|
-
}, []);
|
|
190
|
-
const isClosingRef = useRef(isClosing);
|
|
191
|
-
isClosingRef.current = isClosing;
|
|
192
|
-
const onCloseRef = useRef(onClose);
|
|
193
|
-
onCloseRef.current = onClose;
|
|
194
|
-
const externalSetIsClosingRef = useRef(externalSetIsClosing);
|
|
195
|
-
externalSetIsClosingRef.current = externalSetIsClosing;
|
|
196
|
-
const handleClose = useCallback(() => {
|
|
197
|
-
if (isClosingRef.current) return;
|
|
198
|
-
if (timeoutRef.current) {
|
|
199
|
-
clearTimeout(timeoutRef.current);
|
|
200
|
-
timeoutRef.current = null;
|
|
201
|
-
}
|
|
202
|
-
const currentCloseId = ++closeIdCounter;
|
|
203
|
-
closeIdRef.current = currentCloseId;
|
|
204
|
-
const executeClose = () => {
|
|
205
|
-
if (closeIdRef.current === currentCloseId) {
|
|
206
|
-
onCloseRef.current();
|
|
207
|
-
if (externalSetIsClosingRef.current) {
|
|
208
|
-
externalSetIsClosingRef.current(false);
|
|
209
|
-
} else {
|
|
210
|
-
setInternalIsClosing(false);
|
|
211
|
-
}
|
|
212
|
-
timeoutRef.current = null;
|
|
213
|
-
}
|
|
214
|
-
};
|
|
215
|
-
if (externalSetIsClosingRef.current) {
|
|
216
|
-
externalSetIsClosingRef.current(true);
|
|
217
|
-
timeoutRef.current = setTimeout(executeClose, ANIMATION_DURATION);
|
|
218
|
-
} else {
|
|
219
|
-
setInternalIsClosing(true);
|
|
220
|
-
timeoutRef.current = setTimeout(executeClose, ANIMATION_DURATION);
|
|
221
|
-
}
|
|
222
|
-
}, []);
|
|
223
|
-
useEscapeKey(handleClose, isOpen);
|
|
224
|
-
useBodyScrollLock(isOpen);
|
|
225
|
-
useFocusTrap(modalRef, isOpen);
|
|
226
|
-
useEffect(() => {
|
|
227
|
-
if (isOpen && internalIsClosing) {
|
|
228
|
-
setInternalIsClosing(false);
|
|
229
|
-
}
|
|
230
|
-
}, [isOpen, internalIsClosing]);
|
|
231
|
-
const handleBackdropClick = useCallback((e) => {
|
|
232
|
-
if (e.target === e.currentTarget) {
|
|
233
|
-
if (onBackdropClick) {
|
|
234
|
-
onBackdropClick();
|
|
235
|
-
} else {
|
|
236
|
-
handleClose();
|
|
237
|
-
}
|
|
238
|
-
}
|
|
239
|
-
}, [onBackdropClick, handleClose]);
|
|
240
|
-
if (!isOpen || !mounted) return null;
|
|
241
|
-
const sizeClass = SIZE_CLASSES[size] ?? SIZE_CLASSES.lg;
|
|
242
|
-
const modalContent = /* @__PURE__ */ jsxs(
|
|
243
|
-
"div",
|
|
244
|
-
{
|
|
245
|
-
className: cn(
|
|
246
|
-
"fixed inset-0 flex items-center justify-center p-4 transition-opacity",
|
|
247
|
-
isClosing ? "opacity-0 pointer-events-none" : "opacity-100"
|
|
248
|
-
),
|
|
249
|
-
style: { zIndex: Z_INDEX.MODAL },
|
|
250
|
-
onClick: handleBackdropClick,
|
|
251
|
-
role: "dialog",
|
|
252
|
-
"aria-modal": "true",
|
|
253
|
-
"aria-labelledby": "modal-title",
|
|
254
|
-
children: [
|
|
255
|
-
/* @__PURE__ */ jsx(
|
|
256
|
-
"div",
|
|
257
|
-
{
|
|
258
|
-
className: cn(
|
|
259
|
-
"absolute inset-0 bg-black/50 backdrop-blur-sm transition-opacity",
|
|
260
|
-
isClosing ? "opacity-0" : "opacity-100"
|
|
261
|
-
),
|
|
262
|
-
onClick: handleClose,
|
|
263
|
-
"aria-hidden": "true"
|
|
264
|
-
}
|
|
265
|
-
),
|
|
266
|
-
/* @__PURE__ */ jsxs(
|
|
267
|
-
"div",
|
|
268
|
-
{
|
|
269
|
-
ref: modalRef,
|
|
270
|
-
className: cn(
|
|
271
|
-
// Glassy surface (not the solid .card) to match Sheet/Dialog/navbar.
|
|
272
|
-
"relative w-full rounded-2xl border border-border bg-background/95 backdrop-blur-xl shadow-2xl flex flex-col transition-all",
|
|
273
|
-
sizeClass,
|
|
274
|
-
isClosing ? "scale-95 opacity-0" : "scale-100 opacity-100",
|
|
275
|
-
className
|
|
276
|
-
),
|
|
277
|
-
style: { maxHeight },
|
|
278
|
-
onClick: (e) => e.stopPropagation(),
|
|
279
|
-
tabIndex: -1,
|
|
280
|
-
children: [
|
|
281
|
-
/* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between p-4 border-b border-border shrink-0", children: [
|
|
282
|
-
/* @__PURE__ */ jsxs("div", { className: "space-y-1 min-w-0", children: [
|
|
283
|
-
/* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2", children: [
|
|
284
|
-
/* @__PURE__ */ jsx("h2", { id: "modal-title", className: "text-lg font-semibold truncate", children: title }),
|
|
285
|
-
showUnsavedBadge && /* @__PURE__ */ jsx("span", { className: "badge-warning shrink-0", children: t("unsaved") })
|
|
286
|
-
] }),
|
|
287
|
-
subtitle && /* @__PURE__ */ jsx("p", { className: "text-sm text-muted-foreground truncate", children: subtitle })
|
|
288
|
-
] }),
|
|
289
|
-
showCloseButton && /* @__PURE__ */ jsx(
|
|
290
|
-
Button,
|
|
291
|
-
{
|
|
292
|
-
variant: "ghost",
|
|
293
|
-
size: "sm",
|
|
294
|
-
onClick: handleClose,
|
|
295
|
-
className: "p-2 shrink-0",
|
|
296
|
-
"aria-label": t("close"),
|
|
297
|
-
children: /* @__PURE__ */ jsx(X, { size: 20 })
|
|
298
|
-
}
|
|
299
|
-
)
|
|
300
|
-
] }),
|
|
301
|
-
/* @__PURE__ */ jsx("div", { className: "flex-1 overflow-y-auto p-6", children }),
|
|
302
|
-
footer && /* @__PURE__ */ jsx("div", { className: "p-4 border-t border-border bg-muted/20 shrink-0", children: footer })
|
|
303
|
-
]
|
|
304
|
-
}
|
|
305
|
-
)
|
|
306
|
-
]
|
|
307
|
-
}
|
|
308
|
-
);
|
|
309
|
-
return createPortal(modalContent, document.body);
|
|
310
|
-
}
|
|
311
|
-
var closeIdCounter2 = 0;
|
|
312
152
|
var variantConfig = {
|
|
313
153
|
danger: {
|
|
314
154
|
iconBg: "bg-error-soft",
|
|
@@ -384,7 +224,7 @@ function ConfirmModal({
|
|
|
384
224
|
clearTimeout(timeoutRef.current);
|
|
385
225
|
timeoutRef.current = null;
|
|
386
226
|
}
|
|
387
|
-
const currentCloseId = ++
|
|
227
|
+
const currentCloseId = ++closeIdCounter;
|
|
388
228
|
closeIdRef.current = currentCloseId;
|
|
389
229
|
setIsClosing(true);
|
|
390
230
|
timeoutRef.current = setTimeout(() => {
|
|
@@ -592,7 +432,7 @@ function Sheet({ open, onClose, children, title, mobileOnly = false }) {
|
|
|
592
432
|
}
|
|
593
433
|
)
|
|
594
434
|
] }),
|
|
595
|
-
/* @__PURE__ */ jsx("div", { className: "flex-1 overflow-y-auto", children })
|
|
435
|
+
/* @__PURE__ */ jsx("div", { className: "flex-1 overflow-y-auto px-5 py-4", children })
|
|
596
436
|
]
|
|
597
437
|
},
|
|
598
438
|
"sheet-panel"
|
|
@@ -646,8 +486,13 @@ function Combobox({
|
|
|
646
486
|
const resolvedCreatableText = creatableText || t("creatableText", { value: "" });
|
|
647
487
|
const [isOpen, setIsOpen] = useState(false);
|
|
648
488
|
const [inputValue, setInputValue] = useState(value || "");
|
|
489
|
+
const [highlighted, setHighlighted] = useState(-1);
|
|
649
490
|
const containerRef = useRef(null);
|
|
650
491
|
const inputRef = useRef(null);
|
|
492
|
+
const panelRef = useRef(null);
|
|
493
|
+
const { shift, maxHeight } = useAnchoredPosition(isOpen, panelRef);
|
|
494
|
+
const listboxId = useId();
|
|
495
|
+
const optionId = (i) => `${listboxId}-opt-${i}`;
|
|
651
496
|
useEffect(() => {
|
|
652
497
|
const selectedOption2 = options.find((o) => o.value === value);
|
|
653
498
|
setInputValue(selectedOption2?.label || value || "");
|
|
@@ -661,6 +506,9 @@ function Combobox({
|
|
|
661
506
|
document.addEventListener("mousedown", handleClickOutside);
|
|
662
507
|
return () => document.removeEventListener("mousedown", handleClickOutside);
|
|
663
508
|
}, []);
|
|
509
|
+
useEffect(() => {
|
|
510
|
+
setHighlighted(-1);
|
|
511
|
+
}, [inputValue, isOpen]);
|
|
664
512
|
const filteredOptions = inputValue ? options.filter(
|
|
665
513
|
(o) => o.label.toLowerCase().includes(inputValue.toLowerCase()) || o.value.toLowerCase().includes(inputValue.toLowerCase())
|
|
666
514
|
) : options;
|
|
@@ -676,16 +524,43 @@ function Combobox({
|
|
|
676
524
|
setIsOpen(true);
|
|
677
525
|
};
|
|
678
526
|
const handleKeyDown = (e) => {
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
527
|
+
switch (e.key) {
|
|
528
|
+
case "ArrowDown":
|
|
529
|
+
e.preventDefault();
|
|
530
|
+
if (!isOpen) return setIsOpen(true);
|
|
531
|
+
setHighlighted((h) => Math.min(h + 1, filteredOptions.length - 1));
|
|
532
|
+
break;
|
|
533
|
+
case "ArrowUp":
|
|
534
|
+
e.preventDefault();
|
|
535
|
+
if (!isOpen) return setIsOpen(true);
|
|
536
|
+
setHighlighted((h) => Math.max(h - 1, 0));
|
|
537
|
+
break;
|
|
538
|
+
case "Home":
|
|
539
|
+
if (isOpen) {
|
|
540
|
+
e.preventDefault();
|
|
541
|
+
setHighlighted(0);
|
|
542
|
+
}
|
|
543
|
+
break;
|
|
544
|
+
case "End":
|
|
545
|
+
if (isOpen) {
|
|
546
|
+
e.preventDefault();
|
|
547
|
+
setHighlighted(filteredOptions.length - 1);
|
|
548
|
+
}
|
|
549
|
+
break;
|
|
550
|
+
case "Enter":
|
|
551
|
+
e.preventDefault();
|
|
552
|
+
if (isOpen && highlighted >= 0 && filteredOptions[highlighted]) {
|
|
553
|
+
handleSelect(filteredOptions[highlighted].value);
|
|
554
|
+
} else if (canCreateNew) {
|
|
555
|
+
handleSelect(inputValue);
|
|
556
|
+
} else if (filteredOptions.length > 0) {
|
|
557
|
+
handleSelect(filteredOptions[0].value);
|
|
558
|
+
}
|
|
559
|
+
break;
|
|
560
|
+
case "Escape":
|
|
561
|
+
setIsOpen(false);
|
|
562
|
+
setInputValue(value || "");
|
|
563
|
+
break;
|
|
689
564
|
}
|
|
690
565
|
};
|
|
691
566
|
const clearValue = () => {
|
|
@@ -718,6 +593,12 @@ function Combobox({
|
|
|
718
593
|
onFocus: () => !disabled && setIsOpen(true),
|
|
719
594
|
onKeyDown: handleKeyDown,
|
|
720
595
|
placeholder: resolvedPlaceholder,
|
|
596
|
+
"aria-label": resolvedPlaceholder,
|
|
597
|
+
role: "combobox",
|
|
598
|
+
"aria-expanded": isOpen,
|
|
599
|
+
"aria-controls": listboxId,
|
|
600
|
+
"aria-autocomplete": "list",
|
|
601
|
+
"aria-activedescendant": isOpen && highlighted >= 0 ? optionId(highlighted) : void 0,
|
|
721
602
|
disabled,
|
|
722
603
|
className: `
|
|
723
604
|
w-full py-2
|
|
@@ -752,54 +633,61 @@ function Combobox({
|
|
|
752
633
|
}
|
|
753
634
|
)
|
|
754
635
|
] }),
|
|
755
|
-
isOpen && !disabled && /* @__PURE__ */ jsx(
|
|
756
|
-
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
|
|
774
|
-
|
|
775
|
-
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
height: 16,
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
|
|
790
|
-
|
|
791
|
-
|
|
792
|
-
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
|
|
797
|
-
|
|
798
|
-
|
|
799
|
-
|
|
800
|
-
|
|
801
|
-
|
|
802
|
-
|
|
636
|
+
isOpen && !disabled && /* @__PURE__ */ jsx(
|
|
637
|
+
"div",
|
|
638
|
+
{
|
|
639
|
+
ref: panelRef,
|
|
640
|
+
style: { marginLeft: shift, maxHeight },
|
|
641
|
+
className: "absolute z-50 w-full mt-2 p-1 rounded-2xl border border-border bg-background/60 backdrop-blur-2xl text-popover-foreground shadow-lg shadow-black/5 overflow-hidden flex flex-col animate-in fade-in-0 zoom-in-95 duration-200",
|
|
642
|
+
children: /* @__PURE__ */ jsx("div", { className: "flex-1 min-h-0 max-h-60 overflow-y-auto", role: "listbox", id: listboxId, children: filteredOptions.length === 0 && !canCreateNew ? /* @__PURE__ */ jsx("div", { className: "px-3 py-2 text-sm text-muted-foreground", children: t("noResults") }) : /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
643
|
+
filteredOptions.map((option, i) => {
|
|
644
|
+
const isSelected = option.value === value;
|
|
645
|
+
const isHigh = i === highlighted;
|
|
646
|
+
const optionIconPath = option.iconUrl ?? null;
|
|
647
|
+
return /* @__PURE__ */ jsxs(
|
|
648
|
+
"button",
|
|
649
|
+
{
|
|
650
|
+
id: optionId(i),
|
|
651
|
+
type: "button",
|
|
652
|
+
role: "option",
|
|
653
|
+
"aria-selected": isSelected,
|
|
654
|
+
"data-highlighted": isHigh ? "" : void 0,
|
|
655
|
+
onClick: () => handleSelect(option.value),
|
|
656
|
+
onMouseEnter: () => setHighlighted(i),
|
|
657
|
+
className: `dropdown-item w-full text-left outline-none focus-visible:ring-2 focus-visible:ring-ring ${isSelected ? "active" : ""}`,
|
|
658
|
+
children: [
|
|
659
|
+
optionIconPath && /* @__PURE__ */ jsx("div", { className: "rounded-md overflow-hidden bg-linear-to-br from-black/2 to-black/5 shrink-0", style: { width: 16, height: 16 }, children: /* @__PURE__ */ jsx(
|
|
660
|
+
Image2,
|
|
661
|
+
{
|
|
662
|
+
src: optionIconPath,
|
|
663
|
+
alt: option.label,
|
|
664
|
+
width: 16,
|
|
665
|
+
height: 16,
|
|
666
|
+
className: "object-cover",
|
|
667
|
+
unoptimized: true
|
|
668
|
+
}
|
|
669
|
+
) }),
|
|
670
|
+
/* @__PURE__ */ jsx("span", { className: "flex-1 truncate", children: option.label })
|
|
671
|
+
]
|
|
672
|
+
},
|
|
673
|
+
option.value
|
|
674
|
+
);
|
|
675
|
+
}),
|
|
676
|
+
canCreateNew && /* @__PURE__ */ jsxs(
|
|
677
|
+
"button",
|
|
678
|
+
{
|
|
679
|
+
type: "button",
|
|
680
|
+
onClick: () => handleSelect(inputValue),
|
|
681
|
+
className: "dropdown-item w-full text-left text-primary outline-none focus-visible:ring-2 focus-visible:ring-ring",
|
|
682
|
+
children: [
|
|
683
|
+
/* @__PURE__ */ jsx("span", { className: "text-lg leading-none", children: creatableIcon ?? "+" }),
|
|
684
|
+
/* @__PURE__ */ jsx("span", { className: "flex-1 truncate", children: resolvedCreatableText.replace("{value}", inputValue) })
|
|
685
|
+
]
|
|
686
|
+
}
|
|
687
|
+
)
|
|
688
|
+
] }) })
|
|
689
|
+
}
|
|
690
|
+
)
|
|
803
691
|
] });
|
|
804
692
|
}
|
|
805
693
|
var Accordion = AccordionPrimitive.Root;
|
|
@@ -1394,7 +1282,7 @@ var Input = React7.forwardRef(
|
|
|
1394
1282
|
"aria-invalid": error ? true : void 0,
|
|
1395
1283
|
"aria-describedby": describedByIds,
|
|
1396
1284
|
className: cn(
|
|
1397
|
-
"w-full h-10 px-4 bg-background border rounded-xl text-sm outline-none transition-colors",
|
|
1285
|
+
"w-full h-10 px-4 bg-background border border-border rounded-xl text-sm outline-none transition-colors",
|
|
1398
1286
|
"placeholder:text-muted-foreground",
|
|
1399
1287
|
"focus:border-ring focus:ring-2 focus:ring-ring/20",
|
|
1400
1288
|
"disabled:opacity-50 disabled:cursor-not-allowed",
|
|
@@ -1428,7 +1316,7 @@ var Textarea = React7.forwardRef(
|
|
|
1428
1316
|
"aria-invalid": error ? true : void 0,
|
|
1429
1317
|
"aria-describedby": describedByIds,
|
|
1430
1318
|
className: cn(
|
|
1431
|
-
"w-full px-4 py-3 bg-background border rounded-xl text-sm outline-none transition-colors resize-none",
|
|
1319
|
+
"w-full px-4 py-3 bg-background border border-border rounded-xl text-sm outline-none transition-colors resize-none",
|
|
1432
1320
|
"placeholder:text-muted-foreground",
|
|
1433
1321
|
"focus:border-ring focus:ring-2 focus:ring-ring/20",
|
|
1434
1322
|
"disabled:opacity-50 disabled:cursor-not-allowed",
|
|
@@ -1458,7 +1346,7 @@ var PasswordInput = React7.forwardRef(
|
|
|
1458
1346
|
"div",
|
|
1459
1347
|
{
|
|
1460
1348
|
className: cn(
|
|
1461
|
-
"flex items-center h-10 rounded-xl border bg-background transition-colors",
|
|
1349
|
+
"flex items-center h-10 rounded-xl border border-border bg-background transition-colors",
|
|
1462
1350
|
"focus-within:border-ring focus-within:ring-2 focus-within:ring-ring/20",
|
|
1463
1351
|
error ? "border-(--error) focus:border-(--error)" : "border-border",
|
|
1464
1352
|
disabled && "opacity-50",
|
|
@@ -1519,7 +1407,7 @@ var NumberInput = React7.forwardRef(
|
|
|
1519
1407
|
"div",
|
|
1520
1408
|
{
|
|
1521
1409
|
className: cn(
|
|
1522
|
-
"relative flex items-stretch rounded-xl border bg-background transition-colors focus-within:border-ring focus-within:ring-2 focus-within:ring-ring/20",
|
|
1410
|
+
"relative flex items-stretch rounded-xl border border-border bg-background transition-colors focus-within:border-ring focus-within:ring-2 focus-within:ring-ring/20",
|
|
1523
1411
|
error ? "border-(--error) focus:border-(--error)" : "border-border",
|
|
1524
1412
|
disabled && "opacity-50",
|
|
1525
1413
|
className
|
|
@@ -1623,6 +1511,7 @@ var SearchInput = React7.forwardRef(
|
|
|
1623
1511
|
ref: setRef,
|
|
1624
1512
|
type: "text",
|
|
1625
1513
|
role: "searchbox",
|
|
1514
|
+
"aria-label": props.placeholder,
|
|
1626
1515
|
value,
|
|
1627
1516
|
onChange: (e) => onChange?.(e.target.value),
|
|
1628
1517
|
disabled,
|
|
@@ -1674,13 +1563,27 @@ var Card = React7.forwardRef(
|
|
|
1674
1563
|
}
|
|
1675
1564
|
);
|
|
1676
1565
|
Card.displayName = "Card";
|
|
1566
|
+
var CardHeader = React7.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx("div", { ref, className: cn("flex flex-col space-y-1.5 p-6", className), ...props }));
|
|
1567
|
+
CardHeader.displayName = "CardHeader";
|
|
1568
|
+
var CardTitle = React7.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx("h3", { ref, className: cn("text-lg font-semibold leading-none tracking-tight", className), ...props }));
|
|
1569
|
+
CardTitle.displayName = "CardTitle";
|
|
1570
|
+
var CardDescription = React7.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx("p", { ref, className: cn("text-sm text-muted-foreground", className), ...props }));
|
|
1571
|
+
CardDescription.displayName = "CardDescription";
|
|
1572
|
+
var CardContent = React7.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx("div", { ref, className: cn("p-6 pt-0", className), ...props }));
|
|
1573
|
+
CardContent.displayName = "CardContent";
|
|
1574
|
+
var CardFooter = React7.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx("div", { ref, className: cn("flex items-center p-6 pt-0", className), ...props }));
|
|
1575
|
+
CardFooter.displayName = "CardFooter";
|
|
1677
1576
|
function Badge({ className, variant = "default", ...props }) {
|
|
1678
1577
|
const variants = {
|
|
1679
1578
|
default: "bg-muted text-foreground/80",
|
|
1680
1579
|
success: "bg-success-soft text-success",
|
|
1681
1580
|
warning: "bg-warning-soft text-warning",
|
|
1682
1581
|
error: "bg-error-soft text-error",
|
|
1683
|
-
info: "bg-info-soft text-info"
|
|
1582
|
+
info: "bg-info-soft text-info",
|
|
1583
|
+
// Structural (shadcn-compatible) variants:
|
|
1584
|
+
secondary: "bg-secondary text-secondary-foreground",
|
|
1585
|
+
outline: "border border-border text-foreground",
|
|
1586
|
+
destructive: "bg-error-soft text-error"
|
|
1684
1587
|
};
|
|
1685
1588
|
return /* @__PURE__ */ jsx(
|
|
1686
1589
|
"span",
|
|
@@ -1694,7 +1597,7 @@ function Badge({ className, variant = "default", ...props }) {
|
|
|
1694
1597
|
}
|
|
1695
1598
|
);
|
|
1696
1599
|
}
|
|
1697
|
-
function
|
|
1600
|
+
function Separator3({
|
|
1698
1601
|
className,
|
|
1699
1602
|
orientation = "horizontal",
|
|
1700
1603
|
decorative = false,
|
|
@@ -1719,13 +1622,15 @@ function Alert({ className, variant = "info", title, icon, children, ...props })
|
|
|
1719
1622
|
info: "bg-info-soft text-info border-info-soft",
|
|
1720
1623
|
success: "bg-success-soft text-success border-success-soft",
|
|
1721
1624
|
warning: "bg-warning-soft text-warning border-warning-soft",
|
|
1722
|
-
error: "bg-error-soft text-error border-error-soft"
|
|
1625
|
+
error: "bg-error-soft text-error border-error-soft",
|
|
1626
|
+
accent: "bg-accent-soft text-accent border-accent-soft"
|
|
1723
1627
|
};
|
|
1724
1628
|
const defaultIcon = {
|
|
1725
1629
|
info: /* @__PURE__ */ jsx(Info, { className: "h-4 w-4" }),
|
|
1726
1630
|
success: /* @__PURE__ */ jsx(CheckCircle2, { className: "h-4 w-4" }),
|
|
1727
1631
|
warning: /* @__PURE__ */ jsx(AlertTriangle, { className: "h-4 w-4" }),
|
|
1728
|
-
error: /* @__PURE__ */ jsx(AlertCircle, { className: "h-4 w-4" })
|
|
1632
|
+
error: /* @__PURE__ */ jsx(AlertCircle, { className: "h-4 w-4" }),
|
|
1633
|
+
accent: /* @__PURE__ */ jsx(AlertCircle, { className: "h-4 w-4" })
|
|
1729
1634
|
};
|
|
1730
1635
|
const resolvedIcon = icon === void 0 ? defaultIcon[variant] : icon;
|
|
1731
1636
|
const role = variant === "error" || variant === "warning" ? "alert" : "status";
|
|
@@ -1733,7 +1638,7 @@ function Alert({ className, variant = "info", title, icon, children, ...props })
|
|
|
1733
1638
|
"div",
|
|
1734
1639
|
{
|
|
1735
1640
|
role,
|
|
1736
|
-
className: cn("flex gap-3 rounded-xl border p-3 text-sm", styles[variant], className),
|
|
1641
|
+
className: cn("flex gap-3 rounded-xl border border-border p-3 text-sm", styles[variant], className),
|
|
1737
1642
|
...props,
|
|
1738
1643
|
children: [
|
|
1739
1644
|
resolvedIcon && /* @__PURE__ */ jsx("span", { "aria-hidden": "true", className: "mt-0.5 shrink-0", children: resolvedIcon }),
|
|
@@ -1836,7 +1741,7 @@ function Steps({ steps, current = 0, className, ...props }) {
|
|
|
1836
1741
|
{
|
|
1837
1742
|
"aria-hidden": "true",
|
|
1838
1743
|
className: cn(
|
|
1839
|
-
"flex h-6 w-6 shrink-0 items-center justify-center rounded-full border text-xs font-medium",
|
|
1744
|
+
"flex h-6 w-6 shrink-0 items-center justify-center rounded-full border border-border text-xs font-medium",
|
|
1840
1745
|
state === "done" && "border-transparent bg-primary text-primary-foreground",
|
|
1841
1746
|
state === "active" && "border-primary text-primary",
|
|
1842
1747
|
state === "upcoming" && "border-border text-muted-foreground"
|
|
@@ -1965,7 +1870,7 @@ var SelectContent = React7.forwardRef(({ className, children, position = "popper
|
|
|
1965
1870
|
ref,
|
|
1966
1871
|
position,
|
|
1967
1872
|
className: cn(
|
|
1968
|
-
"relative z-50 min-w-32 overflow-hidden rounded-
|
|
1873
|
+
"relative z-50 min-w-32 overflow-hidden rounded-2xl border border-border bg-background/60 backdrop-blur-2xl text-popover-foreground shadow-lg shadow-black/5",
|
|
1969
1874
|
"data-[state=open]:animate-in data-[state=closed]:animate-out",
|
|
1970
1875
|
"data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",
|
|
1971
1876
|
"data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95",
|
|
@@ -1986,31 +1891,67 @@ var SelectContent = React7.forwardRef(({ className, children, position = "popper
|
|
|
1986
1891
|
}
|
|
1987
1892
|
) }));
|
|
1988
1893
|
SelectContent.displayName = SelectPrimitive.Content.displayName;
|
|
1989
|
-
var SelectItem = React7.forwardRef(({ className, children, ...props }, ref) => /* @__PURE__ */
|
|
1894
|
+
var SelectItem = React7.forwardRef(({ className, children, ...props }, ref) => /* @__PURE__ */ jsx(
|
|
1990
1895
|
SelectPrimitive.Item,
|
|
1991
1896
|
{
|
|
1992
1897
|
ref,
|
|
1993
1898
|
className: cn(
|
|
1994
|
-
|
|
1995
|
-
|
|
1899
|
+
// Shares the LanguageSwitcher row look: the left accent bar (via
|
|
1900
|
+
// data-state=checked) marks the selection — no separate checkmark.
|
|
1901
|
+
"dropdown-item w-full cursor-pointer select-none outline-none data-disabled:pointer-events-none data-disabled:opacity-50",
|
|
1996
1902
|
className
|
|
1997
1903
|
),
|
|
1998
1904
|
...props,
|
|
1999
|
-
children:
|
|
2000
|
-
/* @__PURE__ */ jsx("span", { className: "absolute left-2 flex h-3.5 w-3.5 items-center justify-center", children: /* @__PURE__ */ jsx(SelectPrimitive.ItemIndicator, { children: /* @__PURE__ */ jsx(Check, { className: "h-4 w-4" }) }) }),
|
|
2001
|
-
/* @__PURE__ */ jsx(SelectPrimitive.ItemText, { children })
|
|
2002
|
-
]
|
|
1905
|
+
children: /* @__PURE__ */ jsx(SelectPrimitive.ItemText, { children })
|
|
2003
1906
|
}
|
|
2004
1907
|
));
|
|
2005
1908
|
SelectItem.displayName = SelectPrimitive.Item.displayName;
|
|
1909
|
+
var SelectLabel = React7.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
|
|
1910
|
+
SelectPrimitive.Label,
|
|
1911
|
+
{
|
|
1912
|
+
ref,
|
|
1913
|
+
className: cn("px-2 py-1.5 text-xs font-medium text-muted-foreground", className),
|
|
1914
|
+
...props
|
|
1915
|
+
}
|
|
1916
|
+
));
|
|
1917
|
+
SelectLabel.displayName = SelectPrimitive.Label.displayName;
|
|
1918
|
+
var SelectSeparator = React7.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
|
|
1919
|
+
SelectPrimitive.Separator,
|
|
1920
|
+
{
|
|
1921
|
+
ref,
|
|
1922
|
+
className: cn("-mx-1 my-1 h-px bg-border", className),
|
|
1923
|
+
...props
|
|
1924
|
+
}
|
|
1925
|
+
));
|
|
1926
|
+
SelectSeparator.displayName = SelectPrimitive.Separator.displayName;
|
|
1927
|
+
var SelectScrollUpButton = React7.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
|
|
1928
|
+
SelectPrimitive.ScrollUpButton,
|
|
1929
|
+
{
|
|
1930
|
+
ref,
|
|
1931
|
+
className: cn("flex cursor-default items-center justify-center py-1", className),
|
|
1932
|
+
...props,
|
|
1933
|
+
children: /* @__PURE__ */ jsx(ChevronUp, { className: "h-4 w-4" })
|
|
1934
|
+
}
|
|
1935
|
+
));
|
|
1936
|
+
SelectScrollUpButton.displayName = SelectPrimitive.ScrollUpButton.displayName;
|
|
1937
|
+
var SelectScrollDownButton = React7.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
|
|
1938
|
+
SelectPrimitive.ScrollDownButton,
|
|
1939
|
+
{
|
|
1940
|
+
ref,
|
|
1941
|
+
className: cn("flex cursor-default items-center justify-center py-1", className),
|
|
1942
|
+
...props,
|
|
1943
|
+
children: /* @__PURE__ */ jsx(ChevronDown, { className: "h-4 w-4" })
|
|
1944
|
+
}
|
|
1945
|
+
));
|
|
1946
|
+
SelectScrollDownButton.displayName = SelectPrimitive.ScrollDownButton.displayName;
|
|
2006
1947
|
var Slider = React7.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsxs(
|
|
2007
1948
|
SliderPrimitive.Root,
|
|
2008
1949
|
{
|
|
2009
1950
|
ref,
|
|
2010
|
-
className: cn("relative flex w-full touch-none select-none items-center", className),
|
|
1951
|
+
className: cn("relative flex w-full touch-none select-none items-center px-2.5", className),
|
|
2011
1952
|
...props,
|
|
2012
1953
|
children: [
|
|
2013
|
-
/* @__PURE__ */ jsx(SliderPrimitive.Track, { className: "relative h-2 w-full grow overflow-hidden rounded-full bg-
|
|
1954
|
+
/* @__PURE__ */ jsx(SliderPrimitive.Track, { className: "relative h-2 w-full grow overflow-hidden rounded-full bg-border", children: /* @__PURE__ */ jsx(SliderPrimitive.Range, { className: "absolute h-full bg-foreground yunui-accent-bg" }) }),
|
|
2014
1955
|
/* @__PURE__ */ jsx(
|
|
2015
1956
|
SliderPrimitive.Thumb,
|
|
2016
1957
|
{
|
|
@@ -2043,7 +1984,10 @@ var TabsList = React7.forwardRef(({ className, ...props }, ref) => /* @__PURE__
|
|
|
2043
1984
|
{
|
|
2044
1985
|
ref,
|
|
2045
1986
|
className: cn(
|
|
2046
|
-
|
|
1987
|
+
// max-w-full: inline-flex sizes to content, so without it a long tab
|
|
1988
|
+
// strip grows past its parent and drags the page sideways on narrow
|
|
1989
|
+
// screens instead of engaging its own overflow-x-auto.
|
|
1990
|
+
"inline-flex h-11 max-w-full items-center justify-center rounded-xl bg-muted p-1 flex-nowrap overflow-x-auto overflow-y-hidden overscroll-x-contain",
|
|
2047
1991
|
className
|
|
2048
1992
|
),
|
|
2049
1993
|
...props
|
|
@@ -2055,7 +1999,7 @@ var TabsTrigger = React7.forwardRef(({ className, ...props }, ref) => /* @__PURE
|
|
|
2055
1999
|
{
|
|
2056
2000
|
ref,
|
|
2057
2001
|
className: cn(
|
|
2058
|
-
"inline-flex items-center justify-center whitespace-nowrap rounded-lg px-4 py-2 text-sm font-medium transition-all",
|
|
2002
|
+
"inline-flex items-center justify-center gap-1.5 whitespace-nowrap rounded-lg px-4 py-2 text-sm font-medium transition-all",
|
|
2059
2003
|
"focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring",
|
|
2060
2004
|
"disabled:pointer-events-none disabled:opacity-50",
|
|
2061
2005
|
"data-[state=active]:bg-card data-[state=active]:shadow-sm",
|
|
@@ -2230,7 +2174,7 @@ var IconButton = React7.forwardRef(
|
|
|
2230
2174
|
}
|
|
2231
2175
|
);
|
|
2232
2176
|
IconButton.displayName = "IconButton";
|
|
2233
|
-
function
|
|
2177
|
+
function Label3({ className, ...props }) {
|
|
2234
2178
|
return /* @__PURE__ */ jsx(
|
|
2235
2179
|
"label",
|
|
2236
2180
|
{
|
|
@@ -2270,7 +2214,7 @@ var DropdownMenuSubContent = React7.forwardRef(({ className, ...props }, ref) =>
|
|
|
2270
2214
|
{
|
|
2271
2215
|
ref,
|
|
2272
2216
|
className: cn(
|
|
2273
|
-
"z-50 min-w-32 overflow-hidden rounded-
|
|
2217
|
+
"z-50 min-w-32 overflow-hidden rounded-2xl border border-border bg-background/60 backdrop-blur-2xl p-1 text-popover-foreground shadow-lg shadow-black/5 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",
|
|
2274
2218
|
className
|
|
2275
2219
|
),
|
|
2276
2220
|
...props
|
|
@@ -2283,7 +2227,7 @@ var DropdownMenuContent = React7.forwardRef(({ className, sideOffset = 4, ...pro
|
|
|
2283
2227
|
ref,
|
|
2284
2228
|
sideOffset,
|
|
2285
2229
|
className: cn(
|
|
2286
|
-
"z-50 min-w-32 overflow-hidden rounded-
|
|
2230
|
+
"z-50 min-w-32 overflow-hidden rounded-2xl border border-border bg-background/60 backdrop-blur-2xl p-1 text-popover-foreground shadow-lg shadow-black/5",
|
|
2287
2231
|
"data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",
|
|
2288
2232
|
className
|
|
2289
2233
|
),
|
|
@@ -2373,650 +2317,164 @@ var DropdownMenuShortcut = ({
|
|
|
2373
2317
|
);
|
|
2374
2318
|
};
|
|
2375
2319
|
DropdownMenuShortcut.displayName = "DropdownMenuShortcut";
|
|
2376
|
-
|
|
2377
|
-
|
|
2378
|
-
|
|
2379
|
-
|
|
2380
|
-
|
|
2381
|
-
|
|
2382
|
-
|
|
2383
|
-
|
|
2320
|
+
var closeIdCounter2 = 0;
|
|
2321
|
+
function Modal({
|
|
2322
|
+
isOpen,
|
|
2323
|
+
onClose,
|
|
2324
|
+
title,
|
|
2325
|
+
subtitle,
|
|
2326
|
+
children,
|
|
2327
|
+
footer,
|
|
2328
|
+
size = "lg",
|
|
2329
|
+
className,
|
|
2330
|
+
showCloseButton = true,
|
|
2331
|
+
isClosing: externalIsClosing,
|
|
2332
|
+
setIsClosing: externalSetIsClosing,
|
|
2333
|
+
showUnsavedBadge = false,
|
|
2334
|
+
maxHeight = DEFAULT_MAX_HEIGHT,
|
|
2335
|
+
onBackdropClick
|
|
2384
2336
|
}) {
|
|
2385
|
-
const t = useYunUI().useT("
|
|
2386
|
-
const
|
|
2387
|
-
const
|
|
2388
|
-
const
|
|
2389
|
-
const [
|
|
2390
|
-
const
|
|
2391
|
-
const
|
|
2392
|
-
const triggerRef = useRef(null);
|
|
2393
|
-
const listRef = useRef(null);
|
|
2394
|
-
const baseId = useId();
|
|
2395
|
-
const listboxId = `${baseId}-listbox`;
|
|
2396
|
-
const optionId = (i) => `${baseId}-opt-${i}`;
|
|
2397
|
-
const selectedOption = options.find((o) => o.value === value);
|
|
2398
|
-
const filteredOptions = searchQuery ? options.filter(
|
|
2399
|
-
(o) => o.label.toLowerCase().includes(searchQuery.toLowerCase()) || o.value.toLowerCase().includes(searchQuery.toLowerCase())
|
|
2400
|
-
) : options;
|
|
2337
|
+
const t = useYunUI().useT("components.modal");
|
|
2338
|
+
const modalRef = useRef(null);
|
|
2339
|
+
const timeoutRef = useRef(null);
|
|
2340
|
+
const closeIdRef = useRef(0);
|
|
2341
|
+
const [internalIsClosing, setInternalIsClosing] = useState(false);
|
|
2342
|
+
const [mounted, setMounted] = useState(false);
|
|
2343
|
+
const isClosing = externalIsClosing ?? internalIsClosing;
|
|
2401
2344
|
useEffect(() => {
|
|
2402
|
-
|
|
2403
|
-
|
|
2404
|
-
|
|
2405
|
-
|
|
2345
|
+
setMounted(true);
|
|
2346
|
+
return () => setMounted(false);
|
|
2347
|
+
}, []);
|
|
2348
|
+
useEffect(() => {
|
|
2349
|
+
return () => {
|
|
2350
|
+
if (timeoutRef.current) {
|
|
2351
|
+
clearTimeout(timeoutRef.current);
|
|
2352
|
+
timeoutRef.current = null;
|
|
2406
2353
|
}
|
|
2407
2354
|
};
|
|
2408
|
-
document.addEventListener("mousedown", handleClickOutside);
|
|
2409
|
-
return () => document.removeEventListener("mousedown", handleClickOutside);
|
|
2410
2355
|
}, []);
|
|
2411
|
-
|
|
2412
|
-
|
|
2413
|
-
|
|
2414
|
-
|
|
2415
|
-
|
|
2416
|
-
|
|
2417
|
-
|
|
2418
|
-
|
|
2419
|
-
|
|
2356
|
+
const isClosingRef = useRef(isClosing);
|
|
2357
|
+
isClosingRef.current = isClosing;
|
|
2358
|
+
const onCloseRef = useRef(onClose);
|
|
2359
|
+
onCloseRef.current = onClose;
|
|
2360
|
+
const externalSetIsClosingRef = useRef(externalSetIsClosing);
|
|
2361
|
+
externalSetIsClosingRef.current = externalSetIsClosing;
|
|
2362
|
+
const handleClose = useCallback(() => {
|
|
2363
|
+
if (isClosingRef.current) return;
|
|
2364
|
+
if (timeoutRef.current) {
|
|
2365
|
+
clearTimeout(timeoutRef.current);
|
|
2366
|
+
timeoutRef.current = null;
|
|
2420
2367
|
}
|
|
2421
|
-
|
|
2422
|
-
|
|
2423
|
-
|
|
2424
|
-
|
|
2425
|
-
|
|
2426
|
-
|
|
2427
|
-
|
|
2428
|
-
|
|
2429
|
-
|
|
2430
|
-
const close = () => {
|
|
2431
|
-
setIsOpen(false);
|
|
2432
|
-
setSearchQuery("");
|
|
2433
|
-
triggerRef.current?.focus();
|
|
2434
|
-
};
|
|
2435
|
-
const handleSelect = (optionValue) => {
|
|
2436
|
-
onChange(optionValue);
|
|
2437
|
-
setIsOpen(false);
|
|
2438
|
-
setSearchQuery("");
|
|
2439
|
-
triggerRef.current?.focus();
|
|
2440
|
-
};
|
|
2441
|
-
const handleKeyDown = (e) => {
|
|
2442
|
-
if (disabled) return;
|
|
2443
|
-
switch (e.key) {
|
|
2444
|
-
case "ArrowDown":
|
|
2445
|
-
e.preventDefault();
|
|
2446
|
-
if (!isOpen) return open();
|
|
2447
|
-
setHighlighted((h) => Math.min(h + 1, filteredOptions.length - 1));
|
|
2448
|
-
break;
|
|
2449
|
-
case "ArrowUp":
|
|
2450
|
-
e.preventDefault();
|
|
2451
|
-
if (!isOpen) return open();
|
|
2452
|
-
setHighlighted((h) => Math.max(h - 1, 0));
|
|
2453
|
-
break;
|
|
2454
|
-
case "Home":
|
|
2455
|
-
if (isOpen) {
|
|
2456
|
-
e.preventDefault();
|
|
2457
|
-
setHighlighted(0);
|
|
2458
|
-
}
|
|
2459
|
-
break;
|
|
2460
|
-
case "End":
|
|
2461
|
-
if (isOpen) {
|
|
2462
|
-
e.preventDefault();
|
|
2463
|
-
setHighlighted(filteredOptions.length - 1);
|
|
2464
|
-
}
|
|
2465
|
-
break;
|
|
2466
|
-
case "Enter":
|
|
2467
|
-
if (isOpen && filteredOptions[highlighted]) {
|
|
2468
|
-
e.preventDefault();
|
|
2469
|
-
handleSelect(filteredOptions[highlighted].value);
|
|
2470
|
-
} else if (!isOpen) {
|
|
2471
|
-
e.preventDefault();
|
|
2472
|
-
open();
|
|
2473
|
-
}
|
|
2474
|
-
break;
|
|
2475
|
-
case " ":
|
|
2476
|
-
if (!isOpen && !searchable) {
|
|
2477
|
-
e.preventDefault();
|
|
2478
|
-
open();
|
|
2479
|
-
}
|
|
2480
|
-
break;
|
|
2481
|
-
case "Escape":
|
|
2482
|
-
if (isOpen) {
|
|
2483
|
-
e.preventDefault();
|
|
2484
|
-
close();
|
|
2368
|
+
const currentCloseId = ++closeIdCounter2;
|
|
2369
|
+
closeIdRef.current = currentCloseId;
|
|
2370
|
+
const executeClose = () => {
|
|
2371
|
+
if (closeIdRef.current === currentCloseId) {
|
|
2372
|
+
onCloseRef.current();
|
|
2373
|
+
if (externalSetIsClosingRef.current) {
|
|
2374
|
+
externalSetIsClosingRef.current(false);
|
|
2375
|
+
} else {
|
|
2376
|
+
setInternalIsClosing(false);
|
|
2485
2377
|
}
|
|
2486
|
-
|
|
2487
|
-
case "Tab":
|
|
2488
|
-
if (isOpen) setIsOpen(false);
|
|
2489
|
-
break;
|
|
2490
|
-
}
|
|
2491
|
-
};
|
|
2492
|
-
return /* @__PURE__ */ jsxs("div", { ref: containerRef, className: `relative ${className}`, onKeyDown: handleKeyDown, children: [
|
|
2493
|
-
/* @__PURE__ */ jsxs(
|
|
2494
|
-
"button",
|
|
2495
|
-
{
|
|
2496
|
-
ref: triggerRef,
|
|
2497
|
-
type: "button",
|
|
2498
|
-
onClick: () => !disabled && setIsOpen(!isOpen),
|
|
2499
|
-
disabled,
|
|
2500
|
-
"aria-haspopup": "listbox",
|
|
2501
|
-
"aria-expanded": isOpen,
|
|
2502
|
-
"aria-controls": isOpen ? listboxId : void 0,
|
|
2503
|
-
"aria-activedescendant": isOpen && !searchable && highlighted >= 0 ? optionId(highlighted) : void 0,
|
|
2504
|
-
className: `
|
|
2505
|
-
w-full flex items-center justify-between gap-2 px-3 py-2
|
|
2506
|
-
rounded-xl border border-(--border-default) bg-(--bg-elevated)
|
|
2507
|
-
hover:border-(--border-strong) hover:bg-(--bg-hover)
|
|
2508
|
-
transition-all duration-200 text-sm
|
|
2509
|
-
${disabled ? "opacity-50 cursor-not-allowed" : "cursor-pointer"}
|
|
2510
|
-
${isOpen ? "border-primary ring-2 ring-primary/20" : ""}
|
|
2511
|
-
`,
|
|
2512
|
-
children: [
|
|
2513
|
-
/* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2 flex-1 min-w-0", children: [
|
|
2514
|
-
selectedOption?.icon && /* @__PURE__ */ jsx("span", { className: "shrink-0", children: selectedOption.icon }),
|
|
2515
|
-
/* @__PURE__ */ jsx("span", { className: `truncate ${!selectedOption ? "text-muted-foreground" : ""}`, children: selectedOption ? selectedOption.label : resolvedPlaceholder })
|
|
2516
|
-
] }),
|
|
2517
|
-
/* @__PURE__ */ jsx(
|
|
2518
|
-
ChevronDown,
|
|
2519
|
-
{
|
|
2520
|
-
size: 16,
|
|
2521
|
-
className: `shrink-0 text-muted-foreground transition-transform ${isOpen ? "rotate-180" : ""}`
|
|
2522
|
-
}
|
|
2523
|
-
)
|
|
2524
|
-
]
|
|
2378
|
+
timeoutRef.current = null;
|
|
2525
2379
|
}
|
|
2526
|
-
|
|
2527
|
-
|
|
2528
|
-
|
|
2529
|
-
|
|
2530
|
-
|
|
2531
|
-
|
|
2532
|
-
|
|
2533
|
-
ref: inputRef,
|
|
2534
|
-
type: "text",
|
|
2535
|
-
role: "combobox",
|
|
2536
|
-
"aria-expanded": isOpen,
|
|
2537
|
-
"aria-controls": listboxId,
|
|
2538
|
-
"aria-activedescendant": highlighted >= 0 ? optionId(highlighted) : void 0,
|
|
2539
|
-
"aria-autocomplete": "list",
|
|
2540
|
-
value: searchQuery,
|
|
2541
|
-
onChange: (e) => setSearchQuery(e.target.value),
|
|
2542
|
-
placeholder: t("search"),
|
|
2543
|
-
className: "w-full pl-9 pr-8 py-1.5 text-sm rounded-lg\n bg-(--bg-muted) border border-transparent\n focus:border-primary focus:outline-none focus:bg-(--bg-elevated) transition-colors"
|
|
2544
|
-
}
|
|
2545
|
-
),
|
|
2546
|
-
searchQuery && /* @__PURE__ */ jsx(
|
|
2547
|
-
"button",
|
|
2548
|
-
{
|
|
2549
|
-
type: "button",
|
|
2550
|
-
onClick: () => setSearchQuery(""),
|
|
2551
|
-
"aria-label": t("clearSearch"),
|
|
2552
|
-
className: "absolute right-2.5 top-1/2 -translate-y-1/2 text-muted-foreground hover:text-foreground transition-colors p-0.5 rounded-md hover:bg-(--bg-hover)",
|
|
2553
|
-
title: t("clearSearch"),
|
|
2554
|
-
children: /* @__PURE__ */ jsx(X, { size: 12 })
|
|
2555
|
-
}
|
|
2556
|
-
)
|
|
2557
|
-
] }) }),
|
|
2558
|
-
/* @__PURE__ */ jsx(
|
|
2559
|
-
"div",
|
|
2560
|
-
{
|
|
2561
|
-
ref: listRef,
|
|
2562
|
-
role: "listbox",
|
|
2563
|
-
id: listboxId,
|
|
2564
|
-
className: "max-h-52 overflow-y-auto overscroll-contain",
|
|
2565
|
-
children: filteredOptions.length === 0 ? /* @__PURE__ */ jsx("div", { className: "px-3 py-2 text-sm text-muted-foreground text-center whitespace-nowrap", children: t("noOptions") }) : filteredOptions.map((option, i) => {
|
|
2566
|
-
const isSelected = option.value === value;
|
|
2567
|
-
const isHigh = i === highlighted;
|
|
2568
|
-
return /* @__PURE__ */ jsxs(
|
|
2569
|
-
"button",
|
|
2570
|
-
{
|
|
2571
|
-
id: optionId(i),
|
|
2572
|
-
type: "button",
|
|
2573
|
-
role: "option",
|
|
2574
|
-
"aria-selected": isSelected,
|
|
2575
|
-
onClick: () => handleSelect(option.value),
|
|
2576
|
-
onMouseEnter: () => setHighlighted(i),
|
|
2577
|
-
className: `
|
|
2578
|
-
w-full flex items-center gap-2 px-3 py-2 text-sm text-left transition-colors
|
|
2579
|
-
${isHigh ? "bg-(--bg-hover)" : ""}
|
|
2580
|
-
${isSelected ? "bg-primary/10 text-primary" : ""}
|
|
2581
|
-
`,
|
|
2582
|
-
children: [
|
|
2583
|
-
option.icon && /* @__PURE__ */ jsx("span", { className: "shrink-0 w-5 h-5 flex items-center justify-center", children: option.icon }),
|
|
2584
|
-
/* @__PURE__ */ jsxs("div", { className: "flex-1 min-w-0", children: [
|
|
2585
|
-
/* @__PURE__ */ jsx("div", { className: "truncate", children: option.label }),
|
|
2586
|
-
option.description && /* @__PURE__ */ jsx("div", { className: "text-xs text-muted-foreground truncate", children: option.description })
|
|
2587
|
-
] }),
|
|
2588
|
-
isSelected && /* @__PURE__ */ jsx(Check, { size: 14, className: "shrink-0 text-primary" })
|
|
2589
|
-
]
|
|
2590
|
-
},
|
|
2591
|
-
option.value
|
|
2592
|
-
);
|
|
2593
|
-
})
|
|
2594
|
-
}
|
|
2595
|
-
)
|
|
2596
|
-
] })
|
|
2597
|
-
] });
|
|
2598
|
-
}
|
|
2599
|
-
function SegmentedSelect({
|
|
2600
|
-
options,
|
|
2601
|
-
value,
|
|
2602
|
-
onChange,
|
|
2603
|
-
className,
|
|
2604
|
-
disabled = false
|
|
2605
|
-
}) {
|
|
2606
|
-
return /* @__PURE__ */ jsx("div", { className: cn("flex gap-1 flex-wrap", className), children: options.map((opt) => {
|
|
2607
|
-
const Icon2 = opt.icon;
|
|
2608
|
-
return /* @__PURE__ */ jsxs(
|
|
2609
|
-
"button",
|
|
2610
|
-
{
|
|
2611
|
-
type: "button",
|
|
2612
|
-
onClick: () => !disabled && onChange(opt.value),
|
|
2613
|
-
disabled,
|
|
2614
|
-
"aria-pressed": value === opt.value,
|
|
2615
|
-
title: opt.desc,
|
|
2616
|
-
className: cn(
|
|
2617
|
-
"inline-flex items-center justify-center gap-2 px-3 py-1.5 text-xs font-medium border rounded-lg whitespace-nowrap transition-all duration-150 ease cursor-pointer outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-1 focus-visible:ring-offset-background",
|
|
2618
|
-
value === opt.value ? "text-foreground border-(--border-strong) bg-accent-subtle hover:bg-accent-muted hover:shadow-xs" : "text-muted-foreground border-(--border-default) bg-muted/50 hover:text-foreground hover:border-(--border-strong) hover:bg-muted",
|
|
2619
|
-
disabled && "opacity-50 cursor-not-allowed pointer-events-none"
|
|
2620
|
-
),
|
|
2621
|
-
children: [
|
|
2622
|
-
Icon2 && /* @__PURE__ */ jsx(Icon2, { size: 14 }),
|
|
2623
|
-
opt.label
|
|
2624
|
-
]
|
|
2625
|
-
},
|
|
2626
|
-
String(opt.value)
|
|
2627
|
-
);
|
|
2628
|
-
}) });
|
|
2629
|
-
}
|
|
2630
|
-
function NavTabs({ tabs, activeKey, onChange, className = "", ariaLabel }) {
|
|
2631
|
-
const { Link } = useYunUI();
|
|
2632
|
-
return /* @__PURE__ */ jsx("div", { className, children: /* @__PURE__ */ jsx("nav", { className: "flex items-center gap-1 overflow-x-auto", "aria-label": ariaLabel, children: tabs.map((tab) => {
|
|
2633
|
-
const active = tab.key === activeKey;
|
|
2634
|
-
const cls = `nav-tab ${active ? "active" : ""}`;
|
|
2635
|
-
return tab.href ? /* @__PURE__ */ jsx(Link, { href: tab.href, className: cls, "aria-current": active ? "page" : void 0, children: tab.label }, tab.key) : /* @__PURE__ */ jsx(
|
|
2636
|
-
"button",
|
|
2637
|
-
{
|
|
2638
|
-
type: "button",
|
|
2639
|
-
onClick: () => onChange?.(tab.key),
|
|
2640
|
-
className: cls,
|
|
2641
|
-
"aria-current": active ? "true" : void 0,
|
|
2642
|
-
children: tab.label
|
|
2643
|
-
},
|
|
2644
|
-
tab.key
|
|
2645
|
-
);
|
|
2646
|
-
}) }) });
|
|
2647
|
-
}
|
|
2648
|
-
function ShinyButton({
|
|
2649
|
-
children,
|
|
2650
|
-
className,
|
|
2651
|
-
href,
|
|
2652
|
-
onClick
|
|
2653
|
-
}) {
|
|
2654
|
-
const { Link } = useYunUI();
|
|
2655
|
-
const ButtonContent = /* @__PURE__ */ jsxs(
|
|
2656
|
-
"div",
|
|
2657
|
-
{
|
|
2658
|
-
className: cn(
|
|
2659
|
-
"group relative flex items-center justify-center gap-2 overflow-hidden rounded-xl bg-(--text-primary) px-8 py-3 font-semibold text-background transition-all hover:ring-2 hover:ring-(--accent) hover:ring-offset-2 hover:ring-offset-background",
|
|
2660
|
-
className
|
|
2661
|
-
),
|
|
2662
|
-
children: [
|
|
2663
|
-
/* @__PURE__ */ jsxs("span", { className: "relative z-10 flex items-center gap-2", children: [
|
|
2664
|
-
children,
|
|
2665
|
-
/* @__PURE__ */ jsx(ArrowRight, { className: "h-4 w-4 transition-transform group-hover:translate-x-1" })
|
|
2666
|
-
] }),
|
|
2667
|
-
/* @__PURE__ */ jsx("div", { className: "absolute inset-0 -z-10 block animate-shimmer bg-linear-to-r from-transparent via-(--text-primary)/10 to-transparent bg-size-[200%_100%]" })
|
|
2668
|
-
]
|
|
2380
|
+
};
|
|
2381
|
+
if (externalSetIsClosingRef.current) {
|
|
2382
|
+
externalSetIsClosingRef.current(true);
|
|
2383
|
+
timeoutRef.current = setTimeout(executeClose, ANIMATION_DURATION);
|
|
2384
|
+
} else {
|
|
2385
|
+
setInternalIsClosing(true);
|
|
2386
|
+
timeoutRef.current = setTimeout(executeClose, ANIMATION_DURATION);
|
|
2669
2387
|
}
|
|
2670
|
-
);
|
|
2671
|
-
|
|
2672
|
-
|
|
2673
|
-
|
|
2674
|
-
|
|
2675
|
-
|
|
2676
|
-
|
|
2677
|
-
function Marquee({
|
|
2678
|
-
className,
|
|
2679
|
-
reverse,
|
|
2680
|
-
pauseOnHover = false,
|
|
2681
|
-
children,
|
|
2682
|
-
vertical = false,
|
|
2683
|
-
repeat = 4,
|
|
2684
|
-
...props
|
|
2685
|
-
}) {
|
|
2686
|
-
return /* @__PURE__ */ jsx(
|
|
2687
|
-
"div",
|
|
2688
|
-
{
|
|
2689
|
-
...props,
|
|
2690
|
-
className: cn(
|
|
2691
|
-
"group flex overflow-hidden p-2 [--duration:40s] [--gap:1rem] gap-(--gap)",
|
|
2692
|
-
{
|
|
2693
|
-
"flex-row": !vertical,
|
|
2694
|
-
"flex-col": vertical
|
|
2695
|
-
},
|
|
2696
|
-
className
|
|
2697
|
-
),
|
|
2698
|
-
children: Array(repeat).fill(0).map((_, i) => /* @__PURE__ */ jsx(
|
|
2699
|
-
"div",
|
|
2700
|
-
{
|
|
2701
|
-
className: cn("flex shrink-0 justify-around gap-(--gap)", {
|
|
2702
|
-
"animate-marquee flex-row": !vertical,
|
|
2703
|
-
"animate-marquee-vertical flex-col": vertical,
|
|
2704
|
-
"group-hover:[animation-play-state:paused]": pauseOnHover,
|
|
2705
|
-
"[animation-direction:reverse]": reverse
|
|
2706
|
-
}),
|
|
2707
|
-
children
|
|
2708
|
-
},
|
|
2709
|
-
i
|
|
2710
|
-
))
|
|
2388
|
+
}, []);
|
|
2389
|
+
useEscapeKey(handleClose, isOpen);
|
|
2390
|
+
useBodyScrollLock(isOpen);
|
|
2391
|
+
useFocusTrap(modalRef, isOpen);
|
|
2392
|
+
useEffect(() => {
|
|
2393
|
+
if (isOpen && internalIsClosing) {
|
|
2394
|
+
setInternalIsClosing(false);
|
|
2711
2395
|
}
|
|
2712
|
-
);
|
|
2713
|
-
|
|
2714
|
-
|
|
2715
|
-
|
|
2716
|
-
|
|
2717
|
-
}
|
|
2718
|
-
|
|
2719
|
-
|
|
2720
|
-
{
|
|
2721
|
-
className: cn(
|
|
2722
|
-
"grid grid-cols-1 md:grid-cols-3 gap-6 max-w-7xl mx-auto",
|
|
2723
|
-
className
|
|
2724
|
-
),
|
|
2725
|
-
children
|
|
2396
|
+
}, [isOpen, internalIsClosing]);
|
|
2397
|
+
const handleBackdropClick = useCallback((e) => {
|
|
2398
|
+
if (e.target === e.currentTarget) {
|
|
2399
|
+
if (onBackdropClick) {
|
|
2400
|
+
onBackdropClick();
|
|
2401
|
+
} else {
|
|
2402
|
+
handleClose();
|
|
2403
|
+
}
|
|
2726
2404
|
}
|
|
2727
|
-
);
|
|
2728
|
-
|
|
2729
|
-
|
|
2730
|
-
|
|
2731
|
-
title,
|
|
2732
|
-
description,
|
|
2733
|
-
header,
|
|
2734
|
-
icon
|
|
2735
|
-
}) => {
|
|
2736
|
-
return /* @__PURE__ */ jsxs(
|
|
2405
|
+
}, [onBackdropClick, handleClose]);
|
|
2406
|
+
if (!isOpen || !mounted) return null;
|
|
2407
|
+
const sizeClass = SIZE_CLASSES[size] ?? SIZE_CLASSES.lg;
|
|
2408
|
+
const modalContent = /* @__PURE__ */ jsxs(
|
|
2737
2409
|
"div",
|
|
2738
2410
|
{
|
|
2739
2411
|
className: cn(
|
|
2740
|
-
"
|
|
2741
|
-
|
|
2412
|
+
"fixed inset-0 flex items-center justify-center p-4 transition-opacity",
|
|
2413
|
+
isClosing ? "opacity-0 pointer-events-none" : "opacity-100"
|
|
2742
2414
|
),
|
|
2415
|
+
style: { zIndex: Z_INDEX.MODAL },
|
|
2416
|
+
onClick: handleBackdropClick,
|
|
2417
|
+
role: "dialog",
|
|
2418
|
+
"aria-modal": "true",
|
|
2419
|
+
"aria-labelledby": "modal-title",
|
|
2743
2420
|
children: [
|
|
2744
|
-
|
|
2745
|
-
|
|
2746
|
-
/* @__PURE__ */ jsx("div", { className: "mb-2 text-[var(--text-primary)]", children: icon }),
|
|
2747
|
-
/* @__PURE__ */ jsx("div", { className: "font-semibold text-[var(--text-primary)] text-lg mb-2 mt-2", children: title }),
|
|
2748
|
-
/* @__PURE__ */ jsx("div", { className: "font-normal text-[var(--text-secondary)] text-sm leading-relaxed", children: description })
|
|
2749
|
-
] })
|
|
2750
|
-
]
|
|
2751
|
-
}
|
|
2752
|
-
);
|
|
2753
|
-
};
|
|
2754
|
-
var Collapsible = Primitive.Root;
|
|
2755
|
-
var CollapsibleTrigger2 = Primitive.CollapsibleTrigger;
|
|
2756
|
-
var CollapsibleContent2 = forwardRef(({ children, ...props }, ref) => {
|
|
2757
|
-
const [mounted, setMounted] = useState(false);
|
|
2758
|
-
useEffect(() => {
|
|
2759
|
-
setMounted(true);
|
|
2760
|
-
}, []);
|
|
2761
|
-
return /* @__PURE__ */ jsx(
|
|
2762
|
-
Primitive.CollapsibleContent,
|
|
2763
|
-
{
|
|
2764
|
-
ref,
|
|
2765
|
-
...props,
|
|
2766
|
-
className: cn(
|
|
2767
|
-
"overflow-hidden",
|
|
2768
|
-
mounted && "data-[state=closed]:animate-fd-collapsible-up data-[state=open]:animate-fd-collapsible-down",
|
|
2769
|
-
props.className
|
|
2770
|
-
),
|
|
2771
|
-
children
|
|
2772
|
-
}
|
|
2773
|
-
);
|
|
2774
|
-
});
|
|
2775
|
-
CollapsibleContent2.displayName = Primitive.CollapsibleContent.displayName;
|
|
2776
|
-
var Popover = PopoverPrimitive.Root;
|
|
2777
|
-
var PopoverTrigger = PopoverPrimitive.Trigger;
|
|
2778
|
-
var PopoverContent = React7.forwardRef(({ className, align = "center", sideOffset = 4, ...props }, ref) => /* @__PURE__ */ jsx(PopoverPrimitive.Portal, { children: /* @__PURE__ */ jsx(
|
|
2779
|
-
PopoverPrimitive.Content,
|
|
2780
|
-
{
|
|
2781
|
-
ref,
|
|
2782
|
-
align,
|
|
2783
|
-
sideOffset,
|
|
2784
|
-
side: "bottom",
|
|
2785
|
-
className: cn(
|
|
2786
|
-
"z-50 origin-(--radix-popover-content-transform-origin) overflow-y-auto max-h-(--radix-popover-content-available-height) min-w-[240px] max-w-[98vw] rounded-xl border border-border bg-popover/95 backdrop-blur-lg p-2 text-sm text-popover-foreground shadow-lg focus-visible:outline-none data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95",
|
|
2787
|
-
className
|
|
2788
|
-
),
|
|
2789
|
-
...props
|
|
2790
|
-
}
|
|
2791
|
-
) }));
|
|
2792
|
-
PopoverContent.displayName = PopoverPrimitive.Content.displayName;
|
|
2793
|
-
var PopoverClose2 = PopoverPrimitive.PopoverClose;
|
|
2794
|
-
var sizeClasses = {
|
|
2795
|
-
sm: {
|
|
2796
|
-
track: "w-8 h-4",
|
|
2797
|
-
thumb: "w-2.5 h-2.5",
|
|
2798
|
-
thumbTranslate: "translate-x-3.5"
|
|
2799
|
-
},
|
|
2800
|
-
md: {
|
|
2801
|
-
track: "w-11 h-6",
|
|
2802
|
-
thumb: "w-4 h-4",
|
|
2803
|
-
thumbTranslate: "translate-x-5"
|
|
2804
|
-
}
|
|
2805
|
-
};
|
|
2806
|
-
var variantClasses = {
|
|
2807
|
-
default: {
|
|
2808
|
-
checkedTrack: "border-primary bg-primary/10",
|
|
2809
|
-
uncheckedTrack: "border-(--border-strong) bg-muted",
|
|
2810
|
-
checkedThumb: "bg-primary",
|
|
2811
|
-
uncheckedThumb: "bg-(--border-strong)"
|
|
2812
|
-
},
|
|
2813
|
-
success: {
|
|
2814
|
-
checkedTrack: "border-(--success) bg-success-soft",
|
|
2815
|
-
uncheckedTrack: "border-(--border-strong) bg-muted",
|
|
2816
|
-
checkedThumb: "bg-(--success)",
|
|
2817
|
-
uncheckedThumb: "bg-(--border-strong)"
|
|
2818
|
-
},
|
|
2819
|
-
warning: {
|
|
2820
|
-
checkedTrack: "border-(--warning) bg-warning-soft",
|
|
2821
|
-
uncheckedTrack: "border-(--border-strong) bg-muted",
|
|
2822
|
-
checkedThumb: "bg-(--warning)",
|
|
2823
|
-
uncheckedThumb: "bg-(--border-strong)"
|
|
2824
|
-
},
|
|
2825
|
-
danger: {
|
|
2826
|
-
checkedTrack: "border-(--error) bg-error-soft",
|
|
2827
|
-
uncheckedTrack: "border-(--border-strong) bg-muted",
|
|
2828
|
-
checkedThumb: "bg-(--error)",
|
|
2829
|
-
uncheckedThumb: "bg-(--border-strong)"
|
|
2830
|
-
}
|
|
2831
|
-
};
|
|
2832
|
-
var Switch = forwardRef(
|
|
2833
|
-
({ checked, onCheckedChange, disabled = false, size = "sm", variant = "default", className = "", id }, ref) => {
|
|
2834
|
-
const sizeClass = sizeClasses[size];
|
|
2835
|
-
const variantClass = variantClasses[variant];
|
|
2836
|
-
return /* @__PURE__ */ jsx(
|
|
2837
|
-
"button",
|
|
2838
|
-
{
|
|
2839
|
-
ref,
|
|
2840
|
-
type: "button",
|
|
2841
|
-
role: "switch",
|
|
2842
|
-
"aria-checked": checked,
|
|
2843
|
-
id,
|
|
2844
|
-
onClick: () => !disabled && onCheckedChange(!checked),
|
|
2845
|
-
disabled,
|
|
2846
|
-
className: `
|
|
2847
|
-
${sizeClass.track} rounded-full border-2 flex items-center px-0.5
|
|
2848
|
-
transition-all duration-200 ease-in-out
|
|
2849
|
-
outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background
|
|
2850
|
-
${checked ? variantClass.checkedTrack : variantClass.uncheckedTrack}
|
|
2851
|
-
${disabled ? "opacity-50 cursor-not-allowed" : "cursor-pointer"}
|
|
2852
|
-
${className}
|
|
2853
|
-
`,
|
|
2854
|
-
children: /* @__PURE__ */ jsx(
|
|
2855
|
-
"span",
|
|
2421
|
+
/* @__PURE__ */ jsx(
|
|
2422
|
+
"div",
|
|
2856
2423
|
{
|
|
2857
|
-
className:
|
|
2858
|
-
|
|
2859
|
-
|
|
2860
|
-
|
|
2861
|
-
|
|
2424
|
+
className: cn(
|
|
2425
|
+
"absolute inset-0 bg-black/50 backdrop-blur-sm transition-opacity",
|
|
2426
|
+
isClosing ? "opacity-0" : "opacity-100"
|
|
2427
|
+
),
|
|
2428
|
+
onClick: handleClose,
|
|
2429
|
+
"aria-hidden": "true"
|
|
2430
|
+
}
|
|
2431
|
+
),
|
|
2432
|
+
/* @__PURE__ */ jsxs(
|
|
2433
|
+
"div",
|
|
2434
|
+
{
|
|
2435
|
+
ref: modalRef,
|
|
2436
|
+
className: cn(
|
|
2437
|
+
// Glassy surface (not the solid .card) to match Sheet/Dialog/navbar.
|
|
2438
|
+
"relative w-full rounded-2xl border border-border bg-background/95 backdrop-blur-xl shadow-2xl flex flex-col transition-all",
|
|
2439
|
+
sizeClass,
|
|
2440
|
+
isClosing ? "scale-95 opacity-0" : "scale-100 opacity-100",
|
|
2441
|
+
className
|
|
2442
|
+
),
|
|
2443
|
+
style: { maxHeight },
|
|
2444
|
+
onClick: (e) => e.stopPropagation(),
|
|
2445
|
+
tabIndex: -1,
|
|
2446
|
+
children: [
|
|
2447
|
+
/* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between p-4 border-b border-border shrink-0", children: [
|
|
2448
|
+
/* @__PURE__ */ jsxs("div", { className: "space-y-1 min-w-0", children: [
|
|
2449
|
+
/* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2", children: [
|
|
2450
|
+
/* @__PURE__ */ jsx("h2", { id: "modal-title", className: "text-lg font-semibold truncate", children: title }),
|
|
2451
|
+
showUnsavedBadge && /* @__PURE__ */ jsx("span", { className: "badge-warning shrink-0", children: t("unsaved") })
|
|
2452
|
+
] }),
|
|
2453
|
+
subtitle && /* @__PURE__ */ jsx("p", { className: "text-sm text-muted-foreground truncate", children: subtitle })
|
|
2454
|
+
] }),
|
|
2455
|
+
showCloseButton && /* @__PURE__ */ jsx(
|
|
2456
|
+
Button,
|
|
2457
|
+
{
|
|
2458
|
+
variant: "ghost",
|
|
2459
|
+
size: "sm",
|
|
2460
|
+
onClick: handleClose,
|
|
2461
|
+
className: "p-2 shrink-0",
|
|
2462
|
+
"aria-label": t("close"),
|
|
2463
|
+
children: /* @__PURE__ */ jsx(X, { size: 20 })
|
|
2464
|
+
}
|
|
2465
|
+
)
|
|
2466
|
+
] }),
|
|
2467
|
+
/* @__PURE__ */ jsx("div", { className: "flex-1 overflow-y-auto p-6", children }),
|
|
2468
|
+
footer && /* @__PURE__ */ jsx("div", { className: "p-4 border-t border-border bg-muted/20 shrink-0", children: footer })
|
|
2469
|
+
]
|
|
2862
2470
|
}
|
|
2863
2471
|
)
|
|
2864
|
-
|
|
2865
|
-
);
|
|
2866
|
-
}
|
|
2867
|
-
);
|
|
2868
|
-
Switch.displayName = "Switch";
|
|
2869
|
-
function AnimatedNumber({ value, suffix = "", decimals = 0 }) {
|
|
2870
|
-
const animatedValue = useSpring(0, { stiffness: 50, damping: 15 });
|
|
2871
|
-
const displayValue = useTransform(animatedValue, (latest) => {
|
|
2872
|
-
const numStr = decimals > 0 ? latest.toFixed(decimals) : Math.round(latest).toString();
|
|
2873
|
-
return Number(numStr).toString() + suffix;
|
|
2874
|
-
});
|
|
2875
|
-
useEffect(() => {
|
|
2876
|
-
animatedValue.set(value);
|
|
2877
|
-
}, [animatedValue, value]);
|
|
2878
|
-
return /* @__PURE__ */ jsx(motion.span, { children: displayValue });
|
|
2879
|
-
}
|
|
2880
|
-
function Toaster() {
|
|
2881
|
-
return /* @__PURE__ */ jsx(
|
|
2882
|
-
Toaster$1,
|
|
2883
|
-
{
|
|
2884
|
-
position: "bottom-right",
|
|
2885
|
-
toastOptions: {
|
|
2886
|
-
classNames: {
|
|
2887
|
-
toast: "bg-card border border-border rounded-xl shadow-lg p-4",
|
|
2888
|
-
title: "text-sm font-medium",
|
|
2889
|
-
description: "text-xs text-muted-foreground",
|
|
2890
|
-
actionButton: "bg-foreground text-background text-xs px-3 py-1.5 rounded-lg",
|
|
2891
|
-
cancelButton: "text-muted-foreground text-xs px-3 py-1.5 rounded-lg hover:bg-muted"
|
|
2892
|
-
}
|
|
2893
|
-
}
|
|
2472
|
+
]
|
|
2894
2473
|
}
|
|
2895
2474
|
);
|
|
2896
|
-
|
|
2897
|
-
var toast = {
|
|
2898
|
-
success: (message, description) => {
|
|
2899
|
-
toast$1.success(message, {
|
|
2900
|
-
description,
|
|
2901
|
-
icon: /* @__PURE__ */ jsx(CheckCircle2, { className: "w-5 h-5 text-success" })
|
|
2902
|
-
});
|
|
2903
|
-
},
|
|
2904
|
-
error: (message, description) => {
|
|
2905
|
-
toast$1.error(message, {
|
|
2906
|
-
description,
|
|
2907
|
-
icon: /* @__PURE__ */ jsx(AlertCircle, { className: "w-5 h-5 text-error" })
|
|
2908
|
-
});
|
|
2909
|
-
},
|
|
2910
|
-
info: (message, description) => {
|
|
2911
|
-
toast$1.info(message, {
|
|
2912
|
-
description,
|
|
2913
|
-
icon: /* @__PURE__ */ jsx(Info, { className: "w-5 h-5 text-info" })
|
|
2914
|
-
});
|
|
2915
|
-
},
|
|
2916
|
-
warning: (message, description) => {
|
|
2917
|
-
toast$1.warning(message, {
|
|
2918
|
-
description,
|
|
2919
|
-
icon: /* @__PURE__ */ jsx(AlertTriangle, { className: "w-5 h-5 text-warning" })
|
|
2920
|
-
});
|
|
2921
|
-
},
|
|
2922
|
-
loading: (message) => {
|
|
2923
|
-
return toast$1.loading(message, {
|
|
2924
|
-
icon: /* @__PURE__ */ jsx(Loader2, { className: "w-5 h-5 animate-spin" })
|
|
2925
|
-
});
|
|
2926
|
-
},
|
|
2927
|
-
dismiss: (id) => {
|
|
2928
|
-
toast$1.dismiss(id);
|
|
2929
|
-
},
|
|
2930
|
-
promise: (promise, messages) => {
|
|
2931
|
-
return toast$1.promise(promise, {
|
|
2932
|
-
loading: messages.loading,
|
|
2933
|
-
success: messages.success,
|
|
2934
|
-
error: messages.error
|
|
2935
|
-
});
|
|
2936
|
-
}
|
|
2937
|
-
};
|
|
2938
|
-
var YUNUI_PALETTES = [
|
|
2939
|
-
"gray",
|
|
2940
|
-
"sand",
|
|
2941
|
-
"slate",
|
|
2942
|
-
"mint",
|
|
2943
|
-
"rose",
|
|
2944
|
-
"dusk",
|
|
2945
|
-
"red",
|
|
2946
|
-
"orange",
|
|
2947
|
-
"yellow",
|
|
2948
|
-
"moss",
|
|
2949
|
-
"green",
|
|
2950
|
-
"emerald",
|
|
2951
|
-
"aqua",
|
|
2952
|
-
"cyan",
|
|
2953
|
-
"blue",
|
|
2954
|
-
"indigo",
|
|
2955
|
-
"violet",
|
|
2956
|
-
"magenta",
|
|
2957
|
-
"pink"
|
|
2958
|
-
];
|
|
2959
|
-
var ATTR = {
|
|
2960
|
-
brand: "data-brand",
|
|
2961
|
-
accent: "data-accent",
|
|
2962
|
-
neutral: "data-neutral",
|
|
2963
|
-
solid: "data-solid",
|
|
2964
|
-
surface: "data-surface",
|
|
2965
|
-
theme: "data-theme",
|
|
2966
|
-
accentSource: "data-accent-source"
|
|
2967
|
-
};
|
|
2968
|
-
function resolveTarget(el) {
|
|
2969
|
-
if (el) return el;
|
|
2970
|
-
return typeof document !== "undefined" ? document.documentElement : null;
|
|
2971
|
-
}
|
|
2972
|
-
function applyTheme(theme, el) {
|
|
2973
|
-
const target = resolveTarget(el);
|
|
2974
|
-
if (!target) return;
|
|
2975
|
-
for (const key of Object.keys(theme)) {
|
|
2976
|
-
const value = theme[key];
|
|
2977
|
-
const attr = ATTR[key];
|
|
2978
|
-
if (!attr) continue;
|
|
2979
|
-
if (value == null) target.removeAttribute(attr);
|
|
2980
|
-
else target.setAttribute(attr, value);
|
|
2981
|
-
}
|
|
2982
|
-
}
|
|
2983
|
-
function readTheme(el) {
|
|
2984
|
-
const target = resolveTarget(el);
|
|
2985
|
-
const out = {};
|
|
2986
|
-
if (!target) return out;
|
|
2987
|
-
for (const key of Object.keys(ATTR)) {
|
|
2988
|
-
const v = target.getAttribute(ATTR[key]);
|
|
2989
|
-
if (v != null) out[key] = v;
|
|
2990
|
-
}
|
|
2991
|
-
return out;
|
|
2992
|
-
}
|
|
2993
|
-
var STORAGE_KEY = "yunui-theme";
|
|
2994
|
-
function useYunUITheme(defaults = {}) {
|
|
2995
|
-
const [theme, setTheme] = React7.useState(defaults);
|
|
2996
|
-
React7.useEffect(() => {
|
|
2997
|
-
let stored = {};
|
|
2998
|
-
try {
|
|
2999
|
-
stored = JSON.parse(localStorage.getItem(STORAGE_KEY) || "{}");
|
|
3000
|
-
} catch {
|
|
3001
|
-
}
|
|
3002
|
-
const merged = { ...defaults, ...stored };
|
|
3003
|
-
setTheme(merged);
|
|
3004
|
-
applyTheme(merged);
|
|
3005
|
-
}, []);
|
|
3006
|
-
const update = React7.useCallback((patch) => {
|
|
3007
|
-
setTheme((prev) => {
|
|
3008
|
-
const next = { ...prev, ...patch };
|
|
3009
|
-
applyTheme(next);
|
|
3010
|
-
try {
|
|
3011
|
-
localStorage.setItem(STORAGE_KEY, JSON.stringify(next));
|
|
3012
|
-
} catch {
|
|
3013
|
-
}
|
|
3014
|
-
return next;
|
|
3015
|
-
});
|
|
3016
|
-
}, []);
|
|
3017
|
-
return [theme, update];
|
|
2475
|
+
return createPortal(modalContent, document.body);
|
|
3018
2476
|
}
|
|
3019
2477
|
|
|
3020
|
-
export { Accordion, AccordionContent, AccordionItem, AccordionTrigger, Alert,
|
|
3021
|
-
//# sourceMappingURL=chunk-
|
|
3022
|
-
//# sourceMappingURL=chunk-
|
|
2478
|
+
export { Accordion, AccordionContent, AccordionItem, AccordionTrigger, Alert, Avatar, AvatarFallback, AvatarGroup, AvatarImage, Badge, Breadcrumb, BreadcrumbEllipsis, BreadcrumbItem, BreadcrumbLink, BreadcrumbList, BreadcrumbPage, BreadcrumbSeparator, Button, Card, CardContent, CardDescription, CardFooter, CardHeader, CardTitle, Checkbox, Column, Combobox, ConfirmModal, DeleteConfirmModal, Dialog, DialogClose, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogOverlay, DialogPortal, DialogTitle, DialogTrigger, DropdownMenu, DropdownMenuCheckboxItem, DropdownMenuContent, DropdownMenuGroup, DropdownMenuItem, DropdownMenuLabel, DropdownMenuPortal, DropdownMenuRadioGroup, DropdownMenuRadioItem, DropdownMenuSeparator, DropdownMenuShortcut, DropdownMenuSub, DropdownMenuSubContent, DropdownMenuSubTrigger, DropdownMenuTrigger, EmptyState, Flex, Grid, IconButton, InlineCode, InlineStatus, Input, Kbd, Label3 as Label, Modal, MotionDiv, MotionSpan, NumberInput, PageLoader, Pagination, PasswordInput, Progress, RadioGroup, RadioGroupItem, RegenerateConfirmModal, Row, SearchInput, Select, SelectContent, SelectGroup, SelectItem, SelectLabel, SelectScrollDownButton, SelectScrollUpButton, SelectSeparator, SelectTrigger, SelectValue, Separator3 as Separator, Sheet, Skeleton, Slider, Spinner, Stack, StatusIndicator, Steps, Table, TableBody, TableCaption, TableCell, TableFooter, TableHead, TableHeader, TableRow, Tabs, TabsContent, TabsList, TabsTrigger, Tag, Textarea, Tooltip, TooltipContent, TooltipProvider, TooltipTrigger, fadeIn, staggerContainer, staggerItem, useBodyScrollLock, useEscapeKey, useFocusTrap, useModalBehavior };
|
|
2479
|
+
//# sourceMappingURL=chunk-5TOGZTAO.js.map
|
|
2480
|
+
//# sourceMappingURL=chunk-5TOGZTAO.js.map
|