@nice2dev/ui-erp 1.3.8 → 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 +287 -287
- package/dist/index.mjs +287 -287
- package/package.json +2 -2
package/dist/index.mjs
CHANGED
|
@@ -5,7 +5,7 @@ function v() {
|
|
|
5
5
|
const e = useContext(c), t = useContext(i);
|
|
6
6
|
return { t: e, lang: t };
|
|
7
7
|
}
|
|
8
|
-
const
|
|
8
|
+
const Mt = /* @__PURE__ */ new Set([
|
|
9
9
|
"",
|
|
10
10
|
"text",
|
|
11
11
|
"search",
|
|
@@ -13,7 +13,7 @@ const gt = /* @__PURE__ */ new Set([
|
|
|
13
13
|
"url",
|
|
14
14
|
"tel",
|
|
15
15
|
"password"
|
|
16
|
-
]),
|
|
16
|
+
]), Te = /* @__PURE__ */ new Set([
|
|
17
17
|
"number",
|
|
18
18
|
"range",
|
|
19
19
|
"date",
|
|
@@ -21,7 +21,7 @@ const gt = /* @__PURE__ */ new Set([
|
|
|
21
21
|
"datetime-local",
|
|
22
22
|
"month",
|
|
23
23
|
"week"
|
|
24
|
-
]),
|
|
24
|
+
]), jt = /* @__PURE__ */ new Set([
|
|
25
25
|
"checkbox",
|
|
26
26
|
"radio",
|
|
27
27
|
"button",
|
|
@@ -30,7 +30,7 @@ const gt = /* @__PURE__ */ new Set([
|
|
|
30
30
|
"file",
|
|
31
31
|
"image",
|
|
32
32
|
"color"
|
|
33
|
-
]),
|
|
33
|
+
]), Ut = /* @__PURE__ */ new Set([
|
|
34
34
|
"button",
|
|
35
35
|
"link",
|
|
36
36
|
"checkbox",
|
|
@@ -42,22 +42,22 @@ const gt = /* @__PURE__ */ new Set([
|
|
|
42
42
|
"menuitemradio",
|
|
43
43
|
"option",
|
|
44
44
|
"treeitem"
|
|
45
|
-
]),
|
|
46
|
-
function
|
|
45
|
+
]), gt = (n) => n instanceof HTMLInputElement && Mt.has(n.type), Pe = (n) => n instanceof HTMLTextAreaElement, bt = (n) => n instanceof HTMLElement && n.isContentEditable;
|
|
46
|
+
function Gt(n, e) {
|
|
47
47
|
const { intent: t, direction: a2 } = e;
|
|
48
|
-
return
|
|
48
|
+
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;
|
|
49
49
|
}
|
|
50
|
-
function
|
|
50
|
+
function yt(n) {
|
|
51
51
|
if (n instanceof HTMLButtonElement || n.tagName === "SUMMARY")
|
|
52
52
|
return true;
|
|
53
53
|
if (n instanceof HTMLAnchorElement)
|
|
54
54
|
return n.hasAttribute("href");
|
|
55
55
|
if (n instanceof HTMLInputElement)
|
|
56
|
-
return
|
|
56
|
+
return jt.has(n.type);
|
|
57
57
|
const e = n.getAttribute("role");
|
|
58
|
-
return e !== null &&
|
|
58
|
+
return e !== null && Ut.has(e);
|
|
59
59
|
}
|
|
60
|
-
function
|
|
60
|
+
function qt(n) {
|
|
61
61
|
if (typeof n.click == "function") {
|
|
62
62
|
n.click();
|
|
63
63
|
return;
|
|
@@ -71,7 +71,7 @@ function $t(n) {
|
|
|
71
71
|
})
|
|
72
72
|
);
|
|
73
73
|
}
|
|
74
|
-
function
|
|
74
|
+
function wt(n) {
|
|
75
75
|
if (n.defaultPrevented || n.repeat || n.target !== n.currentTarget || n.key !== "Enter" && n.key !== " " && n.key !== "Spacebar")
|
|
76
76
|
return;
|
|
77
77
|
const e = n.currentTarget;
|
|
@@ -91,34 +91,34 @@ function Et(n) {
|
|
|
91
91
|
})
|
|
92
92
|
);
|
|
93
93
|
}
|
|
94
|
-
function
|
|
94
|
+
function ve(n) {
|
|
95
95
|
const e = n.getAttribute("data-nice-engage");
|
|
96
96
|
if (e === "value" || e === "text" || e === "popup" || e === "canvas")
|
|
97
97
|
return e;
|
|
98
98
|
if (e === "none")
|
|
99
99
|
return null;
|
|
100
100
|
const t = n.getAttribute("role");
|
|
101
|
-
return t === "combobox" ? "popup" : t === "slider" || t === "spinbutton" || n instanceof HTMLSelectElement ? "value" : n instanceof HTMLInputElement ?
|
|
101
|
+
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;
|
|
102
102
|
}
|
|
103
|
-
function
|
|
103
|
+
function Et(n, e) {
|
|
104
104
|
return e === "popup" ? n.getAttribute("aria-expanded") === "true" : n.hasAttribute("data-nice-engaged");
|
|
105
105
|
}
|
|
106
|
-
function
|
|
107
|
-
return n instanceof HTMLSelectElement || n instanceof HTMLInputElement &&
|
|
106
|
+
function ie(n) {
|
|
107
|
+
return n instanceof HTMLSelectElement || n instanceof HTMLInputElement && Te.has(n.type);
|
|
108
108
|
}
|
|
109
|
-
function
|
|
109
|
+
function me(n) {
|
|
110
110
|
n.dispatchEvent(new Event("input", { bubbles: true })), n.dispatchEvent(new Event("change", { bubbles: true }));
|
|
111
111
|
}
|
|
112
|
-
function
|
|
112
|
+
function De(n, e) {
|
|
113
113
|
var r;
|
|
114
114
|
const t = Object.getPrototypeOf(n), a2 = (r = Object.getOwnPropertyDescriptor(t, "value")) == null ? void 0 : r.set;
|
|
115
115
|
a2 ? a2.call(n, e) : n.value = e;
|
|
116
116
|
}
|
|
117
|
-
const
|
|
118
|
-
function
|
|
119
|
-
n.value !== e && (
|
|
117
|
+
const ge = (n) => n instanceof HTMLInputElement && n.type === "number";
|
|
118
|
+
function Yt(n, e) {
|
|
119
|
+
n.value !== e && (De(n, e), me(n));
|
|
120
120
|
}
|
|
121
|
-
function
|
|
121
|
+
function ce(n, e, t = "step") {
|
|
122
122
|
const a2 = e === "up" || e === "right";
|
|
123
123
|
if (n instanceof HTMLSelectElement) {
|
|
124
124
|
const s = n.selectedIndex, o = n.options.length - 1;
|
|
@@ -128,12 +128,12 @@ function le(n, e, t = "step") {
|
|
|
128
128
|
const i2 = t === "big" ? 10 : 1;
|
|
129
129
|
n.selectedIndex = Math.max(0, Math.min(o, s + (a2 ? i2 : -i2)));
|
|
130
130
|
}
|
|
131
|
-
return n.selectedIndex !== s ? (
|
|
131
|
+
return n.selectedIndex !== s ? (me(n), true) : false;
|
|
132
132
|
}
|
|
133
133
|
const r = n.value;
|
|
134
134
|
try {
|
|
135
135
|
if (t === "edge" && (n.min !== "" || n.max !== ""))
|
|
136
|
-
|
|
136
|
+
De(n, a2 ? n.max || n.value : n.min || n.value);
|
|
137
137
|
else {
|
|
138
138
|
const s = t === "big" ? 10 : 1;
|
|
139
139
|
a2 ? n.stepUp(s) : n.stepDown(s);
|
|
@@ -141,15 +141,15 @@ function le(n, e, t = "step") {
|
|
|
141
141
|
} catch {
|
|
142
142
|
return false;
|
|
143
143
|
}
|
|
144
|
-
return n.value !== r ? (
|
|
144
|
+
return n.value !== r ? (me(n), true) : false;
|
|
145
145
|
}
|
|
146
|
-
function
|
|
147
|
-
if (!(
|
|
146
|
+
function Wt(n, e) {
|
|
147
|
+
if (!(gt(n) || Pe(n)) || n.selectionStart === null || e !== "left" && e !== "right")
|
|
148
148
|
return false;
|
|
149
149
|
const t = n.selectionStart + (e === "right" ? 1 : -1), a2 = Math.max(0, Math.min(n.value.length, t));
|
|
150
150
|
return n.setSelectionRange(a2, a2), true;
|
|
151
151
|
}
|
|
152
|
-
const
|
|
152
|
+
const kt = {
|
|
153
153
|
// Navigation
|
|
154
154
|
"chevron-down": "M6 9l6 6 6-6",
|
|
155
155
|
"chevron-up": "M18 15l-6-6-6 6",
|
|
@@ -415,14 +415,14 @@ const xt = {
|
|
|
415
415
|
"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",
|
|
416
416
|
"key-space": "M4 10v4h16v-4",
|
|
417
417
|
"key-caps": "M12 4l-7 7h4v5h6v-5h4z M8 20h8"
|
|
418
|
-
},
|
|
418
|
+
}, Xt = {
|
|
419
419
|
xs: 12,
|
|
420
420
|
sm: 16,
|
|
421
421
|
md: 20,
|
|
422
422
|
lg: 24,
|
|
423
423
|
xl: 32
|
|
424
|
-
},
|
|
425
|
-
function
|
|
424
|
+
}, Ie = /* @__PURE__ */ createContext({});
|
|
425
|
+
function Jt({
|
|
426
426
|
path: n,
|
|
427
427
|
size: e,
|
|
428
428
|
className: t,
|
|
@@ -447,7 +447,7 @@ function Zt({
|
|
|
447
447
|
style: a2,
|
|
448
448
|
role: o ? "button" : s ? "img" : "presentation",
|
|
449
449
|
tabIndex: o ? 0 : void 0,
|
|
450
|
-
onKeyDown: o ?
|
|
450
|
+
onKeyDown: o ? wt : void 0,
|
|
451
451
|
"aria-label": s,
|
|
452
452
|
"aria-hidden": o ? void 0 : !s,
|
|
453
453
|
onClick: o,
|
|
@@ -458,7 +458,7 @@ function Zt({
|
|
|
458
458
|
}
|
|
459
459
|
);
|
|
460
460
|
}
|
|
461
|
-
const
|
|
461
|
+
const ee = ({
|
|
462
462
|
name: n,
|
|
463
463
|
size: e = "md",
|
|
464
464
|
className: t,
|
|
@@ -467,7 +467,7 @@ const te = ({
|
|
|
467
467
|
title: s,
|
|
468
468
|
onClick: o
|
|
469
469
|
}) => {
|
|
470
|
-
const { resolver: i2 } = useContext(
|
|
470
|
+
const { resolver: i2 } = useContext(Ie), c2 = typeof e == "number" ? e : Xt[e];
|
|
471
471
|
if (i2) {
|
|
472
472
|
const u = i2(n, c2);
|
|
473
473
|
if (u)
|
|
@@ -476,7 +476,7 @@ const te = ({
|
|
|
476
476
|
{
|
|
477
477
|
role: o ? "button" : void 0,
|
|
478
478
|
tabIndex: o ? 0 : void 0,
|
|
479
|
-
onKeyDown: o ?
|
|
479
|
+
onKeyDown: o ? wt : void 0,
|
|
480
480
|
className: `nice-icon-wrap ${t || ""}`,
|
|
481
481
|
style: a2,
|
|
482
482
|
onClick: o,
|
|
@@ -484,9 +484,9 @@ const te = ({
|
|
|
484
484
|
}
|
|
485
485
|
);
|
|
486
486
|
}
|
|
487
|
-
const d =
|
|
487
|
+
const d = kt[n];
|
|
488
488
|
return d ? /* @__PURE__ */ jsx(
|
|
489
|
-
|
|
489
|
+
Jt,
|
|
490
490
|
{
|
|
491
491
|
path: d,
|
|
492
492
|
size: c2,
|
|
@@ -498,7 +498,7 @@ const te = ({
|
|
|
498
498
|
}
|
|
499
499
|
) : null;
|
|
500
500
|
};
|
|
501
|
-
const
|
|
501
|
+
const xt = [
|
|
502
502
|
"a[href]",
|
|
503
503
|
"area[href]",
|
|
504
504
|
"button",
|
|
@@ -513,7 +513,7 @@ const zt = [
|
|
|
513
513
|
"[tabindex]",
|
|
514
514
|
"[data-nice-focusable]"
|
|
515
515
|
].join(",");
|
|
516
|
-
function
|
|
516
|
+
function X(n) {
|
|
517
517
|
const e = n.getBoundingClientRect();
|
|
518
518
|
return {
|
|
519
519
|
left: e.left,
|
|
@@ -524,18 +524,18 @@ function J(n) {
|
|
|
524
524
|
height: e.height
|
|
525
525
|
};
|
|
526
526
|
}
|
|
527
|
-
const
|
|
528
|
-
function
|
|
529
|
-
if (
|
|
527
|
+
const Fe = (n) => n instanceof HTMLButtonElement || n instanceof HTMLInputElement || n instanceof HTMLSelectElement || n instanceof HTMLTextAreaElement;
|
|
528
|
+
function Zt(n) {
|
|
529
|
+
if (Fe(n) && n.disabled || n.getAttribute("aria-disabled") === "true" && !n.hasAttribute("data-nice-focusable"))
|
|
530
530
|
return true;
|
|
531
531
|
const e = n.closest("fieldset[disabled]");
|
|
532
|
-
if (e &&
|
|
532
|
+
if (e && Fe(n)) {
|
|
533
533
|
const t = e.querySelector(":scope > legend");
|
|
534
534
|
return !(t && t.contains(n));
|
|
535
535
|
}
|
|
536
536
|
return false;
|
|
537
537
|
}
|
|
538
|
-
function
|
|
538
|
+
function Qt(n) {
|
|
539
539
|
var a2;
|
|
540
540
|
if (n.closest("[hidden]"))
|
|
541
541
|
return false;
|
|
@@ -548,7 +548,7 @@ function en(n) {
|
|
|
548
548
|
const t = (a2 = n.ownerDocument.defaultView) == null ? void 0 : a2.getComputedStyle(n);
|
|
549
549
|
return !t || t.display !== "none" && t.visibility !== "hidden" && t.visibility !== "collapse";
|
|
550
550
|
}
|
|
551
|
-
function
|
|
551
|
+
function en(n) {
|
|
552
552
|
if (!(n instanceof HTMLInputElement) || n.type !== "radio" || !n.name || n.checked)
|
|
553
553
|
return true;
|
|
554
554
|
const t = [...(n.form ?? n.ownerDocument).querySelectorAll('input[type="radio"]')].filter(
|
|
@@ -556,29 +556,29 @@ function tn(n) {
|
|
|
556
556
|
);
|
|
557
557
|
return !t.some((a2) => a2.checked) && t[0] === n;
|
|
558
558
|
}
|
|
559
|
-
function
|
|
560
|
-
if (!(n instanceof HTMLElement) || !n.matches(
|
|
559
|
+
function te(n) {
|
|
560
|
+
if (!(n instanceof HTMLElement) || !n.matches(xt))
|
|
561
561
|
return false;
|
|
562
562
|
if (!n.hasAttribute("data-nice-focusable")) {
|
|
563
563
|
const e = n.getAttribute("tabindex");
|
|
564
564
|
if (e !== null && Number(e) < 0 || n instanceof HTMLAnchorElement && !n.hasAttribute("href") && e === null)
|
|
565
565
|
return false;
|
|
566
566
|
}
|
|
567
|
-
return n.closest('[inert],[aria-hidden="true"]') ||
|
|
567
|
+
return n.closest('[inert],[aria-hidden="true"]') || Zt(n) ? false : Qt(n) && en(n);
|
|
568
568
|
}
|
|
569
569
|
function U(n, e = []) {
|
|
570
570
|
const t = [];
|
|
571
|
-
for (const a2 of n.querySelectorAll(
|
|
572
|
-
e.some((r) => r && r.contains(a2)) ||
|
|
571
|
+
for (const a2 of n.querySelectorAll(xt))
|
|
572
|
+
e.some((r) => r && r.contains(a2)) || te(a2) && t.push(a2);
|
|
573
573
|
return t;
|
|
574
574
|
}
|
|
575
|
-
const
|
|
576
|
-
function
|
|
575
|
+
const _e = typeof window > "u" ? useEffect : useLayoutEffect;
|
|
576
|
+
function B(n, e, t) {
|
|
577
577
|
const a2 = useRef({ el: null, deps: [] }), r = useRef(e);
|
|
578
|
-
r.current = e,
|
|
578
|
+
r.current = e, _e(() => {
|
|
579
579
|
const s = (n == null ? void 0 : n.current) ?? null, o = a2.current;
|
|
580
580
|
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);
|
|
581
|
-
}),
|
|
581
|
+
}), _e(
|
|
582
582
|
() => () => {
|
|
583
583
|
const s = a2.current;
|
|
584
584
|
typeof s.cleanup == "function" && s.cleanup(), a2.current = { el: null, deps: [] };
|
|
@@ -586,21 +586,21 @@ function _(n, e, t) {
|
|
|
586
586
|
[]
|
|
587
587
|
);
|
|
588
588
|
}
|
|
589
|
-
const
|
|
589
|
+
const je = {
|
|
590
590
|
"045e": "xbox",
|
|
591
591
|
"054c": "playstation",
|
|
592
592
|
"057e": "nintendo",
|
|
593
593
|
"28de": "steam"
|
|
594
594
|
};
|
|
595
|
-
function
|
|
595
|
+
function sn(n) {
|
|
596
596
|
var a2, r, s;
|
|
597
597
|
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"));
|
|
598
|
-
return t &&
|
|
598
|
+
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";
|
|
599
599
|
}
|
|
600
|
-
function
|
|
600
|
+
function on(n, e) {
|
|
601
601
|
return e !== "auto" ? e : n === "nintendo" ? "east" : "south";
|
|
602
602
|
}
|
|
603
|
-
const
|
|
603
|
+
const Ct = ["up", "down", "left", "right"], we = {
|
|
604
604
|
navigate: ["ArrowUp", "ArrowDown", "ArrowLeft", "ArrowRight"],
|
|
605
605
|
activate: ["Enter", "Space"],
|
|
606
606
|
back: ["Escape"],
|
|
@@ -616,7 +616,7 @@ const Ht = ["up", "down", "left", "right"], Ee = {
|
|
|
616
616
|
last: ["End"],
|
|
617
617
|
scroll: [],
|
|
618
618
|
toggleHints: ["Shift+?"]
|
|
619
|
-
},
|
|
619
|
+
}, qe = {
|
|
620
620
|
navigate: ["dpadUp", "dpadDown", "dpadLeft", "dpadRight"],
|
|
621
621
|
activate: ["south"],
|
|
622
622
|
back: ["east"],
|
|
@@ -632,7 +632,7 @@ const Ht = ["up", "down", "left", "right"], Ee = {
|
|
|
632
632
|
last: [],
|
|
633
633
|
scroll: [],
|
|
634
634
|
toggleHints: ["leftStick"]
|
|
635
|
-
},
|
|
635
|
+
}, mn = {
|
|
636
636
|
" ": "Space",
|
|
637
637
|
Spacebar: "Space",
|
|
638
638
|
Esc: "Escape",
|
|
@@ -642,63 +642,63 @@ const Ht = ["up", "down", "left", "right"], Ee = {
|
|
|
642
642
|
Left: "ArrowLeft",
|
|
643
643
|
Right: "ArrowRight"
|
|
644
644
|
};
|
|
645
|
-
function
|
|
646
|
-
return
|
|
645
|
+
function Re(n) {
|
|
646
|
+
return mn[n] ?? n;
|
|
647
647
|
}
|
|
648
|
-
function
|
|
648
|
+
function Ht(n) {
|
|
649
649
|
const e = n.endsWith("++") ? [...n.slice(0, -2).split("+"), "+"] : n.split("+"), t = e.pop() ?? "", a2 = new Set(e.map((r) => r.toLowerCase()));
|
|
650
650
|
return {
|
|
651
|
-
key:
|
|
651
|
+
key: Re(t),
|
|
652
652
|
primary: a2.has("ctrl") || a2.has("cmd") || a2.has("meta") || a2.has("mod"),
|
|
653
653
|
alt: a2.has("alt") || a2.has("option"),
|
|
654
654
|
shift: a2.has("shift")
|
|
655
655
|
};
|
|
656
656
|
}
|
|
657
|
-
const
|
|
658
|
-
function
|
|
659
|
-
const t =
|
|
660
|
-
return !(t.length === 1 ? t.toLowerCase() === n.key.toLowerCase() : t === n.key) || n.primary !== (e.ctrlKey || e.metaKey) || n.alt !== e.altKey ? false :
|
|
657
|
+
const Mn = (n) => n.length === 1 && n.toLowerCase() === n.toUpperCase();
|
|
658
|
+
function Nt(n, e) {
|
|
659
|
+
const t = Re(e.key);
|
|
660
|
+
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;
|
|
661
661
|
}
|
|
662
|
-
function
|
|
662
|
+
function $e(n) {
|
|
663
663
|
const e = {};
|
|
664
|
-
for (const t of Object.keys(
|
|
665
|
-
const a2 = n.keyboardBindings[t] ??
|
|
666
|
-
e[t] = a2.map(
|
|
664
|
+
for (const t of Object.keys(we)) {
|
|
665
|
+
const a2 = n.keyboardBindings[t] ?? we[t];
|
|
666
|
+
e[t] = a2.map(Ht);
|
|
667
667
|
}
|
|
668
668
|
return e;
|
|
669
669
|
}
|
|
670
|
-
function
|
|
670
|
+
function gn(n, e) {
|
|
671
671
|
for (const t of Object.keys(e)) {
|
|
672
672
|
const a2 = e[t];
|
|
673
673
|
for (let r = 0; r < a2.length; r++)
|
|
674
|
-
if (
|
|
675
|
-
return t === "navigate" ? { intent: t, direction:
|
|
674
|
+
if (Nt(a2[r], n))
|
|
675
|
+
return t === "navigate" ? { intent: t, direction: Ct[r] } : t === "view" ? { intent: t, direction: a2[r].shift ? "up" : "down" } : { intent: t };
|
|
676
676
|
}
|
|
677
677
|
return null;
|
|
678
678
|
}
|
|
679
|
-
const
|
|
680
|
-
function
|
|
681
|
-
return
|
|
679
|
+
const bn = /* @__PURE__ */ new Set(["GoBack", "BrowserBack", "XF86Back"]), yn = /* @__PURE__ */ new Set([461, 10009]);
|
|
680
|
+
function wn(n) {
|
|
681
|
+
return bn.has(n.key) || yn.has(n.keyCode) ? { intent: "back" } : n.key === "ChannelUp" ? { intent: "sectionNext" } : n.key === "ChannelDown" ? { intent: "sectionPrev" } : null;
|
|
682
682
|
}
|
|
683
|
-
function
|
|
684
|
-
const t =
|
|
685
|
-
for (const s of Object.keys(
|
|
683
|
+
function Ee(n, e) {
|
|
684
|
+
const t = on(e, n.confirmButton), a2 = t === "south" ? "east" : "south", r = {};
|
|
685
|
+
for (const s of Object.keys(qe)) {
|
|
686
686
|
const o = n.gamepadBindings[s];
|
|
687
|
-
o ? r[s] = [...o] : s === "activate" ? r[s] = [t] : s === "back" ? r[s] = [a2] : r[s] = [
|
|
687
|
+
o ? r[s] = [...o] : s === "activate" ? r[s] = [t] : s === "back" ? r[s] = [a2] : r[s] = [...qe[s]];
|
|
688
688
|
}
|
|
689
689
|
return r;
|
|
690
690
|
}
|
|
691
|
-
function
|
|
691
|
+
function En(n) {
|
|
692
692
|
const e = /* @__PURE__ */ new Map();
|
|
693
693
|
for (const t of Object.keys(n))
|
|
694
694
|
n[t].forEach((a2, r) => {
|
|
695
|
-
e.has(a2) || e.set(a2, t === "navigate" ? { intent: t, direction:
|
|
695
|
+
e.has(a2) || e.set(a2, t === "navigate" ? { intent: t, direction: Ct[r] } : { intent: t });
|
|
696
696
|
});
|
|
697
697
|
return e;
|
|
698
698
|
}
|
|
699
|
-
const
|
|
700
|
-
function
|
|
701
|
-
const e = n.getAttribute(
|
|
699
|
+
const re = "data-nice-focus-scope", ke = `[${re}]`;
|
|
700
|
+
function Tt(n) {
|
|
701
|
+
const e = n.getAttribute(re), t = n.getAttribute("data-nice-scope-enter");
|
|
702
702
|
return {
|
|
703
703
|
nav: e === "vertical" || e === "horizontal" || e === "grid" || e === "none" ? e : "spatial",
|
|
704
704
|
wrap: n.hasAttribute("data-nice-scope-wrap"),
|
|
@@ -706,25 +706,25 @@ function Pt(n) {
|
|
|
706
706
|
enter: t === "selected" || t === "first" ? t : "last"
|
|
707
707
|
};
|
|
708
708
|
}
|
|
709
|
-
function
|
|
709
|
+
function Ye(n, e) {
|
|
710
710
|
var a2;
|
|
711
|
-
const t = (a2 = n.parentElement) == null ? void 0 : a2.closest(
|
|
711
|
+
const t = (a2 = n.parentElement) == null ? void 0 : a2.closest(ke);
|
|
712
712
|
return t && e.contains(t) && t !== e ? t : e;
|
|
713
713
|
}
|
|
714
|
-
function
|
|
714
|
+
function xn(n) {
|
|
715
715
|
var t, a2;
|
|
716
716
|
const e = [];
|
|
717
|
-
for (let r = (t = n.parentElement) == null ? void 0 : t.closest(
|
|
717
|
+
for (let r = (t = n.parentElement) == null ? void 0 : t.closest(ke); r; r = (a2 = r.parentElement) == null ? void 0 : a2.closest(ke))
|
|
718
718
|
e.push(r);
|
|
719
719
|
return e;
|
|
720
720
|
}
|
|
721
|
-
function
|
|
721
|
+
function zn(n) {
|
|
722
722
|
var t;
|
|
723
723
|
const e = (t = n.closest("[data-nice-arrows]")) == null ? void 0 : t.getAttribute("data-nice-arrows");
|
|
724
724
|
return e === "spatial" || e === "native" ? e : null;
|
|
725
725
|
}
|
|
726
|
-
const
|
|
727
|
-
function
|
|
726
|
+
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));
|
|
727
|
+
function An(n, e, t) {
|
|
728
728
|
switch (t) {
|
|
729
729
|
case "right":
|
|
730
730
|
return e.left >= n.right - G;
|
|
@@ -736,7 +736,7 @@ function Sn(n, e, t) {
|
|
|
736
736
|
return e.bottom <= n.top + G;
|
|
737
737
|
}
|
|
738
738
|
}
|
|
739
|
-
function
|
|
739
|
+
function Sn(n, e, t) {
|
|
740
740
|
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;
|
|
741
741
|
switch (t) {
|
|
742
742
|
case "right":
|
|
@@ -749,20 +749,20 @@ function Ln(n, e, t) {
|
|
|
749
749
|
return o < r - G;
|
|
750
750
|
}
|
|
751
751
|
}
|
|
752
|
-
function
|
|
752
|
+
function Ln(n, e, t) {
|
|
753
753
|
let a2, r, s;
|
|
754
|
-
|
|
755
|
-
const o =
|
|
754
|
+
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)));
|
|
755
|
+
const o = Xe(t) ? We.horizontal : We.vertical;
|
|
756
756
|
return Math.max(0, a2) + r * o + s * 0.01;
|
|
757
757
|
}
|
|
758
|
-
function
|
|
758
|
+
function Pt(n, e, t, a2) {
|
|
759
759
|
const r = e.map(t);
|
|
760
|
-
for (const s of [
|
|
760
|
+
for (const s of [An, Sn]) {
|
|
761
761
|
let o = -1, i2 = 1 / 0;
|
|
762
762
|
for (let c2 = 0; c2 < r.length; c2++) {
|
|
763
763
|
if (!s(n, r[c2], a2))
|
|
764
764
|
continue;
|
|
765
|
-
const d =
|
|
765
|
+
const d = Ln(n, r[c2], a2);
|
|
766
766
|
d < i2 && (i2 = d, o = c2);
|
|
767
767
|
}
|
|
768
768
|
if (o >= 0)
|
|
@@ -770,11 +770,11 @@ function Dt(n, e, t, a2) {
|
|
|
770
770
|
}
|
|
771
771
|
return null;
|
|
772
772
|
}
|
|
773
|
-
const
|
|
773
|
+
const ue = (n) => n === "left" || n === "right", Cn = (n) => {
|
|
774
774
|
var e;
|
|
775
775
|
return ((e = n.ownerDocument.defaultView) == null ? void 0 : e.getComputedStyle(n).direction) === "rtl";
|
|
776
776
|
};
|
|
777
|
-
function
|
|
777
|
+
function Hn(n, e, t, a2) {
|
|
778
778
|
if (n.length === 0)
|
|
779
779
|
return null;
|
|
780
780
|
const r = (s) => !!(e.compareDocumentPosition(s) & Node.DOCUMENT_POSITION_FOLLOWING);
|
|
@@ -785,51 +785,51 @@ function Nn(n, e, t, a2) {
|
|
|
785
785
|
return n[s];
|
|
786
786
|
return a2 ? n[n.length - 1] : null;
|
|
787
787
|
}
|
|
788
|
-
const
|
|
789
|
-
function
|
|
788
|
+
const Nn = '[aria-selected="true"],[aria-checked="true"],[aria-current]:not([aria-current="false"]),:checked';
|
|
789
|
+
function Tn(n, e, t) {
|
|
790
790
|
let a2 = null;
|
|
791
791
|
for (let s = n.parentElement; s && !s.contains(e); s = s.parentElement)
|
|
792
|
-
s.hasAttribute(
|
|
792
|
+
s.hasAttribute(re) && (a2 = s);
|
|
793
793
|
if (!a2)
|
|
794
794
|
return n;
|
|
795
|
-
const r =
|
|
795
|
+
const r = Tt(a2).enter;
|
|
796
796
|
if (r === "last") {
|
|
797
797
|
const s = t.get(a2);
|
|
798
|
-
return s && s.isConnected && a2.contains(s) &&
|
|
798
|
+
return s && s.isConnected && a2.contains(s) && te(s) ? s : n;
|
|
799
799
|
}
|
|
800
|
-
return r === "selected" ? [...a2.querySelectorAll(
|
|
800
|
+
return r === "selected" ? [...a2.querySelectorAll(Nn)].find(te) ?? n : U(a2)[0] ?? n;
|
|
801
801
|
}
|
|
802
|
-
function
|
|
803
|
-
const a2 =
|
|
804
|
-
let r =
|
|
802
|
+
function Pn(n, e, t) {
|
|
803
|
+
const a2 = X(n);
|
|
804
|
+
let r = Ye(n, t.root), s = null;
|
|
805
805
|
for (; ; ) {
|
|
806
|
-
const o =
|
|
807
|
-
if (o.nav === "spatial" || o.nav === "grid" || o.nav === "vertical" && !
|
|
806
|
+
const o = Tt(r);
|
|
807
|
+
if (o.nav === "spatial" || o.nav === "grid" || o.nav === "vertical" && !ue(e) || o.nav === "horizontal" && ue(e)) {
|
|
808
808
|
const c2 = U(r, [n, s]);
|
|
809
809
|
let d;
|
|
810
810
|
if (o.nav === "vertical" || o.nav === "horizontal") {
|
|
811
811
|
let u = e === "down" || e === "right";
|
|
812
|
-
|
|
812
|
+
ue(e) && Cn(r) && (u = !u), d = Hn(c2, n, u, o.wrap);
|
|
813
813
|
} else
|
|
814
|
-
d =
|
|
814
|
+
d = Pt(a2, c2, X, e);
|
|
815
815
|
if (d)
|
|
816
|
-
return
|
|
816
|
+
return Tn(d, n, t.memory);
|
|
817
817
|
}
|
|
818
818
|
if (r === t.root || o.trap)
|
|
819
819
|
return null;
|
|
820
|
-
s = r, r =
|
|
820
|
+
s = r, r = Ye(r, t.root);
|
|
821
821
|
}
|
|
822
822
|
}
|
|
823
|
-
function
|
|
823
|
+
function Ze(n, e) {
|
|
824
824
|
const t = e.left + e.width / 2, a2 = e.top + e.height / 2;
|
|
825
825
|
let r = null, s = 1 / 0;
|
|
826
826
|
for (const o of U(n)) {
|
|
827
|
-
const i2 =
|
|
827
|
+
const i2 = X(o), c2 = Math.hypot(i2.left + i2.width / 2 - t, i2.top + i2.height / 2 - a2);
|
|
828
828
|
c2 < s && (s = c2, r = o);
|
|
829
829
|
}
|
|
830
830
|
return r;
|
|
831
831
|
}
|
|
832
|
-
const
|
|
832
|
+
const Dt = [
|
|
833
833
|
"[data-nice-region]",
|
|
834
834
|
"header",
|
|
835
835
|
"nav",
|
|
@@ -845,9 +845,9 @@ const It = [
|
|
|
845
845
|
'[role="region"][aria-label]',
|
|
846
846
|
'[role="region"][aria-labelledby]'
|
|
847
847
|
].join(",");
|
|
848
|
-
function
|
|
849
|
-
const a2 = [...t.root.querySelectorAll(
|
|
850
|
-
(u) => !a2.some((
|
|
848
|
+
function Dn(n, e, t) {
|
|
849
|
+
const a2 = [...t.root.querySelectorAll(Dt)], r = a2.filter(
|
|
850
|
+
(u) => !a2.some((h) => h !== u && h.contains(u)) && U(u).length > 0
|
|
851
851
|
);
|
|
852
852
|
if (r.length === 0)
|
|
853
853
|
return null;
|
|
@@ -855,9 +855,9 @@ function In(n, e, t) {
|
|
|
855
855
|
if (c2 === r[s])
|
|
856
856
|
return null;
|
|
857
857
|
const d = t.memory.get(c2);
|
|
858
|
-
return d && d.isConnected && c2.contains(d) &&
|
|
858
|
+
return d && d.isConnected && c2.contains(d) && te(d) ? d : U(c2)[0];
|
|
859
859
|
}
|
|
860
|
-
const
|
|
860
|
+
const de = [
|
|
861
861
|
"south",
|
|
862
862
|
"east",
|
|
863
863
|
"west",
|
|
@@ -875,7 +875,7 @@ const he = [
|
|
|
875
875
|
"dpadLeft",
|
|
876
876
|
"dpadRight",
|
|
877
877
|
"home"
|
|
878
|
-
],
|
|
878
|
+
], xe = "nice-intent", ne = "nice-engagechange", Y = {
|
|
879
879
|
confirmButton: "auto",
|
|
880
880
|
gamepadBindings: {},
|
|
881
881
|
keyboardBindings: {},
|
|
@@ -891,11 +891,11 @@ const he = [
|
|
|
891
891
|
vibration: false,
|
|
892
892
|
arrowNavigation: "auto",
|
|
893
893
|
onScreenKeyboard: "auto"
|
|
894
|
-
},
|
|
895
|
-
function
|
|
894
|
+
}, In = /* @__PURE__ */ new Set([4, 5, 6, 7, 12, 13, 14, 15]), On = 0.85;
|
|
895
|
+
function Rn(n, e) {
|
|
896
896
|
return Math.abs(n) > Math.abs(e) ? n > 0 ? "right" : "left" : e > 0 ? "down" : "up";
|
|
897
897
|
}
|
|
898
|
-
class
|
|
898
|
+
class Vn {
|
|
899
899
|
constructor(e, t) {
|
|
900
900
|
this.states = /* @__PURE__ */ new Map(), this.connected = /* @__PURE__ */ new Set(), this.warned = /* @__PURE__ */ new Set(), this.started = false, this.frameId = 0, this.onConnected = (a2) => {
|
|
901
901
|
const r = a2.gamepad;
|
|
@@ -930,39 +930,39 @@ class Fn {
|
|
|
930
930
|
}
|
|
931
931
|
/** Read every pad once; public so tests can drive a frame. */
|
|
932
932
|
poll(e) {
|
|
933
|
-
var o, i2, c2, d, u,
|
|
933
|
+
var o, i2, c2, d, u, h;
|
|
934
934
|
const t = this.opts.timing(), a2 = /* @__PURE__ */ new Set(), r = this.read();
|
|
935
935
|
for (const l of r) {
|
|
936
936
|
a2.add(l.index);
|
|
937
|
-
let
|
|
938
|
-
(!
|
|
937
|
+
let p = this.states.get(l.index);
|
|
938
|
+
(!p || p.info.id !== l.id) && (p = {
|
|
939
939
|
info: {
|
|
940
940
|
index: l.index,
|
|
941
941
|
id: l.id,
|
|
942
|
-
family:
|
|
942
|
+
family: sn(l.id),
|
|
943
943
|
mapping: l.mapping
|
|
944
944
|
},
|
|
945
945
|
pressed: [],
|
|
946
946
|
stick: null,
|
|
947
947
|
holds: /* @__PURE__ */ new Map()
|
|
948
|
-
}, this.states.set(l.index,
|
|
948
|
+
}, 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);
|
|
949
949
|
}
|
|
950
950
|
let s = false;
|
|
951
951
|
for (const l of [...this.states.keys()])
|
|
952
952
|
a2.has(l) || (this.states.delete(l), s = true);
|
|
953
|
-
s && ((d = (c2 = this.opts).onPadsChange) == null || d.call(c2, this.pads)), (
|
|
953
|
+
s && ((d = (c2 = this.opts).onPadsChange) == null || d.call(c2, this.pads)), (h = (u = this.opts).onFrame) == null || h.call(u, r, e);
|
|
954
954
|
}
|
|
955
955
|
readButtons(e, t, a2, r) {
|
|
956
|
-
for (let s = 0; s <
|
|
956
|
+
for (let s = 0; s < de.length; s++) {
|
|
957
957
|
const o = t.buttons[s], i2 = !!(o && (o.pressed || o.value > 0.5)), c2 = `b${s}`;
|
|
958
|
-
i2 !== !!e.pressed[s] ? (e.pressed[s] = i2, i2 &&
|
|
958
|
+
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({
|
|
959
959
|
pad: e.info,
|
|
960
|
-
button:
|
|
960
|
+
button: de[s],
|
|
961
961
|
pressed: i2,
|
|
962
962
|
repeat: false
|
|
963
963
|
})) : i2 && this.repeats(e, c2, a2, r) && this.opts.onButton({
|
|
964
964
|
pad: e.info,
|
|
965
|
-
button:
|
|
965
|
+
button: de[s],
|
|
966
966
|
pressed: i2,
|
|
967
967
|
repeat: true
|
|
968
968
|
});
|
|
@@ -971,13 +971,13 @@ class Fn {
|
|
|
971
971
|
readSticks(e, t, a2, r) {
|
|
972
972
|
const s = t.axes[0] ?? 0, o = t.axes[1] ?? 0, i2 = Math.hypot(s, o);
|
|
973
973
|
if (i2 >= r.stickThreshold) {
|
|
974
|
-
const
|
|
975
|
-
|
|
974
|
+
const h = Rn(s, o);
|
|
975
|
+
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 });
|
|
976
976
|
} else e.stick && i2 < r.stickThreshold * 0.7 && (e.stick = null, e.holds.delete("stick"));
|
|
977
977
|
const c2 = t.axes[2] ?? 0, d = t.axes[3] ?? 0, u = Math.hypot(c2, d);
|
|
978
978
|
if (u > r.stickDeadzone) {
|
|
979
|
-
const
|
|
980
|
-
this.opts.onScroll({ pad: e.info, x: c2 *
|
|
979
|
+
const h = (u - r.stickDeadzone) / (1 - r.stickDeadzone) / u;
|
|
980
|
+
this.opts.onScroll({ pad: e.info, x: c2 * h, y: d * h });
|
|
981
981
|
}
|
|
982
982
|
}
|
|
983
983
|
repeats(e, t, a2, r) {
|
|
@@ -986,7 +986,7 @@ class Fn {
|
|
|
986
986
|
return false;
|
|
987
987
|
const o = Math.max(
|
|
988
988
|
r.repeatIntervalMin,
|
|
989
|
-
r.repeatInterval *
|
|
989
|
+
r.repeatInterval * On ** s.count
|
|
990
990
|
);
|
|
991
991
|
return a2 - s.last < o ? false : (s.last = a2, s.count++, true);
|
|
992
992
|
}
|
|
@@ -1009,12 +1009,12 @@ class Fn {
|
|
|
1009
1009
|
this.frameId !== 0 && (this.win.cancelAnimationFrame(this.frameId), this.frameId = 0);
|
|
1010
1010
|
}
|
|
1011
1011
|
}
|
|
1012
|
-
const
|
|
1012
|
+
const Fn = {
|
|
1013
1013
|
up: "ArrowUp",
|
|
1014
1014
|
down: "ArrowDown",
|
|
1015
1015
|
left: "ArrowLeft",
|
|
1016
1016
|
right: "ArrowRight"
|
|
1017
|
-
},
|
|
1017
|
+
}, Qe = {
|
|
1018
1018
|
ArrowUp: 38,
|
|
1019
1019
|
ArrowDown: 40,
|
|
1020
1020
|
ArrowLeft: 37,
|
|
@@ -1025,20 +1025,20 @@ const _n = {
|
|
|
1025
1025
|
End: 35,
|
|
1026
1026
|
PageUp: 33,
|
|
1027
1027
|
PageDown: 34
|
|
1028
|
-
},
|
|
1029
|
-
class
|
|
1028
|
+
}, 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";
|
|
1029
|
+
class Bn {
|
|
1030
1030
|
constructor(e) {
|
|
1031
1031
|
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) => {
|
|
1032
1032
|
if (t.niceSource)
|
|
1033
1033
|
return;
|
|
1034
|
-
const a2 =
|
|
1035
|
-
if (
|
|
1034
|
+
const a2 = wn(t), r = this.tv || a2 ? "remote" : "keyboard";
|
|
1035
|
+
if (et.has(t.key) || this.setMethod(r), this.capture && !et.has(t.key)) {
|
|
1036
1036
|
t.preventDefault();
|
|
1037
1037
|
const c2 = [
|
|
1038
1038
|
t.ctrlKey || t.metaKey ? "Ctrl" : "",
|
|
1039
1039
|
t.altKey ? "Alt" : "",
|
|
1040
1040
|
t.shiftKey ? "Shift" : ""
|
|
1041
|
-
], d =
|
|
1041
|
+
], d = Re(t.key);
|
|
1042
1042
|
this.capture({
|
|
1043
1043
|
keys: [...c2, d.length === 1 ? d.toUpperCase() : d].filter(Boolean).join("+")
|
|
1044
1044
|
});
|
|
@@ -1046,11 +1046,11 @@ class Kn {
|
|
|
1046
1046
|
}
|
|
1047
1047
|
if (t.defaultPrevented || t.isComposing)
|
|
1048
1048
|
return;
|
|
1049
|
-
const s = a2 ??
|
|
1049
|
+
const s = a2 ?? gn(t, this.keyTable);
|
|
1050
1050
|
if (!s)
|
|
1051
1051
|
return;
|
|
1052
1052
|
const o = this.targetOf(t);
|
|
1053
|
-
if (
|
|
1053
|
+
if (Gt(o, s))
|
|
1054
1054
|
return;
|
|
1055
1055
|
const i2 = {
|
|
1056
1056
|
intent: s.intent,
|
|
@@ -1087,15 +1087,15 @@ class Kn {
|
|
|
1087
1087
|
repeat: true,
|
|
1088
1088
|
gamepad: t.pad
|
|
1089
1089
|
};
|
|
1090
|
-
this.dispatchIntent(i2, o) || rt(
|
|
1090
|
+
this.dispatchIntent(i2, o) || at(rt(o, r, s), r * tt, s * tt);
|
|
1091
1091
|
}, this.onPointerDown = (t) => {
|
|
1092
1092
|
this.setMethod(t.pointerType === "touch" ? "touch" : "pointer");
|
|
1093
1093
|
}, this.onFocusIn = (t) => {
|
|
1094
1094
|
const a2 = t.target;
|
|
1095
1095
|
if (a2 instanceof HTMLElement) {
|
|
1096
1096
|
for (let r = a2.parentElement; r; r = r.parentElement)
|
|
1097
|
-
(r.hasAttribute(
|
|
1098
|
-
this.lastFocus = { el: a2, rect:
|
|
1097
|
+
(r.hasAttribute(re) || r.matches(Dt) || r === this.doc.body) && this.memory.set(r, a2);
|
|
1098
|
+
this.lastFocus = { el: a2, rect: X(a2), scope: xn(a2)[0] ?? null };
|
|
1099
1099
|
}
|
|
1100
1100
|
}, this.onFocusOut = (t) => {
|
|
1101
1101
|
const a2 = t.target;
|
|
@@ -1108,15 +1108,15 @@ class Kn {
|
|
|
1108
1108
|
const a2 = this.doc.activeElement;
|
|
1109
1109
|
if (a2 && a2 !== this.doc.body)
|
|
1110
1110
|
return;
|
|
1111
|
-
const r = this.navigationRoot(), s = t.scope && t.scope.isConnected && r.contains(t.scope) ? t.scope : r, o =
|
|
1111
|
+
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);
|
|
1112
1112
|
o && this.focusElement(o);
|
|
1113
|
-
}, this.win = e, this.doc = e.document, this.tv =
|
|
1113
|
+
}, this.win = e, this.doc = e.document, this.tv = _n.test(e.navigator.userAgent), this.keyTable = $e(Y), this.state = {
|
|
1114
1114
|
method: "pointer",
|
|
1115
1115
|
family: null,
|
|
1116
1116
|
pads: [],
|
|
1117
|
-
preferences:
|
|
1118
|
-
hintsVisible:
|
|
1119
|
-
}, this.poller = new
|
|
1117
|
+
preferences: Y,
|
|
1118
|
+
hintsVisible: Y.hints === "always"
|
|
1119
|
+
}, this.poller = new Vn(e, {
|
|
1120
1120
|
timing: () => this.state.preferences,
|
|
1121
1121
|
onButton: this.onPadButton,
|
|
1122
1122
|
onStick: this.onPadStick,
|
|
@@ -1157,7 +1157,7 @@ class Kn {
|
|
|
1157
1157
|
}
|
|
1158
1158
|
setPreferences(e) {
|
|
1159
1159
|
const t = { ...this.state.preferences, ...e };
|
|
1160
|
-
this.keyTable =
|
|
1160
|
+
this.keyTable = $e(t), this.padMaps.clear(), this.update({ preferences: t });
|
|
1161
1161
|
}
|
|
1162
1162
|
/** Words of announcements and labels; the React provider passes the app's translator. */
|
|
1163
1163
|
setTranslator(e) {
|
|
@@ -1170,7 +1170,7 @@ class Kn {
|
|
|
1170
1170
|
}
|
|
1171
1171
|
/** The buttons bound to an intent on a pad of the family (for prompts). */
|
|
1172
1172
|
gamepadBinding(e, t = this.glyphFamily) {
|
|
1173
|
-
return
|
|
1173
|
+
return Ee(this.state.preferences, t)[e];
|
|
1174
1174
|
}
|
|
1175
1175
|
/** The keys bound to an intent (for prompts), as written in the preferences. */
|
|
1176
1176
|
keyboardBinding(e) {
|
|
@@ -1193,12 +1193,12 @@ class Kn {
|
|
|
1193
1193
|
}
|
|
1194
1194
|
update(e) {
|
|
1195
1195
|
const t = { ...this.state, ...e }, { hints: a2 } = t.preferences;
|
|
1196
|
-
let r = a2 === "always" ? true : a2 === "never" ? false :
|
|
1196
|
+
let r = a2 === "always" ? true : a2 === "never" ? false : nt(t.method);
|
|
1197
1197
|
this.hintsToggled && (r = !r), t.hintsVisible = r, this.state = t, this.listeners.forEach((s) => s());
|
|
1198
1198
|
}
|
|
1199
1199
|
setMethod(e, t) {
|
|
1200
1200
|
const a2 = this.doc.documentElement;
|
|
1201
|
-
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(
|
|
1201
|
+
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 }));
|
|
1202
1202
|
}
|
|
1203
1203
|
/* ── Gamepad frames (games, device testers) ──────────────────── */
|
|
1204
1204
|
/** Raw pads every polled frame while a pad is connected. */
|
|
@@ -1252,7 +1252,7 @@ class Kn {
|
|
|
1252
1252
|
/* ── Intents ─────────────────────────────────────────────────── */
|
|
1253
1253
|
/** Dispatches `nice-intent` on the target; returns whether a handler consumed it. */
|
|
1254
1254
|
dispatchIntent(e, t = this.focused()) {
|
|
1255
|
-
const a2 = new CustomEvent(
|
|
1255
|
+
const a2 = new CustomEvent(xe, {
|
|
1256
1256
|
detail: e,
|
|
1257
1257
|
bubbles: true,
|
|
1258
1258
|
cancelable: true,
|
|
@@ -1265,12 +1265,12 @@ class Kn {
|
|
|
1265
1265
|
const a2 = this.navigationRoot();
|
|
1266
1266
|
if (t === this.doc.body || !a2.contains(t))
|
|
1267
1267
|
return this.focusInitial(a2);
|
|
1268
|
-
const r =
|
|
1268
|
+
const r = Pn(t, e, { root: a2, memory: this.memory });
|
|
1269
1269
|
return r ? (this.focusElement(r), true) : false;
|
|
1270
1270
|
}
|
|
1271
1271
|
/** The `view` intent: next (`down`) or previous (`up`) region. */
|
|
1272
1272
|
focusRegion(e, t = this.focused()) {
|
|
1273
|
-
const a2 =
|
|
1273
|
+
const a2 = Dn(t, e, {
|
|
1274
1274
|
root: this.navigationRoot(),
|
|
1275
1275
|
memory: this.memory
|
|
1276
1276
|
});
|
|
@@ -1282,13 +1282,13 @@ class Kn {
|
|
|
1282
1282
|
e.focus({ preventScroll: true, focusVisible: true }), (t = e.scrollIntoView) == null || t.call(e, { block: "nearest", inline: "nearest" });
|
|
1283
1283
|
}
|
|
1284
1284
|
/** Engages a control (ADR-005 § 6); popup controls open instead. */
|
|
1285
|
-
engage(e, t, a2 =
|
|
1285
|
+
engage(e, t, a2 = ve(e)) {
|
|
1286
1286
|
if (a2) {
|
|
1287
1287
|
if (a2 === "popup") {
|
|
1288
1288
|
this.emulateKey(e, "ArrowDown", t);
|
|
1289
1289
|
return;
|
|
1290
1290
|
}
|
|
1291
|
-
e.setAttribute("data-nice-engaged", ""),
|
|
1291
|
+
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"));
|
|
1292
1292
|
}
|
|
1293
1293
|
}
|
|
1294
1294
|
/**
|
|
@@ -1300,7 +1300,7 @@ class Kn {
|
|
|
1300
1300
|
return;
|
|
1301
1301
|
e.removeAttribute("data-nice-engaged");
|
|
1302
1302
|
const r = this.engagedValues.get(e);
|
|
1303
|
-
this.engagedValues.delete(e), a2 && r !== void 0 &&
|
|
1303
|
+
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"));
|
|
1304
1304
|
}
|
|
1305
1305
|
/** Defaults of trusted keys: the browser already clicks, types and scrolls. */
|
|
1306
1306
|
keyDefault(e, t) {
|
|
@@ -1321,27 +1321,27 @@ class Kn {
|
|
|
1321
1321
|
if (t !== "keyboard")
|
|
1322
1322
|
return "spatial";
|
|
1323
1323
|
const a2 = this.state.preferences.arrowNavigation;
|
|
1324
|
-
return a2 !== "auto" ? a2 :
|
|
1324
|
+
return a2 !== "auto" ? a2 : zn(e) ?? "native";
|
|
1325
1325
|
}
|
|
1326
1326
|
/* ── Gamepad ─────────────────────────────────────────────────── */
|
|
1327
1327
|
padMap(e) {
|
|
1328
1328
|
let t = this.padMaps.get(e);
|
|
1329
|
-
return t || (t =
|
|
1329
|
+
return t || (t = En(Ee(this.state.preferences, e)), this.padMaps.set(e, t)), t;
|
|
1330
1330
|
}
|
|
1331
1331
|
/** A pad intent: the intent event, then engage rules, key emulation and the default action. */
|
|
1332
1332
|
deviceIntent(e) {
|
|
1333
1333
|
const t = this.focused();
|
|
1334
1334
|
if (this.dispatchIntent(e, t))
|
|
1335
1335
|
return;
|
|
1336
|
-
const a2 = t === this.doc.body ? null :
|
|
1336
|
+
const a2 = t === this.doc.body ? null : ve(t), r = a2 !== null && Et(t, a2), s = t, o = e.source;
|
|
1337
1337
|
switch (e.intent) {
|
|
1338
1338
|
case "navigate": {
|
|
1339
1339
|
const i2 = e.direction ?? "down";
|
|
1340
|
-
a2 && !r ? this.moveFocus(i2, t) : r &&
|
|
1340
|
+
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);
|
|
1341
1341
|
return;
|
|
1342
1342
|
}
|
|
1343
1343
|
case "activate":
|
|
1344
|
-
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 || (
|
|
1344
|
+
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));
|
|
1345
1345
|
return;
|
|
1346
1346
|
case "back":
|
|
1347
1347
|
r && a2 === "popup" ? this.emulateKey(t, "Escape", o) : r ? this.release(s, o, true) : this.emulateKey(t, "Escape", o) || this.closeTopOverlay(o);
|
|
@@ -1350,17 +1350,17 @@ class Kn {
|
|
|
1350
1350
|
case "sectionNext":
|
|
1351
1351
|
if (r && a2 === "value") {
|
|
1352
1352
|
const i2 = e.intent === "sectionNext";
|
|
1353
|
-
|
|
1353
|
+
ie(t) ? ce(t, i2 ? "up" : "down", "big") : this.emulateKey(t, i2 ? "PageUp" : "PageDown", o);
|
|
1354
1354
|
}
|
|
1355
1355
|
return;
|
|
1356
1356
|
case "pagePrev":
|
|
1357
1357
|
case "pageNext": {
|
|
1358
1358
|
const i2 = e.intent === "pageNext";
|
|
1359
1359
|
if (r && a2 === "value")
|
|
1360
|
-
|
|
1360
|
+
ie(t) ? ce(t, i2 ? "up" : "down", "edge") : this.emulateKey(t, i2 ? "End" : "Home", o);
|
|
1361
1361
|
else if (!this.emulateKey(t, i2 ? "PageDown" : "PageUp", o)) {
|
|
1362
|
-
const c2 =
|
|
1363
|
-
|
|
1362
|
+
const c2 = rt(t, 0, i2 ? 1 : -1);
|
|
1363
|
+
at(c2, 0, (i2 ? 1 : -1) * ((c2 == null ? void 0 : c2.clientHeight) ?? 0) * 0.9);
|
|
1364
1364
|
}
|
|
1365
1365
|
return;
|
|
1366
1366
|
}
|
|
@@ -1394,7 +1394,7 @@ class Kn {
|
|
|
1394
1394
|
cancelable: true,
|
|
1395
1395
|
composed: true
|
|
1396
1396
|
});
|
|
1397
|
-
return Object.defineProperty(i2, "niceSource", { value: a2 }), Object.defineProperty(i2, "keyCode", { value:
|
|
1397
|
+
return Object.defineProperty(i2, "niceSource", { value: a2 }), Object.defineProperty(i2, "keyCode", { value: Qe[t] ?? 0 }), Object.defineProperty(i2, "which", { value: Qe[t] ?? 0 }), i2;
|
|
1398
1398
|
}, s = r("keydown");
|
|
1399
1399
|
return e.dispatchEvent(s), e.dispatchEvent(r("keyup")), s.defaultPrevented;
|
|
1400
1400
|
}
|
|
@@ -1433,11 +1433,11 @@ class Kn {
|
|
|
1433
1433
|
}
|
|
1434
1434
|
/** Nothing focused yet: the remembered element, else the first one of the main region. */
|
|
1435
1435
|
focusInitial(e) {
|
|
1436
|
-
const t = this.memory.get(e), a2 = e.querySelector('main,[role="main"]'), r = (t && t.isConnected && e.contains(t) &&
|
|
1436
|
+
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];
|
|
1437
1437
|
return r ? (this.focusElement(r), true) : false;
|
|
1438
1438
|
}
|
|
1439
1439
|
fireEngage(e, t) {
|
|
1440
|
-
e.dispatchEvent(new CustomEvent(
|
|
1440
|
+
e.dispatchEvent(new CustomEvent(ne, { detail: t, bubbles: true }));
|
|
1441
1441
|
}
|
|
1442
1442
|
/** Polite announcement through the engine's own live region. */
|
|
1443
1443
|
announce(e) {
|
|
@@ -1448,10 +1448,10 @@ class Kn {
|
|
|
1448
1448
|
this.live.textContent = e;
|
|
1449
1449
|
}
|
|
1450
1450
|
}
|
|
1451
|
-
function
|
|
1451
|
+
function at(n, e, t) {
|
|
1452
1452
|
n && (typeof n.scrollBy == "function" ? n.scrollBy({ left: e, top: t }) : (n.scrollLeft += e, n.scrollTop += t));
|
|
1453
1453
|
}
|
|
1454
|
-
function
|
|
1454
|
+
function rt(n, e, t) {
|
|
1455
1455
|
const a2 = n.ownerDocument, r = a2.defaultView;
|
|
1456
1456
|
for (let s = n; s && s !== a2.body; s = s.parentElement) {
|
|
1457
1457
|
if (!(s instanceof HTMLElement) || !r)
|
|
@@ -1462,106 +1462,106 @@ function st(n, e, t) {
|
|
|
1462
1462
|
}
|
|
1463
1463
|
return a2.scrollingElement ?? a2.documentElement;
|
|
1464
1464
|
}
|
|
1465
|
-
const
|
|
1466
|
-
function
|
|
1467
|
-
let t =
|
|
1468
|
-
return t || (t = new
|
|
1465
|
+
const st = /* @__PURE__ */ new WeakMap();
|
|
1466
|
+
function Kn(n = window, e = true) {
|
|
1467
|
+
let t = st.get(n);
|
|
1468
|
+
return t || (t = new Bn(n), st.set(n, t)), e && t.start(), t;
|
|
1469
1469
|
}
|
|
1470
|
-
function
|
|
1470
|
+
function K() {
|
|
1471
1471
|
const [n] = useState(
|
|
1472
|
-
() => typeof window > "u" ? null :
|
|
1472
|
+
() => typeof window > "u" ? null : Kn(window, false)
|
|
1473
1473
|
);
|
|
1474
1474
|
return useEffect(() => {
|
|
1475
1475
|
n == null || n.start();
|
|
1476
1476
|
}, [n]), n;
|
|
1477
1477
|
}
|
|
1478
|
-
const
|
|
1479
|
-
function
|
|
1480
|
-
const { rowSelector: t =
|
|
1478
|
+
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"])';
|
|
1479
|
+
function Wa(n, e = {}) {
|
|
1480
|
+
const { rowSelector: t = ua, cellSelector: a2 = da, pageSize: r = 10, enabled: s = true } = e, o = useRef(e);
|
|
1481
1481
|
o.current = e;
|
|
1482
|
-
const i2 =
|
|
1483
|
-
|
|
1482
|
+
const i2 = K();
|
|
1483
|
+
B(
|
|
1484
1484
|
n,
|
|
1485
1485
|
(c2) => {
|
|
1486
1486
|
if (!s)
|
|
1487
1487
|
return;
|
|
1488
|
-
const d = c2.ownerDocument, u = (
|
|
1489
|
-
var
|
|
1490
|
-
return !!
|
|
1491
|
-
},
|
|
1492
|
-
const
|
|
1493
|
-
return
|
|
1494
|
-
},
|
|
1495
|
-
const
|
|
1496
|
-
return
|
|
1497
|
-
},
|
|
1498
|
-
const
|
|
1499
|
-
if (
|
|
1488
|
+
const d = c2.ownerDocument, u = (y) => {
|
|
1489
|
+
var L;
|
|
1490
|
+
return !!y && y.matches(t) && ((L = y.parentElement) == null ? void 0 : L.closest('[role="grid"],[role="treegrid"]')) === c2;
|
|
1491
|
+
}, h = () => [...c2.querySelectorAll(t)].filter(u), l = (y) => [...y.children].filter((L) => L.matches(a2)), p = (y) => {
|
|
1492
|
+
const L = y.querySelectorAll(ha);
|
|
1493
|
+
return L.length === 1 ? L[0] : y;
|
|
1494
|
+
}, w = () => h().flatMap((y) => l(y).map(p)), k = (y) => {
|
|
1495
|
+
const L = (y == null ? void 0 : y.closest(a2)) ?? null;
|
|
1496
|
+
return L && u(L.parentElement) ? L : null;
|
|
1497
|
+
}, x = () => {
|
|
1498
|
+
const y = w();
|
|
1499
|
+
if (y.length === 0)
|
|
1500
1500
|
return;
|
|
1501
|
-
const
|
|
1502
|
-
for (const
|
|
1503
|
-
const
|
|
1504
|
-
|
|
1501
|
+
const L = d.activeElement, T = y.find((E) => E === L || E.contains(L)) ?? y.find((E) => E.getAttribute("tabindex") === "0") ?? y[0];
|
|
1502
|
+
for (const E of y) {
|
|
1503
|
+
const g = E === T ? "0" : "-1";
|
|
1504
|
+
E.getAttribute("tabindex") !== g && E.setAttribute("tabindex", g);
|
|
1505
1505
|
}
|
|
1506
|
-
},
|
|
1507
|
-
var
|
|
1508
|
-
const
|
|
1509
|
-
for (const
|
|
1510
|
-
|
|
1511
|
-
i2 ? i2.focusElement(
|
|
1512
|
-
},
|
|
1513
|
-
var
|
|
1514
|
-
if (
|
|
1506
|
+
}, C = (y, L, T) => {
|
|
1507
|
+
var g, v2;
|
|
1508
|
+
const E = p(y);
|
|
1509
|
+
for (const M of w())
|
|
1510
|
+
M.setAttribute("tabindex", M === E ? "0" : "-1");
|
|
1511
|
+
i2 ? i2.focusElement(E) : E.focus(), (v2 = (g = o.current).onMove) == null || v2.call(g, y, L, T);
|
|
1512
|
+
}, S = (y) => {
|
|
1513
|
+
var P;
|
|
1514
|
+
if (y.defaultPrevented || y.altKey || y.metaKey)
|
|
1515
1515
|
return;
|
|
1516
|
-
const
|
|
1517
|
-
if (!
|
|
1516
|
+
const L = y.target, T = k(L);
|
|
1517
|
+
if (!T || p(T) !== L || L !== T && L.matches(fa))
|
|
1518
1518
|
return;
|
|
1519
|
-
const
|
|
1520
|
-
const
|
|
1521
|
-
if (
|
|
1519
|
+
const E = h(), g = E.indexOf(T.parentElement), v2 = l(E[g]).indexOf(T), M = (H, D) => {
|
|
1520
|
+
const _ = E[H] ? l(E[H]) : [];
|
|
1521
|
+
if (_.length === 0)
|
|
1522
1522
|
return null;
|
|
1523
|
-
const
|
|
1524
|
-
return [
|
|
1523
|
+
const F = Math.min(D, _.length - 1);
|
|
1524
|
+
return [_[F], H, F];
|
|
1525
1525
|
};
|
|
1526
|
-
let
|
|
1527
|
-
const
|
|
1528
|
-
if (
|
|
1529
|
-
|
|
1526
|
+
let f = null;
|
|
1527
|
+
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;
|
|
1528
|
+
if (y.ctrlKey && (b === "Home" || b === "End"))
|
|
1529
|
+
f = b === "Home" ? M(0, 0) : M(E.length - 1, Number.MAX_SAFE_INTEGER);
|
|
1530
1530
|
else {
|
|
1531
|
-
if (
|
|
1531
|
+
if (y.ctrlKey)
|
|
1532
1532
|
return;
|
|
1533
|
-
if (
|
|
1534
|
-
|
|
1535
|
-
else if (
|
|
1536
|
-
|
|
1537
|
-
else if (
|
|
1538
|
-
|
|
1539
|
-
else if (
|
|
1540
|
-
|
|
1541
|
-
else if (
|
|
1542
|
-
|
|
1543
|
-
else if (
|
|
1544
|
-
|
|
1545
|
-
else if (
|
|
1546
|
-
const
|
|
1547
|
-
|
|
1548
|
-
} else if ((
|
|
1549
|
-
|
|
1533
|
+
if (b === "ArrowRight")
|
|
1534
|
+
f = v2 + 1 < l(E[g]).length ? M(g, v2 + 1) : null;
|
|
1535
|
+
else if (b === "ArrowLeft")
|
|
1536
|
+
f = v2 > 0 ? M(g, v2 - 1) : null;
|
|
1537
|
+
else if (b === "ArrowDown")
|
|
1538
|
+
f = g + 1 < E.length ? M(g + 1, v2) : null;
|
|
1539
|
+
else if (b === "ArrowUp")
|
|
1540
|
+
f = g > 0 ? M(g - 1, v2) : null;
|
|
1541
|
+
else if (b === "Home")
|
|
1542
|
+
f = M(g, 0);
|
|
1543
|
+
else if (b === "End")
|
|
1544
|
+
f = M(g, Number.MAX_SAFE_INTEGER);
|
|
1545
|
+
else if (b === "PageDown" || b === "PageUp") {
|
|
1546
|
+
const H = b === "PageDown" ? Math.min(E.length - 1, g + r) : Math.max(0, g - r);
|
|
1547
|
+
f = H !== g ? M(H, v2) : null;
|
|
1548
|
+
} else if ((b === "Enter" || b === " ") && L === T && !T.matches("button,a[href]")) {
|
|
1549
|
+
y.preventDefault(), T.click();
|
|
1550
1550
|
return;
|
|
1551
1551
|
} else
|
|
1552
1552
|
return;
|
|
1553
1553
|
}
|
|
1554
|
-
|
|
1555
|
-
},
|
|
1556
|
-
|
|
1557
|
-
const
|
|
1558
|
-
return
|
|
1554
|
+
f && f[0] !== T && (y.preventDefault(), C(...f));
|
|
1555
|
+
}, m = () => x();
|
|
1556
|
+
x(), c2.addEventListener("keydown", S), c2.addEventListener("focusin", m);
|
|
1557
|
+
const A = typeof MutationObserver > "u" ? null : new MutationObserver(() => x());
|
|
1558
|
+
return A == null || A.observe(c2, {
|
|
1559
1559
|
childList: true,
|
|
1560
1560
|
subtree: true,
|
|
1561
1561
|
attributes: true,
|
|
1562
1562
|
attributeFilter: ["disabled"]
|
|
1563
1563
|
}), () => {
|
|
1564
|
-
c2.removeEventListener("keydown",
|
|
1564
|
+
c2.removeEventListener("keydown", S), c2.removeEventListener("focusin", m), A == null || A.disconnect();
|
|
1565
1565
|
};
|
|
1566
1566
|
},
|
|
1567
1567
|
[s, t, a2, r, i2]
|
|
@@ -1811,7 +1811,7 @@ const NiceCapacityPlanner = ({
|
|
|
1811
1811
|
unit
|
|
1812
1812
|
)) }) }),
|
|
1813
1813
|
/* @__PURE__ */ jsx("div", { className: "nice-resource-allocation__toolbar-right", children: config.showConflicts && conflicts.length > 0 && /* @__PURE__ */ jsxs("div", { className: "nice-resource-allocation__conflicts-badge", children: [
|
|
1814
|
-
/* @__PURE__ */ jsx("span", { className: "nice-resource-allocation__badge-icon", children: /* @__PURE__ */ jsx(
|
|
1814
|
+
/* @__PURE__ */ jsx("span", { className: "nice-resource-allocation__badge-icon", children: /* @__PURE__ */ jsx(ee, { name: "warning", size: 14 }) }),
|
|
1815
1815
|
(conflicts.length === 1 ? t("capacityPlanner.oneConflict", "1 Conflict") : t("capacityPlanner.conflicts", "{count} Conflicts")).replace("{count}", String(conflicts.length))
|
|
1816
1816
|
] }) })
|
|
1817
1817
|
] }),
|
|
@@ -1861,7 +1861,7 @@ const NiceCapacityPlanner = ({
|
|
|
1861
1861
|
{
|
|
1862
1862
|
role: onResourceClick ? "button" : void 0,
|
|
1863
1863
|
tabIndex: onResourceClick ? 0 : void 0,
|
|
1864
|
-
onKeyDown: onResourceClick ?
|
|
1864
|
+
onKeyDown: onResourceClick ? wt : void 0,
|
|
1865
1865
|
className: "nice-resource-allocation__resource-cell",
|
|
1866
1866
|
onClick: () => onResourceClick == null ? void 0 : onResourceClick(resource),
|
|
1867
1867
|
children: [
|
|
@@ -1874,7 +1874,7 @@ const NiceCapacityPlanner = ({
|
|
|
1874
1874
|
toggleResource(resource.id);
|
|
1875
1875
|
},
|
|
1876
1876
|
children: /* @__PURE__ */ jsx(
|
|
1877
|
-
|
|
1877
|
+
ee,
|
|
1878
1878
|
{
|
|
1879
1879
|
name: expandedResources.has(resource.id) ? "chevron-down" : "chevron-right",
|
|
1880
1880
|
size: 14
|
|
@@ -1882,7 +1882,7 @@ const NiceCapacityPlanner = ({
|
|
|
1882
1882
|
)
|
|
1883
1883
|
}
|
|
1884
1884
|
),
|
|
1885
|
-
/* @__PURE__ */ jsx("span", { className: "nice-resource-allocation__resource-icon", children: /* @__PURE__ */ jsx(
|
|
1885
|
+
/* @__PURE__ */ jsx("span", { className: "nice-resource-allocation__resource-icon", children: /* @__PURE__ */ jsx(ee, { name: getResourceTypeIcon(resource.type), size: 16 }) }),
|
|
1886
1886
|
/* @__PURE__ */ jsxs("div", { className: "nice-resource-allocation__resource-info", children: [
|
|
1887
1887
|
/* @__PURE__ */ jsx("span", { className: "nice-resource-allocation__resource-name", children: resource.name }),
|
|
1888
1888
|
resource.department && /* @__PURE__ */ jsx("span", { className: "nice-resource-allocation__resource-dept", children: resource.department })
|
|
@@ -1905,7 +1905,7 @@ const NiceCapacityPlanner = ({
|
|
|
1905
1905
|
role: readOnly ? void 0 : "button",
|
|
1906
1906
|
tabIndex: readOnly ? void 0 : 0,
|
|
1907
1907
|
"aria-label": readOnly ? void 0 : `${resource.name} ${formatDate(period)}`,
|
|
1908
|
-
onKeyDown: readOnly ? void 0 :
|
|
1908
|
+
onKeyDown: readOnly ? void 0 : wt,
|
|
1909
1909
|
className: `nice-resource-allocation__time-cell ${isHovered ? "nice-resource-allocation__time-cell--hovered" : ""}`,
|
|
1910
1910
|
style: { backgroundColor: getCellColor(resource.id, period) },
|
|
1911
1911
|
onClick: () => handleCellClick(resource.id, period),
|
|
@@ -1957,7 +1957,7 @@ const NiceCapacityPlanner = ({
|
|
|
1957
1957
|
{
|
|
1958
1958
|
role: "button",
|
|
1959
1959
|
tabIndex: 0,
|
|
1960
|
-
onKeyDown:
|
|
1960
|
+
onKeyDown: wt,
|
|
1961
1961
|
className: `nice-resource-allocation__allocation-bar nice-resource-allocation__allocation-bar--${allocation.status} ${selectedAllocation === allocation.id ? "nice-resource-allocation__allocation-bar--selected" : ""}`,
|
|
1962
1962
|
style: {
|
|
1963
1963
|
left: `${leftPercent}%`,
|
|
@@ -1978,7 +1978,7 @@ const NiceCapacityPlanner = ({
|
|
|
1978
1978
|
e.stopPropagation();
|
|
1979
1979
|
onAllocationDelete == null ? void 0 : onAllocationDelete(allocation.id);
|
|
1980
1980
|
},
|
|
1981
|
-
children: /* @__PURE__ */ jsx(
|
|
1981
|
+
children: /* @__PURE__ */ jsx(ee, { name: "close", size: 14 })
|
|
1982
1982
|
}
|
|
1983
1983
|
)
|
|
1984
1984
|
]
|
|
@@ -2313,7 +2313,7 @@ const NiceInventoryManager = ({
|
|
|
2313
2313
|
onChange: (e) => setFilters((prev) => ({ ...prev, searchQuery: e.target.value }))
|
|
2314
2314
|
}
|
|
2315
2315
|
),
|
|
2316
|
-
/* @__PURE__ */ jsx("span", { className: "nice-inventory-manager__search-icon", children: /* @__PURE__ */ jsx(
|
|
2316
|
+
/* @__PURE__ */ jsx("span", { className: "nice-inventory-manager__search-icon", children: /* @__PURE__ */ jsx(ee, { name: "search", size: 14 }) })
|
|
2317
2317
|
] }),
|
|
2318
2318
|
/* @__PURE__ */ jsxs(
|
|
2319
2319
|
"select",
|
|
@@ -2348,7 +2348,7 @@ const NiceInventoryManager = ({
|
|
|
2348
2348
|
className: `nice-inventory-manager__view-button ${view === v2 ? "nice-inventory-manager__view-button--active" : ""}`,
|
|
2349
2349
|
onClick: () => setView(v2),
|
|
2350
2350
|
children: /* @__PURE__ */ jsx(
|
|
2351
|
-
|
|
2351
|
+
ee,
|
|
2352
2352
|
{
|
|
2353
2353
|
name: v2 === "grid" ? "grid" : v2 === "list" ? "list" : "table",
|
|
2354
2354
|
size: 14
|
|
@@ -2422,7 +2422,7 @@ const NiceInventoryManager = ({
|
|
|
2422
2422
|
{
|
|
2423
2423
|
role: onItemClick ? "button" : void 0,
|
|
2424
2424
|
tabIndex: onItemClick ? 0 : void 0,
|
|
2425
|
-
onKeyDown: onItemClick ?
|
|
2425
|
+
onKeyDown: onItemClick ? wt : void 0,
|
|
2426
2426
|
className: `nice-inventory-manager__item-card ${selectedItems.has(item.id) ? "nice-inventory-manager__item-card--selected" : ""}`,
|
|
2427
2427
|
onClick: () => onItemClick == null ? void 0 : onItemClick(item),
|
|
2428
2428
|
children: [
|
|
@@ -2436,7 +2436,7 @@ const NiceInventoryManager = ({
|
|
|
2436
2436
|
onClick: (e) => e.stopPropagation()
|
|
2437
2437
|
}
|
|
2438
2438
|
),
|
|
2439
|
-
config.showImages && /* @__PURE__ */ jsx("div", { className: "nice-inventory-manager__item-image", children: ((_a2 = item.images) == null ? void 0 : _a2[0]) ? /* @__PURE__ */ jsx("img", { src: item.images[0], alt: item.name }) : /* @__PURE__ */ jsx("span", { className: "nice-inventory-manager__placeholder-image", children: /* @__PURE__ */ jsx(
|
|
2439
|
+
config.showImages && /* @__PURE__ */ jsx("div", { className: "nice-inventory-manager__item-image", children: ((_a2 = item.images) == null ? void 0 : _a2[0]) ? /* @__PURE__ */ jsx("img", { src: item.images[0], alt: item.name }) : /* @__PURE__ */ jsx("span", { className: "nice-inventory-manager__placeholder-image", children: /* @__PURE__ */ jsx(ee, { name: "box", size: 32 }) }) }),
|
|
2440
2440
|
/* @__PURE__ */ jsxs("div", { className: "nice-inventory-manager__item-info", children: [
|
|
2441
2441
|
/* @__PURE__ */ jsx("span", { className: "nice-inventory-manager__item-sku", children: item.sku }),
|
|
2442
2442
|
/* @__PURE__ */ jsx("h4", { className: "nice-inventory-manager__item-name", children: item.name }),
|
|
@@ -2457,7 +2457,7 @@ const NiceInventoryManager = ({
|
|
|
2457
2457
|
item.unit
|
|
2458
2458
|
] }),
|
|
2459
2459
|
item.quantity <= item.reorderLevel && /* @__PURE__ */ jsxs("span", { className: "nice-inventory-manager__reorder-alert", children: [
|
|
2460
|
-
/* @__PURE__ */ jsx(
|
|
2460
|
+
/* @__PURE__ */ jsx(ee, { name: "warning", size: 12 }),
|
|
2461
2461
|
" ",
|
|
2462
2462
|
t("inventoryManager.lowStock", "Low Stock")
|
|
2463
2463
|
] })
|
|
@@ -2482,7 +2482,7 @@ const NiceInventoryManager = ({
|
|
|
2482
2482
|
t("inventoryManager.sku", "SKU"),
|
|
2483
2483
|
" ",
|
|
2484
2484
|
sortBy === "sku" && /* @__PURE__ */ jsx(
|
|
2485
|
-
|
|
2485
|
+
ee,
|
|
2486
2486
|
{
|
|
2487
2487
|
name: sortOrder === "asc" ? "arrow-up" : "arrow-down",
|
|
2488
2488
|
size: 12
|
|
@@ -2502,7 +2502,7 @@ const NiceInventoryManager = ({
|
|
|
2502
2502
|
t("inventoryManager.name", "Name"),
|
|
2503
2503
|
" ",
|
|
2504
2504
|
sortBy === "name" && /* @__PURE__ */ jsx(
|
|
2505
|
-
|
|
2505
|
+
ee,
|
|
2506
2506
|
{
|
|
2507
2507
|
name: sortOrder === "asc" ? "arrow-up" : "arrow-down",
|
|
2508
2508
|
size: 12
|
|
@@ -2523,7 +2523,7 @@ const NiceInventoryManager = ({
|
|
|
2523
2523
|
t("inventoryManager.qty", "Qty"),
|
|
2524
2524
|
" ",
|
|
2525
2525
|
sortBy === "quantity" && /* @__PURE__ */ jsx(
|
|
2526
|
-
|
|
2526
|
+
ee,
|
|
2527
2527
|
{
|
|
2528
2528
|
name: sortOrder === "asc" ? "arrow-up" : "arrow-down",
|
|
2529
2529
|
size: 12
|
|
@@ -2545,7 +2545,7 @@ const NiceInventoryManager = ({
|
|
|
2545
2545
|
t("inventoryManager.value", "Value"),
|
|
2546
2546
|
" ",
|
|
2547
2547
|
sortBy === "value" && /* @__PURE__ */ jsx(
|
|
2548
|
-
|
|
2548
|
+
ee,
|
|
2549
2549
|
{
|
|
2550
2550
|
name: sortOrder === "asc" ? "arrow-up" : "arrow-down",
|
|
2551
2551
|
size: 12
|
|
@@ -2608,7 +2608,7 @@ const NiceInventoryManager = ({
|
|
|
2608
2608
|
setEditingItem(item);
|
|
2609
2609
|
setShowItemModal(true);
|
|
2610
2610
|
},
|
|
2611
|
-
children: /* @__PURE__ */ jsx(
|
|
2611
|
+
children: /* @__PURE__ */ jsx(ee, { name: "edit", size: 14 })
|
|
2612
2612
|
}
|
|
2613
2613
|
),
|
|
2614
2614
|
/* @__PURE__ */ jsx(
|
|
@@ -2620,7 +2620,7 @@ const NiceInventoryManager = ({
|
|
|
2620
2620
|
setNewTransaction({ itemId: item.id });
|
|
2621
2621
|
setShowTransactionModal(true);
|
|
2622
2622
|
},
|
|
2623
|
-
children: /* @__PURE__ */ jsx(
|
|
2623
|
+
children: /* @__PURE__ */ jsx(ee, { name: "clipboard", size: 14 })
|
|
2624
2624
|
}
|
|
2625
2625
|
),
|
|
2626
2626
|
/* @__PURE__ */ jsx(
|
|
@@ -2631,7 +2631,7 @@ const NiceInventoryManager = ({
|
|
|
2631
2631
|
e.stopPropagation();
|
|
2632
2632
|
onItemDelete == null ? void 0 : onItemDelete(item.id);
|
|
2633
2633
|
},
|
|
2634
|
-
children: /* @__PURE__ */ jsx(
|
|
2634
|
+
children: /* @__PURE__ */ jsx(ee, { name: "trash", size: 14 })
|
|
2635
2635
|
}
|
|
2636
2636
|
)
|
|
2637
2637
|
] })
|
|
@@ -2664,7 +2664,7 @@ const NiceInventoryManager = ({
|
|
|
2664
2664
|
{
|
|
2665
2665
|
role: onItemClick ? "button" : void 0,
|
|
2666
2666
|
tabIndex: onItemClick ? 0 : void 0,
|
|
2667
|
-
onKeyDown: onItemClick ?
|
|
2667
|
+
onKeyDown: onItemClick ? wt : void 0,
|
|
2668
2668
|
className: "nice-inventory-manager__kanban-card",
|
|
2669
2669
|
onClick: () => onItemClick == null ? void 0 : onItemClick(item),
|
|
2670
2670
|
children: [
|
|
@@ -2698,7 +2698,7 @@ const NiceInventoryManager = ({
|
|
|
2698
2698
|
/* @__PURE__ */ jsx("div", { className: "nice-inventory-manager__transactions-list", children: recentTransactions.map((tx) => {
|
|
2699
2699
|
const item = items.find((i2) => i2.id === tx.itemId);
|
|
2700
2700
|
return /* @__PURE__ */ jsxs("div", { className: "nice-inventory-manager__transaction-item", children: [
|
|
2701
|
-
/* @__PURE__ */ jsx("span", { className: "nice-inventory-manager__tx-icon", children: /* @__PURE__ */ jsx(
|
|
2701
|
+
/* @__PURE__ */ jsx("span", { className: "nice-inventory-manager__tx-icon", children: /* @__PURE__ */ jsx(ee, { name: getTransactionIcon(tx.type), size: 16 }) }),
|
|
2702
2702
|
/* @__PURE__ */ jsxs("div", { className: "nice-inventory-manager__tx-info", children: [
|
|
2703
2703
|
/* @__PURE__ */ jsx("span", { className: "nice-inventory-manager__tx-type", children: tx.type }),
|
|
2704
2704
|
/* @__PURE__ */ jsx("span", { className: "nice-inventory-manager__tx-item", children: (item == null ? void 0 : item.name) || tx.itemId })
|
|
@@ -2722,7 +2722,7 @@ const NiceInventoryManager = ({
|
|
|
2722
2722
|
}) })
|
|
2723
2723
|
] }),
|
|
2724
2724
|
activeTab === "reorder" && /* @__PURE__ */ jsx("div", { className: "nice-inventory-manager__reorder-tab", children: reorderItems.length === 0 ? /* @__PURE__ */ jsxs("div", { className: "nice-inventory-manager__empty-state", children: [
|
|
2725
|
-
/* @__PURE__ */ jsx("span", { className: "nice-inventory-manager__empty-icon", children: /* @__PURE__ */ jsx(
|
|
2725
|
+
/* @__PURE__ */ jsx("span", { className: "nice-inventory-manager__empty-icon", children: /* @__PURE__ */ jsx(ee, { name: "success", size: 32 }) }),
|
|
2726
2726
|
/* @__PURE__ */ jsx("p", { children: t(
|
|
2727
2727
|
"inventoryManager.allItemsAreSufficientlyStocked",
|
|
2728
2728
|
"All items are sufficiently stocked"
|
|
@@ -3155,7 +3155,7 @@ const NiceInvoiceView = /* @__PURE__ */ forwardRef(
|
|
|
3155
3155
|
onClick: () => onAction == null ? void 0 : onAction("download"),
|
|
3156
3156
|
"aria-label": t("invoiceView.download", "Download"),
|
|
3157
3157
|
title: t("invoiceView.download", "Download"),
|
|
3158
|
-
children: /* @__PURE__ */ jsx(
|
|
3158
|
+
children: /* @__PURE__ */ jsx(ee, { name: "arrow-down", size: 12 })
|
|
3159
3159
|
}
|
|
3160
3160
|
),
|
|
3161
3161
|
/* @__PURE__ */ jsx(
|
|
@@ -3165,7 +3165,7 @@ const NiceInvoiceView = /* @__PURE__ */ forwardRef(
|
|
|
3165
3165
|
onClick: () => onAction == null ? void 0 : onAction("print"),
|
|
3166
3166
|
"aria-label": t("invoiceView.print", "Print"),
|
|
3167
3167
|
title: t("invoiceView.print", "Print"),
|
|
3168
|
-
children: /* @__PURE__ */ jsx(
|
|
3168
|
+
children: /* @__PURE__ */ jsx(ee, { name: "printer", size: 14 })
|
|
3169
3169
|
}
|
|
3170
3170
|
),
|
|
3171
3171
|
/* @__PURE__ */ jsx(
|
|
@@ -3175,7 +3175,7 @@ const NiceInvoiceView = /* @__PURE__ */ forwardRef(
|
|
|
3175
3175
|
onClick: () => onAction == null ? void 0 : onAction("send"),
|
|
3176
3176
|
"aria-label": t("invoiceView.send", "Send"),
|
|
3177
3177
|
title: t("invoiceView.send", "Send"),
|
|
3178
|
-
children: /* @__PURE__ */ jsx(
|
|
3178
|
+
children: /* @__PURE__ */ jsx(ee, { name: "mail", size: 14 })
|
|
3179
3179
|
}
|
|
3180
3180
|
)
|
|
3181
3181
|
] })
|
|
@@ -3337,7 +3337,7 @@ const NiceWarehouseView = /* @__PURE__ */ forwardRef(
|
|
|
3337
3337
|
return [...rows.entries()].map(([rowKey, arr]) => ({ rowKey, cells: arr }));
|
|
3338
3338
|
}, [cells]);
|
|
3339
3339
|
const gridRef = useRef(null);
|
|
3340
|
-
|
|
3340
|
+
Wa(gridRef);
|
|
3341
3341
|
return /* @__PURE__ */ jsxs(
|
|
3342
3342
|
"div",
|
|
3343
3343
|
{
|
|
@@ -3853,7 +3853,7 @@ const NiceVatTable = /* @__PURE__ */ forwardRef(
|
|
|
3853
3853
|
};
|
|
3854
3854
|
const removeRow = (idx) => {
|
|
3855
3855
|
const code = internal[idx].code;
|
|
3856
|
-
const next = internal.filter((
|
|
3856
|
+
const next = internal.filter((_, i2) => i2 !== idx);
|
|
3857
3857
|
update(next);
|
|
3858
3858
|
onRemove == null ? void 0 : onRemove(code);
|
|
3859
3859
|
};
|
|
@@ -3907,7 +3907,7 @@ const NiceVatTable = /* @__PURE__ */ forwardRef(
|
|
|
3907
3907
|
onChange: (e) => onCellEdit(idx, "description", e.target.value)
|
|
3908
3908
|
}
|
|
3909
3909
|
) : r.description ?? "" }),
|
|
3910
|
-
editable && /* @__PURE__ */ jsx("td", { children: /* @__PURE__ */ jsx("button", { type: "button", onClick: () => removeRow(idx), "aria-label": L.remove, children: /* @__PURE__ */ jsx(
|
|
3910
|
+
editable && /* @__PURE__ */ jsx("td", { children: /* @__PURE__ */ jsx("button", { type: "button", onClick: () => removeRow(idx), "aria-label": L.remove, children: /* @__PURE__ */ jsx(ee, { name: "close", size: 14 }) }) })
|
|
3911
3911
|
] }, r.code)) })
|
|
3912
3912
|
] }),
|
|
3913
3913
|
editable && /* @__PURE__ */ jsx("button", { type: "button", className: "nice-vat-table__add", onClick: addRow, children: L.add })
|