@godxjp/ui 6.12.0 → 8.0.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 +5 -0
- package/dist/app/index.d.ts +2 -2
- package/dist/{app.prop-IobwLwaM.d.ts → app.prop-DnIXFzLi.d.ts} +9 -9
- package/dist/aspect-ratio-DGoYrOry.d.ts +6 -0
- package/dist/avatar-D9MdXzfF.d.ts +8 -0
- package/dist/{checkbox-9w-eF8sM.d.ts → checkbox-ChRsR7Nk.d.ts} +2 -2
- package/dist/{chunk-3UGU5TYP.js → chunk-25RYBC5T.js} +2 -2
- package/dist/{chunk-CQBADMFG.js → chunk-26CPAKUP.js} +3 -2
- package/dist/{chunk-ZTYEH3UW.js → chunk-3TS3G4U3.js} +3 -3
- package/dist/{chunk-ZS6DTAM2.js → chunk-4MMIMZMK.js} +1 -1
- package/dist/{chunk-T2S3IGZG.js → chunk-4R7RQDXI.js} +23 -21
- package/dist/{chunk-Y7AV7QJO.js → chunk-6QXQQAOQ.js} +5 -5
- package/dist/{chunk-JJCGMCTL.js → chunk-A22MCA3X.js} +6 -6
- package/dist/{chunk-TW4IRRAX.js → chunk-A7PKMT7Y.js} +8 -49
- package/dist/chunk-AINW5WYN.js +57 -0
- package/dist/chunk-B3WX53JQ.js +40 -0
- package/dist/{chunk-BM5LIDCS.js → chunk-C5H655GK.js} +223 -67
- package/dist/{chunk-ZLK5SPT6.js → chunk-EOTOCNT7.js} +1 -1
- package/dist/chunk-FRU44GA2.js +18 -0
- package/dist/chunk-FYM3MJSK.js +59 -0
- package/dist/{chunk-EE3B3TEQ.js → chunk-G2WYOCDL.js} +5 -5
- package/dist/chunk-HKD6ERY7.js +1 -0
- package/dist/{chunk-V6UWJKZF.js → chunk-HTEL5DQI.js} +1 -1
- package/dist/{chunk-ICM6XBST.js → chunk-IBK5D2Q6.js} +2 -1
- package/dist/{chunk-IK7I3ABN.js → chunk-IOGU3ZWF.js} +2 -2
- package/dist/{chunk-HJEBRCXL.js → chunk-M4PZNAMV.js} +1 -0
- package/dist/{chunk-2QG3OVAD.js → chunk-N43OKOFT.js} +7 -5
- package/dist/{chunk-YVBZ37ZE.js → chunk-NG23LVTM.js} +5 -5
- package/dist/{chunk-E76QIYSY.js → chunk-O24Z3ULJ.js} +4 -4
- package/dist/{chunk-GXHZAJUA.js → chunk-O2OUNXV4.js} +10 -10
- package/dist/{chunk-L6J44O74.js → chunk-OJZ6C2HM.js} +2 -2
- package/dist/{chunk-2HLWHQJA.js → chunk-P4HFJQID.js} +5 -4
- package/dist/chunk-R2W2FX5Q.js +48 -0
- package/dist/{chunk-AZS7553U.js → chunk-RGIYKJPW.js} +6 -6
- package/dist/{chunk-GH7E5N6F.js → chunk-RGPF3HU6.js} +3 -3
- package/dist/chunk-SEG2YBXF.js +29 -0
- package/dist/{chunk-JBEIL3VD.js → chunk-SKIRU7GC.js} +2 -2
- package/dist/chunk-TILFZBTE.js +50 -0
- package/dist/{chunk-6UFKWOEW.js → chunk-TMDGV4CN.js} +15 -11
- package/dist/chunk-UIYEAUWA.js +78 -0
- package/dist/{chunk-XG7XDYIM.js → chunk-V3N266PT.js} +48 -2
- package/dist/{chunk-I3272Y2C.js → chunk-WN52SCGE.js} +4 -4
- package/dist/{chunk-T4UT3B3K.js → chunk-WTVLZVBA.js} +153 -188
- package/dist/{chunk-SWGQX3AP.js → chunk-XDUZ7JJL.js} +2 -2
- package/dist/chunk-XMBCNMJI.js +61 -0
- package/dist/{chunk-RVY4F7LK.js → chunk-XZM2GNAY.js} +7 -7
- package/dist/{chunk-K27I23OA.js → chunk-Z6HNY2PL.js} +9 -9
- package/dist/components/admin/index.d.ts +24 -22
- package/dist/components/admin/index.js +33 -32
- package/dist/components/data-display/badge.d.ts +15 -4
- package/dist/components/data-display/badge.js +4 -2
- package/dist/components/data-display/card.d.ts +3 -3
- package/dist/components/data-display/card.js +1 -1
- package/dist/components/data-display/index.d.ts +14 -26
- package/dist/components/data-display/index.js +28 -37
- package/dist/components/data-display/table.js +2 -2
- package/dist/components/data-entry/autocomplete.d.ts +5 -5
- package/dist/components/data-entry/autocomplete.js +5 -5
- package/dist/components/data-entry/calendar.d.ts +5 -5
- package/dist/components/data-entry/calendar.js +3 -3
- package/dist/components/data-entry/cascader.d.ts +6 -6
- package/dist/components/data-entry/cascader.js +7 -7
- package/dist/components/data-entry/checkbox.d.ts +6 -6
- package/dist/components/data-entry/checkbox.js +2 -2
- package/dist/components/data-entry/color-picker.d.ts +6 -6
- package/dist/components/data-entry/color-picker.js +2 -2
- package/dist/components/data-entry/command.d.ts +11 -11
- package/dist/components/data-entry/command.js +2 -2
- package/dist/components/data-entry/date-picker.d.ts +6 -6
- package/dist/components/data-entry/date-picker.js +4 -4
- package/dist/components/data-entry/date-range-picker.d.ts +6 -6
- package/dist/components/data-entry/date-range-picker.js +4 -4
- package/dist/components/data-entry/index.d.ts +13 -19
- package/dist/components/data-entry/index.js +27 -145
- package/dist/components/data-entry/radio.d.ts +5 -5
- package/dist/components/data-entry/radio.js +2 -2
- package/dist/components/data-entry/select.d.ts +5 -5
- package/dist/components/data-entry/select.js +5 -5
- package/dist/components/data-entry/slider.d.ts +5 -5
- package/dist/components/data-entry/switch.d.ts +5 -5
- package/dist/components/data-entry/switch.js +1 -1
- package/dist/components/data-entry/textarea.js +2 -2
- package/dist/components/data-entry/time-picker.d.ts +6 -6
- package/dist/components/data-entry/time-picker.js +2 -2
- package/dist/components/data-entry/transfer.d.ts +7 -7
- package/dist/components/data-entry/transfer.js +5 -5
- package/dist/components/data-entry/tree-select.d.ts +6 -6
- package/dist/components/data-entry/tree-select.js +7 -7
- package/dist/components/data-entry/upload.d.ts +7 -7
- package/dist/components/data-entry/upload.js +5 -5
- package/dist/components/feedback/alert.d.ts +7 -5
- package/dist/components/feedback/alert.js +3 -3
- package/dist/components/feedback/dialog.d.ts +9 -6
- package/dist/components/feedback/dialog.js +2 -2
- package/dist/components/feedback/index.d.ts +7 -6
- package/dist/components/feedback/index.js +9 -7
- package/dist/components/general/button.d.ts +4 -4
- package/dist/components/general/button.js +1 -1
- package/dist/components/general/index.d.ts +3 -3
- package/dist/components/general/index.js +1 -1
- package/dist/components/layout/index.d.ts +19 -45
- package/dist/components/layout/index.js +4 -5
- package/dist/components/navigation/index.d.ts +13 -14
- package/dist/components/navigation/index.js +9 -10
- package/dist/components/navigation/pagination.d.ts +5 -5
- package/dist/components/navigation/pagination.js +6 -6
- package/dist/components/navigation/steps.d.ts +6 -6
- package/dist/components/navigation/steps.js +2 -2
- package/dist/components/navigation/tabs.d.ts +14 -2
- package/dist/components/navigation/tabs.js +1 -1
- package/dist/components/query/index.d.ts +12 -7
- package/dist/components/query/index.js +4 -4
- package/dist/components/ui/index.d.ts +21 -14
- package/dist/components/ui/index.js +32 -29
- package/dist/{data-display.prop-i0iaSwMV.d.ts → data-display.prop-Cf2p9QC4.d.ts} +18 -17
- package/dist/{data-entry.prop-Cjidhei7.d.ts → data-entry.prop-CDkOajPj.d.ts} +34 -40
- package/dist/{data-table-Bg7fPpXy.d.ts → data-table-B_q7j992.d.ts} +10 -33
- package/dist/{data.prop-BmLaGLb7.d.ts → data.prop-DMYMNl6L.d.ts} +2 -2
- package/dist/{feedback.prop-BnBpUzNK.d.ts → feedback.prop-BR5JOpPl.d.ts} +8 -5
- package/dist/filter-bar-DvVXm_d1.d.ts +14 -0
- package/dist/form/index.d.ts +3 -3
- package/dist/{form.prop-BHgpuFFm.d.ts → form.prop-Bc6r6JJW.d.ts} +1 -1
- package/dist/{general.prop-D7brMPNL.d.ts → general.prop-DoHDCRmL.d.ts} +2 -2
- package/dist/index.d.ts +27 -25
- package/dist/index.js +46 -32
- package/dist/inline-DqfYlGKj.d.ts +18 -0
- package/dist/{interaction.prop-Cdn7wOtq.d.ts → interaction.prop-DSFizzP6.d.ts} +8 -6
- package/dist/{layout.prop-MwHm4-Zl.d.ts → layout.prop-Baq9muDN.d.ts} +27 -13
- package/dist/layout.prop-CXvl2rVR.d.ts +16 -0
- package/dist/{navigation.prop-Ck5_gSfs.d.ts → navigation.prop-8DgElO0c.d.ts} +17 -14
- package/dist/{navigation.prop-Hu7s7MJa.d.ts → navigation.prop-BKlxd-j7.d.ts} +2 -5
- package/dist/props/components/index.d.ts +14 -14
- package/dist/props/index.d.ts +14 -14
- package/dist/props/index.js +2 -2
- package/dist/props/registry.d.ts +254 -64
- package/dist/props/registry.js +1 -1
- package/dist/props/vocabulary/index.d.ts +5 -5
- package/dist/{query.prop-hIPrk2zI.d.ts → query.prop-DuODxsiU.d.ts} +12 -8
- package/dist/{search-input-mAZy3Den.d.ts → search-input-cezAxpgb.d.ts} +7 -2
- package/dist/{shared.prop-BNRJc9K0.d.ts → shared.prop-BsNSXeqD.d.ts} +9 -3
- package/dist/skeleton-uWAjSacg.d.ts +22 -0
- package/dist/styles/alert-layout.css +38 -18
- package/dist/styles/badge-layout.css +4 -4
- package/dist/styles/card-layout.css +24 -24
- package/dist/styles/control.css +68 -0
- package/dist/styles/data-display-layout.css +23 -81
- package/dist/styles/density.css +10 -10
- package/dist/styles/dialog-layout.css +4 -4
- package/dist/styles/index.css +6 -9
- package/dist/styles/layout.css +114 -85
- package/dist/styles/table-layout.css +3 -3
- package/dist/theme/example.service.css +0 -5
- package/dist/toggle-group-BulJgKh3.d.ts +26 -0
- package/dist/tokens/base.css +7 -7
- package/dist/tokens/components/badge.css +7 -0
- package/dist/tokens/{primitives → components}/card.css +11 -12
- package/dist/tokens/{primitives → components}/control.css +10 -0
- package/dist/tokens/components/feedback.css +17 -0
- package/dist/tokens/{primitives → components}/table.css +2 -2
- package/dist/tokens/foundation.css +7 -22
- package/dist/use-toast-Dsw3yE2S.d.ts +19 -0
- package/package.json +13 -7
- package/scripts/ui-audit.mjs +22 -0
- package/dist/chunk-BPSKQUL2.js +0 -68
- package/dist/chunk-M64MVRLS.js +0 -92
- package/dist/chunk-PIIRNAXA.js +0 -26
- package/dist/chunk-S66TJXJU.js +0 -33
- package/dist/chunk-WXW43RK5.js +0 -24
- package/dist/components/navigation/tabs-items.d.ts +0 -12
- package/dist/components/navigation/tabs-items.js +0 -3
- package/dist/filter-bar-BpUvE_yO.d.ts +0 -10
- package/dist/inline-CV3A46np.d.ts +0 -10
- package/dist/layout.prop-4TCNvyQZ.d.ts +0 -20
- package/dist/tokens/primitives/badge.css +0 -13
- package/dist/tokens/primitives/feedback.css +0 -17
- package/dist/use-toast-Dol5bdY3.d.ts +0 -34
- /package/dist/{chunk-LDSLS6HE.js → chunk-2H65B4JA.js} +0 -0
- /package/dist/tokens/{primitives → components}/navigation.css +0 -0
- /package/dist/tokens/{primitives → semantic}/layout.css +0 -0
|
@@ -1,21 +1,67 @@
|
|
|
1
1
|
import { cn } from './chunk-U7N2A7A3.js';
|
|
2
2
|
import * as React from 'react';
|
|
3
3
|
import * as TabsPrimitive from '@radix-ui/react-tabs';
|
|
4
|
-
import { jsx } from 'react/jsx-runtime';
|
|
4
|
+
import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
|
5
5
|
|
|
6
6
|
function Tabs({
|
|
7
7
|
className,
|
|
8
8
|
orientation = "horizontal",
|
|
9
|
+
items,
|
|
10
|
+
value,
|
|
11
|
+
defaultValue,
|
|
12
|
+
variant = "default",
|
|
13
|
+
listClassName,
|
|
14
|
+
contentClassName,
|
|
9
15
|
...props
|
|
10
16
|
}) {
|
|
17
|
+
const firstValue = items?.[0]?.value;
|
|
18
|
+
const resolvedDefault = defaultValue ?? firstValue;
|
|
11
19
|
return /* @__PURE__ */ jsx(
|
|
12
20
|
TabsPrimitive.Root,
|
|
13
21
|
{
|
|
14
22
|
"data-slot": "tabs",
|
|
15
23
|
"data-orientation": orientation,
|
|
16
24
|
orientation,
|
|
25
|
+
value,
|
|
26
|
+
defaultValue: value === void 0 ? resolvedDefault : void 0,
|
|
17
27
|
className: cn("group/tabs flex gap-2 data-[orientation=horizontal]:flex-col", className),
|
|
18
|
-
...props
|
|
28
|
+
...props,
|
|
29
|
+
children: items ? /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
30
|
+
/* @__PURE__ */ jsx(
|
|
31
|
+
TabsList,
|
|
32
|
+
{
|
|
33
|
+
"data-slot": "tabs-list",
|
|
34
|
+
className: cn(
|
|
35
|
+
variant === "line" && "h-auto w-full justify-start rounded-none border-b bg-transparent p-0",
|
|
36
|
+
variant === "card" && "w-full justify-start",
|
|
37
|
+
listClassName
|
|
38
|
+
),
|
|
39
|
+
children: items.map((item) => /* @__PURE__ */ jsx(
|
|
40
|
+
TabsTrigger,
|
|
41
|
+
{
|
|
42
|
+
value: item.value,
|
|
43
|
+
disabled: item.disabled,
|
|
44
|
+
className: cn(
|
|
45
|
+
variant === "line" && "data-[state=active]:border-primary rounded-none border-b-2 border-transparent bg-transparent px-4 py-2 shadow-none data-[state=active]:bg-transparent data-[state=active]:shadow-none",
|
|
46
|
+
variant === "card" && "data-[state=active]:shadow-sm"
|
|
47
|
+
),
|
|
48
|
+
children: item.label
|
|
49
|
+
},
|
|
50
|
+
item.value
|
|
51
|
+
))
|
|
52
|
+
}
|
|
53
|
+
),
|
|
54
|
+
items.map((item) => /* @__PURE__ */ jsx(
|
|
55
|
+
TabsContent,
|
|
56
|
+
{
|
|
57
|
+
value: item.value,
|
|
58
|
+
"data-slot": "tabs-panel",
|
|
59
|
+
className: cn(variant === "line" && "mt-0", contentClassName),
|
|
60
|
+
children: item.content
|
|
61
|
+
},
|
|
62
|
+
item.value
|
|
63
|
+
))
|
|
64
|
+
] }) : props.children
|
|
19
65
|
}
|
|
20
66
|
);
|
|
21
67
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { Calendar } from './chunk-
|
|
1
|
+
import { Calendar } from './chunk-IOGU3ZWF.js';
|
|
2
2
|
import { Input } from './chunk-VOHTRR5X.js';
|
|
3
3
|
import { Popover, PopoverTrigger, PopoverContent } from './chunk-DY5C44UP.js';
|
|
4
|
-
import { Button } from './chunk-
|
|
4
|
+
import { Button } from './chunk-M4PZNAMV.js';
|
|
5
5
|
import { useTranslation, usePickerLocales } from './chunk-RLGHEV4A.js';
|
|
6
6
|
import { toIsoDate, parseDateInput } from './chunk-FXFJF4YA.js';
|
|
7
7
|
import { cn } from './chunk-U7N2A7A3.js';
|
|
@@ -12,7 +12,7 @@ import { jsxs, jsx } from 'react/jsx-runtime';
|
|
|
12
12
|
var ISO_HINT = "yyyy-mm-dd";
|
|
13
13
|
function DateRangePicker({
|
|
14
14
|
value,
|
|
15
|
-
|
|
15
|
+
onValueChange,
|
|
16
16
|
placeholder,
|
|
17
17
|
disabled,
|
|
18
18
|
className,
|
|
@@ -32,7 +32,7 @@ function DateRangePicker({
|
|
|
32
32
|
setToText(toIsoDate(value?.to));
|
|
33
33
|
}, [value?.from, value?.to]);
|
|
34
34
|
const resolvedPlaceholder = placeholder ?? t("dataEntry.dateRangePicker.placeholder") ?? ISO_HINT;
|
|
35
|
-
const emit = (next) =>
|
|
35
|
+
const emit = (next) => onValueChange?.(next);
|
|
36
36
|
const commitEdge = (edge, raw) => {
|
|
37
37
|
const parsed = raw.trim() === "" ? void 0 : parseDateInput(raw.trim()) ?? void 0;
|
|
38
38
|
const next = { from: value?.from, to: value?.to, [edge]: parsed };
|
|
@@ -1,16 +1,19 @@
|
|
|
1
|
-
import { DropdownMenu, DropdownMenuTrigger } from './chunk-TO33OY4L.js';
|
|
2
1
|
import { Tooltip, TooltipTrigger, TooltipContent } from './chunk-32WO3YLB.js';
|
|
2
|
+
import { DropdownMenu, DropdownMenuTrigger } from './chunk-TO33OY4L.js';
|
|
3
3
|
import { Collapsible, CollapsibleTrigger, CollapsibleContent } from './chunk-DV52WNXO.js';
|
|
4
|
-
import { densityClass, pageContainerVariantClass,
|
|
5
|
-
import { Badge } from './chunk-PIIRNAXA.js';
|
|
4
|
+
import { densityClass, pageContainerVariantClass, Flex } from './chunk-TILFZBTE.js';
|
|
6
5
|
import { Popover, PopoverTrigger, PopoverContent } from './chunk-DY5C44UP.js';
|
|
7
6
|
import { cn } from './chunk-U7N2A7A3.js';
|
|
8
7
|
import { Link } from 'react-router-dom';
|
|
9
8
|
import { ChevronRight, ChevronDown, PanelLeftOpen, PanelLeftClose, Search, Bell, SlidersHorizontal } from 'lucide-react';
|
|
10
|
-
import {
|
|
9
|
+
import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
|
11
10
|
import * as React from 'react';
|
|
11
|
+
import * as SeparatorPrimitive from '@radix-ui/react-separator';
|
|
12
12
|
|
|
13
|
-
function
|
|
13
|
+
function PageContainerInset({ className, children, ...props }) {
|
|
14
|
+
return /* @__PURE__ */ jsx("div", { className: cn("ui-page-container-inset", className), ...props, children });
|
|
15
|
+
}
|
|
16
|
+
function PageContainerRoot({
|
|
14
17
|
title,
|
|
15
18
|
subtitle,
|
|
16
19
|
extra,
|
|
@@ -62,11 +65,14 @@ function PageContainer({
|
|
|
62
65
|
}
|
|
63
66
|
);
|
|
64
67
|
}
|
|
65
|
-
|
|
66
|
-
|
|
68
|
+
var PageContainer = Object.assign(PageContainerRoot, {
|
|
69
|
+
Inset: PageContainerInset
|
|
70
|
+
});
|
|
71
|
+
function PageInset(props) {
|
|
72
|
+
return /* @__PURE__ */ jsx(PageContainerInset, { ...props });
|
|
67
73
|
}
|
|
68
|
-
function Stack(
|
|
69
|
-
return /* @__PURE__ */ jsx(
|
|
74
|
+
function Stack(props) {
|
|
75
|
+
return /* @__PURE__ */ jsx(Flex, { direction: "col", ...props });
|
|
70
76
|
}
|
|
71
77
|
function AppShell({
|
|
72
78
|
sidebar,
|
|
@@ -95,131 +101,14 @@ function AppShell({
|
|
|
95
101
|
footer !== void 0 && /* @__PURE__ */ jsx("footer", { className: "app-footer", children: footer })
|
|
96
102
|
] });
|
|
97
103
|
}
|
|
98
|
-
function
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
onTweaksOpen,
|
|
107
|
-
collapsed = false,
|
|
108
|
-
onToggleCollapsed,
|
|
109
|
-
rightSlot,
|
|
110
|
-
unread = false,
|
|
111
|
-
onNotificationsOpen,
|
|
112
|
-
user
|
|
113
|
-
}) {
|
|
114
|
-
const productChip = /* @__PURE__ */ jsxs(
|
|
115
|
-
"button",
|
|
116
|
-
{
|
|
117
|
-
type: "button",
|
|
118
|
-
className: "tb-chip",
|
|
119
|
-
"aria-label": product.name,
|
|
120
|
-
onClick: productMenu ? void 0 : onProductOpen,
|
|
121
|
-
children: [
|
|
122
|
-
/* @__PURE__ */ jsx(
|
|
123
|
-
"span",
|
|
124
|
-
{
|
|
125
|
-
className: "tb-chip-icon",
|
|
126
|
-
style: { background: product.color ?? "hsl(var(--attention))" },
|
|
127
|
-
children: product.name[0]?.toUpperCase() ?? "?"
|
|
128
|
-
}
|
|
129
|
-
),
|
|
130
|
-
/* @__PURE__ */ jsx("span", { className: "tb-chip-label", children: product.name }),
|
|
131
|
-
/* @__PURE__ */ jsx("span", { className: "tb-chip-caret", children: /* @__PURE__ */ jsx(ChevronDown, { "aria-hidden": "true" }) })
|
|
132
|
-
]
|
|
133
|
-
}
|
|
134
|
-
);
|
|
135
|
-
const showProject = project != null || projectMenu != null;
|
|
136
|
-
const projectChip = /* @__PURE__ */ jsxs(
|
|
137
|
-
"button",
|
|
138
|
-
{
|
|
139
|
-
type: "button",
|
|
140
|
-
className: `tb-chip ${project ? "" : "tb-chip-empty"}`,
|
|
141
|
-
"aria-label": project ? project.name : "Pick project",
|
|
142
|
-
onClick: projectMenu ? void 0 : onProjectOpen,
|
|
143
|
-
children: [
|
|
144
|
-
/* @__PURE__ */ jsx("span", { className: "tb-chip-label", children: project ? project.name : "Pick project" }),
|
|
145
|
-
/* @__PURE__ */ jsx("span", { className: "tb-chip-caret", children: /* @__PURE__ */ jsx(ChevronDown, { "aria-hidden": "true" }) })
|
|
146
|
-
]
|
|
147
|
-
}
|
|
148
|
-
);
|
|
149
|
-
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
150
|
-
onToggleCollapsed ? /* @__PURE__ */ jsx(
|
|
151
|
-
"button",
|
|
152
|
-
{
|
|
153
|
-
type: "button",
|
|
154
|
-
className: "tb-icon-btn",
|
|
155
|
-
"aria-label": "Toggle sidebar",
|
|
156
|
-
"aria-pressed": collapsed,
|
|
157
|
-
onClick: onToggleCollapsed,
|
|
158
|
-
children: collapsed ? /* @__PURE__ */ jsx(PanelLeftOpen, { "aria-hidden": "true" }) : /* @__PURE__ */ jsx(PanelLeftClose, { "aria-hidden": "true" })
|
|
159
|
-
}
|
|
160
|
-
) : null,
|
|
161
|
-
/* @__PURE__ */ jsxs("div", { className: "tb-switcher", children: [
|
|
162
|
-
productMenu ? /* @__PURE__ */ jsxs(DropdownMenu, { children: [
|
|
163
|
-
/* @__PURE__ */ jsx(DropdownMenuTrigger, { asChild: true, children: productChip }),
|
|
164
|
-
productMenu
|
|
165
|
-
] }) : productChip,
|
|
166
|
-
showProject ? /* @__PURE__ */ jsx("span", { className: "tb-chip-sep", children: "/" }) : null,
|
|
167
|
-
showProject ? projectMenu ? /* @__PURE__ */ jsxs(DropdownMenu, { children: [
|
|
168
|
-
/* @__PURE__ */ jsx(DropdownMenuTrigger, { asChild: true, children: projectChip }),
|
|
169
|
-
projectMenu
|
|
170
|
-
] }) : projectChip : null
|
|
171
|
-
] }),
|
|
172
|
-
/* @__PURE__ */ jsxs("button", { type: "button", className: "tb-search", onClick: onSearchOpen, children: [
|
|
173
|
-
/* @__PURE__ */ jsx(Search, { "aria-hidden": "true" }),
|
|
174
|
-
/* @__PURE__ */ jsx("span", { children: "Search..." }),
|
|
175
|
-
/* @__PURE__ */ jsx("kbd", { className: "kbd", children: "\u2318K" })
|
|
176
|
-
] }),
|
|
177
|
-
rightSlot,
|
|
178
|
-
onNotificationsOpen ? /* @__PURE__ */ jsxs(
|
|
179
|
-
"button",
|
|
180
|
-
{
|
|
181
|
-
type: "button",
|
|
182
|
-
className: "tb-icon-btn tb-bell",
|
|
183
|
-
"aria-label": "Notifications",
|
|
184
|
-
onClick: onNotificationsOpen,
|
|
185
|
-
children: [
|
|
186
|
-
/* @__PURE__ */ jsx(Bell, { "aria-hidden": "true" }),
|
|
187
|
-
unread ? /* @__PURE__ */ jsx("span", { className: "tb-bell-dot", "aria-hidden": "true" }) : null
|
|
188
|
-
]
|
|
189
|
-
}
|
|
190
|
-
) : null,
|
|
191
|
-
user,
|
|
192
|
-
onTweaksOpen ? /* @__PURE__ */ jsx(
|
|
193
|
-
"button",
|
|
194
|
-
{
|
|
195
|
-
type: "button",
|
|
196
|
-
className: "tb-icon-btn",
|
|
197
|
-
"aria-label": "Open tweaks",
|
|
198
|
-
onClick: onTweaksOpen,
|
|
199
|
-
children: /* @__PURE__ */ jsx(SlidersHorizontal, { "aria-hidden": "true" })
|
|
200
|
-
}
|
|
201
|
-
) : null
|
|
202
|
-
] });
|
|
203
|
-
}
|
|
204
|
-
function ShellApp({ menu, breadcrumb, children }) {
|
|
205
|
-
return /* @__PURE__ */ jsx(
|
|
206
|
-
AppShell,
|
|
207
|
-
{
|
|
208
|
-
sidebar: menu,
|
|
209
|
-
breadcrumb,
|
|
210
|
-
topbar: /* @__PURE__ */ jsx(
|
|
211
|
-
Topbar,
|
|
212
|
-
{
|
|
213
|
-
product: { name: "GodX", color: "hsl(var(--attention))" },
|
|
214
|
-
project: { name: "Japan to SEA lanes" },
|
|
215
|
-
onSearchOpen: () => void 0,
|
|
216
|
-
onNotificationsOpen: () => void 0,
|
|
217
|
-
unread: true
|
|
218
|
-
}
|
|
219
|
-
),
|
|
220
|
-
children
|
|
221
|
-
}
|
|
222
|
-
);
|
|
104
|
+
function Breadcrumb({ items }) {
|
|
105
|
+
return /* @__PURE__ */ jsx("nav", { "aria-label": "Breadcrumb", className: "ui-breadcrumb", children: /* @__PURE__ */ jsx("ol", { className: "ui-breadcrumb-list", children: items.map((item, index) => {
|
|
106
|
+
const isLast = index === items.length - 1;
|
|
107
|
+
return /* @__PURE__ */ jsxs("li", { className: "ui-breadcrumb-item", children: [
|
|
108
|
+
item.to && !isLast ? /* @__PURE__ */ jsx(Link, { to: item.to, className: "ui-breadcrumb-link", children: item.label }) : /* @__PURE__ */ jsx("span", { className: "ui-breadcrumb-current", "aria-current": isLast ? "page" : void 0, children: item.label }),
|
|
109
|
+
!isLast ? /* @__PURE__ */ jsx(ChevronRight, { "aria-hidden": "true" }) : null
|
|
110
|
+
] }, item.to ?? index);
|
|
111
|
+
}) }) });
|
|
223
112
|
}
|
|
224
113
|
function isItemActive(item, activeId) {
|
|
225
114
|
if (item.id === activeId) return true;
|
|
@@ -376,32 +265,128 @@ function Sidebar({
|
|
|
376
265
|
footer ? /* @__PURE__ */ jsx("div", { className: "sb-footer", children: footer }) : null
|
|
377
266
|
] });
|
|
378
267
|
}
|
|
379
|
-
function
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
268
|
+
function Topbar({
|
|
269
|
+
product,
|
|
270
|
+
project,
|
|
271
|
+
productMenu,
|
|
272
|
+
projectMenu,
|
|
273
|
+
onProductOpen,
|
|
274
|
+
onProjectOpen,
|
|
275
|
+
onSearchOpen,
|
|
276
|
+
onTweaksOpen,
|
|
277
|
+
collapsed = false,
|
|
278
|
+
onToggleCollapsed,
|
|
279
|
+
rightSlot,
|
|
280
|
+
unread = false,
|
|
281
|
+
onNotificationsOpen,
|
|
282
|
+
user
|
|
283
|
+
}) {
|
|
284
|
+
const productChip = /* @__PURE__ */ jsxs(
|
|
285
|
+
"button",
|
|
286
|
+
{
|
|
287
|
+
type: "button",
|
|
288
|
+
className: "tb-chip",
|
|
289
|
+
"aria-label": product.name,
|
|
290
|
+
onClick: productMenu ? void 0 : onProductOpen,
|
|
291
|
+
children: [
|
|
292
|
+
/* @__PURE__ */ jsx(
|
|
293
|
+
"span",
|
|
294
|
+
{
|
|
295
|
+
className: "tb-chip-icon",
|
|
296
|
+
style: { background: product.color ?? "hsl(var(--attention))" },
|
|
297
|
+
children: product.name[0]?.toUpperCase() ?? "?"
|
|
298
|
+
}
|
|
299
|
+
),
|
|
300
|
+
/* @__PURE__ */ jsx("span", { className: "tb-chip-label", children: product.name }),
|
|
301
|
+
/* @__PURE__ */ jsx("span", { className: "tb-chip-caret", children: /* @__PURE__ */ jsx(ChevronDown, { "aria-hidden": "true" }) })
|
|
302
|
+
]
|
|
303
|
+
}
|
|
304
|
+
);
|
|
305
|
+
const showProject = project != null || projectMenu != null;
|
|
306
|
+
const projectChip = /* @__PURE__ */ jsxs(
|
|
307
|
+
"button",
|
|
387
308
|
{
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
309
|
+
type: "button",
|
|
310
|
+
className: `tb-chip ${project ? "" : "tb-chip-empty"}`,
|
|
311
|
+
"aria-label": project ? project.name : "Pick project",
|
|
312
|
+
onClick: projectMenu ? void 0 : onProjectOpen,
|
|
313
|
+
children: [
|
|
314
|
+
/* @__PURE__ */ jsx("span", { className: "tb-chip-label", children: project ? project.name : "Pick project" }),
|
|
315
|
+
/* @__PURE__ */ jsx("span", { className: "tb-chip-caret", children: /* @__PURE__ */ jsx(ChevronDown, { "aria-hidden": "true" }) })
|
|
316
|
+
]
|
|
391
317
|
}
|
|
392
318
|
);
|
|
319
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
320
|
+
onToggleCollapsed ? /* @__PURE__ */ jsx(
|
|
321
|
+
"button",
|
|
322
|
+
{
|
|
323
|
+
type: "button",
|
|
324
|
+
className: "tb-icon-btn",
|
|
325
|
+
"aria-label": "Toggle sidebar",
|
|
326
|
+
"aria-pressed": collapsed,
|
|
327
|
+
onClick: onToggleCollapsed,
|
|
328
|
+
children: collapsed ? /* @__PURE__ */ jsx(PanelLeftOpen, { "aria-hidden": "true" }) : /* @__PURE__ */ jsx(PanelLeftClose, { "aria-hidden": "true" })
|
|
329
|
+
}
|
|
330
|
+
) : null,
|
|
331
|
+
/* @__PURE__ */ jsxs("div", { className: "tb-switcher", children: [
|
|
332
|
+
productMenu ? /* @__PURE__ */ jsxs(DropdownMenu, { children: [
|
|
333
|
+
/* @__PURE__ */ jsx(DropdownMenuTrigger, { asChild: true, children: productChip }),
|
|
334
|
+
productMenu
|
|
335
|
+
] }) : productChip,
|
|
336
|
+
showProject ? /* @__PURE__ */ jsx("span", { className: "tb-chip-sep", children: "/" }) : null,
|
|
337
|
+
showProject ? projectMenu ? /* @__PURE__ */ jsxs(DropdownMenu, { children: [
|
|
338
|
+
/* @__PURE__ */ jsx(DropdownMenuTrigger, { asChild: true, children: projectChip }),
|
|
339
|
+
projectMenu
|
|
340
|
+
] }) : projectChip : null
|
|
341
|
+
] }),
|
|
342
|
+
/* @__PURE__ */ jsxs("button", { type: "button", className: "tb-search", onClick: onSearchOpen, children: [
|
|
343
|
+
/* @__PURE__ */ jsx(Search, { "aria-hidden": "true" }),
|
|
344
|
+
/* @__PURE__ */ jsx("span", { children: "Search..." }),
|
|
345
|
+
/* @__PURE__ */ jsx("kbd", { className: "kbd", children: "\u2318K" })
|
|
346
|
+
] }),
|
|
347
|
+
rightSlot,
|
|
348
|
+
onNotificationsOpen ? /* @__PURE__ */ jsxs(
|
|
349
|
+
"button",
|
|
350
|
+
{
|
|
351
|
+
type: "button",
|
|
352
|
+
className: "tb-icon-btn tb-bell",
|
|
353
|
+
"aria-label": "Notifications",
|
|
354
|
+
onClick: onNotificationsOpen,
|
|
355
|
+
children: [
|
|
356
|
+
/* @__PURE__ */ jsx(Bell, { "aria-hidden": "true" }),
|
|
357
|
+
unread ? /* @__PURE__ */ jsx("span", { className: "tb-bell-dot", "aria-hidden": "true" }) : null
|
|
358
|
+
]
|
|
359
|
+
}
|
|
360
|
+
) : null,
|
|
361
|
+
user,
|
|
362
|
+
onTweaksOpen ? /* @__PURE__ */ jsx(
|
|
363
|
+
"button",
|
|
364
|
+
{
|
|
365
|
+
type: "button",
|
|
366
|
+
className: "tb-icon-btn",
|
|
367
|
+
"aria-label": "Open tweaks",
|
|
368
|
+
onClick: onTweaksOpen,
|
|
369
|
+
children: /* @__PURE__ */ jsx(SlidersHorizontal, { "aria-hidden": "true" })
|
|
370
|
+
}
|
|
371
|
+
) : null
|
|
372
|
+
] });
|
|
393
373
|
}
|
|
394
|
-
function
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
}
|
|
374
|
+
function resolveColumns(columns) {
|
|
375
|
+
if (typeof columns === "number") {
|
|
376
|
+
return {
|
|
377
|
+
"--responsive-grid-sm": Math.min(columns, 2),
|
|
378
|
+
"--responsive-grid-md": Math.min(columns, 3),
|
|
379
|
+
"--responsive-grid-lg": columns
|
|
380
|
+
};
|
|
381
|
+
}
|
|
382
|
+
return {
|
|
383
|
+
"--responsive-grid-sm": columns.sm ?? 1,
|
|
384
|
+
"--responsive-grid-md": columns.md ?? columns.sm ?? 1,
|
|
385
|
+
"--responsive-grid-lg": columns.lg ?? columns.md ?? columns.sm ?? 1
|
|
386
|
+
};
|
|
402
387
|
}
|
|
403
388
|
function ResponsiveGrid({ columns = 4, children }) {
|
|
404
|
-
return /* @__PURE__ */ jsx("div", { className: "ui-responsive-grid",
|
|
389
|
+
return /* @__PURE__ */ jsx("div", { className: "ui-responsive-grid", style: resolveColumns(columns), children });
|
|
405
390
|
}
|
|
406
391
|
function SplitPane({ children, aside, asideWidth = "md" }) {
|
|
407
392
|
return /* @__PURE__ */ jsxs("div", { className: "ui-split-pane", "data-aside-width": asideWidth, children: [
|
|
@@ -409,38 +394,18 @@ function SplitPane({ children, aside, asideWidth = "md" }) {
|
|
|
409
394
|
/* @__PURE__ */ jsx("aside", { className: "ui-split-pane-aside", children: aside })
|
|
410
395
|
] });
|
|
411
396
|
}
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
status ? /* @__PURE__ */ jsx(Badge, { variant: "secondary", children: status }) : null
|
|
426
|
-
] }),
|
|
427
|
-
/* @__PURE__ */ jsx("main", { className: "ui-mobile-main", children }),
|
|
428
|
-
navItems.length > 0 ? /* @__PURE__ */ jsx("footer", { className: "ui-mobile-nav", children: navItems.map((item) => {
|
|
429
|
-
const Icon = item.icon;
|
|
430
|
-
return /* @__PURE__ */ jsxs(
|
|
431
|
-
"div",
|
|
432
|
-
{
|
|
433
|
-
className: "ui-mobile-nav-item",
|
|
434
|
-
"data-active": item.active ? "true" : void 0,
|
|
435
|
-
children: [
|
|
436
|
-
/* @__PURE__ */ jsx(Icon, { "aria-hidden": "true" }),
|
|
437
|
-
/* @__PURE__ */ jsx("span", { children: item.label })
|
|
438
|
-
]
|
|
439
|
-
},
|
|
440
|
-
item.label
|
|
441
|
-
);
|
|
442
|
-
}) }) : null
|
|
443
|
-
] }) });
|
|
444
|
-
}
|
|
397
|
+
var Separator = React.forwardRef(({ className, orientation = "horizontal", decorative = true, ...props }, ref) => /* @__PURE__ */ jsx(
|
|
398
|
+
SeparatorPrimitive.Root,
|
|
399
|
+
{
|
|
400
|
+
ref,
|
|
401
|
+
"data-slot": "separator",
|
|
402
|
+
"data-orientation": orientation,
|
|
403
|
+
orientation,
|
|
404
|
+
decorative,
|
|
405
|
+
className: cn("ui-separator", className),
|
|
406
|
+
...props
|
|
407
|
+
}
|
|
408
|
+
));
|
|
409
|
+
Separator.displayName = SeparatorPrimitive.Root.displayName;
|
|
445
410
|
|
|
446
|
-
export { AppShell, Breadcrumb,
|
|
411
|
+
export { AppShell, Breadcrumb, PageContainer, PageInset, ResponsiveGrid, Separator, Sidebar, SplitPane, Stack, Topbar };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { SearchSelect } from './chunk-
|
|
1
|
+
import { SearchSelect } from './chunk-6QXQQAOQ.js';
|
|
2
2
|
import { jsx } from 'react/jsx-runtime';
|
|
3
3
|
|
|
4
4
|
function Autocomplete({
|
|
@@ -17,7 +17,7 @@ function Autocomplete({
|
|
|
17
17
|
{
|
|
18
18
|
id,
|
|
19
19
|
value,
|
|
20
|
-
|
|
20
|
+
onValueChange: (next) => onValueChange?.(next),
|
|
21
21
|
options,
|
|
22
22
|
clearable: false,
|
|
23
23
|
placeholder,
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import { Select, SelectTrigger, SelectValue, SelectContent, SelectGroup, SelectItem } from './chunk-G2WYOCDL.js';
|
|
2
|
+
import { Inline } from './chunk-TILFZBTE.js';
|
|
3
|
+
import { cn } from './chunk-U7N2A7A3.js';
|
|
4
|
+
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
5
|
+
|
|
6
|
+
function CountryOptionLabel({
|
|
7
|
+
country,
|
|
8
|
+
showCode = false,
|
|
9
|
+
className
|
|
10
|
+
}) {
|
|
11
|
+
const code = country.value ?? country.code ?? "";
|
|
12
|
+
const text = country.nativeName != null && country.nativeName !== "" ? `${country.name} (${country.nativeName})` : country.name;
|
|
13
|
+
return /* @__PURE__ */ jsxs(Inline, { gap: "xs", className: cn("items-center", className), children: [
|
|
14
|
+
country.flagSvgPath != null && country.flagSvgPath !== "" && /* @__PURE__ */ jsx(
|
|
15
|
+
"img",
|
|
16
|
+
{
|
|
17
|
+
src: country.flagSvgPath,
|
|
18
|
+
alt: "",
|
|
19
|
+
className: "h-3 w-5 shrink-0 rounded-sm object-cover",
|
|
20
|
+
"aria-hidden": "true"
|
|
21
|
+
}
|
|
22
|
+
),
|
|
23
|
+
/* @__PURE__ */ jsxs("span", { className: "truncate", children: [
|
|
24
|
+
text,
|
|
25
|
+
showCode && code !== "" && /* @__PURE__ */ jsxs("span", { className: "text-muted-foreground", children: [
|
|
26
|
+
" \xB7 ",
|
|
27
|
+
code
|
|
28
|
+
] })
|
|
29
|
+
] })
|
|
30
|
+
] });
|
|
31
|
+
}
|
|
32
|
+
function CountrySelect({
|
|
33
|
+
id,
|
|
34
|
+
name,
|
|
35
|
+
options,
|
|
36
|
+
defaultValue,
|
|
37
|
+
required = false,
|
|
38
|
+
allowEmpty = false,
|
|
39
|
+
emptyLabel = "\u2014",
|
|
40
|
+
placeholder,
|
|
41
|
+
invalid = false
|
|
42
|
+
}) {
|
|
43
|
+
const emptyValue = "0";
|
|
44
|
+
const resolvedDefault = defaultValue && defaultValue !== "" ? defaultValue : emptyValue;
|
|
45
|
+
return /* @__PURE__ */ jsxs(
|
|
46
|
+
Select,
|
|
47
|
+
{
|
|
48
|
+
name,
|
|
49
|
+
defaultValue: allowEmpty ? resolvedDefault : defaultValue ?? options[0]?.value,
|
|
50
|
+
children: [
|
|
51
|
+
/* @__PURE__ */ jsx(SelectTrigger, { id, className: "w-full", "aria-invalid": invalid, "aria-required": required, children: /* @__PURE__ */ jsx(SelectValue, { placeholder }) }),
|
|
52
|
+
/* @__PURE__ */ jsx(SelectContent, { children: /* @__PURE__ */ jsxs(SelectGroup, { children: [
|
|
53
|
+
allowEmpty && /* @__PURE__ */ jsx(SelectItem, { value: emptyValue, children: emptyLabel }),
|
|
54
|
+
options.map((option) => /* @__PURE__ */ jsx(SelectItem, { value: option.value ?? "", children: /* @__PURE__ */ jsx(CountryOptionLabel, { country: option }) }, option.value))
|
|
55
|
+
] }) })
|
|
56
|
+
]
|
|
57
|
+
}
|
|
58
|
+
);
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
export { CountryOptionLabel, CountrySelect };
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { normalizeTreeOptions, formatPathLabels, getNodeByPath, filterTreeOptions, pathsEqual, pathKey } from './chunk-SMLKNECP.js';
|
|
2
|
-
import { Checkbox } from './chunk-
|
|
3
|
-
import { Command, CommandInput } from './chunk-V6UWJKZF.js';
|
|
4
|
-
import { Popover, PopoverTrigger, PopoverContent } from './chunk-DY5C44UP.js';
|
|
2
|
+
import { Checkbox } from './chunk-O24Z3ULJ.js';
|
|
5
3
|
import { ScrollArea, ScrollBar } from './chunk-3KPEZ5CF.js';
|
|
6
|
-
import {
|
|
4
|
+
import { Command, CommandInput } from './chunk-HTEL5DQI.js';
|
|
5
|
+
import { Popover, PopoverTrigger, PopoverContent } from './chunk-DY5C44UP.js';
|
|
6
|
+
import { Button } from './chunk-M4PZNAMV.js';
|
|
7
7
|
import { useTranslation } from './chunk-RLGHEV4A.js';
|
|
8
8
|
import { cn } from './chunk-U7N2A7A3.js';
|
|
9
9
|
import * as React from 'react';
|
|
@@ -21,7 +21,7 @@ function Cascader({
|
|
|
21
21
|
options: optionsProp,
|
|
22
22
|
value,
|
|
23
23
|
defaultValue,
|
|
24
|
-
|
|
24
|
+
onValueChange,
|
|
25
25
|
multiple,
|
|
26
26
|
changeOnSelect,
|
|
27
27
|
showSearch,
|
|
@@ -62,14 +62,14 @@ function Cascader({
|
|
|
62
62
|
}, [multiple, multiValue, singleValue, options]);
|
|
63
63
|
const commitSingle = (path) => {
|
|
64
64
|
if (!isControlledSingle) setInternalSingle(path);
|
|
65
|
-
|
|
65
|
+
onValueChange?.(path, getNodeByPath(options, path));
|
|
66
66
|
setOpen(false);
|
|
67
67
|
setActivePath([]);
|
|
68
68
|
setSearch("");
|
|
69
69
|
};
|
|
70
70
|
const commitMulti = (paths) => {
|
|
71
71
|
if (!isControlledMulti) setInternalMulti(paths);
|
|
72
|
-
|
|
72
|
+
onValueChange?.(
|
|
73
73
|
paths,
|
|
74
74
|
paths.map((p) => getNodeByPath(options, p))
|
|
75
75
|
);
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { Slider } from './chunk-CRERCLIZ.js';
|
|
2
1
|
import { formatBytes } from './chunk-4R7QL3MW.js';
|
|
3
|
-
import { Dialog, DialogContent, DialogHeader, DialogTitle, DialogFooter } from './chunk-
|
|
4
|
-
import {
|
|
5
|
-
import { Button } from './chunk-
|
|
2
|
+
import { Dialog, DialogContent, DialogHeader, DialogTitle, DialogFooter } from './chunk-P4HFJQID.js';
|
|
3
|
+
import { Slider } from './chunk-CRERCLIZ.js';
|
|
4
|
+
import { Button } from './chunk-M4PZNAMV.js';
|
|
5
|
+
import { controlIconClass } from './chunk-IBK5D2Q6.js';
|
|
6
6
|
import { useTranslation } from './chunk-RLGHEV4A.js';
|
|
7
7
|
import { cn } from './chunk-U7N2A7A3.js';
|
|
8
8
|
import * as React2 from 'react';
|
|
@@ -203,16 +203,16 @@ function fileMatchesAccept(file, accept) {
|
|
|
203
203
|
return file.type === trimmed || file.name.endsWith(trimmed);
|
|
204
204
|
});
|
|
205
205
|
}
|
|
206
|
-
function useUploadList(controlled, defaultValue,
|
|
206
|
+
function useUploadList(controlled, defaultValue, onValueChange) {
|
|
207
207
|
const [internal, setInternal] = React2.useState(defaultValue ?? []);
|
|
208
208
|
const items = controlled ?? internal;
|
|
209
209
|
const setItems = React2.useCallback(
|
|
210
210
|
(next) => {
|
|
211
211
|
const resolved = typeof next === "function" ? next(items) : next;
|
|
212
212
|
if (controlled === void 0) setInternal(resolved);
|
|
213
|
-
|
|
213
|
+
onValueChange?.(resolved);
|
|
214
214
|
},
|
|
215
|
-
[controlled, items,
|
|
215
|
+
[controlled, items, onValueChange]
|
|
216
216
|
);
|
|
217
217
|
return [items, setItems];
|
|
218
218
|
}
|
|
@@ -243,7 +243,7 @@ function Upload({
|
|
|
243
243
|
variant = "dropzone",
|
|
244
244
|
value,
|
|
245
245
|
defaultValue,
|
|
246
|
-
|
|
246
|
+
onValueChange,
|
|
247
247
|
accept: acceptProp,
|
|
248
248
|
multiple: multipleProp,
|
|
249
249
|
maxCount: maxCountProp,
|
|
@@ -261,7 +261,7 @@ function Upload({
|
|
|
261
261
|
const inputRef = React2.useRef(null);
|
|
262
262
|
const [dragActive, setDragActive] = React2.useState(false);
|
|
263
263
|
const [cropFile, setCropFile] = React2.useState(null);
|
|
264
|
-
const [items, setItems] = useUploadList(value, defaultValue,
|
|
264
|
+
const [items, setItems] = useUploadList(value, defaultValue, onValueChange);
|
|
265
265
|
const isSingleAvatar = variant === "avatar" || variant === "avatar-crop" || variant === "picture" && maxCount === 1;
|
|
266
266
|
const singleItem = isSingleAvatar ? items[0] ?? null : null;
|
|
267
267
|
const draft = useUploadDraft({
|