@vonage/vivid 4.31.0 → 5.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 (676) hide show
  1. package/{shared/definition2.cjs → accordion/definition.cjs} +20 -20
  2. package/{shared/definition2.js → accordion/definition.js} +5 -7
  3. package/accordion/index.cjs +5 -5
  4. package/accordion/index.js +129 -3
  5. package/accordion-item/definition.cjs +145 -0
  6. package/accordion-item/definition.js +139 -0
  7. package/accordion-item/index.cjs +1 -5
  8. package/accordion-item/index.js +2 -3
  9. package/{shared/definition3.cjs → action-group/definition.cjs} +12 -9
  10. package/{shared/definition3.js → action-group/definition.js} +5 -4
  11. package/action-group/index.cjs +6 -5
  12. package/action-group/index.js +49 -3
  13. package/{shared/definition4.cjs → alert/definition.cjs} +33 -31
  14. package/{shared/definition4.js → alert/definition.js} +11 -11
  15. package/alert/index.cjs +30 -5
  16. package/alert/index.js +158 -3
  17. package/{shared/definition5.cjs → audio-player/definition.cjs} +58 -57
  18. package/{shared/definition5.js → audio-player/definition.js} +11 -12
  19. package/audio-player/index.cjs +68 -4
  20. package/audio-player/index.js +309 -2
  21. package/{shared/definition6.cjs → avatar/definition.cjs} +28 -26
  22. package/{shared/definition6.js → avatar/definition.js} +7 -7
  23. package/avatar/index.cjs +18 -5
  24. package/avatar/index.js +93 -3
  25. package/{shared/definition7.cjs → badge/definition.cjs} +18 -16
  26. package/{shared/definition7.js → badge/definition.js} +6 -6
  27. package/badge/index.cjs +4 -5
  28. package/badge/index.js +66 -3
  29. package/{shared/definition8.cjs → banner/definition.cjs} +26 -25
  30. package/{shared/definition8.js → banner/definition.js} +10 -11
  31. package/banner/index.cjs +29 -4
  32. package/banner/index.js +128 -2
  33. package/{shared/definition10.cjs → breadcrumb/definition.cjs} +11 -9
  34. package/{shared/definition10.js → breadcrumb/definition.js} +5 -5
  35. package/breadcrumb/index.cjs +12 -5
  36. package/breadcrumb/index.js +69 -3
  37. package/{shared/definition9.cjs → breadcrumb-item/definition.cjs} +18 -15
  38. package/{shared/definition9.js → breadcrumb-item/definition.js} +7 -7
  39. package/breadcrumb-item/index.cjs +5 -5
  40. package/breadcrumb-item/index.js +33 -3
  41. package/bundled/_has.cjs +1 -0
  42. package/bundled/_has.js +34 -0
  43. package/bundled/affix.cjs +13 -0
  44. package/bundled/affix.js +63 -0
  45. package/bundled/anchored.cjs +4 -0
  46. package/bundled/anchored.js +67 -0
  47. package/bundled/aria.cjs +1 -0
  48. package/bundled/aria.js +7 -0
  49. package/bundled/attribute-binding-behaviour.cjs +1 -0
  50. package/bundled/attribute-binding-behaviour.js +27 -0
  51. package/bundled/base-progress.cjs +1 -0
  52. package/bundled/base-progress.js +57 -0
  53. package/bundled/breadcrumb-item.cjs +1 -0
  54. package/bundled/breadcrumb-item.js +21 -0
  55. package/bundled/button.cjs +1 -0
  56. package/bundled/button.js +106 -0
  57. package/bundled/calendar-event.cjs +1 -0
  58. package/bundled/calendar-event.js +34 -0
  59. package/bundled/calendar-picker.template.cjs +148 -0
  60. package/bundled/calendar-picker.template.js +3371 -0
  61. package/bundled/char-count.cjs +13 -0
  62. package/bundled/char-count.js +54 -0
  63. package/bundled/children.cjs +1 -0
  64. package/bundled/children.js +38 -0
  65. package/bundled/class-names.cjs +1 -0
  66. package/bundled/class-names.js +9 -0
  67. package/bundled/definition.cjs +39 -0
  68. package/bundled/definition.js +122 -0
  69. package/bundled/definition10.cjs +19 -0
  70. package/bundled/definition10.js +73 -0
  71. package/bundled/definition11.cjs +10 -0
  72. package/bundled/definition11.js +44 -0
  73. package/bundled/definition12.cjs +1 -0
  74. package/bundled/definition12.js +20 -0
  75. package/bundled/definition13.cjs +73 -0
  76. package/bundled/definition13.js +359 -0
  77. package/bundled/definition14.cjs +5 -0
  78. package/bundled/definition14.js +29 -0
  79. package/bundled/definition15.cjs +30 -0
  80. package/bundled/definition15.js +80 -0
  81. package/bundled/definition16.cjs +19 -0
  82. package/bundled/definition16.js +103 -0
  83. package/bundled/definition17.cjs +13 -0
  84. package/bundled/definition17.js +137 -0
  85. package/bundled/definition18.cjs +12 -0
  86. package/bundled/definition18.js +94 -0
  87. package/bundled/definition19.cjs +67 -0
  88. package/bundled/definition19.js +666 -0
  89. package/bundled/definition2.cjs +20 -0
  90. package/bundled/definition2.js +180 -0
  91. package/bundled/definition20.cjs +20 -0
  92. package/bundled/definition20.js +106 -0
  93. package/bundled/definition21.cjs +5 -0
  94. package/bundled/definition21.js +19 -0
  95. package/bundled/definition22.cjs +24 -0
  96. package/bundled/definition22.js +151 -0
  97. package/bundled/definition3.cjs +29 -0
  98. package/bundled/definition3.js +195 -0
  99. package/bundled/definition4.cjs +6 -0
  100. package/bundled/definition4.js +42 -0
  101. package/bundled/definition5.cjs +1 -0
  102. package/bundled/definition5.js +345 -0
  103. package/bundled/definition6.cjs +31 -0
  104. package/bundled/definition6.js +265 -0
  105. package/bundled/definition7.cjs +30 -0
  106. package/bundled/definition7.js +288 -0
  107. package/bundled/definition8.cjs +19 -0
  108. package/bundled/definition8.js +145 -0
  109. package/bundled/definition9.cjs +14 -0
  110. package/bundled/definition9.js +1406 -0
  111. package/bundled/delegates-aria.cjs +1 -0
  112. package/bundled/delegates-aria.js +77 -0
  113. package/bundled/divider.cjs +1 -0
  114. package/bundled/divider.js +34 -0
  115. package/bundled/dom.cjs +1 -0
  116. package/bundled/dom.js +6 -0
  117. package/bundled/enums.cjs +1 -0
  118. package/bundled/enums.js +9 -0
  119. package/bundled/form-associated.cjs +1 -0
  120. package/bundled/form-associated.js +320 -0
  121. package/bundled/form-element.cjs +1 -0
  122. package/bundled/form-element.js +56 -0
  123. package/bundled/host-semantics.cjs +1 -0
  124. package/bundled/host-semantics.js +57 -0
  125. package/bundled/index.cjs +1 -0
  126. package/bundled/index.js +6 -0
  127. package/bundled/key-codes.cjs +1 -0
  128. package/bundled/key-codes.js +16 -0
  129. package/bundled/linkable.cjs +15 -0
  130. package/bundled/linkable.js +49 -0
  131. package/bundled/listbox.cjs +1 -0
  132. package/bundled/listbox.js +345 -0
  133. package/bundled/localized.cjs +1 -0
  134. package/bundled/localized.js +459 -0
  135. package/bundled/mixins.cjs +33 -0
  136. package/bundled/mixins.js +226 -0
  137. package/bundled/numbers.cjs +1 -0
  138. package/bundled/numbers.js +14 -0
  139. package/bundled/option.cjs +1 -0
  140. package/bundled/option.js +158 -0
  141. package/bundled/picker-field.template.cjs +62 -0
  142. package/bundled/picker-field.template.js +234 -0
  143. package/bundled/playbackRates.cjs +1 -0
  144. package/bundled/playbackRates.js +11 -0
  145. package/bundled/ref.cjs +1 -0
  146. package/bundled/ref.js +32 -0
  147. package/bundled/repeat.cjs +1 -0
  148. package/bundled/repeat.js +341 -0
  149. package/bundled/scrollIntoView.cjs +1 -0
  150. package/bundled/scrollIntoView.js +33 -0
  151. package/bundled/single-date-picker.cjs +1 -0
  152. package/bundled/single-date-picker.js +39 -0
  153. package/bundled/single-value-picker.cjs +1 -0
  154. package/bundled/single-value-picker.js +87 -0
  155. package/bundled/slider.template.cjs +41 -0
  156. package/bundled/slider.template.js +100 -0
  157. package/bundled/slotted.cjs +1 -0
  158. package/bundled/slotted.js +81 -0
  159. package/bundled/strings.cjs +1 -0
  160. package/bundled/strings.js +7 -0
  161. package/bundled/text-field.cjs +1 -0
  162. package/bundled/text-field.js +4 -0
  163. package/bundled/time-selection-picker.template.cjs +46 -0
  164. package/bundled/time-selection-picker.template.js +575 -0
  165. package/bundled/vivid-element.cjs +1 -0
  166. package/bundled/vivid-element.js +1761 -0
  167. package/bundled/when.cjs +1 -0
  168. package/bundled/when.js +11 -0
  169. package/bundled/with-contextual-help.cjs +1 -0
  170. package/bundled/with-contextual-help.js +22 -0
  171. package/bundled/with-error-text.cjs +1 -0
  172. package/bundled/with-error-text.js +39 -0
  173. package/bundled/with-success-text.cjs +1 -0
  174. package/bundled/with-success-text.js +16 -0
  175. package/button/definition.cjs +14 -0
  176. package/button/definition.js +4 -0
  177. package/button/index.cjs +1 -5
  178. package/button/index.js +2 -3
  179. package/{shared/definition13.cjs → calendar/definition.cjs} +27 -449
  180. package/{shared/definition13.js → calendar/definition.js} +7 -431
  181. package/calendar/index.cjs +53 -5
  182. package/calendar/index.js +431 -3
  183. package/{shared/definition12.cjs → calendar-event/definition.cjs} +12 -9
  184. package/{shared/definition12.js → calendar-event/definition.js} +6 -6
  185. package/calendar-event/index.cjs +9 -5
  186. package/calendar-event/index.js +43 -3
  187. package/card/definition.cjs +186 -0
  188. package/{shared/definition14.js → card/definition.js} +10 -11
  189. package/card/index.cjs +47 -5
  190. package/card/index.js +163 -3
  191. package/{shared/definition15.cjs → checkbox/definition.cjs} +35 -30
  192. package/{shared/definition15.js → checkbox/definition.js} +17 -14
  193. package/checkbox/index.cjs +1 -5
  194. package/checkbox/index.js +2 -3
  195. package/{shared/definition16.cjs → combobox/definition.cjs} +50 -52
  196. package/{shared/definition16.js → combobox/definition.js} +19 -23
  197. package/combobox/index.cjs +65 -5
  198. package/combobox/index.js +512 -3
  199. package/contextual-help/definition.cjs +62 -0
  200. package/contextual-help/definition.js +57 -0
  201. package/contextual-help/index.cjs +1 -0
  202. package/contextual-help/index.js +2 -0
  203. package/custom-elements.json +2735 -711
  204. package/{shared/definition17.cjs → data-grid/definition.cjs} +169 -196
  205. package/{shared/definition17.js → data-grid/definition.js} +71 -100
  206. package/data-grid/index.cjs +81 -5
  207. package/data-grid/index.js +1011 -3
  208. package/{shared/definition18.cjs → date-picker/definition.cjs} +20 -17
  209. package/{shared/definition18.js → date-picker/definition.js} +12 -11
  210. package/date-picker/index.cjs +1 -5
  211. package/date-picker/index.js +115 -3
  212. package/{shared/definition19.cjs → date-range-picker/definition.cjs} +26 -23
  213. package/{shared/definition19.js → date-range-picker/definition.js} +10 -9
  214. package/date-range-picker/index.cjs +1 -5
  215. package/date-range-picker/index.js +335 -3
  216. package/{shared/definition20.cjs → date-time-picker/definition.cjs} +27 -24
  217. package/{shared/definition20.js → date-time-picker/definition.js} +13 -12
  218. package/date-time-picker/index.cjs +8 -5
  219. package/date-time-picker/index.js +216 -3
  220. package/{shared/definition21.cjs → dial-pad/definition.cjs} +39 -40
  221. package/{shared/definition21.js → dial-pad/definition.js} +9 -12
  222. package/dial-pad/index.cjs +54 -5
  223. package/dial-pad/index.js +214 -3
  224. package/{shared/definition22.cjs → dialog/definition.cjs} +48 -47
  225. package/{shared/definition22.js → dialog/definition.js} +10 -11
  226. package/dialog/index.cjs +44 -5
  227. package/dialog/index.js +257 -3
  228. package/{shared/definition23.cjs → divider/definition.cjs} +10 -6
  229. package/{shared/definition23.js → divider/definition.js} +6 -5
  230. package/divider/index.cjs +1 -5
  231. package/divider/index.js +2 -3
  232. package/elevation/definition.cjs +11 -0
  233. package/elevation/definition.js +2 -0
  234. package/elevation/index.cjs +1 -5
  235. package/elevation/index.js +2 -3
  236. package/empty-state/definition.cjs +81 -0
  237. package/empty-state/definition.js +75 -0
  238. package/empty-state/index.cjs +14 -5
  239. package/empty-state/index.js +64 -3
  240. package/fab/definition.cjs +105 -0
  241. package/fab/definition.js +99 -0
  242. package/fab/index.cjs +20 -5
  243. package/fab/index.js +86 -3
  244. package/file-picker/definition.cjs +510 -0
  245. package/file-picker/definition.js +504 -0
  246. package/file-picker/index.cjs +58 -5
  247. package/file-picker/index.js +381 -3
  248. package/{shared/definition27.cjs → header/definition.cjs} +14 -11
  249. package/{shared/definition27.js → header/definition.js} +6 -5
  250. package/header/index.cjs +19 -5
  251. package/header/index.js +57 -3
  252. package/{shared/definition28.cjs → icon/definition.cjs} +25 -149
  253. package/{shared/definition28.js → icon/definition.js} +6 -132
  254. package/icon/index.cjs +1 -5
  255. package/icon/index.js +2 -3
  256. package/index.cjs +268 -264
  257. package/index.js +72 -71
  258. package/{shared/definition29.cjs → layout/definition.cjs} +13 -10
  259. package/{shared/definition29.js → layout/definition.js} +4 -3
  260. package/layout/index.cjs +3 -5
  261. package/layout/index.js +52 -3
  262. package/lib/accordion-item/accordion-item.d.ts +42 -2
  263. package/lib/action-group/action-group.d.ts +42 -2
  264. package/lib/alert/alert.d.ts +84 -4
  265. package/lib/audio-player/audio-player.d.ts +42 -2
  266. package/lib/avatar/avatar.d.ts +42 -2
  267. package/lib/badge/badge.d.ts +42 -2
  268. package/lib/banner/banner.d.ts +126 -6
  269. package/lib/breadcrumb/breadcrumb.d.ts +42 -2
  270. package/lib/breadcrumb-item/breadcrumb-item.d.ts +42 -2
  271. package/lib/button/button.d.ts +127 -6
  272. package/lib/calendar-event/calendar-event.d.ts +42 -2
  273. package/lib/card/card.d.ts +42 -2
  274. package/lib/checkbox/checkbox.d.ts +252 -13
  275. package/lib/combobox/combobox.d.ts +252 -12
  276. package/lib/components.d.ts +1 -0
  277. package/lib/contextual-help/contextual-help.d.ts +5 -0
  278. package/lib/contextual-help/contextual-help.template.d.ts +3 -0
  279. package/lib/contextual-help/definition.d.ts +1 -0
  280. package/lib/data-grid/data-grid-cell.d.ts +418 -3
  281. package/lib/data-grid/data-grid-row.d.ts +379 -1
  282. package/lib/date-picker/date-picker.d.ts +374 -54
  283. package/lib/date-range-picker/date-range-picker.d.ts +188 -28
  284. package/lib/date-time-picker/date-time-picker.d.ts +376 -56
  285. package/lib/dial-pad/dial-pad.d.ts +42 -2
  286. package/lib/dialog/dialog.d.ts +84 -4
  287. package/lib/divider/divider.d.ts +42 -2
  288. package/lib/fab/fab.d.ts +43 -2
  289. package/lib/file-picker/accept.d.ts +1 -0
  290. package/lib/file-picker/data-transfer.d.ts +1 -0
  291. package/lib/file-picker/file-picker.d.ts +259 -31
  292. package/lib/file-picker/locale.d.ts +1 -0
  293. package/lib/header/header.d.ts +42 -2
  294. package/lib/menu/menu.d.ts +84 -4
  295. package/lib/menu-item/menu-item.d.ts +84 -4
  296. package/lib/nav/nav.d.ts +42 -2
  297. package/lib/nav-disclosure/nav-disclosure.d.ts +84 -4
  298. package/lib/nav-item/nav-item.d.ts +84 -4
  299. package/lib/note/note.d.ts +42 -2
  300. package/lib/number-field/number-field.d.ts +840 -104
  301. package/lib/option/option.d.ts +85 -4
  302. package/lib/pagination/pagination.d.ts +42 -2
  303. package/lib/progress/progress.d.ts +42 -2
  304. package/lib/progress-ring/progress-ring.d.ts +42 -2
  305. package/lib/radio/radio.d.ts +126 -7
  306. package/lib/radio-group/radio-group.d.ts +42 -2
  307. package/lib/range-slider/range-slider.d.ts +126 -6
  308. package/lib/rich-text-editor/menubar/menubar.d.ts +42 -2
  309. package/lib/rich-text-editor/rich-text-editor.d.ts +42 -2
  310. package/lib/searchable-select/option-tag.d.ts +42 -2
  311. package/lib/searchable-select/searchable-select.d.ts +336 -16
  312. package/lib/select/select.d.ts +294 -14
  313. package/lib/selectable-box/selectable-box.d.ts +42 -3
  314. package/lib/simple-color-picker/definition.d.ts +4 -0
  315. package/lib/simple-color-picker/locale.d.ts +4 -0
  316. package/lib/simple-color-picker/simple-color-picker.d.ts +1600 -0
  317. package/lib/simple-color-picker/simple-color-picker.template.d.ts +3 -0
  318. package/lib/slider/slider.d.ts +126 -6
  319. package/lib/split-button/split-button.d.ts +128 -6
  320. package/lib/switch/switch.d.ts +84 -4
  321. package/lib/tab/tab.d.ts +126 -6
  322. package/lib/tab-panel/tab-panel.d.ts +42 -2
  323. package/lib/tag/tag.d.ts +126 -6
  324. package/lib/tag-group/tag-group.d.ts +42 -2
  325. package/lib/tag-name-map.d.ts +2 -1
  326. package/lib/text-area/text-area.d.ts +787 -91
  327. package/lib/text-field/text-field.d.ts +840 -104
  328. package/lib/time-picker/time-picker.d.ts +188 -28
  329. package/lib/toggletip/toggletip.d.ts +84 -4
  330. package/lib/tooltip/tooltip.d.ts +42 -2
  331. package/lib/tree-item/tree-item.d.ts +84 -4
  332. package/lib/tree-view/tree-view.d.ts +42 -2
  333. package/lib/video-player/video-player.d.ts +42 -2
  334. package/locales/de-DE.cjs +13 -1
  335. package/locales/de-DE.js +13 -1
  336. package/locales/en-GB.cjs +13 -1
  337. package/locales/en-GB.js +13 -1
  338. package/locales/en-US.cjs +13 -1
  339. package/locales/en-US.js +13 -1
  340. package/locales/ja-JP.cjs +13 -1
  341. package/locales/ja-JP.js +13 -1
  342. package/locales/zh-CN.cjs +13 -1
  343. package/locales/zh-CN.js +13 -1
  344. package/{shared/definition31.cjs → menu/definition.cjs} +46 -46
  345. package/{shared/definition31.js → menu/definition.js} +16 -18
  346. package/menu/index.cjs +1 -5
  347. package/menu/index.js +2 -3
  348. package/menu-item/definition.cjs +14 -0
  349. package/menu-item/definition.js +3 -0
  350. package/menu-item/index.cjs +1 -5
  351. package/menu-item/index.js +2 -3
  352. package/{shared/definition34.cjs → nav/definition.cjs} +7 -4
  353. package/{shared/definition34.js → nav/definition.js} +4 -3
  354. package/nav/index.cjs +5 -5
  355. package/nav/index.js +13 -3
  356. package/nav-disclosure/definition.cjs +122 -0
  357. package/nav-disclosure/definition.js +116 -0
  358. package/nav-disclosure/index.cjs +16 -5
  359. package/nav-disclosure/index.js +96 -3
  360. package/{shared/definition33.cjs → nav-item/definition.cjs} +19 -16
  361. package/{shared/definition33.js → nav-item/definition.js} +9 -8
  362. package/nav-item/index.cjs +2 -5
  363. package/nav-item/index.js +59 -3
  364. package/{shared/definition35.cjs → note/definition.cjs} +15 -13
  365. package/{shared/definition35.js → note/definition.js} +6 -6
  366. package/note/index.cjs +9 -5
  367. package/note/index.js +44 -3
  368. package/number-field/definition.cjs +438 -0
  369. package/{shared/definition36.js → number-field/definition.js} +31 -27
  370. package/number-field/index.cjs +60 -5
  371. package/number-field/index.js +369 -3
  372. package/option/definition.cjs +84 -0
  373. package/option/definition.js +78 -0
  374. package/option/index.cjs +1 -5
  375. package/option/index.js +2 -3
  376. package/package.json +15 -4
  377. package/{shared/definition38.cjs → pagination/definition.cjs} +31 -33
  378. package/{shared/definition38.js → pagination/definition.js} +7 -11
  379. package/pagination/index.cjs +43 -5
  380. package/pagination/index.js +194 -3
  381. package/popup/definition.cjs +13 -0
  382. package/popup/definition.js +4 -0
  383. package/popup/index.cjs +1 -5
  384. package/popup/index.js +2 -3
  385. package/{shared/definition40.cjs → progress/definition.cjs} +17 -15
  386. package/{shared/definition40.js → progress/definition.js} +6 -6
  387. package/progress/index.cjs +17 -5
  388. package/progress/index.js +69 -3
  389. package/{shared/definition39.cjs → progress-ring/definition.cjs} +17 -15
  390. package/{shared/definition39.js → progress-ring/definition.js} +7 -7
  391. package/progress-ring/index.cjs +1 -5
  392. package/progress-ring/index.js +2 -3
  393. package/{shared/definition42.cjs → radio/definition.cjs} +20 -23
  394. package/{shared/definition42.js → radio/definition.js} +8 -13
  395. package/radio/index.cjs +1 -5
  396. package/radio/index.js +2 -3
  397. package/{shared/definition41.cjs → radio-group/definition.cjs} +31 -30
  398. package/{shared/definition41.js → radio-group/definition.js} +8 -9
  399. package/radio-group/index.cjs +23 -5
  400. package/radio-group/index.js +255 -3
  401. package/{shared/definition43.cjs → range-slider/definition.cjs} +62 -61
  402. package/{shared/definition43.js → range-slider/definition.js} +13 -14
  403. package/range-slider/index.cjs +68 -5
  404. package/range-slider/index.js +456 -3
  405. package/rich-text-editor/definition.cjs +1206 -0
  406. package/rich-text-editor/definition.js +1200 -0
  407. package/rich-text-editor/index.cjs +133 -4
  408. package/rich-text-editor/index.js +10386 -2
  409. package/{shared/definition45.cjs → searchable-select/definition.cjs} +119 -116
  410. package/{shared/definition45.js → searchable-select/definition.js} +25 -24
  411. package/searchable-select/index.cjs +164 -5
  412. package/searchable-select/index.js +1025 -3
  413. package/{shared/definition46.cjs → select/definition.cjs} +80 -83
  414. package/{shared/definition46.js → select/definition.js} +19 -24
  415. package/select/index.cjs +1 -5
  416. package/select/index.js +2 -3
  417. package/{shared/definition47.cjs → selectable-box/definition.cjs} +26 -32
  418. package/{shared/definition47.js → selectable-box/definition.js} +9 -17
  419. package/selectable-box/index.cjs +28 -5
  420. package/selectable-box/index.js +136 -3
  421. package/shared/aria/aria-mixin.d.ts +43 -3
  422. package/shared/aria/attribute-removal.d.ts +3 -0
  423. package/shared/aria/delegate-aria-behavior.d.ts +0 -3
  424. package/shared/aria/delegates-aria.d.ts +42 -2
  425. package/shared/aria/host-semantics.d.ts +42 -2
  426. package/shared/color-picker/index.d.ts +2 -0
  427. package/shared/color-picker/types.d.ts +4 -0
  428. package/shared/color-picker/utils.d.ts +3 -0
  429. package/shared/feedback/feedback-message.d.ts +42 -2
  430. package/shared/feedback/mixins.d.ts +84 -4
  431. package/shared/foundation/button/button.d.ts +84 -4
  432. package/shared/foundation/form-associated/form-associated.d.ts +84 -4
  433. package/shared/foundation/vivid-element/vivid-element.d.ts +43 -3
  434. package/shared/localization/Locale.d.ts +2 -0
  435. package/shared/patterns/affix.d.ts +84 -4
  436. package/shared/patterns/anchored.d.ts +84 -4
  437. package/shared/patterns/char-count/char-count.d.ts +42 -2
  438. package/shared/patterns/form-elements/form-element.d.ts +84 -4
  439. package/shared/patterns/form-elements/with-contextual-help.d.ts +1238 -0
  440. package/shared/patterns/form-elements/with-error-text.d.ts +126 -6
  441. package/shared/patterns/form-elements/with-success-text.d.ts +42 -2
  442. package/shared/patterns/linkable.d.ts +42 -2
  443. package/shared/patterns/localized.d.ts +42 -2
  444. package/shared/patterns/trapped-focus.d.ts +42 -2
  445. package/shared/picker-field/mixins/calendar-picker.d.ts +94 -14
  446. package/shared/picker-field/mixins/calendar-picker.template.d.ts +94 -14
  447. package/shared/picker-field/mixins/inline-time-picker/inline-time-picker.d.ts +42 -2
  448. package/shared/picker-field/mixins/min-max-calendar-picker.d.ts +188 -28
  449. package/shared/picker-field/mixins/single-date-picker.d.ts +280 -40
  450. package/shared/picker-field/mixins/single-value-picker.d.ts +92 -12
  451. package/shared/picker-field/mixins/time-selection-picker.d.ts +188 -28
  452. package/shared/picker-field/mixins/time-selection-picker.template.d.ts +188 -28
  453. package/shared/picker-field/picker-field.d.ts +252 -12
  454. package/{shared/definition48.cjs → side-drawer/definition.cjs} +16 -14
  455. package/{shared/definition48.js → side-drawer/definition.js} +5 -5
  456. package/side-drawer/index.cjs +17 -3
  457. package/side-drawer/index.js +100 -2
  458. package/simple-color-picker/definition.cjs +398 -0
  459. package/simple-color-picker/definition.js +392 -0
  460. package/simple-color-picker/index.cjs +31 -0
  461. package/simple-color-picker/index.js +250 -0
  462. package/{shared/definition49.cjs → slider/definition.cjs} +46 -53
  463. package/{shared/definition49.js → slider/definition.js} +11 -20
  464. package/slider/index.cjs +1 -5
  465. package/slider/index.js +2 -3
  466. package/split-button/definition.cjs +176 -0
  467. package/split-button/definition.js +170 -0
  468. package/split-button/index.cjs +26 -5
  469. package/split-button/index.js +149 -3
  470. package/styles/core/all.css +1 -1
  471. package/styles/core/theme.css +1 -1
  472. package/styles/core/typography.css +1 -1
  473. package/styles/tokens/theme-dark.css +4 -4
  474. package/styles/tokens/theme-light.css +4 -4
  475. package/styles/tokens/vivid-2-compat.css +1 -1
  476. package/{shared/definition51.cjs → switch/definition.cjs} +20 -19
  477. package/{shared/definition51.js → switch/definition.js} +8 -9
  478. package/switch/index.cjs +16 -5
  479. package/switch/index.js +102 -3
  480. package/tab/definition.cjs +127 -0
  481. package/tab/definition.js +121 -0
  482. package/tab/index.cjs +1 -5
  483. package/tab/index.js +2 -3
  484. package/{shared/definition52.cjs → tab-panel/definition.cjs} +7 -4
  485. package/{shared/definition52.js → tab-panel/definition.js} +4 -3
  486. package/tab-panel/index.cjs +1 -5
  487. package/tab-panel/index.js +2 -3
  488. package/{shared/definition54.cjs → tabs/definition.cjs} +47 -40
  489. package/{shared/definition54.js → tabs/definition.js} +19 -14
  490. package/tabs/index.cjs +31 -5
  491. package/tabs/index.js +321 -3
  492. package/tag/definition.cjs +156 -0
  493. package/tag/definition.js +150 -0
  494. package/tag/index.cjs +19 -5
  495. package/tag/index.js +118 -3
  496. package/{shared/definition55.cjs → tag-group/definition.cjs} +9 -6
  497. package/{shared/definition55.js → tag-group/definition.js} +5 -4
  498. package/tag-group/index.cjs +8 -5
  499. package/tag-group/index.js +26 -3
  500. package/text-area/definition.cjs +355 -0
  501. package/text-area/definition.js +349 -0
  502. package/text-area/index.cjs +41 -5
  503. package/text-area/index.js +293 -3
  504. package/{shared/definition58.cjs → text-field/definition.cjs} +70 -52
  505. package/{shared/definition58.js → text-field/definition.js} +40 -24
  506. package/text-field/index.cjs +1 -5
  507. package/text-field/index.js +2 -3
  508. package/time-picker/definition.cjs +43 -0
  509. package/{shared/definition59.js → time-picker/definition.js} +9 -8
  510. package/time-picker/index.cjs +1 -5
  511. package/time-picker/index.js +29 -3
  512. package/{shared/definition60.cjs → toggletip/definition.cjs} +20 -18
  513. package/{shared/definition60.js → toggletip/definition.js} +8 -8
  514. package/toggletip/index.cjs +1 -5
  515. package/toggletip/index.js +2 -3
  516. package/{shared/definition61.cjs → tooltip/definition.cjs} +16 -13
  517. package/{shared/definition61.js → tooltip/definition.js} +7 -6
  518. package/tooltip/index.cjs +1 -5
  519. package/tooltip/index.js +2 -3
  520. package/tree-item/definition.cjs +13 -0
  521. package/tree-item/definition.js +3 -0
  522. package/tree-item/index.cjs +1 -5
  523. package/tree-item/index.js +2 -3
  524. package/{shared/definition63.cjs → tree-view/definition.cjs} +42 -44
  525. package/{shared/definition63.js → tree-view/definition.js} +7 -11
  526. package/tree-view/index.cjs +13 -5
  527. package/tree-view/index.js +171 -3
  528. package/{shared → unbundled}/affix.cjs +10 -11
  529. package/{shared → unbundled}/affix.js +2 -3
  530. package/{shared → unbundled}/anchored.cjs +7 -8
  531. package/{shared → unbundled}/anchored.js +1 -2
  532. package/{shared → unbundled}/attribute-binding-behaviour.cjs +3 -3
  533. package/{shared → unbundled}/attribute-binding-behaviour.js +1 -1
  534. package/{shared → unbundled}/base-progress.cjs +6 -5
  535. package/{shared → unbundled}/base-progress.js +2 -1
  536. package/{shared → unbundled}/breadcrumb-item.cjs +3 -2
  537. package/{shared → unbundled}/breadcrumb-item.js +2 -1
  538. package/{shared → unbundled}/button.cjs +10 -9
  539. package/{shared → unbundled}/button.js +2 -1
  540. package/{shared → unbundled}/calendar-event.cjs +8 -7
  541. package/{shared → unbundled}/calendar-event.js +2 -1
  542. package/unbundled/calendar-picker.template.cjs +917 -0
  543. package/unbundled/calendar-picker.template.js +906 -0
  544. package/{shared → unbundled}/char-count.cjs +6 -7
  545. package/{shared → unbundled}/char-count.js +2 -3
  546. package/unbundled/definition.cjs +225 -0
  547. package/unbundled/definition.js +220 -0
  548. package/{shared/definition30.cjs → unbundled/definition2.cjs} +49 -46
  549. package/{shared/definition30.js → unbundled/definition2.js} +14 -11
  550. package/unbundled/definition3.cjs +207 -0
  551. package/{shared/definition62.js → unbundled/definition3.js} +6 -10
  552. package/unbundled/definition4.cjs +298 -0
  553. package/unbundled/definition4.js +293 -0
  554. package/{shared/definition65.cjs → unbundled/definition5.cjs} +7 -6
  555. package/{shared/definition65.js → unbundled/definition5.js} +3 -2
  556. package/{shared → unbundled}/delegates-aria.cjs +8 -28
  557. package/{shared → unbundled}/delegates-aria.js +6 -26
  558. package/{shared → unbundled}/divider.cjs +13 -7
  559. package/{shared → unbundled}/divider.js +11 -5
  560. package/{shared → unbundled}/form-associated.cjs +13 -13
  561. package/{shared → unbundled}/form-associated.js +2 -2
  562. package/{shared → unbundled}/form-element.cjs +3 -3
  563. package/{shared → unbundled}/form-element.js +1 -1
  564. package/{shared → unbundled}/host-semantics.cjs +2 -1
  565. package/{shared → unbundled}/host-semantics.js +2 -1
  566. package/unbundled/key-codes.cjs +10 -0
  567. package/unbundled/key-codes.js +7 -0
  568. package/{shared → unbundled}/linkable.cjs +11 -12
  569. package/{shared → unbundled}/linkable.js +1 -2
  570. package/{shared → unbundled}/listbox.cjs +22 -38
  571. package/{shared → unbundled}/listbox.js +4 -20
  572. package/{shared → unbundled}/localized.cjs +2 -2
  573. package/{shared → unbundled}/localized.js +1 -1
  574. package/{shared → unbundled}/mixins.cjs +27 -83
  575. package/{shared → unbundled}/mixins.js +6 -62
  576. package/{shared → unbundled}/option.cjs +42 -17
  577. package/{shared → unbundled}/option.js +29 -4
  578. package/{shared → unbundled}/picker-field.template.cjs +21 -21
  579. package/{shared → unbundled}/picker-field.template.js +7 -7
  580. package/{shared → unbundled}/slider.template.cjs +15 -19
  581. package/{shared → unbundled}/slider.template.js +3 -7
  582. package/unbundled/text-field.cjs +5 -0
  583. package/unbundled/text-field.js +3 -0
  584. package/{shared → unbundled}/time-selection-picker.template.cjs +28 -30
  585. package/{shared → unbundled}/time-selection-picker.template.js +4 -6
  586. package/unbundled/vivid-element.cjs +283 -0
  587. package/unbundled/vivid-element.js +274 -0
  588. package/unbundled/with-contextual-help.cjs +29 -0
  589. package/unbundled/with-contextual-help.js +27 -0
  590. package/{shared → unbundled}/with-error-text.cjs +2 -2
  591. package/{shared → unbundled}/with-error-text.js +1 -1
  592. package/{shared → unbundled}/with-success-text.cjs +2 -2
  593. package/{shared → unbundled}/with-success-text.js +1 -1
  594. package/video-player/definition.cjs +536 -0
  595. package/video-player/definition.js +530 -0
  596. package/video-player/index.cjs +536 -3
  597. package/video-player/index.js +35912 -2
  598. package/{shared/definition66.cjs → visually-hidden/definition.cjs} +6 -3
  599. package/{shared/definition66.js → visually-hidden/definition.js} +3 -2
  600. package/visually-hidden/index.cjs +1 -5
  601. package/visually-hidden/index.js +2 -3
  602. package/vivid.api.json +716 -914
  603. package/shared/_has.cjs +0 -58
  604. package/shared/_has.js +0 -54
  605. package/shared/aria.cjs +0 -11
  606. package/shared/aria.js +0 -9
  607. package/shared/calendar-picker.template.cjs +0 -6377
  608. package/shared/calendar-picker.template.js +0 -6366
  609. package/shared/children.cjs +0 -61
  610. package/shared/children.js +0 -59
  611. package/shared/class-names.cjs +0 -17
  612. package/shared/class-names.js +0 -15
  613. package/shared/definition.cjs +0 -145
  614. package/shared/definition.js +0 -141
  615. package/shared/definition11.cjs +0 -220
  616. package/shared/definition11.js +0 -215
  617. package/shared/definition14.cjs +0 -185
  618. package/shared/definition24.cjs +0 -80
  619. package/shared/definition24.js +0 -76
  620. package/shared/definition25.cjs +0 -90
  621. package/shared/definition25.js +0 -86
  622. package/shared/definition26.cjs +0 -2514
  623. package/shared/definition26.js +0 -2510
  624. package/shared/definition32.cjs +0 -120
  625. package/shared/definition32.js +0 -116
  626. package/shared/definition36.cjs +0 -432
  627. package/shared/definition37.cjs +0 -71
  628. package/shared/definition37.js +0 -68
  629. package/shared/definition44.cjs +0 -14666
  630. package/shared/definition44.js +0 -14662
  631. package/shared/definition50.cjs +0 -148
  632. package/shared/definition50.js +0 -144
  633. package/shared/definition53.cjs +0 -124
  634. package/shared/definition53.js +0 -120
  635. package/shared/definition56.cjs +0 -154
  636. package/shared/definition56.js +0 -150
  637. package/shared/definition57.cjs +0 -335
  638. package/shared/definition57.js +0 -331
  639. package/shared/definition59.cjs +0 -39
  640. package/shared/definition62.cjs +0 -211
  641. package/shared/definition64.cjs +0 -69579
  642. package/shared/definition64.js +0 -69575
  643. package/shared/definition67.cjs +0 -2227
  644. package/shared/definition67.js +0 -2222
  645. package/shared/dom.cjs +0 -10
  646. package/shared/dom.js +0 -8
  647. package/shared/key-codes.cjs +0 -32
  648. package/shared/key-codes.js +0 -18
  649. package/shared/numbers.cjs +0 -38
  650. package/shared/numbers.js +0 -34
  651. package/shared/ref.cjs +0 -43
  652. package/shared/ref.js +0 -41
  653. package/shared/repeat.cjs +0 -767
  654. package/shared/repeat.js +0 -764
  655. package/shared/slotted.cjs +0 -123
  656. package/shared/slotted.js +0 -119
  657. package/shared/strings.cjs +0 -11
  658. package/shared/strings.js +0 -9
  659. package/shared/text-field.cjs +0 -5
  660. package/shared/text-field.js +0 -3
  661. package/shared/vivid-element.cjs +0 -2771
  662. package/shared/vivid-element.js +0 -2748
  663. package/shared/when.cjs +0 -31
  664. package/shared/when.js +0 -29
  665. /package/{shared → unbundled}/enums.cjs +0 -0
  666. /package/{shared → unbundled}/enums.js +0 -0
  667. /package/{shared → unbundled}/index.cjs +0 -0
  668. /package/{shared → unbundled}/index.js +0 -0
  669. /package/{shared → unbundled}/playbackRates.cjs +0 -0
  670. /package/{shared → unbundled}/playbackRates.js +0 -0
  671. /package/{shared → unbundled}/scrollIntoView.cjs +0 -0
  672. /package/{shared → unbundled}/scrollIntoView.js +0 -0
  673. /package/{shared → unbundled}/single-date-picker.cjs +0 -0
  674. /package/{shared → unbundled}/single-date-picker.js +0 -0
  675. /package/{shared → unbundled}/single-value-picker.cjs +0 -0
  676. /package/{shared → unbundled}/single-value-picker.js +0 -0
