@haiilo/catalyst 0.5.0 → 0.5.4

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 (297) hide show
  1. package/README.md +2 -0
  2. package/package.json +5 -6
  3. package/dist/catalyst/assets/fonts/AzeretMono-Regular.woff2 +0 -0
  4. package/dist/catalyst/assets/fonts/DMSans-Bold.woff2 +0 -0
  5. package/dist/catalyst/assets/fonts/DMSans-BoldItalic.woff2 +0 -0
  6. package/dist/catalyst/assets/fonts/DMSans-Italic.woff2 +0 -0
  7. package/dist/catalyst/assets/fonts/DMSans-Medium.woff2 +0 -0
  8. package/dist/catalyst/assets/fonts/DMSans-MediumItalic.woff2 +0 -0
  9. package/dist/catalyst/assets/fonts/DMSans-Regular.woff2 +0 -0
  10. package/dist/catalyst/assets/fonts/Lato-Black.woff +0 -0
  11. package/dist/catalyst/assets/fonts/Lato-Black.woff2 +0 -0
  12. package/dist/catalyst/assets/fonts/Lato-BlackItalic.woff +0 -0
  13. package/dist/catalyst/assets/fonts/Lato-BlackItalic.woff2 +0 -0
  14. package/dist/catalyst/assets/fonts/Lato-Bold.woff +0 -0
  15. package/dist/catalyst/assets/fonts/Lato-Bold.woff2 +0 -0
  16. package/dist/catalyst/assets/fonts/Lato-BoldItalic.woff +0 -0
  17. package/dist/catalyst/assets/fonts/Lato-BoldItalic.woff2 +0 -0
  18. package/dist/catalyst/assets/fonts/Lato-Hairline.woff +0 -0
  19. package/dist/catalyst/assets/fonts/Lato-Hairline.woff2 +0 -0
  20. package/dist/catalyst/assets/fonts/Lato-HairlineItalic.woff +0 -0
  21. package/dist/catalyst/assets/fonts/Lato-HairlineItalic.woff2 +0 -0
  22. package/dist/catalyst/assets/fonts/Lato-Heavy.woff +0 -0
  23. package/dist/catalyst/assets/fonts/Lato-Heavy.woff2 +0 -0
  24. package/dist/catalyst/assets/fonts/Lato-HeavyItalic.woff +0 -0
  25. package/dist/catalyst/assets/fonts/Lato-HeavyItalic.woff2 +0 -0
  26. package/dist/catalyst/assets/fonts/Lato-Italic.woff +0 -0
  27. package/dist/catalyst/assets/fonts/Lato-Italic.woff2 +0 -0
  28. package/dist/catalyst/assets/fonts/Lato-Light.woff +0 -0
  29. package/dist/catalyst/assets/fonts/Lato-Light.woff2 +0 -0
  30. package/dist/catalyst/assets/fonts/Lato-LightItalic.woff +0 -0
  31. package/dist/catalyst/assets/fonts/Lato-LightItalic.woff2 +0 -0
  32. package/dist/catalyst/assets/fonts/Lato-Medium.woff +0 -0
  33. package/dist/catalyst/assets/fonts/Lato-Medium.woff2 +0 -0
  34. package/dist/catalyst/assets/fonts/Lato-MediumItalic.woff +0 -0
  35. package/dist/catalyst/assets/fonts/Lato-MediumItalic.woff2 +0 -0
  36. package/dist/catalyst/assets/fonts/Lato-Regular.woff +0 -0
  37. package/dist/catalyst/assets/fonts/Lato-Regular.woff2 +0 -0
  38. package/dist/catalyst/assets/fonts/Lato-Semibold.woff +0 -0
  39. package/dist/catalyst/assets/fonts/Lato-Semibold.woff2 +0 -0
  40. package/dist/catalyst/assets/fonts/Lato-SemiboldItalic.woff +0 -0
  41. package/dist/catalyst/assets/fonts/Lato-SemiboldItalic.woff2 +0 -0
  42. package/dist/catalyst/assets/fonts/Lato-Thin.woff +0 -0
  43. package/dist/catalyst/assets/fonts/Lato-Thin.woff2 +0 -0
  44. package/dist/catalyst/assets/fonts/Lato-ThinItalic.woff +0 -0
  45. package/dist/catalyst/assets/fonts/Lato-ThinItalic.woff2 +0 -0
  46. package/dist/catalyst/catalyst.css +0 -1
  47. package/dist/catalyst/catalyst.esm.js +0 -2
  48. package/dist/catalyst/catalyst.esm.js.map +0 -1
  49. package/dist/catalyst/index.cdn.js +0 -21
  50. package/dist/catalyst/index.esm.js +0 -2
  51. package/dist/catalyst/index.esm.js.map +0 -1
  52. package/dist/catalyst/p-23d54bc6.js +0 -2
  53. package/dist/catalyst/p-23d54bc6.js.map +0 -1
  54. package/dist/catalyst/p-84693f87.entry.js +0 -24
  55. package/dist/catalyst/p-84693f87.entry.js.map +0 -1
  56. package/dist/catalyst/p-8f5cfa78.js +0 -2
  57. package/dist/catalyst/p-8f5cfa78.js.map +0 -1
  58. package/dist/catalyst/p-fa7da4c6.js +0 -2
  59. package/dist/catalyst/p-fa7da4c6.js.map +0 -1
  60. package/dist/cjs/app-globals-50e7504d.js +0 -180
  61. package/dist/cjs/app-globals-50e7504d.js.map +0 -1
  62. package/dist/cjs/cat-alert_15.cjs.entry.js +0 -4652
  63. package/dist/cjs/cat-alert_15.cjs.entry.js.map +0 -1
  64. package/dist/cjs/cat-icon-registry-6895750f.js +0 -441
  65. package/dist/cjs/cat-icon-registry-6895750f.js.map +0 -1
  66. package/dist/cjs/catalyst.cjs.js +0 -24
  67. package/dist/cjs/catalyst.cjs.js.map +0 -1
  68. package/dist/cjs/index-2db8e23d.js +0 -1347
  69. package/dist/cjs/index-2db8e23d.js.map +0 -1
  70. package/dist/cjs/index.cjs.js +0 -12
  71. package/dist/cjs/index.cjs.js.map +0 -1
  72. package/dist/cjs/loader.cjs.js +0 -26
  73. package/dist/cjs/loader.cjs.js.map +0 -1
  74. package/dist/collection/assets/fonts/AzeretMono-Regular.woff2 +0 -0
  75. package/dist/collection/assets/fonts/DMSans-Bold.woff2 +0 -0
  76. package/dist/collection/assets/fonts/DMSans-BoldItalic.woff2 +0 -0
  77. package/dist/collection/assets/fonts/DMSans-Italic.woff2 +0 -0
  78. package/dist/collection/assets/fonts/DMSans-Medium.woff2 +0 -0
  79. package/dist/collection/assets/fonts/DMSans-MediumItalic.woff2 +0 -0
  80. package/dist/collection/assets/fonts/DMSans-Regular.woff2 +0 -0
  81. package/dist/collection/assets/fonts/Lato-Black.woff +0 -0
  82. package/dist/collection/assets/fonts/Lato-Black.woff2 +0 -0
  83. package/dist/collection/assets/fonts/Lato-BlackItalic.woff +0 -0
  84. package/dist/collection/assets/fonts/Lato-BlackItalic.woff2 +0 -0
  85. package/dist/collection/assets/fonts/Lato-Bold.woff +0 -0
  86. package/dist/collection/assets/fonts/Lato-Bold.woff2 +0 -0
  87. package/dist/collection/assets/fonts/Lato-BoldItalic.woff +0 -0
  88. package/dist/collection/assets/fonts/Lato-BoldItalic.woff2 +0 -0
  89. package/dist/collection/assets/fonts/Lato-Hairline.woff +0 -0
  90. package/dist/collection/assets/fonts/Lato-Hairline.woff2 +0 -0
  91. package/dist/collection/assets/fonts/Lato-HairlineItalic.woff +0 -0
  92. package/dist/collection/assets/fonts/Lato-HairlineItalic.woff2 +0 -0
  93. package/dist/collection/assets/fonts/Lato-Heavy.woff +0 -0
  94. package/dist/collection/assets/fonts/Lato-Heavy.woff2 +0 -0
  95. package/dist/collection/assets/fonts/Lato-HeavyItalic.woff +0 -0
  96. package/dist/collection/assets/fonts/Lato-HeavyItalic.woff2 +0 -0
  97. package/dist/collection/assets/fonts/Lato-Italic.woff +0 -0
  98. package/dist/collection/assets/fonts/Lato-Italic.woff2 +0 -0
  99. package/dist/collection/assets/fonts/Lato-Light.woff +0 -0
  100. package/dist/collection/assets/fonts/Lato-Light.woff2 +0 -0
  101. package/dist/collection/assets/fonts/Lato-LightItalic.woff +0 -0
  102. package/dist/collection/assets/fonts/Lato-LightItalic.woff2 +0 -0
  103. package/dist/collection/assets/fonts/Lato-Medium.woff +0 -0
  104. package/dist/collection/assets/fonts/Lato-Medium.woff2 +0 -0
  105. package/dist/collection/assets/fonts/Lato-MediumItalic.woff +0 -0
  106. package/dist/collection/assets/fonts/Lato-MediumItalic.woff2 +0 -0
  107. package/dist/collection/assets/fonts/Lato-Regular.woff +0 -0
  108. package/dist/collection/assets/fonts/Lato-Regular.woff2 +0 -0
  109. package/dist/collection/assets/fonts/Lato-Semibold.woff +0 -0
  110. package/dist/collection/assets/fonts/Lato-Semibold.woff2 +0 -0
  111. package/dist/collection/assets/fonts/Lato-SemiboldItalic.woff +0 -0
  112. package/dist/collection/assets/fonts/Lato-SemiboldItalic.woff2 +0 -0
  113. package/dist/collection/assets/fonts/Lato-Thin.woff +0 -0
  114. package/dist/collection/assets/fonts/Lato-Thin.woff2 +0 -0
  115. package/dist/collection/assets/fonts/Lato-ThinItalic.woff +0 -0
  116. package/dist/collection/assets/fonts/Lato-ThinItalic.woff2 +0 -0
  117. package/dist/collection/collection-manifest.json +0 -27
  118. package/dist/collection/components/cat-alert/cat-alert.css +0 -62
  119. package/dist/collection/components/cat-alert/cat-alert.js +0 -61
  120. package/dist/collection/components/cat-alert/cat-alert.js.map +0 -1
  121. package/dist/collection/components/cat-badge/cat-badge.css +0 -154
  122. package/dist/collection/components/cat-badge/cat-badge.js +0 -143
  123. package/dist/collection/components/cat-badge/cat-badge.js.map +0 -1
  124. package/dist/collection/components/cat-button/cat-button.css +0 -333
  125. package/dist/collection/components/cat-button/cat-button.js +0 -615
  126. package/dist/collection/components/cat-button/cat-button.js.map +0 -1
  127. package/dist/collection/components/cat-card/cat-card.css +0 -25
  128. package/dist/collection/components/cat-card/cat-card.js +0 -20
  129. package/dist/collection/components/cat-card/cat-card.js.map +0 -1
  130. package/dist/collection/components/cat-checkbox/cat-checkbox.css +0 -105
  131. package/dist/collection/components/cat-checkbox/cat-checkbox.js +0 -314
  132. package/dist/collection/components/cat-checkbox/cat-checkbox.js.map +0 -1
  133. package/dist/collection/components/cat-i18n/cat-i18n-registry.js +0 -69
  134. package/dist/collection/components/cat-i18n/cat-i18n-registry.js.map +0 -1
  135. package/dist/collection/components/cat-icon/cat-icon-registry.js +0 -55
  136. package/dist/collection/components/cat-icon/cat-icon-registry.js.map +0 -1
  137. package/dist/collection/components/cat-icon/cat-icon.css +0 -50
  138. package/dist/collection/components/cat-icon/cat-icon.js +0 -91
  139. package/dist/collection/components/cat-icon/cat-icon.js.map +0 -1
  140. package/dist/collection/components/cat-input/cat-input.css +0 -131
  141. package/dist/collection/components/cat-input/cat-input.js +0 -606
  142. package/dist/collection/components/cat-input/cat-input.js.map +0 -1
  143. package/dist/collection/components/cat-menu/cat-menu.css +0 -34
  144. package/dist/collection/components/cat-menu/cat-menu.js +0 -184
  145. package/dist/collection/components/cat-menu/cat-menu.js.map +0 -1
  146. package/dist/collection/components/cat-radio/cat-radio.css +0 -84
  147. package/dist/collection/components/cat-radio/cat-radio.js +0 -283
  148. package/dist/collection/components/cat-radio/cat-radio.js.map +0 -1
  149. package/dist/collection/components/cat-scrollable/cat-scrollable.css +0 -69
  150. package/dist/collection/components/cat-scrollable/cat-scrollable.js +0 -311
  151. package/dist/collection/components/cat-scrollable/cat-scrollable.js.map +0 -1
  152. package/dist/collection/components/cat-skeleton/cat-skeleton.css +0 -177
  153. package/dist/collection/components/cat-skeleton/cat-skeleton.js +0 -131
  154. package/dist/collection/components/cat-skeleton/cat-skeleton.js.map +0 -1
  155. package/dist/collection/components/cat-spinner/cat-spinner.css +0 -63
  156. package/dist/collection/components/cat-spinner/cat-spinner.js +0 -65
  157. package/dist/collection/components/cat-spinner/cat-spinner.js.map +0 -1
  158. package/dist/collection/components/cat-textarea/cat-textarea.css +0 -74
  159. package/dist/collection/components/cat-textarea/cat-textarea.js +0 -393
  160. package/dist/collection/components/cat-textarea/cat-textarea.js.map +0 -1
  161. package/dist/collection/components/cat-toggle/cat-toggle.css +0 -93
  162. package/dist/collection/components/cat-toggle/cat-toggle.js +0 -283
  163. package/dist/collection/components/cat-toggle/cat-toggle.js.map +0 -1
  164. package/dist/collection/components/cat-tooltip/cat-tooltip.css +0 -41
  165. package/dist/collection/components/cat-tooltip/cat-tooltip.js +0 -254
  166. package/dist/collection/components/cat-tooltip/cat-tooltip.js.map +0 -1
  167. package/dist/collection/index.cdn.js +0 -21
  168. package/dist/collection/index.js +0 -3
  169. package/dist/collection/index.js.map +0 -1
  170. package/dist/collection/init.js +0 -17
  171. package/dist/collection/init.js.map +0 -1
  172. package/dist/collection/utils/breakpoints.js +0 -12
  173. package/dist/collection/utils/breakpoints.js.map +0 -1
  174. package/dist/collection/utils/first-tabbable.js +0 -6
  175. package/dist/collection/utils/first-tabbable.js.map +0 -1
  176. package/dist/collection/utils/is-touch-screen.js +0 -3
  177. package/dist/collection/utils/is-touch-screen.js.map +0 -1
  178. package/dist/collection/utils/media-matcher.js +0 -55
  179. package/dist/collection/utils/media-matcher.js.map +0 -1
  180. package/dist/collection/utils/platform.js +0 -50
  181. package/dist/collection/utils/platform.js.map +0 -1
  182. package/dist/components/cat-alert.d.ts +0 -11
  183. package/dist/components/cat-alert.js +0 -53
  184. package/dist/components/cat-alert.js.map +0 -1
  185. package/dist/components/cat-badge.d.ts +0 -11
  186. package/dist/components/cat-badge.js +0 -68
  187. package/dist/components/cat-badge.js.map +0 -1
  188. package/dist/components/cat-button.d.ts +0 -11
  189. package/dist/components/cat-button.js +0 -8
  190. package/dist/components/cat-button.js.map +0 -1
  191. package/dist/components/cat-button2.js +0 -346
  192. package/dist/components/cat-button2.js.map +0 -1
  193. package/dist/components/cat-card.d.ts +0 -11
  194. package/dist/components/cat-card.js +0 -35
  195. package/dist/components/cat-card.js.map +0 -1
  196. package/dist/components/cat-checkbox.d.ts +0 -11
  197. package/dist/components/cat-checkbox.js +0 -103
  198. package/dist/components/cat-checkbox.js.map +0 -1
  199. package/dist/components/cat-i18n-registry.js +0 -73
  200. package/dist/components/cat-i18n-registry.js.map +0 -1
  201. package/dist/components/cat-icon-registry.js +0 -59
  202. package/dist/components/cat-icon-registry.js.map +0 -1
  203. package/dist/components/cat-icon.d.ts +0 -11
  204. package/dist/components/cat-icon.js +0 -8
  205. package/dist/components/cat-icon.js.map +0 -1
  206. package/dist/components/cat-icon2.js +0 -49
  207. package/dist/components/cat-icon2.js.map +0 -1
  208. package/dist/components/cat-input.d.ts +0 -11
  209. package/dist/components/cat-input.js +0 -172
  210. package/dist/components/cat-input.js.map +0 -1
  211. package/dist/components/cat-menu.d.ts +0 -11
  212. package/dist/components/cat-menu.js +0 -870
  213. package/dist/components/cat-menu.js.map +0 -1
  214. package/dist/components/cat-radio.d.ts +0 -11
  215. package/dist/components/cat-radio.js +0 -93
  216. package/dist/components/cat-radio.js.map +0 -1
  217. package/dist/components/cat-scrollable.d.ts +0 -11
  218. package/dist/components/cat-scrollable.js +0 -1362
  219. package/dist/components/cat-scrollable.js.map +0 -1
  220. package/dist/components/cat-skeleton.d.ts +0 -11
  221. package/dist/components/cat-skeleton.js +0 -78
  222. package/dist/components/cat-skeleton.js.map +0 -1
  223. package/dist/components/cat-spinner.d.ts +0 -11
  224. package/dist/components/cat-spinner.js +0 -8
  225. package/dist/components/cat-spinner.js.map +0 -1
  226. package/dist/components/cat-spinner2.js +0 -41
  227. package/dist/components/cat-spinner2.js.map +0 -1
  228. package/dist/components/cat-textarea.d.ts +0 -11
  229. package/dist/components/cat-textarea.js +0 -119
  230. package/dist/components/cat-textarea.js.map +0 -1
  231. package/dist/components/cat-toggle.d.ts +0 -11
  232. package/dist/components/cat-toggle.js +0 -93
  233. package/dist/components/cat-toggle.js.map +0 -1
  234. package/dist/components/cat-tooltip.d.ts +0 -11
  235. package/dist/components/cat-tooltip.js +0 -154
  236. package/dist/components/cat-tooltip.js.map +0 -1
  237. package/dist/components/first-tabbable.js +0 -1496
  238. package/dist/components/first-tabbable.js.map +0 -1
  239. package/dist/components/index.d.ts +0 -26
  240. package/dist/components/index.js +0 -182
  241. package/dist/components/index.js.map +0 -1
  242. package/dist/components/loglevel.js +0 -315
  243. package/dist/components/loglevel.js.map +0 -1
  244. package/dist/esm/app-globals-6906ac5c.js +0 -178
  245. package/dist/esm/app-globals-6906ac5c.js.map +0 -1
  246. package/dist/esm/cat-alert_15.entry.js +0 -4634
  247. package/dist/esm/cat-alert_15.entry.js.map +0 -1
  248. package/dist/esm/cat-icon-registry-77963c26.js +0 -437
  249. package/dist/esm/cat-icon-registry-77963c26.js.map +0 -1
  250. package/dist/esm/catalyst.js +0 -22
  251. package/dist/esm/catalyst.js.map +0 -1
  252. package/dist/esm/index-1f3ca03b.js +0 -1320
  253. package/dist/esm/index-1f3ca03b.js.map +0 -1
  254. package/dist/esm/index.js +0 -3
  255. package/dist/esm/index.js.map +0 -1
  256. package/dist/esm/loader.js +0 -22
  257. package/dist/esm/loader.js.map +0 -1
  258. package/dist/esm/polyfills/core-js.js +0 -11
  259. package/dist/esm/polyfills/css-shim.js +0 -1
  260. package/dist/esm/polyfills/dom.js +0 -79
  261. package/dist/esm/polyfills/es5-html-element.js +0 -1
  262. package/dist/esm/polyfills/index.js +0 -34
  263. package/dist/esm/polyfills/system.js +0 -6
  264. package/dist/index.cjs.js +0 -1
  265. package/dist/index.js +0 -1
  266. package/dist/types/components/cat-alert/cat-alert.d.ts +0 -14
  267. package/dist/types/components/cat-badge/cat-badge.d.ts +0 -29
  268. package/dist/types/components/cat-button/cat-button.d.ts +0 -134
  269. package/dist/types/components/cat-card/cat-card.d.ts +0 -7
  270. package/dist/types/components/cat-checkbox/cat-checkbox.d.ts +0 -69
  271. package/dist/types/components/cat-i18n/cat-i18n-registry.d.ts +0 -18
  272. package/dist/types/components/cat-icon/cat-icon-registry.d.ts +0 -15
  273. package/dist/types/components/cat-icon/cat-icon.d.ts +0 -23
  274. package/dist/types/components/cat-input/cat-input.d.ts +0 -130
  275. package/dist/types/components/cat-menu/cat-menu.d.ts +0 -31
  276. package/dist/types/components/cat-radio/cat-radio.d.ts +0 -63
  277. package/dist/types/components/cat-scrollable/cat-scrollable.d.ts +0 -52
  278. package/dist/types/components/cat-skeleton/cat-skeleton.d.ts +0 -28
  279. package/dist/types/components/cat-spinner/cat-spinner.d.ts +0 -15
  280. package/dist/types/components/cat-textarea/cat-textarea.d.ts +0 -85
  281. package/dist/types/components/cat-toggle/cat-toggle.d.ts +0 -64
  282. package/dist/types/components/cat-tooltip/cat-tooltip.d.ts +0 -46
  283. package/dist/types/components.d.ts +0 -1167
  284. package/dist/types/index.d.ts +0 -3
  285. package/dist/types/init.d.ts +0 -1
  286. package/dist/types/stencil-public-runtime.d.ts +0 -1565
  287. package/dist/types/utils/breakpoints.d.ts +0 -7
  288. package/dist/types/utils/first-tabbable.d.ts +0 -4
  289. package/dist/types/utils/is-touch-screen.d.ts +0 -2
  290. package/dist/types/utils/media-matcher.d.ts +0 -13
  291. package/dist/types/utils/platform.d.ts +0 -18
  292. package/loader/cdn.js +0 -3
  293. package/loader/index.cjs.js +0 -3
  294. package/loader/index.d.ts +0 -12
  295. package/loader/index.es2017.js +0 -3
  296. package/loader/index.js +0 -4
  297. package/loader/package.json +0 -10
