@nice2dev/ui 1.3.17 → 1.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +146 -0
- package/README.md +29 -2
- package/dist/{NiceDataGrid-aNPAHsWy.cjs → NiceDataGrid-BT6iCUgP.cjs} +1 -1
- package/dist/NiceForm-Bysp66Ef.cjs +1 -0
- package/dist/{NiceMention-CMqAGvO0.cjs → NiceMention-sc8W-DwH.cjs} +1 -1
- package/dist/NiceModuleLifecyclePanel-DBQPCa_V.cjs +1 -0
- package/dist/{NiceSavedQueryPanel-JHrSlHAV.cjs → NiceSavedQueryPanel-BbznsXFd.cjs} +1 -1
- package/dist/{NiceScheduler-2TwOZq-y.cjs → NiceScheduler-3Ez0zSQJ.cjs} +1 -1
- package/dist/{core-lazy-Cda-D35m.cjs → core-lazy-CL4ZIxF-.cjs} +1 -1
- package/dist/data/treeDragSession.mjs +52 -46
- package/dist/data.cjs +1 -1
- package/dist/editors/inputs/NiceAutocomplete.mjs +44 -46
- package/dist/editors/pickers/NiceDateTimePicker.mjs +1 -1
- package/dist/editors/pickers/pickerCommons.mjs +284 -87
- package/dist/editors/pickers/themePickerHelpers.mjs +10 -8
- package/dist/editors.cjs +1 -1
- package/dist/index.cjs +162 -162
- package/dist/index.d.ts +253 -31
- package/dist/index.mjs +1517 -1483
- package/dist/navigation/NiceIconRail.mjs +74 -53
- package/dist/navigation/NiceNavShell.mjs +855 -807
- package/dist/navigation/NiceSetupWizard.mjs +287 -278
- package/dist/navigation/NiceSidebarNav.mjs +1487 -1144
- package/dist/navigation/navItemDrag.mjs +42 -0
- package/dist/navigation/navShellPane.mjs +16 -11
- package/dist/navigation/sidebarColors.mjs +61 -50
- package/dist/navigation/sidebarNavTypes.mjs +1 -0
- package/dist/navigation/sidebarSearch.mjs +28 -0
- package/dist/navigation.cjs +1 -1
- package/dist/navigation.d.ts +70 -21
- package/dist/pickerCommons-CwcCc8Qi.cjs +1 -0
- package/dist/planning/NiceResourceAllocation.mjs +31 -31
- package/dist/style.css +4 -4
- package/dist/tools/NiceThemeDesigner.mjs +781 -708
- package/dist/tools/NiceThemePreview.mjs +344 -282
- package/dist/tools/themeCatalog.mjs +28 -44
- package/dist/tools/themeCatalogArchive.mjs +38 -0
- package/dist/tools/themeDesigner/ThemeSetEditors.mjs +400 -0
- package/dist/tools/themeDesigner/ThemeValueField.mjs +146 -0
- package/dist/tools/themeDesigner/themeDesignerPaths.mjs +105 -0
- package/package.json +4 -4
- package/dist/NiceForm-BtRBLffD.cjs +0 -1
- package/dist/NiceModuleLifecyclePanel-ugNtHimh.cjs +0 -1
- package/dist/pickerCommons-BWglYl6J.cjs +0 -1
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { useState as m, useRef as a, useEffect as l } from "react";
|
|
2
|
+
import { useTreeDragSession as y } from "../data/treeDragSession.mjs";
|
|
3
|
+
const d = (t) => ({
|
|
4
|
+
kind: "nice-nav-item",
|
|
5
|
+
item: t
|
|
6
|
+
});
|
|
7
|
+
function p(t) {
|
|
8
|
+
return typeof t == "object" && t !== null && t.kind === "nice-nav-item";
|
|
9
|
+
}
|
|
10
|
+
function D() {
|
|
11
|
+
const t = y(), [s, i] = m(!1);
|
|
12
|
+
return l(() => {
|
|
13
|
+
if (t)
|
|
14
|
+
return t.subscribe((r) => {
|
|
15
|
+
p(r.payload) && i(r.type === "move");
|
|
16
|
+
});
|
|
17
|
+
}, [t]), s;
|
|
18
|
+
}
|
|
19
|
+
function I(t, s, i) {
|
|
20
|
+
const r = y(), [x, f] = m(!1), o = a(s);
|
|
21
|
+
o.current = s;
|
|
22
|
+
const u = a(i);
|
|
23
|
+
return u.current = i, l(() => {
|
|
24
|
+
if (r)
|
|
25
|
+
return r.subscribe((e) => {
|
|
26
|
+
if (!p(e.payload) || !o.current)
|
|
27
|
+
return;
|
|
28
|
+
const n = t.current?.getBoundingClientRect(), c = !!n && e.x >= n.left && e.x <= n.right && e.y >= n.top && e.y <= n.bottom;
|
|
29
|
+
if (e.type === "move") {
|
|
30
|
+
f(c), u.current?.(c ? { x: e.x, y: e.y } : null);
|
|
31
|
+
return;
|
|
32
|
+
}
|
|
33
|
+
f(!1), u.current?.(null), e.commit && c && o.current(e.payload.item, { x: e.x, y: e.y });
|
|
34
|
+
});
|
|
35
|
+
}, [r, t]), x;
|
|
36
|
+
}
|
|
37
|
+
export {
|
|
38
|
+
p as isNavItemDrag,
|
|
39
|
+
d as navItemDrag,
|
|
40
|
+
D as useNavItemDragActive,
|
|
41
|
+
I as useNavItemDrop
|
|
42
|
+
};
|
|
@@ -1,18 +1,23 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import { useContext as
|
|
3
|
-
import { createPortal as
|
|
4
|
-
const
|
|
1
|
+
import { jsx as n, Fragment as o } from "react/jsx-runtime";
|
|
2
|
+
import { useContext as a, createContext as i } from "react";
|
|
3
|
+
import { createPortal as r } from "react-dom";
|
|
4
|
+
const u = /* @__PURE__ */ i(
|
|
5
5
|
null
|
|
6
6
|
);
|
|
7
|
-
function
|
|
8
|
-
return
|
|
7
|
+
function l() {
|
|
8
|
+
return a(u);
|
|
9
9
|
}
|
|
10
|
-
function p({ children:
|
|
11
|
-
const
|
|
12
|
-
return
|
|
10
|
+
function p({ children: t }) {
|
|
11
|
+
const e = l();
|
|
12
|
+
return e?.inSplit ? e.footerSlot ? r(t, e.footerSlot) : null : /* @__PURE__ */ n(o, { children: t });
|
|
13
|
+
}
|
|
14
|
+
function N({ children: t }) {
|
|
15
|
+
const e = l();
|
|
16
|
+
return e?.inSplit ? e.headerSlot ? r(t, e.headerSlot) : null : /* @__PURE__ */ n(o, { children: t });
|
|
13
17
|
}
|
|
14
18
|
export {
|
|
15
|
-
|
|
19
|
+
u as NiceNavShellPaneContext,
|
|
16
20
|
p as NiceNavShellPaneFooter,
|
|
17
|
-
|
|
21
|
+
N as NiceNavShellPaneHeader,
|
|
22
|
+
l as useNiceNavShellPane
|
|
18
23
|
};
|
|
@@ -1,97 +1,108 @@
|
|
|
1
|
-
import { isDerivableColor as
|
|
2
|
-
const
|
|
1
|
+
import { isDerivableColor as g, nestingLevelColors as h } from "@nice2dev/ui-core";
|
|
2
|
+
const u = 10, x = 0.12, b = "var(--nice-text-on-warning, #0f172a)";
|
|
3
3
|
function s(e) {
|
|
4
|
-
return Math.min(Math.max(e, 1),
|
|
4
|
+
return Math.min(Math.max(e, 1), u);
|
|
5
5
|
}
|
|
6
|
-
function
|
|
7
|
-
return
|
|
6
|
+
function v(e) {
|
|
7
|
+
return g(e) ? h(1, { palette: [e] }, e, b)[0] : {
|
|
8
8
|
bg: e,
|
|
9
9
|
text: "inherit",
|
|
10
10
|
hoverBg: `color-mix(in srgb, ${e} 88%, currentColor)`,
|
|
11
11
|
activeBg: `color-mix(in srgb, ${e} 76%, currentColor)`
|
|
12
12
|
};
|
|
13
13
|
}
|
|
14
|
-
function
|
|
15
|
-
const
|
|
14
|
+
function d(e, r, n) {
|
|
15
|
+
const i = u - s(r) + 1;
|
|
16
16
|
if (e.length === 0)
|
|
17
17
|
return [];
|
|
18
|
-
const
|
|
19
|
-
if (
|
|
20
|
-
const
|
|
21
|
-
if (
|
|
22
|
-
const
|
|
23
|
-
|
|
24
|
-
{ palette: [
|
|
25
|
-
|
|
18
|
+
const o = e.slice(0, i).map(v), t = i - o.length;
|
|
19
|
+
if (t > 0) {
|
|
20
|
+
const c = e[e.length - 1];
|
|
21
|
+
if (g(c)) {
|
|
22
|
+
const l = h(
|
|
23
|
+
t + 1,
|
|
24
|
+
{ palette: [c], bgDerivation: n, bgStep: x },
|
|
25
|
+
c,
|
|
26
26
|
b
|
|
27
27
|
);
|
|
28
|
-
|
|
28
|
+
o.push(...l.slice(1));
|
|
29
29
|
} else
|
|
30
|
-
|
|
30
|
+
o.push(...Array.from({ length: t }, () => v(c)));
|
|
31
31
|
}
|
|
32
|
-
return
|
|
32
|
+
return o;
|
|
33
33
|
}
|
|
34
|
-
function
|
|
34
|
+
function p(e, r) {
|
|
35
35
|
const n = {};
|
|
36
|
-
return e.forEach((
|
|
37
|
-
const
|
|
38
|
-
n[`--nice-sidebar-level-${
|
|
36
|
+
return e.forEach((i, o) => {
|
|
37
|
+
const t = s(r) + o;
|
|
38
|
+
n[`--nice-sidebar-level-${t}-bg`] = i.bg, n[`--nice-sidebar-level-${t}-text`] = i.text, n[`--nice-sidebar-level-${t}-hover-bg`] = i.hoverBg, n[`--nice-sidebar-level-${t}-active-bg`] = i.activeBg;
|
|
39
39
|
}), n;
|
|
40
40
|
}
|
|
41
41
|
function E(e, r) {
|
|
42
|
-
return e && e.length > 0 ? { colors:
|
|
42
|
+
return e && e.length > 0 ? { colors: d(e, 1, r), fromLevel: 1 } : { fromLevel: 1 };
|
|
43
43
|
}
|
|
44
|
-
function
|
|
45
|
-
const
|
|
46
|
-
if (!
|
|
44
|
+
function C(e, r, n, i) {
|
|
45
|
+
const o = r?.levelColors?.length ? r.levelColors : r?.color ? [r.color] : void 0;
|
|
46
|
+
if (!o)
|
|
47
47
|
return { scope: e };
|
|
48
|
-
const
|
|
48
|
+
const t = s(n), c = d(o, t, i);
|
|
49
49
|
return {
|
|
50
|
-
scope: { colors:
|
|
51
|
-
vars:
|
|
50
|
+
scope: { colors: c, fromLevel: t, branchColor: o[0] },
|
|
51
|
+
vars: p(c, t)
|
|
52
52
|
};
|
|
53
53
|
}
|
|
54
|
-
function
|
|
54
|
+
function w(e, r) {
|
|
55
55
|
return e.colors?.[s(r) - e.fromLevel];
|
|
56
56
|
}
|
|
57
57
|
function S(e) {
|
|
58
|
-
return
|
|
58
|
+
return v(e);
|
|
59
59
|
}
|
|
60
|
-
const
|
|
61
|
-
function
|
|
62
|
-
const n = Math.min(e,
|
|
60
|
+
const f = 6, $ = "45%";
|
|
61
|
+
function a(e, r) {
|
|
62
|
+
const n = Math.min(e, f);
|
|
63
63
|
return `var(--nice-sidebar-level-${e}-${r}, var(--nice-sidebar-shade-${n}-${r}))`;
|
|
64
64
|
}
|
|
65
65
|
function B() {
|
|
66
66
|
return {
|
|
67
|
-
"--nice-source-head-bg":
|
|
68
|
-
"--nice-source-head-color":
|
|
69
|
-
|
|
67
|
+
"--nice-source-head-bg": a(1, "bg"),
|
|
68
|
+
"--nice-source-head-color": a(1, "text"),
|
|
69
|
+
// 1.4.0: the first level of the active path — the highlight over the header, at its weakest
|
|
70
|
+
"--nice-source-head-bg-active": m(1, a(1, "bg")),
|
|
70
71
|
"--nice-source-head-accent": "var(--nice-source-head-color)"
|
|
71
72
|
};
|
|
72
73
|
}
|
|
74
|
+
function m(e, r) {
|
|
75
|
+
const n = Math.min(e, f);
|
|
76
|
+
return `var(--nice-sidenav-path-${e}-bg, color-mix(in srgb, var(--nice-sidenav-highlight) var(--nice-sidenav-highlight-step-${n}), ${r}))`;
|
|
77
|
+
}
|
|
73
78
|
function V(e, r) {
|
|
74
|
-
const n = s(e),
|
|
79
|
+
const n = s(e), i = a(n, "bg"), o = a(n, "text"), t = r ? i : `var(--nice-bg-sidenav-item, color-mix(in srgb, ${i} var(--nice-sidenav-item-tint, ${$}), var(--nice-bg-primary)))`, c = r ? o : "var(--nice-text-sidenav-item, var(--nice-text-primary))", l = {
|
|
80
|
+
"--nice-row-path-bg": m(n, i),
|
|
81
|
+
"--nice-row-path-text": `var(--nice-sidenav-path-${n}-text, ${o})`,
|
|
82
|
+
"--nice-row-active-bg": "var(--nice-sidenav-highlight)",
|
|
83
|
+
"--nice-row-active-text": "var(--nice-text-sidenav-highlight)"
|
|
84
|
+
};
|
|
75
85
|
return {
|
|
76
|
-
"--nice-row-bg":
|
|
77
|
-
"--nice-row-text":
|
|
78
|
-
"--nice-row-hover-bg": `color-mix(in srgb, ${
|
|
79
|
-
"--nice-row-label":
|
|
80
|
-
"--nice-row-muted":
|
|
86
|
+
"--nice-row-bg": t,
|
|
87
|
+
"--nice-row-text": c,
|
|
88
|
+
"--nice-row-hover-bg": `color-mix(in srgb, ${t} 88%, ${c})`,
|
|
89
|
+
"--nice-row-label": c,
|
|
90
|
+
"--nice-row-muted": c,
|
|
81
91
|
// the active row's bar and label: the header's text on a header, the primary on a page
|
|
82
|
-
"--nice-row-accent": r ?
|
|
92
|
+
"--nice-row-accent": r ? c : "var(--nice-color-primary)",
|
|
93
|
+
...l
|
|
83
94
|
};
|
|
84
95
|
}
|
|
85
96
|
export {
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
97
|
+
u as SIDEBAR_COLOR_LEVELS,
|
|
98
|
+
f as SIDEBAR_SHADE_LEVELS,
|
|
99
|
+
C as branchColorScope,
|
|
89
100
|
s as colorLevel,
|
|
90
101
|
S as colorsOf,
|
|
91
|
-
|
|
92
|
-
|
|
102
|
+
p as levelColorVars,
|
|
103
|
+
d as levelColorsFrom,
|
|
93
104
|
E as rootColorScope,
|
|
94
|
-
|
|
105
|
+
w as rowColors,
|
|
95
106
|
V as shadeRowVars,
|
|
96
107
|
B as shadeSourceHeadVars
|
|
97
108
|
};
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
function l(e) {
|
|
2
|
+
return e.normalize("NFD").replace(/\p{M}/gu, "").replace(/ł/g, "l").replace(/Ł/g, "L").toLowerCase().trim();
|
|
3
|
+
}
|
|
4
|
+
function o(e) {
|
|
5
|
+
return typeof e == "string" || typeof e == "number" ? String(e) : "";
|
|
6
|
+
}
|
|
7
|
+
function u(e, t) {
|
|
8
|
+
return l(o(e.label)).includes(t) || l(o(e.tooltip)).includes(t);
|
|
9
|
+
}
|
|
10
|
+
function a(e, t, i) {
|
|
11
|
+
if (!t)
|
|
12
|
+
return e;
|
|
13
|
+
const r = [];
|
|
14
|
+
for (const n of e) {
|
|
15
|
+
if (u(n, t)) {
|
|
16
|
+
r.push(n);
|
|
17
|
+
continue;
|
|
18
|
+
}
|
|
19
|
+
const c = n.children?.length ? a(n.children, t, i) : [];
|
|
20
|
+
c.length > 0 && (i.add(n.id), r.push({ ...n, children: c }));
|
|
21
|
+
}
|
|
22
|
+
return r;
|
|
23
|
+
}
|
|
24
|
+
export {
|
|
25
|
+
a as filterSidebarItems,
|
|
26
|
+
l as normalizeSidebarSearch,
|
|
27
|
+
u as sidebarItemMatches
|
|
28
|
+
};
|
package/dist/navigation.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const s=require("./NiceModuleLifecyclePanel-ugNtHimh.cjs"),e=require("react/jsx-runtime"),i=require("@nice2dev/ui-core"),a=require("react"),z=require("./pickerCommons-BWglYl6J.cjs"),K=require("./NicePagination-D7XxeNFz.cjs"),E=[],W=Object.assign(a.forwardRef(({items:p=E,activeKey:f,collapsed:l=!1,width:x=240,collapsedWidth:d=52,onItemClick:y,onCollapseChange:A,header:g,footer:b,size:_="md",className:R,style:I,id:S,accessMode:D,...C},m)=>{const j=i.useControlId(S),M=i.useNiceAccessMode(D,S),[k,h]=a.useState(new Set),c=a.useCallback(n=>{h(t=>{const o=new Set(t);return o.has(n)?o.delete(n):o.add(n),o})},[]);if(M==="hidden")return null;const u=(n,t=0)=>{const o=n.children&&n.children.length>0,r=k.has(n.key),N=n.key===f;return e.jsxs("li",{className:"nice-sidebar-menu__item",children:[e.jsxs("button",{className:`nice-sidebar-menu__btn ${N?"nice-sidebar-menu__btn--active":""} ${n.disabled?"nice-sidebar-menu__btn--disabled":""}`,style:{paddingLeft:l?void 0:12+t*16},onClick:()=>o?c(n.key):y?.(n),disabled:n.disabled,title:l?n.text:void 0,type:"button",children:[n.icon&&e.jsx("span",{className:"nice-sidebar-menu__icon",children:n.icon}),!l&&e.jsx("span",{className:"nice-sidebar-menu__label",children:n.text}),!l&&n.badge!==void 0&&e.jsx("span",{className:"nice-sidebar-menu__badge",children:n.badge}),!l&&o&&e.jsx("span",{className:"nice-sidebar-menu__chevron",children:e.jsx(i.NiceIcon,{name:r?"chevron-down":"chevron-right",size:14})})]}),o&&r&&!l&&e.jsx("ul",{className:"nice-sidebar-menu__children",children:n.children.map($=>u($,t+1))})]},n.key)};return e.jsxs("nav",{ref:m,id:j,className:`nice-sidebar-menu nice-sidebar-menu--${_} ${l?"nice-sidebar-menu--collapsed":""} ${R??""}`,style:{...I,width:l?d:x},...C,children:[g&&e.jsx("div",{className:"nice-sidebar-menu__header",children:g}),e.jsx("ul",{className:"nice-sidebar-menu__list",role:"list",children:p.map(n=>u(n))}),b&&e.jsx("div",{className:"nice-sidebar-menu__footer",children:b})]})}),{displayName:"NiceSidebarMenu"}),q=Object.assign(a.forwardRef(({items:p=E,activeKey:f,onItemClick:l,brand:x,actions:d,size:y="md",className:A,style:g,id:b,accessMode:_,...R},I)=>{const S=i.useControlId(b),D=i.useNiceAccessMode(_,b),[C,m]=a.useState(null),[j,M]=a.useState(!1),k=a.useRef(null),h=a.useRef(null);i.useRovingFocus(k,{orientation:"horizontal",wrap:!0,typeahead:!0}),i.useRovingFocus(h,{orientation:"vertical",wrap:!0,typeahead:!0}),i.useOverlayFocus(h,{open:C!=null&&!j,modal:!1,onClose:()=>m(null)});const c=n=>{M(!1),m(n)},u=n=>{if(n.key!=="ArrowLeft"&&n.key!=="ArrowRight")return;n.preventDefault();const t=[...k.current?.querySelectorAll(".nice-top-menu__btn")??[]],o=t.findIndex(N=>N.getAttribute("aria-expanded")==="true"),r=t[(o+(n.key==="ArrowRight"?1:-1)+t.length)%t.length];m(null),r?.focus()};return D==="hidden"?null:e.jsxs("nav",{ref:I,id:S,className:`nice-top-menu nice-top-menu--${y} ${A??""}`,style:g,...R,children:[x&&e.jsx("div",{className:"nice-top-menu__brand",children:x}),e.jsx("ul",{className:"nice-top-menu__items",role:"menubar",ref:k,children:p.map(n=>{const t=n.children&&n.children.length>0,o=C===n.key;return e.jsxs("li",{className:"nice-top-menu__item",onMouseEnter:()=>{t&&(M(!0),m(n.key))},onMouseLeave:()=>t&&m(null),children:[e.jsxs("button",{className:`nice-top-menu__btn ${n.key===f?"nice-top-menu__btn--active":""}`,onClick:()=>t?o?m(null):c(n.key):l?.(n),onKeyDown:r=>{const N=r.nativeEvent.niceSource;t&&r.key==="ArrowDown"&&N!=="gamepad"&&(r.preventDefault(),c(n.key))},role:"menuitem","aria-haspopup":t,"aria-expanded":o,disabled:n.disabled,type:"button",children:[n.icon&&e.jsx("span",{children:n.icon}),e.jsx("span",{children:n.text}),t&&e.jsx("span",{className:"nice-top-menu__chevron",children:e.jsx(i.NiceIcon,{name:"chevron-down",size:14})})]}),t&&o&&e.jsx("ul",{className:"nice-top-menu__dropdown",role:"menu",ref:h,onKeyDown:u,children:n.children.map(r=>e.jsx("li",{children:e.jsxs("button",{className:`nice-top-menu__dropdown-btn ${r.key===f?"nice-top-menu__dropdown-btn--active":""}`,onClick:()=>{l?.(r),m(null)},disabled:r.disabled,role:"menuitem",type:"button",children:[r.icon&&e.jsx("span",{children:r.icon}),e.jsx("span",{children:r.text}),r.badge!==void 0&&e.jsx("span",{className:"nice-top-menu__badge",children:r.badge})]})},r.key))})]},n.key)})}),d&&e.jsx("div",{className:"nice-top-menu__actions",children:d})]})}),{displayName:"NiceTopMenu"}),U=[],H=Object.assign(a.forwardRef(({tabs:p=U,activeTab:f,onTabChange:l,onItemClick:x,minimized:d=!1,onMinimizeToggle:y,size:A="md",className:g,style:b,id:_,accessMode:R,...I},S)=>{const D=a.useRef(null);i.useRovingFocus(D,{orientation:"horizontal",wrap:!0,activateOnMove:!0});const C=i.useControlId(_),m=i.useNiceAccessMode(R,_),{t:j}=i.useNiceTranslation(),[M,k]=a.useState(void 0),h=f??M??p[0]?.key,c=p.find(n=>n.key===h),u=a.useCallback(n=>{k(n),l?.(n)},[l]);return m==="hidden"?null:e.jsxs("div",{ref:S,id:C,className:`nice-ribbon-menu nice-ribbon-menu--${A} ${d?"nice-ribbon-menu--minimized":""} ${g??""}`,style:b,...I,children:[e.jsxs("div",{className:"nice-ribbon-menu__tabs",ref:D,role:"tablist",children:[p.map(n=>e.jsx("button",{className:`nice-ribbon-menu__tab ${n.key===h?"nice-ribbon-menu__tab--active":""}`,onClick:()=>u(n.key),role:"tab","aria-selected":n.key===h,type:"button",children:n.label},n.key)),e.jsx("button",{className:"nice-ribbon-menu__minimize",onClick:()=>y?.(!d),type:"button","aria-label":d?j("nav.expand","Expand"):j("nav.collapse","Collapse"),children:e.jsx(i.NiceIcon,{name:d?"chevron-down":"chevron-up",size:14})})]}),!d&&c&&e.jsx("div",{className:"nice-ribbon-menu__panel",role:"tabpanel",children:c.groups.map((n,t)=>e.jsxs("div",{className:"nice-ribbon-menu__group",children:[e.jsx("div",{className:"nice-ribbon-menu__group-items",children:n.items.map(o=>e.jsxs("button",{className:"nice-ribbon-menu__item",onClick:()=>x?.(o),disabled:o.disabled,type:"button",children:[o.icon&&e.jsx("span",{className:"nice-ribbon-menu__item-icon",children:o.icon}),e.jsx("span",{className:"nice-ribbon-menu__item-label",children:o.text})]},o.key))}),e.jsx("div",{className:"nice-ribbon-menu__group-label",children:n.label})]},t))})]})}),{displayName:"NiceRibbonMenu"}),V=Object.assign(a.forwardRef(({items:p=E,activeKey:f,onItemClick:l,position:x="bottom",autoHide:d=!1,iconSize:y=40,size:A="md",className:g,style:b,id:_,accessMode:R,...I},S)=>{const D=i.useControlId(_),C=i.useNiceAccessMode(R,_),[m,j]=a.useState(!1),[M,k]=a.useState(!1),h=!d||m||M;return C==="hidden"?null:e.jsx("div",{ref:S,id:D,className:`nice-dock-menu nice-dock-menu--${x} nice-dock-menu--${A} ${d&&!h?"nice-dock-menu--hidden":""} ${g??""}`,style:b,onMouseEnter:()=>j(!0),onMouseLeave:()=>j(!1),onFocus:()=>k(!0),onBlur:c=>{c.currentTarget.contains(c.relatedTarget)||k(!1)},...I,children:e.jsx("div",{className:"nice-dock-menu__items",children:p.map(c=>e.jsxs("button",{className:`nice-dock-menu__item ${c.key===f?"nice-dock-menu__item--active":""}`,onClick:()=>l?.(c),disabled:c.disabled,title:c.text,"aria-label":c.text,type:"button",style:{width:y,height:y},children:[c.icon?e.jsx("span",{className:"nice-dock-menu__icon",children:c.icon}):e.jsx("span",{children:c.text[0]}),c.badge!==void 0&&e.jsx("span",{className:"nice-dock-menu__badge",children:c.badge})]},c.key))})})}),{displayName:"NiceDockMenu"}),Y=Object.assign(a.forwardRef(({items:p=E,activeKey:f,onItemClick:l,open:x,onOpenChange:d,position:y="left",panelWidth:A=280,header:g,footer:b,size:_="md",className:R,style:I,id:S,accessMode:D,...C},m)=>{const j=i.useControlId(S),M=i.useNiceAccessMode(D,S),{t:k}=i.useNiceTranslation(),[h,c]=a.useState(!1),u=x??h,n=a.useCallback(v=>{c(v),d?.(v)},[d]),t=a.useCallback(()=>n(!u),[u,n]),o=a.useCallback(v=>{l?.(v),n(!1)},[l,n]),r=a.useRef(null),N=a.useRef(null),$=a.useRef(null);return a.useLayoutEffect(()=>{$.current?.toggleAttribute("inert",!u)},[u]),i.useMenuButton(r,N,{open:u,onOpenChange:n,closeOnFocusOut:!1,closeOnOutsidePress:!1}),M==="hidden"?null:e.jsxs("div",{ref:m,id:j,className:`nice-hamburger-menu nice-hamburger-menu--${_} ${R??""}`,style:I,...C,children:[e.jsx("button",{ref:r,className:"nice-hamburger-menu__trigger",onClick:t,"aria-label":k("nav.menu","Menu"),"aria-haspopup":"menu","aria-expanded":u,type:"button",children:e.jsxs("span",{className:`nice-hamburger-menu__icon ${u?"nice-hamburger-menu__icon--open":""}`,children:[e.jsx("span",{}),e.jsx("span",{}),e.jsx("span",{})]})}),u&&e.jsx("div",{className:"nice-hamburger-menu__backdrop",onClick:t,"aria-hidden":!0}),e.jsxs("div",{ref:$,className:`nice-hamburger-menu__panel nice-hamburger-menu__panel--${y} ${u?"nice-hamburger-menu__panel--open":""}`,style:{width:A},children:[g&&e.jsx("div",{className:"nice-hamburger-menu__header",children:g}),e.jsx("ul",{className:"nice-hamburger-menu__list",role:"menu",ref:N,children:p.map(v=>e.jsx("li",{children:e.jsxs("button",{className:`nice-hamburger-menu__item ${v.key===f?"nice-hamburger-menu__item--active":""}`,onClick:()=>o(v),disabled:v.disabled,role:"menuitem",type:"button",children:[v.icon&&e.jsx("span",{className:"nice-hamburger-menu__item-icon",children:v.icon}),e.jsx("span",{children:v.text}),v.badge!==void 0&&e.jsx("span",{className:"nice-hamburger-menu__item-badge",children:v.badge})]})},v.key))}),b&&e.jsx("div",{className:"nice-hamburger-menu__footer",children:b})]})]})}),{displayName:"NiceHamburgerMenu"}),J=Object.assign(a.forwardRef(({canGoBack:p=!1,canGoForward:f=!1,onBack:l,onForward:x,onRefresh:d,enableShortcuts:y=!0,showRefresh:A=!0,showStop:g=!0,isLoading:b=!1,onStop:_,size:R="md",variant:I="default",tooltipPosition:S="bottom",backIcon:D,forwardIcon:C,refreshIcon:m,stopIcon:j,className:M,style:k,id:h,accessMode:c,disabled:u,...n},t)=>{const o=i.useControlId(h),r=i.useNiceAccessMode(c,h),{t:N}=i.useNiceTranslation();if(a.useEffect(()=>{if(!y||u)return;const T=w=>{const O=w.altKey,B=w.ctrlKey||w.metaKey;O&&w.key==="ArrowLeft"?(w.preventDefault(),p&&l?.()):O&&w.key==="ArrowRight"?(w.preventDefault(),f&&x?.()):w.key==="F5"||B&&w.key==="r"?(w.preventDefault(),b?_?.():d?.()):w.key==="Escape"&&b&&(w.preventDefault(),_?.())};return window.addEventListener("keydown",T),()=>window.removeEventListener("keydown",T)},[y,u,p,f,b,l,x,d,_]),r==="hidden")return null;const $=r==="disabled"||u,v=D??e.jsx(i.NiceIcon,{name:"chevron-left",size:16}),F=C??e.jsx(i.NiceIcon,{name:"chevron-right",size:16}),L=m??e.jsx(i.NiceIcon,{name:"refresh",size:16}),P=j??e.jsx(i.NiceIcon,{name:"close",size:16});return e.jsxs("div",{ref:t,id:o,className:`nice-nav-controls nice-nav-controls--${R} nice-nav-controls--${I}${$?" nice-nav-controls--disabled":""}${M?` ${M}`:""}`,style:k,role:"navigation","aria-label":N("nav.controls","Navigation controls"),...n,children:[e.jsx("button",{type:"button",className:`nice-nav-controls__btn nice-nav-controls__btn--back${p?"":" nice-nav-controls__btn--disabled"}`,onClick:l,disabled:$||!p,"aria-label":N("nav.back","Back"),title:`${N("nav.back","Back")} (Alt+←)`,children:v}),e.jsx("button",{type:"button",className:`nice-nav-controls__btn nice-nav-controls__btn--forward${f?"":" nice-nav-controls__btn--disabled"}`,onClick:x,disabled:$||!f,"aria-label":N("nav.forward","Forward"),title:`${N("nav.forward","Forward")} (Alt+→)`,children:F}),(A||g&&b)&&(b?e.jsx("button",{type:"button",className:"nice-nav-controls__btn nice-nav-controls__btn--stop nice-nav-controls__btn--loading",onClick:_,disabled:$,"aria-label":N("nav.stop","Stop"),title:`${N("nav.stop","Stop")} (Esc)`,children:P}):e.jsx("button",{type:"button",className:"nice-nav-controls__btn nice-nav-controls__btn--refresh",onClick:d,disabled:$,"aria-label":N("nav.refresh","Refresh"),title:`${N("nav.refresh","Refresh")} (F5)`,children:L}))]})}),{displayName:"NiceNavigationControls"});exports.DEFAULT_SIDEBAR_PREFS=s.DEFAULT_SIDEBAR_PREFS;exports.DesktopContextMenu=s.DesktopContextMenu;exports.DesktopGrid=s.DesktopGrid;exports.DesktopStartMenu=s.DesktopStartMenu;exports.DesktopSystemTray=s.DesktopSystemTray;exports.DesktopTaskbar=s.DesktopTaskbar;exports.NiceAccordion=s.NiceAccordion;exports.NiceAppLayout=s.NiceAppLayout;exports.NiceAuthButtons=s.NiceAuthButtons;exports.NiceBreadcrumb=s.NiceBreadcrumb;exports.NiceCard=s.NiceCard;exports.NiceConsole=s.NiceConsole;exports.NiceContextMenu=s.NiceContextMenu;exports.NiceDashboardLayout=s.NiceDashboardLayout;exports.NiceDashboardShell=s.NiceDashboardShell;exports.NiceDesktop=s.NiceDesktop;exports.NiceDock=s.NiceDock;exports.NiceDynamicSidebar=s.NiceDynamicSidebar;exports.NiceHybridShell=s.NiceHybridShell;exports.NiceKioskShell=s.NiceKioskShell;exports.NiceMdiWorkspace=s.NiceMdiWorkspace;exports.NiceMenu=s.NiceMenu;exports.NiceMinimalShell=s.NiceMinimalShell;exports.NiceModeSelector=s.NiceModeSelector;exports.NiceModernShell=s.NiceModernShell;exports.NiceModuleLifecyclePanel=s.NiceModuleLifecyclePanel;exports.NiceNavMenu=s.NiceNavMenu;exports.NiceNavbar=s.NiceNavbar;exports.NiceOrganizationProfileForm=s.NiceOrganizationProfileForm;exports.NicePwaShell=s.NicePwaShell;exports.NiceSetupWizard=s.NiceSetupWizard;exports.NiceSidebarNav=s.NiceSidebarNav;exports.NiceSplitter=s.NiceSplitter;exports.NiceUserMenu=s.NiceUserMenu;exports.NiceWizard=s.NiceWizard;exports.SIDEBAR_DEFAULT_FAVORITE_LIST=s.SIDEBAR_DEFAULT_FAVORITE_LIST;exports.SIDEBAR_MODE_META=s.SIDEBAR_MODE_META;exports.findSidebarItemByRoute=s.findSidebarItemByRoute;exports.mapSidebarViews=s.mapSidebarViews;exports.sidebarModeLabel=s.sidebarModeLabel;exports.walkSidebarNav=s.walkSidebarNav;exports.NiceTabs=z.NiceTabs;exports.NicePagination=K.NicePagination;exports.NiceDockMenu=V;exports.NiceHamburgerMenu=Y;exports.NiceNavigationControls=J;exports.NiceRibbonMenu=H;exports.NiceSidebarMenu=W;exports.NiceTopMenu=q;
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const s=require("./NiceModuleLifecyclePanel-DBQPCa_V.cjs"),e=require("react/jsx-runtime"),i=require("@nice2dev/ui-core"),a=require("react"),z=require("./pickerCommons-CwcCc8Qi.cjs"),K=require("./NicePagination-D7XxeNFz.cjs"),E=[],W=Object.assign(a.forwardRef(({items:p=E,activeKey:f,collapsed:l=!1,width:x=240,collapsedWidth:d=52,onItemClick:y,onCollapseChange:A,header:g,footer:b,size:_="md",className:R,style:I,id:S,accessMode:D,...C},m)=>{const j=i.useControlId(S),M=i.useNiceAccessMode(D,S),[k,h]=a.useState(new Set),c=a.useCallback(n=>{h(t=>{const o=new Set(t);return o.has(n)?o.delete(n):o.add(n),o})},[]);if(M==="hidden")return null;const u=(n,t=0)=>{const o=n.children&&n.children.length>0,r=k.has(n.key),N=n.key===f;return e.jsxs("li",{className:"nice-sidebar-menu__item",children:[e.jsxs("button",{className:`nice-sidebar-menu__btn ${N?"nice-sidebar-menu__btn--active":""} ${n.disabled?"nice-sidebar-menu__btn--disabled":""}`,style:{paddingLeft:l?void 0:12+t*16},onClick:()=>o?c(n.key):y?.(n),disabled:n.disabled,title:l?n.text:void 0,type:"button",children:[n.icon&&e.jsx("span",{className:"nice-sidebar-menu__icon",children:n.icon}),!l&&e.jsx("span",{className:"nice-sidebar-menu__label",children:n.text}),!l&&n.badge!==void 0&&e.jsx("span",{className:"nice-sidebar-menu__badge",children:n.badge}),!l&&o&&e.jsx("span",{className:"nice-sidebar-menu__chevron",children:e.jsx(i.NiceIcon,{name:r?"chevron-down":"chevron-right",size:14})})]}),o&&r&&!l&&e.jsx("ul",{className:"nice-sidebar-menu__children",children:n.children.map($=>u($,t+1))})]},n.key)};return e.jsxs("nav",{ref:m,id:j,className:`nice-sidebar-menu nice-sidebar-menu--${_} ${l?"nice-sidebar-menu--collapsed":""} ${R??""}`,style:{...I,width:l?d:x},...C,children:[g&&e.jsx("div",{className:"nice-sidebar-menu__header",children:g}),e.jsx("ul",{className:"nice-sidebar-menu__list",role:"list",children:p.map(n=>u(n))}),b&&e.jsx("div",{className:"nice-sidebar-menu__footer",children:b})]})}),{displayName:"NiceSidebarMenu"}),q=Object.assign(a.forwardRef(({items:p=E,activeKey:f,onItemClick:l,brand:x,actions:d,size:y="md",className:A,style:g,id:b,accessMode:_,...R},I)=>{const S=i.useControlId(b),D=i.useNiceAccessMode(_,b),[C,m]=a.useState(null),[j,M]=a.useState(!1),k=a.useRef(null),h=a.useRef(null);i.useRovingFocus(k,{orientation:"horizontal",wrap:!0,typeahead:!0}),i.useRovingFocus(h,{orientation:"vertical",wrap:!0,typeahead:!0}),i.useOverlayFocus(h,{open:C!=null&&!j,modal:!1,onClose:()=>m(null)});const c=n=>{M(!1),m(n)},u=n=>{if(n.key!=="ArrowLeft"&&n.key!=="ArrowRight")return;n.preventDefault();const t=[...k.current?.querySelectorAll(".nice-top-menu__btn")??[]],o=t.findIndex(N=>N.getAttribute("aria-expanded")==="true"),r=t[(o+(n.key==="ArrowRight"?1:-1)+t.length)%t.length];m(null),r?.focus()};return D==="hidden"?null:e.jsxs("nav",{ref:I,id:S,className:`nice-top-menu nice-top-menu--${y} ${A??""}`,style:g,...R,children:[x&&e.jsx("div",{className:"nice-top-menu__brand",children:x}),e.jsx("ul",{className:"nice-top-menu__items",role:"menubar",ref:k,children:p.map(n=>{const t=n.children&&n.children.length>0,o=C===n.key;return e.jsxs("li",{className:"nice-top-menu__item",onMouseEnter:()=>{t&&(M(!0),m(n.key))},onMouseLeave:()=>t&&m(null),children:[e.jsxs("button",{className:`nice-top-menu__btn ${n.key===f?"nice-top-menu__btn--active":""}`,onClick:()=>t?o?m(null):c(n.key):l?.(n),onKeyDown:r=>{const N=r.nativeEvent.niceSource;t&&r.key==="ArrowDown"&&N!=="gamepad"&&(r.preventDefault(),c(n.key))},role:"menuitem","aria-haspopup":t,"aria-expanded":o,disabled:n.disabled,type:"button",children:[n.icon&&e.jsx("span",{children:n.icon}),e.jsx("span",{children:n.text}),t&&e.jsx("span",{className:"nice-top-menu__chevron",children:e.jsx(i.NiceIcon,{name:"chevron-down",size:14})})]}),t&&o&&e.jsx("ul",{className:"nice-top-menu__dropdown",role:"menu",ref:h,onKeyDown:u,children:n.children.map(r=>e.jsx("li",{children:e.jsxs("button",{className:`nice-top-menu__dropdown-btn ${r.key===f?"nice-top-menu__dropdown-btn--active":""}`,onClick:()=>{l?.(r),m(null)},disabled:r.disabled,role:"menuitem",type:"button",children:[r.icon&&e.jsx("span",{children:r.icon}),e.jsx("span",{children:r.text}),r.badge!==void 0&&e.jsx("span",{className:"nice-top-menu__badge",children:r.badge})]})},r.key))})]},n.key)})}),d&&e.jsx("div",{className:"nice-top-menu__actions",children:d})]})}),{displayName:"NiceTopMenu"}),U=[],H=Object.assign(a.forwardRef(({tabs:p=U,activeTab:f,onTabChange:l,onItemClick:x,minimized:d=!1,onMinimizeToggle:y,size:A="md",className:g,style:b,id:_,accessMode:R,...I},S)=>{const D=a.useRef(null);i.useRovingFocus(D,{orientation:"horizontal",wrap:!0,activateOnMove:!0});const C=i.useControlId(_),m=i.useNiceAccessMode(R,_),{t:j}=i.useNiceTranslation(),[M,k]=a.useState(void 0),h=f??M??p[0]?.key,c=p.find(n=>n.key===h),u=a.useCallback(n=>{k(n),l?.(n)},[l]);return m==="hidden"?null:e.jsxs("div",{ref:S,id:C,className:`nice-ribbon-menu nice-ribbon-menu--${A} ${d?"nice-ribbon-menu--minimized":""} ${g??""}`,style:b,...I,children:[e.jsxs("div",{className:"nice-ribbon-menu__tabs",ref:D,role:"tablist",children:[p.map(n=>e.jsx("button",{className:`nice-ribbon-menu__tab ${n.key===h?"nice-ribbon-menu__tab--active":""}`,onClick:()=>u(n.key),role:"tab","aria-selected":n.key===h,type:"button",children:n.label},n.key)),e.jsx("button",{className:"nice-ribbon-menu__minimize",onClick:()=>y?.(!d),type:"button","aria-label":d?j("nav.expand","Expand"):j("nav.collapse","Collapse"),children:e.jsx(i.NiceIcon,{name:d?"chevron-down":"chevron-up",size:14})})]}),!d&&c&&e.jsx("div",{className:"nice-ribbon-menu__panel",role:"tabpanel",children:c.groups.map((n,t)=>e.jsxs("div",{className:"nice-ribbon-menu__group",children:[e.jsx("div",{className:"nice-ribbon-menu__group-items",children:n.items.map(o=>e.jsxs("button",{className:"nice-ribbon-menu__item",onClick:()=>x?.(o),disabled:o.disabled,type:"button",children:[o.icon&&e.jsx("span",{className:"nice-ribbon-menu__item-icon",children:o.icon}),e.jsx("span",{className:"nice-ribbon-menu__item-label",children:o.text})]},o.key))}),e.jsx("div",{className:"nice-ribbon-menu__group-label",children:n.label})]},t))})]})}),{displayName:"NiceRibbonMenu"}),V=Object.assign(a.forwardRef(({items:p=E,activeKey:f,onItemClick:l,position:x="bottom",autoHide:d=!1,iconSize:y=40,size:A="md",className:g,style:b,id:_,accessMode:R,...I},S)=>{const D=i.useControlId(_),C=i.useNiceAccessMode(R,_),[m,j]=a.useState(!1),[M,k]=a.useState(!1),h=!d||m||M;return C==="hidden"?null:e.jsx("div",{ref:S,id:D,className:`nice-dock-menu nice-dock-menu--${x} nice-dock-menu--${A} ${d&&!h?"nice-dock-menu--hidden":""} ${g??""}`,style:b,onMouseEnter:()=>j(!0),onMouseLeave:()=>j(!1),onFocus:()=>k(!0),onBlur:c=>{c.currentTarget.contains(c.relatedTarget)||k(!1)},...I,children:e.jsx("div",{className:"nice-dock-menu__items",children:p.map(c=>e.jsxs("button",{className:`nice-dock-menu__item ${c.key===f?"nice-dock-menu__item--active":""}`,onClick:()=>l?.(c),disabled:c.disabled,title:c.text,"aria-label":c.text,type:"button",style:{width:y,height:y},children:[c.icon?e.jsx("span",{className:"nice-dock-menu__icon",children:c.icon}):e.jsx("span",{children:c.text[0]}),c.badge!==void 0&&e.jsx("span",{className:"nice-dock-menu__badge",children:c.badge})]},c.key))})})}),{displayName:"NiceDockMenu"}),Y=Object.assign(a.forwardRef(({items:p=E,activeKey:f,onItemClick:l,open:x,onOpenChange:d,position:y="left",panelWidth:A=280,header:g,footer:b,size:_="md",className:R,style:I,id:S,accessMode:D,...C},m)=>{const j=i.useControlId(S),M=i.useNiceAccessMode(D,S),{t:k}=i.useNiceTranslation(),[h,c]=a.useState(!1),u=x??h,n=a.useCallback(v=>{c(v),d?.(v)},[d]),t=a.useCallback(()=>n(!u),[u,n]),o=a.useCallback(v=>{l?.(v),n(!1)},[l,n]),r=a.useRef(null),N=a.useRef(null),$=a.useRef(null);return a.useLayoutEffect(()=>{$.current?.toggleAttribute("inert",!u)},[u]),i.useMenuButton(r,N,{open:u,onOpenChange:n,closeOnFocusOut:!1,closeOnOutsidePress:!1}),M==="hidden"?null:e.jsxs("div",{ref:m,id:j,className:`nice-hamburger-menu nice-hamburger-menu--${_} ${R??""}`,style:I,...C,children:[e.jsx("button",{ref:r,className:"nice-hamburger-menu__trigger",onClick:t,"aria-label":k("nav.menu","Menu"),"aria-haspopup":"menu","aria-expanded":u,type:"button",children:e.jsxs("span",{className:`nice-hamburger-menu__icon ${u?"nice-hamburger-menu__icon--open":""}`,children:[e.jsx("span",{}),e.jsx("span",{}),e.jsx("span",{})]})}),u&&e.jsx("div",{className:"nice-hamburger-menu__backdrop",onClick:t,"aria-hidden":!0}),e.jsxs("div",{ref:$,className:`nice-hamburger-menu__panel nice-hamburger-menu__panel--${y} ${u?"nice-hamburger-menu__panel--open":""}`,style:{width:A},children:[g&&e.jsx("div",{className:"nice-hamburger-menu__header",children:g}),e.jsx("ul",{className:"nice-hamburger-menu__list",role:"menu",ref:N,children:p.map(v=>e.jsx("li",{children:e.jsxs("button",{className:`nice-hamburger-menu__item ${v.key===f?"nice-hamburger-menu__item--active":""}`,onClick:()=>o(v),disabled:v.disabled,role:"menuitem",type:"button",children:[v.icon&&e.jsx("span",{className:"nice-hamburger-menu__item-icon",children:v.icon}),e.jsx("span",{children:v.text}),v.badge!==void 0&&e.jsx("span",{className:"nice-hamburger-menu__item-badge",children:v.badge})]})},v.key))}),b&&e.jsx("div",{className:"nice-hamburger-menu__footer",children:b})]})]})}),{displayName:"NiceHamburgerMenu"}),J=Object.assign(a.forwardRef(({canGoBack:p=!1,canGoForward:f=!1,onBack:l,onForward:x,onRefresh:d,enableShortcuts:y=!0,showRefresh:A=!0,showStop:g=!0,isLoading:b=!1,onStop:_,size:R="md",variant:I="default",tooltipPosition:S="bottom",backIcon:D,forwardIcon:C,refreshIcon:m,stopIcon:j,className:M,style:k,id:h,accessMode:c,disabled:u,...n},t)=>{const o=i.useControlId(h),r=i.useNiceAccessMode(c,h),{t:N}=i.useNiceTranslation();if(a.useEffect(()=>{if(!y||u)return;const T=w=>{const O=w.altKey,B=w.ctrlKey||w.metaKey;O&&w.key==="ArrowLeft"?(w.preventDefault(),p&&l?.()):O&&w.key==="ArrowRight"?(w.preventDefault(),f&&x?.()):w.key==="F5"||B&&w.key==="r"?(w.preventDefault(),b?_?.():d?.()):w.key==="Escape"&&b&&(w.preventDefault(),_?.())};return window.addEventListener("keydown",T),()=>window.removeEventListener("keydown",T)},[y,u,p,f,b,l,x,d,_]),r==="hidden")return null;const $=r==="disabled"||u,v=D??e.jsx(i.NiceIcon,{name:"chevron-left",size:16}),F=C??e.jsx(i.NiceIcon,{name:"chevron-right",size:16}),L=m??e.jsx(i.NiceIcon,{name:"refresh",size:16}),P=j??e.jsx(i.NiceIcon,{name:"close",size:16});return e.jsxs("div",{ref:t,id:o,className:`nice-nav-controls nice-nav-controls--${R} nice-nav-controls--${I}${$?" nice-nav-controls--disabled":""}${M?` ${M}`:""}`,style:k,role:"navigation","aria-label":N("nav.controls","Navigation controls"),...n,children:[e.jsx("button",{type:"button",className:`nice-nav-controls__btn nice-nav-controls__btn--back${p?"":" nice-nav-controls__btn--disabled"}`,onClick:l,disabled:$||!p,"aria-label":N("nav.back","Back"),title:`${N("nav.back","Back")} (Alt+←)`,children:v}),e.jsx("button",{type:"button",className:`nice-nav-controls__btn nice-nav-controls__btn--forward${f?"":" nice-nav-controls__btn--disabled"}`,onClick:x,disabled:$||!f,"aria-label":N("nav.forward","Forward"),title:`${N("nav.forward","Forward")} (Alt+→)`,children:F}),(A||g&&b)&&(b?e.jsx("button",{type:"button",className:"nice-nav-controls__btn nice-nav-controls__btn--stop nice-nav-controls__btn--loading",onClick:_,disabled:$,"aria-label":N("nav.stop","Stop"),title:`${N("nav.stop","Stop")} (Esc)`,children:P}):e.jsx("button",{type:"button",className:"nice-nav-controls__btn nice-nav-controls__btn--refresh",onClick:d,disabled:$,"aria-label":N("nav.refresh","Refresh"),title:`${N("nav.refresh","Refresh")} (F5)`,children:L}))]})}),{displayName:"NiceNavigationControls"});exports.DEFAULT_SIDEBAR_PREFS=s.DEFAULT_SIDEBAR_PREFS;exports.DesktopContextMenu=s.DesktopContextMenu;exports.DesktopGrid=s.DesktopGrid;exports.DesktopStartMenu=s.DesktopStartMenu;exports.DesktopSystemTray=s.DesktopSystemTray;exports.DesktopTaskbar=s.DesktopTaskbar;exports.NiceAccordion=s.NiceAccordion;exports.NiceAppLayout=s.NiceAppLayout;exports.NiceAuthButtons=s.NiceAuthButtons;exports.NiceBreadcrumb=s.NiceBreadcrumb;exports.NiceCard=s.NiceCard;exports.NiceConsole=s.NiceConsole;exports.NiceContextMenu=s.NiceContextMenu;exports.NiceDashboardLayout=s.NiceDashboardLayout;exports.NiceDashboardShell=s.NiceDashboardShell;exports.NiceDesktop=s.NiceDesktop;exports.NiceDock=s.NiceDock;exports.NiceDynamicSidebar=s.NiceDynamicSidebar;exports.NiceHybridShell=s.NiceHybridShell;exports.NiceKioskShell=s.NiceKioskShell;exports.NiceMdiWorkspace=s.NiceMdiWorkspace;exports.NiceMenu=s.NiceMenu;exports.NiceMinimalShell=s.NiceMinimalShell;exports.NiceModeSelector=s.NiceModeSelector;exports.NiceModernShell=s.NiceModernShell;exports.NiceModuleLifecyclePanel=s.NiceModuleLifecyclePanel;exports.NiceNavMenu=s.NiceNavMenu;exports.NiceNavbar=s.NiceNavbar;exports.NiceOrganizationProfileForm=s.NiceOrganizationProfileForm;exports.NicePwaShell=s.NicePwaShell;exports.NiceSetupWizard=s.NiceSetupWizard;exports.NiceSidebarNav=s.NiceSidebarNav;exports.NiceSplitter=s.NiceSplitter;exports.NiceUserMenu=s.NiceUserMenu;exports.NiceWizard=s.NiceWizard;exports.SIDEBAR_DEFAULT_FAVORITE_LIST=s.SIDEBAR_DEFAULT_FAVORITE_LIST;exports.SIDEBAR_MODE_META=s.SIDEBAR_MODE_META;exports.findSidebarItemByRoute=s.findSidebarItemByRoute;exports.mapSidebarViews=s.mapSidebarViews;exports.sidebarModeLabel=s.sidebarModeLabel;exports.walkSidebarNav=s.walkSidebarNav;exports.NiceTabs=z.NiceTabs;exports.NicePagination=K.NicePagination;exports.NiceDockMenu=V;exports.NiceHamburgerMenu=Y;exports.NiceNavigationControls=J;exports.NiceRibbonMenu=H;exports.NiceSidebarMenu=W;exports.NiceTopMenu=q;
|
package/dist/navigation.d.ts
CHANGED
|
@@ -13,6 +13,7 @@ import { NiceSize } from '@nice2dev/ui-core';
|
|
|
13
13
|
import { NiceTabDescriptor } from '@nice2dev/ui-core';
|
|
14
14
|
import { NiceTenantInfo } from '@nice2dev/ui-core';
|
|
15
15
|
import { NiceTheme } from '@nice2dev/ui-core';
|
|
16
|
+
import { NiceThemePreviewRoles } from '@nice2dev/ui-core';
|
|
16
17
|
import { NiceTranslateFn } from '@nice2dev/ui-core';
|
|
17
18
|
import { NiceUserMenuResponse } from '@nice2dev/ui-core';
|
|
18
19
|
import { NiceWorkspaceState } from '@nice2dev/ui-core';
|
|
@@ -671,6 +672,8 @@ declare interface NiceIconRailItem {
|
|
|
671
672
|
/** A route the host opens when the button is pressed (no `onClick`). */
|
|
672
673
|
route?: string;
|
|
673
674
|
onClick?: () => void;
|
|
675
|
+
/** A menu on right-click, the menu key or Shift+F10 (1.3.18) — e.g. moving or removing it. */
|
|
676
|
+
menu?: NiceMenuItem[];
|
|
674
677
|
}
|
|
675
678
|
|
|
676
679
|
export declare const NiceKioskShell: ForwardRefExoticComponent<NiceKioskShellProps & RefAttributes<HTMLDivElement>> & {
|
|
@@ -1385,26 +1388,6 @@ export declare interface NiceRibbonTab {
|
|
|
1385
1388
|
groups: NiceRibbonGroup[];
|
|
1386
1389
|
}
|
|
1387
1390
|
|
|
1388
|
-
/**
|
|
1389
|
-
* {@link NiceSetupWizard} — Advanced multi-step setup wizard with branching, quick mode, and schema-driven forms.
|
|
1390
|
-
*
|
|
1391
|
-
* @example
|
|
1392
|
-
* ```tsx
|
|
1393
|
-
* <NiceSetupWizard
|
|
1394
|
-
* layout="vertical"
|
|
1395
|
-
* steps={[
|
|
1396
|
-
* { id: 'welcome', title: 'Welcome', content: <WelcomeScreen /> },
|
|
1397
|
-
* { id: 'account', title: 'Account', fields: [
|
|
1398
|
-
* { id: 'email', type: 'email', label: 'Email', required: true },
|
|
1399
|
-
* { id: 'password', type: 'password', label: 'Password', required: true },
|
|
1400
|
-
* ]},
|
|
1401
|
-
* { id: 'preferences', title: 'Preferences', optional: true, quickModeSkip: true },
|
|
1402
|
-
* { id: 'done', title: 'Complete', content: <CompleteScreen /> },
|
|
1403
|
-
* ]}
|
|
1404
|
-
* onComplete={(values) => saveUser(values)}
|
|
1405
|
-
* />
|
|
1406
|
-
* ```
|
|
1407
|
-
*/
|
|
1408
1391
|
export declare const NiceSetupWizard: default_2.ForwardRefExoticComponent<NiceSetupWizardProps & default_2.RefAttributes<HTMLDivElement>> & {
|
|
1409
1392
|
displayName: string;
|
|
1410
1393
|
};
|
|
@@ -1529,7 +1512,8 @@ export declare interface NiceSetupWizardProps {
|
|
|
1529
1512
|
loadingText?: default_2.ReactNode;
|
|
1530
1513
|
/**
|
|
1531
1514
|
* The loading indicator — e.g. your brand's looping mark. Default: a spinner. It stops moving
|
|
1532
|
-
* for users who ask for reduced motion
|
|
1515
|
+
* for users who ask for reduced motion: CSS animations stop, and since 1.3.18 SVG (SMIL)
|
|
1516
|
+
* animations are paused too (the `Ntd*` icons hold still on their own).
|
|
1533
1517
|
*/
|
|
1534
1518
|
loadingIndicator?: default_2.ReactNode;
|
|
1535
1519
|
id?: string;
|
|
@@ -1602,6 +1586,11 @@ export declare interface NiceSidebarMenuProps extends NiceBaseProps {
|
|
|
1602
1586
|
footer?: React.ReactNode;
|
|
1603
1587
|
}
|
|
1604
1588
|
|
|
1589
|
+
/**
|
|
1590
|
+
* NiceSidebarNav — the multi-mode navigation sidebar. Rows carried to the shortcuts or the
|
|
1591
|
+
* favourites (1.3.18) travel through a drag session: NiceNavShell's, which its tabs share, or —
|
|
1592
|
+
* on its own — one of the sidebar's.
|
|
1593
|
+
*/
|
|
1605
1594
|
export declare const NiceSidebarNav: ForwardRefExoticComponent<NiceSidebarNavProps & RefAttributes<HTMLDivElement>>;
|
|
1606
1595
|
|
|
1607
1596
|
export declare interface NiceSidebarNavProps {
|
|
@@ -1759,6 +1748,33 @@ export declare interface NiceSidebarNavProps {
|
|
|
1759
1748
|
railWidth?: number;
|
|
1760
1749
|
/** The bar's button of the page in view; default the one whose `route` is `activeRoute`. */
|
|
1761
1750
|
railActiveId?: string;
|
|
1751
|
+
/**
|
|
1752
|
+
* A last collapse level (1.3.18): past icons only, the sidebar folds to a column of the
|
|
1753
|
+
* shortcuts — `predefinedShortcuts`, then the user's (`shortcuts` in the preferences), which an
|
|
1754
|
+
* item's star and menu add and the button's own menu moves or removes. The footer then has two
|
|
1755
|
+
* buttons, a level down and a level up. Default `false`.
|
|
1756
|
+
*/
|
|
1757
|
+
shortcutsRail?: boolean;
|
|
1758
|
+
/**
|
|
1759
|
+
* The host's shortcuts (e.g. an administrator's), first on the shortcuts rail; the user cannot
|
|
1760
|
+
* remove or move them.
|
|
1761
|
+
*/
|
|
1762
|
+
predefinedShortcuts?: Omit<SidebarNavFavorite, 'addedAt'>[];
|
|
1763
|
+
/**
|
|
1764
|
+
* Whether users keep shortcuts of their own (default `true`). `false` — e.g. an administrator's
|
|
1765
|
+
* choice — leaves the rail to `predefinedShortcuts`: nothing offers to add one, and the stored ones
|
|
1766
|
+
* do not show.
|
|
1767
|
+
*/
|
|
1768
|
+
allowUserShortcuts?: boolean;
|
|
1769
|
+
/**
|
|
1770
|
+
* How far the sidebar is folded (controlled, 1.3.18). `collapsed` / `onCollapsedChange` keep
|
|
1771
|
+
* working: `'icons'` and `'rail'` are collapsed. `'rail'` needs `shortcutsRail`.
|
|
1772
|
+
*/
|
|
1773
|
+
collapseLevel?: SidebarNavCollapseLevel;
|
|
1774
|
+
/** How far the sidebar is folded at mount (uncontrolled; default `'expanded'`). */
|
|
1775
|
+
defaultCollapseLevel?: SidebarNavCollapseLevel;
|
|
1776
|
+
/** Called when the sidebar folds or unfolds a level. */
|
|
1777
|
+
onCollapseLevelChange?: (level: SidebarNavCollapseLevel) => void;
|
|
1762
1778
|
/**
|
|
1763
1779
|
* By role / By unit with two or more roles / units (1.3.13): a bar under the mode icons picks
|
|
1764
1780
|
* one and the tree shows its modules (`activeGroupId` in the preferences). `false` lists them
|
|
@@ -1777,6 +1793,21 @@ export declare interface NiceSidebarNavProps {
|
|
|
1777
1793
|
* `data` (By module first). Labels and icons of the parents come from `data` when they are in it.
|
|
1778
1794
|
*/
|
|
1779
1795
|
getFavoritePath?: (favorite: SidebarNavFavorite) => SidebarNavPathEntry[] | undefined;
|
|
1796
|
+
/**
|
|
1797
|
+
* A search box above the tree (1.3.18) that narrows whatever the current mode shows — the tree of
|
|
1798
|
+
* All / By role / By unit, the Favourites list. Empty, everything shows; typing hides what does not
|
|
1799
|
+
* match (label or tooltip, case and diacritics ignored) and opens the branches above each match,
|
|
1800
|
+
* whatever their stored state. The Search mode leaves the mode icons then. Default `false`.
|
|
1801
|
+
*/
|
|
1802
|
+
inlineSearch?: boolean;
|
|
1803
|
+
/** The search text (controlled). */
|
|
1804
|
+
searchText?: string;
|
|
1805
|
+
/** The search text at mount (uncontrolled). */
|
|
1806
|
+
defaultSearchText?: string;
|
|
1807
|
+
/** Called with the text as the user types it. */
|
|
1808
|
+
onSearchChange?: (text: string) => void;
|
|
1809
|
+
/** The box's placeholder. */
|
|
1810
|
+
searchPlaceholder?: string;
|
|
1780
1811
|
/** Extra CSS class on the root element */
|
|
1781
1812
|
className?: string;
|
|
1782
1813
|
/** Size variant */
|
|
@@ -2338,6 +2369,12 @@ export declare interface SidebarNavBranchColors {
|
|
|
2338
2369
|
levelColors?: string[];
|
|
2339
2370
|
}
|
|
2340
2371
|
|
|
2372
|
+
/**
|
|
2373
|
+
* How far NiceSidebarNav is folded (1.3.18): `'expanded'` — the tree; `'icons'` — icons only;
|
|
2374
|
+
* `'rail'` — only the shortcuts, as a column of buttons (with `shortcutsRail`).
|
|
2375
|
+
*/
|
|
2376
|
+
export declare type SidebarNavCollapseLevel = 'expanded' | 'icons' | 'rail';
|
|
2377
|
+
|
|
2341
2378
|
/** How the sidebar tree and NavShell's tabs show colour — see {@link SidebarNavUserPrefs.colorStyle}. */
|
|
2342
2379
|
export declare type SidebarNavColorStyle = 'theme' | 'bar' | 'fill';
|
|
2343
2380
|
|
|
@@ -2505,6 +2542,12 @@ export declare interface SidebarNavUserPrefs {
|
|
|
2505
2542
|
favoriteLists?: SidebarNavFavoriteList[];
|
|
2506
2543
|
/** The list the Favourites view shows (1.3.13); default the default list. */
|
|
2507
2544
|
activeFavoriteListId?: string;
|
|
2545
|
+
/**
|
|
2546
|
+
* The user's shortcuts (1.3.18): the buttons of the shortcuts rail, the sidebar's last collapse
|
|
2547
|
+
* level (`shortcutsRail`), after the host's `predefinedShortcuts`. Added from an item's star or
|
|
2548
|
+
* menu; kept as plain data — an icon only as an icon name.
|
|
2549
|
+
*/
|
|
2550
|
+
shortcuts?: SidebarNavFavorite[];
|
|
2508
2551
|
/**
|
|
2509
2552
|
* The user's answer to the first-run preferences (1.3.14): `'done'` (saved) or `'skipped'`.
|
|
2510
2553
|
* No default — absent means "not asked yet".
|
|
@@ -2664,6 +2707,12 @@ declare interface ThemePreviewColors {
|
|
|
2664
2707
|
textColor: string;
|
|
2665
2708
|
/** Border of the thumbnail and of the card (defaults to a translucent overlay). */
|
|
2666
2709
|
border?: string;
|
|
2710
|
+
/**
|
|
2711
|
+
* The layout's colours (1.4.0, `themePreviewRoles`) — top bar, sidebar with its header levels,
|
|
2712
|
+
* highlight, body, panel. With them `'swatch'` / `'columns'` draws a column per role and `'page'` /
|
|
2713
|
+
* `'layout'` a small app; without them the shapes draw as before.
|
|
2714
|
+
*/
|
|
2715
|
+
roles?: NiceThemePreviewRoles;
|
|
2667
2716
|
}
|
|
2668
2717
|
|
|
2669
2718
|
/** A menu item in the user menu. */
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";const e=require("react/jsx-runtime"),g=require("@nice2dev/ui-core"),y=require("react"),K=require("country-flag-icons/string/3x2");function U(f){const n=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(f){for(const i in f)if(i!=="default"){const r=Object.getOwnPropertyDescriptor(f,i);Object.defineProperty(n,i,r.get?r:{enumerable:!0,get:()=>f[i]})}}return n.default=f,Object.freeze(n)}const F=U(K),O=[],Z=({tabs:f=O,activeTab:n,onChange:i,variant:r="default",vertical:l,size:d="md",iconOnly:t=!1,centered:c="auto",countLocation:b="right",showHints:s,id:o,className:h,"data-testid":a,style:m,displayStyle:x})=>{const{t:p}=g.useNiceTranslation(),v=g.useControlId(o),_=c==="auto"?t:c,S=g.useComponentDisplayStyle("tab",x),T=g.useComponentDisplayClass("tab",x),[C,D]=y.useState(n||f[0]?.id),w=n??C,j=y.useRef(null),A=y.useRef(null),[R]=g.useInputPreferences(),k=g.useHintsVisible(),$=y.useCallback(u=>{D(u),i?.(u)},[i]);g.useRovingFocus(A,{orientation:l?"vertical":"horizontal",wrap:!0,onMove:u=>{const N=u.getAttribute("data-tab-id");N&&$(N)}}),g.useIntent(["sectionPrev","sectionNext"],u=>{const N=f.filter(I=>!I.disabled);if(N.length<2)return!1;const H=N.findIndex(I=>I.id===w),G=u.intent==="sectionNext"?1:-1,P=N[(H+G+N.length)%N.length];return $(P.id),[...A.current?.querySelectorAll("[data-tab-id]")??[]].find(I=>I.getAttribute("data-tab-id")===P.id)?.focus(),!0},{ref:j}),g.useInputHints(j,f.length>1?[{intent:"sectionPrev",label:p("input.intent.sectionPrev","Previous section")},{intent:"sectionNext",label:p("input.intent.sectionNext","Next section")}]:[]);const E=f.length>1&&k&&(s??R.hintDensity==="bar-and-controls"),L=f.find(u=>u.id===w)?.content;return e.jsxs("div",{ref:j,className:`nice-tabs nice-tabs--${d} ${l?"nice-tabs--vertical":""} ${t?"nice-tabs--icon-only":""} nice-tabs--ds-${T} ${h||""}`,style:{...S,...m},"data-testid":a,children:[e.jsxs("div",{ref:A,className:`nice-tabs__list ${r!=="default"?`nice-tabs__list--${r}`:""} ${l?"nice-tabs__list--vertical":""} ${_?"nice-tabs__list--centered":""}`,role:"tablist","aria-orientation":l?"vertical":"horizontal",children:[E&&e.jsx("span",{className:"nice-tabs__hint","aria-hidden":"true",children:e.jsx(g.NiceButtonPrompt,{intent:"sectionPrev",size:"sm"})}),f.map(u=>e.jsxs("button",{type:"button",role:"tab",id:`${v}-tab-${u.id}`,"data-tab-id":u.id,"aria-selected":w===u.id,"aria-controls":`${v}-panel`,"aria-label":t?u.label:void 0,title:t?u.label:void 0,className:`nice-tabs__tab ${w===u.id?"nice-tabs__tab--active":""} ${u.disabled?"nice-tabs__tab--disabled":""} ${b==="bottom"?"nice-tabs__tab--count-bottom":""}`,disabled:u.disabled,onClick:()=>$(u.id),children:[u.icon,!t&&e.jsx("span",{children:u.label}),u.badge!==void 0&&e.jsx("span",{className:`nice-tabs__badge${b==="bottom"?" nice-tabs__badge--pill":""}`,children:u.badge})]},u.id)),E&&e.jsx("span",{className:"nice-tabs__hint","aria-hidden":"true",children:e.jsx(g.NiceButtonPrompt,{intent:"sectionNext",size:"sm"})})]}),e.jsx("div",{className:"nice-tabs__panel",role:"tabpanel",id:`${v}-panel`,"aria-labelledby":w?`${v}-tab-${w}`:void 0,children:L})]})};function V(f,{open:n,onSelect:i,onClose:r,onOpen:l,loop:d=!1,pageSize:t=10,intentRef:c}){const[b,s]=y.useState(0);y.useEffect(()=>{s(a=>f.length===0?0:Math.min(Math.max(a,0),f.length-1))},[f.length]);const o=y.useCallback((a,m)=>s(x=>{const p=f.length;if(p===0)return 0;const v=a(x);return m?(v%p+p)%p:Math.min(Math.max(v,0),p-1)}),[f.length]),h=y.useCallback(a=>{if(!n){(a.key==="ArrowDown"||a.key==="ArrowUp")&&(a.preventDefault(),l?.());return}const m=a.target instanceof HTMLTextAreaElement||a.target instanceof HTMLInputElement&&a.target.type!=="checkbox";if(a.key==="ArrowDown")a.preventDefault(),o(x=>x+1,d);else if(a.key==="ArrowUp")a.preventDefault(),o(x=>x-1,d);else if(a.key==="PageDown")a.preventDefault(),o(x=>x+t,!1);else if(a.key==="PageUp")a.preventDefault(),o(x=>x-t,!1);else if(!m&&(a.key==="Home"||a.key==="End"))a.preventDefault(),o(()=>a.key==="Home"?0:f.length-1,!1);else if(a.key==="Enter"){const x=f[b];x!==void 0&&(a.preventDefault(),i(x,b))}else a.key==="Escape"&&r?.()},[n,f,b,d,t,o,i,r,l]);return g.useIntent(["navigate","activate"],a=>{if(a.source==="keyboard")return!1;if(a.intent==="activate"){const m=f[b];if(m===void 0)return!1;i(m,b);return}if(a.direction!=="up"&&a.direction!=="down")return!1;o(m=>m+(a.direction==="down"?1:-1),d)},{ref:c,enabled:n&&!!c}),{activeIndex:b,setActiveIndex:s,handleKeyDown:h}}const Y=Object.assign(y.forwardRef(({label:f,checked:n=!1,onChange:i,disabled:r,readOnly:l,loading:d,required:t,size:c="md",name:b,id:s,className:o,style:h,accessMode:a,displayStyle:m,showKeyboardHints:x,error:p,helperText:v,labelPlacement:_,errorPlacement:S,labelWidth:T,controlWidth:C,"data-testid":D},w)=>{const j=g.useNiceAccessMode(a,s),A=j==="hidden";(j==="disabled"||j==="readOnly")&&(r=!0);const{t:R}=g.useNiceTranslation(),k=g.useControlId(s);g.useComponentDisplayStyle("toggle",m);const $=g.useComponentDisplayClass("toggle",m),E=y.useMemo(()=>[{key:"Space",description:R("shortcuts.toggle","Toggle on/off")}],[R]);return A?null:e.jsxs("div",{className:`nice-field nice-field--inline nice-field--${c} ${_==="left"?"nice-field--label-left":""} ${d?"nice-field--loading":""} ${o||""}`,style:{...h,...T!=null&&{"--nice-field-label-width":typeof T=="number"?`${T}px`:T},...C!=null&&{"--nice-field-control-width":typeof C=="number"?`${C}px`:C}},"data-testid":D,"aria-busy":d||void 0,children:[_==="left"&&f&&e.jsx("span",{className:`nice-field__label ${t?"nice-field__label--required":""}`,children:f}),e.jsxs("div",{className:"nice-field__control",children:[e.jsxs("label",{className:`nice-toggle nice-toggle--ds-${$} ${c!=="md"?`nice-toggle--${c}`:""} ${r||d?"nice-toggle--disabled":""}`,htmlFor:k,children:[e.jsx("input",{ref:w,id:k,type:"checkbox",className:"nice-toggle__input",name:b,checked:n,disabled:r||d,readOnly:l,role:"switch","aria-checked":n,"aria-invalid":!!p,onChange:L=>{l||d||i?.(L.target.checked)}}),e.jsx("span",{className:"nice-toggle__track",children:e.jsx("span",{className:"nice-toggle__thumb"})}),_!=="left"&&f&&e.jsx("span",{children:f}),x&&e.jsx(g.NiceKeyboardHint,{shortcuts:E,size:"sm"})]}),d&&e.jsx("span",{className:"nice-field__spinner",children:e.jsx("span",{className:"nice-spinner nice-spinner--sm"})}),S==="right"&&p&&e.jsx("div",{id:`${k}-error`,className:"nice-field__error",role:"alert",children:p}),S==="right"&&!p&&v&&e.jsx("div",{id:`${k}-helper`,className:"nice-field__helper",children:v})]}),S!=="right"&&p&&e.jsx("div",{id:`${k}-error`,className:"nice-field__error",role:"alert",children:p}),S!=="right"&&!p&&v&&e.jsx("div",{id:`${k}-helper`,className:"nice-field__helper",children:v})]})}),{displayName:"NiceToggle"}),J=Object.freeze({AR:["#74acdf","#ffffff","#74acdf"],AT:["#ed2939","#ffffff","#ed2939"],AU:["#012169","#ffffff","#e4002b"],BE:["#000000","#fae042","#ed2939"],BR:["#009c3b","#ffdf00","#002776"],CA:["#ff0000","#ffffff","#ff0000"],CH:["#d52b1e","#ffffff","#d52b1e"],CN:["#de2910","#ffde00","#de2910"],CZ:["#11457e","#ffffff","#d7141a"],DE:["#000000","#dd0000","#ffce00"],DK:["#c8102e","#ffffff","#c8102e"],EE:["#0072ce","#000000","#ffffff"],EG:["#ce1126","#ffffff","#000000"],ES:["#aa151b","#f1bf00","#aa151b"],FI:["#ffffff","#003580","#ffffff"],FR:["#0055a4","#ffffff","#ef4135"],GB:["#012169","#ffffff","#c8102e"],GR:["#0d5eaf","#ffffff","#0d5eaf"],HR:["#171796","#ffffff","#ff0000"],HU:["#ce2939","#ffffff","#477050"],IE:["#169b62","#ffffff","#ff883e"],IL:["#ffffff","#0038b8","#ffffff"],IN:["#ff9933","#ffffff","#138808"],IS:["#02529c","#ffffff","#dc1e35"],IT:["#009246","#ffffff","#ce2b37"],JP:["#ffffff","#bc002d","#ffffff"],KR:["#ffffff","#cd2e3a","#0047a0"],LT:["#fdb913","#006a44","#c1272d"],LU:["#ed2939","#ffffff","#00a1de"],LV:["#9e3039","#ffffff","#9e3039"],MX:["#006847","#ffffff","#ce1126"],NL:["#ae1c28","#ffffff","#21468b"],NO:["#ef2b2d","#ffffff","#002868"],NZ:["#012169","#ffffff","#cc142b"],PL:["#ffffff","#dc143c"],PT:["#006600","#ff0000"],RO:["#002b7f","#fcd116","#ce1126"],RU:["#ffffff","#0039a6","#d52b1e"],SE:["#006aa7","#fecc00","#006aa7"],SK:["#ffffff","#0b4ea2","#ee1c25"],TR:["#e30a17","#ffffff","#e30a17"],UA:["#005bbb","#ffd500"],US:["#b22234","#ffffff","#3c3b6e"],VN:["#da251d","#ffff00","#da251d"],ZA:["#007a4d","#ffffff","#de3831"],AD:["#10069f","#fedf00","#d50032"],AE:["#00732f","#ffffff","#000000"],AF:["#000000","#d32011","#007a36"],AG:["#ce1126","#fcd116","#000000"],AL:["#e41e20","#000000","#e41e20"],AM:["#d90012","#0033a0","#f2a800"],AO:["#ce1126","#000000","#ffc500"],AZ:["#0092bc","#ed2939","#509e2f"],BA:["#002395","#fecb00","#ffffff"],BB:["#00267f","#ffc726","#00267f"],BD:["#006a4e","#f42a41","#006a4e"],BF:["#ef2b2d","#009e49","#fcd116"],BG:["#ffffff","#00966e","#d62612"],BH:["#ffffff","#ce1126","#ce1126"],BI:["#1eb53a","#ffffff","#ce1126"],BJ:["#008751","#fcd116","#e8112d"],BN:["#f7e017","#ffffff","#000000"],BO:["#d52b1e","#f9e300","#007934"],BS:["#00778b","#ffc72c","#000000"],BT:["#ffcc33","#ff4e12","#ffcc33"],BW:["#75aadb","#ffffff","#000000"],BY:["#c8313e","#007c30","#ffffff"],BZ:["#003f87","#ce1126","#003f87"],CD:["#007fff","#f7d618","#ce1021"],CF:["#003082","#ffffff","#289728"],CG:["#009543","#fbde4a","#dc241f"],CI:["#f77f00","#ffffff","#009e60"],CM:["#007a5e","#ce1126","#fcd116"],CO:["#fcd116","#003893","#ce1126"],CR:["#002b7f","#ffffff","#ce1126"],CU:["#002590","#ffffff","#cf142b"],CV:["#003893","#ffffff","#cf2027"],CY:["#ffffff","#d57800","#ffffff"],DJ:["#6ab2e7","#ffffff","#12ad2b"],DM:["#006b3f","#ffffff","#000000"],DO:["#002d62","#ffffff","#ce1126"],DZ:["#006233","#ffffff","#d21034"],EC:["#ffd100","#034ea2","#ed1c24"],ER:["#ea0437","#0084c9","#418fde"],ET:["#078930","#fcdd09","#da121a"],FJ:["#68bfe5","#cc0000","#ffffff"],GA:["#3a75c4","#ffe700","#009e60"],GD:["#ce1126","#fcd116","#007a5e"],GE:["#ffffff","#ff0000","#ffffff"],GH:["#ce1126","#fcd116","#006b3f"],GM:["#ce1126","#ffffff","#0c1c8c"],GN:["#ce1126","#fcd116","#009460"],GQ:["#3e9a00","#ffffff","#e32118"],GT:["#4997d0","#ffffff","#4997d0"],GW:["#ce1126","#fcd116","#009e49"],GY:["#009e49","#ffffff","#fcd116"],HK:["#de2910","#ffffff","#de2910"],HN:["#0073cf","#ffffff","#0073cf"],HT:["#00209f","#d21034","#00209f"],ID:["#ff0000","#ffffff","#ff0000"],IQ:["#ce1126","#ffffff","#000000"],IR:["#239f40","#ffffff","#da0000"],JM:["#000000","#fed100","#009b3a"],JO:["#000000","#ffffff","#007a3d"],KE:["#000000","#bb0000","#006600"],KG:["#ff0000","#fcd116","#ff0000"],KH:["#032ea1","#e00025","#032ea1"],KM:["#fcd116","#ffffff","#ce1126"],KP:["#024fa2","#ed1c27","#024fa2"],KW:["#007a3d","#ffffff","#ce1126"],KZ:["#00afca","#fec50c","#00afca"],LA:["#ce1126","#002868","#ce1126"],LB:["#ed1c24","#ffffff","#ed1c24"],LI:["#002780","#ce1126","#002780"],LK:["#ffbe29","#8d153a","#00534e"],LR:["#bf0a30","#ffffff","#002868"],LS:["#00209f","#ffffff","#009543"],LY:["#e70013","#000000","#239e46"],MA:["#c1272d","#006233","#c1272d"],MD:["#0046ae","#ffd200","#cc092f"],ME:["#d4af37","#cc0033","#d4af37"],MG:["#ffffff","#fc3d32","#007e3a"],MH:["#003893","#dd7500","#ffffff"],MK:["#d20000","#ffe600","#d20000"],ML:["#14b53a","#fcd116","#ce1126"],MM:["#fecb00","#34b233","#ea2839"],MN:["#c4272f","#015197","#c4272f"],MO:["#00785a","#ffd700","#ffffff"],MR:["#006233","#ffc400","#d01c1f"],MT:["#ffffff","#cf142b","#ffffff"],MU:["#ea2839","#1a206d","#00a04d"],MV:["#d21034","#007e3a","#ffffff"],MW:["#000000","#ce1126","#339e35"],MY:["#cc0000","#ffffff","#010066"],MZ:["#009a44","#ffffff","#000000"],NA:["#003580","#ffffff","#009543"],NE:["#ff8000","#ffffff","#0db02b"],NG:["#008753","#ffffff","#008753"],NI:["#0067c6","#ffffff","#0067c6"],NP:["#dc143c","#003893","#dc143c"],OM:["#dc241f","#ffffff","#008000"],PA:["#ffffff","#cc0033","#005aa7"],PE:["#d91023","#ffffff","#d91023"],PG:["#ce1126","#000000","#fcd116"],PH:["#0038a8","#ffffff","#ce1126"],PK:["#ffffff","#01411c","#01411c"],PS:["#000000","#ffffff","#007a3d"],PY:["#d52b1e","#ffffff","#0038a8"],QA:["#ffffff","#8a1538","#8a1538"],RS:["#c6363c","#0c4076","#ffffff"],RW:["#00a1de","#fad201","#00a651"],SA:["#006c35","#ffffff","#006c35"],SB:["#0051ba","#fcd116","#215b33"],SC:["#003f87","#fcd116","#d62828"],SD:["#d21034","#ffffff","#000000"],SG:["#ed2939","#ffffff","#ed2939"],SI:["#ffffff","#0000ff","#ff0000"],SL:["#1eb53a","#ffffff","#0072c6"],SM:["#ffffff","#5eb6e4","#ffffff"],SN:["#00853f","#fdef42","#e31b23"],SO:["#4189dd","#ffffff","#4189dd"],SR:["#377e3f","#ffffff","#b40a2d"],SS:["#000000","#ce1126","#078930"],ST:["#12ad2b","#ffce00","#d21034"],SV:["#0047ab","#ffffff","#0047ab"],SY:["#ce1126","#ffffff","#000000"],SZ:["#3e5eb9","#ffd900","#b10c0c"],TD:["#002664","#fecb00","#c60c30"],TG:["#006a4e","#fcd116","#d21034"],TH:["#ed1c24","#ffffff","#241d4f"],TJ:["#cc0000","#ffffff","#006600"],TL:["#dc241f","#ffc726","#000000"],TM:["#00853e","#ffffff","#cc0000"],TN:["#e70013","#ffffff","#e70013"],TO:["#ffffff","#c10000","#c10000"],TT:["#ce1126","#ffffff","#000000"],TW:["#fe0000","#000095","#fe0000"],TZ:["#1eb53a","#fcd116","#00a3dd"],UG:["#000000","#fcdc04","#d90000"],UY:["#ffffff","#0038a8","#ffffff"],UZ:["#1eb53a","#ffffff","#0099b5"],VA:["#ffe000","#ffffff","#ffe000"],VE:["#fcd116","#00247d","#cf142b"],VU:["#000000","#ce1126","#009543"],WS:["#002b7f","#ffffff","#cc0033"],YE:["#ce1126","#ffffff","#000000"],ZM:["#198a00","#de2010","#ef7d00"],ZW:["#078930","#fcd116","#cf2027"]}),B=["#cbd5e1","#94a3b8","#cbd5e1"];function q(f){return f?J[f.toUpperCase()]??B:B}const z=F,W=({code:f,size:n=22,className:i})=>{const{t:r}=g.useNiceTranslation(),l=f?.toUpperCase(),d=l?z[l]:void 0,t=n,c=Math.round(n*2/3);return d?e.jsx("span",{className:i,role:"img","aria-label":r("pickerCommons.flag","{upper} flag").replace("{upper}",String(l)),style:{display:"inline-block",width:t,height:c,boxSizing:"content-box",border:"1px solid var(--nice-overlay-15, rgba(0, 0, 0, 0.15))",borderRadius:2,overflow:"hidden",flexShrink:0,verticalAlign:"middle",lineHeight:0},dangerouslySetInnerHTML:{__html:d.replace("<svg ",`<svg width="${t}" height="${c}" preserveAspectRatio="xMidYMid slice" `)}}):e.jsx(Q,{code:f,size:n,className:i})},Q=({code:f,size:n=18,className:i})=>{const{t:r}=g.useNiceTranslation(),l=q(f);return e.jsx("span",{className:i,role:"img","aria-label":r("pickerCommons.flag2","{code} flag").replace("{code}",String(f)),style:{display:"inline-flex",width:n,height:Math.round(n*.7),boxSizing:"content-box",border:"1px solid var(--nice-overlay-15, rgba(0, 0, 0, 0.15))",borderRadius:2,overflow:"hidden",flexShrink:0,verticalAlign:"middle"},children:l.map((d,t)=>e.jsx("span",{style:{flex:1,background:d}},t))})};function X(f,n,i,r=280){const[l,d]=y.useState(i==="left"?"left":"right"),t=y.useCallback(()=>{if(i!=="auto"){d(i);return}const c=n.current;if(!c||typeof window>"u")return;const b=c.getBoundingClientRect(),o=window.innerWidth-b.left,h=b.right;o>=r&&o>h?d("left"):d("right")},[i,n,r]);return y.useEffect(()=>{if(f)return t(),window.addEventListener("resize",t),window.addEventListener("scroll",t,!0),()=>{window.removeEventListener("resize",t),window.removeEventListener("scroll",t,!0)}},[f,t]),l}const M=(f,n)=>({backgroundColor:f,backgroundImage:n});function ff({roles:f,w:n,h:i,border:r,className:l,label:d}){const t=[{key:"side",style:M(f.sideNav,f.sideNavImage),stripes:f.headers},{key:"top",style:M(f.topNav,f.topNavImage)},{key:"body",style:M(f.body,f.bodyImage)},{key:"panel",style:M(f.panel,f.panelImage)},{key:"highlight",style:M(f.highlight)}];return e.jsx("span",{className:l,role:"img","aria-label":d,"data-preview":"columns",style:{display:"inline-flex",width:n,height:i,border:`1px solid ${r}`,borderRadius:Math.max(2,Math.round(i*.14)),overflow:"hidden",flexShrink:0,verticalAlign:"middle"},children:t.map(c=>e.jsx("span",{"data-role":c.key,style:{flex:1,display:"flex",flexDirection:"column",...c.style},children:c.stripes?.map((b,s)=>e.jsx("span",{style:{flex:"0 0 20%",background:b}},s))},c.key))})}function ef({roles:f,w:n,h:i,border:r,className:l,label:d}){const t=Math.max(3,Math.round(i*.18)),c=Math.max(4,Math.round(n*.28)),b=Math.max(2,Math.round((i-t)*.13)),s=Math.max(2,Math.round(n*.06)),o=Math.max(1,Math.round(i*.06)),h=a=>({position:"absolute",...a});return e.jsxs("span",{className:l,role:"img","aria-label":d,"data-preview":"layout",style:{position:"relative",display:"inline-block",width:n,height:i,boxSizing:"content-box",...M(f.body,f.bodyImage),border:`1px solid ${r}`,borderRadius:Math.max(2,Math.round(i*.08)),overflow:"hidden",flexShrink:0,verticalAlign:"middle"},children:[e.jsx("span",{style:h({top:0,left:0,right:0,height:t,...M(f.topNav,f.topNavImage)})}),e.jsx("span",{style:h({top:Math.round(t*.3),left:s,width:Math.round(t*.4),height:Math.round(t*.4),borderRadius:"50%",background:f.primary})}),e.jsx("span",{style:h({top:Math.round(t*.42),left:s+t,width:Math.round(n*.22),height:o,background:f.topNavText,opacity:.8})}),e.jsx("span",{style:h({top:t,bottom:0,left:0,width:c,...M(f.sideNav,f.sideNavImage)})}),f.headers.map((a,m)=>e.jsx("span",{style:h({top:t+m*b,left:0,width:c,height:b,background:a})},m)),e.jsx("span",{style:h({top:t+f.headers.length*b+Math.round(b*.4),left:0,width:c,height:b,background:f.highlight})}),e.jsx("span",{style:h({top:t+s,left:c+s,right:s,bottom:s,...M(f.panel,f.panelImage),border:`1px solid ${f.panelBorder}`,borderRadius:2})}),e.jsx("span",{style:h({top:t+s*2.2,left:c+s*2,right:s*3,height:o,background:f.text,opacity:.85})}),e.jsx("span",{style:h({top:t+s*2.2+o*2.5,left:c+s*2,width:Math.round((n-c)*.4),height:o,background:f.text,opacity:.55})}),e.jsx("span",{style:h({bottom:s*2,right:s*2,width:Math.round((n-c)*.22),height:Math.max(2,o*2),borderRadius:2,background:f.primary})})]})}const tf=({colors:f,size:n=28,shape:i="page",className:r})=>{const{t:l}=g.useNiceTranslation(),d=n,t=Math.round(n*.75),c=f.border??"color-mix(in srgb, currentColor 30%, transparent)",b=l("pickerCommons.themePreview","Theme preview");if(f.roles){const p={roles:f.roles,w:d,h:t,border:c,className:r,label:b};return i==="swatch"||i==="columns"?e.jsx(ff,{...p}):e.jsx(ef,{...p})}if(i==="swatch"||i==="columns"){const p=[f.primary,f.background,f.backgroundSecondary??f.background,f.textColor];return e.jsx("span",{className:r,role:"img","aria-label":l("pickerCommons.themePreview","Theme preview"),style:{display:"inline-flex",width:d,height:t,border:`1px solid ${c}`,borderRadius:2,overflow:"hidden",flexShrink:0,verticalAlign:"middle"},children:p.map((v,_)=>e.jsx("span",{style:{flex:1,background:v}},_))})}const s=Math.max(2,Math.round(t*.17)),o=Math.max(2,Math.round(d*.14)),h=d-o*2,a=Math.max(2,Math.round(h*.16)),m=Math.max(1,Math.round(t*.07)),x=t-s;return e.jsxs("span",{className:r,role:"img","aria-label":l("pickerCommons.themePreview","Theme preview"),style:{position:"relative",display:"inline-block",width:d,height:t,boxSizing:"content-box",background:f.backgroundSecondary??f.background,border:`1px solid ${c}`,borderRadius:2,overflow:"hidden",flexShrink:0,verticalAlign:"middle"},children:[e.jsx("span",{style:{position:"absolute",top:0,left:0,right:0,height:s,background:f.primary}}),e.jsx("span",{style:{position:"absolute",top:s,bottom:0,left:o,right:o,background:f.background,borderLeft:`1px solid ${c}`,borderRight:`1px solid ${c}`}}),e.jsx("span",{style:{position:"absolute",top:s+Math.round(x*.28),left:o+a,right:o+a,height:m,background:f.textColor}}),e.jsx("span",{style:{position:"absolute",top:s+Math.round(x*.55),left:o+a,width:Math.max(3,Math.round((h-a*2)*.6)),height:m,background:f.textColor}})]})};exports.FlagIcon=W;exports.NiceTabs=Z;exports.NiceToggle=Y;exports.ThemePreviewSwatch=tf;exports.useDropdownAlignment=X;exports.useListKeyboardNav=V;
|