@nova-design-system/nova-webcomponents 3.0.0-beta.17

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 (540) hide show
  1. package/LICENSE.MD +157 -0
  2. package/dist/blazor-docs.json +9342 -0
  3. package/dist/cjs/app-globals-2ceecab2.js +11 -0
  4. package/dist/cjs/app-globals-2ceecab2.js.map +1 -0
  5. package/dist/cjs/clsx-fc789adc.js +7 -0
  6. package/dist/cjs/clsx-fc789adc.js.map +1 -0
  7. package/dist/cjs/constants-33057c89.js +140 -0
  8. package/dist/cjs/constants-33057c89.js.map +1 -0
  9. package/dist/cjs/fade.animation-0d33d198.js +1875 -0
  10. package/dist/cjs/fade.animation-0d33d198.js.map +1 -0
  11. package/dist/cjs/grow.animation-46e7ae4b.js +119 -0
  12. package/dist/cjs/grow.animation-46e7ae4b.js.map +1 -0
  13. package/dist/cjs/index-5d1f2412.js +1984 -0
  14. package/dist/cjs/index-5d1f2412.js.map +1 -0
  15. package/dist/cjs/index.cjs.js +494 -0
  16. package/dist/cjs/index.cjs.js.map +1 -0
  17. package/dist/cjs/loader.cjs.js +17 -0
  18. package/dist/cjs/loader.cjs.js.map +1 -0
  19. package/dist/cjs/native.cjs.js +48 -0
  20. package/dist/cjs/native.cjs.js.map +1 -0
  21. package/dist/cjs/nv-alert.cjs.entry.js +140 -0
  22. package/dist/cjs/nv-alert.cjs.entry.js.map +1 -0
  23. package/dist/cjs/nv-avatar.cjs.entry.js +73 -0
  24. package/dist/cjs/nv-avatar.cjs.entry.js.map +1 -0
  25. package/dist/cjs/nv-badge.cjs.entry.js +119 -0
  26. package/dist/cjs/nv-badge.cjs.entry.js.map +1 -0
  27. package/dist/cjs/nv-base.cjs.entry.js +75 -0
  28. package/dist/cjs/nv-base.cjs.entry.js.map +1 -0
  29. package/dist/cjs/nv-button.cjs.entry.js +91 -0
  30. package/dist/cjs/nv-button.cjs.entry.js.map +1 -0
  31. package/dist/cjs/nv-col.cjs.entry.js +41 -0
  32. package/dist/cjs/nv-col.cjs.entry.js.map +1 -0
  33. package/dist/cjs/nv-fieldcheckbox.cjs.entry.js +94 -0
  34. package/dist/cjs/nv-fieldcheckbox.cjs.entry.js.map +1 -0
  35. package/dist/cjs/nv-fieldnumber.cjs.entry.js +94 -0
  36. package/dist/cjs/nv-fieldnumber.cjs.entry.js.map +1 -0
  37. package/dist/cjs/nv-fieldpassword.cjs.entry.js +79 -0
  38. package/dist/cjs/nv-fieldpassword.cjs.entry.js.map +1 -0
  39. package/dist/cjs/nv-fieldradio.cjs.entry.js +81 -0
  40. package/dist/cjs/nv-fieldradio.cjs.entry.js.map +1 -0
  41. package/dist/cjs/nv-fieldselect.cjs.entry.js +290 -0
  42. package/dist/cjs/nv-fieldselect.cjs.entry.js.map +1 -0
  43. package/dist/cjs/nv-fieldtext.cjs.entry.js +83 -0
  44. package/dist/cjs/nv-fieldtext.cjs.entry.js.map +1 -0
  45. package/dist/cjs/nv-fieldtextarea.cjs.entry.js +151 -0
  46. package/dist/cjs/nv-fieldtextarea.cjs.entry.js.map +1 -0
  47. package/dist/cjs/nv-fieldtoggle.cjs.entry.js +64 -0
  48. package/dist/cjs/nv-fieldtoggle.cjs.entry.js.map +1 -0
  49. package/dist/cjs/nv-icon.cjs.entry.js +66 -0
  50. package/dist/cjs/nv-icon.cjs.entry.js.map +1 -0
  51. package/dist/cjs/nv-iconbutton.cjs.entry.js +92 -0
  52. package/dist/cjs/nv-iconbutton.cjs.entry.js.map +1 -0
  53. package/dist/cjs/nv-loader.cjs.entry.js +29 -0
  54. package/dist/cjs/nv-loader.cjs.entry.js.map +1 -0
  55. package/dist/cjs/nv-menu.cjs.entry.js +189 -0
  56. package/dist/cjs/nv-menu.cjs.entry.js.map +1 -0
  57. package/dist/cjs/nv-menuitem.cjs.entry.js +30 -0
  58. package/dist/cjs/nv-menuitem.cjs.entry.js.map +1 -0
  59. package/dist/cjs/nv-popover.cjs.entry.js +2327 -0
  60. package/dist/cjs/nv-popover.cjs.entry.js.map +1 -0
  61. package/dist/cjs/nv-row.cjs.entry.js +24 -0
  62. package/dist/cjs/nv-row.cjs.entry.js.map +1 -0
  63. package/dist/cjs/nv-stack.cjs.entry.js +31 -0
  64. package/dist/cjs/nv-stack.cjs.entry.js.map +1 -0
  65. package/dist/cjs/nv-tooltip.cjs.entry.js +37 -0
  66. package/dist/cjs/nv-tooltip.cjs.entry.js.map +1 -0
  67. package/dist/cjs/timeline.animation-dbb9c5ea.js +107 -0
  68. package/dist/cjs/timeline.animation-dbb9c5ea.js.map +1 -0
  69. package/dist/cjs/v4-7014b8b0.js +67 -0
  70. package/dist/cjs/v4-7014b8b0.js.map +1 -0
  71. package/dist/collection/animations/collapse.animation.js +82 -0
  72. package/dist/collection/animations/collapse.animation.js.map +1 -0
  73. package/dist/collection/animations/fade.animation.js +66 -0
  74. package/dist/collection/animations/fade.animation.js.map +1 -0
  75. package/dist/collection/animations/grow.animation.js +87 -0
  76. package/dist/collection/animations/grow.animation.js.map +1 -0
  77. package/dist/collection/animations/index.js +5 -0
  78. package/dist/collection/animations/index.js.map +1 -0
  79. package/dist/collection/animations/timeline.animation.js +21 -0
  80. package/dist/collection/animations/timeline.animation.js.map +1 -0
  81. package/dist/collection/collection-manifest.json +35 -0
  82. package/dist/collection/components/nv-alert/nv-alert.css +113 -0
  83. package/dist/collection/components/nv-alert/nv-alert.docs.js +61 -0
  84. package/dist/collection/components/nv-alert/nv-alert.docs.js.map +1 -0
  85. package/dist/collection/components/nv-alert/nv-alert.js +355 -0
  86. package/dist/collection/components/nv-alert/nv-alert.js.map +1 -0
  87. package/dist/collection/components/nv-avatar/nv-avatar.css +154 -0
  88. package/dist/collection/components/nv-avatar/nv-avatar.docs.js +42 -0
  89. package/dist/collection/components/nv-avatar/nv-avatar.docs.js.map +1 -0
  90. package/dist/collection/components/nv-avatar/nv-avatar.js +311 -0
  91. package/dist/collection/components/nv-avatar/nv-avatar.js.map +1 -0
  92. package/dist/collection/components/nv-badge/nv-badge.css +174 -0
  93. package/dist/collection/components/nv-badge/nv-badge.docs.js +72 -0
  94. package/dist/collection/components/nv-badge/nv-badge.docs.js.map +1 -0
  95. package/dist/collection/components/nv-badge/nv-badge.js +354 -0
  96. package/dist/collection/components/nv-badge/nv-badge.js.map +1 -0
  97. package/dist/collection/components/nv-base/nv-base.docs.js +5 -0
  98. package/dist/collection/components/nv-base/nv-base.docs.js.map +1 -0
  99. package/dist/collection/components/nv-base/nv-base.js +69 -0
  100. package/dist/collection/components/nv-base/nv-base.js.map +1 -0
  101. package/dist/collection/components/nv-button/nv-button.css +259 -0
  102. package/dist/collection/components/nv-button/nv-button.docs.js +56 -0
  103. package/dist/collection/components/nv-button/nv-button.docs.js.map +1 -0
  104. package/dist/collection/components/nv-button/nv-button.js +241 -0
  105. package/dist/collection/components/nv-button/nv-button.js.map +1 -0
  106. package/dist/collection/components/nv-col/nv-col.css +45 -0
  107. package/dist/collection/components/nv-col/nv-col.docs.js +18 -0
  108. package/dist/collection/components/nv-col/nv-col.docs.js.map +1 -0
  109. package/dist/collection/components/nv-col/nv-col.js +63 -0
  110. package/dist/collection/components/nv-col/nv-col.js.map +1 -0
  111. package/dist/collection/components/nv-fieldcheckbox/nv-fieldcheckbox.css +136 -0
  112. package/dist/collection/components/nv-fieldcheckbox/nv-fieldcheckbox.docs.js +231 -0
  113. package/dist/collection/components/nv-fieldcheckbox/nv-fieldcheckbox.docs.js.map +1 -0
  114. package/dist/collection/components/nv-fieldcheckbox/nv-fieldcheckbox.js +448 -0
  115. package/dist/collection/components/nv-fieldcheckbox/nv-fieldcheckbox.js.map +1 -0
  116. package/dist/collection/components/nv-fieldnumber/nv-fieldnumber.css +183 -0
  117. package/dist/collection/components/nv-fieldnumber/nv-fieldnumber.docs.js +180 -0
  118. package/dist/collection/components/nv-fieldnumber/nv-fieldnumber.docs.js.map +1 -0
  119. package/dist/collection/components/nv-fieldnumber/nv-fieldnumber.js +435 -0
  120. package/dist/collection/components/nv-fieldnumber/nv-fieldnumber.js.map +1 -0
  121. package/dist/collection/components/nv-fieldpassword/nv-fieldpassword.css +149 -0
  122. package/dist/collection/components/nv-fieldpassword/nv-fieldpassword.docs.js +189 -0
  123. package/dist/collection/components/nv-fieldpassword/nv-fieldpassword.docs.js.map +1 -0
  124. package/dist/collection/components/nv-fieldpassword/nv-fieldpassword.js +465 -0
  125. package/dist/collection/components/nv-fieldpassword/nv-fieldpassword.js.map +1 -0
  126. package/dist/collection/components/nv-fieldradio/nv-fieldradio.css +133 -0
  127. package/dist/collection/components/nv-fieldradio/nv-fieldradio.docs.js +121 -0
  128. package/dist/collection/components/nv-fieldradio/nv-fieldradio.docs.js.map +1 -0
  129. package/dist/collection/components/nv-fieldradio/nv-fieldradio.js +347 -0
  130. package/dist/collection/components/nv-fieldradio/nv-fieldradio.js.map +1 -0
  131. package/dist/collection/components/nv-fieldselect/nv-fieldselect.css +197 -0
  132. package/dist/collection/components/nv-fieldselect/nv-fieldselect.docs.js +157 -0
  133. package/dist/collection/components/nv-fieldselect/nv-fieldselect.docs.js.map +1 -0
  134. package/dist/collection/components/nv-fieldselect/nv-fieldselect.js +610 -0
  135. package/dist/collection/components/nv-fieldselect/nv-fieldselect.js.map +1 -0
  136. package/dist/collection/components/nv-fieldtext/nv-fieldtext.css +141 -0
  137. package/dist/collection/components/nv-fieldtext/nv-fieldtext.docs.js +206 -0
  138. package/dist/collection/components/nv-fieldtext/nv-fieldtext.docs.js.map +1 -0
  139. package/dist/collection/components/nv-fieldtext/nv-fieldtext.js +499 -0
  140. package/dist/collection/components/nv-fieldtext/nv-fieldtext.js.map +1 -0
  141. package/dist/collection/components/nv-fieldtextarea/nv-fieldtextarea.css +141 -0
  142. package/dist/collection/components/nv-fieldtextarea/nv-fieldtextarea.docs.js +175 -0
  143. package/dist/collection/components/nv-fieldtextarea/nv-fieldtextarea.docs.js.map +1 -0
  144. package/dist/collection/components/nv-fieldtextarea/nv-fieldtextarea.js +527 -0
  145. package/dist/collection/components/nv-fieldtextarea/nv-fieldtextarea.js.map +1 -0
  146. package/dist/collection/components/nv-fieldtoggle/nv-fieldtoggle.css +114 -0
  147. package/dist/collection/components/nv-fieldtoggle/nv-fieldtoggle.docs.js +65 -0
  148. package/dist/collection/components/nv-fieldtoggle/nv-fieldtoggle.docs.js.map +1 -0
  149. package/dist/collection/components/nv-fieldtoggle/nv-fieldtoggle.js +283 -0
  150. package/dist/collection/components/nv-fieldtoggle/nv-fieldtoggle.js.map +1 -0
  151. package/dist/collection/components/nv-icon/nv-icon.css +32 -0
  152. package/dist/collection/components/nv-icon/nv-icon.docs.js +31 -0
  153. package/dist/collection/components/nv-icon/nv-icon.docs.js.map +1 -0
  154. package/dist/collection/components/nv-icon/nv-icon.js +245 -0
  155. package/dist/collection/components/nv-icon/nv-icon.js.map +1 -0
  156. package/dist/collection/components/nv-icon/nv-icons.js +450 -0
  157. package/dist/collection/components/nv-icon/nv-icons.js.map +1 -0
  158. package/dist/collection/components/nv-icon/test/nv-icon.test.js +25 -0
  159. package/dist/collection/components/nv-icon/test/nv-icon.test.js.map +1 -0
  160. package/dist/collection/components/nv-iconbutton/nv-iconbutton.css +152 -0
  161. package/dist/collection/components/nv-iconbutton/nv-iconbutton.docs.js +61 -0
  162. package/dist/collection/components/nv-iconbutton/nv-iconbutton.docs.js.map +1 -0
  163. package/dist/collection/components/nv-iconbutton/nv-iconbutton.js +263 -0
  164. package/dist/collection/components/nv-iconbutton/nv-iconbutton.js.map +1 -0
  165. package/dist/collection/components/nv-loader/nv-loader.css +162 -0
  166. package/dist/collection/components/nv-loader/nv-loader.docs.js +27 -0
  167. package/dist/collection/components/nv-loader/nv-loader.docs.js.map +1 -0
  168. package/dist/collection/components/nv-loader/nv-loader.js +78 -0
  169. package/dist/collection/components/nv-loader/nv-loader.js.map +1 -0
  170. package/dist/collection/components/nv-menu/nv-menu.css +61 -0
  171. package/dist/collection/components/nv-menu/nv-menu.docs.js +40 -0
  172. package/dist/collection/components/nv-menu/nv-menu.docs.js.map +1 -0
  173. package/dist/collection/components/nv-menu/nv-menu.js +355 -0
  174. package/dist/collection/components/nv-menu/nv-menu.js.map +1 -0
  175. package/dist/collection/components/nv-menuitem/nv-menuitem.css +29 -0
  176. package/dist/collection/components/nv-menuitem/nv-menuitem.docs.js +6 -0
  177. package/dist/collection/components/nv-menuitem/nv-menuitem.docs.js.map +1 -0
  178. package/dist/collection/components/nv-menuitem/nv-menuitem.js +111 -0
  179. package/dist/collection/components/nv-menuitem/nv-menuitem.js.map +1 -0
  180. package/dist/collection/components/nv-popover/nv-popover.css +42 -0
  181. package/dist/collection/components/nv-popover/nv-popover.docs.js +74 -0
  182. package/dist/collection/components/nv-popover/nv-popover.docs.js.map +1 -0
  183. package/dist/collection/components/nv-popover/nv-popover.js +587 -0
  184. package/dist/collection/components/nv-popover/nv-popover.js.map +1 -0
  185. package/dist/collection/components/nv-row/nv-row.css +7 -0
  186. package/dist/collection/components/nv-row/nv-row.docs.js +13 -0
  187. package/dist/collection/components/nv-row/nv-row.docs.js.map +1 -0
  188. package/dist/collection/components/nv-row/nv-row.js +23 -0
  189. package/dist/collection/components/nv-row/nv-row.js.map +1 -0
  190. package/dist/collection/components/nv-stack/nv-stack.css +61 -0
  191. package/dist/collection/components/nv-stack/nv-stack.docs.js +39 -0
  192. package/dist/collection/components/nv-stack/nv-stack.docs.js.map +1 -0
  193. package/dist/collection/components/nv-stack/nv-stack.js +123 -0
  194. package/dist/collection/components/nv-stack/nv-stack.js.map +1 -0
  195. package/dist/collection/components/nv-tooltip/nv-tooltip.css +22 -0
  196. package/dist/collection/components/nv-tooltip/nv-tooltip.docs.js +38 -0
  197. package/dist/collection/components/nv-tooltip/nv-tooltip.docs.js.map +1 -0
  198. package/dist/collection/components/nv-tooltip/nv-tooltip.js +102 -0
  199. package/dist/collection/components/nv-tooltip/nv-tooltip.js.map +1 -0
  200. package/dist/collection/dev/dev-components.js +3 -0
  201. package/dist/collection/dev/dev-components.js.map +1 -0
  202. package/dist/collection/dev/dev-forms.js +3 -0
  203. package/dist/collection/dev/dev-forms.js.map +1 -0
  204. package/dist/collection/dev/dev-root.js +23 -0
  205. package/dist/collection/dev/dev-root.js.map +1 -0
  206. package/dist/collection/dev/dev-utils.js +54 -0
  207. package/dist/collection/dev/dev-utils.js.map +1 -0
  208. package/dist/collection/fonts/TT_Norms_Pro_Bold.woff2 +0 -0
  209. package/dist/collection/fonts/TT_Norms_Pro_Medium.woff2 +0 -0
  210. package/dist/collection/fonts/TT_Norms_Pro_Mono_Bold.woff2 +0 -0
  211. package/dist/collection/fonts/TT_Norms_Pro_Mono_Medium.woff2 +0 -0
  212. package/dist/collection/fonts/TT_Norms_Pro_Mono_Regular.woff2 +0 -0
  213. package/dist/collection/fonts/TT_Norms_Pro_Regular.woff2 +0 -0
  214. package/dist/collection/global.js +6 -0
  215. package/dist/collection/global.js.map +1 -0
  216. package/dist/collection/index.js +10 -0
  217. package/dist/collection/index.js.map +1 -0
  218. package/dist/collection/utils/class.utils.js +15 -0
  219. package/dist/collection/utils/class.utils.js.map +1 -0
  220. package/dist/collection/utils/constants.js +122 -0
  221. package/dist/collection/utils/constants.js.map +1 -0
  222. package/dist/collection/utils/events.utils.js +19 -0
  223. package/dist/collection/utils/events.utils.js.map +1 -0
  224. package/dist/components/index.d.ts +33 -0
  225. package/dist/components/index.js +488 -0
  226. package/dist/components/index.js.map +1 -0
  227. package/dist/components/nv-alert.d.ts +11 -0
  228. package/dist/components/nv-alert.js +171 -0
  229. package/dist/components/nv-alert.js.map +1 -0
  230. package/dist/components/nv-avatar.d.ts +11 -0
  231. package/dist/components/nv-avatar.js +106 -0
  232. package/dist/components/nv-avatar.js.map +1 -0
  233. package/dist/components/nv-badge.d.ts +11 -0
  234. package/dist/components/nv-badge.js +154 -0
  235. package/dist/components/nv-badge.js.map +1 -0
  236. package/dist/components/nv-base.d.ts +11 -0
  237. package/dist/components/nv-base.js +89 -0
  238. package/dist/components/nv-base.js.map +1 -0
  239. package/dist/components/nv-button.d.ts +11 -0
  240. package/dist/components/nv-button.js +116 -0
  241. package/dist/components/nv-button.js.map +1 -0
  242. package/dist/components/nv-col.d.ts +11 -0
  243. package/dist/components/nv-col.js +57 -0
  244. package/dist/components/nv-col.js.map +1 -0
  245. package/dist/components/nv-fieldcheckbox.d.ts +11 -0
  246. package/dist/components/nv-fieldcheckbox.js +128 -0
  247. package/dist/components/nv-fieldcheckbox.js.map +1 -0
  248. package/dist/components/nv-fieldnumber.d.ts +11 -0
  249. package/dist/components/nv-fieldnumber.js +134 -0
  250. package/dist/components/nv-fieldnumber.js.map +1 -0
  251. package/dist/components/nv-fieldpassword.d.ts +11 -0
  252. package/dist/components/nv-fieldpassword.js +134 -0
  253. package/dist/components/nv-fieldpassword.js.map +1 -0
  254. package/dist/components/nv-fieldradio.d.ts +11 -0
  255. package/dist/components/nv-fieldradio.js +110 -0
  256. package/dist/components/nv-fieldradio.js.map +1 -0
  257. package/dist/components/nv-fieldselect.d.ts +11 -0
  258. package/dist/components/nv-fieldselect.js +332 -0
  259. package/dist/components/nv-fieldselect.js.map +1 -0
  260. package/dist/components/nv-fieldtext.d.ts +11 -0
  261. package/dist/components/nv-fieldtext.js +125 -0
  262. package/dist/components/nv-fieldtext.js.map +1 -0
  263. package/dist/components/nv-fieldtextarea.d.ts +11 -0
  264. package/dist/components/nv-fieldtextarea.js +188 -0
  265. package/dist/components/nv-fieldtextarea.js.map +1 -0
  266. package/dist/components/nv-fieldtoggle.d.ts +11 -0
  267. package/dist/components/nv-fieldtoggle.js +91 -0
  268. package/dist/components/nv-fieldtoggle.js.map +1 -0
  269. package/dist/components/nv-icon.d.ts +11 -0
  270. package/dist/components/nv-icon.js +8 -0
  271. package/dist/components/nv-icon.js.map +1 -0
  272. package/dist/components/nv-iconbutton.d.ts +11 -0
  273. package/dist/components/nv-iconbutton.js +8 -0
  274. package/dist/components/nv-iconbutton.js.map +1 -0
  275. package/dist/components/nv-loader.d.ts +11 -0
  276. package/dist/components/nv-loader.js +8 -0
  277. package/dist/components/nv-loader.js.map +1 -0
  278. package/dist/components/nv-menu.d.ts +11 -0
  279. package/dist/components/nv-menu.js +216 -0
  280. package/dist/components/nv-menu.js.map +1 -0
  281. package/dist/components/nv-menuitem.d.ts +11 -0
  282. package/dist/components/nv-menuitem.js +55 -0
  283. package/dist/components/nv-menuitem.js.map +1 -0
  284. package/dist/components/nv-popover.d.ts +11 -0
  285. package/dist/components/nv-popover.js +8 -0
  286. package/dist/components/nv-popover.js.map +1 -0
  287. package/dist/components/nv-row.d.ts +11 -0
  288. package/dist/components/nv-row.js +38 -0
  289. package/dist/components/nv-row.js.map +1 -0
  290. package/dist/components/nv-stack.d.ts +11 -0
  291. package/dist/components/nv-stack.js +51 -0
  292. package/dist/components/nv-stack.js.map +1 -0
  293. package/dist/components/nv-tooltip.d.ts +11 -0
  294. package/dist/components/nv-tooltip.js +61 -0
  295. package/dist/components/nv-tooltip.js.map +1 -0
  296. package/dist/components/p-1daca48a.js +1871 -0
  297. package/dist/components/p-1daca48a.js.map +1 -0
  298. package/dist/components/p-42301d8f.js +104 -0
  299. package/dist/components/p-42301d8f.js.map +1 -0
  300. package/dist/components/p-50bd2808.js +1198 -0
  301. package/dist/components/p-50bd2808.js.map +1 -0
  302. package/dist/components/p-6146d4b0.js +87 -0
  303. package/dist/components/p-6146d4b0.js.map +1 -0
  304. package/dist/components/p-632bedb8.js +1730 -0
  305. package/dist/components/p-632bedb8.js.map +1 -0
  306. package/dist/components/p-8a1a6e56.js +5 -0
  307. package/dist/components/p-8a1a6e56.js.map +1 -0
  308. package/dist/components/p-8da6d9a3.js +43 -0
  309. package/dist/components/p-8da6d9a3.js.map +1 -0
  310. package/dist/components/p-a15ddd42.js +138 -0
  311. package/dist/components/p-a15ddd42.js.map +1 -0
  312. package/dist/components/p-be79e7bc.js +121 -0
  313. package/dist/components/p-be79e7bc.js.map +1 -0
  314. package/dist/components/p-c711fe67.js +2355 -0
  315. package/dist/components/p-c711fe67.js.map +1 -0
  316. package/dist/components/p-f5ff676c.js +65 -0
  317. package/dist/components/p-f5ff676c.js.map +1 -0
  318. package/dist/docs.d.ts +435 -0
  319. package/dist/docs.json +9249 -0
  320. package/dist/esm/app-globals-df0a3c8d.js +9 -0
  321. package/dist/esm/app-globals-df0a3c8d.js.map +1 -0
  322. package/dist/esm/clsx-297c1ffe.js +5 -0
  323. package/dist/esm/clsx-297c1ffe.js.map +1 -0
  324. package/dist/esm/constants-e9bee611.js +138 -0
  325. package/dist/esm/constants-e9bee611.js.map +1 -0
  326. package/dist/esm/fade.animation-2a077983.js +1871 -0
  327. package/dist/esm/fade.animation-2a077983.js.map +1 -0
  328. package/dist/esm/grow.animation-88a8ee8f.js +114 -0
  329. package/dist/esm/grow.animation-88a8ee8f.js.map +1 -0
  330. package/dist/esm/index-179dfba2.js +1952 -0
  331. package/dist/esm/index-179dfba2.js.map +1 -0
  332. package/dist/esm/index.js +487 -0
  333. package/dist/esm/index.js.map +1 -0
  334. package/dist/esm/loader.js +13 -0
  335. package/dist/esm/loader.js.map +1 -0
  336. package/dist/esm/native.js +43 -0
  337. package/dist/esm/native.js.map +1 -0
  338. package/dist/esm/nv-alert.entry.js +136 -0
  339. package/dist/esm/nv-alert.entry.js.map +1 -0
  340. package/dist/esm/nv-avatar.entry.js +69 -0
  341. package/dist/esm/nv-avatar.entry.js.map +1 -0
  342. package/dist/esm/nv-badge.entry.js +115 -0
  343. package/dist/esm/nv-badge.entry.js.map +1 -0
  344. package/dist/esm/nv-base.entry.js +71 -0
  345. package/dist/esm/nv-base.entry.js.map +1 -0
  346. package/dist/esm/nv-button.entry.js +87 -0
  347. package/dist/esm/nv-button.entry.js.map +1 -0
  348. package/dist/esm/nv-col.entry.js +37 -0
  349. package/dist/esm/nv-col.entry.js.map +1 -0
  350. package/dist/esm/nv-fieldcheckbox.entry.js +90 -0
  351. package/dist/esm/nv-fieldcheckbox.entry.js.map +1 -0
  352. package/dist/esm/nv-fieldnumber.entry.js +90 -0
  353. package/dist/esm/nv-fieldnumber.entry.js.map +1 -0
  354. package/dist/esm/nv-fieldpassword.entry.js +75 -0
  355. package/dist/esm/nv-fieldpassword.entry.js.map +1 -0
  356. package/dist/esm/nv-fieldradio.entry.js +77 -0
  357. package/dist/esm/nv-fieldradio.entry.js.map +1 -0
  358. package/dist/esm/nv-fieldselect.entry.js +286 -0
  359. package/dist/esm/nv-fieldselect.entry.js.map +1 -0
  360. package/dist/esm/nv-fieldtext.entry.js +79 -0
  361. package/dist/esm/nv-fieldtext.entry.js.map +1 -0
  362. package/dist/esm/nv-fieldtextarea.entry.js +147 -0
  363. package/dist/esm/nv-fieldtextarea.entry.js.map +1 -0
  364. package/dist/esm/nv-fieldtoggle.entry.js +60 -0
  365. package/dist/esm/nv-fieldtoggle.entry.js.map +1 -0
  366. package/dist/esm/nv-icon.entry.js +62 -0
  367. package/dist/esm/nv-icon.entry.js.map +1 -0
  368. package/dist/esm/nv-iconbutton.entry.js +88 -0
  369. package/dist/esm/nv-iconbutton.entry.js.map +1 -0
  370. package/dist/esm/nv-loader.entry.js +25 -0
  371. package/dist/esm/nv-loader.entry.js.map +1 -0
  372. package/dist/esm/nv-menu.entry.js +185 -0
  373. package/dist/esm/nv-menu.entry.js.map +1 -0
  374. package/dist/esm/nv-menuitem.entry.js +26 -0
  375. package/dist/esm/nv-menuitem.entry.js.map +1 -0
  376. package/dist/esm/nv-popover.entry.js +2323 -0
  377. package/dist/esm/nv-popover.entry.js.map +1 -0
  378. package/dist/esm/nv-row.entry.js +20 -0
  379. package/dist/esm/nv-row.entry.js.map +1 -0
  380. package/dist/esm/nv-stack.entry.js +27 -0
  381. package/dist/esm/nv-stack.entry.js.map +1 -0
  382. package/dist/esm/nv-tooltip.entry.js +33 -0
  383. package/dist/esm/nv-tooltip.entry.js.map +1 -0
  384. package/dist/esm/timeline.animation-1b88f052.js +104 -0
  385. package/dist/esm/timeline.animation-1b88f052.js.map +1 -0
  386. package/dist/esm/v4-a79185f4.js +65 -0
  387. package/dist/esm/v4-a79185f4.js.map +1 -0
  388. package/dist/index.cjs.js +1 -0
  389. package/dist/index.js +1 -0
  390. package/dist/native/fonts/TT_Norms_Pro_Bold.woff2 +0 -0
  391. package/dist/native/fonts/TT_Norms_Pro_Medium.woff2 +0 -0
  392. package/dist/native/fonts/TT_Norms_Pro_Mono_Bold.woff2 +0 -0
  393. package/dist/native/fonts/TT_Norms_Pro_Mono_Medium.woff2 +0 -0
  394. package/dist/native/fonts/TT_Norms_Pro_Mono_Regular.woff2 +0 -0
  395. package/dist/native/fonts/TT_Norms_Pro_Regular.woff2 +0 -0
  396. package/dist/native/index.esm.js +2 -0
  397. package/dist/native/index.esm.js.map +1 -0
  398. package/dist/native/native.css +1 -0
  399. package/dist/native/native.esm.js +2 -0
  400. package/dist/native/native.esm.js.map +1 -0
  401. package/dist/native/p-06f64d05.entry.js +2 -0
  402. package/dist/native/p-06f64d05.entry.js.map +1 -0
  403. package/dist/native/p-0aa0193b.entry.js +2 -0
  404. package/dist/native/p-0aa0193b.entry.js.map +1 -0
  405. package/dist/native/p-124a7067.entry.js +2 -0
  406. package/dist/native/p-124a7067.entry.js.map +1 -0
  407. package/dist/native/p-13d0ab5b.entry.js +2 -0
  408. package/dist/native/p-13d0ab5b.entry.js.map +1 -0
  409. package/dist/native/p-14c08510.entry.js +2 -0
  410. package/dist/native/p-14c08510.entry.js.map +1 -0
  411. package/dist/native/p-1ceee367.entry.js +2 -0
  412. package/dist/native/p-1ceee367.entry.js.map +1 -0
  413. package/dist/native/p-1daca48a.js +16 -0
  414. package/dist/native/p-1daca48a.js.map +1 -0
  415. package/dist/native/p-29d482cd.entry.js +2 -0
  416. package/dist/native/p-29d482cd.entry.js.map +1 -0
  417. package/dist/native/p-42301d8f.js +2 -0
  418. package/dist/native/p-42301d8f.js.map +1 -0
  419. package/dist/native/p-43cd42ca.entry.js +2 -0
  420. package/dist/native/p-43cd42ca.entry.js.map +1 -0
  421. package/dist/native/p-519e0f59.entry.js +2 -0
  422. package/dist/native/p-519e0f59.entry.js.map +1 -0
  423. package/dist/native/p-617d6a09.entry.js +2 -0
  424. package/dist/native/p-617d6a09.entry.js.map +1 -0
  425. package/dist/native/p-6f762ec2.entry.js +2 -0
  426. package/dist/native/p-6f762ec2.entry.js.map +1 -0
  427. package/dist/native/p-71d6aad8.entry.js +2 -0
  428. package/dist/native/p-71d6aad8.entry.js.map +1 -0
  429. package/dist/native/p-7ce1b712.entry.js +2 -0
  430. package/dist/native/p-7ce1b712.entry.js.map +1 -0
  431. package/dist/native/p-80788ddf.js +2 -0
  432. package/dist/native/p-80788ddf.js.map +1 -0
  433. package/dist/native/p-830ec54a.entry.js +2 -0
  434. package/dist/native/p-830ec54a.entry.js.map +1 -0
  435. package/dist/native/p-89accab1.entry.js +2 -0
  436. package/dist/native/p-89accab1.entry.js.map +1 -0
  437. package/dist/native/p-8a1a6e56.js +2 -0
  438. package/dist/native/p-8a1a6e56.js.map +1 -0
  439. package/dist/native/p-8b65b16f.entry.js +2 -0
  440. package/dist/native/p-8b65b16f.entry.js.map +1 -0
  441. package/dist/native/p-a15ddd42.js +2 -0
  442. package/dist/native/p-a15ddd42.js.map +1 -0
  443. package/dist/native/p-a37c2ac2.js +2 -0
  444. package/dist/native/p-a37c2ac2.js.map +1 -0
  445. package/dist/native/p-b5e4a9e7.entry.js +2 -0
  446. package/dist/native/p-b5e4a9e7.entry.js.map +1 -0
  447. package/dist/native/p-b8eb4c31.entry.js +2 -0
  448. package/dist/native/p-b8eb4c31.entry.js.map +1 -0
  449. package/dist/native/p-b99aa075.entry.js +2 -0
  450. package/dist/native/p-b99aa075.entry.js.map +1 -0
  451. package/dist/native/p-d5a8b6c4.entry.js +2 -0
  452. package/dist/native/p-d5a8b6c4.entry.js.map +1 -0
  453. package/dist/native/p-db2a68f3.js +3 -0
  454. package/dist/native/p-db2a68f3.js.map +1 -0
  455. package/dist/native/p-f5acea50.entry.js +2 -0
  456. package/dist/native/p-f5acea50.entry.js.map +1 -0
  457. package/dist/native/p-f5ff676c.js +2 -0
  458. package/dist/native/p-f5ff676c.js.map +1 -0
  459. package/dist/native/p-f9aac71a.entry.js +2 -0
  460. package/dist/native/p-f9aac71a.entry.js.map +1 -0
  461. package/dist/native/p-fb6f42b7.entry.js +2 -0
  462. package/dist/native/p-fb6f42b7.entry.js.map +1 -0
  463. package/dist/types/animations/collapse.animation.d.ts +11 -0
  464. package/dist/types/animations/fade.animation.d.ts +11 -0
  465. package/dist/types/animations/grow.animation.d.ts +15 -0
  466. package/dist/types/animations/index.d.ts +4 -0
  467. package/dist/types/animations/timeline.animation.d.ts +18 -0
  468. package/dist/types/components/nv-alert/nv-alert.d.ts +85 -0
  469. package/dist/types/components/nv-alert/nv-alert.docs.d.ts +4 -0
  470. package/dist/types/components/nv-avatar/nv-avatar.d.ts +75 -0
  471. package/dist/types/components/nv-avatar/nv-avatar.docs.d.ts +4 -0
  472. package/dist/types/components/nv-badge/nv-badge.d.ts +93 -0
  473. package/dist/types/components/nv-badge/nv-badge.docs.d.ts +4 -0
  474. package/dist/types/components/nv-base/nv-base.d.ts +17 -0
  475. package/dist/types/components/nv-base/nv-base.docs.d.ts +5 -0
  476. package/dist/types/components/nv-button/nv-button.d.ts +63 -0
  477. package/dist/types/components/nv-button/nv-button.docs.d.ts +4 -0
  478. package/dist/types/components/nv-col/nv-col.d.ts +18 -0
  479. package/dist/types/components/nv-col/nv-col.docs.d.ts +4 -0
  480. package/dist/types/components/nv-fieldcheckbox/nv-fieldcheckbox.d.ts +119 -0
  481. package/dist/types/components/nv-fieldcheckbox/nv-fieldcheckbox.docs.d.ts +4 -0
  482. package/dist/types/components/nv-fieldnumber/nv-fieldnumber.d.ts +132 -0
  483. package/dist/types/components/nv-fieldnumber/nv-fieldnumber.docs.d.ts +4 -0
  484. package/dist/types/components/nv-fieldpassword/nv-fieldpassword.d.ts +145 -0
  485. package/dist/types/components/nv-fieldpassword/nv-fieldpassword.docs.d.ts +4 -0
  486. package/dist/types/components/nv-fieldradio/nv-fieldradio.d.ts +101 -0
  487. package/dist/types/components/nv-fieldradio/nv-fieldradio.docs.d.ts +4 -0
  488. package/dist/types/components/nv-fieldselect/nv-fieldselect.d.ts +195 -0
  489. package/dist/types/components/nv-fieldselect/nv-fieldselect.docs.d.ts +4 -0
  490. package/dist/types/components/nv-fieldtext/nv-fieldtext.d.ts +162 -0
  491. package/dist/types/components/nv-fieldtext/nv-fieldtext.docs.d.ts +4 -0
  492. package/dist/types/components/nv-fieldtextarea/nv-fieldtextarea.d.ts +161 -0
  493. package/dist/types/components/nv-fieldtextarea/nv-fieldtextarea.docs.d.ts +4 -0
  494. package/dist/types/components/nv-fieldtoggle/nv-fieldtoggle.d.ts +73 -0
  495. package/dist/types/components/nv-fieldtoggle/nv-fieldtoggle.docs.d.ts +4 -0
  496. package/dist/types/components/nv-icon/nv-icon.d.ts +51 -0
  497. package/dist/types/components/nv-icon/nv-icon.docs.d.ts +4 -0
  498. package/dist/types/components/nv-icon/nv-icons.d.ts +3 -0
  499. package/dist/types/components/nv-icon/test/nv-icon.test.d.ts +1 -0
  500. package/dist/types/components/nv-iconbutton/nv-iconbutton.d.ts +70 -0
  501. package/dist/types/components/nv-iconbutton/nv-iconbutton.docs.d.ts +4 -0
  502. package/dist/types/components/nv-loader/nv-loader.d.ts +18 -0
  503. package/dist/types/components/nv-loader/nv-loader.docs.d.ts +4 -0
  504. package/dist/types/components/nv-menu/nv-menu.d.ts +60 -0
  505. package/dist/types/components/nv-menu/nv-menu.docs.d.ts +4 -0
  506. package/dist/types/components/nv-menuitem/nv-menuitem.d.ts +31 -0
  507. package/dist/types/components/nv-menuitem/nv-menuitem.docs.d.ts +4 -0
  508. package/dist/types/components/nv-popover/nv-popover.d.ts +114 -0
  509. package/dist/types/components/nv-popover/nv-popover.docs.d.ts +4 -0
  510. package/dist/types/components/nv-row/nv-row.d.ts +7 -0
  511. package/dist/types/components/nv-row/nv-row.docs.d.ts +4 -0
  512. package/dist/types/components/nv-stack/nv-stack.d.ts +36 -0
  513. package/dist/types/components/nv-stack/nv-stack.docs.d.ts +4 -0
  514. package/dist/types/components/nv-tooltip/nv-tooltip.d.ts +32 -0
  515. package/dist/types/components/nv-tooltip/nv-tooltip.docs.d.ts +4 -0
  516. package/dist/types/components.d.ts +2412 -0
  517. package/dist/types/dev/dev-components.d.ts +2 -0
  518. package/dist/types/dev/dev-forms.d.ts +2 -0
  519. package/dist/types/dev/dev-root.d.ts +1 -0
  520. package/dist/types/dev/dev-utils.d.ts +17 -0
  521. package/dist/types/global.d.ts +1 -0
  522. package/dist/types/index.d.ts +15 -0
  523. package/dist/types/nova-docs.d.ts +32 -0
  524. package/dist/types/stencil-public-runtime.d.ts +1678 -0
  525. package/dist/types/utils/class.utils.d.ts +6 -0
  526. package/dist/types/utils/constants.d.ts +112 -0
  527. package/dist/types/utils/events.utils.d.ts +15 -0
  528. package/dist/vscode-data.json +3179 -0
  529. package/hydrate/index.d.ts +242 -0
  530. package/hydrate/index.js +24827 -0
  531. package/hydrate/index.mjs +24819 -0
  532. package/hydrate/package.json +12 -0
  533. package/loader/cdn.js +1 -0
  534. package/loader/index.cjs.js +1 -0
  535. package/loader/index.d.ts +24 -0
  536. package/loader/index.es2017.js +1 -0
  537. package/loader/index.js +2 -0
  538. package/loader/package.json +11 -0
  539. package/package.json +197 -0
  540. package/readme.md +67 -0