@@ -1,1496 +0,0 @@
1
- function getSide(placement) {
2
- return placement.split('-')[0];
3
- }
4
-
5
- function getAlignment(placement) {
6
- return placement.split('-')[1];
7
- }
8
-
9
- function getMainAxisFromPlacement(placement) {
10
- return ['top', 'bottom'].includes(getSide(placement)) ? 'x' : 'y';
11
- }
12
-
13
- function getLengthFromAxis(axis) {
14
- return axis === 'y' ? 'height' : 'width';
15
- }
16
-
17
- function computeCoordsFromPlacement(_ref, placement, rtl) {
18
- let {
19
- reference,
20
- floating
21
- } = _ref;
22
- const commonX = reference.x + reference.width / 2 - floating.width / 2;
23
- const commonY = reference.y + reference.height / 2 - floating.height / 2;
24
- const mainAxis = getMainAxisFromPlacement(placement);
25
- const length = getLengthFromAxis(mainAxis);
26
- const commonAlign = reference[length] / 2 - floating[length] / 2;
27
- const side = getSide(placement);
28
- const isVertical = mainAxis === 'x';
29
- let coords;
30
-
31
- switch (side) {
32
- case 'top':
33
- coords = {
34
- x: commonX,
35
- y: reference.y - floating.height
36
- };
37
- break;
38
-
39
- case 'bottom':
40
- coords = {
41
- x: commonX,
42
- y: reference.y + reference.height
43
- };
44
- break;
45
-
46
- case 'right':
47
- coords = {
48
- x: reference.x + reference.width,
49
- y: commonY
50
- };
51
- break;
52
-
53
- case 'left':
54
- coords = {
55
- x: reference.x - floating.width,
56
- y: commonY
57
- };
58
- break;
59
-
60
- default:
61
- coords = {
62
- x: reference.x,
63
- y: reference.y
64
- };
65
- }
66
-
67
- switch (getAlignment(placement)) {
68
- case 'start':
69
- coords[mainAxis] -= commonAlign * (rtl && isVertical ? -1 : 1);
70
- break;
71
-
72
- case 'end':
73
- coords[mainAxis] += commonAlign * (rtl && isVertical ? -1 : 1);
74
- break;
75
- }
76
-
77
- return coords;
78
- }
79
-
80
- /**
81
- * Computes the `x` and `y` coordinates that will place the floating element
82
- * next to a reference element when it is given a certain positioning strategy.
83
- *
84
- * This export does not have any `platform` interface logic. You will need to
85
- * write one for the platform you are using Floating UI with.
86
- */
87
-
88
- const computePosition$1 = async (reference, floating, config) => {
89
- const {
90
- placement = 'bottom',
91
- strategy = 'absolute',
92
- middleware = [],
93
- platform
94
- } = config;
95
- const rtl = await (platform.isRTL == null ? void 0 : platform.isRTL(floating));
96
-
97
- let rects = await platform.getElementRects({
98
- reference,
99
- floating,
100
- strategy
101
- });
102
- let {
103
- x,
104
- y
105
- } = computeCoordsFromPlacement(rects, placement, rtl);
106
- let statefulPlacement = placement;
107
- let middlewareData = {};
108
-
109
- for (let i = 0; i < middleware.length; i++) {
110
-
111
- const {
112
- name,
113
- fn
114
- } = middleware[i];
115
- const {
116
- x: nextX,
117
- y: nextY,
118
- data,
119
- reset
120
- } = await fn({
121
- x,
122
- y,
123
- initialPlacement: placement,
124
- placement: statefulPlacement,
125
- strategy,
126
- middlewareData,
127
- rects,
128
- platform,
129
- elements: {
130
- reference,
131
- floating
132
- }
133
- });
134
- x = nextX != null ? nextX : x;
135
- y = nextY != null ? nextY : y;
136
- middlewareData = { ...middlewareData,
137
- [name]: { ...middlewareData[name],
138
- ...data
139
- }
140
- };
141
-
142
- if (reset) {
143
- if (typeof reset === 'object') {
144
- if (reset.placement) {
145
- statefulPlacement = reset.placement;
146
- }
147
-
148
- if (reset.rects) {
149
- rects = reset.rects === true ? await platform.getElementRects({
150
- reference,
151
- floating,
152
- strategy
153
- }) : reset.rects;
154
- }
155
-
156
- ({
157
- x,
158
- y
159
- } = computeCoordsFromPlacement(rects, statefulPlacement, rtl));
160
- }
161
-
162
- i = -1;
163
- continue;
164
- }
165
- }
166
-
167
- return {
168
- x,
169
- y,
170
- placement: statefulPlacement,
171
- strategy,
172
- middlewareData
173
- };
174
- };
175
-
176
- function expandPaddingObject(padding) {
177
- return {
178
- top: 0,
179
- right: 0,
180
- bottom: 0,
181
- left: 0,
182
- ...padding
183
- };
184
- }
185
-
186
- function getSideObjectFromPadding(padding) {
187
- return typeof padding !== 'number' ? expandPaddingObject(padding) : {
188
- top: padding,
189
- right: padding,
190
- bottom: padding,
191
- left: padding
192
- };
193
- }
194
-
195
- function rectToClientRect(rect) {
196
- return { ...rect,
197
- top: rect.y,
198
- left: rect.x,
199
- right: rect.x + rect.width,
200
- bottom: rect.y + rect.height
201
- };
202
- }
203
-
204
- /**
205
- * Resolves with an object of overflow side offsets that determine how much the
206
- * element is overflowing a given clipping boundary.
207
- * - positive = overflowing the boundary by that number of pixels
208
- * - negative = how many pixels left before it will overflow
209
- * - 0 = lies flush with the boundary
210
- * @see https://floating-ui.com/docs/detectOverflow
211
- */
212
- async function detectOverflow(middlewareArguments, options) {
213
- var _await$platform$isEle;
214
-
215
- if (options === void 0) {
216
- options = {};
217
- }
218
-
219
- const {
220
- x,
221
- y,
222
- platform,
223
- rects,
224
- elements,
225
- strategy
226
- } = middlewareArguments;
227
- const {
228
- boundary = 'clippingAncestors',
229
- rootBoundary = 'viewport',
230
- elementContext = 'floating',
231
- altBoundary = false,
232
- padding = 0
233
- } = options;
234
- const paddingObject = getSideObjectFromPadding(padding);
235
- const altContext = elementContext === 'floating' ? 'reference' : 'floating';
236
- const element = elements[altBoundary ? altContext : elementContext];
237
- const clippingClientRect = rectToClientRect(await platform.getClippingRect({
238
- element: ((_await$platform$isEle = await (platform.isElement == null ? void 0 : platform.isElement(element))) != null ? _await$platform$isEle : true) ? element : element.contextElement || (await (platform.getDocumentElement == null ? void 0 : platform.getDocumentElement(elements.floating))),
239
- boundary,
240
- rootBoundary,
241
- strategy
242
- }));
243
- const elementClientRect = rectToClientRect(platform.convertOffsetParentRelativeRectToViewportRelativeRect ? await platform.convertOffsetParentRelativeRectToViewportRelativeRect({
244
- rect: elementContext === 'floating' ? { ...rects.floating,
245
- x,
246
- y
247
- } : rects.reference,
248
- offsetParent: await (platform.getOffsetParent == null ? void 0 : platform.getOffsetParent(elements.floating)),
249
- strategy
250
- }) : rects[elementContext]); // positive = overflowing the clipping rect
251
- // 0 or negative = within the clipping rect
252
-
253
- return {
254
- top: clippingClientRect.top - elementClientRect.top + paddingObject.top,
255
- bottom: elementClientRect.bottom - clippingClientRect.bottom + paddingObject.bottom,
256
- left: clippingClientRect.left - elementClientRect.left + paddingObject.left,
257
- right: elementClientRect.right - clippingClientRect.right + paddingObject.right
258
- };
259
- }
260
-
261
- const hash$1 = {
262
- left: 'right',
263
- right: 'left',
264
- bottom: 'top',
265
- top: 'bottom'
266
- };
267
- function getOppositePlacement(placement) {
268
- return placement.replace(/left|right|bottom|top/g, matched => hash$1[matched]);
269
- }
270
-
271
- function getAlignmentSides(placement, rects, rtl) {
272
- if (rtl === void 0) {
273
- rtl = false;
274
- }
275
-
276
- const alignment = getAlignment(placement);
277
- const mainAxis = getMainAxisFromPlacement(placement);
278
- const length = getLengthFromAxis(mainAxis);
279
- let mainAlignmentSide = mainAxis === 'x' ? alignment === (rtl ? 'end' : 'start') ? 'right' : 'left' : alignment === 'start' ? 'bottom' : 'top';
280
-
281
- if (rects.reference[length] > rects.floating[length]) {
282
- mainAlignmentSide = getOppositePlacement(mainAlignmentSide);
283
- }
284
-
285
- return {
286
- main: mainAlignmentSide,
287
- cross: getOppositePlacement(mainAlignmentSide)
288
- };
289
- }
290
-
291
- const hash = {
292
- start: 'end',
293
- end: 'start'
294
- };
295
- function getOppositeAlignmentPlacement(placement) {
296
- return placement.replace(/start|end/g, matched => hash[matched]);
297
- }
298
-
299
- function getExpandedPlacements(placement) {
300
- const oppositePlacement = getOppositePlacement(placement);
301
- return [getOppositeAlignmentPlacement(placement), oppositePlacement, getOppositeAlignmentPlacement(oppositePlacement)];
302
- }
303
-
304
- /**
305
- * Changes the placement of the floating element to one that will fit if the
306
- * initially specified `placement` does not.
307
- * @see https://floating-ui.com/docs/flip
308
- */
309
- const flip = function (options) {
310
- if (options === void 0) {
311
- options = {};
312
- }
313
-
314
- return {
315
- name: 'flip',
316
- options,
317
-
318
- async fn(middlewareArguments) {
319
- var _middlewareData$flip;
320
-
321
- const {
322
- placement,
323
- middlewareData,
324
- rects,
325
- initialPlacement,
326
- platform,
327
- elements
328
- } = middlewareArguments;
329
- const {
330
- mainAxis: checkMainAxis = true,
331
- crossAxis: checkCrossAxis = true,
332
- fallbackPlacements: specifiedFallbackPlacements,
333
- fallbackStrategy = 'bestFit',
334
- flipAlignment = true,
335
- ...detectOverflowOptions
336
- } = options;
337
- const side = getSide(placement);
338
- const isBasePlacement = side === initialPlacement;
339
- const fallbackPlacements = specifiedFallbackPlacements || (isBasePlacement || !flipAlignment ? [getOppositePlacement(initialPlacement)] : getExpandedPlacements(initialPlacement));
340
- const placements = [initialPlacement, ...fallbackPlacements];
341
- const overflow = await detectOverflow(middlewareArguments, detectOverflowOptions);
342
- const overflows = [];
343
- let overflowsData = ((_middlewareData$flip = middlewareData.flip) == null ? void 0 : _middlewareData$flip.overflows) || [];
344
-
345
- if (checkMainAxis) {
346
- overflows.push(overflow[side]);
347
- }
348
-
349
- if (checkCrossAxis) {
350
- const {
351
- main,
352
- cross
353
- } = getAlignmentSides(placement, rects, await (platform.isRTL == null ? void 0 : platform.isRTL(elements.floating)));
354
- overflows.push(overflow[main], overflow[cross]);
355
- }
356
-
357
- overflowsData = [...overflowsData, {
358
- placement,
359
- overflows
360
- }]; // One or more sides is overflowing
361
-
362
- if (!overflows.every(side => side <= 0)) {
363
- var _middlewareData$flip$, _middlewareData$flip2;
364
-
365
- const nextIndex = ((_middlewareData$flip$ = (_middlewareData$flip2 = middlewareData.flip) == null ? void 0 : _middlewareData$flip2.index) != null ? _middlewareData$flip$ : 0) + 1;
366
- const nextPlacement = placements[nextIndex];
367
-
368
- if (nextPlacement) {
369
- // Try next placement and re-run the lifecycle
370
- return {
371
- data: {
372
- index: nextIndex,
373
- overflows: overflowsData
374
- },
375
- reset: {
376
- placement: nextPlacement
377
- }
378
- };
379
- }
380
-
381
- let resetPlacement = 'bottom';
382
-
383
- switch (fallbackStrategy) {
384
- case 'bestFit':
385
- {
386
- var _overflowsData$slice$;
387
-
388
- const placement = (_overflowsData$slice$ = overflowsData.slice().sort((a, b) => a.overflows.filter(overflow => overflow > 0).reduce((acc, overflow) => acc + overflow, 0) - b.overflows.filter(overflow => overflow > 0).reduce((acc, overflow) => acc + overflow, 0))[0]) == null ? void 0 : _overflowsData$slice$.placement;
389
-
390
- if (placement) {
391
- resetPlacement = placement;
392
- }
393
-
394
- break;
395
- }
396
-
397
- case 'initialPlacement':
398
- resetPlacement = initialPlacement;
399
- break;
400
- }
401
-
402
- if (placement !== resetPlacement) {
403
- return {
404
- reset: {
405
- placement: resetPlacement
406
- }
407
- };
408
- }
409
- }
410
-
411
- return {};
412
- }
413
-
414
- };
415
- };
416
-
417
- function convertValueToCoords(placement, rects, value, rtl) {
418
- if (rtl === void 0) {
419
- rtl = false;
420
- }
421
-
422
- const side = getSide(placement);
423
- const alignment = getAlignment(placement);
424
- const isVertical = getMainAxisFromPlacement(placement) === 'x';
425
- const mainAxisMulti = ['left', 'top'].includes(side) ? -1 : 1;
426
- const crossAxisMulti = rtl && isVertical ? -1 : 1;
427
- const rawValue = typeof value === 'function' ? value({ ...rects,
428
- placement
429
- }) : value;
430
- const isNumber = typeof rawValue === 'number'; // eslint-disable-next-line prefer-const
431
-
432
- let {
433
- mainAxis,
434
- crossAxis,
435
- alignmentAxis
436
- } = isNumber ? {
437
- mainAxis: rawValue,
438
- crossAxis: 0,
439
- alignmentAxis: null
440
- } : {
441
- mainAxis: 0,
442
- crossAxis: 0,
443
- alignmentAxis: null,
444
- ...rawValue
445
- };
446
-
447
- if (alignment && typeof alignmentAxis === 'number') {
448
- crossAxis = alignment === 'end' ? alignmentAxis * -1 : alignmentAxis;
449
- }
450
-
451
- return isVertical ? {
452
- x: crossAxis * crossAxisMulti,
453
- y: mainAxis * mainAxisMulti
454
- } : {
455
- x: mainAxis * mainAxisMulti,
456
- y: crossAxis * crossAxisMulti
457
- };
458
- }
459
- /**
460
- * Displaces the floating element from its reference element.
461
- * @see https://floating-ui.com/docs/offset
462
- */
463
-
464
- const offset = function (value) {
465
- if (value === void 0) {
466
- value = 0;
467
- }
468
-
469
- return {
470
- name: 'offset',
471
- options: value,
472
-
473
- async fn(middlewareArguments) {
474
- const {
475
- x,
476
- y,
477
- placement,
478
- rects,
479
- platform,
480
- elements
481
- } = middlewareArguments;
482
- const diffCoords = convertValueToCoords(placement, rects, value, await (platform.isRTL == null ? void 0 : platform.isRTL(elements.floating)));
483
- return {
484
- x: x + diffCoords.x,
485
- y: y + diffCoords.y,
486
- data: diffCoords
487
- };
488
- }
489
-
490
- };
491
- };
492
-
493
- function isWindow(value) {
494
- return (value == null ? void 0 : value.toString()) === '[object Window]';
495
- }
496
- function getWindow(node) {
497
- if (node == null) {
498
- return window;
499
- }
500
-
501
- if (!isWindow(node)) {
502
- const ownerDocument = node.ownerDocument;
503
- return ownerDocument ? ownerDocument.defaultView || window : window;
504
- }
505
-
506
- return node;
507
- }
508
-
509
- function getComputedStyle$1(element) {
510
- return getWindow(element).getComputedStyle(element);
511
- }
512
-
513
- function getNodeName(node) {
514
- return isWindow(node) ? '' : node ? (node.nodeName || '').toLowerCase() : '';
515
- }
516
-
517
- function isHTMLElement(value) {
518
- return value instanceof getWindow(value).HTMLElement;
519
- }
520
- function isElement(value) {
521
- return value instanceof getWindow(value).Element;
522
- }
523
- function isNode(value) {
524
- return value instanceof getWindow(value).Node;
525
- }
526
- function isShadowRoot(node) {
527
- const OwnElement = getWindow(node).ShadowRoot;
528
- return node instanceof OwnElement || node instanceof ShadowRoot;
529
- }
530
- function isOverflowElement(element) {
531
- // Firefox wants us to check `-x` and `-y` variations as well
532
- const {
533
- overflow,
534
- overflowX,
535
- overflowY
536
- } = getComputedStyle$1(element);
537
- return /auto|scroll|overlay|hidden/.test(overflow + overflowY + overflowX);
538
- }
539
- function isTableElement(element) {
540
- return ['table', 'td', 'th'].includes(getNodeName(element));
541
- }
542
- function isContainingBlock(element) {
543
- // TODO: Try and use feature detection here instead
544
- const isFirefox = navigator.userAgent.toLowerCase().includes('firefox');
545
- const css = getComputedStyle$1(element); // This is non-exhaustive but covers the most common CSS properties that
546
- // create a containing block.
547
- // https://developer.mozilla.org/en-US/docs/Web/CSS/Containing_block#identifying_the_containing_block
548
-
549
- return css.transform !== 'none' || css.perspective !== 'none' || css.contain === 'paint' || ['transform', 'perspective'].includes(css.willChange) || isFirefox && css.willChange === 'filter' || isFirefox && (css.filter ? css.filter !== 'none' : false);
550
- }
551
- function isLayoutViewport() {
552
- // Not Safari
553
- return !/^((?!chrome|android).)*safari/i.test(navigator.userAgent); // Feature detection for this fails in various ways
554
- // • Always-visible scrollbar or not
555
- // • Width of <html>, etc.
556
- // const vV = win.visualViewport;
557
- // return vV ? Math.abs(win.innerWidth / vV.scale - vV.width) < 0.5 : true;
558
- }
559
-
560
- const min = Math.min;
561
- const max = Math.max;
562
- const round = Math.round;
563
-
564
- function getBoundingClientRect(element, includeScale, isFixedStrategy) {
565
- if (includeScale === void 0) {
566
- includeScale = false;
567
- }
568
-
569
- if (isFixedStrategy === void 0) {
570
- isFixedStrategy = false;
571
- }
572
-
573
- const clientRect = element.getBoundingClientRect();
574
- let scaleX = 1;
575
- let scaleY = 1;
576
-
577
- if (includeScale && isHTMLElement(element)) {
578
- scaleX = element.offsetWidth > 0 ? round(clientRect.width) / element.offsetWidth || 1 : 1;
579
- scaleY = element.offsetHeight > 0 ? round(clientRect.height) / element.offsetHeight || 1 : 1;
580
- }
581
-
582
- const win = isElement(element) ? getWindow(element) : window;
583
- const addVisualOffsets = !isLayoutViewport() && isFixedStrategy;
584
- const x = (clientRect.left + (addVisualOffsets ? win.visualViewport.offsetLeft : 0)) / scaleX;
585
- const y = (clientRect.top + (addVisualOffsets ? win.visualViewport.offsetTop : 0)) / scaleY;
586
- const width = clientRect.width / scaleX;
587
- const height = clientRect.height / scaleY;
588
- return {
589
- width,
590
- height,
591
- top: y,
592
- right: x + width,
593
- bottom: y + height,
594
- left: x,
595
- x,
596
- y
597
- };
598
- }
599
-
600
- function getDocumentElement(node) {
601
- return ((isNode(node) ? node.ownerDocument : node.document) || window.document).documentElement;
602
- }
603
-
604
- function getNodeScroll(element) {
605
- if (isWindow(element)) {
606
- return {
607
- scrollLeft: element.pageXOffset,
608
- scrollTop: element.pageYOffset
609
- };
610
- }
611
-
612
- return {
613
- scrollLeft: element.scrollLeft,
614
- scrollTop: element.scrollTop
615
- };
616
- }
617
-
618
- function getWindowScrollBarX(element) {
619
- // If <html> has a CSS width greater than the viewport, then this will be
620
- // incorrect for RTL.
621
- return getBoundingClientRect(getDocumentElement(element)).left + getNodeScroll(element).scrollLeft;
622
- }
623
-
624
- function isScaled(element) {
625
- const rect = getBoundingClientRect(element);
626
- return round(rect.width) !== element.offsetWidth || round(rect.height) !== element.offsetHeight;
627
- }
628
-
629
- function getRectRelativeToOffsetParent(element, offsetParent, strategy) {
630
- const isOffsetParentAnElement = isHTMLElement(offsetParent);
631
- const documentElement = getDocumentElement(offsetParent);
632
- const rect = getBoundingClientRect(element, isOffsetParentAnElement && isScaled(offsetParent), strategy === 'fixed');
633
- let scroll = {
634
- scrollLeft: 0,
635
- scrollTop: 0
636
- };
637
- const offsets = {
638
- x: 0,
639
- y: 0
640
- };
641
-
642
- if (isOffsetParentAnElement || !isOffsetParentAnElement && strategy !== 'fixed') {
643
- if (getNodeName(offsetParent) !== 'body' || isOverflowElement(documentElement)) {
644
- scroll = getNodeScroll(offsetParent);
645
- }
646
-
647
- if (isHTMLElement(offsetParent)) {
648
- const offsetRect = getBoundingClientRect(offsetParent, true);
649
- offsets.x = offsetRect.x + offsetParent.clientLeft;
650
- offsets.y = offsetRect.y + offsetParent.clientTop;
651
- } else if (documentElement) {
652
- offsets.x = getWindowScrollBarX(documentElement);
653
- }
654
- }
655
-
656
- return {
657
- x: rect.left + scroll.scrollLeft - offsets.x,
658
- y: rect.top + scroll.scrollTop - offsets.y,
659
- width: rect.width,
660
- height: rect.height
661
- };
662
- }
663
-
664
- function getParentNode(node) {
665
- if (getNodeName(node) === 'html') {
666
- return node;
667
- }
668
-
669
- return (// this is a quicker (but less type safe) way to save quite some bytes from the bundle
670
- // @ts-ignore
671
- node.assignedSlot || // step into the shadow DOM of the parent of a slotted node
672
- node.parentNode || ( // DOM Element detected
673
- isShadowRoot(node) ? node.host : null) || // ShadowRoot detected
674
- getDocumentElement(node) // fallback
675
-
676
- );
677
- }
678
-
679
- function getTrueOffsetParent(element) {
680
- if (!isHTMLElement(element) || getComputedStyle(element).position === 'fixed') {
681
- return null;
682
- }
683
-
684
- return element.offsetParent;
685
- }
686
-
687
- function getContainingBlock(element) {
688
- let currentNode = getParentNode(element);
689
-
690
- if (isShadowRoot(currentNode)) {
691
- currentNode = currentNode.host;
692
- }
693
-
694
- while (isHTMLElement(currentNode) && !['html', 'body'].includes(getNodeName(currentNode))) {
695
- if (isContainingBlock(currentNode)) {
696
- return currentNode;
697
- } else {
698
- currentNode = currentNode.parentNode;
699
- }
700
- }
701
-
702
- return null;
703
- } // Gets the closest ancestor positioned element. Handles some edge cases,
704
- // such as table ancestors and cross browser bugs.
705
-
706
-
707
- function getOffsetParent(element) {
708
- const window = getWindow(element);
709
- let offsetParent = getTrueOffsetParent(element);
710
-
711
- while (offsetParent && isTableElement(offsetParent) && getComputedStyle(offsetParent).position === 'static') {
712
- offsetParent = getTrueOffsetParent(offsetParent);
713
- }
714
-
715
- if (offsetParent && (getNodeName(offsetParent) === 'html' || getNodeName(offsetParent) === 'body' && getComputedStyle(offsetParent).position === 'static' && !isContainingBlock(offsetParent))) {
716
- return window;
717
- }
718
-
719
- return offsetParent || getContainingBlock(element) || window;
720
- }
721
-
722
- function getDimensions(element) {
723
- if (isHTMLElement(element)) {
724
- return {
725
- width: element.offsetWidth,
726
- height: element.offsetHeight
727
- };
728
- }
729
-
730
- const rect = getBoundingClientRect(element);
731
- return {
732
- width: rect.width,
733
- height: rect.height
734
- };
735
- }
736
-
737
- function convertOffsetParentRelativeRectToViewportRelativeRect(_ref) {
738
- let {
739
- rect,
740
- offsetParent,
741
- strategy
742
- } = _ref;
743
- const isOffsetParentAnElement = isHTMLElement(offsetParent);
744
- const documentElement = getDocumentElement(offsetParent);
745
-
746
- if (offsetParent === documentElement) {
747
- return rect;
748
- }
749
-
750
- let scroll = {
751
- scrollLeft: 0,
752
- scrollTop: 0
753
- };
754
- const offsets = {
755
- x: 0,
756
- y: 0
757
- };
758
-
759
- if (isOffsetParentAnElement || !isOffsetParentAnElement && strategy !== 'fixed') {
760
- if (getNodeName(offsetParent) !== 'body' || isOverflowElement(documentElement)) {
761
- scroll = getNodeScroll(offsetParent);
762
- }
763
-
764
- if (isHTMLElement(offsetParent)) {
765
- const offsetRect = getBoundingClientRect(offsetParent, true);
766
- offsets.x = offsetRect.x + offsetParent.clientLeft;
767
- offsets.y = offsetRect.y + offsetParent.clientTop;
768
- } // This doesn't appear to be need to be negated.
769
- // else if (documentElement) {
770
- // offsets.x = getWindowScrollBarX(documentElement);
771
- // }
772
-
773
- }
774
-
775
- return { ...rect,
776
- x: rect.x - scroll.scrollLeft + offsets.x,
777
- y: rect.y - scroll.scrollTop + offsets.y
778
- };
779
- }
780
-
781
- function getViewportRect(element, strategy) {
782
- const win = getWindow(element);
783
- const html = getDocumentElement(element);
784
- const visualViewport = win.visualViewport;
785
- let width = html.clientWidth;
786
- let height = html.clientHeight;
787
- let x = 0;
788
- let y = 0;
789
-
790
- if (visualViewport) {
791
- width = visualViewport.width;
792
- height = visualViewport.height;
793
- const layoutViewport = isLayoutViewport();
794
-
795
- if (layoutViewport || !layoutViewport && strategy === 'fixed') {
796
- x = visualViewport.offsetLeft;
797
- y = visualViewport.offsetTop;
798
- }
799
- }
800
-
801
- return {
802
- width,
803
- height,
804
- x,
805
- y
806
- };
807
- }
808
-
809
- // of the `<html>` and `<body>` rect bounds if horizontally scrollable
810
-
811
- function getDocumentRect(element) {
812
- var _element$ownerDocumen;
813
-
814
- const html = getDocumentElement(element);
815
- const scroll = getNodeScroll(element);
816
- const body = (_element$ownerDocumen = element.ownerDocument) == null ? void 0 : _element$ownerDocumen.body;
817
- const width = max(html.scrollWidth, html.clientWidth, body ? body.scrollWidth : 0, body ? body.clientWidth : 0);
818
- const height = max(html.scrollHeight, html.clientHeight, body ? body.scrollHeight : 0, body ? body.clientHeight : 0);
819
- let x = -scroll.scrollLeft + getWindowScrollBarX(element);
820
- const y = -scroll.scrollTop;
821
-
822
- if (getComputedStyle$1(body || html).direction === 'rtl') {
823
- x += max(html.clientWidth, body ? body.clientWidth : 0) - width;
824
- }
825
-
826
- return {
827
- width,
828
- height,
829
- x,
830
- y
831
- };
832
- }
833
-
834
- function getNearestOverflowAncestor(node) {
835
- const parentNode = getParentNode(node);
836
-
837
- if (['html', 'body', '#document'].includes(getNodeName(parentNode))) {
838
- // @ts-ignore assume body is always available
839
- return node.ownerDocument.body;
840
- }
841
-
842
- if (isHTMLElement(parentNode) && isOverflowElement(parentNode)) {
843
- return parentNode;
844
- }
845
-
846
- return getNearestOverflowAncestor(parentNode);
847
- }
848
-
849
- function getOverflowAncestors(node, list) {
850
- var _node$ownerDocument;
851
-
852
- if (list === void 0) {
853
- list = [];
854
- }
855
-
856
- const scrollableAncestor = getNearestOverflowAncestor(node);
857
- const isBody = scrollableAncestor === ((_node$ownerDocument = node.ownerDocument) == null ? void 0 : _node$ownerDocument.body);
858
- const win = getWindow(scrollableAncestor);
859
- const target = isBody ? [win].concat(win.visualViewport || [], isOverflowElement(scrollableAncestor) ? scrollableAncestor : []) : scrollableAncestor;
860
- const updatedList = list.concat(target);
861
- return isBody ? updatedList : // @ts-ignore: isBody tells us target will be an HTMLElement here
862
- updatedList.concat(getOverflowAncestors(getParentNode(target)));
863
- }
864
-
865
- function contains(parent, child) {
866
- const rootNode = child.getRootNode == null ? void 0 : child.getRootNode(); // First, attempt with faster native method
867
-
868
- if (parent.contains(child)) {
869
- return true;
870
- } // then fallback to custom implementation with Shadow DOM support
871
- else if (rootNode && isShadowRoot(rootNode)) {
872
- let next = child;
873
-
874
- do {
875
- // use `===` replace node.isSameNode()
876
- if (next && parent === next) {
877
- return true;
878
- } // @ts-ignore: need a better way to handle this...
879
-
880
-
881
- next = next.parentNode || next.host;
882
- } while (next);
883
- }
884
-
885
- return false;
886
- }
887
-
888
- function getInnerBoundingClientRect(element, strategy) {
889
- const clientRect = getBoundingClientRect(element, false, strategy === 'fixed');
890
- const top = clientRect.top + element.clientTop;
891
- const left = clientRect.left + element.clientLeft;
892
- return {
893
- top,
894
- left,
895
- x: left,
896
- y: top,
897
- right: left + element.clientWidth,
898
- bottom: top + element.clientHeight,
899
- width: element.clientWidth,
900
- height: element.clientHeight
901
- };
902
- }
903
-
904
- function getClientRectFromClippingAncestor(element, clippingParent, strategy) {
905
- if (clippingParent === 'viewport') {
906
- return rectToClientRect(getViewportRect(element, strategy));
907
- }
908
-
909
- if (isElement(clippingParent)) {
910
- return getInnerBoundingClientRect(clippingParent, strategy);
911
- }
912
-
913
- return rectToClientRect(getDocumentRect(getDocumentElement(element)));
914
- } // A "clipping ancestor" is an overflowable container with the characteristic of
915
- // clipping (or hiding) overflowing elements with a position different from
916
- // `initial`
917
-
918
-
919
- function getClippingAncestors(element) {
920
- const clippingAncestors = getOverflowAncestors(element);
921
- const canEscapeClipping = ['absolute', 'fixed'].includes(getComputedStyle$1(element).position);
922
- const clipperElement = canEscapeClipping && isHTMLElement(element) ? getOffsetParent(element) : element;
923
-
924
- if (!isElement(clipperElement)) {
925
- return [];
926
- } // @ts-ignore isElement check ensures we return Array<Element>
927
-
928
-
929
- return clippingAncestors.filter(clippingAncestors => isElement(clippingAncestors) && contains(clippingAncestors, clipperElement) && getNodeName(clippingAncestors) !== 'body');
930
- } // Gets the maximum area that the element is visible in due to any number of
931
- // clipping ancestors
932
-
933
-
934
- function getClippingRect(_ref) {
935
- let {
936
- element,
937
- boundary,
938
- rootBoundary,
939
- strategy
940
- } = _ref;
941
- const mainClippingAncestors = boundary === 'clippingAncestors' ? getClippingAncestors(element) : [].concat(boundary);
942
- const clippingAncestors = [...mainClippingAncestors, rootBoundary];
943
- const firstClippingAncestor = clippingAncestors[0];
944
- const clippingRect = clippingAncestors.reduce((accRect, clippingAncestor) => {
945
- const rect = getClientRectFromClippingAncestor(element, clippingAncestor, strategy);
946
- accRect.top = max(rect.top, accRect.top);
947
- accRect.right = min(rect.right, accRect.right);
948
- accRect.bottom = min(rect.bottom, accRect.bottom);
949
- accRect.left = max(rect.left, accRect.left);
950
- return accRect;
951
- }, getClientRectFromClippingAncestor(element, firstClippingAncestor, strategy));
952
- return {
953
- width: clippingRect.right - clippingRect.left,
954
- height: clippingRect.bottom - clippingRect.top,
955
- x: clippingRect.left,
956
- y: clippingRect.top
957
- };
958
- }
959
-
960
- const platform = {
961
- getClippingRect,
962
- convertOffsetParentRelativeRectToViewportRelativeRect,
963
- isElement,
964
- getDimensions,
965
- getOffsetParent,
966
- getDocumentElement,
967
- getElementRects: _ref => {
968
- let {
969
- reference,
970
- floating,
971
- strategy
972
- } = _ref;
973
- return {
974
- reference: getRectRelativeToOffsetParent(reference, getOffsetParent(floating), strategy),
975
- floating: { ...getDimensions(floating),
976
- x: 0,
977
- y: 0
978
- }
979
- };
980
- },
981
- getClientRects: element => Array.from(element.getClientRects()),
982
- isRTL: element => getComputedStyle$1(element).direction === 'rtl'
983
- };
984
-
985
- /**
986
- * Automatically updates the position of the floating element when necessary.
987
- * @see https://floating-ui.com/docs/autoUpdate
988
- */
989
- function autoUpdate(reference, floating, update, options) {
990
- if (options === void 0) {
991
- options = {};
992
- }
993
-
994
- const {
995
- ancestorScroll: _ancestorScroll = true,
996
- ancestorResize: _ancestorResize = true,
997
- elementResize: _elementResize = true,
998
- animationFrame = false
999
- } = options;
1000
- let cleanedUp = false;
1001
- const ancestorScroll = _ancestorScroll && !animationFrame;
1002
- const ancestorResize = _ancestorResize && !animationFrame;
1003
- const elementResize = _elementResize && !animationFrame;
1004
- const ancestors = ancestorScroll || ancestorResize ? [...(isElement(reference) ? getOverflowAncestors(reference) : []), ...getOverflowAncestors(floating)] : [];
1005
- ancestors.forEach(ancestor => {
1006
- ancestorScroll && ancestor.addEventListener('scroll', update, {
1007
- passive: true
1008
- });
1009
- ancestorResize && ancestor.addEventListener('resize', update);
1010
- });
1011
- let observer = null;
1012
-
1013
- if (elementResize) {
1014
- observer = new ResizeObserver(update);
1015
- isElement(reference) && observer.observe(reference);
1016
- observer.observe(floating);
1017
- }
1018
-
1019
- let frameId;
1020
- let prevRefRect = animationFrame ? getBoundingClientRect(reference) : null;
1021
-
1022
- if (animationFrame) {
1023
- frameLoop();
1024
- }
1025
-
1026
- function frameLoop() {
1027
- if (cleanedUp) {
1028
- return;
1029
- }
1030
-
1031
- const nextRefRect = getBoundingClientRect(reference);
1032
-
1033
- if (prevRefRect && (nextRefRect.x !== prevRefRect.x || nextRefRect.y !== prevRefRect.y || nextRefRect.width !== prevRefRect.width || nextRefRect.height !== prevRefRect.height)) {
1034
- update();
1035
- }
1036
-
1037
- prevRefRect = nextRefRect;
1038
- frameId = requestAnimationFrame(frameLoop);
1039
- }
1040
-
1041
- return () => {
1042
- var _observer;
1043
-
1044
- cleanedUp = true;
1045
- ancestors.forEach(ancestor => {
1046
- ancestorScroll && ancestor.removeEventListener('scroll', update);
1047
- ancestorResize && ancestor.removeEventListener('resize', update);
1048
- });
1049
- (_observer = observer) == null ? void 0 : _observer.disconnect();
1050
- observer = null;
1051
-
1052
- if (animationFrame) {
1053
- cancelAnimationFrame(frameId);
1054
- }
1055
- };
1056
- }
1057
-
1058
- /**
1059
- * Computes the `x` and `y` coordinates that will place the floating element
1060
- * next to a reference element when it is given a certain CSS positioning
1061
- * strategy.
1062
- */
1063
-
1064
- const computePosition = (reference, floating, options) => computePosition$1(reference, floating, {
1065
- platform,
1066
- ...options
1067
- });
1068
-
1069
- /*!
1070
- * tabbable 5.3.1
1071
- * @license MIT, https://github.com/focus-trap/tabbable/blob/master/LICENSE
1072
- */
1073
- var candidateSelectors = ['input', 'select', 'textarea', 'a[href]', 'button', '[tabindex]:not(slot)', 'audio[controls]', 'video[controls]', '[contenteditable]:not([contenteditable="false"])', 'details>summary:first-of-type', 'details'];
1074
- var candidateSelector = /* #__PURE__ */candidateSelectors.join(',');
1075
- var NoElement = typeof Element === 'undefined';
1076
- var matches = NoElement ? function () {} : Element.prototype.matches || Element.prototype.msMatchesSelector || Element.prototype.webkitMatchesSelector;
1077
- var getRootNode = !NoElement && Element.prototype.getRootNode ? function (element) {
1078
- return element.getRootNode();
1079
- } : function (element) {
1080
- return element.ownerDocument;
1081
- };
1082
- /**
1083
- * @param {Element} el container to check in
1084
- * @param {boolean} includeContainer add container to check
1085
- * @param {(node: Element) => boolean} filter filter candidates
1086
- * @returns {Element[]}
1087
- */
1088
-
1089
- var getCandidates = function getCandidates(el, includeContainer, filter) {
1090
- var candidates = Array.prototype.slice.apply(el.querySelectorAll(candidateSelector));
1091
-
1092
- if (includeContainer && matches.call(el, candidateSelector)) {
1093
- candidates.unshift(el);
1094
- }
1095
-
1096
- candidates = candidates.filter(filter);
1097
- return candidates;
1098
- };
1099
- /**
1100
- * @callback GetShadowRoot
1101
- * @param {Element} element to check for shadow root
1102
- * @returns {ShadowRoot|boolean} ShadowRoot if available or boolean indicating if a shadowRoot is attached but not available.
1103
- */
1104
-
1105
- /**
1106
- * @typedef {Object} CandidatesScope
1107
- * @property {Element} scope contains inner candidates
1108
- * @property {Element[]} candidates
1109
- */
1110
-
1111
- /**
1112
- * @typedef {Object} IterativeOptions
1113
- * @property {GetShadowRoot|boolean} getShadowRoot true if shadow support is enabled; falsy if not;
1114
- * if a function, implies shadow support is enabled and either returns the shadow root of an element
1115
- * or a boolean stating if it has an undisclosed shadow root
1116
- * @property {(node: Element) => boolean} filter filter candidates
1117
- * @property {boolean} flatten if true then result will flatten any CandidatesScope into the returned list
1118
- */
1119
-
1120
- /**
1121
- * @param {Element[]} elements list of element containers to match candidates from
1122
- * @param {boolean} includeContainer add container list to check
1123
- * @param {IterativeOptions} options
1124
- * @returns {Array.<Element|CandidatesScope>}
1125
- */
1126
-
1127
-
1128
- var getCandidatesIteratively = function getCandidatesIteratively(elements, includeContainer, options) {
1129
- var candidates = [];
1130
- var elementsToCheck = Array.from(elements);
1131
-
1132
- while (elementsToCheck.length) {
1133
- var element = elementsToCheck.shift();
1134
-
1135
- if (element.tagName === 'SLOT') {
1136
- // add shadow dom slot scope (slot itself cannot be focusable)
1137
- var assigned = element.assignedElements();
1138
- var content = assigned.length ? assigned : element.children;
1139
- var nestedCandidates = getCandidatesIteratively(content, true, options);
1140
-
1141
- if (options.flatten) {
1142
- candidates.push.apply(candidates, nestedCandidates);
1143
- } else {
1144
- candidates.push({
1145
- scope: element,
1146
- candidates: nestedCandidates
1147
- });
1148
- }
1149
- } else {
1150
- // check candidate element
1151
- var validCandidate = matches.call(element, candidateSelector);
1152
-
1153
- if (validCandidate && options.filter(element) && (includeContainer || !elements.includes(element))) {
1154
- candidates.push(element);
1155
- } // iterate over shadow content if possible
1156
-
1157
-
1158
- var shadowRoot = element.shadowRoot || // check for an undisclosed shadow
1159
- typeof options.getShadowRoot === 'function' && options.getShadowRoot(element);
1160
-
1161
- if (shadowRoot) {
1162
- // add shadow dom scope IIF a shadow root node was given; otherwise, an undisclosed
1163
- // shadow exists, so look at light dom children as fallback BUT create a scope for any
1164
- // child candidates found because they're likely slotted elements (elements that are
1165
- // children of the web component element (which has the shadow), in the light dom, but
1166
- // slotted somewhere _inside_ the undisclosed shadow) -- the scope is created below,
1167
- // _after_ we return from this recursive call
1168
- var _nestedCandidates = getCandidatesIteratively(shadowRoot === true ? element.children : shadowRoot.children, true, options);
1169
-
1170
- if (options.flatten) {
1171
- candidates.push.apply(candidates, _nestedCandidates);
1172
- } else {
1173
- candidates.push({
1174
- scope: element,
1175
- candidates: _nestedCandidates
1176
- });
1177
- }
1178
- } else {
1179
- // there's not shadow so just dig into the element's (light dom) children
1180
- // __without__ giving the element special scope treatment
1181
- elementsToCheck.unshift.apply(elementsToCheck, element.children);
1182
- }
1183
- }
1184
- }
1185
-
1186
- return candidates;
1187
- };
1188
-
1189
- var getTabindex = function getTabindex(node, isScope) {
1190
- if (node.tabIndex < 0) {
1191
- // in Chrome, <details/>, <audio controls/> and <video controls/> elements get a default
1192
- // `tabIndex` of -1 when the 'tabindex' attribute isn't specified in the DOM,
1193
- // yet they are still part of the regular tab order; in FF, they get a default
1194
- // `tabIndex` of 0; since Chrome still puts those elements in the regular tab
1195
- // order, consider their tab index to be 0.
1196
- // Also browsers do not return `tabIndex` correctly for contentEditable nodes;
1197
- // so if they don't have a tabindex attribute specifically set, assume it's 0.
1198
- //
1199
- // isScope is positive for custom element with shadow root or slot that by default
1200
- // have tabIndex -1, but need to be sorted by document order in order for their
1201
- // content to be inserted in the correct position
1202
- if ((isScope || /^(AUDIO|VIDEO|DETAILS)$/.test(node.tagName) || node.isContentEditable) && isNaN(parseInt(node.getAttribute('tabindex'), 10))) {
1203
- return 0;
1204
- }
1205
- }
1206
-
1207
- return node.tabIndex;
1208
- };
1209
-
1210
- var sortOrderedTabbables = function sortOrderedTabbables(a, b) {
1211
- return a.tabIndex === b.tabIndex ? a.documentOrder - b.documentOrder : a.tabIndex - b.tabIndex;
1212
- };
1213
-
1214
- var isInput = function isInput(node) {
1215
- return node.tagName === 'INPUT';
1216
- };
1217
-
1218
- var isHiddenInput = function isHiddenInput(node) {
1219
- return isInput(node) && node.type === 'hidden';
1220
- };
1221
-
1222
- var isDetailsWithSummary = function isDetailsWithSummary(node) {
1223
- var r = node.tagName === 'DETAILS' && Array.prototype.slice.apply(node.children).some(function (child) {
1224
- return child.tagName === 'SUMMARY';
1225
- });
1226
- return r;
1227
- };
1228
-
1229
- var getCheckedRadio = function getCheckedRadio(nodes, form) {
1230
- for (var i = 0; i < nodes.length; i++) {
1231
- if (nodes[i].checked && nodes[i].form === form) {
1232
- return nodes[i];
1233
- }
1234
- }
1235
- };
1236
-
1237
- var isTabbableRadio = function isTabbableRadio(node) {
1238
- if (!node.name) {
1239
- return true;
1240
- }
1241
-
1242
- var radioScope = node.form || getRootNode(node);
1243
-
1244
- var queryRadios = function queryRadios(name) {
1245
- return radioScope.querySelectorAll('input[type="radio"][name="' + name + '"]');
1246
- };
1247
-
1248
- var radioSet;
1249
-
1250
- if (typeof window !== 'undefined' && typeof window.CSS !== 'undefined' && typeof window.CSS.escape === 'function') {
1251
- radioSet = queryRadios(window.CSS.escape(node.name));
1252
- } else {
1253
- try {
1254
- radioSet = queryRadios(node.name);
1255
- } catch (err) {
1256
- // eslint-disable-next-line no-console
1257
- console.error('Looks like you have a radio button with a name attribute containing invalid CSS selector characters and need the CSS.escape polyfill: %s', err.message);
1258
- return false;
1259
- }
1260
- }
1261
-
1262
- var checked = getCheckedRadio(radioSet, node.form);
1263
- return !checked || checked === node;
1264
- };
1265
-
1266
- var isRadio = function isRadio(node) {
1267
- return isInput(node) && node.type === 'radio';
1268
- };
1269
-
1270
- var isNonTabbableRadio = function isNonTabbableRadio(node) {
1271
- return isRadio(node) && !isTabbableRadio(node);
1272
- };
1273
-
1274
- var isZeroArea = function isZeroArea(node) {
1275
- var _node$getBoundingClie = node.getBoundingClientRect(),
1276
- width = _node$getBoundingClie.width,
1277
- height = _node$getBoundingClie.height;
1278
-
1279
- return width === 0 && height === 0;
1280
- };
1281
-
1282
- var isHidden = function isHidden(node, _ref) {
1283
- var displayCheck = _ref.displayCheck,
1284
- getShadowRoot = _ref.getShadowRoot;
1285
-
1286
- if (getComputedStyle(node).visibility === 'hidden') {
1287
- return true;
1288
- }
1289
-
1290
- var isDirectSummary = matches.call(node, 'details>summary:first-of-type');
1291
- var nodeUnderDetails = isDirectSummary ? node.parentElement : node;
1292
-
1293
- if (matches.call(nodeUnderDetails, 'details:not([open]) *')) {
1294
- return true;
1295
- }
1296
-
1297
- if (!displayCheck || displayCheck === 'full') {
1298
- if (typeof getShadowRoot === 'function') {
1299
- // figure out if we should consider the node to be in an undisclosed shadow and use the
1300
- // 'non-zero-area' fallback
1301
- var originalNode = node;
1302
-
1303
- while (node) {
1304
- var parentElement = node.parentElement;
1305
- var rootNode = getRootNode(node);
1306
-
1307
- if (parentElement && !parentElement.shadowRoot && getShadowRoot(parentElement) === true // check if there's an undisclosed shadow
1308
- ) {
1309
- // node has an undisclosed shadow which means we can only treat it as a black box, so we
1310
- // fall back to a non-zero-area test
1311
- return isZeroArea(node);
1312
- } else if (node.assignedSlot) {
1313
- // iterate up slot
1314
- node = node.assignedSlot;
1315
- } else if (!parentElement && rootNode !== node.ownerDocument) {
1316
- // cross shadow boundary
1317
- node = rootNode.host;
1318
- } else {
1319
- // iterate up normal dom
1320
- node = parentElement;
1321
- }
1322
- }
1323
-
1324
- node = originalNode;
1325
- } // else, `getShadowRoot` might be true, but all that does is enable shadow DOM support
1326
- // (i.e. it does not also presume that all nodes might have undisclosed shadows); or
1327
- // it might be a falsy value, which means shadow DOM support is disabled
1328
- // didn't find it sitting in an undisclosed shadow (or shadows are disabled) so now we
1329
- // can just test to see if it would normally be visible or not
1330
- // this works wherever the node is: if there's at least one client rect, it's
1331
- // somehow displayed; it also covers the CSS 'display: contents' case where the
1332
- // node itself is hidden in place of its contents; and there's no need to search
1333
- // up the hierarchy either
1334
-
1335
-
1336
- return !node.getClientRects().length;
1337
- } else if (displayCheck === 'non-zero-area') {
1338
- return isZeroArea(node);
1339
- }
1340
-
1341
- return false;
1342
- }; // form fields (nested) inside a disabled fieldset are not focusable/tabbable
1343
- // unless they are in the _first_ <legend> element of the top-most disabled
1344
- // fieldset
1345
-
1346
-
1347
- var isDisabledFromFieldset = function isDisabledFromFieldset(node) {
1348
- if (/^(INPUT|BUTTON|SELECT|TEXTAREA)$/.test(node.tagName)) {
1349
- var parentNode = node.parentElement; // check if `node` is contained in a disabled <fieldset>
1350
-
1351
- while (parentNode) {
1352
- if (parentNode.tagName === 'FIELDSET' && parentNode.disabled) {
1353
- // look for the first <legend> among the children of the disabled <fieldset>
1354
- for (var i = 0; i < parentNode.children.length; i++) {
1355
- var child = parentNode.children.item(i); // when the first <legend> (in document order) is found
1356
-
1357
- if (child.tagName === 'LEGEND') {
1358
- // if its parent <fieldset> is not nested in another disabled <fieldset>,
1359
- // return whether `node` is a descendant of its first <legend>
1360
- return matches.call(parentNode, 'fieldset[disabled] *') ? true : !child.contains(node);
1361
- }
1362
- } // the disabled <fieldset> containing `node` has no <legend>
1363
-
1364
-
1365
- return true;
1366
- }
1367
-
1368
- parentNode = parentNode.parentElement;
1369
- }
1370
- } // else, node's tabbable/focusable state should not be affected by a fieldset's
1371
- // enabled/disabled state
1372
-
1373
-
1374
- return false;
1375
- };
1376
-
1377
- var isNodeMatchingSelectorFocusable = function isNodeMatchingSelectorFocusable(options, node) {
1378
- if (node.disabled || isHiddenInput(node) || isHidden(node, options) || // For a details element with a summary, the summary element gets the focus
1379
- isDetailsWithSummary(node) || isDisabledFromFieldset(node)) {
1380
- return false;
1381
- }
1382
-
1383
- return true;
1384
- };
1385
-
1386
- var isNodeMatchingSelectorTabbable = function isNodeMatchingSelectorTabbable(options, node) {
1387
- if (isNonTabbableRadio(node) || getTabindex(node) < 0 || !isNodeMatchingSelectorFocusable(options, node)) {
1388
- return false;
1389
- }
1390
-
1391
- return true;
1392
- };
1393
- /**
1394
- * @param {Array.<Element|CandidatesScope>} candidates
1395
- * @returns Element[]
1396
- */
1397
-
1398
-
1399
- var sortByOrder = function sortByOrder(candidates) {
1400
- var regularTabbables = [];
1401
- var orderedTabbables = [];
1402
- candidates.forEach(function (item, i) {
1403
- var isScope = !!item.scope;
1404
- var element = isScope ? item.scope : item;
1405
- var candidateTabindex = getTabindex(element, isScope);
1406
- var elements = isScope ? sortByOrder(item.candidates) : element;
1407
-
1408
- if (candidateTabindex === 0) {
1409
- isScope ? regularTabbables.push.apply(regularTabbables, elements) : regularTabbables.push(element);
1410
- } else {
1411
- orderedTabbables.push({
1412
- documentOrder: i,
1413
- tabIndex: candidateTabindex,
1414
- item: item,
1415
- isScope: isScope,
1416
- content: elements
1417
- });
1418
- }
1419
- });
1420
- return orderedTabbables.sort(sortOrderedTabbables).reduce(function (acc, sortable) {
1421
- sortable.isScope ? acc.push.apply(acc, sortable.content) : acc.push(sortable.content);
1422
- return acc;
1423
- }, []).concat(regularTabbables);
1424
- };
1425
-
1426
- var tabbable = function tabbable(el, options) {
1427
- options = options || {};
1428
- var candidates;
1429
-
1430
- if (options.getShadowRoot) {
1431
- candidates = getCandidatesIteratively([el], options.includeContainer, {
1432
- filter: isNodeMatchingSelectorTabbable.bind(null, options),
1433
- flatten: false,
1434
- getShadowRoot: options.getShadowRoot
1435
- });
1436
- } else {
1437
- candidates = getCandidates(el, options.includeContainer, isNodeMatchingSelectorTabbable.bind(null, options));
1438
- }
1439
-
1440
- return sortByOrder(candidates);
1441
- };
1442
-
1443
- var focusable = function focusable(el, options) {
1444
- options = options || {};
1445
- var candidates;
1446
-
1447
- if (options.getShadowRoot) {
1448
- candidates = getCandidatesIteratively([el], options.includeContainer, {
1449
- filter: isNodeMatchingSelectorFocusable.bind(null, options),
1450
- flatten: true,
1451
- getShadowRoot: options.getShadowRoot
1452
- });
1453
- } else {
1454
- candidates = getCandidates(el, options.includeContainer, isNodeMatchingSelectorFocusable.bind(null, options));
1455
- }
1456
-
1457
- return candidates;
1458
- };
1459
-
1460
- var isTabbable = function isTabbable(node, options) {
1461
- options = options || {};
1462
-
1463
- if (!node) {
1464
- throw new Error('No node provided');
1465
- }
1466
-
1467
- if (matches.call(node, candidateSelector) === false) {
1468
- return false;
1469
- }
1470
-
1471
- return isNodeMatchingSelectorTabbable(options, node);
1472
- };
1473
-
1474
- var focusableCandidateSelector = /* #__PURE__ */candidateSelectors.concat('iframe').join(',');
1475
-
1476
- var isFocusable = function isFocusable(node, options) {
1477
- options = options || {};
1478
-
1479
- if (!node) {
1480
- throw new Error('No node provided');
1481
- }
1482
-
1483
- if (matches.call(node, focusableCandidateSelector) === false) {
1484
- return false;
1485
- }
1486
-
1487
- return isNodeMatchingSelectorFocusable(options, node);
1488
- };
1489
-
1490
- const firstTabbable = (container) => {
1491
- return (container ? tabbable(container, { includeContainer: true, getShadowRoot: true }) : []).shift();
1492
- };
1493
-
1494
- export { isFocusable as a, firstTabbable as b, autoUpdate as c, computePosition as d, flip as e, focusable as f, isTabbable as i, offset as o, tabbable as t };
1495
-
1496
- //# sourceMappingURL=first-tabbable.js.map