@vuer-ai/vuer-uikit 0.0.19 → 0.0.21
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/chunk-2JCULHBM.js +58 -0
- package/dist/chunk-2TRYGIGT.mjs +76 -0
- package/dist/chunk-2YCL2ET2.js +431 -0
- package/dist/chunk-3FR3WKI4.mjs +24 -0
- package/dist/chunk-44KW6PTD.mjs +111 -0
- package/dist/chunk-5OUTEHVX.js +48 -0
- package/dist/chunk-5SR53QBZ.js +143 -0
- package/dist/chunk-5TVG5JK5.js +93 -0
- package/dist/chunk-5ZZC23M7.mjs +60 -0
- package/dist/chunk-6N5422RT.js +110 -0
- package/dist/chunk-AOUGWGQR.js +609 -0
- package/dist/chunk-B2E7AY66.mjs +86 -0
- package/dist/chunk-BOPZFNFS.mjs +54 -0
- package/dist/chunk-CLTLT5XW.js +27 -0
- package/dist/chunk-DDOX4EEM.mjs +46 -0
- package/dist/chunk-DZ4J7I7I.mjs +114 -0
- package/dist/chunk-E33MW663.js +179 -0
- package/dist/chunk-EAZQH4IX.mjs +27 -0
- package/dist/chunk-EFIRD3FN.js +69 -0
- package/dist/chunk-EOFYA6CS.js +53 -0
- package/dist/chunk-EUY74AXP.mjs +341 -0
- package/dist/chunk-EYIFKSU2.mjs +259 -0
- package/dist/chunk-F56ZKT7B.mjs +1 -0
- package/dist/chunk-F776EMXP.mjs +82 -0
- package/dist/chunk-FORVP7XH.js +164 -0
- package/dist/chunk-FP26SRGL.js +377 -0
- package/dist/chunk-FRT225GK.mjs +34 -0
- package/dist/chunk-G5KMD72J.mjs +162 -0
- package/dist/chunk-G6PRZVSE.mjs +71 -0
- package/dist/chunk-H5P4IX7R.js +67 -0
- package/dist/chunk-HLJ7PQA7.mjs +15 -0
- package/dist/chunk-IGBWUFZL.js +79 -0
- package/dist/chunk-IXHMIR5P.js +131 -0
- package/dist/chunk-JAMJUXBY.mjs +45 -0
- package/dist/chunk-JMPVDU2C.mjs +110 -0
- package/dist/chunk-KJ42IGH6.js +2 -0
- package/dist/chunk-KTNZSZ5Y.mjs +23 -0
- package/dist/chunk-LEPXSM36.mjs +46 -0
- package/dist/chunk-LLXRJYQB.mjs +31 -0
- package/dist/chunk-M4IVLZIH.mjs +1 -0
- package/dist/chunk-MRVMXKZO.mjs +106 -0
- package/dist/chunk-MZ4POL3U.js +301 -0
- package/dist/chunk-N7CINZS2.js +2 -0
- package/dist/chunk-NODFVSVC.mjs +39 -0
- package/dist/chunk-OOI3SJDU.mjs +206 -0
- package/dist/chunk-OQ237S4Z.js +94 -0
- package/dist/chunk-OTPUWWEB.js +98 -0
- package/dist/chunk-PIR7EZC6.js +187 -0
- package/dist/chunk-PVRQNCSJ.js +49 -0
- package/dist/chunk-Q5KEB4UK.mjs +51 -0
- package/dist/chunk-QEY7BWIR.js +208 -0
- package/dist/chunk-QJR6MCTR.js +32 -0
- package/dist/chunk-QVUX6LLD.mjs +270 -0
- package/dist/chunk-QYRRQ65X.mjs +115 -0
- package/dist/chunk-SKO72K64.js +118 -0
- package/dist/chunk-T3VSSE2L.mjs +165 -0
- package/dist/chunk-TMBKCIVQ.mjs +148 -0
- package/dist/chunk-U2ZLDPOE.js +261 -0
- package/dist/chunk-U7SNLMJR.js +110 -0
- package/dist/chunk-UFHMEEGL.js +113 -0
- package/dist/chunk-UKFVRXAR.mjs +409 -0
- package/dist/chunk-UPTTGNMB.js +41 -0
- package/dist/chunk-V4KNORQN.js +21 -0
- package/dist/chunk-VAXIFFOT.js +83 -0
- package/dist/chunk-VGCVIHBR.mjs +1 -0
- package/dist/chunk-VXHM7V6F.mjs +92 -0
- package/dist/chunk-WDUTW7HS.mjs +87 -0
- package/dist/chunk-WJ7T7FAH.js +135 -0
- package/dist/chunk-WO3WHXDP.mjs +66 -0
- package/dist/chunk-X55EAYE2.js +94 -0
- package/dist/chunk-XMG3IVGZ.mjs +95 -0
- package/dist/chunk-XWS4SIB5.js +2 -0
- package/dist/chunk-XXWQ4RVP.js +25 -0
- package/dist/chunk-Y5I2GI4V.js +33 -0
- package/dist/chunk-YXDJPCAF.js +99 -0
- package/dist/chunk-ZVG2UKKC.mjs +603 -0
- package/dist/highlight-cursor/cursor-context.d.mts +7 -0
- package/dist/highlight-cursor/cursor-context.d.ts +7 -0
- package/dist/highlight-cursor/cursor-context.js +14 -0
- package/dist/highlight-cursor/cursor-context.mjs +1 -0
- package/dist/highlight-cursor/cursor-provider.d.mts +7 -0
- package/dist/highlight-cursor/cursor-provider.d.ts +7 -0
- package/dist/highlight-cursor/cursor-provider.js +12 -0
- package/dist/highlight-cursor/cursor-provider.mjs +3 -0
- package/dist/highlight-cursor/enhanced-components.d.mts +20 -0
- package/dist/highlight-cursor/enhanced-components.d.ts +20 -0
- package/dist/highlight-cursor/enhanced-components.js +37 -0
- package/dist/highlight-cursor/enhanced-components.mjs +12 -0
- package/dist/highlight-cursor/index.d.mts +16 -0
- package/dist/highlight-cursor/index.d.ts +16 -0
- package/dist/highlight-cursor/index.js +51 -0
- package/dist/highlight-cursor/index.mjs +14 -0
- package/dist/highlight-cursor/tabs-cursor-context.d.mts +14 -0
- package/dist/highlight-cursor/tabs-cursor-context.d.ts +14 -0
- package/dist/highlight-cursor/tabs-cursor-context.js +14 -0
- package/dist/highlight-cursor/tabs-cursor-context.mjs +1 -0
- package/dist/highlight-cursor/types.d.mts +39 -0
- package/dist/highlight-cursor/types.d.ts +39 -0
- package/dist/highlight-cursor/types.js +2 -0
- package/dist/highlight-cursor/types.mjs +1 -0
- package/dist/highlight-cursor/with-cursor.d.mts +7 -0
- package/dist/highlight-cursor/with-cursor.d.ts +7 -0
- package/dist/highlight-cursor/with-cursor.js +11 -0
- package/dist/highlight-cursor/with-cursor.mjs +2 -0
- package/dist/index.css +318 -0
- package/dist/index.d.mts +55 -0
- package/dist/index.d.ts +55 -0
- package/dist/index.js +131 -131
- package/dist/index.mjs +38 -0
- package/dist/styles/theme.css +192 -0
- package/dist/styles/theme.d.mts +2 -0
- package/dist/styles/theme.d.ts +2 -0
- package/dist/styles/toast.css +61 -0
- package/dist/styles/toast.d.mts +2 -0
- package/dist/styles/toast.d.ts +2 -0
- package/dist/styles/variables.css +188 -0
- package/dist/styles/variables.d.mts +2 -0
- package/dist/styles/variables.d.ts +2 -0
- package/dist/ui/avatar.d.mts +16 -0
- package/dist/ui/avatar.d.ts +16 -0
- package/dist/ui/avatar.js +25 -0
- package/dist/ui/avatar.mjs +4 -0
- package/dist/ui/badge.d.mts +14 -0
- package/dist/ui/badge.d.ts +14 -0
- package/dist/ui/badge.js +17 -0
- package/dist/ui/badge.mjs +4 -0
- package/dist/ui/button.d.mts +16 -0
- package/dist/ui/button.d.ts +16 -0
- package/dist/ui/button.js +13 -0
- package/dist/ui/button.mjs +4 -0
- package/dist/ui/card.d.mts +12 -0
- package/dist/ui/card.d.ts +12 -0
- package/dist/ui/card.js +37 -0
- package/dist/ui/card.mjs +4 -0
- package/dist/ui/checkbox.d.mts +11 -0
- package/dist/ui/checkbox.d.ts +11 -0
- package/dist/ui/checkbox.js +13 -0
- package/dist/ui/checkbox.mjs +4 -0
- package/dist/ui/collapsible.d.mts +9 -0
- package/dist/ui/collapsible.d.ts +9 -0
- package/dist/ui/collapsible.js +21 -0
- package/dist/ui/collapsible.mjs +4 -0
- package/dist/ui/dropdown.d.mts +28 -0
- package/dist/ui/dropdown.d.ts +28 -0
- package/dist/ui/dropdown.js +69 -0
- package/dist/ui/dropdown.mjs +4 -0
- package/dist/ui/index.d.mts +47 -0
- package/dist/ui/index.d.ts +47 -0
- package/dist/ui/index.js +414 -0
- package/dist/ui/index.mjs +33 -0
- package/dist/ui/input-numbers.d.mts +15 -0
- package/dist/ui/input-numbers.d.ts +15 -0
- package/dist/ui/input-numbers.js +14 -0
- package/dist/ui/input-numbers.mjs +5 -0
- package/dist/ui/input.d.mts +22 -0
- package/dist/ui/input.d.ts +22 -0
- package/dist/ui/input.js +17 -0
- package/dist/ui/input.mjs +4 -0
- package/dist/ui/layout.d.mts +12 -0
- package/dist/ui/layout.d.ts +12 -0
- package/dist/ui/layout.js +13 -0
- package/dist/ui/layout.mjs +4 -0
- package/dist/ui/modal.d.mts +28 -0
- package/dist/ui/modal.d.ts +28 -0
- package/dist/ui/modal.js +49 -0
- package/dist/ui/modal.mjs +4 -0
- package/dist/ui/popover.d.mts +10 -0
- package/dist/ui/popover.d.ts +10 -0
- package/dist/ui/popover.js +25 -0
- package/dist/ui/popover.mjs +4 -0
- package/dist/ui/radio-group.d.mts +8 -0
- package/dist/ui/radio-group.d.ts +8 -0
- package/dist/ui/radio-group.js +17 -0
- package/dist/ui/radio-group.mjs +4 -0
- package/dist/ui/select.d.mts +28 -0
- package/dist/ui/select.d.ts +28 -0
- package/dist/ui/select.js +49 -0
- package/dist/ui/select.mjs +4 -0
- package/dist/ui/sheet.d.mts +16 -0
- package/dist/ui/sheet.d.ts +16 -0
- package/dist/ui/sheet.js +39 -0
- package/dist/ui/sheet.mjs +2 -0
- package/dist/ui/slider.d.mts +10 -0
- package/dist/ui/slider.d.ts +10 -0
- package/dist/ui/slider.js +13 -0
- package/dist/ui/slider.mjs +4 -0
- package/dist/ui/switch.d.mts +7 -0
- package/dist/ui/switch.d.ts +7 -0
- package/dist/ui/switch.js +13 -0
- package/dist/ui/switch.mjs +4 -0
- package/dist/ui/tabs.d.mts +16 -0
- package/dist/ui/tabs.d.ts +16 -0
- package/dist/ui/tabs.js +26 -0
- package/dist/ui/tabs.mjs +5 -0
- package/dist/ui/textarea.d.mts +16 -0
- package/dist/ui/textarea.d.ts +16 -0
- package/dist/ui/textarea.js +13 -0
- package/dist/ui/textarea.mjs +4 -0
- package/dist/ui/theme-context.d.mts +17 -0
- package/dist/ui/theme-context.d.ts +17 -0
- package/dist/ui/theme-context.js +17 -0
- package/dist/ui/theme-context.mjs +4 -0
- package/dist/ui/timeline.d.mts +23 -0
- package/dist/ui/timeline.d.ts +23 -0
- package/dist/ui/timeline.js +15 -0
- package/dist/ui/timeline.mjs +6 -0
- package/dist/ui/toast.d.mts +7 -0
- package/dist/ui/toast.d.ts +7 -0
- package/dist/ui/toast.js +14 -0
- package/dist/ui/toast.mjs +1 -0
- package/dist/ui/toggle-group.d.mts +12 -0
- package/dist/ui/toggle-group.d.ts +12 -0
- package/dist/ui/toggle-group.js +18 -0
- package/dist/ui/toggle-group.mjs +5 -0
- package/dist/ui/toggle.d.mts +13 -0
- package/dist/ui/toggle.d.ts +13 -0
- package/dist/ui/toggle.js +17 -0
- package/dist/ui/toggle.mjs +4 -0
- package/dist/ui/tooltip.d.mts +10 -0
- package/dist/ui/tooltip.d.ts +10 -0
- package/dist/ui/tooltip.js +25 -0
- package/dist/ui/tooltip.mjs +4 -0
- package/dist/ui/tree-view-v2.d.mts +25 -0
- package/dist/ui/tree-view-v2.d.ts +25 -0
- package/dist/ui/tree-view-v2.js +14 -0
- package/dist/ui/tree-view-v2.mjs +5 -0
- package/dist/ui/tree-view.d.mts +28 -0
- package/dist/ui/tree-view.d.ts +28 -0
- package/dist/ui/tree-view.js +11 -0
- package/dist/ui/tree-view.mjs +2 -0
- package/dist/ui/version-badge.d.mts +26 -0
- package/dist/ui/version-badge.d.ts +26 -0
- package/dist/ui/version-badge.js +14 -0
- package/dist/ui/version-badge.mjs +5 -0
- package/dist/utils/cn.d.mts +5 -0
- package/dist/utils/cn.d.ts +5 -0
- package/dist/utils/cn.js +10 -0
- package/dist/utils/cn.mjs +1 -0
- package/dist/utils/index.d.mts +3 -0
- package/dist/utils/index.d.ts +3 -0
- package/dist/utils/index.js +16 -0
- package/dist/utils/index.mjs +3 -0
- package/dist/utils/use-local-storage.d.mts +3 -0
- package/dist/utils/use-local-storage.d.ts +3 -0
- package/dist/utils/use-local-storage.js +10 -0
- package/dist/utils/use-local-storage.mjs +1 -0
- package/package.json +3 -2
- package/src/ui/version-badge.tsx +5 -2
|
@@ -0,0 +1,341 @@
|
|
|
1
|
+
import { cn } from './chunk-KTNZSZ5Y.mjs';
|
|
2
|
+
import * as DropdownMenuPrimitive from '@radix-ui/react-dropdown-menu';
|
|
3
|
+
import { CheckIcon, CircleIcon, ChevronRightIcon } from 'lucide-react';
|
|
4
|
+
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
5
|
+
|
|
6
|
+
function DropdownMenu({ ...props }) {
|
|
7
|
+
return /* @__PURE__ */ jsx(DropdownMenuPrimitive.Root, { "data-slot": "dropdown-menu", ...props });
|
|
8
|
+
}
|
|
9
|
+
function DropdownMenuPortal({ ...props }) {
|
|
10
|
+
return /* @__PURE__ */ jsx(DropdownMenuPrimitive.Portal, { "data-slot": "dropdown-menu-portal", ...props });
|
|
11
|
+
}
|
|
12
|
+
function DropdownMenuTrigger({ ...props }) {
|
|
13
|
+
return /* @__PURE__ */ jsx(
|
|
14
|
+
DropdownMenuPrimitive.Trigger,
|
|
15
|
+
{
|
|
16
|
+
"data-slot": "dropdown-menu-trigger",
|
|
17
|
+
className: "text-text-primary hover:text-text-highlight disabled:text-text-tertiary active:text-text-secondary",
|
|
18
|
+
...props
|
|
19
|
+
}
|
|
20
|
+
);
|
|
21
|
+
}
|
|
22
|
+
function DropdownMenuContent({
|
|
23
|
+
className,
|
|
24
|
+
sideOffset = 4,
|
|
25
|
+
...props
|
|
26
|
+
}) {
|
|
27
|
+
return /* @__PURE__ */ jsx(DropdownMenuPrimitive.Portal, { children: /* @__PURE__ */ jsx(
|
|
28
|
+
DropdownMenuPrimitive.Content,
|
|
29
|
+
{
|
|
30
|
+
"data-slot": "dropdown-menu-content",
|
|
31
|
+
sideOffset,
|
|
32
|
+
className: cn(
|
|
33
|
+
[
|
|
34
|
+
"bg-bg-primary",
|
|
35
|
+
"p-md",
|
|
36
|
+
"data-[state=open]:animate-in",
|
|
37
|
+
"data-[state=closed]:animate-out",
|
|
38
|
+
"data-[state=closed]:fade-out-0",
|
|
39
|
+
"data-[state=open]:fade-in-0",
|
|
40
|
+
"data-[state=closed]:zoom-out-95",
|
|
41
|
+
"data-[state=open]:zoom-in-95",
|
|
42
|
+
"data-[side=bottom]:slide-in-from-top-2",
|
|
43
|
+
"data-[side=left]:slide-in-from-right-2",
|
|
44
|
+
"data-[side=right]:slide-in-from-left-2",
|
|
45
|
+
"data-[side=top]:slide-in-from-bottom-2",
|
|
46
|
+
"relative",
|
|
47
|
+
"z-50",
|
|
48
|
+
"max-h-(--radix-dropdown-menu-content-available-height)",
|
|
49
|
+
"min-w-[8rem]",
|
|
50
|
+
"origin-(--radix-dropdown-menu-content-transform-origin)",
|
|
51
|
+
"overflow-x-hidden",
|
|
52
|
+
"overflow-y-auto",
|
|
53
|
+
"rounded-uk-md",
|
|
54
|
+
"shadow-md",
|
|
55
|
+
"shadow-[0_8px_20px_0_rgba(0,0,0,.80)]",
|
|
56
|
+
"liquid:liquid-bg"
|
|
57
|
+
],
|
|
58
|
+
className
|
|
59
|
+
),
|
|
60
|
+
...props
|
|
61
|
+
}
|
|
62
|
+
) });
|
|
63
|
+
}
|
|
64
|
+
function DropdownMenuGroup({
|
|
65
|
+
className,
|
|
66
|
+
...props
|
|
67
|
+
}) {
|
|
68
|
+
return /* @__PURE__ */ jsx(
|
|
69
|
+
DropdownMenuPrimitive.Group,
|
|
70
|
+
{
|
|
71
|
+
"data-slot": "dropdown-menu-group",
|
|
72
|
+
className: cn("space-y-xs", className),
|
|
73
|
+
...props
|
|
74
|
+
}
|
|
75
|
+
);
|
|
76
|
+
}
|
|
77
|
+
function DropdownMenuItem({
|
|
78
|
+
className,
|
|
79
|
+
inset,
|
|
80
|
+
variant = "default",
|
|
81
|
+
...props
|
|
82
|
+
}) {
|
|
83
|
+
return /* @__PURE__ */ jsx(
|
|
84
|
+
DropdownMenuPrimitive.Item,
|
|
85
|
+
{
|
|
86
|
+
"data-slot": "dropdown-menu-item",
|
|
87
|
+
"data-inset": inset,
|
|
88
|
+
"data-variant": variant,
|
|
89
|
+
className: cn(
|
|
90
|
+
[
|
|
91
|
+
"w-full",
|
|
92
|
+
"flex",
|
|
93
|
+
"gap-md",
|
|
94
|
+
"items-center",
|
|
95
|
+
"pr-md",
|
|
96
|
+
"pl-[calc(var(--spacing-md)*2)]",
|
|
97
|
+
"py-xs",
|
|
98
|
+
"mb-xs",
|
|
99
|
+
"last:mb-0",
|
|
100
|
+
"relative",
|
|
101
|
+
"cursor-default",
|
|
102
|
+
"rounded-uk-xs",
|
|
103
|
+
"text-uk-xs",
|
|
104
|
+
"leading-uk-xs",
|
|
105
|
+
"outline-hidden",
|
|
106
|
+
"select-none",
|
|
107
|
+
"hover:bg-bg-tertiary",
|
|
108
|
+
"data-[disabled]:pointer-events-none",
|
|
109
|
+
"data-[disabled]:text-bg-quaternary",
|
|
110
|
+
"[&_svg]:pointer-events-none",
|
|
111
|
+
"[&_svg]:shrink-0",
|
|
112
|
+
"[&_svg:not([class*='size-'])]:size-4",
|
|
113
|
+
"[&_svg:not([class*='text-'])]:text-muted-foreground"
|
|
114
|
+
],
|
|
115
|
+
className
|
|
116
|
+
),
|
|
117
|
+
...props
|
|
118
|
+
}
|
|
119
|
+
);
|
|
120
|
+
}
|
|
121
|
+
function DropdownMenuCheckboxItem({
|
|
122
|
+
className,
|
|
123
|
+
children,
|
|
124
|
+
checked,
|
|
125
|
+
...props
|
|
126
|
+
}) {
|
|
127
|
+
return /* @__PURE__ */ jsxs(
|
|
128
|
+
DropdownMenuPrimitive.CheckboxItem,
|
|
129
|
+
{
|
|
130
|
+
"data-slot": "dropdown-menu-checkbox-item",
|
|
131
|
+
className: cn(
|
|
132
|
+
[
|
|
133
|
+
"w-full",
|
|
134
|
+
"flex",
|
|
135
|
+
"gap-md",
|
|
136
|
+
"items-center",
|
|
137
|
+
"pr-md",
|
|
138
|
+
"pl-[calc(var(--spacing-xl)*1.8)]",
|
|
139
|
+
"py-xs",
|
|
140
|
+
"mb-xs",
|
|
141
|
+
"last:mb-0",
|
|
142
|
+
"relative",
|
|
143
|
+
"cursor-default",
|
|
144
|
+
"rounded-uk-xs",
|
|
145
|
+
"text-uk-xs",
|
|
146
|
+
"leading-uk-xs",
|
|
147
|
+
"outline-hidden",
|
|
148
|
+
"select-none",
|
|
149
|
+
"hover:bg-bg-tertiary",
|
|
150
|
+
"data-[disabled]:pointer-events-none",
|
|
151
|
+
"data-[disabled]:text-bg-quaternary",
|
|
152
|
+
"[&_svg:not([class*='size-'])]:size-4",
|
|
153
|
+
"[&_svg]:pointer-events-none",
|
|
154
|
+
"[&_svg]:shrink-0"
|
|
155
|
+
],
|
|
156
|
+
className
|
|
157
|
+
),
|
|
158
|
+
checked,
|
|
159
|
+
...props,
|
|
160
|
+
children: [
|
|
161
|
+
/* @__PURE__ */ jsx("span", { className: "pointer-events-none absolute left-2 flex size-3.5 items-center justify-center", children: /* @__PURE__ */ jsx(DropdownMenuPrimitive.ItemIndicator, { children: /* @__PURE__ */ jsx(CheckIcon, { className: "size-4" }) }) }),
|
|
162
|
+
children
|
|
163
|
+
]
|
|
164
|
+
}
|
|
165
|
+
);
|
|
166
|
+
}
|
|
167
|
+
function DropdownMenuRadioGroup({
|
|
168
|
+
...props
|
|
169
|
+
}) {
|
|
170
|
+
return /* @__PURE__ */ jsx(DropdownMenuPrimitive.RadioGroup, { "data-slot": "dropdown-menu-radio-group", ...props });
|
|
171
|
+
}
|
|
172
|
+
function DropdownMenuRadioItem({
|
|
173
|
+
className,
|
|
174
|
+
children,
|
|
175
|
+
...props
|
|
176
|
+
}) {
|
|
177
|
+
return /* @__PURE__ */ jsxs(
|
|
178
|
+
DropdownMenuPrimitive.RadioItem,
|
|
179
|
+
{
|
|
180
|
+
"data-slot": "dropdown-menu-radio-item",
|
|
181
|
+
className: cn(
|
|
182
|
+
[
|
|
183
|
+
"w-full",
|
|
184
|
+
"hover:bg-bg-tertiary",
|
|
185
|
+
"outline-hidden",
|
|
186
|
+
"relative",
|
|
187
|
+
"flex",
|
|
188
|
+
"cursor-default",
|
|
189
|
+
"select-none",
|
|
190
|
+
"items-center",
|
|
191
|
+
"gap-md",
|
|
192
|
+
"rounded-uk-xs",
|
|
193
|
+
"py-xs",
|
|
194
|
+
"pl-[calc(var(--spacing-xl)*1.8)]",
|
|
195
|
+
"pr-md",
|
|
196
|
+
"mb-xs",
|
|
197
|
+
"last:mb-0",
|
|
198
|
+
"text-uk-xs",
|
|
199
|
+
"leading-uk-xs",
|
|
200
|
+
"data-[disabled]:pointer-events-none",
|
|
201
|
+
"data-[disabled]:text-bg-quaternary",
|
|
202
|
+
"[&_svg:not([class*='size-'])]:size-4",
|
|
203
|
+
"[&_svg]:pointer-events-none",
|
|
204
|
+
"[&_svg]:shrink-0"
|
|
205
|
+
],
|
|
206
|
+
className
|
|
207
|
+
),
|
|
208
|
+
...props,
|
|
209
|
+
children: [
|
|
210
|
+
/* @__PURE__ */ jsx("span", { className: "pointer-events-none absolute left-2 flex size-3.5 items-center justify-center", children: /* @__PURE__ */ jsx(DropdownMenuPrimitive.ItemIndicator, { children: /* @__PURE__ */ jsx(CircleIcon, { className: "size-2 fill-current" }) }) }),
|
|
211
|
+
children
|
|
212
|
+
]
|
|
213
|
+
}
|
|
214
|
+
);
|
|
215
|
+
}
|
|
216
|
+
function DropdownMenuLabel({
|
|
217
|
+
className,
|
|
218
|
+
inset,
|
|
219
|
+
...props
|
|
220
|
+
}) {
|
|
221
|
+
return /* @__PURE__ */ jsx(
|
|
222
|
+
DropdownMenuPrimitive.Label,
|
|
223
|
+
{
|
|
224
|
+
"data-slot": "dropdown-menu-label",
|
|
225
|
+
"data-inset": inset,
|
|
226
|
+
className: cn("text-text-secondary text-uk-xs leading-uk-xs px-2 py-1.5", className),
|
|
227
|
+
...props
|
|
228
|
+
}
|
|
229
|
+
);
|
|
230
|
+
}
|
|
231
|
+
function DropdownMenuSeparator({
|
|
232
|
+
className,
|
|
233
|
+
...props
|
|
234
|
+
}) {
|
|
235
|
+
return /* @__PURE__ */ jsx(
|
|
236
|
+
DropdownMenuPrimitive.Separator,
|
|
237
|
+
{
|
|
238
|
+
"data-slot": "dropdown-menu-separator",
|
|
239
|
+
className: cn("bg-line-primary my-lg pointer-events-none -mx-1 h-px", className),
|
|
240
|
+
...props
|
|
241
|
+
}
|
|
242
|
+
);
|
|
243
|
+
}
|
|
244
|
+
function DropdownMenuShortcut({ className, ...props }) {
|
|
245
|
+
return /* @__PURE__ */ jsx(
|
|
246
|
+
"span",
|
|
247
|
+
{
|
|
248
|
+
"data-slot": "dropdown-menu-shortcut",
|
|
249
|
+
className: cn("text-text-tertiary text-uk-xs leading-uk-xs ml-auto", className),
|
|
250
|
+
...props
|
|
251
|
+
}
|
|
252
|
+
);
|
|
253
|
+
}
|
|
254
|
+
function DropdownMenuSub({ ...props }) {
|
|
255
|
+
return /* @__PURE__ */ jsx(DropdownMenuPrimitive.Sub, { "data-slot": "dropdown-menu-sub", ...props });
|
|
256
|
+
}
|
|
257
|
+
function DropdownMenuSubTrigger({
|
|
258
|
+
className,
|
|
259
|
+
inset,
|
|
260
|
+
children,
|
|
261
|
+
...props
|
|
262
|
+
}) {
|
|
263
|
+
return /* @__PURE__ */ jsxs(
|
|
264
|
+
DropdownMenuPrimitive.SubTrigger,
|
|
265
|
+
{
|
|
266
|
+
"data-slot": "dropdown-menu-sub-trigger",
|
|
267
|
+
"data-inset": inset,
|
|
268
|
+
className: cn(
|
|
269
|
+
"w-full",
|
|
270
|
+
"flex",
|
|
271
|
+
"gap-md",
|
|
272
|
+
"items-center",
|
|
273
|
+
"pr-md",
|
|
274
|
+
"pl-[calc(var(--spacing-md)*2)]",
|
|
275
|
+
"py-xs",
|
|
276
|
+
"mb-xs",
|
|
277
|
+
"relative",
|
|
278
|
+
"cursor-default",
|
|
279
|
+
"rounded-uk-xs",
|
|
280
|
+
"text-uk-xs",
|
|
281
|
+
"leading-uk-xs",
|
|
282
|
+
"outline-hidden",
|
|
283
|
+
"select-none",
|
|
284
|
+
"hover:bg-bg-tertiary",
|
|
285
|
+
"data-[state=open]:bg-bg-tertiary",
|
|
286
|
+
"data-[disabled]:pointer-events-none",
|
|
287
|
+
"data-[disabled]:text-bg-quaternary",
|
|
288
|
+
"[&_svg]:pointer-events-none",
|
|
289
|
+
"[&_svg]:shrink-0",
|
|
290
|
+
"[&_svg:not([class*='size-'])]:size-4",
|
|
291
|
+
"[&_svg:not([class*='text-'])]:text-muted-foreground",
|
|
292
|
+
className
|
|
293
|
+
),
|
|
294
|
+
...props,
|
|
295
|
+
children: [
|
|
296
|
+
children,
|
|
297
|
+
/* @__PURE__ */ jsx(ChevronRightIcon, { className: "ml-auto size-4" })
|
|
298
|
+
]
|
|
299
|
+
}
|
|
300
|
+
);
|
|
301
|
+
}
|
|
302
|
+
function DropdownMenuSubContent({
|
|
303
|
+
className,
|
|
304
|
+
...props
|
|
305
|
+
}) {
|
|
306
|
+
return /* @__PURE__ */ jsx(
|
|
307
|
+
DropdownMenuPrimitive.SubContent,
|
|
308
|
+
{
|
|
309
|
+
"data-slot": "dropdown-menu-sub-content",
|
|
310
|
+
className: cn(
|
|
311
|
+
"bg-bg-primary",
|
|
312
|
+
"p-md",
|
|
313
|
+
"data-[state=open]:animate-in",
|
|
314
|
+
"data-[state=closed]:animate-out",
|
|
315
|
+
"data-[state=closed]:fade-out-0",
|
|
316
|
+
"data-[state=open]:fade-in-0",
|
|
317
|
+
"data-[state=closed]:zoom-out-95",
|
|
318
|
+
"data-[state=open]:zoom-in-95",
|
|
319
|
+
"data-[side=bottom]:slide-in-from-top-2",
|
|
320
|
+
"data-[side=left]:slide-in-from-right-2",
|
|
321
|
+
"data-[side=right]:slide-in-from-left-2",
|
|
322
|
+
"data-[side=top]:slide-in-from-bottom-2",
|
|
323
|
+
"relative",
|
|
324
|
+
"z-50",
|
|
325
|
+
"max-h-(--radix-dropdown-menu-content-available-height)",
|
|
326
|
+
"min-w-[8rem]",
|
|
327
|
+
"origin-(--radix-dropdown-menu-content-transform-origin)",
|
|
328
|
+
"overflow-x-hidden",
|
|
329
|
+
"overflow-y-auto",
|
|
330
|
+
"rounded-uk-md",
|
|
331
|
+
"shadow-md",
|
|
332
|
+
"shadow-[0_8px_20px_0_rgba(0,0,0,.80)]",
|
|
333
|
+
"liquid:liquid-bg",
|
|
334
|
+
className
|
|
335
|
+
),
|
|
336
|
+
...props
|
|
337
|
+
}
|
|
338
|
+
);
|
|
339
|
+
}
|
|
340
|
+
|
|
341
|
+
export { DropdownMenu, DropdownMenuCheckboxItem, DropdownMenuContent, DropdownMenuGroup, DropdownMenuItem, DropdownMenuLabel, DropdownMenuPortal, DropdownMenuRadioGroup, DropdownMenuRadioItem, DropdownMenuSeparator, DropdownMenuShortcut, DropdownMenuSub, DropdownMenuSubContent, DropdownMenuSubTrigger, DropdownMenuTrigger };
|
|
@@ -0,0 +1,259 @@
|
|
|
1
|
+
import { TooltipProvider, Tooltip, TooltipTrigger, TooltipContent } from './chunk-JMPVDU2C.mjs';
|
|
2
|
+
import { cn } from './chunk-KTNZSZ5Y.mjs';
|
|
3
|
+
import { Search, CaseSensitive, Regex, ChevronDown } from 'lucide-react';
|
|
4
|
+
import { useState, useMemo, useEffect } from 'react';
|
|
5
|
+
import { jsxs, jsx, Fragment } from 'react/jsx-runtime';
|
|
6
|
+
|
|
7
|
+
function TreeView({
|
|
8
|
+
data,
|
|
9
|
+
getIcon,
|
|
10
|
+
onVisibleDataChange,
|
|
11
|
+
onItemHover,
|
|
12
|
+
className,
|
|
13
|
+
hoveredId
|
|
14
|
+
}) {
|
|
15
|
+
const [expandedItems, setExpandedItems] = useState(() => {
|
|
16
|
+
const initial = /* @__PURE__ */ new Set();
|
|
17
|
+
data.forEach((item) => {
|
|
18
|
+
if (item.isCollapsible) initial.add(item.id);
|
|
19
|
+
});
|
|
20
|
+
return initial;
|
|
21
|
+
});
|
|
22
|
+
const [searchQuery, setSearchQuery] = useState("");
|
|
23
|
+
const [isCaseSensitive, setIsCaseSensitive] = useState(false);
|
|
24
|
+
const [isRegex, setIsRegex] = useState(false);
|
|
25
|
+
const [isRegexValid, setIsRegexValid] = useState(true);
|
|
26
|
+
const toggleItem = (id) => {
|
|
27
|
+
setExpandedItems((prev) => {
|
|
28
|
+
const newSet = new Set(prev);
|
|
29
|
+
if (newSet.has(id)) {
|
|
30
|
+
newSet.delete(id);
|
|
31
|
+
} else {
|
|
32
|
+
newSet.add(id);
|
|
33
|
+
}
|
|
34
|
+
return newSet;
|
|
35
|
+
});
|
|
36
|
+
};
|
|
37
|
+
const childrenMap = useMemo(() => {
|
|
38
|
+
const map = /* @__PURE__ */ new Map();
|
|
39
|
+
data.forEach((item) => {
|
|
40
|
+
if (!map.has(item.parentId)) {
|
|
41
|
+
map.set(item.parentId, []);
|
|
42
|
+
}
|
|
43
|
+
map.get(item.parentId).push(item);
|
|
44
|
+
});
|
|
45
|
+
return map;
|
|
46
|
+
}, [data]);
|
|
47
|
+
const dataWithMeta = useMemo(() => {
|
|
48
|
+
const dataMap = new Map(data.map((item) => [item.id, item]));
|
|
49
|
+
const getAncestors = (item) => {
|
|
50
|
+
const ancestors = [];
|
|
51
|
+
let current = item.parentId;
|
|
52
|
+
while (current) {
|
|
53
|
+
const parent = dataMap.get(current);
|
|
54
|
+
if (parent) {
|
|
55
|
+
ancestors.unshift(parent);
|
|
56
|
+
current = parent.parentId;
|
|
57
|
+
} else {
|
|
58
|
+
break;
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
return ancestors;
|
|
62
|
+
};
|
|
63
|
+
return data.map((item) => {
|
|
64
|
+
const siblings = childrenMap.get(item.parentId) || [];
|
|
65
|
+
const isLast = siblings.length > 0 && siblings[siblings.length - 1].id === item.id;
|
|
66
|
+
const ancestors = getAncestors(item);
|
|
67
|
+
const indent = ancestors.length;
|
|
68
|
+
return { ...item, indent, isLast, ancestors };
|
|
69
|
+
});
|
|
70
|
+
}, [data, childrenMap]);
|
|
71
|
+
const visibleData = useMemo(() => {
|
|
72
|
+
const dataMap = new Map(data.map((item) => [item.id, item]));
|
|
73
|
+
if (!searchQuery) {
|
|
74
|
+
const isVisible = (item) => {
|
|
75
|
+
return item.ancestors.every((ancestor) => expandedItems.has(ancestor.id));
|
|
76
|
+
};
|
|
77
|
+
return dataWithMeta.filter(isVisible);
|
|
78
|
+
}
|
|
79
|
+
const matchingAndAncestorIds = /* @__PURE__ */ new Set();
|
|
80
|
+
let regex = null;
|
|
81
|
+
if (isRegex) {
|
|
82
|
+
try {
|
|
83
|
+
regex = new RegExp(searchQuery, isCaseSensitive ? "" : "i");
|
|
84
|
+
if (!isRegexValid) setIsRegexValid(true);
|
|
85
|
+
} catch {
|
|
86
|
+
if (isRegexValid) setIsRegexValid(false);
|
|
87
|
+
return [];
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
data.forEach((item) => {
|
|
91
|
+
let labelMatches = false;
|
|
92
|
+
if (regex) {
|
|
93
|
+
labelMatches = regex.test(item.label);
|
|
94
|
+
} else {
|
|
95
|
+
const source = isCaseSensitive ? item.label : item.label.toLowerCase();
|
|
96
|
+
const query = isCaseSensitive ? searchQuery : searchQuery.toLowerCase();
|
|
97
|
+
labelMatches = source.includes(query);
|
|
98
|
+
}
|
|
99
|
+
if (labelMatches) {
|
|
100
|
+
matchingAndAncestorIds.add(item.id);
|
|
101
|
+
let current = item.parentId;
|
|
102
|
+
while (current) {
|
|
103
|
+
const parent = dataMap.get(current);
|
|
104
|
+
if (parent) {
|
|
105
|
+
matchingAndAncestorIds.add(parent.id);
|
|
106
|
+
current = parent.parentId;
|
|
107
|
+
} else {
|
|
108
|
+
break;
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
});
|
|
113
|
+
return dataWithMeta.filter((item) => matchingAndAncestorIds.has(item.id));
|
|
114
|
+
}, [searchQuery, dataWithMeta, expandedItems, isCaseSensitive, isRegex, isRegexValid, data]);
|
|
115
|
+
useEffect(() => {
|
|
116
|
+
onVisibleDataChange == null ? void 0 : onVisibleDataChange(visibleData);
|
|
117
|
+
}, [visibleData, onVisibleDataChange]);
|
|
118
|
+
const renderLabel = (label) => {
|
|
119
|
+
if (!searchQuery || !isRegexValid) {
|
|
120
|
+
return label;
|
|
121
|
+
}
|
|
122
|
+
let regex;
|
|
123
|
+
try {
|
|
124
|
+
regex = new RegExp(`(${searchQuery})`, isCaseSensitive ? "g" : "gi");
|
|
125
|
+
} catch {
|
|
126
|
+
return label;
|
|
127
|
+
}
|
|
128
|
+
const parts = label.split(regex);
|
|
129
|
+
return /* @__PURE__ */ jsx(Fragment, { children: parts.map(
|
|
130
|
+
(part, i) => i % 2 === 1 ? /* @__PURE__ */ jsx("span", { className: "rounded-uk-xs bg-yellow-300 dark:bg-yellow-700", children: part }, i) : part
|
|
131
|
+
) });
|
|
132
|
+
};
|
|
133
|
+
return /* @__PURE__ */ jsxs("div", { className: cn("border-line-secondary/20 flex flex-col", className), children: [
|
|
134
|
+
/* @__PURE__ */ jsxs("div", { className: "border-line-secondary/20 flex h-[32px] shrink-0 items-center gap-1 border-b px-2", children: [
|
|
135
|
+
/* @__PURE__ */ jsx(Search, { className: "text-text-secondary size-4" }),
|
|
136
|
+
/* @__PURE__ */ jsx(
|
|
137
|
+
"input",
|
|
138
|
+
{
|
|
139
|
+
type: "text",
|
|
140
|
+
placeholder: "Search...",
|
|
141
|
+
className: cn(
|
|
142
|
+
"text-uk-md w-full bg-transparent focus:outline-none",
|
|
143
|
+
!isRegexValid && "text-red-500"
|
|
144
|
+
),
|
|
145
|
+
value: searchQuery,
|
|
146
|
+
onChange: (e) => setSearchQuery(e.target.value)
|
|
147
|
+
}
|
|
148
|
+
),
|
|
149
|
+
/* @__PURE__ */ jsxs(TooltipProvider, { delayDuration: 200, children: [
|
|
150
|
+
/* @__PURE__ */ jsxs(Tooltip, { children: [
|
|
151
|
+
/* @__PURE__ */ jsx(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsx(
|
|
152
|
+
"button",
|
|
153
|
+
{
|
|
154
|
+
onClick: () => setIsCaseSensitive((prev) => !prev),
|
|
155
|
+
className: cn("rounded-uk-sm p-1", isCaseSensitive && "bg-bg-tertiary"),
|
|
156
|
+
children: /* @__PURE__ */ jsx(CaseSensitive, { className: "size-4" })
|
|
157
|
+
}
|
|
158
|
+
) }),
|
|
159
|
+
/* @__PURE__ */ jsx(TooltipContent, { children: /* @__PURE__ */ jsx("p", { children: "Case Sensitive" }) })
|
|
160
|
+
] }),
|
|
161
|
+
/* @__PURE__ */ jsxs(Tooltip, { children: [
|
|
162
|
+
/* @__PURE__ */ jsx(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsx(
|
|
163
|
+
"button",
|
|
164
|
+
{
|
|
165
|
+
onClick: () => setIsRegex((prev) => !prev),
|
|
166
|
+
className: cn("rounded-uk-sm p-1", isRegex && "bg-bg-tertiary"),
|
|
167
|
+
children: /* @__PURE__ */ jsx(Regex, { className: "size-4" })
|
|
168
|
+
}
|
|
169
|
+
) }),
|
|
170
|
+
/* @__PURE__ */ jsx(TooltipContent, { children: /* @__PURE__ */ jsx("p", { children: "Use Regular Expression" }) })
|
|
171
|
+
] })
|
|
172
|
+
] })
|
|
173
|
+
] }),
|
|
174
|
+
/* @__PURE__ */ jsx("div", { className: "overflow-y-auto", children: visibleData.map((item) => /* @__PURE__ */ jsxs(
|
|
175
|
+
"div",
|
|
176
|
+
{
|
|
177
|
+
className: cn(
|
|
178
|
+
"group relative flex h-[32px] cursor-pointer items-center",
|
|
179
|
+
hoveredId === item.id && "bg-bg-secondary/80"
|
|
180
|
+
),
|
|
181
|
+
onMouseEnter: () => onItemHover == null ? void 0 : onItemHover(item.id),
|
|
182
|
+
onMouseLeave: () => onItemHover == null ? void 0 : onItemHover(null),
|
|
183
|
+
children: [
|
|
184
|
+
/* @__PURE__ */ jsxs("div", { className: "absolute top-0 left-[-0.28rem] z-0 flex h-full items-center", children: [
|
|
185
|
+
item.ancestors.map((ancestor, index) => {
|
|
186
|
+
var _a;
|
|
187
|
+
const parentIsLast = (_a = dataWithMeta.find((d) => d.id === ancestor.id)) == null ? void 0 : _a.isLast;
|
|
188
|
+
return /* @__PURE__ */ jsx(
|
|
189
|
+
"div",
|
|
190
|
+
{
|
|
191
|
+
className: cn(
|
|
192
|
+
"h-full w-[1.25rem]",
|
|
193
|
+
parentIsLast ? "" : "border-l",
|
|
194
|
+
"border-line-secondary/20"
|
|
195
|
+
)
|
|
196
|
+
},
|
|
197
|
+
index
|
|
198
|
+
);
|
|
199
|
+
}),
|
|
200
|
+
item.indent > 0 && /* @__PURE__ */ jsxs("div", { className: "relative h-full w-[1.24rem]", children: [
|
|
201
|
+
/* @__PURE__ */ jsx(
|
|
202
|
+
"div",
|
|
203
|
+
{
|
|
204
|
+
className: cn(
|
|
205
|
+
"absolute top-0 left-0 h-1/2 w-1/2 border-b border-l",
|
|
206
|
+
item.isLast ? "rounded-bl-md" : "",
|
|
207
|
+
"border-line-secondary/20"
|
|
208
|
+
)
|
|
209
|
+
}
|
|
210
|
+
),
|
|
211
|
+
!item.isLast && /* @__PURE__ */ jsx("div", { className: "border-line-secondary/20 absolute top-1/2 left-0 h-1/2 w-1/2 border-l" })
|
|
212
|
+
] })
|
|
213
|
+
] }),
|
|
214
|
+
/* @__PURE__ */ jsxs(
|
|
215
|
+
"div",
|
|
216
|
+
{
|
|
217
|
+
className: "text-uk-md z-10 flex w-full items-center gap-2 px-2 whitespace-nowrap",
|
|
218
|
+
style: { paddingLeft: `${item.indent * 1.25 + 0.5}rem` },
|
|
219
|
+
children: [
|
|
220
|
+
/* @__PURE__ */ jsxs("div", { className: "relative flex size-4 items-center justify-center", children: [
|
|
221
|
+
item.isCollapsible && /* @__PURE__ */ jsx(
|
|
222
|
+
"button",
|
|
223
|
+
{
|
|
224
|
+
onClick: () => toggleItem(item.id),
|
|
225
|
+
className: "absolute z-20 flex items-center justify-center opacity-0 transition-opacity group-hover:opacity-100",
|
|
226
|
+
children: /* @__PURE__ */ jsx(
|
|
227
|
+
ChevronDown,
|
|
228
|
+
{
|
|
229
|
+
className: cn(
|
|
230
|
+
"size-4 transition-transform",
|
|
231
|
+
!expandedItems.has(item.id) && "-rotate-90"
|
|
232
|
+
)
|
|
233
|
+
}
|
|
234
|
+
)
|
|
235
|
+
}
|
|
236
|
+
),
|
|
237
|
+
/* @__PURE__ */ jsx(
|
|
238
|
+
"div",
|
|
239
|
+
{
|
|
240
|
+
className: cn(
|
|
241
|
+
"transition-opacity",
|
|
242
|
+
item.isCollapsible && "group-hover:opacity-0"
|
|
243
|
+
),
|
|
244
|
+
children: getIcon(item)
|
|
245
|
+
}
|
|
246
|
+
)
|
|
247
|
+
] }),
|
|
248
|
+
/* @__PURE__ */ jsx("span", { className: "truncate", children: renderLabel(item.label) })
|
|
249
|
+
]
|
|
250
|
+
}
|
|
251
|
+
)
|
|
252
|
+
]
|
|
253
|
+
},
|
|
254
|
+
item.id
|
|
255
|
+
)) })
|
|
256
|
+
] });
|
|
257
|
+
}
|
|
258
|
+
|
|
259
|
+
export { TreeView };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
import { cn } from './chunk-KTNZSZ5Y.mjs';
|
|
2
|
+
import * as AvatarPrimitive from '@radix-ui/react-avatar';
|
|
3
|
+
import React from 'react';
|
|
4
|
+
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
5
|
+
|
|
6
|
+
function Avatar({ className, ...props }) {
|
|
7
|
+
return /* @__PURE__ */ jsx(
|
|
8
|
+
AvatarPrimitive.Root,
|
|
9
|
+
{
|
|
10
|
+
"data-slot": "avatar",
|
|
11
|
+
className: cn("relative flex size-[24px] shrink-0 overflow-hidden rounded-full", className),
|
|
12
|
+
...props
|
|
13
|
+
}
|
|
14
|
+
);
|
|
15
|
+
}
|
|
16
|
+
function AvatarImage({ className, ...props }) {
|
|
17
|
+
return /* @__PURE__ */ jsx(
|
|
18
|
+
AvatarPrimitive.Image,
|
|
19
|
+
{
|
|
20
|
+
"data-slot": "avatar-image",
|
|
21
|
+
className: cn("aspect-square size-full", className),
|
|
22
|
+
...props
|
|
23
|
+
}
|
|
24
|
+
);
|
|
25
|
+
}
|
|
26
|
+
function AvatarFallback({ className, ...props }) {
|
|
27
|
+
return /* @__PURE__ */ jsx(
|
|
28
|
+
AvatarPrimitive.Fallback,
|
|
29
|
+
{
|
|
30
|
+
"data-slot": "avatar-fallback",
|
|
31
|
+
className: cn(
|
|
32
|
+
"bg-bg-tertiary flex size-full items-center justify-center rounded-full",
|
|
33
|
+
className
|
|
34
|
+
),
|
|
35
|
+
...props
|
|
36
|
+
}
|
|
37
|
+
);
|
|
38
|
+
}
|
|
39
|
+
function AvatarGroup({ children, className, spacing = "normal", max }) {
|
|
40
|
+
const spacingClasses = {
|
|
41
|
+
tight: "-space-x-1.5",
|
|
42
|
+
normal: "-space-x-1",
|
|
43
|
+
loose: "-space-x-0.45"
|
|
44
|
+
};
|
|
45
|
+
const childrenArray = React.Children.toArray(children);
|
|
46
|
+
const displayChildren = max ? childrenArray.slice(0, max) : childrenArray;
|
|
47
|
+
const remainingCount = max && childrenArray.length > max ? childrenArray.length - max : 0;
|
|
48
|
+
return /* @__PURE__ */ jsxs("div", { className: cn("flex", spacingClasses[spacing], className), children: [
|
|
49
|
+
displayChildren.map((child, index) => {
|
|
50
|
+
var _a;
|
|
51
|
+
const zIndex = 30 - index;
|
|
52
|
+
if (React.isValidElement(child)) {
|
|
53
|
+
return React.cloneElement(
|
|
54
|
+
child,
|
|
55
|
+
{
|
|
56
|
+
key: index,
|
|
57
|
+
className: cn(
|
|
58
|
+
`ring-background relative ring-2 z-[${zIndex}] transition-all duration-200 ease-in-out hover:z-[100] hover:scale-120`,
|
|
59
|
+
(_a = child.props) == null ? void 0 : _a.className
|
|
60
|
+
)
|
|
61
|
+
}
|
|
62
|
+
);
|
|
63
|
+
}
|
|
64
|
+
return child;
|
|
65
|
+
}),
|
|
66
|
+
remainingCount > 0 && /* @__PURE__ */ jsx(
|
|
67
|
+
Avatar,
|
|
68
|
+
{
|
|
69
|
+
className: cn(
|
|
70
|
+
"ring-background relative cursor-default ring-2 transition-all duration-200 ease-in-out hover:z-[100] hover:scale-120",
|
|
71
|
+
`z-[${30 - displayChildren.length}]`
|
|
72
|
+
),
|
|
73
|
+
children: /* @__PURE__ */ jsxs(AvatarFallback, { children: [
|
|
74
|
+
"+",
|
|
75
|
+
remainingCount
|
|
76
|
+
] })
|
|
77
|
+
}
|
|
78
|
+
)
|
|
79
|
+
] });
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
export { Avatar, AvatarFallback, AvatarGroup, AvatarImage };
|