@serendie/ui 0.1.15 → 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (156) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +51 -9
  3. package/dist/components/{Accordion.d.ts → Accordion/Accordion.d.ts} +2 -2
  4. package/dist/components/{Accordion.js → Accordion/Accordion.js} +10 -10
  5. package/dist/components/Accordion/index.d.ts +1 -0
  6. package/dist/components/AccordionGroup.js +4 -4
  7. package/dist/components/Avatar.js +4 -4
  8. package/dist/components/Badge.js +4 -4
  9. package/dist/components/Banner.js +4 -4
  10. package/dist/components/BottomNavigation.js +3 -3
  11. package/dist/components/BottomNavigationItem.js +4 -4
  12. package/dist/components/Button.js +10 -9
  13. package/dist/components/CheckBox.js +4 -4
  14. package/dist/components/ChoiceBox.js +10 -10
  15. package/dist/components/DashboardWidget.js +4 -4
  16. package/dist/components/Divider.js +4 -4
  17. package/dist/components/Drawer.js +4 -4
  18. package/dist/components/DropdownMenu.js +7 -6
  19. package/dist/components/IconButton.js +4 -4
  20. package/dist/components/ListItem.js +4 -4
  21. package/dist/components/ModalDialog.js +4 -4
  22. package/dist/components/NotificationBadge.js +4 -4
  23. package/dist/components/PasswordField.js +44 -0
  24. package/dist/components/ProgressIndicator.js +4 -4
  25. package/dist/components/RadioButton.js +4 -4
  26. package/dist/components/Search.js +6 -6
  27. package/dist/components/Select.js +4 -4
  28. package/dist/components/Switch.js +4 -4
  29. package/dist/components/TabItem.js +4 -4
  30. package/dist/components/Tabs.js +4 -4
  31. package/dist/components/TextArea.js +4 -4
  32. package/dist/components/TextField.js +4 -4
  33. package/dist/components/Toast.js +3 -3
  34. package/dist/components/TopAppBar.js +4 -4
  35. package/dist/index.d.ts +2 -1
  36. package/dist/index.js +81 -79
  37. package/dist/node_modules/@ark-ui/react/dist/components/accordion/accordion-item-content.js +3 -4
  38. package/dist/node_modules/@ark-ui/react/dist/components/accordion/accordion-item-indicator.js +4 -5
  39. package/dist/node_modules/@ark-ui/react/dist/components/accordion/accordion-item-trigger.js +0 -1
  40. package/dist/node_modules/@ark-ui/react/dist/components/accordion/accordion-item.js +3 -4
  41. package/dist/node_modules/@ark-ui/react/dist/components/accordion/accordion-root.js +2 -3
  42. package/dist/node_modules/@ark-ui/react/dist/components/avatar/avatar-fallback.js +6 -7
  43. package/dist/node_modules/@ark-ui/react/dist/components/avatar/avatar-image.js +5 -6
  44. package/dist/node_modules/@ark-ui/react/dist/components/avatar/avatar-root.js +2 -3
  45. package/dist/node_modules/@ark-ui/react/dist/components/checkbox/checkbox-control.js +5 -6
  46. package/dist/node_modules/@ark-ui/react/dist/components/checkbox/checkbox-hidden-input.js +0 -1
  47. package/dist/node_modules/@ark-ui/react/dist/components/checkbox/checkbox-label.js +0 -1
  48. package/dist/node_modules/@ark-ui/react/dist/components/checkbox/checkbox-root.js +4 -5
  49. package/dist/node_modules/@ark-ui/react/dist/components/collapsible/collapsible-content.js +8 -9
  50. package/dist/node_modules/@ark-ui/react/dist/components/collapsible/collapsible-root.js +0 -1
  51. package/dist/node_modules/@ark-ui/react/dist/components/combobox/combobox-content.js +3 -4
  52. package/dist/node_modules/@ark-ui/react/dist/components/combobox/combobox-control.js +5 -6
  53. package/dist/node_modules/@ark-ui/react/dist/components/combobox/combobox-input.js +6 -7
  54. package/dist/node_modules/@ark-ui/react/dist/components/combobox/combobox-item-group.js +0 -1
  55. package/dist/node_modules/@ark-ui/react/dist/components/combobox/combobox-item-text.js +3 -4
  56. package/dist/node_modules/@ark-ui/react/dist/components/combobox/combobox-item.js +0 -1
  57. package/dist/node_modules/@ark-ui/react/dist/components/combobox/combobox-positioner.js +5 -6
  58. package/dist/node_modules/@ark-ui/react/dist/components/combobox/combobox-root.js +4 -5
  59. package/dist/node_modules/@ark-ui/react/dist/components/combobox/combobox-trigger.js +5 -6
  60. package/dist/node_modules/@ark-ui/react/dist/components/dialog/dialog-backdrop.js +4 -5
  61. package/dist/node_modules/@ark-ui/react/dist/components/dialog/dialog-close-trigger.js +5 -6
  62. package/dist/node_modules/@ark-ui/react/dist/components/dialog/dialog-content.js +0 -1
  63. package/dist/node_modules/@ark-ui/react/dist/components/dialog/dialog-description.js +0 -1
  64. package/dist/node_modules/@ark-ui/react/dist/components/dialog/dialog-positioner.js +5 -6
  65. package/dist/node_modules/@ark-ui/react/dist/components/dialog/dialog-root.js +4 -5
  66. package/dist/node_modules/@ark-ui/react/dist/components/dialog/dialog-title.js +0 -1
  67. package/dist/node_modules/@ark-ui/react/dist/components/menu/menu-content.js +3 -4
  68. package/dist/node_modules/@ark-ui/react/dist/components/menu/menu-item-group.js +0 -1
  69. package/dist/node_modules/@ark-ui/react/dist/components/menu/menu-item.js +2 -3
  70. package/dist/node_modules/@ark-ui/react/dist/components/menu/menu-positioner.js +3 -4
  71. package/dist/node_modules/@ark-ui/react/dist/components/menu/menu-root.js +2 -3
  72. package/dist/node_modules/@ark-ui/react/dist/components/menu/menu-trigger.js +3 -4
  73. package/dist/node_modules/@ark-ui/react/dist/components/radio-group/radio-group-item-control.js +3 -4
  74. package/dist/node_modules/@ark-ui/react/dist/components/radio-group/radio-group-item-hidden-input.js +0 -1
  75. package/dist/node_modules/@ark-ui/react/dist/components/radio-group/radio-group-item-text.js +4 -5
  76. package/dist/node_modules/@ark-ui/react/dist/components/radio-group/radio-group-item.js +3 -4
  77. package/dist/node_modules/@ark-ui/react/dist/components/radio-group/radio-group-root.js +3 -4
  78. package/dist/node_modules/@ark-ui/react/dist/components/select/select-content.js +3 -4
  79. package/dist/node_modules/@ark-ui/react/dist/components/select/select-control.js +6 -7
  80. package/dist/node_modules/@ark-ui/react/dist/components/select/select-item.js +0 -1
  81. package/dist/node_modules/@ark-ui/react/dist/components/select/select-label.js +4 -5
  82. package/dist/node_modules/@ark-ui/react/dist/components/select/select-positioner.js +4 -5
  83. package/dist/node_modules/@ark-ui/react/dist/components/select/select-root.js +7 -7
  84. package/dist/node_modules/@ark-ui/react/dist/components/select/select-trigger.js +5 -6
  85. package/dist/node_modules/@ark-ui/react/dist/components/select/select-value-text.js +5 -6
  86. package/dist/node_modules/@ark-ui/react/dist/components/select/use-select.js +35 -31
  87. package/dist/node_modules/@ark-ui/react/dist/components/switch/switch-control.js +4 -5
  88. package/dist/node_modules/@ark-ui/react/dist/components/switch/switch-hidden-input.js +4 -5
  89. package/dist/node_modules/@ark-ui/react/dist/components/switch/switch-label.js +4 -5
  90. package/dist/node_modules/@ark-ui/react/dist/components/switch/switch-root.js +8 -9
  91. package/dist/node_modules/@ark-ui/react/dist/components/switch/switch-thumb.js +4 -5
  92. package/dist/node_modules/@ark-ui/react/dist/components/tabs/tab-list.js +3 -4
  93. package/dist/node_modules/@ark-ui/react/dist/components/tabs/tab-trigger.js +3 -4
  94. package/dist/node_modules/@ark-ui/react/dist/components/tabs/tabs-root.js +10 -10
  95. package/dist/node_modules/@ark-ui/react/dist/components/toast/toast-root.js +0 -1
  96. package/dist/node_modules/@ark-ui/react/dist/components/toast/toast-title.js +0 -1
  97. package/dist/node_modules/@ark-ui/react/dist/components/toast/toaster.js +4 -4
  98. package/dist/node_modules/@floating-ui/core/dist/floating-ui.core.js +361 -303
  99. package/dist/node_modules/@floating-ui/dom/dist/floating-ui.dom.js +229 -216
  100. package/dist/node_modules/@floating-ui/utils/dist/floating-ui.utils.dom.js +19 -19
  101. package/dist/node_modules/@floating-ui/utils/dist/floating-ui.utils.js +39 -38
  102. package/dist/node_modules/@serendie/design-token/dist/panda-tokens.js +823 -20
  103. package/dist/node_modules/@serendie/design-token/dist/tokens.js +346 -25
  104. package/dist/node_modules/@zag-js/accordion/dist/index.js +12 -12
  105. package/dist/node_modules/@zag-js/aria-hidden/dist/index.js +13 -62
  106. package/dist/node_modules/@zag-js/avatar/dist/index.js +12 -10
  107. package/dist/node_modules/@zag-js/checkbox/dist/index.js +99 -92
  108. package/dist/node_modules/@zag-js/collapsible/dist/index.js +5 -5
  109. package/dist/node_modules/@zag-js/collection/dist/index.js +21 -21
  110. package/dist/node_modules/@zag-js/combobox/dist/index.js +30 -31
  111. package/dist/node_modules/@zag-js/core/dist/index.js +285 -320
  112. package/dist/node_modules/@zag-js/dialog/dist/index.js +56 -62
  113. package/dist/node_modules/@zag-js/dismissable/dist/index.js +3 -3
  114. package/dist/node_modules/@zag-js/dom-event/dist/index.js +88 -115
  115. package/dist/node_modules/@zag-js/dom-query/dist/index.js +2 -2
  116. package/dist/node_modules/@zag-js/focus-visible/dist/index.js +73 -0
  117. package/dist/node_modules/@zag-js/interact-outside/dist/index.js +33 -33
  118. package/dist/node_modules/@zag-js/menu/dist/index.js +81 -77
  119. package/dist/node_modules/@zag-js/popper/dist/index.js +86 -79
  120. package/dist/node_modules/@zag-js/radio-group/dist/index.js +116 -109
  121. package/dist/node_modules/@zag-js/react/dist/index.js +44 -43
  122. package/dist/node_modules/@zag-js/select/dist/index.js +203 -231
  123. package/dist/node_modules/@zag-js/store/dist/index.js +110 -110
  124. package/dist/node_modules/@zag-js/switch/dist/index.js +62 -55
  125. package/dist/node_modules/@zag-js/tabs/dist/index.js +64 -61
  126. package/dist/node_modules/@zag-js/toast/dist/index.js +174 -173
  127. package/dist/node_modules/@zag-js/utils/dist/index.js +93 -71
  128. package/dist/node_modules/aria-hidden/dist/es2015/index.js +52 -0
  129. package/dist/node_modules/focus-trap/dist/focus-trap.esm.js +217 -219
  130. package/dist/preset.d.ts +807 -4
  131. package/dist/{ui/styled-system → styled-system}/css/css.js +5 -6
  132. package/dist/{ui/styled-system → styled-system}/css/cva.js +4 -4
  133. package/dist/{ui/styled-system → styled-system}/css/sva.js +3 -3
  134. package/dist/styled-system/jsx/is-valid-prop.js +6 -0
  135. package/dist/styles.css +1 -1
  136. package/dist/tokens/getToken.d.ts +324 -3
  137. package/dist/tokens/index.d.ts +806 -3
  138. package/package.json +31 -5
  139. package/styled-system/css/css.js +1 -1
  140. package/styled-system/jsx/is-valid-prop.js +1 -1
  141. package/styled-system/themes/theme-asagi.json +1 -1
  142. package/styled-system/themes/theme-kurikawa.json +1 -1
  143. package/styled-system/themes/theme-sumire.json +1 -1
  144. package/styled-system/themes/theme-tsutsuji.json +1 -1
  145. package/styled-system/tokens/index.js +1238 -54
  146. package/styled-system/tokens/tokens.d.ts +3 -3
  147. package/styled-system/types/conditions.d.ts +2 -2
  148. package/styled-system/types/prop-type.d.ts +1 -1
  149. package/dist/ui/styled-system/jsx/is-valid-prop.js +0 -6
  150. /package/dist/{ui/styled-system → styled-system}/css/conditions.js +0 -0
  151. /package/dist/{ui/styled-system → styled-system}/css/cx.js +0 -0
  152. /package/dist/{ui/styled-system → styled-system}/helpers.js +0 -0
  153. /package/dist/{ui/styled-system → styled-system}/jsx/box.js +0 -0
  154. /package/dist/{ui/styled-system → styled-system}/jsx/factory-helper.js +0 -0
  155. /package/dist/{ui/styled-system → styled-system}/jsx/factory.js +0 -0
  156. /package/dist/{ui/styled-system → styled-system}/patterns/box.js +0 -0
