@nice2dev/ui 1.0.5 → 1.0.8
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 +253 -207
- package/dist/NiceAPIFlow.doc-DnQLPUie.js +30 -0
- package/dist/NiceAPIFlow.doc-Dx4qw1lm.cjs +6 -0
- package/dist/NiceBranchManager.doc-BXjiENlD.cjs +6 -0
- package/dist/NiceBranchManager.doc-xLB82YwU.js +30 -0
- package/dist/NiceButton-B5RXLDwI.cjs +1 -0
- package/dist/NiceButton-CDiS45Ya.cjs +1 -0
- package/dist/NiceButton-D9l39Rs7.js +595 -0
- package/dist/NiceButton-DmTHNHet.js +450 -0
- package/dist/NiceCodeTemplate.doc-BWxTE4C_.cjs +6 -0
- package/dist/NiceCodeTemplate.doc-CA2U5F-v.js +30 -0
- package/dist/NiceDataBranchGraph.doc-CkitupWc.js +29 -0
- package/dist/NiceDataBranchGraph.doc-DDUgipqH.cjs +5 -0
- package/dist/NiceDataBranchManager.doc-B0ODKOs4.js +30 -0
- package/dist/NiceDataBranchManager.doc-CC5o8ihs.cjs +6 -0
- package/dist/NiceDataConflictResolver.doc-CdzScNie.cjs +5 -0
- package/dist/NiceDataConflictResolver.doc-V8vxYAeo.js +29 -0
- package/dist/NiceDataDiffViewer.doc-CR14Bq3A.cjs +6 -0
- package/dist/NiceDataDiffViewer.doc-w2I2QjhX.js +30 -0
- package/dist/NiceDataMapper.doc-C7jSyHRM.js +30 -0
- package/dist/NiceDataMapper.doc-DXjQHz87.cjs +6 -0
- package/dist/NiceDataMergeBuilder.doc-CV32WC_w.cjs +6 -0
- package/dist/NiceDataMergeBuilder.doc-DtuYb3nx.js +30 -0
- package/dist/NiceDataSnapshot.doc-CFLkY3ry.js +30 -0
- package/dist/NiceDataSnapshot.doc-CpZyQ17u.cjs +6 -0
- package/dist/NiceErrorBoundary-BAeqfoSc.cjs +1 -0
- package/dist/NiceErrorBoundary-D1hh5GGe.js +732 -0
- package/dist/NiceErrorBoundary-Dta4TGee.cjs +1 -0
- package/dist/NiceErrorBoundary-niMx1aSJ.js +837 -0
- package/dist/NiceEventOrchestrator.doc-C4SJfIDV.js +30 -0
- package/dist/NiceEventOrchestrator.doc-CxjsLxBG.cjs +6 -0
- package/dist/NiceGitBlame.doc-BG3_K9_0.cjs +6 -0
- package/dist/NiceGitBlame.doc-DrJABEat.js +30 -0
- package/dist/NiceGitConflictResolver.doc-BK7hAfz6.js +30 -0
- package/dist/NiceGitConflictResolver.doc-CgroGM9_.cjs +6 -0
- package/dist/NiceGitDiffViewer.doc-BAwgcY_3.cjs +6 -0
- package/dist/NiceGitDiffViewer.doc-BXKJeP-E.js +30 -0
- package/dist/NiceGitGraph.doc-B-WtGuzn.cjs +5 -0
- package/dist/NiceGitGraph.doc-DxnDPCgC.js +29 -0
- package/dist/NiceGitHooks.doc-BrEizvMp.js +29 -0
- package/dist/NiceGitHooks.doc-C4EdV5zj.cjs +5 -0
- package/dist/NiceMergeRequestBuilder.doc-C5p8mYuh.cjs +6 -0
- package/dist/NiceMergeRequestBuilder.doc-Ct9RCmU8.js +30 -0
- package/dist/NiceModuleLifecyclePanel-BapdidD6.js +4776 -0
- package/dist/NiceModuleLifecyclePanel-Brg1RLwi.cjs +1 -0
- package/dist/NiceModuleLifecyclePanel-CsFsm534.cjs +1 -0
- package/dist/NiceModuleLifecyclePanel-I_TXRiiY.js +5053 -0
- package/dist/NicePinCodeInput-4q8yULuo.js +13359 -0
- package/dist/NicePinCodeInput-CrMfdxxc.js +15287 -0
- package/dist/NicePinCodeInput-D0aF9MK8.cjs +692 -0
- package/dist/NicePinCodeInput-eD2q8nGa.cjs +692 -0
- package/dist/NicePinCodeInput.css +1 -0
- package/dist/NicePipelineEditor.doc-0eGt8zbX.cjs +5 -0
- package/dist/NicePipelineEditor.doc-DTmaOebn.js +29 -0
- package/dist/NicePipelineMonitor.doc-67CmsRcf.cjs +5 -0
- package/dist/NicePipelineMonitor.doc-mSMdhuG8.js +29 -0
- package/dist/NiceSavedQueryPanel-BZNvqSQW.cjs +596 -0
- package/dist/NiceSavedQueryPanel-CUAsdOjJ.js +6190 -0
- package/dist/NiceSavedQueryPanel-DUw8plYP.js +5666 -0
- package/dist/NiceSavedQueryPanel-xpk09zy1.cjs +596 -0
- package/dist/NiceSavedQueryPanel.css +1 -0
- package/dist/NiceStateDesigner.doc-B36u0hNU.js +29 -0
- package/dist/NiceStateDesigner.doc-MPmvNHSx.cjs +5 -0
- package/dist/NiceStockChart-CHlOnWzN.cjs +287 -0
- package/dist/NiceStockChart-Cpmv9_Cc.js +2341 -0
- package/dist/NiceStockChart.css +1 -0
- package/dist/NiceTestBuilder.doc-BFInj8GJ.js +30 -0
- package/dist/NiceTestBuilder.doc-CB03U_uR.cjs +6 -0
- package/dist/NiceToggle-C1UKGXmJ.js +209 -0
- package/dist/NiceToggle-CaY1u82g.js +277 -0
- package/dist/NiceToggle-DFJFQv_Z.cjs +1 -0
- package/dist/NiceToggle-lVi-ETi0.cjs +1 -0
- package/dist/NiceWindow-D1awkyFl.js +1636 -0
- package/dist/NiceWindow-IdHAcP70.cjs +1 -0
- package/dist/NiceWindow-SiCaREbq.js +1408 -0
- package/dist/NiceWindow-yARTUJsg.cjs +1 -0
- package/dist/charts-Bx_kNBsE.js +4280 -0
- package/dist/charts-DECVsCHX.cjs +754 -0
- package/dist/charts.cjs +1 -0
- package/dist/charts.css +1 -0
- package/dist/charts.d.ts +1043 -0
- package/dist/charts.mjs +23 -0
- package/dist/core-BZBTsGWN.cjs +96 -0
- package/dist/core-BpghV7Ls.js +17555 -0
- package/dist/core-CfXsl755.js +16305 -0
- package/dist/core-DGJSUW64.cjs +96 -0
- package/dist/data-branching-De4ExX-S.cjs +1 -0
- package/dist/data-branching-DiRfob1f.js +6071 -0
- package/dist/data-branching.cjs +1 -0
- package/dist/data-branching.d.ts +401 -0
- package/dist/data-branching.mjs +9 -0
- package/dist/data.cjs +1 -0
- package/dist/data.d.ts +2003 -0
- package/dist/data.mjs +21 -0
- package/dist/devops-BnYinjkT.cjs +17 -0
- package/dist/devops-Ckh57eti.js +7198 -0
- package/dist/devops.cjs +1 -0
- package/dist/devops.d.ts +758 -0
- package/dist/devops.mjs +12 -0
- package/dist/editors.cjs +1 -0
- package/dist/editors.d.ts +2728 -0
- package/dist/editors.mjs +66 -0
- package/dist/feedback.cjs +1 -0
- package/dist/feedback.d.ts +339 -0
- package/dist/feedback.mjs +16 -0
- package/dist/index-C853adw1.cjs +6199 -0
- package/dist/index-CBIZ6mTQ.cjs +5734 -0
- package/dist/index-CIl98Vbm.js +72951 -0
- package/dist/index-CNwVELPJ.js +62857 -0
- package/dist/index-CUx_-gKK.cjs +1 -0
- package/dist/index-x8mRM4Jc.js +17 -0
- package/dist/index.cjs +1 -7866
- package/dist/index.css +1 -0
- package/dist/index.d.ts +4888 -180
- package/dist/index.mjs +1021 -105889
- package/dist/lazy.cjs +1 -0
- package/dist/lazy.d.ts +1880 -0
- package/dist/lazy.mjs +98 -0
- package/dist/navigation.cjs +1 -0
- package/dist/navigation.d.ts +1862 -0
- package/dist/navigation.mjs +576 -0
- package/dist/no-code-BCuadkm4.cjs +332 -0
- package/dist/no-code-TL7PyulA.js +7005 -0
- package/dist/no-code.cjs +1 -0
- package/dist/no-code.d.ts +870 -0
- package/dist/no-code.mjs +13 -0
- package/dist/overlays.cjs +1 -0
- package/dist/overlays.d.ts +706 -0
- package/dist/overlays.mjs +482 -0
- package/package.json +51 -1
|
@@ -0,0 +1,4776 @@
|
|
|
1
|
+
import { jsxs as c, jsx as e, Fragment as Le } from "react/jsx-runtime";
|
|
2
|
+
import $e, { useState as R, useCallback as L, useId as Xe, useRef as he, useEffect as re, forwardRef as ne, useMemo as le, useContext as Ge, createContext as Je } from "react";
|
|
3
|
+
import { c as Se, d as ke, a as ce, g as Ze, u as ie, b as oe } from "./core-CfXsl755.js";
|
|
4
|
+
import { b as ae, a as Ce, N as Ye, c as Ie } from "./NiceButton-DmTHNHet.js";
|
|
5
|
+
import { a as Re, b as qe, N as en } from "./NiceToggle-C1UKGXmJ.js";
|
|
6
|
+
const ia = ({
|
|
7
|
+
tabs: n,
|
|
8
|
+
activeTab: a,
|
|
9
|
+
onChange: i,
|
|
10
|
+
variant: l = "default",
|
|
11
|
+
vertical: s,
|
|
12
|
+
size: h = "md",
|
|
13
|
+
className: o,
|
|
14
|
+
style: b,
|
|
15
|
+
displayStyle: r
|
|
16
|
+
}) => {
|
|
17
|
+
const t = Se("tab", r), u = ke("tab", r), [m, w] = R(a || n[0]?.id), d = a ?? m, g = L(
|
|
18
|
+
(M) => {
|
|
19
|
+
w(M), i?.(M);
|
|
20
|
+
},
|
|
21
|
+
[i]
|
|
22
|
+
), z = n.find((M) => M.id === d)?.content;
|
|
23
|
+
return /* @__PURE__ */ c(
|
|
24
|
+
"div",
|
|
25
|
+
{
|
|
26
|
+
className: `nice-tabs nice-tabs--${h} nice-tabs--ds-${u} ${o || ""}`,
|
|
27
|
+
style: { ...t, ...b, ...s ? { display: "flex", gap: 16 } : {} },
|
|
28
|
+
children: [
|
|
29
|
+
/* @__PURE__ */ e(
|
|
30
|
+
"div",
|
|
31
|
+
{
|
|
32
|
+
className: `nice-tabs__list ${l !== "default" ? `nice-tabs__list--${l}` : ""} ${s ? "nice-tabs__list--vertical" : ""}`,
|
|
33
|
+
role: "tablist",
|
|
34
|
+
children: n.map((M) => /* @__PURE__ */ c(
|
|
35
|
+
"button",
|
|
36
|
+
{
|
|
37
|
+
role: "tab",
|
|
38
|
+
"aria-selected": d === M.id,
|
|
39
|
+
className: `nice-tabs__tab ${d === M.id ? "nice-tabs__tab--active" : ""} ${M.disabled ? "nice-tabs__tab--disabled" : ""}`,
|
|
40
|
+
disabled: M.disabled,
|
|
41
|
+
onClick: () => g(M.id),
|
|
42
|
+
children: [
|
|
43
|
+
M.icon,
|
|
44
|
+
/* @__PURE__ */ e("span", { children: M.label }),
|
|
45
|
+
M.badge !== void 0 && /* @__PURE__ */ e("span", { className: "nice-tabs__badge", children: M.badge })
|
|
46
|
+
]
|
|
47
|
+
},
|
|
48
|
+
M.id
|
|
49
|
+
))
|
|
50
|
+
}
|
|
51
|
+
),
|
|
52
|
+
z && /* @__PURE__ */ e("div", { className: "nice-tabs__panel", role: "tabpanel", children: z })
|
|
53
|
+
]
|
|
54
|
+
}
|
|
55
|
+
);
|
|
56
|
+
}, ca = ({
|
|
57
|
+
items: n,
|
|
58
|
+
multiple: a = !1,
|
|
59
|
+
defaultOpen: i = [],
|
|
60
|
+
size: l = "md",
|
|
61
|
+
className: s,
|
|
62
|
+
style: h,
|
|
63
|
+
displayStyle: o
|
|
64
|
+
}) => {
|
|
65
|
+
ke("card", o);
|
|
66
|
+
const [b, r] = R(new Set(i)), t = Xe(), u = L(
|
|
67
|
+
(m) => {
|
|
68
|
+
r((w) => {
|
|
69
|
+
const d = new Set(w);
|
|
70
|
+
return d.has(m) ? d.delete(m) : (a || d.clear(), d.add(m)), d;
|
|
71
|
+
});
|
|
72
|
+
},
|
|
73
|
+
[a]
|
|
74
|
+
);
|
|
75
|
+
return /* @__PURE__ */ e("div", { className: `nice-accordion nice-accordion--${l} ${s || ""}`, style: h, children: n.map((m, w) => {
|
|
76
|
+
const d = b.has(m.id), g = `${t}-trigger-${w}`, z = `${t}-panel-${w}`;
|
|
77
|
+
return /* @__PURE__ */ c("div", { className: "nice-accordion__item", children: [
|
|
78
|
+
/* @__PURE__ */ c(
|
|
79
|
+
"button",
|
|
80
|
+
{
|
|
81
|
+
id: g,
|
|
82
|
+
className: "nice-accordion__trigger",
|
|
83
|
+
onClick: () => !m.disabled && u(m.id),
|
|
84
|
+
"aria-expanded": d,
|
|
85
|
+
"aria-controls": z,
|
|
86
|
+
"aria-disabled": m.disabled,
|
|
87
|
+
disabled: m.disabled,
|
|
88
|
+
children: [
|
|
89
|
+
/* @__PURE__ */ e("span", { children: m.title }),
|
|
90
|
+
/* @__PURE__ */ e(
|
|
91
|
+
"svg",
|
|
92
|
+
{
|
|
93
|
+
className: `nice-accordion__chevron ${d ? "nice-accordion__chevron--open" : ""}`,
|
|
94
|
+
viewBox: "0 0 20 20",
|
|
95
|
+
fill: "currentColor",
|
|
96
|
+
"aria-hidden": "true",
|
|
97
|
+
children: /* @__PURE__ */ e(
|
|
98
|
+
"path",
|
|
99
|
+
{
|
|
100
|
+
fillRule: "evenodd",
|
|
101
|
+
d: "M5.23 7.21a.75.75 0 011.06.02L10 11.168l3.71-3.938a.75.75 0 111.08 1.04l-4.25 4.5a.75.75 0 01-1.08 0l-4.25-4.5a.75.75 0 01.02-1.06z",
|
|
102
|
+
clipRule: "evenodd"
|
|
103
|
+
}
|
|
104
|
+
)
|
|
105
|
+
}
|
|
106
|
+
)
|
|
107
|
+
]
|
|
108
|
+
}
|
|
109
|
+
),
|
|
110
|
+
d && /* @__PURE__ */ e(
|
|
111
|
+
"div",
|
|
112
|
+
{
|
|
113
|
+
id: z,
|
|
114
|
+
className: "nice-accordion__content",
|
|
115
|
+
role: "region",
|
|
116
|
+
"aria-labelledby": g,
|
|
117
|
+
children: m.content
|
|
118
|
+
}
|
|
119
|
+
)
|
|
120
|
+
] }, m.id);
|
|
121
|
+
}) });
|
|
122
|
+
}, la = ({
|
|
123
|
+
items: n,
|
|
124
|
+
separator: a = "/",
|
|
125
|
+
size: i = "md",
|
|
126
|
+
className: l,
|
|
127
|
+
style: s
|
|
128
|
+
}) => /* @__PURE__ */ e(
|
|
129
|
+
"nav",
|
|
130
|
+
{
|
|
131
|
+
className: `nice-breadcrumb nice-breadcrumb--${i} ${l || ""}`,
|
|
132
|
+
style: s,
|
|
133
|
+
"aria-label": "Breadcrumb",
|
|
134
|
+
children: n.map((h, o) => /* @__PURE__ */ c($e.Fragment, { children: [
|
|
135
|
+
o > 0 && /* @__PURE__ */ e("span", { className: "nice-breadcrumb__separator", children: a }),
|
|
136
|
+
o === n.length - 1 ? /* @__PURE__ */ e("span", { className: "nice-breadcrumb__current", "aria-current": "page", children: h.label }) : /* @__PURE__ */ e("span", { className: "nice-breadcrumb__item", children: /* @__PURE__ */ e(
|
|
137
|
+
"a",
|
|
138
|
+
{
|
|
139
|
+
className: "nice-breadcrumb__link",
|
|
140
|
+
href: h.href,
|
|
141
|
+
onClick: (b) => {
|
|
142
|
+
h.onClick && (b.preventDefault(), h.onClick());
|
|
143
|
+
},
|
|
144
|
+
children: h.label
|
|
145
|
+
}
|
|
146
|
+
) })
|
|
147
|
+
] }, o))
|
|
148
|
+
}
|
|
149
|
+
);
|
|
150
|
+
function nn(n, a, i) {
|
|
151
|
+
const l = [], s = Math.max(2, n - i), h = Math.min(a - 1, n + i);
|
|
152
|
+
l.push(1), s > 2 && l.push("dots");
|
|
153
|
+
for (let o = s; o <= h; o++) l.push(o);
|
|
154
|
+
return h < a - 1 && l.push("dots"), a > 1 && l.push(a), l;
|
|
155
|
+
}
|
|
156
|
+
const ta = ({
|
|
157
|
+
page: n,
|
|
158
|
+
totalPages: a,
|
|
159
|
+
onChange: i,
|
|
160
|
+
showInfo: l,
|
|
161
|
+
siblingCount: s = 1,
|
|
162
|
+
size: h = "md",
|
|
163
|
+
className: o,
|
|
164
|
+
style: b
|
|
165
|
+
}) => {
|
|
166
|
+
const r = nn(n, a, s);
|
|
167
|
+
return /* @__PURE__ */ c(
|
|
168
|
+
"nav",
|
|
169
|
+
{
|
|
170
|
+
className: `nice-pagination nice-pagination--${h} ${o || ""}`,
|
|
171
|
+
style: b,
|
|
172
|
+
"aria-label": "Pagination",
|
|
173
|
+
children: [
|
|
174
|
+
/* @__PURE__ */ e(
|
|
175
|
+
"button",
|
|
176
|
+
{
|
|
177
|
+
className: "nice-pagination__btn",
|
|
178
|
+
disabled: n <= 1,
|
|
179
|
+
onClick: () => i(n - 1),
|
|
180
|
+
"aria-label": "Previous",
|
|
181
|
+
children: /* @__PURE__ */ e("svg", { width: "14", height: "14", viewBox: "0 0 20 20", fill: "currentColor", children: /* @__PURE__ */ e(
|
|
182
|
+
"path",
|
|
183
|
+
{
|
|
184
|
+
fillRule: "evenodd",
|
|
185
|
+
d: "M12.79 5.23a.75.75 0 01-.02 1.06L8.832 10l3.938 3.71a.75.75 0 11-1.04 1.08l-4.5-4.25a.75.75 0 010-1.08l4.5-4.25a.75.75 0 011.06.02z",
|
|
186
|
+
clipRule: "evenodd"
|
|
187
|
+
}
|
|
188
|
+
) })
|
|
189
|
+
}
|
|
190
|
+
),
|
|
191
|
+
r.map(
|
|
192
|
+
(t, u) => t === "dots" ? /* @__PURE__ */ e("span", { className: "nice-pagination__ellipsis", children: "…" }, `dots-${u}`) : /* @__PURE__ */ e(
|
|
193
|
+
"button",
|
|
194
|
+
{
|
|
195
|
+
className: `nice-pagination__btn ${t === n ? "nice-pagination__btn--active" : ""}`,
|
|
196
|
+
onClick: () => i(t),
|
|
197
|
+
"aria-current": t === n ? "page" : void 0,
|
|
198
|
+
children: t
|
|
199
|
+
},
|
|
200
|
+
t
|
|
201
|
+
)
|
|
202
|
+
),
|
|
203
|
+
/* @__PURE__ */ e(
|
|
204
|
+
"button",
|
|
205
|
+
{
|
|
206
|
+
className: "nice-pagination__btn",
|
|
207
|
+
disabled: n >= a,
|
|
208
|
+
onClick: () => i(n + 1),
|
|
209
|
+
"aria-label": "Next",
|
|
210
|
+
children: /* @__PURE__ */ e("svg", { width: "14", height: "14", viewBox: "0 0 20 20", fill: "currentColor", children: /* @__PURE__ */ e(
|
|
211
|
+
"path",
|
|
212
|
+
{
|
|
213
|
+
fillRule: "evenodd",
|
|
214
|
+
d: "M7.21 14.77a.75.75 0 01.02-1.06L11.168 10 7.23 6.29a.75.75 0 111.04-1.08l4.5 4.25a.75.75 0 010 1.08l-4.5 4.25a.75.75 0 01-1.06-.02z",
|
|
215
|
+
clipRule: "evenodd"
|
|
216
|
+
}
|
|
217
|
+
) })
|
|
218
|
+
}
|
|
219
|
+
),
|
|
220
|
+
l && /* @__PURE__ */ c("span", { className: "nice-pagination__info", children: [
|
|
221
|
+
n,
|
|
222
|
+
" / ",
|
|
223
|
+
a
|
|
224
|
+
] })
|
|
225
|
+
]
|
|
226
|
+
}
|
|
227
|
+
);
|
|
228
|
+
}, sa = ({
|
|
229
|
+
children: n,
|
|
230
|
+
title: a,
|
|
231
|
+
headerExtra: i,
|
|
232
|
+
footer: l,
|
|
233
|
+
hoverable: s,
|
|
234
|
+
onClick: h,
|
|
235
|
+
size: o = "md",
|
|
236
|
+
className: b,
|
|
237
|
+
style: r,
|
|
238
|
+
displayStyle: t
|
|
239
|
+
}) => {
|
|
240
|
+
const u = Se("card", t), m = ke("card", t);
|
|
241
|
+
return /* @__PURE__ */ c(
|
|
242
|
+
"div",
|
|
243
|
+
{
|
|
244
|
+
className: `nice-card nice-card--${o} nice-card--ds-${m} ${s ? "nice-card--hoverable" : ""} ${h ? "nice-card--clickable" : ""} ${b || ""}`,
|
|
245
|
+
style: { ...u, ...r },
|
|
246
|
+
onClick: h,
|
|
247
|
+
role: h ? "button" : void 0,
|
|
248
|
+
tabIndex: h ? 0 : void 0,
|
|
249
|
+
children: [
|
|
250
|
+
(a || i) && /* @__PURE__ */ c("div", { className: "nice-card__header", children: [
|
|
251
|
+
a && /* @__PURE__ */ e("h3", { className: "nice-card__title", children: a }),
|
|
252
|
+
i
|
|
253
|
+
] }),
|
|
254
|
+
/* @__PURE__ */ e("div", { className: "nice-card__body", children: n }),
|
|
255
|
+
l && /* @__PURE__ */ e("div", { className: "nice-card__footer", children: l })
|
|
256
|
+
]
|
|
257
|
+
}
|
|
258
|
+
);
|
|
259
|
+
}, an = ({
|
|
260
|
+
items: n,
|
|
261
|
+
orientation: a = "horizontal",
|
|
262
|
+
onItemClick: i,
|
|
263
|
+
size: l = "md",
|
|
264
|
+
className: s,
|
|
265
|
+
style: h,
|
|
266
|
+
accessMode: o,
|
|
267
|
+
id: b,
|
|
268
|
+
displayStyle: r
|
|
269
|
+
}) => {
|
|
270
|
+
if (Se("menu", r), ke("menu", r), ce(o, b) === "hidden") return null;
|
|
271
|
+
const [u, m] = R(null), [w, d] = R(-1), g = he(null), z = n.filter((f) => !f.disabled), M = L(
|
|
272
|
+
(f) => {
|
|
273
|
+
const $ = a === "horizontal", p = $ ? "ArrowLeft" : "ArrowUp", y = $ ? "ArrowRight" : "ArrowDown";
|
|
274
|
+
if (f.key === p)
|
|
275
|
+
f.preventDefault(), d((x) => x <= 0 ? z.length - 1 : x - 1);
|
|
276
|
+
else if (f.key === y)
|
|
277
|
+
f.preventDefault(), d((x) => x >= z.length - 1 ? 0 : x + 1);
|
|
278
|
+
else if (f.key === "Enter" || f.key === " ") {
|
|
279
|
+
f.preventDefault();
|
|
280
|
+
const x = z[w];
|
|
281
|
+
x && (x.items?.length ? m(u === x.key ? null : x.key) : (x.onClick?.(), i?.(x)));
|
|
282
|
+
} else f.key === "Escape" && m(null);
|
|
283
|
+
},
|
|
284
|
+
[a, z, w, u, i]
|
|
285
|
+
), T = (f, $) => {
|
|
286
|
+
const p = f.items && f.items.length > 0, y = u === f.key, x = z[w]?.key === f.key;
|
|
287
|
+
return /* @__PURE__ */ c(
|
|
288
|
+
"li",
|
|
289
|
+
{
|
|
290
|
+
className: `nice-menu__item ${f.disabled ? "nice-menu__item--disabled" : ""} ${p ? "nice-menu__item--has-children" : ""} ${x ? "nice-menu__item--focused" : ""}`,
|
|
291
|
+
onMouseEnter: () => p && m(f.key),
|
|
292
|
+
onMouseLeave: () => p && m(null),
|
|
293
|
+
role: "none",
|
|
294
|
+
children: [
|
|
295
|
+
/* @__PURE__ */ c(
|
|
296
|
+
"button",
|
|
297
|
+
{
|
|
298
|
+
type: "button",
|
|
299
|
+
className: "nice-menu__link",
|
|
300
|
+
disabled: f.disabled,
|
|
301
|
+
tabIndex: x ? 0 : -1,
|
|
302
|
+
role: "menuitem",
|
|
303
|
+
"aria-haspopup": p || void 0,
|
|
304
|
+
"aria-expanded": p ? y : void 0,
|
|
305
|
+
onClick: () => {
|
|
306
|
+
f.disabled || (f.onClick?.(), i?.(f));
|
|
307
|
+
},
|
|
308
|
+
children: [
|
|
309
|
+
f.icon && /* @__PURE__ */ e("span", { className: "nice-menu__icon", children: f.icon }),
|
|
310
|
+
/* @__PURE__ */ e("span", { children: f.text }),
|
|
311
|
+
p && /* @__PURE__ */ e("span", { className: "nice-menu__arrow", children: "▸" })
|
|
312
|
+
]
|
|
313
|
+
}
|
|
314
|
+
),
|
|
315
|
+
p && y && /* @__PURE__ */ e("ul", { className: "nice-menu__submenu", role: "menu", children: f.items.map((C, A) => T(C)) })
|
|
316
|
+
]
|
|
317
|
+
},
|
|
318
|
+
f.key
|
|
319
|
+
);
|
|
320
|
+
};
|
|
321
|
+
return /* @__PURE__ */ e(
|
|
322
|
+
"nav",
|
|
323
|
+
{
|
|
324
|
+
className: `nice-menu nice-menu--${a} nice-menu--${l} ${s || ""}`,
|
|
325
|
+
style: h,
|
|
326
|
+
children: /* @__PURE__ */ e(
|
|
327
|
+
"ul",
|
|
328
|
+
{
|
|
329
|
+
ref: g,
|
|
330
|
+
className: "nice-menu__list",
|
|
331
|
+
role: "menubar",
|
|
332
|
+
tabIndex: 0,
|
|
333
|
+
onKeyDown: M,
|
|
334
|
+
onFocus: () => w < 0 && d(0),
|
|
335
|
+
children: n.map((f, $) => T(f))
|
|
336
|
+
}
|
|
337
|
+
)
|
|
338
|
+
}
|
|
339
|
+
);
|
|
340
|
+
};
|
|
341
|
+
an.displayName = "NiceMenu";
|
|
342
|
+
const ra = ({
|
|
343
|
+
items: n,
|
|
344
|
+
target: a,
|
|
345
|
+
onItemClick: i,
|
|
346
|
+
size: l = "md",
|
|
347
|
+
className: s,
|
|
348
|
+
style: h
|
|
349
|
+
}) => {
|
|
350
|
+
const [o, b] = R(null), r = he(null);
|
|
351
|
+
return Ze(r, () => b(null)), re(() => {
|
|
352
|
+
const t = a.current;
|
|
353
|
+
if (!t) return;
|
|
354
|
+
const u = (m) => {
|
|
355
|
+
m.preventDefault(), b({ x: m.clientX, y: m.clientY });
|
|
356
|
+
};
|
|
357
|
+
return t.addEventListener("contextmenu", u), () => t.removeEventListener("contextmenu", u);
|
|
358
|
+
}, [a]), o ? /* @__PURE__ */ e(
|
|
359
|
+
"div",
|
|
360
|
+
{
|
|
361
|
+
ref: r,
|
|
362
|
+
className: `nice-contextmenu nice-contextmenu--${l} ${s || ""}`,
|
|
363
|
+
style: { position: "fixed", left: o.x, top: o.y, zIndex: 1e4, ...h },
|
|
364
|
+
children: /* @__PURE__ */ e("ul", { className: "nice-contextmenu__list", role: "menu", children: n.map((t) => /* @__PURE__ */ e(
|
|
365
|
+
"li",
|
|
366
|
+
{
|
|
367
|
+
className: `nice-contextmenu__item ${t.disabled ? "nice-contextmenu__item--disabled" : ""}`,
|
|
368
|
+
role: "none",
|
|
369
|
+
children: /* @__PURE__ */ c(
|
|
370
|
+
"button",
|
|
371
|
+
{
|
|
372
|
+
type: "button",
|
|
373
|
+
className: "nice-contextmenu__btn",
|
|
374
|
+
disabled: t.disabled,
|
|
375
|
+
"aria-disabled": t.disabled,
|
|
376
|
+
role: "menuitem",
|
|
377
|
+
onClick: () => {
|
|
378
|
+
t.onClick?.(), i?.(t), b(null);
|
|
379
|
+
},
|
|
380
|
+
children: [
|
|
381
|
+
t.icon && /* @__PURE__ */ e("span", { className: "nice-contextmenu__icon", "aria-hidden": "true", children: t.icon }),
|
|
382
|
+
/* @__PURE__ */ e("span", { children: t.text })
|
|
383
|
+
]
|
|
384
|
+
}
|
|
385
|
+
)
|
|
386
|
+
},
|
|
387
|
+
t.key
|
|
388
|
+
)) })
|
|
389
|
+
}
|
|
390
|
+
) : null;
|
|
391
|
+
}, oa = ({
|
|
392
|
+
items: n,
|
|
393
|
+
selectedIndex: a,
|
|
394
|
+
onSelectedIndexChange: i,
|
|
395
|
+
animationEnabled: l = !0,
|
|
396
|
+
size: s = "md",
|
|
397
|
+
className: h,
|
|
398
|
+
style: o,
|
|
399
|
+
accessMode: b,
|
|
400
|
+
id: r
|
|
401
|
+
}) => {
|
|
402
|
+
if (ce(b, r) === "hidden") return null;
|
|
403
|
+
const [u, m] = R(0), d = n[a ?? u];
|
|
404
|
+
return d ? /* @__PURE__ */ e(
|
|
405
|
+
"div",
|
|
406
|
+
{
|
|
407
|
+
className: `nice-multiview nice-multiview--${s} ${l ? "nice-multiview--animated" : ""} ${h || ""}`,
|
|
408
|
+
style: o,
|
|
409
|
+
children: /* @__PURE__ */ e("div", { className: "nice-multiview__content", children: d.render() }, d.key)
|
|
410
|
+
}
|
|
411
|
+
) : null;
|
|
412
|
+
}, da = ({
|
|
413
|
+
items: n,
|
|
414
|
+
selectedKey: a,
|
|
415
|
+
onSelectedKeyChange: i,
|
|
416
|
+
tabPosition: l = "top",
|
|
417
|
+
size: s = "md",
|
|
418
|
+
className: h,
|
|
419
|
+
style: o,
|
|
420
|
+
displayStyle: b
|
|
421
|
+
}) => {
|
|
422
|
+
ke("tab", b);
|
|
423
|
+
const [r, t] = R(n[0]?.key ?? ""), u = a ?? r, m = (z) => {
|
|
424
|
+
i ? i(z) : t(z);
|
|
425
|
+
}, w = n.find((z) => z.key === u), d = l === "left" || l === "right", g = /* @__PURE__ */ e(
|
|
426
|
+
"div",
|
|
427
|
+
{
|
|
428
|
+
className: "nice-tabpanel__tabs",
|
|
429
|
+
role: "tablist",
|
|
430
|
+
style: { display: "flex", flexDirection: d ? "column" : "row" },
|
|
431
|
+
children: n.map((z) => /* @__PURE__ */ c(
|
|
432
|
+
"button",
|
|
433
|
+
{
|
|
434
|
+
type: "button",
|
|
435
|
+
role: "tab",
|
|
436
|
+
className: `nice-tabpanel__tab ${z.key === u ? "nice-tabpanel__tab--active" : ""}`,
|
|
437
|
+
disabled: z.disabled,
|
|
438
|
+
onClick: () => !z.disabled && m(z.key),
|
|
439
|
+
"aria-selected": z.key === u,
|
|
440
|
+
children: [
|
|
441
|
+
z.icon && /* @__PURE__ */ e("span", { className: "nice-tabpanel__tab-icon", children: z.icon }),
|
|
442
|
+
/* @__PURE__ */ e("span", { children: z.title }),
|
|
443
|
+
z.badge && /* @__PURE__ */ e("span", { className: "nice-tabpanel__tab-badge", children: z.badge })
|
|
444
|
+
]
|
|
445
|
+
},
|
|
446
|
+
z.key
|
|
447
|
+
))
|
|
448
|
+
}
|
|
449
|
+
);
|
|
450
|
+
return /* @__PURE__ */ c(
|
|
451
|
+
"div",
|
|
452
|
+
{
|
|
453
|
+
className: `nice-tabpanel nice-tabpanel--${l} ${h || ""}`,
|
|
454
|
+
style: { display: "flex", flexDirection: d ? "row" : "column", ...o },
|
|
455
|
+
children: [
|
|
456
|
+
(l === "top" || l === "left") && g,
|
|
457
|
+
/* @__PURE__ */ e("div", { className: "nice-tabpanel__content", role: "tabpanel", children: w?.render() }),
|
|
458
|
+
(l === "bottom" || l === "right") && g
|
|
459
|
+
]
|
|
460
|
+
}
|
|
461
|
+
);
|
|
462
|
+
}, ua = ({
|
|
463
|
+
panes: n,
|
|
464
|
+
orientation: a = "horizontal",
|
|
465
|
+
gutterSize: i = 6,
|
|
466
|
+
onResize: l,
|
|
467
|
+
className: s,
|
|
468
|
+
style: h,
|
|
469
|
+
accessMode: o,
|
|
470
|
+
id: b
|
|
471
|
+
}) => {
|
|
472
|
+
if (ce(o, b) === "hidden") return null;
|
|
473
|
+
const t = he(null), [u, m] = R(
|
|
474
|
+
() => n.map(() => 100 / n.length)
|
|
475
|
+
), w = L((g, z) => {
|
|
476
|
+
z.preventDefault();
|
|
477
|
+
const M = t.current;
|
|
478
|
+
if (!M) return;
|
|
479
|
+
const T = a === "horizontal", f = T ? M.offsetWidth : M.offsetHeight, $ = T ? z.clientX : z.clientY, p = [...u], y = (C) => {
|
|
480
|
+
const A = ((T ? C.clientX : C.clientY) - $) / f * 100, S = [...p], k = n[g].minSize ? n[g].minSize / f * 100 : 5, N = n[g + 1].minSize ? n[g + 1].minSize / f * 100 : 5;
|
|
481
|
+
let D = p[g] + A, _ = p[g + 1] - A;
|
|
482
|
+
D < k && (D = k, _ = p[g] + p[g + 1] - k), _ < N && (_ = N, D = p[g] + p[g + 1] - N), S[g] = D, S[g + 1] = _, m(S), l?.(S);
|
|
483
|
+
}, x = () => {
|
|
484
|
+
document.removeEventListener("pointermove", y), document.removeEventListener("pointerup", x);
|
|
485
|
+
};
|
|
486
|
+
document.addEventListener("pointermove", y), document.addEventListener("pointerup", x);
|
|
487
|
+
}, [u, a, n, l]), d = a === "horizontal";
|
|
488
|
+
return /* @__PURE__ */ e(
|
|
489
|
+
"div",
|
|
490
|
+
{
|
|
491
|
+
ref: t,
|
|
492
|
+
className: `nice-splitter nice-splitter--${a} ${s || ""}`,
|
|
493
|
+
style: { display: "flex", flexDirection: d ? "row" : "column", height: "100%", ...h },
|
|
494
|
+
children: n.map((g, z) => /* @__PURE__ */ c($e.Fragment, { children: [
|
|
495
|
+
/* @__PURE__ */ e(
|
|
496
|
+
"div",
|
|
497
|
+
{
|
|
498
|
+
className: "nice-splitter__pane",
|
|
499
|
+
style: { [d ? "width" : "height"]: `calc(${u[z]}% - ${i * (n.length - 1) / n.length}px)`, overflow: "auto" },
|
|
500
|
+
children: g.render()
|
|
501
|
+
}
|
|
502
|
+
),
|
|
503
|
+
z < n.length - 1 && /* @__PURE__ */ e(
|
|
504
|
+
"div",
|
|
505
|
+
{
|
|
506
|
+
className: `nice-splitter__gutter nice-splitter__gutter--${a}`,
|
|
507
|
+
style: { [d ? "width" : "height"]: i, cursor: d ? "col-resize" : "row-resize", flexShrink: 0 },
|
|
508
|
+
onPointerDown: (M) => w(z, M)
|
|
509
|
+
}
|
|
510
|
+
)
|
|
511
|
+
] }, g.key))
|
|
512
|
+
}
|
|
513
|
+
);
|
|
514
|
+
}, _a = ({
|
|
515
|
+
items: n,
|
|
516
|
+
size: a = "md",
|
|
517
|
+
className: i,
|
|
518
|
+
style: l,
|
|
519
|
+
accessMode: s,
|
|
520
|
+
id: h
|
|
521
|
+
}) => {
|
|
522
|
+
if (ce(s, h) === "hidden") return null;
|
|
523
|
+
const b = n.filter((m) => !m.location || m.location === "before"), r = n.filter((m) => m.location === "center"), t = n.filter((m) => m.location === "after"), u = (m) => m.widget === "separator" ? /* @__PURE__ */ e("div", { className: "nice-toolbar__separator" }, m.key) : m.widget === "spacer" ? /* @__PURE__ */ e("div", { className: "nice-toolbar__spacer", style: { flex: 1 } }, m.key) : m.render ? /* @__PURE__ */ e("div", { className: "nice-toolbar__custom", children: m.render() }, m.key) : /* @__PURE__ */ c(
|
|
524
|
+
"button",
|
|
525
|
+
{
|
|
526
|
+
type: "button",
|
|
527
|
+
className: `nice-toolbar__btn nice-btn nice-btn--ghost nice-btn--${a}`,
|
|
528
|
+
disabled: m.disabled,
|
|
529
|
+
onClick: m.onClick,
|
|
530
|
+
children: [
|
|
531
|
+
m.icon && /* @__PURE__ */ e("span", { className: "nice-toolbar__icon", children: m.icon }),
|
|
532
|
+
m.text && /* @__PURE__ */ e("span", { children: m.text })
|
|
533
|
+
]
|
|
534
|
+
},
|
|
535
|
+
m.key
|
|
536
|
+
);
|
|
537
|
+
return /* @__PURE__ */ c("div", { className: `nice-toolbar ${i || ""}`, style: { display: "flex", alignItems: "center", gap: 4, ...l }, children: [
|
|
538
|
+
/* @__PURE__ */ e("div", { className: "nice-toolbar__section nice-toolbar__section--before", style: { display: "flex", alignItems: "center", gap: 4 }, children: b.map(u) }),
|
|
539
|
+
r.length > 0 && /* @__PURE__ */ e("div", { className: "nice-toolbar__section nice-toolbar__section--center", style: { display: "flex", alignItems: "center", gap: 4, flex: 1, justifyContent: "center" }, children: r.map(u) }),
|
|
540
|
+
/* @__PURE__ */ e("div", { className: "nice-toolbar__section nice-toolbar__section--after", style: { display: "flex", alignItems: "center", gap: 4, marginLeft: r.length === 0 ? "auto" : void 0 }, children: t.map(u) })
|
|
541
|
+
] });
|
|
542
|
+
}, cn = ne(({
|
|
543
|
+
panels: n,
|
|
544
|
+
columns: a = 12,
|
|
545
|
+
rowHeight: i = 80,
|
|
546
|
+
gap: l = 8,
|
|
547
|
+
draggable: s = !0,
|
|
548
|
+
resizable: h = !0,
|
|
549
|
+
onLayoutChange: o,
|
|
550
|
+
className: b,
|
|
551
|
+
style: r,
|
|
552
|
+
id: t
|
|
553
|
+
}, u) => {
|
|
554
|
+
const m = ie(t), [w, d] = R(null), g = he(null), z = L((y, x) => {
|
|
555
|
+
s && (d(x), y.dataTransfer.effectAllowed = "move");
|
|
556
|
+
}, [s]), M = L((y, x) => {
|
|
557
|
+
if (y.preventDefault(), !w || w === x) return;
|
|
558
|
+
const C = n.find((k) => k.key === w), A = n.find((k) => k.key === x);
|
|
559
|
+
if (!C || !A) return;
|
|
560
|
+
const S = n.map((k) => k.key === w ? { ...k, col: A.col, row: A.row } : k.key === x ? { ...k, col: C.col, row: C.row } : k);
|
|
561
|
+
o?.(S), d(null);
|
|
562
|
+
}, [w, n, o]), T = L((y) => {
|
|
563
|
+
y.preventDefault();
|
|
564
|
+
}, []), f = he(null);
|
|
565
|
+
re(() => {
|
|
566
|
+
if (!h) return;
|
|
567
|
+
const y = (C) => {
|
|
568
|
+
if (!f.current || !g.current) return;
|
|
569
|
+
const { key: A, startX: S, startY: k, cs: N, rs: D } = f.current, _ = C.clientX - S, Y = C.clientY - k, K = g.current.clientWidth / a, Q = Math.max(1, N + Math.round(_ / K)), W = Math.max(1, D + Math.round(Y / i)), V = n.map((j) => j.key === A ? { ...j, colSpan: Q, rowSpan: W } : j);
|
|
570
|
+
o?.(V);
|
|
571
|
+
}, x = () => {
|
|
572
|
+
f.current = null;
|
|
573
|
+
};
|
|
574
|
+
return document.addEventListener("mousemove", y), document.addEventListener("mouseup", x), () => {
|
|
575
|
+
document.removeEventListener("mousemove", y), document.removeEventListener("mouseup", x);
|
|
576
|
+
};
|
|
577
|
+
}, [h, n, a, i, o]);
|
|
578
|
+
const $ = L((y, x, C, A) => {
|
|
579
|
+
y.stopPropagation(), f.current = { key: x, startX: y.clientX, startY: y.clientY, cs: C, rs: A };
|
|
580
|
+
}, []), p = Math.max(...n.map((y) => y.row + (y.rowSpan ?? 1)), 1);
|
|
581
|
+
return /* @__PURE__ */ e(
|
|
582
|
+
"div",
|
|
583
|
+
{
|
|
584
|
+
ref: u,
|
|
585
|
+
id: m,
|
|
586
|
+
className: `nice-dashboard ${b || ""}`,
|
|
587
|
+
style: r,
|
|
588
|
+
children: /* @__PURE__ */ e(
|
|
589
|
+
"div",
|
|
590
|
+
{
|
|
591
|
+
ref: g,
|
|
592
|
+
className: "nice-dashboard__grid",
|
|
593
|
+
style: {
|
|
594
|
+
display: "grid",
|
|
595
|
+
gridTemplateColumns: `repeat(${a}, 1fr)`,
|
|
596
|
+
gridTemplateRows: `repeat(${p}, ${i}px)`,
|
|
597
|
+
gap: l
|
|
598
|
+
},
|
|
599
|
+
children: n.map((y) => /* @__PURE__ */ c(
|
|
600
|
+
"div",
|
|
601
|
+
{
|
|
602
|
+
className: `nice-dashboard__panel${w === y.key ? " nice-dashboard__panel--dragging" : ""}`,
|
|
603
|
+
style: {
|
|
604
|
+
gridColumn: `${y.col + 1} / span ${y.colSpan ?? 1}`,
|
|
605
|
+
gridRow: `${y.row + 1} / span ${y.rowSpan ?? 1}`
|
|
606
|
+
},
|
|
607
|
+
draggable: s,
|
|
608
|
+
onDragStart: (x) => z(x, y.key),
|
|
609
|
+
onDragOver: T,
|
|
610
|
+
onDrop: (x) => M(x, y.key),
|
|
611
|
+
children: [
|
|
612
|
+
/* @__PURE__ */ e("div", { className: "nice-dashboard__panel-content", children: y.render() }),
|
|
613
|
+
h && /* @__PURE__ */ e(
|
|
614
|
+
"div",
|
|
615
|
+
{
|
|
616
|
+
className: "nice-dashboard__resize-handle",
|
|
617
|
+
onMouseDown: (x) => $(x, y.key, y.colSpan ?? 1, y.rowSpan ?? 1)
|
|
618
|
+
}
|
|
619
|
+
)
|
|
620
|
+
]
|
|
621
|
+
},
|
|
622
|
+
y.key
|
|
623
|
+
))
|
|
624
|
+
}
|
|
625
|
+
)
|
|
626
|
+
}
|
|
627
|
+
);
|
|
628
|
+
});
|
|
629
|
+
cn.displayName = "NiceDashboardLayout";
|
|
630
|
+
const ln = ne(({
|
|
631
|
+
header: n,
|
|
632
|
+
sidebar: a,
|
|
633
|
+
sidebarWidth: i = 260,
|
|
634
|
+
sidebarCollapsed: l,
|
|
635
|
+
onToggleSidebar: s,
|
|
636
|
+
children: h,
|
|
637
|
+
footer: o,
|
|
638
|
+
className: b,
|
|
639
|
+
style: r,
|
|
640
|
+
id: t
|
|
641
|
+
}, u) => {
|
|
642
|
+
const m = ie(t), [w, d] = R(!1), g = l ?? w, z = L(() => {
|
|
643
|
+
const M = !g;
|
|
644
|
+
d(M), s?.(M);
|
|
645
|
+
}, [g, s]);
|
|
646
|
+
return /* @__PURE__ */ c(
|
|
647
|
+
"div",
|
|
648
|
+
{
|
|
649
|
+
ref: u,
|
|
650
|
+
id: m,
|
|
651
|
+
className: `nice-app-layout${g ? " nice-app-layout--collapsed" : ""} ${b || ""}`,
|
|
652
|
+
style: r,
|
|
653
|
+
children: [
|
|
654
|
+
n && /* @__PURE__ */ e("header", { className: "nice-app-layout__header", children: n }),
|
|
655
|
+
/* @__PURE__ */ c("div", { className: "nice-app-layout__body", children: [
|
|
656
|
+
a && /* @__PURE__ */ e(
|
|
657
|
+
"aside",
|
|
658
|
+
{
|
|
659
|
+
className: "nice-app-layout__sidebar",
|
|
660
|
+
style: { width: g ? 0 : i, overflow: "hidden", transition: "width 0.2s" },
|
|
661
|
+
children: !g && a
|
|
662
|
+
}
|
|
663
|
+
),
|
|
664
|
+
a && /* @__PURE__ */ e(
|
|
665
|
+
"button",
|
|
666
|
+
{
|
|
667
|
+
type: "button",
|
|
668
|
+
className: "nice-app-layout__sidebar-toggle",
|
|
669
|
+
onClick: z,
|
|
670
|
+
"aria-label": g ? "Open sidebar" : "Close sidebar",
|
|
671
|
+
children: g ? "☰" : "✕"
|
|
672
|
+
}
|
|
673
|
+
),
|
|
674
|
+
/* @__PURE__ */ e("main", { className: "nice-app-layout__content", children: h })
|
|
675
|
+
] }),
|
|
676
|
+
o && /* @__PURE__ */ e("footer", { className: "nice-app-layout__footer", children: o })
|
|
677
|
+
]
|
|
678
|
+
}
|
|
679
|
+
);
|
|
680
|
+
});
|
|
681
|
+
ln.displayName = "NiceAppLayout";
|
|
682
|
+
const tn = ne(({
|
|
683
|
+
items: n,
|
|
684
|
+
activeKey: a,
|
|
685
|
+
onChange: i,
|
|
686
|
+
size: l = "md",
|
|
687
|
+
showLabels: s = !0,
|
|
688
|
+
className: h,
|
|
689
|
+
style: o,
|
|
690
|
+
id: b
|
|
691
|
+
}, r) => {
|
|
692
|
+
const t = ie(b);
|
|
693
|
+
return /* @__PURE__ */ e(
|
|
694
|
+
"nav",
|
|
695
|
+
{
|
|
696
|
+
ref: r,
|
|
697
|
+
id: t,
|
|
698
|
+
className: `nice-bottom-nav nice-bottom-nav--${l} ${h || ""}`,
|
|
699
|
+
style: o,
|
|
700
|
+
role: "navigation",
|
|
701
|
+
children: n.map((u) => /* @__PURE__ */ c(
|
|
702
|
+
"button",
|
|
703
|
+
{
|
|
704
|
+
type: "button",
|
|
705
|
+
className: `nice-bottom-nav__item${a === u.key ? " nice-bottom-nav__item--active" : ""}${u.disabled ? " nice-bottom-nav__item--disabled" : ""}`,
|
|
706
|
+
onClick: () => !u.disabled && i?.(u.key),
|
|
707
|
+
disabled: u.disabled,
|
|
708
|
+
"aria-current": a === u.key ? "page" : void 0,
|
|
709
|
+
children: [
|
|
710
|
+
u.icon && /* @__PURE__ */ e("span", { className: "nice-bottom-nav__icon", children: u.icon }),
|
|
711
|
+
s && /* @__PURE__ */ e("span", { className: "nice-bottom-nav__label", children: u.label })
|
|
712
|
+
]
|
|
713
|
+
},
|
|
714
|
+
u.key
|
|
715
|
+
))
|
|
716
|
+
}
|
|
717
|
+
);
|
|
718
|
+
});
|
|
719
|
+
tn.displayName = "NiceBottomNavigation";
|
|
720
|
+
const sn = ne(({
|
|
721
|
+
items: n,
|
|
722
|
+
size: a = "md",
|
|
723
|
+
className: i,
|
|
724
|
+
style: l,
|
|
725
|
+
id: s
|
|
726
|
+
}, h) => {
|
|
727
|
+
const o = ie(s), [b, r] = R(null), t = he(null);
|
|
728
|
+
re(() => {
|
|
729
|
+
if (!b) return;
|
|
730
|
+
const m = (w) => {
|
|
731
|
+
t.current && !t.current.contains(w.target) && r(null);
|
|
732
|
+
};
|
|
733
|
+
return document.addEventListener("mousedown", m), () => document.removeEventListener("mousedown", m);
|
|
734
|
+
}, [b]);
|
|
735
|
+
const u = n.find((m) => m.key === b);
|
|
736
|
+
return /* @__PURE__ */ c(
|
|
737
|
+
"div",
|
|
738
|
+
{
|
|
739
|
+
ref: h,
|
|
740
|
+
id: o,
|
|
741
|
+
className: `nice-mega-menu nice-mega-menu--${a} ${i || ""}`,
|
|
742
|
+
style: l,
|
|
743
|
+
children: [
|
|
744
|
+
/* @__PURE__ */ e("div", { ref: t, className: "nice-mega-menu__bar", role: "menubar", children: n.map((m) => /* @__PURE__ */ e(
|
|
745
|
+
"button",
|
|
746
|
+
{
|
|
747
|
+
type: "button",
|
|
748
|
+
className: `nice-mega-menu__trigger${b === m.key ? " nice-mega-menu__trigger--active" : ""}`,
|
|
749
|
+
onMouseEnter: () => r(m.key),
|
|
750
|
+
onClick: () => r(b === m.key ? null : m.key),
|
|
751
|
+
"aria-haspopup": "true",
|
|
752
|
+
"aria-expanded": b === m.key,
|
|
753
|
+
children: m.label
|
|
754
|
+
},
|
|
755
|
+
m.key
|
|
756
|
+
)) }),
|
|
757
|
+
u && /* @__PURE__ */ e(
|
|
758
|
+
"div",
|
|
759
|
+
{
|
|
760
|
+
className: "nice-mega-menu__dropdown",
|
|
761
|
+
onMouseLeave: () => r(null),
|
|
762
|
+
children: u.renderPanel ? u.renderPanel() : /* @__PURE__ */ e("div", { className: "nice-mega-menu__columns", children: u.columns.map((m, w) => /* @__PURE__ */ c("div", { className: "nice-mega-menu__column", children: [
|
|
763
|
+
m.header && /* @__PURE__ */ e("div", { className: "nice-mega-menu__column-header", children: m.header }),
|
|
764
|
+
/* @__PURE__ */ e("ul", { className: "nice-mega-menu__list", role: "menu", children: m.items.map((d) => /* @__PURE__ */ e(
|
|
765
|
+
"li",
|
|
766
|
+
{
|
|
767
|
+
className: `nice-mega-menu__item${d.disabled ? " nice-mega-menu__item--disabled" : ""}`,
|
|
768
|
+
role: "menuitem",
|
|
769
|
+
children: d.href ? /* @__PURE__ */ c("a", { href: d.href, className: "nice-mega-menu__link", children: [
|
|
770
|
+
d.icon && /* @__PURE__ */ e("span", { className: "nice-mega-menu__icon", children: d.icon }),
|
|
771
|
+
d.label
|
|
772
|
+
] }) : /* @__PURE__ */ c(
|
|
773
|
+
"button",
|
|
774
|
+
{
|
|
775
|
+
type: "button",
|
|
776
|
+
className: "nice-mega-menu__link",
|
|
777
|
+
disabled: d.disabled,
|
|
778
|
+
onClick: () => {
|
|
779
|
+
d.onClick?.(), r(null);
|
|
780
|
+
},
|
|
781
|
+
children: [
|
|
782
|
+
d.icon && /* @__PURE__ */ e("span", { className: "nice-mega-menu__icon", children: d.icon }),
|
|
783
|
+
d.label
|
|
784
|
+
]
|
|
785
|
+
}
|
|
786
|
+
)
|
|
787
|
+
},
|
|
788
|
+
d.key
|
|
789
|
+
)) })
|
|
790
|
+
] }, w)) })
|
|
791
|
+
}
|
|
792
|
+
)
|
|
793
|
+
]
|
|
794
|
+
}
|
|
795
|
+
);
|
|
796
|
+
});
|
|
797
|
+
sn.displayName = "NiceMegaMenu";
|
|
798
|
+
const rn = ne(
|
|
799
|
+
({
|
|
800
|
+
items: n,
|
|
801
|
+
position: a = "bottom",
|
|
802
|
+
size: i = "md",
|
|
803
|
+
magnify: l = !0,
|
|
804
|
+
magnifyScale: s = 1.5,
|
|
805
|
+
activeKey: h,
|
|
806
|
+
onItemClick: o,
|
|
807
|
+
className: b,
|
|
808
|
+
style: r,
|
|
809
|
+
id: t,
|
|
810
|
+
...u
|
|
811
|
+
}, m) => {
|
|
812
|
+
const w = ie(t), { t: d } = oe(), [g, z] = R(null), M = L(
|
|
813
|
+
(f) => {
|
|
814
|
+
if (!l || g === null) return 1;
|
|
815
|
+
const $ = Math.abs(f - g);
|
|
816
|
+
return $ === 0 ? s : $ === 1 ? 1 + (s - 1) * 0.5 : $ === 2 ? 1 + (s - 1) * 0.2 : 1;
|
|
817
|
+
},
|
|
818
|
+
[l, g, s]
|
|
819
|
+
), T = a === "left" || a === "right";
|
|
820
|
+
return /* @__PURE__ */ e(
|
|
821
|
+
"div",
|
|
822
|
+
{
|
|
823
|
+
ref: m,
|
|
824
|
+
id: w,
|
|
825
|
+
className: `nice-dock nice-dock--${a} nice-dock--${i} ${b ?? ""}`,
|
|
826
|
+
style: r,
|
|
827
|
+
role: "toolbar",
|
|
828
|
+
"aria-label": d("dock.label", "Dock"),
|
|
829
|
+
...u,
|
|
830
|
+
children: /* @__PURE__ */ e("div", { className: "nice-dock__bar", style: { flexDirection: T ? "column" : "row" }, children: n.map((f, $) => {
|
|
831
|
+
const p = M($);
|
|
832
|
+
return /* @__PURE__ */ c(
|
|
833
|
+
"button",
|
|
834
|
+
{
|
|
835
|
+
type: "button",
|
|
836
|
+
className: `nice-dock__item ${h === f.key ? "nice-dock__item--active" : ""} ${f.disabled ? "nice-dock__item--disabled" : ""}`,
|
|
837
|
+
style: { transform: `scale(${p})`, transition: "transform 0.15s ease-out" },
|
|
838
|
+
disabled: f.disabled,
|
|
839
|
+
onClick: () => o?.(f.key),
|
|
840
|
+
onMouseEnter: () => z($),
|
|
841
|
+
onMouseLeave: () => z(null),
|
|
842
|
+
"aria-label": f.label,
|
|
843
|
+
title: f.label,
|
|
844
|
+
children: [
|
|
845
|
+
/* @__PURE__ */ e("span", { className: "nice-dock__icon", children: f.icon }),
|
|
846
|
+
f.badge !== void 0 && /* @__PURE__ */ e("span", { className: "nice-dock__badge", children: f.badge })
|
|
847
|
+
]
|
|
848
|
+
},
|
|
849
|
+
f.key
|
|
850
|
+
);
|
|
851
|
+
}) })
|
|
852
|
+
}
|
|
853
|
+
);
|
|
854
|
+
}
|
|
855
|
+
);
|
|
856
|
+
rn.displayName = "NiceDock";
|
|
857
|
+
const on = ({
|
|
858
|
+
items: n,
|
|
859
|
+
label: a,
|
|
860
|
+
icon: i,
|
|
861
|
+
position: l,
|
|
862
|
+
onItemClick: s
|
|
863
|
+
}) => {
|
|
864
|
+
const { t: h } = oe(), [o, b] = R(!1), [r, t] = R(null), u = he(null);
|
|
865
|
+
re(() => {
|
|
866
|
+
if (!o) return;
|
|
867
|
+
const d = (g) => {
|
|
868
|
+
u.current && !u.current.contains(g.target) && (b(!1), t(null));
|
|
869
|
+
};
|
|
870
|
+
return document.addEventListener("mousedown", d), () => document.removeEventListener("mousedown", d);
|
|
871
|
+
}, [o]), re(() => {
|
|
872
|
+
if (!o) return;
|
|
873
|
+
const d = (g) => {
|
|
874
|
+
g.key === "Escape" && (b(!1), t(null));
|
|
875
|
+
};
|
|
876
|
+
return document.addEventListener("keydown", d), () => document.removeEventListener("keydown", d);
|
|
877
|
+
}, [o]);
|
|
878
|
+
const m = l === "bottom" ? "bottom-start" : l === "top" ? "top-start" : l === "left" ? "left-start" : "right-start", w = L((d) => {
|
|
879
|
+
if (d.children && d.children.length > 0) {
|
|
880
|
+
t(r === d.key ? null : d.key);
|
|
881
|
+
return;
|
|
882
|
+
}
|
|
883
|
+
d.onClick?.(), s?.(d.key), b(!1), t(null);
|
|
884
|
+
}, [s, r]);
|
|
885
|
+
return /* @__PURE__ */ c("div", { className: "nice-desktop__start", ref: u, children: [
|
|
886
|
+
/* @__PURE__ */ c(
|
|
887
|
+
"button",
|
|
888
|
+
{
|
|
889
|
+
type: "button",
|
|
890
|
+
className: `nice-desktop__start-btn ${o ? "nice-desktop__start-btn--active" : ""}`,
|
|
891
|
+
onClick: () => b(!o),
|
|
892
|
+
"aria-expanded": o,
|
|
893
|
+
"aria-haspopup": "menu",
|
|
894
|
+
"aria-label": h("desktop.start", "Start"),
|
|
895
|
+
children: [
|
|
896
|
+
i && /* @__PURE__ */ e("span", { className: "nice-desktop__start-icon", children: i }),
|
|
897
|
+
a && /* @__PURE__ */ e("span", { className: "nice-desktop__start-label", children: a }),
|
|
898
|
+
!i && !a && /* @__PURE__ */ e("span", { className: "nice-desktop__start-label", children: h("desktop.start", "Start") })
|
|
899
|
+
]
|
|
900
|
+
}
|
|
901
|
+
),
|
|
902
|
+
o && /* @__PURE__ */ e(
|
|
903
|
+
"div",
|
|
904
|
+
{
|
|
905
|
+
className: `nice-desktop__start-menu nice-desktop__start-menu--${m}`,
|
|
906
|
+
role: "menu",
|
|
907
|
+
children: n.map((d) => /* @__PURE__ */ c($e.Fragment, { children: [
|
|
908
|
+
d.divider && /* @__PURE__ */ e("div", { className: "nice-desktop__start-divider" }),
|
|
909
|
+
/* @__PURE__ */ c("div", { className: "nice-desktop__start-item-wrap", children: [
|
|
910
|
+
/* @__PURE__ */ c(
|
|
911
|
+
"button",
|
|
912
|
+
{
|
|
913
|
+
type: "button",
|
|
914
|
+
className: `nice-desktop__start-item ${r === d.key ? "nice-desktop__start-item--open" : ""}`,
|
|
915
|
+
disabled: d.disabled,
|
|
916
|
+
onClick: () => w(d),
|
|
917
|
+
role: "menuitem",
|
|
918
|
+
children: [
|
|
919
|
+
d.icon && /* @__PURE__ */ e("span", { className: "nice-desktop__start-item-icon", children: d.icon }),
|
|
920
|
+
/* @__PURE__ */ e("span", { className: "nice-desktop__start-item-label", children: d.label }),
|
|
921
|
+
d.children && d.children.length > 0 && /* @__PURE__ */ e("span", { className: "nice-desktop__start-item-arrow", children: "▸" })
|
|
922
|
+
]
|
|
923
|
+
}
|
|
924
|
+
),
|
|
925
|
+
d.children && r === d.key && /* @__PURE__ */ e("div", { className: "nice-desktop__start-submenu", role: "menu", children: d.children.map((g) => /* @__PURE__ */ c(
|
|
926
|
+
"button",
|
|
927
|
+
{
|
|
928
|
+
type: "button",
|
|
929
|
+
className: "nice-desktop__start-item",
|
|
930
|
+
disabled: g.disabled,
|
|
931
|
+
onClick: () => w(g),
|
|
932
|
+
role: "menuitem",
|
|
933
|
+
children: [
|
|
934
|
+
g.icon && /* @__PURE__ */ e("span", { className: "nice-desktop__start-item-icon", children: g.icon }),
|
|
935
|
+
/* @__PURE__ */ e("span", { className: "nice-desktop__start-item-label", children: g.label })
|
|
936
|
+
]
|
|
937
|
+
},
|
|
938
|
+
g.key
|
|
939
|
+
)) })
|
|
940
|
+
] })
|
|
941
|
+
] }, d.key))
|
|
942
|
+
}
|
|
943
|
+
)
|
|
944
|
+
] });
|
|
945
|
+
}, Fe = ({
|
|
946
|
+
items: n,
|
|
947
|
+
position: a,
|
|
948
|
+
size: i,
|
|
949
|
+
startMenu: l,
|
|
950
|
+
systemTray: s,
|
|
951
|
+
onItemClick: h
|
|
952
|
+
}) => {
|
|
953
|
+
const b = a === "left" || a === "right" ? { width: i, height: "100%" } : { height: i, width: "100%" };
|
|
954
|
+
return /* @__PURE__ */ c(
|
|
955
|
+
"div",
|
|
956
|
+
{
|
|
957
|
+
className: `nice-desktop__taskbar nice-desktop__taskbar--${a}`,
|
|
958
|
+
style: b,
|
|
959
|
+
role: "toolbar",
|
|
960
|
+
"aria-label": "Taskbar",
|
|
961
|
+
children: [
|
|
962
|
+
l,
|
|
963
|
+
/* @__PURE__ */ e("div", { className: "nice-desktop__taskbar-items", children: n.map((r) => /* @__PURE__ */ c(
|
|
964
|
+
"button",
|
|
965
|
+
{
|
|
966
|
+
type: "button",
|
|
967
|
+
className: `nice-desktop__taskbar-btn ${r.active ? "nice-desktop__taskbar-btn--active" : ""} ${r.minimized ? "nice-desktop__taskbar-btn--minimized" : ""}`,
|
|
968
|
+
onClick: () => h?.(r.key),
|
|
969
|
+
title: r.label,
|
|
970
|
+
children: [
|
|
971
|
+
r.icon && /* @__PURE__ */ e("span", { className: "nice-desktop__taskbar-btn-icon", children: r.icon }),
|
|
972
|
+
/* @__PURE__ */ e("span", { className: "nice-desktop__taskbar-btn-label", children: r.label }),
|
|
973
|
+
r.badge !== void 0 && /* @__PURE__ */ e("span", { className: "nice-desktop__taskbar-btn-badge", children: r.badge })
|
|
974
|
+
]
|
|
975
|
+
},
|
|
976
|
+
r.key
|
|
977
|
+
)) }),
|
|
978
|
+
s
|
|
979
|
+
]
|
|
980
|
+
}
|
|
981
|
+
);
|
|
982
|
+
}, dn = ({
|
|
983
|
+
items: n,
|
|
984
|
+
showClock: a = !0,
|
|
985
|
+
onItemClick: i
|
|
986
|
+
}) => {
|
|
987
|
+
const [l, s] = R(() => /* @__PURE__ */ new Date());
|
|
988
|
+
return re(() => {
|
|
989
|
+
if (!a) return;
|
|
990
|
+
const h = setInterval(() => s(/* @__PURE__ */ new Date()), 3e4);
|
|
991
|
+
return () => clearInterval(h);
|
|
992
|
+
}, [a]), /* @__PURE__ */ c("div", { className: "nice-desktop__tray", children: [
|
|
993
|
+
n.map((h) => /* @__PURE__ */ e(
|
|
994
|
+
"button",
|
|
995
|
+
{
|
|
996
|
+
type: "button",
|
|
997
|
+
className: "nice-desktop__tray-item",
|
|
998
|
+
title: h.tooltip,
|
|
999
|
+
onClick: () => {
|
|
1000
|
+
h.onClick?.(), i?.(h.key);
|
|
1001
|
+
},
|
|
1002
|
+
children: h.icon
|
|
1003
|
+
},
|
|
1004
|
+
h.key
|
|
1005
|
+
)),
|
|
1006
|
+
a && /* @__PURE__ */ e("span", { className: "nice-desktop__tray-clock", children: l.toLocaleTimeString([], { hour: "2-digit", minute: "2-digit" }) })
|
|
1007
|
+
] });
|
|
1008
|
+
}, un = ({
|
|
1009
|
+
icons: n,
|
|
1010
|
+
gridColumns: a,
|
|
1011
|
+
iconSize: i,
|
|
1012
|
+
onIconClick: l,
|
|
1013
|
+
onIconDoubleClick: s
|
|
1014
|
+
}) => {
|
|
1015
|
+
const [h, o] = R(null), b = L((t) => {
|
|
1016
|
+
o(t), l?.(t);
|
|
1017
|
+
}, [l]), r = L((t) => {
|
|
1018
|
+
s?.(t);
|
|
1019
|
+
}, [s]);
|
|
1020
|
+
return /* @__PURE__ */ e(
|
|
1021
|
+
"div",
|
|
1022
|
+
{
|
|
1023
|
+
className: `nice-desktop__grid nice-desktop__grid--${i}`,
|
|
1024
|
+
style: { gridTemplateColumns: `repeat(${a}, 1fr)` },
|
|
1025
|
+
children: n.map((t) => /* @__PURE__ */ c(
|
|
1026
|
+
"div",
|
|
1027
|
+
{
|
|
1028
|
+
className: `nice-desktop__icon ${h === t.key ? "nice-desktop__icon--selected" : ""} ${t.disabled ? "nice-desktop__icon--disabled" : ""}`,
|
|
1029
|
+
style: t.gridCol != null || t.gridRow != null ? { gridColumn: t.gridCol, gridRow: t.gridRow } : void 0,
|
|
1030
|
+
onClick: () => !t.disabled && b(t.key),
|
|
1031
|
+
onDoubleClick: () => !t.disabled && r(t.key),
|
|
1032
|
+
role: "button",
|
|
1033
|
+
tabIndex: t.disabled ? -1 : 0,
|
|
1034
|
+
"aria-label": t.label,
|
|
1035
|
+
onKeyDown: (u) => {
|
|
1036
|
+
t.disabled || (u.key === "Enter" && r(t.key), u.key === " " && (u.preventDefault(), b(t.key)));
|
|
1037
|
+
},
|
|
1038
|
+
children: [
|
|
1039
|
+
/* @__PURE__ */ e("div", { className: "nice-desktop__icon-img", children: t.icon }),
|
|
1040
|
+
/* @__PURE__ */ e("span", { className: "nice-desktop__icon-label", children: t.label })
|
|
1041
|
+
]
|
|
1042
|
+
},
|
|
1043
|
+
t.key
|
|
1044
|
+
))
|
|
1045
|
+
}
|
|
1046
|
+
);
|
|
1047
|
+
}, _n = ({
|
|
1048
|
+
items: n,
|
|
1049
|
+
x: a,
|
|
1050
|
+
y: i,
|
|
1051
|
+
onItemClick: l,
|
|
1052
|
+
onClose: s
|
|
1053
|
+
}) => {
|
|
1054
|
+
const h = he(null);
|
|
1055
|
+
return re(() => {
|
|
1056
|
+
const o = (b) => {
|
|
1057
|
+
h.current && !h.current.contains(b.target) && s();
|
|
1058
|
+
};
|
|
1059
|
+
return document.addEventListener("mousedown", o), () => document.removeEventListener("mousedown", o);
|
|
1060
|
+
}, [s]), re(() => {
|
|
1061
|
+
const o = (b) => {
|
|
1062
|
+
b.key === "Escape" && s();
|
|
1063
|
+
};
|
|
1064
|
+
return document.addEventListener("keydown", o), () => document.removeEventListener("keydown", o);
|
|
1065
|
+
}, [s]), /* @__PURE__ */ e(
|
|
1066
|
+
"div",
|
|
1067
|
+
{
|
|
1068
|
+
ref: h,
|
|
1069
|
+
className: "nice-desktop__context-menu",
|
|
1070
|
+
style: { position: "fixed", left: a, top: i },
|
|
1071
|
+
role: "menu",
|
|
1072
|
+
children: n.map((o) => /* @__PURE__ */ c($e.Fragment, { children: [
|
|
1073
|
+
o.divider && /* @__PURE__ */ e("div", { className: "nice-desktop__context-divider" }),
|
|
1074
|
+
/* @__PURE__ */ c(
|
|
1075
|
+
"button",
|
|
1076
|
+
{
|
|
1077
|
+
type: "button",
|
|
1078
|
+
className: "nice-desktop__context-item",
|
|
1079
|
+
disabled: o.disabled,
|
|
1080
|
+
onClick: () => {
|
|
1081
|
+
o.onClick?.(), l?.(o.key), s();
|
|
1082
|
+
},
|
|
1083
|
+
role: "menuitem",
|
|
1084
|
+
children: [
|
|
1085
|
+
o.icon && /* @__PURE__ */ e("span", { className: "nice-desktop__context-icon", children: o.icon }),
|
|
1086
|
+
/* @__PURE__ */ e("span", { children: o.label })
|
|
1087
|
+
]
|
|
1088
|
+
}
|
|
1089
|
+
)
|
|
1090
|
+
] }, o.key))
|
|
1091
|
+
}
|
|
1092
|
+
);
|
|
1093
|
+
}, hn = ne(
|
|
1094
|
+
({
|
|
1095
|
+
icons: n = [],
|
|
1096
|
+
taskbarPosition: a = "bottom",
|
|
1097
|
+
taskbarSize: i = 40,
|
|
1098
|
+
startMenuItems: l = [],
|
|
1099
|
+
startMenuLabel: s,
|
|
1100
|
+
startMenuIcon: h,
|
|
1101
|
+
taskbarItems: o = [],
|
|
1102
|
+
systemTrayItems: b = [],
|
|
1103
|
+
showClock: r = !0,
|
|
1104
|
+
wallpaper: t,
|
|
1105
|
+
gridColumns: u = 8,
|
|
1106
|
+
iconSize: m = "md",
|
|
1107
|
+
onIconClick: w,
|
|
1108
|
+
onIconDoubleClick: d,
|
|
1109
|
+
onTaskbarItemClick: g,
|
|
1110
|
+
onStartMenuItemClick: z,
|
|
1111
|
+
onSystemTrayItemClick: M,
|
|
1112
|
+
contextMenuItems: T,
|
|
1113
|
+
onContextMenuItemClick: f,
|
|
1114
|
+
children: $,
|
|
1115
|
+
className: p,
|
|
1116
|
+
style: y,
|
|
1117
|
+
id: x,
|
|
1118
|
+
accessMode: C,
|
|
1119
|
+
...A
|
|
1120
|
+
}, S) => {
|
|
1121
|
+
const k = ie(x);
|
|
1122
|
+
if (ce(C, x) === "hidden") return null;
|
|
1123
|
+
const [D, _] = R(null), Y = L(
|
|
1124
|
+
(V) => {
|
|
1125
|
+
!T || T.length === 0 || (V.preventDefault(), _({ x: V.clientX, y: V.clientY }));
|
|
1126
|
+
},
|
|
1127
|
+
[T]
|
|
1128
|
+
), K = l.length > 0 ? /* @__PURE__ */ e(
|
|
1129
|
+
on,
|
|
1130
|
+
{
|
|
1131
|
+
items: l,
|
|
1132
|
+
label: s,
|
|
1133
|
+
icon: h,
|
|
1134
|
+
position: a,
|
|
1135
|
+
onItemClick: z
|
|
1136
|
+
}
|
|
1137
|
+
) : null, Q = /* @__PURE__ */ e(
|
|
1138
|
+
dn,
|
|
1139
|
+
{
|
|
1140
|
+
items: b,
|
|
1141
|
+
showClock: r,
|
|
1142
|
+
onItemClick: M
|
|
1143
|
+
}
|
|
1144
|
+
), W = {
|
|
1145
|
+
...y,
|
|
1146
|
+
...t ? { background: t } : {}
|
|
1147
|
+
};
|
|
1148
|
+
return /* @__PURE__ */ c(
|
|
1149
|
+
"div",
|
|
1150
|
+
{
|
|
1151
|
+
ref: S,
|
|
1152
|
+
id: k,
|
|
1153
|
+
className: `nice-desktop nice-desktop--taskbar-${a} ${p ?? ""}`,
|
|
1154
|
+
style: W,
|
|
1155
|
+
...A,
|
|
1156
|
+
children: [
|
|
1157
|
+
(a === "top" || a === "left") && /* @__PURE__ */ e(
|
|
1158
|
+
Fe,
|
|
1159
|
+
{
|
|
1160
|
+
items: o,
|
|
1161
|
+
position: a,
|
|
1162
|
+
size: i,
|
|
1163
|
+
startMenu: K,
|
|
1164
|
+
systemTray: Q,
|
|
1165
|
+
onItemClick: g
|
|
1166
|
+
}
|
|
1167
|
+
),
|
|
1168
|
+
/* @__PURE__ */ c(
|
|
1169
|
+
"div",
|
|
1170
|
+
{
|
|
1171
|
+
className: "nice-desktop__area",
|
|
1172
|
+
onContextMenu: Y,
|
|
1173
|
+
children: [
|
|
1174
|
+
n.length > 0 && /* @__PURE__ */ e(
|
|
1175
|
+
un,
|
|
1176
|
+
{
|
|
1177
|
+
icons: n,
|
|
1178
|
+
gridColumns: u,
|
|
1179
|
+
iconSize: m,
|
|
1180
|
+
onIconClick: w,
|
|
1181
|
+
onIconDoubleClick: d
|
|
1182
|
+
}
|
|
1183
|
+
),
|
|
1184
|
+
$,
|
|
1185
|
+
D && T && /* @__PURE__ */ e(
|
|
1186
|
+
_n,
|
|
1187
|
+
{
|
|
1188
|
+
items: T,
|
|
1189
|
+
x: D.x,
|
|
1190
|
+
y: D.y,
|
|
1191
|
+
onItemClick: f,
|
|
1192
|
+
onClose: () => _(null)
|
|
1193
|
+
}
|
|
1194
|
+
)
|
|
1195
|
+
]
|
|
1196
|
+
}
|
|
1197
|
+
),
|
|
1198
|
+
(a === "bottom" || a === "right") && /* @__PURE__ */ e(
|
|
1199
|
+
Fe,
|
|
1200
|
+
{
|
|
1201
|
+
items: o,
|
|
1202
|
+
position: a,
|
|
1203
|
+
size: i,
|
|
1204
|
+
startMenu: K,
|
|
1205
|
+
systemTray: Q,
|
|
1206
|
+
onItemClick: g
|
|
1207
|
+
}
|
|
1208
|
+
)
|
|
1209
|
+
]
|
|
1210
|
+
}
|
|
1211
|
+
);
|
|
1212
|
+
}
|
|
1213
|
+
);
|
|
1214
|
+
hn.displayName = "NiceDesktop";
|
|
1215
|
+
const mn = ({ commands: n, onSelect: a, onClose: i }) => {
|
|
1216
|
+
const [l, s] = R(""), h = he(null), { t: o } = oe();
|
|
1217
|
+
re(() => {
|
|
1218
|
+
h.current?.focus();
|
|
1219
|
+
}, []), re(() => {
|
|
1220
|
+
const r = (t) => {
|
|
1221
|
+
t.key === "Escape" && i();
|
|
1222
|
+
};
|
|
1223
|
+
return document.addEventListener("keydown", r), () => document.removeEventListener("keydown", r);
|
|
1224
|
+
}, [i]);
|
|
1225
|
+
const b = l ? n.filter((r) => r.label.toLowerCase().includes(l.toLowerCase())) : n;
|
|
1226
|
+
return /* @__PURE__ */ c(Le, { children: [
|
|
1227
|
+
/* @__PURE__ */ e("div", { className: "nice-console__palette-overlay", onClick: i }),
|
|
1228
|
+
/* @__PURE__ */ c("div", { className: "nice-console__palette", role: "dialog", "aria-label": o("console.commandPalette", "Command Palette"), children: [
|
|
1229
|
+
/* @__PURE__ */ e(
|
|
1230
|
+
"input",
|
|
1231
|
+
{
|
|
1232
|
+
ref: h,
|
|
1233
|
+
className: "nice-console__palette-input",
|
|
1234
|
+
placeholder: o("console.searchCommands", "Search commands..."),
|
|
1235
|
+
value: l,
|
|
1236
|
+
onChange: (r) => s(r.target.value),
|
|
1237
|
+
onKeyDown: (r) => {
|
|
1238
|
+
r.key === "Enter" && b.length > 0 && (a(b[0].key), i());
|
|
1239
|
+
}
|
|
1240
|
+
}
|
|
1241
|
+
),
|
|
1242
|
+
/* @__PURE__ */ c("div", { className: "nice-console__palette-list", children: [
|
|
1243
|
+
b.map((r) => /* @__PURE__ */ c(
|
|
1244
|
+
"button",
|
|
1245
|
+
{
|
|
1246
|
+
type: "button",
|
|
1247
|
+
className: "nice-console__palette-item",
|
|
1248
|
+
disabled: r.disabled,
|
|
1249
|
+
onClick: () => {
|
|
1250
|
+
a(r.key), i();
|
|
1251
|
+
},
|
|
1252
|
+
children: [
|
|
1253
|
+
r.icon && /* @__PURE__ */ e("span", { className: "nice-console__palette-icon", children: r.icon }),
|
|
1254
|
+
/* @__PURE__ */ e("span", { className: "nice-console__palette-label", children: r.label }),
|
|
1255
|
+
r.description && /* @__PURE__ */ e("span", { className: "nice-console__palette-desc", children: r.description }),
|
|
1256
|
+
r.shortcut && /* @__PURE__ */ e("span", { className: "nice-console__palette-shortcut", children: r.shortcut })
|
|
1257
|
+
]
|
|
1258
|
+
},
|
|
1259
|
+
r.key
|
|
1260
|
+
)),
|
|
1261
|
+
b.length === 0 && /* @__PURE__ */ e("div", { className: "nice-console__palette-empty", children: o("console.noCommands", "No matching commands") })
|
|
1262
|
+
] })
|
|
1263
|
+
] })
|
|
1264
|
+
] });
|
|
1265
|
+
}, bn = ne(
|
|
1266
|
+
({
|
|
1267
|
+
tabs: n = [],
|
|
1268
|
+
activeTabKey: a,
|
|
1269
|
+
onTabChange: i,
|
|
1270
|
+
onTabClose: l,
|
|
1271
|
+
commandPalette: s = [],
|
|
1272
|
+
onCommand: h,
|
|
1273
|
+
statusItems: o = [],
|
|
1274
|
+
toolbar: b,
|
|
1275
|
+
sidePanel: r,
|
|
1276
|
+
sidePanelWidth: t = 220,
|
|
1277
|
+
sidePanelCollapsed: u,
|
|
1278
|
+
onToggleSidePanel: m,
|
|
1279
|
+
bottomPanel: w,
|
|
1280
|
+
bottomPanelHeight: d = 200,
|
|
1281
|
+
bottomPanelCollapsed: g,
|
|
1282
|
+
onToggleBottomPanel: z,
|
|
1283
|
+
children: M,
|
|
1284
|
+
size: T = "md",
|
|
1285
|
+
theme: f = "dark",
|
|
1286
|
+
className: $,
|
|
1287
|
+
style: p,
|
|
1288
|
+
id: y,
|
|
1289
|
+
accessMode: x,
|
|
1290
|
+
...C
|
|
1291
|
+
}, A) => {
|
|
1292
|
+
const S = ie(y), k = ce(x, y), { t: N } = oe();
|
|
1293
|
+
if (k === "hidden") return null;
|
|
1294
|
+
const [D, _] = R(n[0]?.key ?? ""), [Y, K] = R(!1), [Q, W] = R(!1), [V, j] = R(!1), J = a ?? D, B = u ?? Y, O = g ?? Q, X = L((F) => {
|
|
1295
|
+
i ? i(F) : _(F);
|
|
1296
|
+
}, [i]), q = L(() => {
|
|
1297
|
+
const F = !B;
|
|
1298
|
+
m ? m(F) : K(F);
|
|
1299
|
+
}, [B, m]), me = L(() => {
|
|
1300
|
+
const F = !O;
|
|
1301
|
+
z ? z(F) : W(F);
|
|
1302
|
+
}, [O, z]);
|
|
1303
|
+
re(() => {
|
|
1304
|
+
if (s.length === 0) return;
|
|
1305
|
+
const F = (Z) => {
|
|
1306
|
+
Z.ctrlKey && Z.shiftKey && Z.key === "P" && (Z.preventDefault(), j((U) => !U));
|
|
1307
|
+
};
|
|
1308
|
+
return document.addEventListener("keydown", F), () => document.removeEventListener("keydown", F);
|
|
1309
|
+
}, [s.length]);
|
|
1310
|
+
const ve = n.find((F) => F.key === J), pe = o.filter((F) => !F.position || F.position === "left"), de = o.filter((F) => F.position === "right");
|
|
1311
|
+
return /* @__PURE__ */ c(
|
|
1312
|
+
"div",
|
|
1313
|
+
{
|
|
1314
|
+
ref: A,
|
|
1315
|
+
id: S,
|
|
1316
|
+
className: `nice-console nice-console--${T} nice-console--${f} ${$ ?? ""}`,
|
|
1317
|
+
style: p,
|
|
1318
|
+
...C,
|
|
1319
|
+
children: [
|
|
1320
|
+
b && /* @__PURE__ */ e("div", { className: "nice-console__toolbar", children: b }),
|
|
1321
|
+
n.length > 0 && /* @__PURE__ */ e("div", { className: "nice-console__tabs", role: "tablist", children: n.map((F) => /* @__PURE__ */ c(
|
|
1322
|
+
"div",
|
|
1323
|
+
{
|
|
1324
|
+
className: `nice-console__tab ${F.key === J ? "nice-console__tab--active" : ""}`,
|
|
1325
|
+
role: "tab",
|
|
1326
|
+
"aria-selected": F.key === J,
|
|
1327
|
+
children: [
|
|
1328
|
+
/* @__PURE__ */ c(
|
|
1329
|
+
"button",
|
|
1330
|
+
{
|
|
1331
|
+
type: "button",
|
|
1332
|
+
className: "nice-console__tab-btn",
|
|
1333
|
+
onClick: () => X(F.key),
|
|
1334
|
+
children: [
|
|
1335
|
+
F.icon && /* @__PURE__ */ e("span", { className: "nice-console__tab-icon", children: F.icon }),
|
|
1336
|
+
/* @__PURE__ */ e("span", { children: F.label })
|
|
1337
|
+
]
|
|
1338
|
+
}
|
|
1339
|
+
),
|
|
1340
|
+
(F.closable ?? !0) && l && /* @__PURE__ */ e(
|
|
1341
|
+
"button",
|
|
1342
|
+
{
|
|
1343
|
+
type: "button",
|
|
1344
|
+
className: "nice-console__tab-close",
|
|
1345
|
+
onClick: () => l(F.key),
|
|
1346
|
+
"aria-label": N("console.closeTab", "Close tab"),
|
|
1347
|
+
children: "✕"
|
|
1348
|
+
}
|
|
1349
|
+
)
|
|
1350
|
+
]
|
|
1351
|
+
},
|
|
1352
|
+
F.key
|
|
1353
|
+
)) }),
|
|
1354
|
+
/* @__PURE__ */ c("div", { className: "nice-console__main", children: [
|
|
1355
|
+
r && !B && /* @__PURE__ */ c(
|
|
1356
|
+
"aside",
|
|
1357
|
+
{
|
|
1358
|
+
className: "nice-console__side",
|
|
1359
|
+
style: { width: t, flexShrink: 0 },
|
|
1360
|
+
children: [
|
|
1361
|
+
/* @__PURE__ */ e("div", { className: "nice-console__side-header", children: /* @__PURE__ */ e(
|
|
1362
|
+
"button",
|
|
1363
|
+
{
|
|
1364
|
+
type: "button",
|
|
1365
|
+
className: "nice-console__side-toggle",
|
|
1366
|
+
onClick: q,
|
|
1367
|
+
"aria-label": N("console.closeSidePanel", "Close side panel"),
|
|
1368
|
+
children: "✕"
|
|
1369
|
+
}
|
|
1370
|
+
) }),
|
|
1371
|
+
/* @__PURE__ */ e("div", { className: "nice-console__side-content", children: r })
|
|
1372
|
+
]
|
|
1373
|
+
}
|
|
1374
|
+
),
|
|
1375
|
+
/* @__PURE__ */ c("div", { className: "nice-console__center", children: [
|
|
1376
|
+
/* @__PURE__ */ e("div", { className: "nice-console__content", role: "tabpanel", children: ve ? ve.render() : M }),
|
|
1377
|
+
w && !O && /* @__PURE__ */ c(
|
|
1378
|
+
"div",
|
|
1379
|
+
{
|
|
1380
|
+
className: "nice-console__bottom",
|
|
1381
|
+
style: { height: d, flexShrink: 0 },
|
|
1382
|
+
children: [
|
|
1383
|
+
/* @__PURE__ */ e("div", { className: "nice-console__bottom-header", children: /* @__PURE__ */ e(
|
|
1384
|
+
"button",
|
|
1385
|
+
{
|
|
1386
|
+
type: "button",
|
|
1387
|
+
className: "nice-console__bottom-toggle",
|
|
1388
|
+
onClick: me,
|
|
1389
|
+
"aria-label": N("console.closeBottomPanel", "Close bottom panel"),
|
|
1390
|
+
children: "✕"
|
|
1391
|
+
}
|
|
1392
|
+
) }),
|
|
1393
|
+
/* @__PURE__ */ e("div", { className: "nice-console__bottom-content", children: w })
|
|
1394
|
+
]
|
|
1395
|
+
}
|
|
1396
|
+
)
|
|
1397
|
+
] })
|
|
1398
|
+
] }),
|
|
1399
|
+
o.length > 0 && /* @__PURE__ */ c("div", { className: "nice-console__statusbar", children: [
|
|
1400
|
+
/* @__PURE__ */ c("div", { className: "nice-console__statusbar-left", children: [
|
|
1401
|
+
r && B && /* @__PURE__ */ e("button", { type: "button", className: "nice-console__statusbar-btn", onClick: q, title: N("console.openSidePanel", "Open side panel"), children: "☰" }),
|
|
1402
|
+
w && O && /* @__PURE__ */ e("button", { type: "button", className: "nice-console__statusbar-btn", onClick: me, title: N("console.openBottomPanel", "Open bottom panel"), children: "▁" }),
|
|
1403
|
+
pe.map((F) => /* @__PURE__ */ e("span", { className: "nice-console__status-item", onClick: F.onClick, role: F.onClick ? "button" : void 0, tabIndex: F.onClick ? 0 : void 0, children: F.content }, F.key))
|
|
1404
|
+
] }),
|
|
1405
|
+
/* @__PURE__ */ e("div", { className: "nice-console__statusbar-right", children: de.map((F) => /* @__PURE__ */ e("span", { className: "nice-console__status-item", onClick: F.onClick, role: F.onClick ? "button" : void 0, tabIndex: F.onClick ? 0 : void 0, children: F.content }, F.key)) })
|
|
1406
|
+
] }),
|
|
1407
|
+
V && s.length > 0 && /* @__PURE__ */ e(
|
|
1408
|
+
mn,
|
|
1409
|
+
{
|
|
1410
|
+
commands: s,
|
|
1411
|
+
onSelect: (F) => h?.(F),
|
|
1412
|
+
onClose: () => j(!1)
|
|
1413
|
+
}
|
|
1414
|
+
)
|
|
1415
|
+
]
|
|
1416
|
+
}
|
|
1417
|
+
);
|
|
1418
|
+
}
|
|
1419
|
+
);
|
|
1420
|
+
bn.displayName = "NiceConsole";
|
|
1421
|
+
const pn = ne(
|
|
1422
|
+
({
|
|
1423
|
+
steps: n,
|
|
1424
|
+
activeStep: a,
|
|
1425
|
+
onStepChange: i,
|
|
1426
|
+
onComplete: l,
|
|
1427
|
+
onCancel: s,
|
|
1428
|
+
allowStepClick: h = !1,
|
|
1429
|
+
variant: o = "horizontal",
|
|
1430
|
+
nextLabel: b,
|
|
1431
|
+
prevLabel: r,
|
|
1432
|
+
finishLabel: t,
|
|
1433
|
+
cancelLabel: u,
|
|
1434
|
+
showProgress: m = !0,
|
|
1435
|
+
className: w,
|
|
1436
|
+
style: d,
|
|
1437
|
+
size: g = "md",
|
|
1438
|
+
accessMode: z,
|
|
1439
|
+
id: M
|
|
1440
|
+
}, T) => {
|
|
1441
|
+
if (ce(z, M) === "hidden") return null;
|
|
1442
|
+
const { t: $ } = oe(), p = ie(M), [y, x] = R(0), [C, A] = R({}), [S, k] = R(/* @__PURE__ */ new Set([0])), N = a ?? y, D = n[N], _ = N === 0, Y = N === n.length - 1, K = L(
|
|
1443
|
+
(O) => {
|
|
1444
|
+
const X = Math.max(0, Math.min(n.length - 1, O));
|
|
1445
|
+
x(X), k((q) => new Set(q).add(X)), i?.(X);
|
|
1446
|
+
},
|
|
1447
|
+
[n.length, i]
|
|
1448
|
+
), Q = L(() => {
|
|
1449
|
+
if (!D?.validate) return !0;
|
|
1450
|
+
const O = D.validate();
|
|
1451
|
+
return O === !0 || O === void 0 ? (A((X) => {
|
|
1452
|
+
const q = { ...X };
|
|
1453
|
+
return delete q[D.id], q;
|
|
1454
|
+
}), !0) : (A((X) => ({ ...X, [D.id]: O })), !1);
|
|
1455
|
+
}, [D]), W = L(() => {
|
|
1456
|
+
Q() && (Y ? l?.() : K(N + 1));
|
|
1457
|
+
}, [N, Y, Q, K, l]), V = L(() => {
|
|
1458
|
+
_ || K(N - 1);
|
|
1459
|
+
}, [N, _, K]), j = L(
|
|
1460
|
+
(O) => {
|
|
1461
|
+
const X = n.findIndex((q) => q.id === O);
|
|
1462
|
+
X >= 0 && K(X);
|
|
1463
|
+
},
|
|
1464
|
+
[n, K]
|
|
1465
|
+
), J = le(
|
|
1466
|
+
() => ({
|
|
1467
|
+
stepIndex: N,
|
|
1468
|
+
totalSteps: n.length,
|
|
1469
|
+
goNext: W,
|
|
1470
|
+
goPrev: V,
|
|
1471
|
+
goTo: j,
|
|
1472
|
+
isFirst: _,
|
|
1473
|
+
isLast: Y
|
|
1474
|
+
}),
|
|
1475
|
+
[N, n.length, W, V, j, _, Y]
|
|
1476
|
+
), B = (N + 1) / n.length * 100;
|
|
1477
|
+
return /* @__PURE__ */ c(
|
|
1478
|
+
"div",
|
|
1479
|
+
{
|
|
1480
|
+
ref: T,
|
|
1481
|
+
id: p,
|
|
1482
|
+
className: `nice-wizard nice-wizard--${o} nice-size-${g}${w ? ` ${w}` : ""}`,
|
|
1483
|
+
style: d,
|
|
1484
|
+
children: [
|
|
1485
|
+
/* @__PURE__ */ e("div", { className: "nice-wizard__steps", role: "tablist", children: n.map((O, X) => {
|
|
1486
|
+
const q = X < N ? "completed" : X === N ? "active" : "pending", me = !!C[O.id];
|
|
1487
|
+
return /* @__PURE__ */ c(
|
|
1488
|
+
"button",
|
|
1489
|
+
{
|
|
1490
|
+
role: "tab",
|
|
1491
|
+
"aria-selected": X === N,
|
|
1492
|
+
className: `nice-wizard__step nice-wizard__step--${q}${me ? " nice-wizard__step--error" : ""}`,
|
|
1493
|
+
onClick: () => h && X <= N && K(X),
|
|
1494
|
+
disabled: !h || X > N,
|
|
1495
|
+
type: "button",
|
|
1496
|
+
children: [
|
|
1497
|
+
/* @__PURE__ */ e("span", { className: "nice-wizard__step-number", children: q === "completed" ? "✓" : X + 1 }),
|
|
1498
|
+
/* @__PURE__ */ e("span", { className: "nice-wizard__step-title", children: O.title }),
|
|
1499
|
+
O.optional && /* @__PURE__ */ c("span", { className: "nice-wizard__step-optional", children: [
|
|
1500
|
+
"(",
|
|
1501
|
+
$("optional", "optional"),
|
|
1502
|
+
")"
|
|
1503
|
+
] })
|
|
1504
|
+
]
|
|
1505
|
+
},
|
|
1506
|
+
O.id
|
|
1507
|
+
);
|
|
1508
|
+
}) }),
|
|
1509
|
+
m && /* @__PURE__ */ e("div", { className: "nice-wizard__progress", children: /* @__PURE__ */ e("div", { className: "nice-wizard__progress-bar", style: { width: `${B}%` } }) }),
|
|
1510
|
+
/* @__PURE__ */ e("div", { className: "nice-wizard__content", role: "tabpanel", children: D && /* @__PURE__ */ c(Le, { children: [
|
|
1511
|
+
typeof D.content == "function" ? D.content(J) : D.content,
|
|
1512
|
+
C[D.id] && /* @__PURE__ */ e("div", { className: "nice-wizard__error nice-error-text", children: C[D.id] })
|
|
1513
|
+
] }) }),
|
|
1514
|
+
/* @__PURE__ */ c("div", { className: "nice-wizard__actions", children: [
|
|
1515
|
+
s && /* @__PURE__ */ e("button", { type: "button", className: "nice-btn nice-btn--text", onClick: s, children: u ?? $("cancel", "Cancel") }),
|
|
1516
|
+
/* @__PURE__ */ c("div", { className: "nice-wizard__actions-right", children: [
|
|
1517
|
+
!_ && /* @__PURE__ */ e("button", { type: "button", className: "nice-btn nice-btn--outlined", onClick: V, children: r ?? $("previous", "← Previous") }),
|
|
1518
|
+
/* @__PURE__ */ e("button", { type: "button", className: "nice-btn nice-btn--primary", onClick: W, children: Y ? t ?? $("finish", "Finish ✓") : b ?? $("next", "Next →") })
|
|
1519
|
+
] })
|
|
1520
|
+
] })
|
|
1521
|
+
]
|
|
1522
|
+
}
|
|
1523
|
+
);
|
|
1524
|
+
}
|
|
1525
|
+
);
|
|
1526
|
+
pn.displayName = "NiceWizard";
|
|
1527
|
+
const Be = Je(null);
|
|
1528
|
+
function ha() {
|
|
1529
|
+
const n = Ge(Be);
|
|
1530
|
+
if (!n) throw new Error("useSetupWizard must be used within NiceSetupWizard");
|
|
1531
|
+
return n;
|
|
1532
|
+
}
|
|
1533
|
+
const vn = ne(
|
|
1534
|
+
({
|
|
1535
|
+
steps: n,
|
|
1536
|
+
initialValues: a = {},
|
|
1537
|
+
activeStep: i,
|
|
1538
|
+
layout: l = "horizontal",
|
|
1539
|
+
size: s = "md",
|
|
1540
|
+
defaultQuickMode: h = !1,
|
|
1541
|
+
allowQuickModeToggle: o = !0,
|
|
1542
|
+
showStepNumbers: b = !0,
|
|
1543
|
+
showProgress: r = !0,
|
|
1544
|
+
showEstimatedTime: t = !1,
|
|
1545
|
+
allowStepClick: u = !0,
|
|
1546
|
+
showReviewStep: m = !1,
|
|
1547
|
+
persistKey: w,
|
|
1548
|
+
animation: d = "slide",
|
|
1549
|
+
branding: g,
|
|
1550
|
+
header: z,
|
|
1551
|
+
footer: M,
|
|
1552
|
+
onStepChange: T,
|
|
1553
|
+
onValuesChange: f,
|
|
1554
|
+
onComplete: $,
|
|
1555
|
+
onCancel: p,
|
|
1556
|
+
labels: y = {},
|
|
1557
|
+
accessMode: x,
|
|
1558
|
+
id: C,
|
|
1559
|
+
className: A,
|
|
1560
|
+
style: S
|
|
1561
|
+
}, k) => {
|
|
1562
|
+
const N = ce(x, C);
|
|
1563
|
+
if (N === "hidden") return null;
|
|
1564
|
+
const { t: D } = oe(), _ = ie(C), [Y, K] = R(h), Q = le(() => Y ? n.filter((v) => !v.quickModeSkip) : n, [n, Y]), W = le(() => {
|
|
1565
|
+
if (!m) return Q;
|
|
1566
|
+
const v = {
|
|
1567
|
+
id: "__review__",
|
|
1568
|
+
title: y.review ?? D("wizard.review", "Review"),
|
|
1569
|
+
icon: "📋",
|
|
1570
|
+
content: (H) => /* @__PURE__ */ c("div", { className: "nice-setup-wizard__review", children: [
|
|
1571
|
+
/* @__PURE__ */ e("h3", { children: D("wizard.reviewTitle", "Review Your Setup") }),
|
|
1572
|
+
Q.filter((P) => P.summary).map((P) => /* @__PURE__ */ c("div", { className: "nice-setup-wizard__review-section", children: [
|
|
1573
|
+
/* @__PURE__ */ e("h4", { children: P.title }),
|
|
1574
|
+
P.summary?.(H.values)
|
|
1575
|
+
] }, P.id))
|
|
1576
|
+
] })
|
|
1577
|
+
};
|
|
1578
|
+
return [...Q, v];
|
|
1579
|
+
}, [Q, m, y.review, D]), [V, j] = R(() => {
|
|
1580
|
+
if (w)
|
|
1581
|
+
try {
|
|
1582
|
+
const v = localStorage.getItem(w);
|
|
1583
|
+
if (v) return { ...a, ...JSON.parse(v) };
|
|
1584
|
+
} catch {
|
|
1585
|
+
}
|
|
1586
|
+
return a;
|
|
1587
|
+
}), [J, B] = R(() => {
|
|
1588
|
+
if (i) return i;
|
|
1589
|
+
if (w)
|
|
1590
|
+
try {
|
|
1591
|
+
const v = localStorage.getItem(`${w}_step`);
|
|
1592
|
+
if (v && W.some((H) => H.id === v)) return v;
|
|
1593
|
+
} catch {
|
|
1594
|
+
}
|
|
1595
|
+
return W[0]?.id ?? "";
|
|
1596
|
+
}), [O, X] = R(() => /* @__PURE__ */ new Set([J])), [q, me] = R({}), [ve, pe] = R(!1), [de, F] = R("next"), Z = W.findIndex((v) => v.id === J), U = W[Z], E = Z === 0, I = Z === W.length - 1, ee = (Z + 1) / W.length * 100;
|
|
1597
|
+
re(() => {
|
|
1598
|
+
w && (localStorage.setItem(w, JSON.stringify(V)), localStorage.setItem(`${w}_step`, J));
|
|
1599
|
+
}, [V, J, w]);
|
|
1600
|
+
const te = L(
|
|
1601
|
+
(v, H) => {
|
|
1602
|
+
j((P) => {
|
|
1603
|
+
const se = { ...P, [v]: H };
|
|
1604
|
+
return f?.(se), se;
|
|
1605
|
+
});
|
|
1606
|
+
},
|
|
1607
|
+
[f]
|
|
1608
|
+
), fe = L(
|
|
1609
|
+
(v) => {
|
|
1610
|
+
j((H) => {
|
|
1611
|
+
const P = { ...H, ...v };
|
|
1612
|
+
return f?.(P), P;
|
|
1613
|
+
});
|
|
1614
|
+
},
|
|
1615
|
+
[f]
|
|
1616
|
+
), Ne = L((v, H) => {
|
|
1617
|
+
me((P) => ({ ...P, [v]: H }));
|
|
1618
|
+
}, []), we = L((v) => {
|
|
1619
|
+
me((H) => {
|
|
1620
|
+
const P = { ...H };
|
|
1621
|
+
return delete P[v], P;
|
|
1622
|
+
});
|
|
1623
|
+
}, []), be = L(
|
|
1624
|
+
(v) => {
|
|
1625
|
+
const H = W.findIndex((P) => P.id === v);
|
|
1626
|
+
H >= 0 && (F(H > Z ? "next" : "prev"), B(v), X((P) => new Set(P).add(v)), T?.(v, H));
|
|
1627
|
+
},
|
|
1628
|
+
[W, Z, T]
|
|
1629
|
+
), ze = L(async () => {
|
|
1630
|
+
if (U) {
|
|
1631
|
+
if (U.validate) {
|
|
1632
|
+
pe(!0);
|
|
1633
|
+
try {
|
|
1634
|
+
const v = await U.validate(V);
|
|
1635
|
+
if (v) {
|
|
1636
|
+
Ne(U.id, v), pe(!1);
|
|
1637
|
+
return;
|
|
1638
|
+
}
|
|
1639
|
+
we(U.id);
|
|
1640
|
+
} catch (v) {
|
|
1641
|
+
Ne(U.id, String(v)), pe(!1);
|
|
1642
|
+
return;
|
|
1643
|
+
}
|
|
1644
|
+
pe(!1);
|
|
1645
|
+
}
|
|
1646
|
+
if (U.fields) {
|
|
1647
|
+
for (const v of U.fields) {
|
|
1648
|
+
if (v.required && !V[v.id]) {
|
|
1649
|
+
Ne(U.id, `${v.label} ${D("wizard.isRequired", "is required")}`);
|
|
1650
|
+
return;
|
|
1651
|
+
}
|
|
1652
|
+
if (v.validation?.custom) {
|
|
1653
|
+
const H = v.validation.custom(V[v.id]);
|
|
1654
|
+
if (H) {
|
|
1655
|
+
Ne(U.id, H);
|
|
1656
|
+
return;
|
|
1657
|
+
}
|
|
1658
|
+
}
|
|
1659
|
+
}
|
|
1660
|
+
we(U.id);
|
|
1661
|
+
}
|
|
1662
|
+
if (I)
|
|
1663
|
+
await $?.(V), w && (localStorage.removeItem(w), localStorage.removeItem(`${w}_step`));
|
|
1664
|
+
else {
|
|
1665
|
+
let v;
|
|
1666
|
+
U.nextStep ? v = typeof U.nextStep == "function" ? U.nextStep(V) : U.nextStep : v = W[Z + 1]?.id ?? "", v && be(v);
|
|
1667
|
+
}
|
|
1668
|
+
}
|
|
1669
|
+
}, [
|
|
1670
|
+
U,
|
|
1671
|
+
V,
|
|
1672
|
+
I,
|
|
1673
|
+
Z,
|
|
1674
|
+
W,
|
|
1675
|
+
$,
|
|
1676
|
+
w,
|
|
1677
|
+
D,
|
|
1678
|
+
Ne,
|
|
1679
|
+
we,
|
|
1680
|
+
be
|
|
1681
|
+
]), Me = L(() => {
|
|
1682
|
+
if (E) return;
|
|
1683
|
+
const v = U?.prevStep ?? W[Z - 1]?.id;
|
|
1684
|
+
v && (F("prev"), be(v));
|
|
1685
|
+
}, [E, U, Z, W, be]), De = L(() => {
|
|
1686
|
+
if (U?.optional && !I) {
|
|
1687
|
+
const v = W[Z + 1]?.id;
|
|
1688
|
+
v && be(v);
|
|
1689
|
+
}
|
|
1690
|
+
}, [U, I, Z, W, be]), Oe = L(() => {
|
|
1691
|
+
$?.(V);
|
|
1692
|
+
}, [$, V]), Ee = L(() => {
|
|
1693
|
+
p?.();
|
|
1694
|
+
}, [p]), Te = L(() => {
|
|
1695
|
+
K((v) => !v);
|
|
1696
|
+
}, []), ye = le(
|
|
1697
|
+
() => ({
|
|
1698
|
+
values: V,
|
|
1699
|
+
setValue: te,
|
|
1700
|
+
setValues: fe,
|
|
1701
|
+
currentStep: U,
|
|
1702
|
+
currentIndex: Z,
|
|
1703
|
+
totalSteps: W.length,
|
|
1704
|
+
visitedSteps: O,
|
|
1705
|
+
errors: q,
|
|
1706
|
+
setError: Ne,
|
|
1707
|
+
clearError: we,
|
|
1708
|
+
goNext: ze,
|
|
1709
|
+
goPrev: Me,
|
|
1710
|
+
goTo: be,
|
|
1711
|
+
skip: De,
|
|
1712
|
+
complete: Oe,
|
|
1713
|
+
cancel: Ee,
|
|
1714
|
+
isFirst: E,
|
|
1715
|
+
isLast: I,
|
|
1716
|
+
isQuickMode: Y,
|
|
1717
|
+
toggleQuickMode: Te,
|
|
1718
|
+
progress: ee,
|
|
1719
|
+
t: D
|
|
1720
|
+
}),
|
|
1721
|
+
[
|
|
1722
|
+
V,
|
|
1723
|
+
te,
|
|
1724
|
+
fe,
|
|
1725
|
+
U,
|
|
1726
|
+
Z,
|
|
1727
|
+
W.length,
|
|
1728
|
+
O,
|
|
1729
|
+
q,
|
|
1730
|
+
Ne,
|
|
1731
|
+
we,
|
|
1732
|
+
ze,
|
|
1733
|
+
Me,
|
|
1734
|
+
be,
|
|
1735
|
+
De,
|
|
1736
|
+
Oe,
|
|
1737
|
+
Ee,
|
|
1738
|
+
E,
|
|
1739
|
+
I,
|
|
1740
|
+
Y,
|
|
1741
|
+
Te,
|
|
1742
|
+
ee,
|
|
1743
|
+
D
|
|
1744
|
+
]
|
|
1745
|
+
), Ae = le(() => {
|
|
1746
|
+
if (!t) return null;
|
|
1747
|
+
const H = W.map((P) => P.estimatedTime).filter(Boolean).map((P) => {
|
|
1748
|
+
const se = P.match(/(\d+)\s*(min|sec|s|m)/i);
|
|
1749
|
+
if (!se) return 0;
|
|
1750
|
+
const ue = parseInt(se[1], 10);
|
|
1751
|
+
return se[2].toLowerCase().startsWith("m") ? ue : ue / 60;
|
|
1752
|
+
}).reduce((P, se) => P + se, 0);
|
|
1753
|
+
return H > 0 ? `~${Math.ceil(H)} min` : null;
|
|
1754
|
+
}, [W, t]);
|
|
1755
|
+
if (!U) return null;
|
|
1756
|
+
const He = (v, H) => {
|
|
1757
|
+
const P = v.id === J, se = O.has(v.id) && !P && H < Z, ue = !P && !se, _e = !!q[v.id], G = u && (se || H <= Z);
|
|
1758
|
+
return /* @__PURE__ */ c(
|
|
1759
|
+
"button",
|
|
1760
|
+
{
|
|
1761
|
+
type: "button",
|
|
1762
|
+
role: "tab",
|
|
1763
|
+
"aria-selected": P,
|
|
1764
|
+
"aria-current": P ? "step" : void 0,
|
|
1765
|
+
className: [
|
|
1766
|
+
"nice-setup-wizard__step-indicator",
|
|
1767
|
+
P && "nice-setup-wizard__step-indicator--active",
|
|
1768
|
+
se && "nice-setup-wizard__step-indicator--completed",
|
|
1769
|
+
ue && "nice-setup-wizard__step-indicator--pending",
|
|
1770
|
+
_e && "nice-setup-wizard__step-indicator--error"
|
|
1771
|
+
].filter(Boolean).join(" "),
|
|
1772
|
+
onClick: () => G && be(v.id),
|
|
1773
|
+
disabled: !G,
|
|
1774
|
+
children: [
|
|
1775
|
+
/* @__PURE__ */ e("span", { className: "nice-setup-wizard__step-marker", children: se ? "✓" : _e ? "!" : b ? H + 1 : v.icon || "○" }),
|
|
1776
|
+
/* @__PURE__ */ c("span", { className: "nice-setup-wizard__step-info", children: [
|
|
1777
|
+
/* @__PURE__ */ e("span", { className: "nice-setup-wizard__step-title", children: v.title }),
|
|
1778
|
+
v.subtitle && /* @__PURE__ */ e("span", { className: "nice-setup-wizard__step-subtitle", children: v.subtitle }),
|
|
1779
|
+
v.optional && /* @__PURE__ */ c("span", { className: "nice-setup-wizard__step-optional", children: [
|
|
1780
|
+
"(",
|
|
1781
|
+
y.optional ?? D("wizard.optional", "optional"),
|
|
1782
|
+
")"
|
|
1783
|
+
] })
|
|
1784
|
+
] }),
|
|
1785
|
+
v.badge && /* @__PURE__ */ e("span", { className: "nice-setup-wizard__step-badge", children: v.badge })
|
|
1786
|
+
]
|
|
1787
|
+
},
|
|
1788
|
+
v.id
|
|
1789
|
+
);
|
|
1790
|
+
}, Ke = (v) => {
|
|
1791
|
+
if (v.showWhen && !v.showWhen(V)) return null;
|
|
1792
|
+
const H = V[v.id] ?? v.defaultValue ?? "", P = (G) => te(v.id, G);
|
|
1793
|
+
if (v.render)
|
|
1794
|
+
return /* @__PURE__ */ e(
|
|
1795
|
+
"div",
|
|
1796
|
+
{
|
|
1797
|
+
className: `nice-setup-wizard__field${v.fullWidth ? " nice-setup-wizard__field--full" : ""}`,
|
|
1798
|
+
children: v.render({ value: H, onChange: P, field: v })
|
|
1799
|
+
},
|
|
1800
|
+
v.id
|
|
1801
|
+
);
|
|
1802
|
+
const se = `${_}-${v.id}`, ue = {
|
|
1803
|
+
id: se,
|
|
1804
|
+
disabled: v.disabled || N === "disabled" || N === "readOnly",
|
|
1805
|
+
placeholder: v.placeholder,
|
|
1806
|
+
required: v.required
|
|
1807
|
+
};
|
|
1808
|
+
let _e;
|
|
1809
|
+
switch (v.type) {
|
|
1810
|
+
case "textarea":
|
|
1811
|
+
_e = /* @__PURE__ */ e(
|
|
1812
|
+
"textarea",
|
|
1813
|
+
{
|
|
1814
|
+
...ue,
|
|
1815
|
+
className: "nice-setup-wizard__input nice-setup-wizard__textarea",
|
|
1816
|
+
value: String(H),
|
|
1817
|
+
onChange: (G) => P(G.target.value),
|
|
1818
|
+
rows: 4
|
|
1819
|
+
}
|
|
1820
|
+
);
|
|
1821
|
+
break;
|
|
1822
|
+
case "select":
|
|
1823
|
+
_e = /* @__PURE__ */ c(
|
|
1824
|
+
"select",
|
|
1825
|
+
{
|
|
1826
|
+
...ue,
|
|
1827
|
+
className: "nice-setup-wizard__input nice-setup-wizard__select",
|
|
1828
|
+
value: String(H),
|
|
1829
|
+
onChange: (G) => P(G.target.value),
|
|
1830
|
+
children: [
|
|
1831
|
+
/* @__PURE__ */ e("option", { value: "", children: v.placeholder || D("wizard.select", "Select...") }),
|
|
1832
|
+
v.options?.map((G) => /* @__PURE__ */ e("option", { value: G.value, children: G.label }, G.value))
|
|
1833
|
+
]
|
|
1834
|
+
}
|
|
1835
|
+
);
|
|
1836
|
+
break;
|
|
1837
|
+
case "radio":
|
|
1838
|
+
_e = /* @__PURE__ */ e("div", { className: "nice-setup-wizard__radio-group", children: v.options?.map((G) => /* @__PURE__ */ c("label", { className: "nice-setup-wizard__radio-label", children: [
|
|
1839
|
+
/* @__PURE__ */ e(
|
|
1840
|
+
"input",
|
|
1841
|
+
{
|
|
1842
|
+
type: "radio",
|
|
1843
|
+
name: se,
|
|
1844
|
+
value: G.value,
|
|
1845
|
+
checked: H === G.value,
|
|
1846
|
+
onChange: () => P(G.value),
|
|
1847
|
+
disabled: ue.disabled
|
|
1848
|
+
}
|
|
1849
|
+
),
|
|
1850
|
+
G.icon && /* @__PURE__ */ e("span", { className: "nice-setup-wizard__radio-icon", children: G.icon }),
|
|
1851
|
+
/* @__PURE__ */ e("span", { children: G.label })
|
|
1852
|
+
] }, G.value)) });
|
|
1853
|
+
break;
|
|
1854
|
+
case "checkbox":
|
|
1855
|
+
_e = /* @__PURE__ */ c("label", { className: "nice-setup-wizard__checkbox-label", children: [
|
|
1856
|
+
/* @__PURE__ */ e(
|
|
1857
|
+
"input",
|
|
1858
|
+
{
|
|
1859
|
+
type: "checkbox",
|
|
1860
|
+
checked: !!H,
|
|
1861
|
+
onChange: (G) => P(G.target.checked),
|
|
1862
|
+
disabled: ue.disabled
|
|
1863
|
+
}
|
|
1864
|
+
),
|
|
1865
|
+
/* @__PURE__ */ e("span", { children: v.label })
|
|
1866
|
+
] });
|
|
1867
|
+
break;
|
|
1868
|
+
case "switch":
|
|
1869
|
+
_e = /* @__PURE__ */ c("label", { className: "nice-setup-wizard__switch-label", children: [
|
|
1870
|
+
/* @__PURE__ */ e("span", { className: "nice-setup-wizard__switch-text", children: v.label }),
|
|
1871
|
+
/* @__PURE__ */ c(
|
|
1872
|
+
"span",
|
|
1873
|
+
{
|
|
1874
|
+
className: `nice-setup-wizard__switch${H ? " nice-setup-wizard__switch--on" : ""}`,
|
|
1875
|
+
children: [
|
|
1876
|
+
/* @__PURE__ */ e(
|
|
1877
|
+
"input",
|
|
1878
|
+
{
|
|
1879
|
+
type: "checkbox",
|
|
1880
|
+
checked: !!H,
|
|
1881
|
+
onChange: (G) => P(G.target.checked),
|
|
1882
|
+
disabled: ue.disabled
|
|
1883
|
+
}
|
|
1884
|
+
),
|
|
1885
|
+
/* @__PURE__ */ e("span", { className: "nice-setup-wizard__switch-track" }),
|
|
1886
|
+
/* @__PURE__ */ e("span", { className: "nice-setup-wizard__switch-thumb" })
|
|
1887
|
+
]
|
|
1888
|
+
}
|
|
1889
|
+
)
|
|
1890
|
+
] });
|
|
1891
|
+
break;
|
|
1892
|
+
case "slider":
|
|
1893
|
+
_e = /* @__PURE__ */ c("div", { className: "nice-setup-wizard__slider-wrapper", children: [
|
|
1894
|
+
/* @__PURE__ */ e(
|
|
1895
|
+
"input",
|
|
1896
|
+
{
|
|
1897
|
+
type: "range",
|
|
1898
|
+
...ue,
|
|
1899
|
+
className: "nice-setup-wizard__slider",
|
|
1900
|
+
value: Number(H) || v.validation?.min || 0,
|
|
1901
|
+
min: v.validation?.min,
|
|
1902
|
+
max: v.validation?.max,
|
|
1903
|
+
onChange: (G) => P(Number(G.target.value))
|
|
1904
|
+
}
|
|
1905
|
+
),
|
|
1906
|
+
/* @__PURE__ */ e("span", { className: "nice-setup-wizard__slider-value", children: String(H ?? "") })
|
|
1907
|
+
] });
|
|
1908
|
+
break;
|
|
1909
|
+
default:
|
|
1910
|
+
_e = /* @__PURE__ */ e(
|
|
1911
|
+
"input",
|
|
1912
|
+
{
|
|
1913
|
+
type: v.type === "custom" ? "text" : v.type,
|
|
1914
|
+
...ue,
|
|
1915
|
+
className: "nice-setup-wizard__input",
|
|
1916
|
+
value: String(H),
|
|
1917
|
+
onChange: (G) => P(G.target.value),
|
|
1918
|
+
minLength: v.validation?.minLength,
|
|
1919
|
+
maxLength: v.validation?.maxLength,
|
|
1920
|
+
min: v.validation?.min,
|
|
1921
|
+
max: v.validation?.max,
|
|
1922
|
+
pattern: v.validation?.pattern?.source
|
|
1923
|
+
}
|
|
1924
|
+
);
|
|
1925
|
+
}
|
|
1926
|
+
return /* @__PURE__ */ c(
|
|
1927
|
+
"div",
|
|
1928
|
+
{
|
|
1929
|
+
className: `nice-setup-wizard__field${v.fullWidth ? " nice-setup-wizard__field--full" : ""}`,
|
|
1930
|
+
children: [
|
|
1931
|
+
v.type !== "checkbox" && v.type !== "switch" && /* @__PURE__ */ c("label", { htmlFor: se, className: "nice-setup-wizard__label", children: [
|
|
1932
|
+
v.label,
|
|
1933
|
+
v.required && /* @__PURE__ */ e("span", { className: "nice-setup-wizard__required", children: "*" })
|
|
1934
|
+
] }),
|
|
1935
|
+
_e,
|
|
1936
|
+
v.description && /* @__PURE__ */ e("span", { className: "nice-setup-wizard__field-desc", children: v.description })
|
|
1937
|
+
]
|
|
1938
|
+
},
|
|
1939
|
+
v.id
|
|
1940
|
+
);
|
|
1941
|
+
}, Qe = () => U.fields ? /* @__PURE__ */ e("div", { className: "nice-setup-wizard__fields", children: U.fields.map(Ke) }) : U.content ? typeof U.content == "function" ? U.content(ye) : U.content : null;
|
|
1942
|
+
return /* @__PURE__ */ e(Be.Provider, { value: ye, children: /* @__PURE__ */ c(
|
|
1943
|
+
"div",
|
|
1944
|
+
{
|
|
1945
|
+
ref: k,
|
|
1946
|
+
id: _,
|
|
1947
|
+
className: [
|
|
1948
|
+
"nice-setup-wizard",
|
|
1949
|
+
`nice-setup-wizard--${l}`,
|
|
1950
|
+
`nice-size-${s}`,
|
|
1951
|
+
d !== "none" && `nice-setup-wizard--anim-${d}`,
|
|
1952
|
+
A
|
|
1953
|
+
].filter(Boolean).join(" "),
|
|
1954
|
+
style: S,
|
|
1955
|
+
children: [
|
|
1956
|
+
(g || z || o) && /* @__PURE__ */ c("header", { className: "nice-setup-wizard__header", children: [
|
|
1957
|
+
g && /* @__PURE__ */ e("div", { className: "nice-setup-wizard__branding", children: g }),
|
|
1958
|
+
z,
|
|
1959
|
+
o && /* @__PURE__ */ c("label", { className: "nice-setup-wizard__quick-toggle", children: [
|
|
1960
|
+
/* @__PURE__ */ e("input", { type: "checkbox", checked: Y, onChange: Te }),
|
|
1961
|
+
/* @__PURE__ */ e("span", { children: y.quickMode ?? D("wizard.quickMode", "Quick Setup") })
|
|
1962
|
+
] }),
|
|
1963
|
+
Ae && /* @__PURE__ */ e("span", { className: "nice-setup-wizard__time", children: Ae })
|
|
1964
|
+
] }),
|
|
1965
|
+
l !== "minimal" && /* @__PURE__ */ e("nav", { className: "nice-setup-wizard__nav", role: "tablist", children: W.map(He) }),
|
|
1966
|
+
r && /* @__PURE__ */ e("div", { className: "nice-setup-wizard__progress", children: /* @__PURE__ */ e(
|
|
1967
|
+
"div",
|
|
1968
|
+
{
|
|
1969
|
+
className: "nice-setup-wizard__progress-bar",
|
|
1970
|
+
style: { width: `${ee}%` },
|
|
1971
|
+
role: "progressbar",
|
|
1972
|
+
"aria-valuenow": ee,
|
|
1973
|
+
"aria-valuemin": 0,
|
|
1974
|
+
"aria-valuemax": 100
|
|
1975
|
+
}
|
|
1976
|
+
) }),
|
|
1977
|
+
/* @__PURE__ */ c(
|
|
1978
|
+
"div",
|
|
1979
|
+
{
|
|
1980
|
+
className: [
|
|
1981
|
+
"nice-setup-wizard__content",
|
|
1982
|
+
de === "next" && "nice-setup-wizard__content--slide-next",
|
|
1983
|
+
de === "prev" && "nice-setup-wizard__content--slide-prev"
|
|
1984
|
+
].filter(Boolean).join(" "),
|
|
1985
|
+
role: "tabpanel",
|
|
1986
|
+
children: [
|
|
1987
|
+
U.description && /* @__PURE__ */ e("p", { className: "nice-setup-wizard__step-description", children: U.description }),
|
|
1988
|
+
Qe(),
|
|
1989
|
+
q[U.id] && /* @__PURE__ */ e("div", { className: "nice-setup-wizard__error", role: "alert", children: q[U.id] })
|
|
1990
|
+
]
|
|
1991
|
+
},
|
|
1992
|
+
J
|
|
1993
|
+
),
|
|
1994
|
+
/* @__PURE__ */ c("footer", { className: "nice-setup-wizard__footer", children: [
|
|
1995
|
+
/* @__PURE__ */ c("div", { className: "nice-setup-wizard__actions-left", children: [
|
|
1996
|
+
p && /* @__PURE__ */ e("button", { type: "button", className: "nice-btn nice-btn--text", onClick: Ee, children: y.cancel ?? D("wizard.cancel", "Cancel") }),
|
|
1997
|
+
U.optional && !I && /* @__PURE__ */ e("button", { type: "button", className: "nice-btn nice-btn--text", onClick: De, children: y.skip ?? D("wizard.skip", "Skip") }),
|
|
1998
|
+
U.actions?.filter((v) => v.position === "left").map((v) => /* @__PURE__ */ c(
|
|
1999
|
+
"button",
|
|
2000
|
+
{
|
|
2001
|
+
type: "button",
|
|
2002
|
+
className: `nice-btn nice-btn--${v.variant || "outlined"}`,
|
|
2003
|
+
onClick: () => v.onClick(ye),
|
|
2004
|
+
disabled: v.disabled?.(ye),
|
|
2005
|
+
children: [
|
|
2006
|
+
v.icon,
|
|
2007
|
+
" ",
|
|
2008
|
+
v.label
|
|
2009
|
+
]
|
|
2010
|
+
},
|
|
2011
|
+
v.id
|
|
2012
|
+
))
|
|
2013
|
+
] }),
|
|
2014
|
+
/* @__PURE__ */ c("div", { className: "nice-setup-wizard__actions-right", children: [
|
|
2015
|
+
U.actions?.filter((v) => v.position !== "left").map((v) => /* @__PURE__ */ c(
|
|
2016
|
+
"button",
|
|
2017
|
+
{
|
|
2018
|
+
type: "button",
|
|
2019
|
+
className: `nice-btn nice-btn--${v.variant || "outlined"}`,
|
|
2020
|
+
onClick: () => v.onClick(ye),
|
|
2021
|
+
disabled: v.disabled?.(ye),
|
|
2022
|
+
children: [
|
|
2023
|
+
v.icon,
|
|
2024
|
+
" ",
|
|
2025
|
+
v.label
|
|
2026
|
+
]
|
|
2027
|
+
},
|
|
2028
|
+
v.id
|
|
2029
|
+
)),
|
|
2030
|
+
!E && /* @__PURE__ */ e("button", { type: "button", className: "nice-btn nice-btn--outlined", onClick: Me, children: y.prev ?? D("wizard.prev", "← Back") }),
|
|
2031
|
+
/* @__PURE__ */ e(
|
|
2032
|
+
"button",
|
|
2033
|
+
{
|
|
2034
|
+
type: "button",
|
|
2035
|
+
className: "nice-btn nice-btn--primary",
|
|
2036
|
+
onClick: ze,
|
|
2037
|
+
disabled: ve,
|
|
2038
|
+
children: ve ? /* @__PURE__ */ e("span", { className: "nice-setup-wizard__spinner" }) : I ? y.finish ?? D("wizard.finish", "Finish ✓") : y.next ?? D("wizard.next", "Continue →")
|
|
2039
|
+
}
|
|
2040
|
+
)
|
|
2041
|
+
] })
|
|
2042
|
+
] }),
|
|
2043
|
+
M && /* @__PURE__ */ e("div", { className: "nice-setup-wizard__custom-footer", children: M }),
|
|
2044
|
+
l === "minimal" && /* @__PURE__ */ e("div", { className: "nice-setup-wizard__minimal-indicator", children: y.stepOf ? y.stepOf.replace("{current}", String(Z + 1)).replace("{total}", String(W.length)) : `${Z + 1} / ${W.length}` })
|
|
2045
|
+
]
|
|
2046
|
+
}
|
|
2047
|
+
) });
|
|
2048
|
+
}
|
|
2049
|
+
);
|
|
2050
|
+
vn.displayName = "NiceSetupWizard";
|
|
2051
|
+
const Nn = ne(({
|
|
2052
|
+
label: n,
|
|
2053
|
+
helperText: a,
|
|
2054
|
+
disabled: i,
|
|
2055
|
+
size: l = "md",
|
|
2056
|
+
id: s,
|
|
2057
|
+
className: h,
|
|
2058
|
+
style: o,
|
|
2059
|
+
accessMode: b,
|
|
2060
|
+
logo: r,
|
|
2061
|
+
brandName: t,
|
|
2062
|
+
breadcrumbs: u,
|
|
2063
|
+
centerContent: m,
|
|
2064
|
+
rightContent: w,
|
|
2065
|
+
leftContent: d,
|
|
2066
|
+
sticky: g = !0,
|
|
2067
|
+
variant: z = "light",
|
|
2068
|
+
height: M = "md",
|
|
2069
|
+
onBrandClick: T,
|
|
2070
|
+
displayStyle: f
|
|
2071
|
+
}, $) => {
|
|
2072
|
+
const p = ce(b, s);
|
|
2073
|
+
if (p === "hidden") return null;
|
|
2074
|
+
p === "disabled" && (i = !0);
|
|
2075
|
+
const { t: y } = oe(), x = ie(s), C = Se("menu", f), A = ke("menu", f);
|
|
2076
|
+
return /* @__PURE__ */ c(
|
|
2077
|
+
"nav",
|
|
2078
|
+
{
|
|
2079
|
+
ref: $,
|
|
2080
|
+
id: x,
|
|
2081
|
+
className: `nice-navbar nice-navbar--${z} nice-navbar--h-${M}${g ? " nice-navbar--sticky" : ""} nice-navbar--ds-${A}${h ? ` ${h}` : ""}${i ? " nice-disabled" : ""}`,
|
|
2082
|
+
style: { ...C, ...o },
|
|
2083
|
+
role: "navigation",
|
|
2084
|
+
"aria-label": n ?? y("mainNavigation", "Main navigation"),
|
|
2085
|
+
children: [
|
|
2086
|
+
/* @__PURE__ */ c("div", { className: "nice-navbar__left", children: [
|
|
2087
|
+
d,
|
|
2088
|
+
(r || t) && /* @__PURE__ */ c("div", { className: "nice-navbar__brand", onClick: T, role: T ? "button" : void 0, tabIndex: T ? 0 : void 0, children: [
|
|
2089
|
+
r && /* @__PURE__ */ e("span", { className: "nice-navbar__logo", children: r }),
|
|
2090
|
+
t && /* @__PURE__ */ e("span", { className: "nice-navbar__brand-name", children: t })
|
|
2091
|
+
] }),
|
|
2092
|
+
u && u.length > 0 && /* @__PURE__ */ e("ol", { className: "nice-navbar__breadcrumbs", "aria-label": y("breadcrumbs", "Breadcrumbs"), children: u.map((S, k) => /* @__PURE__ */ c("li", { className: "nice-navbar__breadcrumb", children: [
|
|
2093
|
+
k > 0 && /* @__PURE__ */ e("span", { className: "nice-navbar__breadcrumb-sep", children: "/" }),
|
|
2094
|
+
S.href || S.onClick ? /* @__PURE__ */ e("a", { href: S.href ?? "#", onClick: (N) => {
|
|
2095
|
+
S.onClick && (N.preventDefault(), S.onClick());
|
|
2096
|
+
}, children: S.label }) : /* @__PURE__ */ e("span", { "aria-current": k === u.length - 1 ? "page" : void 0, children: S.label })
|
|
2097
|
+
] }, k)) })
|
|
2098
|
+
] }),
|
|
2099
|
+
m && /* @__PURE__ */ e("div", { className: "nice-navbar__center", children: m }),
|
|
2100
|
+
w && /* @__PURE__ */ e("div", { className: "nice-navbar__right", children: w })
|
|
2101
|
+
]
|
|
2102
|
+
}
|
|
2103
|
+
);
|
|
2104
|
+
});
|
|
2105
|
+
Nn.displayName = "NiceNavbar";
|
|
2106
|
+
const gn = ne(({
|
|
2107
|
+
label: n,
|
|
2108
|
+
helperText: a,
|
|
2109
|
+
disabled: i,
|
|
2110
|
+
readOnly: l,
|
|
2111
|
+
size: s = "md",
|
|
2112
|
+
id: h,
|
|
2113
|
+
className: o,
|
|
2114
|
+
style: b,
|
|
2115
|
+
accessMode: r,
|
|
2116
|
+
tenants: t,
|
|
2117
|
+
currentTenantId: u,
|
|
2118
|
+
onSwitch: m,
|
|
2119
|
+
onManage: w,
|
|
2120
|
+
onCreate: d,
|
|
2121
|
+
variant: g = "dropdown",
|
|
2122
|
+
searchable: z = !1
|
|
2123
|
+
}, M) => {
|
|
2124
|
+
const T = ce(r, h);
|
|
2125
|
+
if (T === "hidden") return null;
|
|
2126
|
+
T === "disabled" && (i = !0), T === "readOnly" && (l = !0);
|
|
2127
|
+
const { t: f } = oe(), $ = ie(h), [p, y] = R(!1), [x, C] = R(""), A = le(() => t.find((N) => N.id === u), [t, u]), S = le(() => {
|
|
2128
|
+
if (!x) return t;
|
|
2129
|
+
const N = x.toLowerCase();
|
|
2130
|
+
return t.filter((D) => D.name.toLowerCase().includes(N));
|
|
2131
|
+
}, [t, x]), k = L((N) => {
|
|
2132
|
+
m?.(N), y(!1), C("");
|
|
2133
|
+
}, [m]);
|
|
2134
|
+
return g === "inline" ? /* @__PURE__ */ c("div", { ref: M, id: $, className: `nice-tenant-switcher nice-tenant-switcher--inline nice-size-${s}${o ? ` ${o}` : ""}${i ? " nice-disabled" : ""}`, style: b, children: [
|
|
2135
|
+
n && /* @__PURE__ */ e("span", { className: "nice-tenant-switcher__label", children: n }),
|
|
2136
|
+
/* @__PURE__ */ e("div", { className: "nice-tenant-switcher__list", children: t.map((N) => /* @__PURE__ */ c(
|
|
2137
|
+
"button",
|
|
2138
|
+
{
|
|
2139
|
+
type: "button",
|
|
2140
|
+
className: `nice-tenant-switcher__option${N.id === u ? " nice-tenant-switcher__option--active" : ""}`,
|
|
2141
|
+
onClick: () => k(N.id),
|
|
2142
|
+
disabled: i || l,
|
|
2143
|
+
children: [
|
|
2144
|
+
N.logoUrl && /* @__PURE__ */ e("img", { src: N.logoUrl, alt: "", className: "nice-tenant-switcher__option-logo" }),
|
|
2145
|
+
/* @__PURE__ */ e("span", { children: N.name })
|
|
2146
|
+
]
|
|
2147
|
+
},
|
|
2148
|
+
N.id
|
|
2149
|
+
)) })
|
|
2150
|
+
] }) : /* @__PURE__ */ c(
|
|
2151
|
+
"div",
|
|
2152
|
+
{
|
|
2153
|
+
ref: M,
|
|
2154
|
+
id: $,
|
|
2155
|
+
className: `nice-tenant-switcher nice-size-${s}${o ? ` ${o}` : ""}${i ? " nice-disabled" : ""}`,
|
|
2156
|
+
style: b,
|
|
2157
|
+
children: [
|
|
2158
|
+
/* @__PURE__ */ c(
|
|
2159
|
+
"button",
|
|
2160
|
+
{
|
|
2161
|
+
type: "button",
|
|
2162
|
+
className: "nice-tenant-switcher__trigger",
|
|
2163
|
+
onClick: () => !i && !l && y(!p),
|
|
2164
|
+
onBlur: () => setTimeout(() => y(!1), 200),
|
|
2165
|
+
disabled: i,
|
|
2166
|
+
"aria-haspopup": "listbox",
|
|
2167
|
+
"aria-expanded": p,
|
|
2168
|
+
children: [
|
|
2169
|
+
A?.logoUrl && /* @__PURE__ */ e("img", { src: A.logoUrl, alt: "", className: "nice-tenant-switcher__trigger-logo" }),
|
|
2170
|
+
/* @__PURE__ */ e("span", { className: "nice-tenant-switcher__trigger-name", children: A?.name ?? f("selectTenant", "Select organization") }),
|
|
2171
|
+
/* @__PURE__ */ e("span", { className: "nice-tenant-switcher__trigger-arrow", children: p ? "▲" : "▼" })
|
|
2172
|
+
]
|
|
2173
|
+
}
|
|
2174
|
+
),
|
|
2175
|
+
p && /* @__PURE__ */ c("div", { className: "nice-tenant-switcher__dropdown", role: "listbox", children: [
|
|
2176
|
+
z && /* @__PURE__ */ e(
|
|
2177
|
+
"input",
|
|
2178
|
+
{
|
|
2179
|
+
type: "text",
|
|
2180
|
+
className: "nice-input nice-tenant-switcher__search",
|
|
2181
|
+
value: x,
|
|
2182
|
+
onChange: (N) => C(N.target.value),
|
|
2183
|
+
placeholder: f("searchOrganizations", "Search…"),
|
|
2184
|
+
autoFocus: !0
|
|
2185
|
+
}
|
|
2186
|
+
),
|
|
2187
|
+
/* @__PURE__ */ c("div", { className: "nice-tenant-switcher__options", children: [
|
|
2188
|
+
S.map((N) => /* @__PURE__ */ c(
|
|
2189
|
+
"div",
|
|
2190
|
+
{
|
|
2191
|
+
className: `nice-tenant-switcher__option${N.id === u ? " nice-tenant-switcher__option--active" : ""}`,
|
|
2192
|
+
role: "option",
|
|
2193
|
+
"aria-selected": N.id === u,
|
|
2194
|
+
onClick: () => k(N.id),
|
|
2195
|
+
children: [
|
|
2196
|
+
N.logoUrl && /* @__PURE__ */ e("img", { src: N.logoUrl, alt: "", className: "nice-tenant-switcher__option-logo" }),
|
|
2197
|
+
/* @__PURE__ */ c("div", { className: "nice-tenant-switcher__option-info", children: [
|
|
2198
|
+
/* @__PURE__ */ e("span", { className: "nice-tenant-switcher__option-name", children: N.name }),
|
|
2199
|
+
N.subtitle && /* @__PURE__ */ e("span", { className: "nice-tenant-switcher__option-subtitle", children: N.subtitle })
|
|
2200
|
+
] }),
|
|
2201
|
+
N.id === u && /* @__PURE__ */ e("span", { className: "nice-tenant-switcher__check", children: "✓" })
|
|
2202
|
+
]
|
|
2203
|
+
},
|
|
2204
|
+
N.id
|
|
2205
|
+
)),
|
|
2206
|
+
S.length === 0 && /* @__PURE__ */ e("div", { className: "nice-tenant-switcher__empty", children: f("noResults", "No results") })
|
|
2207
|
+
] }),
|
|
2208
|
+
(w || d) && /* @__PURE__ */ c("div", { className: "nice-tenant-switcher__footer", children: [
|
|
2209
|
+
w && /* @__PURE__ */ e("button", { type: "button", onClick: w, children: f("manageTenants", "Manage organizations") }),
|
|
2210
|
+
d && /* @__PURE__ */ e("button", { type: "button", onClick: d, children: f("createTenant", "Create organization") })
|
|
2211
|
+
] })
|
|
2212
|
+
] })
|
|
2213
|
+
]
|
|
2214
|
+
}
|
|
2215
|
+
);
|
|
2216
|
+
});
|
|
2217
|
+
gn.displayName = "NiceTenantSwitcher";
|
|
2218
|
+
const fn = {
|
|
2219
|
+
online: "var(--nice-color-success, #5cb85c)",
|
|
2220
|
+
away: "var(--nice-color-warning, #f0ad4e)",
|
|
2221
|
+
busy: "var(--nice-color-error, #d9534f)",
|
|
2222
|
+
offline: "var(--nice-color-muted, #999)"
|
|
2223
|
+
}, yn = ne(({
|
|
2224
|
+
label: n,
|
|
2225
|
+
disabled: a,
|
|
2226
|
+
size: i = "md",
|
|
2227
|
+
id: l,
|
|
2228
|
+
className: s,
|
|
2229
|
+
style: h,
|
|
2230
|
+
accessMode: o,
|
|
2231
|
+
userName: b,
|
|
2232
|
+
userEmail: r,
|
|
2233
|
+
userRole: t,
|
|
2234
|
+
avatarUrl: u,
|
|
2235
|
+
items: m = [],
|
|
2236
|
+
open: w,
|
|
2237
|
+
onOpenChange: d,
|
|
2238
|
+
onProfile: g,
|
|
2239
|
+
onLogout: z,
|
|
2240
|
+
avatarSize: M = 36,
|
|
2241
|
+
status: T
|
|
2242
|
+
}, f) => {
|
|
2243
|
+
const $ = ce(o, l);
|
|
2244
|
+
if ($ === "hidden") return null;
|
|
2245
|
+
$ === "disabled" && (a = !0);
|
|
2246
|
+
const { t: p } = oe(), y = ie(l), [x, C] = R(!1), A = w ?? x, S = L(() => {
|
|
2247
|
+
const _ = !A;
|
|
2248
|
+
C(_), d?.(_);
|
|
2249
|
+
}, [A, d]), k = b.split(" ").map((_) => _.charAt(0)).join("").toUpperCase().slice(0, 2), N = [];
|
|
2250
|
+
g && N.push({ id: "__profile", label: p("profile", "Profile"), onClick: g }), z && N.push({ id: "__divider", label: "", isDivider: !0 }, { id: "__logout", label: p("logout", "Logout"), onClick: z, danger: !0 });
|
|
2251
|
+
const D = m.length > 0 ? m : N;
|
|
2252
|
+
return /* @__PURE__ */ c(
|
|
2253
|
+
"div",
|
|
2254
|
+
{
|
|
2255
|
+
ref: f,
|
|
2256
|
+
id: y,
|
|
2257
|
+
className: `nice-user-menu nice-size-${i}${s ? ` ${s}` : ""}${a ? " nice-disabled" : ""}`,
|
|
2258
|
+
style: h,
|
|
2259
|
+
children: [
|
|
2260
|
+
/* @__PURE__ */ e(
|
|
2261
|
+
"button",
|
|
2262
|
+
{
|
|
2263
|
+
type: "button",
|
|
2264
|
+
className: "nice-user-menu__trigger",
|
|
2265
|
+
onClick: S,
|
|
2266
|
+
onBlur: () => setTimeout(() => {
|
|
2267
|
+
C(!1), d?.(!1);
|
|
2268
|
+
}, 200),
|
|
2269
|
+
disabled: a,
|
|
2270
|
+
"aria-haspopup": "menu",
|
|
2271
|
+
"aria-expanded": A,
|
|
2272
|
+
"aria-label": n ?? b,
|
|
2273
|
+
children: /* @__PURE__ */ c("span", { className: "nice-user-menu__avatar", style: { width: M, height: M }, children: [
|
|
2274
|
+
u ? /* @__PURE__ */ e("img", { src: u, alt: b }) : /* @__PURE__ */ e("span", { className: "nice-user-menu__initials", children: k }),
|
|
2275
|
+
T && /* @__PURE__ */ e("span", { className: "nice-user-menu__status", style: { backgroundColor: fn[T] }, title: T })
|
|
2276
|
+
] })
|
|
2277
|
+
}
|
|
2278
|
+
),
|
|
2279
|
+
A && /* @__PURE__ */ c("div", { className: "nice-user-menu__dropdown", role: "menu", children: [
|
|
2280
|
+
/* @__PURE__ */ c("div", { className: "nice-user-menu__info", children: [
|
|
2281
|
+
/* @__PURE__ */ e("span", { className: "nice-user-menu__name", children: b }),
|
|
2282
|
+
r && /* @__PURE__ */ e("span", { className: "nice-user-menu__email", children: r }),
|
|
2283
|
+
t && /* @__PURE__ */ e("span", { className: "nice-user-menu__role", children: t })
|
|
2284
|
+
] }),
|
|
2285
|
+
D.length > 0 && /* @__PURE__ */ e("div", { className: "nice-user-menu__items", children: D.map(
|
|
2286
|
+
(_) => _.isDivider ? /* @__PURE__ */ e("hr", { className: "nice-user-menu__divider" }, _.id) : /* @__PURE__ */ c(
|
|
2287
|
+
"button",
|
|
2288
|
+
{
|
|
2289
|
+
type: "button",
|
|
2290
|
+
role: "menuitem",
|
|
2291
|
+
className: `nice-user-menu__item${_.danger ? " nice-user-menu__item--danger" : ""}`,
|
|
2292
|
+
onClick: () => {
|
|
2293
|
+
_.onClick?.(), C(!1), d?.(!1);
|
|
2294
|
+
},
|
|
2295
|
+
disabled: _.disabled || a,
|
|
2296
|
+
children: [
|
|
2297
|
+
_.icon && /* @__PURE__ */ e("span", { className: "nice-user-menu__item-icon", children: _.icon }),
|
|
2298
|
+
/* @__PURE__ */ e("span", { children: _.label })
|
|
2299
|
+
]
|
|
2300
|
+
},
|
|
2301
|
+
_.id
|
|
2302
|
+
)
|
|
2303
|
+
) })
|
|
2304
|
+
] })
|
|
2305
|
+
]
|
|
2306
|
+
}
|
|
2307
|
+
);
|
|
2308
|
+
});
|
|
2309
|
+
yn.displayName = "NiceUserMenu";
|
|
2310
|
+
function kn(n, a) {
|
|
2311
|
+
if (!a) return n;
|
|
2312
|
+
const i = a.toLowerCase();
|
|
2313
|
+
return n.map((l) => {
|
|
2314
|
+
const s = l.entities.filter(
|
|
2315
|
+
(o) => o.label.toLowerCase().includes(i) || o.name.toLowerCase().includes(i)
|
|
2316
|
+
);
|
|
2317
|
+
return l.label.toLowerCase().includes(i) || l.name.toLowerCase().includes(i) ? l : s.length > 0 ? { ...l, entities: s } : null;
|
|
2318
|
+
}).filter(Boolean);
|
|
2319
|
+
}
|
|
2320
|
+
const wn = ({ value: n, onChange: a, placeholder: i }) => /* @__PURE__ */ c("div", { className: "nice-dynamic-sidebar__search", children: [
|
|
2321
|
+
/* @__PURE__ */ e("span", { className: "nice-dynamic-sidebar__search-icon", "aria-hidden": !0, children: "🔍" }),
|
|
2322
|
+
/* @__PURE__ */ e(
|
|
2323
|
+
"input",
|
|
2324
|
+
{
|
|
2325
|
+
type: "text",
|
|
2326
|
+
className: "nice-dynamic-sidebar__search-input",
|
|
2327
|
+
value: n,
|
|
2328
|
+
onChange: (l) => a(l.target.value),
|
|
2329
|
+
placeholder: i,
|
|
2330
|
+
"aria-label": i
|
|
2331
|
+
}
|
|
2332
|
+
),
|
|
2333
|
+
n && /* @__PURE__ */ e(
|
|
2334
|
+
"button",
|
|
2335
|
+
{
|
|
2336
|
+
className: "nice-dynamic-sidebar__search-clear",
|
|
2337
|
+
onClick: () => a(""),
|
|
2338
|
+
"aria-label": "Clear",
|
|
2339
|
+
type: "button",
|
|
2340
|
+
children: "×"
|
|
2341
|
+
}
|
|
2342
|
+
)
|
|
2343
|
+
] }), Cn = ({ module: n, activeRoute: a, collapsed: i, expandedModules: l, onToggleModule: s, onNavigate: h }) => {
|
|
2344
|
+
const o = l.has(n.id);
|
|
2345
|
+
return i ? /* @__PURE__ */ e("div", { className: "nice-dynamic-sidebar__module nice-dynamic-sidebar__module--collapsed", title: n.label, children: /* @__PURE__ */ e(
|
|
2346
|
+
"button",
|
|
2347
|
+
{
|
|
2348
|
+
className: `nice-dynamic-sidebar__module-icon ${n.isAvailable ? "" : "nice-dynamic-sidebar__module-icon--disabled"}`,
|
|
2349
|
+
onClick: () => n.isAvailable && n.entities.length > 0 && h(n.entities[0].route, n.entities[0]),
|
|
2350
|
+
disabled: !n.isAvailable,
|
|
2351
|
+
type: "button",
|
|
2352
|
+
children: /* @__PURE__ */ e("span", { children: n.icon || n.label[0] })
|
|
2353
|
+
}
|
|
2354
|
+
) }) : /* @__PURE__ */ c("div", { className: `nice-dynamic-sidebar__module ${n.isAvailable ? "" : "nice-dynamic-sidebar__module--disabled"}`, children: [
|
|
2355
|
+
/* @__PURE__ */ c(
|
|
2356
|
+
"button",
|
|
2357
|
+
{
|
|
2358
|
+
className: `nice-dynamic-sidebar__module-header ${o ? "nice-dynamic-sidebar__module-header--expanded" : ""}`,
|
|
2359
|
+
onClick: () => n.isAvailable && s(n.id),
|
|
2360
|
+
disabled: !n.isAvailable,
|
|
2361
|
+
type: "button",
|
|
2362
|
+
"aria-expanded": o,
|
|
2363
|
+
children: [
|
|
2364
|
+
n.icon && /* @__PURE__ */ e("span", { className: "nice-dynamic-sidebar__module-icon", children: n.icon }),
|
|
2365
|
+
/* @__PURE__ */ e("span", { className: "nice-dynamic-sidebar__module-label", children: n.label }),
|
|
2366
|
+
/* @__PURE__ */ e("span", { className: `nice-dynamic-sidebar__module-chevron ${o ? "nice-dynamic-sidebar__module-chevron--open" : ""}`, children: "▸" })
|
|
2367
|
+
]
|
|
2368
|
+
}
|
|
2369
|
+
),
|
|
2370
|
+
o && /* @__PURE__ */ e("ul", { className: "nice-dynamic-sidebar__entities", role: "list", children: n.entities.map((b) => /* @__PURE__ */ e(
|
|
2371
|
+
"li",
|
|
2372
|
+
{
|
|
2373
|
+
className: `nice-dynamic-sidebar__entity ${a === b.route ? "nice-dynamic-sidebar__entity--active" : ""}`,
|
|
2374
|
+
children: /* @__PURE__ */ c(
|
|
2375
|
+
"button",
|
|
2376
|
+
{
|
|
2377
|
+
className: "nice-dynamic-sidebar__entity-btn",
|
|
2378
|
+
onClick: () => h(b.route, b),
|
|
2379
|
+
type: "button",
|
|
2380
|
+
children: [
|
|
2381
|
+
b.icon && /* @__PURE__ */ e("span", { className: "nice-dynamic-sidebar__entity-icon", children: b.icon }),
|
|
2382
|
+
/* @__PURE__ */ e("span", { children: b.label })
|
|
2383
|
+
]
|
|
2384
|
+
}
|
|
2385
|
+
)
|
|
2386
|
+
},
|
|
2387
|
+
b.id
|
|
2388
|
+
)) })
|
|
2389
|
+
] });
|
|
2390
|
+
}, xn = ({ favorites: n, activeRoute: a, onNavigate: i, label: l }) => n.length === 0 ? null : /* @__PURE__ */ c("div", { className: "nice-dynamic-sidebar__favorites", children: [
|
|
2391
|
+
/* @__PURE__ */ e("div", { className: "nice-dynamic-sidebar__section-title", children: l }),
|
|
2392
|
+
/* @__PURE__ */ e("ul", { role: "list", children: n.map((s) => /* @__PURE__ */ e(
|
|
2393
|
+
"li",
|
|
2394
|
+
{
|
|
2395
|
+
className: `nice-dynamic-sidebar__favorite ${a === s.route ? "nice-dynamic-sidebar__favorite--active" : ""}`,
|
|
2396
|
+
children: /* @__PURE__ */ c(
|
|
2397
|
+
"button",
|
|
2398
|
+
{
|
|
2399
|
+
className: "nice-dynamic-sidebar__favorite-btn",
|
|
2400
|
+
onClick: () => i(s.route),
|
|
2401
|
+
type: "button",
|
|
2402
|
+
children: [
|
|
2403
|
+
s.icon && /* @__PURE__ */ e("span", { children: s.icon }),
|
|
2404
|
+
/* @__PURE__ */ e("span", { children: s.label })
|
|
2405
|
+
]
|
|
2406
|
+
}
|
|
2407
|
+
)
|
|
2408
|
+
},
|
|
2409
|
+
s.id
|
|
2410
|
+
)) })
|
|
2411
|
+
] }), $n = ne(
|
|
2412
|
+
({
|
|
2413
|
+
menu: n,
|
|
2414
|
+
activeRoute: a,
|
|
2415
|
+
collapsed: i,
|
|
2416
|
+
width: l = 260,
|
|
2417
|
+
collapsedWidth: s = 56,
|
|
2418
|
+
searchable: h = !0,
|
|
2419
|
+
showFavorites: o = !0,
|
|
2420
|
+
showQuickActions: b = !0,
|
|
2421
|
+
collapsible: r = !0,
|
|
2422
|
+
onNavigate: t,
|
|
2423
|
+
onCollapseChange: u,
|
|
2424
|
+
onToggleFavorite: m,
|
|
2425
|
+
header: w,
|
|
2426
|
+
footer: d,
|
|
2427
|
+
className: g,
|
|
2428
|
+
style: z,
|
|
2429
|
+
id: M,
|
|
2430
|
+
accessMode: T,
|
|
2431
|
+
...f
|
|
2432
|
+
}, $) => {
|
|
2433
|
+
const p = ie(M), y = ce(T, M), { t: x } = oe(), [C, A] = R(i ?? !1), S = i ?? C, [k, N] = R(""), [D, _] = R(() => {
|
|
2434
|
+
if (a) {
|
|
2435
|
+
const j = n.modules.find((J) => J.entities.some((B) => B.route === a));
|
|
2436
|
+
return j ? /* @__PURE__ */ new Set([j.id]) : /* @__PURE__ */ new Set();
|
|
2437
|
+
}
|
|
2438
|
+
return /* @__PURE__ */ new Set();
|
|
2439
|
+
}), Y = L(() => {
|
|
2440
|
+
const j = !S;
|
|
2441
|
+
A(j), u?.(j);
|
|
2442
|
+
}, [S, u]), K = L((j) => {
|
|
2443
|
+
_((J) => {
|
|
2444
|
+
const B = new Set(J);
|
|
2445
|
+
return B.has(j) ? B.delete(j) : B.add(j), B;
|
|
2446
|
+
});
|
|
2447
|
+
}, []), Q = L(
|
|
2448
|
+
(j, J) => {
|
|
2449
|
+
t?.(j, J);
|
|
2450
|
+
},
|
|
2451
|
+
[t]
|
|
2452
|
+
), W = le(
|
|
2453
|
+
() => kn(n.modules.filter((j) => j.isAvailable).sort((j, J) => j.order - J.order), k),
|
|
2454
|
+
[n.modules, k]
|
|
2455
|
+
), V = S ? s : l;
|
|
2456
|
+
return y === "hidden" ? null : /* @__PURE__ */ c(
|
|
2457
|
+
"nav",
|
|
2458
|
+
{
|
|
2459
|
+
ref: $,
|
|
2460
|
+
id: p,
|
|
2461
|
+
className: `nice-dynamic-sidebar ${S ? "nice-dynamic-sidebar--collapsed" : ""} ${g ?? ""}`,
|
|
2462
|
+
style: { ...z, width: V, minWidth: V },
|
|
2463
|
+
"aria-label": x("nav.sidebar", "Sidebar"),
|
|
2464
|
+
...f,
|
|
2465
|
+
children: [
|
|
2466
|
+
w && /* @__PURE__ */ e("div", { className: "nice-dynamic-sidebar__header", children: w }),
|
|
2467
|
+
r && /* @__PURE__ */ e(
|
|
2468
|
+
"button",
|
|
2469
|
+
{
|
|
2470
|
+
className: "nice-dynamic-sidebar__toggle",
|
|
2471
|
+
onClick: Y,
|
|
2472
|
+
"aria-label": S ? x("expand", "Expand") : x("collapse", "Collapse"),
|
|
2473
|
+
type: "button",
|
|
2474
|
+
children: S ? "▸" : "◂"
|
|
2475
|
+
}
|
|
2476
|
+
),
|
|
2477
|
+
h && !S && /* @__PURE__ */ e(
|
|
2478
|
+
wn,
|
|
2479
|
+
{
|
|
2480
|
+
value: k,
|
|
2481
|
+
onChange: N,
|
|
2482
|
+
placeholder: x("nav.search", "Search")
|
|
2483
|
+
}
|
|
2484
|
+
),
|
|
2485
|
+
o && !S && /* @__PURE__ */ e(
|
|
2486
|
+
xn,
|
|
2487
|
+
{
|
|
2488
|
+
favorites: n.favorites,
|
|
2489
|
+
activeRoute: a,
|
|
2490
|
+
onNavigate: Q,
|
|
2491
|
+
label: x("nav.favorites", "Favorites")
|
|
2492
|
+
}
|
|
2493
|
+
),
|
|
2494
|
+
b && !S && n.quickActions.length > 0 && /* @__PURE__ */ e("div", { className: "nice-dynamic-sidebar__quick-actions", children: n.quickActions.map((j) => /* @__PURE__ */ c(
|
|
2495
|
+
"button",
|
|
2496
|
+
{
|
|
2497
|
+
className: "nice-dynamic-sidebar__quick-action",
|
|
2498
|
+
onClick: () => Q(j.route),
|
|
2499
|
+
title: j.shortcut ? `${j.label} (${j.shortcut})` : j.label,
|
|
2500
|
+
type: "button",
|
|
2501
|
+
children: [
|
|
2502
|
+
j.icon && /* @__PURE__ */ e("span", { children: j.icon }),
|
|
2503
|
+
/* @__PURE__ */ e("span", { children: j.label })
|
|
2504
|
+
]
|
|
2505
|
+
},
|
|
2506
|
+
j.id
|
|
2507
|
+
)) }),
|
|
2508
|
+
/* @__PURE__ */ c("div", { className: "nice-dynamic-sidebar__modules", role: "navigation", children: [
|
|
2509
|
+
W.map((j) => /* @__PURE__ */ e(
|
|
2510
|
+
Cn,
|
|
2511
|
+
{
|
|
2512
|
+
module: j,
|
|
2513
|
+
activeRoute: a,
|
|
2514
|
+
collapsed: S,
|
|
2515
|
+
expandedModules: D,
|
|
2516
|
+
onToggleModule: K,
|
|
2517
|
+
onNavigate: Q
|
|
2518
|
+
},
|
|
2519
|
+
j.id
|
|
2520
|
+
)),
|
|
2521
|
+
W.length === 0 && !S && /* @__PURE__ */ e("div", { className: "nice-dynamic-sidebar__empty", children: x("noData", "No data") })
|
|
2522
|
+
] }),
|
|
2523
|
+
d && /* @__PURE__ */ e("div", { className: "nice-dynamic-sidebar__footer", children: d })
|
|
2524
|
+
]
|
|
2525
|
+
}
|
|
2526
|
+
);
|
|
2527
|
+
}
|
|
2528
|
+
);
|
|
2529
|
+
$n.displayName = "NiceDynamicSidebar";
|
|
2530
|
+
const xe = {
|
|
2531
|
+
all: { icon: "☰", label: "Wszystko" },
|
|
2532
|
+
"by-role": { icon: "👤", label: "Według roli" },
|
|
2533
|
+
"by-unit": { icon: "🏢", label: "Według jednostki" },
|
|
2534
|
+
favorites: { icon: "⭐", label: "Ulubione" },
|
|
2535
|
+
preferences: { icon: "⚙️", label: "Preferencje" }
|
|
2536
|
+
}, Ue = {
|
|
2537
|
+
enableModeIcons: !1,
|
|
2538
|
+
enabledModes: ["all", "by-role", "by-unit", "favorites", "preferences"],
|
|
2539
|
+
activeMode: "all",
|
|
2540
|
+
pinnedSources: {},
|
|
2541
|
+
hiddenItems: [],
|
|
2542
|
+
favorites: [],
|
|
2543
|
+
maxDepth: {},
|
|
2544
|
+
collapsedIds: [],
|
|
2545
|
+
autoExpand: !0
|
|
2546
|
+
};
|
|
2547
|
+
function Pe(n) {
|
|
2548
|
+
return `nice_sidebar_nav_${n ?? "_default"}`;
|
|
2549
|
+
}
|
|
2550
|
+
function Sn(n, a) {
|
|
2551
|
+
const i = {
|
|
2552
|
+
...Ue,
|
|
2553
|
+
userId: n ?? "_default"
|
|
2554
|
+
};
|
|
2555
|
+
if (a && Object.assign(i, a), a && typeof a.activeMode < "u") return i;
|
|
2556
|
+
try {
|
|
2557
|
+
const l = localStorage.getItem(Pe(n));
|
|
2558
|
+
if (l) {
|
|
2559
|
+
const s = JSON.parse(l);
|
|
2560
|
+
return { ...i, ...s, userId: n ?? "_default" };
|
|
2561
|
+
}
|
|
2562
|
+
} catch {
|
|
2563
|
+
}
|
|
2564
|
+
return i;
|
|
2565
|
+
}
|
|
2566
|
+
function zn(n, a, i, l) {
|
|
2567
|
+
const [s, h] = R(() => {
|
|
2568
|
+
const r = Sn(n, i);
|
|
2569
|
+
return a !== void 0 && (r.enableModeIcons = a), r;
|
|
2570
|
+
});
|
|
2571
|
+
re(() => {
|
|
2572
|
+
i && h((r) => ({ ...r, ...i }));
|
|
2573
|
+
}, [i]);
|
|
2574
|
+
const o = L(
|
|
2575
|
+
(r) => {
|
|
2576
|
+
h((t) => {
|
|
2577
|
+
const u = r(t);
|
|
2578
|
+
if (!i?.activeMode)
|
|
2579
|
+
try {
|
|
2580
|
+
localStorage.setItem(Pe(n), JSON.stringify(u));
|
|
2581
|
+
} catch {
|
|
2582
|
+
}
|
|
2583
|
+
return l?.(u), u;
|
|
2584
|
+
});
|
|
2585
|
+
},
|
|
2586
|
+
[n, i, l]
|
|
2587
|
+
), b = le(
|
|
2588
|
+
() => ({
|
|
2589
|
+
setMode: (r) => o((t) => ({ ...t, activeMode: r })),
|
|
2590
|
+
setEnableModeIcons: (r) => o((t) => ({ ...t, enableModeIcons: r })),
|
|
2591
|
+
toggleMode: (r) => o((t) => {
|
|
2592
|
+
if (r === "preferences") return t;
|
|
2593
|
+
const u = t.enabledModes.includes(r);
|
|
2594
|
+
return {
|
|
2595
|
+
...t,
|
|
2596
|
+
enabledModes: u ? t.enabledModes.filter((m) => m !== r) : [...t.enabledModes, r],
|
|
2597
|
+
// If we're hiding the active mode, fall back to 'all'
|
|
2598
|
+
activeMode: !u || t.activeMode !== r ? t.activeMode : "all"
|
|
2599
|
+
};
|
|
2600
|
+
}),
|
|
2601
|
+
pinSource: (r, t) => o((u) => ({
|
|
2602
|
+
...u,
|
|
2603
|
+
pinnedSources: {
|
|
2604
|
+
...u.pinnedSources,
|
|
2605
|
+
[r]: [...u.pinnedSources[r] ?? [], t]
|
|
2606
|
+
}
|
|
2607
|
+
})),
|
|
2608
|
+
unpinSource: (r, t) => o((u) => ({
|
|
2609
|
+
...u,
|
|
2610
|
+
pinnedSources: {
|
|
2611
|
+
...u.pinnedSources,
|
|
2612
|
+
[r]: (u.pinnedSources[r] ?? []).filter((m) => m !== t)
|
|
2613
|
+
}
|
|
2614
|
+
})),
|
|
2615
|
+
hideItem: (r) => o((t) => ({
|
|
2616
|
+
...t,
|
|
2617
|
+
hiddenItems: t.hiddenItems.some((u) => u.id === r.id) ? t.hiddenItems : [...t.hiddenItems, r]
|
|
2618
|
+
})),
|
|
2619
|
+
restoreItem: (r) => o((t) => ({
|
|
2620
|
+
...t,
|
|
2621
|
+
hiddenItems: t.hiddenItems.filter((u) => u.id !== r)
|
|
2622
|
+
})),
|
|
2623
|
+
addFavorite: (r) => o((t) => ({
|
|
2624
|
+
...t,
|
|
2625
|
+
favorites: t.favorites.some((u) => u.id === r.id) ? t.favorites : [...t.favorites, { ...r, addedAt: Date.now() }]
|
|
2626
|
+
})),
|
|
2627
|
+
removeFavorite: (r) => o((t) => ({ ...t, favorites: t.favorites.filter((u) => u.id !== r) })),
|
|
2628
|
+
setMaxDepth: (r, t) => o((u) => ({
|
|
2629
|
+
...u,
|
|
2630
|
+
maxDepth: { ...u.maxDepth, [r]: Math.min(4, Math.max(1, t)) }
|
|
2631
|
+
})),
|
|
2632
|
+
toggleCollapse: (r) => o((t) => ({
|
|
2633
|
+
...t,
|
|
2634
|
+
collapsedIds: t.collapsedIds.includes(r) ? t.collapsedIds.filter((u) => u !== r) : [...t.collapsedIds, r]
|
|
2635
|
+
})),
|
|
2636
|
+
setAutoExpand: (r) => o((t) => ({ ...t, autoExpand: r })),
|
|
2637
|
+
resetAll: () => o(() => ({
|
|
2638
|
+
...Ue,
|
|
2639
|
+
userId: n ?? "_default"
|
|
2640
|
+
}))
|
|
2641
|
+
}),
|
|
2642
|
+
[o, n]
|
|
2643
|
+
);
|
|
2644
|
+
return [s, b];
|
|
2645
|
+
}
|
|
2646
|
+
function Mn({ enabledModes: n, activeMode: a, onSelect: i }) {
|
|
2647
|
+
const l = [
|
|
2648
|
+
...n.filter((s) => s !== "preferences"),
|
|
2649
|
+
"preferences"
|
|
2650
|
+
];
|
|
2651
|
+
return /* @__PURE__ */ e("div", { className: "nice-sidebar-nav__mode-strip", role: "tablist", "aria-label": "Tryb nawigacji", children: l.map((s) => {
|
|
2652
|
+
const h = xe[s], o = a === s;
|
|
2653
|
+
return /* @__PURE__ */ e(
|
|
2654
|
+
"button",
|
|
2655
|
+
{
|
|
2656
|
+
role: "tab",
|
|
2657
|
+
"aria-selected": o,
|
|
2658
|
+
"aria-label": h.label,
|
|
2659
|
+
title: h.label,
|
|
2660
|
+
className: [
|
|
2661
|
+
"nice-sidebar-nav__mode-btn",
|
|
2662
|
+
o ? "nice-sidebar-nav__mode-btn--active" : ""
|
|
2663
|
+
].filter(Boolean).join(" "),
|
|
2664
|
+
onClick: () => i(s),
|
|
2665
|
+
children: /* @__PURE__ */ e("span", { className: "nice-sidebar-nav__mode-icon", "aria-hidden": "true", children: h.icon })
|
|
2666
|
+
},
|
|
2667
|
+
s
|
|
2668
|
+
);
|
|
2669
|
+
}) });
|
|
2670
|
+
}
|
|
2671
|
+
function Ve({
|
|
2672
|
+
item: n,
|
|
2673
|
+
depth: a,
|
|
2674
|
+
maxDepth: i,
|
|
2675
|
+
activeRoute: l,
|
|
2676
|
+
collapsedIds: s,
|
|
2677
|
+
hiddenIds: h,
|
|
2678
|
+
autoExpand: o,
|
|
2679
|
+
onNavigate: b,
|
|
2680
|
+
onHide: r,
|
|
2681
|
+
onToggleCollapse: t,
|
|
2682
|
+
onAddFavorite: u,
|
|
2683
|
+
isFavorite: m
|
|
2684
|
+
}) {
|
|
2685
|
+
if (h.has(n.id)) return null;
|
|
2686
|
+
const w = (n.children?.length ?? 0) > 0 && a < i, d = s.includes(n.id), g = o ? !d : d, z = !!(n.route && l && n.route === l), M = !!n.route;
|
|
2687
|
+
function T() {
|
|
2688
|
+
M && n.route ? b?.(n.route, n) : w && t(n.id);
|
|
2689
|
+
}
|
|
2690
|
+
return /* @__PURE__ */ c(
|
|
2691
|
+
"li",
|
|
2692
|
+
{
|
|
2693
|
+
className: [
|
|
2694
|
+
"nice-sidebar-nav__node",
|
|
2695
|
+
`nice-sidebar-nav__node--depth-${a}`,
|
|
2696
|
+
z ? "nice-sidebar-nav__node--active" : "",
|
|
2697
|
+
w ? "nice-sidebar-nav__node--branch" : "nice-sidebar-nav__node--leaf"
|
|
2698
|
+
].filter(Boolean).join(" "),
|
|
2699
|
+
children: [
|
|
2700
|
+
/* @__PURE__ */ c("div", { className: "nice-sidebar-nav__node-row", children: [
|
|
2701
|
+
w && /* @__PURE__ */ e(
|
|
2702
|
+
"button",
|
|
2703
|
+
{
|
|
2704
|
+
className: "nice-sidebar-nav__collapse-btn",
|
|
2705
|
+
"aria-label": g ? "Zwiń" : "Rozwiń",
|
|
2706
|
+
"aria-expanded": g,
|
|
2707
|
+
onClick: () => t(n.id),
|
|
2708
|
+
children: /* @__PURE__ */ e("span", { "aria-hidden": "true", children: g ? "▾" : "▸" })
|
|
2709
|
+
}
|
|
2710
|
+
),
|
|
2711
|
+
!w && /* @__PURE__ */ e("span", { className: "nice-sidebar-nav__collapse-spacer" }),
|
|
2712
|
+
/* @__PURE__ */ c(
|
|
2713
|
+
"span",
|
|
2714
|
+
{
|
|
2715
|
+
role: M ? "link" : void 0,
|
|
2716
|
+
tabIndex: M ? 0 : void 0,
|
|
2717
|
+
className: [
|
|
2718
|
+
"nice-sidebar-nav__node-content",
|
|
2719
|
+
M ? "nice-sidebar-nav__node-content--link" : ""
|
|
2720
|
+
].filter(Boolean).join(" "),
|
|
2721
|
+
onClick: T,
|
|
2722
|
+
onKeyDown: (f) => (f.key === "Enter" || f.key === " ") && T(),
|
|
2723
|
+
children: [
|
|
2724
|
+
n.icon && /* @__PURE__ */ e("span", { className: "nice-sidebar-nav__node-icon", "aria-hidden": "true", children: n.icon }),
|
|
2725
|
+
/* @__PURE__ */ e("span", { className: "nice-sidebar-nav__node-label", children: n.label }),
|
|
2726
|
+
n.badge !== void 0 && /* @__PURE__ */ e("span", { className: "nice-sidebar-nav__node-badge", "aria-label": `${n.badge} powiadomień`, children: n.badge })
|
|
2727
|
+
]
|
|
2728
|
+
}
|
|
2729
|
+
),
|
|
2730
|
+
/* @__PURE__ */ c("div", { className: "nice-sidebar-nav__node-actions", children: [
|
|
2731
|
+
M && !m(n.id) && /* @__PURE__ */ e(
|
|
2732
|
+
"button",
|
|
2733
|
+
{
|
|
2734
|
+
className: "nice-sidebar-nav__action-btn nice-sidebar-nav__action-btn--fav",
|
|
2735
|
+
"aria-label": "Dodaj do ulubionych",
|
|
2736
|
+
title: "Dodaj do ulubionych",
|
|
2737
|
+
onClick: (f) => {
|
|
2738
|
+
f.stopPropagation(), u({
|
|
2739
|
+
id: n.id,
|
|
2740
|
+
label: n.label,
|
|
2741
|
+
icon: n.icon,
|
|
2742
|
+
route: n.route,
|
|
2743
|
+
sourceId: n.sourceId,
|
|
2744
|
+
moduleId: n.moduleId,
|
|
2745
|
+
addedAt: Date.now()
|
|
2746
|
+
});
|
|
2747
|
+
},
|
|
2748
|
+
children: "☆"
|
|
2749
|
+
}
|
|
2750
|
+
),
|
|
2751
|
+
m(n.id) && /* @__PURE__ */ e(
|
|
2752
|
+
"span",
|
|
2753
|
+
{
|
|
2754
|
+
className: "nice-sidebar-nav__action-btn nice-sidebar-nav__action-btn--fav-active",
|
|
2755
|
+
"aria-label": "W ulubionych",
|
|
2756
|
+
title: "W ulubionych",
|
|
2757
|
+
children: "⭐"
|
|
2758
|
+
}
|
|
2759
|
+
),
|
|
2760
|
+
/* @__PURE__ */ e(
|
|
2761
|
+
"button",
|
|
2762
|
+
{
|
|
2763
|
+
className: "nice-sidebar-nav__action-btn nice-sidebar-nav__action-btn--hide",
|
|
2764
|
+
"aria-label": "Ukryj element",
|
|
2765
|
+
title: "Ukryj",
|
|
2766
|
+
onClick: (f) => {
|
|
2767
|
+
f.stopPropagation(), r({ id: n.id, kind: n.kind, label: n.label });
|
|
2768
|
+
},
|
|
2769
|
+
children: "👁"
|
|
2770
|
+
}
|
|
2771
|
+
)
|
|
2772
|
+
] })
|
|
2773
|
+
] }),
|
|
2774
|
+
w && g && /* @__PURE__ */ e("ul", { className: "nice-sidebar-nav__children", children: n.children.map((f) => /* @__PURE__ */ e(
|
|
2775
|
+
Ve,
|
|
2776
|
+
{
|
|
2777
|
+
item: f,
|
|
2778
|
+
depth: a + 1,
|
|
2779
|
+
maxDepth: i,
|
|
2780
|
+
activeRoute: l,
|
|
2781
|
+
collapsedIds: s,
|
|
2782
|
+
hiddenIds: h,
|
|
2783
|
+
autoExpand: o,
|
|
2784
|
+
onNavigate: b,
|
|
2785
|
+
onHide: r,
|
|
2786
|
+
onToggleCollapse: t,
|
|
2787
|
+
onAddFavorite: u,
|
|
2788
|
+
isFavorite: m
|
|
2789
|
+
},
|
|
2790
|
+
f.id
|
|
2791
|
+
)) })
|
|
2792
|
+
]
|
|
2793
|
+
}
|
|
2794
|
+
);
|
|
2795
|
+
}
|
|
2796
|
+
function Dn(n, a) {
|
|
2797
|
+
return n.map((i) => ({
|
|
2798
|
+
id: i.id,
|
|
2799
|
+
label: i.label,
|
|
2800
|
+
icon: i.icon,
|
|
2801
|
+
kind: "module",
|
|
2802
|
+
sourceId: a,
|
|
2803
|
+
children: i.views.map((l) => ({
|
|
2804
|
+
id: l.id,
|
|
2805
|
+
label: l.label,
|
|
2806
|
+
icon: l.icon,
|
|
2807
|
+
route: l.route,
|
|
2808
|
+
badge: l.badge,
|
|
2809
|
+
kind: "view",
|
|
2810
|
+
sourceId: a,
|
|
2811
|
+
moduleId: i.id,
|
|
2812
|
+
children: []
|
|
2813
|
+
}))
|
|
2814
|
+
}));
|
|
2815
|
+
}
|
|
2816
|
+
function En(n, a) {
|
|
2817
|
+
return n.map((i) => ({
|
|
2818
|
+
id: i.id,
|
|
2819
|
+
label: i.label,
|
|
2820
|
+
icon: i.icon,
|
|
2821
|
+
kind: "role",
|
|
2822
|
+
sourceId: a,
|
|
2823
|
+
children: i.modules.map((l) => ({
|
|
2824
|
+
id: `${i.id}:${l.id}`,
|
|
2825
|
+
label: l.label,
|
|
2826
|
+
icon: l.icon,
|
|
2827
|
+
kind: "module",
|
|
2828
|
+
sourceId: a,
|
|
2829
|
+
children: l.views.map((s) => ({
|
|
2830
|
+
id: s.id,
|
|
2831
|
+
label: s.label,
|
|
2832
|
+
icon: s.icon,
|
|
2833
|
+
route: s.route,
|
|
2834
|
+
badge: s.badge,
|
|
2835
|
+
kind: "view",
|
|
2836
|
+
sourceId: a,
|
|
2837
|
+
moduleId: l.id,
|
|
2838
|
+
children: []
|
|
2839
|
+
}))
|
|
2840
|
+
}))
|
|
2841
|
+
}));
|
|
2842
|
+
}
|
|
2843
|
+
function Tn(n, a) {
|
|
2844
|
+
return n.map((i) => ({
|
|
2845
|
+
id: i.id,
|
|
2846
|
+
label: i.label,
|
|
2847
|
+
icon: i.icon,
|
|
2848
|
+
kind: "unit",
|
|
2849
|
+
sourceId: a,
|
|
2850
|
+
children: i.modules.map((l) => ({
|
|
2851
|
+
id: `${i.id}:${l.id}`,
|
|
2852
|
+
label: l.label,
|
|
2853
|
+
icon: l.icon,
|
|
2854
|
+
kind: "module",
|
|
2855
|
+
sourceId: a,
|
|
2856
|
+
children: l.views.map((s) => ({
|
|
2857
|
+
id: s.id,
|
|
2858
|
+
label: s.label,
|
|
2859
|
+
icon: s.icon,
|
|
2860
|
+
route: s.route,
|
|
2861
|
+
badge: s.badge,
|
|
2862
|
+
kind: "view",
|
|
2863
|
+
sourceId: a,
|
|
2864
|
+
moduleId: l.id,
|
|
2865
|
+
children: []
|
|
2866
|
+
}))
|
|
2867
|
+
}))
|
|
2868
|
+
}));
|
|
2869
|
+
}
|
|
2870
|
+
function In({
|
|
2871
|
+
node: n,
|
|
2872
|
+
mode: a,
|
|
2873
|
+
maxDepth: i,
|
|
2874
|
+
isPinned: l,
|
|
2875
|
+
prefs: s,
|
|
2876
|
+
helpers: h,
|
|
2877
|
+
activeRoute: o,
|
|
2878
|
+
onNavigate: b
|
|
2879
|
+
}) {
|
|
2880
|
+
const r = le(() => new Set(s.hiddenItems.map((m) => m.id)), [s.hiddenItems]), t = le(() => a === "all" ? Dn(n.modules, n.source.id) : a === "by-role" ? En(n.roles, n.source.id) : Tn(n.units, n.source.id), [a, n]), u = L(
|
|
2881
|
+
(m) => s.favorites.some((w) => w.id === m),
|
|
2882
|
+
[s.favorites]
|
|
2883
|
+
);
|
|
2884
|
+
return r.has(n.source.id) ? null : /* @__PURE__ */ c("section", { className: "nice-sidebar-nav__source-section", children: [
|
|
2885
|
+
/* @__PURE__ */ c("div", { className: "nice-sidebar-nav__source-header", children: [
|
|
2886
|
+
n.source.icon && /* @__PURE__ */ e("span", { className: "nice-sidebar-nav__source-icon", "aria-hidden": "true", children: n.source.icon }),
|
|
2887
|
+
/* @__PURE__ */ e("span", { className: "nice-sidebar-nav__source-label", children: n.source.label }),
|
|
2888
|
+
/* @__PURE__ */ c("div", { className: "nice-sidebar-nav__source-actions", children: [
|
|
2889
|
+
/* @__PURE__ */ e(
|
|
2890
|
+
"button",
|
|
2891
|
+
{
|
|
2892
|
+
className: [
|
|
2893
|
+
"nice-sidebar-nav__action-btn nice-sidebar-nav__action-btn--pin",
|
|
2894
|
+
l ? "nice-sidebar-nav__action-btn--pin-active" : ""
|
|
2895
|
+
].filter(Boolean).join(" "),
|
|
2896
|
+
"aria-label": l ? "Odepnij źródło" : "Przypnij źródło",
|
|
2897
|
+
title: l ? "Odepnij" : "Przypnij",
|
|
2898
|
+
onClick: () => l ? h.unpinSource(a, n.source.id) : h.pinSource(a, n.source.id),
|
|
2899
|
+
children: l ? "📌" : "📍"
|
|
2900
|
+
}
|
|
2901
|
+
),
|
|
2902
|
+
/* @__PURE__ */ e(
|
|
2903
|
+
"button",
|
|
2904
|
+
{
|
|
2905
|
+
className: "nice-sidebar-nav__action-btn nice-sidebar-nav__action-btn--hide",
|
|
2906
|
+
"aria-label": "Ukryj źródło",
|
|
2907
|
+
title: "Ukryj",
|
|
2908
|
+
onClick: () => h.hideItem({
|
|
2909
|
+
id: n.source.id,
|
|
2910
|
+
kind: "source",
|
|
2911
|
+
label: n.source.label
|
|
2912
|
+
}),
|
|
2913
|
+
children: "👁"
|
|
2914
|
+
}
|
|
2915
|
+
)
|
|
2916
|
+
] })
|
|
2917
|
+
] }),
|
|
2918
|
+
i > 1 && /* @__PURE__ */ e("ul", { className: "nice-sidebar-nav__tree", children: t.map((m) => /* @__PURE__ */ e(
|
|
2919
|
+
Ve,
|
|
2920
|
+
{
|
|
2921
|
+
item: m,
|
|
2922
|
+
depth: 2,
|
|
2923
|
+
maxDepth: i,
|
|
2924
|
+
activeRoute: o,
|
|
2925
|
+
collapsedIds: s.collapsedIds,
|
|
2926
|
+
hiddenIds: r,
|
|
2927
|
+
autoExpand: s.autoExpand,
|
|
2928
|
+
onNavigate: b,
|
|
2929
|
+
onHide: h.hideItem,
|
|
2930
|
+
onToggleCollapse: h.toggleCollapse,
|
|
2931
|
+
onAddFavorite: h.addFavorite,
|
|
2932
|
+
isFavorite: u
|
|
2933
|
+
},
|
|
2934
|
+
m.id
|
|
2935
|
+
)) })
|
|
2936
|
+
] });
|
|
2937
|
+
}
|
|
2938
|
+
function Ln({ favorites: n, activeRoute: a, onNavigate: i, onRemove: l }) {
|
|
2939
|
+
return n.length === 0 ? /* @__PURE__ */ e("p", { className: "nice-sidebar-nav__empty", children: "Brak ulubionych. Najedź na element i kliknij ☆, aby dodać." }) : /* @__PURE__ */ e("ul", { className: "nice-sidebar-nav__favorites-list", children: n.map((s) => {
|
|
2940
|
+
const h = !!(s.route && s.route === a);
|
|
2941
|
+
return /* @__PURE__ */ c(
|
|
2942
|
+
"li",
|
|
2943
|
+
{
|
|
2944
|
+
className: [
|
|
2945
|
+
"nice-sidebar-nav__fav-item",
|
|
2946
|
+
h ? "nice-sidebar-nav__fav-item--active" : ""
|
|
2947
|
+
].filter(Boolean).join(" "),
|
|
2948
|
+
children: [
|
|
2949
|
+
/* @__PURE__ */ c(
|
|
2950
|
+
"span",
|
|
2951
|
+
{
|
|
2952
|
+
role: "link",
|
|
2953
|
+
tabIndex: 0,
|
|
2954
|
+
className: "nice-sidebar-nav__fav-content",
|
|
2955
|
+
onClick: () => {
|
|
2956
|
+
s.route && i?.(s.route, s);
|
|
2957
|
+
},
|
|
2958
|
+
onKeyDown: (o) => {
|
|
2959
|
+
(o.key === "Enter" || o.key === " ") && s.route && i?.(s.route, s);
|
|
2960
|
+
},
|
|
2961
|
+
children: [
|
|
2962
|
+
s.icon && /* @__PURE__ */ e("span", { className: "nice-sidebar-nav__fav-icon", "aria-hidden": "true", children: s.icon }),
|
|
2963
|
+
/* @__PURE__ */ e("span", { className: "nice-sidebar-nav__fav-label", children: s.label })
|
|
2964
|
+
]
|
|
2965
|
+
}
|
|
2966
|
+
),
|
|
2967
|
+
/* @__PURE__ */ e(
|
|
2968
|
+
"button",
|
|
2969
|
+
{
|
|
2970
|
+
className: "nice-sidebar-nav__action-btn nice-sidebar-nav__action-btn--remove",
|
|
2971
|
+
"aria-label": "Usuń z ulubionych",
|
|
2972
|
+
title: "Usuń z ulubionych",
|
|
2973
|
+
onClick: () => l(s.id),
|
|
2974
|
+
children: "✕"
|
|
2975
|
+
}
|
|
2976
|
+
)
|
|
2977
|
+
]
|
|
2978
|
+
},
|
|
2979
|
+
s.id
|
|
2980
|
+
);
|
|
2981
|
+
}) });
|
|
2982
|
+
}
|
|
2983
|
+
const je = ["all", "by-role", "by-unit", "favorites"];
|
|
2984
|
+
function On({ prefs: n, helpers: a }) {
|
|
2985
|
+
return /* @__PURE__ */ c("div", { className: "nice-sidebar-nav__prefs", children: [
|
|
2986
|
+
/* @__PURE__ */ e("h3", { className: "nice-sidebar-nav__prefs-title", children: "Preferencje" }),
|
|
2987
|
+
/* @__PURE__ */ c("section", { className: "nice-sidebar-nav__prefs-section", children: [
|
|
2988
|
+
/* @__PURE__ */ e("h4", { className: "nice-sidebar-nav__prefs-section-title", children: "Tryb wyświetlania" }),
|
|
2989
|
+
/* @__PURE__ */ c("label", { className: "nice-sidebar-nav__prefs-row", children: [
|
|
2990
|
+
/* @__PURE__ */ e("span", { children: "Pokaż ikony trybów" }),
|
|
2991
|
+
/* @__PURE__ */ e(
|
|
2992
|
+
"input",
|
|
2993
|
+
{
|
|
2994
|
+
type: "checkbox",
|
|
2995
|
+
checked: n.enableModeIcons,
|
|
2996
|
+
onChange: (i) => a.setEnableModeIcons(i.target.checked)
|
|
2997
|
+
}
|
|
2998
|
+
)
|
|
2999
|
+
] }),
|
|
3000
|
+
je.map((i) => {
|
|
3001
|
+
const l = xe[i], s = n.enabledModes.includes(i);
|
|
3002
|
+
return /* @__PURE__ */ c("label", { className: "nice-sidebar-nav__prefs-row", children: [
|
|
3003
|
+
/* @__PURE__ */ c("span", { children: [
|
|
3004
|
+
l.icon,
|
|
3005
|
+
" ",
|
|
3006
|
+
l.label
|
|
3007
|
+
] }),
|
|
3008
|
+
/* @__PURE__ */ e("input", { type: "checkbox", checked: s, onChange: () => a.toggleMode(i) })
|
|
3009
|
+
] }, i);
|
|
3010
|
+
})
|
|
3011
|
+
] }),
|
|
3012
|
+
/* @__PURE__ */ c("section", { className: "nice-sidebar-nav__prefs-section", children: [
|
|
3013
|
+
/* @__PURE__ */ e("h4", { className: "nice-sidebar-nav__prefs-section-title", children: "Głębokość drzewa" }),
|
|
3014
|
+
je.map((i) => {
|
|
3015
|
+
const l = xe[i], s = n.maxDepth[i] ?? 4;
|
|
3016
|
+
return /* @__PURE__ */ c("div", { className: "nice-sidebar-nav__prefs-row", children: [
|
|
3017
|
+
/* @__PURE__ */ c("span", { children: [
|
|
3018
|
+
l.icon,
|
|
3019
|
+
" ",
|
|
3020
|
+
l.label
|
|
3021
|
+
] }),
|
|
3022
|
+
/* @__PURE__ */ c("div", { className: "nice-sidebar-nav__depth-control", children: [
|
|
3023
|
+
/* @__PURE__ */ e(
|
|
3024
|
+
"input",
|
|
3025
|
+
{
|
|
3026
|
+
type: "range",
|
|
3027
|
+
min: 1,
|
|
3028
|
+
max: 4,
|
|
3029
|
+
value: s,
|
|
3030
|
+
onChange: (h) => a.setMaxDepth(i, Number(h.target.value)),
|
|
3031
|
+
"aria-label": `Głębokość dla trybu ${l.label}`
|
|
3032
|
+
}
|
|
3033
|
+
),
|
|
3034
|
+
/* @__PURE__ */ e("span", { className: "nice-sidebar-nav__depth-value", children: s })
|
|
3035
|
+
] })
|
|
3036
|
+
] }, i);
|
|
3037
|
+
})
|
|
3038
|
+
] }),
|
|
3039
|
+
/* @__PURE__ */ c("section", { className: "nice-sidebar-nav__prefs-section", children: [
|
|
3040
|
+
/* @__PURE__ */ e("h4", { className: "nice-sidebar-nav__prefs-section-title", children: "Zachowanie drzewa" }),
|
|
3041
|
+
/* @__PURE__ */ c("label", { className: "nice-sidebar-nav__prefs-row", children: [
|
|
3042
|
+
/* @__PURE__ */ e("span", { children: "Domyślnie rozwiń wszystko" }),
|
|
3043
|
+
/* @__PURE__ */ e(
|
|
3044
|
+
"input",
|
|
3045
|
+
{
|
|
3046
|
+
type: "checkbox",
|
|
3047
|
+
checked: n.autoExpand,
|
|
3048
|
+
onChange: (i) => a.setAutoExpand(i.target.checked)
|
|
3049
|
+
}
|
|
3050
|
+
)
|
|
3051
|
+
] })
|
|
3052
|
+
] }),
|
|
3053
|
+
n.hiddenItems.length > 0 && /* @__PURE__ */ c("section", { className: "nice-sidebar-nav__prefs-section", children: [
|
|
3054
|
+
/* @__PURE__ */ e("h4", { className: "nice-sidebar-nav__prefs-section-title", children: "Ukryte elementy" }),
|
|
3055
|
+
/* @__PURE__ */ e("ul", { className: "nice-sidebar-nav__hidden-list", children: n.hiddenItems.map((i) => /* @__PURE__ */ c("li", { className: "nice-sidebar-nav__hidden-item", children: [
|
|
3056
|
+
/* @__PURE__ */ c("span", { className: "nice-sidebar-nav__hidden-label", children: [
|
|
3057
|
+
/* @__PURE__ */ c("span", { className: "nice-sidebar-nav__hidden-kind", children: [
|
|
3058
|
+
"[",
|
|
3059
|
+
i.kind,
|
|
3060
|
+
"]"
|
|
3061
|
+
] }),
|
|
3062
|
+
" ",
|
|
3063
|
+
i.label
|
|
3064
|
+
] }),
|
|
3065
|
+
/* @__PURE__ */ e(
|
|
3066
|
+
"button",
|
|
3067
|
+
{
|
|
3068
|
+
className: "nice-sidebar-nav__action-btn",
|
|
3069
|
+
onClick: () => a.restoreItem(i.id),
|
|
3070
|
+
"aria-label": `Przywróć ${i.label}`,
|
|
3071
|
+
title: "Przywróć",
|
|
3072
|
+
children: "↩"
|
|
3073
|
+
}
|
|
3074
|
+
)
|
|
3075
|
+
] }, i.id)) })
|
|
3076
|
+
] }),
|
|
3077
|
+
/* @__PURE__ */ e("section", { className: "nice-sidebar-nav__prefs-section", children: /* @__PURE__ */ e(
|
|
3078
|
+
"button",
|
|
3079
|
+
{
|
|
3080
|
+
className: "nice-sidebar-nav__btn-reset",
|
|
3081
|
+
onClick: a.resetAll,
|
|
3082
|
+
"aria-label": "Zresetuj wszystkie preferencje",
|
|
3083
|
+
children: "Resetuj wszystkie preferencje"
|
|
3084
|
+
}
|
|
3085
|
+
) })
|
|
3086
|
+
] });
|
|
3087
|
+
}
|
|
3088
|
+
const ma = ne(
|
|
3089
|
+
function({
|
|
3090
|
+
data: a,
|
|
3091
|
+
userId: i,
|
|
3092
|
+
activeRoute: l,
|
|
3093
|
+
onNavigate: s,
|
|
3094
|
+
enableModeIcons: h,
|
|
3095
|
+
preferences: o,
|
|
3096
|
+
onPreferencesChange: b,
|
|
3097
|
+
width: r = 264,
|
|
3098
|
+
size: t = "md",
|
|
3099
|
+
className: u,
|
|
3100
|
+
"data-testid": m
|
|
3101
|
+
}, w) {
|
|
3102
|
+
const [d, g] = zn(
|
|
3103
|
+
i,
|
|
3104
|
+
h,
|
|
3105
|
+
o,
|
|
3106
|
+
b
|
|
3107
|
+
), z = le(() => {
|
|
3108
|
+
const $ = d.activeMode;
|
|
3109
|
+
if ($ === "favorites" || $ === "preferences") return a;
|
|
3110
|
+
const p = d.pinnedSources[$];
|
|
3111
|
+
return !p || p.length === 0 ? a : a.filter((y) => p.includes(y.source.id));
|
|
3112
|
+
}, [a, d.activeMode, d.pinnedSources]), M = d.maxDepth[d.activeMode] ?? 4;
|
|
3113
|
+
function T() {
|
|
3114
|
+
const $ = d.activeMode;
|
|
3115
|
+
return $ === "favorites" ? /* @__PURE__ */ e(
|
|
3116
|
+
Ln,
|
|
3117
|
+
{
|
|
3118
|
+
favorites: d.favorites,
|
|
3119
|
+
activeRoute: l,
|
|
3120
|
+
onNavigate: s,
|
|
3121
|
+
onRemove: g.removeFavorite
|
|
3122
|
+
}
|
|
3123
|
+
) : $ === "preferences" ? /* @__PURE__ */ e(On, { prefs: d, helpers: g }) : z.length === 0 ? /* @__PURE__ */ e("p", { className: "nice-sidebar-nav__empty", children: "Brak widocznych źródeł danych dla tego trybu." }) : z.map((p) => {
|
|
3124
|
+
const y = (d.pinnedSources[$] ?? []).includes(p.source.id);
|
|
3125
|
+
return /* @__PURE__ */ e(
|
|
3126
|
+
In,
|
|
3127
|
+
{
|
|
3128
|
+
node: p,
|
|
3129
|
+
mode: $,
|
|
3130
|
+
maxDepth: M,
|
|
3131
|
+
isPinned: y,
|
|
3132
|
+
prefs: d,
|
|
3133
|
+
helpers: g,
|
|
3134
|
+
activeRoute: l,
|
|
3135
|
+
onNavigate: s
|
|
3136
|
+
},
|
|
3137
|
+
p.source.id
|
|
3138
|
+
);
|
|
3139
|
+
});
|
|
3140
|
+
}
|
|
3141
|
+
const f = [
|
|
3142
|
+
"nice-sidebar-nav",
|
|
3143
|
+
`nice-sidebar-nav--${t}`,
|
|
3144
|
+
d.enableModeIcons ? "nice-sidebar-nav--with-strip" : "",
|
|
3145
|
+
u
|
|
3146
|
+
].filter(Boolean).join(" ");
|
|
3147
|
+
return /* @__PURE__ */ c(
|
|
3148
|
+
"div",
|
|
3149
|
+
{
|
|
3150
|
+
ref: w,
|
|
3151
|
+
className: f,
|
|
3152
|
+
style: { width: r },
|
|
3153
|
+
"data-testid": m,
|
|
3154
|
+
"data-mode": d.activeMode,
|
|
3155
|
+
children: [
|
|
3156
|
+
d.enableModeIcons && /* @__PURE__ */ e(
|
|
3157
|
+
Mn,
|
|
3158
|
+
{
|
|
3159
|
+
enabledModes: d.enabledModes,
|
|
3160
|
+
activeMode: d.activeMode,
|
|
3161
|
+
onSelect: g.setMode
|
|
3162
|
+
}
|
|
3163
|
+
),
|
|
3164
|
+
/* @__PURE__ */ c("div", { className: "nice-sidebar-nav__content", children: [
|
|
3165
|
+
!d.enableModeIcons && d.activeMode !== "favorites" && d.activeMode !== "preferences" && /* @__PURE__ */ c("div", { className: "nice-sidebar-nav__mode-inline-actions", children: [
|
|
3166
|
+
["all", "by-role", "by-unit", "favorites"].map(($) => {
|
|
3167
|
+
const p = xe[$], y = d.activeMode === $;
|
|
3168
|
+
return !d.enabledModes.includes($) && $ !== "all" ? null : /* @__PURE__ */ c(
|
|
3169
|
+
"button",
|
|
3170
|
+
{
|
|
3171
|
+
className: [
|
|
3172
|
+
"nice-sidebar-nav__mode-pill",
|
|
3173
|
+
y ? "nice-sidebar-nav__mode-pill--active" : ""
|
|
3174
|
+
].filter(Boolean).join(" "),
|
|
3175
|
+
onClick: () => g.setMode($),
|
|
3176
|
+
"aria-label": p.label,
|
|
3177
|
+
title: p.label,
|
|
3178
|
+
children: [
|
|
3179
|
+
p.icon,
|
|
3180
|
+
" ",
|
|
3181
|
+
/* @__PURE__ */ e("span", { className: "nice-sidebar-nav__mode-pill-label", children: p.label })
|
|
3182
|
+
]
|
|
3183
|
+
},
|
|
3184
|
+
$
|
|
3185
|
+
);
|
|
3186
|
+
}),
|
|
3187
|
+
/* @__PURE__ */ e(
|
|
3188
|
+
"button",
|
|
3189
|
+
{
|
|
3190
|
+
className: [
|
|
3191
|
+
"nice-sidebar-nav__mode-pill",
|
|
3192
|
+
d.activeMode === "preferences" ? "nice-sidebar-nav__mode-pill--active" : ""
|
|
3193
|
+
].filter(Boolean).join(" "),
|
|
3194
|
+
onClick: () => g.setMode("preferences"),
|
|
3195
|
+
"aria-label": "Preferencje",
|
|
3196
|
+
title: "Preferencje",
|
|
3197
|
+
children: xe.preferences.icon
|
|
3198
|
+
}
|
|
3199
|
+
)
|
|
3200
|
+
] }),
|
|
3201
|
+
/* @__PURE__ */ e("div", { className: "nice-sidebar-nav__body", children: T() })
|
|
3202
|
+
] })
|
|
3203
|
+
]
|
|
3204
|
+
}
|
|
3205
|
+
);
|
|
3206
|
+
}
|
|
3207
|
+
), An = ne(
|
|
3208
|
+
({
|
|
3209
|
+
tabs: n,
|
|
3210
|
+
activeIndex: a,
|
|
3211
|
+
renderTab: i,
|
|
3212
|
+
onActiveChange: l,
|
|
3213
|
+
onCloseTab: s,
|
|
3214
|
+
onReorderTabs: h,
|
|
3215
|
+
onSaveState: o,
|
|
3216
|
+
enableShortcuts: b = !0,
|
|
3217
|
+
maxTabs: r = 0,
|
|
3218
|
+
showDirtyIndicator: t = !0,
|
|
3219
|
+
tabBarPosition: u = "top",
|
|
3220
|
+
draggable: m = !0,
|
|
3221
|
+
showAddButton: w = !1,
|
|
3222
|
+
onAddTab: d,
|
|
3223
|
+
keepAlive: g = !0,
|
|
3224
|
+
// OmniVerk 10.2
|
|
3225
|
+
warnOnUnsavedClose: z = !0,
|
|
3226
|
+
maxClosedTabs: M = 10,
|
|
3227
|
+
onUndoCloseTab: T,
|
|
3228
|
+
getTabState: f,
|
|
3229
|
+
unsavedWarningMessage: $,
|
|
3230
|
+
className: p,
|
|
3231
|
+
style: y,
|
|
3232
|
+
id: x,
|
|
3233
|
+
accessMode: C,
|
|
3234
|
+
...A
|
|
3235
|
+
}, S) => {
|
|
3236
|
+
const k = ie(x), N = ce(C, x), { t: D } = oe(), _ = he(null), [Y, K] = R(null), [Q, W] = R(null), [V, j] = R([]), [J, B] = R(null), O = L((E, I, ee = !1) => {
|
|
3237
|
+
if (!ee && z && E.isDirty) {
|
|
3238
|
+
B({ tab: E, index: I });
|
|
3239
|
+
return;
|
|
3240
|
+
}
|
|
3241
|
+
const te = {
|
|
3242
|
+
tab: { ...E },
|
|
3243
|
+
originalIndex: I,
|
|
3244
|
+
closedAt: Date.now(),
|
|
3245
|
+
state: f?.(E)
|
|
3246
|
+
};
|
|
3247
|
+
j((fe) => [te, ...fe].slice(0, M)), s?.(E, I);
|
|
3248
|
+
}, [z, M, f, s]), X = L(() => {
|
|
3249
|
+
if (V.length === 0) return;
|
|
3250
|
+
const [E, ...I] = V;
|
|
3251
|
+
j(I), T?.(E);
|
|
3252
|
+
}, [V, T]);
|
|
3253
|
+
re(() => {
|
|
3254
|
+
if (!b) return;
|
|
3255
|
+
const E = (I) => {
|
|
3256
|
+
const ee = I.ctrlKey || I.metaKey;
|
|
3257
|
+
if (ee && I.key === "w") {
|
|
3258
|
+
I.preventDefault();
|
|
3259
|
+
const te = n[a];
|
|
3260
|
+
te && te.closable !== !1 && O(te, a);
|
|
3261
|
+
} else if (ee && I.key === "Tab") {
|
|
3262
|
+
I.preventDefault();
|
|
3263
|
+
const te = I.shiftKey ? -1 : 1, fe = (a + te + n.length) % n.length;
|
|
3264
|
+
l?.(fe);
|
|
3265
|
+
} else ee && I.shiftKey && (I.key === "t" || I.key === "T") && (I.preventDefault(), X());
|
|
3266
|
+
};
|
|
3267
|
+
return window.addEventListener("keydown", E), () => window.removeEventListener("keydown", E);
|
|
3268
|
+
}, [b, n, a, O, X, l]), re(() => {
|
|
3269
|
+
if (!o) return;
|
|
3270
|
+
const E = setTimeout(() => {
|
|
3271
|
+
o({ tabs: n, activeTabIndex: a });
|
|
3272
|
+
}, 500);
|
|
3273
|
+
return () => clearTimeout(E);
|
|
3274
|
+
}, [n, a, o]);
|
|
3275
|
+
const q = L((E) => {
|
|
3276
|
+
m && W(E);
|
|
3277
|
+
}, [m]), me = L((E, I) => {
|
|
3278
|
+
E.preventDefault();
|
|
3279
|
+
}, [Q]), ve = L((E) => {
|
|
3280
|
+
if (Q === null || Q === E) return;
|
|
3281
|
+
const I = [...n], [ee] = I.splice(Q, 1);
|
|
3282
|
+
I.splice(E, 0, ee), h?.(I), W(null);
|
|
3283
|
+
let te = a;
|
|
3284
|
+
a === Q ? te = E : Q < a && E >= a ? te-- : Q > a && E <= a && te++, te !== a && l?.(te);
|
|
3285
|
+
}, [Q, n, a, h, l]), pe = L((E, I) => {
|
|
3286
|
+
E.preventDefault(), K({ tabIndex: I, x: E.clientX, y: E.clientY });
|
|
3287
|
+
}, []), de = L(() => K(null), []), F = le(() => {
|
|
3288
|
+
if (!Y) return [];
|
|
3289
|
+
const E = n[Y.tabIndex];
|
|
3290
|
+
return [
|
|
3291
|
+
{ label: D("wm.close", "Close"), action: () => {
|
|
3292
|
+
O(E, Y.tabIndex), de();
|
|
3293
|
+
}, disabled: E.closable === !1 },
|
|
3294
|
+
{ label: D("wm.closeAll", "Close all"), action: () => {
|
|
3295
|
+
n.forEach((I, ee) => I.closable !== !1 && O(I, ee)), de();
|
|
3296
|
+
} },
|
|
3297
|
+
{ label: D("wm.closeOthers", "Close others"), action: () => {
|
|
3298
|
+
n.forEach((I, ee) => ee !== Y.tabIndex && I.closable !== !1 && O(I, ee)), de();
|
|
3299
|
+
} },
|
|
3300
|
+
{ label: D("controls.pin", "Pin"), action: () => de() },
|
|
3301
|
+
{ type: "divider" },
|
|
3302
|
+
{ label: D("wm.reopenClosed", "Reopen closed tab"), action: () => {
|
|
3303
|
+
X(), de();
|
|
3304
|
+
}, disabled: V.length === 0, shortcut: "Ctrl+Shift+T" }
|
|
3305
|
+
];
|
|
3306
|
+
}, [Y, n, D, O, X, V.length, de]);
|
|
3307
|
+
if (re(() => {
|
|
3308
|
+
if (!Y) return;
|
|
3309
|
+
const E = () => de();
|
|
3310
|
+
return window.addEventListener("click", E), () => window.removeEventListener("click", E);
|
|
3311
|
+
}, [Y, de]), N === "hidden") return null;
|
|
3312
|
+
const Z = /* @__PURE__ */ c("div", { className: `nice-mdi__tab-bar nice-mdi__tab-bar--${u}`, role: "tablist", children: [
|
|
3313
|
+
n.map((E, I) => /* @__PURE__ */ c(
|
|
3314
|
+
"div",
|
|
3315
|
+
{
|
|
3316
|
+
className: `nice-mdi__tab ${I === a ? "nice-mdi__tab--active" : ""} ${E.isPinned ? "nice-mdi__tab--pinned" : ""}`,
|
|
3317
|
+
role: "tab",
|
|
3318
|
+
"aria-selected": I === a,
|
|
3319
|
+
onClick: () => l?.(I),
|
|
3320
|
+
onContextMenu: (ee) => pe(ee, I),
|
|
3321
|
+
draggable: m,
|
|
3322
|
+
onDragStart: () => q(I),
|
|
3323
|
+
onDragOver: (ee) => me(ee, I),
|
|
3324
|
+
onDrop: () => ve(I),
|
|
3325
|
+
children: [
|
|
3326
|
+
E.icon && /* @__PURE__ */ e("span", { className: "nice-mdi__tab-icon", children: E.icon }),
|
|
3327
|
+
/* @__PURE__ */ e("span", { className: "nice-mdi__tab-title", children: E.title }),
|
|
3328
|
+
t && E.isDirty && /* @__PURE__ */ e("span", { className: "nice-mdi__tab-dirty", title: "Unsaved changes", children: "●" }),
|
|
3329
|
+
E.closable !== !1 && !E.isPinned && /* @__PURE__ */ e(
|
|
3330
|
+
"button",
|
|
3331
|
+
{
|
|
3332
|
+
className: "nice-mdi__tab-close",
|
|
3333
|
+
onClick: (ee) => {
|
|
3334
|
+
ee.stopPropagation(), O(E, I);
|
|
3335
|
+
},
|
|
3336
|
+
"aria-label": D("wm.close", "Close"),
|
|
3337
|
+
type: "button",
|
|
3338
|
+
children: "×"
|
|
3339
|
+
}
|
|
3340
|
+
)
|
|
3341
|
+
]
|
|
3342
|
+
},
|
|
3343
|
+
E.id
|
|
3344
|
+
)),
|
|
3345
|
+
w && /* @__PURE__ */ e(
|
|
3346
|
+
"button",
|
|
3347
|
+
{
|
|
3348
|
+
className: "nice-mdi__tab-add",
|
|
3349
|
+
onClick: d,
|
|
3350
|
+
"aria-label": D("controls.new", "New"),
|
|
3351
|
+
type: "button",
|
|
3352
|
+
children: "+"
|
|
3353
|
+
}
|
|
3354
|
+
)
|
|
3355
|
+
] }), U = g ? /* @__PURE__ */ e("div", { className: "nice-mdi__content", children: n.map((E, I) => /* @__PURE__ */ e(
|
|
3356
|
+
"div",
|
|
3357
|
+
{
|
|
3358
|
+
className: "nice-mdi__panel",
|
|
3359
|
+
role: "tabpanel",
|
|
3360
|
+
style: { display: I === a ? "block" : "none" },
|
|
3361
|
+
children: i(E, I)
|
|
3362
|
+
},
|
|
3363
|
+
E.id
|
|
3364
|
+
)) }) : /* @__PURE__ */ e("div", { className: "nice-mdi__content", children: n[a] && /* @__PURE__ */ e("div", { className: "nice-mdi__panel", role: "tabpanel", children: i(n[a], a) }) });
|
|
3365
|
+
return /* @__PURE__ */ c(
|
|
3366
|
+
"div",
|
|
3367
|
+
{
|
|
3368
|
+
ref: (E) => {
|
|
3369
|
+
_.current = E, typeof S == "function" ? S(E) : S && (S.current = E);
|
|
3370
|
+
},
|
|
3371
|
+
id: k,
|
|
3372
|
+
className: `nice-mdi ${p ?? ""}`,
|
|
3373
|
+
style: y,
|
|
3374
|
+
...A,
|
|
3375
|
+
children: [
|
|
3376
|
+
u === "top" && Z,
|
|
3377
|
+
U,
|
|
3378
|
+
u === "bottom" && Z,
|
|
3379
|
+
Y && /* @__PURE__ */ e(
|
|
3380
|
+
"div",
|
|
3381
|
+
{
|
|
3382
|
+
className: "nice-mdi__ctx-menu",
|
|
3383
|
+
style: { position: "fixed", left: Y.x, top: Y.y, zIndex: 9999 },
|
|
3384
|
+
children: F.map((E, I) => "type" in E && E.type === "divider" ? /* @__PURE__ */ e("div", { className: "nice-mdi__ctx-divider" }, I) : /* @__PURE__ */ c(
|
|
3385
|
+
"button",
|
|
3386
|
+
{
|
|
3387
|
+
className: "nice-mdi__ctx-item",
|
|
3388
|
+
onClick: E.action,
|
|
3389
|
+
disabled: E.disabled,
|
|
3390
|
+
type: "button",
|
|
3391
|
+
children: [
|
|
3392
|
+
/* @__PURE__ */ e("span", { className: "nice-mdi__ctx-label", children: E.label }),
|
|
3393
|
+
"shortcut" in E && E.shortcut && /* @__PURE__ */ e("span", { className: "nice-mdi__ctx-shortcut", children: E.shortcut })
|
|
3394
|
+
]
|
|
3395
|
+
},
|
|
3396
|
+
I
|
|
3397
|
+
))
|
|
3398
|
+
}
|
|
3399
|
+
),
|
|
3400
|
+
J && /* @__PURE__ */ e("div", { className: "nice-mdi__modal-backdrop", onClick: () => B(null), children: /* @__PURE__ */ c("div", { className: "nice-mdi__modal", onClick: (E) => E.stopPropagation(), children: [
|
|
3401
|
+
/* @__PURE__ */ e("div", { className: "nice-mdi__modal-icon", children: "⚠️" }),
|
|
3402
|
+
/* @__PURE__ */ e("h3", { className: "nice-mdi__modal-title", children: D("wm.unsavedTitle", "Unsaved Changes") }),
|
|
3403
|
+
/* @__PURE__ */ e("p", { className: "nice-mdi__modal-message", children: $ ?? D("wm.unsavedMessage", `"${J.tab.title}" has unsaved changes. Do you want to close it anyway?`) }),
|
|
3404
|
+
/* @__PURE__ */ c("div", { className: "nice-mdi__modal-actions", children: [
|
|
3405
|
+
/* @__PURE__ */ e(
|
|
3406
|
+
"button",
|
|
3407
|
+
{
|
|
3408
|
+
type: "button",
|
|
3409
|
+
className: "nice-mdi__modal-btn nice-mdi__modal-btn--secondary",
|
|
3410
|
+
onClick: () => B(null),
|
|
3411
|
+
children: D("controls.cancel", "Cancel")
|
|
3412
|
+
}
|
|
3413
|
+
),
|
|
3414
|
+
/* @__PURE__ */ e(
|
|
3415
|
+
"button",
|
|
3416
|
+
{
|
|
3417
|
+
type: "button",
|
|
3418
|
+
className: "nice-mdi__modal-btn nice-mdi__modal-btn--danger",
|
|
3419
|
+
onClick: () => {
|
|
3420
|
+
O(J.tab, J.index, !0), B(null);
|
|
3421
|
+
},
|
|
3422
|
+
children: D("wm.closeAnyway", "Close Anyway")
|
|
3423
|
+
}
|
|
3424
|
+
)
|
|
3425
|
+
] })
|
|
3426
|
+
] }) })
|
|
3427
|
+
]
|
|
3428
|
+
}
|
|
3429
|
+
);
|
|
3430
|
+
}
|
|
3431
|
+
);
|
|
3432
|
+
An.displayName = "NiceMdiWorkspace";
|
|
3433
|
+
const Yn = ne(
|
|
3434
|
+
({
|
|
3435
|
+
menu: n,
|
|
3436
|
+
activeRoute: a,
|
|
3437
|
+
toolbar: i,
|
|
3438
|
+
statusBar: l,
|
|
3439
|
+
sidebarHeader: s,
|
|
3440
|
+
sidebarFooter: h,
|
|
3441
|
+
onNavigate: o,
|
|
3442
|
+
children: b,
|
|
3443
|
+
className: r,
|
|
3444
|
+
style: t,
|
|
3445
|
+
id: u,
|
|
3446
|
+
accessMode: m,
|
|
3447
|
+
...w
|
|
3448
|
+
}, d) => {
|
|
3449
|
+
const g = ie(u), z = ce(m, u), { t: M } = oe(), [T, f] = R(!1);
|
|
3450
|
+
return z === "hidden" ? null : /* @__PURE__ */ c(
|
|
3451
|
+
"div",
|
|
3452
|
+
{
|
|
3453
|
+
ref: d,
|
|
3454
|
+
id: g,
|
|
3455
|
+
className: `nice-shell nice-shell--classic ${T ? "nice-shell--sidebar-collapsed" : ""} ${r ?? ""}`,
|
|
3456
|
+
style: t,
|
|
3457
|
+
...w,
|
|
3458
|
+
children: [
|
|
3459
|
+
/* @__PURE__ */ c("aside", { className: "nice-shell__sidebar", children: [
|
|
3460
|
+
s && /* @__PURE__ */ e("div", { className: "nice-shell__sidebar-header", children: s }),
|
|
3461
|
+
/* @__PURE__ */ e(
|
|
3462
|
+
"button",
|
|
3463
|
+
{
|
|
3464
|
+
className: "nice-shell__sidebar-toggle",
|
|
3465
|
+
onClick: () => f(($) => !$),
|
|
3466
|
+
type: "button",
|
|
3467
|
+
"aria-label": T ? M("expand", "Expand") : M("collapse", "Collapse"),
|
|
3468
|
+
children: T ? "▸" : "◂"
|
|
3469
|
+
}
|
|
3470
|
+
),
|
|
3471
|
+
n && !T && /* @__PURE__ */ e("nav", { className: "nice-shell__nav", role: "navigation", children: n.modules.filter(($) => $.isAvailable).sort(($, p) => $.order - p.order).map(($) => /* @__PURE__ */ c("div", { className: "nice-shell__nav-group", children: [
|
|
3472
|
+
/* @__PURE__ */ c("div", { className: "nice-shell__nav-group-label", children: [
|
|
3473
|
+
$.icon && /* @__PURE__ */ e("span", { children: $.icon }),
|
|
3474
|
+
/* @__PURE__ */ e("span", { children: $.label })
|
|
3475
|
+
] }),
|
|
3476
|
+
/* @__PURE__ */ e("ul", { children: $.entities.map((p) => /* @__PURE__ */ e("li", { children: /* @__PURE__ */ e(
|
|
3477
|
+
"button",
|
|
3478
|
+
{
|
|
3479
|
+
className: `nice-shell__nav-item ${a === p.route ? "nice-shell__nav-item--active" : ""}`,
|
|
3480
|
+
onClick: () => o?.(p.route),
|
|
3481
|
+
type: "button",
|
|
3482
|
+
children: p.label
|
|
3483
|
+
}
|
|
3484
|
+
) }, p.id)) })
|
|
3485
|
+
] }, $.id)) }),
|
|
3486
|
+
h && /* @__PURE__ */ e("div", { className: "nice-shell__sidebar-footer", children: h })
|
|
3487
|
+
] }),
|
|
3488
|
+
/* @__PURE__ */ c("div", { className: "nice-shell__main", children: [
|
|
3489
|
+
i && /* @__PURE__ */ e("header", { className: "nice-shell__toolbar", children: i }),
|
|
3490
|
+
/* @__PURE__ */ e("main", { className: "nice-shell__content", children: b }),
|
|
3491
|
+
l && /* @__PURE__ */ e("footer", { className: "nice-shell__status-bar", children: l })
|
|
3492
|
+
] })
|
|
3493
|
+
]
|
|
3494
|
+
}
|
|
3495
|
+
);
|
|
3496
|
+
}
|
|
3497
|
+
);
|
|
3498
|
+
Yn.displayName = "NiceClassicShell";
|
|
3499
|
+
const Rn = ne(
|
|
3500
|
+
({
|
|
3501
|
+
topBar: n,
|
|
3502
|
+
sidePanel: a,
|
|
3503
|
+
sidePanelPosition: i = "left",
|
|
3504
|
+
sidePanelWidth: l = 280,
|
|
3505
|
+
children: s,
|
|
3506
|
+
className: h,
|
|
3507
|
+
style: o,
|
|
3508
|
+
id: b,
|
|
3509
|
+
accessMode: r,
|
|
3510
|
+
...t
|
|
3511
|
+
}, u) => {
|
|
3512
|
+
const m = ie(b);
|
|
3513
|
+
return ce(r, b) === "hidden" ? null : /* @__PURE__ */ c(
|
|
3514
|
+
"div",
|
|
3515
|
+
{
|
|
3516
|
+
ref: u,
|
|
3517
|
+
id: m,
|
|
3518
|
+
className: `nice-shell nice-shell--dashboard ${h ?? ""}`,
|
|
3519
|
+
style: o,
|
|
3520
|
+
...t,
|
|
3521
|
+
children: [
|
|
3522
|
+
n && /* @__PURE__ */ e("header", { className: "nice-shell__top-bar", children: n }),
|
|
3523
|
+
/* @__PURE__ */ c("div", { className: `nice-shell__dashboard-body nice-shell__dashboard-body--panel-${i}`, children: [
|
|
3524
|
+
a && /* @__PURE__ */ e("aside", { className: "nice-shell__side-panel", style: { width: l }, children: a }),
|
|
3525
|
+
/* @__PURE__ */ e("main", { className: "nice-shell__dashboard-content", children: s })
|
|
3526
|
+
] })
|
|
3527
|
+
]
|
|
3528
|
+
}
|
|
3529
|
+
);
|
|
3530
|
+
}
|
|
3531
|
+
);
|
|
3532
|
+
Rn.displayName = "NiceDashboardShell";
|
|
3533
|
+
const Fn = ne(
|
|
3534
|
+
({
|
|
3535
|
+
topBar: n,
|
|
3536
|
+
bottomNav: a,
|
|
3537
|
+
children: i,
|
|
3538
|
+
className: l,
|
|
3539
|
+
style: s,
|
|
3540
|
+
id: h,
|
|
3541
|
+
accessMode: o,
|
|
3542
|
+
...b
|
|
3543
|
+
}, r) => {
|
|
3544
|
+
const t = ie(h);
|
|
3545
|
+
return ce(o, h) === "hidden" ? null : /* @__PURE__ */ c(
|
|
3546
|
+
"div",
|
|
3547
|
+
{
|
|
3548
|
+
ref: r,
|
|
3549
|
+
id: t,
|
|
3550
|
+
className: `nice-shell nice-shell--compact ${l ?? ""}`,
|
|
3551
|
+
style: s,
|
|
3552
|
+
...b,
|
|
3553
|
+
children: [
|
|
3554
|
+
n && /* @__PURE__ */ e("header", { className: "nice-shell__compact-top", children: n }),
|
|
3555
|
+
/* @__PURE__ */ e("main", { className: "nice-shell__compact-content", children: i }),
|
|
3556
|
+
a && /* @__PURE__ */ e("footer", { className: "nice-shell__compact-bottom", children: a })
|
|
3557
|
+
]
|
|
3558
|
+
}
|
|
3559
|
+
);
|
|
3560
|
+
}
|
|
3561
|
+
);
|
|
3562
|
+
Fn.displayName = "NiceCompactShell";
|
|
3563
|
+
const jn = ne(
|
|
3564
|
+
({
|
|
3565
|
+
overlay: n,
|
|
3566
|
+
lockScreen: a,
|
|
3567
|
+
locked: i = !1,
|
|
3568
|
+
children: l,
|
|
3569
|
+
className: s,
|
|
3570
|
+
style: h,
|
|
3571
|
+
id: o,
|
|
3572
|
+
accessMode: b,
|
|
3573
|
+
...r
|
|
3574
|
+
}, t) => {
|
|
3575
|
+
const u = ie(o);
|
|
3576
|
+
return ce(b, o) === "hidden" ? null : /* @__PURE__ */ e(
|
|
3577
|
+
"div",
|
|
3578
|
+
{
|
|
3579
|
+
ref: t,
|
|
3580
|
+
id: u,
|
|
3581
|
+
className: `nice-shell nice-shell--kiosk ${s ?? ""}`,
|
|
3582
|
+
style: { ...h, position: "fixed", inset: 0 },
|
|
3583
|
+
...r,
|
|
3584
|
+
children: i && a ? /* @__PURE__ */ e("div", { className: "nice-shell__kiosk-lock", children: a }) : /* @__PURE__ */ c(Le, { children: [
|
|
3585
|
+
/* @__PURE__ */ e("main", { className: "nice-shell__kiosk-content", children: l }),
|
|
3586
|
+
n && /* @__PURE__ */ e("div", { className: "nice-shell__kiosk-overlay", children: n })
|
|
3587
|
+
] })
|
|
3588
|
+
}
|
|
3589
|
+
);
|
|
3590
|
+
}
|
|
3591
|
+
);
|
|
3592
|
+
jn.displayName = "NiceKioskShell";
|
|
3593
|
+
const Wn = ne(
|
|
3594
|
+
({
|
|
3595
|
+
modes: n,
|
|
3596
|
+
activeMode: a,
|
|
3597
|
+
onModeChange: i,
|
|
3598
|
+
variant: l = "dropdown",
|
|
3599
|
+
gridColumns: s = 3,
|
|
3600
|
+
showDescription: h = !0,
|
|
3601
|
+
showColorIndicator: o = !0,
|
|
3602
|
+
compact: b = !1,
|
|
3603
|
+
size: r = "md",
|
|
3604
|
+
className: t,
|
|
3605
|
+
style: u,
|
|
3606
|
+
id: m,
|
|
3607
|
+
accessMode: w,
|
|
3608
|
+
...d
|
|
3609
|
+
}, g) => {
|
|
3610
|
+
const z = ie(m), M = ce(w, m), { t: T } = oe(), [f, $] = R(!1), p = he(null), y = n.find((C) => C.key === a);
|
|
3611
|
+
re(() => {
|
|
3612
|
+
if (!f) return;
|
|
3613
|
+
const C = (A) => {
|
|
3614
|
+
p.current && !p.current.contains(A.target) && $(!1);
|
|
3615
|
+
};
|
|
3616
|
+
return document.addEventListener("mousedown", C), () => document.removeEventListener("mousedown", C);
|
|
3617
|
+
}, [f]);
|
|
3618
|
+
const x = L(
|
|
3619
|
+
(C) => {
|
|
3620
|
+
i?.(C), $(!1);
|
|
3621
|
+
},
|
|
3622
|
+
[i]
|
|
3623
|
+
);
|
|
3624
|
+
return M === "hidden" ? null : l === "dropdown" ? /* @__PURE__ */ c(
|
|
3625
|
+
"div",
|
|
3626
|
+
{
|
|
3627
|
+
ref: (C) => {
|
|
3628
|
+
p.current = C, typeof g == "function" ? g(C) : g && (g.current = C);
|
|
3629
|
+
},
|
|
3630
|
+
id: z,
|
|
3631
|
+
className: `nice-mode-selector nice-mode-selector--dropdown nice-mode-selector--${r} ${t ?? ""}`,
|
|
3632
|
+
style: u,
|
|
3633
|
+
...d,
|
|
3634
|
+
children: [
|
|
3635
|
+
/* @__PURE__ */ c(
|
|
3636
|
+
"button",
|
|
3637
|
+
{
|
|
3638
|
+
className: "nice-mode-selector__trigger",
|
|
3639
|
+
onClick: () => $((C) => !C),
|
|
3640
|
+
"aria-expanded": f,
|
|
3641
|
+
"aria-haspopup": "listbox",
|
|
3642
|
+
type: "button",
|
|
3643
|
+
children: [
|
|
3644
|
+
o && y?.color && /* @__PURE__ */ e(
|
|
3645
|
+
"span",
|
|
3646
|
+
{
|
|
3647
|
+
className: "nice-mode-selector__color",
|
|
3648
|
+
style: { backgroundColor: y.color }
|
|
3649
|
+
}
|
|
3650
|
+
),
|
|
3651
|
+
y?.icon && /* @__PURE__ */ e("span", { className: "nice-mode-selector__icon", children: y.icon }),
|
|
3652
|
+
/* @__PURE__ */ e("span", { className: "nice-mode-selector__label", children: y?.displayName ?? a }),
|
|
3653
|
+
/* @__PURE__ */ e("span", { className: "nice-mode-selector__chevron", children: f ? "▴" : "▾" })
|
|
3654
|
+
]
|
|
3655
|
+
}
|
|
3656
|
+
),
|
|
3657
|
+
f && /* @__PURE__ */ e("ul", { className: "nice-mode-selector__menu", role: "listbox", children: n.map((C) => /* @__PURE__ */ c(
|
|
3658
|
+
"li",
|
|
3659
|
+
{
|
|
3660
|
+
className: `nice-mode-selector__option ${C.key === a ? "nice-mode-selector__option--active" : ""}`,
|
|
3661
|
+
role: "option",
|
|
3662
|
+
"aria-selected": C.key === a,
|
|
3663
|
+
onClick: () => x(C),
|
|
3664
|
+
children: [
|
|
3665
|
+
o && C.color && /* @__PURE__ */ e(
|
|
3666
|
+
"span",
|
|
3667
|
+
{
|
|
3668
|
+
className: "nice-mode-selector__color",
|
|
3669
|
+
style: { backgroundColor: C.color }
|
|
3670
|
+
}
|
|
3671
|
+
),
|
|
3672
|
+
C.icon && /* @__PURE__ */ e("span", { className: "nice-mode-selector__icon", children: C.icon }),
|
|
3673
|
+
/* @__PURE__ */ c("div", { children: [
|
|
3674
|
+
/* @__PURE__ */ e("div", { className: "nice-mode-selector__name", children: C.displayName }),
|
|
3675
|
+
h && C.description && /* @__PURE__ */ e("div", { className: "nice-mode-selector__desc", children: C.description })
|
|
3676
|
+
] })
|
|
3677
|
+
]
|
|
3678
|
+
},
|
|
3679
|
+
C.key
|
|
3680
|
+
)) })
|
|
3681
|
+
]
|
|
3682
|
+
}
|
|
3683
|
+
) : l === "pills" ? /* @__PURE__ */ e(
|
|
3684
|
+
"div",
|
|
3685
|
+
{
|
|
3686
|
+
ref: g,
|
|
3687
|
+
id: z,
|
|
3688
|
+
className: `nice-mode-selector nice-mode-selector--pills ${t ?? ""}`,
|
|
3689
|
+
style: u,
|
|
3690
|
+
role: "radiogroup",
|
|
3691
|
+
...d,
|
|
3692
|
+
children: n.map((C) => /* @__PURE__ */ c(
|
|
3693
|
+
"button",
|
|
3694
|
+
{
|
|
3695
|
+
className: `nice-mode-selector__pill ${C.key === a ? "nice-mode-selector__pill--active" : ""}`,
|
|
3696
|
+
style: o && C.color ? { borderColor: C.color } : void 0,
|
|
3697
|
+
onClick: () => x(C),
|
|
3698
|
+
role: "radio",
|
|
3699
|
+
"aria-checked": C.key === a,
|
|
3700
|
+
type: "button",
|
|
3701
|
+
children: [
|
|
3702
|
+
C.icon && /* @__PURE__ */ e("span", { children: C.icon }),
|
|
3703
|
+
/* @__PURE__ */ e("span", { children: C.displayName })
|
|
3704
|
+
]
|
|
3705
|
+
},
|
|
3706
|
+
C.key
|
|
3707
|
+
))
|
|
3708
|
+
}
|
|
3709
|
+
) : /* @__PURE__ */ e(
|
|
3710
|
+
"div",
|
|
3711
|
+
{
|
|
3712
|
+
ref: g,
|
|
3713
|
+
id: z,
|
|
3714
|
+
className: `nice-mode-selector nice-mode-selector--card-grid ${t ?? ""}`,
|
|
3715
|
+
style: { ...u, gridTemplateColumns: `repeat(${s}, 1fr)` },
|
|
3716
|
+
role: "radiogroup",
|
|
3717
|
+
...d,
|
|
3718
|
+
children: n.map((C) => /* @__PURE__ */ c(
|
|
3719
|
+
"button",
|
|
3720
|
+
{
|
|
3721
|
+
className: `nice-mode-selector__card ${C.key === a ? "nice-mode-selector__card--active" : ""} ${b ? "nice-mode-selector__card--compact" : ""}`,
|
|
3722
|
+
onClick: () => x(C),
|
|
3723
|
+
role: "radio",
|
|
3724
|
+
"aria-checked": C.key === a,
|
|
3725
|
+
type: "button",
|
|
3726
|
+
children: [
|
|
3727
|
+
o && C.color && /* @__PURE__ */ e(
|
|
3728
|
+
"div",
|
|
3729
|
+
{
|
|
3730
|
+
className: "nice-mode-selector__card-stripe",
|
|
3731
|
+
style: { backgroundColor: C.color }
|
|
3732
|
+
}
|
|
3733
|
+
),
|
|
3734
|
+
C.icon && /* @__PURE__ */ e("div", { className: "nice-mode-selector__card-icon", children: C.icon }),
|
|
3735
|
+
/* @__PURE__ */ e("div", { className: "nice-mode-selector__card-name", children: C.displayName }),
|
|
3736
|
+
h && C.description && !b && /* @__PURE__ */ e("div", { className: "nice-mode-selector__card-desc", children: C.description }),
|
|
3737
|
+
C.sourcePackage && !b && /* @__PURE__ */ e("div", { className: "nice-mode-selector__card-pkg", children: C.sourcePackage })
|
|
3738
|
+
]
|
|
3739
|
+
},
|
|
3740
|
+
C.key
|
|
3741
|
+
))
|
|
3742
|
+
}
|
|
3743
|
+
);
|
|
3744
|
+
}
|
|
3745
|
+
);
|
|
3746
|
+
Wn.displayName = "NiceModeSelector";
|
|
3747
|
+
function Bn(n) {
|
|
3748
|
+
const a = /* @__PURE__ */ new Map();
|
|
3749
|
+
for (const i of n.sort((l, s) => l.orderIndex - s.orderIndex))
|
|
3750
|
+
a.has(i.category) || a.set(i.category, []), a.get(i.category).push(i);
|
|
3751
|
+
return Array.from(a, ([i, l]) => ({ category: i, items: l }));
|
|
3752
|
+
}
|
|
3753
|
+
const Un = ({ question: n, value: a, onChange: i }) => {
|
|
3754
|
+
switch (n.questionType) {
|
|
3755
|
+
case "boolean":
|
|
3756
|
+
return /* @__PURE__ */ c("div", { className: "nice-onboarding__field nice-onboarding__field--boolean", children: [
|
|
3757
|
+
/* @__PURE__ */ c("label", { className: "nice-onboarding__label", children: [
|
|
3758
|
+
n.question,
|
|
3759
|
+
n.isRequired && /* @__PURE__ */ e("span", { className: "nice-onboarding__required", children: "*" })
|
|
3760
|
+
] }),
|
|
3761
|
+
n.helpText && /* @__PURE__ */ e("p", { className: "nice-onboarding__help", children: n.helpText }),
|
|
3762
|
+
/* @__PURE__ */ c("div", { className: "nice-onboarding__boolean-group", children: [
|
|
3763
|
+
/* @__PURE__ */ e(
|
|
3764
|
+
"button",
|
|
3765
|
+
{
|
|
3766
|
+
className: `nice-onboarding__bool-btn ${a === "true" ? "nice-onboarding__bool-btn--active" : ""}`,
|
|
3767
|
+
onClick: () => i("true"),
|
|
3768
|
+
type: "button",
|
|
3769
|
+
children: "✓"
|
|
3770
|
+
}
|
|
3771
|
+
),
|
|
3772
|
+
/* @__PURE__ */ e(
|
|
3773
|
+
"button",
|
|
3774
|
+
{
|
|
3775
|
+
className: `nice-onboarding__bool-btn ${a === "false" ? "nice-onboarding__bool-btn--active" : ""}`,
|
|
3776
|
+
onClick: () => i("false"),
|
|
3777
|
+
type: "button",
|
|
3778
|
+
children: "✗"
|
|
3779
|
+
}
|
|
3780
|
+
)
|
|
3781
|
+
] })
|
|
3782
|
+
] });
|
|
3783
|
+
case "select":
|
|
3784
|
+
return /* @__PURE__ */ c("div", { className: "nice-onboarding__field nice-onboarding__field--select", children: [
|
|
3785
|
+
/* @__PURE__ */ c("label", { className: "nice-onboarding__label", children: [
|
|
3786
|
+
n.question,
|
|
3787
|
+
n.isRequired && /* @__PURE__ */ e("span", { className: "nice-onboarding__required", children: "*" })
|
|
3788
|
+
] }),
|
|
3789
|
+
n.helpText && /* @__PURE__ */ e("p", { className: "nice-onboarding__help", children: n.helpText }),
|
|
3790
|
+
/* @__PURE__ */ e("div", { className: "nice-onboarding__options", children: n.options?.map((l) => /* @__PURE__ */ e(
|
|
3791
|
+
"button",
|
|
3792
|
+
{
|
|
3793
|
+
className: `nice-onboarding__option ${a === l ? "nice-onboarding__option--selected" : ""}`,
|
|
3794
|
+
onClick: () => i(l),
|
|
3795
|
+
type: "button",
|
|
3796
|
+
children: l
|
|
3797
|
+
},
|
|
3798
|
+
l
|
|
3799
|
+
)) })
|
|
3800
|
+
] });
|
|
3801
|
+
case "multiSelect":
|
|
3802
|
+
return /* @__PURE__ */ c("div", { className: "nice-onboarding__field nice-onboarding__field--multi", children: [
|
|
3803
|
+
/* @__PURE__ */ c("label", { className: "nice-onboarding__label", children: [
|
|
3804
|
+
n.question,
|
|
3805
|
+
n.isRequired && /* @__PURE__ */ e("span", { className: "nice-onboarding__required", children: "*" })
|
|
3806
|
+
] }),
|
|
3807
|
+
n.helpText && /* @__PURE__ */ e("p", { className: "nice-onboarding__help", children: n.helpText }),
|
|
3808
|
+
/* @__PURE__ */ e("div", { className: "nice-onboarding__options", children: n.options?.map((l) => {
|
|
3809
|
+
const s = a.split(",").filter(Boolean), h = s.includes(l);
|
|
3810
|
+
return /* @__PURE__ */ e(
|
|
3811
|
+
"button",
|
|
3812
|
+
{
|
|
3813
|
+
className: `nice-onboarding__option ${h ? "nice-onboarding__option--selected" : ""}`,
|
|
3814
|
+
onClick: () => {
|
|
3815
|
+
const o = h ? s.filter((b) => b !== l) : [...s, l];
|
|
3816
|
+
i(o.join(","));
|
|
3817
|
+
},
|
|
3818
|
+
type: "button",
|
|
3819
|
+
children: l
|
|
3820
|
+
},
|
|
3821
|
+
l
|
|
3822
|
+
);
|
|
3823
|
+
}) })
|
|
3824
|
+
] });
|
|
3825
|
+
case "number":
|
|
3826
|
+
return /* @__PURE__ */ c("div", { className: "nice-onboarding__field nice-onboarding__field--number", children: [
|
|
3827
|
+
/* @__PURE__ */ c("label", { className: "nice-onboarding__label", children: [
|
|
3828
|
+
n.question,
|
|
3829
|
+
n.isRequired && /* @__PURE__ */ e("span", { className: "nice-onboarding__required", children: "*" })
|
|
3830
|
+
] }),
|
|
3831
|
+
n.helpText && /* @__PURE__ */ e("p", { className: "nice-onboarding__help", children: n.helpText }),
|
|
3832
|
+
/* @__PURE__ */ e(
|
|
3833
|
+
"input",
|
|
3834
|
+
{
|
|
3835
|
+
type: "number",
|
|
3836
|
+
className: "nice-onboarding__input",
|
|
3837
|
+
value: a,
|
|
3838
|
+
onChange: (l) => i(l.target.value)
|
|
3839
|
+
}
|
|
3840
|
+
)
|
|
3841
|
+
] });
|
|
3842
|
+
case "date":
|
|
3843
|
+
return /* @__PURE__ */ c("div", { className: "nice-onboarding__field nice-onboarding__field--date", children: [
|
|
3844
|
+
/* @__PURE__ */ c("label", { className: "nice-onboarding__label", children: [
|
|
3845
|
+
n.question,
|
|
3846
|
+
n.isRequired && /* @__PURE__ */ e("span", { className: "nice-onboarding__required", children: "*" })
|
|
3847
|
+
] }),
|
|
3848
|
+
n.helpText && /* @__PURE__ */ e("p", { className: "nice-onboarding__help", children: n.helpText }),
|
|
3849
|
+
/* @__PURE__ */ e(
|
|
3850
|
+
"input",
|
|
3851
|
+
{
|
|
3852
|
+
type: "date",
|
|
3853
|
+
className: "nice-onboarding__input",
|
|
3854
|
+
value: a,
|
|
3855
|
+
onChange: (l) => i(l.target.value)
|
|
3856
|
+
}
|
|
3857
|
+
)
|
|
3858
|
+
] });
|
|
3859
|
+
default:
|
|
3860
|
+
return /* @__PURE__ */ c("div", { className: "nice-onboarding__field nice-onboarding__field--text", children: [
|
|
3861
|
+
/* @__PURE__ */ c("label", { className: "nice-onboarding__label", children: [
|
|
3862
|
+
n.question,
|
|
3863
|
+
n.isRequired && /* @__PURE__ */ e("span", { className: "nice-onboarding__required", children: "*" })
|
|
3864
|
+
] }),
|
|
3865
|
+
n.helpText && /* @__PURE__ */ e("p", { className: "nice-onboarding__help", children: n.helpText }),
|
|
3866
|
+
/* @__PURE__ */ e(
|
|
3867
|
+
"input",
|
|
3868
|
+
{
|
|
3869
|
+
type: "text",
|
|
3870
|
+
className: "nice-onboarding__input",
|
|
3871
|
+
value: a,
|
|
3872
|
+
onChange: (l) => i(l.target.value),
|
|
3873
|
+
placeholder: n.defaultValue
|
|
3874
|
+
}
|
|
3875
|
+
)
|
|
3876
|
+
] });
|
|
3877
|
+
}
|
|
3878
|
+
}, Pn = ne(
|
|
3879
|
+
({
|
|
3880
|
+
questions: n,
|
|
3881
|
+
initialAnswers: a = [],
|
|
3882
|
+
stepLabels: i,
|
|
3883
|
+
onComplete: l,
|
|
3884
|
+
onCancel: s,
|
|
3885
|
+
onStepChange: h,
|
|
3886
|
+
welcomeContent: o,
|
|
3887
|
+
completionContent: b,
|
|
3888
|
+
showProgress: r = !0,
|
|
3889
|
+
allowBack: t = !0,
|
|
3890
|
+
logo: u,
|
|
3891
|
+
size: m = "md",
|
|
3892
|
+
className: w,
|
|
3893
|
+
style: d,
|
|
3894
|
+
id: g,
|
|
3895
|
+
accessMode: z,
|
|
3896
|
+
...M
|
|
3897
|
+
}, T) => {
|
|
3898
|
+
const f = ie(g), $ = ce(z, g), { t: p } = oe(), y = le(() => Bn(n), [n]), x = !!o, C = !!b, A = x ? -1 : 0, S = C ? y.length : y.length - 1, [k, N] = R(A), [D, _] = R(() => {
|
|
3899
|
+
const B = /* @__PURE__ */ new Map();
|
|
3900
|
+
for (const O of a) B.set(O.questionId, O.answer);
|
|
3901
|
+
for (const O of n)
|
|
3902
|
+
!B.has(O.id) && O.defaultValue && B.set(O.id, O.defaultValue);
|
|
3903
|
+
return B;
|
|
3904
|
+
}), Y = L((B, O) => {
|
|
3905
|
+
_((X) => {
|
|
3906
|
+
const q = new Map(X);
|
|
3907
|
+
return q.set(B, O), q;
|
|
3908
|
+
});
|
|
3909
|
+
}, []), K = le(() => k < 0 || k >= y.length ? !0 : y[k].items.every(
|
|
3910
|
+
(O) => !O.isRequired || (D.get(O.id) ?? "").trim().length > 0
|
|
3911
|
+
), [k, y, D]), Q = L(() => {
|
|
3912
|
+
if (k >= S) {
|
|
3913
|
+
const O = [];
|
|
3914
|
+
D.forEach((X, q) => O.push({ questionId: q, answer: X })), l?.(O);
|
|
3915
|
+
return;
|
|
3916
|
+
}
|
|
3917
|
+
const B = k + 1;
|
|
3918
|
+
N(B), h?.(B);
|
|
3919
|
+
}, [k, S, D, l, h]), W = L(() => {
|
|
3920
|
+
if (k <= A) return;
|
|
3921
|
+
const B = k - 1;
|
|
3922
|
+
N(B), h?.(B);
|
|
3923
|
+
}, [k, A, h]), V = y.length + (x ? 1 : 0) + (C ? 1 : 0), j = k - A, J = Math.round(j / Math.max(V - 1, 1) * 100);
|
|
3924
|
+
return $ === "hidden" ? null : /* @__PURE__ */ c(
|
|
3925
|
+
"div",
|
|
3926
|
+
{
|
|
3927
|
+
ref: T,
|
|
3928
|
+
id: f,
|
|
3929
|
+
className: `nice-onboarding nice-onboarding--${m} ${w ?? ""}`,
|
|
3930
|
+
style: d,
|
|
3931
|
+
...M,
|
|
3932
|
+
children: [
|
|
3933
|
+
/* @__PURE__ */ c("div", { className: "nice-onboarding__header", children: [
|
|
3934
|
+
u && /* @__PURE__ */ e("div", { className: "nice-onboarding__logo", children: u }),
|
|
3935
|
+
r && /* @__PURE__ */ e("div", { className: "nice-onboarding__progress", children: /* @__PURE__ */ e("div", { className: "nice-onboarding__progress-bar", style: { width: `${J}%` } }) }),
|
|
3936
|
+
/* @__PURE__ */ e("div", { className: "nice-onboarding__steps", children: y.map((B, O) => /* @__PURE__ */ c(
|
|
3937
|
+
"div",
|
|
3938
|
+
{
|
|
3939
|
+
className: `nice-onboarding__step-dot ${O === k ? "nice-onboarding__step-dot--active" : ""} ${O < k ? "nice-onboarding__step-dot--done" : ""}`,
|
|
3940
|
+
children: [
|
|
3941
|
+
/* @__PURE__ */ e("span", { children: O + 1 }),
|
|
3942
|
+
/* @__PURE__ */ e("span", { className: "nice-onboarding__step-label", children: i?.[O] ?? B.category })
|
|
3943
|
+
]
|
|
3944
|
+
},
|
|
3945
|
+
O
|
|
3946
|
+
)) })
|
|
3947
|
+
] }),
|
|
3948
|
+
/* @__PURE__ */ c("div", { className: "nice-onboarding__body", children: [
|
|
3949
|
+
k === -1 && o,
|
|
3950
|
+
k >= 0 && k < y.length && /* @__PURE__ */ c("div", { className: "nice-onboarding__questions", children: [
|
|
3951
|
+
/* @__PURE__ */ e("h2", { className: "nice-onboarding__category", children: y[k].category }),
|
|
3952
|
+
y[k].items.map((B) => /* @__PURE__ */ e(
|
|
3953
|
+
Un,
|
|
3954
|
+
{
|
|
3955
|
+
question: B,
|
|
3956
|
+
value: D.get(B.id) ?? "",
|
|
3957
|
+
onChange: (O) => Y(B.id, O)
|
|
3958
|
+
},
|
|
3959
|
+
B.id
|
|
3960
|
+
))
|
|
3961
|
+
] }),
|
|
3962
|
+
k === y.length && b
|
|
3963
|
+
] }),
|
|
3964
|
+
/* @__PURE__ */ c("div", { className: "nice-onboarding__footer", children: [
|
|
3965
|
+
s && /* @__PURE__ */ e(
|
|
3966
|
+
"button",
|
|
3967
|
+
{
|
|
3968
|
+
className: "nice-onboarding__btn nice-onboarding__btn--cancel",
|
|
3969
|
+
onClick: s,
|
|
3970
|
+
type: "button",
|
|
3971
|
+
children: p("cancel", "Cancel")
|
|
3972
|
+
}
|
|
3973
|
+
),
|
|
3974
|
+
/* @__PURE__ */ c("div", { className: "nice-onboarding__footer-right", children: [
|
|
3975
|
+
t && k > A && /* @__PURE__ */ e(
|
|
3976
|
+
"button",
|
|
3977
|
+
{
|
|
3978
|
+
className: "nice-onboarding__btn nice-onboarding__btn--back",
|
|
3979
|
+
onClick: W,
|
|
3980
|
+
type: "button",
|
|
3981
|
+
children: p("back", "Back")
|
|
3982
|
+
}
|
|
3983
|
+
),
|
|
3984
|
+
/* @__PURE__ */ e(
|
|
3985
|
+
"button",
|
|
3986
|
+
{
|
|
3987
|
+
className: "nice-onboarding__btn nice-onboarding__btn--next",
|
|
3988
|
+
onClick: Q,
|
|
3989
|
+
disabled: !K,
|
|
3990
|
+
type: "button",
|
|
3991
|
+
children: k >= S ? p("finish", "Finish") : p("next", "Next")
|
|
3992
|
+
}
|
|
3993
|
+
)
|
|
3994
|
+
] })
|
|
3995
|
+
] })
|
|
3996
|
+
]
|
|
3997
|
+
}
|
|
3998
|
+
);
|
|
3999
|
+
}
|
|
4000
|
+
);
|
|
4001
|
+
Pn.displayName = "NiceOnboardingWizard";
|
|
4002
|
+
const Vn = [
|
|
4003
|
+
{ key: "Mon", label: "Monday" },
|
|
4004
|
+
{ key: "Tue", label: "Tuesday" },
|
|
4005
|
+
{ key: "Wed", label: "Wednesday" },
|
|
4006
|
+
{ key: "Thu", label: "Thursday" },
|
|
4007
|
+
{ key: "Fri", label: "Friday" },
|
|
4008
|
+
{ key: "Sat", label: "Saturday" },
|
|
4009
|
+
{ key: "Sun", label: "Sunday" }
|
|
4010
|
+
], Hn = [
|
|
4011
|
+
{ value: "YYYY-MM-DD", label: "YYYY-MM-DD" },
|
|
4012
|
+
{ value: "DD/MM/YYYY", label: "DD/MM/YYYY" },
|
|
4013
|
+
{ value: "MM/DD/YYYY", label: "MM/DD/YYYY" },
|
|
4014
|
+
{ value: "DD.MM.YYYY", label: "DD.MM.YYYY" }
|
|
4015
|
+
], We = [
|
|
4016
|
+
"basic",
|
|
4017
|
+
"contact",
|
|
4018
|
+
"address",
|
|
4019
|
+
"branding",
|
|
4020
|
+
"localization",
|
|
4021
|
+
"fiscal",
|
|
4022
|
+
"preferences"
|
|
4023
|
+
], ge = ({ title: n, expanded: a, onToggle: i }) => /* @__PURE__ */ c(
|
|
4024
|
+
"button",
|
|
4025
|
+
{
|
|
4026
|
+
className: `nice-org-form__section-header ${a ? "nice-org-form__section-header--expanded" : ""}`,
|
|
4027
|
+
onClick: i,
|
|
4028
|
+
type: "button",
|
|
4029
|
+
"aria-expanded": a,
|
|
4030
|
+
children: [
|
|
4031
|
+
/* @__PURE__ */ e("span", { className: "nice-org-form__section-title", children: n }),
|
|
4032
|
+
/* @__PURE__ */ e("span", { className: "nice-org-form__section-chevron", children: a ? "▾" : "▸" })
|
|
4033
|
+
]
|
|
4034
|
+
}
|
|
4035
|
+
), Kn = ne(
|
|
4036
|
+
({
|
|
4037
|
+
profile: n,
|
|
4038
|
+
onChange: a,
|
|
4039
|
+
onSave: i,
|
|
4040
|
+
onCancel: l,
|
|
4041
|
+
sections: s,
|
|
4042
|
+
expandedSections: h,
|
|
4043
|
+
showActions: o = !0,
|
|
4044
|
+
countryOptions: b,
|
|
4045
|
+
languageOptions: r,
|
|
4046
|
+
currencyOptions: t,
|
|
4047
|
+
timezoneOptions: u,
|
|
4048
|
+
saving: m = !1,
|
|
4049
|
+
className: w,
|
|
4050
|
+
style: d,
|
|
4051
|
+
id: g,
|
|
4052
|
+
accessMode: z,
|
|
4053
|
+
...M
|
|
4054
|
+
}, T) => {
|
|
4055
|
+
const f = ie(g), $ = ce(z, g), { t: p } = oe(), y = le(
|
|
4056
|
+
() => s && s.length > 0 ? s : We,
|
|
4057
|
+
[s]
|
|
4058
|
+
), [x, C] = R(
|
|
4059
|
+
() => new Set(h ?? We)
|
|
4060
|
+
), A = L((_) => {
|
|
4061
|
+
C((Y) => {
|
|
4062
|
+
const K = new Set(Y);
|
|
4063
|
+
return K.has(_) ? K.delete(_) : K.add(_), K;
|
|
4064
|
+
});
|
|
4065
|
+
}, []), S = $ === "readOnly", k = $ === "disabled", N = L(
|
|
4066
|
+
(_, Y) => {
|
|
4067
|
+
a?.({ ...n, [_]: Y });
|
|
4068
|
+
},
|
|
4069
|
+
[n, a]
|
|
4070
|
+
), D = L(() => {
|
|
4071
|
+
i?.(n);
|
|
4072
|
+
}, [n, i]);
|
|
4073
|
+
return $ === "hidden" ? null : /* @__PURE__ */ c(
|
|
4074
|
+
"div",
|
|
4075
|
+
{
|
|
4076
|
+
ref: T,
|
|
4077
|
+
id: f,
|
|
4078
|
+
className: `nice-org-form ${w ?? ""}`,
|
|
4079
|
+
style: d,
|
|
4080
|
+
...M,
|
|
4081
|
+
children: [
|
|
4082
|
+
y.includes("basic") && /* @__PURE__ */ c("div", { className: "nice-org-form__section", children: [
|
|
4083
|
+
/* @__PURE__ */ e(
|
|
4084
|
+
ge,
|
|
4085
|
+
{
|
|
4086
|
+
title: p("org.basic", "Company Information"),
|
|
4087
|
+
expanded: x.has("basic"),
|
|
4088
|
+
onToggle: () => A("basic")
|
|
4089
|
+
}
|
|
4090
|
+
),
|
|
4091
|
+
x.has("basic") && /* @__PURE__ */ c("div", { className: "nice-org-form__fields", children: [
|
|
4092
|
+
/* @__PURE__ */ e(
|
|
4093
|
+
ae,
|
|
4094
|
+
{
|
|
4095
|
+
label: p("org.name", "Company Name"),
|
|
4096
|
+
value: n.name,
|
|
4097
|
+
onChange: (_) => N("name", _),
|
|
4098
|
+
required: !0,
|
|
4099
|
+
disabled: k,
|
|
4100
|
+
readOnly: S
|
|
4101
|
+
}
|
|
4102
|
+
),
|
|
4103
|
+
/* @__PURE__ */ e(
|
|
4104
|
+
ae,
|
|
4105
|
+
{
|
|
4106
|
+
label: p("org.legalName", "Legal Name"),
|
|
4107
|
+
value: n.legalName ?? "",
|
|
4108
|
+
onChange: (_) => N("legalName", _),
|
|
4109
|
+
disabled: k,
|
|
4110
|
+
readOnly: S
|
|
4111
|
+
}
|
|
4112
|
+
),
|
|
4113
|
+
/* @__PURE__ */ e(
|
|
4114
|
+
ae,
|
|
4115
|
+
{
|
|
4116
|
+
label: p("org.taxId", "Tax ID"),
|
|
4117
|
+
value: n.taxId ?? "",
|
|
4118
|
+
onChange: (_) => N("taxId", _),
|
|
4119
|
+
disabled: k,
|
|
4120
|
+
readOnly: S
|
|
4121
|
+
}
|
|
4122
|
+
),
|
|
4123
|
+
/* @__PURE__ */ e(
|
|
4124
|
+
ae,
|
|
4125
|
+
{
|
|
4126
|
+
label: p("org.regNumber", "Registration Number"),
|
|
4127
|
+
value: n.registrationNumber ?? "",
|
|
4128
|
+
onChange: (_) => N("registrationNumber", _),
|
|
4129
|
+
disabled: k,
|
|
4130
|
+
readOnly: S
|
|
4131
|
+
}
|
|
4132
|
+
),
|
|
4133
|
+
/* @__PURE__ */ e(
|
|
4134
|
+
ae,
|
|
4135
|
+
{
|
|
4136
|
+
label: p("org.industry", "Industry"),
|
|
4137
|
+
value: n.industry ?? "",
|
|
4138
|
+
onChange: (_) => N("industry", _),
|
|
4139
|
+
disabled: k,
|
|
4140
|
+
readOnly: S
|
|
4141
|
+
}
|
|
4142
|
+
),
|
|
4143
|
+
/* @__PURE__ */ e(
|
|
4144
|
+
Re,
|
|
4145
|
+
{
|
|
4146
|
+
label: p("org.employees", "Number of Employees"),
|
|
4147
|
+
value: n.employeeCount ?? null,
|
|
4148
|
+
onChange: (_) => N("employeeCount", _ ?? void 0),
|
|
4149
|
+
min: 1,
|
|
4150
|
+
disabled: k,
|
|
4151
|
+
readOnly: S
|
|
4152
|
+
}
|
|
4153
|
+
)
|
|
4154
|
+
] })
|
|
4155
|
+
] }),
|
|
4156
|
+
y.includes("contact") && /* @__PURE__ */ c("div", { className: "nice-org-form__section", children: [
|
|
4157
|
+
/* @__PURE__ */ e(
|
|
4158
|
+
ge,
|
|
4159
|
+
{
|
|
4160
|
+
title: p("org.contact", "Contact Details"),
|
|
4161
|
+
expanded: x.has("contact"),
|
|
4162
|
+
onToggle: () => A("contact")
|
|
4163
|
+
}
|
|
4164
|
+
),
|
|
4165
|
+
x.has("contact") && /* @__PURE__ */ c("div", { className: "nice-org-form__fields", children: [
|
|
4166
|
+
/* @__PURE__ */ e(
|
|
4167
|
+
ae,
|
|
4168
|
+
{
|
|
4169
|
+
label: p("org.email", "Email"),
|
|
4170
|
+
value: n.email ?? "",
|
|
4171
|
+
onChange: (_) => N("email", _),
|
|
4172
|
+
type: "email",
|
|
4173
|
+
disabled: k,
|
|
4174
|
+
readOnly: S
|
|
4175
|
+
}
|
|
4176
|
+
),
|
|
4177
|
+
/* @__PURE__ */ e(
|
|
4178
|
+
ae,
|
|
4179
|
+
{
|
|
4180
|
+
label: p("org.phone", "Phone"),
|
|
4181
|
+
value: n.phone ?? "",
|
|
4182
|
+
onChange: (_) => N("phone", _),
|
|
4183
|
+
type: "tel",
|
|
4184
|
+
disabled: k,
|
|
4185
|
+
readOnly: S
|
|
4186
|
+
}
|
|
4187
|
+
),
|
|
4188
|
+
/* @__PURE__ */ e(
|
|
4189
|
+
ae,
|
|
4190
|
+
{
|
|
4191
|
+
label: p("org.website", "Website"),
|
|
4192
|
+
value: n.website ?? "",
|
|
4193
|
+
onChange: (_) => N("website", _),
|
|
4194
|
+
type: "url",
|
|
4195
|
+
disabled: k,
|
|
4196
|
+
readOnly: S
|
|
4197
|
+
}
|
|
4198
|
+
),
|
|
4199
|
+
/* @__PURE__ */ e(
|
|
4200
|
+
ae,
|
|
4201
|
+
{
|
|
4202
|
+
label: p("org.fax", "Fax"),
|
|
4203
|
+
value: n.fax ?? "",
|
|
4204
|
+
onChange: (_) => N("fax", _),
|
|
4205
|
+
type: "tel",
|
|
4206
|
+
disabled: k,
|
|
4207
|
+
readOnly: S
|
|
4208
|
+
}
|
|
4209
|
+
)
|
|
4210
|
+
] })
|
|
4211
|
+
] }),
|
|
4212
|
+
y.includes("address") && /* @__PURE__ */ c("div", { className: "nice-org-form__section", children: [
|
|
4213
|
+
/* @__PURE__ */ e(
|
|
4214
|
+
ge,
|
|
4215
|
+
{
|
|
4216
|
+
title: p("org.address", "Address"),
|
|
4217
|
+
expanded: x.has("address"),
|
|
4218
|
+
onToggle: () => A("address")
|
|
4219
|
+
}
|
|
4220
|
+
),
|
|
4221
|
+
x.has("address") && /* @__PURE__ */ c("div", { className: "nice-org-form__fields", children: [
|
|
4222
|
+
/* @__PURE__ */ e(
|
|
4223
|
+
ae,
|
|
4224
|
+
{
|
|
4225
|
+
label: p("org.street", "Street"),
|
|
4226
|
+
value: n.street ?? "",
|
|
4227
|
+
onChange: (_) => N("street", _),
|
|
4228
|
+
disabled: k,
|
|
4229
|
+
readOnly: S
|
|
4230
|
+
}
|
|
4231
|
+
),
|
|
4232
|
+
/* @__PURE__ */ e(
|
|
4233
|
+
ae,
|
|
4234
|
+
{
|
|
4235
|
+
label: p("org.city", "City"),
|
|
4236
|
+
value: n.city ?? "",
|
|
4237
|
+
onChange: (_) => N("city", _),
|
|
4238
|
+
disabled: k,
|
|
4239
|
+
readOnly: S
|
|
4240
|
+
}
|
|
4241
|
+
),
|
|
4242
|
+
/* @__PURE__ */ e(
|
|
4243
|
+
ae,
|
|
4244
|
+
{
|
|
4245
|
+
label: p("org.state", "State / Province"),
|
|
4246
|
+
value: n.state ?? "",
|
|
4247
|
+
onChange: (_) => N("state", _),
|
|
4248
|
+
disabled: k,
|
|
4249
|
+
readOnly: S
|
|
4250
|
+
}
|
|
4251
|
+
),
|
|
4252
|
+
/* @__PURE__ */ e(
|
|
4253
|
+
ae,
|
|
4254
|
+
{
|
|
4255
|
+
label: p("org.postalCode", "Postal Code"),
|
|
4256
|
+
value: n.postalCode ?? "",
|
|
4257
|
+
onChange: (_) => N("postalCode", _),
|
|
4258
|
+
disabled: k,
|
|
4259
|
+
readOnly: S
|
|
4260
|
+
}
|
|
4261
|
+
),
|
|
4262
|
+
b ? /* @__PURE__ */ e(
|
|
4263
|
+
Ce,
|
|
4264
|
+
{
|
|
4265
|
+
label: p("org.country", "Country"),
|
|
4266
|
+
value: n.country ?? "",
|
|
4267
|
+
onChange: (_) => N("country", _),
|
|
4268
|
+
options: b,
|
|
4269
|
+
searchable: !0,
|
|
4270
|
+
disabled: k,
|
|
4271
|
+
readOnly: S
|
|
4272
|
+
}
|
|
4273
|
+
) : /* @__PURE__ */ e(
|
|
4274
|
+
ae,
|
|
4275
|
+
{
|
|
4276
|
+
label: p("org.country", "Country"),
|
|
4277
|
+
value: n.country ?? "",
|
|
4278
|
+
onChange: (_) => N("country", _),
|
|
4279
|
+
disabled: k,
|
|
4280
|
+
readOnly: S
|
|
4281
|
+
}
|
|
4282
|
+
)
|
|
4283
|
+
] })
|
|
4284
|
+
] }),
|
|
4285
|
+
y.includes("branding") && /* @__PURE__ */ c("div", { className: "nice-org-form__section", children: [
|
|
4286
|
+
/* @__PURE__ */ e(
|
|
4287
|
+
ge,
|
|
4288
|
+
{
|
|
4289
|
+
title: p("org.branding", "Branding"),
|
|
4290
|
+
expanded: x.has("branding"),
|
|
4291
|
+
onToggle: () => A("branding")
|
|
4292
|
+
}
|
|
4293
|
+
),
|
|
4294
|
+
x.has("branding") && /* @__PURE__ */ c("div", { className: "nice-org-form__fields", children: [
|
|
4295
|
+
/* @__PURE__ */ e(
|
|
4296
|
+
ae,
|
|
4297
|
+
{
|
|
4298
|
+
label: p("org.logoUrl", "Logo URL"),
|
|
4299
|
+
value: n.logoUrl ?? "",
|
|
4300
|
+
onChange: (_) => N("logoUrl", _),
|
|
4301
|
+
type: "url",
|
|
4302
|
+
disabled: k,
|
|
4303
|
+
readOnly: S
|
|
4304
|
+
}
|
|
4305
|
+
),
|
|
4306
|
+
/* @__PURE__ */ e(
|
|
4307
|
+
Ye,
|
|
4308
|
+
{
|
|
4309
|
+
label: p("org.primaryColor", "Primary Color"),
|
|
4310
|
+
value: n.primaryColor ?? "#3b82f6",
|
|
4311
|
+
onChange: (_) => N("primaryColor", _),
|
|
4312
|
+
disabled: k,
|
|
4313
|
+
readOnly: S
|
|
4314
|
+
}
|
|
4315
|
+
),
|
|
4316
|
+
/* @__PURE__ */ e(
|
|
4317
|
+
Ye,
|
|
4318
|
+
{
|
|
4319
|
+
label: p("org.secondaryColor", "Secondary Color"),
|
|
4320
|
+
value: n.secondaryColor ?? "#8b5cf6",
|
|
4321
|
+
onChange: (_) => N("secondaryColor", _),
|
|
4322
|
+
disabled: k,
|
|
4323
|
+
readOnly: S
|
|
4324
|
+
}
|
|
4325
|
+
)
|
|
4326
|
+
] })
|
|
4327
|
+
] }),
|
|
4328
|
+
y.includes("localization") && /* @__PURE__ */ c("div", { className: "nice-org-form__section", children: [
|
|
4329
|
+
/* @__PURE__ */ e(
|
|
4330
|
+
ge,
|
|
4331
|
+
{
|
|
4332
|
+
title: p("org.localization", "Localization"),
|
|
4333
|
+
expanded: x.has("localization"),
|
|
4334
|
+
onToggle: () => A("localization")
|
|
4335
|
+
}
|
|
4336
|
+
),
|
|
4337
|
+
x.has("localization") && /* @__PURE__ */ c("div", { className: "nice-org-form__fields", children: [
|
|
4338
|
+
r ? /* @__PURE__ */ e(
|
|
4339
|
+
Ce,
|
|
4340
|
+
{
|
|
4341
|
+
label: p("org.language", "Default Language"),
|
|
4342
|
+
value: n.defaultLanguage ?? "",
|
|
4343
|
+
onChange: (_) => N("defaultLanguage", _),
|
|
4344
|
+
options: r,
|
|
4345
|
+
searchable: !0,
|
|
4346
|
+
disabled: k,
|
|
4347
|
+
readOnly: S
|
|
4348
|
+
}
|
|
4349
|
+
) : /* @__PURE__ */ e(
|
|
4350
|
+
ae,
|
|
4351
|
+
{
|
|
4352
|
+
label: p("org.language", "Default Language"),
|
|
4353
|
+
value: n.defaultLanguage ?? "",
|
|
4354
|
+
onChange: (_) => N("defaultLanguage", _),
|
|
4355
|
+
disabled: k,
|
|
4356
|
+
readOnly: S
|
|
4357
|
+
}
|
|
4358
|
+
),
|
|
4359
|
+
t ? /* @__PURE__ */ e(
|
|
4360
|
+
Ce,
|
|
4361
|
+
{
|
|
4362
|
+
label: p("org.currency", "Default Currency"),
|
|
4363
|
+
value: n.defaultCurrency ?? "",
|
|
4364
|
+
onChange: (_) => N("defaultCurrency", _),
|
|
4365
|
+
options: t,
|
|
4366
|
+
searchable: !0,
|
|
4367
|
+
disabled: k,
|
|
4368
|
+
readOnly: S
|
|
4369
|
+
}
|
|
4370
|
+
) : /* @__PURE__ */ e(
|
|
4371
|
+
ae,
|
|
4372
|
+
{
|
|
4373
|
+
label: p("org.currency", "Default Currency"),
|
|
4374
|
+
value: n.defaultCurrency ?? "",
|
|
4375
|
+
onChange: (_) => N("defaultCurrency", _),
|
|
4376
|
+
disabled: k,
|
|
4377
|
+
readOnly: S
|
|
4378
|
+
}
|
|
4379
|
+
),
|
|
4380
|
+
u ? /* @__PURE__ */ e(
|
|
4381
|
+
Ce,
|
|
4382
|
+
{
|
|
4383
|
+
label: p("org.timezone", "Default Timezone"),
|
|
4384
|
+
value: n.defaultTimezone ?? "",
|
|
4385
|
+
onChange: (_) => N("defaultTimezone", _),
|
|
4386
|
+
options: u,
|
|
4387
|
+
searchable: !0,
|
|
4388
|
+
disabled: k,
|
|
4389
|
+
readOnly: S
|
|
4390
|
+
}
|
|
4391
|
+
) : /* @__PURE__ */ e(
|
|
4392
|
+
ae,
|
|
4393
|
+
{
|
|
4394
|
+
label: p("org.timezone", "Default Timezone"),
|
|
4395
|
+
value: n.defaultTimezone ?? "",
|
|
4396
|
+
onChange: (_) => N("defaultTimezone", _),
|
|
4397
|
+
disabled: k,
|
|
4398
|
+
readOnly: S
|
|
4399
|
+
}
|
|
4400
|
+
),
|
|
4401
|
+
/* @__PURE__ */ e(
|
|
4402
|
+
Ce,
|
|
4403
|
+
{
|
|
4404
|
+
label: p("org.dateFormat", "Date Format"),
|
|
4405
|
+
value: n.dateFormat ?? "YYYY-MM-DD",
|
|
4406
|
+
onChange: (_) => N("dateFormat", _),
|
|
4407
|
+
options: Hn,
|
|
4408
|
+
disabled: k,
|
|
4409
|
+
readOnly: S
|
|
4410
|
+
}
|
|
4411
|
+
)
|
|
4412
|
+
] })
|
|
4413
|
+
] }),
|
|
4414
|
+
y.includes("fiscal") && /* @__PURE__ */ c("div", { className: "nice-org-form__section", children: [
|
|
4415
|
+
/* @__PURE__ */ e(
|
|
4416
|
+
ge,
|
|
4417
|
+
{
|
|
4418
|
+
title: p("org.fiscal", "Fiscal Settings"),
|
|
4419
|
+
expanded: x.has("fiscal"),
|
|
4420
|
+
onToggle: () => A("fiscal")
|
|
4421
|
+
}
|
|
4422
|
+
),
|
|
4423
|
+
x.has("fiscal") && /* @__PURE__ */ c("div", { className: "nice-org-form__fields", children: [
|
|
4424
|
+
/* @__PURE__ */ e(
|
|
4425
|
+
ae,
|
|
4426
|
+
{
|
|
4427
|
+
label: p("org.fiscalYearStart", "Fiscal Year Start"),
|
|
4428
|
+
value: n.fiscalYearStart ?? "",
|
|
4429
|
+
onChange: (_) => N("fiscalYearStart", _),
|
|
4430
|
+
placeholder: "MM-DD",
|
|
4431
|
+
disabled: k,
|
|
4432
|
+
readOnly: S
|
|
4433
|
+
}
|
|
4434
|
+
),
|
|
4435
|
+
/* @__PURE__ */ e(
|
|
4436
|
+
qe,
|
|
4437
|
+
{
|
|
4438
|
+
label: p("org.vatEnabled", "VAT Enabled"),
|
|
4439
|
+
checked: n.vatEnabled ?? !1,
|
|
4440
|
+
onChange: (_) => N("vatEnabled", _),
|
|
4441
|
+
disabled: k || S
|
|
4442
|
+
}
|
|
4443
|
+
),
|
|
4444
|
+
n.vatEnabled && /* @__PURE__ */ e(
|
|
4445
|
+
Re,
|
|
4446
|
+
{
|
|
4447
|
+
label: p("org.defaultVatRate", "Default VAT Rate (%)"),
|
|
4448
|
+
value: n.defaultVatRate ?? null,
|
|
4449
|
+
onChange: (_) => N("defaultVatRate", _ ?? void 0),
|
|
4450
|
+
min: 0,
|
|
4451
|
+
max: 100,
|
|
4452
|
+
step: 0.5,
|
|
4453
|
+
disabled: k,
|
|
4454
|
+
readOnly: S
|
|
4455
|
+
}
|
|
4456
|
+
)
|
|
4457
|
+
] })
|
|
4458
|
+
] }),
|
|
4459
|
+
y.includes("preferences") && /* @__PURE__ */ c("div", { className: "nice-org-form__section", children: [
|
|
4460
|
+
/* @__PURE__ */ e(
|
|
4461
|
+
ge,
|
|
4462
|
+
{
|
|
4463
|
+
title: p("org.preferences", "Work Preferences"),
|
|
4464
|
+
expanded: x.has("preferences"),
|
|
4465
|
+
onToggle: () => A("preferences")
|
|
4466
|
+
}
|
|
4467
|
+
),
|
|
4468
|
+
x.has("preferences") && /* @__PURE__ */ c("div", { className: "nice-org-form__fields", children: [
|
|
4469
|
+
/* @__PURE__ */ c("div", { className: "nice-org-form__field-group", children: [
|
|
4470
|
+
/* @__PURE__ */ e("label", { className: "nice-org-form__group-label", children: p("org.workingDays", "Working Days") }),
|
|
4471
|
+
/* @__PURE__ */ e("div", { className: "nice-org-form__checkboxes", children: Vn.map((_) => /* @__PURE__ */ e(
|
|
4472
|
+
en,
|
|
4473
|
+
{
|
|
4474
|
+
label: _.label,
|
|
4475
|
+
checked: (n.workingDays ?? ["Mon", "Tue", "Wed", "Thu", "Fri"]).includes(_.key),
|
|
4476
|
+
onChange: (Y) => {
|
|
4477
|
+
const K = n.workingDays ?? ["Mon", "Tue", "Wed", "Thu", "Fri"], Q = Y ? [...K, _.key] : K.filter((W) => W !== _.key);
|
|
4478
|
+
N("workingDays", Q);
|
|
4479
|
+
},
|
|
4480
|
+
disabled: k || S
|
|
4481
|
+
},
|
|
4482
|
+
_.key
|
|
4483
|
+
)) })
|
|
4484
|
+
] }),
|
|
4485
|
+
/* @__PURE__ */ e(
|
|
4486
|
+
ae,
|
|
4487
|
+
{
|
|
4488
|
+
label: p("org.workStart", "Working Hours Start"),
|
|
4489
|
+
value: n.workingHoursStart ?? "09:00",
|
|
4490
|
+
onChange: (_) => N("workingHoursStart", _),
|
|
4491
|
+
placeholder: "HH:MM",
|
|
4492
|
+
disabled: k,
|
|
4493
|
+
readOnly: S
|
|
4494
|
+
}
|
|
4495
|
+
),
|
|
4496
|
+
/* @__PURE__ */ e(
|
|
4497
|
+
ae,
|
|
4498
|
+
{
|
|
4499
|
+
label: p("org.workEnd", "Working Hours End"),
|
|
4500
|
+
value: n.workingHoursEnd ?? "17:00",
|
|
4501
|
+
onChange: (_) => N("workingHoursEnd", _),
|
|
4502
|
+
placeholder: "HH:MM",
|
|
4503
|
+
disabled: k,
|
|
4504
|
+
readOnly: S
|
|
4505
|
+
}
|
|
4506
|
+
)
|
|
4507
|
+
] })
|
|
4508
|
+
] }),
|
|
4509
|
+
o && /* @__PURE__ */ c("div", { className: "nice-org-form__actions", children: [
|
|
4510
|
+
l && /* @__PURE__ */ e(Ie, { variant: "secondary", onClick: l, disabled: m, children: p("cancel", "Cancel") }),
|
|
4511
|
+
i && /* @__PURE__ */ e(Ie, { variant: "primary", onClick: D, loading: m, disabled: S || k, children: p("save", "Save") })
|
|
4512
|
+
] })
|
|
4513
|
+
]
|
|
4514
|
+
}
|
|
4515
|
+
);
|
|
4516
|
+
}
|
|
4517
|
+
);
|
|
4518
|
+
Kn.displayName = "NiceOrganizationProfileForm";
|
|
4519
|
+
const Qn = {
|
|
4520
|
+
available: { color: "#6b7280", icon: "○" },
|
|
4521
|
+
installed: { color: "#3b82f6", icon: "◉" },
|
|
4522
|
+
active: { color: "#10b981", icon: "●" },
|
|
4523
|
+
disabled: { color: "#f59e0b", icon: "◌" },
|
|
4524
|
+
error: { color: "#ef4444", icon: "⊘" },
|
|
4525
|
+
updating: { color: "#8b5cf6", icon: "↻" }
|
|
4526
|
+
};
|
|
4527
|
+
function Xn(n, a) {
|
|
4528
|
+
switch (n) {
|
|
4529
|
+
case "available":
|
|
4530
|
+
return ["install"];
|
|
4531
|
+
case "installed":
|
|
4532
|
+
return ["activate", ...a ? [] : ["uninstall"]];
|
|
4533
|
+
case "active":
|
|
4534
|
+
return ["deactivate"];
|
|
4535
|
+
case "disabled":
|
|
4536
|
+
return ["activate", ...a ? [] : ["uninstall"]];
|
|
4537
|
+
case "error":
|
|
4538
|
+
return ["activate", ...a ? [] : ["uninstall"]];
|
|
4539
|
+
case "updating":
|
|
4540
|
+
return [];
|
|
4541
|
+
default:
|
|
4542
|
+
return [];
|
|
4543
|
+
}
|
|
4544
|
+
}
|
|
4545
|
+
const Gn = ({ module: n, onAction: a, onClick: i, showDependencies: l, showAuthor: s, showVersion: h, processing: o, disabled: b, readOnly: r, t, layout: u }) => {
|
|
4546
|
+
const m = Qn[n.status], w = Xn(n.status, n.isCore);
|
|
4547
|
+
return /* @__PURE__ */ c(
|
|
4548
|
+
"div",
|
|
4549
|
+
{
|
|
4550
|
+
className: `nice-module-card nice-module-card--${u} nice-module-card--${n.status}`,
|
|
4551
|
+
onClick: i,
|
|
4552
|
+
role: i ? "button" : void 0,
|
|
4553
|
+
tabIndex: i ? 0 : void 0,
|
|
4554
|
+
onKeyDown: i ? (d) => {
|
|
4555
|
+
(d.key === "Enter" || d.key === " ") && (d.preventDefault(), i());
|
|
4556
|
+
} : void 0,
|
|
4557
|
+
children: [
|
|
4558
|
+
/* @__PURE__ */ c("div", { className: "nice-module-card__header", children: [
|
|
4559
|
+
/* @__PURE__ */ e("span", { className: "nice-module-card__icon", children: n.icon ?? "📦" }),
|
|
4560
|
+
/* @__PURE__ */ c("div", { className: "nice-module-card__info", children: [
|
|
4561
|
+
/* @__PURE__ */ e("div", { className: "nice-module-card__name", children: n.label }),
|
|
4562
|
+
h && /* @__PURE__ */ c("span", { className: "nice-module-card__version", children: [
|
|
4563
|
+
"v",
|
|
4564
|
+
n.version
|
|
4565
|
+
] })
|
|
4566
|
+
] }),
|
|
4567
|
+
/* @__PURE__ */ c(
|
|
4568
|
+
"span",
|
|
4569
|
+
{
|
|
4570
|
+
className: "nice-module-card__status",
|
|
4571
|
+
style: { color: m.color },
|
|
4572
|
+
title: n.status,
|
|
4573
|
+
children: [
|
|
4574
|
+
o ? "⟳" : m.icon,
|
|
4575
|
+
" ",
|
|
4576
|
+
n.status
|
|
4577
|
+
]
|
|
4578
|
+
}
|
|
4579
|
+
)
|
|
4580
|
+
] }),
|
|
4581
|
+
/* @__PURE__ */ e("div", { className: "nice-module-card__desc", children: n.description }),
|
|
4582
|
+
/* @__PURE__ */ c("div", { className: "nice-module-card__meta", children: [
|
|
4583
|
+
s && n.author && /* @__PURE__ */ e("span", { className: "nice-module-card__author", children: n.author }),
|
|
4584
|
+
n.isCore && /* @__PURE__ */ e("span", { className: "nice-module-card__badge nice-module-card__badge--core", children: t("module.core", "Core") })
|
|
4585
|
+
] }),
|
|
4586
|
+
l && n.dependencies && n.dependencies.length > 0 && /* @__PURE__ */ c("div", { className: "nice-module-card__deps", children: [
|
|
4587
|
+
/* @__PURE__ */ c("span", { className: "nice-module-card__deps-label", children: [
|
|
4588
|
+
t("module.deps", "Dependencies"),
|
|
4589
|
+
":"
|
|
4590
|
+
] }),
|
|
4591
|
+
n.dependencies.map((d) => /* @__PURE__ */ e("span", { className: "nice-module-card__dep-tag", children: d }, d))
|
|
4592
|
+
] }),
|
|
4593
|
+
!r && w.length > 0 && /* @__PURE__ */ e("div", { className: "nice-module-card__actions", children: w.map((d) => /* @__PURE__ */ e(
|
|
4594
|
+
Ie,
|
|
4595
|
+
{
|
|
4596
|
+
size: "sm",
|
|
4597
|
+
variant: d === "uninstall" ? "error" : d === "activate" ? "primary" : "secondary",
|
|
4598
|
+
onClick: (g) => {
|
|
4599
|
+
g.stopPropagation(), a(d);
|
|
4600
|
+
},
|
|
4601
|
+
disabled: b || o,
|
|
4602
|
+
loading: o,
|
|
4603
|
+
children: t(`module.${d}`, d.charAt(0).toUpperCase() + d.slice(1))
|
|
4604
|
+
},
|
|
4605
|
+
d
|
|
4606
|
+
)) })
|
|
4607
|
+
]
|
|
4608
|
+
}
|
|
4609
|
+
);
|
|
4610
|
+
}, Jn = ne(
|
|
4611
|
+
({
|
|
4612
|
+
modules: n,
|
|
4613
|
+
onAction: a,
|
|
4614
|
+
statusFilter: i,
|
|
4615
|
+
searchable: l = !0,
|
|
4616
|
+
showDependencies: s = !0,
|
|
4617
|
+
showAuthor: h = !0,
|
|
4618
|
+
showVersion: o = !0,
|
|
4619
|
+
processingModules: b,
|
|
4620
|
+
layout: r = "list",
|
|
4621
|
+
gridColumns: t = 3,
|
|
4622
|
+
onModuleClick: u,
|
|
4623
|
+
className: m,
|
|
4624
|
+
style: w,
|
|
4625
|
+
id: d,
|
|
4626
|
+
accessMode: g,
|
|
4627
|
+
...z
|
|
4628
|
+
}, M) => {
|
|
4629
|
+
const T = ie(d), f = ce(g, d), { t: $ } = oe(), [p, y] = R(""), [x, C] = R("all"), A = f === "readOnly", S = f === "disabled", k = le(() => {
|
|
4630
|
+
let _ = n;
|
|
4631
|
+
if (i && i.length > 0 && (_ = _.filter((Y) => i.includes(Y.status))), x !== "all" && (_ = _.filter((Y) => Y.status === x)), p) {
|
|
4632
|
+
const Y = p.toLowerCase();
|
|
4633
|
+
_ = _.filter(
|
|
4634
|
+
(K) => K.label.toLowerCase().includes(Y) || K.name.toLowerCase().includes(Y) || K.description.toLowerCase().includes(Y)
|
|
4635
|
+
);
|
|
4636
|
+
}
|
|
4637
|
+
return _;
|
|
4638
|
+
}, [n, i, x, p]), N = le(() => {
|
|
4639
|
+
const _ = { all: n.length };
|
|
4640
|
+
for (const Y of n)
|
|
4641
|
+
_[Y.status] = (_[Y.status] ?? 0) + 1;
|
|
4642
|
+
return _;
|
|
4643
|
+
}, [n]), D = L(
|
|
4644
|
+
(_, Y) => {
|
|
4645
|
+
a?.(_, Y);
|
|
4646
|
+
},
|
|
4647
|
+
[a]
|
|
4648
|
+
);
|
|
4649
|
+
return f === "hidden" ? null : /* @__PURE__ */ c(
|
|
4650
|
+
"div",
|
|
4651
|
+
{
|
|
4652
|
+
ref: M,
|
|
4653
|
+
id: T,
|
|
4654
|
+
className: `nice-module-panel ${m ?? ""}`,
|
|
4655
|
+
style: w,
|
|
4656
|
+
...z,
|
|
4657
|
+
children: [
|
|
4658
|
+
/* @__PURE__ */ c("div", { className: "nice-module-panel__toolbar", children: [
|
|
4659
|
+
l && /* @__PURE__ */ e(
|
|
4660
|
+
ae,
|
|
4661
|
+
{
|
|
4662
|
+
value: p,
|
|
4663
|
+
onChange: y,
|
|
4664
|
+
placeholder: $("module.search", "Search modules…"),
|
|
4665
|
+
type: "search",
|
|
4666
|
+
clearable: !0,
|
|
4667
|
+
className: "nice-module-panel__search"
|
|
4668
|
+
}
|
|
4669
|
+
),
|
|
4670
|
+
/* @__PURE__ */ e("div", { className: "nice-module-panel__filters", role: "tablist", children: ["all", "active", "installed", "disabled", "available", "error"].map((_) => /* @__PURE__ */ c(
|
|
4671
|
+
"button",
|
|
4672
|
+
{
|
|
4673
|
+
className: `nice-module-panel__filter ${x === _ ? "nice-module-panel__filter--active" : ""}`,
|
|
4674
|
+
onClick: () => C(_),
|
|
4675
|
+
role: "tab",
|
|
4676
|
+
"aria-selected": x === _,
|
|
4677
|
+
type: "button",
|
|
4678
|
+
children: [
|
|
4679
|
+
$(`module.status.${_}`, _ === "all" ? "All" : _.charAt(0).toUpperCase() + _.slice(1)),
|
|
4680
|
+
/* @__PURE__ */ e("span", { className: "nice-module-panel__filter-count", children: N[_] ?? 0 })
|
|
4681
|
+
]
|
|
4682
|
+
},
|
|
4683
|
+
_
|
|
4684
|
+
)) })
|
|
4685
|
+
] }),
|
|
4686
|
+
/* @__PURE__ */ e(
|
|
4687
|
+
"div",
|
|
4688
|
+
{
|
|
4689
|
+
className: `nice-module-panel__grid nice-module-panel__grid--${r}`,
|
|
4690
|
+
style: r === "grid" ? { gridTemplateColumns: `repeat(${t}, 1fr)` } : void 0,
|
|
4691
|
+
children: k.length === 0 ? /* @__PURE__ */ e("div", { className: "nice-module-panel__empty", children: $("module.empty", "No modules found") }) : k.map((_) => /* @__PURE__ */ e(
|
|
4692
|
+
Gn,
|
|
4693
|
+
{
|
|
4694
|
+
module: _,
|
|
4695
|
+
onAction: (Y) => D(_.id, Y),
|
|
4696
|
+
onClick: u ? () => u(_) : void 0,
|
|
4697
|
+
showDependencies: s,
|
|
4698
|
+
showAuthor: h,
|
|
4699
|
+
showVersion: o,
|
|
4700
|
+
processing: b?.has(_.id) ?? !1,
|
|
4701
|
+
disabled: S,
|
|
4702
|
+
readOnly: A,
|
|
4703
|
+
t: $,
|
|
4704
|
+
layout: r
|
|
4705
|
+
},
|
|
4706
|
+
_.id
|
|
4707
|
+
))
|
|
4708
|
+
}
|
|
4709
|
+
),
|
|
4710
|
+
/* @__PURE__ */ c("div", { className: "nice-module-panel__summary", children: [
|
|
4711
|
+
$("module.total", "Total"),
|
|
4712
|
+
": ",
|
|
4713
|
+
n.length,
|
|
4714
|
+
" ·",
|
|
4715
|
+
$("module.status.active", "Active"),
|
|
4716
|
+
": ",
|
|
4717
|
+
N.active ?? 0,
|
|
4718
|
+
" ·",
|
|
4719
|
+
$("module.status.disabled", "Disabled"),
|
|
4720
|
+
": ",
|
|
4721
|
+
N.disabled ?? 0,
|
|
4722
|
+
" ·",
|
|
4723
|
+
$("module.status.error", "Error"),
|
|
4724
|
+
": ",
|
|
4725
|
+
N.error ?? 0
|
|
4726
|
+
] })
|
|
4727
|
+
]
|
|
4728
|
+
}
|
|
4729
|
+
);
|
|
4730
|
+
}
|
|
4731
|
+
);
|
|
4732
|
+
Jn.displayName = "NiceModuleLifecyclePanel";
|
|
4733
|
+
export {
|
|
4734
|
+
Pn as A,
|
|
4735
|
+
Kn as B,
|
|
4736
|
+
ta as C,
|
|
4737
|
+
Ue as D,
|
|
4738
|
+
vn as E,
|
|
4739
|
+
ma as F,
|
|
4740
|
+
ua as G,
|
|
4741
|
+
da as H,
|
|
4742
|
+
ia as I,
|
|
4743
|
+
gn as J,
|
|
4744
|
+
_a as K,
|
|
4745
|
+
yn as L,
|
|
4746
|
+
pn as M,
|
|
4747
|
+
ca as N,
|
|
4748
|
+
ha as O,
|
|
4749
|
+
xe as S,
|
|
4750
|
+
_n as a,
|
|
4751
|
+
un as b,
|
|
4752
|
+
on as c,
|
|
4753
|
+
dn as d,
|
|
4754
|
+
Fe as e,
|
|
4755
|
+
ln as f,
|
|
4756
|
+
tn as g,
|
|
4757
|
+
la as h,
|
|
4758
|
+
sa as i,
|
|
4759
|
+
Yn as j,
|
|
4760
|
+
Fn as k,
|
|
4761
|
+
bn as l,
|
|
4762
|
+
ra as m,
|
|
4763
|
+
cn as n,
|
|
4764
|
+
Rn as o,
|
|
4765
|
+
hn as p,
|
|
4766
|
+
rn as q,
|
|
4767
|
+
$n as r,
|
|
4768
|
+
jn as s,
|
|
4769
|
+
An as t,
|
|
4770
|
+
sn as u,
|
|
4771
|
+
an as v,
|
|
4772
|
+
Wn as w,
|
|
4773
|
+
Jn as x,
|
|
4774
|
+
oa as y,
|
|
4775
|
+
Nn as z
|
|
4776
|
+
};
|