@midas-ds/components 1.0.3 → 1.2.3

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 (185) hide show
  1. package/CHANGELOG.md +39 -1
  2. package/accordion/Accordion.d.ts +8 -8
  3. package/accordion/AccordionItem.d.ts +11 -3
  4. package/accordion/index.d.ts +0 -3
  5. package/global.css +1 -0
  6. package/index.cjs +138 -0
  7. package/index.css +1 -1
  8. package/index.d.ts +0 -1
  9. package/index.js +27067 -110
  10. package/package.json +21 -4
  11. package/theme.cjs +1 -0
  12. package/tokens-BskyMDHv.cjs +1 -0
  13. package/Breadcrumbs.css +0 -1
  14. package/Button-B4vMZbC6.js +0 -182
  15. package/Button.css +0 -1
  16. package/ButtonGroup.css +0 -1
  17. package/Card.css +0 -1
  18. package/Checkbox-DnKWanep.js +0 -402
  19. package/Checkbox.css +0 -1
  20. package/Collection-COLWgm24.js +0 -510
  21. package/ComboBox.css +0 -1
  22. package/DatePicker.css +0 -1
  23. package/Dialog-Cb6toyXO.js +0 -1951
  24. package/DragAndDrop-B0T3WgjL.js +0 -40
  25. package/Dropdown.css +0 -1
  26. package/FileUpload.css +0 -1
  27. package/Flex.css +0 -1
  28. package/Flex.module-CpoxBzQX.js +0 -37
  29. package/FocusScope-C8i7CH6y.js +0 -513
  30. package/Form-BQQs3jUk.js +0 -238
  31. package/Grid.css +0 -1
  32. package/Grid.module-Ia0e9Dix.js +0 -36
  33. package/Group-CdwXhx8Q.js +0 -42
  34. package/Hidden-DngIphiL.js +0 -37
  35. package/InfoBanner.css +0 -1
  36. package/Layout.css +0 -1
  37. package/Link-iAZLB3RI.js +0 -75
  38. package/Link.css +0 -1
  39. package/LinkButton.css +0 -1
  40. package/ListBox-BKWkIIm6.js +0 -474
  41. package/ListKeyboardDelegate-BH-K5hyq.js +0 -172
  42. package/Logo.css +0 -1
  43. package/Modal.css +0 -1
  44. package/MultiSelect.css +0 -1
  45. package/PressResponder-Cz-TRBHO.js +0 -31
  46. package/RSPContexts-EOiWkKOf.js +0 -11
  47. package/Radio.css +0 -1
  48. package/SearchField.css +0 -1
  49. package/Select.css +0 -1
  50. package/SelectionManager-8o40f7mx.js +0 -1047
  51. package/Separator-BlvmQjwz.js +0 -49
  52. package/Spinner.css +0 -1
  53. package/Table.css +0 -1
  54. package/Tabs.css +0 -1
  55. package/Tag--W5TgxmK.js +0 -728
  56. package/Tag.css +0 -1
  57. package/Text-CQPW6xs7.js +0 -15
  58. package/TextArea.css +0 -1
  59. package/TextField-DeK_yiK-.js +0 -225
  60. package/TextField.css +0 -1
  61. package/TextField.module-0-u4LVPp.js +0 -143
  62. package/Toast.css +0 -1
  63. package/VisuallyHidden-CFx06Bae.js +0 -39
  64. package/accordion/AccordionContent.d.ts +0 -3
  65. package/accordion/AccordionTagContext.d.ts +0 -3
  66. package/accordion/AccordionTrigger.d.ts +0 -3
  67. package/chevron-down-Cd1bkzXT.js +0 -13
  68. package/chevron-right-DBMc9VMi.js +0 -23
  69. package/clsx-OuTLNxxd.js +0 -16
  70. package/context-Bnqknrce.js +0 -80
  71. package/createLucideIcon-DeWljiyi.js +0 -79
  72. package/index-B-jHjTDC.js +0 -120
  73. package/index-BPdc9gJ8.js +0 -3122
  74. package/index-DK9ZACEc.js +0 -642
  75. package/index-KSgQWWiy.js +0 -26984
  76. package/index10.js +0 -4
  77. package/index11.js +0 -5
  78. package/index12.js +0 -4
  79. package/index13.js +0 -4
  80. package/index14.js +0 -4
  81. package/index15.js +0 -6
  82. package/index16.js +0 -6
  83. package/index17.js +0 -6
  84. package/index18.js +0 -4
  85. package/index19.js +0 -6
  86. package/index2.js +0 -8
  87. package/index20.js +0 -6
  88. package/index21.js +0 -4
  89. package/index22.js +0 -5
  90. package/index23.js +0 -5
  91. package/index24.js +0 -5
  92. package/index25.js +0 -6
  93. package/index26.js +0 -6
  94. package/index27.js +0 -6
  95. package/index28.js +0 -4
  96. package/index29.js +0 -12
  97. package/index3.js +0 -6
  98. package/index31.js +0 -22
  99. package/index32.js +0 -14
  100. package/index33.js +0 -11
  101. package/index34.js +0 -31
  102. package/index35.js +0 -8
  103. package/index36.js +0 -9
  104. package/index37.js +0 -19
  105. package/index38.js +0 -9
  106. package/index39.js +0 -9
  107. package/index4.js +0 -4
  108. package/index40.js +0 -16
  109. package/index41.js +0 -16
  110. package/index42.js +0 -31
  111. package/index43.js +0 -16
  112. package/index44.js +0 -6
  113. package/index45.js +0 -53
  114. package/index46.js +0 -18
  115. package/index47.js +0 -27
  116. package/index48.js +0 -18
  117. package/index49.js +0 -21
  118. package/index5.js +0 -5
  119. package/index50.js +0 -49
  120. package/index51.js +0 -5
  121. package/index52.js +0 -25
  122. package/index53.js +0 -18
  123. package/index54.js +0 -9
  124. package/index55.js +0 -25
  125. package/index56.js +0 -18
  126. package/index57.js +0 -11
  127. package/index58.js +0 -12
  128. package/index59.js +0 -15
  129. package/index6.js +0 -4
  130. package/index60.js +0 -9
  131. package/index61.js +0 -9
  132. package/index62.js +0 -19
  133. package/index63.js +0 -22
  134. package/index64.js +0 -61
  135. package/index65.js +0 -15
  136. package/index66.js +0 -11
  137. package/index67.js +0 -63
  138. package/index68.js +0 -85
  139. package/index69.js +0 -74
  140. package/index7.js +0 -9
  141. package/index70.js +0 -24
  142. package/index71.js +0 -69
  143. package/index72.js +0 -80
  144. package/index73.js +0 -140
  145. package/index74.js +0 -70
  146. package/index75.js +0 -42
  147. package/index76.js +0 -82
  148. package/index77.js +0 -71
  149. package/index78.js +0 -104
  150. package/index79.js +0 -274
  151. package/index8.js +0 -4
  152. package/index80.js +0 -723
  153. package/index81.js +0 -489
  154. package/index82.js +0 -314
  155. package/index83.js +0 -389
  156. package/index84.js +0 -252
  157. package/index85.js +0 -1363
  158. package/index86.js +0 -1009
  159. package/index87.js +0 -386
  160. package/index88.js +0 -2101
  161. package/index89.js +0 -2369
  162. package/index9.js +0 -5
  163. package/index90.js +0 -6836
  164. package/index91.js +0 -17
  165. package/index92.js +0 -14
  166. package/index93.js +0 -6
  167. package/index94.js +0 -9
  168. package/intlStrings-Cd44R5hT.js +0 -278
  169. package/react.esm-sMU8Z7rL.js +0 -11060
  170. package/triangle-alert-1OYl9KWz.js +0 -56
  171. package/useControlledState-DrAoodI6.js +0 -45
  172. package/useDescription-BPs7eRff.js +0 -32
  173. package/useField-Dz62UHCP.js +0 -67
  174. package/useFilter-ViwzkzZe.js +0 -35
  175. package/useFocusRing-BKGhL91C.js +0 -1297
  176. package/useFocusable-CRSmYEQc.js +0 -59
  177. package/useGridSelectionCheckbox-CVEvUCJL.js +0 -22
  178. package/useHasTabbableChild-C8y4fwiY.js +0 -34
  179. package/useHighlightSelectionDescription-CD74uzLh.js +0 -552
  180. package/useListState-DKnP5TB5.js +0 -119
  181. package/useLocalizedStringFormatter-DsZ-ZWSk.js +0 -96
  182. package/useSingleSelectListState-BHTLh8Ob.js +0 -34
  183. package/useUpdateEffect-Dtz-i14F.js +0 -12
  184. package/x-JK7i-TQC.js +0 -14
  185. /package/{index30.js → theme.js} +0 -0
