@vonage/vivid 3.0.0 → 3.1.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 (337) hide show
  1. package/README.md +176 -4
  2. package/accordion/index.js +22 -61
  3. package/accordion-item/index.js +16 -118
  4. package/action-group/index.js +5 -0
  5. package/avatar/index.js +11 -0
  6. package/badge/index.js +9 -53
  7. package/banner/index.js +20 -210
  8. package/breadcrumb/index.js +7 -96
  9. package/breadcrumb-item/index.js +15 -46
  10. package/button/index.js +19 -751
  11. package/calendar/index.js +6 -1520
  12. package/calendar-event/index.js +9 -0
  13. package/card/index.js +10 -133
  14. package/checkbox/index.js +16 -0
  15. package/combobox/index.js +35 -0
  16. package/custom-elements.json +6214 -0
  17. package/data-grid/index.js +1104 -0
  18. package/dialog/index.js +24 -0
  19. package/divider/index.js +6 -0
  20. package/elevation/index.js +4 -30
  21. package/fab/index.js +22 -0
  22. package/focus/index.js +4 -2
  23. package/header/index.js +6 -0
  24. package/icon/index.js +8 -36
  25. package/index.js +77 -26
  26. package/layout/index.js +4 -52
  27. package/lib/accordion/accordion.d.ts +3 -7
  28. package/lib/accordion/accordion.template.d.ts +1 -2
  29. package/lib/accordion/definition.d.ts +1 -0
  30. package/lib/accordion/index.d.ts +1 -2
  31. package/lib/accordion-item/accordion-item.d.ts +2 -6
  32. package/lib/accordion-item/accordion-item.template.d.ts +4 -4
  33. package/lib/accordion-item/definition.d.ts +1 -0
  34. package/lib/accordion-item/index.d.ts +1 -3
  35. package/lib/action-group/action-group.d.ts +10 -0
  36. package/lib/{sidenav-item/sidenav-item.template.d.ts → action-group/action-group.template.d.ts} +2 -2
  37. package/lib/action-group/definition.d.ts +1 -0
  38. package/lib/action-group/index.d.ts +1 -0
  39. package/lib/avatar/avatar.d.ts +15 -0
  40. package/lib/avatar/avatar.template.d.ts +4 -0
  41. package/lib/avatar/definition.d.ts +1 -0
  42. package/lib/avatar/index.d.ts +1 -0
  43. package/lib/badge/badge.d.ts +2 -4
  44. package/lib/badge/definition.d.ts +3 -0
  45. package/lib/badge/index.d.ts +1 -3
  46. package/lib/banner/banner.d.ts +1 -1
  47. package/lib/banner/banner.template.d.ts +0 -2
  48. package/lib/banner/definition.d.ts +1 -0
  49. package/lib/banner/index.d.ts +1 -2
  50. package/lib/breadcrumb/breadcrumb.template.d.ts +4 -0
  51. package/lib/breadcrumb/definition.d.ts +1 -0
  52. package/lib/breadcrumb/index.d.ts +1 -2
  53. package/lib/breadcrumb-item/definition.d.ts +1 -0
  54. package/lib/breadcrumb-item/index.d.ts +1 -3
  55. package/lib/button/button.d.ts +3 -2
  56. package/lib/button/definition.d.ts +1 -0
  57. package/lib/button/index.d.ts +1 -21
  58. package/lib/calendar/calendar.d.ts +3 -1
  59. package/lib/calendar/definition.d.ts +1 -0
  60. package/lib/calendar/index.d.ts +1 -3
  61. package/lib/calendar-event/calendar-event.d.ts +14 -0
  62. package/lib/calendar-event/calendar-event.template.d.ts +4 -0
  63. package/lib/calendar-event/definition.d.ts +1 -0
  64. package/lib/calendar-event/index.d.ts +1 -0
  65. package/lib/card/card.d.ts +2 -2
  66. package/lib/card/definition.d.ts +1 -0
  67. package/lib/card/index.d.ts +1 -5
  68. package/lib/checkbox/checkbox.d.ts +5 -0
  69. package/lib/checkbox/checkbox.template.d.ts +4 -0
  70. package/lib/checkbox/definition.d.ts +1 -0
  71. package/lib/checkbox/index.d.ts +1 -0
  72. package/lib/combobox/combobox.d.ts +14 -0
  73. package/lib/combobox/combobox.template.d.ts +4 -0
  74. package/lib/combobox/definition.d.ts +3 -0
  75. package/lib/combobox/index.d.ts +1 -0
  76. package/lib/components.d.ts +44 -16
  77. package/lib/data-grid/data-grid-cell.d.ts +5 -0
  78. package/lib/data-grid/data-grid-cell.template.d.ts +4 -0
  79. package/lib/data-grid/data-grid-row.d.ts +3 -0
  80. package/lib/data-grid/data-grid-row.template.d.ts +3 -0
  81. package/lib/data-grid/data-grid.d.ts +3 -0
  82. package/lib/data-grid/data-grid.options.d.ts +31 -0
  83. package/lib/data-grid/data-grid.template.d.ts +3 -0
  84. package/lib/data-grid/definition.d.ts +6 -0
  85. package/lib/data-grid/index.d.ts +1 -0
  86. package/lib/dialog/definition.d.ts +1 -0
  87. package/lib/dialog/dialog.d.ts +23 -0
  88. package/lib/dialog/dialog.template.d.ts +4 -0
  89. package/lib/dialog/index.d.ts +1 -0
  90. package/lib/divider/definition.d.ts +1 -0
  91. package/lib/divider/divider.d.ts +3 -0
  92. package/lib/divider/divider.template.d.ts +4 -0
  93. package/lib/divider/index.d.ts +1 -0
  94. package/lib/elevation/definition.d.ts +1 -0
  95. package/lib/elevation/elevation.d.ts +1 -0
  96. package/lib/elevation/index.d.ts +1 -2
  97. package/lib/enums.d.ts +19 -6
  98. package/lib/fab/definition.d.ts +3 -0
  99. package/lib/fab/fab.d.ts +13 -0
  100. package/lib/fab/fab.template.d.ts +4 -0
  101. package/lib/fab/index.d.ts +1 -0
  102. package/lib/focus/definition.d.ts +3 -0
  103. package/lib/focus/index.d.ts +1 -2
  104. package/lib/{sidenav-item/index.d.ts → header/definition.d.ts} +2 -2
  105. package/lib/header/header.d.ts +5 -0
  106. package/lib/header/header.template.d.ts +4 -0
  107. package/lib/header/index.d.ts +1 -0
  108. package/lib/icon/definition.d.ts +3 -0
  109. package/lib/icon/icon.d.ts +5 -6
  110. package/lib/icon/index.d.ts +1 -2
  111. package/lib/layout/definition.d.ts +3 -0
  112. package/lib/layout/index.d.ts +1 -2
  113. package/lib/layout/layout.d.ts +4 -4
  114. package/lib/listbox/definition.d.ts +3 -0
  115. package/lib/listbox/index.d.ts +1 -0
  116. package/lib/listbox/listbox.d.ts +6 -0
  117. package/lib/listbox/listbox.template.d.ts +4 -0
  118. package/lib/menu/definition.d.ts +11 -0
  119. package/lib/menu/index.d.ts +1 -0
  120. package/lib/menu/menu.d.ts +10 -0
  121. package/lib/menu/menu.template.d.ts +3 -0
  122. package/lib/menu-item/definition.d.ts +3 -0
  123. package/lib/menu-item/index.d.ts +1 -0
  124. package/lib/menu-item/menu-item.d.ts +8 -0
  125. package/lib/menu-item/menu-item.template.d.ts +5 -0
  126. package/lib/nav/definition.d.ts +3 -0
  127. package/lib/nav/index.d.ts +1 -0
  128. package/lib/nav/nav.d.ts +3 -0
  129. package/lib/nav/nav.template.d.ts +4 -0
  130. package/lib/nav-disclosure/definition.d.ts +3 -0
  131. package/lib/nav-disclosure/index.d.ts +1 -0
  132. package/lib/nav-disclosure/nav-disclosure.d.ts +10 -0
  133. package/lib/nav-disclosure/nav-disclosure.template.d.ts +4 -0
  134. package/lib/nav-item/definition.d.ts +3 -0
  135. package/lib/nav-item/index.d.ts +1 -0
  136. package/lib/{sidenav-item/sidenav-item.d.ts → nav-item/nav-item.d.ts} +2 -2
  137. package/lib/nav-item/nav-item.template.d.ts +4 -0
  138. package/lib/note/definition.d.ts +3 -0
  139. package/lib/note/index.d.ts +1 -0
  140. package/lib/note/note.d.ts +10 -0
  141. package/lib/{text/text.template.d.ts → note/note.template.d.ts} +2 -2
  142. package/lib/number-field/definition.d.ts +4 -0
  143. package/lib/number-field/index.d.ts +1 -0
  144. package/lib/number-field/number-field.d.ts +14 -0
  145. package/lib/number-field/number-field.template.d.ts +4 -0
  146. package/lib/option/definition.d.ts +3 -0
  147. package/lib/option/index.d.ts +1 -0
  148. package/lib/option/option.d.ts +9 -0
  149. package/lib/option/option.template.d.ts +4 -0
  150. package/lib/popup/definition.d.ts +3 -0
  151. package/lib/popup/index.d.ts +1 -4
  152. package/lib/popup/popup.d.ts +8 -4
  153. package/lib/progress/definition.d.ts +3 -0
  154. package/lib/progress/index.d.ts +1 -2
  155. package/lib/progress/progress.d.ts +1 -1
  156. package/lib/progress-ring/definition.d.ts +3 -0
  157. package/lib/progress-ring/index.d.ts +1 -2
  158. package/lib/progress-ring/progress-ring.d.ts +2 -1
  159. package/lib/radio/definition.d.ts +3 -0
  160. package/lib/radio/index.d.ts +1 -0
  161. package/lib/radio/radio.d.ts +4 -0
  162. package/lib/radio/radio.template.d.ts +4 -0
  163. package/lib/radio-group/definition.d.ts +11 -0
  164. package/lib/radio-group/index.d.ts +1 -0
  165. package/lib/radio-group/radio-group.d.ts +4 -0
  166. package/lib/radio-group/radio-group.template.d.ts +4 -0
  167. package/lib/select/definition.d.ts +3 -0
  168. package/lib/select/index.d.ts +1 -0
  169. package/lib/select/select.d.ts +17 -0
  170. package/lib/select/select.template.d.ts +4 -0
  171. package/lib/side-drawer/definition.d.ts +3 -0
  172. package/lib/side-drawer/index.d.ts +1 -2
  173. package/lib/side-drawer/side-drawer.d.ts +3 -2
  174. package/lib/slider/definition.d.ts +3 -0
  175. package/lib/slider/index.d.ts +1 -0
  176. package/lib/slider/slider.d.ts +4 -0
  177. package/lib/slider/slider.template.d.ts +4 -0
  178. package/lib/switch/definition.d.ts +3 -0
  179. package/lib/switch/index.d.ts +1 -0
  180. package/lib/switch/switch.d.ts +7 -0
  181. package/lib/switch/switch.template.d.ts +4 -0
  182. package/lib/tab/definition.d.ts +3 -0
  183. package/lib/tab/index.d.ts +1 -0
  184. package/lib/tab/tab.d.ts +9 -0
  185. package/lib/tab/tab.template.d.ts +3 -0
  186. package/lib/tab-panel/definition.d.ts +3 -0
  187. package/lib/tab-panel/index.d.ts +1 -0
  188. package/lib/tab-panel/tab-panel.d.ts +3 -0
  189. package/lib/tab-panel/tab-panel.template.d.ts +2 -0
  190. package/lib/tabs/definition.d.ts +3 -0
  191. package/lib/tabs/index.d.ts +1 -0
  192. package/lib/tabs/tabs.d.ts +10 -0
  193. package/lib/tabs/tabs.template.d.ts +2 -0
  194. package/lib/text-anchor/definition.d.ts +3 -0
  195. package/lib/text-anchor/index.d.ts +1 -2
  196. package/lib/text-area/definition.d.ts +3 -0
  197. package/lib/text-area/index.d.ts +1 -0
  198. package/lib/text-area/text-area.d.ts +9 -0
  199. package/lib/text-area/text-area.template.d.ts +4 -0
  200. package/lib/text-field/definition.d.ts +3 -0
  201. package/lib/text-field/index.d.ts +1 -0
  202. package/lib/text-field/text-field.d.ts +14 -0
  203. package/lib/text-field/text-field.template.d.ts +4 -0
  204. package/lib/tooltip/definition.d.ts +3 -0
  205. package/lib/tooltip/index.d.ts +1 -3
  206. package/lib/tooltip/tooltip.d.ts +6 -6
  207. package/listbox/index.js +27 -0
  208. package/menu/index.js +30 -0
  209. package/menu-item/index.js +20 -0
  210. package/nav/index.js +4 -0
  211. package/nav-disclosure/index.js +17 -0
  212. package/nav-item/index.js +22 -0
  213. package/note/index.js +15 -0
  214. package/number-field/index.js +459 -0
  215. package/option/index.js +21 -0
  216. package/package.json +21 -11
  217. package/popup/index.js +21 -2062
  218. package/progress/index.js +6 -98
  219. package/progress-ring/index.js +6 -75
  220. package/radio/index.js +12 -0
  221. package/radio-group/index.js +11 -0
  222. package/select/index.js +34 -0
  223. package/shared/affix.js +2 -8
  224. package/shared/anchor.js +10 -2
  225. package/shared/apply-mixins.js +5 -4
  226. package/shared/aria-global.js +2 -86
  227. package/shared/aria.js +9 -0
  228. package/shared/base-progress.js +5 -0
  229. package/shared/breadcrumb-item.js +1 -1
  230. package/shared/button.js +200 -0
  231. package/shared/calendar-event.js +19 -0
  232. package/shared/definition.js +225 -0
  233. package/shared/definition10.js +99 -0
  234. package/shared/definition11.js +48 -0
  235. package/shared/definition12.js +763 -0
  236. package/shared/definition13.js +111 -0
  237. package/shared/definition14.js +114 -0
  238. package/shared/definition15.js +32 -0
  239. package/shared/definition16.js +172 -0
  240. package/shared/definition17.js +727 -0
  241. package/shared/definition18.js +1531 -0
  242. package/shared/definition19.js +261 -0
  243. package/shared/definition2.js +150 -0
  244. package/shared/definition20.js +221 -0
  245. package/shared/definition21.js +78 -0
  246. package/shared/definition22.js +87 -0
  247. package/shared/definition23.js +58 -0
  248. package/shared/definition24.js +44 -0
  249. package/shared/definition25.js +58 -0
  250. package/shared/definition26.js +348 -0
  251. package/shared/definition27.js +363 -0
  252. package/shared/definition28.js +21 -0
  253. package/shared/definition29.js +75 -0
  254. package/shared/definition3.js +29 -0
  255. package/shared/definition30.js +31 -0
  256. package/shared/definition31.js +49 -0
  257. package/shared/definition32.js +94 -0
  258. package/shared/definition33.js +77 -0
  259. package/shared/definition34.js +45 -0
  260. package/shared/definition35.js +435 -0
  261. package/shared/definition36.js +634 -0
  262. package/shared/definition37.js +86 -0
  263. package/shared/definition38.js +592 -0
  264. package/shared/definition39.js +147 -0
  265. package/shared/definition4.js +19 -0
  266. package/shared/definition40.js +67 -0
  267. package/shared/definition41.js +32 -0
  268. package/shared/definition42.js +440 -0
  269. package/shared/definition43.js +282 -0
  270. package/shared/definition44.js +119 -0
  271. package/shared/definition45.js +77 -0
  272. package/shared/definition5.js +38 -0
  273. package/shared/definition6.js +60 -0
  274. package/shared/definition7.js +45 -0
  275. package/shared/definition8.js +113 -0
  276. package/shared/definition9.js +107 -0
  277. package/shared/design-system/index.d.ts +1 -1
  278. package/shared/dialog-polyfill.esm.js +858 -0
  279. package/shared/direction.js +20 -0
  280. package/shared/dom.js +8 -0
  281. package/shared/enums.js +70 -0
  282. package/shared/es.object.assign.js +2 -3
  283. package/shared/es.regexp.to-string.js +59 -0
  284. package/shared/focus.js +5 -0
  285. package/shared/focus2.js +11 -0
  286. package/shared/form-associated.js +466 -0
  287. package/shared/form-elements.js +127 -0
  288. package/shared/icon.js +538 -567
  289. package/shared/index.js +1664 -83
  290. package/shared/key-codes.js +100 -0
  291. package/shared/listbox.js +995 -0
  292. package/shared/numbers.js +34 -0
  293. package/shared/patterns/affix.d.ts +1 -1
  294. package/shared/patterns/focus.d.ts +3 -0
  295. package/shared/patterns/form-elements/form-elements.d.ts +43 -0
  296. package/shared/patterns/form-elements/index.d.ts +1 -0
  297. package/shared/patterns/index.d.ts +2 -0
  298. package/shared/radio.js +127 -0
  299. package/shared/ref.js +41 -0
  300. package/shared/repeat.js +764 -0
  301. package/shared/select.options.js +10 -0
  302. package/shared/slotted.js +1 -1
  303. package/shared/start-end.js +50 -0
  304. package/shared/string-trim.js +40 -0
  305. package/shared/strings.js +9 -0
  306. package/shared/text-anchor.js +0 -2
  307. package/shared/text-anchor.template.js +6 -5
  308. package/shared/text-field.js +3 -0
  309. package/shared/text-field2.js +225 -0
  310. package/shared/to-string.js +51 -0
  311. package/side-drawer/index.js +5 -81
  312. package/slider/index.js +17 -0
  313. package/styles/core/all.css +83 -0
  314. package/styles/core/theme.css +11 -0
  315. package/styles/core/typography.css +77 -0
  316. package/styles/tokens/theme-dark.css +228 -0
  317. package/styles/tokens/theme-light.css +228 -0
  318. package/switch/index.js +18 -0
  319. package/tab/index.js +16 -0
  320. package/tab-panel/index.js +4 -0
  321. package/tabs/index.js +24 -0
  322. package/text-anchor/index.js +11 -6
  323. package/text-area/index.js +23 -0
  324. package/text-field/index.js +24 -0
  325. package/tooltip/index.js +18 -55
  326. package/vivid.api.json +3695 -0
  327. package/lib/text/index.d.ts +0 -2
  328. package/lib/text/text.d.ts +0 -10
  329. package/shared/index2.js +0 -21
  330. package/shared/object-set-prototype-of.js +0 -1009
  331. package/shared/style-inject.es.js +0 -28
  332. package/shared/web.dom-collections.iterator.js +0 -473
  333. package/sidenav-item/index.js +0 -39
  334. package/styles/fonts/spezia.css +0 -23
  335. package/styles/themes/dark.css +0 -205
  336. package/styles/themes/light.css +0 -205
  337. package/text/index.js +0 -46