@@ -0,0 +1,2327 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, '__esModule', { value: true });
4
+
5
+ const index = require('./index-5d1f2412.js');
6
+ const fade_animation = require('./fade.animation-0d33d198.js');
7
+ const grow_animation = require('./grow.animation-46e7ae4b.js');
8
+
9
+ /**
10
+ * Custom positioning reference element.
11
+ * @see https://floating-ui.com/docs/virtual-elements
12
+ */
13
+
14
+ const sides = ['top', 'right', 'bottom', 'left'];
15
+ const alignments = ['start', 'end'];
16
+ const placements = /*#__PURE__*/sides.reduce((acc, side) => acc.concat(side, side + "-" + alignments[0], side + "-" + alignments[1]), []);
17
+ const min = Math.min;
18
+ const max = Math.max;
19
+ const round = Math.round;
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
+ function getSideAxis(placement) {
53
+ return ['top', 'bottom'].includes(getSide(placement)) ? 'y' : 'x';
54
+ }
55
+ function getAlignmentAxis(placement) {
56
+ return getOppositeAxis(getSideAxis(placement));
57
+ }
58
+ function getAlignmentSides(placement, rects, rtl) {
59
+ if (rtl === void 0) {
60
+ rtl = false;
61
+ }
62
+ const alignment = getAlignment(placement);
63
+ const alignmentAxis = getAlignmentAxis(placement);
64
+ const length = getAxisLength(alignmentAxis);
65
+ let mainAlignmentSide = alignmentAxis === 'x' ? alignment === (rtl ? 'end' : 'start') ? 'right' : 'left' : alignment === 'start' ? 'bottom' : 'top';
66
+ if (rects.reference[length] > rects.floating[length]) {
67
+ mainAlignmentSide = getOppositePlacement(mainAlignmentSide);
68
+ }
69
+ return [mainAlignmentSide, getOppositePlacement(mainAlignmentSide)];
70
+ }
71
+ function getExpandedPlacements(placement) {
72
+ const oppositePlacement = getOppositePlacement(placement);
73
+ return [getOppositeAlignmentPlacement(placement), oppositePlacement, getOppositeAlignmentPlacement(oppositePlacement)];
74
+ }
75
+ function getOppositeAlignmentPlacement(placement) {
76
+ return placement.replace(/start|end/g, alignment => oppositeAlignmentMap[alignment]);
77
+ }
78
+ function getSideList(side, isStart, rtl) {
79
+ const lr = ['left', 'right'];
80
+ const rl = ['right', 'left'];
81
+ const tb = ['top', 'bottom'];
82
+ const bt = ['bottom', 'top'];
83
+ switch (side) {
84
+ case 'top':
85
+ case 'bottom':
86
+ if (rtl) return isStart ? rl : lr;
87
+ return isStart ? lr : rl;
88
+ case 'left':
89
+ case 'right':
90
+ return isStart ? tb : bt;
91
+ default:
92
+ return [];
93
+ }
94
+ }
95
+ function getOppositeAxisPlacements(placement, flipAlignment, direction, rtl) {
96
+ const alignment = getAlignment(placement);
97
+ let list = getSideList(getSide(placement), direction === 'start', rtl);
98
+ if (alignment) {
99
+ list = list.map(side => side + "-" + alignment);
100
+ if (flipAlignment) {
101
+ list = list.concat(list.map(getOppositeAlignmentPlacement));
102
+ }
103
+ }
104
+ return list;
105
+ }
106
+ function getOppositePlacement(placement) {
107
+ return placement.replace(/left|right|bottom|top/g, side => oppositeSideMap[side]);
108
+ }
109
+ function expandPaddingObject(padding) {
110
+ return {
111
+ top: 0,
112
+ right: 0,
113
+ bottom: 0,
114
+ left: 0,
115
+ ...padding
116
+ };
117
+ }
118
+ function getPaddingObject(padding) {
119
+ return typeof padding !== 'number' ? expandPaddingObject(padding) : {
120
+ top: padding,
121
+ right: padding,
122
+ bottom: padding,
123
+ left: padding
124
+ };
125
+ }
126
+ function rectToClientRect(rect) {
127
+ const {
128
+ x,
129
+ y,
130
+ width,
131
+ height
132
+ } = rect;
133
+ return {
134
+ width,
135
+ height,
136
+ top: y,
137
+ left: x,
138
+ right: x + width,
139
+ bottom: y + height,
140
+ x,
141
+ y
142
+ };
143
+ }
144
+
145
+ function computeCoordsFromPlacement(_ref, placement, rtl) {
146
+ let {
147
+ reference,
148
+ floating
149
+ } = _ref;
150
+ const sideAxis = getSideAxis(placement);
151
+ const alignmentAxis = getAlignmentAxis(placement);
152
+ const alignLength = getAxisLength(alignmentAxis);
153
+ const side = getSide(placement);
154
+ const isVertical = sideAxis === 'y';
155
+ const commonX = reference.x + reference.width / 2 - floating.width / 2;
156
+ const commonY = reference.y + reference.height / 2 - floating.height / 2;
157
+ const commonAlign = reference[alignLength] / 2 - floating[alignLength] / 2;
158
+ let coords;
159
+ switch (side) {
160
+ case 'top':
161
+ coords = {
162
+ x: commonX,
163
+ y: reference.y - floating.height
164
+ };
165
+ break;
166
+ case 'bottom':
167
+ coords = {
168
+ x: commonX,
169
+ y: reference.y + reference.height
170
+ };
171
+ break;
172
+ case 'right':
173
+ coords = {
174
+ x: reference.x + reference.width,
175
+ y: commonY
176
+ };
177
+ break;
178
+ case 'left':
179
+ coords = {
180
+ x: reference.x - floating.width,
181
+ y: commonY
182
+ };
183
+ break;
184
+ default:
185
+ coords = {
186
+ x: reference.x,
187
+ y: reference.y
188
+ };
189
+ }
190
+ switch (getAlignment(placement)) {
191
+ case 'start':
192
+ coords[alignmentAxis] -= commonAlign * (rtl && isVertical ? -1 : 1);
193
+ break;
194
+ case 'end':
195
+ coords[alignmentAxis] += commonAlign * (rtl && isVertical ? -1 : 1);
196
+ break;
197
+ }
198
+ return coords;
199
+ }
200
+
201
+ /**
202
+ * Computes the `x` and `y` coordinates that will place the floating element
203
+ * next to a given reference element.
204
+ *
205
+ * This export does not have any `platform` interface logic. You will need to
206
+ * write one for the platform you are using Floating UI with.
207
+ */
208
+ const computePosition$1 = async (reference, floating, config) => {
209
+ const {
210
+ placement = 'bottom',
211
+ strategy = 'absolute',
212
+ middleware = [],
213
+ platform
214
+ } = config;
215
+ const validMiddleware = middleware.filter(Boolean);
216
+ const rtl = await (platform.isRTL == null ? void 0 : platform.isRTL(floating));
217
+ let rects = await platform.getElementRects({
218
+ reference,
219
+ floating,
220
+ strategy
221
+ });
222
+ let {
223
+ x,
224
+ y
225
+ } = computeCoordsFromPlacement(rects, placement, rtl);
226
+ let statefulPlacement = placement;
227
+ let middlewareData = {};
228
+ let resetCount = 0;
229
+ for (let i = 0; i < validMiddleware.length; i++) {
230
+ const {
231
+ name,
232
+ fn
233
+ } = validMiddleware[i];
234
+ const {
235
+ x: nextX,
236
+ y: nextY,
237
+ data,
238
+ reset
239
+ } = await fn({
240
+ x,
241
+ y,
242
+ initialPlacement: placement,
243
+ placement: statefulPlacement,
244
+ strategy,
245
+ middlewareData,
246
+ rects,
247
+ platform,
248
+ elements: {
249
+ reference,
250
+ floating
251
+ }
252
+ });
253
+ x = nextX != null ? nextX : x;
254
+ y = nextY != null ? nextY : y;
255
+ middlewareData = {
256
+ ...middlewareData,
257
+ [name]: {
258
+ ...middlewareData[name],
259
+ ...data
260
+ }
261
+ };
262
+ if (reset && resetCount <= 50) {
263
+ resetCount++;
264
+ if (typeof reset === 'object') {
265
+ if (reset.placement) {
266
+ statefulPlacement = reset.placement;
267
+ }
268
+ if (reset.rects) {
269
+ rects = reset.rects === true ? await platform.getElementRects({
270
+ reference,
271
+ floating,
272
+ strategy
273
+ }) : reset.rects;
274
+ }
275
+ ({
276
+ x,
277
+ y
278
+ } = computeCoordsFromPlacement(rects, statefulPlacement, rtl));
279
+ }
280
+ i = -1;
281
+ }
282
+ }
283
+ return {
284
+ x,
285
+ y,
286
+ placement: statefulPlacement,
287
+ strategy,
288
+ middlewareData
289
+ };
290
+ };
291
+
292
+ /**
293
+ * Resolves with an object of overflow side offsets that determine how much the
294
+ * element is overflowing a given clipping boundary on each side.
295
+ * - positive = overflowing the boundary by that number of pixels
296
+ * - negative = how many pixels left before it will overflow
297
+ * - 0 = lies flush with the boundary
298
+ * @see https://floating-ui.com/docs/detectOverflow
299
+ */
300
+ async function detectOverflow(state, options) {
301
+ var _await$platform$isEle;
302
+ if (options === void 0) {
303
+ options = {};
304
+ }
305
+ const {
306
+ x,
307
+ y,
308
+ platform,
309
+ rects,
310
+ elements,
311
+ strategy
312
+ } = state;
313
+ const {
314
+ boundary = 'clippingAncestors',
315
+ rootBoundary = 'viewport',
316
+ elementContext = 'floating',
317
+ altBoundary = false,
318
+ padding = 0
319
+ } = evaluate(options, state);
320
+ const paddingObject = getPaddingObject(padding);
321
+ const altContext = elementContext === 'floating' ? 'reference' : 'floating';
322
+ const element = elements[altBoundary ? altContext : elementContext];
323
+ const clippingClientRect = rectToClientRect(await platform.getClippingRect({
324
+ 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))),
325
+ boundary,
326
+ rootBoundary,
327
+ strategy
328
+ }));
329
+ const rect = elementContext === 'floating' ? {
330
+ x,
331
+ y,
332
+ width: rects.floating.width,
333
+ height: rects.floating.height
334
+ } : rects.reference;
335
+ const offsetParent = await (platform.getOffsetParent == null ? void 0 : platform.getOffsetParent(elements.floating));
336
+ const offsetScale = (await (platform.isElement == null ? void 0 : platform.isElement(offsetParent))) ? (await (platform.getScale == null ? void 0 : platform.getScale(offsetParent))) || {
337
+ x: 1,
338
+ y: 1
339
+ } : {
340
+ x: 1,
341
+ y: 1
342
+ };
343
+ const elementClientRect = rectToClientRect(platform.convertOffsetParentRelativeRectToViewportRelativeRect ? await platform.convertOffsetParentRelativeRectToViewportRelativeRect({
344
+ elements,
345
+ rect,
346
+ offsetParent,
347
+ strategy
348
+ }) : rect);
349
+ return {
350
+ top: (clippingClientRect.top - elementClientRect.top + paddingObject.top) / offsetScale.y,
351
+ bottom: (elementClientRect.bottom - clippingClientRect.bottom + paddingObject.bottom) / offsetScale.y,
352
+ left: (clippingClientRect.left - elementClientRect.left + paddingObject.left) / offsetScale.x,
353
+ right: (elementClientRect.right - clippingClientRect.right + paddingObject.right) / offsetScale.x
354
+ };
355
+ }
356
+
357
+ /**
358
+ * Provides data to position an inner element of the floating element so that it
359
+ * appears centered to the reference element.
360
+ * @see https://floating-ui.com/docs/arrow
361
+ */
362
+ const arrow$1 = options => ({
363
+ name: 'arrow',
364
+ options,
365
+ async fn(state) {
366
+ const {
367
+ x,
368
+ y,
369
+ placement,
370
+ rects,
371
+ platform,
372
+ elements,
373
+ middlewareData
374
+ } = state;
375
+ // Since `element` is required, we don't Partial<> the type.
376
+ const {
377
+ element,
378
+ padding = 0
379
+ } = evaluate(options, state) || {};
380
+ if (element == null) {
381
+ return {};
382
+ }
383
+ const paddingObject = getPaddingObject(padding);
384
+ const coords = {
385
+ x,
386
+ y
387
+ };
388
+ const axis = getAlignmentAxis(placement);
389
+ const length = getAxisLength(axis);
390
+ const arrowDimensions = await platform.getDimensions(element);
391
+ const isYAxis = axis === 'y';
392
+ const minProp = isYAxis ? 'top' : 'left';
393
+ const maxProp = isYAxis ? 'bottom' : 'right';
394
+ const clientProp = isYAxis ? 'clientHeight' : 'clientWidth';
395
+ const endDiff = rects.reference[length] + rects.reference[axis] - coords[axis] - rects.floating[length];
396
+ const startDiff = coords[axis] - rects.reference[axis];
397
+ const arrowOffsetParent = await (platform.getOffsetParent == null ? void 0 : platform.getOffsetParent(element));
398
+ let clientSize = arrowOffsetParent ? arrowOffsetParent[clientProp] : 0;
399
+
400
+ // DOM platform can return `window` as the `offsetParent`.
401
+ if (!clientSize || !(await (platform.isElement == null ? void 0 : platform.isElement(arrowOffsetParent)))) {
402
+ clientSize = elements.floating[clientProp] || rects.floating[length];
403
+ }
404
+ const centerToReference = endDiff / 2 - startDiff / 2;
405
+
406
+ // If the padding is large enough that it causes the arrow to no longer be
407
+ // centered, modify the padding so that it is centered.
408
+ const largestPossiblePadding = clientSize / 2 - arrowDimensions[length] / 2 - 1;
409
+ const minPadding = min(paddingObject[minProp], largestPossiblePadding);
410
+ const maxPadding = min(paddingObject[maxProp], largestPossiblePadding);
411
+
412
+ // Make sure the arrow doesn't overflow the floating element if the center
413
+ // point is outside the floating element's bounds.
414
+ const min$1 = minPadding;
415
+ const max = clientSize - arrowDimensions[length] - maxPadding;
416
+ const center = clientSize / 2 - arrowDimensions[length] / 2 + centerToReference;
417
+ const offset = clamp(min$1, center, max);
418
+
419
+ // If the reference is small enough that the arrow's padding causes it to
420
+ // to point to nothing for an aligned placement, adjust the offset of the
421
+ // floating element itself. To ensure `shift()` continues to take action,
422
+ // a single reset is performed when this is true.
423
+ const shouldAddOffset = !middlewareData.arrow && getAlignment(placement) != null && center !== offset && rects.reference[length] / 2 - (center < min$1 ? minPadding : maxPadding) - arrowDimensions[length] / 2 < 0;
424
+ const alignmentOffset = shouldAddOffset ? center < min$1 ? center - min$1 : center - max : 0;
425
+ return {
426
+ [axis]: coords[axis] + alignmentOffset,
427
+ data: {
428
+ [axis]: offset,
429
+ centerOffset: center - offset - alignmentOffset,
430
+ ...(shouldAddOffset && {
431
+ alignmentOffset
432
+ })
433
+ },
434
+ reset: shouldAddOffset
435
+ };
436
+ }
437
+ });
438
+
439
+ function getPlacementList(alignment, autoAlignment, allowedPlacements) {
440
+ const allowedPlacementsSortedByAlignment = alignment ? [...allowedPlacements.filter(placement => getAlignment(placement) === alignment), ...allowedPlacements.filter(placement => getAlignment(placement) !== alignment)] : allowedPlacements.filter(placement => getSide(placement) === placement);
441
+ return allowedPlacementsSortedByAlignment.filter(placement => {
442
+ if (alignment) {
443
+ return getAlignment(placement) === alignment || (autoAlignment ? getOppositeAlignmentPlacement(placement) !== placement : false);
444
+ }
445
+ return true;
446
+ });
447
+ }
448
+ /**
449
+ * Optimizes the visibility of the floating element by choosing the placement
450
+ * that has the most space available automatically, without needing to specify a
451
+ * preferred placement. Alternative to `flip`.
452
+ * @see https://floating-ui.com/docs/autoPlacement
453
+ */
454
+ const autoPlacement = function (options) {
455
+ if (options === void 0) {
456
+ options = {};
457
+ }
458
+ return {
459
+ name: 'autoPlacement',
460
+ options,
461
+ async fn(state) {
462
+ var _middlewareData$autoP, _middlewareData$autoP2, _placementsThatFitOnE;
463
+ const {
464
+ rects,
465
+ middlewareData,
466
+ placement,
467
+ platform,
468
+ elements
469
+ } = state;
470
+ const {
471
+ crossAxis = false,
472
+ alignment,
473
+ allowedPlacements = placements,
474
+ autoAlignment = true,
475
+ ...detectOverflowOptions
476
+ } = evaluate(options, state);
477
+ const placements$1 = alignment !== undefined || allowedPlacements === placements ? getPlacementList(alignment || null, autoAlignment, allowedPlacements) : allowedPlacements;
478
+ const overflow = await detectOverflow(state, detectOverflowOptions);
479
+ const currentIndex = ((_middlewareData$autoP = middlewareData.autoPlacement) == null ? void 0 : _middlewareData$autoP.index) || 0;
480
+ const currentPlacement = placements$1[currentIndex];
481
+ if (currentPlacement == null) {
482
+ return {};
483
+ }
484
+ const alignmentSides = getAlignmentSides(currentPlacement, rects, await (platform.isRTL == null ? void 0 : platform.isRTL(elements.floating)));
485
+
486
+ // Make `computeCoords` start from the right place.
487
+ if (placement !== currentPlacement) {
488
+ return {
489
+ reset: {
490
+ placement: placements$1[0]
491
+ }
492
+ };
493
+ }
494
+ const currentOverflows = [overflow[getSide(currentPlacement)], overflow[alignmentSides[0]], overflow[alignmentSides[1]]];
495
+ const allOverflows = [...(((_middlewareData$autoP2 = middlewareData.autoPlacement) == null ? void 0 : _middlewareData$autoP2.overflows) || []), {
496
+ placement: currentPlacement,
497
+ overflows: currentOverflows
498
+ }];
499
+ const nextPlacement = placements$1[currentIndex + 1];
500
+
501
+ // There are more placements to check.
502
+ if (nextPlacement) {
503
+ return {
504
+ data: {
505
+ index: currentIndex + 1,
506
+ overflows: allOverflows
507
+ },
508
+ reset: {
509
+ placement: nextPlacement
510
+ }
511
+ };
512
+ }
513
+ const placementsSortedByMostSpace = allOverflows.map(d => {
514
+ const alignment = getAlignment(d.placement);
515
+ return [d.placement, alignment && crossAxis ?
516
+ // Check along the mainAxis and main crossAxis side.
517
+ d.overflows.slice(0, 2).reduce((acc, v) => acc + v, 0) :
518
+ // Check only the mainAxis.
519
+ d.overflows[0], d.overflows];
520
+ }).sort((a, b) => a[1] - b[1]);
521
+ const placementsThatFitOnEachSide = placementsSortedByMostSpace.filter(d => d[2].slice(0,
522
+ // Aligned placements should not check their opposite crossAxis
523
+ // side.
524
+ getAlignment(d[0]) ? 2 : 3).every(v => v <= 0));
525
+ const resetPlacement = ((_placementsThatFitOnE = placementsThatFitOnEachSide[0]) == null ? void 0 : _placementsThatFitOnE[0]) || placementsSortedByMostSpace[0][0];
526
+ if (resetPlacement !== placement) {
527
+ return {
528
+ data: {
529
+ index: currentIndex + 1,
530
+ overflows: allOverflows
531
+ },
532
+ reset: {
533
+ placement: resetPlacement
534
+ }
535
+ };
536
+ }
537
+ return {};
538
+ }
539
+ };
540
+ };
541
+
542
+ /**
543
+ * Optimizes the visibility of the floating element by flipping the `placement`
544
+ * in order to keep it in view when the preferred placement(s) will overflow the
545
+ * clipping boundary. Alternative to `autoPlacement`.
546
+ * @see https://floating-ui.com/docs/flip
547
+ */
548
+ const flip$1 = function (options) {
549
+ if (options === void 0) {
550
+ options = {};
551
+ }
552
+ return {
553
+ name: 'flip',
554
+ options,
555
+ async fn(state) {
556
+ var _middlewareData$arrow, _middlewareData$flip;
557
+ const {
558
+ placement,
559
+ middlewareData,
560
+ rects,
561
+ initialPlacement,
562
+ platform,
563
+ elements
564
+ } = state;
565
+ const {
566
+ mainAxis: checkMainAxis = true,
567
+ crossAxis: checkCrossAxis = true,
568
+ fallbackPlacements: specifiedFallbackPlacements,
569
+ fallbackStrategy = 'bestFit',
570
+ fallbackAxisSideDirection = 'none',
571
+ flipAlignment = true,
572
+ ...detectOverflowOptions
573
+ } = evaluate(options, state);
574
+
575
+ // If a reset by the arrow was caused due to an alignment offset being
576
+ // added, we should skip any logic now since `flip()` has already done its
577
+ // work.
578
+ // https://github.com/floating-ui/floating-ui/issues/2549#issuecomment-1719601643
579
+ if ((_middlewareData$arrow = middlewareData.arrow) != null && _middlewareData$arrow.alignmentOffset) {
580
+ return {};
581
+ }
582
+ const side = getSide(placement);
583
+ const isBasePlacement = getSide(initialPlacement) === initialPlacement;
584
+ const rtl = await (platform.isRTL == null ? void 0 : platform.isRTL(elements.floating));
585
+ const fallbackPlacements = specifiedFallbackPlacements || (isBasePlacement || !flipAlignment ? [getOppositePlacement(initialPlacement)] : getExpandedPlacements(initialPlacement));
586
+ if (!specifiedFallbackPlacements && fallbackAxisSideDirection !== 'none') {
587
+ fallbackPlacements.push(...getOppositeAxisPlacements(initialPlacement, flipAlignment, fallbackAxisSideDirection, rtl));
588
+ }
589
+ const placements = [initialPlacement, ...fallbackPlacements];
590
+ const overflow = await detectOverflow(state, detectOverflowOptions);
591
+ const overflows = [];
592
+ let overflowsData = ((_middlewareData$flip = middlewareData.flip) == null ? void 0 : _middlewareData$flip.overflows) || [];
593
+ if (checkMainAxis) {
594
+ overflows.push(overflow[side]);
595
+ }
596
+ if (checkCrossAxis) {
597
+ const sides = getAlignmentSides(placement, rects, rtl);
598
+ overflows.push(overflow[sides[0]], overflow[sides[1]]);
599
+ }
600
+ overflowsData = [...overflowsData, {
601
+ placement,
602
+ overflows
603
+ }];
604
+
605
+ // One or more sides is overflowing.
606
+ if (!overflows.every(side => side <= 0)) {
607
+ var _middlewareData$flip2, _overflowsData$filter;
608
+ const nextIndex = (((_middlewareData$flip2 = middlewareData.flip) == null ? void 0 : _middlewareData$flip2.index) || 0) + 1;
609
+ const nextPlacement = placements[nextIndex];
610
+ if (nextPlacement) {
611
+ // Try next placement and re-run the lifecycle.
612
+ return {
613
+ data: {
614
+ index: nextIndex,
615
+ overflows: overflowsData
616
+ },
617
+ reset: {
618
+ placement: nextPlacement
619
+ }
620
+ };
621
+ }
622
+
623
+ // First, find the candidates that fit on the mainAxis side of overflow,
624
+ // then find the placement that fits the best on the main crossAxis side.
625
+ 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;
626
+
627
+ // Otherwise fallback.
628
+ if (!resetPlacement) {
629
+ switch (fallbackStrategy) {
630
+ case 'bestFit':
631
+ {
632
+ var _overflowsData$map$so;
633
+ 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];
634
+ if (placement) {
635
+ resetPlacement = placement;
636
+ }
637
+ break;
638
+ }
639
+ case 'initialPlacement':
640
+ resetPlacement = initialPlacement;
641
+ break;
642
+ }
643
+ }
644
+ if (placement !== resetPlacement) {
645
+ return {
646
+ reset: {
647
+ placement: resetPlacement
648
+ }
649
+ };
650
+ }
651
+ }
652
+ return {};
653
+ }
654
+ };
655
+ };
656
+
657
+ function getSideOffsets(overflow, rect) {
658
+ return {
659
+ top: overflow.top - rect.height,
660
+ right: overflow.right - rect.width,
661
+ bottom: overflow.bottom - rect.height,
662
+ left: overflow.left - rect.width
663
+ };
664
+ }
665
+ function isAnySideFullyClipped(overflow) {
666
+ return sides.some(side => overflow[side] >= 0);
667
+ }
668
+ /**
669
+ * Provides data to hide the floating element in applicable situations, such as
670
+ * when it is not in the same clipping context as the reference element.
671
+ * @see https://floating-ui.com/docs/hide
672
+ */
673
+ const hide = function (options) {
674
+ if (options === void 0) {
675
+ options = {};
676
+ }
677
+ return {
678
+ name: 'hide',
679
+ options,
680
+ async fn(state) {
681
+ const {
682
+ rects
683
+ } = state;
684
+ const {
685
+ strategy = 'referenceHidden',
686
+ ...detectOverflowOptions
687
+ } = evaluate(options, state);
688
+ switch (strategy) {
689
+ case 'referenceHidden':
690
+ {
691
+ const overflow = await detectOverflow(state, {
692
+ ...detectOverflowOptions,
693
+ elementContext: 'reference'
694
+ });
695
+ const offsets = getSideOffsets(overflow, rects.reference);
696
+ return {
697
+ data: {
698
+ referenceHiddenOffsets: offsets,
699
+ referenceHidden: isAnySideFullyClipped(offsets)
700
+ }
701
+ };
702
+ }
703
+ case 'escaped':
704
+ {
705
+ const overflow = await detectOverflow(state, {
706
+ ...detectOverflowOptions,
707
+ altBoundary: true
708
+ });
709
+ const offsets = getSideOffsets(overflow, rects.floating);
710
+ return {
711
+ data: {
712
+ escapedOffsets: offsets,
713
+ escaped: isAnySideFullyClipped(offsets)
714
+ }
715
+ };
716
+ }
717
+ default:
718
+ {
719
+ return {};
720
+ }
721
+ }
722
+ }
723
+ };
724
+ };
725
+
726
+ function getBoundingRect(rects) {
727
+ const minX = min(...rects.map(rect => rect.left));
728
+ const minY = min(...rects.map(rect => rect.top));
729
+ const maxX = max(...rects.map(rect => rect.right));
730
+ const maxY = max(...rects.map(rect => rect.bottom));
731
+ return {
732
+ x: minX,
733
+ y: minY,
734
+ width: maxX - minX,
735
+ height: maxY - minY
736
+ };
737
+ }
738
+ function getRectsByLine(rects) {
739
+ const sortedRects = rects.slice().sort((a, b) => a.y - b.y);
740
+ const groups = [];
741
+ let prevRect = null;
742
+ for (let i = 0; i < sortedRects.length; i++) {
743
+ const rect = sortedRects[i];
744
+ if (!prevRect || rect.y - prevRect.y > prevRect.height / 2) {
745
+ groups.push([rect]);
746
+ } else {
747
+ groups[groups.length - 1].push(rect);
748
+ }
749
+ prevRect = rect;
750
+ }
751
+ return groups.map(rect => rectToClientRect(getBoundingRect(rect)));
752
+ }
753
+ /**
754
+ * Provides improved positioning for inline reference elements that can span
755
+ * over multiple lines, such as hyperlinks or range selections.
756
+ * @see https://floating-ui.com/docs/inline
757
+ */
758
+ const inline = function (options) {
759
+ if (options === void 0) {
760
+ options = {};
761
+ }
762
+ return {
763
+ name: 'inline',
764
+ options,
765
+ async fn(state) {
766
+ const {
767
+ placement,
768
+ elements,
769
+ rects,
770
+ platform,
771
+ strategy
772
+ } = state;
773
+ // A MouseEvent's client{X,Y} coords can be up to 2 pixels off a
774
+ // ClientRect's bounds, despite the event listener being triggered. A
775
+ // padding of 2 seems to handle this issue.
776
+ const {
777
+ padding = 2,
778
+ x,
779
+ y
780
+ } = evaluate(options, state);
781
+ const nativeClientRects = Array.from((await (platform.getClientRects == null ? void 0 : platform.getClientRects(elements.reference))) || []);
782
+ const clientRects = getRectsByLine(nativeClientRects);
783
+ const fallback = rectToClientRect(getBoundingRect(nativeClientRects));
784
+ const paddingObject = getPaddingObject(padding);
785
+ function getBoundingClientRect() {
786
+ // There are two rects and they are disjoined.
787
+ if (clientRects.length === 2 && clientRects[0].left > clientRects[1].right && x != null && y != null) {
788
+ // Find the first rect in which the point is fully inside.
789
+ 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;
790
+ }
791
+
792
+ // There are 2 or more connected rects.
793
+ if (clientRects.length >= 2) {
794
+ if (getSideAxis(placement) === 'y') {
795
+ const firstRect = clientRects[0];
796
+ const lastRect = clientRects[clientRects.length - 1];
797
+ const isTop = getSide(placement) === 'top';
798
+ const top = firstRect.top;
799
+ const bottom = lastRect.bottom;
800
+ const left = isTop ? firstRect.left : lastRect.left;
801
+ const right = isTop ? firstRect.right : lastRect.right;
802
+ const width = right - left;
803
+ const height = bottom - top;
804
+ return {
805
+ top,
806
+ bottom,
807
+ left,
808
+ right,
809
+ width,
810
+ height,
811
+ x: left,
812
+ y: top
813
+ };
814
+ }
815
+ const isLeftSide = getSide(placement) === 'left';
816
+ const maxRight = max(...clientRects.map(rect => rect.right));
817
+ const minLeft = min(...clientRects.map(rect => rect.left));
818
+ const measureRects = clientRects.filter(rect => isLeftSide ? rect.left === minLeft : rect.right === maxRight);
819
+ const top = measureRects[0].top;
820
+ const bottom = measureRects[measureRects.length - 1].bottom;
821
+ const left = minLeft;
822
+ const right = maxRight;
823
+ const width = right - left;
824
+ const height = bottom - top;
825
+ return {
826
+ top,
827
+ bottom,
828
+ left,
829
+ right,
830
+ width,
831
+ height,
832
+ x: left,
833
+ y: top
834
+ };
835
+ }
836
+ return fallback;
837
+ }
838
+ const resetRects = await platform.getElementRects({
839
+ reference: {
840
+ getBoundingClientRect
841
+ },
842
+ floating: elements.floating,
843
+ strategy
844
+ });
845
+ 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) {
846
+ return {
847
+ reset: {
848
+ rects: resetRects
849
+ }
850
+ };
851
+ }
852
+ return {};
853
+ }
854
+ };
855
+ };
856
+
857
+ // For type backwards-compatibility, the `OffsetOptions` type was also
858
+ // Derivable.
859
+
860
+ async function convertValueToCoords(state, options) {
861
+ const {
862
+ placement,
863
+ platform,
864
+ elements
865
+ } = state;
866
+ const rtl = await (platform.isRTL == null ? void 0 : platform.isRTL(elements.floating));
867
+ const side = getSide(placement);
868
+ const alignment = getAlignment(placement);
869
+ const isVertical = getSideAxis(placement) === 'y';
870
+ const mainAxisMulti = ['left', 'top'].includes(side) ? -1 : 1;
871
+ const crossAxisMulti = rtl && isVertical ? -1 : 1;
872
+ const rawValue = evaluate(options, state);
873
+
874
+ // eslint-disable-next-line prefer-const
875
+ let {
876
+ mainAxis,
877
+ crossAxis,
878
+ alignmentAxis
879
+ } = typeof rawValue === 'number' ? {
880
+ mainAxis: rawValue,
881
+ crossAxis: 0,
882
+ alignmentAxis: null
883
+ } : {
884
+ mainAxis: 0,
885
+ crossAxis: 0,
886
+ alignmentAxis: null,
887
+ ...rawValue
888
+ };
889
+ if (alignment && typeof alignmentAxis === 'number') {
890
+ crossAxis = alignment === 'end' ? alignmentAxis * -1 : alignmentAxis;
891
+ }
892
+ return isVertical ? {
893
+ x: crossAxis * crossAxisMulti,
894
+ y: mainAxis * mainAxisMulti
895
+ } : {
896
+ x: mainAxis * mainAxisMulti,
897
+ y: crossAxis * crossAxisMulti
898
+ };
899
+ }
900
+
901
+ /**
902
+ * Modifies the placement by translating the floating element along the
903
+ * specified axes.
904
+ * A number (shorthand for `mainAxis` or distance), or an axes configuration
905
+ * object may be passed.
906
+ * @see https://floating-ui.com/docs/offset
907
+ */
908
+ const offset$1 = function (options) {
909
+ if (options === void 0) {
910
+ options = 0;
911
+ }
912
+ return {
913
+ name: 'offset',
914
+ options,
915
+ async fn(state) {
916
+ var _middlewareData$offse, _middlewareData$arrow;
917
+ const {
918
+ x,
919
+ y,
920
+ placement,
921
+ middlewareData
922
+ } = state;
923
+ const diffCoords = await convertValueToCoords(state, options);
924
+
925
+ // If the placement is the same and the arrow caused an alignment offset
926
+ // then we don't need to change the positioning coordinates.
927
+ if (placement === ((_middlewareData$offse = middlewareData.offset) == null ? void 0 : _middlewareData$offse.placement) && (_middlewareData$arrow = middlewareData.arrow) != null && _middlewareData$arrow.alignmentOffset) {
928
+ return {};
929
+ }
930
+ return {
931
+ x: x + diffCoords.x,
932
+ y: y + diffCoords.y,
933
+ data: {
934
+ ...diffCoords,
935
+ placement
936
+ }
937
+ };
938
+ }
939
+ };
940
+ };
941
+
942
+ /**
943
+ * Optimizes the visibility of the floating element by shifting it in order to
944
+ * keep it in view when it will overflow the clipping boundary.
945
+ * @see https://floating-ui.com/docs/shift
946
+ */
947
+ const shift$1 = function (options) {
948
+ if (options === void 0) {
949
+ options = {};
950
+ }
951
+ return {
952
+ name: 'shift',
953
+ options,
954
+ async fn(state) {
955
+ const {
956
+ x,
957
+ y,
958
+ placement
959
+ } = state;
960
+ const {
961
+ mainAxis: checkMainAxis = true,
962
+ crossAxis: checkCrossAxis = false,
963
+ limiter = {
964
+ fn: _ref => {
965
+ let {
966
+ x,
967
+ y
968
+ } = _ref;
969
+ return {
970
+ x,
971
+ y
972
+ };
973
+ }
974
+ },
975
+ ...detectOverflowOptions
976
+ } = evaluate(options, state);
977
+ const coords = {
978
+ x,
979
+ y
980
+ };
981
+ const overflow = await detectOverflow(state, detectOverflowOptions);
982
+ const crossAxis = getSideAxis(getSide(placement));
983
+ const mainAxis = getOppositeAxis(crossAxis);
984
+ let mainAxisCoord = coords[mainAxis];
985
+ let crossAxisCoord = coords[crossAxis];
986
+ if (checkMainAxis) {
987
+ const minSide = mainAxis === 'y' ? 'top' : 'left';
988
+ const maxSide = mainAxis === 'y' ? 'bottom' : 'right';
989
+ const min = mainAxisCoord + overflow[minSide];
990
+ const max = mainAxisCoord - overflow[maxSide];
991
+ mainAxisCoord = clamp(min, mainAxisCoord, max);
992
+ }
993
+ if (checkCrossAxis) {
994
+ const minSide = crossAxis === 'y' ? 'top' : 'left';
995
+ const maxSide = crossAxis === 'y' ? 'bottom' : 'right';
996
+ const min = crossAxisCoord + overflow[minSide];
997
+ const max = crossAxisCoord - overflow[maxSide];
998
+ crossAxisCoord = clamp(min, crossAxisCoord, max);
999
+ }
1000
+ const limitedCoords = limiter.fn({
1001
+ ...state,
1002
+ [mainAxis]: mainAxisCoord,
1003
+ [crossAxis]: crossAxisCoord
1004
+ });
1005
+ return {
1006
+ ...limitedCoords,
1007
+ data: {
1008
+ x: limitedCoords.x - x,
1009
+ y: limitedCoords.y - y
1010
+ }
1011
+ };
1012
+ }
1013
+ };
1014
+ };
1015
+ /**
1016
+ * Built-in `limiter` that will stop `shift()` at a certain point.
1017
+ */
1018
+ const limitShift = function (options) {
1019
+ if (options === void 0) {
1020
+ options = {};
1021
+ }
1022
+ return {
1023
+ options,
1024
+ fn(state) {
1025
+ const {
1026
+ x,
1027
+ y,
1028
+ placement,
1029
+ rects,
1030
+ middlewareData
1031
+ } = state;
1032
+ const {
1033
+ offset = 0,
1034
+ mainAxis: checkMainAxis = true,
1035
+ crossAxis: checkCrossAxis = true
1036
+ } = evaluate(options, state);
1037
+ const coords = {
1038
+ x,
1039
+ y
1040
+ };
1041
+ const crossAxis = getSideAxis(placement);
1042
+ const mainAxis = getOppositeAxis(crossAxis);
1043
+ let mainAxisCoord = coords[mainAxis];
1044
+ let crossAxisCoord = coords[crossAxis];
1045
+ const rawOffset = evaluate(offset, state);
1046
+ const computedOffset = typeof rawOffset === 'number' ? {
1047
+ mainAxis: rawOffset,
1048
+ crossAxis: 0
1049
+ } : {
1050
+ mainAxis: 0,
1051
+ crossAxis: 0,
1052
+ ...rawOffset
1053
+ };
1054
+ if (checkMainAxis) {
1055
+ const len = mainAxis === 'y' ? 'height' : 'width';
1056
+ const limitMin = rects.reference[mainAxis] - rects.floating[len] + computedOffset.mainAxis;
1057
+ const limitMax = rects.reference[mainAxis] + rects.reference[len] - computedOffset.mainAxis;
1058
+ if (mainAxisCoord < limitMin) {
1059
+ mainAxisCoord = limitMin;
1060
+ } else if (mainAxisCoord > limitMax) {
1061
+ mainAxisCoord = limitMax;
1062
+ }
1063
+ }
1064
+ if (checkCrossAxis) {
1065
+ var _middlewareData$offse, _middlewareData$offse2;
1066
+ const len = mainAxis === 'y' ? 'width' : 'height';
1067
+ const isOriginSide = ['top', 'left'].includes(getSide(placement));
1068
+ const limitMin = rects.reference[crossAxis] - rects.floating[len] + (isOriginSide ? ((_middlewareData$offse = middlewareData.offset) == null ? void 0 : _middlewareData$offse[crossAxis]) || 0 : 0) + (isOriginSide ? 0 : computedOffset.crossAxis);
1069
+ const limitMax = rects.reference[crossAxis] + rects.reference[len] + (isOriginSide ? 0 : ((_middlewareData$offse2 = middlewareData.offset) == null ? void 0 : _middlewareData$offse2[crossAxis]) || 0) - (isOriginSide ? computedOffset.crossAxis : 0);
1070
+ if (crossAxisCoord < limitMin) {
1071
+ crossAxisCoord = limitMin;
1072
+ } else if (crossAxisCoord > limitMax) {
1073
+ crossAxisCoord = limitMax;
1074
+ }
1075
+ }
1076
+ return {
1077
+ [mainAxis]: mainAxisCoord,
1078
+ [crossAxis]: crossAxisCoord
1079
+ };
1080
+ }
1081
+ };
1082
+ };
1083
+
1084
+ /**
1085
+ * Provides data that allows you to change the size of the floating element —
1086
+ * for instance, prevent it from overflowing the clipping boundary or match the
1087
+ * width of the reference element.
1088
+ * @see https://floating-ui.com/docs/size
1089
+ */
1090
+ const size = function (options) {
1091
+ if (options === void 0) {
1092
+ options = {};
1093
+ }
1094
+ return {
1095
+ name: 'size',
1096
+ options,
1097
+ async fn(state) {
1098
+ const {
1099
+ placement,
1100
+ rects,
1101
+ platform,
1102
+ elements
1103
+ } = state;
1104
+ const {
1105
+ apply = () => {},
1106
+ ...detectOverflowOptions
1107
+ } = evaluate(options, state);
1108
+ const overflow = await detectOverflow(state, detectOverflowOptions);
1109
+ const side = getSide(placement);
1110
+ const alignment = getAlignment(placement);
1111
+ const isYAxis = getSideAxis(placement) === 'y';
1112
+ const {
1113
+ width,
1114
+ height
1115
+ } = rects.floating;
1116
+ let heightSide;
1117
+ let widthSide;
1118
+ if (side === 'top' || side === 'bottom') {
1119
+ heightSide = side;
1120
+ widthSide = alignment === ((await (platform.isRTL == null ? void 0 : platform.isRTL(elements.floating))) ? 'start' : 'end') ? 'left' : 'right';
1121
+ } else {
1122
+ widthSide = side;
1123
+ heightSide = alignment === 'end' ? 'top' : 'bottom';
1124
+ }
1125
+ const maximumClippingHeight = height - overflow.top - overflow.bottom;
1126
+ const maximumClippingWidth = width - overflow.left - overflow.right;
1127
+ const overflowAvailableHeight = min(height - overflow[heightSide], maximumClippingHeight);
1128
+ const overflowAvailableWidth = min(width - overflow[widthSide], maximumClippingWidth);
1129
+ const noShift = !state.middlewareData.shift;
1130
+ let availableHeight = overflowAvailableHeight;
1131
+ let availableWidth = overflowAvailableWidth;
1132
+ if (isYAxis) {
1133
+ availableWidth = alignment || noShift ? min(overflowAvailableWidth, maximumClippingWidth) : maximumClippingWidth;
1134
+ } else {
1135
+ availableHeight = alignment || noShift ? min(overflowAvailableHeight, maximumClippingHeight) : maximumClippingHeight;
1136
+ }
1137
+ if (noShift && !alignment) {
1138
+ const xMin = max(overflow.left, 0);
1139
+ const xMax = max(overflow.right, 0);
1140
+ const yMin = max(overflow.top, 0);
1141
+ const yMax = max(overflow.bottom, 0);
1142
+ if (isYAxis) {
1143
+ availableWidth = width - 2 * (xMin !== 0 || xMax !== 0 ? xMin + xMax : max(overflow.left, overflow.right));
1144
+ } else {
1145
+ availableHeight = height - 2 * (yMin !== 0 || yMax !== 0 ? yMin + yMax : max(overflow.top, overflow.bottom));
1146
+ }
1147
+ }
1148
+ await apply({
1149
+ ...state,
1150
+ availableWidth,
1151
+ availableHeight
1152
+ });
1153
+ const nextDimensions = await platform.getDimensions(elements.floating);
1154
+ if (width !== nextDimensions.width || height !== nextDimensions.height) {
1155
+ return {
1156
+ reset: {
1157
+ rects: true
1158
+ }
1159
+ };
1160
+ }
1161
+ return {};
1162
+ }
1163
+ };
1164
+ };
1165
+
1166
+ function hasWindow() {
1167
+ return typeof window !== 'undefined';
1168
+ }
1169
+ function getNodeName(node) {
1170
+ if (isNode(node)) {
1171
+ return (node.nodeName || '').toLowerCase();
1172
+ }
1173
+ // Mocked nodes in testing environments may not be instances of Node. By
1174
+ // returning `#document` an infinite loop won't occur.
1175
+ // https://github.com/floating-ui/floating-ui/issues/2317
1176
+ return '#document';
1177
+ }
1178
+ function getWindow(node) {
1179
+ var _node$ownerDocument;
1180
+ return (node == null || (_node$ownerDocument = node.ownerDocument) == null ? void 0 : _node$ownerDocument.defaultView) || window;
1181
+ }
1182
+ function getDocumentElement(node) {
1183
+ var _ref;
1184
+ return (_ref = (isNode(node) ? node.ownerDocument : node.document) || window.document) == null ? void 0 : _ref.documentElement;
1185
+ }
1186
+ function isNode(value) {
1187
+ if (!hasWindow()) {
1188
+ return false;
1189
+ }
1190
+ return value instanceof Node || value instanceof getWindow(value).Node;
1191
+ }
1192
+ function isElement(value) {
1193
+ if (!hasWindow()) {
1194
+ return false;
1195
+ }
1196
+ return value instanceof Element || value instanceof getWindow(value).Element;
1197
+ }
1198
+ function isHTMLElement(value) {
1199
+ if (!hasWindow()) {
1200
+ return false;
1201
+ }
1202
+ return value instanceof HTMLElement || value instanceof getWindow(value).HTMLElement;
1203
+ }
1204
+ function isShadowRoot(value) {
1205
+ if (!hasWindow() || typeof ShadowRoot === 'undefined') {
1206
+ return false;
1207
+ }
1208
+ return value instanceof ShadowRoot || value instanceof getWindow(value).ShadowRoot;
1209
+ }
1210
+ function isOverflowElement(element) {
1211
+ const {
1212
+ overflow,
1213
+ overflowX,
1214
+ overflowY,
1215
+ display
1216
+ } = getComputedStyle(element);
1217
+ return /auto|scroll|overlay|hidden|clip/.test(overflow + overflowY + overflowX) && !['inline', 'contents'].includes(display);
1218
+ }
1219
+ function isTableElement(element) {
1220
+ return ['table', 'td', 'th'].includes(getNodeName(element));
1221
+ }
1222
+ function isTopLayer(element) {
1223
+ return [':popover-open', ':modal'].some(selector => {
1224
+ try {
1225
+ return element.matches(selector);
1226
+ } catch (e) {
1227
+ return false;
1228
+ }
1229
+ });
1230
+ }
1231
+ function isContainingBlock(elementOrCss) {
1232
+ const webkit = isWebKit();
1233
+ const css = isElement(elementOrCss) ? getComputedStyle(elementOrCss) : elementOrCss;
1234
+
1235
+ // https://developer.mozilla.org/en-US/docs/Web/CSS/Containing_block#identifying_the_containing_block
1236
+ return css.transform !== 'none' || css.perspective !== 'none' || (css.containerType ? css.containerType !== 'normal' : false) || !webkit && (css.backdropFilter ? css.backdropFilter !== 'none' : false) || !webkit && (css.filter ? css.filter !== 'none' : false) || ['transform', 'perspective', 'filter'].some(value => (css.willChange || '').includes(value)) || ['paint', 'layout', 'strict', 'content'].some(value => (css.contain || '').includes(value));
1237
+ }
1238
+ function getContainingBlock(element) {
1239
+ let currentNode = getParentNode(element);
1240
+ while (isHTMLElement(currentNode) && !isLastTraversableNode(currentNode)) {
1241
+ if (isContainingBlock(currentNode)) {
1242
+ return currentNode;
1243
+ } else if (isTopLayer(currentNode)) {
1244
+ return null;
1245
+ }
1246
+ currentNode = getParentNode(currentNode);
1247
+ }
1248
+ return null;
1249
+ }
1250
+ function isWebKit() {
1251
+ if (typeof CSS === 'undefined' || !CSS.supports) return false;
1252
+ return CSS.supports('-webkit-backdrop-filter', 'none');
1253
+ }
1254
+ function isLastTraversableNode(node) {
1255
+ return ['html', 'body', '#document'].includes(getNodeName(node));
1256
+ }
1257
+ function getComputedStyle(element) {
1258
+ return getWindow(element).getComputedStyle(element);
1259
+ }
1260
+ function getNodeScroll(element) {
1261
+ if (isElement(element)) {
1262
+ return {
1263
+ scrollLeft: element.scrollLeft,
1264
+ scrollTop: element.scrollTop
1265
+ };
1266
+ }
1267
+ return {
1268
+ scrollLeft: element.scrollX,
1269
+ scrollTop: element.scrollY
1270
+ };
1271
+ }
1272
+ function getParentNode(node) {
1273
+ if (getNodeName(node) === 'html') {
1274
+ return node;
1275
+ }
1276
+ const result =
1277
+ // Step into the shadow DOM of the parent of a slotted node.
1278
+ node.assignedSlot ||
1279
+ // DOM Element detected.
1280
+ node.parentNode ||
1281
+ // ShadowRoot detected.
1282
+ isShadowRoot(node) && node.host ||
1283
+ // Fallback.
1284
+ getDocumentElement(node);
1285
+ return isShadowRoot(result) ? result.host : result;
1286
+ }
1287
+ function getNearestOverflowAncestor(node) {
1288
+ const parentNode = getParentNode(node);
1289
+ if (isLastTraversableNode(parentNode)) {
1290
+ return node.ownerDocument ? node.ownerDocument.body : node.body;
1291
+ }
1292
+ if (isHTMLElement(parentNode) && isOverflowElement(parentNode)) {
1293
+ return parentNode;
1294
+ }
1295
+ return getNearestOverflowAncestor(parentNode);
1296
+ }
1297
+ function getOverflowAncestors(node, list, traverseIframes) {
1298
+ var _node$ownerDocument2;
1299
+ if (list === void 0) {
1300
+ list = [];
1301
+ }
1302
+ if (traverseIframes === void 0) {
1303
+ traverseIframes = true;
1304
+ }
1305
+ const scrollableAncestor = getNearestOverflowAncestor(node);
1306
+ const isBody = scrollableAncestor === ((_node$ownerDocument2 = node.ownerDocument) == null ? void 0 : _node$ownerDocument2.body);
1307
+ const win = getWindow(scrollableAncestor);
1308
+ if (isBody) {
1309
+ const frameElement = getFrameElement(win);
1310
+ return list.concat(win, win.visualViewport || [], isOverflowElement(scrollableAncestor) ? scrollableAncestor : [], frameElement && traverseIframes ? getOverflowAncestors(frameElement) : []);
1311
+ }
1312
+ return list.concat(scrollableAncestor, getOverflowAncestors(scrollableAncestor, [], traverseIframes));
1313
+ }
1314
+ function getFrameElement(win) {
1315
+ return win.parent && Object.getPrototypeOf(win.parent) ? win.frameElement : null;
1316
+ }
1317
+
1318
+ function getCssDimensions(element) {
1319
+ const css = getComputedStyle(element);
1320
+ // In testing environments, the `width` and `height` properties are empty
1321
+ // strings for SVG elements, returning NaN. Fallback to `0` in this case.
1322
+ let width = parseFloat(css.width) || 0;
1323
+ let height = parseFloat(css.height) || 0;
1324
+ const hasOffset = isHTMLElement(element);
1325
+ const offsetWidth = hasOffset ? element.offsetWidth : width;
1326
+ const offsetHeight = hasOffset ? element.offsetHeight : height;
1327
+ const shouldFallback = round(width) !== offsetWidth || round(height) !== offsetHeight;
1328
+ if (shouldFallback) {
1329
+ width = offsetWidth;
1330
+ height = offsetHeight;
1331
+ }
1332
+ return {
1333
+ width,
1334
+ height,
1335
+ $: shouldFallback
1336
+ };
1337
+ }
1338
+
1339
+ function unwrapElement(element) {
1340
+ return !isElement(element) ? element.contextElement : element;
1341
+ }
1342
+
1343
+ function getScale(element) {
1344
+ const domElement = unwrapElement(element);
1345
+ if (!isHTMLElement(domElement)) {
1346
+ return createCoords(1);
1347
+ }
1348
+ const rect = domElement.getBoundingClientRect();
1349
+ const {
1350
+ width,
1351
+ height,
1352
+ $
1353
+ } = getCssDimensions(domElement);
1354
+ let x = ($ ? round(rect.width) : rect.width) / width;
1355
+ let y = ($ ? round(rect.height) : rect.height) / height;
1356
+
1357
+ // 0, NaN, or Infinity should always fallback to 1.
1358
+
1359
+ if (!x || !Number.isFinite(x)) {
1360
+ x = 1;
1361
+ }
1362
+ if (!y || !Number.isFinite(y)) {
1363
+ y = 1;
1364
+ }
1365
+ return {
1366
+ x,
1367
+ y
1368
+ };
1369
+ }
1370
+
1371
+ const noOffsets = /*#__PURE__*/createCoords(0);
1372
+ function getVisualOffsets(element) {
1373
+ const win = getWindow(element);
1374
+ if (!isWebKit() || !win.visualViewport) {
1375
+ return noOffsets;
1376
+ }
1377
+ return {
1378
+ x: win.visualViewport.offsetLeft,
1379
+ y: win.visualViewport.offsetTop
1380
+ };
1381
+ }
1382
+ function shouldAddVisualOffsets(element, isFixed, floatingOffsetParent) {
1383
+ if (isFixed === void 0) {
1384
+ isFixed = false;
1385
+ }
1386
+ if (!floatingOffsetParent || isFixed && floatingOffsetParent !== getWindow(element)) {
1387
+ return false;
1388
+ }
1389
+ return isFixed;
1390
+ }
1391
+
1392
+ function getBoundingClientRect(element, includeScale, isFixedStrategy, offsetParent) {
1393
+ if (includeScale === void 0) {
1394
+ includeScale = false;
1395
+ }
1396
+ if (isFixedStrategy === void 0) {
1397
+ isFixedStrategy = false;
1398
+ }
1399
+ const clientRect = element.getBoundingClientRect();
1400
+ const domElement = unwrapElement(element);
1401
+ let scale = createCoords(1);
1402
+ if (includeScale) {
1403
+ if (offsetParent) {
1404
+ if (isElement(offsetParent)) {
1405
+ scale = getScale(offsetParent);
1406
+ }
1407
+ } else {
1408
+ scale = getScale(element);
1409
+ }
1410
+ }
1411
+ const visualOffsets = shouldAddVisualOffsets(domElement, isFixedStrategy, offsetParent) ? getVisualOffsets(domElement) : createCoords(0);
1412
+ let x = (clientRect.left + visualOffsets.x) / scale.x;
1413
+ let y = (clientRect.top + visualOffsets.y) / scale.y;
1414
+ let width = clientRect.width / scale.x;
1415
+ let height = clientRect.height / scale.y;
1416
+ if (domElement) {
1417
+ const win = getWindow(domElement);
1418
+ const offsetWin = offsetParent && isElement(offsetParent) ? getWindow(offsetParent) : offsetParent;
1419
+ let currentWin = win;
1420
+ let currentIFrame = getFrameElement(currentWin);
1421
+ while (currentIFrame && offsetParent && offsetWin !== currentWin) {
1422
+ const iframeScale = getScale(currentIFrame);
1423
+ const iframeRect = currentIFrame.getBoundingClientRect();
1424
+ const css = getComputedStyle(currentIFrame);
1425
+ const left = iframeRect.left + (currentIFrame.clientLeft + parseFloat(css.paddingLeft)) * iframeScale.x;
1426
+ const top = iframeRect.top + (currentIFrame.clientTop + parseFloat(css.paddingTop)) * iframeScale.y;
1427
+ x *= iframeScale.x;
1428
+ y *= iframeScale.y;
1429
+ width *= iframeScale.x;
1430
+ height *= iframeScale.y;
1431
+ x += left;
1432
+ y += top;
1433
+ currentWin = getWindow(currentIFrame);
1434
+ currentIFrame = getFrameElement(currentWin);
1435
+ }
1436
+ }
1437
+ return rectToClientRect({
1438
+ width,
1439
+ height,
1440
+ x,
1441
+ y
1442
+ });
1443
+ }
1444
+
1445
+ function convertOffsetParentRelativeRectToViewportRelativeRect(_ref) {
1446
+ let {
1447
+ elements,
1448
+ rect,
1449
+ offsetParent,
1450
+ strategy
1451
+ } = _ref;
1452
+ const isFixed = strategy === 'fixed';
1453
+ const documentElement = getDocumentElement(offsetParent);
1454
+ const topLayer = elements ? isTopLayer(elements.floating) : false;
1455
+ if (offsetParent === documentElement || topLayer && isFixed) {
1456
+ return rect;
1457
+ }
1458
+ let scroll = {
1459
+ scrollLeft: 0,
1460
+ scrollTop: 0
1461
+ };
1462
+ let scale = createCoords(1);
1463
+ const offsets = createCoords(0);
1464
+ const isOffsetParentAnElement = isHTMLElement(offsetParent);
1465
+ if (isOffsetParentAnElement || !isOffsetParentAnElement && !isFixed) {
1466
+ if (getNodeName(offsetParent) !== 'body' || isOverflowElement(documentElement)) {
1467
+ scroll = getNodeScroll(offsetParent);
1468
+ }
1469
+ if (isHTMLElement(offsetParent)) {
1470
+ const offsetRect = getBoundingClientRect(offsetParent);
1471
+ scale = getScale(offsetParent);
1472
+ offsets.x = offsetRect.x + offsetParent.clientLeft;
1473
+ offsets.y = offsetRect.y + offsetParent.clientTop;
1474
+ }
1475
+ }
1476
+ return {
1477
+ width: rect.width * scale.x,
1478
+ height: rect.height * scale.y,
1479
+ x: rect.x * scale.x - scroll.scrollLeft * scale.x + offsets.x,
1480
+ y: rect.y * scale.y - scroll.scrollTop * scale.y + offsets.y
1481
+ };
1482
+ }
1483
+
1484
+ function getClientRects(element) {
1485
+ return Array.from(element.getClientRects());
1486
+ }
1487
+
1488
+ // If <html> has a CSS width greater than the viewport, then this will be
1489
+ // incorrect for RTL.
1490
+ function getWindowScrollBarX(element, rect) {
1491
+ const leftScroll = getNodeScroll(element).scrollLeft;
1492
+ if (!rect) {
1493
+ return getBoundingClientRect(getDocumentElement(element)).left + leftScroll;
1494
+ }
1495
+ return rect.left + leftScroll;
1496
+ }
1497
+
1498
+ // Gets the entire size of the scrollable document area, even extending outside
1499
+ // of the `<html>` and `<body>` rect bounds if horizontally scrollable.
1500
+ function getDocumentRect(element) {
1501
+ const html = getDocumentElement(element);
1502
+ const scroll = getNodeScroll(element);
1503
+ const body = element.ownerDocument.body;
1504
+ const width = max(html.scrollWidth, html.clientWidth, body.scrollWidth, body.clientWidth);
1505
+ const height = max(html.scrollHeight, html.clientHeight, body.scrollHeight, body.clientHeight);
1506
+ let x = -scroll.scrollLeft + getWindowScrollBarX(element);
1507
+ const y = -scroll.scrollTop;
1508
+ if (getComputedStyle(body).direction === 'rtl') {
1509
+ x += max(html.clientWidth, body.clientWidth) - width;
1510
+ }
1511
+ return {
1512
+ width,
1513
+ height,
1514
+ x,
1515
+ y
1516
+ };
1517
+ }
1518
+
1519
+ function getViewportRect(element, strategy) {
1520
+ const win = getWindow(element);
1521
+ const html = getDocumentElement(element);
1522
+ const visualViewport = win.visualViewport;
1523
+ let width = html.clientWidth;
1524
+ let height = html.clientHeight;
1525
+ let x = 0;
1526
+ let y = 0;
1527
+ if (visualViewport) {
1528
+ width = visualViewport.width;
1529
+ height = visualViewport.height;
1530
+ const visualViewportBased = isWebKit();
1531
+ if (!visualViewportBased || visualViewportBased && strategy === 'fixed') {
1532
+ x = visualViewport.offsetLeft;
1533
+ y = visualViewport.offsetTop;
1534
+ }
1535
+ }
1536
+ return {
1537
+ width,
1538
+ height,
1539
+ x,
1540
+ y
1541
+ };
1542
+ }
1543
+
1544
+ // Returns the inner client rect, subtracting scrollbars if present.
1545
+ function getInnerBoundingClientRect(element, strategy) {
1546
+ const clientRect = getBoundingClientRect(element, true, strategy === 'fixed');
1547
+ const top = clientRect.top + element.clientTop;
1548
+ const left = clientRect.left + element.clientLeft;
1549
+ const scale = isHTMLElement(element) ? getScale(element) : createCoords(1);
1550
+ const width = element.clientWidth * scale.x;
1551
+ const height = element.clientHeight * scale.y;
1552
+ const x = left * scale.x;
1553
+ const y = top * scale.y;
1554
+ return {
1555
+ width,
1556
+ height,
1557
+ x,
1558
+ y
1559
+ };
1560
+ }
1561
+ function getClientRectFromClippingAncestor(element, clippingAncestor, strategy) {
1562
+ let rect;
1563
+ if (clippingAncestor === 'viewport') {
1564
+ rect = getViewportRect(element, strategy);
1565
+ } else if (clippingAncestor === 'document') {
1566
+ rect = getDocumentRect(getDocumentElement(element));
1567
+ } else if (isElement(clippingAncestor)) {
1568
+ rect = getInnerBoundingClientRect(clippingAncestor, strategy);
1569
+ } else {
1570
+ const visualOffsets = getVisualOffsets(element);
1571
+ rect = {
1572
+ ...clippingAncestor,
1573
+ x: clippingAncestor.x - visualOffsets.x,
1574
+ y: clippingAncestor.y - visualOffsets.y
1575
+ };
1576
+ }
1577
+ return rectToClientRect(rect);
1578
+ }
1579
+ function hasFixedPositionAncestor(element, stopNode) {
1580
+ const parentNode = getParentNode(element);
1581
+ if (parentNode === stopNode || !isElement(parentNode) || isLastTraversableNode(parentNode)) {
1582
+ return false;
1583
+ }
1584
+ return getComputedStyle(parentNode).position === 'fixed' || hasFixedPositionAncestor(parentNode, stopNode);
1585
+ }
1586
+
1587
+ // A "clipping ancestor" is an `overflow` element with the characteristic of
1588
+ // clipping (or hiding) child elements. This returns all clipping ancestors
1589
+ // of the given element up the tree.
1590
+ function getClippingElementAncestors(element, cache) {
1591
+ const cachedResult = cache.get(element);
1592
+ if (cachedResult) {
1593
+ return cachedResult;
1594
+ }
1595
+ let result = getOverflowAncestors(element, [], false).filter(el => isElement(el) && getNodeName(el) !== 'body');
1596
+ let currentContainingBlockComputedStyle = null;
1597
+ const elementIsFixed = getComputedStyle(element).position === 'fixed';
1598
+ let currentNode = elementIsFixed ? getParentNode(element) : element;
1599
+
1600
+ // https://developer.mozilla.org/en-US/docs/Web/CSS/Containing_block#identifying_the_containing_block
1601
+ while (isElement(currentNode) && !isLastTraversableNode(currentNode)) {
1602
+ const computedStyle = getComputedStyle(currentNode);
1603
+ const currentNodeIsContaining = isContainingBlock(currentNode);
1604
+ if (!currentNodeIsContaining && computedStyle.position === 'fixed') {
1605
+ currentContainingBlockComputedStyle = null;
1606
+ }
1607
+ const shouldDropCurrentNode = elementIsFixed ? !currentNodeIsContaining && !currentContainingBlockComputedStyle : !currentNodeIsContaining && computedStyle.position === 'static' && !!currentContainingBlockComputedStyle && ['absolute', 'fixed'].includes(currentContainingBlockComputedStyle.position) || isOverflowElement(currentNode) && !currentNodeIsContaining && hasFixedPositionAncestor(element, currentNode);
1608
+ if (shouldDropCurrentNode) {
1609
+ // Drop non-containing blocks.
1610
+ result = result.filter(ancestor => ancestor !== currentNode);
1611
+ } else {
1612
+ // Record last containing block for next iteration.
1613
+ currentContainingBlockComputedStyle = computedStyle;
1614
+ }
1615
+ currentNode = getParentNode(currentNode);
1616
+ }
1617
+ cache.set(element, result);
1618
+ return result;
1619
+ }
1620
+
1621
+ // Gets the maximum area that the element is visible in due to any number of
1622
+ // clipping ancestors.
1623
+ function getClippingRect(_ref) {
1624
+ let {
1625
+ element,
1626
+ boundary,
1627
+ rootBoundary,
1628
+ strategy
1629
+ } = _ref;
1630
+ const elementClippingAncestors = boundary === 'clippingAncestors' ? isTopLayer(element) ? [] : getClippingElementAncestors(element, this._c) : [].concat(boundary);
1631
+ const clippingAncestors = [...elementClippingAncestors, rootBoundary];
1632
+ const firstClippingAncestor = clippingAncestors[0];
1633
+ const clippingRect = clippingAncestors.reduce((accRect, clippingAncestor) => {
1634
+ const rect = getClientRectFromClippingAncestor(element, clippingAncestor, strategy);
1635
+ accRect.top = max(rect.top, accRect.top);
1636
+ accRect.right = min(rect.right, accRect.right);
1637
+ accRect.bottom = min(rect.bottom, accRect.bottom);
1638
+ accRect.left = max(rect.left, accRect.left);
1639
+ return accRect;
1640
+ }, getClientRectFromClippingAncestor(element, firstClippingAncestor, strategy));
1641
+ return {
1642
+ width: clippingRect.right - clippingRect.left,
1643
+ height: clippingRect.bottom - clippingRect.top,
1644
+ x: clippingRect.left,
1645
+ y: clippingRect.top
1646
+ };
1647
+ }
1648
+
1649
+ function getDimensions(element) {
1650
+ const {
1651
+ width,
1652
+ height
1653
+ } = getCssDimensions(element);
1654
+ return {
1655
+ width,
1656
+ height
1657
+ };
1658
+ }
1659
+
1660
+ function getRectRelativeToOffsetParent(element, offsetParent, strategy) {
1661
+ const isOffsetParentAnElement = isHTMLElement(offsetParent);
1662
+ const documentElement = getDocumentElement(offsetParent);
1663
+ const isFixed = strategy === 'fixed';
1664
+ const rect = getBoundingClientRect(element, true, isFixed, offsetParent);
1665
+ let scroll = {
1666
+ scrollLeft: 0,
1667
+ scrollTop: 0
1668
+ };
1669
+ const offsets = createCoords(0);
1670
+ if (isOffsetParentAnElement || !isOffsetParentAnElement && !isFixed) {
1671
+ if (getNodeName(offsetParent) !== 'body' || isOverflowElement(documentElement)) {
1672
+ scroll = getNodeScroll(offsetParent);
1673
+ }
1674
+ if (isOffsetParentAnElement) {
1675
+ const offsetRect = getBoundingClientRect(offsetParent, true, isFixed, offsetParent);
1676
+ offsets.x = offsetRect.x + offsetParent.clientLeft;
1677
+ offsets.y = offsetRect.y + offsetParent.clientTop;
1678
+ } else if (documentElement) {
1679
+ // If the <body> scrollbar appears on the left (e.g. RTL systems). Use
1680
+ // Firefox with layout.scrollbar.side = 3 in about:config to test this.
1681
+ offsets.x = getWindowScrollBarX(documentElement);
1682
+ }
1683
+ }
1684
+ let htmlX = 0;
1685
+ let htmlY = 0;
1686
+ if (documentElement && !isOffsetParentAnElement && !isFixed) {
1687
+ const htmlRect = documentElement.getBoundingClientRect();
1688
+ htmlY = htmlRect.top + scroll.scrollTop;
1689
+ htmlX = htmlRect.left + scroll.scrollLeft -
1690
+ // RTL <body> scrollbar.
1691
+ getWindowScrollBarX(documentElement, htmlRect);
1692
+ }
1693
+ const x = rect.left + scroll.scrollLeft - offsets.x - htmlX;
1694
+ const y = rect.top + scroll.scrollTop - offsets.y - htmlY;
1695
+ return {
1696
+ x,
1697
+ y,
1698
+ width: rect.width,
1699
+ height: rect.height
1700
+ };
1701
+ }
1702
+
1703
+ function isStaticPositioned(element) {
1704
+ return getComputedStyle(element).position === 'static';
1705
+ }
1706
+
1707
+ function getTrueOffsetParent(element, polyfill) {
1708
+ if (!isHTMLElement(element) || getComputedStyle(element).position === 'fixed') {
1709
+ return null;
1710
+ }
1711
+ if (polyfill) {
1712
+ return polyfill(element);
1713
+ }
1714
+ let rawOffsetParent = element.offsetParent;
1715
+
1716
+ // Firefox returns the <html> element as the offsetParent if it's non-static,
1717
+ // while Chrome and Safari return the <body> element. The <body> element must
1718
+ // be used to perform the correct calculations even if the <html> element is
1719
+ // non-static.
1720
+ if (getDocumentElement(element) === rawOffsetParent) {
1721
+ rawOffsetParent = rawOffsetParent.ownerDocument.body;
1722
+ }
1723
+ return rawOffsetParent;
1724
+ }
1725
+
1726
+ // Gets the closest ancestor positioned element. Handles some edge cases,
1727
+ // such as table ancestors and cross browser bugs.
1728
+ function getOffsetParent(element, polyfill) {
1729
+ const win = getWindow(element);
1730
+ if (isTopLayer(element)) {
1731
+ return win;
1732
+ }
1733
+ if (!isHTMLElement(element)) {
1734
+ let svgOffsetParent = getParentNode(element);
1735
+ while (svgOffsetParent && !isLastTraversableNode(svgOffsetParent)) {
1736
+ if (isElement(svgOffsetParent) && !isStaticPositioned(svgOffsetParent)) {
1737
+ return svgOffsetParent;
1738
+ }
1739
+ svgOffsetParent = getParentNode(svgOffsetParent);
1740
+ }
1741
+ return win;
1742
+ }
1743
+ let offsetParent = getTrueOffsetParent(element, polyfill);
1744
+ while (offsetParent && isTableElement(offsetParent) && isStaticPositioned(offsetParent)) {
1745
+ offsetParent = getTrueOffsetParent(offsetParent, polyfill);
1746
+ }
1747
+ if (offsetParent && isLastTraversableNode(offsetParent) && isStaticPositioned(offsetParent) && !isContainingBlock(offsetParent)) {
1748
+ return win;
1749
+ }
1750
+ return offsetParent || getContainingBlock(element) || win;
1751
+ }
1752
+
1753
+ const getElementRects = async function (data) {
1754
+ const getOffsetParentFn = this.getOffsetParent || getOffsetParent;
1755
+ const getDimensionsFn = this.getDimensions;
1756
+ const floatingDimensions = await getDimensionsFn(data.floating);
1757
+ return {
1758
+ reference: getRectRelativeToOffsetParent(data.reference, await getOffsetParentFn(data.floating), data.strategy),
1759
+ floating: {
1760
+ x: 0,
1761
+ y: 0,
1762
+ width: floatingDimensions.width,
1763
+ height: floatingDimensions.height
1764
+ }
1765
+ };
1766
+ };
1767
+
1768
+ function isRTL(element) {
1769
+ return getComputedStyle(element).direction === 'rtl';
1770
+ }
1771
+
1772
+ const platform = {
1773
+ convertOffsetParentRelativeRectToViewportRelativeRect,
1774
+ getDocumentElement,
1775
+ getClippingRect,
1776
+ getOffsetParent,
1777
+ getElementRects,
1778
+ getClientRects,
1779
+ getDimensions,
1780
+ getScale,
1781
+ isElement,
1782
+ isRTL
1783
+ };
1784
+
1785
+ /**
1786
+ * Modifies the placement by translating the floating element along the
1787
+ * specified axes.
1788
+ * A number (shorthand for `mainAxis` or distance), or an axes configuration
1789
+ * object may be passed.
1790
+ * @see https://floating-ui.com/docs/offset
1791
+ */
1792
+ const offset = offset$1;
1793
+
1794
+ /**
1795
+ * Optimizes the visibility of the floating element by choosing the placement
1796
+ * that has the most space available automatically, without needing to specify a
1797
+ * preferred placement. Alternative to `flip`.
1798
+ * @see https://floating-ui.com/docs/autoPlacement
1799
+ */
1800
+ autoPlacement;
1801
+
1802
+ /**
1803
+ * Optimizes the visibility of the floating element by shifting it in order to
1804
+ * keep it in view when it will overflow the clipping boundary.
1805
+ * @see https://floating-ui.com/docs/shift
1806
+ */
1807
+ const shift = shift$1;
1808
+
1809
+ /**
1810
+ * Optimizes the visibility of the floating element by flipping the `placement`
1811
+ * in order to keep it in view when the preferred placement(s) will overflow the
1812
+ * clipping boundary. Alternative to `autoPlacement`.
1813
+ * @see https://floating-ui.com/docs/flip
1814
+ */
1815
+ const flip = flip$1;
1816
+
1817
+ /**
1818
+ * Provides data that allows you to change the size of the floating element —
1819
+ * for instance, prevent it from overflowing the clipping boundary or match the
1820
+ * width of the reference element.
1821
+ * @see https://floating-ui.com/docs/size
1822
+ */
1823
+ size;
1824
+
1825
+ /**
1826
+ * Provides data to hide the floating element in applicable situations, such as
1827
+ * when it is not in the same clipping context as the reference element.
1828
+ * @see https://floating-ui.com/docs/hide
1829
+ */
1830
+ hide;
1831
+
1832
+ /**
1833
+ * Provides data to position an inner element of the floating element so that it
1834
+ * appears centered to the reference element.
1835
+ * @see https://floating-ui.com/docs/arrow
1836
+ */
1837
+ const arrow = arrow$1;
1838
+
1839
+ /**
1840
+ * Provides improved positioning for inline reference elements that can span
1841
+ * over multiple lines, such as hyperlinks or range selections.
1842
+ * @see https://floating-ui.com/docs/inline
1843
+ */
1844
+ inline;
1845
+
1846
+ /**
1847
+ * Built-in `limiter` that will stop `shift()` at a certain point.
1848
+ */
1849
+ limitShift;
1850
+
1851
+ /**
1852
+ * Computes the `x` and `y` coordinates that will place the floating element
1853
+ * next to a given reference element.
1854
+ */
1855
+ const computePosition = (reference, floating, options) => {
1856
+ // This caches the expensive `getClippingElementAncestors` function so that
1857
+ // multiple lifecycle resets re-use the same result. It only lives for a
1858
+ // single call. If other functions become expensive, we can add them as well.
1859
+ const cache = new Map();
1860
+ const mergedOptions = {
1861
+ platform,
1862
+ ...options
1863
+ };
1864
+ const platformWithCache = {
1865
+ ...mergedOptions.platform,
1866
+ _c: cache
1867
+ };
1868
+ return computePosition$1(reference, floating, {
1869
+ ...mergedOptions,
1870
+ platform: platformWithCache
1871
+ });
1872
+ };
1873
+
1874
+ const appendToMap = (map, propName, value) => {
1875
+ const items = map.get(propName);
1876
+ if (!items) {
1877
+ map.set(propName, [value]);
1878
+ }
1879
+ else if (!items.includes(value)) {
1880
+ items.push(value);
1881
+ }
1882
+ };
1883
+ const debounce = (fn, ms) => {
1884
+ let timeoutId;
1885
+ return (...args) => {
1886
+ if (timeoutId) {
1887
+ clearTimeout(timeoutId);
1888
+ }
1889
+ timeoutId = setTimeout(() => {
1890
+ timeoutId = 0;
1891
+ fn(...args);
1892
+ }, ms);
1893
+ };
1894
+ };
1895
+
1896
+ /**
1897
+ * Check if a possible element isConnected.
1898
+ * The property might not be there, so we check for it.
1899
+ *
1900
+ * We want it to return true if isConnected is not a property,
1901
+ * otherwise we would remove these elements and would not update.
1902
+ *
1903
+ * Better leak in Edge than to be useless.
1904
+ */
1905
+ const isConnected = (maybeElement) => !('isConnected' in maybeElement) || maybeElement.isConnected;
1906
+ const cleanupElements = debounce((map) => {
1907
+ for (let key of map.keys()) {
1908
+ map.set(key, map.get(key).filter(isConnected));
1909
+ }
1910
+ }, 2000);
1911
+ const stencilSubscription = () => {
1912
+ if (typeof index.getRenderingRef !== 'function') {
1913
+ // If we are not in a stencil project, we do nothing.
1914
+ // This function is not really exported by @stencil/core.
1915
+ return {};
1916
+ }
1917
+ const elmsToUpdate = new Map();
1918
+ return {
1919
+ dispose: () => elmsToUpdate.clear(),
1920
+ get: (propName) => {
1921
+ const elm = index.getRenderingRef();
1922
+ if (elm) {
1923
+ appendToMap(elmsToUpdate, propName, elm);
1924
+ }
1925
+ },
1926
+ set: (propName) => {
1927
+ const elements = elmsToUpdate.get(propName);
1928
+ if (elements) {
1929
+ elmsToUpdate.set(propName, elements.filter(index.forceUpdate));
1930
+ }
1931
+ cleanupElements(elmsToUpdate);
1932
+ },
1933
+ reset: () => {
1934
+ elmsToUpdate.forEach((elms) => elms.forEach(index.forceUpdate));
1935
+ cleanupElements(elmsToUpdate);
1936
+ },
1937
+ };
1938
+ };
1939
+
1940
+ const unwrap = (val) => (typeof val === 'function' ? val() : val);
1941
+ const createObservableMap = (defaultState, shouldUpdate = (a, b) => a !== b) => {
1942
+ const unwrappedState = unwrap(defaultState);
1943
+ let states = new Map(Object.entries(unwrappedState !== null && unwrappedState !== void 0 ? unwrappedState : {}));
1944
+ const handlers = {
1945
+ dispose: [],
1946
+ get: [],
1947
+ set: [],
1948
+ reset: [],
1949
+ };
1950
+ const reset = () => {
1951
+ var _a;
1952
+ // When resetting the state, the default state may be a function - unwrap it to invoke it.
1953
+ // otherwise, the state won't be properly reset
1954
+ states = new Map(Object.entries((_a = unwrap(defaultState)) !== null && _a !== void 0 ? _a : {}));
1955
+ handlers.reset.forEach((cb) => cb());
1956
+ };
1957
+ const dispose = () => {
1958
+ // Call first dispose as resetting the state would
1959
+ // cause less updates ;)
1960
+ handlers.dispose.forEach((cb) => cb());
1961
+ reset();
1962
+ };
1963
+ const get = (propName) => {
1964
+ handlers.get.forEach((cb) => cb(propName));
1965
+ return states.get(propName);
1966
+ };
1967
+ const set = (propName, value) => {
1968
+ const oldValue = states.get(propName);
1969
+ if (shouldUpdate(value, oldValue, propName)) {
1970
+ states.set(propName, value);
1971
+ handlers.set.forEach((cb) => cb(propName, value, oldValue));
1972
+ }
1973
+ };
1974
+ const state = (typeof Proxy === 'undefined'
1975
+ ? {}
1976
+ : new Proxy(unwrappedState, {
1977
+ get(_, propName) {
1978
+ return get(propName);
1979
+ },
1980
+ ownKeys(_) {
1981
+ return Array.from(states.keys());
1982
+ },
1983
+ getOwnPropertyDescriptor() {
1984
+ return {
1985
+ enumerable: true,
1986
+ configurable: true,
1987
+ };
1988
+ },
1989
+ has(_, propName) {
1990
+ return states.has(propName);
1991
+ },
1992
+ set(_, propName, value) {
1993
+ set(propName, value);
1994
+ return true;
1995
+ },
1996
+ }));
1997
+ const on = (eventName, callback) => {
1998
+ handlers[eventName].push(callback);
1999
+ return () => {
2000
+ removeFromArray(handlers[eventName], callback);
2001
+ };
2002
+ };
2003
+ const onChange = (propName, cb) => {
2004
+ const unSet = on('set', (key, newValue) => {
2005
+ if (key === propName) {
2006
+ cb(newValue);
2007
+ }
2008
+ });
2009
+ // We need to unwrap the defaultState because it might be a function.
2010
+ // Otherwise we might not be sending the right reset value.
2011
+ const unReset = on('reset', () => cb(unwrap(defaultState)[propName]));
2012
+ return () => {
2013
+ unSet();
2014
+ unReset();
2015
+ };
2016
+ };
2017
+ const use = (...subscriptions) => {
2018
+ const unsubs = subscriptions.reduce((unsubs, subscription) => {
2019
+ if (subscription.set) {
2020
+ unsubs.push(on('set', subscription.set));
2021
+ }
2022
+ if (subscription.get) {
2023
+ unsubs.push(on('get', subscription.get));
2024
+ }
2025
+ if (subscription.reset) {
2026
+ unsubs.push(on('reset', subscription.reset));
2027
+ }
2028
+ if (subscription.dispose) {
2029
+ unsubs.push(on('dispose', subscription.dispose));
2030
+ }
2031
+ return unsubs;
2032
+ }, []);
2033
+ return () => unsubs.forEach((unsub) => unsub());
2034
+ };
2035
+ const forceUpdate = (key) => {
2036
+ const oldValue = states.get(key);
2037
+ handlers.set.forEach((cb) => cb(key, oldValue, oldValue));
2038
+ };
2039
+ return {
2040
+ state,
2041
+ get,
2042
+ set,
2043
+ on,
2044
+ onChange,
2045
+ use,
2046
+ dispose,
2047
+ reset,
2048
+ forceUpdate,
2049
+ };
2050
+ };
2051
+ const removeFromArray = (array, item) => {
2052
+ const index = array.indexOf(item);
2053
+ if (index >= 0) {
2054
+ array[index] = array[array.length - 1];
2055
+ array.length--;
2056
+ }
2057
+ };
2058
+
2059
+ const createStore = (defaultState, shouldUpdate) => {
2060
+ const map = createObservableMap(defaultState, shouldUpdate);
2061
+ map.use(stencilSubscription());
2062
+ return map;
2063
+ };
2064
+
2065
+ const nvPopoverCss = "nv-popover{display:inline-block;position:relative}nv-popover:has([fluid]:not([fluid=false])){display:block}nv-popover [data-scope=popover]{width:max-content;background-color:var(--components-popover-background);border-color:var(--components-popover-border);font-weight:var(--font-weight-medium-emphasis);border-width:1px;border-style:solid;border-radius:var(--popover-radius);padding:var(--popover-padding-y) var(--popover-padding-x);position:absolute;top:0;left:0;z-index:1;box-shadow:var(--popover-shadow-1-x) var(--popover-shadow-1-y) var(--popover-shadow-1-blur) -2px var(--popover-shadow-1-opacity), var(--popover-shadow-2-x) var(--popover-shadow-2-y) var(--popover-shadow-2-blur) var(--shadow-spread-lg-2) var(--popover-shadow-2-opacity)}nv-popover [data-scope=arrow]{background-color:var(--components-popover-background);position:absolute;border-color:var(--components-popover-border);border-width:1px;border-style:solid;border-bottom-color:transparent;border-right-color:transparent;width:8px;height:8px;transform:rotate(45deg);border-radius:1px}nv-popover [slot=content]{position:relative;z-index:1}nv-popover slot-fb{display:none}";
2066
+ const NvPopoverStyle0 = nvPopoverCss;
2067
+
2068
+ const { state } = createStore({
2069
+ groups: new Map(),
2070
+ });
2071
+ const NvPopover = class {
2072
+ constructor(hostRef) {
2073
+ index.registerInstance(this, hostRef);
2074
+ this.openChanged = index.createEvent(this, "openChanged", 7);
2075
+ this.handleClickOutside = (event) => {
2076
+ // This popover should close when the user clicks outside of it.
2077
+ if (this.el.contains(event.target))
2078
+ return;
2079
+ if (this.triggerElement.contains(event.target))
2080
+ return;
2081
+ this.hide();
2082
+ };
2083
+ this.clickEvents = [
2084
+ ['click', this.toggle],
2085
+ ['touchstart', this.toggle],
2086
+ [
2087
+ 'keydown',
2088
+ (e) => {
2089
+ if (e.key === 'Enter' || e.key === ' ') {
2090
+ e.preventDefault();
2091
+ this.toggle();
2092
+ }
2093
+ },
2094
+ ],
2095
+ ];
2096
+ this.hoverEvents = [
2097
+ [
2098
+ 'focus',
2099
+ () => {
2100
+ clearTimeout(this.hideTimeout);
2101
+ this.showTimeout = setTimeout(() => this.show(), this.enterDelay);
2102
+ },
2103
+ ],
2104
+ [
2105
+ 'blur',
2106
+ () => {
2107
+ clearTimeout(this.showTimeout);
2108
+ this.hideTimeout = setTimeout(() => this.hide(), 50);
2109
+ },
2110
+ ],
2111
+ [
2112
+ 'mouseenter',
2113
+ () => {
2114
+ clearTimeout(this.hideTimeout);
2115
+ this.showTimeout = setTimeout(() => this.show(), this.enterDelay);
2116
+ },
2117
+ ],
2118
+ [
2119
+ 'mouseleave',
2120
+ () => {
2121
+ clearTimeout(this.showTimeout);
2122
+ this.hideTimeout = setTimeout(() => this.hide(), 100);
2123
+ },
2124
+ ],
2125
+ ];
2126
+ this.closeEvents = [
2127
+ [
2128
+ 'keydown',
2129
+ (e) => {
2130
+ if (e.key === 'Escape') {
2131
+ this.hide();
2132
+ }
2133
+ },
2134
+ ],
2135
+ ];
2136
+ //#endregion EVENTS
2137
+ /****************************************************************************/
2138
+ //#region WATCHERS
2139
+ this.isAnimating = false;
2140
+ this.triggerElement = undefined;
2141
+ this.open = false;
2142
+ this.triggerMode = 'click';
2143
+ this.placement = 'bottom';
2144
+ this.groupName = undefined;
2145
+ this.offset = 12;
2146
+ this.hasArrow = false;
2147
+ this.disableFlip = false;
2148
+ this.shiftPadding = 16;
2149
+ this.enterDelay = 0;
2150
+ this.nested = false;
2151
+ }
2152
+ //#endregion PROPERTIES
2153
+ /****************************************************************************/
2154
+ //#region METHODS
2155
+ /**
2156
+ * Call this method to show the popover, making it visible on the screen.
2157
+ */
2158
+ async show() {
2159
+ this.open = true;
2160
+ }
2161
+ /**
2162
+ * Use this method to hide the popover, making it disappear from view.
2163
+ */
2164
+ async hide() {
2165
+ this.open = false;
2166
+ }
2167
+ /**
2168
+ * Call this method to toggle between showing and hiding the popover, based on
2169
+ * its current state.
2170
+ */
2171
+ async toggle() {
2172
+ this.open = !this.open;
2173
+ }
2174
+ /**
2175
+ * Calculates the position of the popover relative to the trigger.
2176
+ * @docs https://floating-ui.com/docs/computePosition
2177
+ */
2178
+ positionPopover() {
2179
+ if (!this.triggerElement)
2180
+ return;
2181
+ computePosition(this.triggerElement, this.popoverElement, {
2182
+ placement: this.placement,
2183
+ middleware: [
2184
+ offset(this.offset),
2185
+ !this.disableFlip &&
2186
+ flip({
2187
+ fallbackStrategy: 'bestFit',
2188
+ crossAxis: true,
2189
+ fallbackPlacements: ['bottom'],
2190
+ }),
2191
+ shift({ padding: this.shiftPadding }),
2192
+ this.hasArrow && arrow({ element: this.arrowElement }),
2193
+ ],
2194
+ }).then(({ x, y, placement, middlewareData }) => {
2195
+ Object.assign(this.popoverElement.style, {
2196
+ left: `${x}px`,
2197
+ top: `${y}px`,
2198
+ });
2199
+ if (this.hasArrow) {
2200
+ const staticSide = {
2201
+ top: 'bottom',
2202
+ right: 'left',
2203
+ bottom: 'top',
2204
+ left: 'right',
2205
+ }[placement.split('-')[0]];
2206
+ const transform = {
2207
+ top: 'rotate(225deg)',
2208
+ right: 'rotate(315deg)',
2209
+ bottom: 'rotate(45deg)',
2210
+ left: 'rotate(135deg)',
2211
+ }[placement.split('-')[0]];
2212
+ const { x: arrowX, y: arrowY } = middlewareData.arrow;
2213
+ Object.assign(this.arrowElement.style, {
2214
+ left: arrowX != null ? `${arrowX}px` : '',
2215
+ top: arrowY != null ? `${arrowY}px` : '',
2216
+ right: '',
2217
+ bottom: '',
2218
+ transform,
2219
+ [staticSide]: '-4px',
2220
+ });
2221
+ }
2222
+ });
2223
+ }
2224
+ handleOpenChanged(event) {
2225
+ var _a;
2226
+ if (this.triggerMode === 'controlled')
2227
+ return;
2228
+ if (this.nested)
2229
+ return;
2230
+ if ((_a = event.target) === null || _a === void 0 ? void 0 : _a.hasAttribute('nested'))
2231
+ return;
2232
+ // This popover should close when another one is opened.
2233
+ if (event.target !== this.el && event.detail === true)
2234
+ this.hide();
2235
+ }
2236
+ handleDocumentClick(event) {
2237
+ if (this.triggerMode === 'controlled')
2238
+ return;
2239
+ this.handleClickOutside(event);
2240
+ }
2241
+ handleDocumentTouch(event) {
2242
+ if (this.triggerMode === 'controlled')
2243
+ return;
2244
+ this.handleClickOutside(event);
2245
+ }
2246
+ async handleOpenChange(open) {
2247
+ // Prevent multiple animations from running at the same time.
2248
+ while (this.isAnimating) {
2249
+ await new Promise(resolve => setTimeout(resolve, 50));
2250
+ }
2251
+ this.isAnimating = true;
2252
+ const group = state.groups.get(this.groupName);
2253
+ const isOtherMemberOpen = group && group.openedBy !== this.el;
2254
+ const isThisMemberOpen = group && group.openedBy === this.el;
2255
+ if (open)
2256
+ this.popoverElement.style.removeProperty('display');
2257
+ if (isThisMemberOpen && !open)
2258
+ state.groups.delete(this.groupName);
2259
+ if (this.groupName && open)
2260
+ state.groups.set(this.groupName, { openedBy: this.el });
2261
+ const { growIn } = grow_animation.useGrow(this.popoverElement, {
2262
+ duration: isOtherMemberOpen ? 0 : 100,
2263
+ amount: 0.85,
2264
+ });
2265
+ const { fadeOut } = fade_animation.useFade(this.popoverElement, {
2266
+ duration: isOtherMemberOpen ? 0 : 100,
2267
+ });
2268
+ if (open === true) {
2269
+ this.popoverElement.removeAttribute('hidden');
2270
+ this.positionPopover();
2271
+ await growIn();
2272
+ }
2273
+ if (open === false) {
2274
+ await fadeOut();
2275
+ this.popoverElement.setAttribute('hidden', '');
2276
+ }
2277
+ this.isAnimating = false;
2278
+ this.openChanged.emit(open);
2279
+ }
2280
+ //#endregion WATCHERS
2281
+ /****************************************************************************/
2282
+ //#region LIFECYCLE
2283
+ componentWillLoad() {
2284
+ if (!this.triggerElement)
2285
+ this.triggerElement = Array.from(this.el.children).find(child => child.getAttribute('slot') === 'trigger');
2286
+ }
2287
+ componentDidLoad() {
2288
+ // Initial inline style setup
2289
+ if (!this.open) {
2290
+ const { setGrowOut } = grow_animation.useGrow(this.popoverElement);
2291
+ setGrowOut();
2292
+ }
2293
+ else {
2294
+ const { setFadeIn } = fade_animation.useFade(this.popoverElement);
2295
+ setFadeIn();
2296
+ this.popoverElement.removeAttribute('hidden');
2297
+ }
2298
+ this.positionPopover();
2299
+ grow_animation.addEventListeners(this.closeEvents, document, this);
2300
+ if (this.triggerMode === 'click')
2301
+ grow_animation.addEventListeners(this.clickEvents, this.triggerElement, this);
2302
+ if (this.triggerMode === 'hover')
2303
+ grow_animation.addEventListeners(this.hoverEvents, this.triggerElement, this);
2304
+ }
2305
+ disconnectedCallback() {
2306
+ grow_animation.removeEventListeners(this.closeEvents, document, this);
2307
+ if (this.triggerMode === 'click')
2308
+ grow_animation.removeEventListeners(this.clickEvents, this.triggerElement, this);
2309
+ if (this.triggerMode === 'hover')
2310
+ grow_animation.removeEventListeners(this.hoverEvents, this.triggerElement, this);
2311
+ }
2312
+ //#endregion LIFECYCLE
2313
+ /****************************************************************************/
2314
+ //#region RENDER
2315
+ render() {
2316
+ return (index.h(index.Host, { key: '8d32b4cb618de8d8c88e813b5cb446eb4e667f27' }, index.h("slot", { key: 'bb4688a7ed334a32c1033c340d765e5abc8aef4a', name: "trigger" }), index.h("div", { key: '2e3847dd205be87742f3794f806ed1d903d88f14', "data-scope": "popover", hidden: true, ref: el => (this.popoverElement = el) }, this.hasArrow && (index.h("div", { key: '8259476267d3c14043c649b95d875452909e1e08', "data-scope": "arrow", ref: el => (this.arrowElement = el) })), index.h("slot", { key: 'e6d68d89876b7353c0abd349b7c3bc1bfe790a76', name: "content" }))));
2317
+ }
2318
+ get el() { return index.getElement(this); }
2319
+ static get watchers() { return {
2320
+ "open": ["handleOpenChange"]
2321
+ }; }
2322
+ };
2323
+ NvPopover.style = NvPopoverStyle0;
2324
+
2325
+ exports.nv_popover = NvPopover;
2326
+
2327
+ //# sourceMappingURL=nv-popover.cjs.entry.js.map