bromcom-ui 2.8.0-rc.3 → 2.8.0-rc.5

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 (374) hide show
  1. package/dist/bromcom-ui/bromcom-ui.css +1 -1
  2. package/dist/bromcom-ui/bromcom-ui.esm.js +1 -1
  3. package/dist/bromcom-ui/{p-70ca213d.entry.js → p-04d4c6e7.entry.js} +1 -1
  4. package/dist/bromcom-ui/p-04f65223.entry.js +5 -0
  5. package/dist/bromcom-ui/p-0557b296.entry.js +5 -0
  6. package/dist/bromcom-ui/{p-416febed.entry.js → p-0a16fcfa.entry.js} +1 -1
  7. package/dist/bromcom-ui/{p-210a8642.entry.js → p-0b663779.entry.js} +1 -1
  8. package/dist/bromcom-ui/p-10228af8.entry.js +5 -0
  9. package/dist/bromcom-ui/{p-86e5ffe3.entry.js → p-14a0a646.entry.js} +1 -1
  10. package/dist/bromcom-ui/p-16bae5a0.entry.js +5 -0
  11. package/dist/bromcom-ui/p-19c5d157.entry.js +5 -0
  12. package/dist/bromcom-ui/p-1a681f4b.entry.js +5 -0
  13. package/dist/bromcom-ui/p-1c700098.entry.js +5 -0
  14. package/dist/bromcom-ui/p-1e264881.entry.js +5 -0
  15. package/dist/bromcom-ui/p-1fa1c5d9.entry.js +5 -0
  16. package/dist/bromcom-ui/{p-d52e3a0a.entry.js → p-221448f8.entry.js} +1 -1
  17. package/dist/bromcom-ui/p-244075dd.entry.js +5 -0
  18. package/dist/bromcom-ui/p-24aefda6.js +5 -0
  19. package/dist/bromcom-ui/p-2b2a6374.entry.js +5 -0
  20. package/dist/bromcom-ui/p-2e1ae66c.entry.js +5 -0
  21. package/dist/bromcom-ui/{p-2358bca8.entry.js → p-31226526.entry.js} +1 -1
  22. package/dist/bromcom-ui/p-31f5b765.entry.js +5 -0
  23. package/dist/bromcom-ui/p-38a5fb2c.entry.js +5 -0
  24. package/dist/bromcom-ui/{p-77312b64.entry.js → p-39eda493.entry.js} +1 -1
  25. package/dist/bromcom-ui/p-4620092f.js +5 -0
  26. package/dist/bromcom-ui/p-49656e08.entry.js +5 -0
  27. package/dist/bromcom-ui/{p-9763ed2d.js → p-4dd66352.js} +1 -1
  28. package/dist/bromcom-ui/{p-dfe8e354.entry.js → p-4fcf03c1.entry.js} +1 -1
  29. package/dist/bromcom-ui/p-504575be.entry.js +5 -0
  30. package/dist/bromcom-ui/p-51b670a0.entry.js +5 -0
  31. package/dist/bromcom-ui/p-5303f5d7.entry.js +5 -0
  32. package/dist/bromcom-ui/{p-7f6736c8.entry.js → p-533cb826.entry.js} +1 -1
  33. package/dist/bromcom-ui/p-54a3364d.entry.js +5 -0
  34. package/dist/bromcom-ui/{p-3c690e56.entry.js → p-58651d85.entry.js} +1 -1
  35. package/dist/bromcom-ui/p-5ae2ce53.entry.js +5 -0
  36. package/dist/bromcom-ui/p-61ee8d5c.entry.js +5 -0
  37. package/dist/bromcom-ui/p-692a0269.js +5 -0
  38. package/dist/bromcom-ui/p-6949fcce.entry.js +5 -0
  39. package/dist/bromcom-ui/{p-a7cedfe6.entry.js → p-6b7a9d96.entry.js} +1 -1
  40. package/dist/bromcom-ui/p-6cc73d59.entry.js +5 -0
  41. package/dist/bromcom-ui/{p-9ae9706d.entry.js → p-6e017905.entry.js} +1 -1
  42. package/dist/bromcom-ui/{p-c34638dc.js → p-76358e74.js} +1 -1
  43. package/dist/bromcom-ui/p-778590bf.entry.js +5 -0
  44. package/dist/bromcom-ui/p-79fd816c.js +5 -0
  45. package/dist/bromcom-ui/p-7c2806d1.entry.js +5 -0
  46. package/dist/bromcom-ui/p-7ed49ddd.entry.js +5 -0
  47. package/dist/bromcom-ui/{p-2c9d1709.entry.js → p-88ace511.entry.js} +1 -1
  48. package/dist/bromcom-ui/p-89d42239.entry.js +5 -0
  49. package/dist/bromcom-ui/{p-16b50160.js → p-8d0ca8c2.js} +1 -1
  50. package/dist/bromcom-ui/{p-2623b84a.entry.js → p-8e2540d8.entry.js} +1 -1
  51. package/dist/bromcom-ui/{p-9c5c74d6.entry.js → p-976f682f.entry.js} +1 -1
  52. package/dist/bromcom-ui/{p-25e8759d.entry.js → p-97933e31.entry.js} +1 -1
  53. package/dist/bromcom-ui/p-98253d3c.entry.js +5 -0
  54. package/dist/bromcom-ui/p-9c1caebd.entry.js +5 -0
  55. package/dist/bromcom-ui/p-9d48056f.entry.js +5 -0
  56. package/dist/bromcom-ui/{p-74595a06.js → p-a60a2dd0.js} +1 -1
  57. package/dist/bromcom-ui/p-a92be147.entry.js +5 -0
  58. package/dist/bromcom-ui/p-aaea010b.entry.js +5 -0
  59. package/dist/bromcom-ui/p-ad5cb398.entry.js +5 -0
  60. package/dist/bromcom-ui/p-b001d7cd.entry.js +5 -0
  61. package/dist/bromcom-ui/p-b358c791.entry.js +10 -0
  62. package/dist/bromcom-ui/p-b60bcecf.js +5 -0
  63. package/dist/bromcom-ui/p-b7e0fe52.entry.js +5 -0
  64. package/dist/bromcom-ui/{p-eb945ceb.js → p-b9ee6aca.js} +1 -1
  65. package/dist/bromcom-ui/p-bb2b3ad0.entry.js +5 -0
  66. package/dist/bromcom-ui/{p-3d4897d8.entry.js → p-bc840f30.entry.js} +1 -1
  67. package/dist/bromcom-ui/p-bca3b603.js +5 -0
  68. package/dist/bromcom-ui/p-bee37fd5.entry.js +5 -0
  69. package/dist/bromcom-ui/p-c1c066a4.entry.js +5 -0
  70. package/dist/bromcom-ui/{p-ef0a59b6.js → p-c23b6240.js} +1 -1
  71. package/dist/bromcom-ui/p-c42e3b89.entry.js +5 -0
  72. package/dist/bromcom-ui/p-c721df8b.js +5 -0
  73. package/dist/bromcom-ui/p-c7496628.entry.js +5 -0
  74. package/dist/bromcom-ui/{p-920fdcd8.entry.js → p-c85b8abc.entry.js} +1 -1
  75. package/dist/bromcom-ui/{p-5963e647.entry.js → p-c85d5bb2.entry.js} +1 -1
  76. package/dist/bromcom-ui/p-c8e13fd7.js +5 -0
  77. package/dist/bromcom-ui/p-cde1298c.entry.js +5 -0
  78. package/dist/bromcom-ui/p-cf0e31dc.entry.js +5 -0
  79. package/dist/bromcom-ui/p-cf3b02d0.entry.js +5 -0
  80. package/dist/bromcom-ui/p-cf85d777.entry.js +5 -0
  81. package/dist/bromcom-ui/p-d14fd581.entry.js +5 -0
  82. package/dist/bromcom-ui/p-d4ed79f0.entry.js +5 -0
  83. package/dist/bromcom-ui/{p-4260353d.entry.js → p-d644b6d9.entry.js} +1 -1
  84. package/dist/bromcom-ui/p-d65a1e21.js +11 -0
  85. package/dist/bromcom-ui/p-da1055cb.js +6 -0
  86. package/dist/bromcom-ui/{p-45f6c93b.js → p-dbc4c30c.js} +1 -1
  87. package/dist/bromcom-ui/{p-a0807939.js → p-e01220df.js} +1 -1
  88. package/dist/bromcom-ui/{p-9141db41.entry.js → p-e19e9dc1.entry.js} +1 -1
  89. package/dist/bromcom-ui/{p-ef8b37a2.js → p-ee381ce5.js} +1 -1
  90. package/dist/bromcom-ui/p-f11a03af.entry.js +5 -0
  91. package/dist/bromcom-ui/p-f3c08dc7.entry.js +5 -0
  92. package/dist/bromcom-ui/p-f3d970d7.entry.js +5 -0
  93. package/dist/bromcom-ui/{p-9b723535.entry.js → p-f529ded0.entry.js} +1 -1
  94. package/dist/bromcom-ui/p-f654d64d.entry.js +5 -0
  95. package/dist/bromcom-ui/p-f6dba555.entry.js +5 -0
  96. package/dist/bromcom-ui/{p-97df9122.entry.js → p-f8c20298.entry.js} +1 -1
  97. package/dist/bromcom-ui/p-fec276e6.entry.js +5 -0
  98. package/dist/bromcom-ui/{p-e01fb694.entry.js → p-ff1acc28.entry.js} +1 -1
  99. package/dist/cjs/bcm-accordion.cjs.entry.js +4 -3
  100. package/dist/cjs/bcm-alert.cjs.entry.js +7 -6
  101. package/dist/cjs/bcm-attendance.cjs.entry.js +4 -3
  102. package/dist/cjs/bcm-autocomplete.cjs.entry.js +3 -3
  103. package/dist/cjs/bcm-avatar_2.cjs.entry.js +10 -9
  104. package/dist/cjs/bcm-box.cjs.entry.js +2 -2
  105. package/dist/cjs/bcm-breadcrumb.cjs.entry.js +5 -4
  106. package/dist/cjs/bcm-button-group.cjs.entry.js +6 -5
  107. package/dist/cjs/bcm-button.cjs.entry.js +385 -0
  108. package/dist/cjs/bcm-card.cjs.entry.js +8 -7
  109. package/dist/cjs/bcm-checkbox-group.cjs.entry.js +23 -22
  110. package/dist/cjs/bcm-checkbox-lite_9.cjs.entry.js +5 -4
  111. package/dist/cjs/bcm-checkbox_2.cjs.entry.js +9 -8
  112. package/dist/cjs/bcm-chip.cjs.entry.js +6 -5
  113. package/dist/cjs/bcm-collapse-group.cjs.entry.js +2 -2
  114. package/dist/cjs/bcm-collapse.cjs.entry.js +5 -4
  115. package/dist/cjs/bcm-color-input.cjs.entry.js +7 -6
  116. package/dist/cjs/{bcm-button_13.cjs.entry.js → bcm-colorful_2.cjs.entry.js} +139 -3898
  117. package/dist/cjs/bcm-colorpicker.cjs.entry.js +3 -3
  118. package/dist/cjs/bcm-date-picker.cjs.entry.js +5 -4
  119. package/dist/cjs/bcm-datetime-picker.cjs.entry.js +9 -8
  120. package/dist/cjs/bcm-default.cjs.entry.js +4 -3
  121. package/dist/cjs/bcm-drawer.cjs.entry.js +9 -8
  122. package/dist/cjs/bcm-dropdown.cjs.entry.js +6 -5
  123. package/dist/cjs/bcm-error-layout.cjs.entry.js +3 -3
  124. package/dist/cjs/bcm-expansion-panel.cjs.entry.js +7 -6
  125. package/dist/cjs/bcm-form-2.cjs.entry.js +5 -4
  126. package/dist/cjs/bcm-form-group.cjs.entry.js +2 -2
  127. package/dist/cjs/bcm-form.cjs.entry.js +487 -0
  128. package/dist/cjs/bcm-icon.cjs.entry.js +41 -0
  129. package/dist/cjs/bcm-input-custom.cjs.entry.js +5 -4
  130. package/dist/cjs/bcm-input.cjs.entry.js +369 -0
  131. package/dist/cjs/bcm-item.cjs.entry.js +6 -5
  132. package/dist/cjs/bcm-items.cjs.entry.js +5 -4
  133. package/dist/cjs/bcm-label_2.cjs.entry.js +149 -0
  134. package/dist/cjs/bcm-link.cjs.entry.js +3 -3
  135. package/dist/cjs/bcm-list.cjs.entry.js +1793 -0
  136. package/dist/cjs/bcm-menu.cjs.entry.js +11 -10
  137. package/dist/cjs/bcm-message.cjs.entry.js +3 -3
  138. package/dist/cjs/bcm-modal.cjs.entry.js +7 -6
  139. package/dist/cjs/bcm-notification.cjs.entry.js +3 -3
  140. package/dist/cjs/bcm-old-input.cjs.entry.js +4 -4
  141. package/dist/cjs/bcm-old-tag_2.cjs.entry.js +3 -3
  142. package/dist/cjs/bcm-popconfirm-box.cjs.entry.js +8 -7
  143. package/dist/cjs/bcm-popconfirm.cjs.entry.js +5 -4
  144. package/dist/cjs/bcm-popover.cjs.entry.js +10 -9
  145. package/dist/cjs/bcm-progress.cjs.entry.js +6 -5
  146. package/dist/cjs/bcm-radio-group.cjs.entry.js +10 -9
  147. package/dist/cjs/bcm-radio.cjs.entry.js +8 -7
  148. package/dist/cjs/bcm-range.cjs.entry.js +5 -4
  149. package/dist/cjs/bcm-result.cjs.entry.js +3 -3
  150. package/dist/cjs/bcm-search.cjs.entry.js +259 -0
  151. package/dist/cjs/bcm-select-group.cjs.entry.js +2 -2
  152. package/dist/cjs/bcm-select-option.cjs.entry.js +2 -2
  153. package/dist/cjs/bcm-select.cjs.entry.js +4 -4
  154. package/dist/cjs/bcm-skeleton.cjs.entry.js +4 -3
  155. package/dist/cjs/bcm-step.cjs.entry.js +102 -0
  156. package/dist/cjs/bcm-stepper.cjs.entry.js +247 -0
  157. package/dist/cjs/bcm-switch.cjs.entry.js +6 -5
  158. package/dist/cjs/bcm-tab-group.cjs.entry.js +87 -30
  159. package/dist/cjs/bcm-tab-item-header.cjs.entry.js +9 -8
  160. package/dist/cjs/bcm-tab-item.cjs.entry.js +8 -7
  161. package/dist/cjs/bcm-tab-pane.cjs.entry.js +3 -3
  162. package/dist/cjs/bcm-tab.cjs.entry.js +3 -3
  163. package/dist/cjs/bcm-table.cjs.entry.js +2 -2
  164. package/dist/cjs/bcm-tabs-content.cjs.entry.js +3 -3
  165. package/dist/cjs/bcm-tabs.cjs.entry.js +3 -3
  166. package/dist/cjs/bcm-tag.cjs.entry.js +6 -5
  167. package/dist/cjs/bcm-text.cjs.entry.js +63 -0
  168. package/dist/cjs/bcm-textarea.cjs.entry.js +7 -6
  169. package/dist/cjs/bcm-time-picker.cjs.entry.js +5 -4
  170. package/dist/cjs/bcm-timeline-item.cjs.entry.js +3 -3
  171. package/dist/cjs/bcm-timeline.cjs.entry.js +3 -3
  172. package/dist/cjs/bcm-toast.cjs.entry.js +6 -5
  173. package/dist/cjs/bcm-treeview-group.cjs.entry.js +1 -1
  174. package/dist/cjs/bromcom-ui.cjs.js +7 -3
  175. package/dist/cjs/{caption-template-de4a0064.js → caption-template-8d099fd6.js} +2 -2
  176. package/dist/cjs/{color-helper-ff22257f.js → color-helper-0097a7c2.js} +8 -8
  177. package/dist/cjs/colors-43b24668.js +435 -0
  178. package/dist/cjs/{floating-ui-c23acc6c.js → floating-ui-74eb26d6.js} +592 -542
  179. package/dist/cjs/generate-ab5c97d5.js +305 -0
  180. package/dist/cjs/{index-56628fe5.js → index-4506fcd7.js} +1 -1
  181. package/dist/cjs/{index-7e2a5376.js → index-ddfd6d8f.js} +111 -2
  182. package/dist/cjs/{index-a2b50e51.js → index-fdbf5226.js} +11 -10
  183. package/dist/cjs/{input-template-98c29bbb.js → input-template-b540fdc4.js} +3 -3
  184. package/dist/cjs/{is-load-decorator-faac117d.js → is-load-decorator-137dded1.js} +1 -1
  185. package/dist/cjs/{json-parse-decarator-79e20ff3.js → json-parse-decarator-fc944651.js} +2 -2
  186. package/dist/cjs/{label-template-098a30a4.js → label-template-cc69bc21.js} +3 -3
  187. package/dist/cjs/loader.cjs.js +4 -3
  188. package/dist/cjs/{number-helper-9869878b.js → number-helper-b9cf4b48.js} +1 -1
  189. package/dist/cjs/old-bcm-popover-box.cjs.entry.js +9 -8
  190. package/dist/cjs/old-bcm-popover.cjs.entry.js +5 -4
  191. package/dist/cjs/{popover-placement-69d37a5f.js → popover-placement-3c8f3a72.js} +1 -1
  192. package/dist/cjs/{slot-template-7a07f865.js → slot-template-3e59d7d8.js} +2 -2
  193. package/dist/cjs/stepper-states-cb28501d.js +85 -0
  194. package/dist/cjs/{string-helper-71b10c53.js → string-helper-45cffee0.js} +4 -4
  195. package/dist/cjs/{tooltip-helper-27421198.js → tooltip-helper-0f770cf7.js} +6 -6
  196. package/dist/cjs/{validators-261e5c81.js → validators-72173f1d.js} +1 -1
  197. package/dist/collection/collection-manifest.json +2 -2
  198. package/dist/collection/components/atoms/button/button.js +1 -1
  199. package/dist/collection/components/molecules/dropdown/dropdown.js +1 -1
  200. package/dist/collection/components/molecules/popover/popover.js +1 -1
  201. package/dist/collection/components/molecules/tab-group/tab-group.js +89 -24
  202. package/dist/collection/components/molecules/tab-group/tab-item.js +2 -2
  203. package/dist/collection/components/molecules/tooltip/tooltip.js +1 -1
  204. package/dist/components/bcm-popover.js +1 -1
  205. package/dist/components/bcm-tab-group.js +80 -24
  206. package/dist/components/bcm-tab-item.js +1 -1
  207. package/dist/components/colors2.js +45 -23
  208. package/dist/components/floating-ui.js +592 -542
  209. package/dist/components/generate.js +1 -1
  210. package/dist/components/index.d.ts +9 -0
  211. package/dist/components/index.js +1 -1
  212. package/dist/components/index2.js +11 -10
  213. package/dist/components/string-helper.js +4 -4
  214. package/dist/components/tooltip.js +1 -1
  215. package/dist/esm/bcm-accordion.entry.js +4 -3
  216. package/dist/esm/bcm-alert.entry.js +7 -6
  217. package/dist/esm/bcm-attendance.entry.js +4 -3
  218. package/dist/esm/bcm-autocomplete.entry.js +3 -3
  219. package/dist/esm/bcm-avatar_2.entry.js +10 -9
  220. package/dist/esm/bcm-box.entry.js +2 -2
  221. package/dist/esm/bcm-breadcrumb.entry.js +5 -4
  222. package/dist/esm/bcm-button-group.entry.js +6 -5
  223. package/dist/esm/bcm-button.entry.js +381 -0
  224. package/dist/esm/bcm-card.entry.js +8 -7
  225. package/dist/esm/bcm-checkbox-group.entry.js +15 -14
  226. package/dist/esm/bcm-checkbox-lite_9.entry.js +5 -4
  227. package/dist/esm/bcm-checkbox_2.entry.js +9 -8
  228. package/dist/esm/bcm-chip.entry.js +6 -5
  229. package/dist/esm/bcm-collapse-group.entry.js +2 -2
  230. package/dist/esm/bcm-collapse.entry.js +5 -4
  231. package/dist/esm/bcm-color-input.entry.js +7 -6
  232. package/dist/esm/{bcm-button_13.entry.js → bcm-colorful_2.entry.js} +135 -3883
  233. package/dist/esm/bcm-colorpicker.entry.js +3 -3
  234. package/dist/esm/bcm-date-picker.entry.js +5 -4
  235. package/dist/esm/bcm-datetime-picker.entry.js +9 -8
  236. package/dist/esm/bcm-default.entry.js +4 -3
  237. package/dist/esm/bcm-drawer.entry.js +9 -8
  238. package/dist/esm/bcm-dropdown.entry.js +6 -5
  239. package/dist/esm/bcm-error-layout.entry.js +3 -3
  240. package/dist/esm/bcm-expansion-panel.entry.js +7 -6
  241. package/dist/esm/bcm-form-2.entry.js +5 -4
  242. package/dist/esm/bcm-form-group.entry.js +2 -2
  243. package/dist/esm/bcm-form.entry.js +483 -0
  244. package/dist/esm/bcm-icon.entry.js +37 -0
  245. package/dist/esm/bcm-input-custom.entry.js +5 -4
  246. package/dist/esm/bcm-input.entry.js +365 -0
  247. package/dist/esm/bcm-item.entry.js +6 -5
  248. package/dist/esm/bcm-items.entry.js +5 -4
  249. package/dist/esm/bcm-label_2.entry.js +144 -0
  250. package/dist/esm/bcm-link.entry.js +3 -3
  251. package/dist/esm/bcm-list.entry.js +1789 -0
  252. package/dist/esm/bcm-menu.entry.js +11 -10
  253. package/dist/esm/bcm-message.entry.js +3 -3
  254. package/dist/esm/bcm-modal.entry.js +7 -6
  255. package/dist/esm/bcm-notification.entry.js +3 -3
  256. package/dist/esm/bcm-old-input.entry.js +4 -4
  257. package/dist/esm/bcm-old-tag_2.entry.js +3 -3
  258. package/dist/esm/bcm-popconfirm-box.entry.js +8 -7
  259. package/dist/esm/bcm-popconfirm.entry.js +5 -4
  260. package/dist/esm/bcm-popover.entry.js +10 -9
  261. package/dist/esm/bcm-progress.entry.js +6 -5
  262. package/dist/esm/bcm-radio-group.entry.js +10 -9
  263. package/dist/esm/bcm-radio.entry.js +8 -7
  264. package/dist/esm/bcm-range.entry.js +5 -4
  265. package/dist/esm/bcm-result.entry.js +3 -3
  266. package/dist/esm/bcm-search.entry.js +255 -0
  267. package/dist/esm/bcm-select-group.entry.js +2 -2
  268. package/dist/esm/bcm-select-option.entry.js +2 -2
  269. package/dist/esm/bcm-select.entry.js +4 -4
  270. package/dist/esm/bcm-skeleton.entry.js +4 -3
  271. package/dist/esm/bcm-step.entry.js +98 -0
  272. package/dist/esm/bcm-stepper.entry.js +243 -0
  273. package/dist/esm/bcm-switch.entry.js +6 -5
  274. package/dist/esm/bcm-tab-group.entry.js +87 -30
  275. package/dist/esm/bcm-tab-item-header.entry.js +9 -8
  276. package/dist/esm/bcm-tab-item.entry.js +8 -7
  277. package/dist/esm/bcm-tab-pane.entry.js +3 -3
  278. package/dist/esm/bcm-tab.entry.js +3 -3
  279. package/dist/esm/bcm-table.entry.js +2 -2
  280. package/dist/esm/bcm-tabs-content.entry.js +3 -3
  281. package/dist/esm/bcm-tabs.entry.js +3 -3
  282. package/dist/esm/bcm-tag.entry.js +6 -5
  283. package/dist/esm/bcm-text.entry.js +59 -0
  284. package/dist/esm/bcm-textarea.entry.js +7 -6
  285. package/dist/esm/bcm-time-picker.entry.js +5 -4
  286. package/dist/esm/bcm-timeline-item.entry.js +3 -3
  287. package/dist/esm/bcm-timeline.entry.js +3 -3
  288. package/dist/esm/bcm-toast.entry.js +6 -5
  289. package/dist/esm/bcm-treeview-group.entry.js +1 -1
  290. package/dist/esm/bromcom-ui.js +4 -3
  291. package/dist/esm/{caption-template-389f5bd6.js → caption-template-da16ba7b.js} +2 -2
  292. package/dist/esm/{color-helper-362cd7b6.js → color-helper-4fa5dd0d.js} +1 -1
  293. package/dist/esm/colors-fa05fe33.js +433 -0
  294. package/dist/esm/{floating-ui-4a49ea46.js → floating-ui-e7341329.js} +592 -542
  295. package/dist/esm/generate-7a787f1e.js +302 -0
  296. package/dist/esm/{index-6e2d80d7.js → index-39133086.js} +111 -3
  297. package/dist/esm/{index-8b349654.js → index-93e36fdb.js} +1 -1
  298. package/dist/esm/{index-ba2edd32.js → index-ed9652af.js} +11 -10
  299. package/dist/esm/{input-template-21cb9810.js → input-template-7f7c2370.js} +3 -3
  300. package/dist/esm/{is-load-decorator-359a1080.js → is-load-decorator-bc14ec4b.js} +1 -1
  301. package/dist/esm/{json-parse-decarator-b3d10607.js → json-parse-decarator-d04cb735.js} +2 -2
  302. package/dist/esm/{label-template-eed2dd69.js → label-template-d74fe788.js} +3 -3
  303. package/dist/esm/loader.js +4 -3
  304. package/dist/esm/{number-helper-0ab0676b.js → number-helper-d88788e7.js} +1 -1
  305. package/dist/esm/old-bcm-popover-box.entry.js +9 -8
  306. package/dist/esm/old-bcm-popover.entry.js +5 -4
  307. package/dist/esm/polyfills/css-shim.js +1 -1
  308. package/dist/esm/{popover-placement-4baf5f2f.js → popover-placement-78f86f15.js} +1 -1
  309. package/dist/esm/{slot-template-64b41ee5.js → slot-template-5b2db362.js} +2 -2
  310. package/dist/esm/stepper-states-25155b3b.js +83 -0
  311. package/dist/esm/{string-helper-0fb7ff20.js → string-helper-6bd24967.js} +4 -4
  312. package/dist/esm/{tooltip-helper-6b6cee19.js → tooltip-helper-ec0f9e15.js} +6 -6
  313. package/dist/esm/{validators-87201c22.js → validators-69c22893.js} +1 -1
  314. package/dist/types/components/molecules/popover/popover.d.ts +1 -1
  315. package/dist/types/components/molecules/tab-group/tab-group.d.ts +7 -1
  316. package/dist/types/components/molecules/tooltip/tooltip.d.ts +1 -1
  317. package/dist/types/stencil-public-runtime.d.ts +59 -3
  318. package/helper/index.js +1 -1
  319. package/helper/toast.js +1 -1
  320. package/loader/index.d.ts +9 -0
  321. package/package.json +7 -4
  322. package/dist/bromcom-ui/p-01e2c310.entry.js +0 -5
  323. package/dist/bromcom-ui/p-025fa461.entry.js +0 -5
  324. package/dist/bromcom-ui/p-02d89883.entry.js +0 -5
  325. package/dist/bromcom-ui/p-090ed544.entry.js +0 -5
  326. package/dist/bromcom-ui/p-09733614.entry.js +0 -5
  327. package/dist/bromcom-ui/p-0f07e69b.js +0 -5
  328. package/dist/bromcom-ui/p-23f4991b.entry.js +0 -5
  329. package/dist/bromcom-ui/p-323973e5.entry.js +0 -5
  330. package/dist/bromcom-ui/p-37194223.entry.js +0 -5
  331. package/dist/bromcom-ui/p-3f7625ff.js +0 -5
  332. package/dist/bromcom-ui/p-4487e8c2.js +0 -5
  333. package/dist/bromcom-ui/p-479f0bd5.entry.js +0 -5
  334. package/dist/bromcom-ui/p-4836d1cd.entry.js +0 -5
  335. package/dist/bromcom-ui/p-48e9166c.js +0 -5
  336. package/dist/bromcom-ui/p-56898932.js +0 -5
  337. package/dist/bromcom-ui/p-59e2af89.entry.js +0 -5
  338. package/dist/bromcom-ui/p-5a68e6e7.entry.js +0 -5
  339. package/dist/bromcom-ui/p-65ab887f.entry.js +0 -5
  340. package/dist/bromcom-ui/p-677195de.entry.js +0 -5
  341. package/dist/bromcom-ui/p-6c78072c.entry.js +0 -5
  342. package/dist/bromcom-ui/p-6cb33e93.entry.js +0 -5
  343. package/dist/bromcom-ui/p-6d0e6802.entry.js +0 -5
  344. package/dist/bromcom-ui/p-6d4f10e3.entry.js +0 -5
  345. package/dist/bromcom-ui/p-71663e53.entry.js +0 -5
  346. package/dist/bromcom-ui/p-761f7e8c.entry.js +0 -5
  347. package/dist/bromcom-ui/p-762aeb4a.entry.js +0 -5
  348. package/dist/bromcom-ui/p-7b0bfeb2.entry.js +0 -5
  349. package/dist/bromcom-ui/p-84919c9d.entry.js +0 -5
  350. package/dist/bromcom-ui/p-8811d071.entry.js +0 -5
  351. package/dist/bromcom-ui/p-88f7d869.js +0 -6
  352. package/dist/bromcom-ui/p-911776d7.entry.js +0 -5
  353. package/dist/bromcom-ui/p-92f6ca0f.entry.js +0 -5
  354. package/dist/bromcom-ui/p-a051b68c.entry.js +0 -5
  355. package/dist/bromcom-ui/p-accf5f6c.entry.js +0 -11
  356. package/dist/bromcom-ui/p-adbe308b.entry.js +0 -5
  357. package/dist/bromcom-ui/p-afac7571.entry.js +0 -5
  358. package/dist/bromcom-ui/p-b280f61e.entry.js +0 -5
  359. package/dist/bromcom-ui/p-b295dc77.entry.js +0 -5
  360. package/dist/bromcom-ui/p-bf383f52.entry.js +0 -5
  361. package/dist/bromcom-ui/p-c08cee8b.entry.js +0 -5
  362. package/dist/bromcom-ui/p-c7dc70b8.entry.js +0 -5
  363. package/dist/bromcom-ui/p-c865c604.entry.js +0 -5
  364. package/dist/bromcom-ui/p-cc67f4a8.entry.js +0 -5
  365. package/dist/bromcom-ui/p-d353ce68.entry.js +0 -5
  366. package/dist/bromcom-ui/p-d3dd1bcb.entry.js +0 -5
  367. package/dist/bromcom-ui/p-d3ff6b31.entry.js +0 -5
  368. package/dist/bromcom-ui/p-d5b08a77.js +0 -11
  369. package/dist/bromcom-ui/p-d9668e00.entry.js +0 -5
  370. package/dist/bromcom-ui/p-de954bc9.js +0 -5
  371. package/dist/bromcom-ui/p-e320352d.entry.js +0 -5
  372. package/dist/bromcom-ui/p-fa3291a8.entry.js +0 -5
  373. package/dist/cjs/generate-7b71e00a.js +0 -710
  374. package/dist/esm/generate-6c5030c9.js +0 -706