package/popup/index.js CHANGED
@@ -1,2066 +1,25 @@
1
- import '../elevation/index.js';
2
- import '../button/index.js';
3
- import { F as FoundationElement, c as __classPrivateFieldGet, g as __classPrivateFieldSet, _ as __decorate, a as attr, b as __metadata, h as html, d as designSystem } from '../shared/index.js';
4
- import { t as toString$3, s as speciesConstructor$1, f as functionApply } from '../shared/icon.js';
5
- import { a as objectCreate } from '../shared/web.dom-collections.iterator.js';
6
- import '../shared/es.object.assign.js';
7
- import { b as anObject$3, g as fails$5, i as global$5, x as functionCall, C as functionUncurryThis, T as shared$1, z as internalState, _ as _export, w as wellKnownSymbol$2, r as redefine$1, u as createNonEnumerableProperty$1, M as isObject$1, F as classofRaw, P as requireObjectCoercible$2, U as toIntegerOrInfinity$1, V as toPropertyKey$1, a as objectDefineProperty, m as createPropertyDescriptor$1, I as lengthOfArrayLike$1, W as toAbsoluteIndex$1, k as isCallable$1, X as toLength$1, G as getMethod$1 } from '../shared/object-set-prototype-of.js';
8
- import { s as styleInject } from '../shared/style-inject.es.js';
9
- import { w as when } from '../shared/when.js';
10
- import { r as ref } from '../shared/aria-global.js';
11
- import { c as classNames } from '../shared/class-names.js';
12
- import '../icon/index.js';
1
+ import { r as registerPopup } from '../shared/definition18.js';
2
+ import '../shared/index.js';
3
+ import '../shared/definition9.js';
4
+ import '../shared/definition3.js';
5
+ import '../shared/icon.js';
6
+ import '../shared/to-string.js';
7
+ import '../shared/string-trim.js';
13
8
  import '../shared/_has.js';
14
- import '../shared/index2.js';
9
+ import '../shared/class-names.js';
10
+ import '../shared/when.js';
11
+ import '../shared/definition4.js';
12
+ import '../shared/focus.js';
15
13
  import '../shared/affix.js';
14
+ import '../shared/button.js';
16
15
  import '../shared/apply-mixins.js';
16
+ import '../shared/form-associated.js';
17
+ import '../shared/key-codes.js';
18
+ import '../shared/aria-global.js';
19
+ import '../shared/start-end.js';
20
+ import '../shared/ref.js';
21
+ import '../shared/focus2.js';
22
+ import '../shared/definition15.js';
23
+ import '../shared/es.object.assign.js';
17
24
 
