@tpc-mare/mare-ui-components-react 0.1.26 → 0.1.29

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.
Files changed (104) hide show
  1. package/dist/avatar/index.js +1 -1
  2. package/dist/badge/index.js +1 -1
  3. package/dist/banner/index.js +1 -1
  4. package/dist/button/index.js +1 -1
  5. package/dist/checkbox/index.js +1 -1
  6. package/dist/combobox/index.js +1 -1
  7. package/dist/confirm-dialog/index.js +1 -1
  8. package/dist/counter/index.js +1 -1
  9. package/dist/date-picker/index.js +1 -1
  10. package/dist/dialog/index.js +2 -2
  11. package/dist/divider/index.js +1 -1
  12. package/dist/drawer/index.js +1 -1
  13. package/dist/expandable-counter/index.js +1 -1
  14. package/dist/filter-chip/index.js +1 -1
  15. package/dist/filter-chip-dropdown-multiple/index.js +1 -1
  16. package/dist/filter-chip-dropdown-single/index.js +1 -1
  17. package/dist/floating-action-button/index.js +1 -1
  18. package/dist/image-item/index.js +1 -1
  19. package/dist/index/index.js +41 -41
  20. package/dist/input-number/index.js +1 -1
  21. package/dist/input-otp/index.js +1 -1
  22. package/dist/input-text/IconField.d.ts +3 -1
  23. package/dist/input-text/index.js +2 -2
  24. package/dist/keyboard-commands/index.d.ts +5 -0
  25. package/dist/keyboard-commands/index.js +825 -0
  26. package/dist/keyboard-commands/useKeyboardCommands.d.ts +27 -0
  27. package/dist/keyboard-commands/useKeyboardNavGrid.d.ts +19 -0
  28. package/dist/keyboard-commands/useKeyboardNavList.d.ts +17 -0
  29. package/dist/keyboard-commands/useKeyboardScope.d.ts +20 -0
  30. package/dist/message/index.js +1 -1
  31. package/dist/multi-select/index.js +1 -1
  32. package/dist/overlay-badge/index.js +1 -1
  33. package/dist/paginator/index.js +1 -1
  34. package/dist/password/index.js +1 -1
  35. package/dist/radio-group/index.js +1 -1
  36. package/dist/search-field/index.js +1 -1
  37. package/dist/segmented-control/index.js +1 -1
  38. package/dist/select-field/index.js +1 -1
  39. package/dist/shared/{Avatar-D3QlO3Tz.js → Avatar-BpJDY1wm.js} +24 -22
  40. package/dist/shared/{Badge-WC6my4Aw.js → Badge-CGotZzok.js} +16 -9
  41. package/dist/shared/Banner-D4na_bM8.js +60 -0
  42. package/dist/shared/{Button-DwJ5RTfQ.js → Button-C2ULmKj3.js} +64 -57
  43. package/dist/shared/{Checkbox-BXnSN2vK.js → Checkbox-DCq3_MWz.js} +35 -33
  44. package/dist/shared/{Combobox-CcmWgRYZ.js → Combobox-DrkeDMW0.js} +48 -47
  45. package/dist/shared/{ConfirmDialog-DLHY-c70.js → ConfirmDialog-CjrWhDx8.js} +33 -27
  46. package/dist/shared/{Counter-DjIoe4h3.js → Counter-0siKQRKc.js} +42 -41
  47. package/dist/shared/{DatePicker-CwAISvNc.js → DatePicker-DhIWE0V_.js} +246 -240
  48. package/dist/shared/{DialogFooter-DyltZzK-.js → DialogFooter-CDlh11Gy.js} +34 -32
  49. package/dist/shared/{DialogHeader-M5Bfyxos.js → DialogHeader-PMBgMjsb.js} +2 -2
  50. package/dist/shared/{Divider-UgKI7dtK.js → Divider-CSQOHeMo.js} +16 -14
  51. package/dist/shared/{DrawerFooter-B9-Vrgd3.js → DrawerFooter-Bb-X7keE.js} +62 -54
  52. package/dist/shared/{ExpandableCounter-DZxbdqRa.js → ExpandableCounter-pPJIrd6L.js} +2 -2
  53. package/dist/shared/{FilterChip-eECL3oO7.js → FilterChip-TpKF-4vP.js} +21 -20
  54. package/dist/shared/{FilterChipDropdownMultiple-D2eMYXyS.js → FilterChipDropdownMultiple-2mr_Z57i.js} +43 -42
  55. package/dist/shared/{FilterChipDropdownSingle-C7ahD-_3.js → FilterChipDropdownSingle-CLmWzX9q.js} +39 -38
  56. package/dist/shared/FloatingActionButton-BWB5Taeg.js +28 -0
  57. package/dist/shared/{HelperText-CVWWvLCI.js → HelperText-zmUym82m.js} +1 -1
  58. package/dist/shared/IconField-CqKydKep.js +81 -0
  59. package/dist/shared/ImageItem-CL2VGEha.js +19 -0
  60. package/dist/shared/InputNumber-nxus9h5s.js +64 -0
  61. package/dist/shared/{InputOtp-CUXXVP2E.js → InputOtp-BxBc6Vhs.js} +16 -15
  62. package/dist/shared/InputText.types-KhlkzHMw-BtRY371_.js +4 -0
  63. package/dist/shared/Message-CQUdM9rR.js +81 -0
  64. package/dist/shared/{MultiSelect-Dowp0_FX.js → MultiSelect-DlaYWcPo.js} +60 -59
  65. package/dist/shared/{OverlayBadge-DLskqll7.js → OverlayBadge-Dkosm3Il.js} +1 -1
  66. package/dist/shared/{Paginator-DxZdCXSC.js → Paginator-QTDpAJ-N.js} +2 -2
  67. package/dist/shared/Password-D4PRaleH.js +97 -0
  68. package/dist/shared/{RadioGroup-lw27DCoV.js → RadioGroup-B8CXU8-l.js} +44 -38
  69. package/dist/shared/{SearchField-DjJHDaR4.js → SearchField-DIsFhJ22.js} +1 -1
  70. package/dist/shared/{SegmentedControl-Ct5ZLXpN.js → SegmentedControl-BfE3jNM6.js} +35 -33
  71. package/dist/shared/{SelectField-B-g52vHx.js → SelectField-CcnbnPEi.js} +30 -29
  72. package/dist/shared/Skeleton-DpWtYSz4.js +30 -0
  73. package/dist/shared/{Slider-CXFkperZ.js → Slider-Cl9PyH2q.js} +28 -22
  74. package/dist/shared/Snackbar-3BxmqK8x.js +105 -0
  75. package/dist/shared/{Stepper-By8M5bs0.js → Stepper-DrKKSn_j.js} +42 -37
  76. package/dist/shared/{Switch-DNCn0xjb.js → Switch-B5DSQLFL.js} +31 -29
  77. package/dist/shared/{Tabs-BqIorZYD.js → Tabs-DuufYBV2.js} +19 -17
  78. package/dist/shared/{Tag-BtbmgIwL.js → Tag-uIK_GPrs.js} +24 -15
  79. package/dist/shared/{TagChip-Bs7srjIL.js → TagChip-CP3aX2_G.js} +28 -26
  80. package/dist/shared/Textarea-DHJIWBRM.js +42 -0
  81. package/dist/shared/{field-layout-D34MpDMB.js → field-layout-o6bDLvVU.js} +6 -6
  82. package/dist/shared/index-ByQ37VXf.js +6 -0
  83. package/dist/skeleton/index.js +1 -1
  84. package/dist/slider/index.js +1 -1
  85. package/dist/snackbar/index.js +1 -1
  86. package/dist/stepper/index.js +1 -1
  87. package/dist/styles.css +1 -1
  88. package/dist/switch/index.js +1 -1
  89. package/dist/tabs/index.js +1 -1
  90. package/dist/tag/index.js +1 -1
  91. package/dist/tag-chip/index.js +1 -1
  92. package/dist/textarea/index.js +1 -1
  93. package/dist/utilities-standalone.css +1 -1
  94. package/package.json +1 -1
  95. package/dist/shared/Banner-C4wLe6N0.js +0 -52
  96. package/dist/shared/FloatingActionButton-D4FK6uSs.js +0 -19
  97. package/dist/shared/IconField-Dh6j6SL1.js +0 -78
  98. package/dist/shared/ImageItem-BBy5fOl3.js +0 -17
  99. package/dist/shared/InputNumber-D48wsE-o.js +0 -62
  100. package/dist/shared/Message-BNsFuQU1.js +0 -70
  101. package/dist/shared/Password-BMKy8dAy.js +0 -95
  102. package/dist/shared/Skeleton-CAjoF-T2.js +0 -29
  103. package/dist/shared/Snackbar-CjTqCOaV.js +0 -100
  104. package/dist/shared/Textarea-iJhYTZos.js +0 -40
