@nice2dev/ui-erp 1.3.7 → 1.3.9
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/dist/index.cjs +434 -401
- package/dist/index.mjs +434 -401
- package/package.json +2 -2
package/dist/index.cjs
CHANGED
|
@@ -7,7 +7,7 @@ function v() {
|
|
|
7
7
|
const e = De$1.useContext(c), t = De$1.useContext(i);
|
|
8
8
|
return { t: e, lang: t };
|
|
9
9
|
}
|
|
10
|
-
const
|
|
10
|
+
const Mt = /* @__PURE__ */ new Set([
|
|
11
11
|
"",
|
|
12
12
|
"text",
|
|
13
13
|
"search",
|
|
@@ -15,7 +15,7 @@ const gt = /* @__PURE__ */ new Set([
|
|
|
15
15
|
"url",
|
|
16
16
|
"tel",
|
|
17
17
|
"password"
|
|
18
|
-
]),
|
|
18
|
+
]), Te = /* @__PURE__ */ new Set([
|
|
19
19
|
"number",
|
|
20
20
|
"range",
|
|
21
21
|
"date",
|
|
@@ -23,7 +23,7 @@ const gt = /* @__PURE__ */ new Set([
|
|
|
23
23
|
"datetime-local",
|
|
24
24
|
"month",
|
|
25
25
|
"week"
|
|
26
|
-
]),
|
|
26
|
+
]), jt = /* @__PURE__ */ new Set([
|
|
27
27
|
"checkbox",
|
|
28
28
|
"radio",
|
|
29
29
|
"button",
|
|
@@ -32,7 +32,7 @@ const gt = /* @__PURE__ */ new Set([
|
|
|
32
32
|
"file",
|
|
33
33
|
"image",
|
|
34
34
|
"color"
|
|
35
|
-
]),
|
|
35
|
+
]), Ut = /* @__PURE__ */ new Set([
|
|
36
36
|
"button",
|
|
37
37
|
"link",
|
|
38
38
|
"checkbox",
|
|
@@ -44,22 +44,22 @@ const gt = /* @__PURE__ */ new Set([
|
|
|
44
44
|
"menuitemradio",
|
|
45
45
|
"option",
|
|
46
46
|
"treeitem"
|
|
47
|
-
]),
|
|
48
|
-
function
|
|
47
|
+
]), gt = (n) => n instanceof HTMLInputElement && Mt.has(n.type), Pe = (n) => n instanceof HTMLTextAreaElement, bt = (n) => n instanceof HTMLElement && n.isContentEditable;
|
|
48
|
+
function Gt(n, e) {
|
|
49
49
|
const { intent: t, direction: a2 } = e;
|
|
50
|
-
return
|
|
50
|
+
return gt(n) ? t === "navigate" ? a2 === "left" || a2 === "right" : t === "first" || t === "last" || t === "activate" || t === "toggleHints" : Pe(n) || bt(n) ? t !== "back" && t !== "view" && t !== "menu" && t !== "secondary" : n instanceof HTMLSelectElement ? t !== "back" && t !== "view" && t !== "menu" : n instanceof HTMLInputElement ? Te.has(n.type) ? t === "navigate" || t === "first" || t === "last" || t === "pagePrev" || t === "pageNext" : n.type === "radio" && t === "navigate" : false;
|
|
51
51
|
}
|
|
52
|
-
function
|
|
52
|
+
function yt(n) {
|
|
53
53
|
if (n instanceof HTMLButtonElement || n.tagName === "SUMMARY")
|
|
54
54
|
return true;
|
|
55
55
|
if (n instanceof HTMLAnchorElement)
|
|
56
56
|
return n.hasAttribute("href");
|
|
57
57
|
if (n instanceof HTMLInputElement)
|
|
58
|
-
return
|
|
58
|
+
return jt.has(n.type);
|
|
59
59
|
const e = n.getAttribute("role");
|
|
60
|
-
return e !== null &&
|
|
60
|
+
return e !== null && Ut.has(e);
|
|
61
61
|
}
|
|
62
|
-
function
|
|
62
|
+
function qt(n) {
|
|
63
63
|
if (typeof n.click == "function") {
|
|
64
64
|
n.click();
|
|
65
65
|
return;
|
|
@@ -73,7 +73,7 @@ function $t(n) {
|
|
|
73
73
|
})
|
|
74
74
|
);
|
|
75
75
|
}
|
|
76
|
-
function
|
|
76
|
+
function wt(n) {
|
|
77
77
|
if (n.defaultPrevented || n.repeat || n.target !== n.currentTarget || n.key !== "Enter" && n.key !== " " && n.key !== "Spacebar")
|
|
78
78
|
return;
|
|
79
79
|
const e = n.currentTarget;
|
|
@@ -93,34 +93,34 @@ function Et(n) {
|
|
|
93
93
|
})
|
|
94
94
|
);
|
|
95
95
|
}
|
|
96
|
-
function
|
|
96
|
+
function ve(n) {
|
|
97
97
|
const e = n.getAttribute("data-nice-engage");
|
|
98
98
|
if (e === "value" || e === "text" || e === "popup" || e === "canvas")
|
|
99
99
|
return e;
|
|
100
100
|
if (e === "none")
|
|
101
101
|
return null;
|
|
102
102
|
const t = n.getAttribute("role");
|
|
103
|
-
return t === "combobox" ? "popup" : t === "slider" || t === "spinbutton" || n instanceof HTMLSelectElement ? "value" : n instanceof HTMLInputElement ?
|
|
103
|
+
return t === "combobox" ? "popup" : t === "slider" || t === "spinbutton" || n instanceof HTMLSelectElement ? "value" : n instanceof HTMLInputElement ? Mt.has(n.type) ? n.readOnly ? null : "text" : Te.has(n.type) && !n.readOnly ? "value" : null : Pe(n) ? n.readOnly ? null : "text" : bt(n) ? "text" : null;
|
|
104
104
|
}
|
|
105
|
-
function
|
|
105
|
+
function Et(n, e) {
|
|
106
106
|
return e === "popup" ? n.getAttribute("aria-expanded") === "true" : n.hasAttribute("data-nice-engaged");
|
|
107
107
|
}
|
|
108
|
-
function
|
|
109
|
-
return n instanceof HTMLSelectElement || n instanceof HTMLInputElement &&
|
|
108
|
+
function ie(n) {
|
|
109
|
+
return n instanceof HTMLSelectElement || n instanceof HTMLInputElement && Te.has(n.type);
|
|
110
110
|
}
|
|
111
|
-
function
|
|
111
|
+
function me(n) {
|
|
112
112
|
n.dispatchEvent(new Event("input", { bubbles: true })), n.dispatchEvent(new Event("change", { bubbles: true }));
|
|
113
113
|
}
|
|
114
|
-
function
|
|
114
|
+
function De(n, e) {
|
|
115
115
|
var r;
|
|
116
116
|
const t = Object.getPrototypeOf(n), a2 = (r = Object.getOwnPropertyDescriptor(t, "value")) == null ? void 0 : r.set;
|
|
117
117
|
a2 ? a2.call(n, e) : n.value = e;
|
|
118
118
|
}
|
|
119
|
-
const
|
|
120
|
-
function
|
|
121
|
-
n.value !== e && (
|
|
119
|
+
const ge = (n) => n instanceof HTMLInputElement && n.type === "number";
|
|
120
|
+
function Yt(n, e) {
|
|
121
|
+
n.value !== e && (De(n, e), me(n));
|
|
122
122
|
}
|
|
123
|
-
function
|
|
123
|
+
function ce(n, e, t = "step") {
|
|
124
124
|
const a2 = e === "up" || e === "right";
|
|
125
125
|
if (n instanceof HTMLSelectElement) {
|
|
126
126
|
const s = n.selectedIndex, o = n.options.length - 1;
|
|
@@ -130,12 +130,12 @@ function le(n, e, t = "step") {
|
|
|
130
130
|
const i2 = t === "big" ? 10 : 1;
|
|
131
131
|
n.selectedIndex = Math.max(0, Math.min(o, s + (a2 ? i2 : -i2)));
|
|
132
132
|
}
|
|
133
|
-
return n.selectedIndex !== s ? (
|
|
133
|
+
return n.selectedIndex !== s ? (me(n), true) : false;
|
|
134
134
|
}
|
|
135
135
|
const r = n.value;
|
|
136
136
|
try {
|
|
137
137
|
if (t === "edge" && (n.min !== "" || n.max !== ""))
|
|
138
|
-
|
|
138
|
+
De(n, a2 ? n.max || n.value : n.min || n.value);
|
|
139
139
|
else {
|
|
140
140
|
const s = t === "big" ? 10 : 1;
|
|
141
141
|
a2 ? n.stepUp(s) : n.stepDown(s);
|
|
@@ -143,15 +143,15 @@ function le(n, e, t = "step") {
|
|
|
143
143
|
} catch {
|
|
144
144
|
return false;
|
|
145
145
|
}
|
|
146
|
-
return n.value !== r ? (
|
|
146
|
+
return n.value !== r ? (me(n), true) : false;
|
|
147
147
|
}
|
|
148
|
-
function
|
|
149
|
-
if (!(
|
|
148
|
+
function Wt(n, e) {
|
|
149
|
+
if (!(gt(n) || Pe(n)) || n.selectionStart === null || e !== "left" && e !== "right")
|
|
150
150
|
return false;
|
|
151
151
|
const t = n.selectionStart + (e === "right" ? 1 : -1), a2 = Math.max(0, Math.min(n.value.length, t));
|
|
152
152
|
return n.setSelectionRange(a2, a2), true;
|
|
153
153
|
}
|
|
154
|
-
const
|
|
154
|
+
const kt = {
|
|
155
155
|
// Navigation
|
|
156
156
|
"chevron-down": "M6 9l6 6 6-6",
|
|
157
157
|
"chevron-up": "M18 15l-6-6-6 6",
|
|
@@ -417,14 +417,14 @@ const xt = {
|
|
|
417
417
|
"key-backspace": "M21 5H9l-6 7 6 7h12a1 1 0 0 0 1-1V6a1 1 0 0 0-1-1z M17 9l-6 6 M11 9l6 6",
|
|
418
418
|
"key-space": "M4 10v4h16v-4",
|
|
419
419
|
"key-caps": "M12 4l-7 7h4v5h6v-5h4z M8 20h8"
|
|
420
|
-
},
|
|
420
|
+
}, Xt = {
|
|
421
421
|
xs: 12,
|
|
422
422
|
sm: 16,
|
|
423
423
|
md: 20,
|
|
424
424
|
lg: 24,
|
|
425
425
|
xl: 32
|
|
426
|
-
},
|
|
427
|
-
function
|
|
426
|
+
}, Ie = /* @__PURE__ */ De$1.createContext({});
|
|
427
|
+
function Jt({
|
|
428
428
|
path: n,
|
|
429
429
|
size: e,
|
|
430
430
|
className: t,
|
|
@@ -449,7 +449,7 @@ function Zt({
|
|
|
449
449
|
style: a2,
|
|
450
450
|
role: o ? "button" : s ? "img" : "presentation",
|
|
451
451
|
tabIndex: o ? 0 : void 0,
|
|
452
|
-
onKeyDown: o ?
|
|
452
|
+
onKeyDown: o ? wt : void 0,
|
|
453
453
|
"aria-label": s,
|
|
454
454
|
"aria-hidden": o ? void 0 : !s,
|
|
455
455
|
onClick: o,
|
|
@@ -460,7 +460,7 @@ function Zt({
|
|
|
460
460
|
}
|
|
461
461
|
);
|
|
462
462
|
}
|
|
463
|
-
const
|
|
463
|
+
const ee = ({
|
|
464
464
|
name: n,
|
|
465
465
|
size: e = "md",
|
|
466
466
|
className: t,
|
|
@@ -469,7 +469,7 @@ const te = ({
|
|
|
469
469
|
title: s,
|
|
470
470
|
onClick: o
|
|
471
471
|
}) => {
|
|
472
|
-
const { resolver: i2 } = De$1.useContext(
|
|
472
|
+
const { resolver: i2 } = De$1.useContext(Ie), c2 = typeof e == "number" ? e : Xt[e];
|
|
473
473
|
if (i2) {
|
|
474
474
|
const u = i2(n, c2);
|
|
475
475
|
if (u)
|
|
@@ -478,7 +478,7 @@ const te = ({
|
|
|
478
478
|
{
|
|
479
479
|
role: o ? "button" : void 0,
|
|
480
480
|
tabIndex: o ? 0 : void 0,
|
|
481
|
-
onKeyDown: o ?
|
|
481
|
+
onKeyDown: o ? wt : void 0,
|
|
482
482
|
className: `nice-icon-wrap ${t || ""}`,
|
|
483
483
|
style: a2,
|
|
484
484
|
onClick: o,
|
|
@@ -486,9 +486,9 @@ const te = ({
|
|
|
486
486
|
}
|
|
487
487
|
);
|
|
488
488
|
}
|
|
489
|
-
const d =
|
|
489
|
+
const d = kt[n];
|
|
490
490
|
return d ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
491
|
-
|
|
491
|
+
Jt,
|
|
492
492
|
{
|
|
493
493
|
path: d,
|
|
494
494
|
size: c2,
|
|
@@ -500,7 +500,7 @@ const te = ({
|
|
|
500
500
|
}
|
|
501
501
|
) : null;
|
|
502
502
|
};
|
|
503
|
-
const
|
|
503
|
+
const xt = [
|
|
504
504
|
"a[href]",
|
|
505
505
|
"area[href]",
|
|
506
506
|
"button",
|
|
@@ -515,7 +515,7 @@ const zt = [
|
|
|
515
515
|
"[tabindex]",
|
|
516
516
|
"[data-nice-focusable]"
|
|
517
517
|
].join(",");
|
|
518
|
-
function
|
|
518
|
+
function X(n) {
|
|
519
519
|
const e = n.getBoundingClientRect();
|
|
520
520
|
return {
|
|
521
521
|
left: e.left,
|
|
@@ -526,18 +526,18 @@ function J(n) {
|
|
|
526
526
|
height: e.height
|
|
527
527
|
};
|
|
528
528
|
}
|
|
529
|
-
const
|
|
530
|
-
function
|
|
531
|
-
if (
|
|
529
|
+
const Fe = (n) => n instanceof HTMLButtonElement || n instanceof HTMLInputElement || n instanceof HTMLSelectElement || n instanceof HTMLTextAreaElement;
|
|
530
|
+
function Zt(n) {
|
|
531
|
+
if (Fe(n) && n.disabled || n.getAttribute("aria-disabled") === "true" && !n.hasAttribute("data-nice-focusable"))
|
|
532
532
|
return true;
|
|
533
533
|
const e = n.closest("fieldset[disabled]");
|
|
534
|
-
if (e &&
|
|
534
|
+
if (e && Fe(n)) {
|
|
535
535
|
const t = e.querySelector(":scope > legend");
|
|
536
536
|
return !(t && t.contains(n));
|
|
537
537
|
}
|
|
538
538
|
return false;
|
|
539
539
|
}
|
|
540
|
-
function
|
|
540
|
+
function Qt(n) {
|
|
541
541
|
var a2;
|
|
542
542
|
if (n.closest("[hidden]"))
|
|
543
543
|
return false;
|
|
@@ -550,7 +550,7 @@ function en(n) {
|
|
|
550
550
|
const t = (a2 = n.ownerDocument.defaultView) == null ? void 0 : a2.getComputedStyle(n);
|
|
551
551
|
return !t || t.display !== "none" && t.visibility !== "hidden" && t.visibility !== "collapse";
|
|
552
552
|
}
|
|
553
|
-
function
|
|
553
|
+
function en(n) {
|
|
554
554
|
if (!(n instanceof HTMLInputElement) || n.type !== "radio" || !n.name || n.checked)
|
|
555
555
|
return true;
|
|
556
556
|
const t = [...(n.form ?? n.ownerDocument).querySelectorAll('input[type="radio"]')].filter(
|
|
@@ -558,29 +558,29 @@ function tn(n) {
|
|
|
558
558
|
);
|
|
559
559
|
return !t.some((a2) => a2.checked) && t[0] === n;
|
|
560
560
|
}
|
|
561
|
-
function
|
|
562
|
-
if (!(n instanceof HTMLElement) || !n.matches(
|
|
561
|
+
function te(n) {
|
|
562
|
+
if (!(n instanceof HTMLElement) || !n.matches(xt))
|
|
563
563
|
return false;
|
|
564
564
|
if (!n.hasAttribute("data-nice-focusable")) {
|
|
565
565
|
const e = n.getAttribute("tabindex");
|
|
566
566
|
if (e !== null && Number(e) < 0 || n instanceof HTMLAnchorElement && !n.hasAttribute("href") && e === null)
|
|
567
567
|
return false;
|
|
568
568
|
}
|
|
569
|
-
return n.closest('[inert],[aria-hidden="true"]') ||
|
|
569
|
+
return n.closest('[inert],[aria-hidden="true"]') || Zt(n) ? false : Qt(n) && en(n);
|
|
570
570
|
}
|
|
571
571
|
function U(n, e = []) {
|
|
572
572
|
const t = [];
|
|
573
|
-
for (const a2 of n.querySelectorAll(
|
|
574
|
-
e.some((r) => r && r.contains(a2)) ||
|
|
573
|
+
for (const a2 of n.querySelectorAll(xt))
|
|
574
|
+
e.some((r) => r && r.contains(a2)) || te(a2) && t.push(a2);
|
|
575
575
|
return t;
|
|
576
576
|
}
|
|
577
|
-
const
|
|
578
|
-
function
|
|
577
|
+
const _e = typeof window > "u" ? De$1.useEffect : De$1.useLayoutEffect;
|
|
578
|
+
function B(n, e, t) {
|
|
579
579
|
const a2 = De$1.useRef({ el: null, deps: [] }), r = De$1.useRef(e);
|
|
580
|
-
r.current = e,
|
|
580
|
+
r.current = e, _e(() => {
|
|
581
581
|
const s = (n == null ? void 0 : n.current) ?? null, o = a2.current;
|
|
582
582
|
s === o.el && t.length === o.deps.length && t.every((c2, d) => Object.is(c2, o.deps[d])) || (typeof o.cleanup == "function" && o.cleanup(), o.el = s, o.deps = [...t], o.cleanup = s ? r.current(s) : void 0);
|
|
583
|
-
}),
|
|
583
|
+
}), _e(
|
|
584
584
|
() => () => {
|
|
585
585
|
const s = a2.current;
|
|
586
586
|
typeof s.cleanup == "function" && s.cleanup(), a2.current = { el: null, deps: [] };
|
|
@@ -588,21 +588,21 @@ function _(n, e, t) {
|
|
|
588
588
|
[]
|
|
589
589
|
);
|
|
590
590
|
}
|
|
591
|
-
const
|
|
591
|
+
const je = {
|
|
592
592
|
"045e": "xbox",
|
|
593
593
|
"054c": "playstation",
|
|
594
594
|
"057e": "nintendo",
|
|
595
595
|
"28de": "steam"
|
|
596
596
|
};
|
|
597
|
-
function
|
|
597
|
+
function sn(n) {
|
|
598
598
|
var a2, r, s;
|
|
599
599
|
const e = n.toLowerCase(), t = ((a2 = /vendor:\s*([0-9a-f]{4})/.exec(e)) == null ? void 0 : a2[1]) ?? ((s = (r = /^([0-9a-f]{1,4})-[0-9a-f]{1,4}-/.exec(e)) == null ? void 0 : r[1]) == null ? void 0 : s.padStart(4, "0"));
|
|
600
|
-
return t &&
|
|
600
|
+
return t && je[t] ? je[t] : /xbox|xinput|x-box/.test(e) ? "xbox" : /dualsense|dualshock|playstation/.test(e) ? "playstation" : /nintendo|pro controller|joy-con|switch/.test(e) ? "nintendo" : /steam|valve/.test(e) ? "steam" : "generic";
|
|
601
601
|
}
|
|
602
|
-
function
|
|
602
|
+
function on(n, e) {
|
|
603
603
|
return e !== "auto" ? e : n === "nintendo" ? "east" : "south";
|
|
604
604
|
}
|
|
605
|
-
const
|
|
605
|
+
const Ct = ["up", "down", "left", "right"], we = {
|
|
606
606
|
navigate: ["ArrowUp", "ArrowDown", "ArrowLeft", "ArrowRight"],
|
|
607
607
|
activate: ["Enter", "Space"],
|
|
608
608
|
back: ["Escape"],
|
|
@@ -618,7 +618,7 @@ const Ht = ["up", "down", "left", "right"], Ee = {
|
|
|
618
618
|
last: ["End"],
|
|
619
619
|
scroll: [],
|
|
620
620
|
toggleHints: ["Shift+?"]
|
|
621
|
-
},
|
|
621
|
+
}, qe = {
|
|
622
622
|
navigate: ["dpadUp", "dpadDown", "dpadLeft", "dpadRight"],
|
|
623
623
|
activate: ["south"],
|
|
624
624
|
back: ["east"],
|
|
@@ -634,7 +634,7 @@ const Ht = ["up", "down", "left", "right"], Ee = {
|
|
|
634
634
|
last: [],
|
|
635
635
|
scroll: [],
|
|
636
636
|
toggleHints: ["leftStick"]
|
|
637
|
-
},
|
|
637
|
+
}, mn = {
|
|
638
638
|
" ": "Space",
|
|
639
639
|
Spacebar: "Space",
|
|
640
640
|
Esc: "Escape",
|
|
@@ -644,63 +644,63 @@ const Ht = ["up", "down", "left", "right"], Ee = {
|
|
|
644
644
|
Left: "ArrowLeft",
|
|
645
645
|
Right: "ArrowRight"
|
|
646
646
|
};
|
|
647
|
-
function
|
|
648
|
-
return
|
|
647
|
+
function Re(n) {
|
|
648
|
+
return mn[n] ?? n;
|
|
649
649
|
}
|
|
650
|
-
function
|
|
650
|
+
function Ht(n) {
|
|
651
651
|
const e = n.endsWith("++") ? [...n.slice(0, -2).split("+"), "+"] : n.split("+"), t = e.pop() ?? "", a2 = new Set(e.map((r) => r.toLowerCase()));
|
|
652
652
|
return {
|
|
653
|
-
key:
|
|
653
|
+
key: Re(t),
|
|
654
654
|
primary: a2.has("ctrl") || a2.has("cmd") || a2.has("meta") || a2.has("mod"),
|
|
655
655
|
alt: a2.has("alt") || a2.has("option"),
|
|
656
656
|
shift: a2.has("shift")
|
|
657
657
|
};
|
|
658
658
|
}
|
|
659
|
-
const
|
|
660
|
-
function
|
|
661
|
-
const t =
|
|
662
|
-
return !(t.length === 1 ? t.toLowerCase() === n.key.toLowerCase() : t === n.key) || n.primary !== (e.ctrlKey || e.metaKey) || n.alt !== e.altKey ? false :
|
|
659
|
+
const Mn = (n) => n.length === 1 && n.toLowerCase() === n.toUpperCase();
|
|
660
|
+
function Nt(n, e) {
|
|
661
|
+
const t = Re(e.key);
|
|
662
|
+
return !(t.length === 1 ? t.toLowerCase() === n.key.toLowerCase() : t === n.key) || n.primary !== (e.ctrlKey || e.metaKey) || n.alt !== e.altKey ? false : Mn(n.key) || n.shift === e.shiftKey;
|
|
663
663
|
}
|
|
664
|
-
function
|
|
664
|
+
function $e(n) {
|
|
665
665
|
const e = {};
|
|
666
|
-
for (const t of Object.keys(
|
|
667
|
-
const a2 = n.keyboardBindings[t] ??
|
|
668
|
-
e[t] = a2.map(
|
|
666
|
+
for (const t of Object.keys(we)) {
|
|
667
|
+
const a2 = n.keyboardBindings[t] ?? we[t];
|
|
668
|
+
e[t] = a2.map(Ht);
|
|
669
669
|
}
|
|
670
670
|
return e;
|
|
671
671
|
}
|
|
672
|
-
function
|
|
672
|
+
function gn(n, e) {
|
|
673
673
|
for (const t of Object.keys(e)) {
|
|
674
674
|
const a2 = e[t];
|
|
675
675
|
for (let r = 0; r < a2.length; r++)
|
|
676
|
-
if (
|
|
677
|
-
return t === "navigate" ? { intent: t, direction:
|
|
676
|
+
if (Nt(a2[r], n))
|
|
677
|
+
return t === "navigate" ? { intent: t, direction: Ct[r] } : t === "view" ? { intent: t, direction: a2[r].shift ? "up" : "down" } : { intent: t };
|
|
678
678
|
}
|
|
679
679
|
return null;
|
|
680
680
|
}
|
|
681
|
-
const
|
|
682
|
-
function
|
|
683
|
-
return
|
|
681
|
+
const bn = /* @__PURE__ */ new Set(["GoBack", "BrowserBack", "XF86Back"]), yn = /* @__PURE__ */ new Set([461, 10009]);
|
|
682
|
+
function wn(n) {
|
|
683
|
+
return bn.has(n.key) || yn.has(n.keyCode) ? { intent: "back" } : n.key === "ChannelUp" ? { intent: "sectionNext" } : n.key === "ChannelDown" ? { intent: "sectionPrev" } : null;
|
|
684
684
|
}
|
|
685
|
-
function
|
|
686
|
-
const t =
|
|
687
|
-
for (const s of Object.keys(
|
|
685
|
+
function Ee(n, e) {
|
|
686
|
+
const t = on(e, n.confirmButton), a2 = t === "south" ? "east" : "south", r = {};
|
|
687
|
+
for (const s of Object.keys(qe)) {
|
|
688
688
|
const o = n.gamepadBindings[s];
|
|
689
|
-
o ? r[s] = [...o] : s === "activate" ? r[s] = [t] : s === "back" ? r[s] = [a2] : r[s] = [
|
|
689
|
+
o ? r[s] = [...o] : s === "activate" ? r[s] = [t] : s === "back" ? r[s] = [a2] : r[s] = [...qe[s]];
|
|
690
690
|
}
|
|
691
691
|
return r;
|
|
692
692
|
}
|
|
693
|
-
function
|
|
693
|
+
function En(n) {
|
|
694
694
|
const e = /* @__PURE__ */ new Map();
|
|
695
695
|
for (const t of Object.keys(n))
|
|
696
696
|
n[t].forEach((a2, r) => {
|
|
697
|
-
e.has(a2) || e.set(a2, t === "navigate" ? { intent: t, direction:
|
|
697
|
+
e.has(a2) || e.set(a2, t === "navigate" ? { intent: t, direction: Ct[r] } : { intent: t });
|
|
698
698
|
});
|
|
699
699
|
return e;
|
|
700
700
|
}
|
|
701
|
-
const
|
|
702
|
-
function
|
|
703
|
-
const e = n.getAttribute(
|
|
701
|
+
const re = "data-nice-focus-scope", ke = `[${re}]`;
|
|
702
|
+
function Tt(n) {
|
|
703
|
+
const e = n.getAttribute(re), t = n.getAttribute("data-nice-scope-enter");
|
|
704
704
|
return {
|
|
705
705
|
nav: e === "vertical" || e === "horizontal" || e === "grid" || e === "none" ? e : "spatial",
|
|
706
706
|
wrap: n.hasAttribute("data-nice-scope-wrap"),
|
|
@@ -708,25 +708,25 @@ function Pt(n) {
|
|
|
708
708
|
enter: t === "selected" || t === "first" ? t : "last"
|
|
709
709
|
};
|
|
710
710
|
}
|
|
711
|
-
function
|
|
711
|
+
function Ye(n, e) {
|
|
712
712
|
var a2;
|
|
713
|
-
const t = (a2 = n.parentElement) == null ? void 0 : a2.closest(
|
|
713
|
+
const t = (a2 = n.parentElement) == null ? void 0 : a2.closest(ke);
|
|
714
714
|
return t && e.contains(t) && t !== e ? t : e;
|
|
715
715
|
}
|
|
716
|
-
function
|
|
716
|
+
function xn(n) {
|
|
717
717
|
var t, a2;
|
|
718
718
|
const e = [];
|
|
719
|
-
for (let r = (t = n.parentElement) == null ? void 0 : t.closest(
|
|
719
|
+
for (let r = (t = n.parentElement) == null ? void 0 : t.closest(ke); r; r = (a2 = r.parentElement) == null ? void 0 : a2.closest(ke))
|
|
720
720
|
e.push(r);
|
|
721
721
|
return e;
|
|
722
722
|
}
|
|
723
|
-
function
|
|
723
|
+
function zn(n) {
|
|
724
724
|
var t;
|
|
725
725
|
const e = (t = n.closest("[data-nice-arrows]")) == null ? void 0 : t.getAttribute("data-nice-arrows");
|
|
726
726
|
return e === "spatial" || e === "native" ? e : null;
|
|
727
727
|
}
|
|
728
|
-
const
|
|
729
|
-
function
|
|
728
|
+
const We = { horizontal: 30, vertical: 2 }, G = 1, Xe = (n) => n === "left" || n === "right", Je = (n, e, t, a2) => Math.max(0, Math.max(n, t) - Math.min(e, a2));
|
|
729
|
+
function An(n, e, t) {
|
|
730
730
|
switch (t) {
|
|
731
731
|
case "right":
|
|
732
732
|
return e.left >= n.right - G;
|
|
@@ -738,7 +738,7 @@ function Sn(n, e, t) {
|
|
|
738
738
|
return e.bottom <= n.top + G;
|
|
739
739
|
}
|
|
740
740
|
}
|
|
741
|
-
function
|
|
741
|
+
function Sn(n, e, t) {
|
|
742
742
|
const a2 = n.left + n.width / 2, r = n.top + n.height / 2, s = e.left + e.width / 2, o = e.top + e.height / 2;
|
|
743
743
|
switch (t) {
|
|
744
744
|
case "right":
|
|
@@ -751,20 +751,20 @@ function Ln(n, e, t) {
|
|
|
751
751
|
return o < r - G;
|
|
752
752
|
}
|
|
753
753
|
}
|
|
754
|
-
function
|
|
754
|
+
function Ln(n, e, t) {
|
|
755
755
|
let a2, r, s;
|
|
756
|
-
|
|
757
|
-
const o =
|
|
756
|
+
Xe(t) ? (a2 = t === "right" ? e.left - n.right : n.left - e.right, r = Je(n.top, n.bottom, e.top, e.bottom), s = Math.abs(e.top + e.height / 2 - (n.top + n.height / 2))) : (a2 = t === "down" ? e.top - n.bottom : n.top - e.bottom, r = Je(n.left, n.right, e.left, e.right), s = Math.abs(e.left + e.width / 2 - (n.left + n.width / 2)));
|
|
757
|
+
const o = Xe(t) ? We.horizontal : We.vertical;
|
|
758
758
|
return Math.max(0, a2) + r * o + s * 0.01;
|
|
759
759
|
}
|
|
760
|
-
function
|
|
760
|
+
function Pt(n, e, t, a2) {
|
|
761
761
|
const r = e.map(t);
|
|
762
|
-
for (const s of [
|
|
762
|
+
for (const s of [An, Sn]) {
|
|
763
763
|
let o = -1, i2 = 1 / 0;
|
|
764
764
|
for (let c2 = 0; c2 < r.length; c2++) {
|
|
765
765
|
if (!s(n, r[c2], a2))
|
|
766
766
|
continue;
|
|
767
|
-
const d =
|
|
767
|
+
const d = Ln(n, r[c2], a2);
|
|
768
768
|
d < i2 && (i2 = d, o = c2);
|
|
769
769
|
}
|
|
770
770
|
if (o >= 0)
|
|
@@ -772,11 +772,11 @@ function Dt(n, e, t, a2) {
|
|
|
772
772
|
}
|
|
773
773
|
return null;
|
|
774
774
|
}
|
|
775
|
-
const
|
|
775
|
+
const ue = (n) => n === "left" || n === "right", Cn = (n) => {
|
|
776
776
|
var e;
|
|
777
777
|
return ((e = n.ownerDocument.defaultView) == null ? void 0 : e.getComputedStyle(n).direction) === "rtl";
|
|
778
778
|
};
|
|
779
|
-
function
|
|
779
|
+
function Hn(n, e, t, a2) {
|
|
780
780
|
if (n.length === 0)
|
|
781
781
|
return null;
|
|
782
782
|
const r = (s) => !!(e.compareDocumentPosition(s) & Node.DOCUMENT_POSITION_FOLLOWING);
|
|
@@ -787,51 +787,51 @@ function Nn(n, e, t, a2) {
|
|
|
787
787
|
return n[s];
|
|
788
788
|
return a2 ? n[n.length - 1] : null;
|
|
789
789
|
}
|
|
790
|
-
const
|
|
791
|
-
function
|
|
790
|
+
const Nn = '[aria-selected="true"],[aria-checked="true"],[aria-current]:not([aria-current="false"]),:checked';
|
|
791
|
+
function Tn(n, e, t) {
|
|
792
792
|
let a2 = null;
|
|
793
793
|
for (let s = n.parentElement; s && !s.contains(e); s = s.parentElement)
|
|
794
|
-
s.hasAttribute(
|
|
794
|
+
s.hasAttribute(re) && (a2 = s);
|
|
795
795
|
if (!a2)
|
|
796
796
|
return n;
|
|
797
|
-
const r =
|
|
797
|
+
const r = Tt(a2).enter;
|
|
798
798
|
if (r === "last") {
|
|
799
799
|
const s = t.get(a2);
|
|
800
|
-
return s && s.isConnected && a2.contains(s) &&
|
|
800
|
+
return s && s.isConnected && a2.contains(s) && te(s) ? s : n;
|
|
801
801
|
}
|
|
802
|
-
return r === "selected" ? [...a2.querySelectorAll(
|
|
802
|
+
return r === "selected" ? [...a2.querySelectorAll(Nn)].find(te) ?? n : U(a2)[0] ?? n;
|
|
803
803
|
}
|
|
804
|
-
function
|
|
805
|
-
const a2 =
|
|
806
|
-
let r =
|
|
804
|
+
function Pn(n, e, t) {
|
|
805
|
+
const a2 = X(n);
|
|
806
|
+
let r = Ye(n, t.root), s = null;
|
|
807
807
|
for (; ; ) {
|
|
808
|
-
const o =
|
|
809
|
-
if (o.nav === "spatial" || o.nav === "grid" || o.nav === "vertical" && !
|
|
808
|
+
const o = Tt(r);
|
|
809
|
+
if (o.nav === "spatial" || o.nav === "grid" || o.nav === "vertical" && !ue(e) || o.nav === "horizontal" && ue(e)) {
|
|
810
810
|
const c2 = U(r, [n, s]);
|
|
811
811
|
let d;
|
|
812
812
|
if (o.nav === "vertical" || o.nav === "horizontal") {
|
|
813
813
|
let u = e === "down" || e === "right";
|
|
814
|
-
|
|
814
|
+
ue(e) && Cn(r) && (u = !u), d = Hn(c2, n, u, o.wrap);
|
|
815
815
|
} else
|
|
816
|
-
d =
|
|
816
|
+
d = Pt(a2, c2, X, e);
|
|
817
817
|
if (d)
|
|
818
|
-
return
|
|
818
|
+
return Tn(d, n, t.memory);
|
|
819
819
|
}
|
|
820
820
|
if (r === t.root || o.trap)
|
|
821
821
|
return null;
|
|
822
|
-
s = r, r =
|
|
822
|
+
s = r, r = Ye(r, t.root);
|
|
823
823
|
}
|
|
824
824
|
}
|
|
825
|
-
function
|
|
825
|
+
function Ze(n, e) {
|
|
826
826
|
const t = e.left + e.width / 2, a2 = e.top + e.height / 2;
|
|
827
827
|
let r = null, s = 1 / 0;
|
|
828
828
|
for (const o of U(n)) {
|
|
829
|
-
const i2 =
|
|
829
|
+
const i2 = X(o), c2 = Math.hypot(i2.left + i2.width / 2 - t, i2.top + i2.height / 2 - a2);
|
|
830
830
|
c2 < s && (s = c2, r = o);
|
|
831
831
|
}
|
|
832
832
|
return r;
|
|
833
833
|
}
|
|
834
|
-
const
|
|
834
|
+
const Dt = [
|
|
835
835
|
"[data-nice-region]",
|
|
836
836
|
"header",
|
|
837
837
|
"nav",
|
|
@@ -847,9 +847,9 @@ const It = [
|
|
|
847
847
|
'[role="region"][aria-label]',
|
|
848
848
|
'[role="region"][aria-labelledby]'
|
|
849
849
|
].join(",");
|
|
850
|
-
function
|
|
851
|
-
const a2 = [...t.root.querySelectorAll(
|
|
852
|
-
(u) => !a2.some((
|
|
850
|
+
function Dn(n, e, t) {
|
|
851
|
+
const a2 = [...t.root.querySelectorAll(Dt)], r = a2.filter(
|
|
852
|
+
(u) => !a2.some((h) => h !== u && h.contains(u)) && U(u).length > 0
|
|
853
853
|
);
|
|
854
854
|
if (r.length === 0)
|
|
855
855
|
return null;
|
|
@@ -857,9 +857,9 @@ function In(n, e, t) {
|
|
|
857
857
|
if (c2 === r[s])
|
|
858
858
|
return null;
|
|
859
859
|
const d = t.memory.get(c2);
|
|
860
|
-
return d && d.isConnected && c2.contains(d) &&
|
|
860
|
+
return d && d.isConnected && c2.contains(d) && te(d) ? d : U(c2)[0];
|
|
861
861
|
}
|
|
862
|
-
const
|
|
862
|
+
const de = [
|
|
863
863
|
"south",
|
|
864
864
|
"east",
|
|
865
865
|
"west",
|
|
@@ -877,7 +877,7 @@ const he = [
|
|
|
877
877
|
"dpadLeft",
|
|
878
878
|
"dpadRight",
|
|
879
879
|
"home"
|
|
880
|
-
],
|
|
880
|
+
], xe = "nice-intent", ne = "nice-engagechange", Y = {
|
|
881
881
|
confirmButton: "auto",
|
|
882
882
|
gamepadBindings: {},
|
|
883
883
|
keyboardBindings: {},
|
|
@@ -893,11 +893,11 @@ const he = [
|
|
|
893
893
|
vibration: false,
|
|
894
894
|
arrowNavigation: "auto",
|
|
895
895
|
onScreenKeyboard: "auto"
|
|
896
|
-
},
|
|
897
|
-
function
|
|
896
|
+
}, In = /* @__PURE__ */ new Set([4, 5, 6, 7, 12, 13, 14, 15]), On = 0.85;
|
|
897
|
+
function Rn(n, e) {
|
|
898
898
|
return Math.abs(n) > Math.abs(e) ? n > 0 ? "right" : "left" : e > 0 ? "down" : "up";
|
|
899
899
|
}
|
|
900
|
-
class
|
|
900
|
+
class Vn {
|
|
901
901
|
constructor(e, t) {
|
|
902
902
|
this.states = /* @__PURE__ */ new Map(), this.connected = /* @__PURE__ */ new Set(), this.warned = /* @__PURE__ */ new Set(), this.started = false, this.frameId = 0, this.onConnected = (a2) => {
|
|
903
903
|
const r = a2.gamepad;
|
|
@@ -932,39 +932,39 @@ class Fn {
|
|
|
932
932
|
}
|
|
933
933
|
/** Read every pad once; public so tests can drive a frame. */
|
|
934
934
|
poll(e) {
|
|
935
|
-
var o, i2, c2, d, u,
|
|
935
|
+
var o, i2, c2, d, u, h;
|
|
936
936
|
const t = this.opts.timing(), a2 = /* @__PURE__ */ new Set(), r = this.read();
|
|
937
937
|
for (const l of r) {
|
|
938
938
|
a2.add(l.index);
|
|
939
|
-
let
|
|
940
|
-
(!
|
|
939
|
+
let p = this.states.get(l.index);
|
|
940
|
+
(!p || p.info.id !== l.id) && (p = {
|
|
941
941
|
info: {
|
|
942
942
|
index: l.index,
|
|
943
943
|
id: l.id,
|
|
944
|
-
family:
|
|
944
|
+
family: sn(l.id),
|
|
945
945
|
mapping: l.mapping
|
|
946
946
|
},
|
|
947
947
|
pressed: [],
|
|
948
948
|
stick: null,
|
|
949
949
|
holds: /* @__PURE__ */ new Map()
|
|
950
|
-
}, this.states.set(l.index,
|
|
950
|
+
}, this.states.set(l.index, p), this.warnMapping(l), (i2 = (o = this.opts).onPadsChange) == null || i2.call(o, this.pads)), this.readButtons(p, l, e, t), this.readSticks(p, l, e, t);
|
|
951
951
|
}
|
|
952
952
|
let s = false;
|
|
953
953
|
for (const l of [...this.states.keys()])
|
|
954
954
|
a2.has(l) || (this.states.delete(l), s = true);
|
|
955
|
-
s && ((d = (c2 = this.opts).onPadsChange) == null || d.call(c2, this.pads)), (
|
|
955
|
+
s && ((d = (c2 = this.opts).onPadsChange) == null || d.call(c2, this.pads)), (h = (u = this.opts).onFrame) == null || h.call(u, r, e);
|
|
956
956
|
}
|
|
957
957
|
readButtons(e, t, a2, r) {
|
|
958
|
-
for (let s = 0; s <
|
|
958
|
+
for (let s = 0; s < de.length; s++) {
|
|
959
959
|
const o = t.buttons[s], i2 = !!(o && (o.pressed || o.value > 0.5)), c2 = `b${s}`;
|
|
960
|
-
i2 !== !!e.pressed[s] ? (e.pressed[s] = i2, i2 &&
|
|
960
|
+
i2 !== !!e.pressed[s] ? (e.pressed[s] = i2, i2 && In.has(s) ? e.holds.set(c2, { since: a2, last: a2, count: 0 }) : e.holds.delete(c2), this.opts.onButton({
|
|
961
961
|
pad: e.info,
|
|
962
|
-
button:
|
|
962
|
+
button: de[s],
|
|
963
963
|
pressed: i2,
|
|
964
964
|
repeat: false
|
|
965
965
|
})) : i2 && this.repeats(e, c2, a2, r) && this.opts.onButton({
|
|
966
966
|
pad: e.info,
|
|
967
|
-
button:
|
|
967
|
+
button: de[s],
|
|
968
968
|
pressed: i2,
|
|
969
969
|
repeat: true
|
|
970
970
|
});
|
|
@@ -973,13 +973,13 @@ class Fn {
|
|
|
973
973
|
readSticks(e, t, a2, r) {
|
|
974
974
|
const s = t.axes[0] ?? 0, o = t.axes[1] ?? 0, i2 = Math.hypot(s, o);
|
|
975
975
|
if (i2 >= r.stickThreshold) {
|
|
976
|
-
const
|
|
977
|
-
|
|
976
|
+
const h = Rn(s, o);
|
|
977
|
+
h !== e.stick ? (e.stick = h, e.holds.set("stick", { since: a2, last: a2, count: 0 }), this.opts.onStick({ pad: e.info, direction: h, repeat: false })) : this.repeats(e, "stick", a2, r) && this.opts.onStick({ pad: e.info, direction: h, repeat: true });
|
|
978
978
|
} else e.stick && i2 < r.stickThreshold * 0.7 && (e.stick = null, e.holds.delete("stick"));
|
|
979
979
|
const c2 = t.axes[2] ?? 0, d = t.axes[3] ?? 0, u = Math.hypot(c2, d);
|
|
980
980
|
if (u > r.stickDeadzone) {
|
|
981
|
-
const
|
|
982
|
-
this.opts.onScroll({ pad: e.info, x: c2 *
|
|
981
|
+
const h = (u - r.stickDeadzone) / (1 - r.stickDeadzone) / u;
|
|
982
|
+
this.opts.onScroll({ pad: e.info, x: c2 * h, y: d * h });
|
|
983
983
|
}
|
|
984
984
|
}
|
|
985
985
|
repeats(e, t, a2, r) {
|
|
@@ -988,7 +988,7 @@ class Fn {
|
|
|
988
988
|
return false;
|
|
989
989
|
const o = Math.max(
|
|
990
990
|
r.repeatIntervalMin,
|
|
991
|
-
r.repeatInterval *
|
|
991
|
+
r.repeatInterval * On ** s.count
|
|
992
992
|
);
|
|
993
993
|
return a2 - s.last < o ? false : (s.last = a2, s.count++, true);
|
|
994
994
|
}
|
|
@@ -1011,12 +1011,12 @@ class Fn {
|
|
|
1011
1011
|
this.frameId !== 0 && (this.win.cancelAnimationFrame(this.frameId), this.frameId = 0);
|
|
1012
1012
|
}
|
|
1013
1013
|
}
|
|
1014
|
-
const
|
|
1014
|
+
const Fn = {
|
|
1015
1015
|
up: "ArrowUp",
|
|
1016
1016
|
down: "ArrowDown",
|
|
1017
1017
|
left: "ArrowLeft",
|
|
1018
1018
|
right: "ArrowRight"
|
|
1019
|
-
},
|
|
1019
|
+
}, Qe = {
|
|
1020
1020
|
ArrowUp: 38,
|
|
1021
1021
|
ArrowDown: 40,
|
|
1022
1022
|
ArrowLeft: 37,
|
|
@@ -1027,20 +1027,20 @@ const _n = {
|
|
|
1027
1027
|
End: 35,
|
|
1028
1028
|
PageUp: 33,
|
|
1029
1029
|
PageDown: 34
|
|
1030
|
-
},
|
|
1031
|
-
class
|
|
1030
|
+
}, et = /* @__PURE__ */ new Set(["Shift", "Control", "Alt", "Meta", "AltGraph", "OS"]), _n = /Web0S|webOS|Tizen|SMART-TV|SmartTV|HbbTV|NetCast|Android TV|AFT|BRAVIA|CrKey/i, tt = 18, nt = (n) => n === "keyboard" || n === "gamepad" || n === "remote";
|
|
1031
|
+
class Bn {
|
|
1032
1032
|
constructor(e) {
|
|
1033
1033
|
this.started = false, this.listeners = /* @__PURE__ */ new Set(), this.frameListeners = /* @__PURE__ */ new Set(), this.padMaps = /* @__PURE__ */ new Map(), this.memory = /* @__PURE__ */ new WeakMap(), this.engagedValues = /* @__PURE__ */ new WeakMap(), this.overlays = [], this.hintsToggled = false, this.activePad = null, this.lastFocus = null, this.observer = null, this.live = null, this.snapshot = [], this.capture = null, this.translate = (t, a2) => a2, this.onKeyDown = (t) => {
|
|
1034
1034
|
if (t.niceSource)
|
|
1035
1035
|
return;
|
|
1036
|
-
const a2 =
|
|
1037
|
-
if (
|
|
1036
|
+
const a2 = wn(t), r = this.tv || a2 ? "remote" : "keyboard";
|
|
1037
|
+
if (et.has(t.key) || this.setMethod(r), this.capture && !et.has(t.key)) {
|
|
1038
1038
|
t.preventDefault();
|
|
1039
1039
|
const c2 = [
|
|
1040
1040
|
t.ctrlKey || t.metaKey ? "Ctrl" : "",
|
|
1041
1041
|
t.altKey ? "Alt" : "",
|
|
1042
1042
|
t.shiftKey ? "Shift" : ""
|
|
1043
|
-
], d =
|
|
1043
|
+
], d = Re(t.key);
|
|
1044
1044
|
this.capture({
|
|
1045
1045
|
keys: [...c2, d.length === 1 ? d.toUpperCase() : d].filter(Boolean).join("+")
|
|
1046
1046
|
});
|
|
@@ -1048,11 +1048,11 @@ class Kn {
|
|
|
1048
1048
|
}
|
|
1049
1049
|
if (t.defaultPrevented || t.isComposing)
|
|
1050
1050
|
return;
|
|
1051
|
-
const s = a2 ??
|
|
1051
|
+
const s = a2 ?? gn(t, this.keyTable);
|
|
1052
1052
|
if (!s)
|
|
1053
1053
|
return;
|
|
1054
1054
|
const o = this.targetOf(t);
|
|
1055
|
-
if (
|
|
1055
|
+
if (Gt(o, s))
|
|
1056
1056
|
return;
|
|
1057
1057
|
const i2 = {
|
|
1058
1058
|
intent: s.intent,
|
|
@@ -1089,15 +1089,15 @@ class Kn {
|
|
|
1089
1089
|
repeat: true,
|
|
1090
1090
|
gamepad: t.pad
|
|
1091
1091
|
};
|
|
1092
|
-
this.dispatchIntent(i2, o) || rt(
|
|
1092
|
+
this.dispatchIntent(i2, o) || at(rt(o, r, s), r * tt, s * tt);
|
|
1093
1093
|
}, this.onPointerDown = (t) => {
|
|
1094
1094
|
this.setMethod(t.pointerType === "touch" ? "touch" : "pointer");
|
|
1095
1095
|
}, this.onFocusIn = (t) => {
|
|
1096
1096
|
const a2 = t.target;
|
|
1097
1097
|
if (a2 instanceof HTMLElement) {
|
|
1098
1098
|
for (let r = a2.parentElement; r; r = r.parentElement)
|
|
1099
|
-
(r.hasAttribute(
|
|
1100
|
-
this.lastFocus = { el: a2, rect:
|
|
1099
|
+
(r.hasAttribute(re) || r.matches(Dt) || r === this.doc.body) && this.memory.set(r, a2);
|
|
1100
|
+
this.lastFocus = { el: a2, rect: X(a2), scope: xn(a2)[0] ?? null };
|
|
1101
1101
|
}
|
|
1102
1102
|
}, this.onFocusOut = (t) => {
|
|
1103
1103
|
const a2 = t.target;
|
|
@@ -1110,15 +1110,15 @@ class Kn {
|
|
|
1110
1110
|
const a2 = this.doc.activeElement;
|
|
1111
1111
|
if (a2 && a2 !== this.doc.body)
|
|
1112
1112
|
return;
|
|
1113
|
-
const r = this.navigationRoot(), s = t.scope && t.scope.isConnected && r.contains(t.scope) ? t.scope : r, o =
|
|
1113
|
+
const r = this.navigationRoot(), s = t.scope && t.scope.isConnected && r.contains(t.scope) ? t.scope : r, o = Ze(s, t.rect) ?? (s !== r ? Ze(r, t.rect) : null);
|
|
1114
1114
|
o && this.focusElement(o);
|
|
1115
|
-
}, this.win = e, this.doc = e.document, this.tv =
|
|
1115
|
+
}, this.win = e, this.doc = e.document, this.tv = _n.test(e.navigator.userAgent), this.keyTable = $e(Y), this.state = {
|
|
1116
1116
|
method: "pointer",
|
|
1117
1117
|
family: null,
|
|
1118
1118
|
pads: [],
|
|
1119
|
-
preferences:
|
|
1120
|
-
hintsVisible:
|
|
1121
|
-
}, this.poller = new
|
|
1119
|
+
preferences: Y,
|
|
1120
|
+
hintsVisible: Y.hints === "always"
|
|
1121
|
+
}, this.poller = new Vn(e, {
|
|
1122
1122
|
timing: () => this.state.preferences,
|
|
1123
1123
|
onButton: this.onPadButton,
|
|
1124
1124
|
onStick: this.onPadStick,
|
|
@@ -1159,7 +1159,7 @@ class Kn {
|
|
|
1159
1159
|
}
|
|
1160
1160
|
setPreferences(e) {
|
|
1161
1161
|
const t = { ...this.state.preferences, ...e };
|
|
1162
|
-
this.keyTable =
|
|
1162
|
+
this.keyTable = $e(t), this.padMaps.clear(), this.update({ preferences: t });
|
|
1163
1163
|
}
|
|
1164
1164
|
/** Words of announcements and labels; the React provider passes the app's translator. */
|
|
1165
1165
|
setTranslator(e) {
|
|
@@ -1172,7 +1172,7 @@ class Kn {
|
|
|
1172
1172
|
}
|
|
1173
1173
|
/** The buttons bound to an intent on a pad of the family (for prompts). */
|
|
1174
1174
|
gamepadBinding(e, t = this.glyphFamily) {
|
|
1175
|
-
return
|
|
1175
|
+
return Ee(this.state.preferences, t)[e];
|
|
1176
1176
|
}
|
|
1177
1177
|
/** The keys bound to an intent (for prompts), as written in the preferences. */
|
|
1178
1178
|
keyboardBinding(e) {
|
|
@@ -1195,12 +1195,12 @@ class Kn {
|
|
|
1195
1195
|
}
|
|
1196
1196
|
update(e) {
|
|
1197
1197
|
const t = { ...this.state, ...e }, { hints: a2 } = t.preferences;
|
|
1198
|
-
let r = a2 === "always" ? true : a2 === "never" ? false :
|
|
1198
|
+
let r = a2 === "always" ? true : a2 === "never" ? false : nt(t.method);
|
|
1199
1199
|
this.hintsToggled && (r = !r), t.hintsVisible = r, this.state = t, this.listeners.forEach((s) => s());
|
|
1200
1200
|
}
|
|
1201
1201
|
setMethod(e, t) {
|
|
1202
1202
|
const a2 = this.doc.documentElement;
|
|
1203
|
-
t && a2.getAttribute("data-nice-gamepad") !== t && a2.setAttribute("data-nice-gamepad", t), !(e === this.state.method && (t === void 0 || t === this.state.family)) && (a2.setAttribute("data-nice-input", e), this.watchRecovery(
|
|
1203
|
+
t && a2.getAttribute("data-nice-gamepad") !== t && a2.setAttribute("data-nice-gamepad", t), !(e === this.state.method && (t === void 0 || t === this.state.family)) && (a2.setAttribute("data-nice-input", e), this.watchRecovery(nt(e)), this.update(t ? { method: e, family: t } : { method: e }));
|
|
1204
1204
|
}
|
|
1205
1205
|
/* ── Gamepad frames (games, device testers) ──────────────────── */
|
|
1206
1206
|
/** Raw pads every polled frame while a pad is connected. */
|
|
@@ -1254,7 +1254,7 @@ class Kn {
|
|
|
1254
1254
|
/* ── Intents ─────────────────────────────────────────────────── */
|
|
1255
1255
|
/** Dispatches `nice-intent` on the target; returns whether a handler consumed it. */
|
|
1256
1256
|
dispatchIntent(e, t = this.focused()) {
|
|
1257
|
-
const a2 = new CustomEvent(
|
|
1257
|
+
const a2 = new CustomEvent(xe, {
|
|
1258
1258
|
detail: e,
|
|
1259
1259
|
bubbles: true,
|
|
1260
1260
|
cancelable: true,
|
|
@@ -1267,12 +1267,12 @@ class Kn {
|
|
|
1267
1267
|
const a2 = this.navigationRoot();
|
|
1268
1268
|
if (t === this.doc.body || !a2.contains(t))
|
|
1269
1269
|
return this.focusInitial(a2);
|
|
1270
|
-
const r =
|
|
1270
|
+
const r = Pn(t, e, { root: a2, memory: this.memory });
|
|
1271
1271
|
return r ? (this.focusElement(r), true) : false;
|
|
1272
1272
|
}
|
|
1273
1273
|
/** The `view` intent: next (`down`) or previous (`up`) region. */
|
|
1274
1274
|
focusRegion(e, t = this.focused()) {
|
|
1275
|
-
const a2 =
|
|
1275
|
+
const a2 = Dn(t, e, {
|
|
1276
1276
|
root: this.navigationRoot(),
|
|
1277
1277
|
memory: this.memory
|
|
1278
1278
|
});
|
|
@@ -1284,13 +1284,13 @@ class Kn {
|
|
|
1284
1284
|
e.focus({ preventScroll: true, focusVisible: true }), (t = e.scrollIntoView) == null || t.call(e, { block: "nearest", inline: "nearest" });
|
|
1285
1285
|
}
|
|
1286
1286
|
/** Engages a control (ADR-005 § 6); popup controls open instead. */
|
|
1287
|
-
engage(e, t, a2 =
|
|
1287
|
+
engage(e, t, a2 = ve(e)) {
|
|
1288
1288
|
if (a2) {
|
|
1289
1289
|
if (a2 === "popup") {
|
|
1290
1290
|
this.emulateKey(e, "ArrowDown", t);
|
|
1291
1291
|
return;
|
|
1292
1292
|
}
|
|
1293
|
-
e.setAttribute("data-nice-engaged", ""),
|
|
1293
|
+
e.setAttribute("data-nice-engaged", ""), ge(e) && this.engagedValues.set(e, e.value), this.fireEngage(e, { engaged: true, cancelled: false, source: t }), this.announce(this.translate("input.engaged", "Editing"));
|
|
1294
1294
|
}
|
|
1295
1295
|
}
|
|
1296
1296
|
/**
|
|
@@ -1302,7 +1302,7 @@ class Kn {
|
|
|
1302
1302
|
return;
|
|
1303
1303
|
e.removeAttribute("data-nice-engaged");
|
|
1304
1304
|
const r = this.engagedValues.get(e);
|
|
1305
|
-
this.engagedValues.delete(e), a2 && r !== void 0 &&
|
|
1305
|
+
this.engagedValues.delete(e), a2 && r !== void 0 && ge(e) && Yt(e, r), this.fireEngage(e, { engaged: false, cancelled: a2, source: t }), this.announce(this.translate("input.released", "Done editing"));
|
|
1306
1306
|
}
|
|
1307
1307
|
/** Defaults of trusted keys: the browser already clicks, types and scrolls. */
|
|
1308
1308
|
keyDefault(e, t) {
|
|
@@ -1323,27 +1323,27 @@ class Kn {
|
|
|
1323
1323
|
if (t !== "keyboard")
|
|
1324
1324
|
return "spatial";
|
|
1325
1325
|
const a2 = this.state.preferences.arrowNavigation;
|
|
1326
|
-
return a2 !== "auto" ? a2 :
|
|
1326
|
+
return a2 !== "auto" ? a2 : zn(e) ?? "native";
|
|
1327
1327
|
}
|
|
1328
1328
|
/* ── Gamepad ─────────────────────────────────────────────────── */
|
|
1329
1329
|
padMap(e) {
|
|
1330
1330
|
let t = this.padMaps.get(e);
|
|
1331
|
-
return t || (t =
|
|
1331
|
+
return t || (t = En(Ee(this.state.preferences, e)), this.padMaps.set(e, t)), t;
|
|
1332
1332
|
}
|
|
1333
1333
|
/** A pad intent: the intent event, then engage rules, key emulation and the default action. */
|
|
1334
1334
|
deviceIntent(e) {
|
|
1335
1335
|
const t = this.focused();
|
|
1336
1336
|
if (this.dispatchIntent(e, t))
|
|
1337
1337
|
return;
|
|
1338
|
-
const a2 = t === this.doc.body ? null :
|
|
1338
|
+
const a2 = t === this.doc.body ? null : ve(t), r = a2 !== null && Et(t, a2), s = t, o = e.source;
|
|
1339
1339
|
switch (e.intent) {
|
|
1340
1340
|
case "navigate": {
|
|
1341
1341
|
const i2 = e.direction ?? "down";
|
|
1342
|
-
a2 && !r ? this.moveFocus(i2, t) : r &&
|
|
1342
|
+
a2 && !r ? this.moveFocus(i2, t) : r && ie(t) ? ce(t, i2) : r && a2 === "text" ? Wt(t, i2) : this.emulateKey(t, Fn[i2], o) || this.moveFocus(i2, t);
|
|
1343
1343
|
return;
|
|
1344
1344
|
}
|
|
1345
1345
|
case "activate":
|
|
1346
|
-
a2 && !r ? this.engage(s, o, a2) : r && a2 === "popup" ? this.emulateKey(t, "Enter", o) : r && (a2 === "value" || a2 === "canvas") ? this.release(s, o, false) : r || (
|
|
1346
|
+
a2 && !r ? this.engage(s, o, a2) : r && a2 === "popup" ? this.emulateKey(t, "Enter", o) : r && (a2 === "value" || a2 === "canvas") ? this.release(s, o, false) : r || (yt(t) ? qt(t) : this.emulateKey(t, "Enter", o));
|
|
1347
1347
|
return;
|
|
1348
1348
|
case "back":
|
|
1349
1349
|
r && a2 === "popup" ? this.emulateKey(t, "Escape", o) : r ? this.release(s, o, true) : this.emulateKey(t, "Escape", o) || this.closeTopOverlay(o);
|
|
@@ -1352,17 +1352,17 @@ class Kn {
|
|
|
1352
1352
|
case "sectionNext":
|
|
1353
1353
|
if (r && a2 === "value") {
|
|
1354
1354
|
const i2 = e.intent === "sectionNext";
|
|
1355
|
-
|
|
1355
|
+
ie(t) ? ce(t, i2 ? "up" : "down", "big") : this.emulateKey(t, i2 ? "PageUp" : "PageDown", o);
|
|
1356
1356
|
}
|
|
1357
1357
|
return;
|
|
1358
1358
|
case "pagePrev":
|
|
1359
1359
|
case "pageNext": {
|
|
1360
1360
|
const i2 = e.intent === "pageNext";
|
|
1361
1361
|
if (r && a2 === "value")
|
|
1362
|
-
|
|
1362
|
+
ie(t) ? ce(t, i2 ? "up" : "down", "edge") : this.emulateKey(t, i2 ? "End" : "Home", o);
|
|
1363
1363
|
else if (!this.emulateKey(t, i2 ? "PageDown" : "PageUp", o)) {
|
|
1364
|
-
const c2 =
|
|
1365
|
-
|
|
1364
|
+
const c2 = rt(t, 0, i2 ? 1 : -1);
|
|
1365
|
+
at(c2, 0, (i2 ? 1 : -1) * ((c2 == null ? void 0 : c2.clientHeight) ?? 0) * 0.9);
|
|
1366
1366
|
}
|
|
1367
1367
|
return;
|
|
1368
1368
|
}
|
|
@@ -1396,7 +1396,7 @@ class Kn {
|
|
|
1396
1396
|
cancelable: true,
|
|
1397
1397
|
composed: true
|
|
1398
1398
|
});
|
|
1399
|
-
return Object.defineProperty(i2, "niceSource", { value: a2 }), Object.defineProperty(i2, "keyCode", { value:
|
|
1399
|
+
return Object.defineProperty(i2, "niceSource", { value: a2 }), Object.defineProperty(i2, "keyCode", { value: Qe[t] ?? 0 }), Object.defineProperty(i2, "which", { value: Qe[t] ?? 0 }), i2;
|
|
1400
1400
|
}, s = r("keydown");
|
|
1401
1401
|
return e.dispatchEvent(s), e.dispatchEvent(r("keyup")), s.defaultPrevented;
|
|
1402
1402
|
}
|
|
@@ -1435,11 +1435,11 @@ class Kn {
|
|
|
1435
1435
|
}
|
|
1436
1436
|
/** Nothing focused yet: the remembered element, else the first one of the main region. */
|
|
1437
1437
|
focusInitial(e) {
|
|
1438
|
-
const t = this.memory.get(e), a2 = e.querySelector('main,[role="main"]'), r = (t && t.isConnected && e.contains(t) &&
|
|
1438
|
+
const t = this.memory.get(e), a2 = e.querySelector('main,[role="main"]'), r = (t && t.isConnected && e.contains(t) && te(t) ? t : null) ?? (a2 ? U(a2)[0] : void 0) ?? U(e)[0];
|
|
1439
1439
|
return r ? (this.focusElement(r), true) : false;
|
|
1440
1440
|
}
|
|
1441
1441
|
fireEngage(e, t) {
|
|
1442
|
-
e.dispatchEvent(new CustomEvent(
|
|
1442
|
+
e.dispatchEvent(new CustomEvent(ne, { detail: t, bubbles: true }));
|
|
1443
1443
|
}
|
|
1444
1444
|
/** Polite announcement through the engine's own live region. */
|
|
1445
1445
|
announce(e) {
|
|
@@ -1450,10 +1450,10 @@ class Kn {
|
|
|
1450
1450
|
this.live.textContent = e;
|
|
1451
1451
|
}
|
|
1452
1452
|
}
|
|
1453
|
-
function
|
|
1453
|
+
function at(n, e, t) {
|
|
1454
1454
|
n && (typeof n.scrollBy == "function" ? n.scrollBy({ left: e, top: t }) : (n.scrollLeft += e, n.scrollTop += t));
|
|
1455
1455
|
}
|
|
1456
|
-
function
|
|
1456
|
+
function rt(n, e, t) {
|
|
1457
1457
|
const a2 = n.ownerDocument, r = a2.defaultView;
|
|
1458
1458
|
for (let s = n; s && s !== a2.body; s = s.parentElement) {
|
|
1459
1459
|
if (!(s instanceof HTMLElement) || !r)
|
|
@@ -1464,106 +1464,106 @@ function st(n, e, t) {
|
|
|
1464
1464
|
}
|
|
1465
1465
|
return a2.scrollingElement ?? a2.documentElement;
|
|
1466
1466
|
}
|
|
1467
|
-
const
|
|
1468
|
-
function
|
|
1469
|
-
let t =
|
|
1470
|
-
return t || (t = new
|
|
1467
|
+
const st = /* @__PURE__ */ new WeakMap();
|
|
1468
|
+
function Kn(n = window, e = true) {
|
|
1469
|
+
let t = st.get(n);
|
|
1470
|
+
return t || (t = new Bn(n), st.set(n, t)), e && t.start(), t;
|
|
1471
1471
|
}
|
|
1472
|
-
function
|
|
1472
|
+
function K() {
|
|
1473
1473
|
const [n] = De$1.useState(
|
|
1474
|
-
() => typeof window > "u" ? null :
|
|
1474
|
+
() => typeof window > "u" ? null : Kn(window, false)
|
|
1475
1475
|
);
|
|
1476
1476
|
return De$1.useEffect(() => {
|
|
1477
1477
|
n == null || n.start();
|
|
1478
1478
|
}, [n]), n;
|
|
1479
1479
|
}
|
|
1480
|
-
const
|
|
1481
|
-
function
|
|
1482
|
-
const { rowSelector: t =
|
|
1480
|
+
const ua = '[role="row"],tr', da = '[role="gridcell"],[role="columnheader"],[role="rowheader"],td,th', ha = 'button:not([disabled]),a[href],input:not([disabled]):not([type="hidden"]),select:not([disabled]),textarea:not([disabled])', fa = 'textarea,select,input:not([type="checkbox"]):not([type="radio"]):not([type="button"]):not([type="submit"]):not([type="reset"])';
|
|
1481
|
+
function Wa(n, e = {}) {
|
|
1482
|
+
const { rowSelector: t = ua, cellSelector: a2 = da, pageSize: r = 10, enabled: s = true } = e, o = De$1.useRef(e);
|
|
1483
1483
|
o.current = e;
|
|
1484
|
-
const i2 =
|
|
1485
|
-
|
|
1484
|
+
const i2 = K();
|
|
1485
|
+
B(
|
|
1486
1486
|
n,
|
|
1487
1487
|
(c2) => {
|
|
1488
1488
|
if (!s)
|
|
1489
1489
|
return;
|
|
1490
|
-
const d = c2.ownerDocument, u = (
|
|
1491
|
-
var
|
|
1492
|
-
return !!
|
|
1493
|
-
},
|
|
1494
|
-
const
|
|
1495
|
-
return
|
|
1496
|
-
},
|
|
1497
|
-
const
|
|
1498
|
-
return
|
|
1499
|
-
},
|
|
1500
|
-
const
|
|
1501
|
-
if (
|
|
1490
|
+
const d = c2.ownerDocument, u = (y) => {
|
|
1491
|
+
var L;
|
|
1492
|
+
return !!y && y.matches(t) && ((L = y.parentElement) == null ? void 0 : L.closest('[role="grid"],[role="treegrid"]')) === c2;
|
|
1493
|
+
}, h = () => [...c2.querySelectorAll(t)].filter(u), l = (y) => [...y.children].filter((L) => L.matches(a2)), p = (y) => {
|
|
1494
|
+
const L = y.querySelectorAll(ha);
|
|
1495
|
+
return L.length === 1 ? L[0] : y;
|
|
1496
|
+
}, w = () => h().flatMap((y) => l(y).map(p)), k = (y) => {
|
|
1497
|
+
const L = (y == null ? void 0 : y.closest(a2)) ?? null;
|
|
1498
|
+
return L && u(L.parentElement) ? L : null;
|
|
1499
|
+
}, x = () => {
|
|
1500
|
+
const y = w();
|
|
1501
|
+
if (y.length === 0)
|
|
1502
1502
|
return;
|
|
1503
|
-
const
|
|
1504
|
-
for (const
|
|
1505
|
-
const
|
|
1506
|
-
|
|
1503
|
+
const L = d.activeElement, T = y.find((E) => E === L || E.contains(L)) ?? y.find((E) => E.getAttribute("tabindex") === "0") ?? y[0];
|
|
1504
|
+
for (const E of y) {
|
|
1505
|
+
const g = E === T ? "0" : "-1";
|
|
1506
|
+
E.getAttribute("tabindex") !== g && E.setAttribute("tabindex", g);
|
|
1507
1507
|
}
|
|
1508
|
-
},
|
|
1509
|
-
var
|
|
1510
|
-
const
|
|
1511
|
-
for (const
|
|
1512
|
-
|
|
1513
|
-
i2 ? i2.focusElement(
|
|
1514
|
-
},
|
|
1515
|
-
var
|
|
1516
|
-
if (
|
|
1508
|
+
}, C = (y, L, T) => {
|
|
1509
|
+
var g, v2;
|
|
1510
|
+
const E = p(y);
|
|
1511
|
+
for (const M of w())
|
|
1512
|
+
M.setAttribute("tabindex", M === E ? "0" : "-1");
|
|
1513
|
+
i2 ? i2.focusElement(E) : E.focus(), (v2 = (g = o.current).onMove) == null || v2.call(g, y, L, T);
|
|
1514
|
+
}, S = (y) => {
|
|
1515
|
+
var P;
|
|
1516
|
+
if (y.defaultPrevented || y.altKey || y.metaKey)
|
|
1517
1517
|
return;
|
|
1518
|
-
const
|
|
1519
|
-
if (!
|
|
1518
|
+
const L = y.target, T = k(L);
|
|
1519
|
+
if (!T || p(T) !== L || L !== T && L.matches(fa))
|
|
1520
1520
|
return;
|
|
1521
|
-
const
|
|
1522
|
-
const
|
|
1523
|
-
if (
|
|
1521
|
+
const E = h(), g = E.indexOf(T.parentElement), v2 = l(E[g]).indexOf(T), M = (H, D) => {
|
|
1522
|
+
const _ = E[H] ? l(E[H]) : [];
|
|
1523
|
+
if (_.length === 0)
|
|
1524
1524
|
return null;
|
|
1525
|
-
const
|
|
1526
|
-
return [
|
|
1525
|
+
const F = Math.min(D, _.length - 1);
|
|
1526
|
+
return [_[F], H, F];
|
|
1527
1527
|
};
|
|
1528
|
-
let
|
|
1529
|
-
const
|
|
1530
|
-
if (
|
|
1531
|
-
|
|
1528
|
+
let f = null;
|
|
1529
|
+
const z = ((P = d.defaultView) == null ? void 0 : P.getComputedStyle(c2).direction) === "rtl", b = z && y.key === "ArrowLeft" ? "ArrowRight" : z && y.key === "ArrowRight" ? "ArrowLeft" : y.key;
|
|
1530
|
+
if (y.ctrlKey && (b === "Home" || b === "End"))
|
|
1531
|
+
f = b === "Home" ? M(0, 0) : M(E.length - 1, Number.MAX_SAFE_INTEGER);
|
|
1532
1532
|
else {
|
|
1533
|
-
if (
|
|
1533
|
+
if (y.ctrlKey)
|
|
1534
1534
|
return;
|
|
1535
|
-
if (
|
|
1536
|
-
|
|
1537
|
-
else if (
|
|
1538
|
-
|
|
1539
|
-
else if (
|
|
1540
|
-
|
|
1541
|
-
else if (
|
|
1542
|
-
|
|
1543
|
-
else if (
|
|
1544
|
-
|
|
1545
|
-
else if (
|
|
1546
|
-
|
|
1547
|
-
else if (
|
|
1548
|
-
const
|
|
1549
|
-
|
|
1550
|
-
} else if ((
|
|
1551
|
-
|
|
1535
|
+
if (b === "ArrowRight")
|
|
1536
|
+
f = v2 + 1 < l(E[g]).length ? M(g, v2 + 1) : null;
|
|
1537
|
+
else if (b === "ArrowLeft")
|
|
1538
|
+
f = v2 > 0 ? M(g, v2 - 1) : null;
|
|
1539
|
+
else if (b === "ArrowDown")
|
|
1540
|
+
f = g + 1 < E.length ? M(g + 1, v2) : null;
|
|
1541
|
+
else if (b === "ArrowUp")
|
|
1542
|
+
f = g > 0 ? M(g - 1, v2) : null;
|
|
1543
|
+
else if (b === "Home")
|
|
1544
|
+
f = M(g, 0);
|
|
1545
|
+
else if (b === "End")
|
|
1546
|
+
f = M(g, Number.MAX_SAFE_INTEGER);
|
|
1547
|
+
else if (b === "PageDown" || b === "PageUp") {
|
|
1548
|
+
const H = b === "PageDown" ? Math.min(E.length - 1, g + r) : Math.max(0, g - r);
|
|
1549
|
+
f = H !== g ? M(H, v2) : null;
|
|
1550
|
+
} else if ((b === "Enter" || b === " ") && L === T && !T.matches("button,a[href]")) {
|
|
1551
|
+
y.preventDefault(), T.click();
|
|
1552
1552
|
return;
|
|
1553
1553
|
} else
|
|
1554
1554
|
return;
|
|
1555
1555
|
}
|
|
1556
|
-
|
|
1557
|
-
},
|
|
1558
|
-
|
|
1559
|
-
const
|
|
1560
|
-
return
|
|
1556
|
+
f && f[0] !== T && (y.preventDefault(), C(...f));
|
|
1557
|
+
}, m = () => x();
|
|
1558
|
+
x(), c2.addEventListener("keydown", S), c2.addEventListener("focusin", m);
|
|
1559
|
+
const A = typeof MutationObserver > "u" ? null : new MutationObserver(() => x());
|
|
1560
|
+
return A == null || A.observe(c2, {
|
|
1561
1561
|
childList: true,
|
|
1562
1562
|
subtree: true,
|
|
1563
1563
|
attributes: true,
|
|
1564
1564
|
attributeFilter: ["disabled"]
|
|
1565
1565
|
}), () => {
|
|
1566
|
-
c2.removeEventListener("keydown",
|
|
1566
|
+
c2.removeEventListener("keydown", S), c2.removeEventListener("focusin", m), A == null || A.disconnect();
|
|
1567
1567
|
};
|
|
1568
1568
|
},
|
|
1569
1569
|
[s, t, a2, r, i2]
|
|
@@ -1813,7 +1813,7 @@ const NiceCapacityPlanner = ({
|
|
|
1813
1813
|
unit
|
|
1814
1814
|
)) }) }),
|
|
1815
1815
|
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "nice-resource-allocation__toolbar-right", children: config.showConflicts && conflicts.length > 0 && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "nice-resource-allocation__conflicts-badge", children: [
|
|
1816
|
-
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "nice-resource-allocation__badge-icon", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
1816
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "nice-resource-allocation__badge-icon", children: /* @__PURE__ */ jsxRuntime.jsx(ee, { name: "warning", size: 14 }) }),
|
|
1817
1817
|
(conflicts.length === 1 ? t("capacityPlanner.oneConflict", "1 Conflict") : t("capacityPlanner.conflicts", "{count} Conflicts")).replace("{count}", String(conflicts.length))
|
|
1818
1818
|
] }) })
|
|
1819
1819
|
] }),
|
|
@@ -1863,7 +1863,7 @@ const NiceCapacityPlanner = ({
|
|
|
1863
1863
|
{
|
|
1864
1864
|
role: onResourceClick ? "button" : void 0,
|
|
1865
1865
|
tabIndex: onResourceClick ? 0 : void 0,
|
|
1866
|
-
onKeyDown: onResourceClick ?
|
|
1866
|
+
onKeyDown: onResourceClick ? wt : void 0,
|
|
1867
1867
|
className: "nice-resource-allocation__resource-cell",
|
|
1868
1868
|
onClick: () => onResourceClick == null ? void 0 : onResourceClick(resource),
|
|
1869
1869
|
children: [
|
|
@@ -1876,7 +1876,7 @@ const NiceCapacityPlanner = ({
|
|
|
1876
1876
|
toggleResource(resource.id);
|
|
1877
1877
|
},
|
|
1878
1878
|
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
1879
|
-
|
|
1879
|
+
ee,
|
|
1880
1880
|
{
|
|
1881
1881
|
name: expandedResources.has(resource.id) ? "chevron-down" : "chevron-right",
|
|
1882
1882
|
size: 14
|
|
@@ -1884,7 +1884,7 @@ const NiceCapacityPlanner = ({
|
|
|
1884
1884
|
)
|
|
1885
1885
|
}
|
|
1886
1886
|
),
|
|
1887
|
-
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "nice-resource-allocation__resource-icon", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
1887
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "nice-resource-allocation__resource-icon", children: /* @__PURE__ */ jsxRuntime.jsx(ee, { name: getResourceTypeIcon(resource.type), size: 16 }) }),
|
|
1888
1888
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "nice-resource-allocation__resource-info", children: [
|
|
1889
1889
|
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "nice-resource-allocation__resource-name", children: resource.name }),
|
|
1890
1890
|
resource.department && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "nice-resource-allocation__resource-dept", children: resource.department })
|
|
@@ -1907,7 +1907,7 @@ const NiceCapacityPlanner = ({
|
|
|
1907
1907
|
role: readOnly ? void 0 : "button",
|
|
1908
1908
|
tabIndex: readOnly ? void 0 : 0,
|
|
1909
1909
|
"aria-label": readOnly ? void 0 : `${resource.name} ${formatDate(period)}`,
|
|
1910
|
-
onKeyDown: readOnly ? void 0 :
|
|
1910
|
+
onKeyDown: readOnly ? void 0 : wt,
|
|
1911
1911
|
className: `nice-resource-allocation__time-cell ${isHovered ? "nice-resource-allocation__time-cell--hovered" : ""}`,
|
|
1912
1912
|
style: { backgroundColor: getCellColor(resource.id, period) },
|
|
1913
1913
|
onClick: () => handleCellClick(resource.id, period),
|
|
@@ -1959,7 +1959,7 @@ const NiceCapacityPlanner = ({
|
|
|
1959
1959
|
{
|
|
1960
1960
|
role: "button",
|
|
1961
1961
|
tabIndex: 0,
|
|
1962
|
-
onKeyDown:
|
|
1962
|
+
onKeyDown: wt,
|
|
1963
1963
|
className: `nice-resource-allocation__allocation-bar nice-resource-allocation__allocation-bar--${allocation.status} ${selectedAllocation === allocation.id ? "nice-resource-allocation__allocation-bar--selected" : ""}`,
|
|
1964
1964
|
style: {
|
|
1965
1965
|
left: `${leftPercent}%`,
|
|
@@ -1980,7 +1980,7 @@ const NiceCapacityPlanner = ({
|
|
|
1980
1980
|
e.stopPropagation();
|
|
1981
1981
|
onAllocationDelete == null ? void 0 : onAllocationDelete(allocation.id);
|
|
1982
1982
|
},
|
|
1983
|
-
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
1983
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(ee, { name: "close", size: 14 })
|
|
1984
1984
|
}
|
|
1985
1985
|
)
|
|
1986
1986
|
]
|
|
@@ -2315,7 +2315,7 @@ const NiceInventoryManager = ({
|
|
|
2315
2315
|
onChange: (e) => setFilters((prev) => ({ ...prev, searchQuery: e.target.value }))
|
|
2316
2316
|
}
|
|
2317
2317
|
),
|
|
2318
|
-
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "nice-inventory-manager__search-icon", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
2318
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "nice-inventory-manager__search-icon", children: /* @__PURE__ */ jsxRuntime.jsx(ee, { name: "search", size: 14 }) })
|
|
2319
2319
|
] }),
|
|
2320
2320
|
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
2321
2321
|
"select",
|
|
@@ -2350,7 +2350,7 @@ const NiceInventoryManager = ({
|
|
|
2350
2350
|
className: `nice-inventory-manager__view-button ${view === v2 ? "nice-inventory-manager__view-button--active" : ""}`,
|
|
2351
2351
|
onClick: () => setView(v2),
|
|
2352
2352
|
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
2353
|
-
|
|
2353
|
+
ee,
|
|
2354
2354
|
{
|
|
2355
2355
|
name: v2 === "grid" ? "grid" : v2 === "list" ? "list" : "table",
|
|
2356
2356
|
size: 14
|
|
@@ -2424,7 +2424,7 @@ const NiceInventoryManager = ({
|
|
|
2424
2424
|
{
|
|
2425
2425
|
role: onItemClick ? "button" : void 0,
|
|
2426
2426
|
tabIndex: onItemClick ? 0 : void 0,
|
|
2427
|
-
onKeyDown: onItemClick ?
|
|
2427
|
+
onKeyDown: onItemClick ? wt : void 0,
|
|
2428
2428
|
className: `nice-inventory-manager__item-card ${selectedItems.has(item.id) ? "nice-inventory-manager__item-card--selected" : ""}`,
|
|
2429
2429
|
onClick: () => onItemClick == null ? void 0 : onItemClick(item),
|
|
2430
2430
|
children: [
|
|
@@ -2438,7 +2438,7 @@ const NiceInventoryManager = ({
|
|
|
2438
2438
|
onClick: (e) => e.stopPropagation()
|
|
2439
2439
|
}
|
|
2440
2440
|
),
|
|
2441
|
-
config.showImages && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "nice-inventory-manager__item-image", children: ((_a2 = item.images) == null ? void 0 : _a2[0]) ? /* @__PURE__ */ jsxRuntime.jsx("img", { src: item.images[0], alt: item.name }) : /* @__PURE__ */ jsxRuntime.jsx("span", { className: "nice-inventory-manager__placeholder-image", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
2441
|
+
config.showImages && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "nice-inventory-manager__item-image", children: ((_a2 = item.images) == null ? void 0 : _a2[0]) ? /* @__PURE__ */ jsxRuntime.jsx("img", { src: item.images[0], alt: item.name }) : /* @__PURE__ */ jsxRuntime.jsx("span", { className: "nice-inventory-manager__placeholder-image", children: /* @__PURE__ */ jsxRuntime.jsx(ee, { name: "box", size: 32 }) }) }),
|
|
2442
2442
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "nice-inventory-manager__item-info", children: [
|
|
2443
2443
|
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "nice-inventory-manager__item-sku", children: item.sku }),
|
|
2444
2444
|
/* @__PURE__ */ jsxRuntime.jsx("h4", { className: "nice-inventory-manager__item-name", children: item.name }),
|
|
@@ -2459,7 +2459,7 @@ const NiceInventoryManager = ({
|
|
|
2459
2459
|
item.unit
|
|
2460
2460
|
] }),
|
|
2461
2461
|
item.quantity <= item.reorderLevel && /* @__PURE__ */ jsxRuntime.jsxs("span", { className: "nice-inventory-manager__reorder-alert", children: [
|
|
2462
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
2462
|
+
/* @__PURE__ */ jsxRuntime.jsx(ee, { name: "warning", size: 12 }),
|
|
2463
2463
|
" ",
|
|
2464
2464
|
t("inventoryManager.lowStock", "Low Stock")
|
|
2465
2465
|
] })
|
|
@@ -2484,7 +2484,7 @@ const NiceInventoryManager = ({
|
|
|
2484
2484
|
t("inventoryManager.sku", "SKU"),
|
|
2485
2485
|
" ",
|
|
2486
2486
|
sortBy === "sku" && /* @__PURE__ */ jsxRuntime.jsx(
|
|
2487
|
-
|
|
2487
|
+
ee,
|
|
2488
2488
|
{
|
|
2489
2489
|
name: sortOrder === "asc" ? "arrow-up" : "arrow-down",
|
|
2490
2490
|
size: 12
|
|
@@ -2504,7 +2504,7 @@ const NiceInventoryManager = ({
|
|
|
2504
2504
|
t("inventoryManager.name", "Name"),
|
|
2505
2505
|
" ",
|
|
2506
2506
|
sortBy === "name" && /* @__PURE__ */ jsxRuntime.jsx(
|
|
2507
|
-
|
|
2507
|
+
ee,
|
|
2508
2508
|
{
|
|
2509
2509
|
name: sortOrder === "asc" ? "arrow-up" : "arrow-down",
|
|
2510
2510
|
size: 12
|
|
@@ -2525,7 +2525,7 @@ const NiceInventoryManager = ({
|
|
|
2525
2525
|
t("inventoryManager.qty", "Qty"),
|
|
2526
2526
|
" ",
|
|
2527
2527
|
sortBy === "quantity" && /* @__PURE__ */ jsxRuntime.jsx(
|
|
2528
|
-
|
|
2528
|
+
ee,
|
|
2529
2529
|
{
|
|
2530
2530
|
name: sortOrder === "asc" ? "arrow-up" : "arrow-down",
|
|
2531
2531
|
size: 12
|
|
@@ -2547,7 +2547,7 @@ const NiceInventoryManager = ({
|
|
|
2547
2547
|
t("inventoryManager.value", "Value"),
|
|
2548
2548
|
" ",
|
|
2549
2549
|
sortBy === "value" && /* @__PURE__ */ jsxRuntime.jsx(
|
|
2550
|
-
|
|
2550
|
+
ee,
|
|
2551
2551
|
{
|
|
2552
2552
|
name: sortOrder === "asc" ? "arrow-up" : "arrow-down",
|
|
2553
2553
|
size: 12
|
|
@@ -2610,7 +2610,7 @@ const NiceInventoryManager = ({
|
|
|
2610
2610
|
setEditingItem(item);
|
|
2611
2611
|
setShowItemModal(true);
|
|
2612
2612
|
},
|
|
2613
|
-
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
2613
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(ee, { name: "edit", size: 14 })
|
|
2614
2614
|
}
|
|
2615
2615
|
),
|
|
2616
2616
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
@@ -2622,7 +2622,7 @@ const NiceInventoryManager = ({
|
|
|
2622
2622
|
setNewTransaction({ itemId: item.id });
|
|
2623
2623
|
setShowTransactionModal(true);
|
|
2624
2624
|
},
|
|
2625
|
-
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
2625
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(ee, { name: "clipboard", size: 14 })
|
|
2626
2626
|
}
|
|
2627
2627
|
),
|
|
2628
2628
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
@@ -2633,7 +2633,7 @@ const NiceInventoryManager = ({
|
|
|
2633
2633
|
e.stopPropagation();
|
|
2634
2634
|
onItemDelete == null ? void 0 : onItemDelete(item.id);
|
|
2635
2635
|
},
|
|
2636
|
-
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
2636
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(ee, { name: "trash", size: 14 })
|
|
2637
2637
|
}
|
|
2638
2638
|
)
|
|
2639
2639
|
] })
|
|
@@ -2666,7 +2666,7 @@ const NiceInventoryManager = ({
|
|
|
2666
2666
|
{
|
|
2667
2667
|
role: onItemClick ? "button" : void 0,
|
|
2668
2668
|
tabIndex: onItemClick ? 0 : void 0,
|
|
2669
|
-
onKeyDown: onItemClick ?
|
|
2669
|
+
onKeyDown: onItemClick ? wt : void 0,
|
|
2670
2670
|
className: "nice-inventory-manager__kanban-card",
|
|
2671
2671
|
onClick: () => onItemClick == null ? void 0 : onItemClick(item),
|
|
2672
2672
|
children: [
|
|
@@ -2700,7 +2700,7 @@ const NiceInventoryManager = ({
|
|
|
2700
2700
|
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "nice-inventory-manager__transactions-list", children: recentTransactions.map((tx) => {
|
|
2701
2701
|
const item = items.find((i2) => i2.id === tx.itemId);
|
|
2702
2702
|
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "nice-inventory-manager__transaction-item", children: [
|
|
2703
|
-
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "nice-inventory-manager__tx-icon", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
2703
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "nice-inventory-manager__tx-icon", children: /* @__PURE__ */ jsxRuntime.jsx(ee, { name: getTransactionIcon(tx.type), size: 16 }) }),
|
|
2704
2704
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "nice-inventory-manager__tx-info", children: [
|
|
2705
2705
|
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "nice-inventory-manager__tx-type", children: tx.type }),
|
|
2706
2706
|
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "nice-inventory-manager__tx-item", children: (item == null ? void 0 : item.name) || tx.itemId })
|
|
@@ -2724,7 +2724,7 @@ const NiceInventoryManager = ({
|
|
|
2724
2724
|
}) })
|
|
2725
2725
|
] }),
|
|
2726
2726
|
activeTab === "reorder" && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "nice-inventory-manager__reorder-tab", children: reorderItems.length === 0 ? /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "nice-inventory-manager__empty-state", children: [
|
|
2727
|
-
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "nice-inventory-manager__empty-icon", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
2727
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "nice-inventory-manager__empty-icon", children: /* @__PURE__ */ jsxRuntime.jsx(ee, { name: "success", size: 32 }) }),
|
|
2728
2728
|
/* @__PURE__ */ jsxRuntime.jsx("p", { children: t(
|
|
2729
2729
|
"inventoryManager.allItemsAreSufficientlyStocked",
|
|
2730
2730
|
"All items are sufficiently stocked"
|
|
@@ -3063,7 +3063,9 @@ const NiceInvoiceView = /* @__PURE__ */ De$1.forwardRef(
|
|
|
3063
3063
|
density = "comfortable",
|
|
3064
3064
|
className,
|
|
3065
3065
|
style,
|
|
3066
|
-
id
|
|
3066
|
+
id,
|
|
3067
|
+
testId,
|
|
3068
|
+
"data-testid": dataTestId
|
|
3067
3069
|
}, ref) {
|
|
3068
3070
|
var _a;
|
|
3069
3071
|
const { t } = v();
|
|
@@ -3113,6 +3115,7 @@ const NiceInvoiceView = /* @__PURE__ */ De$1.forwardRef(
|
|
|
3113
3115
|
className: `nice-invoice-view nice-invoice-view--${density} ${className ?? ""}`,
|
|
3114
3116
|
style,
|
|
3115
3117
|
"aria-label": `${L.invoiceNumber} ${invoice.invoiceNumber}`,
|
|
3118
|
+
"data-testid": dataTestId ?? testId,
|
|
3116
3119
|
children: [
|
|
3117
3120
|
!(hideSections == null ? void 0 : hideSections.header) && /* @__PURE__ */ jsxRuntime.jsxs("header", { className: "nice-invoice-view__header", children: [
|
|
3118
3121
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
|
|
@@ -3154,7 +3157,7 @@ const NiceInvoiceView = /* @__PURE__ */ De$1.forwardRef(
|
|
|
3154
3157
|
onClick: () => onAction == null ? void 0 : onAction("download"),
|
|
3155
3158
|
"aria-label": t("invoiceView.download", "Download"),
|
|
3156
3159
|
title: t("invoiceView.download", "Download"),
|
|
3157
|
-
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
3160
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(ee, { name: "arrow-down", size: 12 })
|
|
3158
3161
|
}
|
|
3159
3162
|
),
|
|
3160
3163
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
@@ -3164,7 +3167,7 @@ const NiceInvoiceView = /* @__PURE__ */ De$1.forwardRef(
|
|
|
3164
3167
|
onClick: () => onAction == null ? void 0 : onAction("print"),
|
|
3165
3168
|
"aria-label": t("invoiceView.print", "Print"),
|
|
3166
3169
|
title: t("invoiceView.print", "Print"),
|
|
3167
|
-
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
3170
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(ee, { name: "printer", size: 14 })
|
|
3168
3171
|
}
|
|
3169
3172
|
),
|
|
3170
3173
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
@@ -3174,7 +3177,7 @@ const NiceInvoiceView = /* @__PURE__ */ De$1.forwardRef(
|
|
|
3174
3177
|
onClick: () => onAction == null ? void 0 : onAction("send"),
|
|
3175
3178
|
"aria-label": t("invoiceView.send", "Send"),
|
|
3176
3179
|
title: t("invoiceView.send", "Send"),
|
|
3177
|
-
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
3180
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(ee, { name: "mail", size: 14 })
|
|
3178
3181
|
}
|
|
3179
3182
|
)
|
|
3180
3183
|
] })
|
|
@@ -3316,7 +3319,9 @@ const NiceWarehouseView = /* @__PURE__ */ De$1.forwardRef(
|
|
|
3316
3319
|
aisleEvery = 4,
|
|
3317
3320
|
className,
|
|
3318
3321
|
style,
|
|
3319
|
-
id
|
|
3322
|
+
id,
|
|
3323
|
+
testId,
|
|
3324
|
+
"data-testid": dataTestId
|
|
3320
3325
|
}, ref) {
|
|
3321
3326
|
const { t } = v();
|
|
3322
3327
|
const [hovered, setHovered] = De$1.useState(null);
|
|
@@ -3334,87 +3339,97 @@ const NiceWarehouseView = /* @__PURE__ */ De$1.forwardRef(
|
|
|
3334
3339
|
return [...rows.entries()].map(([rowKey, arr]) => ({ rowKey, cells: arr }));
|
|
3335
3340
|
}, [cells]);
|
|
3336
3341
|
const gridRef = De$1.useRef(null);
|
|
3337
|
-
|
|
3338
|
-
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
3339
|
-
|
|
3340
|
-
|
|
3341
|
-
|
|
3342
|
-
|
|
3343
|
-
|
|
3344
|
-
|
|
3345
|
-
|
|
3346
|
-
|
|
3347
|
-
|
|
3348
|
-
|
|
3349
|
-
|
|
3350
|
-
|
|
3351
|
-
|
|
3352
|
-
|
|
3353
|
-
|
|
3354
|
-
|
|
3355
|
-
|
|
3356
|
-
|
|
3357
|
-
|
|
3358
|
-
|
|
3359
|
-
|
|
3360
|
-
|
|
3361
|
-
|
|
3362
|
-
|
|
3363
|
-
|
|
3364
|
-
|
|
3365
|
-
|
|
3366
|
-
|
|
3367
|
-
|
|
3368
|
-
|
|
3369
|
-
|
|
3370
|
-
|
|
3371
|
-
|
|
3372
|
-
|
|
3373
|
-
|
|
3374
|
-
|
|
3375
|
-
|
|
3376
|
-
|
|
3377
|
-
|
|
3378
|
-
|
|
3379
|
-
|
|
3380
|
-
|
|
3381
|
-
|
|
3382
|
-
|
|
3383
|
-
|
|
3384
|
-
|
|
3385
|
-
|
|
3386
|
-
|
|
3387
|
-
|
|
3388
|
-
|
|
3389
|
-
|
|
3390
|
-
|
|
3391
|
-
|
|
3392
|
-
|
|
3393
|
-
|
|
3394
|
-
|
|
3395
|
-
|
|
3396
|
-
|
|
3397
|
-
|
|
3398
|
-
|
|
3399
|
-
|
|
3400
|
-
|
|
3401
|
-
|
|
3402
|
-
|
|
3403
|
-
|
|
3404
|
-
|
|
3405
|
-
|
|
3406
|
-
|
|
3407
|
-
|
|
3408
|
-
|
|
3409
|
-
|
|
3410
|
-
|
|
3411
|
-
|
|
3412
|
-
"
|
|
3413
|
-
|
|
3342
|
+
Wa(gridRef);
|
|
3343
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
3344
|
+
"div",
|
|
3345
|
+
{
|
|
3346
|
+
ref,
|
|
3347
|
+
id,
|
|
3348
|
+
className: `nice-warehouse-view ${className ?? ""}`,
|
|
3349
|
+
style,
|
|
3350
|
+
"data-testid": dataTestId ?? testId,
|
|
3351
|
+
children: [
|
|
3352
|
+
/* @__PURE__ */ jsxRuntime.jsxs("header", { className: "nice-warehouse-view__header", children: [
|
|
3353
|
+
/* @__PURE__ */ jsxRuntime.jsx("h3", { children: warehouseName }),
|
|
3354
|
+
showLegend && /* @__PURE__ */ jsxRuntime.jsxs(
|
|
3355
|
+
"div",
|
|
3356
|
+
{
|
|
3357
|
+
className: "nice-warehouse-view__legend",
|
|
3358
|
+
"aria-label": t("warehouseView.occupancyLegend", "Occupancy legend"),
|
|
3359
|
+
children: [
|
|
3360
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { style: { background: colors.low } }),
|
|
3361
|
+
" ",
|
|
3362
|
+
t("warehouseView.low", "low"),
|
|
3363
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { style: { background: colors.mid } }),
|
|
3364
|
+
" ",
|
|
3365
|
+
t("warehouseView.mid", "mid"),
|
|
3366
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { style: { background: colors.high } }),
|
|
3367
|
+
" ",
|
|
3368
|
+
t("warehouseView.high", "high")
|
|
3369
|
+
]
|
|
3370
|
+
}
|
|
3371
|
+
)
|
|
3372
|
+
] }),
|
|
3373
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
3374
|
+
"div",
|
|
3375
|
+
{
|
|
3376
|
+
ref: gridRef,
|
|
3377
|
+
className: "nice-warehouse-view__grid",
|
|
3378
|
+
role: "grid",
|
|
3379
|
+
"aria-label": warehouseName,
|
|
3380
|
+
children: grid.map(({ rowKey, cells: row }) => /* @__PURE__ */ jsxRuntime.jsx("div", { className: "nice-warehouse-view__row", role: "row", children: row.map((c2, idx) => {
|
|
3381
|
+
const key = [c2.location.rack, c2.location.aisle, c2.location.shelf, c2.location.bin].filter(Boolean).join("-") || String(idx);
|
|
3382
|
+
const aisleBreak = aisleEvery > 0 && idx > 0 && idx % aisleEvery === 0;
|
|
3383
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(De$1.Fragment, { children: [
|
|
3384
|
+
aisleBreak && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "nice-warehouse-view__aisle", "aria-hidden": true }),
|
|
3385
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
3386
|
+
"button",
|
|
3387
|
+
{
|
|
3388
|
+
type: "button",
|
|
3389
|
+
role: "gridcell",
|
|
3390
|
+
className: "nice-warehouse-view__cell",
|
|
3391
|
+
style: {
|
|
3392
|
+
width: cellSize,
|
|
3393
|
+
height: cellSize,
|
|
3394
|
+
background: colorFor(c2.occupancy, colors)
|
|
3395
|
+
},
|
|
3396
|
+
title: t("warehouseView.items", "{key} — {occupancy}% ({items} items)").replace("{key}", String(key)).replace("{occupancy}", String((c2.occupancy * 100).toFixed(0))).replace("{items}", String(c2.items.length)),
|
|
3397
|
+
onClick: () => onCellClick == null ? void 0 : onCellClick(c2),
|
|
3398
|
+
onMouseEnter: () => setHovered(c2),
|
|
3399
|
+
onMouseLeave: () => setHovered(null),
|
|
3400
|
+
onFocus: () => setHovered(c2),
|
|
3401
|
+
onBlur: () => setHovered(null),
|
|
3402
|
+
children: /* @__PURE__ */ jsxRuntime.jsx("span", { className: "nice-warehouse-view__bin", children: c2.location.bin ?? c2.location.shelf ?? "" })
|
|
3403
|
+
}
|
|
3404
|
+
)
|
|
3405
|
+
] }, key);
|
|
3406
|
+
}) }, rowKey))
|
|
3407
|
+
}
|
|
3408
|
+
),
|
|
3409
|
+
hovered && /* @__PURE__ */ jsxRuntime.jsxs("aside", { className: "nice-warehouse-view__details", "aria-live": "polite", children: [
|
|
3410
|
+
/* @__PURE__ */ jsxRuntime.jsxs("strong", { children: [
|
|
3411
|
+
hovered.location.rack,
|
|
3412
|
+
"/",
|
|
3413
|
+
hovered.location.shelf,
|
|
3414
|
+
"/",
|
|
3415
|
+
hovered.location.bin
|
|
3416
|
+
] }),
|
|
3417
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { children: t("warehouseView.itemsFull", "{items} items · {occupancy}% full").replace("{items}", String(hovered.items.length)).replace("{occupancy}", String((hovered.occupancy * 100).toFixed(0))) }),
|
|
3418
|
+
/* @__PURE__ */ jsxRuntime.jsxs("ul", { children: [
|
|
3419
|
+
hovered.items.slice(0, 5).map((it) => /* @__PURE__ */ jsxRuntime.jsxs("li", { children: [
|
|
3420
|
+
it.sku,
|
|
3421
|
+
" — ",
|
|
3422
|
+
it.name
|
|
3423
|
+
] }, it.id)),
|
|
3424
|
+
hovered.items.length > 5 && /* @__PURE__ */ jsxRuntime.jsxs("li", { children: [
|
|
3425
|
+
"…+",
|
|
3426
|
+
hovered.items.length - 5
|
|
3427
|
+
] })
|
|
3428
|
+
] })
|
|
3414
3429
|
] })
|
|
3415
|
-
]
|
|
3416
|
-
|
|
3417
|
-
|
|
3430
|
+
]
|
|
3431
|
+
}
|
|
3432
|
+
);
|
|
3418
3433
|
}
|
|
3419
3434
|
);
|
|
3420
3435
|
const EMPTY_ORDERS = [];
|
|
@@ -3598,7 +3613,9 @@ const NiceHRDashboard = /* @__PURE__ */ De$1.forwardRef(
|
|
|
3598
3613
|
onWidgetClick,
|
|
3599
3614
|
className,
|
|
3600
3615
|
style,
|
|
3601
|
-
id
|
|
3616
|
+
id,
|
|
3617
|
+
testId,
|
|
3618
|
+
"data-testid": dataTestId
|
|
3602
3619
|
}, ref) {
|
|
3603
3620
|
const { t } = v();
|
|
3604
3621
|
const L = {
|
|
@@ -3652,6 +3669,7 @@ const NiceHRDashboard = /* @__PURE__ */ De$1.forwardRef(
|
|
|
3652
3669
|
style,
|
|
3653
3670
|
role: "group",
|
|
3654
3671
|
"aria-label": t("hrDashboard.hrDashboard", "HR dashboard"),
|
|
3672
|
+
"data-testid": dataTestId ?? testId,
|
|
3655
3673
|
children: [
|
|
3656
3674
|
!(hideWidgets == null ? void 0 : hideWidgets.headcount) && /* @__PURE__ */ jsxRuntime.jsx(
|
|
3657
3675
|
Widget,
|
|
@@ -3795,7 +3813,9 @@ const NiceVatTable = /* @__PURE__ */ De$1.forwardRef(
|
|
|
3795
3813
|
density = "comfortable",
|
|
3796
3814
|
className,
|
|
3797
3815
|
style,
|
|
3798
|
-
id
|
|
3816
|
+
id,
|
|
3817
|
+
testId,
|
|
3818
|
+
"data-testid": dataTestId
|
|
3799
3819
|
}, ref) {
|
|
3800
3820
|
const { t } = v();
|
|
3801
3821
|
const [internal, setInternal] = De$1.useState(rates ?? NICE_VAT_PRESETS[country]);
|
|
@@ -3835,7 +3855,7 @@ const NiceVatTable = /* @__PURE__ */ De$1.forwardRef(
|
|
|
3835
3855
|
};
|
|
3836
3856
|
const removeRow = (idx) => {
|
|
3837
3857
|
const code = internal[idx].code;
|
|
3838
|
-
const next = internal.filter((
|
|
3858
|
+
const next = internal.filter((_, i2) => i2 !== idx);
|
|
3839
3859
|
update(next);
|
|
3840
3860
|
onRemove == null ? void 0 : onRemove(code);
|
|
3841
3861
|
};
|
|
@@ -3846,6 +3866,7 @@ const NiceVatTable = /* @__PURE__ */ De$1.forwardRef(
|
|
|
3846
3866
|
id,
|
|
3847
3867
|
className: `nice-vat-table nice-vat-table--${density} ${className ?? ""}`,
|
|
3848
3868
|
style,
|
|
3869
|
+
"data-testid": dataTestId ?? testId,
|
|
3849
3870
|
children: [
|
|
3850
3871
|
/* @__PURE__ */ jsxRuntime.jsxs("table", { children: [
|
|
3851
3872
|
/* @__PURE__ */ jsxRuntime.jsx("thead", { children: /* @__PURE__ */ jsxRuntime.jsxs("tr", { children: [
|
|
@@ -3888,7 +3909,7 @@ const NiceVatTable = /* @__PURE__ */ De$1.forwardRef(
|
|
|
3888
3909
|
onChange: (e) => onCellEdit(idx, "description", e.target.value)
|
|
3889
3910
|
}
|
|
3890
3911
|
) : r.description ?? "" }),
|
|
3891
|
-
editable && /* @__PURE__ */ jsxRuntime.jsx("td", { children: /* @__PURE__ */ jsxRuntime.jsx("button", { type: "button", onClick: () => removeRow(idx), "aria-label": L.remove, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
3912
|
+
editable && /* @__PURE__ */ jsxRuntime.jsx("td", { children: /* @__PURE__ */ jsxRuntime.jsx("button", { type: "button", onClick: () => removeRow(idx), "aria-label": L.remove, children: /* @__PURE__ */ jsxRuntime.jsx(ee, { name: "close", size: 14 }) }) })
|
|
3892
3913
|
] }, r.code)) })
|
|
3893
3914
|
] }),
|
|
3894
3915
|
editable && /* @__PURE__ */ jsxRuntime.jsx("button", { type: "button", className: "nice-vat-table__add", onClick: addRow, children: L.add })
|
|
@@ -3962,7 +3983,9 @@ const NiceJpkExporter = /* @__PURE__ */ De$1.forwardRef(
|
|
|
3962
3983
|
labels,
|
|
3963
3984
|
className,
|
|
3964
3985
|
style,
|
|
3965
|
-
id
|
|
3986
|
+
id,
|
|
3987
|
+
testId,
|
|
3988
|
+
"data-testid": dataTestId
|
|
3966
3989
|
}, ref) {
|
|
3967
3990
|
const { t } = v();
|
|
3968
3991
|
const today = /* @__PURE__ */ new Date();
|
|
@@ -4002,36 +4025,46 @@ const NiceJpkExporter = /* @__PURE__ */ De$1.forwardRef(
|
|
|
4002
4025
|
URL.revokeObjectURL(url);
|
|
4003
4026
|
}
|
|
4004
4027
|
}, [format, from, to, taxpayer, invoices, buildXml, onExport, filenameFor]);
|
|
4005
|
-
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
4006
|
-
|
|
4007
|
-
|
|
4008
|
-
|
|
4009
|
-
|
|
4010
|
-
|
|
4011
|
-
|
|
4012
|
-
|
|
4013
|
-
|
|
4014
|
-
|
|
4015
|
-
|
|
4016
|
-
|
|
4017
|
-
|
|
4018
|
-
|
|
4019
|
-
|
|
4020
|
-
|
|
4021
|
-
|
|
4022
|
-
|
|
4023
|
-
|
|
4024
|
-
|
|
4025
|
-
|
|
4026
|
-
|
|
4027
|
-
|
|
4028
|
-
|
|
4029
|
-
|
|
4030
|
-
|
|
4031
|
-
|
|
4032
|
-
|
|
4033
|
-
|
|
4034
|
-
|
|
4028
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
4029
|
+
"div",
|
|
4030
|
+
{
|
|
4031
|
+
ref,
|
|
4032
|
+
id,
|
|
4033
|
+
className: `nice-jpk-exporter ${className ?? ""}`,
|
|
4034
|
+
style,
|
|
4035
|
+
"data-testid": dataTestId ?? testId,
|
|
4036
|
+
children: [
|
|
4037
|
+
/* @__PURE__ */ jsxRuntime.jsxs("label", { children: [
|
|
4038
|
+
L.format,
|
|
4039
|
+
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
4040
|
+
"select",
|
|
4041
|
+
{
|
|
4042
|
+
value: format,
|
|
4043
|
+
onChange: (e) => setFormat(e.target.value),
|
|
4044
|
+
children: [
|
|
4045
|
+
/* @__PURE__ */ jsxRuntime.jsx("option", { value: "JPK_V7M", children: "JPK_V7M" }),
|
|
4046
|
+
/* @__PURE__ */ jsxRuntime.jsx("option", { value: "JPK_V7K", children: "JPK_V7K" }),
|
|
4047
|
+
/* @__PURE__ */ jsxRuntime.jsx("option", { value: "JPK_FA", children: "JPK_FA" })
|
|
4048
|
+
]
|
|
4049
|
+
}
|
|
4050
|
+
)
|
|
4051
|
+
] }),
|
|
4052
|
+
/* @__PURE__ */ jsxRuntime.jsxs("label", { children: [
|
|
4053
|
+
L.from,
|
|
4054
|
+
/* @__PURE__ */ jsxRuntime.jsx("input", { type: "date", value: from, onChange: (e) => setFrom(e.target.value) })
|
|
4055
|
+
] }),
|
|
4056
|
+
/* @__PURE__ */ jsxRuntime.jsxs("label", { children: [
|
|
4057
|
+
L.to,
|
|
4058
|
+
/* @__PURE__ */ jsxRuntime.jsx("input", { type: "date", value: to, onChange: (e) => setTo(e.target.value) })
|
|
4059
|
+
] }),
|
|
4060
|
+
/* @__PURE__ */ jsxRuntime.jsx("button", { type: "button", onClick: exportNow, children: L.export }),
|
|
4061
|
+
/* @__PURE__ */ jsxRuntime.jsx("small", { children: t("jpkExporter.invoicesReady", "{invoices} invoices ready").replace(
|
|
4062
|
+
"{invoices}",
|
|
4063
|
+
String(invoices.length)
|
|
4064
|
+
) })
|
|
4065
|
+
]
|
|
4066
|
+
}
|
|
4067
|
+
);
|
|
4035
4068
|
}
|
|
4036
4069
|
);
|
|
4037
4070
|
exports.NICE_VAT_PRESETS = NICE_VAT_PRESETS;
|