@@ -1,40 +0,0 @@
1
- import r, { createContext as c, useCallback as b, forwardRef as $, useContext as g, useMemo as s } from "react";
2
- const y = /* @__PURE__ */ c({}), x = /* @__PURE__ */ c(null), m = /* @__PURE__ */ $(function(n, u) {
3
- let { render: l } = g(x);
4
- return /* @__PURE__ */ r.createElement(r.Fragment, null, l(n, u));
5
- });
6
- function I(e, n) {
7
- var u;
8
- let l = e == null ? void 0 : e.renderDropIndicator, f = e == null || (u = e.isVirtualDragging) === null || u === void 0 ? void 0 : u.call(e), d = b((i) => {
9
- if (f || n != null && n.isDropTarget(i)) return l ? l(i) : /* @__PURE__ */ r.createElement(m, {
10
- target: i
11
- });
12
- }, [
13
- n == null ? void 0 : n.target,
14
- f,
15
- l
16
- ]);
17
- return e != null && e.useDropIndicator ? d : void 0;
18
- }
19
- function v(e, n, u) {
20
- var l, f;
21
- let d = e.focusedKey, i = null;
22
- if (!(n == null || (l = n.isVirtualDragging) === null || l === void 0) && l.call(n) && (u == null || (f = u.target) === null || f === void 0 ? void 0 : f.type) === "item") {
23
- i = u.target.key;
24
- var t;
25
- u.target.dropPosition === "after" && (i = (t = u.collection.getKeyAfter(i)) !== null && t !== void 0 ? t : i);
26
- }
27
- return s(() => new Set([
28
- d,
29
- i
30
- ].filter((a) => a != null)), [
31
- d,
32
- i
33
- ]);
34
- }
35
- export {
36
- y as $,
37
- x as a,
38
- v as b,
39
- I as c
40
- };
package/Dropdown.css DELETED
@@ -1 +0,0 @@
1
- ._dropDownMenu_1f4ap_4{font-family:Inter,sans-serif;box-shadow:2px 2px 4px #00000040;background-color:#f2f2f2}._dropDownMenu_1f4ap_4:focus-visible{outline:none;box-shadow:0 0 0 2px #fff,0 0 0 4px #000}._dropdownMenu_1f4ap_15{width:100%}._dropdownMenu_1f4ap_15:focus-visible{outline:none;box-shadow:0 0 0 2px #fff,0 0 0 4px #000}
package/FileUpload.css DELETED
@@ -1 +0,0 @@
1
- ._box_iol70_4{background-color:#f2f2f2;display:flex;flex-flow:row wrap;justify-content:space-between;align-items:center;padding:.875rem 1rem;font-size:1rem}._box_iol70_4>span{word-wrap:break-all;overflow-wrap:break-word;text-wrap:balance;-webkit-hyphens:auto;hyphens:auto;flex:1 0 0%}._box_iol70_4 button{border:none;cursor:pointer;flex:0 0 auto}._list_iol70_28{display:flex;flex-direction:column;list-style-type:none;margin:8px 0 0;padding:0;gap:8px}._container_iol70_38{font-family:Inter,sans-serif;display:flex;flex-direction:column;height:100%}._label_iol70_45{font-size:1rem;font-weight:500;margin-bottom:8px}._text_iol70_51{font-size:14px;font-weight:400;margin-bottom:8px}._dropzone_iol70_57{grid-area:Input;border:1px dashed #8c8c8c;padding:1.5rem;text-align:center;background-color:#fff}._dropzone_iol70_57:hover{background-color:#f2f2f2}._input_iol70_71{grid-area:Input}
package/Flex.css DELETED
@@ -1 +0,0 @@
1
- ._container_148sa_4{--columns: 1;--padding: 1rem;--gutter: 1rem;--maxWidth: 1368px;--margin: auto;width:100%;margin-right:var(--margin);margin-left:var(--margin)}._flex_148sa_16{padding-right:var(--padding);padding-left:var(--padding);display:flex;flex-flow:row wrap;gap:var(--gutter)}._flex_148sa_16>*{display:flex;flex-flow:column wrap;flex:0 0 auto;width:calc((100% / var(--columns)) - var(--gutter) + (var(--gutter) / var(--columns)))}@media (min-width: 768px){._container_148sa_4{--columns: 12;--padding: 2rem}}@media (min-width: 1200px){._container_148sa_4{--gutter: 1.5rem}}@media (min-width: 1440px){._container_148sa_4{max-width:var(--maxWidth);--padding: 0}}._fluid_148sa_54{--maxWidth: unset;--margin: 0;--padding: 0}._col_148sa_60{flex:1 0 0%}._col-1_148sa_64,._col-2_148sa_65,._col-3_148sa_66,._col-4_148sa_67,._col-5_148sa_68,._col-6_148sa_69,._col-7_148sa_70,._col-8_148sa_71,._col-9_148sa_72,._col-10_148sa_73,._col-11_148sa_74,._col-12_148sa_75,._col-auto_148sa_76{flex:0 0 auto;width:100%}@media (min-width: 768px){._col-1_148sa_64{width:calc((100% / 12) - (11 * var(--gutter) / 12))}._col-2_148sa_65{width:calc((2 * 100% / 12) - (10 * var(--gutter) / 12))}._col-3_148sa_66{width:calc((3 * 100% / 12) - (9 * var(--gutter) / 12))}._col-4_148sa_67{width:calc((4 * 100% / 12) - (8 * var(--gutter) / 12))}._col-5_148sa_68{width:calc((5 * 100% / 12) - (7 * var(--gutter) / 12))}._col-6_148sa_69{width:calc((6 * 100% / 12) - (6 * var(--gutter) / 12))}._col-7_148sa_70{width:calc((7 * 100% / 12) - (5 * var(--gutter) / 12))}._col-8_148sa_71{width:calc((8 * 100% / 12) - (4 * var(--gutter) / 12))}._col-9_148sa_72{width:calc((9 * 100% / 12) - (3 * var(--gutter) / 12))}._col-10_148sa_73{width:calc((10 * 100% / 12) - (2 * var(--gutter) / 12))}._col-11_148sa_74{width:calc((11 * 100% / 12) - (1 * var(--gutter) / 12))}._col-auto_148sa_76{width:auto}._offset-1_148sa_130{margin-left:calc((100% / 12) + (var(--gutter) / 12))}._offset-2_148sa_134{margin-left:calc((2 * 100% / 12) + (var(--gutter) / 6))}._offset-3_148sa_138{margin-left:calc((3 * 100% / 12) + (var(--gutter) / 4))}._offset-4_148sa_142{margin-left:calc((4 * 100% / 12) + (var(--gutter) / 3))}._offset-5_148sa_146{margin-left:calc((5 * 100% / 12) + (var(--gutter) * 5 / 12))}._offset-6_148sa_150{margin-left:calc((6 * 100% / 12) + (var(--gutter) / 2))}._offset-7_148sa_154{margin-left:calc((7 * 100% / 12) + (var(--gutter) * 7 / 12))}._offset-8_148sa_158{margin-left:calc((8 * 100% / 12) + (var(--gutter) * 2 / 3))}._offset-9_148sa_162{margin-left:calc((9 * 100% / 12) + (var(--gutter) * 3 / 4))}._offset-10_148sa_166{margin-left:calc((10 * 100% / 12) + (var(--gutter) * 5 / 6))}._offset-11_148sa_170{margin-left:calc((11 * 100% / 12) + (var(--gutter) * 11 / 12))}}
@@ -1,37 +0,0 @@
1
- import './Flex.css';const _ = '"../theme/tokens.css"', o = "(min-width: 768px)", s = "(min-width: 1200px)", t = "(min-width: 1440px)", f = "_container_148sa_4", c = "_flex_148sa_16", e = "_fluid_148sa_54", a = "_col_148sa_60", l = {
2
- tokens: _,
3
- mdBreakpoint: o,
4
- lgBreakpoint: s,
5
- xlBreakpoint: t,
6
- container: f,
7
- flex: c,
8
- fluid: e,
9
- col: a,
10
- "col-1": "_col-1_148sa_64",
11
- "col-2": "_col-2_148sa_65",
12
- "col-3": "_col-3_148sa_66",
13
- "col-4": "_col-4_148sa_67",
14
- "col-5": "_col-5_148sa_68",
15
- "col-6": "_col-6_148sa_69",
16
- "col-7": "_col-7_148sa_70",
17
- "col-8": "_col-8_148sa_71",
18
- "col-9": "_col-9_148sa_72",
19
- "col-10": "_col-10_148sa_73",
20
- "col-11": "_col-11_148sa_74",
21
- "col-12": "_col-12_148sa_75",
22
- "col-auto": "_col-auto_148sa_76",
23
- "offset-1": "_offset-1_148sa_130",
24
- "offset-2": "_offset-2_148sa_134",
25
- "offset-3": "_offset-3_148sa_138",
26
- "offset-4": "_offset-4_148sa_142",
27
- "offset-5": "_offset-5_148sa_146",
28
- "offset-6": "_offset-6_148sa_150",
29
- "offset-7": "_offset-7_148sa_154",
30
- "offset-8": "_offset-8_148sa_158",
31
- "offset-9": "_offset-9_148sa_162",
32
- "offset-10": "_offset-10_148sa_166",
33
- "offset-11": "_offset-11_148sa_170"
34
- };
35
- export {
36
- l as s
37
- };
@@ -1,513 +0,0 @@
1
- import { r as H, k as T, s as N, t as W, u as G, v as J, w as Y } from "./useFocusRing-BKGhL91C.js";
2
- import L, { useRef as y, useContext as Q, useMemo as R, useEffect as B } from "react";
3
- function X(e) {
4
- const t = H(e);
5
- if (!(e instanceof t.HTMLElement) && !(e instanceof t.SVGElement)) return !1;
6
- let { display: n, visibility: a } = e.style, r = n !== "none" && a !== "hidden" && a !== "collapse";
7
- if (r) {
8
- const { getComputedStyle: u } = e.ownerDocument.defaultView;
9
- let { display: d, visibility: o } = u(e);
10
- r = d !== "none" && o !== "hidden" && o !== "collapse";
11
- }
12
- return r;
13
- }
14
- function Z(e, t) {
15
- return !e.hasAttribute("hidden") && // Ignore HiddenSelect when tree walking.
16
- !e.hasAttribute("data-react-aria-prevent-focus") && (e.nodeName === "DETAILS" && t && t.nodeName !== "SUMMARY" ? e.hasAttribute("open") : !0);
17
- }
18
- function j(e, t) {
19
- return e.nodeName !== "#comment" && X(e) && Z(e, t) && (!e.parentElement || j(e.parentElement, e));
20
- }
21
- const I = /* @__PURE__ */ L.createContext(null), k = "react-aria-focus-scope-restore";
22
- let f = null;
23
- function le(e) {
24
- let { children: t, contain: n, restoreFocus: a, autoFocus: r } = e, u = y(null), d = y(null), o = y([]), { parentNode: p } = Q(I) || {}, l = R(() => new A({
25
- scopeRef: o
26
- }), [
27
- o
28
- ]);
29
- T(() => {
30
- let s = p || v.root;
31
- if (v.getTreeNode(s.scopeRef) && f && !F(f, s.scopeRef)) {
32
- let b = v.getTreeNode(f);
33
- b && (s = b);
34
- }
35
- s.addChild(l), v.addNode(l);
36
- }, [
37
- l,
38
- p
39
- ]), T(() => {
40
- let s = v.getTreeNode(o);
41
- s && (s.contain = !!n);
42
- }, [
43
- n
44
- ]), T(() => {
45
- var s;
46
- let b = (s = u.current) === null || s === void 0 ? void 0 : s.nextSibling, $ = [], x = (_) => _.stopPropagation();
47
- for (; b && b !== d.current; )
48
- $.push(b), b.addEventListener(k, x), b = b.nextSibling;
49
- return o.current = $, () => {
50
- for (let _ of $) _.removeEventListener(k, x);
51
- };
52
- }, [
53
- t
54
- ]), re(o, a, n), te(o, n), ae(o, a, n), ne(o, r), B(() => {
55
- const s = N(o.current ? o.current[0] : void 0).activeElement;
56
- let b = null;
57
- if (h(s, o.current)) {
58
- for (let $ of v.traverse()) $.scopeRef && h(s, $.scopeRef.current) && (b = $);
59
- b === v.getTreeNode(o) && (f = b.scopeRef);
60
- }
61
- }, [
62
- o
63
- ]), T(() => () => {
64
- var s, b, $;
65
- let x = ($ = (b = v.getTreeNode(o)) === null || b === void 0 || (s = b.parent) === null || s === void 0 ? void 0 : s.scopeRef) !== null && $ !== void 0 ? $ : null;
66
- (o === f || F(o, f)) && (!x || v.getTreeNode(x)) && (f = x), v.removeTreeNode(o);
67
- }, [
68
- o
69
- ]);
70
- let i = R(() => O(o), []), c = R(() => ({
71
- focusManager: i,
72
- parentNode: l
73
- }), [
74
- l,
75
- i
76
- ]);
77
- return /* @__PURE__ */ L.createElement(I.Provider, {
78
- value: c
79
- }, /* @__PURE__ */ L.createElement("span", {
80
- "data-focus-scope-start": !0,
81
- hidden: !0,
82
- ref: u
83
- }), t, /* @__PURE__ */ L.createElement("span", {
84
- "data-focus-scope-end": !0,
85
- hidden: !0,
86
- ref: d
87
- }));
88
- }
89
- function O(e) {
90
- return {
91
- focusNext(t = {}) {
92
- let n = e.current, { from: a, tabbable: r, wrap: u, accept: d } = t, o = a || N(n[0]).activeElement, p = n[0].previousElementSibling, l = w(n), i = m(l, {
93
- tabbable: r,
94
- accept: d
95
- }, n);
96
- i.currentNode = h(o, n) ? o : p;
97
- let c = i.nextNode();
98
- return !c && u && (i.currentNode = p, c = i.nextNode()), c && E(c, !0), c;
99
- },
100
- focusPrevious(t = {}) {
101
- let n = e.current, { from: a, tabbable: r, wrap: u, accept: d } = t, o = a || N(n[0]).activeElement, p = n[n.length - 1].nextElementSibling, l = w(n), i = m(l, {
102
- tabbable: r,
103
- accept: d
104
- }, n);
105
- i.currentNode = h(o, n) ? o : p;
106
- let c = i.previousNode();
107
- return !c && u && (i.currentNode = p, c = i.previousNode()), c && E(c, !0), c;
108
- },
109
- focusFirst(t = {}) {
110
- let n = e.current, { tabbable: a, accept: r } = t, u = w(n), d = m(u, {
111
- tabbable: a,
112
- accept: r
113
- }, n);
114
- d.currentNode = n[0].previousElementSibling;
115
- let o = d.nextNode();
116
- return o && E(o, !0), o;
117
- },
118
- focusLast(t = {}) {
119
- let n = e.current, { tabbable: a, accept: r } = t, u = w(n), d = m(u, {
120
- tabbable: a,
121
- accept: r
122
- }, n);
123
- d.currentNode = n[n.length - 1].nextElementSibling;
124
- let o = d.previousNode();
125
- return o && E(o, !0), o;
126
- }
127
- };
128
- }
129
- const K = [
130
- "input:not([disabled]):not([type=hidden])",
131
- "select:not([disabled])",
132
- "textarea:not([disabled])",
133
- "button:not([disabled])",
134
- "a[href]",
135
- "area[href]",
136
- "summary",
137
- "iframe",
138
- "object",
139
- "embed",
140
- "audio[controls]",
141
- "video[controls]",
142
- '[contenteditable]:not([contenteditable^="false"])'
143
- ], z = K.join(":not([hidden]),") + ",[tabindex]:not([disabled]):not([hidden])";
144
- K.push('[tabindex]:not([tabindex="-1"]):not([disabled])');
145
- const ee = K.join(':not([hidden]):not([tabindex="-1"]),');
146
- function ie(e) {
147
- return e.matches(z);
148
- }
149
- function w(e) {
150
- return e[0].parentElement;
151
- }
152
- function S(e) {
153
- let t = v.getTreeNode(f);
154
- for (; t && t.scopeRef !== e; ) {
155
- if (t.contain) return !1;
156
- t = t.parent;
157
- }
158
- return !0;
159
- }
160
- function te(e, t) {
161
- let n = y(void 0), a = y(void 0);
162
- T(() => {
163
- let r = e.current;
164
- if (!t) {
165
- a.current && (cancelAnimationFrame(a.current), a.current = void 0);
166
- return;
167
- }
168
- const u = N(r ? r[0] : void 0);
169
- let d = (l) => {
170
- if (l.key !== "Tab" || l.altKey || l.ctrlKey || l.metaKey || !S(e) || l.isComposing) return;
171
- let i = u.activeElement, c = e.current;
172
- if (!c || !h(i, c)) return;
173
- let s = w(c), b = m(s, {
174
- tabbable: !0
175
- }, c);
176
- if (!i) return;
177
- b.currentNode = i;
178
- let $ = l.shiftKey ? b.previousNode() : b.nextNode();
179
- $ || (b.currentNode = l.shiftKey ? c[c.length - 1].nextElementSibling : c[0].previousElementSibling, $ = l.shiftKey ? b.previousNode() : b.nextNode()), l.preventDefault(), $ && E($, !0);
180
- }, o = (l) => {
181
- (!f || F(f, e)) && h(l.target, e.current) ? (f = e, n.current = l.target) : S(e) && !g(l.target, e) ? n.current ? n.current.focus() : f && f.current && M(f.current) : S(e) && (n.current = l.target);
182
- }, p = (l) => {
183
- a.current && cancelAnimationFrame(a.current), a.current = requestAnimationFrame(() => {
184
- let i = Y();
185
- if (!((i === "virtual" || i === null) && G() && J()) && u.activeElement && S(e) && !g(u.activeElement, e))
186
- if (f = e, u.body.contains(l.target)) {
187
- var s;
188
- n.current = l.target, (s = n.current) === null || s === void 0 || s.focus();
189
- } else f.current && M(f.current);
190
- });
191
- };
192
- return u.addEventListener("keydown", d, !1), u.addEventListener("focusin", o, !1), r == null || r.forEach((l) => l.addEventListener("focusin", o, !1)), r == null || r.forEach((l) => l.addEventListener("focusout", p, !1)), () => {
193
- u.removeEventListener("keydown", d, !1), u.removeEventListener("focusin", o, !1), r == null || r.forEach((l) => l.removeEventListener("focusin", o, !1)), r == null || r.forEach((l) => l.removeEventListener("focusout", p, !1));
194
- };
195
- }, [
196
- e,
197
- t
198
- ]), T(() => () => {
199
- a.current && cancelAnimationFrame(a.current);
200
- }, [
201
- a
202
- ]);
203
- }
204
- function U(e) {
205
- return g(e);
206
- }
207
- function h(e, t) {
208
- return !e || !t ? !1 : t.some((n) => n.contains(e));
209
- }
210
- function g(e, t = null) {
211
- if (e instanceof Element && e.closest("[data-react-aria-top-layer]")) return !0;
212
- for (let { scopeRef: n } of v.traverse(v.getTreeNode(t)))
213
- if (n && h(e, n.current)) return !0;
214
- return !1;
215
- }
216
- function de(e) {
217
- return g(e, f);
218
- }
219
- function F(e, t) {
220
- var n;
221
- let a = (n = v.getTreeNode(t)) === null || n === void 0 ? void 0 : n.parent;
222
- for (; a; ) {
223
- if (a.scopeRef === e) return !0;
224
- a = a.parent;
225
- }
226
- return !1;
227
- }
228
- function E(e, t = !1) {
229
- if (e != null && !t) try {
230
- W(e);
231
- } catch {
232
- }
233
- else if (e != null) try {
234
- e.focus();
235
- } catch {
236
- }
237
- }
238
- function q(e, t = !0) {
239
- let n = e[0].previousElementSibling, a = w(e), r = m(a, {
240
- tabbable: t
241
- }, e);
242
- r.currentNode = n;
243
- let u = r.nextNode();
244
- return t && !u && (a = w(e), r = m(a, {
245
- tabbable: !1
246
- }, e), r.currentNode = n, u = r.nextNode()), u;
247
- }
248
- function M(e, t = !0) {
249
- E(q(e, t));
250
- }
251
- function ne(e, t) {
252
- const n = L.useRef(t);
253
- B(() => {
254
- if (n.current) {
255
- f = e;
256
- const a = N(e.current ? e.current[0] : void 0);
257
- !h(a.activeElement, f.current) && e.current && M(e.current);
258
- }
259
- n.current = !1;
260
- }, [
261
- e
262
- ]);
263
- }
264
- function re(e, t, n) {
265
- T(() => {
266
- if (t || n) return;
267
- let a = e.current;
268
- const r = N(a ? a[0] : void 0);
269
- let u = (d) => {
270
- let o = d.target;
271
- h(o, e.current) ? f = e : U(o) || (f = null);
272
- };
273
- return r.addEventListener("focusin", u, !1), a == null || a.forEach((d) => d.addEventListener("focusin", u, !1)), () => {
274
- r.removeEventListener("focusin", u, !1), a == null || a.forEach((d) => d.removeEventListener("focusin", u, !1));
275
- };
276
- }, [
277
- e,
278
- t,
279
- n
280
- ]);
281
- }
282
- function P(e) {
283
- let t = v.getTreeNode(f);
284
- for (; t && t.scopeRef !== e; ) {
285
- if (t.nodeToRestore) return !1;
286
- t = t.parent;
287
- }
288
- return (t == null ? void 0 : t.scopeRef) === e;
289
- }
290
- function ae(e, t, n) {
291
- const a = y(typeof document < "u" ? N(e.current ? e.current[0] : void 0).activeElement : null);
292
- T(() => {
293
- let r = e.current;
294
- const u = N(r ? r[0] : void 0);
295
- if (!t || n) return;
296
- let d = () => {
297
- (!f || F(f, e)) && h(u.activeElement, e.current) && (f = e);
298
- };
299
- return u.addEventListener("focusin", d, !1), r == null || r.forEach((o) => o.addEventListener("focusin", d, !1)), () => {
300
- u.removeEventListener("focusin", d, !1), r == null || r.forEach((o) => o.removeEventListener("focusin", d, !1));
301
- };
302
- }, [
303
- e,
304
- n
305
- ]), T(() => {
306
- const r = N(e.current ? e.current[0] : void 0);
307
- if (!t) return;
308
- let u = (d) => {
309
- if (d.key !== "Tab" || d.altKey || d.ctrlKey || d.metaKey || !S(e) || d.isComposing) return;
310
- let o = r.activeElement;
311
- if (!g(o, e) || !P(e)) return;
312
- let p = v.getTreeNode(e);
313
- if (!p) return;
314
- let l = p.nodeToRestore, i = m(r.body, {
315
- tabbable: !0
316
- });
317
- i.currentNode = o;
318
- let c = d.shiftKey ? i.previousNode() : i.nextNode();
319
- if ((!l || !r.body.contains(l) || l === r.body) && (l = void 0, p.nodeToRestore = void 0), (!c || !g(c, e)) && l) {
320
- i.currentNode = l;
321
- do
322
- c = d.shiftKey ? i.previousNode() : i.nextNode();
323
- while (g(c, e));
324
- d.preventDefault(), d.stopPropagation(), c ? E(c, !0) : U(l) ? E(l, !0) : o.blur();
325
- }
326
- };
327
- return n || r.addEventListener("keydown", u, !0), () => {
328
- n || r.removeEventListener("keydown", u, !0);
329
- };
330
- }, [
331
- e,
332
- t,
333
- n
334
- ]), T(() => {
335
- const r = N(e.current ? e.current[0] : void 0);
336
- if (!t) return;
337
- let u = v.getTreeNode(e);
338
- if (u) {
339
- var d;
340
- return u.nodeToRestore = (d = a.current) !== null && d !== void 0 ? d : void 0, () => {
341
- let o = v.getTreeNode(e);
342
- if (!o) return;
343
- let p = o.nodeToRestore;
344
- if (t && p && (r.activeElement && g(r.activeElement, e) || r.activeElement === r.body && P(e))) {
345
- let l = v.clone();
346
- requestAnimationFrame(() => {
347
- if (r.activeElement === r.body) {
348
- let i = l.getTreeNode(e);
349
- for (; i; ) {
350
- if (i.nodeToRestore && i.nodeToRestore.isConnected) {
351
- V(i.nodeToRestore);
352
- return;
353
- }
354
- i = i.parent;
355
- }
356
- for (i = l.getTreeNode(e); i; ) {
357
- if (i.scopeRef && i.scopeRef.current && v.getTreeNode(i.scopeRef)) {
358
- let c = q(i.scopeRef.current, !0);
359
- V(c);
360
- return;
361
- }
362
- i = i.parent;
363
- }
364
- }
365
- });
366
- }
367
- };
368
- }
369
- }, [
370
- e,
371
- t
372
- ]);
373
- }
374
- function V(e) {
375
- e.dispatchEvent(new CustomEvent(k, {
376
- bubbles: !0,
377
- cancelable: !0
378
- })) && E(e);
379
- }
380
- function m(e, t, n) {
381
- let a = t != null && t.tabbable ? ee : z, r = N(e).createTreeWalker(e, NodeFilter.SHOW_ELEMENT, {
382
- acceptNode(u) {
383
- var d;
384
- return !(t == null || (d = t.from) === null || d === void 0) && d.contains(u) ? NodeFilter.FILTER_REJECT : u.matches(a) && j(u) && (!n || h(u, n)) && (!(t != null && t.accept) || t.accept(u)) ? NodeFilter.FILTER_ACCEPT : NodeFilter.FILTER_SKIP;
385
- }
386
- });
387
- return t != null && t.from && (r.currentNode = t.from), r;
388
- }
389
- function ce(e, t = {}) {
390
- return {
391
- focusNext(n = {}) {
392
- let a = e.current;
393
- if (!a) return null;
394
- let { from: r, tabbable: u = t.tabbable, wrap: d = t.wrap, accept: o = t.accept } = n, p = r || N(a).activeElement, l = m(a, {
395
- tabbable: u,
396
- accept: o
397
- });
398
- a.contains(p) && (l.currentNode = p);
399
- let i = l.nextNode();
400
- return !i && d && (l.currentNode = a, i = l.nextNode()), i && E(i, !0), i;
401
- },
402
- focusPrevious(n = t) {
403
- let a = e.current;
404
- if (!a) return null;
405
- let { from: r, tabbable: u = t.tabbable, wrap: d = t.wrap, accept: o = t.accept } = n, p = r || N(a).activeElement, l = m(a, {
406
- tabbable: u,
407
- accept: o
408
- });
409
- if (a.contains(p)) l.currentNode = p;
410
- else {
411
- let c = C(l);
412
- return c && E(c, !0), c ?? null;
413
- }
414
- let i = l.previousNode();
415
- if (!i && d) {
416
- l.currentNode = a;
417
- let c = C(l);
418
- if (!c)
419
- return null;
420
- i = c;
421
- }
422
- return i && E(i, !0), i ?? null;
423
- },
424
- focusFirst(n = t) {
425
- let a = e.current;
426
- if (!a) return null;
427
- let { tabbable: r = t.tabbable, accept: u = t.accept } = n, o = m(a, {
428
- tabbable: r,
429
- accept: u
430
- }).nextNode();
431
- return o && E(o, !0), o;
432
- },
433
- focusLast(n = t) {
434
- let a = e.current;
435
- if (!a) return null;
436
- let { tabbable: r = t.tabbable, accept: u = t.accept } = n, d = m(a, {
437
- tabbable: r,
438
- accept: u
439
- }), o = C(d);
440
- return o && E(o, !0), o ?? null;
441
- }
442
- };
443
- }
444
- function C(e) {
445
- let t, n;
446
- do
447
- n = e.lastChild(), n && (t = n);
448
- while (n);
449
- return t;
450
- }
451
- class D {
452
- get size() {
453
- return this.fastMap.size;
454
- }
455
- getTreeNode(t) {
456
- return this.fastMap.get(t);
457
- }
458
- addTreeNode(t, n, a) {
459
- let r = this.fastMap.get(n ?? null);
460
- if (!r) return;
461
- let u = new A({
462
- scopeRef: t
463
- });
464
- r.addChild(u), u.parent = r, this.fastMap.set(t, u), a && (u.nodeToRestore = a);
465
- }
466
- addNode(t) {
467
- this.fastMap.set(t.scopeRef, t);
468
- }
469
- removeTreeNode(t) {
470
- if (t === null) return;
471
- let n = this.fastMap.get(t);
472
- if (!n) return;
473
- let a = n.parent;
474
- for (let u of this.traverse()) u !== n && n.nodeToRestore && u.nodeToRestore && n.scopeRef && n.scopeRef.current && h(u.nodeToRestore, n.scopeRef.current) && (u.nodeToRestore = n.nodeToRestore);
475
- let r = n.children;
476
- a && (a.removeChild(n), r.size > 0 && r.forEach((u) => a && a.addChild(u))), this.fastMap.delete(n.scopeRef);
477
- }
478
- // Pre Order Depth First
479
- *traverse(t = this.root) {
480
- if (t.scopeRef != null && (yield t), t.children.size > 0) for (let n of t.children) yield* this.traverse(n);
481
- }
482
- clone() {
483
- var t;
484
- let n = new D();
485
- var a;
486
- for (let r of this.traverse()) n.addTreeNode(r.scopeRef, (a = (t = r.parent) === null || t === void 0 ? void 0 : t.scopeRef) !== null && a !== void 0 ? a : null, r.nodeToRestore);
487
- return n;
488
- }
489
- constructor() {
490
- this.fastMap = /* @__PURE__ */ new Map(), this.root = new A({
491
- scopeRef: null
492
- }), this.fastMap.set(null, this.root);
493
- }
494
- }
495
- class A {
496
- addChild(t) {
497
- this.children.add(t), t.parent = this;
498
- }
499
- removeChild(t) {
500
- this.children.delete(t), t.parent = void 0;
501
- }
502
- constructor(t) {
503
- this.children = /* @__PURE__ */ new Set(), this.contain = !1, this.scopeRef = t.scopeRef;
504
- }
505
- }
506
- let v = new D();
507
- export {
508
- m as $,
509
- le as a,
510
- ie as b,
511
- de as c,
512
- ce as d
513
- };