@@ -0,0 +1,825 @@
1
+ import { useId as ae, useEffect as N, useSyncExternalStore as ye, useRef as A, useState as B, useCallback as le } from "react";
2
+ function P() {
3
+ return typeof document < "u";
4
+ }
5
+ const ee = "__mareKeyboardScopeStack__";
6
+ function I() {
7
+ const e = globalThis;
8
+ return e[ee] ??= { stack: [], listeners: /* @__PURE__ */ new Set() }, e[ee];
9
+ }
10
+ function V() {
11
+ const { stack: e } = I();
12
+ return e.length === 0 ? 0 : Math.max(...e.map((t) => t.depth));
13
+ }
14
+ function ue() {
15
+ const { listeners: e } = I(), t = V();
16
+ for (const o of e) o(t);
17
+ }
18
+ function be(e, t) {
19
+ const { stack: o } = I(), r = o.findIndex((i) => i.id === e);
20
+ r !== -1 && o.splice(r, 1), o.push({ id: e, depth: t }), ue();
21
+ }
22
+ function te(e) {
23
+ const t = I(), o = t.stack.findIndex((r) => r.id === e);
24
+ o !== -1 && (t.stack.splice(o, 1), ue());
25
+ }
26
+ function we(e) {
27
+ const { listeners: t } = I();
28
+ return t.add(e), e(V()), () => t.delete(e);
29
+ }
30
+ function j() {
31
+ return V();
32
+ }
33
+ const Y = typeof navigator < "u" && /mac/i.test(navigator.userAgent), oe = {
34
+ a: "Å",
35
+ // U+00C5
36
+ b: "ı",
37
+ // U+0131 dotless i
38
+ c: "Ç",
39
+ // U+00C7
40
+ d: "Î",
41
+ // U+00CE
42
+ e: "´",
43
+ // U+00B4 non-dead acute
44
+ f: "Ï",
45
+ // U+00CF
46
+ g: "˝",
47
+ // U+02DD double acute
48
+ h: "Ó",
49
+ // U+00D3
50
+ i: "ˆ",
51
+ // U+02C6 non-dead circumflex
52
+ j: "Ô",
53
+ // U+00D4
54
+ l: "Ò",
55
+ // U+00D2
56
+ m: "Â",
57
+ // U+00C2
58
+ n: "˜",
59
+ // U+02DC non-dead tilde
60
+ o: "Ø",
61
+ // U+00D8
62
+ p: "∏",
63
+ // U+220F n-ary product
64
+ q: "Œ",
65
+ // U+0152
66
+ r: "‰",
67
+ // U+2030 per mille
68
+ s: "Í",
69
+ // U+00CD
70
+ t: "ˇ",
71
+ // U+02C7 caron
72
+ u: "¨",
73
+ // U+00A8 non-dead diaeresis
74
+ v: "◊",
75
+ // U+25CA lozenge
76
+ w: "„",
77
+ // U+201E double low quotation mark
78
+ x: "˛",
79
+ // U+02DB ogonek
80
+ y: "Á",
81
+ // U+00C1
82
+ z: "¸"
83
+ // U+00B8 cedilla
84
+ }, ke = {
85
+ a: "å",
86
+ // U+00E5
87
+ b: "∫",
88
+ // U+222B integral
89
+ c: "ç",
90
+ // U+00E7
91
+ d: "∂",
92
+ // U+2202 partial differential
93
+ e: "´",
94
+ // U+00B4 (dead: acute accent)
95
+ f: "ƒ",
96
+ // U+0192
97
+ g: "©",
98
+ // U+00A9
99
+ h: "˙",
100
+ // U+02D9 dot above
101
+ i: "ˆ",
102
+ // U+02C6 (dead: circumflex)
103
+ j: "∆",
104
+ // U+2206 increment
105
+ k: "˚",
106
+ // U+02DA ring above
107
+ l: "¬",
108
+ // U+00AC not sign
109
+ m: "µ",
110
+ // U+00B5 micro sign
111
+ n: "˜",
112
+ // U+02DC (dead: tilde)
113
+ o: "ø",
114
+ // U+00F8
115
+ p: "π",
116
+ // U+03C0
117
+ q: "œ",
118
+ // U+0153
119
+ r: "®",
120
+ // U+00AE
121
+ s: "ß",
122
+ // U+00DF
123
+ t: "†",
124
+ // U+2020 dagger
125
+ u: "¨",
126
+ // U+00A8 (dead: diaeresis)
127
+ v: "√",
128
+ // U+221A square root
129
+ w: "∑",
130
+ // U+2211 summation
131
+ x: "≈",
132
+ // U+2248 almost equal
133
+ y: "¥",
134
+ // U+00A5 yen sign
135
+ z: "Ω"
136
+ // U+03A9 omega
137
+ };
138
+ function g(e) {
139
+ const t = e.split("+"), o = t.pop() ?? e, r = new Set(t.map((s) => s.trim().toLowerCase())), i = o === " " ? "space" : o.trim().toLowerCase();
140
+ return {
141
+ ctrl: r.has("ctrl") || r.has("control"),
142
+ alt: r.has("alt"),
143
+ shift: r.has("shift"),
144
+ meta: r.has("meta") || r.has("cmd") || r.has("command"),
145
+ mod: r.has("mod") || r.has("accel") || r.has("cmdorctrl"),
146
+ key: i
147
+ };
148
+ }
149
+ function E(e, t, o) {
150
+ const r = typeof o == "boolean" ? { isMac: o } : o ?? {}, i = r.isMac ?? Y, s = r.keydownModifiers, l = t.ctrl || t.mod && !i, u = t.meta || t.mod && i, p = s ? s.ctrlKey : e.ctrlKey, v = s ? s.metaKey : e.metaKey;
151
+ if (p !== l || v !== u) return !1;
152
+ const D = s ? s.shiftKey : e.shiftKey || e.getModifierState("Shift"), w = s ? s.altKey : e.altKey || e.getModifierState("Alt") || e.getModifierState("AltGraph"), h = e.code.toLowerCase().replace(/^(key|digit)/, "");
153
+ if (i && t.alt && t.shift && e.type === "keyup") {
154
+ const M = e.key.normalize("NFC"), T = oe[t.key], O = h === t.key || e.code.toLowerCase() === `key${t.key}`;
155
+ if (T !== void 0 && M === T && O)
156
+ return !0;
157
+ }
158
+ if (t.shift !== D || t.alt !== w) return !1;
159
+ if (e.key.toLowerCase() === t.key || e.code.toLowerCase() === t.key || h === t.key)
160
+ return !0;
161
+ if (i && t.alt && w) {
162
+ const M = e.key.normalize("NFC"), T = (t.shift ? oe : ke)[t.key];
163
+ if (T !== void 0 && M === T) return !0;
164
+ }
165
+ return !1;
166
+ }
167
+ function Ze(e) {
168
+ return e.map(
169
+ (t) => (Array.isArray(t) ? t : [t]).map((o) => g(o))
170
+ );
171
+ }
172
+ function re(e) {
173
+ return e === "both" ? ["keydown", "keyup"] : [e ?? "keydown"];
174
+ }
175
+ const pe = 450;
176
+ function ne(e, t, o, r) {
177
+ if (e !== "both" || r.type !== "keydown" && r.type !== "keyup") return !1;
178
+ const i = typeof performance < "u" && typeof performance.now == "function" ? performance.now() : Date.now(), s = t.current;
179
+ if (s?.bucket === o && s.phase !== r.type && i - s.time < pe)
180
+ return !0;
181
+ const l = {
182
+ bucket: o,
183
+ phase: r.type,
184
+ time: i
185
+ };
186
+ return r.type === "keydown" && (l.modifiers = {
187
+ altKey: r.altKey,
188
+ shiftKey: r.shiftKey,
189
+ ctrlKey: r.ctrlKey,
190
+ metaKey: r.metaKey
191
+ }), t.current = l, !1;
192
+ }
193
+ function ge(e, t, o) {
194
+ if (!(e !== "both" || o.type !== "keyup" || t.current?.phase !== "keydown" || (typeof performance < "u" && typeof performance.now == "function" ? performance.now() : Date.now()) - t.current.time > pe))
195
+ return t.current.modifiers;
196
+ }
197
+ const Ae = {
198
+ enter: "↵",
199
+ escape: "Esc",
200
+ backspace: "⌫",
201
+ delete: "⌦",
202
+ tab: "⇥",
203
+ arrowup: "↑",
204
+ arrowdown: "↓",
205
+ arrowleft: "←",
206
+ arrowright: "→",
207
+ home: "↖",
208
+ end: "↘",
209
+ pageup: "⇞",
210
+ pagedown: "⇟",
211
+ space: "␣",
212
+ " ": "␣"
213
+ }, ve = {
214
+ ctrl: "⌃",
215
+ control: "⌃",
216
+ alt: "⌥",
217
+ shift: "⇧",
218
+ meta: "⌘",
219
+ cmd: "⌘",
220
+ command: "⌘",
221
+ mod: "⌘",
222
+ accel: "⌘",
223
+ cmdorctrl: "⌘"
224
+ }, Ee = {
225
+ ctrl: "Ctrl",
226
+ control: "Ctrl",
227
+ alt: "Alt",
228
+ shift: "Shift",
229
+ meta: "Meta",
230
+ cmd: "Meta",
231
+ command: "Meta",
232
+ mod: "Ctrl",
233
+ accel: "Ctrl",
234
+ cmdorctrl: "Ctrl"
235
+ };
236
+ function Ce(e) {
237
+ return (Array.isArray(e) ? e : [e]).map((t) => {
238
+ const o = t.split("+").map((i) => i.trim()), r = o.pop() ?? t;
239
+ return [
240
+ ...o.map((i) => {
241
+ const s = i.toLowerCase();
242
+ return Y ? ve[s] ?? i : Ee[s] ?? i;
243
+ }),
244
+ Ae[r.toLowerCase()] ?? r
245
+ ];
246
+ });
247
+ }
248
+ function De(e) {
249
+ return e.flatMap((t) => (Array.isArray(t.keys) ? t.keys : [t.keys]).map(
250
+ (o) => o.split("+").map((r) => {
251
+ const i = r.trim(), s = i.toLowerCase();
252
+ return s === "ctrl" || s === "control" ? "Ctrl" : s === "alt" ? "Alt" : s === "shift" ? "Shift" : s === "meta" || s === "cmd" || s === "command" ? "Meta" : s === "mod" || s === "accel" || s === "cmdorctrl" ? Y ? "Meta" : "Ctrl" : i;
253
+ }).join("+")
254
+ )).join(" ");
255
+ }
256
+ function Te(e) {
257
+ return !(!P() || !e || !(e instanceof HTMLElement) || e === document.body || e === document.documentElement);
258
+ }
259
+ function G(e) {
260
+ return e ? e === !0 ? {} : e : !1;
261
+ }
262
+ function Le(e, t) {
263
+ for (const [o, r] of t.entries()) {
264
+ if (o > 0) {
265
+ const s = document.createElement("span");
266
+ s.className = "mare-kbd-tooltip-separator", s.textContent = "/", e.append(s);
267
+ }
268
+ const i = document.createElement("span");
269
+ i.className = "mare-kbd-tooltip-keys";
270
+ for (const [s, l] of r.entries()) {
271
+ if (s > 0) {
272
+ const p = document.createElement("span");
273
+ p.className = "mare-kbd-tooltip-separator", p.textContent = "+", i.append(p);
274
+ }
275
+ const u = document.createElement("kbd");
276
+ u.className = "mare-kbd-chip", u.textContent = l, i.append(u);
277
+ }
278
+ e.append(i);
279
+ }
280
+ }
281
+ const z = "__mareKbdTooltip__", fe = [
282
+ "mare-kbd-tooltip-popup--top",
283
+ "mare-kbd-tooltip-popup--bottom",
284
+ "mare-kbd-tooltip-popup--left",
285
+ "mare-kbd-tooltip-popup--right"
286
+ ];
287
+ function Se(e, t) {
288
+ for (const o of fe) e.classList.remove(o);
289
+ if (!t || t === "auto") {
290
+ e.classList.add("mare-kbd-tooltip-popup--top"), Ke(e);
291
+ return;
292
+ }
293
+ e.classList.add(`mare-kbd-tooltip-popup--${t}`);
294
+ }
295
+ function Ke(e) {
296
+ if (!P() || typeof IntersectionObserver > "u") return;
297
+ const t = new IntersectionObserver(
298
+ (o) => {
299
+ if (t.disconnect(), o[0].intersectionRatio >= 0.98) return;
300
+ const r = [...e.classList].find(
301
+ (s) => fe.includes(
302
+ s
303
+ )
304
+ ), i = {
305
+ "mare-kbd-tooltip-popup--top": "mare-kbd-tooltip-popup--bottom",
306
+ "mare-kbd-tooltip-popup--bottom": "mare-kbd-tooltip-popup--top",
307
+ "mare-kbd-tooltip-popup--left": "mare-kbd-tooltip-popup--right",
308
+ "mare-kbd-tooltip-popup--right": "mare-kbd-tooltip-popup--left"
309
+ };
310
+ r && i[r] && (e.classList.remove(r), e.classList.add(i[r]));
311
+ },
312
+ { threshold: 0.98 }
313
+ );
314
+ t.observe(e);
315
+ }
316
+ function se(e, t) {
317
+ const o = document.createElement("div");
318
+ o.className = "mare-kbd-tooltip-popup mare-kbd-tooltip-popup--hidden", o.setAttribute("role", "tooltip"), o.setAttribute("aria-hidden", "true");
319
+ const r = Ce(e.keys), i = t.placement ?? "suffix", s = t.label === !1 ? null : typeof t.label == "string" ? t.label : e.description ?? null, l = document.createElement("span");
320
+ if (l.className = `mare-kbd-tooltip-keys ${i === "prefix" ? "mare-kbd-tooltip-keys--prefix" : ""}`, Le(l, r), s) {
321
+ const u = document.createElement("span");
322
+ u.className = "mare-kbd-tooltip-label", u.textContent = s, i === "prefix" ? (o.append(l), o.append(u)) : (o.append(u), o.append(l));
323
+ } else
324
+ o.append(l);
325
+ return o;
326
+ }
327
+ function ce(e, t) {
328
+ e.hideTimer && (clearTimeout(e.hideTimer), e.hideTimer = null);
329
+ const o = t.showDelay ?? 0;
330
+ e.showTimer = setTimeout(() => {
331
+ e.popup.classList.remove("mare-kbd-tooltip-popup--hidden"), Se(e.popup, t.position);
332
+ }, o);
333
+ }
334
+ function ie(e, t) {
335
+ e.showTimer && (clearTimeout(e.showTimer), e.showTimer = null);
336
+ const o = t.hideDelay ?? 0;
337
+ e.hideTimer = setTimeout(() => {
338
+ e.popup.classList.add("mare-kbd-tooltip-popup--hidden");
339
+ }, o);
340
+ }
341
+ function Me(e, t) {
342
+ if (!Te(e)) return;
343
+ const o = e;
344
+ de(e);
345
+ const r = t.filter(
346
+ (v) => G(v.tooltip) !== !1
347
+ );
348
+ if (r.length === 0) return;
349
+ let i = null;
350
+ getComputedStyle(e).position === "static" && (i = e.style.position, e.style.position = "relative");
351
+ const s = r[0], l = G(
352
+ s.tooltip
353
+ ), u = se(s, l);
354
+ if (r.length > 1)
355
+ for (const v of r.slice(1)) {
356
+ const D = G(
357
+ v.tooltip
358
+ ), w = se(v, D), h = document.createElement("hr");
359
+ for (h.style.cssText = "border:none;border-top:1px solid rgba(255,255,255,0.1);margin:2px 0;", u.append(h); w.firstChild; ) u.append(w.firstChild);
360
+ }
361
+ e.append(u);
362
+ const p = {
363
+ element: e,
364
+ popup: u,
365
+ showTimer: null,
366
+ hideTimer: null,
367
+ onFocusin: () => {
368
+ ce(p, l);
369
+ },
370
+ onFocusout: () => {
371
+ ie(p, l);
372
+ },
373
+ onMouseenter: () => {
374
+ ce(p, l);
375
+ },
376
+ onMouseleave: () => {
377
+ ie(p, l);
378
+ },
379
+ observer: null,
380
+ originalPosition: i
381
+ };
382
+ e.addEventListener("focusin", p.onFocusin), e.addEventListener("focusout", p.onFocusout), e.addEventListener("mouseenter", p.onMouseenter), e.addEventListener("mouseleave", p.onMouseleave), o[z] = p;
383
+ }
384
+ function de(e) {
385
+ const t = e, o = t[z];
386
+ o && (o.showTimer && clearTimeout(o.showTimer), o.hideTimer && clearTimeout(o.hideTimer), o.observer?.disconnect(), e.removeEventListener("focusin", o.onFocusin), e.removeEventListener("focusout", o.onFocusout), e.removeEventListener("mouseenter", o.onMouseenter), e.removeEventListener("mouseleave", o.onMouseleave), o.originalPosition !== null && (o.originalPosition === "" ? e.style.removeProperty("position") : e.style.position = o.originalPosition), o.popup.remove(), t[z] = void 0);
387
+ }
388
+ const me = "data-mare-kbd-hint", xe = /* @__PURE__ */ new Set([
389
+ "a",
390
+ "button",
391
+ "input",
392
+ "select",
393
+ "textarea"
394
+ ]);
395
+ function Oe(e) {
396
+ return !!(e.hasAttribute("disabled") || e.getAttribute("aria-disabled") === "true" || e.closest("fieldset")?.disabled);
397
+ }
398
+ function Re(e) {
399
+ !e.hasAttribute("tabindex") && !xe.has(e.tagName.toLowerCase()) && e.setAttribute("tabindex", "0");
400
+ }
401
+ function He(e, t, o, r, i) {
402
+ const s = t.map((p) => ({
403
+ keys: p.keys,
404
+ ...p.description ? { description: p.description } : {}
405
+ })), l = i?.length ? [...s, ...i] : s;
406
+ if (l.length === 0) return;
407
+ const u = {
408
+ depth: o,
409
+ commands: l,
410
+ ...r ? { context: r } : {}
411
+ };
412
+ e.setAttribute(me, JSON.stringify(u));
413
+ }
414
+ function _e(e, t) {
415
+ Re(e);
416
+ const o = De(t.commands);
417
+ if (o && e.setAttribute("aria-keyshortcuts", o), (t.commands.length > 0 || (t.hintCommands?.length ?? 0) > 0) && He(
418
+ e,
419
+ t.commands,
420
+ t.depth,
421
+ t.context,
422
+ t.hintCommands
423
+ ), t.ariaAttributes)
424
+ for (const [r, i] of Object.entries(
425
+ t.ariaAttributes
426
+ ))
427
+ e.setAttribute(r, i);
428
+ t.commands.length > 0 && Me(e, t.commands);
429
+ }
430
+ function Ne(e, t) {
431
+ if (e.removeAttribute("aria-keyshortcuts"), e.removeAttribute(me), de(e), t)
432
+ for (const o of Object.keys(t))
433
+ e.removeAttribute(o);
434
+ }
435
+ function W() {
436
+ return P() && window.matchMedia("(prefers-reduced-motion: reduce)").matches;
437
+ }
438
+ function Pe(e) {
439
+ return e.scrollBehavior ? e.scrollBehavior : W() ? "auto" : "smooth";
440
+ }
441
+ function Ie(e) {
442
+ return typeof e == "boolean" ? {
443
+ scrollUpKeys: ["ArrowUp", "PageUp"],
444
+ scrollDownKeys: ["ArrowDown", "PageDown"],
445
+ scrollStep: 40
446
+ } : {
447
+ scrollUpKeys: e.scrollUpKeys ?? ["ArrowUp", "PageUp"],
448
+ scrollDownKeys: e.scrollDownKeys ?? ["ArrowDown", "PageDown"],
449
+ scrollStep: e.scrollStep ?? 40,
450
+ container: e.container,
451
+ scrollBehavior: e.scrollBehavior
452
+ };
453
+ }
454
+ function _(e) {
455
+ if (!P()) return null;
456
+ let t = e.parentElement;
457
+ for (; t && t !== document.body; ) {
458
+ const { overflow: o, overflowY: r } = window.getComputedStyle(t);
459
+ if (/(auto|scroll)/.test(o) || /(auto|scroll)/.test(r))
460
+ return t;
461
+ t = t.parentElement;
462
+ }
463
+ return null;
464
+ }
465
+ function Fe(e) {
466
+ if (!P()) return !1;
467
+ const { overflow: t, overflowY: o } = window.getComputedStyle(e);
468
+ return /(auto|scroll)/.test(t) || /(auto|scroll)/.test(o);
469
+ }
470
+ function $(e, t) {
471
+ return t.container ? t.container === "parent" ? _(e) : typeof t.container == "string" ? e.querySelector(t.container) ?? _(e) : t.container ?? _(e) : Fe(e) ? e : _(e);
472
+ }
473
+ function et(e = {}) {
474
+ const t = ae(), o = e.depth ?? 1, r = e.visible ?? !0;
475
+ return N(() => (r ? be(t, o) : te(t), () => te(t)), [t, o, r]), { scopeId: t };
476
+ }
477
+ function tt(e, t = {}) {
478
+ const o = ae(), r = t.depth ?? 0, i = ye(
479
+ we,
480
+ j,
481
+ j
482
+ ), l = (t.visible ?? !0) && i === r, u = A(t);
483
+ u.current = t;
484
+ const p = A(l);
485
+ p.current = l;
486
+ const v = A(null);
487
+ v.current = t.scrollable ? Ie(t.scrollable) : null;
488
+ const D = A(null), w = A({ current: null });
489
+ function h() {
490
+ const a = e.current;
491
+ return a instanceof HTMLElement ? a : null;
492
+ }
493
+ function M() {
494
+ const a = h();
495
+ if (!a) return;
496
+ const f = u.current;
497
+ _e(a, {
498
+ commands: f.commands ?? [],
499
+ depth: r,
500
+ context: f.hintContext,
501
+ hintCommands: f.hintCommands,
502
+ ariaAttributes: f.ariaAttributes
503
+ });
504
+ }
505
+ function T(a) {
506
+ const f = a ?? h();
507
+ f && Ne(f, u.current.ariaAttributes);
508
+ }
509
+ function O(a) {
510
+ if (!(a instanceof KeyboardEvent) || !p.current) return;
511
+ const f = u.current, k = v.current, K = e.current;
512
+ if (!K) return;
513
+ const H = K instanceof HTMLElement ? K : null;
514
+ if (H && Oe(H)) return;
515
+ const J = ge(
516
+ f.triggerOn,
517
+ w.current,
518
+ a
519
+ ), q = J ? { keydownModifiers: J } : void 0;
520
+ if (k && H) {
521
+ const F = $(H, k);
522
+ if (F) {
523
+ const x = (k.scrollUpKeys ?? ["ArrowUp", "PageUp"]).map((C) => g(C)), Q = (k.scrollDownKeys ?? ["ArrowDown", "PageDown"]).map((C) => g(C)), U = x.some(
524
+ (C) => E(a, C, q)
525
+ ), X = Q.some(
526
+ (C) => E(a, C, q)
527
+ );
528
+ if (U || X) {
529
+ const C = U ? "scroll:up" : "scroll:down";
530
+ if (ne(
531
+ f.triggerOn,
532
+ w.current,
533
+ C,
534
+ a
535
+ ))
536
+ return;
537
+ a.preventDefault();
538
+ const Z = k.scrollStep ?? 40;
539
+ F.scrollBy({
540
+ top: U ? -Z : Z,
541
+ behavior: Pe(k)
542
+ });
543
+ return;
544
+ }
545
+ }
546
+ }
547
+ const he = f.commands ?? [];
548
+ for (const [F, x] of he.entries())
549
+ if ((Array.isArray(x.keys) ? x.keys : [x.keys]).map((C) => g(C)).some(
550
+ (C) => E(a, C, q)
551
+ ) && !(x.when && !x.when())) {
552
+ if (ne(
553
+ f.triggerOn,
554
+ w.current,
555
+ F,
556
+ a
557
+ ))
558
+ return;
559
+ x.preventDefault !== !1 && a.preventDefault(), x.stopPropagation && a.stopPropagation(), x.handler(a);
560
+ return;
561
+ }
562
+ }
563
+ function c() {
564
+ const a = v.current;
565
+ if (!a) return;
566
+ const f = h();
567
+ if (!f) return;
568
+ const k = $(f, a);
569
+ k && (D.current = {
570
+ top: k.scrollTop,
571
+ left: k.scrollLeft
572
+ });
573
+ }
574
+ function y() {
575
+ const a = v.current;
576
+ if (!a || !D.current) return;
577
+ const f = h();
578
+ if (!f) return;
579
+ const k = $(f, a);
580
+ k && (k.scrollTop = D.current.top, k.scrollLeft = D.current.left);
581
+ }
582
+ const n = A((a) => O(a)).current, b = A(() => c()).current, d = A(() => y()).current;
583
+ function L() {
584
+ if (!u.current.autoFocus) return;
585
+ const a = h();
586
+ a && requestAnimationFrame(() => {
587
+ !p.current || !a.isConnected || a.focus({ preventScroll: !1 });
588
+ });
589
+ }
590
+ function S(a) {
591
+ const f = u.current, k = f.capture ?? !1;
592
+ for (const H of re(f.triggerOn))
593
+ a.addEventListener(H, n, { capture: k });
594
+ const K = a instanceof HTMLElement ? a : null;
595
+ K && f.scrollable && (K.addEventListener("blur", b, !0), K.addEventListener("focus", d, !0)), p.current && (M(), L());
596
+ }
597
+ function R(a) {
598
+ const f = u.current, k = f.capture ?? !1;
599
+ for (const H of re(f.triggerOn))
600
+ a.removeEventListener(H, n, { capture: k });
601
+ const K = a instanceof HTMLElement ? a : null;
602
+ K && f.scrollable && (K.removeEventListener("blur", b, !0), K.removeEventListener("focus", d, !0)), T(K ?? void 0);
603
+ }
604
+ const m = A(null);
605
+ return N(() => {
606
+ const a = e.current;
607
+ a !== m.current && (m.current && R(m.current), a && S(a), m.current = a);
608
+ }), N(() => () => {
609
+ m.current && R(m.current), m.current = null;
610
+ }, []), N(() => {
611
+ e.current && (l ? (M(), L()) : T());
612
+ }, [l]), { commandGroupId: o, isActive: l };
613
+ }
614
+ const Ue = [g("ArrowUp")], Be = [g("ArrowDown")], je = [g("Enter"), g(" ")], qe = g("Home"), Ge = g("End");
615
+ function ot(e) {
616
+ const [t, o] = B(-1), r = A(e);
617
+ r.current = e;
618
+ const i = A(t);
619
+ i.current = t;
620
+ const s = A(null), [l, u] = B(
621
+ null
622
+ ), p = le((n) => {
623
+ s.current = n, u(n);
624
+ }, []);
625
+ function v(n) {
626
+ const b = r.current.items.length;
627
+ return b === 0 ? -1 : r.current.wrap ? (n % b + b) % b : Math.max(0, Math.min(b - 1, n));
628
+ }
629
+ function D(n, b = !1) {
630
+ const d = s.current;
631
+ if (!d || n < 0) return;
632
+ const L = d.children[n], S = L?.matches('[role="option"], [data-kbd-nav-item], li') ? L : [
633
+ ...d.querySelectorAll(
634
+ '[role="option"], [data-kbd-nav-item], li'
635
+ )
636
+ ].at(n) ?? void 0;
637
+ S === void 0 || !(_(S) ?? (d.scrollHeight > d.clientHeight ? d : null)) || S.scrollIntoView({
638
+ block: "nearest",
639
+ inline: "nearest",
640
+ behavior: b ? "instant" : W() ? "auto" : "smooth"
641
+ });
642
+ }
643
+ function w(n, b = !1) {
644
+ const d = v(n);
645
+ o(d), D(d, b);
646
+ }
647
+ function h() {
648
+ w(0);
649
+ }
650
+ function M() {
651
+ w(r.current.items.length - 1);
652
+ }
653
+ function T() {
654
+ o(-1);
655
+ }
656
+ function O(n) {
657
+ const b = r.current.depth ?? 0;
658
+ if (j() !== b) return;
659
+ const d = r.current.items, L = r.current.wrap ?? !1, S = d.length;
660
+ if (S === 0) return;
661
+ const R = i.current;
662
+ if (Ue.some((m) => E(n, m))) {
663
+ n.preventDefault(), n.stopPropagation();
664
+ const m = R <= 0 ? L ? S - 1 : 0 : R - 1;
665
+ w(m, n.repeat);
666
+ return;
667
+ }
668
+ if (Be.some((m) => E(n, m))) {
669
+ n.preventDefault(), n.stopPropagation();
670
+ const m = R < 0 ? 0 : R >= S - 1 ? L ? 0 : S - 1 : R + 1;
671
+ w(m, n.repeat);
672
+ return;
673
+ }
674
+ if (E(n, qe)) {
675
+ n.preventDefault(), w(0, n.repeat);
676
+ return;
677
+ }
678
+ if (E(n, Ge)) {
679
+ n.preventDefault(), w(S - 1, n.repeat);
680
+ return;
681
+ }
682
+ if (!n.repeat && je.some((m) => E(n, m))) {
683
+ const m = i.current;
684
+ if (m < 0) return;
685
+ const a = d[m];
686
+ if (a === void 0) return;
687
+ n.preventDefault(), r.current.onSelect?.(a, m), r.current.onActivate?.(a, m);
688
+ }
689
+ }
690
+ const c = A(
691
+ (n) => O(n)
692
+ ).current;
693
+ N(() => {
694
+ if (l)
695
+ return l.addEventListener("keydown", c), () => l.removeEventListener("keydown", c);
696
+ }, [l, c]);
697
+ const y = r.current.items[t] ?? null;
698
+ return {
699
+ focusedIndex: t,
700
+ focusedItem: y,
701
+ containerRef: p,
702
+ focus: w,
703
+ focusFirst: h,
704
+ focusLast: M,
705
+ clearFocus: T
706
+ };
707
+ }
708
+ const $e = g("ArrowUp"), ze = g("ArrowDown"), Ve = g("ArrowLeft"), Ye = g("ArrowRight"), We = g("Home"), Je = g("End"), Qe = [g("Enter"), g(" ")];
709
+ function rt(e) {
710
+ const [t, o] = B({ row: 0, col: 0 }), r = A(e);
711
+ r.current = e;
712
+ const i = A(t);
713
+ i.current = t;
714
+ const s = A(null), [l, u] = B(
715
+ null
716
+ ), p = le((c) => {
717
+ s.current = c, u(c);
718
+ }, []);
719
+ function v(c) {
720
+ const y = r.current.rows, n = y - 1;
721
+ return r.current.wrap ? (c % y + y) % y : Math.max(0, Math.min(n, c));
722
+ }
723
+ function D(c) {
724
+ const y = r.current.cols, n = y - 1;
725
+ return r.current.wrap ? (c % y + y) % y : Math.max(0, Math.min(n, c));
726
+ }
727
+ function w(c, y = !1) {
728
+ const n = s.current;
729
+ if (!n) return;
730
+ const d = n.querySelectorAll('[role="row"]')[c.row];
731
+ if (!d) return;
732
+ const L = d.querySelectorAll(
733
+ '[role="gridcell"], [data-kbd-nav-cell]'
734
+ )[c.col];
735
+ !L || !(_(L) ?? (n.scrollHeight > n.clientHeight ? n : null)) || L.scrollIntoView({
736
+ block: "nearest",
737
+ inline: "nearest",
738
+ behavior: y ? "instant" : W() ? "auto" : "smooth"
739
+ });
740
+ }
741
+ function h(c, y = !1) {
742
+ const n = { row: v(c.row), col: D(c.col) };
743
+ o(n), w(n, y);
744
+ }
745
+ function M(c, y) {
746
+ return t.row === c && t.col === y;
747
+ }
748
+ function T(c) {
749
+ const y = r.current.depth ?? 0;
750
+ if (j() !== y) return;
751
+ const { row: n, col: b } = i.current;
752
+ if (E(c, $e)) {
753
+ c.preventDefault(), c.stopPropagation(), h({ row: n - 1, col: b }, c.repeat);
754
+ return;
755
+ }
756
+ if (E(c, ze)) {
757
+ c.preventDefault(), c.stopPropagation(), h({ row: n + 1, col: b }, c.repeat);
758
+ return;
759
+ }
760
+ if (E(c, Ve)) {
761
+ c.preventDefault(), c.stopPropagation(), h({ row: n, col: b - 1 }, c.repeat);
762
+ return;
763
+ }
764
+ if (E(c, Ye)) {
765
+ c.preventDefault(), c.stopPropagation(), h({ row: n, col: b + 1 }, c.repeat);
766
+ return;
767
+ }
768
+ if (E(c, We)) {
769
+ c.preventDefault(), h({ row: n, col: 0 }, c.repeat);
770
+ return;
771
+ }
772
+ if (E(c, Je)) {
773
+ c.preventDefault(), h({ row: n, col: r.current.cols - 1 }, c.repeat);
774
+ return;
775
+ }
776
+ if (!c.repeat && Qe.some((d) => E(c, d))) {
777
+ c.preventDefault(), c.stopPropagation();
778
+ const d = { ...i.current };
779
+ r.current.onSelect?.(d), r.current.onActivate?.(d);
780
+ }
781
+ }
782
+ const O = A(
783
+ (c) => T(c)
784
+ ).current;
785
+ return N(() => {
786
+ if (l)
787
+ return l.addEventListener("keydown", O), () => l.removeEventListener("keydown", O);
788
+ }, [l, O]), { focused: t, containerRef: p, focus: h, isFocused: M };
789
+ }
790
+ export {
791
+ me as KBD_HINT_ATTR,
792
+ pe as KEYBOARD_BOTH_TRIGGER_DEDUP_MS,
793
+ Me as attachTooltips,
794
+ De as buildAriaKeyshortcuts,
795
+ Ze as buildParsedChordLists,
796
+ de as detachTooltips,
797
+ Re as ensureTabindex,
798
+ _ as findScrollableAncestor,
799
+ Ce as formatKeyDescriptor,
800
+ j as getActiveDepth,
801
+ ge as getKeydownModifiersForKeyup,
802
+ _e as injectAriaOnElement,
803
+ He as injectKbdHintAttribute,
804
+ P as isBrowser,
805
+ Oe as isElementDisabled,
806
+ Y as isMac,
807
+ Fe as isScrollable,
808
+ Te as isTooltipEligibleTarget,
809
+ E as matchesChord,
810
+ Ie as normalizeScrollAreaOptions,
811
+ we as onScopeDepthChange,
812
+ g as parseChord,
813
+ W as prefersReducedMotion,
814
+ be as registerScope,
815
+ Ne as removeAriaOnElement,
816
+ Pe as resolveScrollBehavior,
817
+ $ as resolveScrollContainer,
818
+ re as resolveTriggerEventNames,
819
+ ne as suppressDuplicateBothTrigger,
820
+ te as unregisterScope,
821
+ tt as useKeyboardCommands,
822
+ rt as useKeyboardNavGrid,
823
+ ot as useKeyboardNavList,
824
+ et as useKeyboardScope
825
+ };