@vonage/vivid 5.0.0 → 5.2.0

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