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