@godxjp/ui 9.1.0 → 10.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 +58 -29
- package/dist/app/index.d.ts +1 -1
- package/dist/app/index.js +4 -4
- package/dist/{app.prop-DnIXFzLi.d.ts → app.prop-Cy6dJnU8.d.ts} +18 -35
- package/dist/aspect-ratio-CZZJd9Km.d.ts +9 -0
- package/dist/{checkbox-ChRsR7Nk.d.ts → checkbox-em-oFM5D.d.ts} +1 -1
- package/dist/{chunk-LJLGABFV.js → chunk-2HXZT2WJ.js} +17 -9
- package/dist/{chunk-QLMXEJSY.js → chunk-3Q4A4U2P.js} +24 -1
- package/dist/{chunk-26CPAKUP.js → chunk-44YRPSZ7.js} +1 -2
- package/dist/{chunk-HB2OHB5X.js → chunk-5NCFLCM7.js} +27 -16
- package/dist/{chunk-FXFJF4YA.js → chunk-6CSBMMZS.js} +262 -31
- package/dist/{chunk-ZRRLOOBX.js → chunk-6HHSU6RG.js} +8 -6
- package/dist/{chunk-INSF6K3Y.js → chunk-7Q45MBFW.js} +7 -5
- package/dist/{chunk-O24Z3ULJ.js → chunk-BE6GJGKJ.js} +1 -1
- package/dist/{chunk-5D42MFB4.js → chunk-BG5RNXTH.js} +71 -2
- package/dist/{chunk-AINW5WYN.js → chunk-COD66MFF.js} +1 -2
- package/dist/{chunk-IOGU3ZWF.js → chunk-DNGJHWJZ.js} +3 -3
- package/dist/{chunk-3TS3G4U3.js → chunk-EE5DKOHX.js} +3 -1
- package/dist/{chunk-KXOAZGPA.js → chunk-EQZP53KI.js} +33 -8
- package/dist/{chunk-BHV2FUOA.js → chunk-EZHHJQWQ.js} +1 -1
- package/dist/{chunk-N3JPLJ3B.js → chunk-GDDCSKCB.js} +12 -5
- package/dist/{chunk-RLGHEV4A.js → chunk-HTG5VHU7.js} +10 -1
- package/dist/{chunk-R2W2FX5Q.js → chunk-I7NQ2LIL.js} +1 -9
- package/dist/{chunk-XQMPK4GM.js → chunk-IHRMOJXD.js} +86 -39
- package/dist/{chunk-TILFZBTE.js → chunk-INIIF7F7.js} +1 -4
- package/dist/{chunk-UIYEAUWA.js → chunk-IY347EQA.js} +2 -2
- package/dist/{chunk-HCM4JAC2.js → chunk-JWGLJXQU.js} +39 -11
- package/dist/{chunk-TO33OY4L.js → chunk-LMKUKCTN.js} +1 -1
- package/dist/chunk-NXVCI6YB.js +453 -0
- package/dist/{chunk-JBHXILI4.js → chunk-O6DQZYNI.js} +63 -44
- package/dist/{chunk-O2OUNXV4.js → chunk-P5KPCT6R.js} +3 -3
- package/dist/{chunk-56NYZNVY.js → chunk-PDXFQS7M.js} +112 -49
- package/dist/{chunk-F7PG4OEV.js → chunk-QSGW3ZWK.js} +12 -4
- package/dist/{chunk-25RYBC5T.js → chunk-S2IJKT3D.js} +1 -1
- package/dist/{chunk-OJZ6C2HM.js → chunk-SARQRCKO.js} +54 -48
- package/dist/chunk-T2QO2S65.js +126 -0
- package/dist/{chunk-442ULAA6.js → chunk-TGNBXS7H.js} +142 -62
- package/dist/{chunk-6J7GRCDA.js → chunk-UNVRNJCB.js} +71 -11
- package/dist/{chunk-6YBYAEXD.js → chunk-VSM44AYE.js} +94 -24
- package/dist/chunk-VSUYVT2Q.js +163 -0
- package/dist/{chunk-4R7QL3MW.js → chunk-X2VY4MOW.js} +14 -29
- package/dist/{chunk-FRU44GA2.js → chunk-XK3M3VRR.js} +16 -2
- package/dist/{chunk-6YK3IJXW.js → chunk-Z46J47FY.js} +73 -77
- package/dist/components/admin/index.d.ts +23 -13
- package/dist/components/admin/index.js +29 -30
- package/dist/components/data-display/badge.js +3 -3
- package/dist/components/data-display/card.d.ts +3 -3
- package/dist/components/data-display/card.js +1 -1
- package/dist/components/data-display/carousel.js +3 -1
- package/dist/components/data-display/index.js +55 -33
- package/dist/components/data-entry/calendar.d.ts +1 -1
- package/dist/components/data-entry/calendar.js +1 -1
- package/dist/components/data-entry/cascader.d.ts +1 -1
- package/dist/components/data-entry/cascader.js +5 -5
- package/dist/components/data-entry/checkbox.d.ts +2 -2
- package/dist/components/data-entry/checkbox.js +2 -2
- package/dist/components/data-entry/color-picker.d.ts +1 -1
- package/dist/components/data-entry/color-picker.js +3 -3
- package/dist/components/data-entry/date-picker.d.ts +2 -2
- package/dist/components/data-entry/date-picker.js +4 -4
- package/dist/components/data-entry/date-range-picker.d.ts +2 -2
- package/dist/components/data-entry/date-range-picker.js +4 -4
- package/dist/components/data-entry/index.d.ts +9 -25
- package/dist/components/data-entry/index.js +22 -26
- package/dist/components/data-entry/radio.d.ts +1 -1
- package/dist/components/data-entry/radio.js +2 -2
- package/dist/components/data-entry/select.d.ts +2 -2
- package/dist/components/data-entry/select.js +3 -4
- package/dist/components/data-entry/slider.d.ts +1 -1
- package/dist/components/data-entry/switch.d.ts +2 -2
- package/dist/components/data-entry/switch.js +1 -1
- package/dist/components/data-entry/time-input.js +2 -2
- package/dist/components/data-entry/time-picker.d.ts +3 -1
- package/dist/components/data-entry/time-picker.js +3 -3
- package/dist/components/data-entry/transfer.d.ts +2 -2
- package/dist/components/data-entry/transfer.js +5 -5
- package/dist/components/data-entry/tree-select.d.ts +1 -1
- package/dist/components/data-entry/tree-select.js +5 -5
- package/dist/components/data-entry/upload.d.ts +2 -2
- package/dist/components/data-entry/upload.js +5 -5
- package/dist/components/feedback/alert.js +5 -5
- package/dist/components/feedback/dialog.d.ts +20 -1
- package/dist/components/feedback/dialog.js +3 -3
- package/dist/components/feedback/index.d.ts +10 -18
- package/dist/components/feedback/index.js +9 -9
- package/dist/components/feedback/sheet.js +1 -1
- package/dist/components/layout/index.d.ts +27 -15
- package/dist/components/layout/index.js +7 -5
- package/dist/components/navigation/dropdown-menu.js +1 -1
- package/dist/components/navigation/index.d.ts +15 -17
- package/dist/components/navigation/index.js +7 -8
- package/dist/components/navigation/pagination.d.ts +25 -4
- package/dist/components/navigation/pagination.js +4 -5
- package/dist/components/navigation/steps.d.ts +3 -3
- package/dist/components/navigation/steps.js +3 -1
- package/dist/components/query/index.d.ts +1 -5
- package/dist/components/query/index.js +6 -8
- package/dist/components/ui/index.d.ts +13 -12
- package/dist/components/ui/index.js +30 -32
- package/dist/{data-entry.prop-CDkOajPj.d.ts → data-entry.prop-BR4vNA1j.d.ts} +7 -35
- package/dist/filter-bar-BxjSJJnQ.d.ts +7 -0
- package/dist/{inline-DCqn4O29.d.ts → flex-D_EXRFSW.d.ts} +2 -8
- package/dist/form/index.js +1 -1
- package/dist/i18n/index.d.ts +82 -10
- package/dist/i18n/index.js +2 -2
- package/dist/index.d.ts +7 -7
- package/dist/index.js +41 -44
- package/dist/{layout.prop-DwJKI6ka.d.ts → layout.prop-JE2TcRyL.d.ts} +8 -2
- package/dist/lib/datetime/index.js +1 -1
- package/dist/{navigation.prop-8DgElO0c.d.ts → navigation.prop-DMcXkR-J.d.ts} +9 -11
- package/dist/{toggle-group-BulJgKh3.d.ts → password-strength-DVRvXEOK.d.ts} +24 -3
- package/dist/props/components/index.d.ts +4 -4
- package/dist/props/index.d.ts +4 -4
- package/dist/props/index.js +1 -1
- package/dist/props/registry.d.ts +84 -39
- package/dist/props/registry.js +1 -1
- package/dist/{search-input-cezAxpgb.d.ts → search-input-DpqDMXcn.d.ts} +2 -4
- package/dist/{skeleton-uWAjSacg.d.ts → skeleton-cj9kh5wo.d.ts} +1 -3
- package/dist/styles/control.css +176 -41
- package/dist/styles/data-display-layout.css +41 -15
- package/dist/styles/data-entry-layout.css +71 -0
- package/dist/styles/feedback-layout.css +44 -12
- package/dist/styles/index.css +45 -1
- package/dist/styles/layout.css +66 -17
- package/dist/styles/navigation-layout.css +3 -1
- package/dist/styles/shell-layout.css +3 -3
- package/dist/styles/table-layout.css +13 -0
- package/dist/tokens/foundation.css +12 -1
- package/dist/tokens/semantic/layout.css +2 -2
- package/dist/tooltip-Bf2KjRy8.d.ts +14 -0
- package/package.json +7 -7
- package/scripts/ui-audit.mjs +31 -2
- package/dist/aspect-ratio-DGoYrOry.d.ts +0 -6
- package/dist/chunk-CAEL2ZD2.js +0 -222
- package/dist/chunk-FYM3MJSK.js +0 -59
- package/dist/chunk-GKXPALFT.js +0 -32
- package/dist/chunk-JKHWLPM5.js +0 -101
- package/dist/chunk-KDBGFJJI.js +0 -220
- package/dist/chunk-VN72SWHX.js +0 -189
- package/dist/components/data-entry/autocomplete.d.ts +0 -24
- package/dist/components/data-entry/autocomplete.js +0 -10
- package/dist/components/data-entry/combobox.d.ts +0 -22
- package/dist/components/data-entry/combobox.js +0 -6
- package/dist/filter-bar-BycYH10i.d.ts +0 -14
- /package/dist/{chunk-LDSLS6HE.js → chunk-7CFO5FFE.js} +0 -0
|
@@ -1,9 +1,10 @@
|
|
|
1
|
-
import { Select, SelectTrigger, SelectValue, SelectContent, SelectItem } from './chunk-
|
|
1
|
+
import { Select, SelectTrigger, SelectValue, SelectContent, SelectItem } from './chunk-NXVCI6YB.js';
|
|
2
2
|
import { Button } from './chunk-M4PZNAMV.js';
|
|
3
|
-
import { useTranslation } from './chunk-
|
|
3
|
+
import { useTranslation } from './chunk-HTG5VHU7.js';
|
|
4
4
|
import { cn } from './chunk-U7N2A7A3.js';
|
|
5
|
-
import
|
|
6
|
-
import {
|
|
5
|
+
import * as React from 'react';
|
|
6
|
+
import { MoreHorizontal, ChevronLeft, ChevronRight } from 'lucide-react';
|
|
7
|
+
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
7
8
|
|
|
8
9
|
// src/components/navigation/pagination-utils.ts
|
|
9
10
|
function buildPageRange(current, totalPages, siblingCount = 1) {
|
|
@@ -28,8 +29,76 @@ function buildPageRange(current, totalPages, siblingCount = 1) {
|
|
|
28
29
|
if (totalPages > 1) range.push(totalPages);
|
|
29
30
|
return range;
|
|
30
31
|
}
|
|
32
|
+
var PaginationContent = React.forwardRef(({ className, ...props }, ref) => {
|
|
33
|
+
return /* @__PURE__ */ jsx("ul", { ref, className: cn("ui-pagination-list", className), role: "list", ...props });
|
|
34
|
+
});
|
|
35
|
+
PaginationContent.displayName = "PaginationContent";
|
|
36
|
+
var PaginationItem = React.forwardRef(
|
|
37
|
+
({ className, ...props }, ref) => /* @__PURE__ */ jsx("li", { ref, className: cn("ui-pagination-item", className), ...props })
|
|
38
|
+
);
|
|
39
|
+
PaginationItem.displayName = "PaginationItem";
|
|
40
|
+
var PaginationLink = React.forwardRef(
|
|
41
|
+
({ className, isActive, disabled, children, onClick, href: _href, ...props }, ref) => /* @__PURE__ */ jsx(
|
|
42
|
+
"button",
|
|
43
|
+
{
|
|
44
|
+
ref,
|
|
45
|
+
type: "button",
|
|
46
|
+
"data-active": isActive || void 0,
|
|
47
|
+
"aria-current": isActive ? "page" : void 0,
|
|
48
|
+
disabled: disabled || void 0,
|
|
49
|
+
"data-state": disabled ? "disabled" : void 0,
|
|
50
|
+
className: cn(
|
|
51
|
+
"ui-pagination-link ui-button--compact-icon ui-pagination-page",
|
|
52
|
+
isActive ? "ui-pagination-link-active" : void 0,
|
|
53
|
+
disabled ? "ui-pagination-link-disabled" : void 0,
|
|
54
|
+
className
|
|
55
|
+
),
|
|
56
|
+
onClick,
|
|
57
|
+
...props,
|
|
58
|
+
children
|
|
59
|
+
}
|
|
60
|
+
)
|
|
61
|
+
);
|
|
62
|
+
PaginationLink.displayName = "PaginationLink";
|
|
63
|
+
var PaginationEllipsis = ({ className, ...props }) => /* @__PURE__ */ jsx(
|
|
64
|
+
"span",
|
|
65
|
+
{
|
|
66
|
+
className: cn("ui-pagination-ellipsis ui-button--compact-icon", className),
|
|
67
|
+
"aria-hidden": "true",
|
|
68
|
+
role: "presentation",
|
|
69
|
+
...props,
|
|
70
|
+
children: /* @__PURE__ */ jsx(MoreHorizontal, {})
|
|
71
|
+
}
|
|
72
|
+
);
|
|
73
|
+
PaginationEllipsis.displayName = "PaginationEllipsis";
|
|
74
|
+
var PaginationPrevious = React.forwardRef(
|
|
75
|
+
({ className, children, ...props }, ref) => /* @__PURE__ */ jsx(
|
|
76
|
+
PaginationLink,
|
|
77
|
+
{
|
|
78
|
+
ref,
|
|
79
|
+
className: cn("ui-pagination-prev", className),
|
|
80
|
+
disabled: props.disabled,
|
|
81
|
+
...props,
|
|
82
|
+
children
|
|
83
|
+
}
|
|
84
|
+
)
|
|
85
|
+
);
|
|
86
|
+
PaginationPrevious.displayName = "PaginationPrevious";
|
|
87
|
+
var PaginationNext = React.forwardRef(
|
|
88
|
+
({ className, children, ...props }, ref) => /* @__PURE__ */ jsx(
|
|
89
|
+
PaginationLink,
|
|
90
|
+
{
|
|
91
|
+
ref,
|
|
92
|
+
className: cn("ui-pagination-next", className),
|
|
93
|
+
disabled: props.disabled,
|
|
94
|
+
...props,
|
|
95
|
+
children
|
|
96
|
+
}
|
|
97
|
+
)
|
|
98
|
+
);
|
|
99
|
+
PaginationNext.displayName = "PaginationNext";
|
|
31
100
|
function Pagination({
|
|
32
|
-
|
|
101
|
+
value = 1,
|
|
33
102
|
total = 0,
|
|
34
103
|
pageSize = 10,
|
|
35
104
|
pageSizeOptions = [10, 20, 50, 100],
|
|
@@ -38,16 +107,16 @@ function Pagination({
|
|
|
38
107
|
simple,
|
|
39
108
|
disabled,
|
|
40
109
|
className,
|
|
41
|
-
|
|
110
|
+
onValueChange
|
|
42
111
|
}) {
|
|
43
112
|
const { t } = useTranslation();
|
|
44
113
|
const totalPages = Math.max(1, Math.ceil(total / pageSize));
|
|
45
|
-
const safeCurrent = Math.min(Math.max(1,
|
|
114
|
+
const safeCurrent = Math.min(Math.max(1, value), totalPages);
|
|
46
115
|
const pages = buildPageRange(safeCurrent, totalPages);
|
|
47
116
|
const go = (page, size = pageSize) => {
|
|
48
117
|
if (disabled) return;
|
|
49
118
|
const nextPage = Math.min(Math.max(1, page), Math.max(1, Math.ceil(total / size)));
|
|
50
|
-
|
|
119
|
+
onValueChange?.(nextPage, size);
|
|
51
120
|
};
|
|
52
121
|
const totalLabel = typeof showTotal === "function" ? showTotal(total, [
|
|
53
122
|
(safeCurrent - 1) * pageSize + 1,
|
|
@@ -121,51 +190,45 @@ function Pagination({
|
|
|
121
190
|
]
|
|
122
191
|
}
|
|
123
192
|
),
|
|
124
|
-
/* @__PURE__ */
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
type: "button",
|
|
128
|
-
variant: "outline",
|
|
129
|
-
size: "icon",
|
|
130
|
-
className: "ui-button--compact-icon",
|
|
131
|
-
disabled: Boolean(disabled) || safeCurrent <= 1,
|
|
132
|
-
"aria-label": t("navigation.pagination.prev"),
|
|
133
|
-
onClick: () => go(safeCurrent - 1),
|
|
134
|
-
children: /* @__PURE__ */ jsx(ChevronLeft, { "aria-hidden": "true" })
|
|
135
|
-
}
|
|
136
|
-
),
|
|
137
|
-
/* @__PURE__ */ jsx("ul", { className: "ui-pagination-list", children: pages.map(
|
|
138
|
-
(page, index) => page === "ellipsis" ? /* @__PURE__ */ jsx("li", { className: "ui-pagination-ellipsis ui-button--compact-icon", children: /* @__PURE__ */ jsx(MoreHorizontal, { "aria-hidden": "true" }) }, `e-${index}`) : /* @__PURE__ */ jsx("li", { children: /* @__PURE__ */ jsx(
|
|
139
|
-
Button,
|
|
193
|
+
/* @__PURE__ */ jsxs(PaginationContent, { children: [
|
|
194
|
+
/* @__PURE__ */ jsx(PaginationItem, { children: /* @__PURE__ */ jsx(
|
|
195
|
+
PaginationPrevious,
|
|
140
196
|
{
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
"aria-label": t("navigation.pagination.page", { page }),
|
|
147
|
-
"aria-current": page === safeCurrent ? "page" : void 0,
|
|
148
|
-
onClick: () => go(page),
|
|
149
|
-
children: page
|
|
197
|
+
"aria-label": t("navigation.pagination.prev"),
|
|
198
|
+
onClick: () => go(safeCurrent - 1),
|
|
199
|
+
className: "ui-button--compact-icon",
|
|
200
|
+
disabled: Boolean(disabled) || safeCurrent <= 1,
|
|
201
|
+
children: /* @__PURE__ */ jsx(ChevronLeft, { "aria-hidden": "true" })
|
|
150
202
|
}
|
|
151
|
-
) },
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
203
|
+
) }),
|
|
204
|
+
pages.map(
|
|
205
|
+
(page, index) => page === "ellipsis" ? /* @__PURE__ */ jsx(PaginationItem, { children: /* @__PURE__ */ jsx(PaginationEllipsis, {}) }, `e-${index}`) : /* @__PURE__ */ jsx(PaginationItem, { children: /* @__PURE__ */ jsx(
|
|
206
|
+
PaginationLink,
|
|
207
|
+
{
|
|
208
|
+
isActive: page === safeCurrent,
|
|
209
|
+
"aria-label": t("navigation.pagination.page", { page }),
|
|
210
|
+
onClick: () => {
|
|
211
|
+
if (!disabled) go(page);
|
|
212
|
+
},
|
|
213
|
+
disabled,
|
|
214
|
+
children: page
|
|
215
|
+
}
|
|
216
|
+
) }, page)
|
|
217
|
+
),
|
|
218
|
+
/* @__PURE__ */ jsx(PaginationItem, { children: /* @__PURE__ */ jsx(
|
|
219
|
+
PaginationNext,
|
|
220
|
+
{
|
|
221
|
+
"aria-label": t("navigation.pagination.next"),
|
|
222
|
+
onClick: () => go(safeCurrent + 1),
|
|
223
|
+
className: "ui-button--compact-icon",
|
|
224
|
+
disabled: Boolean(disabled) || safeCurrent >= totalPages,
|
|
225
|
+
children: /* @__PURE__ */ jsx(ChevronRight, { "aria-hidden": "true" })
|
|
226
|
+
}
|
|
227
|
+
) })
|
|
228
|
+
] })
|
|
166
229
|
]
|
|
167
230
|
}
|
|
168
231
|
);
|
|
169
232
|
}
|
|
170
233
|
|
|
171
|
-
export { Pagination };
|
|
234
|
+
export { Pagination, PaginationContent, PaginationEllipsis, PaginationItem, PaginationLink, PaginationNext, PaginationPrevious };
|
|
@@ -13,11 +13,18 @@ function FormField({
|
|
|
13
13
|
className,
|
|
14
14
|
children
|
|
15
15
|
}) {
|
|
16
|
-
const helperId = helper
|
|
16
|
+
const helperId = helper ? `${id}-helper` : void 0;
|
|
17
17
|
const errorId = error ? `${id}-error` : void 0;
|
|
18
|
-
|
|
18
|
+
if (typeof process !== "undefined" && process.env?.NODE_ENV !== "production" && !React.isValidElement(children)) {
|
|
19
|
+
console.warn(
|
|
20
|
+
"FormField expects a single React element child to receive aria-describedby/aria-errormessage; the helper text and error message will not be associated with the control."
|
|
21
|
+
);
|
|
22
|
+
}
|
|
19
23
|
const childWithA11y = React.isValidElement(children) ? React.cloneElement(children, {
|
|
20
|
-
|
|
24
|
+
// Helper and error can coexist: helper stays on aria-describedby, the error on
|
|
25
|
+
// aria-errormessage (surfaced when aria-invalid is true).
|
|
26
|
+
"aria-describedby": helperId,
|
|
27
|
+
"aria-errormessage": errorId,
|
|
21
28
|
"aria-required": required ? true : void 0,
|
|
22
29
|
"aria-invalid": !!error || void 0
|
|
23
30
|
}) : children;
|
|
@@ -30,7 +37,8 @@ function FormField({
|
|
|
30
37
|
labelAddon
|
|
31
38
|
] }),
|
|
32
39
|
childWithA11y,
|
|
33
|
-
|
|
40
|
+
helper ? /* @__PURE__ */ jsx("p", { id: helperId, className: "text-muted-foreground text-xs", children: helper }) : null,
|
|
41
|
+
error ? /* @__PURE__ */ jsx("p", { id: errorId, role: "alert", className: "text-destructive text-xs", children: error }) : null
|
|
34
42
|
] });
|
|
35
43
|
}
|
|
36
44
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Field, choiceGroupClassName } from './chunk-
|
|
1
|
+
import { Field, choiceGroupClassName } from './chunk-44YRPSZ7.js';
|
|
2
2
|
import { cn } from './chunk-U7N2A7A3.js';
|
|
3
3
|
import * as React from 'react';
|
|
4
4
|
import * as RadioGroupPrimitive from '@radix-ui/react-radio-group';
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { controlIconClass } from './chunk-IBK5D2Q6.js';
|
|
2
|
+
import { useTranslation } from './chunk-HTG5VHU7.js';
|
|
2
3
|
import { cn } from './chunk-U7N2A7A3.js';
|
|
3
4
|
import { Check, Loader2, X, Circle } from 'lucide-react';
|
|
4
|
-
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
5
|
+
import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
|
5
6
|
|
|
6
7
|
function resolveStepStatus(index, current, itemStatus, currentStatus) {
|
|
7
8
|
if (itemStatus) return itemStatus;
|
|
@@ -53,17 +54,18 @@ function StepIcon({
|
|
|
53
54
|
}
|
|
54
55
|
function Steps({
|
|
55
56
|
items = [],
|
|
56
|
-
current = 0,
|
|
57
|
-
|
|
57
|
+
value: current = 0,
|
|
58
|
+
defaultValue = 0,
|
|
58
59
|
status: currentStatus = "process",
|
|
59
60
|
orientation = "horizontal",
|
|
60
61
|
type = "default",
|
|
61
|
-
size = "
|
|
62
|
+
size = "md",
|
|
62
63
|
titlePlacement = "horizontal",
|
|
63
|
-
|
|
64
|
+
onValueChange,
|
|
64
65
|
className
|
|
65
66
|
}) {
|
|
66
|
-
const
|
|
67
|
+
const { t } = useTranslation();
|
|
68
|
+
const base = defaultValue;
|
|
67
69
|
const isVertical = orientation === "vertical";
|
|
68
70
|
const compact = size === "sm";
|
|
69
71
|
return /* @__PURE__ */ jsx(
|
|
@@ -74,65 +76,69 @@ function Steps({
|
|
|
74
76
|
isVertical ? "flex-col gap-0" : "flex-row items-start",
|
|
75
77
|
className
|
|
76
78
|
),
|
|
77
|
-
"aria-label": "
|
|
79
|
+
"aria-label": t("navigation.steps.ariaLabel"),
|
|
78
80
|
children: items.map((item, index) => {
|
|
79
81
|
const absoluteIndex = base + index;
|
|
80
82
|
const stepStatus = resolveStepStatus(absoluteIndex, current, item.status, currentStatus);
|
|
81
|
-
const
|
|
82
|
-
const
|
|
83
|
+
const interactive = Boolean(onValueChange);
|
|
84
|
+
const clickable = interactive && !item.disabled;
|
|
85
|
+
const description = item.description;
|
|
86
|
+
const isCurrent = absoluteIndex === current;
|
|
87
|
+
const stepClassName = cn(
|
|
88
|
+
"group flex min-w-0",
|
|
89
|
+
isVertical ? "flex-row items-start gap-3" : "flex-col items-center",
|
|
90
|
+
clickable ? "cursor-pointer" : "cursor-default"
|
|
91
|
+
);
|
|
92
|
+
const stepInner = /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
93
|
+
/* @__PURE__ */ jsx(StepIcon, { status: stepStatus, icon: item.icon, type }),
|
|
94
|
+
/* @__PURE__ */ jsxs(
|
|
95
|
+
"div",
|
|
96
|
+
{
|
|
97
|
+
className: cn(
|
|
98
|
+
"min-w-0",
|
|
99
|
+
isVertical ? "pt-1 text-left" : "mt-2 px-2",
|
|
100
|
+
titlePlacement === "vertical" && !isVertical && "mt-1"
|
|
101
|
+
),
|
|
102
|
+
children: [
|
|
103
|
+
/* @__PURE__ */ jsx(
|
|
104
|
+
"div",
|
|
105
|
+
{
|
|
106
|
+
className: cn(
|
|
107
|
+
"font-medium",
|
|
108
|
+
compact ? "text-xs" : "text-sm",
|
|
109
|
+
stepStatus === "process" && "text-foreground",
|
|
110
|
+
stepStatus === "wait" && "text-muted-foreground",
|
|
111
|
+
stepStatus === "error" && "text-destructive"
|
|
112
|
+
),
|
|
113
|
+
children: item.title
|
|
114
|
+
}
|
|
115
|
+
),
|
|
116
|
+
item.subtitle && /* @__PURE__ */ jsx("div", { className: "text-muted-foreground text-xs", children: item.subtitle }),
|
|
117
|
+
description && /* @__PURE__ */ jsx("div", { className: cn("text-muted-foreground", compact ? "text-xs" : "text-sm"), children: description })
|
|
118
|
+
]
|
|
119
|
+
}
|
|
120
|
+
)
|
|
121
|
+
] });
|
|
83
122
|
return /* @__PURE__ */ jsx(
|
|
84
123
|
"li",
|
|
85
124
|
{
|
|
125
|
+
"aria-current": isCurrent ? "step" : void 0,
|
|
86
126
|
className: cn(
|
|
87
127
|
"relative flex min-w-0 flex-1",
|
|
88
128
|
isVertical ? "flex-row gap-3 pb-8 last:pb-0" : "flex-col items-center text-center",
|
|
89
129
|
!isVertical && index < items.length - 1 && "after:bg-border after:absolute after:top-4 after:h-px",
|
|
90
130
|
!isVertical && index < items.length - 1 && "after:left-[calc(50%+1.25rem)] after:w-[calc(100%-2.5rem)]"
|
|
91
131
|
),
|
|
92
|
-
children: /* @__PURE__ */
|
|
132
|
+
children: interactive ? /* @__PURE__ */ jsx(
|
|
93
133
|
"button",
|
|
94
134
|
{
|
|
95
135
|
type: "button",
|
|
96
136
|
disabled: !clickable,
|
|
97
|
-
onClick: clickable ? () =>
|
|
98
|
-
className:
|
|
99
|
-
|
|
100
|
-
isVertical ? "flex-row items-start gap-3" : "flex-col items-center",
|
|
101
|
-
clickable && "cursor-pointer",
|
|
102
|
-
!clickable && "cursor-default"
|
|
103
|
-
),
|
|
104
|
-
children: [
|
|
105
|
-
/* @__PURE__ */ jsx(StepIcon, { status: stepStatus, icon: item.icon, type }),
|
|
106
|
-
/* @__PURE__ */ jsxs(
|
|
107
|
-
"div",
|
|
108
|
-
{
|
|
109
|
-
className: cn(
|
|
110
|
-
"min-w-0",
|
|
111
|
-
isVertical ? "pt-1 text-left" : "mt-2 px-2",
|
|
112
|
-
titlePlacement === "vertical" && !isVertical && "mt-1"
|
|
113
|
-
),
|
|
114
|
-
children: [
|
|
115
|
-
/* @__PURE__ */ jsx(
|
|
116
|
-
"div",
|
|
117
|
-
{
|
|
118
|
-
className: cn(
|
|
119
|
-
"font-medium",
|
|
120
|
-
compact ? "text-xs" : "text-sm",
|
|
121
|
-
stepStatus === "process" && "text-foreground",
|
|
122
|
-
stepStatus === "wait" && "text-muted-foreground",
|
|
123
|
-
stepStatus === "error" && "text-destructive"
|
|
124
|
-
),
|
|
125
|
-
children: item.title
|
|
126
|
-
}
|
|
127
|
-
),
|
|
128
|
-
item.subTitle && /* @__PURE__ */ jsx("div", { className: "text-muted-foreground text-xs", children: item.subTitle }),
|
|
129
|
-
description && /* @__PURE__ */ jsx("div", { className: cn("text-muted-foreground", compact ? "text-xs" : "text-sm"), children: description })
|
|
130
|
-
]
|
|
131
|
-
}
|
|
132
|
-
)
|
|
133
|
-
]
|
|
137
|
+
onClick: clickable ? () => onValueChange?.(absoluteIndex) : void 0,
|
|
138
|
+
className: stepClassName,
|
|
139
|
+
children: stepInner
|
|
134
140
|
}
|
|
135
|
-
)
|
|
141
|
+
) : /* @__PURE__ */ jsx("span", { className: stepClassName, children: stepInner })
|
|
136
142
|
},
|
|
137
143
|
index
|
|
138
144
|
);
|
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
import { Select, SelectTrigger, SelectValue, SelectContent, SelectItem } from './chunk-NXVCI6YB.js';
|
|
2
|
+
import { Button } from './chunk-M4PZNAMV.js';
|
|
3
|
+
import { useOptionalAppContext, useTranslation, APP_TIME_FORMAT_OPTIONS, getTimeFormatLabel, resolveTimezonePickerOptions, getTimezoneLabel, APP_LOCALES } from './chunk-HTG5VHU7.js';
|
|
4
|
+
import { APP_DATE_FORMAT_OPTIONS, getDateFormatLabel } from './chunk-6CSBMMZS.js';
|
|
5
|
+
import { cn } from './chunk-U7N2A7A3.js';
|
|
6
|
+
import * as React from 'react';
|
|
7
|
+
import { useId } from 'react';
|
|
8
|
+
import { Clock, CalendarDays, Globe, Languages, X } from 'lucide-react';
|
|
9
|
+
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
10
|
+
|
|
11
|
+
function Toolbar({ onClear, hasActiveFilters = true, className, children }) {
|
|
12
|
+
const { t } = useTranslation();
|
|
13
|
+
return /* @__PURE__ */ jsxs(
|
|
14
|
+
"div",
|
|
15
|
+
{
|
|
16
|
+
role: "toolbar",
|
|
17
|
+
"aria-label": t("navigation.toolbar.ariaLabel"),
|
|
18
|
+
className: cn("ui-toolbar", className),
|
|
19
|
+
children: [
|
|
20
|
+
children,
|
|
21
|
+
onClear && hasActiveFilters && /* @__PURE__ */ jsxs(Button, { variant: "ghost", size: "sm", onClick: onClear, className: "ui-toolbar-clear", children: [
|
|
22
|
+
/* @__PURE__ */ jsx(X, { "aria-hidden": "true" }),
|
|
23
|
+
t("common.clearFilters")
|
|
24
|
+
] })
|
|
25
|
+
]
|
|
26
|
+
}
|
|
27
|
+
);
|
|
28
|
+
}
|
|
29
|
+
function ToolbarGroup({ label, className, children }) {
|
|
30
|
+
const labelId = useId();
|
|
31
|
+
return /* @__PURE__ */ jsxs(
|
|
32
|
+
"div",
|
|
33
|
+
{
|
|
34
|
+
role: "group",
|
|
35
|
+
"aria-labelledby": label ? labelId : void 0,
|
|
36
|
+
className: cn("ui-stack-xs ui-toolbar-group", className),
|
|
37
|
+
children: [
|
|
38
|
+
label ? /* @__PURE__ */ jsx("div", { id: labelId, className: "ui-toolbar-label", children: label }) : null,
|
|
39
|
+
children
|
|
40
|
+
]
|
|
41
|
+
}
|
|
42
|
+
);
|
|
43
|
+
}
|
|
44
|
+
var ICON = {
|
|
45
|
+
locale: Languages,
|
|
46
|
+
timezone: Globe,
|
|
47
|
+
dateFormat: CalendarDays,
|
|
48
|
+
timeFormat: Clock
|
|
49
|
+
};
|
|
50
|
+
var TRIGGER_WIDTH = {
|
|
51
|
+
locale: "sm:w-40",
|
|
52
|
+
timezone: "sm:w-56",
|
|
53
|
+
dateFormat: "sm:w-44",
|
|
54
|
+
timeFormat: "sm:w-44"
|
|
55
|
+
};
|
|
56
|
+
var ARIA_KEY = {
|
|
57
|
+
locale: "navigation.localePicker.ariaLabel",
|
|
58
|
+
timezone: "navigation.timezonePicker.ariaLabel",
|
|
59
|
+
dateFormat: "navigation.dateFormatPicker.ariaLabel",
|
|
60
|
+
timeFormat: "navigation.timeFormatPicker.ariaLabel"
|
|
61
|
+
};
|
|
62
|
+
var AppSettingPicker = React.forwardRef(
|
|
63
|
+
function AppSettingPicker2({ kind, className, disabled, id, name, value, onValueChange }, ref) {
|
|
64
|
+
const ctx = useOptionalAppContext();
|
|
65
|
+
const { t, locale, fallbackLocale } = useTranslation();
|
|
66
|
+
const current = value ?? ctx?.[kind];
|
|
67
|
+
const setter = ctx ? {
|
|
68
|
+
locale: ctx.setLocale,
|
|
69
|
+
timezone: ctx.setTimezone,
|
|
70
|
+
dateFormat: ctx.setDateFormat,
|
|
71
|
+
timeFormat: ctx.setTimeFormat
|
|
72
|
+
}[kind] : void 0;
|
|
73
|
+
const handleChange = onValueChange ?? setter;
|
|
74
|
+
const items = React.useMemo(() => {
|
|
75
|
+
switch (kind) {
|
|
76
|
+
case "locale":
|
|
77
|
+
return APP_LOCALES.map((code) => ({ value: code, label: t(`locale.${code}`) }));
|
|
78
|
+
case "timezone":
|
|
79
|
+
return resolveTimezonePickerOptions(ctx?.timezoneOptions, current ?? "").map((tz) => ({
|
|
80
|
+
value: tz,
|
|
81
|
+
label: getTimezoneLabel(tz, locale, fallbackLocale)
|
|
82
|
+
}));
|
|
83
|
+
case "dateFormat":
|
|
84
|
+
return APP_DATE_FORMAT_OPTIONS.map((option) => ({
|
|
85
|
+
value: option.value,
|
|
86
|
+
label: getDateFormatLabel(option.value, locale, fallbackLocale)
|
|
87
|
+
}));
|
|
88
|
+
case "timeFormat":
|
|
89
|
+
return APP_TIME_FORMAT_OPTIONS.map((option) => ({
|
|
90
|
+
value: option.value,
|
|
91
|
+
label: getTimeFormatLabel(option.value, locale, fallbackLocale)
|
|
92
|
+
}));
|
|
93
|
+
}
|
|
94
|
+
}, [kind, ctx?.timezoneOptions, current, t, locale, fallbackLocale]);
|
|
95
|
+
const unbound = current === void 0 || !handleChange;
|
|
96
|
+
const Icon = ICON[kind];
|
|
97
|
+
return /* @__PURE__ */ jsxs(
|
|
98
|
+
Select,
|
|
99
|
+
{
|
|
100
|
+
value: current ?? "",
|
|
101
|
+
onValueChange: handleChange ?? (() => {
|
|
102
|
+
}),
|
|
103
|
+
disabled: disabled || unbound,
|
|
104
|
+
name,
|
|
105
|
+
children: [
|
|
106
|
+
/* @__PURE__ */ jsxs(
|
|
107
|
+
SelectTrigger,
|
|
108
|
+
{
|
|
109
|
+
ref,
|
|
110
|
+
id,
|
|
111
|
+
className: cn("w-full", TRIGGER_WIDTH[kind], className),
|
|
112
|
+
"aria-label": t(ARIA_KEY[kind]),
|
|
113
|
+
children: [
|
|
114
|
+
/* @__PURE__ */ jsx(Icon, { className: "me-2 size-4 shrink-0 opacity-70", "aria-hidden": "true" }),
|
|
115
|
+
/* @__PURE__ */ jsx(SelectValue, {})
|
|
116
|
+
]
|
|
117
|
+
}
|
|
118
|
+
),
|
|
119
|
+
/* @__PURE__ */ jsx(SelectContent, { children: items.map((item) => /* @__PURE__ */ jsx(SelectItem, { value: item.value, children: item.label }, item.value)) })
|
|
120
|
+
]
|
|
121
|
+
}
|
|
122
|
+
);
|
|
123
|
+
}
|
|
124
|
+
);
|
|
125
|
+
|
|
126
|
+
export { AppSettingPicker, Toolbar, ToolbarGroup };
|