@mdigital_ui/ui 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +296 -0
- package/dist/accordion/index.js +5 -0
- package/dist/accordion/index.js.map +1 -0
- package/dist/badge/index.js +5 -0
- package/dist/badge/index.js.map +1 -0
- package/dist/button/index.js +6 -0
- package/dist/button/index.js.map +1 -0
- package/dist/card/index.js +4 -0
- package/dist/card/index.js.map +1 -0
- package/dist/carousel/index.js +3 -0
- package/dist/carousel/index.js.map +1 -0
- package/dist/cascader/index.js +4 -0
- package/dist/cascader/index.js.map +1 -0
- package/dist/chart/index.js +4 -0
- package/dist/chart/index.js.map +1 -0
- package/dist/checkbox/index.js +5 -0
- package/dist/checkbox/index.js.map +1 -0
- package/dist/checkbox-group/index.js +4 -0
- package/dist/checkbox-group/index.js.map +1 -0
- package/dist/chunk-2JGAYDZR.js +181 -0
- package/dist/chunk-2JGAYDZR.js.map +1 -0
- package/dist/chunk-3PFA3YG6.js +228 -0
- package/dist/chunk-3PFA3YG6.js.map +1 -0
- package/dist/chunk-4OMLQCUV.js +96 -0
- package/dist/chunk-4OMLQCUV.js.map +1 -0
- package/dist/chunk-4P5EMRFI.js +298 -0
- package/dist/chunk-4P5EMRFI.js.map +1 -0
- package/dist/chunk-5UEWVFF6.js +212 -0
- package/dist/chunk-5UEWVFF6.js.map +1 -0
- package/dist/chunk-5VCGW53O.js +332 -0
- package/dist/chunk-5VCGW53O.js.map +1 -0
- package/dist/chunk-75XESYGN.js +49 -0
- package/dist/chunk-75XESYGN.js.map +1 -0
- package/dist/chunk-7AEGBABZ.js +1102 -0
- package/dist/chunk-7AEGBABZ.js.map +1 -0
- package/dist/chunk-AOITJRSV.js +134 -0
- package/dist/chunk-AOITJRSV.js.map +1 -0
- package/dist/chunk-AWPKZYHT.js +152 -0
- package/dist/chunk-AWPKZYHT.js.map +1 -0
- package/dist/chunk-BNILRB4T.js +37 -0
- package/dist/chunk-BNILRB4T.js.map +1 -0
- package/dist/chunk-BP434VYV.js +448 -0
- package/dist/chunk-BP434VYV.js.map +1 -0
- package/dist/chunk-C7SXY3ZV.js +65 -0
- package/dist/chunk-C7SXY3ZV.js.map +1 -0
- package/dist/chunk-CLLQDCDR.js +560 -0
- package/dist/chunk-CLLQDCDR.js.map +1 -0
- package/dist/chunk-CWHFK7ZC.js +128 -0
- package/dist/chunk-CWHFK7ZC.js.map +1 -0
- package/dist/chunk-D3JWPGCA.js +123 -0
- package/dist/chunk-D3JWPGCA.js.map +1 -0
- package/dist/chunk-DOKTHDG3.js +55 -0
- package/dist/chunk-DOKTHDG3.js.map +1 -0
- package/dist/chunk-DPOSWW22.js +126 -0
- package/dist/chunk-DPOSWW22.js.map +1 -0
- package/dist/chunk-E2CYDDYC.js +39 -0
- package/dist/chunk-E2CYDDYC.js.map +1 -0
- package/dist/chunk-EYTOKUBM.js +401 -0
- package/dist/chunk-EYTOKUBM.js.map +1 -0
- package/dist/chunk-FGWSUPVW.js +356 -0
- package/dist/chunk-FGWSUPVW.js.map +1 -0
- package/dist/chunk-FPOXTCYV.js +166 -0
- package/dist/chunk-FPOXTCYV.js.map +1 -0
- package/dist/chunk-FTJOSVTY.js +104 -0
- package/dist/chunk-FTJOSVTY.js.map +1 -0
- package/dist/chunk-FYHQDFKE.js +164 -0
- package/dist/chunk-FYHQDFKE.js.map +1 -0
- package/dist/chunk-H2HIBD5Y.js +158 -0
- package/dist/chunk-H2HIBD5Y.js.map +1 -0
- package/dist/chunk-J3G5WWGR.js +53 -0
- package/dist/chunk-J3G5WWGR.js.map +1 -0
- package/dist/chunk-JZCHZ4B3.js +487 -0
- package/dist/chunk-JZCHZ4B3.js.map +1 -0
- package/dist/chunk-KBCBVH7B.js +51 -0
- package/dist/chunk-KBCBVH7B.js.map +1 -0
- package/dist/chunk-KNQ7UQ2W.js +143 -0
- package/dist/chunk-KNQ7UQ2W.js.map +1 -0
- package/dist/chunk-KTBPIEP2.js +102 -0
- package/dist/chunk-KTBPIEP2.js.map +1 -0
- package/dist/chunk-L3SP7GHC.js +1023 -0
- package/dist/chunk-L3SP7GHC.js.map +1 -0
- package/dist/chunk-LBJG2UWT.js +100 -0
- package/dist/chunk-LBJG2UWT.js.map +1 -0
- package/dist/chunk-MLDX3Z67.js +470 -0
- package/dist/chunk-MLDX3Z67.js.map +1 -0
- package/dist/chunk-NNSS366W.js +331 -0
- package/dist/chunk-NNSS366W.js.map +1 -0
- package/dist/chunk-OQANRZPV.js +197 -0
- package/dist/chunk-OQANRZPV.js.map +1 -0
- package/dist/chunk-OW5A5IIF.js +175 -0
- package/dist/chunk-OW5A5IIF.js.map +1 -0
- package/dist/chunk-R225A5II.js +187 -0
- package/dist/chunk-R225A5II.js.map +1 -0
- package/dist/chunk-ROR4E6IE.js +119 -0
- package/dist/chunk-ROR4E6IE.js.map +1 -0
- package/dist/chunk-RPAQAZTI.js +54 -0
- package/dist/chunk-RPAQAZTI.js.map +1 -0
- package/dist/chunk-RQBXZKTH.js +452 -0
- package/dist/chunk-RQBXZKTH.js.map +1 -0
- package/dist/chunk-S5XJXU52.js +178 -0
- package/dist/chunk-S5XJXU52.js.map +1 -0
- package/dist/chunk-SAVE5ACL.js +324 -0
- package/dist/chunk-SAVE5ACL.js.map +1 -0
- package/dist/chunk-SERJ3TZE.js +640 -0
- package/dist/chunk-SERJ3TZE.js.map +1 -0
- package/dist/chunk-SK5ECBBK.js +175 -0
- package/dist/chunk-SK5ECBBK.js.map +1 -0
- package/dist/chunk-SOV4PE3P.js +218 -0
- package/dist/chunk-SOV4PE3P.js.map +1 -0
- package/dist/chunk-W7BQYIXF.js +687 -0
- package/dist/chunk-W7BQYIXF.js.map +1 -0
- package/dist/chunk-XMAH5PDW.js +59 -0
- package/dist/chunk-XMAH5PDW.js.map +1 -0
- package/dist/chunk-XOBGEMQY.js +94 -0
- package/dist/chunk-XOBGEMQY.js.map +1 -0
- package/dist/chunk-YNNAOXU5.js +57 -0
- package/dist/chunk-YNNAOXU5.js.map +1 -0
- package/dist/chunk-YZVSDRJD.js +253 -0
- package/dist/chunk-YZVSDRJD.js.map +1 -0
- package/dist/collapse/index.js +4 -0
- package/dist/collapse/index.js.map +1 -0
- package/dist/command/index.js +5 -0
- package/dist/command/index.js.map +1 -0
- package/dist/date-picker/index.js +5 -0
- package/dist/date-picker/index.js.map +1 -0
- package/dist/descriptions/index.js +4 -0
- package/dist/descriptions/index.js.map +1 -0
- package/dist/drawer/index.js +4 -0
- package/dist/drawer/index.js.map +1 -0
- package/dist/dropdown/index.js +5 -0
- package/dist/dropdown/index.js.map +1 -0
- package/dist/empty/index.js +4 -0
- package/dist/empty/index.js.map +1 -0
- package/dist/fetching-overlay/index.js +5 -0
- package/dist/fetching-overlay/index.js.map +1 -0
- package/dist/image/index.js +4 -0
- package/dist/image/index.js.map +1 -0
- package/dist/index.d.ts +2672 -0
- package/dist/index.js +976 -0
- package/dist/index.js.map +1 -0
- package/dist/input/index.js +5 -0
- package/dist/input/index.js.map +1 -0
- package/dist/input-group/index.js +4 -0
- package/dist/input-group/index.js.map +1 -0
- package/dist/input-otp/index.js +4 -0
- package/dist/input-otp/index.js.map +1 -0
- package/dist/input-password/index.js +6 -0
- package/dist/input-password/index.js.map +1 -0
- package/dist/kbd/index.js +4 -0
- package/dist/kbd/index.js.map +1 -0
- package/dist/modal/index.js +4 -0
- package/dist/modal/index.js.map +1 -0
- package/dist/multi-select/index.js +5 -0
- package/dist/multi-select/index.js.map +1 -0
- package/dist/notification/index.js +4 -0
- package/dist/notification/index.js.map +1 -0
- package/dist/pagination/index.js +4 -0
- package/dist/pagination/index.js.map +1 -0
- package/dist/popover/index.js +4 -0
- package/dist/popover/index.js.map +1 -0
- package/dist/progress/index.js +4 -0
- package/dist/progress/index.js.map +1 -0
- package/dist/radio/index.js +4 -0
- package/dist/radio/index.js.map +1 -0
- package/dist/radio-group/index.js +4 -0
- package/dist/radio-group/index.js.map +1 -0
- package/dist/rating/index.js +4 -0
- package/dist/rating/index.js.map +1 -0
- package/dist/ribbon/index.js +4 -0
- package/dist/ribbon/index.js.map +1 -0
- package/dist/select/index.js +6 -0
- package/dist/select/index.js.map +1 -0
- package/dist/skeleton/index.js +4 -0
- package/dist/skeleton/index.js.map +1 -0
- package/dist/slider/index.js +4 -0
- package/dist/slider/index.js.map +1 -0
- package/dist/spinner/index.js +4 -0
- package/dist/spinner/index.js.map +1 -0
- package/dist/stepper/index.js +4 -0
- package/dist/stepper/index.js.map +1 -0
- package/dist/styles/base.css +161 -0
- package/dist/styles/global.css +633 -0
- package/dist/styles/themes/dark.css +84 -0
- package/dist/styles/themes/light.css +84 -0
- package/dist/switch/index.js +4 -0
- package/dist/switch/index.js.map +1 -0
- package/dist/table/index.js +12 -0
- package/dist/table/index.js.map +1 -0
- package/dist/tabs/index.js +5 -0
- package/dist/tabs/index.js.map +1 -0
- package/dist/textarea/index.js +4 -0
- package/dist/textarea/index.js.map +1 -0
- package/dist/toggle/index.js +4 -0
- package/dist/toggle/index.js.map +1 -0
- package/dist/toggle-group/index.js +4 -0
- package/dist/toggle-group/index.js.map +1 -0
- package/dist/tooltip/index.js +4 -0
- package/dist/tooltip/index.js.map +1 -0
- package/dist/transfer/index.js +6 -0
- package/dist/transfer/index.js.map +1 -0
- package/dist/tree/index.js +4 -0
- package/dist/tree/index.js.map +1 -0
- package/dist/tree-select/index.js +6 -0
- package/dist/tree-select/index.js.map +1 -0
- package/package.json +107 -0
package/dist/index.js
ADDED
|
@@ -0,0 +1,976 @@
|
|
|
1
|
+
export { Transfer } from './chunk-EYTOKUBM.js';
|
|
2
|
+
export { tabs_default as Tabs } from './chunk-OW5A5IIF.js';
|
|
3
|
+
export { table_default as Table } from './chunk-L3SP7GHC.js';
|
|
4
|
+
export { textarea_default as Textarea } from './chunk-FPOXTCYV.js';
|
|
5
|
+
export { toggle_default as Toggle } from './chunk-DPOSWW22.js';
|
|
6
|
+
export { tooltip_default as Tooltip } from './chunk-D3JWPGCA.js';
|
|
7
|
+
export { toggle_group_default as ToggleGroup } from './chunk-SK5ECBBK.js';
|
|
8
|
+
export { tree_select_default as TreeSelect } from './chunk-JZCHZ4B3.js';
|
|
9
|
+
export { tree_default as Tree } from './chunk-SAVE5ACL.js';
|
|
10
|
+
export { radio_default as Radio } from './chunk-KTBPIEP2.js';
|
|
11
|
+
export { ribbon_default as Ribbon } from './chunk-C7SXY3ZV.js';
|
|
12
|
+
export { select_default as Select } from './chunk-CLLQDCDR.js';
|
|
13
|
+
export { slider_default as Slider } from './chunk-NNSS366W.js';
|
|
14
|
+
export { stepper_default as Stepper } from './chunk-MLDX3Z67.js';
|
|
15
|
+
export { switch_default as Switch } from './chunk-AOITJRSV.js';
|
|
16
|
+
export { skeleton_default as Skeleton } from './chunk-75XESYGN.js';
|
|
17
|
+
export { multi_select_default as MultiSelect } from './chunk-W7BQYIXF.js';
|
|
18
|
+
export { notification_default as Notification } from './chunk-YZVSDRJD.js';
|
|
19
|
+
export { pagination_default as Pagination } from './chunk-FGWSUPVW.js';
|
|
20
|
+
export { progress_default as Progress } from './chunk-RQBXZKTH.js';
|
|
21
|
+
export { rating_default as Rating } from './chunk-FYHQDFKE.js';
|
|
22
|
+
export { radio_group_default as RadioGroup } from './chunk-DOKTHDG3.js';
|
|
23
|
+
export { empty_default as Empty } from './chunk-ROR4E6IE.js';
|
|
24
|
+
export { fetching_overlay_default as FetchingOverlay } from './chunk-BNILRB4T.js';
|
|
25
|
+
export { image_default as Image } from './chunk-XMAH5PDW.js';
|
|
26
|
+
export { input_otp_default as InputOTP } from './chunk-R225A5II.js';
|
|
27
|
+
export { input_group_default as InputGroup } from './chunk-KBCBVH7B.js';
|
|
28
|
+
export { input_password_default as InputPassword } from './chunk-E2CYDDYC.js';
|
|
29
|
+
export { input_default as Input } from './chunk-2JGAYDZR.js';
|
|
30
|
+
export { kbd_default as Kbd } from './chunk-OQANRZPV.js';
|
|
31
|
+
export { checkbox_default as Checkbox } from './chunk-H2HIBD5Y.js';
|
|
32
|
+
export { checkbox_group_default as CheckboxGroup } from './chunk-RPAQAZTI.js';
|
|
33
|
+
export { collapse_default as Collapse } from './chunk-SOV4PE3P.js';
|
|
34
|
+
export { Command, CommandEmpty, CommandGroup, CommandInput, CommandItem, CommandList, CommandModal, CommandSeparator, CommandShortcut } from './chunk-4P5EMRFI.js';
|
|
35
|
+
export { modal_default as Modal } from './chunk-5VCGW53O.js';
|
|
36
|
+
export { DatePicker, RangePickerComponent as RangePicker, TimePickerComponent as TimePicker } from './chunk-7AEGBABZ.js';
|
|
37
|
+
export { descriptions_default as Descriptions } from './chunk-S5XJXU52.js';
|
|
38
|
+
export { Drawer, DrawerClose, DrawerContent, DrawerDescription, DrawerFooter, DrawerHeader, DrawerOverlay, DrawerPortal, DrawerTitle, DrawerTrigger } from './chunk-AWPKZYHT.js';
|
|
39
|
+
import { dropdown_default } from './chunk-KNQ7UQ2W.js';
|
|
40
|
+
export { dropdown_default as Dropdown } from './chunk-KNQ7UQ2W.js';
|
|
41
|
+
export { Popover, PopoverAnchor, PopoverContent, PopoverTrigger } from './chunk-3PFA3YG6.js';
|
|
42
|
+
export { badge_default as Badge } from './chunk-FTJOSVTY.js';
|
|
43
|
+
export { accordion_default as Accordion } from './chunk-CWHFK7ZC.js';
|
|
44
|
+
export { button_default as Button } from './chunk-LBJG2UWT.js';
|
|
45
|
+
export { spinner_default as Spinner } from './chunk-J3G5WWGR.js';
|
|
46
|
+
import { textColorVariants } from './chunk-5UEWVFF6.js';
|
|
47
|
+
export { buttonColors, commonSpacing, componentColors, componentSizeVariants, createAllColorVariants, createDashedColorVariants, createDefaultColorVariants, createGhostColorVariants, createLinkColorVariants, createOutlineColorVariants, createSoftColorVariants, createSolidColorVariants, extendedComponentSizeVariants, getAccordionColorClass, getCheckboxColorClass, getIconColorClass, iconColorClasses, textColorVariants } from './chunk-5UEWVFF6.js';
|
|
48
|
+
export { card_default as Card } from './chunk-XOBGEMQY.js';
|
|
49
|
+
export { carousel_default as Carousel } from './chunk-4OMLQCUV.js';
|
|
50
|
+
export { cascader_default as Cascader } from './chunk-SERJ3TZE.js';
|
|
51
|
+
export { AreaChart, BarChart, ComposedChart, LineChart, PieChart } from './chunk-BP434VYV.js';
|
|
52
|
+
import { cn, iconSizes, getValidationStatus, statusMessageVariants } from './chunk-YNNAOXU5.js';
|
|
53
|
+
export { cn, getValidationStatus, iconSizes } from './chunk-YNNAOXU5.js';
|
|
54
|
+
import { cva } from 'class-variance-authority';
|
|
55
|
+
import { ChevronRight, MoreHorizontal, MoreVertical, Check, Copy, Image, Upload as Upload$1, File, X, Loader2, CheckCircle, AlertCircle } from 'lucide-react';
|
|
56
|
+
import React5, { useState } from 'react';
|
|
57
|
+
import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
|
58
|
+
|
|
59
|
+
var BreadcrumbContext = React5.createContext({});
|
|
60
|
+
var breadcrumbVariants = cva("", {
|
|
61
|
+
variants: {
|
|
62
|
+
size: {
|
|
63
|
+
xs: "text-xs",
|
|
64
|
+
sm: "text-sm",
|
|
65
|
+
md: "text-base",
|
|
66
|
+
lg: "text-lg"
|
|
67
|
+
}
|
|
68
|
+
},
|
|
69
|
+
defaultVariants: {
|
|
70
|
+
size: "md"
|
|
71
|
+
}
|
|
72
|
+
});
|
|
73
|
+
var Breadcrumb = React5.memo(
|
|
74
|
+
({
|
|
75
|
+
children,
|
|
76
|
+
items,
|
|
77
|
+
color = "default",
|
|
78
|
+
size = "md",
|
|
79
|
+
separator,
|
|
80
|
+
className
|
|
81
|
+
}) => {
|
|
82
|
+
const content = items?.length ? /* @__PURE__ */ jsx(BreadcrumbList, { children: items.map((item, index) => {
|
|
83
|
+
const isLast = index === items.length - 1;
|
|
84
|
+
return /* @__PURE__ */ jsxs(React5.Fragment, { children: [
|
|
85
|
+
/* @__PURE__ */ jsx(BreadcrumbItem, { children: item.ellipsis ? /* @__PURE__ */ jsx(
|
|
86
|
+
BreadcrumbEllipsis,
|
|
87
|
+
{
|
|
88
|
+
orientation: item.ellipsisOrientation || "horizontal",
|
|
89
|
+
items: item.ellipsisItems || [],
|
|
90
|
+
size
|
|
91
|
+
}
|
|
92
|
+
) : isLast ? /* @__PURE__ */ jsx(
|
|
93
|
+
BreadcrumbPage,
|
|
94
|
+
{
|
|
95
|
+
leftIcon: item.leftIcon,
|
|
96
|
+
rightIcon: item.rightIcon,
|
|
97
|
+
children: item.label
|
|
98
|
+
}
|
|
99
|
+
) : /* @__PURE__ */ jsx(
|
|
100
|
+
BreadcrumbLink,
|
|
101
|
+
{
|
|
102
|
+
href: item.href || "",
|
|
103
|
+
onClick: item.onClick,
|
|
104
|
+
leftIcon: item.leftIcon,
|
|
105
|
+
rightIcon: item.rightIcon,
|
|
106
|
+
children: item.label
|
|
107
|
+
}
|
|
108
|
+
) }),
|
|
109
|
+
!isLast && /* @__PURE__ */ jsx(BreadcrumbSeparator, { size, children: separator })
|
|
110
|
+
] }, index);
|
|
111
|
+
}) }) : children;
|
|
112
|
+
return /* @__PURE__ */ jsx(BreadcrumbContext.Provider, { value: { color, size }, children: /* @__PURE__ */ jsx(
|
|
113
|
+
"nav",
|
|
114
|
+
{
|
|
115
|
+
"aria-label": "breadcrumb",
|
|
116
|
+
className: cn(
|
|
117
|
+
breadcrumbVariants({ size }),
|
|
118
|
+
textColorVariants({ color }),
|
|
119
|
+
className
|
|
120
|
+
),
|
|
121
|
+
children: content
|
|
122
|
+
}
|
|
123
|
+
) });
|
|
124
|
+
}
|
|
125
|
+
);
|
|
126
|
+
Breadcrumb.displayName = "Breadcrumb";
|
|
127
|
+
var BreadcrumbList = React5.memo(
|
|
128
|
+
({ children, className }) => {
|
|
129
|
+
return /* @__PURE__ */ jsx("ol", { className: cn("flex items-center gap-1.5", className), children });
|
|
130
|
+
}
|
|
131
|
+
);
|
|
132
|
+
BreadcrumbList.displayName = "BreadcrumbList";
|
|
133
|
+
var BreadcrumbItem = React5.memo(
|
|
134
|
+
({ children, className }) => {
|
|
135
|
+
return /* @__PURE__ */ jsx("li", { className: cn("inline-flex items-center gap-1.5", className), children });
|
|
136
|
+
}
|
|
137
|
+
);
|
|
138
|
+
BreadcrumbItem.displayName = "BreadcrumbItem";
|
|
139
|
+
var BreadcrumbLink = React5.memo(
|
|
140
|
+
({ children, href, onClick, leftIcon, rightIcon, className }) => {
|
|
141
|
+
const handleClick = (e) => {
|
|
142
|
+
if (onClick) {
|
|
143
|
+
e.preventDefault();
|
|
144
|
+
onClick();
|
|
145
|
+
}
|
|
146
|
+
};
|
|
147
|
+
const content = /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
148
|
+
leftIcon && /* @__PURE__ */ jsx("span", { className: "inline-flex items-center", children: leftIcon }),
|
|
149
|
+
children,
|
|
150
|
+
rightIcon && /* @__PURE__ */ jsx("span", { className: "inline-flex items-center", children: rightIcon })
|
|
151
|
+
] });
|
|
152
|
+
if (href) {
|
|
153
|
+
return /* @__PURE__ */ jsx(
|
|
154
|
+
"a",
|
|
155
|
+
{
|
|
156
|
+
href,
|
|
157
|
+
onClick: handleClick,
|
|
158
|
+
className: cn(
|
|
159
|
+
"inline-flex items-center gap-1.5 transition-colors hover:underline cursor-pointer",
|
|
160
|
+
className
|
|
161
|
+
),
|
|
162
|
+
children: content
|
|
163
|
+
}
|
|
164
|
+
);
|
|
165
|
+
}
|
|
166
|
+
if (onClick) {
|
|
167
|
+
return /* @__PURE__ */ jsx(
|
|
168
|
+
"button",
|
|
169
|
+
{
|
|
170
|
+
onClick: handleClick,
|
|
171
|
+
className: cn(
|
|
172
|
+
"inline-flex items-center gap-1.5 transition-colors hover:underline cursor-pointer",
|
|
173
|
+
className
|
|
174
|
+
),
|
|
175
|
+
children: content
|
|
176
|
+
}
|
|
177
|
+
);
|
|
178
|
+
}
|
|
179
|
+
return /* @__PURE__ */ jsx("span", { className: cn("inline-flex items-center gap-1.5", className), children: content });
|
|
180
|
+
}
|
|
181
|
+
);
|
|
182
|
+
BreadcrumbLink.displayName = "BreadcrumbLink";
|
|
183
|
+
var BreadcrumbPage = React5.memo(
|
|
184
|
+
({ children, leftIcon, rightIcon, className }) => {
|
|
185
|
+
return /* @__PURE__ */ jsxs(
|
|
186
|
+
"span",
|
|
187
|
+
{
|
|
188
|
+
"aria-current": "page",
|
|
189
|
+
className: cn(
|
|
190
|
+
"inline-flex items-center gap-1.5 font-medium",
|
|
191
|
+
className
|
|
192
|
+
),
|
|
193
|
+
children: [
|
|
194
|
+
leftIcon && /* @__PURE__ */ jsx("span", { className: "inline-flex items-center", children: leftIcon }),
|
|
195
|
+
children,
|
|
196
|
+
rightIcon && /* @__PURE__ */ jsx("span", { className: "inline-flex items-center", children: rightIcon })
|
|
197
|
+
]
|
|
198
|
+
}
|
|
199
|
+
);
|
|
200
|
+
}
|
|
201
|
+
);
|
|
202
|
+
BreadcrumbPage.displayName = "BreadcrumbPage";
|
|
203
|
+
var BreadcrumbSeparator = React5.memo(
|
|
204
|
+
({ children, className, size = "md" }) => {
|
|
205
|
+
return /* @__PURE__ */ jsx("span", { className: cn("text-text-muted", className), children: children ?? /* @__PURE__ */ jsx(ChevronRight, { className: iconSizes[size] }) });
|
|
206
|
+
}
|
|
207
|
+
);
|
|
208
|
+
BreadcrumbSeparator.displayName = "BreadcrumbSeparator";
|
|
209
|
+
var BreadcrumbEllipsis = React5.memo(
|
|
210
|
+
({ orientation = "horizontal", items, children, className, size = "md" }) => {
|
|
211
|
+
const Icon = orientation === "horizontal" ? MoreHorizontal : MoreVertical;
|
|
212
|
+
const ellipsisButton = /* @__PURE__ */ jsxs(
|
|
213
|
+
"span",
|
|
214
|
+
{
|
|
215
|
+
role: "presentation",
|
|
216
|
+
"aria-hidden": "true",
|
|
217
|
+
className: cn(
|
|
218
|
+
"flex items-center justify-center",
|
|
219
|
+
items || children ? "cursor-pointer" : "",
|
|
220
|
+
className
|
|
221
|
+
),
|
|
222
|
+
children: [
|
|
223
|
+
/* @__PURE__ */ jsx(Icon, { className: iconSizes[size] }),
|
|
224
|
+
/* @__PURE__ */ jsx("span", { className: "sr-only", children: "More" })
|
|
225
|
+
]
|
|
226
|
+
}
|
|
227
|
+
);
|
|
228
|
+
if (items || children) {
|
|
229
|
+
const dropdownItems = (items || []).map((item) => ({
|
|
230
|
+
label: item.label || "",
|
|
231
|
+
value: item.label || "",
|
|
232
|
+
onClick: item.onClick || (() => {
|
|
233
|
+
if (item.href) {
|
|
234
|
+
window.location.href = item.href;
|
|
235
|
+
}
|
|
236
|
+
})
|
|
237
|
+
}));
|
|
238
|
+
return /* @__PURE__ */ jsx(dropdown_default, { items: dropdownItems, children: ellipsisButton });
|
|
239
|
+
}
|
|
240
|
+
return ellipsisButton;
|
|
241
|
+
}
|
|
242
|
+
);
|
|
243
|
+
BreadcrumbEllipsis.displayName = "BreadcrumbEllipsis";
|
|
244
|
+
var breadcrumbs_default = Breadcrumb;
|
|
245
|
+
var buttonGroupVariants = cva("inline-flex", {
|
|
246
|
+
variants: {
|
|
247
|
+
vertical: {
|
|
248
|
+
true: "flex-col [&>*:not(:first-child)]:rounded-t-none [&>*:not(:last-child)]:border-b-0 [&>*:not(:last-child)]:rounded-b-none",
|
|
249
|
+
false: "flex-row [&>*:not(:first-child)]:rounded-l-none [&>*:not(:last-child)]:border-r-0 [&>*:not(:last-child)]:rounded-r-none"
|
|
250
|
+
},
|
|
251
|
+
spacing: {
|
|
252
|
+
true: "gap-2",
|
|
253
|
+
false: "gap-0"
|
|
254
|
+
},
|
|
255
|
+
fullWidth: {
|
|
256
|
+
true: "w-full [&>*]:flex-1",
|
|
257
|
+
false: ""
|
|
258
|
+
}
|
|
259
|
+
},
|
|
260
|
+
defaultVariants: {
|
|
261
|
+
vertical: false,
|
|
262
|
+
fullWidth: false
|
|
263
|
+
}
|
|
264
|
+
});
|
|
265
|
+
var ButtonGroup = React5.memo(
|
|
266
|
+
({
|
|
267
|
+
vertical = false,
|
|
268
|
+
spacing = false,
|
|
269
|
+
fullWidth = false,
|
|
270
|
+
className,
|
|
271
|
+
children,
|
|
272
|
+
ref,
|
|
273
|
+
...props
|
|
274
|
+
}) => {
|
|
275
|
+
return /* @__PURE__ */ jsx(
|
|
276
|
+
"div",
|
|
277
|
+
{
|
|
278
|
+
ref,
|
|
279
|
+
role: "group",
|
|
280
|
+
className: cn(
|
|
281
|
+
buttonGroupVariants({ vertical, spacing, fullWidth }),
|
|
282
|
+
className
|
|
283
|
+
),
|
|
284
|
+
...props,
|
|
285
|
+
children
|
|
286
|
+
}
|
|
287
|
+
);
|
|
288
|
+
}
|
|
289
|
+
);
|
|
290
|
+
ButtonGroup.displayName = "ButtonGroup";
|
|
291
|
+
var button_group_default = ButtonGroup;
|
|
292
|
+
var clipboardVariants = cva(
|
|
293
|
+
"inline-flex items-center justify-between gap-2 rounded-md font-medium transition-all cursor-pointer border",
|
|
294
|
+
{
|
|
295
|
+
variants: {
|
|
296
|
+
size: {
|
|
297
|
+
xs: "px-2 py-1 text-xs",
|
|
298
|
+
sm: "px-3 py-1.5 text-xs",
|
|
299
|
+
md: "px-4 py-2 text-sm",
|
|
300
|
+
lg: "px-5 py-2.5 text-lg"
|
|
301
|
+
}
|
|
302
|
+
},
|
|
303
|
+
defaultVariants: {
|
|
304
|
+
size: "md"
|
|
305
|
+
}
|
|
306
|
+
}
|
|
307
|
+
);
|
|
308
|
+
var colorStyles = {
|
|
309
|
+
default: {
|
|
310
|
+
default: "bg-background border-border text-text-primary hover:bg-surface",
|
|
311
|
+
solid: "bg-surface border-border text-text-primary hover:bg-surface/80",
|
|
312
|
+
soft: "bg-surface/50 border-border text-text-primary hover:bg-surface"
|
|
313
|
+
},
|
|
314
|
+
primary: {
|
|
315
|
+
default: "bg-background border-primary text-primary hover:bg-primary/10",
|
|
316
|
+
solid: "bg-primary border-primary text-background hover:bg-primary/90",
|
|
317
|
+
soft: "bg-primary/10 border-primary/30 text-primary hover:bg-primary/20"
|
|
318
|
+
},
|
|
319
|
+
secondary: {
|
|
320
|
+
default: "bg-background border-secondary text-secondary hover:bg-secondary/10",
|
|
321
|
+
solid: "bg-secondary border-secondary text-background hover:bg-secondary/90",
|
|
322
|
+
soft: "bg-secondary/10 border-secondary/30 text-secondary hover:bg-secondary/20"
|
|
323
|
+
},
|
|
324
|
+
accent: {
|
|
325
|
+
default: "bg-background border-accent text-accent hover:bg-accent/10",
|
|
326
|
+
solid: "bg-accent border-accent text-background hover:bg-accent/90",
|
|
327
|
+
soft: "bg-accent/10 border-accent/30 text-accent hover:bg-accent/20"
|
|
328
|
+
},
|
|
329
|
+
success: {
|
|
330
|
+
default: "bg-background border-success text-success hover:bg-success/10",
|
|
331
|
+
solid: "bg-success border-success text-background hover:bg-success/90",
|
|
332
|
+
soft: "bg-success/10 border-success/30 text-success hover:bg-success/20"
|
|
333
|
+
},
|
|
334
|
+
error: {
|
|
335
|
+
default: "bg-background border-error text-error hover:bg-error/10",
|
|
336
|
+
solid: "bg-error border-error text-background hover:bg-error/90",
|
|
337
|
+
soft: "bg-error/10 border-error/30 text-error hover:bg-error/20"
|
|
338
|
+
},
|
|
339
|
+
warning: {
|
|
340
|
+
default: "bg-background border-warning text-warning hover:bg-warning/10",
|
|
341
|
+
solid: "bg-warning border-warning text-background hover:bg-warning/90",
|
|
342
|
+
soft: "bg-warning/10 border-warning/30 text-warning hover:bg-warning/20"
|
|
343
|
+
},
|
|
344
|
+
info: {
|
|
345
|
+
default: "bg-background border-info text-info hover:bg-info/10",
|
|
346
|
+
solid: "bg-info border-info text-background hover:bg-info/90",
|
|
347
|
+
soft: "bg-info/10 border-info/30 text-info hover:bg-info/20"
|
|
348
|
+
}
|
|
349
|
+
};
|
|
350
|
+
var Clipboard = React5.memo(
|
|
351
|
+
({
|
|
352
|
+
value,
|
|
353
|
+
color = "default",
|
|
354
|
+
size = "md",
|
|
355
|
+
variant = "default",
|
|
356
|
+
showValue = true,
|
|
357
|
+
successDuration = 2e3,
|
|
358
|
+
onCopy,
|
|
359
|
+
className
|
|
360
|
+
}) => {
|
|
361
|
+
const [copied, setCopied] = useState(false);
|
|
362
|
+
const handleCopy = async () => {
|
|
363
|
+
try {
|
|
364
|
+
await navigator.clipboard.writeText(value);
|
|
365
|
+
setCopied(true);
|
|
366
|
+
onCopy?.();
|
|
367
|
+
setTimeout(() => {
|
|
368
|
+
setCopied(false);
|
|
369
|
+
}, successDuration);
|
|
370
|
+
} catch (err) {
|
|
371
|
+
console.error("Failed to copy:", err);
|
|
372
|
+
}
|
|
373
|
+
};
|
|
374
|
+
return /* @__PURE__ */ jsxs(
|
|
375
|
+
"div",
|
|
376
|
+
{
|
|
377
|
+
onClick: handleCopy,
|
|
378
|
+
className: cn(
|
|
379
|
+
clipboardVariants({ size }),
|
|
380
|
+
colorStyles[color][variant],
|
|
381
|
+
className
|
|
382
|
+
),
|
|
383
|
+
children: [
|
|
384
|
+
showValue && /* @__PURE__ */ jsx("span", { className: "font-mono truncate", children: value }),
|
|
385
|
+
copied ? /* @__PURE__ */ jsx(Check, { className: cn(iconSizes[size], "flex-shrink-0") }) : /* @__PURE__ */ jsx(Copy, { className: cn(iconSizes[size], "flex-shrink-0") })
|
|
386
|
+
]
|
|
387
|
+
}
|
|
388
|
+
);
|
|
389
|
+
}
|
|
390
|
+
);
|
|
391
|
+
Clipboard.displayName = "Clipboard";
|
|
392
|
+
var clipboard_default = Clipboard;
|
|
393
|
+
var gridVariants = cva("w-full grid", {
|
|
394
|
+
variants: {
|
|
395
|
+
gap: {
|
|
396
|
+
xs: "gap-2",
|
|
397
|
+
sm: "gap-4",
|
|
398
|
+
md: "gap-6",
|
|
399
|
+
lg: "gap-8"
|
|
400
|
+
},
|
|
401
|
+
columns: {
|
|
402
|
+
1: "grid-cols-1",
|
|
403
|
+
2: "grid-cols-1 md:grid-cols-2",
|
|
404
|
+
3: "grid-cols-1 md:grid-cols-2 lg:grid-cols-3",
|
|
405
|
+
4: "grid-cols-1 md:grid-cols-2 lg:grid-cols-4",
|
|
406
|
+
5: "grid-cols-1 md:grid-cols-3 lg:grid-cols-5",
|
|
407
|
+
6: "grid-cols-1 md:grid-cols-3 lg:grid-cols-6"
|
|
408
|
+
}
|
|
409
|
+
},
|
|
410
|
+
defaultVariants: {
|
|
411
|
+
gap: "md",
|
|
412
|
+
columns: 3
|
|
413
|
+
}
|
|
414
|
+
});
|
|
415
|
+
var Grid = React5.memo(
|
|
416
|
+
({ children, columns = 3, gap = "md", className }) => {
|
|
417
|
+
return /* @__PURE__ */ jsx("div", { className: cn(gridVariants({ gap, columns }), className), children });
|
|
418
|
+
}
|
|
419
|
+
);
|
|
420
|
+
Grid.displayName = "Grid";
|
|
421
|
+
var grid_default = Grid;
|
|
422
|
+
var uploadButtonVariants = cva(
|
|
423
|
+
"inline-flex cursor-pointer outline-none border items-center justify-center gap-2 font-medium rounded-md disabled:opacity-50 disabled:cursor-not-allowed transition-colors",
|
|
424
|
+
{
|
|
425
|
+
variants: {
|
|
426
|
+
color: {
|
|
427
|
+
primary: "border-primary text-white bg-primary hover:bg-primary/90",
|
|
428
|
+
secondary: "border-secondary text-white bg-secondary hover:bg-secondary/90",
|
|
429
|
+
success: "border-success text-white bg-success hover:bg-success/90",
|
|
430
|
+
error: "border-error text-white bg-error hover:bg-error/90",
|
|
431
|
+
accent: "border-accent text-white bg-accent hover:bg-accent/90",
|
|
432
|
+
warning: "border-warning text-white bg-warning hover:bg-warning/90",
|
|
433
|
+
info: "border-info text-white bg-info hover:bg-info/90"
|
|
434
|
+
},
|
|
435
|
+
size: {
|
|
436
|
+
xs: "h-[var(--button-height-xs)] px-[var(--button-padding-x-xs)] text-xs",
|
|
437
|
+
sm: "h-[var(--button-height-sm)] px-[var(--button-padding-x-sm)] text-sm",
|
|
438
|
+
md: "h-[var(--button-height-md)] px-[var(--button-padding-x-md)] text-base",
|
|
439
|
+
lg: "h-[var(--button-height-lg)] px-[var(--button-padding-x-lg)] text-lg"
|
|
440
|
+
}
|
|
441
|
+
},
|
|
442
|
+
defaultVariants: {
|
|
443
|
+
color: "primary",
|
|
444
|
+
size: "md"
|
|
445
|
+
}
|
|
446
|
+
}
|
|
447
|
+
);
|
|
448
|
+
var uploadDropzoneVariants = cva(
|
|
449
|
+
"relative border-2 border-dashed rounded-lg transition-all duration-200 cursor-pointer",
|
|
450
|
+
{
|
|
451
|
+
variants: {
|
|
452
|
+
status: {
|
|
453
|
+
default: "border-border bg-surface/50 hover:border-primary hover:bg-primary/5",
|
|
454
|
+
dragActive: "border-primary bg-primary/10",
|
|
455
|
+
error: "border-error bg-error/5",
|
|
456
|
+
disabled: "border-border bg-surface/30 cursor-not-allowed opacity-50"
|
|
457
|
+
},
|
|
458
|
+
size: {
|
|
459
|
+
xs: "p-2",
|
|
460
|
+
sm: "p-4",
|
|
461
|
+
md: "p-6",
|
|
462
|
+
lg: "p-8"
|
|
463
|
+
}
|
|
464
|
+
},
|
|
465
|
+
defaultVariants: {
|
|
466
|
+
status: "default",
|
|
467
|
+
size: "md"
|
|
468
|
+
}
|
|
469
|
+
}
|
|
470
|
+
);
|
|
471
|
+
var uploadDraggerVariants = cva(
|
|
472
|
+
"relative border-2 border-dashed rounded-lg transition-all duration-200 cursor-pointer flex flex-col items-center justify-center gap-2",
|
|
473
|
+
{
|
|
474
|
+
variants: {
|
|
475
|
+
status: {
|
|
476
|
+
default: "border-border bg-surface/50 hover:border-primary hover:bg-primary/5",
|
|
477
|
+
dragActive: "border-primary bg-primary/10 scale-[1.02]",
|
|
478
|
+
error: "border-error bg-error/5",
|
|
479
|
+
disabled: "border-border bg-surface/30 cursor-not-allowed opacity-50"
|
|
480
|
+
},
|
|
481
|
+
size: {
|
|
482
|
+
xs: "min-h-[100px] p-3",
|
|
483
|
+
sm: "min-h-[120px] p-4",
|
|
484
|
+
md: "min-h-[160px] p-6",
|
|
485
|
+
lg: "min-h-[200px] p-8"
|
|
486
|
+
}
|
|
487
|
+
},
|
|
488
|
+
defaultVariants: {
|
|
489
|
+
status: "default",
|
|
490
|
+
size: "md"
|
|
491
|
+
}
|
|
492
|
+
}
|
|
493
|
+
);
|
|
494
|
+
var uploadAvatarVariants = cva(
|
|
495
|
+
"relative overflow-hidden rounded-full border-2 border-dashed cursor-pointer transition-all duration-200 flex items-center justify-center",
|
|
496
|
+
{
|
|
497
|
+
variants: {
|
|
498
|
+
status: {
|
|
499
|
+
default: "border-border bg-surface/50 hover:border-primary",
|
|
500
|
+
dragActive: "border-primary bg-primary/10",
|
|
501
|
+
error: "border-error bg-error/5",
|
|
502
|
+
disabled: "border-border bg-surface/30 cursor-not-allowed opacity-50"
|
|
503
|
+
},
|
|
504
|
+
size: {
|
|
505
|
+
xs: "w-12 h-12",
|
|
506
|
+
sm: "w-16 h-16",
|
|
507
|
+
md: "w-24 h-24",
|
|
508
|
+
lg: "w-32 h-32"
|
|
509
|
+
}
|
|
510
|
+
},
|
|
511
|
+
defaultVariants: {
|
|
512
|
+
status: "default",
|
|
513
|
+
size: "md"
|
|
514
|
+
}
|
|
515
|
+
}
|
|
516
|
+
);
|
|
517
|
+
var uploadPictureVariants = cva(
|
|
518
|
+
"relative overflow-hidden rounded-md border-2 border-dashed cursor-pointer transition-all duration-200 flex items-center justify-center",
|
|
519
|
+
{
|
|
520
|
+
variants: {
|
|
521
|
+
status: {
|
|
522
|
+
default: "border-border bg-surface/50 hover:border-primary",
|
|
523
|
+
dragActive: "border-primary bg-primary/10",
|
|
524
|
+
error: "border-error bg-error/5",
|
|
525
|
+
disabled: "border-border bg-surface/30 cursor-not-allowed opacity-50"
|
|
526
|
+
},
|
|
527
|
+
size: {
|
|
528
|
+
xs: "w-16 h-16",
|
|
529
|
+
sm: "w-24 h-24",
|
|
530
|
+
md: "w-32 h-32",
|
|
531
|
+
lg: "w-40 h-40"
|
|
532
|
+
}
|
|
533
|
+
},
|
|
534
|
+
defaultVariants: {
|
|
535
|
+
status: "default",
|
|
536
|
+
size: "md"
|
|
537
|
+
}
|
|
538
|
+
}
|
|
539
|
+
);
|
|
540
|
+
var formatFileSize = (bytes) => {
|
|
541
|
+
if (bytes === 0) return "0 Bytes";
|
|
542
|
+
const k = 1024;
|
|
543
|
+
const sizes = ["Bytes", "KB", "MB", "GB"];
|
|
544
|
+
const i = Math.floor(Math.log(bytes) / Math.log(k));
|
|
545
|
+
return Math.round(bytes / Math.pow(k, i) * 100) / 100 + " " + sizes[i];
|
|
546
|
+
};
|
|
547
|
+
var isImageFile = (file) => {
|
|
548
|
+
const type = file.type || "";
|
|
549
|
+
return type.startsWith("image/");
|
|
550
|
+
};
|
|
551
|
+
var generateUID = () => {
|
|
552
|
+
return `upload-${Date.now()}-${Math.random().toString(36).substr(2, 9)}`;
|
|
553
|
+
};
|
|
554
|
+
var Upload = React5.memo(
|
|
555
|
+
({
|
|
556
|
+
variant = "button",
|
|
557
|
+
size = "md",
|
|
558
|
+
color = "primary",
|
|
559
|
+
label,
|
|
560
|
+
helperText,
|
|
561
|
+
error,
|
|
562
|
+
warning,
|
|
563
|
+
info,
|
|
564
|
+
success,
|
|
565
|
+
accept,
|
|
566
|
+
multiple = false,
|
|
567
|
+
maxSize,
|
|
568
|
+
maxCount,
|
|
569
|
+
fileList,
|
|
570
|
+
defaultFileList = [],
|
|
571
|
+
showUploadList = true,
|
|
572
|
+
listType = "text",
|
|
573
|
+
disabled = false,
|
|
574
|
+
buttonText = "Upload File",
|
|
575
|
+
dragText = "Click or drag file to this area to upload",
|
|
576
|
+
dragHint = "Support for a single or bulk upload",
|
|
577
|
+
onChange,
|
|
578
|
+
onRemove,
|
|
579
|
+
beforeUpload,
|
|
580
|
+
customRequest,
|
|
581
|
+
onError,
|
|
582
|
+
className,
|
|
583
|
+
ref,
|
|
584
|
+
...props
|
|
585
|
+
}) => {
|
|
586
|
+
const [internalFileList, setInternalFileList] = React5.useState(defaultFileList);
|
|
587
|
+
const [dragActive, setDragActive] = React5.useState(false);
|
|
588
|
+
const inputRef = React5.useRef(null);
|
|
589
|
+
const currentFileList = fileList !== void 0 ? fileList : internalFileList;
|
|
590
|
+
const { status, message: helperMessage } = getValidationStatus({
|
|
591
|
+
error,
|
|
592
|
+
warning,
|
|
593
|
+
info,
|
|
594
|
+
success,
|
|
595
|
+
helperText
|
|
596
|
+
});
|
|
597
|
+
const validateFile = React5.useCallback(
|
|
598
|
+
(file) => {
|
|
599
|
+
if (maxSize && file.size > maxSize) {
|
|
600
|
+
return `File size exceeds ${formatFileSize(maxSize)}`;
|
|
601
|
+
}
|
|
602
|
+
if (maxCount && currentFileList.length >= maxCount) {
|
|
603
|
+
return `Maximum ${maxCount} file${maxCount > 1 ? "s" : ""} allowed`;
|
|
604
|
+
}
|
|
605
|
+
return null;
|
|
606
|
+
},
|
|
607
|
+
[maxSize, maxCount, currentFileList.length]
|
|
608
|
+
);
|
|
609
|
+
const handleFiles = React5.useCallback(
|
|
610
|
+
async (files) => {
|
|
611
|
+
if (!files || files.length === 0) return;
|
|
612
|
+
const newFiles = [];
|
|
613
|
+
for (let i = 0; i < files.length; i++) {
|
|
614
|
+
const file = files[i];
|
|
615
|
+
if (!file) continue;
|
|
616
|
+
const validationError = validateFile(file);
|
|
617
|
+
if (validationError) {
|
|
618
|
+
onError?.(validationError, file);
|
|
619
|
+
continue;
|
|
620
|
+
}
|
|
621
|
+
if (beforeUpload) {
|
|
622
|
+
const shouldUpload = await beforeUpload(file);
|
|
623
|
+
if (!shouldUpload) continue;
|
|
624
|
+
}
|
|
625
|
+
const uploadFile = {
|
|
626
|
+
uid: generateUID(),
|
|
627
|
+
name: file.name,
|
|
628
|
+
size: file.size,
|
|
629
|
+
type: file.type,
|
|
630
|
+
status: "uploading",
|
|
631
|
+
percent: 0
|
|
632
|
+
};
|
|
633
|
+
newFiles.push(uploadFile);
|
|
634
|
+
if (customRequest) {
|
|
635
|
+
customRequest({
|
|
636
|
+
file,
|
|
637
|
+
onProgress: (percent) => {
|
|
638
|
+
setInternalFileList(
|
|
639
|
+
(prev) => prev.map(
|
|
640
|
+
(f) => f.uid === uploadFile.uid ? { ...f, percent } : f
|
|
641
|
+
)
|
|
642
|
+
);
|
|
643
|
+
},
|
|
644
|
+
onSuccess: (response) => {
|
|
645
|
+
setInternalFileList(
|
|
646
|
+
(prev) => prev.map(
|
|
647
|
+
(f) => f.uid === uploadFile.uid ? {
|
|
648
|
+
...f,
|
|
649
|
+
status: "done",
|
|
650
|
+
percent: 100,
|
|
651
|
+
response
|
|
652
|
+
} : f
|
|
653
|
+
)
|
|
654
|
+
);
|
|
655
|
+
},
|
|
656
|
+
onError: (err) => {
|
|
657
|
+
setInternalFileList(
|
|
658
|
+
(prev) => prev.map(
|
|
659
|
+
(f) => f.uid === uploadFile.uid ? { ...f, status: "error", error: err } : f
|
|
660
|
+
)
|
|
661
|
+
);
|
|
662
|
+
}
|
|
663
|
+
});
|
|
664
|
+
} else {
|
|
665
|
+
if (file && isImageFile(file)) {
|
|
666
|
+
uploadFile.thumbUrl = URL.createObjectURL(file);
|
|
667
|
+
}
|
|
668
|
+
uploadFile.status = "done";
|
|
669
|
+
uploadFile.percent = 100;
|
|
670
|
+
}
|
|
671
|
+
}
|
|
672
|
+
const updatedList = multiple ? [...currentFileList, ...newFiles] : newFiles;
|
|
673
|
+
if (fileList === void 0) {
|
|
674
|
+
setInternalFileList(updatedList);
|
|
675
|
+
}
|
|
676
|
+
onChange?.(updatedList);
|
|
677
|
+
},
|
|
678
|
+
[
|
|
679
|
+
validateFile,
|
|
680
|
+
beforeUpload,
|
|
681
|
+
customRequest,
|
|
682
|
+
onError,
|
|
683
|
+
multiple,
|
|
684
|
+
currentFileList,
|
|
685
|
+
fileList,
|
|
686
|
+
onChange
|
|
687
|
+
]
|
|
688
|
+
);
|
|
689
|
+
const handleInputChange = React5.useCallback(
|
|
690
|
+
(e) => {
|
|
691
|
+
handleFiles(e.target.files);
|
|
692
|
+
e.target.value = "";
|
|
693
|
+
},
|
|
694
|
+
[handleFiles]
|
|
695
|
+
);
|
|
696
|
+
const handleRemove = React5.useCallback(
|
|
697
|
+
(file) => {
|
|
698
|
+
const updatedList = currentFileList.filter((f) => f.uid !== file.uid);
|
|
699
|
+
if (fileList === void 0) {
|
|
700
|
+
setInternalFileList(updatedList);
|
|
701
|
+
}
|
|
702
|
+
onRemove?.(file);
|
|
703
|
+
onChange?.(updatedList);
|
|
704
|
+
},
|
|
705
|
+
[currentFileList, fileList, onRemove, onChange]
|
|
706
|
+
);
|
|
707
|
+
const handleClick = React5.useCallback(() => {
|
|
708
|
+
if (!disabled) {
|
|
709
|
+
inputRef.current?.click();
|
|
710
|
+
}
|
|
711
|
+
}, [disabled]);
|
|
712
|
+
const handleDragEnter = React5.useCallback((e) => {
|
|
713
|
+
e.preventDefault();
|
|
714
|
+
e.stopPropagation();
|
|
715
|
+
setDragActive(true);
|
|
716
|
+
}, []);
|
|
717
|
+
const handleDragLeave = React5.useCallback((e) => {
|
|
718
|
+
e.preventDefault();
|
|
719
|
+
e.stopPropagation();
|
|
720
|
+
setDragActive(false);
|
|
721
|
+
}, []);
|
|
722
|
+
const handleDragOver = React5.useCallback((e) => {
|
|
723
|
+
e.preventDefault();
|
|
724
|
+
e.stopPropagation();
|
|
725
|
+
}, []);
|
|
726
|
+
const handleDrop = React5.useCallback(
|
|
727
|
+
(e) => {
|
|
728
|
+
e.preventDefault();
|
|
729
|
+
e.stopPropagation();
|
|
730
|
+
setDragActive(false);
|
|
731
|
+
if (!disabled) {
|
|
732
|
+
handleFiles(e.dataTransfer.files);
|
|
733
|
+
}
|
|
734
|
+
},
|
|
735
|
+
[disabled, handleFiles]
|
|
736
|
+
);
|
|
737
|
+
const renderFileList = () => {
|
|
738
|
+
if (!showUploadList || currentFileList.length === 0) return null;
|
|
739
|
+
if (listType === "picture-card") {
|
|
740
|
+
return /* @__PURE__ */ jsx("div", { className: "flex flex-wrap gap-2 mt-2", children: currentFileList.map((file) => /* @__PURE__ */ jsxs(
|
|
741
|
+
"div",
|
|
742
|
+
{
|
|
743
|
+
className: "relative w-24 h-24 rounded-md border border-border overflow-hidden group",
|
|
744
|
+
children: [
|
|
745
|
+
file.thumbUrl ? /* @__PURE__ */ jsx(
|
|
746
|
+
"img",
|
|
747
|
+
{
|
|
748
|
+
src: file.thumbUrl,
|
|
749
|
+
alt: file.name,
|
|
750
|
+
className: "w-full h-full object-cover"
|
|
751
|
+
}
|
|
752
|
+
) : /* @__PURE__ */ jsx("div", { className: "w-full h-full flex items-center justify-center bg-surface", children: /* @__PURE__ */ jsx(File, { className: "w-8 h-8 text-text-muted" }) }),
|
|
753
|
+
/* @__PURE__ */ jsx("div", { className: "absolute inset-0 bg-black/50 opacity-0 group-hover:opacity-100 transition-opacity flex items-center justify-center", children: /* @__PURE__ */ jsx(
|
|
754
|
+
"button",
|
|
755
|
+
{
|
|
756
|
+
type: "button",
|
|
757
|
+
onClick: () => handleRemove(file),
|
|
758
|
+
className: "text-white hover:text-error transition-colors",
|
|
759
|
+
children: /* @__PURE__ */ jsx(X, { className: iconSizes[size] })
|
|
760
|
+
}
|
|
761
|
+
) }),
|
|
762
|
+
file.status === "uploading" && /* @__PURE__ */ jsx("div", { className: "absolute inset-0 bg-black/30 flex items-center justify-center", children: /* @__PURE__ */ jsx(Loader2, { className: "w-6 h-6 text-white animate-spin" }) })
|
|
763
|
+
]
|
|
764
|
+
},
|
|
765
|
+
file.uid
|
|
766
|
+
)) });
|
|
767
|
+
}
|
|
768
|
+
return /* @__PURE__ */ jsx("div", { className: "mt-2 space-y-1", children: currentFileList.map((file) => /* @__PURE__ */ jsxs(
|
|
769
|
+
"div",
|
|
770
|
+
{
|
|
771
|
+
className: "flex items-center justify-between p-2 rounded-md bg-surface hover:bg-surface/80 transition-colors",
|
|
772
|
+
children: [
|
|
773
|
+
/* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2 flex-1 min-w-0", children: [
|
|
774
|
+
listType === "picture" && file.thumbUrl ? /* @__PURE__ */ jsx(
|
|
775
|
+
"img",
|
|
776
|
+
{
|
|
777
|
+
src: file.thumbUrl,
|
|
778
|
+
alt: file.name,
|
|
779
|
+
className: "w-8 h-8 rounded object-cover"
|
|
780
|
+
}
|
|
781
|
+
) : /* @__PURE__ */ jsx(
|
|
782
|
+
File,
|
|
783
|
+
{
|
|
784
|
+
className: cn("text-text-muted shrink-0", iconSizes[size])
|
|
785
|
+
}
|
|
786
|
+
),
|
|
787
|
+
/* @__PURE__ */ jsxs("div", { className: "flex-1 min-w-0", children: [
|
|
788
|
+
/* @__PURE__ */ jsx("p", { className: "text-sm text-text-primary truncate", children: file.name }),
|
|
789
|
+
/* @__PURE__ */ jsxs("p", { className: "text-xs text-text-muted", children: [
|
|
790
|
+
formatFileSize(file.size),
|
|
791
|
+
file.status === "uploading" && file.percent !== void 0 && /* @__PURE__ */ jsxs("span", { children: [
|
|
792
|
+
" - ",
|
|
793
|
+
file.percent,
|
|
794
|
+
"%"
|
|
795
|
+
] })
|
|
796
|
+
] })
|
|
797
|
+
] })
|
|
798
|
+
] }),
|
|
799
|
+
/* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2", children: [
|
|
800
|
+
file.status === "uploading" && /* @__PURE__ */ jsx(
|
|
801
|
+
Loader2,
|
|
802
|
+
{
|
|
803
|
+
className: cn("text-primary animate-spin", iconSizes[size])
|
|
804
|
+
}
|
|
805
|
+
),
|
|
806
|
+
file.status === "done" && /* @__PURE__ */ jsx(
|
|
807
|
+
CheckCircle,
|
|
808
|
+
{
|
|
809
|
+
className: cn("text-success", iconSizes[size])
|
|
810
|
+
}
|
|
811
|
+
),
|
|
812
|
+
file.status === "error" && /* @__PURE__ */ jsx(AlertCircle, { className: cn("text-error", iconSizes[size]) }),
|
|
813
|
+
/* @__PURE__ */ jsx(
|
|
814
|
+
"button",
|
|
815
|
+
{
|
|
816
|
+
type: "button",
|
|
817
|
+
onClick: () => handleRemove(file),
|
|
818
|
+
className: "text-text-muted hover:text-error transition-colors",
|
|
819
|
+
children: /* @__PURE__ */ jsx(X, { className: iconSizes[size] })
|
|
820
|
+
}
|
|
821
|
+
)
|
|
822
|
+
] })
|
|
823
|
+
]
|
|
824
|
+
},
|
|
825
|
+
file.uid
|
|
826
|
+
)) });
|
|
827
|
+
};
|
|
828
|
+
const currentFile = currentFileList[0];
|
|
829
|
+
const renderUploadArea = () => {
|
|
830
|
+
const dragStatus = dragActive ? "dragActive" : disabled ? "disabled" : status === "error" ? "error" : "default";
|
|
831
|
+
switch (variant) {
|
|
832
|
+
case "button":
|
|
833
|
+
return /* @__PURE__ */ jsxs(
|
|
834
|
+
"button",
|
|
835
|
+
{
|
|
836
|
+
type: "button",
|
|
837
|
+
onClick: handleClick,
|
|
838
|
+
disabled,
|
|
839
|
+
className: cn(uploadButtonVariants({ color, size }), className),
|
|
840
|
+
children: [
|
|
841
|
+
/* @__PURE__ */ jsx(Upload$1, { className: iconSizes[size] }),
|
|
842
|
+
buttonText
|
|
843
|
+
]
|
|
844
|
+
}
|
|
845
|
+
);
|
|
846
|
+
case "dropzone":
|
|
847
|
+
return /* @__PURE__ */ jsx(
|
|
848
|
+
"div",
|
|
849
|
+
{
|
|
850
|
+
onClick: handleClick,
|
|
851
|
+
onDragEnter: handleDragEnter,
|
|
852
|
+
onDragLeave: handleDragLeave,
|
|
853
|
+
onDragOver: handleDragOver,
|
|
854
|
+
onDrop: handleDrop,
|
|
855
|
+
className: cn(
|
|
856
|
+
uploadDropzoneVariants({ status: dragStatus, size }),
|
|
857
|
+
className
|
|
858
|
+
),
|
|
859
|
+
children: /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-3", children: [
|
|
860
|
+
/* @__PURE__ */ jsx(
|
|
861
|
+
Upload$1,
|
|
862
|
+
{
|
|
863
|
+
className: cn("text-text-muted", iconSizes[size])
|
|
864
|
+
}
|
|
865
|
+
),
|
|
866
|
+
/* @__PURE__ */ jsxs("div", { children: [
|
|
867
|
+
/* @__PURE__ */ jsx("p", { className: "text-sm text-text-primary font-medium", children: dragText }),
|
|
868
|
+
dragHint && /* @__PURE__ */ jsx("p", { className: "text-xs text-text-muted mt-0.5", children: dragHint })
|
|
869
|
+
] })
|
|
870
|
+
] })
|
|
871
|
+
}
|
|
872
|
+
);
|
|
873
|
+
case "dragger":
|
|
874
|
+
return /* @__PURE__ */ jsxs(
|
|
875
|
+
"div",
|
|
876
|
+
{
|
|
877
|
+
onClick: handleClick,
|
|
878
|
+
onDragEnter: handleDragEnter,
|
|
879
|
+
onDragLeave: handleDragLeave,
|
|
880
|
+
onDragOver: handleDragOver,
|
|
881
|
+
onDrop: handleDrop,
|
|
882
|
+
className: cn(
|
|
883
|
+
uploadDraggerVariants({ status: dragStatus, size }),
|
|
884
|
+
className
|
|
885
|
+
),
|
|
886
|
+
children: [
|
|
887
|
+
/* @__PURE__ */ jsx(Upload$1, { className: "w-10 h-10 text-primary" }),
|
|
888
|
+
/* @__PURE__ */ jsx("p", { className: "text-base font-medium text-text-primary", children: dragText }),
|
|
889
|
+
dragHint && /* @__PURE__ */ jsx("p", { className: "text-sm text-text-muted", children: dragHint })
|
|
890
|
+
]
|
|
891
|
+
}
|
|
892
|
+
);
|
|
893
|
+
case "avatar":
|
|
894
|
+
return /* @__PURE__ */ jsx(
|
|
895
|
+
"div",
|
|
896
|
+
{
|
|
897
|
+
onClick: handleClick,
|
|
898
|
+
onDragEnter: handleDragEnter,
|
|
899
|
+
onDragLeave: handleDragLeave,
|
|
900
|
+
onDragOver: handleDragOver,
|
|
901
|
+
onDrop: handleDrop,
|
|
902
|
+
className: cn(
|
|
903
|
+
uploadAvatarVariants({ status: dragStatus, size }),
|
|
904
|
+
className
|
|
905
|
+
),
|
|
906
|
+
children: currentFile?.thumbUrl ? /* @__PURE__ */ jsx(
|
|
907
|
+
"img",
|
|
908
|
+
{
|
|
909
|
+
src: currentFile.thumbUrl,
|
|
910
|
+
alt: "avatar",
|
|
911
|
+
className: "w-full h-full object-cover"
|
|
912
|
+
}
|
|
913
|
+
) : /* @__PURE__ */ jsx(Image, { className: "w-8 h-8 text-text-muted" })
|
|
914
|
+
}
|
|
915
|
+
);
|
|
916
|
+
case "picture":
|
|
917
|
+
return /* @__PURE__ */ jsx(
|
|
918
|
+
"div",
|
|
919
|
+
{
|
|
920
|
+
onClick: handleClick,
|
|
921
|
+
onDragEnter: handleDragEnter,
|
|
922
|
+
onDragLeave: handleDragLeave,
|
|
923
|
+
onDragOver: handleDragOver,
|
|
924
|
+
onDrop: handleDrop,
|
|
925
|
+
className: cn(
|
|
926
|
+
uploadPictureVariants({ status: dragStatus, size }),
|
|
927
|
+
className
|
|
928
|
+
),
|
|
929
|
+
children: currentFile?.thumbUrl ? /* @__PURE__ */ jsx(
|
|
930
|
+
"img",
|
|
931
|
+
{
|
|
932
|
+
src: currentFile.thumbUrl,
|
|
933
|
+
alt: "preview",
|
|
934
|
+
className: "w-full h-full object-cover"
|
|
935
|
+
}
|
|
936
|
+
) : /* @__PURE__ */ jsx(Image, { className: "w-8 h-8 text-text-muted" })
|
|
937
|
+
}
|
|
938
|
+
);
|
|
939
|
+
default:
|
|
940
|
+
return null;
|
|
941
|
+
}
|
|
942
|
+
};
|
|
943
|
+
return /* @__PURE__ */ jsxs(
|
|
944
|
+
"div",
|
|
945
|
+
{
|
|
946
|
+
ref,
|
|
947
|
+
className: "w-full",
|
|
948
|
+
children: [
|
|
949
|
+
/* @__PURE__ */ jsx(
|
|
950
|
+
"input",
|
|
951
|
+
{
|
|
952
|
+
ref: inputRef,
|
|
953
|
+
type: "file",
|
|
954
|
+
accept,
|
|
955
|
+
multiple,
|
|
956
|
+
onChange: handleInputChange,
|
|
957
|
+
disabled,
|
|
958
|
+
className: "hidden",
|
|
959
|
+
...props
|
|
960
|
+
}
|
|
961
|
+
),
|
|
962
|
+
label && /* @__PURE__ */ jsx("label", { className: "block mb-1", children: /* @__PURE__ */ jsx("span", { className: "text-sm font-medium text-text-muted", children: label }) }),
|
|
963
|
+
renderUploadArea(),
|
|
964
|
+
renderFileList(),
|
|
965
|
+
helperMessage && /* @__PURE__ */ jsx("p", { className: cn(statusMessageVariants({ status }), "mt-1"), children: helperMessage })
|
|
966
|
+
]
|
|
967
|
+
}
|
|
968
|
+
);
|
|
969
|
+
}
|
|
970
|
+
);
|
|
971
|
+
Upload.displayName = "Upload";
|
|
972
|
+
var upload_default = Upload;
|
|
973
|
+
|
|
974
|
+
export { breadcrumbs_default as Breadcrumbs, button_group_default as ButtonGroup, clipboard_default as Clipboard, grid_default as Grid, upload_default as Upload };
|
|
975
|
+
//# sourceMappingURL=index.js.map
|
|
976
|
+
//# sourceMappingURL=index.js.map
|