@@ -1,2227 +0,0 @@
1
- 'use strict';
2
-
3
- const definition$1 = require('./definition11.cjs');
4
- const definition = require('./definition65.cjs');
5
- const vividElement = require('./vivid-element.cjs');
6
- const ref = require('./ref.cjs');
7
- const classNames = require('./class-names.cjs');
8
- const when = require('./when.cjs');
9
-
10
- /**
11
- * Custom positioning reference element.
12
- * @see https://floating-ui.com/docs/virtual-elements
13
- */
14
-
15
- const sides = ['top', 'right', 'bottom', 'left'];
16
- const alignments = ['start', 'end'];
17
- const placements = /*#__PURE__*/sides.reduce((acc, side) => acc.concat(side, side + "-" + alignments[0], side + "-" + alignments[1]), []);
18
- const min = Math.min;
19
- const max = Math.max;
20
- const round = Math.round;
21
- const floor = Math.floor;
22
- const createCoords = v => ({
23
- x: v,
24
- y: v
25
- });
26
- const oppositeSideMap = {
27
- left: 'right',
28
- right: 'left',
29
- bottom: 'top',
30
- top: 'bottom'
31
- };
32
- const oppositeAlignmentMap = {
33
- start: 'end',
34
- end: 'start'
35
- };
36
- function clamp(start, value, end) {
37
- return max(start, min(value, end));
38
- }
39
- function evaluate(value, param) {
40
- return typeof value === 'function' ? value(param) : value;
41
- }
42
- function getSide(placement) {
43
- return placement.split('-')[0];
44
- }
45
- function getAlignment(placement) {
46
- return placement.split('-')[1];
47
- }
48
- function getOppositeAxis(axis) {
49
- return axis === 'x' ? 'y' : 'x';
50
- }
51
- function getAxisLength(axis) {
52
- return axis === 'y' ? 'height' : 'width';
53
- }
54
- const yAxisSides = /*#__PURE__*/new Set(['top', 'bottom']);
55
- function getSideAxis(placement) {
56
- return yAxisSides.has(getSide(placement)) ? 'y' : 'x';
57
- }
58
- function getAlignmentAxis(placement) {
59
- return getOppositeAxis(getSideAxis(placement));
60
- }
61
- function getAlignmentSides(placement, rects, rtl) {
62
- if (rtl === void 0) {
63
- rtl = false;
64
- }
65
- const alignment = getAlignment(placement);
66
- const alignmentAxis = getAlignmentAxis(placement);
67
- const length = getAxisLength(alignmentAxis);
68
- let mainAlignmentSide = alignmentAxis === 'x' ? alignment === (rtl ? 'end' : 'start') ? 'right' : 'left' : alignment === 'start' ? 'bottom' : 'top';
69
- if (rects.reference[length] > rects.floating[length]) {
70
- mainAlignmentSide = getOppositePlacement(mainAlignmentSide);
71
- }
72
- return [mainAlignmentSide, getOppositePlacement(mainAlignmentSide)];
73
- }
74
- function getExpandedPlacements(placement) {
75
- const oppositePlacement = getOppositePlacement(placement);
76
- return [getOppositeAlignmentPlacement(placement), oppositePlacement, getOppositeAlignmentPlacement(oppositePlacement)];
77
- }
78
- function getOppositeAlignmentPlacement(placement) {
79
- return placement.replace(/start|end/g, alignment => oppositeAlignmentMap[alignment]);
80
- }
81
- const lrPlacement = ['left', 'right'];
82
- const rlPlacement = ['right', 'left'];
83
- const tbPlacement = ['top', 'bottom'];
84
- const btPlacement = ['bottom', 'top'];
85
- function getSideList(side, isStart, rtl) {
86
- switch (side) {
87
- case 'top':
88
- case 'bottom':
89
- if (rtl) return isStart ? rlPlacement : lrPlacement;
90
- return isStart ? lrPlacement : rlPlacement;
91
- case 'left':
92
- case 'right':
93
- return isStart ? tbPlacement : btPlacement;
94
- default:
95
- return [];
96
- }
97
- }
98
- function getOppositeAxisPlacements(placement, flipAlignment, direction, rtl) {
99
- const alignment = getAlignment(placement);
100
- let list = getSideList(getSide(placement), direction === 'start', rtl);
101
- if (alignment) {
102
- list = list.map(side => side + "-" + alignment);
103
- if (flipAlignment) {
104
- list = list.concat(list.map(getOppositeAlignmentPlacement));
105
- }
106
- }
107
- return list;
108
- }
109
- function getOppositePlacement(placement) {
110
- return placement.replace(/left|right|bottom|top/g, side => oppositeSideMap[side]);
111
- }
112
- function expandPaddingObject(padding) {
113
- return {
114
- top: 0,
115
- right: 0,
116
- bottom: 0,
117
- left: 0,
118
- ...padding
119
- };
120
- }
121
- function getPaddingObject(padding) {
122
- return typeof padding !== 'number' ? expandPaddingObject(padding) : {
123
- top: padding,
124
- right: padding,
125
- bottom: padding,
126
- left: padding
127
- };
128
- }
129
- function rectToClientRect(rect) {
130
- const {
131
- x,
132
- y,
133
- width,
134
- height
135
- } = rect;
136
- return {
137
- width,
138
- height,
139
- top: y,
140
- left: x,
141
- right: x + width,
142
- bottom: y + height,
143
- x,
144
- y
145
- };
146
- }
147
-
148
- function computeCoordsFromPlacement(_ref, placement, rtl) {
149
- let {
150
- reference,
151
- floating
152
- } = _ref;
153
- const sideAxis = getSideAxis(placement);
154
- const alignmentAxis = getAlignmentAxis(placement);
155
- const alignLength = getAxisLength(alignmentAxis);
156
- const side = getSide(placement);
157
- const isVertical = sideAxis === 'y';
158
- const commonX = reference.x + reference.width / 2 - floating.width / 2;
159
- const commonY = reference.y + reference.height / 2 - floating.height / 2;
160
- const commonAlign = reference[alignLength] / 2 - floating[alignLength] / 2;
161
- let coords;
162
- switch (side) {
163
- case 'top':
164
- coords = {
165
- x: commonX,
166
- y: reference.y - floating.height
167
- };
168
- break;
169
- case 'bottom':
170
- coords = {
171
- x: commonX,
172
- y: reference.y + reference.height
173
- };
174
- break;
175
- case 'right':
176
- coords = {
177
- x: reference.x + reference.width,
178
- y: commonY
179
- };
180
- break;
181
- case 'left':
182
- coords = {
183
- x: reference.x - floating.width,
184
- y: commonY
185
- };
186
- break;
187
- default:
188
- coords = {
189
- x: reference.x,
190
- y: reference.y
191
- };
192
- }
193
- switch (getAlignment(placement)) {
194
- case 'start':
195
- coords[alignmentAxis] -= commonAlign * (rtl && isVertical ? -1 : 1);
196
- break;
197
- case 'end':
198
- coords[alignmentAxis] += commonAlign * (rtl && isVertical ? -1 : 1);
199
- break;
200
- }
201
- return coords;
202
- }
203
-
204
- /**
205
- * Computes the `x` and `y` coordinates that will place the floating element
206
- * next to a given reference element.
207
- *
208
- * This export does not have any `platform` interface logic. You will need to
209
- * write one for the platform you are using Floating UI with.
210
- */
211
- const computePosition$1 = async (reference, floating, config) => {
212
- const {
213
- placement = 'bottom',
214
- strategy = 'absolute',
215
- middleware = [],
216
- platform
217
- } = config;
218
- const validMiddleware = middleware.filter(Boolean);
219
- const rtl = await (platform.isRTL == null ? void 0 : platform.isRTL(floating));
220
- let rects = await platform.getElementRects({
221
- reference,
222
- floating,
223
- strategy
224
- });
225
- let {
226
- x,
227
- y
228
- } = computeCoordsFromPlacement(rects, placement, rtl);
229
- let statefulPlacement = placement;
230
- let middlewareData = {};
231
- let resetCount = 0;
232
- for (let i = 0; i < validMiddleware.length; i++) {
233
- const {
234
- name,
235
- fn
236
- } = validMiddleware[i];
237
- const {
238
- x: nextX,
239
- y: nextY,
240
- data,
241
- reset
242
- } = await fn({
243
- x,
244
- y,
245
- initialPlacement: placement,
246
- placement: statefulPlacement,
247
- strategy,
248
- middlewareData,
249
- rects,
250
- platform,
251
- elements: {
252
- reference,
253
- floating
254
- }
255
- });
256
- x = nextX != null ? nextX : x;
257
- y = nextY != null ? nextY : y;
258
- middlewareData = {
259
- ...middlewareData,
260
- [name]: {
261
- ...middlewareData[name],
262
- ...data
263
- }
264
- };
265
- if (reset && resetCount <= 50) {
266
- resetCount++;
267
- if (typeof reset === 'object') {
268
- if (reset.placement) {
269
- statefulPlacement = reset.placement;
270
- }
271
- if (reset.rects) {
272
- rects = reset.rects === true ? await platform.getElementRects({
273
- reference,
274
- floating,
275
- strategy
276
- }) : reset.rects;
277
- }
278
- ({
279
- x,
280
- y
281
- } = computeCoordsFromPlacement(rects, statefulPlacement, rtl));
282
- }
283
- i = -1;
284
- }
285
- }
286
- return {
287
- x,
288
- y,
289
- placement: statefulPlacement,
290
- strategy,
291
- middlewareData
292
- };
293
- };
294
-
295
- /**
296
- * Resolves with an object of overflow side offsets that determine how much the
297
- * element is overflowing a given clipping boundary on each side.
298
- * - positive = overflowing the boundary by that number of pixels
299
- * - negative = how many pixels left before it will overflow
300
- * - 0 = lies flush with the boundary
301
- * @see https://floating-ui.com/docs/detectOverflow
302
- */
303
- async function detectOverflow(state, options) {
304
- var _await$platform$isEle;
305
- if (options === void 0) {
306
- options = {};
307
- }
308
- const {
309
- x,
310
- y,
311
- platform,
312
- rects,
313
- elements,
314
- strategy
315
- } = state;
316
- const {
317
- boundary = 'clippingAncestors',
318
- rootBoundary = 'viewport',
319
- elementContext = 'floating',
320
- altBoundary = false,
321
- padding = 0
322
- } = evaluate(options, state);
323
- const paddingObject = getPaddingObject(padding);
324
- const altContext = elementContext === 'floating' ? 'reference' : 'floating';
325
- const element = elements[altBoundary ? altContext : elementContext];
326
- const clippingClientRect = rectToClientRect(await platform.getClippingRect({
327
- 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))),
328
- boundary,
329
- rootBoundary,
330
- strategy
331
- }));
332
- const rect = elementContext === 'floating' ? {
333
- x,
334
- y,
335
- width: rects.floating.width,
336
- height: rects.floating.height
337
- } : rects.reference;
338
- const offsetParent = await (platform.getOffsetParent == null ? void 0 : platform.getOffsetParent(elements.floating));
339
- const offsetScale = (await (platform.isElement == null ? void 0 : platform.isElement(offsetParent))) ? (await (platform.getScale == null ? void 0 : platform.getScale(offsetParent))) || {
340
- x: 1,
341
- y: 1
342
- } : {
343
- x: 1,
344
- y: 1
345
- };
346
- const elementClientRect = rectToClientRect(platform.convertOffsetParentRelativeRectToViewportRelativeRect ? await platform.convertOffsetParentRelativeRectToViewportRelativeRect({
347
- elements,
348
- rect,
349
- offsetParent,
350
- strategy
351
- }) : rect);
352
- return {
353
- top: (clippingClientRect.top - elementClientRect.top + paddingObject.top) / offsetScale.y,
354
- bottom: (elementClientRect.bottom - clippingClientRect.bottom + paddingObject.bottom) / offsetScale.y,
355
- left: (clippingClientRect.left - elementClientRect.left + paddingObject.left) / offsetScale.x,
356
- right: (elementClientRect.right - clippingClientRect.right + paddingObject.right) / offsetScale.x
357
- };
358
- }
359
-
360
- /**
361
- * Provides data to position an inner element of the floating element so that it
362
- * appears centered to the reference element.
363
- * @see https://floating-ui.com/docs/arrow
364
- */
365
- const arrow$1 = options => ({
366
- name: 'arrow',
367
- options,
368
- async fn(state) {
369
- const {
370
- x,
371
- y,
372
- placement,
373
- rects,
374
- platform,
375
- elements,
376
- middlewareData
377
- } = state;
378
- // Since `element` is required, we don't Partial<> the type.
379
- const {
380
- element,
381
- padding = 0
382
- } = evaluate(options, state) || {};
383
- if (element == null) {
384
- return {};
385
- }
386
- const paddingObject = getPaddingObject(padding);
387
- const coords = {
388
- x,
389
- y
390
- };
391
- const axis = getAlignmentAxis(placement);
392
- const length = getAxisLength(axis);
393
- const arrowDimensions = await platform.getDimensions(element);
394
- const isYAxis = axis === 'y';
395
- const minProp = isYAxis ? 'top' : 'left';
396
- const maxProp = isYAxis ? 'bottom' : 'right';
397
- const clientProp = isYAxis ? 'clientHeight' : 'clientWidth';
398
- const endDiff = rects.reference[length] + rects.reference[axis] - coords[axis] - rects.floating[length];
399
- const startDiff = coords[axis] - rects.reference[axis];
400
- const arrowOffsetParent = await (platform.getOffsetParent == null ? void 0 : platform.getOffsetParent(element));
401
- let clientSize = arrowOffsetParent ? arrowOffsetParent[clientProp] : 0;
402
-
403
- // DOM platform can return `window` as the `offsetParent`.
404
- if (!clientSize || !(await (platform.isElement == null ? void 0 : platform.isElement(arrowOffsetParent)))) {
405
- clientSize = elements.floating[clientProp] || rects.floating[length];
406
- }
407
- const centerToReference = endDiff / 2 - startDiff / 2;
408
-
409
- // If the padding is large enough that it causes the arrow to no longer be
410
- // centered, modify the padding so that it is centered.
411
- const largestPossiblePadding = clientSize / 2 - arrowDimensions[length] / 2 - 1;
412
- const minPadding = min(paddingObject[minProp], largestPossiblePadding);
413
- const maxPadding = min(paddingObject[maxProp], largestPossiblePadding);
414
-
415
- // Make sure the arrow doesn't overflow the floating element if the center
416
- // point is outside the floating element's bounds.
417
- const min$1 = minPadding;
418
- const max = clientSize - arrowDimensions[length] - maxPadding;
419
- const center = clientSize / 2 - arrowDimensions[length] / 2 + centerToReference;
420
- const offset = clamp(min$1, center, max);
421
-
422
- // If the reference is small enough that the arrow's padding causes it to
423
- // to point to nothing for an aligned placement, adjust the offset of the
424
- // floating element itself. To ensure `shift()` continues to take action,
425
- // a single reset is performed when this is true.
426
- const shouldAddOffset = !middlewareData.arrow && getAlignment(placement) != null && center !== offset && rects.reference[length] / 2 - (center < min$1 ? minPadding : maxPadding) - arrowDimensions[length] / 2 < 0;
427
- const alignmentOffset = shouldAddOffset ? center < min$1 ? center - min$1 : center - max : 0;
428
- return {
429
- [axis]: coords[axis] + alignmentOffset,
430
- data: {
431
- [axis]: offset,
432
- centerOffset: center - offset - alignmentOffset,
433
- ...(shouldAddOffset && {
434
- alignmentOffset
435
- })
436
- },
437
- reset: shouldAddOffset
438
- };
439
- }
440
- });
441
-
442
- function getPlacementList(alignment, autoAlignment, allowedPlacements) {
443
- const allowedPlacementsSortedByAlignment = alignment ? [...allowedPlacements.filter(placement => getAlignment(placement) === alignment), ...allowedPlacements.filter(placement => getAlignment(placement) !== alignment)] : allowedPlacements.filter(placement => getSide(placement) === placement);
444
- return allowedPlacementsSortedByAlignment.filter(placement => {
445
- if (alignment) {
446
- return getAlignment(placement) === alignment || (autoAlignment ? getOppositeAlignmentPlacement(placement) !== placement : false);
447
- }
448
- return true;
449
- });
450
- }
451
- /**
452
- * Optimizes the visibility of the floating element by choosing the placement
453
- * that has the most space available automatically, without needing to specify a
454
- * preferred placement. Alternative to `flip`.
455
- * @see https://floating-ui.com/docs/autoPlacement
456
- */
457
- const autoPlacement$1 = function (options) {
458
- if (options === void 0) {
459
- options = {};
460
- }
461
- return {
462
- name: 'autoPlacement',
463
- options,
464
- async fn(state) {
465
- var _middlewareData$autoP, _middlewareData$autoP2, _placementsThatFitOnE;
466
- const {
467
- rects,
468
- middlewareData,
469
- placement,
470
- platform,
471
- elements
472
- } = state;
473
- const {
474
- crossAxis = false,
475
- alignment,
476
- allowedPlacements = placements,
477
- autoAlignment = true,
478
- ...detectOverflowOptions
479
- } = evaluate(options, state);
480
- const placements$1 = alignment !== undefined || allowedPlacements === placements ? getPlacementList(alignment || null, autoAlignment, allowedPlacements) : allowedPlacements;
481
- const overflow = await detectOverflow(state, detectOverflowOptions);
482
- const currentIndex = ((_middlewareData$autoP = middlewareData.autoPlacement) == null ? void 0 : _middlewareData$autoP.index) || 0;
483
- const currentPlacement = placements$1[currentIndex];
484
- if (currentPlacement == null) {
485
- return {};
486
- }
487
- const alignmentSides = getAlignmentSides(currentPlacement, rects, await (platform.isRTL == null ? void 0 : platform.isRTL(elements.floating)));
488
-
489
- // Make `computeCoords` start from the right place.
490
- if (placement !== currentPlacement) {
491
- return {
492
- reset: {
493
- placement: placements$1[0]
494
- }
495
- };
496
- }
497
- const currentOverflows = [overflow[getSide(currentPlacement)], overflow[alignmentSides[0]], overflow[alignmentSides[1]]];
498
- const allOverflows = [...(((_middlewareData$autoP2 = middlewareData.autoPlacement) == null ? void 0 : _middlewareData$autoP2.overflows) || []), {
499
- placement: currentPlacement,
500
- overflows: currentOverflows
501
- }];
502
- const nextPlacement = placements$1[currentIndex + 1];
503
-
504
- // There are more placements to check.
505
- if (nextPlacement) {
506
- return {
507
- data: {
508
- index: currentIndex + 1,
509
- overflows: allOverflows
510
- },
511
- reset: {
512
- placement: nextPlacement
513
- }
514
- };
515
- }
516
- const placementsSortedByMostSpace = allOverflows.map(d => {
517
- const alignment = getAlignment(d.placement);
518
- return [d.placement, alignment && crossAxis ?
519
- // Check along the mainAxis and main crossAxis side.
520
- d.overflows.slice(0, 2).reduce((acc, v) => acc + v, 0) :
521
- // Check only the mainAxis.
522
- d.overflows[0], d.overflows];
523
- }).sort((a, b) => a[1] - b[1]);
524
- const placementsThatFitOnEachSide = placementsSortedByMostSpace.filter(d => d[2].slice(0,
525
- // Aligned placements should not check their opposite crossAxis
526
- // side.
527
- getAlignment(d[0]) ? 2 : 3).every(v => v <= 0));
528
- const resetPlacement = ((_placementsThatFitOnE = placementsThatFitOnEachSide[0]) == null ? void 0 : _placementsThatFitOnE[0]) || placementsSortedByMostSpace[0][0];
529
- if (resetPlacement !== placement) {
530
- return {
531
- data: {
532
- index: currentIndex + 1,
533
- overflows: allOverflows
534
- },
535
- reset: {
536
- placement: resetPlacement
537
- }
538
- };
539
- }
540
- return {};
541
- }
542
- };
543
- };
544
-
545
- /**
546
- * Optimizes the visibility of the floating element by flipping the `placement`
547
- * in order to keep it in view when the preferred placement(s) will overflow the
548
- * clipping boundary. Alternative to `autoPlacement`.
549
- * @see https://floating-ui.com/docs/flip
550
- */
551
- const flip$1 = function (options) {
552
- if (options === void 0) {
553
- options = {};
554
- }
555
- return {
556
- name: 'flip',
557
- options,
558
- async fn(state) {
559
- var _middlewareData$arrow, _middlewareData$flip;
560
- const {
561
- placement,
562
- middlewareData,
563
- rects,
564
- initialPlacement,
565
- platform,
566
- elements
567
- } = state;
568
- const {
569
- mainAxis: checkMainAxis = true,
570
- crossAxis: checkCrossAxis = true,
571
- fallbackPlacements: specifiedFallbackPlacements,
572
- fallbackStrategy = 'bestFit',
573
- fallbackAxisSideDirection = 'none',
574
- flipAlignment = true,
575
- ...detectOverflowOptions
576
- } = evaluate(options, state);
577
-
578
- // If a reset by the arrow was caused due to an alignment offset being
579
- // added, we should skip any logic now since `flip()` has already done its
580
- // work.
581
- // https://github.com/floating-ui/floating-ui/issues/2549#issuecomment-1719601643
582
- if ((_middlewareData$arrow = middlewareData.arrow) != null && _middlewareData$arrow.alignmentOffset) {
583
- return {};
584
- }
585
- const side = getSide(placement);
586
- const initialSideAxis = getSideAxis(initialPlacement);
587
- const isBasePlacement = getSide(initialPlacement) === initialPlacement;
588
- const rtl = await (platform.isRTL == null ? void 0 : platform.isRTL(elements.floating));
589
- const fallbackPlacements = specifiedFallbackPlacements || (isBasePlacement || !flipAlignment ? [getOppositePlacement(initialPlacement)] : getExpandedPlacements(initialPlacement));
590
- const hasFallbackAxisSideDirection = fallbackAxisSideDirection !== 'none';
591
- if (!specifiedFallbackPlacements && hasFallbackAxisSideDirection) {
592
- fallbackPlacements.push(...getOppositeAxisPlacements(initialPlacement, flipAlignment, fallbackAxisSideDirection, rtl));
593
- }
594
- const placements = [initialPlacement, ...fallbackPlacements];
595
- const overflow = await detectOverflow(state, detectOverflowOptions);
596
- const overflows = [];
597
- let overflowsData = ((_middlewareData$flip = middlewareData.flip) == null ? void 0 : _middlewareData$flip.overflows) || [];
598
- if (checkMainAxis) {
599
- overflows.push(overflow[side]);
600
- }
601
- if (checkCrossAxis) {
602
- const sides = getAlignmentSides(placement, rects, rtl);
603
- overflows.push(overflow[sides[0]], overflow[sides[1]]);
604
- }
605
- overflowsData = [...overflowsData, {
606
- placement,
607
- overflows
608
- }];
609
-
610
- // One or more sides is overflowing.
611
- if (!overflows.every(side => side <= 0)) {
612
- var _middlewareData$flip2, _overflowsData$filter;
613
- const nextIndex = (((_middlewareData$flip2 = middlewareData.flip) == null ? void 0 : _middlewareData$flip2.index) || 0) + 1;
614
- const nextPlacement = placements[nextIndex];
615
- if (nextPlacement) {
616
- const ignoreCrossAxisOverflow = checkCrossAxis === 'alignment' ? initialSideAxis !== getSideAxis(nextPlacement) : false;
617
- if (!ignoreCrossAxisOverflow ||
618
- // We leave the current main axis only if every placement on that axis
619
- // overflows the main axis.
620
- overflowsData.every(d => d.overflows[0] > 0 && getSideAxis(d.placement) === initialSideAxis)) {
621
- // Try next placement and re-run the lifecycle.
622
- return {
623
- data: {
624
- index: nextIndex,
625
- overflows: overflowsData
626
- },
627
- reset: {
628
- placement: nextPlacement
629
- }
630
- };
631
- }
632
- }
633
-
634
- // First, find the candidates that fit on the mainAxis side of overflow,
635
- // then find the placement that fits the best on the main crossAxis side.
636
- let resetPlacement = (_overflowsData$filter = overflowsData.filter(d => d.overflows[0] <= 0).sort((a, b) => a.overflows[1] - b.overflows[1])[0]) == null ? void 0 : _overflowsData$filter.placement;
637
-
638
- // Otherwise fallback.
639
- if (!resetPlacement) {
640
- switch (fallbackStrategy) {
641
- case 'bestFit':
642
- {
643
- var _overflowsData$filter2;
644
- const placement = (_overflowsData$filter2 = overflowsData.filter(d => {
645
- if (hasFallbackAxisSideDirection) {
646
- const currentSideAxis = getSideAxis(d.placement);
647
- return currentSideAxis === initialSideAxis ||
648
- // Create a bias to the `y` side axis due to horizontal
649
- // reading directions favoring greater width.
650
- currentSideAxis === 'y';
651
- }
652
- return true;
653
- }).map(d => [d.placement, d.overflows.filter(overflow => overflow > 0).reduce((acc, overflow) => acc + overflow, 0)]).sort((a, b) => a[1] - b[1])[0]) == null ? void 0 : _overflowsData$filter2[0];
654
- if (placement) {
655
- resetPlacement = placement;
656
- }
657
- break;
658
- }
659
- case 'initialPlacement':
660
- resetPlacement = initialPlacement;
661
- break;
662
- }
663
- }
664
- if (placement !== resetPlacement) {
665
- return {
666
- reset: {
667
- placement: resetPlacement
668
- }
669
- };
670
- }
671
- }
672
- return {};
673
- }
674
- };
675
- };
676
-
677
- function getSideOffsets(overflow, rect) {
678
- return {
679
- top: overflow.top - rect.height,
680
- right: overflow.right - rect.width,
681
- bottom: overflow.bottom - rect.height,
682
- left: overflow.left - rect.width
683
- };
684
- }
685
- function isAnySideFullyClipped(overflow) {
686
- return sides.some(side => overflow[side] >= 0);
687
- }
688
- /**
689
- * Provides data to hide the floating element in applicable situations, such as
690
- * when it is not in the same clipping context as the reference element.
691
- * @see https://floating-ui.com/docs/hide
692
- */
693
- const hide$1 = function (options) {
694
- if (options === void 0) {
695
- options = {};
696
- }
697
- return {
698
- name: 'hide',
699
- options,
700
- async fn(state) {
701
- const {
702
- rects
703
- } = state;
704
- const {
705
- strategy = 'referenceHidden',
706
- ...detectOverflowOptions
707
- } = evaluate(options, state);
708
- switch (strategy) {
709
- case 'referenceHidden':
710
- {
711
- const overflow = await detectOverflow(state, {
712
- ...detectOverflowOptions,
713
- elementContext: 'reference'
714
- });
715
- const offsets = getSideOffsets(overflow, rects.reference);
716
- return {
717
- data: {
718
- referenceHiddenOffsets: offsets,
719
- referenceHidden: isAnySideFullyClipped(offsets)
720
- }
721
- };
722
- }
723
- case 'escaped':
724
- {
725
- const overflow = await detectOverflow(state, {
726
- ...detectOverflowOptions,
727
- altBoundary: true
728
- });
729
- const offsets = getSideOffsets(overflow, rects.floating);
730
- return {
731
- data: {
732
- escapedOffsets: offsets,
733
- escaped: isAnySideFullyClipped(offsets)
734
- }
735
- };
736
- }
737
- default:
738
- {
739
- return {};
740
- }
741
- }
742
- }
743
- };
744
- };
745
-
746
- function getBoundingRect(rects) {
747
- const minX = min(...rects.map(rect => rect.left));
748
- const minY = min(...rects.map(rect => rect.top));
749
- const maxX = max(...rects.map(rect => rect.right));
750
- const maxY = max(...rects.map(rect => rect.bottom));
751
- return {
752
- x: minX,
753
- y: minY,
754
- width: maxX - minX,
755
- height: maxY - minY
756
- };
757
- }
758
- function getRectsByLine(rects) {
759
- const sortedRects = rects.slice().sort((a, b) => a.y - b.y);
760
- const groups = [];
761
- let prevRect = null;
762
- for (let i = 0; i < sortedRects.length; i++) {
763
- const rect = sortedRects[i];
764
- if (!prevRect || rect.y - prevRect.y > prevRect.height / 2) {
765
- groups.push([rect]);
766
- } else {
767
- groups[groups.length - 1].push(rect);
768
- }
769
- prevRect = rect;
770
- }
771
- return groups.map(rect => rectToClientRect(getBoundingRect(rect)));
772
- }
773
- /**
774
- * Provides improved positioning for inline reference elements that can span
775
- * over multiple lines, such as hyperlinks or range selections.
776
- * @see https://floating-ui.com/docs/inline
777
- */
778
- const inline$1 = function (options) {
779
- if (options === void 0) {
780
- options = {};
781
- }
782
- return {
783
- name: 'inline',
784
- options,
785
- async fn(state) {
786
- const {
787
- placement,
788
- elements,
789
- rects,
790
- platform,
791
- strategy
792
- } = state;
793
- // A MouseEvent's client{X,Y} coords can be up to 2 pixels off a
794
- // ClientRect's bounds, despite the event listener being triggered. A
795
- // padding of 2 seems to handle this issue.
796
- const {
797
- padding = 2,
798
- x,
799
- y
800
- } = evaluate(options, state);
801
- const nativeClientRects = Array.from((await (platform.getClientRects == null ? void 0 : platform.getClientRects(elements.reference))) || []);
802
- const clientRects = getRectsByLine(nativeClientRects);
803
- const fallback = rectToClientRect(getBoundingRect(nativeClientRects));
804
- const paddingObject = getPaddingObject(padding);
805
- function getBoundingClientRect() {
806
- // There are two rects and they are disjoined.
807
- if (clientRects.length === 2 && clientRects[0].left > clientRects[1].right && x != null && y != null) {
808
- // Find the first rect in which the point is fully inside.
809
- return clientRects.find(rect => x > rect.left - paddingObject.left && x < rect.right + paddingObject.right && y > rect.top - paddingObject.top && y < rect.bottom + paddingObject.bottom) || fallback;
810
- }
811
-
812
- // There are 2 or more connected rects.
813
- if (clientRects.length >= 2) {
814
- if (getSideAxis(placement) === 'y') {
815
- const firstRect = clientRects[0];
816
- const lastRect = clientRects[clientRects.length - 1];
817
- const isTop = getSide(placement) === 'top';
818
- const top = firstRect.top;
819
- const bottom = lastRect.bottom;
820
- const left = isTop ? firstRect.left : lastRect.left;
821
- const right = isTop ? firstRect.right : lastRect.right;
822
- const width = right - left;
823
- const height = bottom - top;
824
- return {
825
- top,
826
- bottom,
827
- left,
828
- right,
829
- width,
830
- height,
831
- x: left,
832
- y: top
833
- };
834
- }
835
- const isLeftSide = getSide(placement) === 'left';
836
- const maxRight = max(...clientRects.map(rect => rect.right));
837
- const minLeft = min(...clientRects.map(rect => rect.left));
838
- const measureRects = clientRects.filter(rect => isLeftSide ? rect.left === minLeft : rect.right === maxRight);
839
- const top = measureRects[0].top;
840
- const bottom = measureRects[measureRects.length - 1].bottom;
841
- const left = minLeft;
842
- const right = maxRight;
843
- const width = right - left;
844
- const height = bottom - top;
845
- return {
846
- top,
847
- bottom,
848
- left,
849
- right,
850
- width,
851
- height,
852
- x: left,
853
- y: top
854
- };
855
- }
856
- return fallback;
857
- }
858
- const resetRects = await platform.getElementRects({
859
- reference: {
860
- getBoundingClientRect
861
- },
862
- floating: elements.floating,
863
- strategy
864
- });
865
- 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) {
866
- return {
867
- reset: {
868
- rects: resetRects
869
- }
870
- };
871
- }
872
- return {};
873
- }
874
- };
875
- };
876
-
877
- const originSides = /*#__PURE__*/new Set(['left', 'top']);
878
-
879
- // For type backwards-compatibility, the `OffsetOptions` type was also
880
- // Derivable.
881
-
882
- async function convertValueToCoords(state, options) {
883
- const {
884
- placement,
885
- platform,
886
- elements
887
- } = state;
888
- const rtl = await (platform.isRTL == null ? void 0 : platform.isRTL(elements.floating));
889
- const side = getSide(placement);
890
- const alignment = getAlignment(placement);
891
- const isVertical = getSideAxis(placement) === 'y';
892
- const mainAxisMulti = originSides.has(side) ? -1 : 1;
893
- const crossAxisMulti = rtl && isVertical ? -1 : 1;
894
- const rawValue = evaluate(options, state);
895
-
896
- // eslint-disable-next-line prefer-const
897
- let {
898
- mainAxis,
899
- crossAxis,
900
- alignmentAxis
901
- } = typeof rawValue === 'number' ? {
902
- mainAxis: rawValue,
903
- crossAxis: 0,
904
- alignmentAxis: null
905
- } : {
906
- mainAxis: rawValue.mainAxis || 0,
907
- crossAxis: rawValue.crossAxis || 0,
908
- alignmentAxis: rawValue.alignmentAxis
909
- };
910
- if (alignment && typeof alignmentAxis === 'number') {
911
- crossAxis = alignment === 'end' ? alignmentAxis * -1 : alignmentAxis;
912
- }
913
- return isVertical ? {
914
- x: crossAxis * crossAxisMulti,
915
- y: mainAxis * mainAxisMulti
916
- } : {
917
- x: mainAxis * mainAxisMulti,
918
- y: crossAxis * crossAxisMulti
919
- };
920
- }
921
-
922
- /**
923
- * Modifies the placement by translating the floating element along the
924
- * specified axes.
925
- * A number (shorthand for `mainAxis` or distance), or an axes configuration
926
- * object may be passed.
927
- * @see https://floating-ui.com/docs/offset
928
- */
929
- const offset$1 = function (options) {
930
- if (options === void 0) {
931
- options = 0;
932
- }
933
- return {
934
- name: 'offset',
935
- options,
936
- async fn(state) {
937
- var _middlewareData$offse, _middlewareData$arrow;
938
- const {
939
- x,
940
- y,
941
- placement,
942
- middlewareData
943
- } = state;
944
- const diffCoords = await convertValueToCoords(state, options);
945
-
946
- // If the placement is the same and the arrow caused an alignment offset
947
- // then we don't need to change the positioning coordinates.
948
- if (placement === ((_middlewareData$offse = middlewareData.offset) == null ? void 0 : _middlewareData$offse.placement) && (_middlewareData$arrow = middlewareData.arrow) != null && _middlewareData$arrow.alignmentOffset) {
949
- return {};
950
- }
951
- return {
952
- x: x + diffCoords.x,
953
- y: y + diffCoords.y,
954
- data: {
955
- ...diffCoords,
956
- placement
957
- }
958
- };
959
- }
960
- };
961
- };
962
-
963
- /**
964
- * Provides data that allows you to change the size of the floating element —
965
- * for instance, prevent it from overflowing the clipping boundary or match the
966
- * width of the reference element.
967
- * @see https://floating-ui.com/docs/size
968
- */
969
- const size$1 = function (options) {
970
- if (options === void 0) {
971
- options = {};
972
- }
973
- return {
974
- name: 'size',
975
- options,
976
- async fn(state) {
977
- var _state$middlewareData, _state$middlewareData2;
978
- const {
979
- placement,
980
- rects,
981
- platform,
982
- elements
983
- } = state;
984
- const {
985
- apply = () => {},
986
- ...detectOverflowOptions
987
- } = evaluate(options, state);
988
- const overflow = await detectOverflow(state, detectOverflowOptions);
989
- const side = getSide(placement);
990
- const alignment = getAlignment(placement);
991
- const isYAxis = getSideAxis(placement) === 'y';
992
- const {
993
- width,
994
- height
995
- } = rects.floating;
996
- let heightSide;
997
- let widthSide;
998
- if (side === 'top' || side === 'bottom') {
999
- heightSide = side;
1000
- widthSide = alignment === ((await (platform.isRTL == null ? void 0 : platform.isRTL(elements.floating))) ? 'start' : 'end') ? 'left' : 'right';
1001
- } else {
1002
- widthSide = side;
1003
- heightSide = alignment === 'end' ? 'top' : 'bottom';
1004
- }
1005
- const maximumClippingHeight = height - overflow.top - overflow.bottom;
1006
- const maximumClippingWidth = width - overflow.left - overflow.right;
1007
- const overflowAvailableHeight = min(height - overflow[heightSide], maximumClippingHeight);
1008
- const overflowAvailableWidth = min(width - overflow[widthSide], maximumClippingWidth);
1009
- const noShift = !state.middlewareData.shift;
1010
- let availableHeight = overflowAvailableHeight;
1011
- let availableWidth = overflowAvailableWidth;
1012
- if ((_state$middlewareData = state.middlewareData.shift) != null && _state$middlewareData.enabled.x) {
1013
- availableWidth = maximumClippingWidth;
1014
- }
1015
- if ((_state$middlewareData2 = state.middlewareData.shift) != null && _state$middlewareData2.enabled.y) {
1016
- availableHeight = maximumClippingHeight;
1017
- }
1018
- if (noShift && !alignment) {
1019
- const xMin = max(overflow.left, 0);
1020
- const xMax = max(overflow.right, 0);
1021
- const yMin = max(overflow.top, 0);
1022
- const yMax = max(overflow.bottom, 0);
1023
- if (isYAxis) {
1024
- availableWidth = width - 2 * (xMin !== 0 || xMax !== 0 ? xMin + xMax : max(overflow.left, overflow.right));
1025
- } else {
1026
- availableHeight = height - 2 * (yMin !== 0 || yMax !== 0 ? yMin + yMax : max(overflow.top, overflow.bottom));
1027
- }
1028
- }
1029
- await apply({
1030
- ...state,
1031
- availableWidth,
1032
- availableHeight
1033
- });
1034
- const nextDimensions = await platform.getDimensions(elements.floating);
1035
- if (width !== nextDimensions.width || height !== nextDimensions.height) {
1036
- return {
1037
- reset: {
1038
- rects: true
1039
- }
1040
- };
1041
- }
1042
- return {};
1043
- }
1044
- };
1045
- };
1046
-
1047
- function hasWindow() {
1048
- return typeof window !== 'undefined';
1049
- }
1050
- function getNodeName(node) {
1051
- if (isNode(node)) {
1052
- return (node.nodeName || '').toLowerCase();
1053
- }
1054
- // Mocked nodes in testing environments may not be instances of Node. By
1055
- // returning `#document` an infinite loop won't occur.
1056
- // https://github.com/floating-ui/floating-ui/issues/2317
1057
- return '#document';
1058
- }
1059
- function getWindow(node) {
1060
- var _node$ownerDocument;
1061
- return (node == null || (_node$ownerDocument = node.ownerDocument) == null ? void 0 : _node$ownerDocument.defaultView) || window;
1062
- }
1063
- function getDocumentElement(node) {
1064
- var _ref;
1065
- return (_ref = (isNode(node) ? node.ownerDocument : node.document) || window.document) == null ? void 0 : _ref.documentElement;
1066
- }
1067
- function isNode(value) {
1068
- if (!hasWindow()) {
1069
- return false;
1070
- }
1071
- return value instanceof Node || value instanceof getWindow(value).Node;
1072
- }
1073
- function isElement(value) {
1074
- if (!hasWindow()) {
1075
- return false;
1076
- }
1077
- return value instanceof Element || value instanceof getWindow(value).Element;
1078
- }
1079
- function isHTMLElement(value) {
1080
- if (!hasWindow()) {
1081
- return false;
1082
- }
1083
- return value instanceof HTMLElement || value instanceof getWindow(value).HTMLElement;
1084
- }
1085
- function isShadowRoot(value) {
1086
- if (!hasWindow() || typeof ShadowRoot === 'undefined') {
1087
- return false;
1088
- }
1089
- return value instanceof ShadowRoot || value instanceof getWindow(value).ShadowRoot;
1090
- }
1091
- const invalidOverflowDisplayValues = /*#__PURE__*/new Set(['inline', 'contents']);
1092
- function isOverflowElement(element) {
1093
- const {
1094
- overflow,
1095
- overflowX,
1096
- overflowY,
1097
- display
1098
- } = getComputedStyle(element);
1099
- return /auto|scroll|overlay|hidden|clip/.test(overflow + overflowY + overflowX) && !invalidOverflowDisplayValues.has(display);
1100
- }
1101
- const tableElements = /*#__PURE__*/new Set(['table', 'td', 'th']);
1102
- function isTableElement(element) {
1103
- return tableElements.has(getNodeName(element));
1104
- }
1105
- const topLayerSelectors = [':popover-open', ':modal'];
1106
- function isTopLayer(element) {
1107
- return topLayerSelectors.some(selector => {
1108
- try {
1109
- return element.matches(selector);
1110
- } catch (_e) {
1111
- return false;
1112
- }
1113
- });
1114
- }
1115
- const transformProperties = ['transform', 'translate', 'scale', 'rotate', 'perspective'];
1116
- const willChangeValues = ['transform', 'translate', 'scale', 'rotate', 'perspective', 'filter'];
1117
- const containValues = ['paint', 'layout', 'strict', 'content'];
1118
- function isContainingBlock(elementOrCss) {
1119
- const webkit = isWebKit();
1120
- const css = isElement(elementOrCss) ? getComputedStyle(elementOrCss) : elementOrCss;
1121
-
1122
- // https://developer.mozilla.org/en-US/docs/Web/CSS/Containing_block#identifying_the_containing_block
1123
- // https://drafts.csswg.org/css-transforms-2/#individual-transforms
1124
- return transformProperties.some(value => css[value] ? css[value] !== 'none' : false) || (css.containerType ? css.containerType !== 'normal' : false) || !webkit && (css.backdropFilter ? css.backdropFilter !== 'none' : false) || !webkit && (css.filter ? css.filter !== 'none' : false) || willChangeValues.some(value => (css.willChange || '').includes(value)) || containValues.some(value => (css.contain || '').includes(value));
1125
- }
1126
- function getContainingBlock(element) {
1127
- let currentNode = getParentNode(element);
1128
- while (isHTMLElement(currentNode) && !isLastTraversableNode(currentNode)) {
1129
- if (isContainingBlock(currentNode)) {
1130
- return currentNode;
1131
- } else if (isTopLayer(currentNode)) {
1132
- return null;
1133
- }
1134
- currentNode = getParentNode(currentNode);
1135
- }
1136
- return null;
1137
- }
1138
- function isWebKit() {
1139
- if (typeof CSS === 'undefined' || !CSS.supports) return false;
1140
- return CSS.supports('-webkit-backdrop-filter', 'none');
1141
- }
1142
- const lastTraversableNodeNames = /*#__PURE__*/new Set(['html', 'body', '#document']);
1143
- function isLastTraversableNode(node) {
1144
- return lastTraversableNodeNames.has(getNodeName(node));
1145
- }
1146
- function getComputedStyle(element) {
1147
- return getWindow(element).getComputedStyle(element);
1148
- }
1149
- function getNodeScroll(element) {
1150
- if (isElement(element)) {
1151
- return {
1152
- scrollLeft: element.scrollLeft,
1153
- scrollTop: element.scrollTop
1154
- };
1155
- }
1156
- return {
1157
- scrollLeft: element.scrollX,
1158
- scrollTop: element.scrollY
1159
- };
1160
- }
1161
- function getParentNode(node) {
1162
- if (getNodeName(node) === 'html') {
1163
- return node;
1164
- }
1165
- const result =
1166
- // Step into the shadow DOM of the parent of a slotted node.
1167
- node.assignedSlot ||
1168
- // DOM Element detected.
1169
- node.parentNode ||
1170
- // ShadowRoot detected.
1171
- isShadowRoot(node) && node.host ||
1172
- // Fallback.
1173
- getDocumentElement(node);
1174
- return isShadowRoot(result) ? result.host : result;
1175
- }
1176
- function getNearestOverflowAncestor(node) {
1177
- const parentNode = getParentNode(node);
1178
- if (isLastTraversableNode(parentNode)) {
1179
- return node.ownerDocument ? node.ownerDocument.body : node.body;
1180
- }
1181
- if (isHTMLElement(parentNode) && isOverflowElement(parentNode)) {
1182
- return parentNode;
1183
- }
1184
- return getNearestOverflowAncestor(parentNode);
1185
- }
1186
- function getOverflowAncestors(node, list, traverseIframes) {
1187
- var _node$ownerDocument2;
1188
- if (list === void 0) {
1189
- list = [];
1190
- }
1191
- if (traverseIframes === void 0) {
1192
- traverseIframes = true;
1193
- }
1194
- const scrollableAncestor = getNearestOverflowAncestor(node);
1195
- const isBody = scrollableAncestor === ((_node$ownerDocument2 = node.ownerDocument) == null ? void 0 : _node$ownerDocument2.body);
1196
- const win = getWindow(scrollableAncestor);
1197
- if (isBody) {
1198
- const frameElement = getFrameElement(win);
1199
- return list.concat(win, win.visualViewport || [], isOverflowElement(scrollableAncestor) ? scrollableAncestor : [], frameElement && traverseIframes ? getOverflowAncestors(frameElement) : []);
1200
- }
1201
- return list.concat(scrollableAncestor, getOverflowAncestors(scrollableAncestor, [], traverseIframes));
1202
- }
1203
- function getFrameElement(win) {
1204
- return win.parent && Object.getPrototypeOf(win.parent) ? win.frameElement : null;
1205
- }
1206
-
1207
- function getCssDimensions(element) {
1208
- const css = getComputedStyle(element);
1209
- // In testing environments, the `width` and `height` properties are empty
1210
- // strings for SVG elements, returning NaN. Fallback to `0` in this case.
1211
- let width = parseFloat(css.width) || 0;
1212
- let height = parseFloat(css.height) || 0;
1213
- const hasOffset = isHTMLElement(element);
1214
- const offsetWidth = hasOffset ? element.offsetWidth : width;
1215
- const offsetHeight = hasOffset ? element.offsetHeight : height;
1216
- const shouldFallback = round(width) !== offsetWidth || round(height) !== offsetHeight;
1217
- if (shouldFallback) {
1218
- width = offsetWidth;
1219
- height = offsetHeight;
1220
- }
1221
- return {
1222
- width,
1223
- height,
1224
- $: shouldFallback
1225
- };
1226
- }
1227
-
1228
- function unwrapElement(element) {
1229
- return !isElement(element) ? element.contextElement : element;
1230
- }
1231
-
1232
- function getScale(element) {
1233
- const domElement = unwrapElement(element);
1234
- if (!isHTMLElement(domElement)) {
1235
- return createCoords(1);
1236
- }
1237
- const rect = domElement.getBoundingClientRect();
1238
- const {
1239
- width,
1240
- height,
1241
- $
1242
- } = getCssDimensions(domElement);
1243
- let x = ($ ? round(rect.width) : rect.width) / width;
1244
- let y = ($ ? round(rect.height) : rect.height) / height;
1245
-
1246
- // 0, NaN, or Infinity should always fallback to 1.
1247
-
1248
- if (!x || !Number.isFinite(x)) {
1249
- x = 1;
1250
- }
1251
- if (!y || !Number.isFinite(y)) {
1252
- y = 1;
1253
- }
1254
- return {
1255
- x,
1256
- y
1257
- };
1258
- }
1259
-
1260
- const noOffsets = /*#__PURE__*/createCoords(0);
1261
- function getVisualOffsets(element) {
1262
- const win = getWindow(element);
1263
- if (!isWebKit() || !win.visualViewport) {
1264
- return noOffsets;
1265
- }
1266
- return {
1267
- x: win.visualViewport.offsetLeft,
1268
- y: win.visualViewport.offsetTop
1269
- };
1270
- }
1271
- function shouldAddVisualOffsets(element, isFixed, floatingOffsetParent) {
1272
- if (isFixed === void 0) {
1273
- isFixed = false;
1274
- }
1275
- if (!floatingOffsetParent || isFixed && floatingOffsetParent !== getWindow(element)) {
1276
- return false;
1277
- }
1278
- return isFixed;
1279
- }
1280
-
1281
- function getBoundingClientRect(element, includeScale, isFixedStrategy, offsetParent) {
1282
- if (includeScale === void 0) {
1283
- includeScale = false;
1284
- }
1285
- if (isFixedStrategy === void 0) {
1286
- isFixedStrategy = false;
1287
- }
1288
- const clientRect = element.getBoundingClientRect();
1289
- const domElement = unwrapElement(element);
1290
- let scale = createCoords(1);
1291
- if (includeScale) {
1292
- if (offsetParent) {
1293
- if (isElement(offsetParent)) {
1294
- scale = getScale(offsetParent);
1295
- }
1296
- } else {
1297
- scale = getScale(element);
1298
- }
1299
- }
1300
- const visualOffsets = shouldAddVisualOffsets(domElement, isFixedStrategy, offsetParent) ? getVisualOffsets(domElement) : createCoords(0);
1301
- let x = (clientRect.left + visualOffsets.x) / scale.x;
1302
- let y = (clientRect.top + visualOffsets.y) / scale.y;
1303
- let width = clientRect.width / scale.x;
1304
- let height = clientRect.height / scale.y;
1305
- if (domElement) {
1306
- const win = getWindow(domElement);
1307
- const offsetWin = offsetParent && isElement(offsetParent) ? getWindow(offsetParent) : offsetParent;
1308
- let currentWin = win;
1309
- let currentIFrame = getFrameElement(currentWin);
1310
- while (currentIFrame && offsetParent && offsetWin !== currentWin) {
1311
- const iframeScale = getScale(currentIFrame);
1312
- const iframeRect = currentIFrame.getBoundingClientRect();
1313
- const css = getComputedStyle(currentIFrame);
1314
- const left = iframeRect.left + (currentIFrame.clientLeft + parseFloat(css.paddingLeft)) * iframeScale.x;
1315
- const top = iframeRect.top + (currentIFrame.clientTop + parseFloat(css.paddingTop)) * iframeScale.y;
1316
- x *= iframeScale.x;
1317
- y *= iframeScale.y;
1318
- width *= iframeScale.x;
1319
- height *= iframeScale.y;
1320
- x += left;
1321
- y += top;
1322
- currentWin = getWindow(currentIFrame);
1323
- currentIFrame = getFrameElement(currentWin);
1324
- }
1325
- }
1326
- return rectToClientRect({
1327
- width,
1328
- height,
1329
- x,
1330
- y
1331
- });
1332
- }
1333
-
1334
- // If <html> has a CSS width greater than the viewport, then this will be
1335
- // incorrect for RTL.
1336
- function getWindowScrollBarX(element, rect) {
1337
- const leftScroll = getNodeScroll(element).scrollLeft;
1338
- if (!rect) {
1339
- return getBoundingClientRect(getDocumentElement(element)).left + leftScroll;
1340
- }
1341
- return rect.left + leftScroll;
1342
- }
1343
-
1344
- function getHTMLOffset(documentElement, scroll, ignoreScrollbarX) {
1345
- if (ignoreScrollbarX === void 0) {
1346
- ignoreScrollbarX = false;
1347
- }
1348
- const htmlRect = documentElement.getBoundingClientRect();
1349
- const x = htmlRect.left + scroll.scrollLeft - (ignoreScrollbarX ? 0 :
1350
- // RTL <body> scrollbar.
1351
- getWindowScrollBarX(documentElement, htmlRect));
1352
- const y = htmlRect.top + scroll.scrollTop;
1353
- return {
1354
- x,
1355
- y
1356
- };
1357
- }
1358
-
1359
- function convertOffsetParentRelativeRectToViewportRelativeRect(_ref) {
1360
- let {
1361
- elements,
1362
- rect,
1363
- offsetParent,
1364
- strategy
1365
- } = _ref;
1366
- const isFixed = strategy === 'fixed';
1367
- const documentElement = getDocumentElement(offsetParent);
1368
- const topLayer = elements ? isTopLayer(elements.floating) : false;
1369
- if (offsetParent === documentElement || topLayer && isFixed) {
1370
- return rect;
1371
- }
1372
- let scroll = {
1373
- scrollLeft: 0,
1374
- scrollTop: 0
1375
- };
1376
- let scale = createCoords(1);
1377
- const offsets = createCoords(0);
1378
- const isOffsetParentAnElement = isHTMLElement(offsetParent);
1379
- if (isOffsetParentAnElement || !isOffsetParentAnElement && !isFixed) {
1380
- if (getNodeName(offsetParent) !== 'body' || isOverflowElement(documentElement)) {
1381
- scroll = getNodeScroll(offsetParent);
1382
- }
1383
- if (isHTMLElement(offsetParent)) {
1384
- const offsetRect = getBoundingClientRect(offsetParent);
1385
- scale = getScale(offsetParent);
1386
- offsets.x = offsetRect.x + offsetParent.clientLeft;
1387
- offsets.y = offsetRect.y + offsetParent.clientTop;
1388
- }
1389
- }
1390
- const htmlOffset = documentElement && !isOffsetParentAnElement && !isFixed ? getHTMLOffset(documentElement, scroll, true) : createCoords(0);
1391
- return {
1392
- width: rect.width * scale.x,
1393
- height: rect.height * scale.y,
1394
- x: rect.x * scale.x - scroll.scrollLeft * scale.x + offsets.x + htmlOffset.x,
1395
- y: rect.y * scale.y - scroll.scrollTop * scale.y + offsets.y + htmlOffset.y
1396
- };
1397
- }
1398
-
1399
- function getClientRects(element) {
1400
- return Array.from(element.getClientRects());
1401
- }
1402
-
1403
- // Gets the entire size of the scrollable document area, even extending outside
1404
- // of the `<html>` and `<body>` rect bounds if horizontally scrollable.
1405
- function getDocumentRect(element) {
1406
- const html = getDocumentElement(element);
1407
- const scroll = getNodeScroll(element);
1408
- const body = element.ownerDocument.body;
1409
- const width = max(html.scrollWidth, html.clientWidth, body.scrollWidth, body.clientWidth);
1410
- const height = max(html.scrollHeight, html.clientHeight, body.scrollHeight, body.clientHeight);
1411
- let x = -scroll.scrollLeft + getWindowScrollBarX(element);
1412
- const y = -scroll.scrollTop;
1413
- if (getComputedStyle(body).direction === 'rtl') {
1414
- x += max(html.clientWidth, body.clientWidth) - width;
1415
- }
1416
- return {
1417
- width,
1418
- height,
1419
- x,
1420
- y
1421
- };
1422
- }
1423
-
1424
- function getViewportRect(element, strategy) {
1425
- const win = getWindow(element);
1426
- const html = getDocumentElement(element);
1427
- const visualViewport = win.visualViewport;
1428
- let width = html.clientWidth;
1429
- let height = html.clientHeight;
1430
- let x = 0;
1431
- let y = 0;
1432
- if (visualViewport) {
1433
- width = visualViewport.width;
1434
- height = visualViewport.height;
1435
- const visualViewportBased = isWebKit();
1436
- if (!visualViewportBased || visualViewportBased && strategy === 'fixed') {
1437
- x = visualViewport.offsetLeft;
1438
- y = visualViewport.offsetTop;
1439
- }
1440
- }
1441
- return {
1442
- width,
1443
- height,
1444
- x,
1445
- y
1446
- };
1447
- }
1448
-
1449
- const absoluteOrFixed = /*#__PURE__*/new Set(['absolute', 'fixed']);
1450
- // Returns the inner client rect, subtracting scrollbars if present.
1451
- function getInnerBoundingClientRect(element, strategy) {
1452
- const clientRect = getBoundingClientRect(element, true, strategy === 'fixed');
1453
- const top = clientRect.top + element.clientTop;
1454
- const left = clientRect.left + element.clientLeft;
1455
- const scale = isHTMLElement(element) ? getScale(element) : createCoords(1);
1456
- const width = element.clientWidth * scale.x;
1457
- const height = element.clientHeight * scale.y;
1458
- const x = left * scale.x;
1459
- const y = top * scale.y;
1460
- return {
1461
- width,
1462
- height,
1463
- x,
1464
- y
1465
- };
1466
- }
1467
- function getClientRectFromClippingAncestor(element, clippingAncestor, strategy) {
1468
- let rect;
1469
- if (clippingAncestor === 'viewport') {
1470
- rect = getViewportRect(element, strategy);
1471
- } else if (clippingAncestor === 'document') {
1472
- rect = getDocumentRect(getDocumentElement(element));
1473
- } else if (isElement(clippingAncestor)) {
1474
- rect = getInnerBoundingClientRect(clippingAncestor, strategy);
1475
- } else {
1476
- const visualOffsets = getVisualOffsets(element);
1477
- rect = {
1478
- x: clippingAncestor.x - visualOffsets.x,
1479
- y: clippingAncestor.y - visualOffsets.y,
1480
- width: clippingAncestor.width,
1481
- height: clippingAncestor.height
1482
- };
1483
- }
1484
- return rectToClientRect(rect);
1485
- }
1486
- function hasFixedPositionAncestor(element, stopNode) {
1487
- const parentNode = getParentNode(element);
1488
- if (parentNode === stopNode || !isElement(parentNode) || isLastTraversableNode(parentNode)) {
1489
- return false;
1490
- }
1491
- return getComputedStyle(parentNode).position === 'fixed' || hasFixedPositionAncestor(parentNode, stopNode);
1492
- }
1493
-
1494
- // A "clipping ancestor" is an `overflow` element with the characteristic of
1495
- // clipping (or hiding) child elements. This returns all clipping ancestors
1496
- // of the given element up the tree.
1497
- function getClippingElementAncestors(element, cache) {
1498
- const cachedResult = cache.get(element);
1499
- if (cachedResult) {
1500
- return cachedResult;
1501
- }
1502
- let result = getOverflowAncestors(element, [], false).filter(el => isElement(el) && getNodeName(el) !== 'body');
1503
- let currentContainingBlockComputedStyle = null;
1504
- const elementIsFixed = getComputedStyle(element).position === 'fixed';
1505
- let currentNode = elementIsFixed ? getParentNode(element) : element;
1506
-
1507
- // https://developer.mozilla.org/en-US/docs/Web/CSS/Containing_block#identifying_the_containing_block
1508
- while (isElement(currentNode) && !isLastTraversableNode(currentNode)) {
1509
- const computedStyle = getComputedStyle(currentNode);
1510
- const currentNodeIsContaining = isContainingBlock(currentNode);
1511
- if (!currentNodeIsContaining && computedStyle.position === 'fixed') {
1512
- currentContainingBlockComputedStyle = null;
1513
- }
1514
- const shouldDropCurrentNode = elementIsFixed ? !currentNodeIsContaining && !currentContainingBlockComputedStyle : !currentNodeIsContaining && computedStyle.position === 'static' && !!currentContainingBlockComputedStyle && absoluteOrFixed.has(currentContainingBlockComputedStyle.position) || isOverflowElement(currentNode) && !currentNodeIsContaining && hasFixedPositionAncestor(element, currentNode);
1515
- if (shouldDropCurrentNode) {
1516
- // Drop non-containing blocks.
1517
- result = result.filter(ancestor => ancestor !== currentNode);
1518
- } else {
1519
- // Record last containing block for next iteration.
1520
- currentContainingBlockComputedStyle = computedStyle;
1521
- }
1522
- currentNode = getParentNode(currentNode);
1523
- }
1524
- cache.set(element, result);
1525
- return result;
1526
- }
1527
-
1528
- // Gets the maximum area that the element is visible in due to any number of
1529
- // clipping ancestors.
1530
- function getClippingRect(_ref) {
1531
- let {
1532
- element,
1533
- boundary,
1534
- rootBoundary,
1535
- strategy
1536
- } = _ref;
1537
- const elementClippingAncestors = boundary === 'clippingAncestors' ? isTopLayer(element) ? [] : getClippingElementAncestors(element, this._c) : [].concat(boundary);
1538
- const clippingAncestors = [...elementClippingAncestors, rootBoundary];
1539
- const firstClippingAncestor = clippingAncestors[0];
1540
- const clippingRect = clippingAncestors.reduce((accRect, clippingAncestor) => {
1541
- const rect = getClientRectFromClippingAncestor(element, clippingAncestor, strategy);
1542
- accRect.top = max(rect.top, accRect.top);
1543
- accRect.right = min(rect.right, accRect.right);
1544
- accRect.bottom = min(rect.bottom, accRect.bottom);
1545
- accRect.left = max(rect.left, accRect.left);
1546
- return accRect;
1547
- }, getClientRectFromClippingAncestor(element, firstClippingAncestor, strategy));
1548
- return {
1549
- width: clippingRect.right - clippingRect.left,
1550
- height: clippingRect.bottom - clippingRect.top,
1551
- x: clippingRect.left,
1552
- y: clippingRect.top
1553
- };
1554
- }
1555
-
1556
- function getDimensions(element) {
1557
- const {
1558
- width,
1559
- height
1560
- } = getCssDimensions(element);
1561
- return {
1562
- width,
1563
- height
1564
- };
1565
- }
1566
-
1567
- function getRectRelativeToOffsetParent(element, offsetParent, strategy) {
1568
- const isOffsetParentAnElement = isHTMLElement(offsetParent);
1569
- const documentElement = getDocumentElement(offsetParent);
1570
- const isFixed = strategy === 'fixed';
1571
- const rect = getBoundingClientRect(element, true, isFixed, offsetParent);
1572
- let scroll = {
1573
- scrollLeft: 0,
1574
- scrollTop: 0
1575
- };
1576
- const offsets = createCoords(0);
1577
-
1578
- // If the <body> scrollbar appears on the left (e.g. RTL systems). Use
1579
- // Firefox with layout.scrollbar.side = 3 in about:config to test this.
1580
- function setLeftRTLScrollbarOffset() {
1581
- offsets.x = getWindowScrollBarX(documentElement);
1582
- }
1583
- if (isOffsetParentAnElement || !isOffsetParentAnElement && !isFixed) {
1584
- if (getNodeName(offsetParent) !== 'body' || isOverflowElement(documentElement)) {
1585
- scroll = getNodeScroll(offsetParent);
1586
- }
1587
- if (isOffsetParentAnElement) {
1588
- const offsetRect = getBoundingClientRect(offsetParent, true, isFixed, offsetParent);
1589
- offsets.x = offsetRect.x + offsetParent.clientLeft;
1590
- offsets.y = offsetRect.y + offsetParent.clientTop;
1591
- } else if (documentElement) {
1592
- setLeftRTLScrollbarOffset();
1593
- }
1594
- }
1595
- if (isFixed && !isOffsetParentAnElement && documentElement) {
1596
- setLeftRTLScrollbarOffset();
1597
- }
1598
- const htmlOffset = documentElement && !isOffsetParentAnElement && !isFixed ? getHTMLOffset(documentElement, scroll) : createCoords(0);
1599
- const x = rect.left + scroll.scrollLeft - offsets.x - htmlOffset.x;
1600
- const y = rect.top + scroll.scrollTop - offsets.y - htmlOffset.y;
1601
- return {
1602
- x,
1603
- y,
1604
- width: rect.width,
1605
- height: rect.height
1606
- };
1607
- }
1608
-
1609
- function isStaticPositioned(element) {
1610
- return getComputedStyle(element).position === 'static';
1611
- }
1612
-
1613
- function getTrueOffsetParent(element, polyfill) {
1614
- if (!isHTMLElement(element) || getComputedStyle(element).position === 'fixed') {
1615
- return null;
1616
- }
1617
- if (polyfill) {
1618
- return polyfill(element);
1619
- }
1620
- let rawOffsetParent = element.offsetParent;
1621
-
1622
- // Firefox returns the <html> element as the offsetParent if it's non-static,
1623
- // while Chrome and Safari return the <body> element. The <body> element must
1624
- // be used to perform the correct calculations even if the <html> element is
1625
- // non-static.
1626
- if (getDocumentElement(element) === rawOffsetParent) {
1627
- rawOffsetParent = rawOffsetParent.ownerDocument.body;
1628
- }
1629
- return rawOffsetParent;
1630
- }
1631
-
1632
- // Gets the closest ancestor positioned element. Handles some edge cases,
1633
- // such as table ancestors and cross browser bugs.
1634
- function getOffsetParent(element, polyfill) {
1635
- const win = getWindow(element);
1636
- if (isTopLayer(element)) {
1637
- return win;
1638
- }
1639
- if (!isHTMLElement(element)) {
1640
- let svgOffsetParent = getParentNode(element);
1641
- while (svgOffsetParent && !isLastTraversableNode(svgOffsetParent)) {
1642
- if (isElement(svgOffsetParent) && !isStaticPositioned(svgOffsetParent)) {
1643
- return svgOffsetParent;
1644
- }
1645
- svgOffsetParent = getParentNode(svgOffsetParent);
1646
- }
1647
- return win;
1648
- }
1649
- let offsetParent = getTrueOffsetParent(element, polyfill);
1650
- while (offsetParent && isTableElement(offsetParent) && isStaticPositioned(offsetParent)) {
1651
- offsetParent = getTrueOffsetParent(offsetParent, polyfill);
1652
- }
1653
- if (offsetParent && isLastTraversableNode(offsetParent) && isStaticPositioned(offsetParent) && !isContainingBlock(offsetParent)) {
1654
- return win;
1655
- }
1656
- return offsetParent || getContainingBlock(element) || win;
1657
- }
1658
-
1659
- const getElementRects = async function (data) {
1660
- const getOffsetParentFn = this.getOffsetParent || getOffsetParent;
1661
- const getDimensionsFn = this.getDimensions;
1662
- const floatingDimensions = await getDimensionsFn(data.floating);
1663
- return {
1664
- reference: getRectRelativeToOffsetParent(data.reference, await getOffsetParentFn(data.floating), data.strategy),
1665
- floating: {
1666
- x: 0,
1667
- y: 0,
1668
- width: floatingDimensions.width,
1669
- height: floatingDimensions.height
1670
- }
1671
- };
1672
- };
1673
-
1674
- function isRTL(element) {
1675
- return getComputedStyle(element).direction === 'rtl';
1676
- }
1677
-
1678
- const platform = {
1679
- convertOffsetParentRelativeRectToViewportRelativeRect,
1680
- getDocumentElement,
1681
- getClippingRect,
1682
- getOffsetParent,
1683
- getElementRects,
1684
- getClientRects,
1685
- getDimensions,
1686
- getScale,
1687
- isElement,
1688
- isRTL
1689
- };
1690
-
1691
- function rectsAreEqual(a, b) {
1692
- return a.x === b.x && a.y === b.y && a.width === b.width && a.height === b.height;
1693
- }
1694
-
1695
- // https://samthor.au/2021/observing-dom/
1696
- function observeMove(element, onMove) {
1697
- let io = null;
1698
- let timeoutId;
1699
- const root = getDocumentElement(element);
1700
- function cleanup() {
1701
- var _io;
1702
- clearTimeout(timeoutId);
1703
- (_io = io) == null || _io.disconnect();
1704
- io = null;
1705
- }
1706
- function refresh(skip, threshold) {
1707
- if (skip === void 0) {
1708
- skip = false;
1709
- }
1710
- if (threshold === void 0) {
1711
- threshold = 1;
1712
- }
1713
- cleanup();
1714
- const elementRectForRootMargin = element.getBoundingClientRect();
1715
- const {
1716
- left,
1717
- top,
1718
- width,
1719
- height
1720
- } = elementRectForRootMargin;
1721
- if (!skip) {
1722
- onMove();
1723
- }
1724
- if (!width || !height) {
1725
- return;
1726
- }
1727
- const insetTop = floor(top);
1728
- const insetRight = floor(root.clientWidth - (left + width));
1729
- const insetBottom = floor(root.clientHeight - (top + height));
1730
- const insetLeft = floor(left);
1731
- const rootMargin = -insetTop + "px " + -insetRight + "px " + -insetBottom + "px " + -insetLeft + "px";
1732
- const options = {
1733
- rootMargin,
1734
- threshold: max(0, min(1, threshold)) || 1
1735
- };
1736
- let isFirstUpdate = true;
1737
- function handleObserve(entries) {
1738
- const ratio = entries[0].intersectionRatio;
1739
- if (ratio !== threshold) {
1740
- if (!isFirstUpdate) {
1741
- return refresh();
1742
- }
1743
- if (!ratio) {
1744
- // If the reference is clipped, the ratio is 0. Throttle the refresh
1745
- // to prevent an infinite loop of updates.
1746
- timeoutId = setTimeout(() => {
1747
- refresh(false, 1e-7);
1748
- }, 1000);
1749
- } else {
1750
- refresh(false, ratio);
1751
- }
1752
- }
1753
- if (ratio === 1 && !rectsAreEqual(elementRectForRootMargin, element.getBoundingClientRect())) {
1754
- // It's possible that even though the ratio is reported as 1, the
1755
- // element is not actually fully within the IntersectionObserver's root
1756
- // area anymore. This can happen under performance constraints. This may
1757
- // be a bug in the browser's IntersectionObserver implementation. To
1758
- // work around this, we compare the element's bounding rect now with
1759
- // what it was at the time we created the IntersectionObserver. If they
1760
- // are not equal then the element moved, so we refresh.
1761
- refresh();
1762
- }
1763
- isFirstUpdate = false;
1764
- }
1765
-
1766
- // Older browsers don't support a `document` as the root and will throw an
1767
- // error.
1768
- try {
1769
- io = new IntersectionObserver(handleObserve, {
1770
- ...options,
1771
- // Handle <iframe>s
1772
- root: root.ownerDocument
1773
- });
1774
- } catch (_e) {
1775
- io = new IntersectionObserver(handleObserve, options);
1776
- }
1777
- io.observe(element);
1778
- }
1779
- refresh(true);
1780
- return cleanup;
1781
- }
1782
-
1783
- /**
1784
- * Automatically updates the position of the floating element when necessary.
1785
- * Should only be called when the floating element is mounted on the DOM or
1786
- * visible on the screen.
1787
- * @returns cleanup function that should be invoked when the floating element is
1788
- * removed from the DOM or hidden from the screen.
1789
- * @see https://floating-ui.com/docs/autoUpdate
1790
- */
1791
- function autoUpdate(reference, floating, update, options) {
1792
- if (options === void 0) {
1793
- options = {};
1794
- }
1795
- const {
1796
- ancestorScroll = true,
1797
- ancestorResize = true,
1798
- elementResize = typeof ResizeObserver === 'function',
1799
- layoutShift = typeof IntersectionObserver === 'function',
1800
- animationFrame = false
1801
- } = options;
1802
- const referenceEl = unwrapElement(reference);
1803
- const ancestors = ancestorScroll || ancestorResize ? [...(referenceEl ? getOverflowAncestors(referenceEl) : []), ...getOverflowAncestors(floating)] : [];
1804
- ancestors.forEach(ancestor => {
1805
- ancestorScroll && ancestor.addEventListener('scroll', update, {
1806
- passive: true
1807
- });
1808
- ancestorResize && ancestor.addEventListener('resize', update);
1809
- });
1810
- const cleanupIo = referenceEl && layoutShift ? observeMove(referenceEl, update) : null;
1811
- let reobserveFrame = -1;
1812
- let resizeObserver = null;
1813
- if (elementResize) {
1814
- resizeObserver = new ResizeObserver(_ref => {
1815
- let [firstEntry] = _ref;
1816
- if (firstEntry && firstEntry.target === referenceEl && resizeObserver) {
1817
- // Prevent update loops when using the `size` middleware.
1818
- // https://github.com/floating-ui/floating-ui/issues/1740
1819
- resizeObserver.unobserve(floating);
1820
- cancelAnimationFrame(reobserveFrame);
1821
- reobserveFrame = requestAnimationFrame(() => {
1822
- var _resizeObserver;
1823
- (_resizeObserver = resizeObserver) == null || _resizeObserver.observe(floating);
1824
- });
1825
- }
1826
- update();
1827
- });
1828
- if (referenceEl && !animationFrame) {
1829
- resizeObserver.observe(referenceEl);
1830
- }
1831
- resizeObserver.observe(floating);
1832
- }
1833
- let frameId;
1834
- let prevRefRect = animationFrame ? getBoundingClientRect(reference) : null;
1835
- if (animationFrame) {
1836
- frameLoop();
1837
- }
1838
- function frameLoop() {
1839
- const nextRefRect = getBoundingClientRect(reference);
1840
- if (prevRefRect && !rectsAreEqual(prevRefRect, nextRefRect)) {
1841
- update();
1842
- }
1843
- prevRefRect = nextRefRect;
1844
- frameId = requestAnimationFrame(frameLoop);
1845
- }
1846
- update();
1847
- return () => {
1848
- var _resizeObserver2;
1849
- ancestors.forEach(ancestor => {
1850
- ancestorScroll && ancestor.removeEventListener('scroll', update);
1851
- ancestorResize && ancestor.removeEventListener('resize', update);
1852
- });
1853
- cleanupIo == null || cleanupIo();
1854
- (_resizeObserver2 = resizeObserver) == null || _resizeObserver2.disconnect();
1855
- resizeObserver = null;
1856
- if (animationFrame) {
1857
- cancelAnimationFrame(frameId);
1858
- }
1859
- };
1860
- }
1861
-
1862
- /**
1863
- * Modifies the placement by translating the floating element along the
1864
- * specified axes.
1865
- * A number (shorthand for `mainAxis` or distance), or an axes configuration
1866
- * object may be passed.
1867
- * @see https://floating-ui.com/docs/offset
1868
- */
1869
- const offset = offset$1;
1870
-
1871
- /**
1872
- * Optimizes the visibility of the floating element by choosing the placement
1873
- * that has the most space available automatically, without needing to specify a
1874
- * preferred placement. Alternative to `flip`.
1875
- * @see https://floating-ui.com/docs/autoPlacement
1876
- */
1877
- const autoPlacement = autoPlacement$1;
1878
-
1879
- /**
1880
- * Optimizes the visibility of the floating element by flipping the `placement`
1881
- * in order to keep it in view when the preferred placement(s) will overflow the
1882
- * clipping boundary. Alternative to `autoPlacement`.
1883
- * @see https://floating-ui.com/docs/flip
1884
- */
1885
- const flip = flip$1;
1886
-
1887
- /**
1888
- * Provides data that allows you to change the size of the floating element —
1889
- * for instance, prevent it from overflowing the clipping boundary or match the
1890
- * width of the reference element.
1891
- * @see https://floating-ui.com/docs/size
1892
- */
1893
- const size = size$1;
1894
-
1895
- /**
1896
- * Provides data to hide the floating element in applicable situations, such as
1897
- * when it is not in the same clipping context as the reference element.
1898
- * @see https://floating-ui.com/docs/hide
1899
- */
1900
- const hide = hide$1;
1901
-
1902
- /**
1903
- * Provides data to position an inner element of the floating element so that it
1904
- * appears centered to the reference element.
1905
- * @see https://floating-ui.com/docs/arrow
1906
- */
1907
- const arrow = arrow$1;
1908
-
1909
- /**
1910
- * Provides improved positioning for inline reference elements that can span
1911
- * over multiple lines, such as hyperlinks or range selections.
1912
- * @see https://floating-ui.com/docs/inline
1913
- */
1914
- const inline = inline$1;
1915
-
1916
- /**
1917
- * Computes the `x` and `y` coordinates that will place the floating element
1918
- * next to a given reference element.
1919
- */
1920
- const computePosition = (reference, floating, options) => {
1921
- // This caches the expensive `getClippingElementAncestors` function so that
1922
- // multiple lifecycle resets re-use the same result. It only lives for a
1923
- // single call. If other functions become expensive, we can add them as well.
1924
- const cache = new Map();
1925
- const mergedOptions = {
1926
- platform,
1927
- ...options
1928
- };
1929
- const platformWithCache = {
1930
- ...mergedOptions.platform,
1931
- _c: cache
1932
- };
1933
- return computePosition$1(reference, floating, {
1934
- ...mergedOptions,
1935
- platform: platformWithCache
1936
- });
1937
- };
1938
-
1939
- var __defProp = Object.defineProperty;
1940
- var __decorateClass = (decorators, target, key, kind) => {
1941
- var result = void 0 ;
1942
- for (var i = decorators.length - 1, decorator; i >= 0; i--)
1943
- if (decorator = decorators[i])
1944
- result = (decorator(target, key, result) ) || result;
1945
- if (result) __defProp(target, key, result);
1946
- return result;
1947
- };
1948
- const PlacementStrategy = {
1949
- Flip: "flip",
1950
- AutoPlacementHorizontal: "auto-placement-horizontal",
1951
- AutoPlacementVertical: "auto-placement-vertical"
1952
- };
1953
- const placementStrategyMiddlewares = {
1954
- [PlacementStrategy.Flip]: flip(),
1955
- [PlacementStrategy.AutoPlacementHorizontal]: autoPlacement({
1956
- allowedPlacements: [
1957
- "bottom",
1958
- "top",
1959
- "bottom-start",
1960
- "bottom-end",
1961
- "top-start",
1962
- "top-end"
1963
- ]
1964
- }),
1965
- [PlacementStrategy.AutoPlacementVertical]: autoPlacement({
1966
- allowedPlacements: [
1967
- "left",
1968
- "right",
1969
- "left-start",
1970
- "left-end",
1971
- "right-start",
1972
- "right-end"
1973
- ]
1974
- })
1975
- };
1976
- class Popup extends vividElement.VividElement {
1977
- constructor() {
1978
- super(...arguments);
1979
- this.open = false;
1980
- this.dismissible = false;
1981
- this.arrow = false;
1982
- this.alternate = false;
1983
- /**
1984
- * The placement strategy of the popup.
1985
- *
1986
- * @public
1987
- */
1988
- this.placementStrategy = PlacementStrategy.Flip;
1989
- this.animationFrame = false;
1990
- this.strategy = "fixed";
1991
- this.offset = null;
1992
- this.#autoUpdateCallback = () => {
1993
- this.#lastPositionUpdate = this.updatePosition();
1994
- return this.#lastPositionUpdate;
1995
- };
1996
- }
1997
- get #middleware() {
1998
- let middleware = [
1999
- inline(),
2000
- placementStrategyMiddlewares[this.placementStrategy],
2001
- hide(),
2002
- size({
2003
- apply({ availableWidth, availableHeight, elements }) {
2004
- Object.assign(elements.floating.style, {
2005
- maxWidth: `${availableWidth}px`,
2006
- maxHeight: `${availableHeight}px`
2007
- });
2008
- }
2009
- })
2010
- ];
2011
- let offsetValue = this.offset ?? 0;
2012
- if (this.arrow) {
2013
- offsetValue += 12;
2014
- middleware = [
2015
- ...middleware,
2016
- arrow({ element: this.arrowEl, padding: 10 })
2017
- ];
2018
- }
2019
- if (offsetValue > 0) {
2020
- middleware.unshift(offset(offsetValue));
2021
- }
2022
- return middleware;
2023
- }
2024
- #cleanup;
2025
- openChanged(_, newValue) {
2026
- this.#togglePopover();
2027
- this.#updateAutoUpdate();
2028
- this.$emit(newValue ? "vwc-popup:open" : "vwc-popup:close");
2029
- }
2030
- /**
2031
- * @internal
2032
- */
2033
- animationFrameChanged() {
2034
- this.#updateAutoUpdate();
2035
- }
2036
- /**
2037
- * @internal
2038
- */
2039
- anchorChanged() {
2040
- this.#updateAutoUpdate();
2041
- }
2042
- /**
2043
- * @internal
2044
- */
2045
- strategyChanged() {
2046
- this.#togglePopover();
2047
- }
2048
- connectedCallback() {
2049
- super.connectedCallback();
2050
- this.#togglePopover();
2051
- this.#updateAutoUpdate();
2052
- }
2053
- disconnectedCallback() {
2054
- super.disconnectedCallback();
2055
- this.#updateAutoUpdate();
2056
- }
2057
- #updateAutoUpdate() {
2058
- this.#cleanup?.();
2059
- if (this.open && this.controlEl) {
2060
- this.controlEl.classList.add("open");
2061
- }
2062
- if (this.anchorEl && this.open && this.popupEl) {
2063
- this.#cleanup = autoUpdate(
2064
- this.anchorEl,
2065
- this.popupEl,
2066
- this.#autoUpdateCallback,
2067
- {
2068
- animationFrame: this.animationFrame
2069
- }
2070
- );
2071
- }
2072
- }
2073
- #togglePopover() {
2074
- if (this.popupEl && this.strategy === "fixed") {
2075
- if (this.open) {
2076
- this.popupEl.showPopover();
2077
- } else {
2078
- this.popupEl.hidePopover();
2079
- }
2080
- }
2081
- }
2082
- #lastPositionUpdate;
2083
- #autoUpdateCallback;
2084
- /**
2085
- * Updates popup's position
2086
- *
2087
- * @public
2088
- */
2089
- async updatePosition() {
2090
- if (!this.open || !this.anchorEl) {
2091
- return;
2092
- }
2093
- const positionData = await computePosition(this.anchorEl, this.popupEl, {
2094
- placement: this.placement,
2095
- strategy: this.strategy,
2096
- middleware: this.#middleware
2097
- });
2098
- this.#assignPopupPosition(positionData);
2099
- if (this.arrow) {
2100
- this.#assignArrowPosition(positionData);
2101
- }
2102
- }
2103
- #assignPopupPosition(data) {
2104
- const { x: popupX, y: popupY } = data;
2105
- const { referenceHidden } = data.middlewareData.hide;
2106
- Object.assign(this.popupEl.style, {
2107
- left: `${popupX}px`,
2108
- top: `${popupY}px`,
2109
- visibility: referenceHidden ? "hidden" : "visible"
2110
- });
2111
- }
2112
- #assignArrowPosition(data) {
2113
- const { x: arrowX, y: arrowY } = data.middlewareData.arrow;
2114
- const styles = {
2115
- left: "calc(100% - 4px)",
2116
- right: "-4px",
2117
- top: "calc(100% - 4px)",
2118
- bottom: "-4px"
2119
- };
2120
- const staticAxis = data.placement.split("-")[0];
2121
- Object.assign(this.arrowEl.style, {
2122
- left: arrowX ? `${arrowX}px` : styles[staticAxis],
2123
- top: arrowY ? `${arrowY}px` : styles[staticAxis]
2124
- });
2125
- }
2126
- get anchorEl() {
2127
- return this.anchor ?? null;
2128
- }
2129
- /**
2130
- * Shows the popup.
2131
- * Unlike toggling the `open` attribute, show() will wait for the popup to become visible and positioned correctly.
2132
- */
2133
- show() {
2134
- this.open = true;
2135
- return this.#lastPositionUpdate ?? Promise.resolve();
2136
- }
2137
- hide() {
2138
- this.open = false;
2139
- }
2140
- }
2141
- __decorateClass([
2142
- vividElement.attr({
2143
- mode: "boolean"
2144
- })
2145
- ], Popup.prototype, "open");
2146
- __decorateClass([
2147
- vividElement.attr({
2148
- mode: "boolean"
2149
- })
2150
- ], Popup.prototype, "dismissible");
2151
- __decorateClass([
2152
- vividElement.attr({
2153
- mode: "boolean"
2154
- })
2155
- ], Popup.prototype, "arrow");
2156
- __decorateClass([
2157
- vividElement.attr({
2158
- mode: "boolean"
2159
- })
2160
- ], Popup.prototype, "alternate");
2161
- __decorateClass([
2162
- vividElement.attr({ mode: "fromView" })
2163
- ], Popup.prototype, "placement");
2164
- __decorateClass([
2165
- vividElement.attr({ mode: "boolean", attribute: "animation-frame" })
2166
- ], Popup.prototype, "animationFrame");
2167
- __decorateClass([
2168
- vividElement.attr({ mode: "fromView" })
2169
- ], Popup.prototype, "strategy");
2170
- __decorateClass([
2171
- vividElement.attr({ attribute: "offset", converter: vividElement.nullableNumberConverter })
2172
- ], Popup.prototype, "offset");
2173
- __decorateClass([
2174
- vividElement.observable
2175
- ], Popup.prototype, "anchor");
2176
-
2177
- const styles = ":host{display:var(--_popup-display, inline)}.control{border-radius:inherit;background:var(--vvd-color-surface-4dp);contain:layout}.control:not(.open){display:none}.popup-wrapper{white-space:initial;--scrollbar-track-color: transparent;--scrollbar-thumb-color: color-mix(in srgb, var(--vvd-color-neutral-950), transparent 70%)}.popup-wrapper{scrollbar-color:var(--scrollbar-thumb-color) var(--scrollbar-track-color);scrollbar-width:thin}.popup-wrapper ::-webkit-scrollbar{width:4px}.popup-wrapper ::-webkit-scrollbar-track{background:var(--scrollbar-track-color)}.popup-wrapper ::-webkit-scrollbar-thumb{border:0;border-radius:4px;background-color:var(--scrollbar-fallback-track-color, var(--scrollbar-thumb-color))}.popup-wrapper{z-index:var(--_popup-z-index, 10);overflow:visible;padding:0;border:none;border-radius:8px;margin:0;inline-size:max-content}.popup-wrapper:not(.absolute){position:fixed}.popup-wrapper.absolute{position:absolute;top:0;left:0}.popup-content{display:grid;color:var(--vvd-color-canvas-text)}.dismissible .popup-content{align-content:start;grid-template-columns:1fr auto}.arrow{position:absolute;z-index:-1;width:8px;height:8px;background:var(--vvd-color-surface-4dp);transform:rotate(45deg)}.dismissible-button{align-self:flex-start;margin-block-start:4px;margin-inline-end:4px}";
2178
-
2179
- const getClasses = ({ open, dismissible, alternate }) => classNames.classNames(
2180
- "control",
2181
- ["open", Boolean(open)],
2182
- ["dismissible", Boolean(dismissible)],
2183
- ["alternate", Boolean(alternate)]
2184
- );
2185
- function handlePopover(x) {
2186
- return x.strategy && x.strategy === "fixed" ? "manual" : null;
2187
- }
2188
- const popupTemplate = (context) => {
2189
- const elevationTag = context.tagFor(definition.Elevation);
2190
- const buttonTag = context.tagFor(definition$1.Button);
2191
- return vividElement.html`
2192
- <${elevationTag}>
2193
- <div popover="${handlePopover}" class="popup-wrapper ${(x) => x.strategy}" ${ref.ref("popupEl")} part="popup-base">
2194
- <div ${ref.ref("controlEl")} class="${getClasses}" aria-hidden="${(x) => x.open ? "false" : "true"}"
2195
- part="${(x) => x.alternate ? "vvd-theme-alternate" : ""}">
2196
- <div class="popup-content">
2197
- <slot></slot>
2198
- ${when.when(
2199
- (x) => x.dismissible,
2200
- vividElement.html`<${buttonTag} size="condensed" @click="${(x) => x.open = false}"
2201
- class="dismissible-button" icon="close-small-solid" shape="pill"></${buttonTag}>`
2202
- )}
2203
- </div>
2204
- ${when.when(
2205
- (x) => x.arrow,
2206
- vividElement.html`<div class="arrow" ${ref.ref("arrowEl")}></div>`
2207
- )}
2208
- </div>
2209
- </div>
2210
- </${elevationTag}>`;
2211
- };
2212
-
2213
- const popupDefinition = vividElement.defineVividComponent(
2214
- "popup",
2215
- Popup,
2216
- popupTemplate,
2217
- [definition.elevationDefinition, definition$1.buttonDefinition],
2218
- {
2219
- styles
2220
- }
2221
- );
2222
- const registerPopup = vividElement.createRegisterFunction(popupDefinition);
2223
-
2224
- exports.PlacementStrategy = PlacementStrategy;
2225
- exports.Popup = Popup;
2226
- exports.popupDefinition = popupDefinition;
2227
- exports.registerPopup = registerPopup;