@@ -1,95 +1,95 @@
1
- import { isFocusable as G, tabbable as te, focusable as ae, isTabbable as T, getTabIndex as K } from "../../tabbable/dist/index.esm.js";
1
+ import { isFocusable as G, tabbable as ne, focusable as ae, isTabbable as T, getTabIndex as K } from "../../tabbable/dist/index.esm.js";
2
2
  /*!
3
- * focus-trap 7.5.4
3
+ * focus-trap 7.6.0
4
4
  * @license MIT, https://github.com/focus-trap/focus-trap/blob/master/LICENSE
5
5
  */
6
- function z(u, a) {
6
+ function re(u, n, o) {
7
+ return (n = oe(n)) in u ? Object.defineProperty(u, n, {
8
+ value: o,
9
+ enumerable: !0,
10
+ configurable: !0,
11
+ writable: !0
12
+ }) : u[n] = o, u;
13
+ }
14
+ function Q(u, n) {
7
15
  var o = Object.keys(u);
8
16
  if (Object.getOwnPropertySymbols) {
9
17
  var i = Object.getOwnPropertySymbols(u);
10
- a && (i = i.filter(function(m) {
18
+ n && (i = i.filter(function(m) {
11
19
  return Object.getOwnPropertyDescriptor(u, m).enumerable;
12
20
  })), o.push.apply(o, i);
13
21
  }
14
22
  return o;
15
23
  }
16
- function J(u) {
17
- for (var a = 1; a < arguments.length; a++) {
18
- var o = arguments[a] != null ? arguments[a] : {};
19
- a % 2 ? z(Object(o), !0).forEach(function(i) {
20
- ne(u, i, o[i]);
21
- }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(u, Object.getOwnPropertyDescriptors(o)) : z(Object(o)).forEach(function(i) {
24
+ function W(u) {
25
+ for (var n = 1; n < arguments.length; n++) {
26
+ var o = arguments[n] != null ? arguments[n] : {};
27
+ n % 2 ? Q(Object(o), !0).forEach(function(i) {
28
+ re(u, i, o[i]);
29
+ }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(u, Object.getOwnPropertyDescriptors(o)) : Q(Object(o)).forEach(function(i) {
22
30
  Object.defineProperty(u, i, Object.getOwnPropertyDescriptor(o, i));
23
31
  });
24
32
  }
25
33
  return u;
26
34
  }
27
- function ne(u, a, o) {
28
- return a = ie(a), a in u ? Object.defineProperty(u, a, {
29
- value: o,
30
- enumerable: !0,
31
- configurable: !0,
32
- writable: !0
33
- }) : u[a] = o, u;
34
- }
35
- function re(u, a) {
36
- if (typeof u != "object" || u === null) return u;
35
+ function ie(u, n) {
36
+ if (typeof u != "object" || !u) return u;
37
37
  var o = u[Symbol.toPrimitive];
38
38
  if (o !== void 0) {
39
- var i = o.call(u, a || "default");
39
+ var i = o.call(u, n);
40
40
  if (typeof i != "object") return i;
41
41
  throw new TypeError("@@toPrimitive must return a primitive value.");
42
42
  }
43
- return (a === "string" ? String : Number)(u);
43
+ return (n === "string" ? String : Number)(u);
44
44
  }
45
- function ie(u) {
46
- var a = re(u, "string");
47
- return typeof a == "symbol" ? a : String(a);
45
+ function oe(u) {
46
+ var n = ie(u, "string");
47
+ return typeof n == "symbol" ? n : n + "";
48
48
  }
49
- var Q = {
50
- activateTrap: function(a, o) {
51
- if (a.length > 0) {
52
- var i = a[a.length - 1];
49
+ var X = {
50
+ activateTrap: function(n, o) {
51
+ if (n.length > 0) {
52
+ var i = n[n.length - 1];
53
53
  i !== o && i.pause();
54
54
  }
55
- var m = a.indexOf(o);
56
- m === -1 || a.splice(m, 1), a.push(o);
55
+ var m = n.indexOf(o);
56
+ m === -1 || n.splice(m, 1), n.push(o);
57
57
  },
58
- deactivateTrap: function(a, o) {
59
- var i = a.indexOf(o);
60
- i !== -1 && a.splice(i, 1), a.length > 0 && a[a.length - 1].unpause();
58
+ deactivateTrap: function(n, o) {
59
+ var i = n.indexOf(o);
60
+ i !== -1 && n.splice(i, 1), n.length > 0 && n[n.length - 1].unpause();
61
61
  }
62
- }, oe = function(a) {
63
- return a.tagName && a.tagName.toLowerCase() === "input" && typeof a.select == "function";
64
- }, ue = function(a) {
65
- return (a == null ? void 0 : a.key) === "Escape" || (a == null ? void 0 : a.key) === "Esc" || (a == null ? void 0 : a.keyCode) === 27;
66
- }, L = function(a) {
67
- return (a == null ? void 0 : a.key) === "Tab" || (a == null ? void 0 : a.keyCode) === 9;
68
- }, se = function(a) {
69
- return L(a) && !a.shiftKey;
70
- }, ce = function(a) {
71
- return L(a) && a.shiftKey;
72
- }, W = function(a) {
73
- return setTimeout(a, 0);
74
- }, X = function(a, o) {
62
+ }, ue = function(n) {
63
+ return n.tagName && n.tagName.toLowerCase() === "input" && typeof n.select == "function";
64
+ }, se = function(n) {
65
+ return (n == null ? void 0 : n.key) === "Escape" || (n == null ? void 0 : n.key) === "Esc" || (n == null ? void 0 : n.keyCode) === 27;
66
+ }, B = function(n) {
67
+ return (n == null ? void 0 : n.key) === "Tab" || (n == null ? void 0 : n.keyCode) === 9;
68
+ }, ce = function(n) {
69
+ return B(n) && !n.shiftKey;
70
+ }, le = function(n) {
71
+ return B(n) && n.shiftKey;
72
+ }, Z = function(n) {
73
+ return setTimeout(n, 0);
74
+ }, _ = function(n, o) {
75
75
  var i = -1;
76
- return a.every(function(m, s) {
76
+ return n.every(function(m, s) {
77
77
  return o(m) ? (i = s, !1) : !0;
78
78
  }), i;
79
- }, B = function(a) {
79
+ }, L = function(n) {
80
80
  for (var o = arguments.length, i = new Array(o > 1 ? o - 1 : 0), m = 1; m < o; m++)
81
81
  i[m - 1] = arguments[m];
82
- return typeof a == "function" ? a.apply(void 0, i) : a;
83
- }, C = function(a) {
84
- return a.target.shadowRoot && typeof a.composedPath == "function" ? a.composedPath()[0] : a.target;
85
- }, le = [], de = function(a, o) {
86
- var i = (o == null ? void 0 : o.document) || document, m = (o == null ? void 0 : o.trapStack) || le, s = J({
82
+ return typeof n == "function" ? n.apply(void 0, i) : n;
83
+ }, A = function(n) {
84
+ return n.target.shadowRoot && typeof n.composedPath == "function" ? n.composedPath()[0] : n.target;
85
+ }, fe = [], ve = function(n, o) {
86
+ var i = (o == null ? void 0 : o.document) || document, m = (o == null ? void 0 : o.trapStack) || fe, s = W({
87
87
  returnFocusOnDeactivate: !0,
88
88
  escapeDeactivates: !0,
89
89
  delayInitialFocus: !0,
90
- isKeyForward: se,
91
- isKeyBackward: ce
92
- }, o), n = {
90
+ isKeyForward: ce,
91
+ isKeyBackward: le
92
+ }, o), a = {
93
93
  // containers given to createFocusTrap()
94
94
  // @type {Array<HTMLElement>}
95
95
  containers: [],
@@ -125,62 +125,62 @@ var Q = {
125
125
  delayInitialFocusTimer: void 0,
126
126
  // the most recent KeyboardEvent for the configured nav key (typically [SHIFT+]TAB), if any
127
127
  recentNavEvent: void 0
128
- }, g, h = function(t, e, r) {
129
- return t && t[e] !== void 0 ? t[e] : s[r || e];
130
- }, F = function(t, e) {
131
- var r = typeof (e == null ? void 0 : e.composedPath) == "function" ? e.composedPath() : void 0;
132
- return n.containerGroups.findIndex(function(c) {
128
+ }, y, h = function(e, t, r) {
129
+ return e && e[t] !== void 0 ? e[t] : s[r || t];
130
+ }, F = function(e, t) {
131
+ var r = typeof (t == null ? void 0 : t.composedPath) == "function" ? t.composedPath() : void 0;
132
+ return a.containerGroups.findIndex(function(c) {
133
133
  var l = c.container, d = c.tabbableNodes;
134
- return l.contains(t) || // fall back to explicit tabbable search which will take into consideration any
134
+ return l.contains(e) || // fall back to explicit tabbable search which will take into consideration any
135
135
  // web components if the `tabbableOptions.getShadowRoot` option was used for
136
136
  // the trap, enabling shadow DOM support in tabbable (`Node.contains()` doesn't
137
137
  // look inside web components even if open)
138
138
  (r == null ? void 0 : r.includes(l)) || d.find(function(v) {
139
- return v === t;
139
+ return v === e;
140
140
  });
141
141
  });
142
- }, E = function(t) {
143
- var e = s[t];
144
- if (typeof e == "function") {
142
+ }, E = function(e) {
143
+ var t = s[e];
144
+ if (typeof t == "function") {
145
145
  for (var r = arguments.length, c = new Array(r > 1 ? r - 1 : 0), l = 1; l < r; l++)
146
146
  c[l - 1] = arguments[l];
147
- e = e.apply(void 0, c);
147
+ t = t.apply(void 0, c);
148
148
  }
149
- if (e === !0 && (e = void 0), !e) {
150
- if (e === void 0 || e === !1)
151
- return e;
152
- throw new Error("`".concat(t, "` was specified but was not a node, or did not return a node"));
149
+ if (t === !0 && (t = void 0), !t) {
150
+ if (t === void 0 || t === !1)
151
+ return t;
152
+ throw new Error("`".concat(e, "` was specified but was not a node, or did not return a node"));
153
153
  }
154
- var d = e;
155
- if (typeof e == "string" && (d = i.querySelector(e), !d))
156
- throw new Error("`".concat(t, "` as selector refers to no known node"));
154
+ var d = t;
155
+ if (typeof t == "string" && (d = i.querySelector(t), !d))
156
+ throw new Error("`".concat(e, "` as selector refers to no known node"));
157
157
  return d;
158
- }, P = function() {
159
- var t = E("initialFocus");
160
- if (t === !1)
158
+ }, k = function() {
159
+ var e = E("initialFocus");
160
+ if (e === !1)
161
161
  return !1;
162
- if (t === void 0 || !G(t, s.tabbableOptions))
162
+ if (e === void 0 || !G(e, s.tabbableOptions))
163
163
  if (F(i.activeElement) >= 0)
164
- t = i.activeElement;
164
+ e = i.activeElement;
165
165
  else {
166
- var e = n.tabbableGroups[0], r = e && e.firstTabbableNode;
167
- t = r || E("fallbackFocus");
166
+ var t = a.tabbableGroups[0], r = t && t.firstTabbableNode;
167
+ e = r || E("fallbackFocus");
168
168
  }
169
- if (!t)
169
+ if (!e)
170
170
  throw new Error("Your focus-trap needs to have at least one focusable element");
171
- return t;
172
- }, D = function() {
173
- if (n.containerGroups = n.containers.map(function(t) {
174
- var e = te(t, s.tabbableOptions), r = ae(t, s.tabbableOptions), c = e.length > 0 ? e[0] : void 0, l = e.length > 0 ? e[e.length - 1] : void 0, d = r.find(function(b) {
171
+ return e;
172
+ }, P = function() {
173
+ if (a.containerGroups = a.containers.map(function(e) {
174
+ var t = ne(e, s.tabbableOptions), r = ae(e, s.tabbableOptions), c = t.length > 0 ? t[0] : void 0, l = t.length > 0 ? t[t.length - 1] : void 0, d = r.find(function(b) {
175
175
  return T(b);
176
176
  }), v = r.slice().reverse().find(function(b) {
177
177
  return T(b);
178
- }), p = !!e.find(function(b) {
178
+ }), p = !!t.find(function(b) {
179
179
  return K(b) > 0;
180
180
  });
181
181
  return {
182
- container: t,
183
- tabbableNodes: e,
182
+ container: e,
183
+ tabbableNodes: t,
184
184
  focusableNodes: r,
185
185
  /** True if at least one node with positive `tabindex` was found in this container. */
186
186
  posTabIndexesFound: p,
@@ -208,74 +208,74 @@ var Q = {
208
208
  * @returns {HTMLElement|undefined} The next tabbable node, if any.
209
209
  */
210
210
  nextTabbableNode: function(N) {
211
- var O = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : !0, y = e.indexOf(N);
212
- return y < 0 ? O ? r.slice(r.indexOf(N) + 1).find(function(R) {
211
+ var O = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : !0, w = t.indexOf(N);
212
+ return w < 0 ? O ? r.slice(r.indexOf(N) + 1).find(function(R) {
213
213
  return T(R);
214
214
  }) : r.slice(0, r.indexOf(N)).reverse().find(function(R) {
215
215
  return T(R);
216
- }) : e[y + (O ? 1 : -1)];
216
+ }) : t[w + (O ? 1 : -1)];
217
217
  }
218
218
  };
219
- }), n.tabbableGroups = n.containerGroups.filter(function(t) {
220
- return t.tabbableNodes.length > 0;
221
- }), n.tabbableGroups.length <= 0 && !E("fallbackFocus"))
219
+ }), a.tabbableGroups = a.containerGroups.filter(function(e) {
220
+ return e.tabbableNodes.length > 0;
221
+ }), a.tabbableGroups.length <= 0 && !E("fallbackFocus"))
222
222
  throw new Error("Your focus-trap must have at least one container with at least one tabbable node in it at all times");
223
- if (n.containerGroups.find(function(t) {
224
- return t.posTabIndexesFound;
225
- }) && n.containerGroups.length > 1)
223
+ if (a.containerGroups.find(function(e) {
224
+ return e.posTabIndexesFound;
225
+ }) && a.containerGroups.length > 1)
226
226
  throw new Error("At least one node with a positive tabindex was found in one of your focus-trap's multiple containers. Positive tabindexes are only supported in single-container focus-traps.");
227
- }, Z = function f(t) {
228
- var e = t.activeElement;
229
- if (e)
230
- return e.shadowRoot && e.shadowRoot.activeElement !== null ? f(e.shadowRoot) : e;
231
- }, w = function f(t) {
232
- if (t !== !1 && t !== Z(document)) {
233
- if (!t || !t.focus) {
234
- f(P());
227
+ }, S = function(e) {
228
+ var t = e.activeElement;
229
+ if (t)
230
+ return t.shadowRoot && t.shadowRoot.activeElement !== null ? S(t.shadowRoot) : t;
231
+ }, g = function(e) {
232
+ if (e !== !1 && e !== S(document)) {
233
+ if (!e || !e.focus) {
234
+ g(k());
235
235
  return;
236
236
  }
237
- t.focus({
237
+ e.focus({
238
238
  preventScroll: !!s.preventScroll
239
- }), n.mostRecentlyFocusedNode = t, oe(t) && t.select();
239
+ }), a.mostRecentlyFocusedNode = e, ue(e) && e.select();
240
240
  }
241
- }, S = function(t) {
242
- var e = E("setReturnFocus", t);
243
- return e || (e === !1 ? !1 : t);
244
- }, U = function(t) {
245
- var e = t.target, r = t.event, c = t.isBackward, l = c === void 0 ? !1 : c;
246
- e = e || C(r), D();
241
+ }, U = function(e) {
242
+ var t = E("setReturnFocus", e);
243
+ return t || (t === !1 ? !1 : e);
244
+ }, q = function(e) {
245
+ var t = e.target, r = e.event, c = e.isBackward, l = c === void 0 ? !1 : c;
246
+ t = t || A(r), P();
247
247
  var d = null;
248
- if (n.tabbableGroups.length > 0) {
249
- var v = F(e, r), p = v >= 0 ? n.containerGroups[v] : void 0;
248
+ if (a.tabbableGroups.length > 0) {
249
+ var v = F(t, r), p = v >= 0 ? a.containerGroups[v] : void 0;
250
250
  if (v < 0)
251
- l ? d = n.tabbableGroups[n.tabbableGroups.length - 1].lastTabbableNode : d = n.tabbableGroups[0].firstTabbableNode;
251
+ l ? d = a.tabbableGroups[a.tabbableGroups.length - 1].lastTabbableNode : d = a.tabbableGroups[0].firstTabbableNode;
252
252
  else if (l) {
253
- var b = X(n.tabbableGroups, function(I) {
253
+ var b = _(a.tabbableGroups, function(I) {
254
254
  var x = I.firstTabbableNode;
255
- return e === x;
255
+ return t === x;
256
256
  });
257
- if (b < 0 && (p.container === e || G(e, s.tabbableOptions) && !T(e, s.tabbableOptions) && !p.nextTabbableNode(e, !1)) && (b = v), b >= 0) {
258
- var N = b === 0 ? n.tabbableGroups.length - 1 : b - 1, O = n.tabbableGroups[N];
259
- d = K(e) >= 0 ? O.lastTabbableNode : O.lastDomTabbableNode;
260
- } else L(r) || (d = p.nextTabbableNode(e, !1));
257
+ if (b < 0 && (p.container === t || G(t, s.tabbableOptions) && !T(t, s.tabbableOptions) && !p.nextTabbableNode(t, !1)) && (b = v), b >= 0) {
258
+ var N = b === 0 ? a.tabbableGroups.length - 1 : b - 1, O = a.tabbableGroups[N];
259
+ d = K(t) >= 0 ? O.lastTabbableNode : O.lastDomTabbableNode;
260
+ } else B(r) || (d = p.nextTabbableNode(t, !1));
261
261
  } else {
262
- var y = X(n.tabbableGroups, function(I) {
262
+ var w = _(a.tabbableGroups, function(I) {
263
263
  var x = I.lastTabbableNode;
264
- return e === x;
264
+ return t === x;
265
265
  });
266
- if (y < 0 && (p.container === e || G(e, s.tabbableOptions) && !T(e, s.tabbableOptions) && !p.nextTabbableNode(e)) && (y = v), y >= 0) {
267
- var R = y === n.tabbableGroups.length - 1 ? 0 : y + 1, $ = n.tabbableGroups[R];
268
- d = K(e) >= 0 ? $.firstTabbableNode : $.firstDomTabbableNode;
269
- } else L(r) || (d = p.nextTabbableNode(e));
266
+ if (w < 0 && (p.container === t || G(t, s.tabbableOptions) && !T(t, s.tabbableOptions) && !p.nextTabbableNode(t)) && (w = v), w >= 0) {
267
+ var R = w === a.tabbableGroups.length - 1 ? 0 : w + 1, J = a.tabbableGroups[R];
268
+ d = K(t) >= 0 ? J.firstTabbableNode : J.firstDomTabbableNode;
269
+ } else B(r) || (d = p.nextTabbableNode(t));
270
270
  }
271
271
  } else
272
272
  d = E("fallbackFocus");
273
273
  return d;
274
- }, A = function(t) {
275
- var e = C(t);
276
- if (!(F(e, t) >= 0)) {
277
- if (B(s.clickOutsideDeactivates, t)) {
278
- g.deactivate({
274
+ }, j = function(e) {
275
+ var t = A(e);
276
+ if (!(F(t, e) >= 0)) {
277
+ if (L(s.clickOutsideDeactivates, e)) {
278
+ y.deactivate({
279
279
  // NOTE: by setting `returnFocus: false`, deactivate() will do nothing,
280
280
  // which will result in the outside click setting focus to the node
281
281
  // that was clicked (and if not focusable, to "nothing"); by setting
@@ -286,148 +286,146 @@ var Q = {
286
286
  });
287
287
  return;
288
288
  }
289
- B(s.allowOutsideClick, t) || t.preventDefault();
289
+ L(s.allowOutsideClick, e) || e.preventDefault();
290
290
  }
291
- }, q = function(t) {
292
- var e = C(t), r = F(e, t) >= 0;
293
- if (r || e instanceof Document)
294
- r && (n.mostRecentlyFocusedNode = e);
291
+ }, H = function(e) {
292
+ var t = A(e), r = F(t, e) >= 0;
293
+ if (r || t instanceof Document)
294
+ r && (a.mostRecentlyFocusedNode = t);
295
295
  else {
296
- t.stopImmediatePropagation();
296
+ e.stopImmediatePropagation();
297
297
  var c, l = !0;
298
- if (n.mostRecentlyFocusedNode)
299
- if (K(n.mostRecentlyFocusedNode) > 0) {
300
- var d = F(n.mostRecentlyFocusedNode), v = n.containerGroups[d].tabbableNodes;
298
+ if (a.mostRecentlyFocusedNode)
299
+ if (K(a.mostRecentlyFocusedNode) > 0) {
300
+ var d = F(a.mostRecentlyFocusedNode), v = a.containerGroups[d].tabbableNodes;
301
301
  if (v.length > 0) {
302
302
  var p = v.findIndex(function(b) {
303
- return b === n.mostRecentlyFocusedNode;
303
+ return b === a.mostRecentlyFocusedNode;
304
304
  });
305
- p >= 0 && (s.isKeyForward(n.recentNavEvent) ? p + 1 < v.length && (c = v[p + 1], l = !1) : p - 1 >= 0 && (c = v[p - 1], l = !1));
305
+ p >= 0 && (s.isKeyForward(a.recentNavEvent) ? p + 1 < v.length && (c = v[p + 1], l = !1) : p - 1 >= 0 && (c = v[p - 1], l = !1));
306
306
  }
307
307
  } else
308
- n.containerGroups.some(function(b) {
308
+ a.containerGroups.some(function(b) {
309
309
  return b.tabbableNodes.some(function(N) {
310
310
  return K(N) > 0;
311
311
  });
312
312
  }) || (l = !1);
313
313
  else
314
314
  l = !1;
315
- l && (c = U({
315
+ l && (c = q({
316
316
  // move FROM the MRU node, not event-related node (which will be the node that is
317
317
  // outside the trap causing the focus escape we're trying to fix)
318
- target: n.mostRecentlyFocusedNode,
319
- isBackward: s.isKeyBackward(n.recentNavEvent)
320
- })), w(c || n.mostRecentlyFocusedNode || P());
318
+ target: a.mostRecentlyFocusedNode,
319
+ isBackward: s.isKeyBackward(a.recentNavEvent)
320
+ })), g(c || a.mostRecentlyFocusedNode || k());
321
321
  }
322
- n.recentNavEvent = void 0;
323
- }, _ = function(t) {
324
- var e = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : !1;
325
- n.recentNavEvent = t;
326
- var r = U({
327
- event: t,
328
- isBackward: e
322
+ a.recentNavEvent = void 0;
323
+ }, ee = function(e) {
324
+ var t = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : !1;
325
+ a.recentNavEvent = e;
326
+ var r = q({
327
+ event: e,
328
+ isBackward: t
329
329
  });
330
- r && (L(t) && t.preventDefault(), w(r));
331
- }, H = function(t) {
332
- if (ue(t) && B(s.escapeDeactivates, t) !== !1) {
333
- t.preventDefault(), g.deactivate();
334
- return;
335
- }
336
- (s.isKeyForward(t) || s.isKeyBackward(t)) && _(t, s.isKeyBackward(t));
337
- }, M = function(t) {
338
- var e = C(t);
339
- F(e, t) >= 0 || B(s.clickOutsideDeactivates, t) || B(s.allowOutsideClick, t) || (t.preventDefault(), t.stopImmediatePropagation());
340
- }, Y = function() {
341
- if (n.active)
342
- return Q.activateTrap(m, g), n.delayInitialFocusTimer = s.delayInitialFocus ? W(function() {
343
- w(P());
344
- }) : w(P()), i.addEventListener("focusin", q, !0), i.addEventListener("mousedown", A, {
330
+ r && (B(e) && e.preventDefault(), g(r));
331
+ }, M = function(e) {
332
+ (s.isKeyForward(e) || s.isKeyBackward(e)) && ee(e, s.isKeyBackward(e));
333
+ }, Y = function(e) {
334
+ se(e) && L(s.escapeDeactivates, e) !== !1 && (e.preventDefault(), y.deactivate());
335
+ }, V = function(e) {
336
+ var t = A(e);
337
+ F(t, e) >= 0 || L(s.clickOutsideDeactivates, e) || L(s.allowOutsideClick, e) || (e.preventDefault(), e.stopImmediatePropagation());
338
+ }, $ = function() {
339
+ if (a.active)
340
+ return X.activateTrap(m, y), a.delayInitialFocusTimer = s.delayInitialFocus ? Z(function() {
341
+ g(k());
342
+ }) : g(k()), i.addEventListener("focusin", H, !0), i.addEventListener("mousedown", j, {
345
343
  capture: !0,
346
344
  passive: !1
347
- }), i.addEventListener("touchstart", A, {
345
+ }), i.addEventListener("touchstart", j, {
348
346
  capture: !0,
349
347
  passive: !1
350
- }), i.addEventListener("click", M, {
348
+ }), i.addEventListener("click", V, {
351
349
  capture: !0,
352
350
  passive: !1
353
- }), i.addEventListener("keydown", H, {
351
+ }), i.addEventListener("keydown", M, {
354
352
  capture: !0,
355
353
  passive: !1
356
- }), g;
357
- }, V = function() {
358
- if (n.active)
359
- return i.removeEventListener("focusin", q, !0), i.removeEventListener("mousedown", A, !0), i.removeEventListener("touchstart", A, !0), i.removeEventListener("click", M, !0), i.removeEventListener("keydown", H, !0), g;
360
- }, ee = function(t) {
361
- var e = t.some(function(r) {
354
+ }), i.addEventListener("keydown", Y), y;
355
+ }, z = function() {
356
+ if (a.active)
357
+ return i.removeEventListener("focusin", H, !0), i.removeEventListener("mousedown", j, !0), i.removeEventListener("touchstart", j, !0), i.removeEventListener("click", V, !0), i.removeEventListener("keydown", M, !0), i.removeEventListener("keydown", Y), y;
358
+ }, te = function(e) {
359
+ var t = e.some(function(r) {
362
360
  var c = Array.from(r.removedNodes);
363
361
  return c.some(function(l) {
364
- return l === n.mostRecentlyFocusedNode;
362
+ return l === a.mostRecentlyFocusedNode;
365
363
  });
366
364
  });
367
- e && w(P());
368
- }, j = typeof window < "u" && "MutationObserver" in window ? new MutationObserver(ee) : void 0, k = function() {
369
- j && (j.disconnect(), n.active && !n.paused && n.containers.map(function(t) {
370
- j.observe(t, {
365
+ t && g(k());
366
+ }, C = typeof window < "u" && "MutationObserver" in window ? new MutationObserver(te) : void 0, D = function() {
367
+ C && (C.disconnect(), a.active && !a.paused && a.containers.map(function(e) {
368
+ C.observe(e, {
371
369
  subtree: !0,
372
370
  childList: !0
373
371
  });
374
372
  }));
375
373
  };
376
- return g = {
374
+ return y = {
377
375
  get active() {
378
- return n.active;
376
+ return a.active;
379
377
  },
380
378
  get paused() {
381
- return n.paused;
379
+ return a.paused;
382
380
  },
383
- activate: function(t) {
384
- if (n.active)
381
+ activate: function(e) {
382
+ if (a.active)
385
383
  return this;
386
- var e = h(t, "onActivate"), r = h(t, "onPostActivate"), c = h(t, "checkCanFocusTrap");
387
- c || D(), n.active = !0, n.paused = !1, n.nodeFocusedBeforeActivation = i.activeElement, e == null || e();
384
+ var t = h(e, "onActivate"), r = h(e, "onPostActivate"), c = h(e, "checkCanFocusTrap");
385
+ c || P(), a.active = !0, a.paused = !1, a.nodeFocusedBeforeActivation = i.activeElement, t == null || t();
388
386
  var l = function() {
389
- c && D(), Y(), k(), r == null || r();
387
+ c && P(), $(), D(), r == null || r();
390
388
  };
391
- return c ? (c(n.containers.concat()).then(l, l), this) : (l(), this);
389
+ return c ? (c(a.containers.concat()).then(l, l), this) : (l(), this);
392
390
  },
393
- deactivate: function(t) {
394
- if (!n.active)
391
+ deactivate: function(e) {
392
+ if (!a.active)
395
393
  return this;
396
- var e = J({
394
+ var t = W({
397
395
  onDeactivate: s.onDeactivate,
398
396
  onPostDeactivate: s.onPostDeactivate,
399
397
  checkCanReturnFocus: s.checkCanReturnFocus
400
- }, t);
401
- clearTimeout(n.delayInitialFocusTimer), n.delayInitialFocusTimer = void 0, V(), n.active = !1, n.paused = !1, k(), Q.deactivateTrap(m, g);
402
- var r = h(e, "onDeactivate"), c = h(e, "onPostDeactivate"), l = h(e, "checkCanReturnFocus"), d = h(e, "returnFocus", "returnFocusOnDeactivate");
398
+ }, e);
399
+ clearTimeout(a.delayInitialFocusTimer), a.delayInitialFocusTimer = void 0, z(), a.active = !1, a.paused = !1, D(), X.deactivateTrap(m, y);
400
+ var r = h(t, "onDeactivate"), c = h(t, "onPostDeactivate"), l = h(t, "checkCanReturnFocus"), d = h(t, "returnFocus", "returnFocusOnDeactivate");
403
401
  r == null || r();
404
402
  var v = function() {
405
- W(function() {
406
- d && w(S(n.nodeFocusedBeforeActivation)), c == null || c();
403
+ Z(function() {
404
+ d && g(U(a.nodeFocusedBeforeActivation)), c == null || c();
407
405
  });
408
406
  };
409
- return d && l ? (l(S(n.nodeFocusedBeforeActivation)).then(v, v), this) : (v(), this);
407
+ return d && l ? (l(U(a.nodeFocusedBeforeActivation)).then(v, v), this) : (v(), this);
410
408
  },
411
- pause: function(t) {
412
- if (n.paused || !n.active)
409
+ pause: function(e) {
410
+ if (a.paused || !a.active)
413
411
  return this;
414
- var e = h(t, "onPause"), r = h(t, "onPostPause");
415
- return n.paused = !0, e == null || e(), V(), k(), r == null || r(), this;
412
+ var t = h(e, "onPause"), r = h(e, "onPostPause");
413
+ return a.paused = !0, t == null || t(), z(), D(), r == null || r(), this;
416
414
  },
417
- unpause: function(t) {
418
- if (!n.paused || !n.active)
415
+ unpause: function(e) {
416
+ if (!a.paused || !a.active)
419
417
  return this;
420
- var e = h(t, "onUnpause"), r = h(t, "onPostUnpause");
421
- return n.paused = !1, e == null || e(), D(), Y(), k(), r == null || r(), this;
418
+ var t = h(e, "onUnpause"), r = h(e, "onPostUnpause");
419
+ return a.paused = !1, t == null || t(), P(), $(), D(), r == null || r(), this;
422
420
  },
423
- updateContainerElements: function(t) {
424
- var e = [].concat(t).filter(Boolean);
425
- return n.containers = e.map(function(r) {
421
+ updateContainerElements: function(e) {
422
+ var t = [].concat(e).filter(Boolean);
423
+ return a.containers = t.map(function(r) {
426
424
  return typeof r == "string" ? i.querySelector(r) : r;
427
- }), n.active && D(), k(), this;
425
+ }), a.active && P(), D(), this;
428
426
  }
429
- }, g.updateContainerElements(a), g;
427
+ }, y.updateContainerElements(n), y;
430
428
  };
431
429
  export {
432
- de as createFocusTrap
430
+ ve as createFocusTrap
433
431
  };