@@ -4,22 +4,22 @@
4
4
  */
5
5
  import { a as Bcm } from './bcm.js';
6
6
 
7
- function getSide(placement) {
8
- return placement.split('-')[0];
9
- }
10
-
11
7
  function getAlignment(placement) {
12
8
  return placement.split('-')[1];
13
9
  }
14
10
 
15
- function getMainAxisFromPlacement(placement) {
16
- return ['top', 'bottom'].includes(getSide(placement)) ? 'x' : 'y';
17
- }
18
-
19
11
  function getLengthFromAxis(axis) {
20
12
  return axis === 'y' ? 'height' : 'width';
21
13
  }
22
14
 
15
+ function getSide(placement) {
16
+ return placement.split('-')[0];
17
+ }
18
+
19
+ function getMainAxisFromPlacement(placement) {
20
+ return ['top', 'bottom'].includes(getSide(placement)) ? 'x' : 'y';
21
+ }
22
+
23
23
  function computeCoordsFromPlacement(_ref, placement, rtl) {
24
24
  let {
25
25
  reference,
@@ -33,7 +33,6 @@ function computeCoordsFromPlacement(_ref, placement, rtl) {
33
33
  const side = getSide(placement);
34
34
  const isVertical = mainAxis === 'x';
35
35
  let coords;
36
-
37
36
  switch (side) {
38
37
  case 'top':
39
38
  coords = {
@@ -41,45 +40,38 @@ function computeCoordsFromPlacement(_ref, placement, rtl) {
41
40
  y: reference.y - floating.height
42
41
  };
43
42
  break;
44
-
45
43
  case 'bottom':
46
44
  coords = {
47
45
  x: commonX,
48
46
  y: reference.y + reference.height
49
47
  };
50
48
  break;
51
-
52
49
  case 'right':
53
50
  coords = {
54
51
  x: reference.x + reference.width,
55
52
  y: commonY
56
53
  };
57
54
  break;
58
-
59
55
  case 'left':
60
56
  coords = {
61
57
  x: reference.x - floating.width,
62
58
  y: commonY
63
59
  };
64
60
  break;
65
-
66
61
  default:
67
62
  coords = {
68
63
  x: reference.x,
69
64
  y: reference.y
70
65
  };
71
66
  }
72
-
73
67
  switch (getAlignment(placement)) {
74
68
  case 'start':
75
69
  coords[mainAxis] -= commonAlign * (rtl && isVertical ? -1 : 1);
76
70
  break;
77
-
78
71
  case 'end':
79
72
  coords[mainAxis] += commonAlign * (rtl && isVertical ? -1 : 1);
80
73
  break;
81
74
  }
82
-
83
75
  return coords;
84
76
  }
85
77
 
@@ -90,7 +82,6 @@ function computeCoordsFromPlacement(_ref, placement, rtl) {
90
82
  * This export does not have any `platform` interface logic. You will need to
91
83
  * write one for the platform you are using Floating UI with.
92
84
  */
93
-
94
85
  const computePosition$1 = async (reference, floating, config) => {
95
86
  const {
96
87
  placement = 'bottom',
@@ -98,8 +89,8 @@ const computePosition$1 = async (reference, floating, config) => {
98
89
  middleware = [],
99
90
  platform
100
91
  } = config;
92
+ const validMiddleware = middleware.filter(Boolean);
101
93
  const rtl = await (platform.isRTL == null ? void 0 : platform.isRTL(floating));
102
-
103
94
  let rects = await platform.getElementRects({
104
95
  reference,
105
96
  floating,
@@ -112,12 +103,11 @@ const computePosition$1 = async (reference, floating, config) => {
112
103
  let statefulPlacement = placement;
113
104
  let middlewareData = {};
114
105
  let resetCount = 0;
115
-
116
- for (let i = 0; i < middleware.length; i++) {
106
+ for (let i = 0; i < validMiddleware.length; i++) {
117
107
  const {
118
108
  name,
119
109
  fn
120
- } = middleware[i];
110
+ } = validMiddleware[i];
121
111
  const {
122
112
  x: nextX,
123
113
  y: nextY,
@@ -139,20 +129,19 @@ const computePosition$1 = async (reference, floating, config) => {
139
129
  });
140
130
  x = nextX != null ? nextX : x;
141
131
  y = nextY != null ? nextY : y;
142
- middlewareData = { ...middlewareData,
143
- [name]: { ...middlewareData[name],
132
+ middlewareData = {
133
+ ...middlewareData,
134
+ [name]: {
135
+ ...middlewareData[name],
144
136
  ...data
145
137
  }
146
138
  };
147
-
148
139
  if (reset && resetCount <= 50) {
149
140
  resetCount++;
150
-
151
141
  if (typeof reset === 'object') {
152
142
  if (reset.placement) {
153
143
  statefulPlacement = reset.placement;
154
144
  }
155
-
156
145
  if (reset.rects) {
157
146
  rects = reset.rects === true ? await platform.getElementRects({
158
147
  reference,
@@ -160,18 +149,15 @@ const computePosition$1 = async (reference, floating, config) => {
160
149
  strategy
161
150
  }) : reset.rects;
162
151
  }
163
-
164
152
  ({
165
153
  x,
166
154
  y
167
155
  } = computeCoordsFromPlacement(rects, statefulPlacement, rtl));
168
156
  }
169
-
170
157
  i = -1;
171
158
  continue;
172
159
  }
173
160
  }
174
-
175
161
  return {
176
162
  x,
177
163
  y,
@@ -201,7 +187,8 @@ function getSideObjectFromPadding(padding) {
201
187
  }
202
188
 
203
189
  function rectToClientRect(rect) {
204
- return { ...rect,
190
+ return {
191
+ ...rect,
205
192
  top: rect.y,
206
193
  left: rect.x,
207
194
  right: rect.x + rect.width,
@@ -211,19 +198,17 @@ function rectToClientRect(rect) {
211
198
 
212
199
  /**
213
200
  * Resolves with an object of overflow side offsets that determine how much the
214
- * element is overflowing a given clipping boundary.
201
+ * element is overflowing a given clipping boundary on each side.
215
202
  * - positive = overflowing the boundary by that number of pixels
216
203
  * - negative = how many pixels left before it will overflow
217
204
  * - 0 = lies flush with the boundary
218
205
  * @see https://floating-ui.com/docs/detectOverflow
219
206
  */
220
- async function detectOverflow(middlewareArguments, options) {
207
+ async function detectOverflow(state, options) {
221
208
  var _await$platform$isEle;
222
-
223
209
  if (options === void 0) {
224
210
  options = {};
225
211
  }
226
-
227
212
  const {
228
213
  x,
229
214
  y,
@@ -231,7 +216,7 @@ async function detectOverflow(middlewareArguments, options) {
231
216
  rects,
232
217
  elements,
233
218
  strategy
234
- } = middlewareArguments;
219
+ } = state;
235
220
  const {
236
221
  boundary = 'clippingAncestors',
237
222
  rootBoundary = 'viewport',
@@ -248,19 +233,29 @@ async function detectOverflow(middlewareArguments, options) {
248
233
  rootBoundary,
249
234
  strategy
250
235
  }));
236
+ const rect = elementContext === 'floating' ? {
237
+ ...rects.floating,
238
+ x,
239
+ y
240
+ } : rects.reference;
241
+ const offsetParent = await (platform.getOffsetParent == null ? void 0 : platform.getOffsetParent(elements.floating));
242
+ const offsetScale = (await (platform.isElement == null ? void 0 : platform.isElement(offsetParent))) ? (await (platform.getScale == null ? void 0 : platform.getScale(offsetParent))) || {
243
+ x: 1,
244
+ y: 1
245
+ } : {
246
+ x: 1,
247
+ y: 1
248
+ };
251
249
  const elementClientRect = rectToClientRect(platform.convertOffsetParentRelativeRectToViewportRelativeRect ? await platform.convertOffsetParentRelativeRectToViewportRelativeRect({
252
- rect: elementContext === 'floating' ? { ...rects.floating,
253
- x,
254
- y
255
- } : rects.reference,
256
- offsetParent: await (platform.getOffsetParent == null ? void 0 : platform.getOffsetParent(elements.floating)),
250
+ rect,
251
+ offsetParent,
257
252
  strategy
258
- }) : rects[elementContext]);
253
+ }) : rect);
259
254
  return {
260
- top: clippingClientRect.top - elementClientRect.top + paddingObject.top,
261
- bottom: elementClientRect.bottom - clippingClientRect.bottom + paddingObject.bottom,
262
- left: clippingClientRect.left - elementClientRect.left + paddingObject.left,
263
- right: elementClientRect.right - clippingClientRect.right + paddingObject.right
255
+ top: (clippingClientRect.top - elementClientRect.top + paddingObject.top) / offsetScale.y,
256
+ bottom: (elementClientRect.bottom - clippingClientRect.bottom + paddingObject.bottom) / offsetScale.y,
257
+ left: (clippingClientRect.left - elementClientRect.left + paddingObject.left) / offsetScale.x,
258
+ right: (elementClientRect.right - clippingClientRect.right + paddingObject.right) / offsetScale.x
264
259
  };
265
260
  }
266
261
 
@@ -272,63 +267,65 @@ function within(min$1$1, value, max$1$1) {
272
267
  }
273
268
 
274
269
  /**
275
- * Positions an inner element of the floating element such that it is centered
276
- * to the reference element.
270
+ * Provides data to position an inner element of the floating element so that it
271
+ * appears centered to the reference element.
277
272
  * @see https://floating-ui.com/docs/arrow
278
273
  */
279
274
  const arrow = options => ({
280
275
  name: 'arrow',
281
276
  options,
282
-
283
- async fn(middlewareArguments) {
284
- // Since `element` is required, we don't Partial<> the type
277
+ async fn(state) {
278
+ // Since `element` is required, we don't Partial<> the type.
285
279
  const {
286
280
  element,
287
281
  padding = 0
288
- } = options != null ? options : {};
282
+ } = options || {};
289
283
  const {
290
284
  x,
291
285
  y,
292
286
  placement,
293
287
  rects,
294
- platform
295
- } = middlewareArguments;
296
-
288
+ platform,
289
+ elements
290
+ } = state;
297
291
  if (element == null) {
298
-
299
292
  return {};
300
293
  }
301
-
302
294
  const paddingObject = getSideObjectFromPadding(padding);
303
295
  const coords = {
304
296
  x,
305
297
  y
306
298
  };
307
299
  const axis = getMainAxisFromPlacement(placement);
308
- const alignment = getAlignment(placement);
309
300
  const length = getLengthFromAxis(axis);
310
301
  const arrowDimensions = await platform.getDimensions(element);
311
- const minProp = axis === 'y' ? 'top' : 'left';
312
- const maxProp = axis === 'y' ? 'bottom' : 'right';
302
+ const isYAxis = axis === 'y';
303
+ const minProp = isYAxis ? 'top' : 'left';
304
+ const maxProp = isYAxis ? 'bottom' : 'right';
305
+ const clientProp = isYAxis ? 'clientHeight' : 'clientWidth';
313
306
  const endDiff = rects.reference[length] + rects.reference[axis] - coords[axis] - rects.floating[length];
314
307
  const startDiff = coords[axis] - rects.reference[axis];
315
308
  const arrowOffsetParent = await (platform.getOffsetParent == null ? void 0 : platform.getOffsetParent(element));
316
- let clientSize = arrowOffsetParent ? axis === 'y' ? arrowOffsetParent.clientHeight || 0 : arrowOffsetParent.clientWidth || 0 : 0;
309
+ let clientSize = arrowOffsetParent ? arrowOffsetParent[clientProp] : 0;
317
310
 
318
- if (clientSize === 0) {
319
- clientSize = rects.floating[length];
311
+ // DOM platform can return `window` as the `offsetParent`.
312
+ if (!clientSize || !(await (platform.isElement == null ? void 0 : platform.isElement(arrowOffsetParent)))) {
313
+ clientSize = elements.floating[clientProp] || rects.floating[length];
320
314
  }
315
+ const centerToReference = endDiff / 2 - startDiff / 2;
321
316
 
322
- const centerToReference = endDiff / 2 - startDiff / 2; // Make sure the arrow doesn't overflow the floating element if the center
323
- // point is outside the floating element's bounds
324
-
317
+ // Make sure the arrow doesn't overflow the floating element if the center
318
+ // point is outside the floating element's bounds.
325
319
  const min = paddingObject[minProp];
326
320
  const max = clientSize - arrowDimensions[length] - paddingObject[maxProp];
327
321
  const center = clientSize / 2 - arrowDimensions[length] / 2 + centerToReference;
328
- const offset = within(min, center, max); // Make sure that arrow points at the reference
322
+ const offset = within(min, center, max);
329
323
 
330
- const alignmentPadding = alignment === 'start' ? paddingObject[minProp] : paddingObject[maxProp];
331
- const shouldAddOffset = alignmentPadding > 0 && center !== offset && rects.reference[length] <= rects.floating[length];
324
+ // If the reference is small enough that the arrow's padding causes it to
325
+ // to point to nothing for an aligned placement, adjust the offset of the
326
+ // floating element itself. This stops `shift()` from taking action, but can
327
+ // be worked around by calling it again after the `arrow()` if desired.
328
+ const shouldAddOffset = getAlignment(placement) != null && center != offset && rects.reference[length] / 2 - (center < min ? paddingObject[minProp] : paddingObject[maxProp]) - arrowDimensions[length] / 2 < 0;
332
329
  const alignmentOffset = shouldAddOffset ? center < min ? min - center : max - center : 0;
333
330
  return {
334
331
  [axis]: coords[axis] - alignmentOffset,
@@ -338,71 +335,94 @@ const arrow = options => ({
338
335
  }
339
336
  };
340
337
  }
341
-
342
338
  });
343
339
 
344
- const hash$1 = {
340
+ const sides = ['top', 'right', 'bottom', 'left'];
341
+
342
+ const oppositeSideMap = {
345
343
  left: 'right',
346
344
  right: 'left',
347
345
  bottom: 'top',
348
346
  top: 'bottom'
349
347
  };
350
348
  function getOppositePlacement(placement) {
351
- return placement.replace(/left|right|bottom|top/g, matched => hash$1[matched]);
349
+ return placement.replace(/left|right|bottom|top/g, side => oppositeSideMap[side]);
352
350
  }
353
351
 
354
352
  function getAlignmentSides(placement, rects, rtl) {
355
353
  if (rtl === void 0) {
356
354
  rtl = false;
357
355
  }
358
-
359
356
  const alignment = getAlignment(placement);
360
357
  const mainAxis = getMainAxisFromPlacement(placement);
361
358
  const length = getLengthFromAxis(mainAxis);
362
359
  let mainAlignmentSide = mainAxis === 'x' ? alignment === (rtl ? 'end' : 'start') ? 'right' : 'left' : alignment === 'start' ? 'bottom' : 'top';
363
-
364
360
  if (rects.reference[length] > rects.floating[length]) {
365
361
  mainAlignmentSide = getOppositePlacement(mainAlignmentSide);
366
362
  }
367
-
368
363
  return {
369
364
  main: mainAlignmentSide,
370
365
  cross: getOppositePlacement(mainAlignmentSide)
371
366
  };
372
367
  }
373
368
 
374
- const hash = {
369
+ const oppositeAlignmentMap = {
375
370
  start: 'end',
376
371
  end: 'start'
377
372
  };
378
373
  function getOppositeAlignmentPlacement(placement) {
379
- return placement.replace(/start|end/g, matched => hash[matched]);
374
+ return placement.replace(/start|end/g, alignment => oppositeAlignmentMap[alignment]);
380
375
  }
381
376
 
382
- const sides = ['top', 'right', 'bottom', 'left'];
383
-
384
377
  function getExpandedPlacements(placement) {
385
378
  const oppositePlacement = getOppositePlacement(placement);
386
379
  return [getOppositeAlignmentPlacement(placement), oppositePlacement, getOppositeAlignmentPlacement(oppositePlacement)];
387
380
  }
388
381
 
382
+ function getSideList(side, isStart, rtl) {
383
+ const lr = ['left', 'right'];
384
+ const rl = ['right', 'left'];
385
+ const tb = ['top', 'bottom'];
386
+ const bt = ['bottom', 'top'];
387
+ switch (side) {
388
+ case 'top':
389
+ case 'bottom':
390
+ if (rtl) return isStart ? rl : lr;
391
+ return isStart ? lr : rl;
392
+ case 'left':
393
+ case 'right':
394
+ return isStart ? tb : bt;
395
+ default:
396
+ return [];
397
+ }
398
+ }
399
+ function getOppositeAxisPlacements(placement, flipAlignment, direction, rtl) {
400
+ const alignment = getAlignment(placement);
401
+ let list = getSideList(getSide(placement), direction === 'start', rtl);
402
+ if (alignment) {
403
+ list = list.map(side => side + "-" + alignment);
404
+ if (flipAlignment) {
405
+ list = list.concat(list.map(getOppositeAlignmentPlacement));
406
+ }
407
+ }
408
+ return list;
409
+ }
410
+
389
411
  /**
390
- * Changes the placement of the floating element to one that will fit if the
391
- * initially specified `placement` does not.
412
+ * Optimizes the visibility of the floating element by flipping the `placement`
413
+ * in order to keep it in view when the preferred placement(s) will overflow the
414
+ * clipping boundary. Alternative to `autoPlacement`.
392
415
  * @see https://floating-ui.com/docs/flip
393
416
  */
394
417
  const flip = function (options) {
395
418
  if (options === void 0) {
396
419
  options = {};
397
420
  }
398
-
399
421
  return {
400
422
  name: 'flip',
401
423
  options,
402
-
403
- async fn(middlewareArguments) {
424
+ async fn(state) {
404
425
  var _middlewareData$flip;
405
-
406
426
  const {
407
427
  placement,
408
428
  middlewareData,
@@ -410,48 +430,49 @@ const flip = function (options) {
410
430
  initialPlacement,
411
431
  platform,
412
432
  elements
413
- } = middlewareArguments;
433
+ } = state;
414
434
  const {
415
435
  mainAxis: checkMainAxis = true,
416
436
  crossAxis: checkCrossAxis = true,
417
437
  fallbackPlacements: specifiedFallbackPlacements,
418
438
  fallbackStrategy = 'bestFit',
439
+ fallbackAxisSideDirection = 'none',
419
440
  flipAlignment = true,
420
441
  ...detectOverflowOptions
421
442
  } = options;
422
443
  const side = getSide(placement);
423
- const isBasePlacement = side === initialPlacement;
444
+ const isBasePlacement = getSide(initialPlacement) === initialPlacement;
445
+ const rtl = await (platform.isRTL == null ? void 0 : platform.isRTL(elements.floating));
424
446
  const fallbackPlacements = specifiedFallbackPlacements || (isBasePlacement || !flipAlignment ? [getOppositePlacement(initialPlacement)] : getExpandedPlacements(initialPlacement));
447
+ if (!specifiedFallbackPlacements && fallbackAxisSideDirection !== 'none') {
448
+ fallbackPlacements.push(...getOppositeAxisPlacements(initialPlacement, flipAlignment, fallbackAxisSideDirection, rtl));
449
+ }
425
450
  const placements = [initialPlacement, ...fallbackPlacements];
426
- const overflow = await detectOverflow(middlewareArguments, detectOverflowOptions);
451
+ const overflow = await detectOverflow(state, detectOverflowOptions);
427
452
  const overflows = [];
428
453
  let overflowsData = ((_middlewareData$flip = middlewareData.flip) == null ? void 0 : _middlewareData$flip.overflows) || [];
429
-
430
454
  if (checkMainAxis) {
431
455
  overflows.push(overflow[side]);
432
456
  }
433
-
434
457
  if (checkCrossAxis) {
435
458
  const {
436
459
  main,
437
460
  cross
438
- } = getAlignmentSides(placement, rects, await (platform.isRTL == null ? void 0 : platform.isRTL(elements.floating)));
461
+ } = getAlignmentSides(placement, rects, rtl);
439
462
  overflows.push(overflow[main], overflow[cross]);
440
463
  }
441
-
442
464
  overflowsData = [...overflowsData, {
443
465
  placement,
444
466
  overflows
445
- }]; // One or more sides is overflowing
467
+ }];
446
468
 
469
+ // One or more sides is overflowing.
447
470
  if (!overflows.every(side => side <= 0)) {
448
- var _middlewareData$flip$, _middlewareData$flip2;
449
-
450
- const nextIndex = ((_middlewareData$flip$ = (_middlewareData$flip2 = middlewareData.flip) == null ? void 0 : _middlewareData$flip2.index) != null ? _middlewareData$flip$ : 0) + 1;
471
+ var _middlewareData$flip2, _overflowsData$filter;
472
+ const nextIndex = (((_middlewareData$flip2 = middlewareData.flip) == null ? void 0 : _middlewareData$flip2.index) || 0) + 1;
451
473
  const nextPlacement = placements[nextIndex];
452
-
453
474
  if (nextPlacement) {
454
- // Try next placement and re-run the lifecycle
475
+ // Try next placement and re-run the lifecycle.
455
476
  return {
456
477
  data: {
457
478
  index: nextIndex,
@@ -463,27 +484,27 @@ const flip = function (options) {
463
484
  };
464
485
  }
465
486
 
466
- let resetPlacement = 'bottom';
467
-
468
- switch (fallbackStrategy) {
469
- case 'bestFit':
470
- {
471
- var _overflowsData$map$so;
472
-
473
- const placement = (_overflowsData$map$so = overflowsData.map(d => [d, d.overflows.filter(overflow => overflow > 0).reduce((acc, overflow) => acc + overflow, 0)]).sort((a, b) => a[1] - b[1])[0]) == null ? void 0 : _overflowsData$map$so[0].placement;
474
-
475
- if (placement) {
476
- resetPlacement = placement;
487
+ // First, find the candidates that fit on the mainAxis side of overflow,
488
+ // then find the placement that fits the best on the main crossAxis side.
489
+ 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;
490
+
491
+ // Otherwise fallback.
492
+ if (!resetPlacement) {
493
+ switch (fallbackStrategy) {
494
+ case 'bestFit':
495
+ {
496
+ var _overflowsData$map$so;
497
+ const placement = (_overflowsData$map$so = overflowsData.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$map$so[0];
498
+ if (placement) {
499
+ resetPlacement = placement;
500
+ }
501
+ break;
477
502
  }
478
-
503
+ case 'initialPlacement':
504
+ resetPlacement = initialPlacement;
479
505
  break;
480
- }
481
-
482
- case 'initialPlacement':
483
- resetPlacement = initialPlacement;
484
- break;
506
+ }
485
507
  }
486
-
487
508
  if (placement !== resetPlacement) {
488
509
  return {
489
510
  reset: {
@@ -492,10 +513,8 @@ const flip = function (options) {
492
513
  };
493
514
  }
494
515
  }
495
-
496
516
  return {};
497
517
  }
498
-
499
518
  };
500
519
  };
501
520
 
@@ -507,33 +526,34 @@ function getSideOffsets(overflow, rect) {
507
526
  left: overflow.left - rect.width
508
527
  };
509
528
  }
510
-
511
529
  function isAnySideFullyClipped(overflow) {
512
530
  return sides.some(side => overflow[side] >= 0);
513
531
  }
514
-
515
532
  /**
516
533
  * Provides data to hide the floating element in applicable situations, such as
517
534
  * when it is not in the same clipping context as the reference element.
518
535
  * @see https://floating-ui.com/docs/hide
519
536
  */
520
- const hide = function (_temp) {
521
- let {
522
- strategy = 'referenceHidden',
523
- ...detectOverflowOptions
524
- } = _temp === void 0 ? {} : _temp;
537
+ const hide = function (options) {
538
+ if (options === void 0) {
539
+ options = {};
540
+ }
525
541
  return {
526
542
  name: 'hide',
527
-
528
- async fn(middlewareArguments) {
543
+ options,
544
+ async fn(state) {
545
+ const {
546
+ strategy = 'referenceHidden',
547
+ ...detectOverflowOptions
548
+ } = options;
529
549
  const {
530
550
  rects
531
- } = middlewareArguments;
532
-
551
+ } = state;
533
552
  switch (strategy) {
534
553
  case 'referenceHidden':
535
554
  {
536
- const overflow = await detectOverflow(middlewareArguments, { ...detectOverflowOptions,
555
+ const overflow = await detectOverflow(state, {
556
+ ...detectOverflowOptions,
537
557
  elementContext: 'reference'
538
558
  });
539
559
  const offsets = getSideOffsets(overflow, rects.reference);
@@ -544,10 +564,10 @@ const hide = function (_temp) {
544
564
  }
545
565
  };
546
566
  }
547
-
548
567
  case 'escaped':
549
568
  {
550
- const overflow = await detectOverflow(middlewareArguments, { ...detectOverflowOptions,
569
+ const overflow = await detectOverflow(state, {
570
+ ...detectOverflowOptions,
551
571
  altBoundary: true
552
572
  });
553
573
  const offsets = getSideOffsets(overflow, rects.floating);
@@ -558,31 +578,30 @@ const hide = function (_temp) {
558
578
  }
559
579
  };
560
580
  }
561
-
562
581
  default:
563
582
  {
564
583
  return {};
565
584
  }
566
585
  }
567
586
  }
568
-
569
587
  };
570
588
  };
571
589
 
572
- async function convertValueToCoords(middlewareArguments, value) {
590
+ async function convertValueToCoords(state, value) {
573
591
  const {
574
592
  placement,
575
593
  platform,
576
594
  elements
577
- } = middlewareArguments;
595
+ } = state;
578
596
  const rtl = await (platform.isRTL == null ? void 0 : platform.isRTL(elements.floating));
579
597
  const side = getSide(placement);
580
598
  const alignment = getAlignment(placement);
581
599
  const isVertical = getMainAxisFromPlacement(placement) === 'x';
582
600
  const mainAxisMulti = ['left', 'top'].includes(side) ? -1 : 1;
583
601
  const crossAxisMulti = rtl && isVertical ? -1 : 1;
584
- const rawValue = typeof value === 'function' ? value(middlewareArguments) : value; // eslint-disable-next-line prefer-const
602
+ const rawValue = typeof value === 'function' ? value(state) : value;
585
603
 
604
+ // eslint-disable-next-line prefer-const
586
605
  let {
587
606
  mainAxis,
588
607
  crossAxis,
@@ -597,11 +616,9 @@ async function convertValueToCoords(middlewareArguments, value) {
597
616
  alignmentAxis: null,
598
617
  ...rawValue
599
618
  };
600
-
601
619
  if (alignment && typeof alignmentAxis === 'number') {
602
620
  crossAxis = alignment === 'end' ? alignmentAxis * -1 : alignmentAxis;
603
621
  }
604
-
605
622
  return isVertical ? {
606
623
  x: crossAxis * crossAxisMulti,
607
624
  y: mainAxis * mainAxisMulti
@@ -610,33 +627,33 @@ async function convertValueToCoords(middlewareArguments, value) {
610
627
  y: crossAxis * crossAxisMulti
611
628
  };
612
629
  }
630
+
613
631
  /**
614
- * Displaces the floating element from its reference element.
632
+ * Modifies the placement by translating the floating element along the
633
+ * specified axes.
634
+ * A number (shorthand for `mainAxis` or distance), or an axes configuration
635
+ * object may be passed.
615
636
  * @see https://floating-ui.com/docs/offset
616
637
  */
617
-
618
638
  const offset = function (value) {
619
639
  if (value === void 0) {
620
640
  value = 0;
621
641
  }
622
-
623
642
  return {
624
643
  name: 'offset',
625
644
  options: value,
626
-
627
- async fn(middlewareArguments) {
645
+ async fn(state) {
628
646
  const {
629
647
  x,
630
648
  y
631
- } = middlewareArguments;
632
- const diffCoords = await convertValueToCoords(middlewareArguments, value);
649
+ } = state;
650
+ const diffCoords = await convertValueToCoords(state, value);
633
651
  return {
634
652
  x: x + diffCoords.x,
635
653
  y: y + diffCoords.y,
636
654
  data: diffCoords
637
655
  };
638
656
  }
639
-
640
657
  };
641
658
  };
642
659
 
@@ -645,25 +662,23 @@ function getCrossAxis(axis) {
645
662
  }
646
663
 
647
664
  /**
648
- * Shifts the floating element in order to keep it in view when it will overflow
649
- * a clipping boundary.
665
+ * Optimizes the visibility of the floating element by shifting it in order to
666
+ * keep it in view when it will overflow the clipping boundary.
650
667
  * @see https://floating-ui.com/docs/shift
651
668
  */
652
669
  const shift = function (options) {
653
670
  if (options === void 0) {
654
671
  options = {};
655
672
  }
656
-
657
673
  return {
658
674
  name: 'shift',
659
675
  options,
660
-
661
- async fn(middlewareArguments) {
676
+ async fn(state) {
662
677
  const {
663
678
  x,
664
679
  y,
665
680
  placement
666
- } = middlewareArguments;
681
+ } = state;
667
682
  const {
668
683
  mainAxis: checkMainAxis = true,
669
684
  crossAxis: checkCrossAxis = false,
@@ -685,12 +700,11 @@ const shift = function (options) {
685
700
  x,
686
701
  y
687
702
  };
688
- const overflow = await detectOverflow(middlewareArguments, detectOverflowOptions);
703
+ const overflow = await detectOverflow(state, detectOverflowOptions);
689
704
  const mainAxis = getMainAxisFromPlacement(getSide(placement));
690
705
  const crossAxis = getCrossAxis(mainAxis);
691
706
  let mainAxisCoord = coords[mainAxis];
692
707
  let crossAxisCoord = coords[crossAxis];
693
-
694
708
  if (checkMainAxis) {
695
709
  const minSide = mainAxis === 'y' ? 'top' : 'left';
696
710
  const maxSide = mainAxis === 'y' ? 'bottom' : 'right';
@@ -698,7 +712,6 @@ const shift = function (options) {
698
712
  const max = mainAxisCoord - overflow[maxSide];
699
713
  mainAxisCoord = within(min, mainAxisCoord, max);
700
714
  }
701
-
702
715
  if (checkCrossAxis) {
703
716
  const minSide = crossAxis === 'y' ? 'top' : 'left';
704
717
  const maxSide = crossAxis === 'y' ? 'bottom' : 'right';
@@ -706,54 +719,57 @@ const shift = function (options) {
706
719
  const max = crossAxisCoord - overflow[maxSide];
707
720
  crossAxisCoord = within(min, crossAxisCoord, max);
708
721
  }
709
-
710
- const limitedCoords = limiter.fn({ ...middlewareArguments,
722
+ const limitedCoords = limiter.fn({
723
+ ...state,
711
724
  [mainAxis]: mainAxisCoord,
712
725
  [crossAxis]: crossAxisCoord
713
726
  });
714
- return { ...limitedCoords,
727
+ return {
728
+ ...limitedCoords,
715
729
  data: {
716
730
  x: limitedCoords.x - x,
717
731
  y: limitedCoords.y - y
718
732
  }
719
733
  };
720
734
  }
721
-
722
735
  };
723
736
  };
724
737
 
725
738
  /**
726
- * Provides data to change the size of the floating element. For instance,
727
- * prevent it from overflowing its clipping boundary or match the width of the
728
- * reference element.
739
+ * Provides data that allows you to change the size of the floating element
740
+ * for instance, prevent it from overflowing the clipping boundary or match the
741
+ * width of the reference element.
729
742
  * @see https://floating-ui.com/docs/size
730
743
  */
731
744
  const size = function (options) {
732
745
  if (options === void 0) {
733
746
  options = {};
734
747
  }
735
-
736
748
  return {
737
749
  name: 'size',
738
750
  options,
739
-
740
- async fn(middlewareArguments) {
751
+ async fn(state) {
741
752
  const {
742
753
  placement,
743
754
  rects,
744
755
  platform,
745
756
  elements
746
- } = middlewareArguments;
757
+ } = state;
747
758
  const {
748
759
  apply = () => {},
749
760
  ...detectOverflowOptions
750
761
  } = options;
751
- const overflow = await detectOverflow(middlewareArguments, detectOverflowOptions);
762
+ const overflow = await detectOverflow(state, detectOverflowOptions);
752
763
  const side = getSide(placement);
753
764
  const alignment = getAlignment(placement);
765
+ const axis = getMainAxisFromPlacement(placement);
766
+ const isXAxis = axis === 'x';
767
+ const {
768
+ width,
769
+ height
770
+ } = rects.floating;
754
771
  let heightSide;
755
772
  let widthSide;
756
-
757
773
  if (side === 'top' || side === 'bottom') {
758
774
  heightSide = side;
759
775
  widthSide = alignment === ((await (platform.isRTL == null ? void 0 : platform.isRTL(elements.floating))) ? 'start' : 'end') ? 'left' : 'right';
@@ -761,65 +777,74 @@ const size = function (options) {
761
777
  widthSide = side;
762
778
  heightSide = alignment === 'end' ? 'top' : 'bottom';
763
779
  }
764
-
765
- const xMin = max$1(overflow.left, 0);
766
- const xMax = max$1(overflow.right, 0);
767
- const yMin = max$1(overflow.top, 0);
768
- const yMax = max$1(overflow.bottom, 0);
769
- const dimensions = {
770
- availableHeight: rects.floating.height - (['left', 'right'].includes(placement) ? 2 * (yMin !== 0 || yMax !== 0 ? yMin + yMax : max$1(overflow.top, overflow.bottom)) : overflow[heightSide]),
771
- availableWidth: rects.floating.width - (['top', 'bottom'].includes(placement) ? 2 * (xMin !== 0 || xMax !== 0 ? xMin + xMax : max$1(overflow.left, overflow.right)) : overflow[widthSide])
772
- };
773
- await apply({ ...middlewareArguments,
774
- ...dimensions
780
+ const overflowAvailableHeight = height - overflow[heightSide];
781
+ const overflowAvailableWidth = width - overflow[widthSide];
782
+ let availableHeight = overflowAvailableHeight;
783
+ let availableWidth = overflowAvailableWidth;
784
+ if (isXAxis) {
785
+ availableWidth = min$1(
786
+ // Maximum clipping viewport width
787
+ width - overflow.right - overflow.left, overflowAvailableWidth);
788
+ } else {
789
+ availableHeight = min$1(
790
+ // Maximum clipping viewport height
791
+ height - overflow.bottom - overflow.top, overflowAvailableHeight);
792
+ }
793
+ if (!state.middlewareData.shift && !alignment) {
794
+ const xMin = max$1(overflow.left, 0);
795
+ const xMax = max$1(overflow.right, 0);
796
+ const yMin = max$1(overflow.top, 0);
797
+ const yMax = max$1(overflow.bottom, 0);
798
+ if (isXAxis) {
799
+ availableWidth = width - 2 * (xMin !== 0 || xMax !== 0 ? xMin + xMax : max$1(overflow.left, overflow.right));
800
+ } else {
801
+ availableHeight = height - 2 * (yMin !== 0 || yMax !== 0 ? yMin + yMax : max$1(overflow.top, overflow.bottom));
802
+ }
803
+ }
804
+ await apply({
805
+ ...state,
806
+ availableWidth,
807
+ availableHeight
775
808
  });
776
809
  const nextDimensions = await platform.getDimensions(elements.floating);
777
-
778
- if (rects.floating.width !== nextDimensions.width || rects.floating.height !== nextDimensions.height) {
810
+ if (width !== nextDimensions.width || height !== nextDimensions.height) {
779
811
  return {
780
812
  reset: {
781
813
  rects: true
782
814
  }
783
815
  };
784
816
  }
785
-
786
817
  return {};
787
818
  }
788
-
789
819
  };
790
820
  };
791
821
 
792
- function isWindow(value) {
793
- return value && value.document && value.location && value.alert && value.setInterval;
794
- }
795
822
  function getWindow(node) {
796
- if (node == null) {
797
- return window;
798
- }
799
-
800
- if (!isWindow(node)) {
801
- const ownerDocument = node.ownerDocument;
802
- return ownerDocument ? ownerDocument.defaultView || window : window;
803
- }
804
-
805
- return node;
823
+ var _node$ownerDocument;
824
+ return ((_node$ownerDocument = node.ownerDocument) == null ? void 0 : _node$ownerDocument.defaultView) || window;
806
825
  }
807
826
 
808
- function getComputedStyle(element) {
827
+ function getComputedStyle$1(element) {
809
828
  return getWindow(element).getComputedStyle(element);
810
829
  }
811
830
 
831
+ function isNode(value) {
832
+ return value instanceof getWindow(value).Node;
833
+ }
812
834
  function getNodeName(node) {
813
- return isWindow(node) ? '' : node ? (node.nodeName || '').toLowerCase() : '';
835
+ return isNode(node) ? (node.nodeName || '').toLowerCase() : '';
814
836
  }
815
837
 
838
+ let uaString;
816
839
  function getUAString() {
840
+ if (uaString) {
841
+ return uaString;
842
+ }
817
843
  const uaData = navigator.userAgentData;
818
-
819
- if (uaData != null && uaData.brands) {
820
- return uaData.brands.map(item => item.brand + "/" + item.version).join(' ');
844
+ if (uaData && Array.isArray(uaData.brands)) {
845
+ uaString = uaData.brands.map(item => item.brand + "/" + item.version).join(' ');
846
+ return uaString;
821
847
  }
822
-
823
848
  return navigator.userAgent;
824
849
  }
825
850
 
@@ -829,275 +854,188 @@ function isHTMLElement(value) {
829
854
  function isElement(value) {
830
855
  return value instanceof getWindow(value).Element;
831
856
  }
832
- function isNode(value) {
833
- return value instanceof getWindow(value).Node;
834
- }
835
857
  function isShadowRoot(node) {
836
- // Browsers without `ShadowRoot` support
858
+ // Browsers without `ShadowRoot` support.
837
859
  if (typeof ShadowRoot === 'undefined') {
838
860
  return false;
839
861
  }
840
-
841
862
  const OwnElement = getWindow(node).ShadowRoot;
842
863
  return node instanceof OwnElement || node instanceof ShadowRoot;
843
864
  }
844
865
  function isOverflowElement(element) {
845
- // Firefox wants us to check `-x` and `-y` variations as well
846
866
  const {
847
867
  overflow,
848
868
  overflowX,
849
- overflowY
850
- } = getComputedStyle(element);
851
- return /auto|scroll|overlay|hidden/.test(overflow + overflowY + overflowX);
869
+ overflowY,
870
+ display
871
+ } = getComputedStyle$1(element);
872
+ return /auto|scroll|overlay|hidden|clip/.test(overflow + overflowY + overflowX) && !['inline', 'contents'].includes(display);
852
873
  }
853
874
  function isTableElement(element) {
854
875
  return ['table', 'td', 'th'].includes(getNodeName(element));
855
876
  }
856
877
  function isContainingBlock(element) {
857
- // TODO: Try and use feature detection here instead
878
+ // TODO: Try to use feature detection here instead.
858
879
  const isFirefox = /firefox/i.test(getUAString());
859
- const css = getComputedStyle(element); // This is non-exhaustive but covers the most common CSS properties that
880
+ const css = getComputedStyle$1(element);
881
+ const backdropFilter = css.backdropFilter || css.WebkitBackdropFilter;
882
+
883
+ // This is non-exhaustive but covers the most common CSS properties that
860
884
  // create a containing block.
861
885
  // https://developer.mozilla.org/en-US/docs/Web/CSS/Containing_block#identifying_the_containing_block
862
-
863
- return css.transform !== 'none' || css.perspective !== 'none' || // @ts-ignore (TS 4.1 compat)
864
- css.contain === 'paint' || ['transform', 'perspective'].includes(css.willChange) || isFirefox && css.willChange === 'filter' || isFirefox && (css.filter ? css.filter !== 'none' : false);
886
+ return css.transform !== 'none' || css.perspective !== 'none' || (backdropFilter ? backdropFilter !== 'none' : false) || isFirefox && css.willChange === 'filter' || isFirefox && (css.filter ? css.filter !== 'none' : false) || ['transform', 'perspective'].some(value => css.willChange.includes(value)) || ['paint', 'layout', 'strict', 'content'].some(value => {
887
+ // Add type check for old browsers.
888
+ const contain = css.contain;
889
+ return contain != null ? contain.includes(value) : false;
890
+ });
865
891
  }
866
- function isLayoutViewport() {
867
- // Not Safari
868
- return !/^((?!chrome|android).)*safari/i.test(getUAString()); // Feature detection for this fails in various ways
892
+
893
+ /**
894
+ * Determines whether or not `.getBoundingClientRect()` is affected by visual
895
+ * viewport offsets. In Safari, the `x`/`y` offsets are values relative to the
896
+ * visual viewport, while in other engines, they are values relative to the
897
+ * layout viewport.
898
+ */
899
+ function isClientRectVisualViewportBased() {
900
+ // TODO: Try to use feature detection here instead. Feature detection for
901
+ // this can fail in various ways, making the userAgent check the most
902
+ // reliable:
869
903
  // • Always-visible scrollbar or not
870
- // • Width of <html>, etc.
871
- // const vV = win.visualViewport;
872
- // return vV ? Math.abs(win.innerWidth / vV.scale - vV.width) < 0.5 : true;
904
+ // • Width of <html>
905
+
906
+ // Is Safari.
907
+ return /^((?!chrome|android).)*safari/i.test(getUAString());
908
+ }
909
+ function isLastTraversableNode(node) {
910
+ return ['html', 'body', '#document'].includes(getNodeName(node));
873
911
  }
874
912
 
875
913
  const min = Math.min;
876
914
  const max = Math.max;
877
915
  const round = Math.round;
878
916
 
879
- function getBoundingClientRect(element, includeScale, isFixedStrategy) {
880
- var _win$visualViewport$o, _win$visualViewport, _win$visualViewport$o2, _win$visualViewport2;
881
-
882
- if (includeScale === void 0) {
883
- includeScale = false;
917
+ function getCssDimensions(element) {
918
+ const css = getComputedStyle$1(element);
919
+ let width = parseFloat(css.width);
920
+ let height = parseFloat(css.height);
921
+ const hasOffset = isHTMLElement(element);
922
+ const offsetWidth = hasOffset ? element.offsetWidth : width;
923
+ const offsetHeight = hasOffset ? element.offsetHeight : height;
924
+ const shouldFallback = round(width) !== offsetWidth || round(height) !== offsetHeight;
925
+ if (shouldFallback) {
926
+ width = offsetWidth;
927
+ height = offsetHeight;
884
928
  }
885
-
886
- if (isFixedStrategy === void 0) {
887
- isFixedStrategy = false;
888
- }
889
-
890
- const clientRect = element.getBoundingClientRect();
891
- let scaleX = 1;
892
- let scaleY = 1;
893
-
894
- if (includeScale && isHTMLElement(element)) {
895
- scaleX = element.offsetWidth > 0 ? round(clientRect.width) / element.offsetWidth || 1 : 1;
896
- scaleY = element.offsetHeight > 0 ? round(clientRect.height) / element.offsetHeight || 1 : 1;
897
- }
898
-
899
- const win = isElement(element) ? getWindow(element) : window;
900
- const addVisualOffsets = !isLayoutViewport() && isFixedStrategy;
901
- const x = (clientRect.left + (addVisualOffsets ? (_win$visualViewport$o = (_win$visualViewport = win.visualViewport) == null ? void 0 : _win$visualViewport.offsetLeft) != null ? _win$visualViewport$o : 0 : 0)) / scaleX;
902
- const y = (clientRect.top + (addVisualOffsets ? (_win$visualViewport$o2 = (_win$visualViewport2 = win.visualViewport) == null ? void 0 : _win$visualViewport2.offsetTop) != null ? _win$visualViewport$o2 : 0 : 0)) / scaleY;
903
- const width = clientRect.width / scaleX;
904
- const height = clientRect.height / scaleY;
905
929
  return {
906
930
  width,
907
931
  height,
908
- top: y,
909
- right: x + width,
910
- bottom: y + height,
911
- left: x,
912
- x,
913
- y
932
+ fallback: shouldFallback
914
933
  };
915
934
  }
916
935
 
917
- function getDocumentElement(node) {
918
- return ((isNode(node) ? node.ownerDocument : node.document) || window.document).documentElement;
936
+ function unwrapElement(element) {
937
+ return !isElement(element) ? element.contextElement : element;
919
938
  }
920
939
 
921
- function getNodeScroll(element) {
922
- if (isElement(element)) {
923
- return {
924
- scrollLeft: element.scrollLeft,
925
- scrollTop: element.scrollTop
926
- };
940
+ const FALLBACK_SCALE = {
941
+ x: 1,
942
+ y: 1
943
+ };
944
+ function getScale(element) {
945
+ const domElement = unwrapElement(element);
946
+ if (!isHTMLElement(domElement)) {
947
+ return FALLBACK_SCALE;
927
948
  }
949
+ const rect = domElement.getBoundingClientRect();
950
+ const {
951
+ width,
952
+ height,
953
+ fallback
954
+ } = getCssDimensions(domElement);
955
+ let x = (fallback ? round(rect.width) : rect.width) / width;
956
+ let y = (fallback ? round(rect.height) : rect.height) / height;
928
957
 
929
- return {
930
- scrollLeft: element.pageXOffset,
931
- scrollTop: element.pageYOffset
932
- };
933
- }
934
-
935
- function getWindowScrollBarX(element) {
936
- // If <html> has a CSS width greater than the viewport, then this will be
937
- // incorrect for RTL.
938
- return getBoundingClientRect(getDocumentElement(element)).left + getNodeScroll(element).scrollLeft;
939
- }
940
-
941
- function isScaled(element) {
942
- const rect = getBoundingClientRect(element);
943
- return round(rect.width) !== element.offsetWidth || round(rect.height) !== element.offsetHeight;
944
- }
945
-
946
- function getRectRelativeToOffsetParent(element, offsetParent, strategy) {
947
- const isOffsetParentAnElement = isHTMLElement(offsetParent);
948
- const documentElement = getDocumentElement(offsetParent);
949
- const rect = getBoundingClientRect(element, // @ts-ignore - checked above (TS 4.1 compat)
950
- isOffsetParentAnElement && isScaled(offsetParent), strategy === 'fixed');
951
- let scroll = {
952
- scrollLeft: 0,
953
- scrollTop: 0
954
- };
955
- const offsets = {
956
- x: 0,
957
- y: 0
958
- };
959
-
960
- if (isOffsetParentAnElement || !isOffsetParentAnElement && strategy !== 'fixed') {
961
- if (getNodeName(offsetParent) !== 'body' || isOverflowElement(documentElement)) {
962
- scroll = getNodeScroll(offsetParent);
963
- }
958
+ // 0, NaN, or Infinity should always fallback to 1.
964
959
 
965
- if (isHTMLElement(offsetParent)) {
966
- const offsetRect = getBoundingClientRect(offsetParent, true);
967
- offsets.x = offsetRect.x + offsetParent.clientLeft;
968
- offsets.y = offsetRect.y + offsetParent.clientTop;
969
- } else if (documentElement) {
970
- offsets.x = getWindowScrollBarX(documentElement);
971
- }
960
+ if (!x || !Number.isFinite(x)) {
961
+ x = 1;
962
+ }
963
+ if (!y || !Number.isFinite(y)) {
964
+ y = 1;
972
965
  }
973
-
974
966
  return {
975
- x: rect.left + scroll.scrollLeft - offsets.x,
976
- y: rect.top + scroll.scrollTop - offsets.y,
977
- width: rect.width,
978
- height: rect.height
967
+ x,
968
+ y
979
969
  };
980
970
  }
981
971
 
982
- function getParentNode(node) {
983
- if (getNodeName(node) === 'html') {
984
- return node;
972
+ function getBoundingClientRect(element, includeScale, isFixedStrategy, offsetParent) {
973
+ var _win$visualViewport, _win$visualViewport2;
974
+ if (includeScale === void 0) {
975
+ includeScale = false;
985
976
  }
986
-
987
- return (// this is a quicker (but less type safe) way to save quite some bytes from the bundle
988
- // @ts-ignore
989
- node.assignedSlot || // step into the shadow DOM of the parent of a slotted node
990
- node.parentNode || ( // DOM Element detected
991
- isShadowRoot(node) ? node.host : null) || // ShadowRoot detected
992
- getDocumentElement(node) // fallback
993
-
994
- );
995
- }
996
-
997
- function getTrueOffsetParent(element) {
998
- if (!isHTMLElement(element) || getComputedStyle(element).position === 'fixed') {
999
- return null;
977
+ if (isFixedStrategy === void 0) {
978
+ isFixedStrategy = false;
1000
979
  }
1001
-
1002
- return composedOffsetParent(element);
1003
- }
1004
- /**
1005
- * Polyfills the old offsetParent behavior from before the spec was changed:
1006
- * https://github.com/w3c/csswg-drafts/issues/159
1007
- */
1008
-
1009
-
1010
- function composedOffsetParent(element) {
1011
- let {
1012
- offsetParent
1013
- } = element;
1014
- let ancestor = element;
1015
- let foundInsideSlot = false;
1016
-
1017
- while (ancestor && ancestor !== offsetParent) {
1018
- const {
1019
- assignedSlot
1020
- } = ancestor;
1021
-
1022
- if (assignedSlot) {
1023
- let newOffsetParent = assignedSlot.offsetParent;
1024
-
1025
- if (getComputedStyle(assignedSlot).display === 'contents') {
1026
- const hadStyleAttribute = assignedSlot.hasAttribute('style');
1027
- const oldDisplay = assignedSlot.style.display;
1028
- assignedSlot.style.display = getComputedStyle(ancestor).display;
1029
- newOffsetParent = assignedSlot.offsetParent;
1030
- assignedSlot.style.display = oldDisplay;
1031
-
1032
- if (!hadStyleAttribute) {
1033
- assignedSlot.removeAttribute('style');
1034
- }
1035
- }
1036
-
1037
- ancestor = assignedSlot;
1038
-
1039
- if (offsetParent !== newOffsetParent) {
1040
- offsetParent = newOffsetParent;
1041
- foundInsideSlot = true;
980
+ const clientRect = element.getBoundingClientRect();
981
+ const domElement = unwrapElement(element);
982
+ let scale = FALLBACK_SCALE;
983
+ if (includeScale) {
984
+ if (offsetParent) {
985
+ if (isElement(offsetParent)) {
986
+ scale = getScale(offsetParent);
1042
987
  }
1043
- } else if (isShadowRoot(ancestor) && ancestor.host && foundInsideSlot) {
1044
- break;
1045
- }
1046
-
1047
- ancestor = isShadowRoot(ancestor) && ancestor.host || ancestor.parentNode;
1048
- }
1049
-
1050
- return offsetParent;
1051
- }
1052
-
1053
- function getContainingBlock(element) {
1054
- let currentNode = getParentNode(element);
1055
-
1056
- if (isShadowRoot(currentNode)) {
1057
- currentNode = currentNode.host;
1058
- }
1059
-
1060
- while (isHTMLElement(currentNode) && !['html', 'body'].includes(getNodeName(currentNode))) {
1061
- if (isContainingBlock(currentNode)) {
1062
- return currentNode;
1063
988
  } else {
1064
- const parent = currentNode.parentNode;
1065
- currentNode = isShadowRoot(parent) ? parent.host : parent;
989
+ scale = getScale(element);
1066
990
  }
1067
991
  }
1068
-
1069
- return null;
1070
- } // Gets the closest ancestor positioned element. Handles some edge cases,
1071
- // such as table ancestors and cross browser bugs.
1072
-
1073
-
1074
- function getOffsetParent(element) {
1075
- const window = getWindow(element);
1076
- let offsetParent = getTrueOffsetParent(element);
1077
-
1078
- while (offsetParent && isTableElement(offsetParent) && getComputedStyle(offsetParent).position === 'static') {
1079
- offsetParent = getTrueOffsetParent(offsetParent);
1080
- }
1081
-
1082
- if (offsetParent && (getNodeName(offsetParent) === 'html' || getNodeName(offsetParent) === 'body' && getComputedStyle(offsetParent).position === 'static' && !isContainingBlock(offsetParent))) {
1083
- return window;
992
+ const win = domElement ? getWindow(domElement) : window;
993
+ const addVisualOffsets = isClientRectVisualViewportBased() && isFixedStrategy;
994
+ let x = (clientRect.left + (addVisualOffsets ? ((_win$visualViewport = win.visualViewport) == null ? void 0 : _win$visualViewport.offsetLeft) || 0 : 0)) / scale.x;
995
+ let y = (clientRect.top + (addVisualOffsets ? ((_win$visualViewport2 = win.visualViewport) == null ? void 0 : _win$visualViewport2.offsetTop) || 0 : 0)) / scale.y;
996
+ let width = clientRect.width / scale.x;
997
+ let height = clientRect.height / scale.y;
998
+ if (domElement) {
999
+ const win = getWindow(domElement);
1000
+ const offsetWin = offsetParent && isElement(offsetParent) ? getWindow(offsetParent) : offsetParent;
1001
+ let currentIFrame = win.frameElement;
1002
+ while (currentIFrame && offsetParent && offsetWin !== win) {
1003
+ const iframeScale = getScale(currentIFrame);
1004
+ const iframeRect = currentIFrame.getBoundingClientRect();
1005
+ const css = getComputedStyle(currentIFrame);
1006
+ iframeRect.x += (currentIFrame.clientLeft + parseFloat(css.paddingLeft)) * iframeScale.x;
1007
+ iframeRect.y += (currentIFrame.clientTop + parseFloat(css.paddingTop)) * iframeScale.y;
1008
+ x *= iframeScale.x;
1009
+ y *= iframeScale.y;
1010
+ width *= iframeScale.x;
1011
+ height *= iframeScale.y;
1012
+ x += iframeRect.x;
1013
+ y += iframeRect.y;
1014
+ currentIFrame = getWindow(currentIFrame).frameElement;
1015
+ }
1084
1016
  }
1017
+ return rectToClientRect({
1018
+ width,
1019
+ height,
1020
+ x,
1021
+ y
1022
+ });
1023
+ }
1085
1024
 
1086
- return offsetParent || getContainingBlock(element) || window;
1025
+ function getDocumentElement(node) {
1026
+ return ((isNode(node) ? node.ownerDocument : node.document) || window.document).documentElement;
1087
1027
  }
1088
1028
 
1089
- function getDimensions(element) {
1090
- if (isHTMLElement(element)) {
1029
+ function getNodeScroll(element) {
1030
+ if (isElement(element)) {
1091
1031
  return {
1092
- width: element.offsetWidth,
1093
- height: element.offsetHeight
1032
+ scrollLeft: element.scrollLeft,
1033
+ scrollTop: element.scrollTop
1094
1034
  };
1095
1035
  }
1096
-
1097
- const rect = getBoundingClientRect(element);
1098
1036
  return {
1099
- width: rect.width,
1100
- height: rect.height
1037
+ scrollLeft: element.pageXOffset,
1038
+ scrollTop: element.pageYOffset
1101
1039
  };
1102
1040
  }
1103
1041
 
@@ -1109,87 +1047,59 @@ function convertOffsetParentRelativeRectToViewportRelativeRect(_ref) {
1109
1047
  } = _ref;
1110
1048
  const isOffsetParentAnElement = isHTMLElement(offsetParent);
1111
1049
  const documentElement = getDocumentElement(offsetParent);
1112
-
1113
1050
  if (offsetParent === documentElement) {
1114
1051
  return rect;
1115
1052
  }
1116
-
1117
1053
  let scroll = {
1118
1054
  scrollLeft: 0,
1119
1055
  scrollTop: 0
1120
1056
  };
1057
+ let scale = {
1058
+ x: 1,
1059
+ y: 1
1060
+ };
1121
1061
  const offsets = {
1122
1062
  x: 0,
1123
1063
  y: 0
1124
1064
  };
1125
-
1126
1065
  if (isOffsetParentAnElement || !isOffsetParentAnElement && strategy !== 'fixed') {
1127
1066
  if (getNodeName(offsetParent) !== 'body' || isOverflowElement(documentElement)) {
1128
1067
  scroll = getNodeScroll(offsetParent);
1129
1068
  }
1130
-
1131
1069
  if (isHTMLElement(offsetParent)) {
1132
- const offsetRect = getBoundingClientRect(offsetParent, true);
1070
+ const offsetRect = getBoundingClientRect(offsetParent);
1071
+ scale = getScale(offsetParent);
1133
1072
  offsets.x = offsetRect.x + offsetParent.clientLeft;
1134
1073
  offsets.y = offsetRect.y + offsetParent.clientTop;
1135
- } // This doesn't appear to be need to be negated.
1136
- // else if (documentElement) {
1137
- // offsets.x = getWindowScrollBarX(documentElement);
1138
- // }
1139
-
1140
- }
1141
-
1142
- return { ...rect,
1143
- x: rect.x - scroll.scrollLeft + offsets.x,
1144
- y: rect.y - scroll.scrollTop + offsets.y
1145
- };
1146
- }
1147
-
1148
- function getViewportRect(element, strategy) {
1149
- const win = getWindow(element);
1150
- const html = getDocumentElement(element);
1151
- const visualViewport = win.visualViewport;
1152
- let width = html.clientWidth;
1153
- let height = html.clientHeight;
1154
- let x = 0;
1155
- let y = 0;
1156
-
1157
- if (visualViewport) {
1158
- width = visualViewport.width;
1159
- height = visualViewport.height;
1160
- const layoutViewport = isLayoutViewport();
1161
-
1162
- if (layoutViewport || !layoutViewport && strategy === 'fixed') {
1163
- x = visualViewport.offsetLeft;
1164
- y = visualViewport.offsetTop;
1165
1074
  }
1166
1075
  }
1167
-
1168
1076
  return {
1169
- width,
1170
- height,
1171
- x,
1172
- y
1077
+ width: rect.width * scale.x,
1078
+ height: rect.height * scale.y,
1079
+ x: rect.x * scale.x - scroll.scrollLeft * scale.x + offsets.x,
1080
+ y: rect.y * scale.y - scroll.scrollTop * scale.y + offsets.y
1173
1081
  };
1174
1082
  }
1175
1083
 
1176
- // of the `<html>` and `<body>` rect bounds if horizontally scrollable
1084
+ function getWindowScrollBarX(element) {
1085
+ // If <html> has a CSS width greater than the viewport, then this will be
1086
+ // incorrect for RTL.
1087
+ return getBoundingClientRect(getDocumentElement(element)).left + getNodeScroll(element).scrollLeft;
1088
+ }
1177
1089
 
1090
+ // Gets the entire size of the scrollable document area, even extending outside
1091
+ // of the `<html>` and `<body>` rect bounds if horizontally scrollable.
1178
1092
  function getDocumentRect(element) {
1179
- var _element$ownerDocumen;
1180
-
1181
1093
  const html = getDocumentElement(element);
1182
1094
  const scroll = getNodeScroll(element);
1183
- const body = (_element$ownerDocumen = element.ownerDocument) == null ? void 0 : _element$ownerDocumen.body;
1184
- const width = max(html.scrollWidth, html.clientWidth, body ? body.scrollWidth : 0, body ? body.clientWidth : 0);
1185
- const height = max(html.scrollHeight, html.clientHeight, body ? body.scrollHeight : 0, body ? body.clientHeight : 0);
1095
+ const body = element.ownerDocument.body;
1096
+ const width = max(html.scrollWidth, html.clientWidth, body.scrollWidth, body.clientWidth);
1097
+ const height = max(html.scrollHeight, html.clientHeight, body.scrollHeight, body.clientHeight);
1186
1098
  let x = -scroll.scrollLeft + getWindowScrollBarX(element);
1187
1099
  const y = -scroll.scrollTop;
1188
-
1189
- if (getComputedStyle(body || html).direction === 'rtl') {
1190
- x += max(html.clientWidth, body ? body.clientWidth : 0) - width;
1100
+ if (getComputedStyle$1(body).direction === 'rtl') {
1101
+ x += max(html.clientWidth, body.clientWidth) - width;
1191
1102
  }
1192
-
1193
1103
  return {
1194
1104
  width,
1195
1105
  height,
@@ -1198,106 +1108,155 @@ function getDocumentRect(element) {
1198
1108
  };
1199
1109
  }
1200
1110
 
1111
+ function getParentNode(node) {
1112
+ if (getNodeName(node) === 'html') {
1113
+ return node;
1114
+ }
1115
+ const result =
1116
+ // Step into the shadow DOM of the parent of a slotted node.
1117
+ node.assignedSlot ||
1118
+ // DOM Element detected.
1119
+ node.parentNode ||
1120
+ // ShadowRoot detected.
1121
+ isShadowRoot(node) && node.host ||
1122
+ // Fallback.
1123
+ getDocumentElement(node);
1124
+ return isShadowRoot(result) ? result.host : result;
1125
+ }
1126
+
1201
1127
  function getNearestOverflowAncestor(node) {
1202
1128
  const parentNode = getParentNode(node);
1203
-
1204
- if (['html', 'body', '#document'].includes(getNodeName(parentNode))) {
1205
- // @ts-ignore assume body is always available
1206
- return node.ownerDocument.body;
1129
+ if (isLastTraversableNode(parentNode)) {
1130
+ // `getParentNode` will never return a `Document` due to the fallback
1131
+ // check, so it's either the <html> or <body> element.
1132
+ return parentNode.ownerDocument.body;
1207
1133
  }
1208
-
1209
1134
  if (isHTMLElement(parentNode) && isOverflowElement(parentNode)) {
1210
1135
  return parentNode;
1211
1136
  }
1212
-
1213
1137
  return getNearestOverflowAncestor(parentNode);
1214
1138
  }
1215
1139
 
1216
1140
  function getOverflowAncestors(node, list) {
1217
1141
  var _node$ownerDocument;
1218
-
1219
1142
  if (list === void 0) {
1220
1143
  list = [];
1221
1144
  }
1222
-
1223
1145
  const scrollableAncestor = getNearestOverflowAncestor(node);
1224
1146
  const isBody = scrollableAncestor === ((_node$ownerDocument = node.ownerDocument) == null ? void 0 : _node$ownerDocument.body);
1225
1147
  const win = getWindow(scrollableAncestor);
1226
- const target = isBody ? [win].concat(win.visualViewport || [], isOverflowElement(scrollableAncestor) ? scrollableAncestor : []) : scrollableAncestor;
1227
- const updatedList = list.concat(target);
1228
- return isBody ? updatedList : // @ts-ignore: isBody tells us target will be an HTMLElement here
1229
- updatedList.concat(getOverflowAncestors(target));
1148
+ if (isBody) {
1149
+ return list.concat(win, win.visualViewport || [], isOverflowElement(scrollableAncestor) ? scrollableAncestor : []);
1150
+ }
1151
+ return list.concat(scrollableAncestor, getOverflowAncestors(scrollableAncestor));
1230
1152
  }
1231
1153
 
1232
- function contains(parent, child) {
1233
- const rootNode = child.getRootNode == null ? void 0 : child.getRootNode(); // First, attempt with faster native method
1234
-
1235
- if (parent.contains(child)) {
1236
- return true;
1237
- } // then fallback to custom implementation with Shadow DOM support
1238
- else if (rootNode && isShadowRoot(rootNode)) {
1239
- let next = child;
1240
-
1241
- do {
1242
- // use `===` replace node.isSameNode()
1243
- if (next && parent === next) {
1244
- return true;
1245
- } // @ts-ignore: need a better way to handle this...
1246
-
1247
-
1248
- next = next.parentNode || next.host;
1249
- } while (next);
1154
+ function getViewportRect(element, strategy) {
1155
+ const win = getWindow(element);
1156
+ const html = getDocumentElement(element);
1157
+ const visualViewport = win.visualViewport;
1158
+ let width = html.clientWidth;
1159
+ let height = html.clientHeight;
1160
+ let x = 0;
1161
+ let y = 0;
1162
+ if (visualViewport) {
1163
+ width = visualViewport.width;
1164
+ height = visualViewport.height;
1165
+ const visualViewportBased = isClientRectVisualViewportBased();
1166
+ if (!visualViewportBased || visualViewportBased && strategy === 'fixed') {
1167
+ x = visualViewport.offsetLeft;
1168
+ y = visualViewport.offsetTop;
1169
+ }
1250
1170
  }
1251
-
1252
- return false;
1171
+ return {
1172
+ width,
1173
+ height,
1174
+ x,
1175
+ y
1176
+ };
1253
1177
  }
1254
1178
 
1179
+ // Returns the inner client rect, subtracting scrollbars if present.
1255
1180
  function getInnerBoundingClientRect(element, strategy) {
1256
- const clientRect = getBoundingClientRect(element, false, strategy === 'fixed');
1181
+ const clientRect = getBoundingClientRect(element, true, strategy === 'fixed');
1257
1182
  const top = clientRect.top + element.clientTop;
1258
1183
  const left = clientRect.left + element.clientLeft;
1184
+ const scale = isHTMLElement(element) ? getScale(element) : {
1185
+ x: 1,
1186
+ y: 1
1187
+ };
1188
+ const width = element.clientWidth * scale.x;
1189
+ const height = element.clientHeight * scale.y;
1190
+ const x = left * scale.x;
1191
+ const y = top * scale.y;
1259
1192
  return {
1260
- top,
1261
- left,
1262
- x: left,
1263
- y: top,
1264
- right: left + element.clientWidth,
1265
- bottom: top + element.clientHeight,
1266
- width: element.clientWidth,
1267
- height: element.clientHeight
1193
+ width,
1194
+ height,
1195
+ x,
1196
+ y
1268
1197
  };
1269
1198
  }
1270
-
1271
- function getClientRectFromClippingAncestor(element, clippingParent, strategy) {
1272
- if (clippingParent === 'viewport') {
1273
- return rectToClientRect(getViewportRect(element, strategy));
1199
+ function getClientRectFromClippingAncestor(element, clippingAncestor, strategy) {
1200
+ let rect;
1201
+ if (clippingAncestor === 'viewport') {
1202
+ rect = getViewportRect(element, strategy);
1203
+ } else if (clippingAncestor === 'document') {
1204
+ rect = getDocumentRect(getDocumentElement(element));
1205
+ } else if (isElement(clippingAncestor)) {
1206
+ rect = getInnerBoundingClientRect(clippingAncestor, strategy);
1207
+ } else {
1208
+ const mutableRect = {
1209
+ ...clippingAncestor
1210
+ };
1211
+ if (isClientRectVisualViewportBased()) {
1212
+ var _win$visualViewport, _win$visualViewport2;
1213
+ const win = getWindow(element);
1214
+ mutableRect.x -= ((_win$visualViewport = win.visualViewport) == null ? void 0 : _win$visualViewport.offsetLeft) || 0;
1215
+ mutableRect.y -= ((_win$visualViewport2 = win.visualViewport) == null ? void 0 : _win$visualViewport2.offsetTop) || 0;
1216
+ }
1217
+ rect = mutableRect;
1274
1218
  }
1219
+ return rectToClientRect(rect);
1220
+ }
1275
1221
 
1276
- if (isElement(clippingParent)) {
1277
- return getInnerBoundingClientRect(clippingParent, strategy);
1222
+ // A "clipping ancestor" is an `overflow` element with the characteristic of
1223
+ // clipping (or hiding) child elements. This returns all clipping ancestors
1224
+ // of the given element up the tree.
1225
+ function getClippingElementAncestors(element, cache) {
1226
+ const cachedResult = cache.get(element);
1227
+ if (cachedResult) {
1228
+ return cachedResult;
1278
1229
  }
1230
+ let result = getOverflowAncestors(element).filter(el => isElement(el) && getNodeName(el) !== 'body');
1231
+ let currentContainingBlockComputedStyle = null;
1232
+ const elementIsFixed = getComputedStyle$1(element).position === 'fixed';
1233
+ let currentNode = elementIsFixed ? getParentNode(element) : element;
1279
1234
 
1280
- return rectToClientRect(getDocumentRect(getDocumentElement(element)));
1281
- } // A "clipping ancestor" is an overflowable container with the characteristic of
1282
- // clipping (or hiding) overflowing elements with a position different from
1283
- // `initial`
1284
-
1285
-
1286
- function getClippingAncestors(element) {
1287
- const clippingAncestors = getOverflowAncestors(element);
1288
- const canEscapeClipping = ['absolute', 'fixed'].includes(getComputedStyle(element).position);
1289
- const clipperElement = canEscapeClipping && isHTMLElement(element) ? getOffsetParent(element) : element;
1290
-
1291
- if (!isElement(clipperElement)) {
1292
- return [];
1293
- } // @ts-ignore isElement check ensures we return Array<Element>
1294
-
1295
-
1296
- return clippingAncestors.filter(clippingAncestors => isElement(clippingAncestors) && contains(clippingAncestors, clipperElement) && getNodeName(clippingAncestors) !== 'body');
1297
- } // Gets the maximum area that the element is visible in due to any number of
1298
- // clipping ancestors
1299
-
1235
+ // https://developer.mozilla.org/en-US/docs/Web/CSS/Containing_block#identifying_the_containing_block
1236
+ while (isElement(currentNode) && !isLastTraversableNode(currentNode)) {
1237
+ const computedStyle = getComputedStyle$1(currentNode);
1238
+ const containingBlock = isContainingBlock(currentNode);
1239
+ const shouldIgnoreCurrentNode = computedStyle.position === 'fixed';
1240
+ if (shouldIgnoreCurrentNode) {
1241
+ currentContainingBlockComputedStyle = null;
1242
+ } else {
1243
+ const shouldDropCurrentNode = elementIsFixed ? !containingBlock && !currentContainingBlockComputedStyle : !containingBlock && computedStyle.position === 'static' && !!currentContainingBlockComputedStyle && ['absolute', 'fixed'].includes(currentContainingBlockComputedStyle.position);
1244
+ if (shouldDropCurrentNode) {
1245
+ // Drop non-containing blocks.
1246
+ result = result.filter(ancestor => ancestor !== currentNode);
1247
+ } else {
1248
+ // Record last containing block for next iteration.
1249
+ currentContainingBlockComputedStyle = computedStyle;
1250
+ }
1251
+ }
1252
+ currentNode = getParentNode(currentNode);
1253
+ }
1254
+ cache.set(element, result);
1255
+ return result;
1256
+ }
1300
1257
 
1258
+ // Gets the maximum area that the element is visible in due to any number of
1259
+ // clipping ancestors.
1301
1260
  function getClippingRect(_ref) {
1302
1261
  let {
1303
1262
  element,
@@ -1305,8 +1264,8 @@ function getClippingRect(_ref) {
1305
1264
  rootBoundary,
1306
1265
  strategy
1307
1266
  } = _ref;
1308
- const mainClippingAncestors = boundary === 'clippingAncestors' ? getClippingAncestors(element) : [].concat(boundary);
1309
- const clippingAncestors = [...mainClippingAncestors, rootBoundary];
1267
+ const elementClippingAncestors = boundary === 'clippingAncestors' ? getClippingElementAncestors(element, this._c) : [].concat(boundary);
1268
+ const clippingAncestors = [...elementClippingAncestors, rootBoundary];
1310
1269
  const firstClippingAncestor = clippingAncestors[0];
1311
1270
  const clippingRect = clippingAncestors.reduce((accRect, clippingAncestor) => {
1312
1271
  const rect = getClientRectFromClippingAncestor(element, clippingAncestor, strategy);
@@ -1324,6 +1283,80 @@ function getClippingRect(_ref) {
1324
1283
  };
1325
1284
  }
1326
1285
 
1286
+ function getDimensions(element) {
1287
+ return getCssDimensions(element);
1288
+ }
1289
+
1290
+ function getTrueOffsetParent(element, polyfill) {
1291
+ if (!isHTMLElement(element) || getComputedStyle$1(element).position === 'fixed') {
1292
+ return null;
1293
+ }
1294
+ if (polyfill) {
1295
+ return polyfill(element);
1296
+ }
1297
+ return element.offsetParent;
1298
+ }
1299
+ function getContainingBlock(element) {
1300
+ let currentNode = getParentNode(element);
1301
+ while (isHTMLElement(currentNode) && !isLastTraversableNode(currentNode)) {
1302
+ if (isContainingBlock(currentNode)) {
1303
+ return currentNode;
1304
+ } else {
1305
+ currentNode = getParentNode(currentNode);
1306
+ }
1307
+ }
1308
+ return null;
1309
+ }
1310
+
1311
+ // Gets the closest ancestor positioned element. Handles some edge cases,
1312
+ // such as table ancestors and cross browser bugs.
1313
+ function getOffsetParent(element, polyfill) {
1314
+ const window = getWindow(element);
1315
+ if (!isHTMLElement(element)) {
1316
+ return window;
1317
+ }
1318
+ let offsetParent = getTrueOffsetParent(element, polyfill);
1319
+ while (offsetParent && isTableElement(offsetParent) && getComputedStyle$1(offsetParent).position === 'static') {
1320
+ offsetParent = getTrueOffsetParent(offsetParent, polyfill);
1321
+ }
1322
+ if (offsetParent && (getNodeName(offsetParent) === 'html' || getNodeName(offsetParent) === 'body' && getComputedStyle$1(offsetParent).position === 'static' && !isContainingBlock(offsetParent))) {
1323
+ return window;
1324
+ }
1325
+ return offsetParent || getContainingBlock(element) || window;
1326
+ }
1327
+
1328
+ function getRectRelativeToOffsetParent(element, offsetParent, strategy) {
1329
+ const isOffsetParentAnElement = isHTMLElement(offsetParent);
1330
+ const documentElement = getDocumentElement(offsetParent);
1331
+ const rect = getBoundingClientRect(element, true, strategy === 'fixed', offsetParent);
1332
+ let scroll = {
1333
+ scrollLeft: 0,
1334
+ scrollTop: 0
1335
+ };
1336
+ const offsets = {
1337
+ x: 0,
1338
+ y: 0
1339
+ };
1340
+ if (isOffsetParentAnElement || !isOffsetParentAnElement && strategy !== 'fixed') {
1341
+ if (getNodeName(offsetParent) !== 'body' || isOverflowElement(documentElement)) {
1342
+ scroll = getNodeScroll(offsetParent);
1343
+ }
1344
+ if (isHTMLElement(offsetParent)) {
1345
+ const offsetRect = getBoundingClientRect(offsetParent, true);
1346
+ offsets.x = offsetRect.x + offsetParent.clientLeft;
1347
+ offsets.y = offsetRect.y + offsetParent.clientTop;
1348
+ } else if (documentElement) {
1349
+ offsets.x = getWindowScrollBarX(documentElement);
1350
+ }
1351
+ }
1352
+ return {
1353
+ x: rect.left + scroll.scrollLeft - offsets.x,
1354
+ y: rect.top + scroll.scrollTop - offsets.y,
1355
+ width: rect.width,
1356
+ height: rect.height
1357
+ };
1358
+ }
1359
+
1327
1360
  const platform = {
1328
1361
  getClippingRect,
1329
1362
  convertOffsetParentRelativeRectToViewportRelativeRect,
@@ -1331,22 +1364,26 @@ const platform = {
1331
1364
  getDimensions,
1332
1365
  getOffsetParent,
1333
1366
  getDocumentElement,
1334
- getElementRects: _ref => {
1367
+ getScale,
1368
+ async getElementRects(_ref) {
1335
1369
  let {
1336
1370
  reference,
1337
1371
  floating,
1338
1372
  strategy
1339
1373
  } = _ref;
1374
+ const getOffsetParentFn = this.getOffsetParent || getOffsetParent;
1375
+ const getDimensionsFn = this.getDimensions;
1340
1376
  return {
1341
- reference: getRectRelativeToOffsetParent(reference, getOffsetParent(floating), strategy),
1342
- floating: { ...getDimensions(floating),
1377
+ reference: getRectRelativeToOffsetParent(reference, await getOffsetParentFn(floating), strategy),
1378
+ floating: {
1343
1379
  x: 0,
1344
- y: 0
1380
+ y: 0,
1381
+ ...(await getDimensionsFn(floating))
1345
1382
  }
1346
1383
  };
1347
1384
  },
1348
1385
  getClientRects: element => Array.from(element.getClientRects()),
1349
- isRTL: element => getComputedStyle(element).direction === 'rtl'
1386
+ isRTL: element => getComputedStyle$1(element).direction === 'rtl'
1350
1387
  };
1351
1388
 
1352
1389
  /**
@@ -1354,11 +1391,24 @@ const platform = {
1354
1391
  * next to a reference element when it is given a certain CSS positioning
1355
1392
  * strategy.
1356
1393
  */
1357
-
1358
- const computePosition = (reference, floating, options) => computePosition$1(reference, floating, {
1359
- platform,
1360
- ...options
1361
- });
1394
+ const computePosition = (reference, floating, options) => {
1395
+ // This caches the expensive `getClippingElementAncestors` function so that
1396
+ // multiple lifecycle resets re-use the same result. It only lives for a
1397
+ // single call. If other functions become expensive, we can add them as well.
1398
+ const cache = new Map();
1399
+ const mergedOptions = {
1400
+ platform,
1401
+ ...options
1402
+ };
1403
+ const platformWithCache = {
1404
+ ...mergedOptions.platform,
1405
+ _c: cache
1406
+ };
1407
+ return computePosition$1(reference, floating, {
1408
+ ...mergedOptions,
1409
+ platform: platformWithCache
1410
+ });
1411
+ };
1362
1412
 
1363
1413
  const FloatingUI = (
1364
1414
  // el,