18
- var anObject$2 = anObject$3;
19
-
20
- // `RegExp.prototype.flags` getter implementation
21
- // https://tc39.es/ecma262/#sec-get-regexp.prototype.flags
22
- var regexpFlags$1 = function () {
23
- var that = anObject$2(this);
24
- var result = '';
25
- if (that.global) result += 'g';
26
- if (that.ignoreCase) result += 'i';
27
- if (that.multiline) result += 'm';
28
- if (that.dotAll) result += 's';
29
- if (that.unicode) result += 'u';
30
- if (that.sticky) result += 'y';
31
- return result;
32
- };
33
-
34
- var fails$4 = fails$5;
35
- var global$4 = global$5;
36
-
37
- // babel-minify and Closure Compiler transpiles RegExp('a', 'y') -> /a/y and it causes SyntaxError
38
- var $RegExp$2 = global$4.RegExp;
39
-
40
- var UNSUPPORTED_Y$2 = fails$4(function () {
41
- var re = $RegExp$2('a', 'y');
42
- re.lastIndex = 2;
43
- return re.exec('abcd') != null;
44
- });
45
-
46
- // UC Browser bug
47
- // https://github.com/zloirock/core-js/issues/1008
48
- var MISSED_STICKY = UNSUPPORTED_Y$2 || fails$4(function () {
49
- return !$RegExp$2('a', 'y').sticky;
50
- });
51
-
52
- var BROKEN_CARET = UNSUPPORTED_Y$2 || fails$4(function () {
53
- // https://bugzilla.mozilla.org/show_bug.cgi?id=773687
54
- var re = $RegExp$2('^r', 'gy');
55
- re.lastIndex = 2;
56
- return re.exec('str') != null;
57
- });
58
-
59
- var regexpStickyHelpers = {
60
- BROKEN_CARET: BROKEN_CARET,
61
- MISSED_STICKY: MISSED_STICKY,
62
- UNSUPPORTED_Y: UNSUPPORTED_Y$2
63
- };
64
-
65
- var fails$3 = fails$5;
66
- var global$3 = global$5;
67
-
68
- // babel-minify and Closure Compiler transpiles RegExp('.', 's') -> /./s and it causes SyntaxError
69
- var $RegExp$1 = global$3.RegExp;
70
-
71
- var regexpUnsupportedDotAll = fails$3(function () {
72
- var re = $RegExp$1('.', 's');
73
- return !(re.dotAll && re.exec('\n') && re.flags === 's');
74
- });
75
-
76
- var fails$2 = fails$5;
77
- var global$2 = global$5;
78
-
79
- // babel-minify and Closure Compiler transpiles RegExp('(?<a>b)', 'g') -> /(?<a>b)/g and it causes SyntaxError
80
- var $RegExp = global$2.RegExp;
81
-
82
- var regexpUnsupportedNcg = fails$2(function () {
83
- var re = $RegExp('(?<a>b)', 'g');
84
- return re.exec('b').groups.a !== 'b' ||
85
- 'b'.replace(re, '$<a>c') !== 'bc';
86
- });
87
-
88
- /* eslint-disable regexp/no-empty-capturing-group, regexp/no-empty-group, regexp/no-lazy-ends -- testing */
89
- /* eslint-disable regexp/no-useless-quantifier -- testing */
90
- var call$2 = functionCall;
91
- var uncurryThis$3 = functionUncurryThis;
92
- var toString$2 = toString$3;
93
- var regexpFlags = regexpFlags$1;
94
- var stickyHelpers$1 = regexpStickyHelpers;
95
- var shared = shared$1.exports;
96
- var create = objectCreate;
97
- var getInternalState = internalState.get;
98
- var UNSUPPORTED_DOT_ALL = regexpUnsupportedDotAll;
99
- var UNSUPPORTED_NCG = regexpUnsupportedNcg;
100
-
101
- var nativeReplace = shared('native-string-replace', String.prototype.replace);
102
- var nativeExec = RegExp.prototype.exec;
103
- var patchedExec = nativeExec;
104
- var charAt$2 = uncurryThis$3(''.charAt);
105
- var indexOf = uncurryThis$3(''.indexOf);
106
- var replace = uncurryThis$3(''.replace);
107
- var stringSlice$2 = uncurryThis$3(''.slice);
108
-
109
- var UPDATES_LAST_INDEX_WRONG = (function () {
110
- var re1 = /a/;
111
- var re2 = /b*/g;
112
- call$2(nativeExec, re1, 'a');
113
- call$2(nativeExec, re2, 'a');
114
- return re1.lastIndex !== 0 || re2.lastIndex !== 0;
115
- })();
116
-
117
- var UNSUPPORTED_Y$1 = stickyHelpers$1.BROKEN_CARET;
118
-
119
- // nonparticipating capturing group, copied from es5-shim's String#split patch.
120
- var NPCG_INCLUDED = /()??/.exec('')[1] !== undefined;
121
-
122
- var PATCH = UPDATES_LAST_INDEX_WRONG || NPCG_INCLUDED || UNSUPPORTED_Y$1 || UNSUPPORTED_DOT_ALL || UNSUPPORTED_NCG;
123
-
124
- if (PATCH) {
125
- patchedExec = function exec(string) {
126
- var re = this;
127
- var state = getInternalState(re);
128
- var str = toString$2(string);
129
- var raw = state.raw;
130
- var result, reCopy, lastIndex, match, i, object, group;
131
-
132
- if (raw) {
133
- raw.lastIndex = re.lastIndex;
134
- result = call$2(patchedExec, raw, str);
135
- re.lastIndex = raw.lastIndex;
136
- return result;
137
- }
138
-
139
- var groups = state.groups;
140
- var sticky = UNSUPPORTED_Y$1 && re.sticky;
141
- var flags = call$2(regexpFlags, re);
142
- var source = re.source;
143
- var charsAdded = 0;
144
- var strCopy = str;
145
-
146
- if (sticky) {
147
- flags = replace(flags, 'y', '');
148
- if (indexOf(flags, 'g') === -1) {
149
- flags += 'g';
150
- }
151
-
152
- strCopy = stringSlice$2(str, re.lastIndex);
153
- // Support anchored sticky behavior.
154
- if (re.lastIndex > 0 && (!re.multiline || re.multiline && charAt$2(str, re.lastIndex - 1) !== '\n')) {
155
- source = '(?: ' + source + ')';
156
- strCopy = ' ' + strCopy;
157
- charsAdded++;
158
- }
159
- // ^(? + rx + ) is needed, in combination with some str slicing, to
160
- // simulate the 'y' flag.
161
- reCopy = new RegExp('^(?:' + source + ')', flags);
162
- }
163
-
164
- if (NPCG_INCLUDED) {
165
- reCopy = new RegExp('^' + source + '$(?!\\s)', flags);
166
- }
167
- if (UPDATES_LAST_INDEX_WRONG) lastIndex = re.lastIndex;
168
-
169
- match = call$2(nativeExec, sticky ? reCopy : re, strCopy);
170
-
171
- if (sticky) {
172
- if (match) {
173
- match.input = stringSlice$2(match.input, charsAdded);
174
- match[0] = stringSlice$2(match[0], charsAdded);
175
- match.index = re.lastIndex;
176
- re.lastIndex += match[0].length;
177
- } else re.lastIndex = 0;
178
- } else if (UPDATES_LAST_INDEX_WRONG && match) {
179
- re.lastIndex = re.global ? match.index + match[0].length : lastIndex;
180
- }
181
- if (NPCG_INCLUDED && match && match.length > 1) {
182
- // Fix browsers whose `exec` methods don't consistently return `undefined`
183
- // for NPCG, like IE8. NOTE: This doesn' work for /(.?)?/
184
- call$2(nativeReplace, match[0], reCopy, function () {
185
- for (i = 1; i < arguments.length - 2; i++) {
186
- if (arguments[i] === undefined) match[i] = undefined;
187
- }
188
- });
189
- }
190
-
191
- if (match && groups) {
192
- match.groups = object = create(null);
193
- for (i = 0; i < groups.length; i++) {
194
- group = groups[i];
195
- object[group[0]] = match[group[1]];
196
- }
197
- }
198
-
199
- return match;
200
- };
201
- }
202
-
203
- var regexpExec$3 = patchedExec;
204
-
205
- var $ = _export;
206
- var exec$1 = regexpExec$3;
207
-
208
- // `RegExp.prototype.exec` method
209
- // https://tc39.es/ecma262/#sec-regexp.prototype.exec
210
- $({ target: 'RegExp', proto: true, forced: /./.exec !== exec$1 }, {
211
- exec: exec$1
212
- });
213
-
214
- // TODO: Remove from `core-js@4` since it's moved to entry points
215
-
216
- var uncurryThis$2 = functionUncurryThis;
217
- var redefine = redefine$1.exports;
218
- var regexpExec$2 = regexpExec$3;
219
- var fails$1 = fails$5;
220
- var wellKnownSymbol$1 = wellKnownSymbol$2;
221
- var createNonEnumerableProperty = createNonEnumerableProperty$1;
222
-
223
- var SPECIES = wellKnownSymbol$1('species');
224
- var RegExpPrototype = RegExp.prototype;
225
-
226
- var fixRegexpWellKnownSymbolLogic = function (KEY, exec, FORCED, SHAM) {
227
- var SYMBOL = wellKnownSymbol$1(KEY);
228
-
229
- var DELEGATES_TO_SYMBOL = !fails$1(function () {
230
- // String methods call symbol-named RegEp methods
231
- var O = {};
232
- O[SYMBOL] = function () { return 7; };
233
- return ''[KEY](O) != 7;
234
- });
235
-
236
- var DELEGATES_TO_EXEC = DELEGATES_TO_SYMBOL && !fails$1(function () {
237
- // Symbol-named RegExp methods call .exec
238
- var execCalled = false;
239
- var re = /a/;
240
-
241
- if (KEY === 'split') {
242
- // We can't use real regex here since it causes deoptimization
243
- // and serious performance degradation in V8
244
- // https://github.com/zloirock/core-js/issues/306
245
- re = {};
246
- // RegExp[@@split] doesn't call the regex's exec method, but first creates
247
- // a new one. We need to return the patched regex when creating the new one.
248
- re.constructor = {};
249
- re.constructor[SPECIES] = function () { return re; };
250
- re.flags = '';
251
- re[SYMBOL] = /./[SYMBOL];
252
- }
253
-
254
- re.exec = function () { execCalled = true; return null; };
255
-
256
- re[SYMBOL]('');
257
- return !execCalled;
258
- });
259
-
260
- if (
261
- !DELEGATES_TO_SYMBOL ||
262
- !DELEGATES_TO_EXEC ||
263
- FORCED
264
- ) {
265
- var uncurriedNativeRegExpMethod = uncurryThis$2(/./[SYMBOL]);
266
- var methods = exec(SYMBOL, ''[KEY], function (nativeMethod, regexp, str, arg2, forceStringMethod) {
267
- var uncurriedNativeMethod = uncurryThis$2(nativeMethod);
268
- var $exec = regexp.exec;
269
- if ($exec === regexpExec$2 || $exec === RegExpPrototype.exec) {
270
- if (DELEGATES_TO_SYMBOL && !forceStringMethod) {
271
- // The native String method already delegates to @@method (this
272
- // polyfilled function), leasing to infinite recursion.
273
- // We avoid it by directly calling the native @@method method.
274
- return { done: true, value: uncurriedNativeRegExpMethod(regexp, str, arg2) };
275
- }
276
- return { done: true, value: uncurriedNativeMethod(str, regexp, arg2) };
277
- }
278
- return { done: false };
279
- });
280
-
281
- redefine(String.prototype, KEY, methods[0]);
282
- redefine(RegExpPrototype, SYMBOL, methods[1]);
283
- }
284
-
285
- if (SHAM) createNonEnumerableProperty(RegExpPrototype[SYMBOL], 'sham', true);
286
- };
287
-
288
- var isObject = isObject$1;
289
- var classof$1 = classofRaw;
290
- var wellKnownSymbol = wellKnownSymbol$2;
291
-
292
- var MATCH = wellKnownSymbol('match');
293
-
294
- // `IsRegExp` abstract operation
295
- // https://tc39.es/ecma262/#sec-isregexp
296
- var isRegexp = function (it) {
297
- var isRegExp;
298
- return isObject(it) && ((isRegExp = it[MATCH]) !== undefined ? !!isRegExp : classof$1(it) == 'RegExp');
299
- };
300
-
301
- var uncurryThis$1 = functionUncurryThis;
302
- var toIntegerOrInfinity = toIntegerOrInfinity$1;
303
- var toString$1 = toString$3;
304
- var requireObjectCoercible$1 = requireObjectCoercible$2;
305
-
306
- var charAt$1 = uncurryThis$1(''.charAt);
307
- var charCodeAt = uncurryThis$1(''.charCodeAt);
308
- var stringSlice$1 = uncurryThis$1(''.slice);
309
-
310
- var createMethod = function (CONVERT_TO_STRING) {
311
- return function ($this, pos) {
312
- var S = toString$1(requireObjectCoercible$1($this));
313
- var position = toIntegerOrInfinity(pos);
314
- var size = S.length;
315
- var first, second;
316
- if (position < 0 || position >= size) return CONVERT_TO_STRING ? '' : undefined;
317
- first = charCodeAt(S, position);
318
- return first < 0xD800 || first > 0xDBFF || position + 1 === size
319
- || (second = charCodeAt(S, position + 1)) < 0xDC00 || second > 0xDFFF
320
- ? CONVERT_TO_STRING
321
- ? charAt$1(S, position)
322
- : first
323
- : CONVERT_TO_STRING
324
- ? stringSlice$1(S, position, position + 2)
325
- : (first - 0xD800 << 10) + (second - 0xDC00) + 0x10000;
326
- };
327
- };
328
-
329
- var stringMultibyte = {
330
- // `String.prototype.codePointAt` method
331
- // https://tc39.es/ecma262/#sec-string.prototype.codepointat
332
- codeAt: createMethod(false),
333
- // `String.prototype.at` method
334
- // https://github.com/mathiasbynens/String.prototype.at
335
- charAt: createMethod(true)
336
- };
337
-
338
- var charAt = stringMultibyte.charAt;
339
-
340
- // `AdvanceStringIndex` abstract operation
341
- // https://tc39.es/ecma262/#sec-advancestringindex
342
- var advanceStringIndex$1 = function (S, index, unicode) {
343
- return index + (unicode ? charAt(S, index).length : 1);
344
- };
345
-
346
- var toPropertyKey = toPropertyKey$1;
347
- var definePropertyModule = objectDefineProperty;
348
- var createPropertyDescriptor = createPropertyDescriptor$1;
349
-
350
- var createProperty$1 = function (object, key, value) {
351
- var propertyKey = toPropertyKey(key);
352
- if (propertyKey in object) definePropertyModule.f(object, propertyKey, createPropertyDescriptor(0, value));
353
- else object[propertyKey] = value;
354
- };
355
-
356
- var global$1 = global$5;
357
- var toAbsoluteIndex = toAbsoluteIndex$1;
358
- var lengthOfArrayLike = lengthOfArrayLike$1;
359
- var createProperty = createProperty$1;
360
-
361
- var Array$1 = global$1.Array;
362
- var max$2 = Math.max;
363
-
364
- var arraySliceSimple = function (O, start, end) {
365
- var length = lengthOfArrayLike(O);
366
- var k = toAbsoluteIndex(start, length);
367
- var fin = toAbsoluteIndex(end === undefined ? length : end, length);
368
- var result = Array$1(max$2(fin - k, 0));
369
- for (var n = 0; k < fin; k++, n++) createProperty(result, n, O[k]);
370
- result.length = n;
371
- return result;
372
- };
373
-
374
- var global = global$5;
375
- var call$1 = functionCall;
376
- var anObject$1 = anObject$3;
377
- var isCallable = isCallable$1;
378
- var classof = classofRaw;
379
- var regexpExec$1 = regexpExec$3;
380
-
381
- var TypeError = global.TypeError;
382
-
383
- // `RegExpExec` abstract operation
384
- // https://tc39.es/ecma262/#sec-regexpexec
385
- var regexpExecAbstract = function (R, S) {
386
- var exec = R.exec;
387
- if (isCallable(exec)) {
388
- var result = call$1(exec, R, S);
389
- if (result !== null) anObject$1(result);
390
- return result;
391
- }
392
- if (classof(R) === 'RegExp') return call$1(regexpExec$1, R, S);
393
- throw TypeError('RegExp#exec called on incompatible receiver');
394
- };
395
-
396
- var apply = functionApply;
397
- var call = functionCall;
398
- var uncurryThis = functionUncurryThis;
399
- var fixRegExpWellKnownSymbolLogic = fixRegexpWellKnownSymbolLogic;
400
- var isRegExp = isRegexp;
401
- var anObject = anObject$3;
402
- var requireObjectCoercible = requireObjectCoercible$2;
403
- var speciesConstructor = speciesConstructor$1;
404
- var advanceStringIndex = advanceStringIndex$1;
405
- var toLength = toLength$1;
406
- var toString = toString$3;
407
- var getMethod = getMethod$1;
408
- var arraySlice = arraySliceSimple;
409
- var callRegExpExec = regexpExecAbstract;
410
- var regexpExec = regexpExec$3;
411
- var stickyHelpers = regexpStickyHelpers;
412
- var fails = fails$5;
413
-
414
- var UNSUPPORTED_Y = stickyHelpers.UNSUPPORTED_Y;
415
- var MAX_UINT32 = 0xFFFFFFFF;
416
- var min$2 = Math.min;
417
- var $push = [].push;
418
- var exec = uncurryThis(/./.exec);
419
- var push = uncurryThis($push);
420
- var stringSlice = uncurryThis(''.slice);
421
-
422
- // Chrome 51 has a buggy "split" implementation when RegExp#exec !== nativeExec
423
- // Weex JS has frozen built-in prototypes, so use try / catch wrapper
424
- var SPLIT_WORKS_WITH_OVERWRITTEN_EXEC = !fails(function () {
425
- // eslint-disable-next-line regexp/no-empty-group -- required for testing
426
- var re = /(?:)/;
427
- var originalExec = re.exec;
428
- re.exec = function () { return originalExec.apply(this, arguments); };
429
- var result = 'ab'.split(re);
430
- return result.length !== 2 || result[0] !== 'a' || result[1] !== 'b';
431
- });
432
-
433
- // @@split logic
434
- fixRegExpWellKnownSymbolLogic('split', function (SPLIT, nativeSplit, maybeCallNative) {
435
- var internalSplit;
436
- if (
437
- 'abbc'.split(/(b)*/)[1] == 'c' ||
438
- // eslint-disable-next-line regexp/no-empty-group -- required for testing
439
- 'test'.split(/(?:)/, -1).length != 4 ||
440
- 'ab'.split(/(?:ab)*/).length != 2 ||
441
- '.'.split(/(.?)(.?)/).length != 4 ||
442
- // eslint-disable-next-line regexp/no-empty-capturing-group, regexp/no-empty-group -- required for testing
443
- '.'.split(/()()/).length > 1 ||
444
- ''.split(/.?/).length
445
- ) {
446
- // based on es5-shim implementation, need to rework it
447
- internalSplit = function (separator, limit) {
448
- var string = toString(requireObjectCoercible(this));
449
- var lim = limit === undefined ? MAX_UINT32 : limit >>> 0;
450
- if (lim === 0) return [];
451
- if (separator === undefined) return [string];
452
- // If `separator` is not a regex, use native split
453
- if (!isRegExp(separator)) {
454
- return call(nativeSplit, string, separator, lim);
455
- }
456
- var output = [];
457
- var flags = (separator.ignoreCase ? 'i' : '') +
458
- (separator.multiline ? 'm' : '') +
459
- (separator.unicode ? 'u' : '') +
460
- (separator.sticky ? 'y' : '');
461
- var lastLastIndex = 0;
462
- // Make `global` and avoid `lastIndex` issues by working with a copy
463
- var separatorCopy = new RegExp(separator.source, flags + 'g');
464
- var match, lastIndex, lastLength;
465
- while (match = call(regexpExec, separatorCopy, string)) {
466
- lastIndex = separatorCopy.lastIndex;
467
- if (lastIndex > lastLastIndex) {
468
- push(output, stringSlice(string, lastLastIndex, match.index));
469
- if (match.length > 1 && match.index < string.length) apply($push, output, arraySlice(match, 1));
470
- lastLength = match[0].length;
471
- lastLastIndex = lastIndex;
472
- if (output.length >= lim) break;
473
- }
474
- if (separatorCopy.lastIndex === match.index) separatorCopy.lastIndex++; // Avoid an infinite loop
475
- }
476
- if (lastLastIndex === string.length) {
477
- if (lastLength || !exec(separatorCopy, '')) push(output, '');
478
- } else push(output, stringSlice(string, lastLastIndex));
479
- return output.length > lim ? arraySlice(output, 0, lim) : output;
480
- };
481
- // Chakra, V8
482
- } else if ('0'.split(undefined, 0).length) {
483
- internalSplit = function (separator, limit) {
484
- return separator === undefined && limit === 0 ? [] : call(nativeSplit, this, separator, limit);
485
- };
486
- } else internalSplit = nativeSplit;
487
-
488
- return [
489
- // `String.prototype.split` method
490
- // https://tc39.es/ecma262/#sec-string.prototype.split
491
- function split(separator, limit) {
492
- var O = requireObjectCoercible(this);
493
- var splitter = separator == undefined ? undefined : getMethod(separator, SPLIT);
494
- return splitter
495
- ? call(splitter, separator, O, limit)
496
- : call(internalSplit, toString(O), separator, limit);
497
- },
498
- // `RegExp.prototype[@@split]` method
499
- // https://tc39.es/ecma262/#sec-regexp.prototype-@@split
500
- //
501
- // NOTE: This cannot be properly polyfilled in engines that don't support
502
- // the 'y' flag.
503
- function (string, limit) {
504
- var rx = anObject(this);
505
- var S = toString(string);
506
- var res = maybeCallNative(internalSplit, rx, S, limit, internalSplit !== nativeSplit);
507
-
508
- if (res.done) return res.value;
509
-
510
- var C = speciesConstructor(rx, RegExp);
511
-
512
- var unicodeMatching = rx.unicode;
513
- var flags = (rx.ignoreCase ? 'i' : '') +
514
- (rx.multiline ? 'm' : '') +
515
- (rx.unicode ? 'u' : '') +
516
- (UNSUPPORTED_Y ? 'g' : 'y');
517
-
518
- // ^(? + rx + ) is needed, in combination with some S slicing, to
519
- // simulate the 'y' flag.
520
- var splitter = new C(UNSUPPORTED_Y ? '^(?:' + rx.source + ')' : rx, flags);
521
- var lim = limit === undefined ? MAX_UINT32 : limit >>> 0;
522
- if (lim === 0) return [];
523
- if (S.length === 0) return callRegExpExec(splitter, S) === null ? [S] : [];
524
- var p = 0;
525
- var q = 0;
526
- var A = [];
527
- while (q < S.length) {
528
- splitter.lastIndex = UNSUPPORTED_Y ? 0 : q;
529
- var z = callRegExpExec(splitter, UNSUPPORTED_Y ? stringSlice(S, q) : S);
530
- var e;
531
- if (
532
- z === null ||
533
- (e = min$2(toLength(splitter.lastIndex + (UNSUPPORTED_Y ? q : 0)), S.length)) === p
534
- ) {
535
- q = advanceStringIndex(S, q, unicodeMatching);
536
- } else {
537
- push(A, stringSlice(S, p, q));
538
- if (A.length === lim) return A;
539
- for (var i = 1; i <= z.length - 1; i++) {
540
- push(A, z[i]);
541
- if (A.length === lim) return A;
542
- }
543
- q = p = e;
544
- }
545
- }
546
- push(A, stringSlice(S, p));
547
- return A;
548
- }
549
- ];
550
- }, !SPLIT_WORKS_WITH_OVERWRITTEN_EXEC, UNSUPPORTED_Y);
551
-
552
- function getSide(placement) {
553
- return placement.split('-')[0];
554
- }
555
-
556
- function getAlignment(placement) {
557
- return placement.split('-')[1];
558
- }
559
-
560
- function getMainAxisFromPlacement(placement) {
561
- return ['top', 'bottom'].includes(getSide(placement)) ? 'x' : 'y';
562
- }
563
-
564
- function getLengthFromAxis(axis) {
565
- return axis === 'y' ? 'height' : 'width';
566
- }
567
-
568
- function computeCoordsFromPlacement(_ref, placement, rtl) {
569
- let {
570
- reference,
571
- floating
572
- } = _ref;
573
- const commonX = reference.x + reference.width / 2 - floating.width / 2;
574
- const commonY = reference.y + reference.height / 2 - floating.height / 2;
575
- const mainAxis = getMainAxisFromPlacement(placement);
576
- const length = getLengthFromAxis(mainAxis);
577
- const commonAlign = reference[length] / 2 - floating[length] / 2;
578
- const side = getSide(placement);
579
- const isVertical = mainAxis === 'x';
580
- let coords;
581
-
582
- switch (side) {
583
- case 'top':
584
- coords = {
585
- x: commonX,
586
- y: reference.y - floating.height
587
- };
588
- break;
589
-
590
- case 'bottom':
591
- coords = {
592
- x: commonX,
593
- y: reference.y + reference.height
594
- };
595
- break;
596
-
597
- case 'right':
598
- coords = {
599
- x: reference.x + reference.width,
600
- y: commonY
601
- };
602
- break;
603
-
604
- case 'left':
605
- coords = {
606
- x: reference.x - floating.width,
607
- y: commonY
608
- };
609
- break;
610
-
611
- default:
612
- coords = {
613
- x: reference.x,
614
- y: reference.y
615
- };
616
- }
617
-
618
- switch (getAlignment(placement)) {
619
- case 'start':
620
- coords[mainAxis] -= commonAlign * (rtl && isVertical ? -1 : 1);
621
- break;
622
-
623
- case 'end':
624
- coords[mainAxis] += commonAlign * (rtl && isVertical ? -1 : 1);
625
- break;
626
- }
627
-
628
- return coords;
629
- }
630
-
631
- /**
632
- * Computes the `x` and `y` coordinates that will place the floating element
633
- * next to a reference element when it is given a certain positioning strategy.
634
- *
635
- * This export does not have any `platform` interface logic. You will need to
636
- * write one for the platform you are using Floating UI with.
637
- */
638
-
639
- const computePosition$1 = async (reference, floating, config) => {
640
- const {
641
- placement = 'bottom',
642
- strategy = 'absolute',
643
- middleware = [],
644
- platform
645
- } = config;
646
- const rtl = await (platform.isRTL == null ? void 0 : platform.isRTL(floating));
647
-
648
- {
649
- if (platform == null) {
650
- console.error(['Floating UI: `platform` property was not passed to config. If you', 'want to use Floating UI on the web, install @floating-ui/dom', 'instead of the /core package. Otherwise, you can create your own', '`platform`: https://floating-ui.com/docs/platform'].join(' '));
651
- }
652
-
653
- if (middleware.filter(_ref => {
654
- let {
655
- name
656
- } = _ref;
657
- return name === 'autoPlacement' || name === 'flip';
658
- }).length > 1) {
659
- throw new Error(['Floating UI: duplicate `flip` and/or `autoPlacement`', 'middleware detected. This will lead to an infinite loop. Ensure only', 'one of either has been passed to the `middleware` array.'].join(' '));
660
- }
661
- }
662
-
663
- let rects = await platform.getElementRects({
664
- reference,
665
- floating,
666
- strategy
667
- });
668
- let {
669
- x,
670
- y
671
- } = computeCoordsFromPlacement(rects, placement, rtl);
672
- let statefulPlacement = placement;
673
- let middlewareData = {};
674
- let _debug_loop_count_ = 0;
675
-
676
- for (let i = 0; i < middleware.length; i++) {
677
- {
678
- _debug_loop_count_++;
679
-
680
- if (_debug_loop_count_ > 100) {
681
- throw new Error(['Floating UI: The middleware lifecycle appears to be', 'running in an infinite loop. This is usually caused by a `reset`', 'continually being returned without a break condition.'].join(' '));
682
- }
683
- }
684
-
685
- const {
686
- name,
687
- fn
688
- } = middleware[i];
689
- const {
690
- x: nextX,
691
- y: nextY,
692
- data,
693
- reset
694
- } = await fn({
695
- x,
696
- y,
697
- initialPlacement: placement,
698
- placement: statefulPlacement,
699
- strategy,
700
- middlewareData,
701
- rects,
702
- platform,
703
- elements: {
704
- reference,
705
- floating
706
- }
707
- });
708
- x = nextX != null ? nextX : x;
709
- y = nextY != null ? nextY : y;
710
- middlewareData = { ...middlewareData,
711
- [name]: { ...middlewareData[name],
712
- ...data
713
- }
714
- };
715
-
716
- if (reset) {
717
- if (typeof reset === 'object') {
718
- if (reset.placement) {
719
- statefulPlacement = reset.placement;
720
- }
721
-
722
- if (reset.rects) {
723
- rects = reset.rects === true ? await platform.getElementRects({
724
- reference,
725
- floating,
726
- strategy
727
- }) : reset.rects;
728
- }
729
-
730
- ({
731
- x,
732
- y
733
- } = computeCoordsFromPlacement(rects, statefulPlacement, rtl));
734
- }
735
-
736
- i = -1;
737
- continue;
738
- }
739
- }
740
-
741
- return {
742
- x,
743
- y,
744
- placement: statefulPlacement,
745
- strategy,
746
- middlewareData
747
- };
748
- };
749
-
750
- function expandPaddingObject(padding) {
751
- return {
752
- top: 0,
753
- right: 0,
754
- bottom: 0,
755
- left: 0,
756
- ...padding
757
- };
758
- }
759
-
760
- function getSideObjectFromPadding(padding) {
761
- return typeof padding !== 'number' ? expandPaddingObject(padding) : {
762
- top: padding,
763
- right: padding,
764
- bottom: padding,
765
- left: padding
766
- };
767
- }
768
-
769
- function rectToClientRect(rect) {
770
- return { ...rect,
771
- top: rect.y,
772
- left: rect.x,
773
- right: rect.x + rect.width,
774
- bottom: rect.y + rect.height
775
- };
776
- }
777
-
778
- /**
779
- * Resolves with an object of overflow side offsets that determine how much the
780
- * element is overflowing a given clipping boundary.
781
- * - positive = overflowing the boundary by that number of pixels
782
- * - negative = how many pixels left before it will overflow
783
- * - 0 = lies flush with the boundary
784
- * @see https://floating-ui.com/docs/detectOverflow
785
- */
786
- async function detectOverflow(middlewareArguments, options) {
787
- var _await$platform$isEle;
788
-
789
- if (options === void 0) {
790
- options = {};
791
- }
792
-
793
- const {
794
- x,
795
- y,
796
- platform,
797
- rects,
798
- elements,
799
- strategy
800
- } = middlewareArguments;
801
- const {
802
- boundary = 'clippingAncestors',
803
- rootBoundary = 'viewport',
804
- elementContext = 'floating',
805
- altBoundary = false,
806
- padding = 0
807
- } = options;
808
- const paddingObject = getSideObjectFromPadding(padding);
809
- const altContext = elementContext === 'floating' ? 'reference' : 'floating';
810
- const element = elements[altBoundary ? altContext : elementContext];
811
- const clippingClientRect = rectToClientRect(await platform.getClippingRect({
812
- 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))),
813
- boundary,
814
- rootBoundary
815
- }));
816
- const elementClientRect = rectToClientRect(platform.convertOffsetParentRelativeRectToViewportRelativeRect ? await platform.convertOffsetParentRelativeRectToViewportRelativeRect({
817
- rect: elementContext === 'floating' ? { ...rects.floating,
818
- x,
819
- y
820
- } : rects.reference,
821
- offsetParent: await (platform.getOffsetParent == null ? void 0 : platform.getOffsetParent(elements.floating)),
822
- strategy
823
- }) : rects[elementContext]); // positive = overflowing the clipping rect
824
- // 0 or negative = within the clipping rect
825
-
826
- return {
827
- top: clippingClientRect.top - elementClientRect.top + paddingObject.top,
828
- bottom: elementClientRect.bottom - clippingClientRect.bottom + paddingObject.bottom,
829
- left: clippingClientRect.left - elementClientRect.left + paddingObject.left,
830
- right: elementClientRect.right - clippingClientRect.right + paddingObject.right
831
- };
832
- }
833
-
834
- const min$1 = Math.min;
835
- const max$1 = Math.max;
836
-
837
- function within(min$1$1, value, max$1$1) {
838
- return max$1(min$1$1, min$1(value, max$1$1));
839
- }
840
-
841
- /**
842
- * Positions an inner element of the floating element such that it is centered
843
- * to the reference element.
844
- * @see https://floating-ui.com/docs/arrow
845
- */
846
- const arrow = options => ({
847
- name: 'arrow',
848
- options,
849
-
850
- async fn(middlewareArguments) {
851
- // Since `element` is required, we don't Partial<> the type
852
- const {
853
- element,
854
- padding = 0
855
- } = options != null ? options : {};
856
- const {
857
- x,
858
- y,
859
- placement,
860
- rects,
861
- platform
862
- } = middlewareArguments;
863
-
864
- if (element == null) {
865
- {
866
- console.warn('Floating UI: No `element` was passed to the `arrow` middleware.');
867
- }
868
-
869
- return {};
870
- }
871
-
872
- const paddingObject = getSideObjectFromPadding(padding);
873
- const coords = {
874
- x,
875
- y
876
- };
877
- const axis = getMainAxisFromPlacement(placement);
878
- const length = getLengthFromAxis(axis);
879
- const arrowDimensions = await platform.getDimensions(element);
880
- const minProp = axis === 'y' ? 'top' : 'left';
881
- const maxProp = axis === 'y' ? 'bottom' : 'right';
882
- const endDiff = rects.reference[length] + rects.reference[axis] - coords[axis] - rects.floating[length];
883
- const startDiff = coords[axis] - rects.reference[axis];
884
- const arrowOffsetParent = await (platform.getOffsetParent == null ? void 0 : platform.getOffsetParent(element));
885
- const clientSize = arrowOffsetParent ? axis === 'y' ? arrowOffsetParent.clientHeight || 0 : arrowOffsetParent.clientWidth || 0 : 0;
886
- const centerToReference = endDiff / 2 - startDiff / 2; // Make sure the arrow doesn't overflow the floating element if the center
887
- // point is outside of the floating element's bounds
888
-
889
- const min = paddingObject[minProp];
890
- const max = clientSize - arrowDimensions[length] - paddingObject[maxProp];
891
- const center = clientSize / 2 - arrowDimensions[length] / 2 + centerToReference;
892
- const offset = within(min, center, max);
893
- return {
894
- data: {
895
- [axis]: offset,
896
- centerOffset: center - offset
897
- }
898
- };
899
- }
900
-
901
- });
902
-
903
- const hash$1 = {
904
- left: 'right',
905
- right: 'left',
906
- bottom: 'top',
907
- top: 'bottom'
908
- };
909
- function getOppositePlacement(placement) {
910
- return placement.replace(/left|right|bottom|top/g, matched => hash$1[matched]);
911
- }
912
-
913
- function getAlignmentSides(placement, rects, rtl) {
914
- if (rtl === void 0) {
915
- rtl = false;
916
- }
917
-
918
- const alignment = getAlignment(placement);
919
- const mainAxis = getMainAxisFromPlacement(placement);
920
- const length = getLengthFromAxis(mainAxis);
921
- let mainAlignmentSide = mainAxis === 'x' ? alignment === (rtl ? 'end' : 'start') ? 'right' : 'left' : alignment === 'start' ? 'bottom' : 'top';
922
-
923
- if (rects.reference[length] > rects.floating[length]) {
924
- mainAlignmentSide = getOppositePlacement(mainAlignmentSide);
925
- }
926
-
927
- return {
928
- main: mainAlignmentSide,
929
- cross: getOppositePlacement(mainAlignmentSide)
930
- };
931
- }
932
-
933
- const hash = {
934
- start: 'end',
935
- end: 'start'
936
- };
937
- function getOppositeAlignmentPlacement(placement) {
938
- return placement.replace(/start|end/g, matched => hash[matched]);
939
- }
940
-
941
- const sides = ['top', 'right', 'bottom', 'left'];
942
-
943
- function getExpandedPlacements(placement) {
944
- const oppositePlacement = getOppositePlacement(placement);
945
- return [getOppositeAlignmentPlacement(placement), oppositePlacement, getOppositeAlignmentPlacement(oppositePlacement)];
946
- }
947
-
948
- /**
949
- * Changes the placement of the floating element to one that will fit if the
950
- * initially specified `placement` does not.
951
- * @see https://floating-ui.com/docs/flip
952
- */
953
- const flip = function (options) {
954
- if (options === void 0) {
955
- options = {};
956
- }
957
-
958
- return {
959
- name: 'flip',
960
- options,
961
-
962
- async fn(middlewareArguments) {
963
- var _middlewareData$flip;
964
-
965
- const {
966
- placement,
967
- middlewareData,
968
- rects,
969
- initialPlacement,
970
- platform,
971
- elements
972
- } = middlewareArguments;
973
- const {
974
- mainAxis: checkMainAxis = true,
975
- crossAxis: checkCrossAxis = true,
976
- fallbackPlacements: specifiedFallbackPlacements,
977
- fallbackStrategy = 'bestFit',
978
- flipAlignment = true,
979
- ...detectOverflowOptions
980
- } = options;
981
- const side = getSide(placement);
982
- const isBasePlacement = side === initialPlacement;
983
- const fallbackPlacements = specifiedFallbackPlacements || (isBasePlacement || !flipAlignment ? [getOppositePlacement(initialPlacement)] : getExpandedPlacements(initialPlacement));
984
- const placements = [initialPlacement, ...fallbackPlacements];
985
- const overflow = await detectOverflow(middlewareArguments, detectOverflowOptions);
986
- const overflows = [];
987
- let overflowsData = ((_middlewareData$flip = middlewareData.flip) == null ? void 0 : _middlewareData$flip.overflows) || [];
988
-
989
- if (checkMainAxis) {
990
- overflows.push(overflow[side]);
991
- }
992
-
993
- if (checkCrossAxis) {
994
- const {
995
- main,
996
- cross
997
- } = getAlignmentSides(placement, rects, await (platform.isRTL == null ? void 0 : platform.isRTL(elements.floating)));
998
- overflows.push(overflow[main], overflow[cross]);
999
- }
1000
-
1001
- overflowsData = [...overflowsData, {
1002
- placement,
1003
- overflows
1004
- }]; // One or more sides is overflowing
1005
-
1006
- if (!overflows.every(side => side <= 0)) {
1007
- var _middlewareData$flip$, _middlewareData$flip2;
1008
-
1009
- const nextIndex = ((_middlewareData$flip$ = (_middlewareData$flip2 = middlewareData.flip) == null ? void 0 : _middlewareData$flip2.index) != null ? _middlewareData$flip$ : 0) + 1;
1010
- const nextPlacement = placements[nextIndex];
1011
-
1012
- if (nextPlacement) {
1013
- // Try next placement and re-run the lifecycle
1014
- return {
1015
- data: {
1016
- index: nextIndex,
1017
- overflows: overflowsData
1018
- },
1019
- reset: {
1020
- placement: nextPlacement
1021
- }
1022
- };
1023
- }
1024
-
1025
- let resetPlacement = 'bottom';
1026
-
1027
- switch (fallbackStrategy) {
1028
- case 'bestFit':
1029
- {
1030
- var _overflowsData$slice$;
1031
-
1032
- 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;
1033
-
1034
- if (placement) {
1035
- resetPlacement = placement;
1036
- }
1037
-
1038
- break;
1039
- }
1040
-
1041
- case 'initialPlacement':
1042
- resetPlacement = initialPlacement;
1043
- break;
1044
- }
1045
-
1046
- if (placement !== resetPlacement) {
1047
- return {
1048
- reset: {
1049
- placement: resetPlacement
1050
- }
1051
- };
1052
- }
1053
- }
1054
-
1055
- return {};
1056
- }
1057
-
1058
- };
1059
- };
1060
-
1061
- function getSideOffsets(overflow, rect) {
1062
- return {
1063
- top: overflow.top - rect.height,
1064
- right: overflow.right - rect.width,
1065
- bottom: overflow.bottom - rect.height,
1066
- left: overflow.left - rect.width
1067
- };
1068
- }
1069
-
1070
- function isAnySideFullyClipped(overflow) {
1071
- return sides.some(side => overflow[side] >= 0);
1072
- }
1073
-
1074
- /**
1075
- * Provides data to hide the floating element in applicable situations, such as
1076
- * when it is not in the same clipping context as the reference element.
1077
- * @see https://floating-ui.com/docs/hide
1078
- */
1079
- const hide = function (_temp) {
1080
- let {
1081
- strategy = 'referenceHidden',
1082
- ...detectOverflowOptions
1083
- } = _temp === void 0 ? {} : _temp;
1084
- return {
1085
- name: 'hide',
1086
-
1087
- async fn(middlewareArguments) {
1088
- const {
1089
- rects
1090
- } = middlewareArguments;
1091
-
1092
- switch (strategy) {
1093
- case 'referenceHidden':
1094
- {
1095
- const overflow = await detectOverflow(middlewareArguments, { ...detectOverflowOptions,
1096
- elementContext: 'reference'
1097
- });
1098
- const offsets = getSideOffsets(overflow, rects.reference);
1099
- return {
1100
- data: {
1101
- referenceHiddenOffsets: offsets,
1102
- referenceHidden: isAnySideFullyClipped(offsets)
1103
- }
1104
- };
1105
- }
1106
-
1107
- case 'escaped':
1108
- {
1109
- const overflow = await detectOverflow(middlewareArguments, { ...detectOverflowOptions,
1110
- altBoundary: true
1111
- });
1112
- const offsets = getSideOffsets(overflow, rects.floating);
1113
- return {
1114
- data: {
1115
- escapedOffsets: offsets,
1116
- escaped: isAnySideFullyClipped(offsets)
1117
- }
1118
- };
1119
- }
1120
-
1121
- default:
1122
- {
1123
- return {};
1124
- }
1125
- }
1126
- }
1127
-
1128
- };
1129
- };
1130
-
1131
- function convertValueToCoords(placement, rects, value, rtl) {
1132
- if (rtl === void 0) {
1133
- rtl = false;
1134
- }
1135
-
1136
- const side = getSide(placement);
1137
- const alignment = getAlignment(placement);
1138
- const isVertical = getMainAxisFromPlacement(placement) === 'x';
1139
- const mainAxisMulti = ['left', 'top'].includes(side) ? -1 : 1;
1140
- const crossAxisMulti = rtl && isVertical ? -1 : 1;
1141
- const rawValue = typeof value === 'function' ? value({ ...rects,
1142
- placement
1143
- }) : value;
1144
- const isNumber = typeof rawValue === 'number'; // eslint-disable-next-line prefer-const
1145
-
1146
- let {
1147
- mainAxis,
1148
- crossAxis,
1149
- alignmentAxis
1150
- } = isNumber ? {
1151
- mainAxis: rawValue,
1152
- crossAxis: 0,
1153
- alignmentAxis: null
1154
- } : {
1155
- mainAxis: 0,
1156
- crossAxis: 0,
1157
- alignmentAxis: null,
1158
- ...rawValue
1159
- };
1160
-
1161
- if (alignment && typeof alignmentAxis === 'number') {
1162
- crossAxis = alignment === 'end' ? alignmentAxis * -1 : alignmentAxis;
1163
- }
1164
-
1165
- return isVertical ? {
1166
- x: crossAxis * crossAxisMulti,
1167
- y: mainAxis * mainAxisMulti
1168
- } : {
1169
- x: mainAxis * mainAxisMulti,
1170
- y: crossAxis * crossAxisMulti
1171
- };
1172
- }
1173
- /**
1174
- * Displaces the floating element from its reference element.
1175
- * @see https://floating-ui.com/docs/offset
1176
- */
1177
-
1178
- const offset = function (value) {
1179
- if (value === void 0) {
1180
- value = 0;
1181
- }
1182
-
1183
- return {
1184
- name: 'offset',
1185
- options: value,
1186
-
1187
- async fn(middlewareArguments) {
1188
- const {
1189
- x,
1190
- y,
1191
- placement,
1192
- rects,
1193
- platform,
1194
- elements
1195
- } = middlewareArguments;
1196
- const diffCoords = convertValueToCoords(placement, rects, value, await (platform.isRTL == null ? void 0 : platform.isRTL(elements.floating)));
1197
- return {
1198
- x: x + diffCoords.x,
1199
- y: y + diffCoords.y,
1200
- data: diffCoords
1201
- };
1202
- }
1203
-
1204
- };
1205
- };
1206
-
1207
- /**
1208
- * Provides improved positioning for inline reference elements that can span
1209
- * over multiple lines, such as hyperlinks or range selections.
1210
- * @see https://floating-ui.com/docs/inline
1211
- */
1212
- const inline = function (options) {
1213
- if (options === void 0) {
1214
- options = {};
1215
- }
1216
-
1217
- return {
1218
- name: 'inline',
1219
- options,
1220
-
1221
- async fn(middlewareArguments) {
1222
- var _await$platform$getCl;
1223
-
1224
- const {
1225
- placement,
1226
- elements,
1227
- rects,
1228
- platform,
1229
- strategy
1230
- } = middlewareArguments; // A MouseEvent's client{X,Y} coords can be up to 2 pixels off a
1231
- // ClientRect's bounds, despite the event listener being triggered. A
1232
- // padding of 2 seems to handle this issue.
1233
-
1234
- const {
1235
- padding = 2,
1236
- x,
1237
- y
1238
- } = options;
1239
- const fallback = rectToClientRect(platform.convertOffsetParentRelativeRectToViewportRelativeRect ? await platform.convertOffsetParentRelativeRectToViewportRelativeRect({
1240
- rect: rects.reference,
1241
- offsetParent: await (platform.getOffsetParent == null ? void 0 : platform.getOffsetParent(elements.floating)),
1242
- strategy
1243
- }) : rects.reference);
1244
- const clientRects = (_await$platform$getCl = await (platform.getClientRects == null ? void 0 : platform.getClientRects(elements.reference))) != null ? _await$platform$getCl : [];
1245
- const paddingObject = getSideObjectFromPadding(padding);
1246
-
1247
- function getBoundingClientRect() {
1248
- // There are two rects and they are disjoined
1249
- if (clientRects.length === 2 && clientRects[0].left > clientRects[1].right && x != null && y != null) {
1250
- var _clientRects$find;
1251
-
1252
- // Find the first rect in which the point is fully inside
1253
- return (_clientRects$find = clientRects.find(rect => x > rect.left - paddingObject.left && x < rect.right + paddingObject.right && y > rect.top - paddingObject.top && y < rect.bottom + paddingObject.bottom)) != null ? _clientRects$find : fallback;
1254
- } // There are 2 or more connected rects
1255
-
1256
-
1257
- if (clientRects.length >= 2) {
1258
- if (getMainAxisFromPlacement(placement) === 'x') {
1259
- const firstRect = clientRects[0];
1260
- const lastRect = clientRects[clientRects.length - 1];
1261
- const isTop = getSide(placement) === 'top';
1262
- const top = firstRect.top;
1263
- const bottom = lastRect.bottom;
1264
- const left = isTop ? firstRect.left : lastRect.left;
1265
- const right = isTop ? firstRect.right : lastRect.right;
1266
- const width = right - left;
1267
- const height = bottom - top;
1268
- return {
1269
- top,
1270
- bottom,
1271
- left,
1272
- right,
1273
- width,
1274
- height,
1275
- x: left,
1276
- y: top
1277
- };
1278
- }
1279
-
1280
- const isLeftSide = getSide(placement) === 'left';
1281
- const maxRight = max$1(...clientRects.map(rect => rect.right));
1282
- const minLeft = min$1(...clientRects.map(rect => rect.left));
1283
- const measureRects = clientRects.filter(rect => isLeftSide ? rect.left === minLeft : rect.right === maxRight);
1284
- const top = measureRects[0].top;
1285
- const bottom = measureRects[measureRects.length - 1].bottom;
1286
- const left = minLeft;
1287
- const right = maxRight;
1288
- const width = right - left;
1289
- const height = bottom - top;
1290
- return {
1291
- top,
1292
- bottom,
1293
- left,
1294
- right,
1295
- width,
1296
- height,
1297
- x: left,
1298
- y: top
1299
- };
1300
- }
1301
-
1302
- return fallback;
1303
- }
1304
-
1305
- const resetRects = await platform.getElementRects({
1306
- reference: {
1307
- getBoundingClientRect
1308
- },
1309
- floating: elements.floating,
1310
- strategy
1311
- });
1312
-
1313
- if (rects.reference.x !== resetRects.reference.x || rects.reference.y !== resetRects.reference.y || rects.reference.width !== resetRects.reference.width || rects.reference.height !== resetRects.reference.height) {
1314
- return {
1315
- reset: {
1316
- rects: resetRects
1317
- }
1318
- };
1319
- }
1320
-
1321
- return {};
1322
- }
1323
-
1324
- };
1325
- };
1326
-
1327
- function isWindow(value) {
1328
- return (value == null ? void 0 : value.toString()) === '[object Window]';
1329
- }
1330
- function getWindow(node) {
1331
- if (node == null) {
1332
- return window;
1333
- }
1334
-
1335
- if (!isWindow(node)) {
1336
- const ownerDocument = node.ownerDocument;
1337
- return ownerDocument ? ownerDocument.defaultView || window : window;
1338
- }
1339
-
1340
- return node;
1341
- }
1342
-
1343
- function getComputedStyle$1(element) {
1344
- return getWindow(element).getComputedStyle(element);
1345
- }
1346
-
1347
- function getNodeName(node) {
1348
- return isWindow(node) ? '' : node ? (node.nodeName || '').toLowerCase() : '';
1349
- }
1350
-
1351
- function isHTMLElement(value) {
1352
- return value instanceof getWindow(value).HTMLElement;
1353
- }
1354
- function isElement(value) {
1355
- return value instanceof getWindow(value).Element;
1356
- }
1357
- function isNode(value) {
1358
- return value instanceof getWindow(value).Node;
1359
- }
1360
- function isShadowRoot(node) {
1361
- const OwnElement = getWindow(node).ShadowRoot;
1362
- return node instanceof OwnElement || node instanceof ShadowRoot;
1363
- }
1364
- function isOverflowElement(element) {
1365
- // Firefox wants us to check `-x` and `-y` variations as well
1366
- const {
1367
- overflow,
1368
- overflowX,
1369
- overflowY
1370
- } = getComputedStyle$1(element);
1371
- return /auto|scroll|overlay|hidden/.test(overflow + overflowY + overflowX);
1372
- }
1373
- function isTableElement(element) {
1374
- return ['table', 'td', 'th'].includes(getNodeName(element));
1375
- }
1376
- function isContainingBlock(element) {
1377
- // TODO: Try and use feature detection here instead
1378
- const isFirefox = navigator.userAgent.toLowerCase().includes('firefox');
1379
- const css = getComputedStyle$1(element); // This is non-exhaustive but covers the most common CSS properties that
1380
- // create a containing block.
1381
- // https://developer.mozilla.org/en-US/docs/Web/CSS/Containing_block#identifying_the_containing_block
1382
-
1383
- 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);
1384
- }
1385
-
1386
- const min = Math.min;
1387
- const max = Math.max;
1388
- const round = Math.round;
1389
-
1390
- function getBoundingClientRect(element, includeScale) {
1391
- if (includeScale === void 0) {
1392
- includeScale = false;
1393
- }
1394
-
1395
- const clientRect = element.getBoundingClientRect();
1396
- let scaleX = 1;
1397
- let scaleY = 1;
1398
-
1399
- if (includeScale && isHTMLElement(element)) {
1400
- scaleX = element.offsetWidth > 0 ? round(clientRect.width) / element.offsetWidth || 1 : 1;
1401
- scaleY = element.offsetHeight > 0 ? round(clientRect.height) / element.offsetHeight || 1 : 1;
1402
- }
1403
-
1404
- return {
1405
- width: clientRect.width / scaleX,
1406
- height: clientRect.height / scaleY,
1407
- top: clientRect.top / scaleY,
1408
- right: clientRect.right / scaleX,
1409
- bottom: clientRect.bottom / scaleY,
1410
- left: clientRect.left / scaleX,
1411
- x: clientRect.left / scaleX,
1412
- y: clientRect.top / scaleY
1413
- };
1414
- }
1415
-
1416
- function getDocumentElement(node) {
1417
- return ((isNode(node) ? node.ownerDocument : node.document) || window.document).documentElement;
1418
- }
1419
-
1420
- function getNodeScroll(element) {
1421
- if (isWindow(element)) {
1422
- return {
1423
- scrollLeft: element.pageXOffset,
1424
- scrollTop: element.pageYOffset
1425
- };
1426
- }
1427
-
1428
- return {
1429
- scrollLeft: element.scrollLeft,
1430
- scrollTop: element.scrollTop
1431
- };
1432
- }
1433
-
1434
- function getWindowScrollBarX(element) {
1435
- // If <html> has a CSS width greater than the viewport, then this will be
1436
- // incorrect for RTL.
1437
- return getBoundingClientRect(getDocumentElement(element)).left + getNodeScroll(element).scrollLeft;
1438
- }
1439
-
1440
- function isScaled(element) {
1441
- const rect = getBoundingClientRect(element);
1442
- return round(rect.width) !== element.offsetWidth || round(rect.height) !== element.offsetHeight;
1443
- }
1444
-
1445
- function getRectRelativeToOffsetParent(element, offsetParent, strategy) {
1446
- const isOffsetParentAnElement = isHTMLElement(offsetParent);
1447
- const documentElement = getDocumentElement(offsetParent);
1448
- const rect = getBoundingClientRect(element, isOffsetParentAnElement && isScaled(offsetParent));
1449
- let scroll = {
1450
- scrollLeft: 0,
1451
- scrollTop: 0
1452
- };
1453
- const offsets = {
1454
- x: 0,
1455
- y: 0
1456
- };
1457
-
1458
- if (isOffsetParentAnElement || !isOffsetParentAnElement && strategy !== 'fixed') {
1459
- if (getNodeName(offsetParent) !== 'body' || isOverflowElement(documentElement)) {
1460
- scroll = getNodeScroll(offsetParent);
1461
- }
1462
-
1463
- if (isHTMLElement(offsetParent)) {
1464
- const offsetRect = getBoundingClientRect(offsetParent, true);
1465
- offsets.x = offsetRect.x + offsetParent.clientLeft;
1466
- offsets.y = offsetRect.y + offsetParent.clientTop;
1467
- } else if (documentElement) {
1468
- offsets.x = getWindowScrollBarX(documentElement);
1469
- }
1470
- }
1471
-
1472
- return {
1473
- x: rect.left + scroll.scrollLeft - offsets.x,
1474
- y: rect.top + scroll.scrollTop - offsets.y,
1475
- width: rect.width,
1476
- height: rect.height
1477
- };
1478
- }
1479
-
1480
- function getParentNode(node) {
1481
- if (getNodeName(node) === 'html') {
1482
- return node;
1483
- }
1484
-
1485
- return (// this is a quicker (but less type safe) way to save quite some bytes from the bundle
1486
- // @ts-ignore
1487
- node.assignedSlot || // step into the shadow DOM of the parent of a slotted node
1488
- node.parentNode || ( // DOM Element detected
1489
- isShadowRoot(node) ? node.host : null) || // ShadowRoot detected
1490
- getDocumentElement(node) // fallback
1491
-
1492
- );
1493
- }
1494
-
1495
- function getTrueOffsetParent(element) {
1496
- if (!isHTMLElement(element) || getComputedStyle(element).position === 'fixed') {
1497
- return null;
1498
- }
1499
-
1500
- return element.offsetParent;
1501
- }
1502
-
1503
- function getContainingBlock(element) {
1504
- let currentNode = getParentNode(element);
1505
-
1506
- if (isShadowRoot(currentNode)) {
1507
- currentNode = currentNode.host;
1508
- }
1509
-
1510
- while (isHTMLElement(currentNode) && !['html', 'body'].includes(getNodeName(currentNode))) {
1511
- if (isContainingBlock(currentNode)) {
1512
- return currentNode;
1513
- } else {
1514
- currentNode = currentNode.parentNode;
1515
- }
1516
- }
1517
-
1518
- return null;
1519
- } // Gets the closest ancestor positioned element. Handles some edge cases,
1520
- // such as table ancestors and cross browser bugs.
1521
-
1522
-
1523
- function getOffsetParent(element) {
1524
- const window = getWindow(element);
1525
- let offsetParent = getTrueOffsetParent(element);
1526
-
1527
- while (offsetParent && isTableElement(offsetParent) && getComputedStyle(offsetParent).position === 'static') {
1528
- offsetParent = getTrueOffsetParent(offsetParent);
1529
- }
1530
-
1531
- if (offsetParent && (getNodeName(offsetParent) === 'html' || getNodeName(offsetParent) === 'body' && getComputedStyle(offsetParent).position === 'static' && !isContainingBlock(offsetParent))) {
1532
- return window;
1533
- }
1534
-
1535
- return offsetParent || getContainingBlock(element) || window;
1536
- }
1537
-
1538
- function getDimensions(element) {
1539
- if (isHTMLElement(element)) {
1540
- return {
1541
- width: element.offsetWidth,
1542
- height: element.offsetHeight
1543
- };
1544
- }
1545
-
1546
- const rect = getBoundingClientRect(element);
1547
- return {
1548
- width: rect.width,
1549
- height: rect.height
1550
- };
1551
- }
1552
-
1553
- function convertOffsetParentRelativeRectToViewportRelativeRect(_ref) {
1554
- let {
1555
- rect,
1556
- offsetParent,
1557
- strategy
1558
- } = _ref;
1559
- const isOffsetParentAnElement = isHTMLElement(offsetParent);
1560
- const documentElement = getDocumentElement(offsetParent);
1561
-
1562
- if (offsetParent === documentElement) {
1563
- return rect;
1564
- }
1565
-
1566
- let scroll = {
1567
- scrollLeft: 0,
1568
- scrollTop: 0
1569
- };
1570
- const offsets = {
1571
- x: 0,
1572
- y: 0
1573
- };
1574
-
1575
- if (isOffsetParentAnElement || !isOffsetParentAnElement && strategy !== 'fixed') {
1576
- if (getNodeName(offsetParent) !== 'body' || isOverflowElement(documentElement)) {
1577
- scroll = getNodeScroll(offsetParent);
1578
- }
1579
-
1580
- if (isHTMLElement(offsetParent)) {
1581
- const offsetRect = getBoundingClientRect(offsetParent, true);
1582
- offsets.x = offsetRect.x + offsetParent.clientLeft;
1583
- offsets.y = offsetRect.y + offsetParent.clientTop;
1584
- } // This doesn't appear to be need to be negated.
1585
- // else if (documentElement) {
1586
- // offsets.x = getWindowScrollBarX(documentElement);
1587
- // }
1588
-
1589
- }
1590
-
1591
- return { ...rect,
1592
- x: rect.x - scroll.scrollLeft + offsets.x,
1593
- y: rect.y - scroll.scrollTop + offsets.y
1594
- };
1595
- }
1596
-
1597
- function getViewportRect(element) {
1598
- const win = getWindow(element);
1599
- const html = getDocumentElement(element);
1600
- const visualViewport = win.visualViewport;
1601
- let width = html.clientWidth;
1602
- let height = html.clientHeight;
1603
- let x = 0;
1604
- let y = 0;
1605
-
1606
- if (visualViewport) {
1607
- width = visualViewport.width;
1608
- height = visualViewport.height; // Uses Layout Viewport (like Chrome; Safari does not currently)
1609
- // In Chrome, it returns a value very close to 0 (+/-) but contains rounding
1610
- // errors due to floating point numbers, so we need to check precision.
1611
- // Safari returns a number <= 0, usually < -1 when pinch-zoomed
1612
-
1613
- if (Math.abs(win.innerWidth / visualViewport.scale - visualViewport.width) < 0.01) {
1614
- x = visualViewport.offsetLeft;
1615
- y = visualViewport.offsetTop;
1616
- }
1617
- }
1618
-
1619
- return {
1620
- width,
1621
- height,
1622
- x,
1623
- y
1624
- };
1625
- }
1626
-
1627
- // of the `<html>` and `<body>` rect bounds if horizontally scrollable
1628
-
1629
- function getDocumentRect(element) {
1630
- var _element$ownerDocumen;
1631
-
1632
- const html = getDocumentElement(element);
1633
- const scroll = getNodeScroll(element);
1634
- const body = (_element$ownerDocumen = element.ownerDocument) == null ? void 0 : _element$ownerDocumen.body;
1635
- const width = max(html.scrollWidth, html.clientWidth, body ? body.scrollWidth : 0, body ? body.clientWidth : 0);
1636
- const height = max(html.scrollHeight, html.clientHeight, body ? body.scrollHeight : 0, body ? body.clientHeight : 0);
1637
- let x = -scroll.scrollLeft + getWindowScrollBarX(element);
1638
- const y = -scroll.scrollTop;
1639
-
1640
- if (getComputedStyle$1(body || html).direction === 'rtl') {
1641
- x += max(html.clientWidth, body ? body.clientWidth : 0) - width;
1642
- }
1643
-
1644
- return {
1645
- width,
1646
- height,
1647
- x,
1648
- y
1649
- };
1650
- }
1651
-
1652
- function getNearestOverflowAncestor(node) {
1653
- const parentNode = getParentNode(node);
1654
-
1655
- if (['html', 'body', '#document'].includes(getNodeName(parentNode))) {
1656
- // @ts-ignore assume body is always available
1657
- return node.ownerDocument.body;
1658
- }
1659
-
1660
- if (isHTMLElement(parentNode) && isOverflowElement(parentNode)) {
1661
- return parentNode;
1662
- }
1663
-
1664
- return getNearestOverflowAncestor(parentNode);
1665
- }
1666
-
1667
- function getOverflowAncestors(node, list) {
1668
- var _node$ownerDocument;
1669
-
1670
- if (list === void 0) {
1671
- list = [];
1672
- }
1673
-
1674
- const scrollableAncestor = getNearestOverflowAncestor(node);
1675
- const isBody = scrollableAncestor === ((_node$ownerDocument = node.ownerDocument) == null ? void 0 : _node$ownerDocument.body);
1676
- const win = getWindow(scrollableAncestor);
1677
- const target = isBody ? [win].concat(win.visualViewport || [], isOverflowElement(scrollableAncestor) ? scrollableAncestor : []) : scrollableAncestor;
1678
- const updatedList = list.concat(target);
1679
- return isBody ? updatedList : // @ts-ignore: isBody tells us target will be an HTMLElement here
1680
- updatedList.concat(getOverflowAncestors(getParentNode(target)));
1681
- }
1682
-
1683
- function contains(parent, child) {
1684
- const rootNode = child.getRootNode == null ? void 0 : child.getRootNode(); // First, attempt with faster native method
1685
-
1686
- if (parent.contains(child)) {
1687
- return true;
1688
- } // then fallback to custom implementation with Shadow DOM support
1689
- else if (rootNode && isShadowRoot(rootNode)) {
1690
- let next = child;
1691
-
1692
- do {
1693
- // use `===` replace node.isSameNode()
1694
- if (next && parent === next) {
1695
- return true;
1696
- } // @ts-ignore: need a better way to handle this...
1697
-
1698
-
1699
- next = next.parentNode || next.host;
1700
- } while (next);
1701
- }
1702
-
1703
- return false;
1704
- }
1705
-
1706
- function getInnerBoundingClientRect(element) {
1707
- const clientRect = getBoundingClientRect(element);
1708
- const top = clientRect.top + element.clientTop;
1709
- const left = clientRect.left + element.clientLeft;
1710
- return {
1711
- top,
1712
- left,
1713
- x: left,
1714
- y: top,
1715
- right: left + element.clientWidth,
1716
- bottom: top + element.clientHeight,
1717
- width: element.clientWidth,
1718
- height: element.clientHeight
1719
- };
1720
- }
1721
-
1722
- function getClientRectFromClippingAncestor(element, clippingParent) {
1723
- if (clippingParent === 'viewport') {
1724
- return rectToClientRect(getViewportRect(element));
1725
- }
1726
-
1727
- if (isElement(clippingParent)) {
1728
- return getInnerBoundingClientRect(clippingParent);
1729
- }
1730
-
1731
- return rectToClientRect(getDocumentRect(getDocumentElement(element)));
1732
- } // A "clipping ancestor" is an overflowable container with the characteristic of
1733
- // clipping (or hiding) overflowing elements with a position different from
1734
- // `initial`
1735
-
1736
-
1737
- function getClippingAncestors(element) {
1738
- const clippingAncestors = getOverflowAncestors(element);
1739
- const canEscapeClipping = ['absolute', 'fixed'].includes(getComputedStyle$1(element).position);
1740
- const clipperElement = canEscapeClipping && isHTMLElement(element) ? getOffsetParent(element) : element;
1741
-
1742
- if (!isElement(clipperElement)) {
1743
- return [];
1744
- } // @ts-ignore isElement check ensures we return Array<Element>
1745
-
1746
-
1747
- return clippingAncestors.filter(clippingAncestors => isElement(clippingAncestors) && contains(clippingAncestors, clipperElement) && getNodeName(clippingAncestors) !== 'body');
1748
- } // Gets the maximum area that the element is visible in due to any number of
1749
- // clipping ancestors
1750
-
1751
-
1752
- function getClippingRect(_ref) {
1753
- let {
1754
- element,
1755
- boundary,
1756
- rootBoundary
1757
- } = _ref;
1758
- const mainClippingAncestors = boundary === 'clippingAncestors' ? getClippingAncestors(element) : [].concat(boundary);
1759
- const clippingAncestors = [...mainClippingAncestors, rootBoundary];
1760
- const firstClippingAncestor = clippingAncestors[0];
1761
- const clippingRect = clippingAncestors.reduce((accRect, clippingAncestor) => {
1762
- const rect = getClientRectFromClippingAncestor(element, clippingAncestor);
1763
- accRect.top = max(rect.top, accRect.top);
1764
- accRect.right = min(rect.right, accRect.right);
1765
- accRect.bottom = min(rect.bottom, accRect.bottom);
1766
- accRect.left = max(rect.left, accRect.left);
1767
- return accRect;
1768
- }, getClientRectFromClippingAncestor(element, firstClippingAncestor));
1769
- return {
1770
- width: clippingRect.right - clippingRect.left,
1771
- height: clippingRect.bottom - clippingRect.top,
1772
- x: clippingRect.left,
1773
- y: clippingRect.top
1774
- };
1775
- }
1776
-
1777
- const platform = {
1778
- getClippingRect,
1779
- convertOffsetParentRelativeRectToViewportRelativeRect,
1780
- isElement,
1781
- getDimensions,
1782
- getOffsetParent,
1783
- getDocumentElement,
1784
- getElementRects: _ref => {
1785
- let {
1786
- reference,
1787
- floating,
1788
- strategy
1789
- } = _ref;
1790
- return {
1791
- reference: getRectRelativeToOffsetParent(reference, getOffsetParent(floating), strategy),
1792
- floating: { ...getDimensions(floating),
1793
- x: 0,
1794
- y: 0
1795
- }
1796
- };
1797
- },
1798
- getClientRects: element => Array.from(element.getClientRects()),
1799
- isRTL: element => getComputedStyle$1(element).direction === 'rtl'
1800
- };
1801
-
1802
- /**
1803
- * Automatically updates the position of the floating element when necessary.
1804
- * @see https://floating-ui.com/docs/autoUpdate
1805
- */
1806
- function autoUpdate(reference, floating, update, options) {
1807
- if (options === void 0) {
1808
- options = {};
1809
- }
1810
-
1811
- const {
1812
- ancestorScroll: _ancestorScroll = true,
1813
- ancestorResize: _ancestorResize = true,
1814
- elementResize: _elementResize = true,
1815
- animationFrame = false
1816
- } = options;
1817
- let cleanedUp = false;
1818
- const ancestorScroll = _ancestorScroll && !animationFrame;
1819
- const ancestorResize = _ancestorResize && !animationFrame;
1820
- const elementResize = _elementResize && !animationFrame;
1821
- const ancestors = ancestorScroll || ancestorResize ? [...(isElement(reference) ? getOverflowAncestors(reference) : []), ...getOverflowAncestors(floating)] : [];
1822
- ancestors.forEach(ancestor => {
1823
- ancestorScroll && ancestor.addEventListener('scroll', update, {
1824
- passive: true
1825
- });
1826
- ancestorResize && ancestor.addEventListener('resize', update);
1827
- });
1828
- let observer = null;
1829
-
1830
- if (elementResize) {
1831
- observer = new ResizeObserver(update);
1832
- isElement(reference) && observer.observe(reference);
1833
- observer.observe(floating);
1834
- }
1835
-
1836
- let frameId;
1837
- let prevRefRect = animationFrame ? getBoundingClientRect(reference) : null;
1838
-
1839
- if (animationFrame) {
1840
- frameLoop();
1841
- }
1842
-
1843
- function frameLoop() {
1844
- if (cleanedUp) {
1845
- return;
1846
- }
1847
-
1848
- const nextRefRect = getBoundingClientRect(reference);
1849
-
1850
- if (prevRefRect && (nextRefRect.x !== prevRefRect.x || nextRefRect.y !== prevRefRect.y || nextRefRect.width !== prevRefRect.width || nextRefRect.height !== prevRefRect.height)) {
1851
- update();
1852
- }
1853
-
1854
- prevRefRect = nextRefRect;
1855
- frameId = requestAnimationFrame(frameLoop);
1856
- }
1857
-
1858
- return () => {
1859
- var _observer;
1860
-
1861
- cleanedUp = true;
1862
- ancestors.forEach(ancestor => {
1863
- ancestorScroll && ancestor.removeEventListener('scroll', update);
1864
- ancestorResize && ancestor.removeEventListener('resize', update);
1865
- });
1866
- (_observer = observer) == null ? void 0 : _observer.disconnect();
1867
- observer = null;
1868
-
1869
- if (animationFrame) {
1870
- cancelAnimationFrame(frameId);
1871
- }
1872
- };
1873
- }
1874
-
1875
- /**
1876
- * Computes the `x` and `y` coordinates that will place the floating element
1877
- * next to a reference element when it is given a certain CSS positioning
1878
- * strategy.
1879
- */
1880
-
1881
- const computePosition = (reference, floating, options) => computePosition$1(reference, floating, {
1882
- platform,
1883
- ...options
1884
- });
1885
-
1886
- var _Popup_instances, _Popup_arrowPosition_get, _Popup_padding_get, _Popup_distance_get, _Popup_strategy_get, _Popup_middleware_get, _Popup_cleanup, _Popup_anchorEl, _Popup_assignPopupPosition, _Popup_assignArrowPosition, _Popup_getAnchorById;
1887
- class Popup extends FoundationElement {
1888
- constructor() {
1889
- super();
1890
-
1891
- _Popup_instances.add(this);
1892
-
1893
- _Popup_cleanup.set(this, void 0);
1894
-
1895
- _Popup_anchorEl.set(this, void 0);
1896
-
1897
- this.open = false;
1898
- this.dismissible = false;
1899
- this.arrow = false;
1900
- this.alternate = false;
1901
- this.corner = 'left';
1902
- }
1903
-
1904
- disconnectedCallback() {
1905
- var _a;
1906
-
1907
- super.disconnectedCallback();
1908
- (_a = __classPrivateFieldGet(this, _Popup_cleanup, "f")) === null || _a === void 0 ? void 0 : _a.call(this);
1909
- }
1910
-
1911
- attributeChangedCallback(name, oldValue, newValue) {
1912
- var _a;
1913
-
1914
- super.attributeChangedCallback(name, oldValue, newValue);
1915
-
1916
- switch (name) {
1917
- case 'anchor':
1918
- {
1919
- __classPrivateFieldSet(this, _Popup_anchorEl, __classPrivateFieldGet(this, _Popup_instances, "m", _Popup_getAnchorById).call(this), "f");
1920
-
1921
- break;
1922
- }
1923
- }
1924
-
1925
- if (__classPrivateFieldGet(this, _Popup_anchorEl, "f") && this.popupEl) {
1926
- __classPrivateFieldSet(this, _Popup_cleanup, autoUpdate(__classPrivateFieldGet(this, _Popup_anchorEl, "f"), this.popupEl, () => this.updatePosition()), "f");
1927
- } else {
1928
- (_a = __classPrivateFieldGet(this, _Popup_cleanup, "f")) === null || _a === void 0 ? void 0 : _a.call(this);
1929
- }
1930
- }
1931
-
1932
- async updatePosition() {
1933
- if (!this.open || !__classPrivateFieldGet(this, _Popup_anchorEl, "f")) {
1934
- return;
1935
- }
1936
-
1937
- const positionData = await computePosition(__classPrivateFieldGet(this, _Popup_anchorEl, "f"), this.popupEl, {
1938
- placement: this.corner,
1939
- strategy: __classPrivateFieldGet(this, _Popup_instances, "a", _Popup_strategy_get),
1940
- middleware: __classPrivateFieldGet(this, _Popup_instances, "a", _Popup_middleware_get)
1941
- });
1942
-
1943
- __classPrivateFieldGet(this, _Popup_instances, "m", _Popup_assignPopupPosition).call(this, positionData);
1944
-
1945
- if (this.arrow) {
1946
- __classPrivateFieldGet(this, _Popup_instances, "m", _Popup_assignArrowPosition).call(this, positionData);
1947
- }
1948
- }
1949
-
1950
- }
1951
- _Popup_cleanup = new WeakMap(), _Popup_anchorEl = new WeakMap(), _Popup_instances = new WeakSet(), _Popup_arrowPosition_get = function _Popup_arrowPosition_get() {
1952
- return {
1953
- top: 'bottom',
1954
- right: 'left',
1955
- bottom: 'top',
1956
- left: 'right'
1957
- };
1958
- }, _Popup_padding_get = function _Popup_padding_get() {
1959
- return 0;
1960
- }, _Popup_distance_get = function _Popup_distance_get() {
1961
- return 12;
1962
- }, _Popup_strategy_get = function _Popup_strategy_get() {
1963
- return 'fixed';
1964
- }, _Popup_middleware_get = function _Popup_middleware_get() {
1965
- const middleware = [flip(), hide(), inline()];
1966
-
1967
- if (this.arrow) {
1968
- middleware.push(arrow({
1969
- element: this.arrowEl,
1970
- padding: __classPrivateFieldGet(this, _Popup_instances, "a", _Popup_padding_get)
1971
- }), offset(__classPrivateFieldGet(this, _Popup_instances, "a", _Popup_distance_get)));
1972
- }
1973
-
1974
- return middleware;
1975
- }, _Popup_assignPopupPosition = function _Popup_assignPopupPosition(data) {
1976
- const {
1977
- x: popupX,
1978
- y: popupY
1979
- } = data;
1980
- const {
1981
- referenceHidden
1982
- } = data.middlewareData.hide;
1983
- Object.assign(this.popupEl.style, {
1984
- left: `${popupX}px`,
1985
- top: `${popupY}px`,
1986
- visibility: referenceHidden ? 'hidden' : 'visible'
1987
- });
1988
- }, _Popup_assignArrowPosition = function _Popup_assignArrowPosition(data) {
1989
- const {
1990
- x: arrowX,
1991
- y: arrowY
1992
- } = data.middlewareData.arrow;
1993
-
1994
- const side = __classPrivateFieldGet(this, _Popup_instances, "a", _Popup_arrowPosition_get)[data.placement.split('-')[0]];
1995
-
1996
- Object.assign(this.arrowEl.style, {
1997
- left: `${arrowX}px`,
1998
- top: `${arrowY}px`,
1999
- right: '',
2000
- bottom: '',
2001
- [side]: '-4px'
2002
- });
2003
- }, _Popup_getAnchorById = function _Popup_getAnchorById() {
2004
- return document.getElementById(this.anchor);
2005
- };
2006
-
2007
- __decorate([attr({
2008
- mode: 'boolean'
2009
- }), __metadata("design:type", Object)], Popup.prototype, "open", void 0);
2010
-
2011
- __decorate([attr({
2012
- mode: 'boolean'
2013
- }), __metadata("design:type", Object)], Popup.prototype, "dismissible", void 0);
2014
-
2015
- __decorate([attr({
2016
- mode: 'boolean'
2017
- }), __metadata("design:type", Object)], Popup.prototype, "arrow", void 0);
2018
-
2019
- __decorate([attr({
2020
- mode: 'boolean'
2021
- }), __metadata("design:type", Object)], Popup.prototype, "alternate", void 0);
2022
-
2023
- __decorate([attr({
2024
- mode: 'fromView'
2025
- }), __metadata("design:type", String)], Popup.prototype, "corner", void 0);
2026
-
2027
- __decorate([attr, __metadata("design:type", String)], Popup.prototype, "anchor", void 0);
2028
-
2029
- var css_248z = ".control {\n width: min-content;\n background-color: var(--vvd-color-surface-4dp);\n border-radius: inherit;\n contain: layout;\n}\n.control:not(.open) {\n display: none;\n}\n\n.popup-wrapper {\n position: fixed;\n border-radius: 6px;\n}\n\n.popup-content {\n display: grid;\n color: var(--vvd-color-on-canvas);\n}\n.dismissible .popup-content {\n align-content: start;\n grid-template-columns: 1fr auto;\n}\n\n.arrow {\n position: absolute;\n z-index: -1;\n width: 8px;\n height: 8px;\n background-color: var(--vvd-color-surface-4dp);\n transform: rotate(45deg);\n}\n\n.dismissible {\n align-self: flex-start;\n margin-block-start: 0.25rem;\n margin-inline-end: 0.25rem;\n}";
2030
- styleInject(css_248z);
2031
-
2032
- let _ = t => t,
2033
- _t,
2034
- _t2,
2035
- _t3;
2036
-
2037
- const getClasses = ({
2038
- open,
2039
- dismissible,
2040
- alternate
2041
- }) => classNames('control', ['open', Boolean(open)], ['dismissible', Boolean(dismissible)], ['alternate', Boolean(alternate)]);
2042
-
2043
- const popupTemplate = () => html(_t || (_t = _`
2044
- <vwc-elevation>
2045
- <!--the popup-wrapper is needed for alternating the inside of the popup nd not its shadow-->
2046
- <div class="popup-wrapper" ${0}>
2047
- <div class="${0}" aria-hidden="${0}"
2048
- part="${0}">
2049
- <div class="popup-content">
2050
- <slot></slot>
2051
- ${0}
2052
- </div>
2053
- ${0}
2054
- </div>
2055
- </div>
2056
- </vwc-elevation>`), ref('popupEl'), getClasses, x => x.open ? 'false' : 'true', x => x.alternate ? 'vvd-theme-alternate' : '', when(x => x.dismissible, html(_t2 || (_t2 = _`<vwc-button size="base-small" @click="${0}"
2057
- class="dismissible" icon="close-small-solid" shape="pill"></vwc-button>`), x => x.open = false)), when(x => x.arrow, html(_t3 || (_t3 = _`<div class="arrow" ${0}></div>`), ref('arrowEl'))));
2058
-
2059
- const VIVIDPopup = Popup.compose({
2060
- baseName: 'popup',
2061
- template: popupTemplate,
2062
- styles: css_248z
2063
- });
2064
- designSystem.register(VIVIDPopup());
2065
-
2066
- export { VIVIDPopup };
25
+ registerPopup();