@godxjp/ui 5.0.2 → 6.0.1
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 +101 -142
- package/dist/app/index.d.ts +140 -0
- package/dist/app/index.js +38 -0
- package/dist/app.prop-IobwLwaM.d.ts +90 -0
- package/dist/checkbox-NkFkqsQ8.d.ts +13 -0
- package/dist/chunk-2XW7J3EI.js +226 -0
- package/dist/chunk-3F2AKYRD.js +416 -0
- package/dist/chunk-3KPEZ5CF.js +37 -0
- package/dist/chunk-3UGU5TYP.js +89 -0
- package/dist/chunk-6RA3KSVK.js +588 -0
- package/dist/chunk-7NZFVD24.js +122 -0
- package/dist/chunk-7PWBC4BY.js +25 -0
- package/dist/chunk-7S7MYFXE.js +61 -0
- package/dist/chunk-7WRZG2IG.js +71 -0
- package/dist/chunk-B775Y6BE.js +1 -0
- package/dist/chunk-BHV2FUOA.js +111 -0
- package/dist/chunk-BI3HERR7.js +70 -0
- package/dist/chunk-BPSKQUL2.js +68 -0
- package/dist/chunk-CDWPQ5RP.js +187 -0
- package/dist/chunk-CP2LET6N.js +244 -0
- package/dist/chunk-CQBADMFG.js +20 -0
- package/dist/chunk-CRERCLIZ.js +33 -0
- package/dist/chunk-DU6ZYZRP.js +238 -0
- package/dist/chunk-DY5C44UP.js +55 -0
- package/dist/chunk-E4HJNQ62.js +117 -0
- package/dist/chunk-E76QIYSY.js +93 -0
- package/dist/chunk-F7PG4OEV.js +37 -0
- package/dist/chunk-GDSVW62T.js +171 -0
- package/dist/chunk-H2FHJOLU.js +178 -0
- package/dist/chunk-HJEBRCXL.js +55 -0
- package/dist/chunk-ICM6XBST.js +16 -0
- package/dist/chunk-IK7I3ABN.js +88 -0
- package/dist/chunk-L6J44O74.js +144 -0
- package/dist/chunk-LDSLS6HE.js +1 -0
- package/dist/chunk-LVNUHUEZ.js +191 -0
- package/dist/chunk-M64MVRLS.js +92 -0
- package/dist/chunk-NGQW3KEM.js +402 -0
- package/dist/chunk-NZ4FOC5N.js +559 -0
- package/dist/chunk-PIIRNAXA.js +26 -0
- package/dist/chunk-S66TJXJU.js +33 -0
- package/dist/chunk-SMLKNECP.js +133 -0
- package/dist/chunk-TAHBM3F2.js +66 -0
- package/dist/chunk-TO33OY4L.js +150 -0
- package/dist/chunk-TO7URV7U.js +51 -0
- package/dist/chunk-TOO5AEKL.js +81 -0
- package/dist/chunk-U3GHAOIJ.js +299 -0
- package/dist/chunk-U7N2A7A3.js +9 -0
- package/dist/chunk-UX634MYF.js +123 -0
- package/dist/chunk-V6UWJKZF.js +28 -0
- package/dist/chunk-VOHTRR5X.js +28 -0
- package/dist/chunk-WRFKVUPW.js +332 -0
- package/dist/chunk-WXW43RK5.js +24 -0
- package/dist/chunk-XG7XDYIM.js +60 -0
- package/dist/chunk-YFCQKO3B.js +842 -0
- package/dist/chunk-ZDWXGWLY.js +73 -0
- package/dist/chunk-ZLK5SPT6.js +11 -0
- package/dist/chunk-ZS6DTAM2.js +31 -0
- package/dist/chunk-ZT5UEUBO.js +1 -0
- package/dist/components/admin/index.d.ts +80 -0
- package/dist/components/admin/index.js +38 -0
- package/dist/components/data-display/badge.d.ts +12 -0
- package/dist/components/data-display/badge.js +3 -0
- package/dist/components/data-display/card.d.ts +87 -0
- package/dist/components/data-display/card.js +2 -0
- package/dist/components/data-display/index.d.ts +72 -0
- package/dist/components/data-display/index.js +89 -0
- package/dist/components/data-display/popover.d.ts +13 -0
- package/dist/components/data-display/popover.js +2 -0
- package/dist/components/data-display/scroll-area.d.ts +7 -0
- package/dist/components/data-display/scroll-area.js +2 -0
- package/dist/components/data-display/table.d.ts +10 -0
- package/dist/components/data-display/table.js +3 -0
- package/dist/components/data-entry/autocomplete.d.ts +16 -0
- package/dist/components/data-entry/autocomplete.js +8 -0
- package/dist/components/data-entry/calendar.d.ts +16 -0
- package/dist/components/data-entry/calendar.js +4 -0
- package/dist/components/data-entry/cascader.d.ts +32 -0
- package/dist/components/data-entry/cascader.js +13 -0
- package/dist/components/data-entry/checkbox.d.ts +13 -0
- package/dist/components/data-entry/checkbox.js +4 -0
- package/dist/components/data-entry/color-picker.d.ts +16 -0
- package/dist/components/data-entry/color-picker.js +6 -0
- package/dist/components/data-entry/command.d.ts +69 -0
- package/dist/components/data-entry/command.js +3 -0
- package/dist/components/data-entry/date-picker.d.ts +16 -0
- package/dist/components/data-entry/date-picker.js +8 -0
- package/dist/components/data-entry/date-range-picker.d.ts +16 -0
- package/dist/components/data-entry/date-range-picker.js +8 -0
- package/dist/components/data-entry/index.d.ts +53 -0
- package/dist/components/data-entry/index.js +152 -0
- package/dist/components/data-entry/input.d.ts +6 -0
- package/dist/components/data-entry/input.js +2 -0
- package/dist/components/data-entry/label.d.ts +8 -0
- package/dist/components/data-entry/label.js +2 -0
- package/dist/components/data-entry/radio.d.ts +24 -0
- package/dist/components/data-entry/radio.js +4 -0
- package/dist/components/data-entry/select.d.ts +18 -0
- package/dist/components/data-entry/select.js +3 -0
- package/dist/components/data-entry/slider.d.ts +16 -0
- package/dist/components/data-entry/slider.js +2 -0
- package/dist/components/data-entry/switch.d.ts +17 -0
- package/dist/components/data-entry/switch.js +2 -0
- package/dist/components/data-entry/textarea.d.ts +6 -0
- package/dist/components/data-entry/textarea.js +3 -0
- package/dist/components/data-entry/time-picker.d.ts +16 -0
- package/dist/components/data-entry/time-picker.js +7 -0
- package/dist/components/data-entry/transfer.d.ts +17 -0
- package/dist/components/data-entry/transfer.js +11 -0
- package/dist/components/data-entry/tree-select.d.ts +26 -0
- package/dist/components/data-entry/tree-select.js +13 -0
- package/dist/components/data-entry/upload.d.ts +42 -0
- package/dist/components/data-entry/upload.js +11 -0
- package/dist/components/feedback/alert.d.ts +60 -0
- package/dist/components/feedback/alert.js +7 -0
- package/dist/components/feedback/dialog.d.ts +64 -0
- package/dist/components/feedback/dialog.js +7 -0
- package/dist/components/feedback/index.d.ts +16 -0
- package/dist/components/feedback/index.js +14 -0
- package/dist/components/feedback/sheet.d.ts +24 -0
- package/dist/components/feedback/sheet.js +2 -0
- package/dist/components/feedback/sonner.d.ts +6 -0
- package/dist/components/feedback/sonner.js +1 -0
- package/dist/components/general/button.d.ts +20 -0
- package/dist/components/general/button.js +2 -0
- package/dist/components/general/index.d.ts +6 -0
- package/dist/components/general/index.js +2 -0
- package/dist/components/layout/index.d.ts +71 -0
- package/dist/components/layout/index.js +5 -0
- package/dist/components/navigation/dropdown-menu.d.ts +28 -0
- package/dist/components/navigation/dropdown-menu.js +2 -0
- package/dist/components/navigation/index.d.ts +32 -0
- package/dist/components/navigation/index.js +12 -0
- package/dist/components/navigation/pagination.d.ts +11 -0
- package/dist/components/navigation/pagination.js +7 -0
- package/dist/components/navigation/steps.d.ts +12 -0
- package/dist/components/navigation/steps.js +3 -0
- package/dist/components/navigation/tabs-items.d.ts +12 -0
- package/dist/components/navigation/tabs-items.js +3 -0
- package/dist/components/navigation/tabs.d.ts +12 -0
- package/dist/components/navigation/tabs.js +2 -0
- package/dist/components/query/index.d.ts +43 -0
- package/dist/components/query/index.js +8 -0
- package/dist/components/ui/index.d.ts +57 -0
- package/dist/components/ui/index.js +37 -0
- package/dist/content.prop-D1Dd3TAc.d.ts +31 -0
- package/dist/data-display.prop-DNTAzmDy.d.ts +58 -0
- package/dist/data-entry.prop-BEGA1lTq.d.ts +323 -0
- package/dist/data-table-D1u_rKLK.d.ts +83 -0
- package/dist/data.prop-BVvfKC_g.d.ts +41 -0
- package/dist/feedback.prop-BmxUlpAW.d.ts +64 -0
- package/dist/filter-bar-B7OGFO9S.d.ts +10 -0
- package/dist/form/index.d.ts +21 -0
- package/dist/form/index.js +4 -0
- package/dist/form.prop-BHgpuFFm.d.ts +41 -0
- package/dist/format-date-ByyZoqI5.d.ts +51 -0
- package/dist/general.prop-D7brMPNL.d.ts +16 -0
- package/dist/i18n/index.d.ts +217 -0
- package/dist/i18n/index.js +2 -0
- package/dist/index.d.ts +46 -26
- package/dist/index.js +39 -13062
- package/dist/inline-C5u6ptJV.d.ts +10 -0
- package/dist/interaction.prop-Cdn7wOtq.d.ts +25 -0
- package/dist/layout.prop-4TCNvyQZ.d.ts +20 -0
- package/dist/layout.prop-C795F0qg.d.ts +112 -0
- package/dist/lib/datetime/index.d.ts +31 -0
- package/dist/lib/datetime/index.js +1 -0
- package/dist/lib/utils.d.ts +5 -0
- package/dist/lib/utils.js +1 -0
- package/dist/navigation.prop-DpZqcXey.d.ts +78 -0
- package/dist/navigation.prop-DxBiClEH.d.ts +20 -0
- package/dist/props/components/index.d.ts +27 -0
- package/dist/props/components/index.js +1 -0
- package/dist/props/index.d.ts +28 -0
- package/dist/props/index.js +3 -0
- package/dist/props/registry.d.ts +649 -0
- package/dist/props/registry.js +1 -0
- package/dist/props/vocabulary/index.d.ts +7 -0
- package/dist/props/vocabulary/index.js +1 -0
- package/dist/query.prop-hIPrk2zI.d.ts +71 -0
- package/dist/search-input-uP01rY1L.d.ts +22 -0
- package/dist/shared.prop-BNRJc9K0.d.ts +45 -0
- package/dist/styles/alert-layout.css +191 -0
- package/dist/styles/badge-layout.css +22 -0
- package/dist/styles/card-layout.css +373 -0
- package/dist/styles/control.css +504 -0
- package/dist/styles/data-display-layout.css +246 -0
- package/dist/styles/density.css +43 -0
- package/dist/styles/dialog-layout.css +84 -0
- package/dist/styles/index.css +105 -0
- package/dist/styles/layout.css +479 -0
- package/dist/styles/shell-layout.css +604 -0
- package/dist/styles/table-layout.css +109 -0
- package/dist/theme/example.service.css +37 -0
- package/dist/tokens/base.css +13 -0
- package/dist/tokens/foundation.css +151 -0
- package/dist/tokens/primitives/badge.css +13 -0
- package/dist/tokens/primitives/card.css +29 -0
- package/dist/tokens/primitives/control.css +55 -0
- package/dist/tokens/primitives/feedback.css +17 -0
- package/dist/tokens/primitives/layout.css +20 -0
- package/dist/tokens/primitives/navigation.css +13 -0
- package/dist/tokens/primitives/table.css +10 -0
- package/dist/types-mvzYGrma.d.ts +37 -0
- package/dist/use-toast-Dol5bdY3.d.ts +34 -0
- package/package.json +279 -117
- package/scripts/ui-audit.mjs +179 -0
- package/BRAND.md +0 -296
- package/CHANGELOG.md +0 -668
- package/config/eslint.js +0 -54
- package/config/prettier.cjs +0 -20
- package/config/tsconfig.base.json +0 -22
- package/config/vitest.base.ts +0 -26
- package/dist/MiniMonth-YAmPGEpC.d.ts +0 -143
- package/dist/Table.types-BbsxoIYE.d.ts +0 -352
- package/dist/color-DO0qqUAb.d.ts +0 -38
- package/dist/components/composites.d.ts +0 -963
- package/dist/components/composites.js +0 -7343
- package/dist/components/composites.js.map +0 -1
- package/dist/components/primitives.d.ts +0 -2744
- package/dist/components/primitives.js +0 -7356
- package/dist/components/primitives.js.map +0 -1
- package/dist/components/shell.d.ts +0 -182
- package/dist/components/shell.js +0 -774
- package/dist/components/shell.js.map +0 -1
- package/dist/hooks.d.ts +0 -100
- package/dist/hooks.js +0 -558
- package/dist/hooks.js.map +0 -1
- package/dist/i18n.d.ts +0 -61
- package/dist/i18n.js +0 -860
- package/dist/i18n.js.map +0 -1
- package/dist/index.js.map +0 -1
- package/dist/padding-DY0JV5Ja.d.ts +0 -16
- package/dist/preferences.d.ts +0 -132
- package/dist/preferences.js +0 -262
- package/dist/preferences.js.map +0 -1
- package/dist/props.d.ts +0 -86
- package/dist/props.js +0 -16
- package/dist/props.js.map +0 -1
- package/dist/size-CQwNvOWd.d.ts +0 -19
- package/dist/types-LTj-2bl-.d.ts +0 -30
- package/dist/useTableViews-D5NIAJ7h.d.ts +0 -154
- package/src/tokens/tailwind.css +0 -158
|
@@ -0,0 +1,171 @@
|
|
|
1
|
+
import { Select, SelectTrigger, SelectValue, SelectContent, SelectItem } from './chunk-UX634MYF.js';
|
|
2
|
+
import { Button } from './chunk-HJEBRCXL.js';
|
|
3
|
+
import { useTranslation } from './chunk-3F2AKYRD.js';
|
|
4
|
+
import { cn } from './chunk-U7N2A7A3.js';
|
|
5
|
+
import { ChevronLeft, ChevronRight, MoreHorizontal } from 'lucide-react';
|
|
6
|
+
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
7
|
+
|
|
8
|
+
// src/components/navigation/pagination-utils.ts
|
|
9
|
+
function buildPageRange(current, totalPages, siblingCount = 1) {
|
|
10
|
+
if (totalPages <= 1) return totalPages === 1 ? [1] : [];
|
|
11
|
+
const totalNumbers = siblingCount * 2 + 5;
|
|
12
|
+
if (totalPages <= totalNumbers) {
|
|
13
|
+
return Array.from({ length: totalPages }, (_, i) => i + 1);
|
|
14
|
+
}
|
|
15
|
+
const left = Math.max(current - siblingCount, 1);
|
|
16
|
+
const right = Math.min(current + siblingCount, totalPages);
|
|
17
|
+
const showLeftEllipsis = left > 2;
|
|
18
|
+
const showRightEllipsis = right < totalPages - 1;
|
|
19
|
+
const range = [];
|
|
20
|
+
range.push(1);
|
|
21
|
+
if (showLeftEllipsis) range.push("ellipsis");
|
|
22
|
+
else for (let i = 2; i < left; i++) range.push(i);
|
|
23
|
+
for (let i = left; i <= right; i++) {
|
|
24
|
+
if (i !== 1 && i !== totalPages) range.push(i);
|
|
25
|
+
}
|
|
26
|
+
if (showRightEllipsis) range.push("ellipsis");
|
|
27
|
+
else for (let i = right + 1; i < totalPages; i++) range.push(i);
|
|
28
|
+
if (totalPages > 1) range.push(totalPages);
|
|
29
|
+
return range;
|
|
30
|
+
}
|
|
31
|
+
function Pagination({
|
|
32
|
+
current = 1,
|
|
33
|
+
total = 0,
|
|
34
|
+
pageSize = 10,
|
|
35
|
+
pageSizeOptions = [10, 20, 50, 100],
|
|
36
|
+
showSizeChanger,
|
|
37
|
+
showTotal,
|
|
38
|
+
simple,
|
|
39
|
+
disabled,
|
|
40
|
+
className,
|
|
41
|
+
onChange
|
|
42
|
+
}) {
|
|
43
|
+
const { t } = useTranslation();
|
|
44
|
+
const totalPages = Math.max(1, Math.ceil(total / pageSize));
|
|
45
|
+
const safeCurrent = Math.min(Math.max(1, current), totalPages);
|
|
46
|
+
const pages = buildPageRange(safeCurrent, totalPages);
|
|
47
|
+
const go = (page, size = pageSize) => {
|
|
48
|
+
if (disabled) return;
|
|
49
|
+
const nextPage = Math.min(Math.max(1, page), Math.max(1, Math.ceil(total / size)));
|
|
50
|
+
onChange?.(nextPage, size);
|
|
51
|
+
};
|
|
52
|
+
const totalLabel = typeof showTotal === "function" ? showTotal(total, [
|
|
53
|
+
(safeCurrent - 1) * pageSize + 1,
|
|
54
|
+
Math.min(safeCurrent * pageSize, total)
|
|
55
|
+
]) : showTotal ? t("navigation.pagination.total", { total }) : null;
|
|
56
|
+
if (simple) {
|
|
57
|
+
return /* @__PURE__ */ jsxs(
|
|
58
|
+
"nav",
|
|
59
|
+
{
|
|
60
|
+
"aria-label": t("navigation.pagination.ariaLabel"),
|
|
61
|
+
"data-simple": "true",
|
|
62
|
+
className: cn("ui-pagination", className),
|
|
63
|
+
children: [
|
|
64
|
+
totalLabel && /* @__PURE__ */ jsx("span", { className: "ui-pagination-total", children: totalLabel }),
|
|
65
|
+
/* @__PURE__ */ jsx(
|
|
66
|
+
Button,
|
|
67
|
+
{
|
|
68
|
+
type: "button",
|
|
69
|
+
variant: "outline",
|
|
70
|
+
size: "sm",
|
|
71
|
+
disabled: Boolean(disabled) || safeCurrent <= 1,
|
|
72
|
+
"aria-label": t("navigation.pagination.prev"),
|
|
73
|
+
onClick: () => go(safeCurrent - 1),
|
|
74
|
+
children: /* @__PURE__ */ jsx(ChevronLeft, { className: "size-4", "aria-hidden": "true" })
|
|
75
|
+
}
|
|
76
|
+
),
|
|
77
|
+
/* @__PURE__ */ jsxs("span", { className: "ui-pagination-count", children: [
|
|
78
|
+
safeCurrent,
|
|
79
|
+
" / ",
|
|
80
|
+
totalPages
|
|
81
|
+
] }),
|
|
82
|
+
/* @__PURE__ */ jsx(
|
|
83
|
+
Button,
|
|
84
|
+
{
|
|
85
|
+
type: "button",
|
|
86
|
+
variant: "outline",
|
|
87
|
+
size: "sm",
|
|
88
|
+
disabled: Boolean(disabled) || safeCurrent >= totalPages,
|
|
89
|
+
"aria-label": t("navigation.pagination.next"),
|
|
90
|
+
onClick: () => go(safeCurrent + 1),
|
|
91
|
+
children: /* @__PURE__ */ jsx(ChevronRight, { className: "size-4", "aria-hidden": "true" })
|
|
92
|
+
}
|
|
93
|
+
)
|
|
94
|
+
]
|
|
95
|
+
}
|
|
96
|
+
);
|
|
97
|
+
}
|
|
98
|
+
return /* @__PURE__ */ jsxs(
|
|
99
|
+
"nav",
|
|
100
|
+
{
|
|
101
|
+
"aria-label": t("navigation.pagination.ariaLabel"),
|
|
102
|
+
className: cn("ui-pagination", className),
|
|
103
|
+
children: [
|
|
104
|
+
totalLabel && /* @__PURE__ */ jsx("span", { className: "ui-pagination-total", children: totalLabel }),
|
|
105
|
+
showSizeChanger && /* @__PURE__ */ jsxs(
|
|
106
|
+
Select,
|
|
107
|
+
{
|
|
108
|
+
value: String(pageSize),
|
|
109
|
+
onValueChange: (v) => go(1, Number(v)),
|
|
110
|
+
disabled,
|
|
111
|
+
children: [
|
|
112
|
+
/* @__PURE__ */ jsx(
|
|
113
|
+
SelectTrigger,
|
|
114
|
+
{
|
|
115
|
+
className: "ui-pagination-size-trigger",
|
|
116
|
+
"aria-label": t("navigation.pagination.pageSize"),
|
|
117
|
+
children: /* @__PURE__ */ jsx(SelectValue, {})
|
|
118
|
+
}
|
|
119
|
+
),
|
|
120
|
+
/* @__PURE__ */ jsx(SelectContent, { children: pageSizeOptions.map((size) => /* @__PURE__ */ jsx(SelectItem, { value: String(size), children: t("navigation.pagination.pageSizeOption", { size }) }, size)) })
|
|
121
|
+
]
|
|
122
|
+
}
|
|
123
|
+
),
|
|
124
|
+
/* @__PURE__ */ jsx(
|
|
125
|
+
Button,
|
|
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,
|
|
140
|
+
{
|
|
141
|
+
type: "button",
|
|
142
|
+
variant: page === safeCurrent ? "default" : "outline",
|
|
143
|
+
size: "icon",
|
|
144
|
+
className: "ui-button--compact-icon ui-pagination-page",
|
|
145
|
+
disabled,
|
|
146
|
+
"aria-label": t("navigation.pagination.page", { page }),
|
|
147
|
+
"aria-current": page === safeCurrent ? "page" : void 0,
|
|
148
|
+
onClick: () => go(page),
|
|
149
|
+
children: page
|
|
150
|
+
}
|
|
151
|
+
) }, page)
|
|
152
|
+
) }),
|
|
153
|
+
/* @__PURE__ */ jsx(
|
|
154
|
+
Button,
|
|
155
|
+
{
|
|
156
|
+
type: "button",
|
|
157
|
+
variant: "outline",
|
|
158
|
+
size: "icon",
|
|
159
|
+
className: "ui-button--compact-icon",
|
|
160
|
+
disabled: Boolean(disabled) || safeCurrent >= totalPages,
|
|
161
|
+
"aria-label": t("navigation.pagination.next"),
|
|
162
|
+
onClick: () => go(safeCurrent + 1),
|
|
163
|
+
children: /* @__PURE__ */ jsx(ChevronRight, { "aria-hidden": "true" })
|
|
164
|
+
}
|
|
165
|
+
)
|
|
166
|
+
]
|
|
167
|
+
}
|
|
168
|
+
);
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
export { Pagination };
|
|
@@ -0,0 +1,178 @@
|
|
|
1
|
+
import { Select, SelectTrigger, SelectValue, SelectContent, SelectItem } from './chunk-UX634MYF.js';
|
|
2
|
+
import { Button } from './chunk-HJEBRCXL.js';
|
|
3
|
+
import { useTranslation, useOptionalAppContext, APP_LOCALES, resolveTimezonePickerOptions, getTimezoneLabel, APP_TIME_FORMAT_OPTIONS, getTimeFormatLabel } from './chunk-3F2AKYRD.js';
|
|
4
|
+
import { APP_DATE_FORMAT_OPTIONS, getDateFormatLabel } from './chunk-YFCQKO3B.js';
|
|
5
|
+
import { cn } from './chunk-U7N2A7A3.js';
|
|
6
|
+
import { X, ChevronRight, Languages, Globe, Clock, CalendarDays } from 'lucide-react';
|
|
7
|
+
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
8
|
+
import { Link } from 'react-router-dom';
|
|
9
|
+
import * as React from 'react';
|
|
10
|
+
|
|
11
|
+
function FilterBar({
|
|
12
|
+
onClear,
|
|
13
|
+
hasActiveFilters = true,
|
|
14
|
+
className,
|
|
15
|
+
children
|
|
16
|
+
}) {
|
|
17
|
+
const { t } = useTranslation();
|
|
18
|
+
return /* @__PURE__ */ jsxs("div", { className: cn("ui-filter-bar", className), children: [
|
|
19
|
+
children,
|
|
20
|
+
onClear && hasActiveFilters && /* @__PURE__ */ jsxs(Button, { variant: "ghost", size: "sm", onClick: onClear, className: "ui-filter-clear", children: [
|
|
21
|
+
/* @__PURE__ */ jsx(X, { "aria-hidden": "true" }),
|
|
22
|
+
t("common.clearFilters")
|
|
23
|
+
] })
|
|
24
|
+
] });
|
|
25
|
+
}
|
|
26
|
+
function FilterGroup({ label, className, children }) {
|
|
27
|
+
return /* @__PURE__ */ jsxs("div", { className: cn("ui-stack-xs ui-filter-group", className), children: [
|
|
28
|
+
/* @__PURE__ */ jsx("div", { className: "ui-filter-label", children: label }),
|
|
29
|
+
children
|
|
30
|
+
] });
|
|
31
|
+
}
|
|
32
|
+
function PageHeader({ title, description, breadcrumb, actions, className }) {
|
|
33
|
+
return /* @__PURE__ */ jsxs("header", { className: cn("ui-page-header", className), children: [
|
|
34
|
+
breadcrumb && breadcrumb.length > 0 && /* @__PURE__ */ jsx("nav", { "aria-label": "Breadcrumb", className: "ui-breadcrumb", children: /* @__PURE__ */ jsx("ol", { className: "ui-breadcrumb-list", children: breadcrumb.map((item, i) => {
|
|
35
|
+
const isLast = i === breadcrumb.length - 1;
|
|
36
|
+
return /* @__PURE__ */ jsxs("li", { className: "ui-inline-xs", children: [
|
|
37
|
+
item.to && !isLast ? /* @__PURE__ */ jsx(Link, { to: item.to, className: "hover:text-foreground hover:underline", children: item.label }) : /* @__PURE__ */ jsx(
|
|
38
|
+
"span",
|
|
39
|
+
{
|
|
40
|
+
className: isLast ? "text-foreground" : "",
|
|
41
|
+
"aria-current": isLast ? "page" : void 0,
|
|
42
|
+
children: item.label
|
|
43
|
+
}
|
|
44
|
+
),
|
|
45
|
+
!isLast && /* @__PURE__ */ jsx(ChevronRight, { className: "size-3", "aria-hidden": "true" })
|
|
46
|
+
] }, i);
|
|
47
|
+
}) }) }),
|
|
48
|
+
/* @__PURE__ */ jsxs("div", { className: "ui-page-header-row", children: [
|
|
49
|
+
/* @__PURE__ */ jsxs("div", { className: "min-w-0", children: [
|
|
50
|
+
/* @__PURE__ */ jsx("h1", { className: "ui-page-title", children: title }),
|
|
51
|
+
description && /* @__PURE__ */ jsx("p", { className: "ui-page-subtitle", children: description })
|
|
52
|
+
] }),
|
|
53
|
+
actions && /* @__PURE__ */ jsx("div", { className: "ui-inline-sm shrink-0", children: actions })
|
|
54
|
+
] })
|
|
55
|
+
] });
|
|
56
|
+
}
|
|
57
|
+
function LocalePicker({ className, disabled, id, value, onChange }) {
|
|
58
|
+
const ctx = useOptionalAppContext();
|
|
59
|
+
const { t } = useTranslation();
|
|
60
|
+
const current = value ?? ctx?.locale;
|
|
61
|
+
const handleChange = onChange ?? ctx?.setLocale;
|
|
62
|
+
if (current === void 0 || !handleChange) {
|
|
63
|
+
throw new Error("LocalePicker requires <AppProvider> or controlled value + onChange");
|
|
64
|
+
}
|
|
65
|
+
return /* @__PURE__ */ jsxs(Select, { value: current, onValueChange: handleChange, disabled, children: [
|
|
66
|
+
/* @__PURE__ */ jsxs(
|
|
67
|
+
SelectTrigger,
|
|
68
|
+
{
|
|
69
|
+
id,
|
|
70
|
+
className: cn("w-full sm:w-40", className),
|
|
71
|
+
"aria-label": t("navigation.localePicker.ariaLabel"),
|
|
72
|
+
children: [
|
|
73
|
+
/* @__PURE__ */ jsx(Languages, { className: "mr-2 size-4 shrink-0 opacity-70", "aria-hidden": "true" }),
|
|
74
|
+
/* @__PURE__ */ jsx(SelectValue, {})
|
|
75
|
+
]
|
|
76
|
+
}
|
|
77
|
+
),
|
|
78
|
+
/* @__PURE__ */ jsx(SelectContent, { children: APP_LOCALES.map((code) => /* @__PURE__ */ jsx(SelectItem, { value: code, children: t(`locale.${code}`) }, code)) })
|
|
79
|
+
] });
|
|
80
|
+
}
|
|
81
|
+
function TimezonePicker({
|
|
82
|
+
className,
|
|
83
|
+
disabled,
|
|
84
|
+
id,
|
|
85
|
+
value,
|
|
86
|
+
onChange,
|
|
87
|
+
options: optionsProp
|
|
88
|
+
}) {
|
|
89
|
+
const ctx = useOptionalAppContext();
|
|
90
|
+
const { t, locale, fallbackLocale } = useTranslation();
|
|
91
|
+
const current = value ?? ctx?.timezone;
|
|
92
|
+
const handleChange = onChange ?? ctx?.setTimezone;
|
|
93
|
+
const configured = optionsProp ?? ctx?.timezoneOptions;
|
|
94
|
+
if (current === void 0 || !handleChange) {
|
|
95
|
+
throw new Error("TimezonePicker requires <AppProvider> or controlled value + onChange");
|
|
96
|
+
}
|
|
97
|
+
const options = React.useMemo(
|
|
98
|
+
() => resolveTimezonePickerOptions(configured, current),
|
|
99
|
+
[configured, current]
|
|
100
|
+
);
|
|
101
|
+
return /* @__PURE__ */ jsxs(Select, { value: current, onValueChange: handleChange, disabled, children: [
|
|
102
|
+
/* @__PURE__ */ jsxs(
|
|
103
|
+
SelectTrigger,
|
|
104
|
+
{
|
|
105
|
+
id,
|
|
106
|
+
className: cn("w-full sm:w-56", className),
|
|
107
|
+
"aria-label": t("navigation.timezonePicker.ariaLabel"),
|
|
108
|
+
children: [
|
|
109
|
+
/* @__PURE__ */ jsx(Globe, { className: "mr-2 size-4 shrink-0 opacity-70", "aria-hidden": "true" }),
|
|
110
|
+
/* @__PURE__ */ jsx(SelectValue, {})
|
|
111
|
+
]
|
|
112
|
+
}
|
|
113
|
+
),
|
|
114
|
+
/* @__PURE__ */ jsx(SelectContent, { children: options.map((tz) => /* @__PURE__ */ jsx(SelectItem, { value: tz, children: getTimezoneLabel(tz, locale, fallbackLocale) }, tz)) })
|
|
115
|
+
] });
|
|
116
|
+
}
|
|
117
|
+
function TimeFormatPicker({
|
|
118
|
+
className,
|
|
119
|
+
disabled,
|
|
120
|
+
id,
|
|
121
|
+
value,
|
|
122
|
+
onChange
|
|
123
|
+
}) {
|
|
124
|
+
const ctx = useOptionalAppContext();
|
|
125
|
+
const { t, locale, fallbackLocale } = useTranslation();
|
|
126
|
+
const current = value ?? ctx?.timeFormat;
|
|
127
|
+
const handleChange = onChange ?? ctx?.setTimeFormat;
|
|
128
|
+
if (current === void 0 || !handleChange) {
|
|
129
|
+
throw new Error("TimeFormatPicker requires <AppProvider> or controlled value + onChange");
|
|
130
|
+
}
|
|
131
|
+
return /* @__PURE__ */ jsxs(Select, { value: current, onValueChange: handleChange, disabled, children: [
|
|
132
|
+
/* @__PURE__ */ jsxs(
|
|
133
|
+
SelectTrigger,
|
|
134
|
+
{
|
|
135
|
+
id,
|
|
136
|
+
className: cn("w-full sm:w-44", className),
|
|
137
|
+
"aria-label": t("navigation.timeFormatPicker.ariaLabel"),
|
|
138
|
+
children: [
|
|
139
|
+
/* @__PURE__ */ jsx(Clock, { className: "mr-2 size-4 shrink-0 opacity-70", "aria-hidden": "true" }),
|
|
140
|
+
/* @__PURE__ */ jsx(SelectValue, {})
|
|
141
|
+
]
|
|
142
|
+
}
|
|
143
|
+
),
|
|
144
|
+
/* @__PURE__ */ jsx(SelectContent, { children: APP_TIME_FORMAT_OPTIONS.map((option) => /* @__PURE__ */ jsx(SelectItem, { value: option.value, children: getTimeFormatLabel(option.value, locale, fallbackLocale) }, option.value)) })
|
|
145
|
+
] });
|
|
146
|
+
}
|
|
147
|
+
function DateFormatPicker({
|
|
148
|
+
className,
|
|
149
|
+
disabled,
|
|
150
|
+
id,
|
|
151
|
+
value,
|
|
152
|
+
onChange
|
|
153
|
+
}) {
|
|
154
|
+
const ctx = useOptionalAppContext();
|
|
155
|
+
const { t, locale, fallbackLocale } = useTranslation();
|
|
156
|
+
const current = value ?? ctx?.dateFormat;
|
|
157
|
+
const handleChange = onChange ?? ctx?.setDateFormat;
|
|
158
|
+
if (current === void 0 || !handleChange) {
|
|
159
|
+
throw new Error("DateFormatPicker requires <AppProvider> or controlled value + onChange");
|
|
160
|
+
}
|
|
161
|
+
return /* @__PURE__ */ jsxs(Select, { value: current, onValueChange: handleChange, disabled, children: [
|
|
162
|
+
/* @__PURE__ */ jsxs(
|
|
163
|
+
SelectTrigger,
|
|
164
|
+
{
|
|
165
|
+
id,
|
|
166
|
+
className: cn("w-full sm:w-44", className),
|
|
167
|
+
"aria-label": t("navigation.dateFormatPicker.ariaLabel"),
|
|
168
|
+
children: [
|
|
169
|
+
/* @__PURE__ */ jsx(CalendarDays, { className: "mr-2 size-4 shrink-0 opacity-70", "aria-hidden": "true" }),
|
|
170
|
+
/* @__PURE__ */ jsx(SelectValue, {})
|
|
171
|
+
]
|
|
172
|
+
}
|
|
173
|
+
),
|
|
174
|
+
/* @__PURE__ */ jsx(SelectContent, { children: APP_DATE_FORMAT_OPTIONS.map((option) => /* @__PURE__ */ jsx(SelectItem, { value: option.value, children: getDateFormatLabel(option.value, locale, fallbackLocale) }, option.value)) })
|
|
175
|
+
] });
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
export { DateFormatPicker, FilterBar, FilterGroup, LocalePicker, PageHeader, TimeFormatPicker, TimezonePicker };
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import { cn } from './chunk-U7N2A7A3.js';
|
|
2
|
+
import * as React from 'react';
|
|
3
|
+
import { Slot } from '@radix-ui/react-slot';
|
|
4
|
+
import { cva } from 'class-variance-authority';
|
|
5
|
+
import { jsx } from 'react/jsx-runtime';
|
|
6
|
+
|
|
7
|
+
var buttonVariants = cva("ui-button", {
|
|
8
|
+
variants: {
|
|
9
|
+
variant: {
|
|
10
|
+
default: "ui-button--default bg-primary text-primary-foreground hover:bg-primary/90",
|
|
11
|
+
destructive: "ui-button--destructive bg-destructive text-destructive-foreground hover:bg-destructive/90 focus-visible:ring-destructive/20",
|
|
12
|
+
outline: "ui-button--outline border bg-background shadow-xs hover:bg-accent hover:text-accent-foreground",
|
|
13
|
+
secondary: "ui-button--secondary bg-secondary text-secondary-foreground hover:bg-secondary/80",
|
|
14
|
+
ghost: "ui-button--ghost hover:bg-accent hover:text-accent-foreground",
|
|
15
|
+
link: "ui-button--link text-primary underline-offset-4 hover:underline"
|
|
16
|
+
},
|
|
17
|
+
size: {
|
|
18
|
+
default: "ui-button--default-size py-2 has-[>svg]:px-3",
|
|
19
|
+
xs: "h-[calc(var(--control-height)-0.75rem)] gap-1 rounded-md px-2 text-xs has-[>svg]:px-1.5 [&_svg:not([class*='size-'])]:size-3",
|
|
20
|
+
sm: "ui-button--sm gap-1.5 rounded-md has-[>svg]:px-2.5",
|
|
21
|
+
lg: "ui-button--lg rounded-md has-[>svg]:px-4",
|
|
22
|
+
icon: "ui-button--icon",
|
|
23
|
+
"icon-xs": "size-[calc(var(--control-height)-0.75rem)] rounded-md [&_svg:not([class*='size-'])]:size-3",
|
|
24
|
+
"icon-sm": "size-[calc(var(--control-height)-0.5rem)]",
|
|
25
|
+
"icon-lg": "size-[calc(var(--control-height)+0.25rem)]"
|
|
26
|
+
}
|
|
27
|
+
},
|
|
28
|
+
defaultVariants: { variant: "default", size: "default" }
|
|
29
|
+
});
|
|
30
|
+
var Button = React.forwardRef(
|
|
31
|
+
({ className, variant, size, asChild = false, ...props }, ref) => {
|
|
32
|
+
const Comp = asChild ? Slot : "button";
|
|
33
|
+
return /* @__PURE__ */ jsx(
|
|
34
|
+
Comp,
|
|
35
|
+
{
|
|
36
|
+
"data-slot": "button",
|
|
37
|
+
"data-variant": variant ?? "default",
|
|
38
|
+
"data-size": size ?? "default",
|
|
39
|
+
className: cn(
|
|
40
|
+
"inline-flex shrink-0 items-center justify-center gap-2 rounded-md text-sm font-medium whitespace-nowrap transition-all outline-none",
|
|
41
|
+
"focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px]",
|
|
42
|
+
"disabled:pointer-events-none disabled:opacity-50",
|
|
43
|
+
"aria-invalid:border-destructive aria-invalid:ring-destructive/20",
|
|
44
|
+
"[&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",
|
|
45
|
+
buttonVariants({ variant, size, className })
|
|
46
|
+
),
|
|
47
|
+
ref,
|
|
48
|
+
...props
|
|
49
|
+
}
|
|
50
|
+
);
|
|
51
|
+
}
|
|
52
|
+
);
|
|
53
|
+
Button.displayName = "Button";
|
|
54
|
+
|
|
55
|
+
export { Button, buttonVariants };
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
// src/lib/control-styles.ts
|
|
2
|
+
var controlMultilineClass = "ui-control-multiline w-full rounded-lg border border-input bg-background ring-offset-background placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-[3px] focus-visible:ring-ring/25 disabled:cursor-not-allowed disabled:opacity-50";
|
|
3
|
+
var controlTriggerClass = "ui-control flex w-full items-center justify-between gap-2 whitespace-nowrap rounded-lg border border-input bg-background shadow-sm focus-visible:outline-none focus-visible:ring-[3px] focus-visible:ring-ring/25 disabled:cursor-not-allowed disabled:opacity-50 [&>span]:line-clamp-1";
|
|
4
|
+
var controlIconClass = "size-[length:var(--control-height)] shrink-0";
|
|
5
|
+
var controlIconSmClass = "size-[calc(var(--control-height)-0.5rem)] shrink-0";
|
|
6
|
+
var controlIconLeadingClass = "size-[length:var(--control-icon-size)] shrink-0";
|
|
7
|
+
var tableRowHeightClass = "h-[length:var(--table-row-height)]";
|
|
8
|
+
var tableHeadHeightClass = "h-[length:var(--table-row-height)]";
|
|
9
|
+
var tableCellPaddingClass = "py-[length:var(--table-cell-padding-y)]";
|
|
10
|
+
var toneSuccessClass = "border-success/30 bg-success/10 text-success";
|
|
11
|
+
var toneWarningClass = "border-warning/30 bg-warning/10 text-warning-foreground";
|
|
12
|
+
var toneInfoClass = "border-info/30 bg-info/10 text-info";
|
|
13
|
+
var toneDestructiveClass = "border-destructive/30 bg-destructive/10 text-destructive";
|
|
14
|
+
var toneNeutralClass = "border-border bg-muted text-muted-foreground";
|
|
15
|
+
|
|
16
|
+
export { controlIconClass, controlIconLeadingClass, controlIconSmClass, controlMultilineClass, controlTriggerClass, tableCellPaddingClass, tableHeadHeightClass, tableRowHeightClass, toneDestructiveClass, toneInfoClass, toneNeutralClass, toneSuccessClass, toneWarningClass };
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
import { controlIconSmClass } from './chunk-ICM6XBST.js';
|
|
2
|
+
import { buttonVariants } from './chunk-HJEBRCXL.js';
|
|
3
|
+
import { cn } from './chunk-U7N2A7A3.js';
|
|
4
|
+
import { ChevronLeft, ChevronRight } from 'lucide-react';
|
|
5
|
+
import { DayPicker } from 'react-day-picker';
|
|
6
|
+
import { jsx } from 'react/jsx-runtime';
|
|
7
|
+
|
|
8
|
+
function Calendar({
|
|
9
|
+
className,
|
|
10
|
+
classNames,
|
|
11
|
+
showOutsideDays = true,
|
|
12
|
+
...props
|
|
13
|
+
}) {
|
|
14
|
+
return /* @__PURE__ */ jsx(
|
|
15
|
+
DayPicker,
|
|
16
|
+
{
|
|
17
|
+
showOutsideDays,
|
|
18
|
+
className: cn("p-3", className),
|
|
19
|
+
classNames: {
|
|
20
|
+
months: cn("flex flex-col gap-4 sm:flex-row", classNames?.months),
|
|
21
|
+
month: cn("relative flex flex-col gap-4", classNames?.month),
|
|
22
|
+
month_caption: cn(
|
|
23
|
+
"flex h-[length:var(--control-height)] w-full items-center justify-center px-8",
|
|
24
|
+
classNames?.month_caption
|
|
25
|
+
),
|
|
26
|
+
caption_label: cn("text-sm font-medium", classNames?.caption_label),
|
|
27
|
+
nav: cn("absolute inset-x-0 top-3 flex items-center justify-between px-1", classNames?.nav),
|
|
28
|
+
button_previous: cn(
|
|
29
|
+
buttonVariants({ variant: "outline" }),
|
|
30
|
+
controlIconSmClass,
|
|
31
|
+
"bg-transparent p-0 opacity-70 hover:opacity-100",
|
|
32
|
+
classNames?.button_previous
|
|
33
|
+
),
|
|
34
|
+
button_next: cn(
|
|
35
|
+
buttonVariants({ variant: "outline" }),
|
|
36
|
+
controlIconSmClass,
|
|
37
|
+
"bg-transparent p-0 opacity-70 hover:opacity-100",
|
|
38
|
+
classNames?.button_next
|
|
39
|
+
),
|
|
40
|
+
month_grid: cn("mt-4 w-full border-collapse", classNames?.month_grid),
|
|
41
|
+
weekdays: cn("flex", classNames?.weekdays),
|
|
42
|
+
weekday: cn(
|
|
43
|
+
"w-[length:var(--control-height)] rounded-md text-xs font-normal text-muted-foreground",
|
|
44
|
+
classNames?.weekday
|
|
45
|
+
),
|
|
46
|
+
week: cn("mt-2 flex w-full", classNames?.week),
|
|
47
|
+
day: cn(
|
|
48
|
+
"relative p-0 text-center text-sm focus-within:relative focus-within:z-20",
|
|
49
|
+
"[&:has([aria-selected])]:bg-accent [&:has([aria-selected].day-outside)]:bg-accent/50",
|
|
50
|
+
"[&:has([aria-selected].day-range-end)]:rounded-r-md",
|
|
51
|
+
classNames?.day
|
|
52
|
+
),
|
|
53
|
+
day_button: cn(
|
|
54
|
+
buttonVariants({ variant: "ghost" }),
|
|
55
|
+
"size-[length:var(--control-height)] p-0 font-normal aria-selected:opacity-100",
|
|
56
|
+
classNames?.day_button
|
|
57
|
+
),
|
|
58
|
+
range_start: cn("day-range-start rounded-l-md", classNames?.range_start),
|
|
59
|
+
range_end: cn("day-range-end rounded-r-md", classNames?.range_end),
|
|
60
|
+
range_middle: cn(
|
|
61
|
+
"aria-selected:bg-accent aria-selected:text-accent-foreground",
|
|
62
|
+
classNames?.range_middle
|
|
63
|
+
),
|
|
64
|
+
selected: cn(
|
|
65
|
+
"bg-primary text-primary-foreground hover:bg-primary hover:text-primary-foreground focus:bg-primary focus:text-primary-foreground",
|
|
66
|
+
classNames?.selected
|
|
67
|
+
),
|
|
68
|
+
today: cn("bg-accent text-accent-foreground", classNames?.today),
|
|
69
|
+
outside: cn(
|
|
70
|
+
"day-outside text-muted-foreground aria-selected:text-muted-foreground",
|
|
71
|
+
classNames?.outside
|
|
72
|
+
),
|
|
73
|
+
disabled: cn("text-muted-foreground opacity-50", classNames?.disabled),
|
|
74
|
+
hidden: cn("invisible", classNames?.hidden),
|
|
75
|
+
...classNames
|
|
76
|
+
},
|
|
77
|
+
components: {
|
|
78
|
+
Chevron: ({ orientation, className: chevronClassName }) => {
|
|
79
|
+
const Icon = orientation === "left" ? ChevronLeft : ChevronRight;
|
|
80
|
+
return /* @__PURE__ */ jsx(Icon, { className: cn("size-4", chevronClassName), "aria-hidden": "true" });
|
|
81
|
+
}
|
|
82
|
+
},
|
|
83
|
+
...props
|
|
84
|
+
}
|
|
85
|
+
);
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
export { Calendar };
|
|
@@ -0,0 +1,144 @@
|
|
|
1
|
+
import { controlIconClass } from './chunk-ICM6XBST.js';
|
|
2
|
+
import { cn } from './chunk-U7N2A7A3.js';
|
|
3
|
+
import { Check, Loader2, X, Circle } from 'lucide-react';
|
|
4
|
+
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
5
|
+
|
|
6
|
+
function resolveStepStatus(index, current, itemStatus, currentStatus) {
|
|
7
|
+
if (itemStatus) return itemStatus;
|
|
8
|
+
if (index < current) return "finish";
|
|
9
|
+
if (index === current) return currentStatus ?? "process";
|
|
10
|
+
return "wait";
|
|
11
|
+
}
|
|
12
|
+
function StepIcon({
|
|
13
|
+
status,
|
|
14
|
+
icon,
|
|
15
|
+
type
|
|
16
|
+
}) {
|
|
17
|
+
if (icon)
|
|
18
|
+
return /* @__PURE__ */ jsx("span", { className: cn("flex items-center justify-center", controlIconClass), children: icon });
|
|
19
|
+
if (type === "dot") {
|
|
20
|
+
return /* @__PURE__ */ jsx(
|
|
21
|
+
"span",
|
|
22
|
+
{
|
|
23
|
+
className: cn(
|
|
24
|
+
"block size-2.5 rounded-full",
|
|
25
|
+
status === "finish" && "bg-primary",
|
|
26
|
+
status === "process" && "bg-primary ring-primary/20 ring-4",
|
|
27
|
+
status === "error" && "bg-destructive",
|
|
28
|
+
status === "wait" && "bg-muted-foreground/30"
|
|
29
|
+
)
|
|
30
|
+
}
|
|
31
|
+
);
|
|
32
|
+
}
|
|
33
|
+
return /* @__PURE__ */ jsxs(
|
|
34
|
+
"span",
|
|
35
|
+
{
|
|
36
|
+
className: cn(
|
|
37
|
+
"flex items-center justify-center",
|
|
38
|
+
controlIconClass,
|
|
39
|
+
"rounded-full border-2 text-sm font-medium",
|
|
40
|
+
status === "finish" && "border-primary bg-primary text-primary-foreground",
|
|
41
|
+
status === "process" && "border-primary text-primary",
|
|
42
|
+
status === "error" && "border-destructive bg-destructive text-destructive-foreground",
|
|
43
|
+
status === "wait" && "border-muted-foreground/30 text-muted-foreground"
|
|
44
|
+
),
|
|
45
|
+
children: [
|
|
46
|
+
status === "finish" && /* @__PURE__ */ jsx(Check, { className: "size-4", "aria-hidden": "true" }),
|
|
47
|
+
status === "process" && /* @__PURE__ */ jsx(Loader2, { className: "size-4 animate-spin", "aria-hidden": "true" }),
|
|
48
|
+
status === "error" && /* @__PURE__ */ jsx(X, { className: "size-4", "aria-hidden": "true" }),
|
|
49
|
+
status === "wait" && /* @__PURE__ */ jsx(Circle, { className: "size-3 fill-current", "aria-hidden": "true" })
|
|
50
|
+
]
|
|
51
|
+
}
|
|
52
|
+
);
|
|
53
|
+
}
|
|
54
|
+
function Steps({
|
|
55
|
+
items = [],
|
|
56
|
+
current = 0,
|
|
57
|
+
initial = 0,
|
|
58
|
+
status: currentStatus = "process",
|
|
59
|
+
orientation = "horizontal",
|
|
60
|
+
type = "default",
|
|
61
|
+
size = "default",
|
|
62
|
+
titlePlacement = "horizontal",
|
|
63
|
+
onChange,
|
|
64
|
+
className
|
|
65
|
+
}) {
|
|
66
|
+
const base = initial;
|
|
67
|
+
const isVertical = orientation === "vertical";
|
|
68
|
+
const compact = size === "small";
|
|
69
|
+
return /* @__PURE__ */ jsx(
|
|
70
|
+
"ol",
|
|
71
|
+
{
|
|
72
|
+
className: cn(
|
|
73
|
+
"flex w-full",
|
|
74
|
+
isVertical ? "flex-col gap-0" : "flex-row items-start",
|
|
75
|
+
className
|
|
76
|
+
),
|
|
77
|
+
"aria-label": "Progress",
|
|
78
|
+
children: items.map((item, index) => {
|
|
79
|
+
const absoluteIndex = base + index;
|
|
80
|
+
const stepStatus = resolveStepStatus(absoluteIndex, current, item.status, currentStatus);
|
|
81
|
+
const clickable = Boolean(onChange) && !item.disabled;
|
|
82
|
+
const description = item.content ?? item.description;
|
|
83
|
+
return /* @__PURE__ */ jsx(
|
|
84
|
+
"li",
|
|
85
|
+
{
|
|
86
|
+
className: cn(
|
|
87
|
+
"relative flex min-w-0 flex-1",
|
|
88
|
+
isVertical ? "flex-row gap-3 pb-8 last:pb-0" : "flex-col items-center text-center",
|
|
89
|
+
!isVertical && index < items.length - 1 && "after:bg-border after:absolute after:top-4 after:h-px",
|
|
90
|
+
!isVertical && index < items.length - 1 && "after:left-[calc(50%+1.25rem)] after:w-[calc(100%-2.5rem)]"
|
|
91
|
+
),
|
|
92
|
+
children: /* @__PURE__ */ jsxs(
|
|
93
|
+
"button",
|
|
94
|
+
{
|
|
95
|
+
type: "button",
|
|
96
|
+
disabled: !clickable,
|
|
97
|
+
onClick: clickable ? () => onChange?.(absoluteIndex) : void 0,
|
|
98
|
+
className: cn(
|
|
99
|
+
"group flex min-w-0",
|
|
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
|
+
]
|
|
134
|
+
}
|
|
135
|
+
)
|
|
136
|
+
},
|
|
137
|
+
index
|
|
138
|
+
);
|
|
139
|
+
})
|
|
140
|
+
}
|
|
141
|
+
);
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
export { Steps };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|