bromcom-ui-next 0.1.30 → 0.1.31

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 (546) hide show
  1. package/dist/bromcom-ui/bcm-accordion-group.entry.esm.js.map +1 -1
  2. package/dist/bromcom-ui/bcm-accordion.entry.esm.js.map +1 -1
  3. package/dist/bromcom-ui/bcm-alert.entry.esm.js.map +1 -1
  4. package/dist/bromcom-ui/bcm-avatar.entry.esm.js.map +1 -1
  5. package/dist/bromcom-ui/bcm-badge.entry.esm.js.map +1 -1
  6. package/dist/bromcom-ui/bcm-basic-badge.entry.esm.js.map +1 -1
  7. package/dist/bromcom-ui/bcm-button-group.entry.esm.js.map +1 -1
  8. package/dist/bromcom-ui/bcm-button.entry.esm.js.map +1 -0
  9. package/dist/bromcom-ui/bcm-checkbox.entry.esm.js.map +1 -1
  10. package/dist/bromcom-ui/bcm-chip.entry.esm.js.map +1 -1
  11. package/dist/bromcom-ui/bcm-divider.entry.esm.js.map +1 -1
  12. package/dist/bromcom-ui/bcm-drawer.entry.esm.js.map +1 -0
  13. package/dist/bromcom-ui/bcm-dropdown-item.entry.esm.js.map +1 -1
  14. package/dist/bromcom-ui/bcm-dropdown.entry.esm.js.map +1 -1
  15. package/dist/bromcom-ui/bcm-file-upload.entry.esm.js.map +1 -0
  16. package/dist/bromcom-ui/bcm-input.entry.esm.js.map +1 -1
  17. package/dist/bromcom-ui/bcm-linked.entry.esm.js.map +1 -0
  18. package/dist/bromcom-ui/bcm-modal.entry.esm.js.map +1 -0
  19. package/dist/bromcom-ui/bcm-pop-confirm.entry.esm.js.map +1 -0
  20. package/dist/bromcom-ui/bcm-popover.entry.esm.js.map +1 -0
  21. package/dist/bromcom-ui/bcm-radio-group.entry.esm.js.map +1 -1
  22. package/dist/bromcom-ui/bcm-radio.entry.esm.js.map +1 -1
  23. package/dist/bromcom-ui/bcm-segment.bcm-segmented-picker.entry.esm.js.map +1 -0
  24. package/dist/bromcom-ui/bcm-shortcut.entry.esm.js.map +1 -1
  25. package/dist/bromcom-ui/bcm-switch.entry.esm.js.map +1 -1
  26. package/dist/bromcom-ui/bcm-tab.entry.esm.js.map +1 -0
  27. package/dist/bromcom-ui/bcm-tabs.entry.esm.js.map +1 -1
  28. package/dist/bromcom-ui/bcm-text.entry.esm.js.map +1 -1
  29. package/dist/bromcom-ui/bcm-textarea.entry.esm.js.map +1 -1
  30. package/dist/bromcom-ui/bcm-tooltip.entry.esm.js.map +1 -0
  31. package/dist/bromcom-ui/bromcom-ui.esm.js +1 -1
  32. package/dist/bromcom-ui/global/global.js +33 -30
  33. package/dist/bromcom-ui/p-010219cf.entry.js +2 -0
  34. package/dist/bromcom-ui/p-010219cf.entry.js.map +1 -0
  35. package/dist/bromcom-ui/p-01a4e00b.entry.js +2 -0
  36. package/dist/bromcom-ui/p-01a4e00b.entry.js.map +1 -0
  37. package/dist/bromcom-ui/p-14c63d61.entry.js +2 -0
  38. package/dist/bromcom-ui/p-14c63d61.entry.js.map +1 -0
  39. package/dist/bromcom-ui/p-20a94dec.entry.js +2 -0
  40. package/dist/bromcom-ui/p-20a94dec.entry.js.map +1 -0
  41. package/dist/bromcom-ui/p-398620c2.entry.js +2 -0
  42. package/dist/bromcom-ui/p-398620c2.entry.js.map +1 -0
  43. package/dist/bromcom-ui/p-3b898f90.entry.js +2 -0
  44. package/dist/bromcom-ui/p-3b898f90.entry.js.map +1 -0
  45. package/dist/bromcom-ui/p-43c85c84.entry.js +2 -0
  46. package/dist/bromcom-ui/p-43c85c84.entry.js.map +1 -0
  47. package/dist/bromcom-ui/p-4e6661a5.entry.js +2 -0
  48. package/dist/bromcom-ui/p-4e6661a5.entry.js.map +1 -0
  49. package/dist/bromcom-ui/p-52bb0cdc.entry.js +2 -0
  50. package/dist/bromcom-ui/p-52bb0cdc.entry.js.map +1 -0
  51. package/dist/bromcom-ui/p-61c1c1c8.entry.js +2 -0
  52. package/dist/bromcom-ui/p-61c1c1c8.entry.js.map +1 -0
  53. package/dist/bromcom-ui/p-82e4c5f2.entry.js +2 -0
  54. package/dist/bromcom-ui/p-82e4c5f2.entry.js.map +1 -0
  55. package/dist/bromcom-ui/p-86f85963.entry.js +2 -0
  56. package/dist/bromcom-ui/p-86f85963.entry.js.map +1 -0
  57. package/dist/bromcom-ui/p-9249c1d1.entry.js +2 -0
  58. package/dist/bromcom-ui/p-9249c1d1.entry.js.map +1 -0
  59. package/dist/bromcom-ui/p-B6Ppbs5O.js +3 -0
  60. package/dist/bromcom-ui/p-B6Ppbs5O.js.map +1 -0
  61. package/dist/bromcom-ui/p-DBDSgIvP.js +2 -0
  62. package/dist/bromcom-ui/p-DBDSgIvP.js.map +1 -0
  63. package/dist/bromcom-ui/p-DaE0ZLar.js +2 -0
  64. package/dist/bromcom-ui/p-DaE0ZLar.js.map +1 -0
  65. package/dist/bromcom-ui/p-a25d1cef.entry.js +2 -0
  66. package/dist/bromcom-ui/p-a25d1cef.entry.js.map +1 -0
  67. package/dist/bromcom-ui/p-a4cb2e79.entry.js +2 -0
  68. package/dist/bromcom-ui/p-a4cb2e79.entry.js.map +1 -0
  69. package/dist/bromcom-ui/p-a68925b4.entry.js +2 -0
  70. package/dist/bromcom-ui/p-a68925b4.entry.js.map +1 -0
  71. package/dist/bromcom-ui/p-a750186c.entry.js +2 -0
  72. package/dist/bromcom-ui/p-a750186c.entry.js.map +1 -0
  73. package/dist/bromcom-ui/p-ac768b56.entry.js +2 -0
  74. package/dist/bromcom-ui/p-ac768b56.entry.js.map +1 -0
  75. package/dist/bromcom-ui/p-b0b193e6.entry.js +2 -0
  76. package/dist/bromcom-ui/p-b0b193e6.entry.js.map +1 -0
  77. package/dist/bromcom-ui/p-bf4409ca.entry.js +2 -0
  78. package/dist/bromcom-ui/p-bf4409ca.entry.js.map +1 -0
  79. package/dist/bromcom-ui/p-c57fb29b.entry.js +2 -0
  80. package/dist/bromcom-ui/p-c57fb29b.entry.js.map +1 -0
  81. package/dist/bromcom-ui/{p-1507908f.entry.js → p-ccc310aa.entry.js} +2 -2
  82. package/dist/bromcom-ui/p-ccc310aa.entry.js.map +1 -0
  83. package/dist/bromcom-ui/p-d4ee962d.entry.js +2 -0
  84. package/dist/bromcom-ui/p-d4ee962d.entry.js.map +1 -0
  85. package/dist/bromcom-ui/p-e25a2f7a.entry.js +2 -0
  86. package/dist/bromcom-ui/p-e25a2f7a.entry.js.map +1 -0
  87. package/dist/bromcom-ui/p-e5b0b2ad.entry.js +2 -0
  88. package/dist/bromcom-ui/p-e5b0b2ad.entry.js.map +1 -0
  89. package/dist/bromcom-ui/p-e70d784d.entry.js +2 -0
  90. package/dist/bromcom-ui/p-e70d784d.entry.js.map +1 -0
  91. package/dist/bromcom-ui/p-e9fa3a22.entry.js +2 -0
  92. package/dist/bromcom-ui/p-e9fa3a22.entry.js.map +1 -0
  93. package/dist/bromcom-ui/p-ef281184.entry.js +2 -0
  94. package/dist/bromcom-ui/p-ef281184.entry.js.map +1 -0
  95. package/dist/bromcom-ui/{p-496014ca.entry.js → p-fb6f616c.entry.js} +2 -2
  96. package/dist/bromcom-ui/p-fb6f616c.entry.js.map +1 -0
  97. package/dist/bromcom-ui/p-fd31c70c.entry.js +2 -0
  98. package/dist/bromcom-ui/p-fd31c70c.entry.js.map +1 -0
  99. package/dist/bromcom-ui/p-nf_HKsGq.js +2 -0
  100. package/dist/bromcom-ui/{p-CUvT12BL.js.map → p-nf_HKsGq.js.map} +1 -1
  101. package/dist/cjs/base-choice-control-EmA4JRjR.js +54 -0
  102. package/dist/cjs/base-choice-control-EmA4JRjR.js.map +1 -0
  103. package/dist/cjs/bcm-accordion-group.cjs.entry.js +20 -18
  104. package/dist/cjs/bcm-accordion-group.entry.cjs.js.map +1 -1
  105. package/dist/cjs/bcm-accordion.cjs.entry.js +73 -56
  106. package/dist/cjs/bcm-accordion.entry.cjs.js.map +1 -1
  107. package/dist/cjs/bcm-alert.cjs.entry.js +21 -21
  108. package/dist/cjs/bcm-alert.entry.cjs.js.map +1 -1
  109. package/dist/cjs/bcm-avatar.cjs.entry.js +22 -12
  110. package/dist/cjs/bcm-avatar.entry.cjs.js.map +1 -1
  111. package/dist/cjs/bcm-badge.cjs.entry.js +114 -82
  112. package/dist/cjs/bcm-badge.entry.cjs.js.map +1 -1
  113. package/dist/cjs/bcm-basic-badge.cjs.entry.js +73 -59
  114. package/dist/cjs/bcm-basic-badge.entry.cjs.js.map +1 -1
  115. package/dist/cjs/bcm-button-group.cjs.entry.js +36 -24
  116. package/dist/cjs/bcm-button-group.entry.cjs.js.map +1 -1
  117. package/dist/cjs/bcm-button.cjs.entry.js +338 -0
  118. package/dist/cjs/bcm-button.entry.cjs.js.map +1 -0
  119. package/dist/cjs/bcm-checkbox.cjs.entry.js +284 -174
  120. package/dist/cjs/bcm-checkbox.entry.cjs.js.map +1 -1
  121. package/dist/cjs/bcm-chip.cjs.entry.js +38 -35
  122. package/dist/cjs/bcm-chip.entry.cjs.js.map +1 -1
  123. package/dist/cjs/bcm-divider.cjs.entry.js +55 -55
  124. package/dist/cjs/bcm-divider.entry.cjs.js.map +1 -1
  125. package/dist/cjs/bcm-drawer.cjs.entry.js +332 -0
  126. package/dist/cjs/bcm-drawer.entry.cjs.js.map +1 -0
  127. package/dist/cjs/bcm-dropdown-item.cjs.entry.js +36 -33
  128. package/dist/cjs/bcm-dropdown-item.entry.cjs.js.map +1 -1
  129. package/dist/cjs/bcm-dropdown.cjs.entry.js +18 -17
  130. package/dist/cjs/bcm-dropdown.entry.cjs.js.map +1 -1
  131. package/dist/cjs/bcm-file-upload.cjs.entry.js +552 -0
  132. package/dist/cjs/bcm-file-upload.entry.cjs.js.map +1 -0
  133. package/dist/cjs/bcm-input.cjs.entry.js +250 -158
  134. package/dist/cjs/bcm-input.entry.cjs.js.map +1 -1
  135. package/dist/cjs/bcm-linked.cjs.entry.js +452 -0
  136. package/dist/cjs/bcm-linked.entry.cjs.js.map +1 -0
  137. package/dist/cjs/bcm-modal.cjs.entry.js +360 -0
  138. package/dist/cjs/bcm-modal.entry.cjs.js.map +1 -0
  139. package/dist/cjs/bcm-pop-confirm.cjs.entry.js +381 -0
  140. package/dist/cjs/bcm-pop-confirm.entry.cjs.js.map +1 -0
  141. package/dist/cjs/bcm-popover.cjs.entry.js +451 -0
  142. package/dist/cjs/bcm-popover.entry.cjs.js.map +1 -0
  143. package/dist/cjs/bcm-radio-group.cjs.entry.js +103 -80
  144. package/dist/cjs/bcm-radio-group.entry.cjs.js.map +1 -1
  145. package/dist/cjs/bcm-radio.cjs.entry.js +239 -106
  146. package/dist/cjs/bcm-radio.entry.cjs.js.map +1 -1
  147. package/dist/cjs/bcm-segment.bcm-segmented-picker.entry.cjs.js.map +1 -0
  148. package/dist/cjs/bcm-segment_2.cjs.entry.js +335 -0
  149. package/dist/cjs/bcm-shortcut.cjs.entry.js +5 -4
  150. package/dist/cjs/bcm-shortcut.entry.cjs.js.map +1 -1
  151. package/dist/cjs/bcm-switch.cjs.entry.js +281 -148
  152. package/dist/cjs/bcm-switch.entry.cjs.js.map +1 -1
  153. package/dist/cjs/bcm-tab.cjs.entry.js +44 -0
  154. package/dist/cjs/bcm-tab.entry.cjs.js.map +1 -0
  155. package/dist/cjs/bcm-tabs.cjs.entry.js +191 -237
  156. package/dist/cjs/bcm-tabs.entry.cjs.js.map +1 -1
  157. package/dist/cjs/bcm-text.cjs.entry.js +86 -85
  158. package/dist/cjs/bcm-text.entry.cjs.js.map +1 -1
  159. package/dist/cjs/bcm-textarea.cjs.entry.js +224 -154
  160. package/dist/cjs/bcm-textarea.entry.cjs.js.map +1 -1
  161. package/dist/cjs/bcm-tooltip.cjs.entry.js +414 -0
  162. package/dist/cjs/bcm-tooltip.entry.cjs.js.map +1 -0
  163. package/dist/cjs/bromcom-ui.cjs.js +2 -2
  164. package/dist/cjs/floating-ui.dom-S9nP6zZt.js +1622 -0
  165. package/dist/{bromcom-ui/floating-ui.dom-ltNPqX34.js.map → cjs/floating-ui.dom-S9nP6zZt.js.map} +1 -1
  166. package/dist/cjs/{index-CmYzUr-k.js → index-1Qal-onT.js} +111 -33
  167. package/dist/cjs/index-1Qal-onT.js.map +1 -0
  168. package/dist/cjs/loader.cjs.js +2 -2
  169. package/dist/cjs/{validation-messages-BjfpSEWk.js → validation-messages-DieKlSG4.js} +6 -7
  170. package/dist/{esm/validation-messages-CUvT12BL.js.map → cjs/validation-messages-DieKlSG4.js.map} +1 -1
  171. package/dist/collection/collection-manifest.json +4 -5
  172. package/dist/collection/components/_shared/form/base-choice-control.js +90 -0
  173. package/dist/collection/components/_shared/form/base-choice-control.js.map +1 -0
  174. package/dist/collection/components/_shared/form/base-form-control.js +115 -0
  175. package/dist/collection/components/_shared/form/base-form-control.js.map +1 -0
  176. package/dist/collection/components/accordion/accordion.component.js +72 -55
  177. package/dist/collection/components/accordion/accordion.component.js.map +1 -1
  178. package/dist/collection/components/accordion/accordion.css +1 -1
  179. package/dist/collection/components/accordion-group/accordion-group.component.js +20 -18
  180. package/dist/collection/components/accordion-group/accordion-group.component.js.map +1 -1
  181. package/dist/collection/components/alert/alert.component.js +19 -21
  182. package/dist/collection/components/alert/alert.component.js.map +1 -1
  183. package/dist/collection/components/alert/alert.css +1 -1
  184. package/dist/collection/components/avatar/avatar.component.js +20 -12
  185. package/dist/collection/components/avatar/avatar.component.js.map +1 -1
  186. package/dist/collection/components/avatar/avatar.css +1 -1
  187. package/dist/collection/components/badge/badge.component.js +111 -81
  188. package/dist/collection/components/badge/badge.component.js.map +1 -1
  189. package/dist/collection/components/badge/badge.css +1 -1
  190. package/dist/collection/components/basic-badge/basic-badge.component.js +70 -58
  191. package/dist/collection/components/basic-badge/basic-badge.component.js.map +1 -1
  192. package/dist/collection/components/basic-badge/basic-badge.css +1 -1
  193. package/dist/collection/components/button/button.component.js +105 -84
  194. package/dist/collection/components/button/button.component.js.map +1 -1
  195. package/dist/collection/components/button/button.css +1 -1
  196. package/dist/collection/components/button-group/button-group.component.js +34 -23
  197. package/dist/collection/components/button-group/button-group.component.js.map +1 -1
  198. package/dist/collection/components/button-group/button-group.css +1 -1
  199. package/dist/collection/components/checkbox/checkbox.component.js +355 -236
  200. package/dist/collection/components/checkbox/checkbox.component.js.map +1 -1
  201. package/dist/collection/components/checkbox/checkbox.css +1 -1
  202. package/dist/collection/components/chip/chip.component.js +35 -34
  203. package/dist/collection/components/chip/chip.component.js.map +1 -1
  204. package/dist/collection/components/chip/chip.css +1 -1
  205. package/dist/collection/components/divider/divider.component.js +53 -55
  206. package/dist/collection/components/divider/divider.component.js.map +1 -1
  207. package/dist/collection/components/drawer/drawer.component.js +168 -144
  208. package/dist/collection/components/drawer/drawer.component.js.map +1 -1
  209. package/dist/collection/components/dropdown/dropdown.component.js +16 -16
  210. package/dist/collection/components/dropdown/dropdown.component.js.map +1 -1
  211. package/dist/collection/components/dropdown/dropdown.css +1 -1
  212. package/dist/collection/components/dropdown-item/dropdown-item.component.js +34 -32
  213. package/dist/collection/components/dropdown-item/dropdown-item.component.js.map +1 -1
  214. package/dist/collection/components/dropdown-item/dropdown-item.css +1 -1
  215. package/dist/collection/components/input/input.component.js +241 -155
  216. package/dist/collection/components/input/input.component.js.map +1 -1
  217. package/dist/collection/components/linked/linked.component.js +160 -138
  218. package/dist/collection/components/linked/linked.component.js.map +1 -1
  219. package/dist/collection/components/linked/linked.css +1 -1
  220. package/dist/collection/components/modal/modal.component.js +180 -156
  221. package/dist/collection/components/modal/modal.component.js.map +1 -1
  222. package/dist/collection/components/pop-confirm/pop-confirm.component.js +190 -159
  223. package/dist/collection/components/pop-confirm/pop-confirm.component.js.map +1 -1
  224. package/dist/collection/components/pop-confirm/pop-confirm.css +1 -1
  225. package/dist/collection/components/popover/popover.component.js +240 -212
  226. package/dist/collection/components/popover/popover.component.js.map +1 -1
  227. package/dist/collection/components/popover/popover.css +1 -1
  228. package/dist/collection/components/radio/radio.component.js +282 -106
  229. package/dist/collection/components/radio/radio.component.js.map +1 -1
  230. package/dist/collection/components/radio-group/radio-group.component.js +102 -80
  231. package/dist/collection/components/radio-group/radio-group.component.js.map +1 -1
  232. package/dist/collection/components/segmented-picker/segment.component.js +228 -0
  233. package/dist/collection/components/segmented-picker/segment.component.js.map +1 -0
  234. package/dist/collection/components/segmented-picker/segment.css +1 -0
  235. package/dist/collection/components/segmented-picker/segmented-picker.component.js +354 -139
  236. package/dist/collection/components/segmented-picker/segmented-picker.component.js.map +1 -1
  237. package/dist/collection/components/segmented-picker/segmented-picker.css +1 -1
  238. package/dist/collection/components/shortcut/shortcut.js +4 -5
  239. package/dist/collection/components/shortcut/shortcut.js.map +1 -1
  240. package/dist/collection/components/switch/switch.component.js +350 -280
  241. package/dist/collection/components/switch/switch.component.js.map +1 -1
  242. package/dist/collection/components/switch/switch.css +1 -1
  243. package/dist/collection/components/tabs/bcm-tab.css +1 -0
  244. package/dist/collection/components/tabs/bcm-tabs.css +1 -1
  245. package/dist/collection/components/tabs/tab.component.js +169 -0
  246. package/dist/collection/components/tabs/tab.component.js.map +1 -0
  247. package/dist/collection/components/tabs/tabs.component.js +221 -352
  248. package/dist/collection/components/tabs/tabs.component.js.map +1 -1
  249. package/dist/collection/components/text/text.component.js +84 -85
  250. package/dist/collection/components/text/text.component.js.map +1 -1
  251. package/dist/collection/components/text/text.css +1 -1
  252. package/dist/collection/components/textarea/textarea.component.js +216 -153
  253. package/dist/collection/components/textarea/textarea.component.js.map +1 -1
  254. package/dist/collection/components/tooltip/tooltip.component.js +164 -154
  255. package/dist/collection/components/tooltip/tooltip.component.js.map +1 -1
  256. package/dist/collection/components/upload/file-upload.component.js +905 -0
  257. package/dist/collection/components/upload/file-upload.component.js.map +1 -0
  258. package/dist/collection/components/upload/file-upload.css +1 -0
  259. package/dist/collection/global/global.js +33 -30
  260. package/dist/collection/utils/i18n.js +3 -4
  261. package/dist/collection/utils/i18n.js.map +1 -1
  262. package/dist/collection/utils/slot/check-slot-content.js +1 -2
  263. package/dist/collection/utils/slot/check-slot-content.js.map +1 -1
  264. package/dist/collection/utils/validation-messages.js +1 -1
  265. package/dist/collection/utils/validation-messages.js.map +1 -1
  266. package/dist/components/bcm-accordion-group.js +19 -17
  267. package/dist/components/bcm-accordion-group.js.map +1 -1
  268. package/dist/components/bcm-accordion.js +72 -55
  269. package/dist/components/bcm-accordion.js.map +1 -1
  270. package/dist/components/bcm-alert.js +1 -114
  271. package/dist/components/bcm-alert.js.map +1 -1
  272. package/dist/components/bcm-avatar.js +22 -12
  273. package/dist/components/bcm-avatar.js.map +1 -1
  274. package/dist/components/bcm-badge.js +1 -1
  275. package/dist/components/bcm-basic-badge.js +72 -58
  276. package/dist/components/bcm-basic-badge.js.map +1 -1
  277. package/dist/components/bcm-button-group.js +35 -23
  278. package/dist/components/bcm-button-group.js.map +1 -1
  279. package/dist/components/bcm-button.js +1 -1
  280. package/dist/components/bcm-checkbox.js +296 -184
  281. package/dist/components/bcm-checkbox.js.map +1 -1
  282. package/dist/components/bcm-chip.js +37 -34
  283. package/dist/components/bcm-chip.js.map +1 -1
  284. package/dist/components/bcm-divider.js +54 -54
  285. package/dist/components/bcm-divider.js.map +1 -1
  286. package/dist/components/bcm-drawer.js +169 -144
  287. package/dist/components/bcm-drawer.js.map +1 -1
  288. package/dist/components/bcm-dropdown-item.js +35 -32
  289. package/dist/components/bcm-dropdown-item.js.map +1 -1
  290. package/dist/components/bcm-dropdown.js +19 -18
  291. package/dist/components/bcm-dropdown.js.map +1 -1
  292. package/dist/components/{bcm-tabs-content.d.ts → bcm-file-upload.d.ts} +4 -4
  293. package/dist/components/bcm-file-upload.js +593 -0
  294. package/dist/components/bcm-file-upload.js.map +1 -0
  295. package/dist/components/bcm-input.js +244 -158
  296. package/dist/components/bcm-input.js.map +1 -1
  297. package/dist/components/bcm-linked.js +1 -1
  298. package/dist/components/bcm-modal.js +181 -156
  299. package/dist/components/bcm-modal.js.map +1 -1
  300. package/dist/components/bcm-pop-confirm.js +192 -160
  301. package/dist/components/bcm-pop-confirm.js.map +1 -1
  302. package/dist/components/bcm-popover.js +242 -213
  303. package/dist/components/bcm-popover.js.map +1 -1
  304. package/dist/components/bcm-radio-group.js +102 -79
  305. package/dist/components/bcm-radio-group.js.map +1 -1
  306. package/dist/components/bcm-radio.js +241 -108
  307. package/dist/components/bcm-radio.js.map +1 -1
  308. package/dist/components/{bcm-tabs-list.d.ts → bcm-segment.d.ts} +4 -4
  309. package/dist/components/bcm-segment.js +110 -0
  310. package/dist/components/bcm-segment.js.map +1 -0
  311. package/dist/components/bcm-segmented-picker.js +234 -115
  312. package/dist/components/bcm-segmented-picker.js.map +1 -1
  313. package/dist/components/bcm-shortcut.js +4 -3
  314. package/dist/components/bcm-shortcut.js.map +1 -1
  315. package/dist/components/bcm-switch.js +292 -156
  316. package/dist/components/bcm-switch.js.map +1 -1
  317. package/dist/components/{bcm-tabs-trigger.d.ts → bcm-tab.d.ts} +4 -4
  318. package/dist/components/bcm-tab.js +71 -0
  319. package/dist/components/bcm-tab.js.map +1 -0
  320. package/dist/components/bcm-tabs.js +196 -247
  321. package/dist/components/bcm-tabs.js.map +1 -1
  322. package/dist/components/bcm-text.js +85 -84
  323. package/dist/components/bcm-text.js.map +1 -1
  324. package/dist/components/bcm-textarea.js +218 -154
  325. package/dist/components/bcm-textarea.js.map +1 -1
  326. package/dist/components/bcm-tooltip.js +164 -153
  327. package/dist/components/bcm-tooltip.js.map +1 -1
  328. package/dist/components/index.js +105 -32
  329. package/dist/components/index.js.map +1 -1
  330. package/dist/components/p-5_TgtzQU.js +119 -0
  331. package/dist/components/p-5_TgtzQU.js.map +1 -0
  332. package/dist/components/p-RlBWOSgL.js +179 -0
  333. package/dist/components/p-RlBWOSgL.js.map +1 -0
  334. package/dist/components/p-SERXqWcS.js +51 -0
  335. package/dist/components/p-SERXqWcS.js.map +1 -0
  336. package/dist/components/{p-CUvT12BL.js → p-nf_HKsGq.js} +6 -7
  337. package/dist/components/p-nf_HKsGq.js.map +1 -0
  338. package/dist/components/{p-CsIBm0J5.js → p-xQIzBLsS.js} +108 -85
  339. package/dist/components/p-xQIzBLsS.js.map +1 -0
  340. package/dist/components/{p-6VLsKZvR.js → p-z9ESseGb.js} +163 -140
  341. package/dist/components/p-z9ESseGb.js.map +1 -0
  342. package/dist/esm/base-choice-control-CKR8UdZ6.js +52 -0
  343. package/dist/esm/base-choice-control-CKR8UdZ6.js.map +1 -0
  344. package/dist/esm/bcm-accordion-group.entry.js +20 -18
  345. package/dist/esm/bcm-accordion-group.entry.js.map +1 -1
  346. package/dist/esm/bcm-accordion.entry.js +73 -56
  347. package/dist/esm/bcm-accordion.entry.js.map +1 -1
  348. package/dist/esm/bcm-alert.entry.js +21 -21
  349. package/dist/esm/bcm-alert.entry.js.map +1 -1
  350. package/dist/esm/bcm-avatar.entry.js +22 -12
  351. package/dist/esm/bcm-avatar.entry.js.map +1 -1
  352. package/dist/esm/bcm-badge.entry.js +114 -82
  353. package/dist/esm/bcm-badge.entry.js.map +1 -1
  354. package/dist/esm/bcm-basic-badge.entry.js +73 -59
  355. package/dist/esm/bcm-basic-badge.entry.js.map +1 -1
  356. package/dist/esm/bcm-button-group.entry.js +36 -24
  357. package/dist/esm/bcm-button-group.entry.js.map +1 -1
  358. package/dist/esm/bcm-button.entry.js +336 -0
  359. package/dist/esm/bcm-button.entry.js.map +1 -0
  360. package/dist/esm/bcm-checkbox.entry.js +284 -174
  361. package/dist/esm/bcm-checkbox.entry.js.map +1 -1
  362. package/dist/esm/bcm-chip.entry.js +38 -35
  363. package/dist/esm/bcm-chip.entry.js.map +1 -1
  364. package/dist/esm/bcm-divider.entry.js +55 -55
  365. package/dist/esm/bcm-divider.entry.js.map +1 -1
  366. package/dist/esm/bcm-drawer.entry.js +330 -0
  367. package/dist/esm/bcm-drawer.entry.js.map +1 -0
  368. package/dist/esm/bcm-dropdown-item.entry.js +36 -33
  369. package/dist/esm/bcm-dropdown-item.entry.js.map +1 -1
  370. package/dist/esm/bcm-dropdown.entry.js +18 -17
  371. package/dist/esm/bcm-dropdown.entry.js.map +1 -1
  372. package/dist/esm/bcm-file-upload.entry.js +550 -0
  373. package/dist/esm/bcm-file-upload.entry.js.map +1 -0
  374. package/dist/esm/bcm-input.entry.js +250 -158
  375. package/dist/esm/bcm-input.entry.js.map +1 -1
  376. package/dist/esm/bcm-linked.entry.js +450 -0
  377. package/dist/esm/bcm-linked.entry.js.map +1 -0
  378. package/dist/esm/bcm-modal.entry.js +358 -0
  379. package/dist/esm/bcm-modal.entry.js.map +1 -0
  380. package/dist/esm/bcm-pop-confirm.entry.js +379 -0
  381. package/dist/esm/bcm-pop-confirm.entry.js.map +1 -0
  382. package/dist/esm/bcm-popover.entry.js +449 -0
  383. package/dist/esm/bcm-popover.entry.js.map +1 -0
  384. package/dist/esm/bcm-radio-group.entry.js +103 -80
  385. package/dist/esm/bcm-radio-group.entry.js.map +1 -1
  386. package/dist/esm/bcm-radio.entry.js +239 -106
  387. package/dist/esm/bcm-radio.entry.js.map +1 -1
  388. package/dist/esm/bcm-segment.bcm-segmented-picker.entry.js.map +1 -0
  389. package/dist/esm/bcm-segment_2.entry.js +332 -0
  390. package/dist/esm/bcm-shortcut.entry.js +5 -4
  391. package/dist/esm/bcm-shortcut.entry.js.map +1 -1
  392. package/dist/esm/bcm-switch.entry.js +281 -148
  393. package/dist/esm/bcm-switch.entry.js.map +1 -1
  394. package/dist/esm/bcm-tab.entry.js +42 -0
  395. package/dist/esm/bcm-tab.entry.js.map +1 -0
  396. package/dist/esm/bcm-tabs.entry.js +191 -237
  397. package/dist/esm/bcm-tabs.entry.js.map +1 -1
  398. package/dist/esm/bcm-text.entry.js +86 -85
  399. package/dist/esm/bcm-text.entry.js.map +1 -1
  400. package/dist/esm/bcm-textarea.entry.js +224 -154
  401. package/dist/esm/bcm-textarea.entry.js.map +1 -1
  402. package/dist/esm/bcm-tooltip.entry.js +412 -0
  403. package/dist/esm/bcm-tooltip.entry.js.map +1 -0
  404. package/dist/esm/bromcom-ui.js +3 -3
  405. package/dist/esm/floating-ui.dom-DBDSgIvP.js +1615 -0
  406. package/dist/esm/floating-ui.dom-DBDSgIvP.js.map +1 -0
  407. package/dist/esm/{index-CRwAh9Np.js → index-B6Ppbs5O.js} +111 -34
  408. package/dist/esm/index-B6Ppbs5O.js.map +1 -0
  409. package/dist/esm/loader.js +3 -3
  410. package/dist/esm/{validation-messages-CUvT12BL.js → validation-messages-nf_HKsGq.js} +6 -7
  411. package/dist/{cjs/validation-messages-BjfpSEWk.js.map → esm/validation-messages-nf_HKsGq.js.map} +1 -1
  412. package/dist/types/components/_shared/form/base-choice-control.d.ts +15 -0
  413. package/dist/types/components/_shared/form/base-form-control.d.ts +11 -0
  414. package/dist/types/components/checkbox/checkbox.component.d.ts +89 -71
  415. package/dist/types/components/input/input.component.d.ts +5 -0
  416. package/dist/types/components/radio/radio.component.d.ts +21 -0
  417. package/dist/types/components/segmented-picker/segment.component.d.ts +42 -0
  418. package/dist/types/components/segmented-picker/segmented-picker.component.d.ts +91 -24
  419. package/dist/types/components/switch/switch.component.d.ts +83 -43
  420. package/dist/types/components/tabs/tab.component.d.ts +33 -0
  421. package/dist/types/components/tabs/tabs.component.d.ts +51 -64
  422. package/dist/types/components/textarea/textarea.component.d.ts +5 -0
  423. package/dist/types/components/upload/file-upload.component.d.ts +107 -0
  424. package/dist/types/components.d.ts +830 -382
  425. package/package.json +2 -2
  426. package/dist/bromcom-ui/_commonjsHelpers-CvGrISen.js.map +0 -1
  427. package/dist/bromcom-ui/bcm-button.bcm-drawer.bcm-linked.bcm-modal.bcm-pop-confirm.bcm-popover.bcm-tooltip.entry.esm.js.map +0 -1
  428. package/dist/bromcom-ui/bcm-segmented-picker-option.entry.esm.js.map +0 -1
  429. package/dist/bromcom-ui/bcm-segmented-picker.entry.esm.js.map +0 -1
  430. package/dist/bromcom-ui/bcm-tabs-content.entry.esm.js.map +0 -1
  431. package/dist/bromcom-ui/bcm-tabs-list.entry.esm.js.map +0 -1
  432. package/dist/bromcom-ui/bcm-tabs-trigger.entry.esm.js.map +0 -1
  433. package/dist/bromcom-ui/generate-id-Crb5QsB-.js.map +0 -1
  434. package/dist/bromcom-ui/index-40rmUZjU.js.map +0 -1
  435. package/dist/bromcom-ui/index-BCaJmHBB.js.map +0 -1
  436. package/dist/bromcom-ui/p-0c7c6896.entry.js +0 -2
  437. package/dist/bromcom-ui/p-0c7c6896.entry.js.map +0 -1
  438. package/dist/bromcom-ui/p-11d0e649.entry.js +0 -2
  439. package/dist/bromcom-ui/p-11d0e649.entry.js.map +0 -1
  440. package/dist/bromcom-ui/p-12f38632.entry.js +0 -2
  441. package/dist/bromcom-ui/p-12f38632.entry.js.map +0 -1
  442. package/dist/bromcom-ui/p-13cbd1f5.entry.js +0 -2
  443. package/dist/bromcom-ui/p-13cbd1f5.entry.js.map +0 -1
  444. package/dist/bromcom-ui/p-1507908f.entry.js.map +0 -1
  445. package/dist/bromcom-ui/p-1ce9913f.entry.js +0 -2
  446. package/dist/bromcom-ui/p-1ce9913f.entry.js.map +0 -1
  447. package/dist/bromcom-ui/p-206d767e.entry.js +0 -2
  448. package/dist/bromcom-ui/p-206d767e.entry.js.map +0 -1
  449. package/dist/bromcom-ui/p-3cf7a7f4.entry.js +0 -2
  450. package/dist/bromcom-ui/p-3cf7a7f4.entry.js.map +0 -1
  451. package/dist/bromcom-ui/p-4505feba.entry.js +0 -2
  452. package/dist/bromcom-ui/p-4505feba.entry.js.map +0 -1
  453. package/dist/bromcom-ui/p-496014ca.entry.js.map +0 -1
  454. package/dist/bromcom-ui/p-4a932cd3.entry.js +0 -2
  455. package/dist/bromcom-ui/p-4a932cd3.entry.js.map +0 -1
  456. package/dist/bromcom-ui/p-4e554b8d.entry.js +0 -2
  457. package/dist/bromcom-ui/p-4e554b8d.entry.js.map +0 -1
  458. package/dist/bromcom-ui/p-57c4c4c4.entry.js +0 -2
  459. package/dist/bromcom-ui/p-57c4c4c4.entry.js.map +0 -1
  460. package/dist/bromcom-ui/p-61293ab2.entry.js +0 -2
  461. package/dist/bromcom-ui/p-61293ab2.entry.js.map +0 -1
  462. package/dist/bromcom-ui/p-61789456.entry.js +0 -2
  463. package/dist/bromcom-ui/p-61789456.entry.js.map +0 -1
  464. package/dist/bromcom-ui/p-65d0f188.entry.js +0 -2
  465. package/dist/bromcom-ui/p-65d0f188.entry.js.map +0 -1
  466. package/dist/bromcom-ui/p-83f707dc.entry.js +0 -2
  467. package/dist/bromcom-ui/p-83f707dc.entry.js.map +0 -1
  468. package/dist/bromcom-ui/p-8ba02e7e.entry.js +0 -2
  469. package/dist/bromcom-ui/p-8ba02e7e.entry.js.map +0 -1
  470. package/dist/bromcom-ui/p-9e9bf32e.entry.js +0 -2
  471. package/dist/bromcom-ui/p-9e9bf32e.entry.js.map +0 -1
  472. package/dist/bromcom-ui/p-CRwAh9Np.js +0 -3
  473. package/dist/bromcom-ui/p-CRwAh9Np.js.map +0 -1
  474. package/dist/bromcom-ui/p-CUvT12BL.js +0 -2
  475. package/dist/bromcom-ui/p-c87a6acf.entry.js +0 -2
  476. package/dist/bromcom-ui/p-c87a6acf.entry.js.map +0 -1
  477. package/dist/bromcom-ui/p-e0e235a8.entry.js +0 -2
  478. package/dist/bromcom-ui/p-e0e235a8.entry.js.map +0 -1
  479. package/dist/bromcom-ui/p-e1ce8b55.entry.js +0 -2
  480. package/dist/bromcom-ui/p-e1ce8b55.entry.js.map +0 -1
  481. package/dist/bromcom-ui/p-e4dddb0b.entry.js +0 -2
  482. package/dist/bromcom-ui/p-e4dddb0b.entry.js.map +0 -1
  483. package/dist/bromcom-ui/p-f9426924.entry.js +0 -2
  484. package/dist/bromcom-ui/p-f9426924.entry.js.map +0 -1
  485. package/dist/bromcom-ui/p-faa0e62c.entry.js +0 -2
  486. package/dist/bromcom-ui/p-faa0e62c.entry.js.map +0 -1
  487. package/dist/bromcom-ui/p-fcb4399f.entry.js +0 -2
  488. package/dist/bromcom-ui/p-fcb4399f.entry.js.map +0 -1
  489. package/dist/bromcom-ui/tv-SlGJ5EfR.js.map +0 -1
  490. package/dist/bromcom-ui/validation-messages-CUvT12BL.js.map +0 -1
  491. package/dist/cjs/bcm-button.bcm-drawer.bcm-linked.bcm-modal.bcm-pop-confirm.bcm-popover.bcm-tooltip.entry.cjs.js.map +0 -1
  492. package/dist/cjs/bcm-button_7.cjs.entry.js +0 -4131
  493. package/dist/cjs/bcm-segmented-picker-option.cjs.entry.js +0 -105
  494. package/dist/cjs/bcm-segmented-picker-option.entry.cjs.js.map +0 -1
  495. package/dist/cjs/bcm-segmented-picker.cjs.entry.js +0 -142
  496. package/dist/cjs/bcm-segmented-picker.entry.cjs.js.map +0 -1
  497. package/dist/cjs/bcm-tabs-content.cjs.entry.js +0 -18
  498. package/dist/cjs/bcm-tabs-content.entry.cjs.js.map +0 -1
  499. package/dist/cjs/bcm-tabs-list.cjs.entry.js +0 -82
  500. package/dist/cjs/bcm-tabs-list.entry.cjs.js.map +0 -1
  501. package/dist/cjs/bcm-tabs-trigger.cjs.entry.js +0 -120
  502. package/dist/cjs/bcm-tabs-trigger.entry.cjs.js.map +0 -1
  503. package/dist/cjs/index-CmYzUr-k.js.map +0 -1
  504. package/dist/collection/components/segmented-picker/segmented-picker-option.component.js +0 -253
  505. package/dist/collection/components/segmented-picker/segmented-picker-option.component.js.map +0 -1
  506. package/dist/collection/components/segmented-picker/segmented-picker-option.css +0 -1
  507. package/dist/collection/components/tabs/tabs-content.component.js +0 -46
  508. package/dist/collection/components/tabs/tabs-content.component.js.map +0 -1
  509. package/dist/collection/components/tabs/tabs-content.css +0 -1
  510. package/dist/collection/components/tabs/tabs-list.component.js +0 -133
  511. package/dist/collection/components/tabs/tabs-list.component.js.map +0 -1
  512. package/dist/collection/components/tabs/tabs-list.css +0 -1
  513. package/dist/collection/components/tabs/tabs-trigger.component.js +0 -267
  514. package/dist/collection/components/tabs/tabs-trigger.component.js.map +0 -1
  515. package/dist/collection/components/tabs/tabs-trigger.css +0 -1
  516. package/dist/components/bcm-segmented-picker-option.d.ts +0 -11
  517. package/dist/components/bcm-segmented-picker-option.js +0 -133
  518. package/dist/components/bcm-segmented-picker-option.js.map +0 -1
  519. package/dist/components/bcm-tabs-content.js +0 -41
  520. package/dist/components/bcm-tabs-content.js.map +0 -1
  521. package/dist/components/bcm-tabs-list.js +0 -106
  522. package/dist/components/bcm-tabs-list.js.map +0 -1
  523. package/dist/components/bcm-tabs-trigger.js +0 -148
  524. package/dist/components/bcm-tabs-trigger.js.map +0 -1
  525. package/dist/components/p-6VLsKZvR.js.map +0 -1
  526. package/dist/components/p-CUvT12BL.js.map +0 -1
  527. package/dist/components/p-CaemikSK.js +0 -147
  528. package/dist/components/p-CaemikSK.js.map +0 -1
  529. package/dist/components/p-CsIBm0J5.js.map +0 -1
  530. package/dist/esm/bcm-button.bcm-drawer.bcm-linked.bcm-modal.bcm-pop-confirm.bcm-popover.bcm-tooltip.entry.js.map +0 -1
  531. package/dist/esm/bcm-button_7.entry.js +0 -4123
  532. package/dist/esm/bcm-segmented-picker-option.entry.js +0 -103
  533. package/dist/esm/bcm-segmented-picker-option.entry.js.map +0 -1
  534. package/dist/esm/bcm-segmented-picker.entry.js +0 -140
  535. package/dist/esm/bcm-segmented-picker.entry.js.map +0 -1
  536. package/dist/esm/bcm-tabs-content.entry.js +0 -16
  537. package/dist/esm/bcm-tabs-content.entry.js.map +0 -1
  538. package/dist/esm/bcm-tabs-list.entry.js +0 -80
  539. package/dist/esm/bcm-tabs-list.entry.js.map +0 -1
  540. package/dist/esm/bcm-tabs-trigger.entry.js +0 -118
  541. package/dist/esm/bcm-tabs-trigger.entry.js.map +0 -1
  542. package/dist/esm/index-CRwAh9Np.js.map +0 -1
  543. package/dist/types/components/segmented-picker/segmented-picker-option.component.d.ts +0 -30
  544. package/dist/types/components/tabs/tabs-content.component.d.ts +0 -13
  545. package/dist/types/components/tabs/tabs-list.component.d.ts +0 -20
  546. package/dist/types/components/tabs/tabs-trigger.component.d.ts +0 -49
@@ -1,4123 +0,0 @@
1
- import { r as registerInstance, c as createEvent, h, H as Host, a as getElement } from './index-CRwAh9Np.js';
2
- import { t as tv } from './tv-CEcVC0yX.js';
3
-
4
- const variantOptions = {
5
- save: {
6
- text: 'Save',
7
- status: 'success',
8
- icon: 'far fa-save',
9
- iconPosition: 'prefix',
10
- kind: 'primary',
11
- },
12
- ok: {
13
- text: 'Ok',
14
- status: 'success',
15
- icon: 'far fa-check',
16
- iconPosition: 'prefix',
17
- },
18
- new: {
19
- text: 'New',
20
- status: 'success',
21
- icon: 'far fa-plus',
22
- iconPosition: 'prefix',
23
- },
24
- add: {
25
- text: 'Add',
26
- status: 'success',
27
- icon: 'far fa-plus',
28
- iconPosition: 'prefix',
29
- },
30
- create: {
31
- text: 'Create',
32
- status: 'success',
33
- icon: 'far fa-plus',
34
- iconPosition: 'prefix',
35
- },
36
- prev: {
37
- text: 'Prev',
38
- status: 'default',
39
- icon: 'far fa-arrow-left',
40
- iconPosition: 'prefix',
41
- },
42
- next: {
43
- text: 'Next',
44
- status: 'default',
45
- icon: 'far fa-arrow-right',
46
- iconPosition: 'suffix',
47
- },
48
- apply: {
49
- text: 'Apply',
50
- status: 'default',
51
- icon: 'far fa-check-circle',
52
- iconPosition: 'prefix',
53
- },
54
- submit: {
55
- text: 'Submit',
56
- status: 'default',
57
- icon: 'far fa-save',
58
- iconPosition: 'prefix',
59
- },
60
- send: {
61
- text: 'Send',
62
- status: 'success',
63
- icon: 'far fa-paper-plane',
64
- iconPosition: 'prefix',
65
- },
66
- delete: {
67
- text: 'Delete',
68
- status: 'error',
69
- icon: 'far fa-trash',
70
- iconPosition: 'prefix',
71
- },
72
- cancel: {
73
- text: 'Cancel',
74
- status: 'error',
75
- icon: 'far fa-times',
76
- iconPosition: 'prefix',
77
- },
78
- decline: {
79
- text: 'Decline',
80
- status: 'error',
81
- icon: 'far fa-ban',
82
- iconPosition: 'prefix',
83
- },
84
- close: {
85
- text: 'Close',
86
- status: 'error',
87
- icon: 'far fa-times-circle',
88
- iconPosition: 'prefix',
89
- },
90
- archive: {
91
- text: 'Archive',
92
- status: 'error',
93
- icon: 'far fa-folder-open',
94
- iconPosition: 'prefix',
95
- },
96
- remove: {
97
- text: 'Remove',
98
- status: 'error',
99
- icon: 'far fa-minus-circle',
100
- iconPosition: 'prefix',
101
- },
102
- edit: {
103
- text: 'Edit',
104
- status: 'default',
105
- icon: 'far fa-edit',
106
- iconPosition: 'prefix',
107
- },
108
- export: {
109
- text: 'Export',
110
- status: 'default',
111
- icon: 'far fa-sign-out',
112
- iconPosition: 'prefix',
113
- },
114
- import: {
115
- text: 'Import',
116
- status: 'default',
117
- icon: 'far fa-sign-in',
118
- iconPosition: 'prefix',
119
- },
120
- filter: {
121
- text: 'Filter',
122
- status: 'default',
123
- icon: 'far fa-filter',
124
- iconPosition: 'prefix',
125
- },
126
- update: {
127
- text: 'Update',
128
- status: 'default',
129
- icon: 'far fa-sync',
130
- iconPosition: 'prefix',
131
- },
132
- reset: {
133
- text: 'Reset',
134
- status: 'default',
135
- icon: 'far fa-sync',
136
- iconPosition: 'prefix',
137
- },
138
- download: {
139
- text: 'Download',
140
- status: 'default',
141
- icon: 'far fa-download',
142
- iconPosition: 'prefix',
143
- },
144
- };
145
-
146
- const buttonCss = ".relative{position:relative}:host{display:inline-flex;height:-moz-fit-content;height:fit-content;position:relative;width:-moz-fit-content;width:fit-content}:host([full-width]){width:100%}:host([position=first]) .bcm-button{border-bottom-right-radius:0;border-top-right-radius:0}:host([position=middle]) .bcm-button{border-radius:0}:host([position=last]) .bcm-button{border-bottom-left-radius:0;border-top-left-radius:0}:host([position=first].orientation-vertical) .bcm-button{border-bottom-left-radius:0;border-bottom-right-radius:0;border-top-left-radius:var(--bcm-ui-border-radius,4px);border-top-right-radius:var(--bcm-ui-border-radius,4px)}:host([position=middle].orientation-vertical) .bcm-button{border-radius:0}:host([position=last].orientation-vertical) .bcm-button{border-bottom-left-radius:var(--bcm-ui-border-radius,4px);border-bottom-right-radius:var(--bcm-ui-border-radius,4px);border-top-left-radius:0;border-top-right-radius:0}.container{width:100%}@media (min-width:640px){.container{max-width:640px}}@media (min-width:768px){.container{max-width:768px}}@media (min-width:1024px){.container{max-width:1024px}}@media (min-width:1280px){.container{max-width:1280px}}@media (min-width:1536px){.container{max-width:1536px}}.bcm-ui-element{-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;font-family:Inter,sans-serif}.static{position:static}.fixed{position:fixed}.absolute{position:absolute}.right-3{right:.75rem}.right-4{right:1rem}.right-6{right:1.5rem}.top-3{top:.75rem}.top-4{top:1rem}.top-6{top:1.5rem}.z-\\[9999\\]{z-index:9999}.m-0{margin:0}.inline-block{display:inline-block}.flex{display:flex}.size-6{height:1.5rem;width:1.5rem}.h-3{height:.75rem}.w-3{width:.75rem}.max-w-64{max-width:16rem}.max-w-80{max-width:20rem}.max-w-96{max-width:24rem}.flex-1{flex:1 1 0%}.rotate-45{--tw-rotate:45deg;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.cursor-pointer{cursor:pointer}.flex-row{flex-direction:row}.flex-col{flex-direction:column}.items-center{align-items:center}.justify-end{justify-content:flex-end}.justify-center{justify-content:center}.gap-2{gap:.5rem}.gap-4{gap:1rem}.gap-6{gap:1.5rem}.gap-8{gap:2rem}.text-pretty{text-wrap:pretty}.rounded-full{border-radius:var(--bcm-ui-border-radius-full,9999px)}.rounded-lg{border-radius:var(--bcm-ui-border-radius-lg,8px)}.bg-\\[--popover-bg\\]{background-color:var(--popover-bg)}.p-4{padding:1rem}.p-6{padding:1.5rem}.p-8{padding:2rem}.pr-8{padding-right:2rem}.font-sans{font-family:Inter,sans-serif}.text-size-4{font-size:var(--bcm-ui-font-size-4,14px);line-height:var(--bcm-ui-line-height-4,20px)}.text-size-5{font-size:var(--bcm-ui-font-size-5,16px);line-height:var(--bcm-ui-line-height-5,24px)}.text-size-6{font-size:var(--bcm-ui-font-size-6,18px);line-height:var(--bcm-ui-line-height-6,24px)}.text-size-7{font-size:var(--bcm-ui-font-size-7,20px);line-height:var(--bcm-ui-line-height-7,28px)}.font-semibold{font-weight:600}.\\!text-color-header{color:var(--bcm-ui-color-text-header)!important}.text-\\[var\\(--bcm-ui-color-text-error\\)\\]{color:var(--bcm-ui-color-text-error)}.text-\\[var\\(--bcm-ui-color-text-info\\)\\]{color:var(--bcm-ui-color-text-info)}.text-\\[var\\(--bcm-ui-color-text-success\\)\\]{color:var(--bcm-ui-color-text-success)}.text-\\[var\\(--bcm-ui-color-text-warning\\)\\]{color:var(--bcm-ui-color-text-warning)}.shadow{--tw-shadow:var(--bcm-ui-box-shadow-default);--tw-shadow-colored:var(--bcm-ui-box-shadow-default)}.shadow,.shadow-3{box-shadow:var(--tw-ring-offset-shadow,0 0 #0000),var(--tw-ring-shadow,0 0 #0000),var(--tw-shadow)}.shadow-3{--tw-shadow:var(--bcm-ui-box-shadow-3);--tw-shadow-colored:var(--bcm-ui-box-shadow-3)}.outline{outline-style:solid}.filter{filter:var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow)}.hover\\:bg-gray-100:hover{background-color:oklch(.967 .003 264.542)}.inline-flex{display:inline-flex}.min-h-10{min-height:2.5rem}.min-h-6{min-height:1.5rem}.min-h-8{min-height:2rem}.w-full{width:100%}.cursor-not-allowed{cursor:not-allowed}.appearance-none{appearance:none}.rounded{border-radius:var(--bcm-ui-border-radius-default,6px)}.border{border-width:1px}.border-solid{border-style:solid}.border-\\[--bcm-final-border-color\\]{border-color:var(--bcm-final-border-color)}.border-color-disabled{border-color:var(--bcm-ui-color-border-disabled)}.bg-\\[--bcm-final-bg-color\\]{background-color:var(--bcm-final-bg-color)}.bg-\\[--bcm-ui-color-background-disabled-default\\]{background-color:var(--bcm-ui-color-background-disabled-default)}.px-2{padding-left:.5rem;padding-right:.5rem}.px-3{padding-left:.75rem;padding-right:.75rem}.py-0\\.5{padding-bottom:.125rem;padding-top:.125rem}.py-1{padding-bottom:.25rem;padding-top:.25rem}.py-px{padding-bottom:1px;padding-top:1px}.leading-none{line-height:1}.text-\\[--bcm-final-text-color\\]{color:var(--bcm-final-text-color)}.text-color-disabled{color:var(--bcm-ui-color-text-disabled)}.outline-0{outline-width:0}.hover\\:bg-\\[--bcm-final-hover-bg-color\\]:hover{background-color:var(--bcm-final-hover-bg-color)}.focus-visible\\:ring:focus-visible{--tw-ring-offset-shadow:var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow:var(--tw-ring-inset) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow,0 0 #0000)}.active\\:bg-\\[--bcm-final-active-bg-color\\]:active{background-color:var(--bcm-final-active-bg-color)}.max-h-64{max-height:16rem}.min-w-10{min-width:2.5rem}.overflow-y-auto{overflow-y:auto}.bg-color-basic-panel{background-color:var(--bcm-ui-color-background-basic-panel)}.py-1\\.5{padding-bottom:.375rem;padding-top:.375rem}";
147
-
148
- const BcmButton = class {
149
- constructor(hostRef) {
150
- registerInstance(this, hostRef);
151
- this.bcmClick = createEvent(this, "bcmClick", 1);
152
- this.bcmFocus = createEvent(this, "bcmFocus", 1);
153
- this.bcmBlur = createEvent(this, "bcmBlur", 1);
154
- /** Defines the main visual style of the button */
155
- this.kind = 'primary';
156
- /** Controls the button size */
157
- this.size = 'medium';
158
- /** Defines the button's status/state color */
159
- this.status = 'default';
160
- /** Icon placement (prefix/suffix) */
161
- this.iconPosition = 'prefix';
162
- /** Icon-only button mode */
163
- this.iconOnly = false;
164
- /** Full width button */
165
- this.fullWidth = false;
166
- /** HTML button type */
167
- this.type = 'button';
168
- /** Loading state */
169
- this.loading = false;
170
- /** Disabled state */
171
- this.disabled = false;
172
- /** Active state */
173
- this.active = false;
174
- this.handleClick = (event) => {
175
- if (!this.disabled && !this.loading) {
176
- this.bcmClick.emit(event);
177
- }
178
- };
179
- this.handleFocus = (event) => {
180
- this.bcmFocus.emit(event);
181
- };
182
- this.handleBlur = (event) => {
183
- this.bcmBlur.emit(event);
184
- };
185
- this.buttonClass = tv({
186
- base: 'bcm-button appearance-none inline-flex items-center justify-center border border-solid rounded outline-0',
187
- variants: {
188
- size: {
189
- small: 'text-size-4 py-px px-2 min-h-6',
190
- medium: 'text-size-5 py-0.5 px-3 min-h-8',
191
- large: 'text-size-6 py-1 px-3 min-h-10',
192
- },
193
- kind: {
194
- primary: 'kind-primary',
195
- ghost: 'kind-ghost',
196
- text: 'kind-text',
197
- outline: 'kind-outline',
198
- },
199
- fullWidth: {
200
- true: 'full-width w-full',
201
- },
202
- disabled: {
203
- true: 'disabled cursor-not-allowed bg-[--bcm-ui-color-background-disabled-default] text-color-disabled border-color-disabled',
204
- false: [
205
- 'cursor-pointer',
206
- 'bg-[--bcm-final-bg-color] text-[--bcm-final-text-color] border-[--bcm-final-border-color]',
207
- 'hover:bg-[--bcm-final-hover-bg-color]',
208
- 'active:bg-[--bcm-final-active-bg-color]',
209
- 'focus-visible:ring',
210
- ],
211
- },
212
- loading: {
213
- true: '',
214
- },
215
- position: {
216
- first: 'position-first',
217
- middle: 'position-middle',
218
- last: 'position-last',
219
- },
220
- },
221
- defaultVariants: {
222
- size: 'medium',
223
- kind: 'primary',
224
- fullWidth: false,
225
- disabled: false,
226
- loading: false,
227
- },
228
- }, {
229
- twMerge: false,
230
- });
231
- }
232
- get buttonText() {
233
- return this.text || (this.variant && variantOptions[this.variant] ? variantOptions[this.variant].text : '');
234
- }
235
- get buttonIcon() {
236
- var _a;
237
- if (this.variant && ((_a = variantOptions[this.variant]) === null || _a === void 0 ? void 0 : _a.icon)) {
238
- return {
239
- icon: variantOptions[this.variant].icon,
240
- position: variantOptions[this.variant].iconPosition || 'prefix',
241
- };
242
- }
243
- return {
244
- icon: this.icon,
245
- position: this.iconPosition,
246
- };
247
- }
248
- get buttonStatus() {
249
- return this.variant && variantOptions[this.variant] ? variantOptions[this.variant].status : this.status;
250
- }
251
- get buttonStyles() {
252
- const status = this.buttonStatus === 'default' ? 'primary' : this.buttonStatus;
253
- // These are the internal default styles based on component props (kind, status)
254
- const kindStyleMap = {
255
- primary: {
256
- '--bcm-button-bg': `var(--bcm-ui-color-background-${status}-default)`,
257
- '--bcm-button-bg-hover': `var(--bcm-ui-color-background-${status}-hover)`,
258
- '--bcm-button-bg-active': `var(--bcm-ui-color-background-${status}-active)`,
259
- '--bcm-button-border': 'transparent',
260
- '--bcm-button-text': 'var(--bcm-ui-color-text-base)',
261
- },
262
- outline: {
263
- '--bcm-button-bg': 'var(--bcm-ui-color-background-default-default)',
264
- '--bcm-button-bg-hover': 'var(--bcm-ui-color-background-default-hover)',
265
- '--bcm-button-bg-active': 'var(--bcm-ui-color-background-default-active)',
266
- '--bcm-button-border': `var(--bcm-ui-color-border-${this.buttonStatus})`,
267
- '--bcm-button-text': `var(--bcm-ui-color-text-${this.buttonStatus})`,
268
- },
269
- ghost: {
270
- '--bcm-button-bg': 'transparent',
271
- '--bcm-button-bg-hover': 'var(--bcm-ui-color-background-default-hover)',
272
- '--bcm-button-bg-active': 'var(--bcm-ui-color-background-default-active)',
273
- '--bcm-button-border': 'transparent',
274
- '--bcm-button-text': `var(--bcm-ui-color-text-${this.buttonStatus})`,
275
- },
276
- text: {
277
- '--bcm-button-bg': 'transparent',
278
- '--bcm-button-bg-hover': 'var(--bcm-ui-color-background-default-hover)',
279
- '--bcm-button-bg-active': 'var(--bcm-ui-color-background-default-active)',
280
- '--bcm-button-border': 'transparent',
281
- '--bcm-button-text': `var(--bcm-ui-color-text-${status})`,
282
- },
283
- };
284
- const internalDefaultStyles = kindStyleMap[this.kind];
285
- // These are the "final" CSS custom properties used by the component's styling.
286
- // They use the "--bcm-button-custom-..." token if provided by the user,
287
- // otherwise, they fall back to the internal "--bcm-button-..." style defined above.
288
- const finalEffectiveStyles = {
289
- '--bcm-final-text-color': `var(--bcm-button-custom-text-color, ${internalDefaultStyles['--bcm-button-text']})`,
290
- '--bcm-final-border-color': `var(--bcm-button-custom-border-color, ${internalDefaultStyles['--bcm-button-border']})`,
291
- '--bcm-final-bg-color': `var(--bcm-button-custom-bg-color, ${internalDefaultStyles['--bcm-button-bg']})`,
292
- '--bcm-final-hover-bg-color': `var(--bcm-button-custom-hover-bg-color, ${internalDefaultStyles['--bcm-button-bg-hover']})`,
293
- '--bcm-final-active-bg-color': `var(--bcm-button-custom-active-bg-color, ${internalDefaultStyles['--bcm-button-bg-active']})`,
294
- };
295
- // return kindStyleMap[this.kind];
296
- return Object.assign(Object.assign({}, internalDefaultStyles), finalEffectiveStyles);
297
- }
298
- render() {
299
- const { icon, position } = this.buttonIcon;
300
- return (h(Host, { key: 'a11591319f31f3ecfe6d1db5f5137f537b7cf71b' }, h("button", { key: 'e7e7876b08b2d2b82fedc97ee6d1135e886044cb', type: this.type, disabled: this.disabled || this.loading, "aria-label": this.label, "aria-expanded": this.expanded, "aria-controls": this.controls, "aria-disabled": this.disabled, onClick: this.handleClick, onFocus: this.handleFocus, onBlur: this.handleBlur, style: this.buttonStyles, class: this.buttonClass({
301
- size: this.size,
302
- kind: this.kind,
303
- fullWidth: this.fullWidth,
304
- disabled: this.disabled,
305
- loading: this.loading,
306
- position: this.position,
307
- }) }, this.loading && h("slot", { key: 'c8b923e0fcb64f9c299602ab8a6ea1e25aaf5c8d', name: "loading" }), h("span", { key: '838f85afd0355eec4c7dea0e1ae02ffa98e8e260' }, h("slot", { key: '5f65cf6f40096595d6affcb4c30cde9eef0d7614', name: "prefix" }, position === 'prefix' && icon && h("i", { key: '96425b8dd1396ef268e30c6f209b495bf7f5f6d6', class: ' leading-none ' + icon }))), h("slot", { key: 'a34f07f25c2d06aa7a60673ac0e1329063a6887a' }, this.buttonText), h("span", { key: 'a375ba2ac1411a82850b60074fdc561272bdeda6' }, h("slot", { key: '8fc1cfcdcee4c9339b4894900c5a1e03e75820b0', name: "suffix" }, position === 'suffix' && icon && h("i", { key: 'd8f5b40843d278ad2cfc0260b0a071f42d5f73a5', class: ' leading-none ' + icon }))))));
308
- }
309
- };
310
- BcmButton.style = buttonCss;
311
-
312
- const drawerCss = ".contents{display:contents}.transform{transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.transition{transition-duration:.15s;transition-property:color,background-color,border-color,text-decoration-color,fill,stroke,opacity,box-shadow,transform,filter,backdrop-filter;transition-timing-function:cubic-bezier(.4,0,.2,1)}:host{display:contents}[part=dialog]::backdrop{animation:backdrop-fade-in .2s ease-out}@keyframes backdrop-fade-in{0%{opacity:0}to{opacity:.5}}[part=drawer]{transition:transform .2s ease-out}:host([position=left]) [part=drawer]{transform:translateX(-20px)}:host([position=left][open]) [part=drawer]{transform:translateX(0)}:host([position=right]) [part=drawer]{transform:translateX(20px)}:host([position=right][open]) [part=drawer]{transform:translateX(0)}:host([position=top]) [part=drawer]{transform:translateY(-20px)}:host([position=top][open]) [part=drawer]{transform:translateY(0)}:host([position=bottom]) [part=drawer]{transform:translateY(20px)}:host([position=bottom][open]) [part=drawer]{transform:translateY(0)}.container{width:100%}@media (min-width:640px){.container{max-width:640px}}@media (min-width:768px){.container{max-width:768px}}@media (min-width:1024px){.container{max-width:1024px}}@media (min-width:1280px){.container{max-width:1280px}}@media (min-width:1536px){.container{max-width:1536px}}.bcm-ui-element{-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;font-family:Inter,sans-serif}.static{position:static}.fixed{position:fixed}.relative{position:relative}.inset-0{inset:0}.m-0{margin:0}.flex{display:flex}.hidden{display:none}.h-6{height:1.5rem}.h-full{height:100%}.h-screen{height:100vh}.max-h-full{max-height:100%}.max-h-none{max-height:none}.w-6{width:1.5rem}.w-full{width:100%}.w-screen{width:100vw}.min-w-0{min-width:0}.max-w-full{max-width:100%}.max-w-none{max-width:none}.flex-1{flex:1 1 0%}.flex-shrink-0{flex-shrink:0}.flex-grow{flex-grow:1}.animate-shake{animation:shake .82s cubic-bezier(.36,.07,.19,.97) infinite;animation:shake .3s cubic-bezier(.36,.07,.19,.97) both}.cursor-pointer{cursor:pointer}.flex-col{flex-direction:column}.items-start{align-items:flex-start}.items-end{align-items:flex-end}.items-center{align-items:center}.justify-start{justify-content:flex-start}.justify-end{justify-content:flex-end}.justify-between{justify-content:space-between}.gap-2{gap:.5rem}.overflow-hidden{overflow:hidden}.overflow-y-auto{overflow-y:auto}.rounded{border-radius:var(--bcm-ui-border-radius-default,6px)}.border-0{border-width:0}.border-b{border-bottom-width:1px}.border-t{border-top-width:1px}.border-solid{border-style:solid}.border-none{border-style:none}.border-color-default{border-color:var(--bcm-ui-color-border-default)}.bg-color-base{background-color:var(--bcm-ui-color-background-base-default)}.bg-transparent{background-color:transparent}.p-0{padding:0}.p-4{padding:1rem}.px-4{padding-left:1rem;padding-right:1rem}.py-3{padding-bottom:.75rem;padding-top:.75rem}.text-size-5{font-size:var(--bcm-ui-font-size-5,16px);line-height:var(--bcm-ui-line-height-5,24px)}.text-size-6{font-size:var(--bcm-ui-font-size-6,18px);line-height:var(--bcm-ui-line-height-6,24px)}.font-medium{font-weight:500}.font-semibold{font-weight:600}.text-color-default{color:var(--bcm-ui-color-text-default)}.text-color-header{color:var(--bcm-ui-color-text-header)}.text-color-placeholder{color:var(--bcm-ui-color-text-placeholder)}.shadow{--tw-shadow:var(--bcm-ui-box-shadow-default);--tw-shadow-colored:var(--bcm-ui-box-shadow-default)}.shadow,.shadow-2xl{box-shadow:var(--tw-ring-offset-shadow,0 0 #0000),var(--tw-ring-shadow,0 0 #0000),var(--tw-shadow)}.shadow-2xl{--tw-shadow:var(--bcm-ui-box-shadow-2xl);--tw-shadow-colored:var(--bcm-ui-box-shadow-2xl)}.outline-none{outline:2px solid transparent;outline-offset:2px}.transition-colors{transition-duration:.15s;transition-property:color,background-color,border-color,text-decoration-color,fill,stroke;transition-timing-function:cubic-bezier(.4,0,.2,1)}.backdrop\\:bg-color-default-dark::backdrop{background-color:var(--bcm-ui-color-background-default-dark-default)}.backdrop\\:opacity-50::backdrop{opacity:.5}.hover\\:bg-color-default-hover:hover{background-color:var(--bcm-ui-color-background-default-hover)}.focus-visible\\:ring:focus-visible{--tw-ring-offset-shadow:var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow:var(--tw-ring-inset) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow,0 0 #0000)}";
313
-
314
- const BcmDrawer = class {
315
- constructor(hostRef) {
316
- registerInstance(this, hostRef);
317
- this.bcmOpen = createEvent(this, "bcmOpen", 7);
318
- this.bcmClose = createEvent(this, "bcmClose", 7);
319
- this.bcmBeforeOpen = createEvent(this, "bcmBeforeOpen", 7);
320
- this.bcmBeforeClose = createEvent(this, "bcmBeforeClose", 7);
321
- /**
322
- * Controls whether the drawer is open or closed
323
- */
324
- this.open = false;
325
- /**
326
- * The size of the drawer. Can be a preset value or a custom CSS size
327
- * - For left/right drawers:
328
- * - 'small': 320px
329
- * - 'medium': 480px
330
- * - 'large': 1064px
331
- * - For top/bottom drawers:
332
- * - 'small': 40vh
333
- * - 'medium': 60vh
334
- * - 'large': 90vh
335
- * - Custom values: Any valid CSS size (e.g., '600px', '50%', '30rem', '80vw')
336
- */
337
- this.size = 'medium';
338
- /**
339
- * The position where the drawer slides in from
340
- * - 'left': Slides from the left edge
341
- * - 'right': Slides from the right edge
342
- * - 'top': Slides from the top edge
343
- * - 'bottom': Slides from the bottom edge
344
- */
345
- this.position = 'right';
346
- /**
347
- * Makes the drawer take full width (for left/right) or full height (for top/bottom)
348
- */
349
- this.fullWidth = false;
350
- /**
351
- * Makes the drawer take the full screen (100vw x 100vh)
352
- */
353
- this.fullScreen = false;
354
- /**
355
- * Controls backdrop behavior
356
- * - true: Shows backdrop, drawer can be closed by clicking outside
357
- * - false: No backdrop
358
- * - 'static': Shows backdrop but prevents closing by clicking outside (triggers shake animation)
359
- */
360
- this.backdrop = true;
361
- /**
362
- * Hides the header section completely
363
- */
364
- this.noHeader = false;
365
- /**
366
- * Hides the footer section completely
367
- */
368
- this.noFooter = false;
369
- /**
370
- * Allows closing the drawer by clicking on the backdrop
371
- */
372
- this.closeOnBackdrop = true;
373
- /**
374
- * Allows closing the drawer by pressing the Escape key
375
- */
376
- this.closeOnEscape = true;
377
- this.shake = false;
378
- this.drawerClass = tv({
379
- slots: {
380
- dialog: 'bcm-ui-element fixed inset-0 m-0 p-0 w-full max-w-full h-full max-h-full border-none bg-transparent backdrop:bg-color-default-dark backdrop:opacity-50',
381
- container: 'fixed inset-0 flex overflow-hidden',
382
- drawer: 'relative bg-color-base text-color-default shadow-2xl flex flex-col',
383
- header: 'flex justify-between items-start bg-color-base text-color-default border-color-default border-solid border-0 py-3 px-4',
384
- headerContent: 'flex-1 min-w-0 flex items-center gap-2',
385
- title: 'font-semibold m-0 text-size-6 text-color-header',
386
- helperText: 'text-size-5 text-color-placeholder m-0',
387
- closeButton: 'text-size-5 font-medium text-color-default bg-transparent border-none p-0 h-6 w-6 rounded hover:bg-color-default-hover cursor-pointer active:bg-color-active transition-colors flex-shrink-0 outline-none focus-visible:ring',
388
- content: 'flex-grow overflow-y-auto p-4',
389
- footer: 'flex items-center justify-end gap-2 py-3 px-4',
390
- },
391
- variants: {
392
- position: {
393
- left: {
394
- container: 'justify-start',
395
- drawer: 'h-full',
396
- header: 'border-b',
397
- },
398
- right: {
399
- container: 'justify-end',
400
- drawer: 'h-full',
401
- header: 'border-b',
402
- },
403
- top: {
404
- container: 'items-start',
405
- drawer: 'w-full',
406
- header: 'border-b',
407
- },
408
- bottom: {
409
- container: 'items-end',
410
- drawer: 'w-full',
411
- header: 'border-t',
412
- },
413
- },
414
- fullScreen: {
415
- true: {
416
- drawer: 'w-screen h-screen max-w-none max-h-none',
417
- container: 'p-0',
418
- },
419
- },
420
- shake: {
421
- true: {
422
- drawer: 'animate-shake',
423
- },
424
- },
425
- noHeader: {
426
- true: {
427
- header: 'hidden',
428
- },
429
- },
430
- noFooter: {
431
- true: {
432
- footer: 'hidden',
433
- },
434
- },
435
- },
436
- });
437
- this.handleBackdropClick = (event) => {
438
- const target = event.target;
439
- // Check if click is on the container (backdrop area), not on drawer content
440
- if (target.getAttribute('part') === 'container') {
441
- if (this.backdrop === 'static') {
442
- this.shakeDrawer();
443
- }
444
- else if (this.closeOnBackdrop) {
445
- this.hide();
446
- }
447
- }
448
- };
449
- this.handleDialogCancel = (event) => {
450
- event.preventDefault();
451
- if (this.backdrop === 'static') {
452
- this.shakeDrawer();
453
- // Force dialog to stay open for static backdrop
454
- requestAnimationFrame(() => {
455
- if (this.dialogRef && !this.dialogRef.open && this.open) {
456
- this.dialogRef.showModal();
457
- }
458
- });
459
- }
460
- else if (this.closeOnEscape) {
461
- this.hide();
462
- }
463
- };
464
- this.handleDrawerClick = (e) => {
465
- e.stopPropagation();
466
- };
467
- }
468
- handleOpenChange(isOpen) {
469
- if (isOpen) {
470
- const event = this.bcmBeforeOpen.emit();
471
- if (event.defaultPrevented) {
472
- this.open = false;
473
- return;
474
- }
475
- if (this.dialogRef) {
476
- if (!this.dialogRef.open) {
477
- this.dialogRef.showModal();
478
- }
479
- }
480
- this.bcmOpen.emit();
481
- }
482
- else {
483
- const event = this.bcmBeforeClose.emit();
484
- if (event.defaultPrevented) {
485
- this.open = true;
486
- return;
487
- }
488
- if (this.dialogRef && this.dialogRef.open) {
489
- this.dialogRef.close();
490
- }
491
- this.bcmClose.emit();
492
- }
493
- }
494
- handleClick(event) {
495
- const path = event.composedPath();
496
- const dismissElement = path.find(el => { var _a; return (_a = el.hasAttribute) === null || _a === void 0 ? void 0 : _a.call(el, 'data-dismiss'); });
497
- if (dismissElement) {
498
- this.hide();
499
- event.preventDefault();
500
- event.stopPropagation();
501
- }
502
- }
503
- /**
504
- * Programmatically opens the drawer
505
- */
506
- async show() {
507
- this.open = true;
508
- }
509
- /**
510
- * Programmatically closes the drawer
511
- */
512
- async hide() {
513
- this.open = false;
514
- }
515
- /**
516
- * Toggles the drawer open/closed state
517
- */
518
- async toggle() {
519
- this.open = !this.open;
520
- }
521
- shakeDrawer() {
522
- this.shake = true;
523
- setTimeout(() => {
524
- this.shake = false;
525
- }, 300);
526
- }
527
- componentDidLoad() {
528
- if (this.open && this.dialogRef) {
529
- this.dialogRef.showModal();
530
- }
531
- }
532
- disconnectedCallback() {
533
- if (this.dialogRef && this.open) {
534
- this.dialogRef.close();
535
- }
536
- }
537
- getDrawerStyle() {
538
- const style = {};
539
- if (this.fullScreen) {
540
- style.width = '100vw';
541
- style.height = '100vh';
542
- style.maxWidth = 'none';
543
- style.maxHeight = 'none';
544
- return style;
545
- }
546
- if (this.fullWidth) {
547
- if (this.position === 'left' || this.position === 'right') {
548
- style.width = '100vw';
549
- }
550
- else {
551
- style.height = '100vh';
552
- }
553
- return style;
554
- }
555
- // Check if size is a custom value (contains px, %, rem, etc.)
556
- const isCustomSize = this.size && (this.size.includes('px') || this.size.includes('%') || this.size.includes('rem') || this.size.includes('em') || this.size.includes('vw') || this.size.includes('vh'));
557
- if (this.position === 'left' || this.position === 'right') {
558
- if (isCustomSize) {
559
- style.width = this.size;
560
- }
561
- else {
562
- switch (this.size) {
563
- case 'small':
564
- style.width = '320px';
565
- break;
566
- case 'medium':
567
- style.width = '480px';
568
- break;
569
- case 'large':
570
- style.width = '1064px';
571
- break;
572
- }
573
- }
574
- }
575
- else {
576
- if (isCustomSize) {
577
- style.height = this.size;
578
- }
579
- else {
580
- switch (this.size) {
581
- case 'small':
582
- style.height = '40vh';
583
- break;
584
- case 'medium':
585
- style.height = '60vh';
586
- break;
587
- case 'large':
588
- style.height = '90vh';
589
- break;
590
- }
591
- }
592
- }
593
- return style;
594
- }
595
- render() {
596
- const { dialog, container, drawer, header, headerContent, title, helperText, closeButton, content, footer } = this.drawerClass({
597
- position: this.position,
598
- fullScreen: this.fullScreen,
599
- shake: this.shake,
600
- noHeader: this.noHeader,
601
- noFooter: this.noFooter,
602
- });
603
- return (h("dialog", { key: '2b60e637660a9aaed3d1223114d2f0df4c66bb44', ref: el => (this.dialogRef = el), part: "dialog", class: dialog(), onClick: this.handleBackdropClick, onCancel: this.handleDialogCancel, "aria-labelledby": "drawer-title", "aria-describedby": this.helperText ? 'drawer-helper' : undefined, "aria-modal": "true" }, h("div", { key: 'd08f1664dfc39e62bc0cf499b5976af0e14310da', part: "container", class: container() }, h("div", { key: 'ec18449ff5552177551606c5fdd48ce9116fd287', part: "drawer", class: drawer(), style: this.getDrawerStyle(), role: "document", onClick: this.handleDrawerClick }, !this.noHeader && (h("div", { key: '43a3e3afd31c5db5cf9c616f01a3212ec6e3472b', part: "header", class: header() }, h("div", { key: 'bb3d4eea627e0425422015cc400ccea81c70a1a5', part: "header-content", class: headerContent() }, h("h2", { key: '5c5cbd204a44f31171b932fba0932bfcba89e255', id: "drawer-title", part: "title", class: title() }, h("slot", { key: 'c8785c89adb151666c76c158c82f3e9ca6666199', name: "header" }, this.headerText)), this.helperText && (h("p", { key: '2ca315ad22086559305dc0cdcd63f32115a4f721', id: "drawer-helper", part: "helper-text", class: helperText() }, h("slot", { key: '93dcafee1e25675a0e72b53d9d6c848fd63c2f86', name: "helper" }, this.helperText)))), h("button", { key: '1eb3d5b2e9ac607bd1642ca9f067064bf376ce97', part: "close-button", class: closeButton(), onClick: () => this.hide(), "aria-label": "Close drawer", type: "button" }, h("bcm-icon", { key: '0c48991f9d68c874b78384de0d8a3bd15b27f363', name: "fa-solid fa-xmark" })))), h("div", { key: 'd34a886ca003e38bc84b86185fd0b5690954fd9f', part: "content", class: content() }, h("slot", { key: '1c3978b0a66f122b5d4ee5582ed0458c6fc16c73' })), !this.noFooter && (h("div", { key: 'db5faf3da663d11455299840e33732995aa75cf0', part: "footer", class: footer() }, h("slot", { key: '4836d78626ec999eb8f0aa8585d20df48a677f72', name: "footer" })))))));
604
- }
605
- get host() { return getElement(this); }
606
- static get watchers() { return {
607
- "open": ["handleOpenChange"]
608
- }; }
609
- };
610
- BcmDrawer.style = drawerCss;
611
-
612
- /**
613
- * Custom positioning reference element.
614
- * @see https://floating-ui.com/docs/virtual-elements
615
- */
616
-
617
- const min = Math.min;
618
- const max = Math.max;
619
- const round = Math.round;
620
- const floor = Math.floor;
621
- const createCoords = v => ({
622
- x: v,
623
- y: v
624
- });
625
- const oppositeSideMap = {
626
- left: 'right',
627
- right: 'left',
628
- bottom: 'top',
629
- top: 'bottom'
630
- };
631
- const oppositeAlignmentMap = {
632
- start: 'end',
633
- end: 'start'
634
- };
635
- function clamp(start, value, end) {
636
- return max(start, min(value, end));
637
- }
638
- function evaluate(value, param) {
639
- return typeof value === 'function' ? value(param) : value;
640
- }
641
- function getSide(placement) {
642
- return placement.split('-')[0];
643
- }
644
- function getAlignment(placement) {
645
- return placement.split('-')[1];
646
- }
647
- function getOppositeAxis(axis) {
648
- return axis === 'x' ? 'y' : 'x';
649
- }
650
- function getAxisLength(axis) {
651
- return axis === 'y' ? 'height' : 'width';
652
- }
653
- const yAxisSides = /*#__PURE__*/new Set(['top', 'bottom']);
654
- function getSideAxis(placement) {
655
- return yAxisSides.has(getSide(placement)) ? 'y' : 'x';
656
- }
657
- function getAlignmentAxis(placement) {
658
- return getOppositeAxis(getSideAxis(placement));
659
- }
660
- function getAlignmentSides(placement, rects, rtl) {
661
- if (rtl === void 0) {
662
- rtl = false;
663
- }
664
- const alignment = getAlignment(placement);
665
- const alignmentAxis = getAlignmentAxis(placement);
666
- const length = getAxisLength(alignmentAxis);
667
- let mainAlignmentSide = alignmentAxis === 'x' ? alignment === (rtl ? 'end' : 'start') ? 'right' : 'left' : alignment === 'start' ? 'bottom' : 'top';
668
- if (rects.reference[length] > rects.floating[length]) {
669
- mainAlignmentSide = getOppositePlacement(mainAlignmentSide);
670
- }
671
- return [mainAlignmentSide, getOppositePlacement(mainAlignmentSide)];
672
- }
673
- function getExpandedPlacements(placement) {
674
- const oppositePlacement = getOppositePlacement(placement);
675
- return [getOppositeAlignmentPlacement(placement), oppositePlacement, getOppositeAlignmentPlacement(oppositePlacement)];
676
- }
677
- function getOppositeAlignmentPlacement(placement) {
678
- return placement.replace(/start|end/g, alignment => oppositeAlignmentMap[alignment]);
679
- }
680
- const lrPlacement = ['left', 'right'];
681
- const rlPlacement = ['right', 'left'];
682
- const tbPlacement = ['top', 'bottom'];
683
- const btPlacement = ['bottom', 'top'];
684
- function getSideList(side, isStart, rtl) {
685
- switch (side) {
686
- case 'top':
687
- case 'bottom':
688
- if (rtl) return isStart ? rlPlacement : lrPlacement;
689
- return isStart ? lrPlacement : rlPlacement;
690
- case 'left':
691
- case 'right':
692
- return isStart ? tbPlacement : btPlacement;
693
- default:
694
- return [];
695
- }
696
- }
697
- function getOppositeAxisPlacements(placement, flipAlignment, direction, rtl) {
698
- const alignment = getAlignment(placement);
699
- let list = getSideList(getSide(placement), direction === 'start', rtl);
700
- if (alignment) {
701
- list = list.map(side => side + "-" + alignment);
702
- if (flipAlignment) {
703
- list = list.concat(list.map(getOppositeAlignmentPlacement));
704
- }
705
- }
706
- return list;
707
- }
708
- function getOppositePlacement(placement) {
709
- return placement.replace(/left|right|bottom|top/g, side => oppositeSideMap[side]);
710
- }
711
- function expandPaddingObject(padding) {
712
- return {
713
- top: 0,
714
- right: 0,
715
- bottom: 0,
716
- left: 0,
717
- ...padding
718
- };
719
- }
720
- function getPaddingObject(padding) {
721
- return typeof padding !== 'number' ? expandPaddingObject(padding) : {
722
- top: padding,
723
- right: padding,
724
- bottom: padding,
725
- left: padding
726
- };
727
- }
728
- function rectToClientRect(rect) {
729
- const {
730
- x,
731
- y,
732
- width,
733
- height
734
- } = rect;
735
- return {
736
- width,
737
- height,
738
- top: y,
739
- left: x,
740
- right: x + width,
741
- bottom: y + height,
742
- x,
743
- y
744
- };
745
- }
746
-
747
- function computeCoordsFromPlacement(_ref, placement, rtl) {
748
- let {
749
- reference,
750
- floating
751
- } = _ref;
752
- const sideAxis = getSideAxis(placement);
753
- const alignmentAxis = getAlignmentAxis(placement);
754
- const alignLength = getAxisLength(alignmentAxis);
755
- const side = getSide(placement);
756
- const isVertical = sideAxis === 'y';
757
- const commonX = reference.x + reference.width / 2 - floating.width / 2;
758
- const commonY = reference.y + reference.height / 2 - floating.height / 2;
759
- const commonAlign = reference[alignLength] / 2 - floating[alignLength] / 2;
760
- let coords;
761
- switch (side) {
762
- case 'top':
763
- coords = {
764
- x: commonX,
765
- y: reference.y - floating.height
766
- };
767
- break;
768
- case 'bottom':
769
- coords = {
770
- x: commonX,
771
- y: reference.y + reference.height
772
- };
773
- break;
774
- case 'right':
775
- coords = {
776
- x: reference.x + reference.width,
777
- y: commonY
778
- };
779
- break;
780
- case 'left':
781
- coords = {
782
- x: reference.x - floating.width,
783
- y: commonY
784
- };
785
- break;
786
- default:
787
- coords = {
788
- x: reference.x,
789
- y: reference.y
790
- };
791
- }
792
- switch (getAlignment(placement)) {
793
- case 'start':
794
- coords[alignmentAxis] -= commonAlign * (rtl && isVertical ? -1 : 1);
795
- break;
796
- case 'end':
797
- coords[alignmentAxis] += commonAlign * (rtl && isVertical ? -1 : 1);
798
- break;
799
- }
800
- return coords;
801
- }
802
-
803
- /**
804
- * Computes the `x` and `y` coordinates that will place the floating element
805
- * next to a given reference element.
806
- *
807
- * This export does not have any `platform` interface logic. You will need to
808
- * write one for the platform you are using Floating UI with.
809
- */
810
- const computePosition$1 = async (reference, floating, config) => {
811
- const {
812
- placement = 'bottom',
813
- strategy = 'absolute',
814
- middleware = [],
815
- platform
816
- } = config;
817
- const validMiddleware = middleware.filter(Boolean);
818
- const rtl = await (platform.isRTL == null ? void 0 : platform.isRTL(floating));
819
- let rects = await platform.getElementRects({
820
- reference,
821
- floating,
822
- strategy
823
- });
824
- let {
825
- x,
826
- y
827
- } = computeCoordsFromPlacement(rects, placement, rtl);
828
- let statefulPlacement = placement;
829
- let middlewareData = {};
830
- let resetCount = 0;
831
- for (let i = 0; i < validMiddleware.length; i++) {
832
- const {
833
- name,
834
- fn
835
- } = validMiddleware[i];
836
- const {
837
- x: nextX,
838
- y: nextY,
839
- data,
840
- reset
841
- } = await fn({
842
- x,
843
- y,
844
- initialPlacement: placement,
845
- placement: statefulPlacement,
846
- strategy,
847
- middlewareData,
848
- rects,
849
- platform,
850
- elements: {
851
- reference,
852
- floating
853
- }
854
- });
855
- x = nextX != null ? nextX : x;
856
- y = nextY != null ? nextY : y;
857
- middlewareData = {
858
- ...middlewareData,
859
- [name]: {
860
- ...middlewareData[name],
861
- ...data
862
- }
863
- };
864
- if (reset && resetCount <= 50) {
865
- resetCount++;
866
- if (typeof reset === 'object') {
867
- if (reset.placement) {
868
- statefulPlacement = reset.placement;
869
- }
870
- if (reset.rects) {
871
- rects = reset.rects === true ? await platform.getElementRects({
872
- reference,
873
- floating,
874
- strategy
875
- }) : reset.rects;
876
- }
877
- ({
878
- x,
879
- y
880
- } = computeCoordsFromPlacement(rects, statefulPlacement, rtl));
881
- }
882
- i = -1;
883
- }
884
- }
885
- return {
886
- x,
887
- y,
888
- placement: statefulPlacement,
889
- strategy,
890
- middlewareData
891
- };
892
- };
893
-
894
- /**
895
- * Resolves with an object of overflow side offsets that determine how much the
896
- * element is overflowing a given clipping boundary on each side.
897
- * - positive = overflowing the boundary by that number of pixels
898
- * - negative = how many pixels left before it will overflow
899
- * - 0 = lies flush with the boundary
900
- * @see https://floating-ui.com/docs/detectOverflow
901
- */
902
- async function detectOverflow(state, options) {
903
- var _await$platform$isEle;
904
- if (options === void 0) {
905
- options = {};
906
- }
907
- const {
908
- x,
909
- y,
910
- platform,
911
- rects,
912
- elements,
913
- strategy
914
- } = state;
915
- const {
916
- boundary = 'clippingAncestors',
917
- rootBoundary = 'viewport',
918
- elementContext = 'floating',
919
- altBoundary = false,
920
- padding = 0
921
- } = evaluate(options, state);
922
- const paddingObject = getPaddingObject(padding);
923
- const altContext = elementContext === 'floating' ? 'reference' : 'floating';
924
- const element = elements[altBoundary ? altContext : elementContext];
925
- const clippingClientRect = rectToClientRect(await platform.getClippingRect({
926
- 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))),
927
- boundary,
928
- rootBoundary,
929
- strategy
930
- }));
931
- const rect = elementContext === 'floating' ? {
932
- x,
933
- y,
934
- width: rects.floating.width,
935
- height: rects.floating.height
936
- } : rects.reference;
937
- const offsetParent = await (platform.getOffsetParent == null ? void 0 : platform.getOffsetParent(elements.floating));
938
- const offsetScale = (await (platform.isElement == null ? void 0 : platform.isElement(offsetParent))) ? (await (platform.getScale == null ? void 0 : platform.getScale(offsetParent))) || {
939
- x: 1,
940
- y: 1
941
- } : {
942
- x: 1,
943
- y: 1
944
- };
945
- const elementClientRect = rectToClientRect(platform.convertOffsetParentRelativeRectToViewportRelativeRect ? await platform.convertOffsetParentRelativeRectToViewportRelativeRect({
946
- elements,
947
- rect,
948
- offsetParent,
949
- strategy
950
- }) : rect);
951
- return {
952
- top: (clippingClientRect.top - elementClientRect.top + paddingObject.top) / offsetScale.y,
953
- bottom: (elementClientRect.bottom - clippingClientRect.bottom + paddingObject.bottom) / offsetScale.y,
954
- left: (clippingClientRect.left - elementClientRect.left + paddingObject.left) / offsetScale.x,
955
- right: (elementClientRect.right - clippingClientRect.right + paddingObject.right) / offsetScale.x
956
- };
957
- }
958
-
959
- /**
960
- * Provides data to position an inner element of the floating element so that it
961
- * appears centered to the reference element.
962
- * @see https://floating-ui.com/docs/arrow
963
- */
964
- const arrow$1 = options => ({
965
- name: 'arrow',
966
- options,
967
- async fn(state) {
968
- const {
969
- x,
970
- y,
971
- placement,
972
- rects,
973
- platform,
974
- elements,
975
- middlewareData
976
- } = state;
977
- // Since `element` is required, we don't Partial<> the type.
978
- const {
979
- element,
980
- padding = 0
981
- } = evaluate(options, state) || {};
982
- if (element == null) {
983
- return {};
984
- }
985
- const paddingObject = getPaddingObject(padding);
986
- const coords = {
987
- x,
988
- y
989
- };
990
- const axis = getAlignmentAxis(placement);
991
- const length = getAxisLength(axis);
992
- const arrowDimensions = await platform.getDimensions(element);
993
- const isYAxis = axis === 'y';
994
- const minProp = isYAxis ? 'top' : 'left';
995
- const maxProp = isYAxis ? 'bottom' : 'right';
996
- const clientProp = isYAxis ? 'clientHeight' : 'clientWidth';
997
- const endDiff = rects.reference[length] + rects.reference[axis] - coords[axis] - rects.floating[length];
998
- const startDiff = coords[axis] - rects.reference[axis];
999
- const arrowOffsetParent = await (platform.getOffsetParent == null ? void 0 : platform.getOffsetParent(element));
1000
- let clientSize = arrowOffsetParent ? arrowOffsetParent[clientProp] : 0;
1001
-
1002
- // DOM platform can return `window` as the `offsetParent`.
1003
- if (!clientSize || !(await (platform.isElement == null ? void 0 : platform.isElement(arrowOffsetParent)))) {
1004
- clientSize = elements.floating[clientProp] || rects.floating[length];
1005
- }
1006
- const centerToReference = endDiff / 2 - startDiff / 2;
1007
-
1008
- // If the padding is large enough that it causes the arrow to no longer be
1009
- // centered, modify the padding so that it is centered.
1010
- const largestPossiblePadding = clientSize / 2 - arrowDimensions[length] / 2 - 1;
1011
- const minPadding = min(paddingObject[minProp], largestPossiblePadding);
1012
- const maxPadding = min(paddingObject[maxProp], largestPossiblePadding);
1013
-
1014
- // Make sure the arrow doesn't overflow the floating element if the center
1015
- // point is outside the floating element's bounds.
1016
- const min$1 = minPadding;
1017
- const max = clientSize - arrowDimensions[length] - maxPadding;
1018
- const center = clientSize / 2 - arrowDimensions[length] / 2 + centerToReference;
1019
- const offset = clamp(min$1, center, max);
1020
-
1021
- // If the reference is small enough that the arrow's padding causes it to
1022
- // to point to nothing for an aligned placement, adjust the offset of the
1023
- // floating element itself. To ensure `shift()` continues to take action,
1024
- // a single reset is performed when this is true.
1025
- const shouldAddOffset = !middlewareData.arrow && getAlignment(placement) != null && center !== offset && rects.reference[length] / 2 - (center < min$1 ? minPadding : maxPadding) - arrowDimensions[length] / 2 < 0;
1026
- const alignmentOffset = shouldAddOffset ? center < min$1 ? center - min$1 : center - max : 0;
1027
- return {
1028
- [axis]: coords[axis] + alignmentOffset,
1029
- data: {
1030
- [axis]: offset,
1031
- centerOffset: center - offset - alignmentOffset,
1032
- ...(shouldAddOffset && {
1033
- alignmentOffset
1034
- })
1035
- },
1036
- reset: shouldAddOffset
1037
- };
1038
- }
1039
- });
1040
-
1041
- /**
1042
- * Optimizes the visibility of the floating element by flipping the `placement`
1043
- * in order to keep it in view when the preferred placement(s) will overflow the
1044
- * clipping boundary. Alternative to `autoPlacement`.
1045
- * @see https://floating-ui.com/docs/flip
1046
- */
1047
- const flip$1 = function (options) {
1048
- if (options === void 0) {
1049
- options = {};
1050
- }
1051
- return {
1052
- name: 'flip',
1053
- options,
1054
- async fn(state) {
1055
- var _middlewareData$arrow, _middlewareData$flip;
1056
- const {
1057
- placement,
1058
- middlewareData,
1059
- rects,
1060
- initialPlacement,
1061
- platform,
1062
- elements
1063
- } = state;
1064
- const {
1065
- mainAxis: checkMainAxis = true,
1066
- crossAxis: checkCrossAxis = true,
1067
- fallbackPlacements: specifiedFallbackPlacements,
1068
- fallbackStrategy = 'bestFit',
1069
- fallbackAxisSideDirection = 'none',
1070
- flipAlignment = true,
1071
- ...detectOverflowOptions
1072
- } = evaluate(options, state);
1073
-
1074
- // If a reset by the arrow was caused due to an alignment offset being
1075
- // added, we should skip any logic now since `flip()` has already done its
1076
- // work.
1077
- // https://github.com/floating-ui/floating-ui/issues/2549#issuecomment-1719601643
1078
- if ((_middlewareData$arrow = middlewareData.arrow) != null && _middlewareData$arrow.alignmentOffset) {
1079
- return {};
1080
- }
1081
- const side = getSide(placement);
1082
- const initialSideAxis = getSideAxis(initialPlacement);
1083
- const isBasePlacement = getSide(initialPlacement) === initialPlacement;
1084
- const rtl = await (platform.isRTL == null ? void 0 : platform.isRTL(elements.floating));
1085
- const fallbackPlacements = specifiedFallbackPlacements || (isBasePlacement || !flipAlignment ? [getOppositePlacement(initialPlacement)] : getExpandedPlacements(initialPlacement));
1086
- const hasFallbackAxisSideDirection = fallbackAxisSideDirection !== 'none';
1087
- if (!specifiedFallbackPlacements && hasFallbackAxisSideDirection) {
1088
- fallbackPlacements.push(...getOppositeAxisPlacements(initialPlacement, flipAlignment, fallbackAxisSideDirection, rtl));
1089
- }
1090
- const placements = [initialPlacement, ...fallbackPlacements];
1091
- const overflow = await detectOverflow(state, detectOverflowOptions);
1092
- const overflows = [];
1093
- let overflowsData = ((_middlewareData$flip = middlewareData.flip) == null ? void 0 : _middlewareData$flip.overflows) || [];
1094
- if (checkMainAxis) {
1095
- overflows.push(overflow[side]);
1096
- }
1097
- if (checkCrossAxis) {
1098
- const sides = getAlignmentSides(placement, rects, rtl);
1099
- overflows.push(overflow[sides[0]], overflow[sides[1]]);
1100
- }
1101
- overflowsData = [...overflowsData, {
1102
- placement,
1103
- overflows
1104
- }];
1105
-
1106
- // One or more sides is overflowing.
1107
- if (!overflows.every(side => side <= 0)) {
1108
- var _middlewareData$flip2, _overflowsData$filter;
1109
- const nextIndex = (((_middlewareData$flip2 = middlewareData.flip) == null ? void 0 : _middlewareData$flip2.index) || 0) + 1;
1110
- const nextPlacement = placements[nextIndex];
1111
- if (nextPlacement) {
1112
- const ignoreCrossAxisOverflow = checkCrossAxis === 'alignment' ? initialSideAxis !== getSideAxis(nextPlacement) : false;
1113
- if (!ignoreCrossAxisOverflow ||
1114
- // We leave the current main axis only if every placement on that axis
1115
- // overflows the main axis.
1116
- overflowsData.every(d => getSideAxis(d.placement) === initialSideAxis ? d.overflows[0] > 0 : true)) {
1117
- // Try next placement and re-run the lifecycle.
1118
- return {
1119
- data: {
1120
- index: nextIndex,
1121
- overflows: overflowsData
1122
- },
1123
- reset: {
1124
- placement: nextPlacement
1125
- }
1126
- };
1127
- }
1128
- }
1129
-
1130
- // First, find the candidates that fit on the mainAxis side of overflow,
1131
- // then find the placement that fits the best on the main crossAxis side.
1132
- 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;
1133
-
1134
- // Otherwise fallback.
1135
- if (!resetPlacement) {
1136
- switch (fallbackStrategy) {
1137
- case 'bestFit':
1138
- {
1139
- var _overflowsData$filter2;
1140
- const placement = (_overflowsData$filter2 = overflowsData.filter(d => {
1141
- if (hasFallbackAxisSideDirection) {
1142
- const currentSideAxis = getSideAxis(d.placement);
1143
- return currentSideAxis === initialSideAxis ||
1144
- // Create a bias to the `y` side axis due to horizontal
1145
- // reading directions favoring greater width.
1146
- currentSideAxis === 'y';
1147
- }
1148
- return true;
1149
- }).map(d => [d.placement, d.overflows.filter(overflow => overflow > 0).reduce((acc, overflow) => acc + overflow, 0)]).sort((a, b) => a[1] - b[1])[0]) == null ? void 0 : _overflowsData$filter2[0];
1150
- if (placement) {
1151
- resetPlacement = placement;
1152
- }
1153
- break;
1154
- }
1155
- case 'initialPlacement':
1156
- resetPlacement = initialPlacement;
1157
- break;
1158
- }
1159
- }
1160
- if (placement !== resetPlacement) {
1161
- return {
1162
- reset: {
1163
- placement: resetPlacement
1164
- }
1165
- };
1166
- }
1167
- }
1168
- return {};
1169
- }
1170
- };
1171
- };
1172
-
1173
- const originSides = /*#__PURE__*/new Set(['left', 'top']);
1174
-
1175
- // For type backwards-compatibility, the `OffsetOptions` type was also
1176
- // Derivable.
1177
-
1178
- async function convertValueToCoords(state, options) {
1179
- const {
1180
- placement,
1181
- platform,
1182
- elements
1183
- } = state;
1184
- const rtl = await (platform.isRTL == null ? void 0 : platform.isRTL(elements.floating));
1185
- const side = getSide(placement);
1186
- const alignment = getAlignment(placement);
1187
- const isVertical = getSideAxis(placement) === 'y';
1188
- const mainAxisMulti = originSides.has(side) ? -1 : 1;
1189
- const crossAxisMulti = rtl && isVertical ? -1 : 1;
1190
- const rawValue = evaluate(options, state);
1191
-
1192
- // eslint-disable-next-line prefer-const
1193
- let {
1194
- mainAxis,
1195
- crossAxis,
1196
- alignmentAxis
1197
- } = typeof rawValue === 'number' ? {
1198
- mainAxis: rawValue,
1199
- crossAxis: 0,
1200
- alignmentAxis: null
1201
- } : {
1202
- mainAxis: rawValue.mainAxis || 0,
1203
- crossAxis: rawValue.crossAxis || 0,
1204
- alignmentAxis: rawValue.alignmentAxis
1205
- };
1206
- if (alignment && typeof alignmentAxis === 'number') {
1207
- crossAxis = alignment === 'end' ? alignmentAxis * -1 : alignmentAxis;
1208
- }
1209
- return isVertical ? {
1210
- x: crossAxis * crossAxisMulti,
1211
- y: mainAxis * mainAxisMulti
1212
- } : {
1213
- x: mainAxis * mainAxisMulti,
1214
- y: crossAxis * crossAxisMulti
1215
- };
1216
- }
1217
-
1218
- /**
1219
- * Modifies the placement by translating the floating element along the
1220
- * specified axes.
1221
- * A number (shorthand for `mainAxis` or distance), or an axes configuration
1222
- * object may be passed.
1223
- * @see https://floating-ui.com/docs/offset
1224
- */
1225
- const offset$1 = function (options) {
1226
- if (options === void 0) {
1227
- options = 0;
1228
- }
1229
- return {
1230
- name: 'offset',
1231
- options,
1232
- async fn(state) {
1233
- var _middlewareData$offse, _middlewareData$arrow;
1234
- const {
1235
- x,
1236
- y,
1237
- placement,
1238
- middlewareData
1239
- } = state;
1240
- const diffCoords = await convertValueToCoords(state, options);
1241
-
1242
- // If the placement is the same and the arrow caused an alignment offset
1243
- // then we don't need to change the positioning coordinates.
1244
- if (placement === ((_middlewareData$offse = middlewareData.offset) == null ? void 0 : _middlewareData$offse.placement) && (_middlewareData$arrow = middlewareData.arrow) != null && _middlewareData$arrow.alignmentOffset) {
1245
- return {};
1246
- }
1247
- return {
1248
- x: x + diffCoords.x,
1249
- y: y + diffCoords.y,
1250
- data: {
1251
- ...diffCoords,
1252
- placement
1253
- }
1254
- };
1255
- }
1256
- };
1257
- };
1258
-
1259
- /**
1260
- * Optimizes the visibility of the floating element by shifting it in order to
1261
- * keep it in view when it will overflow the clipping boundary.
1262
- * @see https://floating-ui.com/docs/shift
1263
- */
1264
- const shift$1 = function (options) {
1265
- if (options === void 0) {
1266
- options = {};
1267
- }
1268
- return {
1269
- name: 'shift',
1270
- options,
1271
- async fn(state) {
1272
- const {
1273
- x,
1274
- y,
1275
- placement
1276
- } = state;
1277
- const {
1278
- mainAxis: checkMainAxis = true,
1279
- crossAxis: checkCrossAxis = false,
1280
- limiter = {
1281
- fn: _ref => {
1282
- let {
1283
- x,
1284
- y
1285
- } = _ref;
1286
- return {
1287
- x,
1288
- y
1289
- };
1290
- }
1291
- },
1292
- ...detectOverflowOptions
1293
- } = evaluate(options, state);
1294
- const coords = {
1295
- x,
1296
- y
1297
- };
1298
- const overflow = await detectOverflow(state, detectOverflowOptions);
1299
- const crossAxis = getSideAxis(getSide(placement));
1300
- const mainAxis = getOppositeAxis(crossAxis);
1301
- let mainAxisCoord = coords[mainAxis];
1302
- let crossAxisCoord = coords[crossAxis];
1303
- if (checkMainAxis) {
1304
- const minSide = mainAxis === 'y' ? 'top' : 'left';
1305
- const maxSide = mainAxis === 'y' ? 'bottom' : 'right';
1306
- const min = mainAxisCoord + overflow[minSide];
1307
- const max = mainAxisCoord - overflow[maxSide];
1308
- mainAxisCoord = clamp(min, mainAxisCoord, max);
1309
- }
1310
- if (checkCrossAxis) {
1311
- const minSide = crossAxis === 'y' ? 'top' : 'left';
1312
- const maxSide = crossAxis === 'y' ? 'bottom' : 'right';
1313
- const min = crossAxisCoord + overflow[minSide];
1314
- const max = crossAxisCoord - overflow[maxSide];
1315
- crossAxisCoord = clamp(min, crossAxisCoord, max);
1316
- }
1317
- const limitedCoords = limiter.fn({
1318
- ...state,
1319
- [mainAxis]: mainAxisCoord,
1320
- [crossAxis]: crossAxisCoord
1321
- });
1322
- return {
1323
- ...limitedCoords,
1324
- data: {
1325
- x: limitedCoords.x - x,
1326
- y: limitedCoords.y - y,
1327
- enabled: {
1328
- [mainAxis]: checkMainAxis,
1329
- [crossAxis]: checkCrossAxis
1330
- }
1331
- }
1332
- };
1333
- }
1334
- };
1335
- };
1336
-
1337
- function hasWindow() {
1338
- return typeof window !== 'undefined';
1339
- }
1340
- function getNodeName(node) {
1341
- if (isNode(node)) {
1342
- return (node.nodeName || '').toLowerCase();
1343
- }
1344
- // Mocked nodes in testing environments may not be instances of Node. By
1345
- // returning `#document` an infinite loop won't occur.
1346
- // https://github.com/floating-ui/floating-ui/issues/2317
1347
- return '#document';
1348
- }
1349
- function getWindow(node) {
1350
- var _node$ownerDocument;
1351
- return (node == null || (_node$ownerDocument = node.ownerDocument) == null ? void 0 : _node$ownerDocument.defaultView) || window;
1352
- }
1353
- function getDocumentElement(node) {
1354
- var _ref;
1355
- return (_ref = (isNode(node) ? node.ownerDocument : node.document) || window.document) == null ? void 0 : _ref.documentElement;
1356
- }
1357
- function isNode(value) {
1358
- if (!hasWindow()) {
1359
- return false;
1360
- }
1361
- return value instanceof Node || value instanceof getWindow(value).Node;
1362
- }
1363
- function isElement(value) {
1364
- if (!hasWindow()) {
1365
- return false;
1366
- }
1367
- return value instanceof Element || value instanceof getWindow(value).Element;
1368
- }
1369
- function isHTMLElement(value) {
1370
- if (!hasWindow()) {
1371
- return false;
1372
- }
1373
- return value instanceof HTMLElement || value instanceof getWindow(value).HTMLElement;
1374
- }
1375
- function isShadowRoot(value) {
1376
- if (!hasWindow() || typeof ShadowRoot === 'undefined') {
1377
- return false;
1378
- }
1379
- return value instanceof ShadowRoot || value instanceof getWindow(value).ShadowRoot;
1380
- }
1381
- const invalidOverflowDisplayValues = /*#__PURE__*/new Set(['inline', 'contents']);
1382
- function isOverflowElement(element) {
1383
- const {
1384
- overflow,
1385
- overflowX,
1386
- overflowY,
1387
- display
1388
- } = getComputedStyle$1(element);
1389
- return /auto|scroll|overlay|hidden|clip/.test(overflow + overflowY + overflowX) && !invalidOverflowDisplayValues.has(display);
1390
- }
1391
- const tableElements = /*#__PURE__*/new Set(['table', 'td', 'th']);
1392
- function isTableElement(element) {
1393
- return tableElements.has(getNodeName(element));
1394
- }
1395
- const topLayerSelectors = [':popover-open', ':modal'];
1396
- function isTopLayer(element) {
1397
- return topLayerSelectors.some(selector => {
1398
- try {
1399
- return element.matches(selector);
1400
- } catch (_e) {
1401
- return false;
1402
- }
1403
- });
1404
- }
1405
- const transformProperties = ['transform', 'translate', 'scale', 'rotate', 'perspective'];
1406
- const willChangeValues = ['transform', 'translate', 'scale', 'rotate', 'perspective', 'filter'];
1407
- const containValues = ['paint', 'layout', 'strict', 'content'];
1408
- function isContainingBlock(elementOrCss) {
1409
- const webkit = isWebKit();
1410
- const css = isElement(elementOrCss) ? getComputedStyle$1(elementOrCss) : elementOrCss;
1411
-
1412
- // https://developer.mozilla.org/en-US/docs/Web/CSS/Containing_block#identifying_the_containing_block
1413
- // https://drafts.csswg.org/css-transforms-2/#individual-transforms
1414
- return transformProperties.some(value => css[value] ? css[value] !== 'none' : false) || (css.containerType ? css.containerType !== 'normal' : false) || !webkit && (css.backdropFilter ? css.backdropFilter !== 'none' : false) || !webkit && (css.filter ? css.filter !== 'none' : false) || willChangeValues.some(value => (css.willChange || '').includes(value)) || containValues.some(value => (css.contain || '').includes(value));
1415
- }
1416
- function getContainingBlock(element) {
1417
- let currentNode = getParentNode(element);
1418
- while (isHTMLElement(currentNode) && !isLastTraversableNode(currentNode)) {
1419
- if (isContainingBlock(currentNode)) {
1420
- return currentNode;
1421
- } else if (isTopLayer(currentNode)) {
1422
- return null;
1423
- }
1424
- currentNode = getParentNode(currentNode);
1425
- }
1426
- return null;
1427
- }
1428
- function isWebKit() {
1429
- if (typeof CSS === 'undefined' || !CSS.supports) return false;
1430
- return CSS.supports('-webkit-backdrop-filter', 'none');
1431
- }
1432
- const lastTraversableNodeNames = /*#__PURE__*/new Set(['html', 'body', '#document']);
1433
- function isLastTraversableNode(node) {
1434
- return lastTraversableNodeNames.has(getNodeName(node));
1435
- }
1436
- function getComputedStyle$1(element) {
1437
- return getWindow(element).getComputedStyle(element);
1438
- }
1439
- function getNodeScroll(element) {
1440
- if (isElement(element)) {
1441
- return {
1442
- scrollLeft: element.scrollLeft,
1443
- scrollTop: element.scrollTop
1444
- };
1445
- }
1446
- return {
1447
- scrollLeft: element.scrollX,
1448
- scrollTop: element.scrollY
1449
- };
1450
- }
1451
- function getParentNode(node) {
1452
- if (getNodeName(node) === 'html') {
1453
- return node;
1454
- }
1455
- const result =
1456
- // Step into the shadow DOM of the parent of a slotted node.
1457
- node.assignedSlot ||
1458
- // DOM Element detected.
1459
- node.parentNode ||
1460
- // ShadowRoot detected.
1461
- isShadowRoot(node) && node.host ||
1462
- // Fallback.
1463
- getDocumentElement(node);
1464
- return isShadowRoot(result) ? result.host : result;
1465
- }
1466
- function getNearestOverflowAncestor(node) {
1467
- const parentNode = getParentNode(node);
1468
- if (isLastTraversableNode(parentNode)) {
1469
- return node.ownerDocument ? node.ownerDocument.body : node.body;
1470
- }
1471
- if (isHTMLElement(parentNode) && isOverflowElement(parentNode)) {
1472
- return parentNode;
1473
- }
1474
- return getNearestOverflowAncestor(parentNode);
1475
- }
1476
- function getOverflowAncestors(node, list, traverseIframes) {
1477
- var _node$ownerDocument2;
1478
- if (list === void 0) {
1479
- list = [];
1480
- }
1481
- if (traverseIframes === void 0) {
1482
- traverseIframes = true;
1483
- }
1484
- const scrollableAncestor = getNearestOverflowAncestor(node);
1485
- const isBody = scrollableAncestor === ((_node$ownerDocument2 = node.ownerDocument) == null ? void 0 : _node$ownerDocument2.body);
1486
- const win = getWindow(scrollableAncestor);
1487
- if (isBody) {
1488
- const frameElement = getFrameElement(win);
1489
- return list.concat(win, win.visualViewport || [], isOverflowElement(scrollableAncestor) ? scrollableAncestor : [], frameElement && traverseIframes ? getOverflowAncestors(frameElement) : []);
1490
- }
1491
- return list.concat(scrollableAncestor, getOverflowAncestors(scrollableAncestor, [], traverseIframes));
1492
- }
1493
- function getFrameElement(win) {
1494
- return win.parent && Object.getPrototypeOf(win.parent) ? win.frameElement : null;
1495
- }
1496
-
1497
- function getCssDimensions(element) {
1498
- const css = getComputedStyle$1(element);
1499
- // In testing environments, the `width` and `height` properties are empty
1500
- // strings for SVG elements, returning NaN. Fallback to `0` in this case.
1501
- let width = parseFloat(css.width) || 0;
1502
- let height = parseFloat(css.height) || 0;
1503
- const hasOffset = isHTMLElement(element);
1504
- const offsetWidth = hasOffset ? element.offsetWidth : width;
1505
- const offsetHeight = hasOffset ? element.offsetHeight : height;
1506
- const shouldFallback = round(width) !== offsetWidth || round(height) !== offsetHeight;
1507
- if (shouldFallback) {
1508
- width = offsetWidth;
1509
- height = offsetHeight;
1510
- }
1511
- return {
1512
- width,
1513
- height,
1514
- $: shouldFallback
1515
- };
1516
- }
1517
-
1518
- function unwrapElement(element) {
1519
- return !isElement(element) ? element.contextElement : element;
1520
- }
1521
-
1522
- function getScale(element) {
1523
- const domElement = unwrapElement(element);
1524
- if (!isHTMLElement(domElement)) {
1525
- return createCoords(1);
1526
- }
1527
- const rect = domElement.getBoundingClientRect();
1528
- const {
1529
- width,
1530
- height,
1531
- $
1532
- } = getCssDimensions(domElement);
1533
- let x = ($ ? round(rect.width) : rect.width) / width;
1534
- let y = ($ ? round(rect.height) : rect.height) / height;
1535
-
1536
- // 0, NaN, or Infinity should always fallback to 1.
1537
-
1538
- if (!x || !Number.isFinite(x)) {
1539
- x = 1;
1540
- }
1541
- if (!y || !Number.isFinite(y)) {
1542
- y = 1;
1543
- }
1544
- return {
1545
- x,
1546
- y
1547
- };
1548
- }
1549
-
1550
- const noOffsets = /*#__PURE__*/createCoords(0);
1551
- function getVisualOffsets(element) {
1552
- const win = getWindow(element);
1553
- if (!isWebKit() || !win.visualViewport) {
1554
- return noOffsets;
1555
- }
1556
- return {
1557
- x: win.visualViewport.offsetLeft,
1558
- y: win.visualViewport.offsetTop
1559
- };
1560
- }
1561
- function shouldAddVisualOffsets(element, isFixed, floatingOffsetParent) {
1562
- if (isFixed === void 0) {
1563
- isFixed = false;
1564
- }
1565
- if (!floatingOffsetParent || isFixed && floatingOffsetParent !== getWindow(element)) {
1566
- return false;
1567
- }
1568
- return isFixed;
1569
- }
1570
-
1571
- function getBoundingClientRect(element, includeScale, isFixedStrategy, offsetParent) {
1572
- if (includeScale === void 0) {
1573
- includeScale = false;
1574
- }
1575
- if (isFixedStrategy === void 0) {
1576
- isFixedStrategy = false;
1577
- }
1578
- const clientRect = element.getBoundingClientRect();
1579
- const domElement = unwrapElement(element);
1580
- let scale = createCoords(1);
1581
- if (includeScale) {
1582
- if (offsetParent) {
1583
- if (isElement(offsetParent)) {
1584
- scale = getScale(offsetParent);
1585
- }
1586
- } else {
1587
- scale = getScale(element);
1588
- }
1589
- }
1590
- const visualOffsets = shouldAddVisualOffsets(domElement, isFixedStrategy, offsetParent) ? getVisualOffsets(domElement) : createCoords(0);
1591
- let x = (clientRect.left + visualOffsets.x) / scale.x;
1592
- let y = (clientRect.top + visualOffsets.y) / scale.y;
1593
- let width = clientRect.width / scale.x;
1594
- let height = clientRect.height / scale.y;
1595
- if (domElement) {
1596
- const win = getWindow(domElement);
1597
- const offsetWin = offsetParent && isElement(offsetParent) ? getWindow(offsetParent) : offsetParent;
1598
- let currentWin = win;
1599
- let currentIFrame = getFrameElement(currentWin);
1600
- while (currentIFrame && offsetParent && offsetWin !== currentWin) {
1601
- const iframeScale = getScale(currentIFrame);
1602
- const iframeRect = currentIFrame.getBoundingClientRect();
1603
- const css = getComputedStyle$1(currentIFrame);
1604
- const left = iframeRect.left + (currentIFrame.clientLeft + parseFloat(css.paddingLeft)) * iframeScale.x;
1605
- const top = iframeRect.top + (currentIFrame.clientTop + parseFloat(css.paddingTop)) * iframeScale.y;
1606
- x *= iframeScale.x;
1607
- y *= iframeScale.y;
1608
- width *= iframeScale.x;
1609
- height *= iframeScale.y;
1610
- x += left;
1611
- y += top;
1612
- currentWin = getWindow(currentIFrame);
1613
- currentIFrame = getFrameElement(currentWin);
1614
- }
1615
- }
1616
- return rectToClientRect({
1617
- width,
1618
- height,
1619
- x,
1620
- y
1621
- });
1622
- }
1623
-
1624
- // If <html> has a CSS width greater than the viewport, then this will be
1625
- // incorrect for RTL.
1626
- function getWindowScrollBarX(element, rect) {
1627
- const leftScroll = getNodeScroll(element).scrollLeft;
1628
- if (!rect) {
1629
- return getBoundingClientRect(getDocumentElement(element)).left + leftScroll;
1630
- }
1631
- return rect.left + leftScroll;
1632
- }
1633
-
1634
- function getHTMLOffset(documentElement, scroll) {
1635
- const htmlRect = documentElement.getBoundingClientRect();
1636
- const x = htmlRect.left + scroll.scrollLeft - getWindowScrollBarX(documentElement, htmlRect);
1637
- const y = htmlRect.top + scroll.scrollTop;
1638
- return {
1639
- x,
1640
- y
1641
- };
1642
- }
1643
-
1644
- function convertOffsetParentRelativeRectToViewportRelativeRect(_ref) {
1645
- let {
1646
- elements,
1647
- rect,
1648
- offsetParent,
1649
- strategy
1650
- } = _ref;
1651
- const isFixed = strategy === 'fixed';
1652
- const documentElement = getDocumentElement(offsetParent);
1653
- const topLayer = elements ? isTopLayer(elements.floating) : false;
1654
- if (offsetParent === documentElement || topLayer && isFixed) {
1655
- return rect;
1656
- }
1657
- let scroll = {
1658
- scrollLeft: 0,
1659
- scrollTop: 0
1660
- };
1661
- let scale = createCoords(1);
1662
- const offsets = createCoords(0);
1663
- const isOffsetParentAnElement = isHTMLElement(offsetParent);
1664
- if (isOffsetParentAnElement || !isOffsetParentAnElement && !isFixed) {
1665
- if (getNodeName(offsetParent) !== 'body' || isOverflowElement(documentElement)) {
1666
- scroll = getNodeScroll(offsetParent);
1667
- }
1668
- if (isHTMLElement(offsetParent)) {
1669
- const offsetRect = getBoundingClientRect(offsetParent);
1670
- scale = getScale(offsetParent);
1671
- offsets.x = offsetRect.x + offsetParent.clientLeft;
1672
- offsets.y = offsetRect.y + offsetParent.clientTop;
1673
- }
1674
- }
1675
- const htmlOffset = documentElement && !isOffsetParentAnElement && !isFixed ? getHTMLOffset(documentElement, scroll) : createCoords(0);
1676
- return {
1677
- width: rect.width * scale.x,
1678
- height: rect.height * scale.y,
1679
- x: rect.x * scale.x - scroll.scrollLeft * scale.x + offsets.x + htmlOffset.x,
1680
- y: rect.y * scale.y - scroll.scrollTop * scale.y + offsets.y + htmlOffset.y
1681
- };
1682
- }
1683
-
1684
- function getClientRects(element) {
1685
- return Array.from(element.getClientRects());
1686
- }
1687
-
1688
- // Gets the entire size of the scrollable document area, even extending outside
1689
- // of the `<html>` and `<body>` rect bounds if horizontally scrollable.
1690
- function getDocumentRect(element) {
1691
- const html = getDocumentElement(element);
1692
- const scroll = getNodeScroll(element);
1693
- const body = element.ownerDocument.body;
1694
- const width = max(html.scrollWidth, html.clientWidth, body.scrollWidth, body.clientWidth);
1695
- const height = max(html.scrollHeight, html.clientHeight, body.scrollHeight, body.clientHeight);
1696
- let x = -scroll.scrollLeft + getWindowScrollBarX(element);
1697
- const y = -scroll.scrollTop;
1698
- if (getComputedStyle$1(body).direction === 'rtl') {
1699
- x += max(html.clientWidth, body.clientWidth) - width;
1700
- }
1701
- return {
1702
- width,
1703
- height,
1704
- x,
1705
- y
1706
- };
1707
- }
1708
-
1709
- // Safety check: ensure the scrollbar space is reasonable in case this
1710
- // calculation is affected by unusual styles.
1711
- // Most scrollbars leave 15-18px of space.
1712
- const SCROLLBAR_MAX = 25;
1713
- function getViewportRect(element, strategy) {
1714
- const win = getWindow(element);
1715
- const html = getDocumentElement(element);
1716
- const visualViewport = win.visualViewport;
1717
- let width = html.clientWidth;
1718
- let height = html.clientHeight;
1719
- let x = 0;
1720
- let y = 0;
1721
- if (visualViewport) {
1722
- width = visualViewport.width;
1723
- height = visualViewport.height;
1724
- const visualViewportBased = isWebKit();
1725
- if (!visualViewportBased || visualViewportBased && strategy === 'fixed') {
1726
- x = visualViewport.offsetLeft;
1727
- y = visualViewport.offsetTop;
1728
- }
1729
- }
1730
- const windowScrollbarX = getWindowScrollBarX(html);
1731
- // <html> `overflow: hidden` + `scrollbar-gutter: stable` reduces the
1732
- // visual width of the <html> but this is not considered in the size
1733
- // of `html.clientWidth`.
1734
- if (windowScrollbarX <= 0) {
1735
- const doc = html.ownerDocument;
1736
- const body = doc.body;
1737
- const bodyStyles = getComputedStyle(body);
1738
- const bodyMarginInline = doc.compatMode === 'CSS1Compat' ? parseFloat(bodyStyles.marginLeft) + parseFloat(bodyStyles.marginRight) || 0 : 0;
1739
- const clippingStableScrollbarWidth = Math.abs(html.clientWidth - body.clientWidth - bodyMarginInline);
1740
- if (clippingStableScrollbarWidth <= SCROLLBAR_MAX) {
1741
- width -= clippingStableScrollbarWidth;
1742
- }
1743
- } else if (windowScrollbarX <= SCROLLBAR_MAX) {
1744
- // If the <body> scrollbar is on the left, the width needs to be extended
1745
- // by the scrollbar amount so there isn't extra space on the right.
1746
- width += windowScrollbarX;
1747
- }
1748
- return {
1749
- width,
1750
- height,
1751
- x,
1752
- y
1753
- };
1754
- }
1755
-
1756
- const absoluteOrFixed = /*#__PURE__*/new Set(['absolute', 'fixed']);
1757
- // Returns the inner client rect, subtracting scrollbars if present.
1758
- function getInnerBoundingClientRect(element, strategy) {
1759
- const clientRect = getBoundingClientRect(element, true, strategy === 'fixed');
1760
- const top = clientRect.top + element.clientTop;
1761
- const left = clientRect.left + element.clientLeft;
1762
- const scale = isHTMLElement(element) ? getScale(element) : createCoords(1);
1763
- const width = element.clientWidth * scale.x;
1764
- const height = element.clientHeight * scale.y;
1765
- const x = left * scale.x;
1766
- const y = top * scale.y;
1767
- return {
1768
- width,
1769
- height,
1770
- x,
1771
- y
1772
- };
1773
- }
1774
- function getClientRectFromClippingAncestor(element, clippingAncestor, strategy) {
1775
- let rect;
1776
- if (clippingAncestor === 'viewport') {
1777
- rect = getViewportRect(element, strategy);
1778
- } else if (clippingAncestor === 'document') {
1779
- rect = getDocumentRect(getDocumentElement(element));
1780
- } else if (isElement(clippingAncestor)) {
1781
- rect = getInnerBoundingClientRect(clippingAncestor, strategy);
1782
- } else {
1783
- const visualOffsets = getVisualOffsets(element);
1784
- rect = {
1785
- x: clippingAncestor.x - visualOffsets.x,
1786
- y: clippingAncestor.y - visualOffsets.y,
1787
- width: clippingAncestor.width,
1788
- height: clippingAncestor.height
1789
- };
1790
- }
1791
- return rectToClientRect(rect);
1792
- }
1793
- function hasFixedPositionAncestor(element, stopNode) {
1794
- const parentNode = getParentNode(element);
1795
- if (parentNode === stopNode || !isElement(parentNode) || isLastTraversableNode(parentNode)) {
1796
- return false;
1797
- }
1798
- return getComputedStyle$1(parentNode).position === 'fixed' || hasFixedPositionAncestor(parentNode, stopNode);
1799
- }
1800
-
1801
- // A "clipping ancestor" is an `overflow` element with the characteristic of
1802
- // clipping (or hiding) child elements. This returns all clipping ancestors
1803
- // of the given element up the tree.
1804
- function getClippingElementAncestors(element, cache) {
1805
- const cachedResult = cache.get(element);
1806
- if (cachedResult) {
1807
- return cachedResult;
1808
- }
1809
- let result = getOverflowAncestors(element, [], false).filter(el => isElement(el) && getNodeName(el) !== 'body');
1810
- let currentContainingBlockComputedStyle = null;
1811
- const elementIsFixed = getComputedStyle$1(element).position === 'fixed';
1812
- let currentNode = elementIsFixed ? getParentNode(element) : element;
1813
-
1814
- // https://developer.mozilla.org/en-US/docs/Web/CSS/Containing_block#identifying_the_containing_block
1815
- while (isElement(currentNode) && !isLastTraversableNode(currentNode)) {
1816
- const computedStyle = getComputedStyle$1(currentNode);
1817
- const currentNodeIsContaining = isContainingBlock(currentNode);
1818
- if (!currentNodeIsContaining && computedStyle.position === 'fixed') {
1819
- currentContainingBlockComputedStyle = null;
1820
- }
1821
- const shouldDropCurrentNode = elementIsFixed ? !currentNodeIsContaining && !currentContainingBlockComputedStyle : !currentNodeIsContaining && computedStyle.position === 'static' && !!currentContainingBlockComputedStyle && absoluteOrFixed.has(currentContainingBlockComputedStyle.position) || isOverflowElement(currentNode) && !currentNodeIsContaining && hasFixedPositionAncestor(element, currentNode);
1822
- if (shouldDropCurrentNode) {
1823
- // Drop non-containing blocks.
1824
- result = result.filter(ancestor => ancestor !== currentNode);
1825
- } else {
1826
- // Record last containing block for next iteration.
1827
- currentContainingBlockComputedStyle = computedStyle;
1828
- }
1829
- currentNode = getParentNode(currentNode);
1830
- }
1831
- cache.set(element, result);
1832
- return result;
1833
- }
1834
-
1835
- // Gets the maximum area that the element is visible in due to any number of
1836
- // clipping ancestors.
1837
- function getClippingRect(_ref) {
1838
- let {
1839
- element,
1840
- boundary,
1841
- rootBoundary,
1842
- strategy
1843
- } = _ref;
1844
- const elementClippingAncestors = boundary === 'clippingAncestors' ? isTopLayer(element) ? [] : getClippingElementAncestors(element, this._c) : [].concat(boundary);
1845
- const clippingAncestors = [...elementClippingAncestors, rootBoundary];
1846
- const firstClippingAncestor = clippingAncestors[0];
1847
- const clippingRect = clippingAncestors.reduce((accRect, clippingAncestor) => {
1848
- const rect = getClientRectFromClippingAncestor(element, clippingAncestor, strategy);
1849
- accRect.top = max(rect.top, accRect.top);
1850
- accRect.right = min(rect.right, accRect.right);
1851
- accRect.bottom = min(rect.bottom, accRect.bottom);
1852
- accRect.left = max(rect.left, accRect.left);
1853
- return accRect;
1854
- }, getClientRectFromClippingAncestor(element, firstClippingAncestor, strategy));
1855
- return {
1856
- width: clippingRect.right - clippingRect.left,
1857
- height: clippingRect.bottom - clippingRect.top,
1858
- x: clippingRect.left,
1859
- y: clippingRect.top
1860
- };
1861
- }
1862
-
1863
- function getDimensions(element) {
1864
- const {
1865
- width,
1866
- height
1867
- } = getCssDimensions(element);
1868
- return {
1869
- width,
1870
- height
1871
- };
1872
- }
1873
-
1874
- function getRectRelativeToOffsetParent(element, offsetParent, strategy) {
1875
- const isOffsetParentAnElement = isHTMLElement(offsetParent);
1876
- const documentElement = getDocumentElement(offsetParent);
1877
- const isFixed = strategy === 'fixed';
1878
- const rect = getBoundingClientRect(element, true, isFixed, offsetParent);
1879
- let scroll = {
1880
- scrollLeft: 0,
1881
- scrollTop: 0
1882
- };
1883
- const offsets = createCoords(0);
1884
-
1885
- // If the <body> scrollbar appears on the left (e.g. RTL systems). Use
1886
- // Firefox with layout.scrollbar.side = 3 in about:config to test this.
1887
- function setLeftRTLScrollbarOffset() {
1888
- offsets.x = getWindowScrollBarX(documentElement);
1889
- }
1890
- if (isOffsetParentAnElement || !isOffsetParentAnElement && !isFixed) {
1891
- if (getNodeName(offsetParent) !== 'body' || isOverflowElement(documentElement)) {
1892
- scroll = getNodeScroll(offsetParent);
1893
- }
1894
- if (isOffsetParentAnElement) {
1895
- const offsetRect = getBoundingClientRect(offsetParent, true, isFixed, offsetParent);
1896
- offsets.x = offsetRect.x + offsetParent.clientLeft;
1897
- offsets.y = offsetRect.y + offsetParent.clientTop;
1898
- } else if (documentElement) {
1899
- setLeftRTLScrollbarOffset();
1900
- }
1901
- }
1902
- if (isFixed && !isOffsetParentAnElement && documentElement) {
1903
- setLeftRTLScrollbarOffset();
1904
- }
1905
- const htmlOffset = documentElement && !isOffsetParentAnElement && !isFixed ? getHTMLOffset(documentElement, scroll) : createCoords(0);
1906
- const x = rect.left + scroll.scrollLeft - offsets.x - htmlOffset.x;
1907
- const y = rect.top + scroll.scrollTop - offsets.y - htmlOffset.y;
1908
- return {
1909
- x,
1910
- y,
1911
- width: rect.width,
1912
- height: rect.height
1913
- };
1914
- }
1915
-
1916
- function isStaticPositioned(element) {
1917
- return getComputedStyle$1(element).position === 'static';
1918
- }
1919
-
1920
- function getTrueOffsetParent(element, polyfill) {
1921
- if (!isHTMLElement(element) || getComputedStyle$1(element).position === 'fixed') {
1922
- return null;
1923
- }
1924
- if (polyfill) {
1925
- return polyfill(element);
1926
- }
1927
- let rawOffsetParent = element.offsetParent;
1928
-
1929
- // Firefox returns the <html> element as the offsetParent if it's non-static,
1930
- // while Chrome and Safari return the <body> element. The <body> element must
1931
- // be used to perform the correct calculations even if the <html> element is
1932
- // non-static.
1933
- if (getDocumentElement(element) === rawOffsetParent) {
1934
- rawOffsetParent = rawOffsetParent.ownerDocument.body;
1935
- }
1936
- return rawOffsetParent;
1937
- }
1938
-
1939
- // Gets the closest ancestor positioned element. Handles some edge cases,
1940
- // such as table ancestors and cross browser bugs.
1941
- function getOffsetParent(element, polyfill) {
1942
- const win = getWindow(element);
1943
- if (isTopLayer(element)) {
1944
- return win;
1945
- }
1946
- if (!isHTMLElement(element)) {
1947
- let svgOffsetParent = getParentNode(element);
1948
- while (svgOffsetParent && !isLastTraversableNode(svgOffsetParent)) {
1949
- if (isElement(svgOffsetParent) && !isStaticPositioned(svgOffsetParent)) {
1950
- return svgOffsetParent;
1951
- }
1952
- svgOffsetParent = getParentNode(svgOffsetParent);
1953
- }
1954
- return win;
1955
- }
1956
- let offsetParent = getTrueOffsetParent(element, polyfill);
1957
- while (offsetParent && isTableElement(offsetParent) && isStaticPositioned(offsetParent)) {
1958
- offsetParent = getTrueOffsetParent(offsetParent, polyfill);
1959
- }
1960
- if (offsetParent && isLastTraversableNode(offsetParent) && isStaticPositioned(offsetParent) && !isContainingBlock(offsetParent)) {
1961
- return win;
1962
- }
1963
- return offsetParent || getContainingBlock(element) || win;
1964
- }
1965
-
1966
- const getElementRects = async function (data) {
1967
- const getOffsetParentFn = this.getOffsetParent || getOffsetParent;
1968
- const getDimensionsFn = this.getDimensions;
1969
- const floatingDimensions = await getDimensionsFn(data.floating);
1970
- return {
1971
- reference: getRectRelativeToOffsetParent(data.reference, await getOffsetParentFn(data.floating), data.strategy),
1972
- floating: {
1973
- x: 0,
1974
- y: 0,
1975
- width: floatingDimensions.width,
1976
- height: floatingDimensions.height
1977
- }
1978
- };
1979
- };
1980
-
1981
- function isRTL(element) {
1982
- return getComputedStyle$1(element).direction === 'rtl';
1983
- }
1984
-
1985
- const platform = {
1986
- convertOffsetParentRelativeRectToViewportRelativeRect,
1987
- getDocumentElement,
1988
- getClippingRect,
1989
- getOffsetParent,
1990
- getElementRects,
1991
- getClientRects,
1992
- getDimensions,
1993
- getScale,
1994
- isElement,
1995
- isRTL
1996
- };
1997
-
1998
- function rectsAreEqual(a, b) {
1999
- return a.x === b.x && a.y === b.y && a.width === b.width && a.height === b.height;
2000
- }
2001
-
2002
- // https://samthor.au/2021/observing-dom/
2003
- function observeMove(element, onMove) {
2004
- let io = null;
2005
- let timeoutId;
2006
- const root = getDocumentElement(element);
2007
- function cleanup() {
2008
- var _io;
2009
- clearTimeout(timeoutId);
2010
- (_io = io) == null || _io.disconnect();
2011
- io = null;
2012
- }
2013
- function refresh(skip, threshold) {
2014
- if (skip === void 0) {
2015
- skip = false;
2016
- }
2017
- if (threshold === void 0) {
2018
- threshold = 1;
2019
- }
2020
- cleanup();
2021
- const elementRectForRootMargin = element.getBoundingClientRect();
2022
- const {
2023
- left,
2024
- top,
2025
- width,
2026
- height
2027
- } = elementRectForRootMargin;
2028
- if (!skip) {
2029
- onMove();
2030
- }
2031
- if (!width || !height) {
2032
- return;
2033
- }
2034
- const insetTop = floor(top);
2035
- const insetRight = floor(root.clientWidth - (left + width));
2036
- const insetBottom = floor(root.clientHeight - (top + height));
2037
- const insetLeft = floor(left);
2038
- const rootMargin = -insetTop + "px " + -insetRight + "px " + -insetBottom + "px " + -insetLeft + "px";
2039
- const options = {
2040
- rootMargin,
2041
- threshold: max(0, min(1, threshold)) || 1
2042
- };
2043
- let isFirstUpdate = true;
2044
- function handleObserve(entries) {
2045
- const ratio = entries[0].intersectionRatio;
2046
- if (ratio !== threshold) {
2047
- if (!isFirstUpdate) {
2048
- return refresh();
2049
- }
2050
- if (!ratio) {
2051
- // If the reference is clipped, the ratio is 0. Throttle the refresh
2052
- // to prevent an infinite loop of updates.
2053
- timeoutId = setTimeout(() => {
2054
- refresh(false, 1e-7);
2055
- }, 1000);
2056
- } else {
2057
- refresh(false, ratio);
2058
- }
2059
- }
2060
- if (ratio === 1 && !rectsAreEqual(elementRectForRootMargin, element.getBoundingClientRect())) {
2061
- // It's possible that even though the ratio is reported as 1, the
2062
- // element is not actually fully within the IntersectionObserver's root
2063
- // area anymore. This can happen under performance constraints. This may
2064
- // be a bug in the browser's IntersectionObserver implementation. To
2065
- // work around this, we compare the element's bounding rect now with
2066
- // what it was at the time we created the IntersectionObserver. If they
2067
- // are not equal then the element moved, so we refresh.
2068
- refresh();
2069
- }
2070
- isFirstUpdate = false;
2071
- }
2072
-
2073
- // Older browsers don't support a `document` as the root and will throw an
2074
- // error.
2075
- try {
2076
- io = new IntersectionObserver(handleObserve, {
2077
- ...options,
2078
- // Handle <iframe>s
2079
- root: root.ownerDocument
2080
- });
2081
- } catch (_e) {
2082
- io = new IntersectionObserver(handleObserve, options);
2083
- }
2084
- io.observe(element);
2085
- }
2086
- refresh(true);
2087
- return cleanup;
2088
- }
2089
-
2090
- /**
2091
- * Automatically updates the position of the floating element when necessary.
2092
- * Should only be called when the floating element is mounted on the DOM or
2093
- * visible on the screen.
2094
- * @returns cleanup function that should be invoked when the floating element is
2095
- * removed from the DOM or hidden from the screen.
2096
- * @see https://floating-ui.com/docs/autoUpdate
2097
- */
2098
- function autoUpdate(reference, floating, update, options) {
2099
- if (options === void 0) {
2100
- options = {};
2101
- }
2102
- const {
2103
- ancestorScroll = true,
2104
- ancestorResize = true,
2105
- elementResize = typeof ResizeObserver === 'function',
2106
- layoutShift = typeof IntersectionObserver === 'function',
2107
- animationFrame = false
2108
- } = options;
2109
- const referenceEl = unwrapElement(reference);
2110
- const ancestors = ancestorScroll || ancestorResize ? [...(referenceEl ? getOverflowAncestors(referenceEl) : []), ...getOverflowAncestors(floating)] : [];
2111
- ancestors.forEach(ancestor => {
2112
- ancestorScroll && ancestor.addEventListener('scroll', update, {
2113
- passive: true
2114
- });
2115
- ancestorResize && ancestor.addEventListener('resize', update);
2116
- });
2117
- const cleanupIo = referenceEl && layoutShift ? observeMove(referenceEl, update) : null;
2118
- let reobserveFrame = -1;
2119
- let resizeObserver = null;
2120
- if (elementResize) {
2121
- resizeObserver = new ResizeObserver(_ref => {
2122
- let [firstEntry] = _ref;
2123
- if (firstEntry && firstEntry.target === referenceEl && resizeObserver) {
2124
- // Prevent update loops when using the `size` middleware.
2125
- // https://github.com/floating-ui/floating-ui/issues/1740
2126
- resizeObserver.unobserve(floating);
2127
- cancelAnimationFrame(reobserveFrame);
2128
- reobserveFrame = requestAnimationFrame(() => {
2129
- var _resizeObserver;
2130
- (_resizeObserver = resizeObserver) == null || _resizeObserver.observe(floating);
2131
- });
2132
- }
2133
- update();
2134
- });
2135
- if (referenceEl && !animationFrame) {
2136
- resizeObserver.observe(referenceEl);
2137
- }
2138
- resizeObserver.observe(floating);
2139
- }
2140
- let frameId;
2141
- let prevRefRect = animationFrame ? getBoundingClientRect(reference) : null;
2142
- if (animationFrame) {
2143
- frameLoop();
2144
- }
2145
- function frameLoop() {
2146
- const nextRefRect = getBoundingClientRect(reference);
2147
- if (prevRefRect && !rectsAreEqual(prevRefRect, nextRefRect)) {
2148
- update();
2149
- }
2150
- prevRefRect = nextRefRect;
2151
- frameId = requestAnimationFrame(frameLoop);
2152
- }
2153
- update();
2154
- return () => {
2155
- var _resizeObserver2;
2156
- ancestors.forEach(ancestor => {
2157
- ancestorScroll && ancestor.removeEventListener('scroll', update);
2158
- ancestorResize && ancestor.removeEventListener('resize', update);
2159
- });
2160
- cleanupIo == null || cleanupIo();
2161
- (_resizeObserver2 = resizeObserver) == null || _resizeObserver2.disconnect();
2162
- resizeObserver = null;
2163
- if (animationFrame) {
2164
- cancelAnimationFrame(frameId);
2165
- }
2166
- };
2167
- }
2168
-
2169
- /**
2170
- * Modifies the placement by translating the floating element along the
2171
- * specified axes.
2172
- * A number (shorthand for `mainAxis` or distance), or an axes configuration
2173
- * object may be passed.
2174
- * @see https://floating-ui.com/docs/offset
2175
- */
2176
- const offset = offset$1;
2177
-
2178
- /**
2179
- * Optimizes the visibility of the floating element by shifting it in order to
2180
- * keep it in view when it will overflow the clipping boundary.
2181
- * @see https://floating-ui.com/docs/shift
2182
- */
2183
- const shift = shift$1;
2184
-
2185
- /**
2186
- * Optimizes the visibility of the floating element by flipping the `placement`
2187
- * in order to keep it in view when the preferred placement(s) will overflow the
2188
- * clipping boundary. Alternative to `autoPlacement`.
2189
- * @see https://floating-ui.com/docs/flip
2190
- */
2191
- const flip = flip$1;
2192
-
2193
- /**
2194
- * Provides data to position an inner element of the floating element so that it
2195
- * appears centered to the reference element.
2196
- * @see https://floating-ui.com/docs/arrow
2197
- */
2198
- const arrow = arrow$1;
2199
-
2200
- /**
2201
- * Computes the `x` and `y` coordinates that will place the floating element
2202
- * next to a given reference element.
2203
- */
2204
- const computePosition = (reference, floating, options) => {
2205
- // This caches the expensive `getClippingElementAncestors` function so that
2206
- // multiple lifecycle resets re-use the same result. It only lives for a
2207
- // single call. If other functions become expensive, we can add them as well.
2208
- const cache = new Map();
2209
- const mergedOptions = {
2210
- platform,
2211
- ...options
2212
- };
2213
- const platformWithCache = {
2214
- ...mergedOptions.platform,
2215
- _c: cache
2216
- };
2217
- return computePosition$1(reference, floating, {
2218
- ...mergedOptions,
2219
- platform: platformWithCache
2220
- });
2221
- };
2222
-
2223
- const linkedCss = ".visible{visibility:visible}.absolute{position:absolute}.transform{transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.border{border-width:1px}.transition{transition-duration:.15s;transition-property:color,background-color,border-color,text-decoration-color,fill,stroke,opacity,box-shadow,transform,filter,backdrop-filter;transition-timing-function:cubic-bezier(.4,0,.2,1)}.ease-out{transition-timing-function:cubic-bezier(0,0,.2,1)}:host{display:inline-block}[popover]{background:transparent;border:none;margin:0;opacity:0;overflow:visible;padding:0;position:absolute;transform:scale(.95);transition:opacity .15s ease-out,transform .15s ease-out,display allow-discrete .15s ease-out,overlay allow-discrete .15s ease-out}[popover]:popover-open{opacity:1;transform:scale(1)}@starting-style{[popover]:popover-open{opacity:0;transform:scale(.95)}}[data-placement^=top] [part=arrow]{border-left:none;border-top:none;bottom:-4px}[data-placement^=bottom] [part=arrow]{border-bottom:none;border-right:none;top:-4px}[data-placement^=left] [part=arrow]{border-bottom:none;border-left:none;right:-4px}[data-placement^=right] [part=arrow]{border-right:none;border-top:none;left:-4px}.bcm-ui-element{-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;font-family:Inter,sans-serif}.static{position:static}.fixed{position:fixed}.relative{position:relative}.inline-block{display:inline-block}.h-2{height:.5rem}.w-2{width:.5rem}.rotate-45{--tw-rotate:45deg;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.rounded-md{border-radius:var(--bcm-ui-border-radius-md,6px)}.bg-color-basic-base{background-color:var(--bcm-ui-color-background-basic-base)}.shadow{--tw-shadow:var(--bcm-ui-box-shadow-default);--tw-shadow-colored:var(--bcm-ui-box-shadow-default)}.shadow,.shadow-lg{box-shadow:var(--tw-ring-offset-shadow,0 0 #0000),var(--tw-ring-shadow,0 0 #0000),var(--tw-shadow)}.shadow-lg{--tw-shadow:var(--bcm-ui-box-shadow-lg);--tw-shadow-colored:var(--bcm-ui-box-shadow-lg)}.blur{--tw-blur:blur(8px);filter:var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow)}.flex{display:flex}.max-h-64{max-height:16rem}.w-full{width:100%}.min-w-10{min-width:2.5rem}.max-w-64{max-width:16rem}.flex-col{flex-direction:column}.items-center{align-items:center}.overflow-y-auto{overflow-y:auto}.rounded-lg{border-radius:var(--bcm-ui-border-radius-lg,8px)}.bg-color-basic-panel{background-color:var(--bcm-ui-color-background-basic-panel)}.py-1\\.5{padding-bottom:.375rem;padding-top:.375rem}.shadow,.shadow-3{box-shadow:var(--tw-ring-offset-shadow,0 0 #0000),var(--tw-ring-shadow,0 0 #0000),var(--tw-shadow)}.shadow-3{--tw-shadow:var(--bcm-ui-box-shadow-3);--tw-shadow-colored:var(--bcm-ui-box-shadow-3)}.outline{outline-style:solid}";
2224
-
2225
- const BcmLinked = class {
2226
- constructor(hostRef) {
2227
- registerInstance(this, hostRef);
2228
- this.bcmBeforeShow = createEvent(this, "bcmBeforeShow", 1);
2229
- this.bcmShow = createEvent(this, "bcmShow", 1);
2230
- this.bcmBeforeHide = createEvent(this, "bcmBeforeHide", 1);
2231
- this.bcmHide = createEvent(this, "bcmHide", 1);
2232
- this.bcmShown = createEvent(this, "bcmShown", 1);
2233
- this.bcmHidden = createEvent(this, "bcmHidden", 1);
2234
- // Unique ID for ARIA
2235
- this.componentId = `linked-${Math.random().toString(36).substring(2, 11)}`;
2236
- /**
2237
- * @prop {boolean} visible - Controls the visibility state of the floating element.
2238
- * Can be set programmatically or toggled by user interaction.
2239
- * Default: false
2240
- */
2241
- this.visible = false;
2242
- /**
2243
- * @prop {TriggerType} trigger - Defines the interaction type to show/hide the floating element.
2244
- * 'click' toggles on click, 'hover' shows on mouse enter and hides on mouse leave,
2245
- * 'focus' shows on focus and hides on blur, 'manual' requires programmatic control.
2246
- * Default: 'click'
2247
- */
2248
- this.trigger = 'click';
2249
- /**
2250
- * @prop {Placement} placement - Defines the position of the floating element relative to the trigger.
2251
- * Default: 'bottom-start'
2252
- */
2253
- this.placement = 'bottom-start';
2254
- /**
2255
- * @prop {number} showDelay - Delay in milliseconds before showing the floating element.
2256
- * Default: 0
2257
- */
2258
- this.showDelay = 0;
2259
- /**
2260
- * @prop {number} hideDelay - Delay in milliseconds before hiding the floating element.
2261
- * Default: 0
2262
- */
2263
- this.hideDelay = 0;
2264
- /**
2265
- * @prop {number} offsetDistance - Distance in pixels between the floating element and the trigger.
2266
- * Default: 8
2267
- */
2268
- this.offsetDistance = 8;
2269
- /**
2270
- * @prop {boolean} showArrow - Whether to show an arrow pointing to the trigger element.
2271
- * Default: true
2272
- */
2273
- this.showArrow = true;
2274
- /**
2275
- * @prop {boolean} disabled - Disables the floating element, preventing it from showing.
2276
- * Default: false
2277
- */
2278
- this.disabled = false;
2279
- /**
2280
- * @prop {boolean} closeOnOutsideClick - Whether to close when clicking outside.
2281
- * Default: true
2282
- */
2283
- this.closeOnOutsideClick = true;
2284
- /**
2285
- * @prop {boolean} closeOnEscape - Whether to close when pressing Escape key.
2286
- * Default: true
2287
- */
2288
- this.closeOnEscape = true;
2289
- // Internal state
2290
- this.isVisible = false;
2291
- this.handleTriggerSlotChange = () => {
2292
- var _a;
2293
- const slot = (_a = this.host.shadowRoot) === null || _a === void 0 ? void 0 : _a.querySelector('slot[name="trigger"]');
2294
- if (!slot)
2295
- return;
2296
- const elements = slot.assignedElements();
2297
- if (elements.length > 0) {
2298
- this.removeTriggerListeners();
2299
- this.triggerRef = elements[0];
2300
- this.setupTriggerListeners();
2301
- this.setupAriaAttributes();
2302
- }
2303
- };
2304
- this.handleMouseEnter = () => {
2305
- this.show();
2306
- };
2307
- this.handleMouseLeave = () => {
2308
- this.hide();
2309
- };
2310
- this.handleFloatingMouseEnter = () => {
2311
- this.clearTimeouts();
2312
- };
2313
- this.handleFloatingMouseLeave = () => {
2314
- this.hide();
2315
- };
2316
- this.handleTriggerClick = (event) => {
2317
- event.stopPropagation();
2318
- this.toggle();
2319
- };
2320
- this.handleFocus = () => {
2321
- this.show();
2322
- };
2323
- this.handleBlur = () => {
2324
- this.hide();
2325
- };
2326
- this.handleOutsideClick = (event) => {
2327
- var _a;
2328
- if (!this.closeOnOutsideClick || !this.visible)
2329
- return;
2330
- const target = event.target;
2331
- const path = event.composedPath();
2332
- const isInsideHost = this.host.contains(target) || path.includes(this.host);
2333
- const isInsideFloating = ((_a = this.floatingRef) === null || _a === void 0 ? void 0 : _a.contains(target)) || (this.floatingRef && path.includes(this.floatingRef));
2334
- if (!isInsideHost && !isInsideFloating) {
2335
- this.hide();
2336
- }
2337
- };
2338
- this.handleToggle = (event) => {
2339
- if (event.newState === 'open' && !this.isVisible) {
2340
- this.isVisible = true;
2341
- }
2342
- else if (event.newState === 'closed' && this.isVisible) {
2343
- this.isVisible = false;
2344
- }
2345
- };
2346
- this.linkedClass = tv({
2347
- slots: {
2348
- wrapper: 'inline-block',
2349
- floating: ['bcm-ui-element', 'fixed', 'bg-color-basic-base', 'rounded-md', 'shadow-lg', 'border', 'border-color-basic-subtle'],
2350
- arrow: ['absolute', 'w-2', 'h-2', 'bg-color-basic-base', 'border', 'border-color-basic-subtle', 'rotate-45'],
2351
- content: 'bg-color-basic-base',
2352
- },
2353
- });
2354
- }
2355
- // Watch for visibility prop changes
2356
- handleVisibleChange(newValue) {
2357
- if (this.disabled)
2358
- return;
2359
- if (newValue) {
2360
- this.showInternal();
2361
- }
2362
- else {
2363
- this.hideInternal();
2364
- }
2365
- }
2366
- handleDisabledChange(isDisabled) {
2367
- if (isDisabled && this.visible) {
2368
- this.hide();
2369
- }
2370
- }
2371
- handlePositionPropsChange() {
2372
- if (this.visible) {
2373
- this.updatePosition();
2374
- }
2375
- }
2376
- // Internal show logic
2377
- showInternal() {
2378
- var _a;
2379
- if (!this.floatingRef || this.disabled)
2380
- return;
2381
- this.bcmShow.emit();
2382
- this.isVisible = true;
2383
- this.floatingRef.showPopover();
2384
- this.startAutoUpdate();
2385
- this.updatePosition();
2386
- (_a = this.triggerRef) === null || _a === void 0 ? void 0 : _a.setAttribute('aria-expanded', 'true');
2387
- if (this.closeOnOutsideClick && this.trigger !== 'manual') {
2388
- this.addOutsideClickListener();
2389
- }
2390
- // Emit bcmShown after animation
2391
- requestAnimationFrame(() => {
2392
- this.bcmShown.emit();
2393
- });
2394
- }
2395
- // Internal hide logic
2396
- hideInternal() {
2397
- var _a;
2398
- if (!this.floatingRef)
2399
- return;
2400
- this.bcmHide.emit();
2401
- this.isVisible = false;
2402
- this.floatingRef.hidePopover();
2403
- this.stopAutoUpdate();
2404
- (_a = this.triggerRef) === null || _a === void 0 ? void 0 : _a.setAttribute('aria-expanded', 'false');
2405
- this.removeOutsideClickListener();
2406
- // Emit bcmHidden after animation
2407
- setTimeout(() => {
2408
- this.bcmHidden.emit();
2409
- }, 150);
2410
- }
2411
- /**
2412
- * Programmatically shows the floating element.
2413
- * Respects the showDelay prop.
2414
- */
2415
- async show() {
2416
- if (this.visible || this.disabled)
2417
- return;
2418
- this.clearTimeouts();
2419
- if (this.showDelay > 0) {
2420
- this.showTimeout = window.setTimeout(() => {
2421
- this.bcmBeforeShow.emit();
2422
- this.visible = true;
2423
- }, this.showDelay);
2424
- }
2425
- else {
2426
- this.bcmBeforeShow.emit();
2427
- this.visible = true;
2428
- }
2429
- }
2430
- /**
2431
- * Programmatically hides the floating element.
2432
- * Respects the hideDelay prop.
2433
- */
2434
- async hide() {
2435
- if (!this.visible)
2436
- return;
2437
- this.clearTimeouts();
2438
- if (this.hideDelay > 0) {
2439
- this.hideTimeout = window.setTimeout(() => {
2440
- this.bcmBeforeHide.emit();
2441
- this.visible = false;
2442
- }, this.hideDelay);
2443
- }
2444
- else {
2445
- this.bcmBeforeHide.emit();
2446
- this.visible = false;
2447
- }
2448
- }
2449
- /**
2450
- * Toggles the floating element visibility.
2451
- */
2452
- async toggle() {
2453
- if (this.visible) {
2454
- await this.hide();
2455
- }
2456
- else {
2457
- await this.show();
2458
- }
2459
- }
2460
- /**
2461
- * Updates the position of the floating element.
2462
- * Useful when the trigger element moves or resizes.
2463
- */
2464
- async updatePosition() {
2465
- await this.calculatePosition();
2466
- }
2467
- clearTimeouts() {
2468
- if (this.showTimeout) {
2469
- clearTimeout(this.showTimeout);
2470
- this.showTimeout = undefined;
2471
- }
2472
- if (this.hideTimeout) {
2473
- clearTimeout(this.hideTimeout);
2474
- this.hideTimeout = undefined;
2475
- }
2476
- }
2477
- setupAriaAttributes() {
2478
- if (!this.triggerRef)
2479
- return;
2480
- this.triggerRef.setAttribute('aria-describedby', this.componentId);
2481
- this.triggerRef.setAttribute('aria-expanded', String(this.visible));
2482
- this.triggerRef.setAttribute('aria-haspopup', 'true');
2483
- }
2484
- setupTriggerListeners() {
2485
- var _a, _b;
2486
- if (!this.triggerRef || this.disabled)
2487
- return;
2488
- switch (this.trigger) {
2489
- case 'hover':
2490
- this.triggerRef.addEventListener('mouseenter', this.handleMouseEnter);
2491
- this.triggerRef.addEventListener('mouseleave', this.handleMouseLeave);
2492
- (_a = this.floatingRef) === null || _a === void 0 ? void 0 : _a.addEventListener('mouseenter', this.handleFloatingMouseEnter);
2493
- (_b = this.floatingRef) === null || _b === void 0 ? void 0 : _b.addEventListener('mouseleave', this.handleFloatingMouseLeave);
2494
- break;
2495
- case 'click':
2496
- this.triggerRef.addEventListener('click', this.handleTriggerClick);
2497
- break;
2498
- case 'focus':
2499
- this.triggerRef.addEventListener('focus', this.handleFocus);
2500
- this.triggerRef.addEventListener('blur', this.handleBlur);
2501
- break;
2502
- }
2503
- }
2504
- removeTriggerListeners() {
2505
- var _a, _b;
2506
- if (!this.triggerRef)
2507
- return;
2508
- this.triggerRef.removeEventListener('mouseenter', this.handleMouseEnter);
2509
- this.triggerRef.removeEventListener('mouseleave', this.handleMouseLeave);
2510
- this.triggerRef.removeEventListener('click', this.handleTriggerClick);
2511
- this.triggerRef.removeEventListener('focus', this.handleFocus);
2512
- this.triggerRef.removeEventListener('blur', this.handleBlur);
2513
- (_a = this.floatingRef) === null || _a === void 0 ? void 0 : _a.removeEventListener('mouseenter', this.handleFloatingMouseEnter);
2514
- (_b = this.floatingRef) === null || _b === void 0 ? void 0 : _b.removeEventListener('mouseleave', this.handleFloatingMouseLeave);
2515
- }
2516
- handleKeyDown(event) {
2517
- var _a;
2518
- if (!this.closeOnEscape || !this.visible)
2519
- return;
2520
- if (event.key === 'Escape') {
2521
- const openLinked = Array.from(document.querySelectorAll('bcm-linked[visible]'));
2522
- const topLinked = openLinked[openLinked.length - 1];
2523
- if (topLinked === this.host) {
2524
- event.preventDefault();
2525
- this.hide();
2526
- (_a = this.triggerRef) === null || _a === void 0 ? void 0 : _a.focus();
2527
- }
2528
- }
2529
- }
2530
- addOutsideClickListener() {
2531
- setTimeout(() => {
2532
- document.addEventListener('click', this.handleOutsideClick, true);
2533
- }, 0);
2534
- }
2535
- removeOutsideClickListener() {
2536
- document.removeEventListener('click', this.handleOutsideClick, true);
2537
- }
2538
- async calculatePosition() {
2539
- if (!this.triggerRef || !this.floatingRef || !this.isVisible)
2540
- return;
2541
- const virtualElement = {
2542
- getBoundingClientRect: () => this.triggerRef.getBoundingClientRect(),
2543
- };
2544
- const middlewareList = [
2545
- offset(this.offsetDistance),
2546
- flip({
2547
- fallbackPlacements: ['top', 'bottom', 'left', 'right', 'top-start', 'top-end', 'bottom-start', 'bottom-end', 'left-start', 'left-end', 'right-start', 'right-end'],
2548
- }),
2549
- shift({
2550
- padding: 8,
2551
- }),
2552
- ];
2553
- if (this.showArrow && this.arrowRef) {
2554
- middlewareList.push(arrow({ element: this.arrowRef }));
2555
- }
2556
- const { x, y, placement, middlewareData } = await computePosition(virtualElement, this.floatingRef, {
2557
- placement: this.placement,
2558
- middleware: middlewareList,
2559
- strategy: 'fixed',
2560
- });
2561
- Object.assign(this.floatingRef.style, {
2562
- left: `${x}px`,
2563
- top: `${y}px`,
2564
- });
2565
- // Arrow positioning
2566
- if (this.showArrow && this.arrowRef && middlewareData.arrow) {
2567
- const { x: arrowX, y: arrowY } = middlewareData.arrow;
2568
- const staticSide = {
2569
- top: 'bottom',
2570
- right: 'left',
2571
- bottom: 'top',
2572
- left: 'right',
2573
- }[placement.split('-')[0]];
2574
- Object.assign(this.arrowRef.style, {
2575
- left: arrowX != null ? `${arrowX}px` : '',
2576
- top: arrowY != null ? `${arrowY}px` : '',
2577
- right: '',
2578
- bottom: '',
2579
- [staticSide]: '-4px',
2580
- });
2581
- }
2582
- this.floatingRef.setAttribute('data-placement', placement);
2583
- }
2584
- startAutoUpdate() {
2585
- if (!this.triggerRef || !this.floatingRef)
2586
- return;
2587
- this.cleanupAutoUpdate = autoUpdate(this.triggerRef, this.floatingRef, () => this.calculatePosition(), {
2588
- ancestorScroll: true,
2589
- ancestorResize: true,
2590
- elementResize: true,
2591
- layoutShift: true,
2592
- });
2593
- }
2594
- stopAutoUpdate() {
2595
- var _a;
2596
- (_a = this.cleanupAutoUpdate) === null || _a === void 0 ? void 0 : _a.call(this);
2597
- this.cleanupAutoUpdate = undefined;
2598
- }
2599
- componentDidLoad() {
2600
- var _a;
2601
- // Toggle event listener (Popover API)
2602
- (_a = this.floatingRef) === null || _a === void 0 ? void 0 : _a.addEventListener('toggle', this.handleToggle);
2603
- // Initial trigger setup - manually trigger slot change handler
2604
- this.handleTriggerSlotChange();
2605
- // Initial state sync
2606
- if (this.visible) {
2607
- this.showInternal();
2608
- }
2609
- }
2610
- disconnectedCallback() {
2611
- this.clearTimeouts();
2612
- this.stopAutoUpdate();
2613
- this.removeTriggerListeners();
2614
- this.removeOutsideClickListener();
2615
- if (this.floatingRef) {
2616
- this.floatingRef.removeEventListener('toggle', this.handleToggle);
2617
- if (this.isVisible) {
2618
- try {
2619
- this.floatingRef.hidePopover();
2620
- }
2621
- catch (e) {
2622
- // Element might already be removed
2623
- }
2624
- }
2625
- }
2626
- }
2627
- render() {
2628
- const { wrapper, floating, arrow, content } = this.linkedClass();
2629
- return (h(Host, { key: 'f58760b6589329f9eabc42f39b6503fad10cf330' }, h("div", { key: 'adb9003eec4ca786bdddc657ba28cbc0a80baf57', class: wrapper() }, h("slot", { key: '61323463e76c395668d02288e5bdcb44826a31ea', name: "trigger", onSlotchange: this.handleTriggerSlotChange }), h("div", { key: '3b395b18152cd302b4511ef89928374f33012594', ref: el => (this.floatingRef = el), id: this.componentId, part: "floating", class: floating(),
2630
- // @ts-ignore - popover is a valid HTML attribute
2631
- popover: "manual", role: "dialog" }, this.showArrow && h("div", { key: '3f5311d21f7fce74c94ac0435a8d2fc076036b10', ref: el => (this.arrowRef = el), part: "arrow", class: arrow() }), h("div", { key: 'ee41f30c7f73c113f129f938fd721476658b5744', part: "content", class: content() }, h("slot", { key: '106502e2f8db8fdc90412fcf59da40d2de377988' }))))));
2632
- }
2633
- get host() { return getElement(this); }
2634
- static get watchers() { return {
2635
- "visible": ["handleVisibleChange"],
2636
- "disabled": ["handleDisabledChange"],
2637
- "placement": ["handlePositionPropsChange"],
2638
- "offsetDistance": ["handlePositionPropsChange"],
2639
- "showArrow": ["handlePositionPropsChange"]
2640
- }; }
2641
- };
2642
- BcmLinked.style = linkedCss;
2643
-
2644
- const modalCss = ".contents{display:contents}:host{display:contents}.container{width:100%}@media (min-width:640px){.container{max-width:640px}}@media (min-width:768px){.container{max-width:768px}}@media (min-width:1024px){.container{max-width:1024px}}@media (min-width:1280px){.container{max-width:1280px}}@media (min-width:1536px){.container{max-width:1536px}}.bcm-ui-element{-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;font-family:Inter,sans-serif}.static{position:static}.fixed{position:fixed}.relative{position:relative}.inset-0{inset:0}.m-0{margin:0}.flex{display:flex}.hidden{display:none}.h-6{height:1.5rem}.h-full{height:100%}.h-screen{height:100vh}.max-h-full{max-height:100%}.max-h-none{max-height:none}.w-6{width:1.5rem}.w-full{width:100%}.w-screen{width:100vw}.min-w-0{min-width:0}.max-w-full{max-width:100%}.max-w-none{max-width:none}.flex-1{flex:1 1 0%}.flex-shrink-0{flex-shrink:0}.flex-grow{flex-grow:1}.-translate-y-4{--tw-translate-y:-1rem}.-translate-y-4,.translate-y-0{transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.translate-y-0{--tw-translate-y:0px}.scale-100{--tw-scale-x:1;--tw-scale-y:1}.scale-100,.scale-95{transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.scale-95{--tw-scale-x:.95;--tw-scale-y:.95}.transform{transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.animate-shake{animation:shake .82s cubic-bezier(.36,.07,.19,.97) infinite;animation:shake .3s cubic-bezier(.36,.07,.19,.97) both}.cursor-pointer{cursor:pointer}.flex-col{flex-direction:column}.items-start{align-items:flex-start}.items-center{align-items:center}.justify-end{justify-content:flex-end}.justify-center{justify-content:center}.justify-between{justify-content:space-between}.gap-2{gap:.5rem}.overflow-y-auto{overflow-y:auto}.overscroll-contain{overscroll-behavior:contain}.rounded{border-radius:var(--bcm-ui-border-radius-default,6px)}.rounded-lg{border-radius:var(--bcm-ui-border-radius-lg,8px)}.rounded-none{border-radius:var(--bcm-ui-border-radius-none,0)}.rounded-t-lg{border-top-left-radius:var(--bcm-ui-border-radius-lg,8px);border-top-right-radius:var(--bcm-ui-border-radius-lg,8px)}.border{border-width:1px}.border-0{border-width:0}.border-b{border-bottom-width:1px}.border-solid{border-style:solid}.border-none{border-style:none}.border-color-default{border-color:var(--bcm-ui-color-border-default)}.bg-color-base{background-color:var(--bcm-ui-color-background-base-default)}.bg-color-basic-base{background-color:var(--bcm-ui-color-background-basic-base)}.bg-transparent{background-color:transparent}.p-0{padding:0}.p-4{padding:1rem}.p-5{padding:1.25rem}.p-6{padding:1.5rem}.p-8{padding:2rem}.px-4{padding-left:1rem;padding-right:1rem}.px-5{padding-left:1.25rem;padding-right:1.25rem}.px-6{padding-left:1.5rem;padding-right:1.5rem}.px-8{padding-left:2rem;padding-right:2rem}.py-3{padding-bottom:.75rem;padding-top:.75rem}.py-4{padding-bottom:1rem;padding-top:1rem}.py-5{padding-bottom:1.25rem;padding-top:1.25rem}.pt-20{padding-top:5rem}.text-size-5{font-size:var(--bcm-ui-font-size-5,16px);line-height:var(--bcm-ui-line-height-5,24px)}.text-size-6{font-size:var(--bcm-ui-font-size-6,18px);line-height:var(--bcm-ui-line-height-6,24px)}.font-medium{font-weight:500}.font-semibold{font-weight:600}.text-color-default{color:var(--bcm-ui-color-text-default)}.text-color-header{color:var(--bcm-ui-color-text-header)}.text-color-placeholder{color:var(--bcm-ui-color-text-placeholder)}.opacity-0{opacity:0}.opacity-100{opacity:1}.shadow{--tw-shadow:var(--bcm-ui-box-shadow-default);--tw-shadow-colored:var(--bcm-ui-box-shadow-default)}.shadow,.shadow-2xl{box-shadow:var(--tw-ring-offset-shadow,0 0 #0000),var(--tw-ring-shadow,0 0 #0000),var(--tw-shadow)}.shadow-2xl{--tw-shadow:var(--bcm-ui-box-shadow-2xl);--tw-shadow-colored:var(--bcm-ui-box-shadow-2xl)}.outline-none{outline:2px solid transparent;outline-offset:2px}.transition-all{transition-duration:.15s;transition-property:all;transition-timing-function:cubic-bezier(.4,0,.2,1)}.transition-colors{transition-duration:.15s;transition-property:color,background-color,border-color,text-decoration-color,fill,stroke;transition-timing-function:cubic-bezier(.4,0,.2,1)}.duration-300{transition-duration:.3s}.ease-in-out{transition-timing-function:cubic-bezier(.4,0,.2,1)}.backdrop\\:bg-color-default-dark::backdrop{background-color:var(--bcm-ui-color-background-default-dark-default)}.backdrop\\:opacity-50::backdrop{opacity:.5}.backdrop\\:transition-opacity::backdrop{transition-duration:.15s;transition-property:opacity;transition-timing-function:cubic-bezier(.4,0,.2,1)}.backdrop\\:duration-300::backdrop{transition-duration:.3s}.hover\\:bg-color-default-hover:hover{background-color:var(--bcm-ui-color-background-default-hover)}.focus-visible\\:ring:focus-visible{--tw-ring-offset-shadow:var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow:var(--tw-ring-inset) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow,0 0 #0000)}";
2645
-
2646
- const BcmModal = class {
2647
- constructor(hostRef) {
2648
- registerInstance(this, hostRef);
2649
- this.bcmOpen = createEvent(this, "bcmOpen", 7);
2650
- this.bcmClose = createEvent(this, "bcmClose", 7);
2651
- this.bcmBeforeOpen = createEvent(this, "bcmBeforeOpen", 7);
2652
- this.bcmBeforeClose = createEvent(this, "bcmBeforeClose", 7);
2653
- /**
2654
- * Controls whether the modal is open or closed
2655
- */
2656
- this.open = false;
2657
- /**
2658
- * The size of the modal
2659
- * - 'small': 400px
2660
- * - 'medium': 600px
2661
- * - 'large': 800px
2662
- * - 'xlarge': 1024px
2663
- * - 'xxlarge': 1200px
2664
- * - 'full': 100% width
2665
- */
2666
- this.size = 'medium';
2667
- /**
2668
- * The placement of the modal on the screen
2669
- * - 'center': Centered vertically and horizontally
2670
- * - 'top': Aligned to the top with 80px padding
2671
- */
2672
- this.placement = 'center';
2673
- /**
2674
- * Controls backdrop behavior
2675
- * - true: Shows backdrop, modal can be closed by clicking outside
2676
- * - false: No backdrop
2677
- * - 'static': Shows backdrop but prevents closing by clicking outside (triggers shake animation)
2678
- */
2679
- this.backdrop = true;
2680
- /**
2681
- * Makes the modal take full width of the viewport (max-width: 100%)
2682
- */
2683
- this.fullWidth = false;
2684
- /**
2685
- * Makes the modal take the full screen (100vw x 100vh, no border radius)
2686
- */
2687
- this.fullScreen = false;
2688
- /**
2689
- * Hides the header section completely
2690
- */
2691
- this.noHeader = false;
2692
- /**
2693
- * Hides the footer section completely
2694
- */
2695
- this.noFooter = false;
2696
- /**
2697
- * Allows closing the modal by clicking on the backdrop
2698
- */
2699
- this.closeOnBackdrop = true;
2700
- /**
2701
- * Allows closing the modal by pressing the Escape key
2702
- */
2703
- this.closeOnEscape = true;
2704
- this.isAnimating = false;
2705
- this.shake = false;
2706
- this.modalClass = tv({
2707
- slots: {
2708
- dialog: 'bcm-ui-element fixed inset-0 m-0 p-0 w-full max-w-full h-full max-h-full border-none bg-transparent backdrop:bg-color-default-dark backdrop:opacity-50 backdrop:transition-opacity backdrop:duration-300',
2709
- container: 'fixed inset-0 flex items-start justify-center p-4 overflow-y-auto overscroll-contain',
2710
- modal: 'relative bg-color-basic-base text-color-default rounded-lg shadow-2xl transform transition-all duration-300 ease-in-out flex flex-col',
2711
- header: 'flex justify-between items-start bg-color-base text-color-default border-color-default border-solid border-0 border-b rounded-t-lg',
2712
- headerContent: 'flex-1 min-w-0 flex items-center gap-2',
2713
- title: 'font-semibold m-0 text-size-6 text-color-header',
2714
- helperText: 'text-size-5 text-color-placeholder m-0',
2715
- closeButton: 'text-size-5 font-medium text-color-default bg-transparent border-none p-0 h-6 w-6 rounded hover:bg-color-default-hover cursor-pointer active:bg-color-active transition-colors flex-shrink-0 outline-none focus-visible:ring ',
2716
- content: 'flex-grow overflow-y-auto',
2717
- footer: 'flex items-center justify-end gap-2',
2718
- },
2719
- variants: {
2720
- open: {
2721
- true: {
2722
- modal: 'opacity-100 translate-y-0 scale-100',
2723
- },
2724
- false: {
2725
- modal: 'opacity-0 -translate-y-4 scale-95',
2726
- },
2727
- },
2728
- placement: {
2729
- center: {
2730
- container: 'items-center',
2731
- },
2732
- top: {
2733
- container: 'items-start pt-20',
2734
- },
2735
- },
2736
- size: {
2737
- small: {
2738
- header: 'py-3 px-4',
2739
- content: 'p-4',
2740
- footer: 'py-3 px-4',
2741
- },
2742
- medium: {
2743
- header: 'py-4 px-5',
2744
- content: 'p-5',
2745
- footer: 'py-4 px-5',
2746
- },
2747
- large: {
2748
- header: 'py-4 px-6',
2749
- content: 'p-6',
2750
- footer: 'py-4 px-6',
2751
- },
2752
- xlarge: {
2753
- header: 'py-5 px-6',
2754
- content: 'p-6',
2755
- footer: 'py-5 px-6',
2756
- },
2757
- xxlarge: {
2758
- header: 'py-5 px-8',
2759
- content: 'p-8',
2760
- footer: 'py-5 px-8',
2761
- },
2762
- full: {
2763
- header: 'py-5 px-8',
2764
- content: 'p-8',
2765
- footer: 'py-5 px-8',
2766
- },
2767
- },
2768
- fullScreen: {
2769
- true: {
2770
- modal: 'rounded-none w-screen h-screen max-w-none max-h-none',
2771
- container: 'p-0',
2772
- },
2773
- },
2774
- shake: {
2775
- true: {
2776
- modal: 'animate-shake',
2777
- },
2778
- },
2779
- noHeader: {
2780
- true: {
2781
- header: 'hidden',
2782
- },
2783
- },
2784
- noFooter: {
2785
- true: {
2786
- footer: 'hidden',
2787
- },
2788
- },
2789
- },
2790
- });
2791
- this.handleBackdropClick = (event) => {
2792
- const target = event.target;
2793
- // Check if click is on the container (backdrop area), not on modal content
2794
- if (target.getAttribute('part') === 'container') {
2795
- if (this.backdrop === 'static') {
2796
- this.shakeModal();
2797
- }
2798
- else if (this.closeOnBackdrop) {
2799
- this.hide();
2800
- }
2801
- }
2802
- };
2803
- this.handleDialogCancel = (event) => {
2804
- event.preventDefault();
2805
- if (this.closeOnEscape) {
2806
- if (this.backdrop === 'static') {
2807
- this.shakeModal();
2808
- }
2809
- else {
2810
- this.hide();
2811
- }
2812
- }
2813
- };
2814
- }
2815
- async handleOpenChange(isOpen) {
2816
- if (isOpen) {
2817
- this.isAnimating = true;
2818
- const event = this.bcmBeforeOpen.emit();
2819
- if (event.defaultPrevented) {
2820
- this.open = false;
2821
- return;
2822
- }
2823
- // Use native dialog API with top-layer
2824
- if (this.dialogRef) {
2825
- this.dialogRef.showModal();
2826
- // Small delay for animation
2827
- await new Promise(resolve => setTimeout(resolve, 50));
2828
- this.isAnimating = false;
2829
- this.bcmOpen.emit();
2830
- }
2831
- }
2832
- else {
2833
- this.isAnimating = true;
2834
- const event = this.bcmBeforeClose.emit();
2835
- if (event.defaultPrevented) {
2836
- this.open = true;
2837
- return;
2838
- }
2839
- // Wait for animation before closing
2840
- await new Promise(resolve => setTimeout(resolve, 300));
2841
- if (this.dialogRef) {
2842
- this.dialogRef.close();
2843
- }
2844
- this.isAnimating = false;
2845
- this.bcmClose.emit();
2846
- }
2847
- }
2848
- handleClick(event) {
2849
- // Use composedPath to work with shadow DOM and slots
2850
- const path = event.composedPath();
2851
- const dismissElement = path.find(el => { var _a; return (_a = el.hasAttribute) === null || _a === void 0 ? void 0 : _a.call(el, 'data-dismiss'); });
2852
- const closeModalElement = path.find(el => { var _a; return (_a = el.hasAttribute) === null || _a === void 0 ? void 0 : _a.call(el, 'data-close-modal'); });
2853
- if (dismissElement) {
2854
- this.hide();
2855
- event.preventDefault();
2856
- event.stopPropagation();
2857
- }
2858
- else if (closeModalElement) {
2859
- const modalId = closeModalElement.getAttribute('data-close-modal');
2860
- // If modalId matches this modal's id, close it
2861
- if (!modalId || modalId === this.host.id) {
2862
- this.hide();
2863
- event.preventDefault();
2864
- event.stopPropagation();
2865
- }
2866
- }
2867
- }
2868
- handleKeyDown(event) {
2869
- if (event.key === 'Escape' && this.open) {
2870
- // Only handle ESC if this is the topmost modal
2871
- const openModals = Array.from(document.querySelectorAll('bcm-modal[open]'));
2872
- const topModal = openModals[openModals.length - 1];
2873
- if (topModal !== this.host) {
2874
- return;
2875
- }
2876
- event.preventDefault();
2877
- if (this.closeOnEscape) {
2878
- if (this.backdrop === 'static') {
2879
- this.shakeModal();
2880
- }
2881
- else {
2882
- this.hide();
2883
- }
2884
- }
2885
- else if (this.backdrop === 'static') {
2886
- this.shakeModal();
2887
- }
2888
- }
2889
- }
2890
- /**
2891
- * Programmatically opens the modal
2892
- */
2893
- async show() {
2894
- this.open = true;
2895
- }
2896
- /**
2897
- * Programmatically closes the modal
2898
- */
2899
- async hide() {
2900
- this.open = false;
2901
- }
2902
- /**
2903
- * Toggles the modal open/closed state
2904
- */
2905
- async toggle() {
2906
- this.open = !this.open;
2907
- }
2908
- shakeModal() {
2909
- this.shake = true;
2910
- setTimeout(() => {
2911
- this.shake = false;
2912
- }, 300);
2913
- }
2914
- getModalStyle() {
2915
- if (this.fullScreen) {
2916
- return {
2917
- width: '100vw',
2918
- height: '100vh',
2919
- maxWidth: 'none',
2920
- maxHeight: 'none',
2921
- };
2922
- }
2923
- if (this.fullWidth) {
2924
- return {
2925
- width: '100%',
2926
- maxWidth: '100%',
2927
- };
2928
- }
2929
- const widths = {
2930
- small: '400px',
2931
- medium: '600px',
2932
- large: '800px',
2933
- xlarge: '1024px',
2934
- xxlarge: '1200px',
2935
- full: '100%',
2936
- };
2937
- return {
2938
- width: widths[this.size],
2939
- maxWidth: this.fullScreen ? 'none' : '90vw',
2940
- maxHeight: this.fullScreen ? 'none' : '90vh',
2941
- };
2942
- }
2943
- componentDidLoad() {
2944
- if (this.open && this.dialogRef) {
2945
- this.dialogRef.showModal();
2946
- }
2947
- }
2948
- disconnectedCallback() {
2949
- if (this.dialogRef && this.open) {
2950
- this.dialogRef.close();
2951
- }
2952
- }
2953
- render() {
2954
- const { dialog, container, modal, header, headerContent, title, helperText, closeButton, content, footer } = this.modalClass({
2955
- open: this.open,
2956
- placement: this.placement,
2957
- size: this.size,
2958
- fullScreen: this.fullScreen,
2959
- shake: this.shake,
2960
- noHeader: this.noHeader,
2961
- noFooter: this.noFooter,
2962
- });
2963
- return (h("dialog", { key: '604224de7fad889eff33705ec549d41927728f7d', ref: el => (this.dialogRef = el), part: "dialog", class: dialog(), onClick: this.handleBackdropClick, onCancel: this.handleDialogCancel, "aria-labelledby": "modal-title", "aria-describedby": this.helperText ? 'modal-helper' : undefined, "aria-modal": "true" }, h("div", { key: '7182bea36412891a27153711392e9e70920ac9c4', part: "container", class: container() }, h("div", { key: 'a8ad382c7766e1db2fc330aa73479bb3e5002eff', part: "modal", class: modal(), style: this.getModalStyle(), role: "document", onClick: e => e.stopPropagation() }, !this.noHeader && (h("div", { key: '8ea66d15bc39c5b06d887529e8af07020bfe4fc4', part: "header", class: header() }, h("div", { key: '24ed7baca534c2016a0e6abcaa396643ab91f5c7', part: "header-content", class: headerContent() }, h("h2", { key: '4dd835faebd8b96c1a77dfc07731aa76418e2afc', id: "modal-title", part: "title", class: title() }, h("slot", { key: 'bf2d40045ccc6040d990d7caccbefa1e0f9e9164', name: "header" }, this.headerText)), this.helperText && (h("p", { key: '4dac43e3355fc7d53500dc90fcbfe3191e174c76', id: "modal-helper", part: "helper-text", class: helperText() }, h("slot", { key: 'dd37c548df818e4a758bdeede4dc0fd49ca241a3', name: "helper" }, this.helperText)))), h("button", { key: '38262ebb76c8d471f4e6070c32e3a4ef4ca01007', part: "close-button", class: closeButton(), onClick: () => this.hide(), "aria-label": "Close modal", type: "button" }, h("bcm-icon", { key: '69fca23e4377193ead2931283c6321df9189e3c7', name: "fa-solid fa-xmark" })))), h("div", { key: 'e67d5ee554203441246394a2062d4a5662f04b21', part: "content", class: content() }, h("slot", { key: '71020c0e5593186befb4ea9841b459986a6dfc2b' })), !this.noFooter && (h("div", { key: '12bf38555e3cf905a56543a24742746364c3a41d', part: "footer", class: footer() }, h("slot", { key: 'afc38ce22fcb46b85795f8d95eab2f20c6ef3deb', name: "footer" })))))));
2964
- }
2965
- get host() { return getElement(this); }
2966
- static get watchers() { return {
2967
- "open": ["handleOpenChange"]
2968
- }; }
2969
- };
2970
- BcmModal.style = modalCss;
2971
-
2972
- const popConfirmCss = ".visible{visibility:visible}.transform{transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.text-wrap{text-wrap:wrap}.border{border-width:1px}.transition{transition-duration:.15s;transition-property:color,background-color,border-color,text-decoration-color,fill,stroke,opacity,box-shadow,transform,filter,backdrop-filter;transition-timing-function:cubic-bezier(.4,0,.2,1)}:host{--popover-bg:var(--bcm-ui-color-background-basic-panel);display:inline-block}[popover]{border:none;overflow:visible;padding:0}[popover]:not(:popover-open){display:none}[popover]:popover-open{opacity:1;transform:scale(1);transition:opacity .15s ease-out,transform .15s ease-out}@starting-style{[popover]:popover-open{opacity:0;transform:scale(.95)}}::slotted([slot=body]){text-wrap:pretty;font-family:Inter,sans-serif}.container{width:100%}@media (min-width:640px){.container{max-width:640px}}@media (min-width:768px){.container{max-width:768px}}@media (min-width:1024px){.container{max-width:1024px}}@media (min-width:1280px){.container{max-width:1280px}}@media (min-width:1536px){.container{max-width:1536px}}.bcm-ui-element{-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;font-family:Inter,sans-serif}.static{position:static}.fixed{position:fixed}.absolute{position:absolute}.relative{position:relative}.right-3{right:.75rem}.right-4{right:1rem}.right-6{right:1.5rem}.top-3{top:.75rem}.top-4{top:1rem}.top-6{top:1.5rem}.z-\\[9999\\]{z-index:9999}.m-0{margin:0}.inline-block{display:inline-block}.flex{display:flex}.size-6{height:1.5rem;width:1.5rem}.h-3{height:.75rem}.w-3{width:.75rem}.max-w-64{max-width:16rem}.max-w-80{max-width:20rem}.max-w-96{max-width:24rem}.flex-1{flex:1 1 0%}.rotate-45{--tw-rotate:45deg;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.cursor-pointer{cursor:pointer}.flex-row{flex-direction:row}.flex-col{flex-direction:column}.items-center{align-items:center}.justify-end{justify-content:flex-end}.justify-center{justify-content:center}.gap-2{gap:.5rem}.gap-4{gap:1rem}.gap-6{gap:1.5rem}.gap-8{gap:2rem}.text-pretty{text-wrap:pretty}.rounded-full{border-radius:var(--bcm-ui-border-radius-full,9999px)}.rounded-lg{border-radius:var(--bcm-ui-border-radius-lg,8px)}.bg-\\[--popover-bg\\]{background-color:var(--popover-bg)}.p-4{padding:1rem}.p-6{padding:1.5rem}.p-8{padding:2rem}.pr-8{padding-right:2rem}.font-sans{font-family:Inter,sans-serif}.text-size-4{font-size:var(--bcm-ui-font-size-4,14px);line-height:var(--bcm-ui-line-height-4,20px)}.text-size-5{font-size:var(--bcm-ui-font-size-5,16px);line-height:var(--bcm-ui-line-height-5,24px)}.text-size-6{font-size:var(--bcm-ui-font-size-6,18px);line-height:var(--bcm-ui-line-height-6,24px)}.text-size-7{font-size:var(--bcm-ui-font-size-7,20px);line-height:var(--bcm-ui-line-height-7,28px)}.font-semibold{font-weight:600}.\\!text-color-header{color:var(--bcm-ui-color-text-header)!important}.text-\\[var\\(--bcm-ui-color-text-error\\)\\]{color:var(--bcm-ui-color-text-error)}.text-\\[var\\(--bcm-ui-color-text-info\\)\\]{color:var(--bcm-ui-color-text-info)}.text-\\[var\\(--bcm-ui-color-text-success\\)\\]{color:var(--bcm-ui-color-text-success)}.text-\\[var\\(--bcm-ui-color-text-warning\\)\\]{color:var(--bcm-ui-color-text-warning)}.shadow{--tw-shadow:var(--bcm-ui-box-shadow-default);--tw-shadow-colored:var(--bcm-ui-box-shadow-default)}.shadow,.shadow-3{box-shadow:var(--tw-ring-offset-shadow,0 0 #0000),var(--tw-ring-shadow,0 0 #0000),var(--tw-shadow)}.shadow-3{--tw-shadow:var(--bcm-ui-box-shadow-3);--tw-shadow-colored:var(--bcm-ui-box-shadow-3)}.outline{outline-style:solid}.filter{filter:var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow)}.hover\\:bg-gray-100:hover{background-color:oklch(.967 .003 264.542)}";
2973
-
2974
- const statusIcons = {
2975
- info: 'fa-solid fa-circle-info',
2976
- success: 'fa-solid fa-circle-check',
2977
- warning: 'fa-solid fa-triangle-exclamation',
2978
- error: 'fa-solid fa-circle-xmark',
2979
- };
2980
- const BcmPopConfirm = class {
2981
- constructor(hostRef) {
2982
- registerInstance(this, hostRef);
2983
- this.bcmBeforeOpen = createEvent(this, "bcmBeforeOpen", 1);
2984
- this.bcmOpen = createEvent(this, "bcmOpen", 1);
2985
- this.bcmBeforeClose = createEvent(this, "bcmBeforeClose", 1);
2986
- this.bcmClose = createEvent(this, "bcmClose", 1);
2987
- this.bcmConfirm = createEvent(this, "bcmConfirm", 1);
2988
- this.bcmCancel = createEvent(this, "bcmCancel", 1);
2989
- /**
2990
- * @prop {PopConfirmPlacement} placement - Position of the popover relative to the trigger element.
2991
- * Automatically flips if there's not enough space.
2992
- * Default: 'top'
2993
- */
2994
- this.placement = 'top';
2995
- /**
2996
- * @prop {PopConfirmSize} size - Size variant that controls padding and text size.
2997
- * - 'small': Compact size with minimal padding
2998
- * - 'medium': Standard size
2999
- * - 'large': Spacious size with more padding
3000
- * Default: 'medium'
3001
- */
3002
- this.size = 'medium';
3003
- /**
3004
- * @prop {PopConfirmStatus} status - Status type that determines the color scheme and icon.
3005
- * - 'info': Informational (blue)
3006
- * - 'success': Success/positive action (green)
3007
- * - 'warning': Warning/caution (yellow)
3008
- * - 'error': Error/destructive action (red)
3009
- * Default: 'info'
3010
- */
3011
- this.status = 'info';
3012
- /**
3013
- * @prop {string} headerText - Text displayed in the header section.
3014
- * Can be overridden by using the 'header' slot.
3015
- * Default: ''
3016
- */
3017
- this.headerText = '';
3018
- /**
3019
- * @prop {string} description - Description text displayed in the body section.
3020
- * Can be overridden by using the 'body' slot.
3021
- * Default: ''
3022
- */
3023
- this.description = '';
3024
- /**
3025
- * @prop {string} confirmText - Text for the confirm button.
3026
- * Default: 'Yes'
3027
- */
3028
- this.confirmText = 'Yes';
3029
- /**
3030
- * @prop {string} cancelText - Text for the cancel button.
3031
- * Default: 'Cancel'
3032
- */
3033
- this.cancelText = 'Cancel';
3034
- /**
3035
- * @prop {boolean} showArrow - Whether to show the arrow pointing to the trigger.
3036
- * Default: true
3037
- */
3038
- this.showArrow = true;
3039
- /**
3040
- * @prop {boolean} statusIcon - Whether to show the status icon in the header.
3041
- * Icon only shows if headerText is also provided.
3042
- * Default: true
3043
- */
3044
- this.statusIcon = true;
3045
- /**
3046
- * @prop {number} offsetDistance - Distance in pixels between the popover and trigger element.
3047
- * Default: 12
3048
- */
3049
- this.offsetDistance = 12;
3050
- /**
3051
- * @prop {boolean} closeOnOutsideClick - Whether to close when clicking outside the popover.
3052
- * Default: true
3053
- */
3054
- this.closeOnOutsideClick = true;
3055
- /**
3056
- * @prop {boolean} closeOnEscape - Whether to close when pressing the Escape key.
3057
- * Default: true
3058
- */
3059
- this.closeOnEscape = true;
3060
- this.isOpen = false;
3061
- this.handleSlotChange = () => {
3062
- var _a;
3063
- const slot = (_a = this.host.shadowRoot) === null || _a === void 0 ? void 0 : _a.querySelector('slot:not([name])');
3064
- if (!slot)
3065
- return;
3066
- const elements = slot.assignedElements();
3067
- const assignedElement = elements[0];
3068
- this.triggerRef = (assignedElement || this.host);
3069
- if (!this.triggerRef)
3070
- return;
3071
- if (this.popconfirmRef && this.popconfirmId) {
3072
- this.triggerRef.setAttribute('aria-describedby', this.popconfirmId);
3073
- }
3074
- this.removeTriggerListeners();
3075
- this.setupTriggerListeners();
3076
- };
3077
- this.handleTriggerClick = () => {
3078
- this.toggle();
3079
- };
3080
- this.handleOutsideClick = (e) => {
3081
- var _a;
3082
- if (!this.closeOnOutsideClick || !this.isOpen)
3083
- return;
3084
- const target = e.target;
3085
- if (!this.host.contains(target) && !((_a = this.popconfirmRef) === null || _a === void 0 ? void 0 : _a.contains(target))) {
3086
- this.handleCancel();
3087
- }
3088
- };
3089
- this.handleToggle = (e) => {
3090
- const toggleEvent = e;
3091
- if (toggleEvent.newState === 'open' && !this.isOpen) {
3092
- this.isOpen = true;
3093
- }
3094
- else if (toggleEvent.newState === 'closed' && this.isOpen) {
3095
- this.isOpen = false;
3096
- }
3097
- };
3098
- this.handleConfirm = () => {
3099
- this.bcmConfirm.emit();
3100
- this.hide();
3101
- };
3102
- this.handleCancel = () => {
3103
- this.bcmCancel.emit();
3104
- this.hide();
3105
- };
3106
- this.popconfirmClass = tv({
3107
- slots: {
3108
- container: 'bcm-ui-element fixed m-0 flex flex-col bg-[--popover-bg] rounded-lg shadow-3 z-[9999]',
3109
- arrow: 'absolute w-3 h-3 bg-[--popover-bg] rotate-45',
3110
- closeBtn: 'absolute flex size-6 items-center justify-center hover:bg-gray-100 rounded-full cursor-pointer text-color-muted',
3111
- header: 'flex items-center pr-8',
3112
- headerLeft: 'flex items-center gap-2',
3113
- title: '!text-color-header font-semibold',
3114
- body: 'flex-1 font-sans text-pretty',
3115
- footer: 'flex flex-row justify-end gap-2',
3116
- },
3117
- variants: {
3118
- size: {
3119
- small: {
3120
- container: 'text-size-4 max-w-64 p-4 gap-4',
3121
- title: 'text-size-5',
3122
- closeBtn: 'top-3 right-3',
3123
- },
3124
- medium: {
3125
- container: 'text-size-5 max-w-80 p-6 gap-6',
3126
- title: 'text-size-6',
3127
- closeBtn: 'top-4 right-4',
3128
- },
3129
- large: {
3130
- container: 'text-size-6 max-w-96 p-8 gap-8',
3131
- title: 'text-size-7',
3132
- closeBtn: 'top-6 right-6',
3133
- },
3134
- },
3135
- status: {
3136
- info: { headerLeft: 'text-[var(--bcm-ui-color-text-info)]' },
3137
- success: { headerLeft: 'text-[var(--bcm-ui-color-text-success)]' },
3138
- warning: { headerLeft: 'text-[var(--bcm-ui-color-text-warning)]' },
3139
- error: { headerLeft: 'text-[var(--bcm-ui-color-text-error)]' },
3140
- },
3141
- },
3142
- });
3143
- }
3144
- async handleOpenChange(open) {
3145
- if (!this.popconfirmRef)
3146
- return;
3147
- if (open) {
3148
- this.popconfirmRef.showPopover();
3149
- await new Promise(resolve => requestAnimationFrame(() => resolve(undefined)));
3150
- await this.updatePosition();
3151
- this.startAutoUpdate();
3152
- this.bcmOpen.emit();
3153
- // Add outside click listener after a frame to avoid immediate close
3154
- if (this.closeOnOutsideClick) {
3155
- requestAnimationFrame(() => {
3156
- document.addEventListener('click', this.handleOutsideClick);
3157
- });
3158
- }
3159
- }
3160
- else {
3161
- this.popconfirmRef.hidePopover();
3162
- this.stopAutoUpdate();
3163
- this.bcmClose.emit();
3164
- document.removeEventListener('click', this.handleOutsideClick);
3165
- }
3166
- }
3167
- /**
3168
- * Programmatically shows the popconfirm.
3169
- * @returns Promise that resolves when the show operation begins
3170
- */
3171
- async show() {
3172
- if (this.isOpen)
3173
- return;
3174
- this.bcmBeforeOpen.emit();
3175
- this.isOpen = true;
3176
- }
3177
- /**
3178
- * Programmatically hides the popconfirm.
3179
- * @returns Promise that resolves when the hide operation begins
3180
- */
3181
- async hide() {
3182
- if (!this.isOpen)
3183
- return;
3184
- this.bcmBeforeClose.emit();
3185
- this.isOpen = false;
3186
- }
3187
- /**
3188
- * Toggles the popconfirm visibility.
3189
- * If open, it will close. If closed, it will open.
3190
- * @returns Promise that resolves when the toggle operation completes
3191
- */
3192
- async toggle() {
3193
- if (this.isOpen) {
3194
- await this.hide();
3195
- }
3196
- else {
3197
- await this.show();
3198
- }
3199
- }
3200
- startAutoUpdate() {
3201
- if (!this.triggerRef || !this.popconfirmRef)
3202
- return;
3203
- this.cleanupAutoUpdate = autoUpdate(this.triggerRef, this.popconfirmRef, () => this.updatePosition(), {
3204
- ancestorScroll: true,
3205
- ancestorResize: true,
3206
- elementResize: true,
3207
- layoutShift: true,
3208
- });
3209
- }
3210
- stopAutoUpdate() {
3211
- if (this.cleanupAutoUpdate) {
3212
- this.cleanupAutoUpdate();
3213
- this.cleanupAutoUpdate = undefined;
3214
- }
3215
- }
3216
- async updatePosition() {
3217
- if (!this.triggerRef || !this.popconfirmRef)
3218
- return;
3219
- const middleware = [offset(this.offsetDistance), flip(), shift({ padding: 8 })];
3220
- if (this.showArrow && this.arrowRef) {
3221
- middleware.push(arrow({ element: this.arrowRef }));
3222
- }
3223
- const virtualElement = {
3224
- getBoundingClientRect: () => this.triggerRef.getBoundingClientRect(),
3225
- };
3226
- const { x, y, placement, middlewareData } = await computePosition(virtualElement, this.popconfirmRef, {
3227
- placement: this.placement,
3228
- strategy: 'fixed',
3229
- middleware,
3230
- });
3231
- this.popconfirmRef.style.left = `${x}px`;
3232
- this.popconfirmRef.style.top = `${y}px`;
3233
- if (this.showArrow && this.arrowRef && middlewareData.arrow) {
3234
- const { x: arrowX, y: arrowY } = middlewareData.arrow;
3235
- const side = placement.split('-')[0];
3236
- const staticSide = {
3237
- top: 'bottom',
3238
- right: 'left',
3239
- bottom: 'top',
3240
- left: 'right',
3241
- }[side];
3242
- Object.assign(this.arrowRef.style, {
3243
- left: arrowX != null ? `${arrowX}px` : '',
3244
- top: arrowY != null ? `${arrowY}px` : '',
3245
- right: '',
3246
- bottom: '',
3247
- [staticSide]: '-4px',
3248
- });
3249
- }
3250
- }
3251
- setupTriggerListeners() {
3252
- if (!this.triggerRef)
3253
- return;
3254
- this.triggerRef.addEventListener('click', this.handleTriggerClick);
3255
- }
3256
- removeTriggerListeners() {
3257
- if (!this.triggerRef)
3258
- return;
3259
- this.triggerRef.removeEventListener('click', this.handleTriggerClick);
3260
- }
3261
- handleKeyDown(e) {
3262
- if (!this.closeOnEscape || !this.isOpen)
3263
- return;
3264
- if (e.key === 'Escape') {
3265
- // Check if this is the topmost open popconfirm
3266
- const openPopconfirms = Array.from(document.querySelectorAll('bcm-pop-confirm')).filter(el => {
3267
- var _a;
3268
- const popconfirmEl = (_a = el.shadowRoot) === null || _a === void 0 ? void 0 : _a.querySelector('[popover]');
3269
- return popconfirmEl === null || popconfirmEl === void 0 ? void 0 : popconfirmEl.matches(':popover-open');
3270
- });
3271
- const topPopconfirm = openPopconfirms[openPopconfirms.length - 1];
3272
- if (topPopconfirm === this.host) {
3273
- e.preventDefault();
3274
- e.stopPropagation();
3275
- this.handleCancel();
3276
- }
3277
- }
3278
- }
3279
- componentWillLoad() {
3280
- this.popconfirmId = `popconfirm-${Math.random().toString(36).substring(2, 11)}`;
3281
- }
3282
- componentDidLoad() {
3283
- if (this.popconfirmRef) {
3284
- this.popconfirmRef.addEventListener('toggle', this.handleToggle);
3285
- }
3286
- }
3287
- disconnectedCallback() {
3288
- this.stopAutoUpdate();
3289
- this.removeTriggerListeners();
3290
- document.removeEventListener('click', this.handleOutsideClick);
3291
- if (this.popconfirmRef) {
3292
- this.popconfirmRef.removeEventListener('toggle', this.handleToggle);
3293
- }
3294
- }
3295
- render() {
3296
- const { container, arrow: arrowClass, header, headerLeft, title, closeBtn, body, footer } = this.popconfirmClass({
3297
- size: this.size,
3298
- status: this.status,
3299
- });
3300
- // Only show header if there's actual header content (headerText or custom header slot)
3301
- // Status icon only shows if explicitly enabled AND there's header text
3302
- const showStatusIcon = this.statusIcon && this.headerText;
3303
- const hasHeaderText = Boolean(this.headerText);
3304
- return (h("div", { key: '7329eb6db100b57368ca73b36a2a2ad66b218b8e', class: "inline-block" }, h("slot", { key: '0d775cf4a00b4ef97e8e75e2620ddf420caf43c6', onSlotchange: this.handleSlotChange }), h("div", { key: '19c4c001fbf51b895a45b271365b3a7cb22590bb', ref: el => (this.popconfirmRef = el), id: this.popconfirmId, part: "container", class: container(), popover: "manual", role: "alertdialog", "aria-labelledby": hasHeaderText ? `${this.popconfirmId}-header` : undefined, "aria-describedby": `${this.popconfirmId}-body` }, this.showArrow && h("div", { key: '91aaa976265c10537cea1d0d57d08df27c838645', ref: el => (this.arrowRef = el), part: "arrow", class: arrowClass() }), h("div", { key: '91a049dd52d47d267d11c8e8c628aa417fb40663', class: closeBtn(), onClick: this.handleCancel, role: "button", tabIndex: 0, "aria-label": "Close" }, h("bcm-icon", { key: 'd15fb5922185f246c15e9480c3a4652ef9e96ffa', "icon-name": "far fa-times" })), h("header", { key: 'b62f81fd72a05aa116ecad7614f20645aa85f060', class: header() }, h("div", { key: '226cbb6ac92d294b67eb0c33ed0faea52d56689a', class: headerLeft() }, showStatusIcon && h("bcm-icon", { key: '0e5cd64e8369876b9016af3c9607cdb406828651', "icon-name": statusIcons[this.status] }), hasHeaderText && (h("span", { key: '4a1cf44acf56bc46ad52fda1d1d29da0c838fded', id: `${this.popconfirmId}-header`, class: title() }, this.headerText)), h("slot", { key: '5e159545f0b12d97c9b632653955f636866c2a14', name: "header" }))), h("main", { key: '6e082c73048583a1447dc4fb7c9940a677e7d587', id: `${this.popconfirmId}-body`, part: "body", class: body() }, h("slot", { key: '6d0546a06ca77118d82074fffb9164c4b4f86a5c', name: "body" }, this.description)), h("footer", { key: '4f36400e44847e31d6ceed5fd7f47d35f68af458', part: "footer", class: footer() }, h("slot", { key: '97b85bb7dd3d39790b91e6bffef01f7eb077c2c3', name: "footer" }, h("bcm-button", { key: '8e8b7175a1dd9e069e9cbca7b430fdc1e9a7beab', kind: "outline", size: this.size, onClick: this.handleCancel }, this.cancelText), h("bcm-button", { key: 'ae9daeacaf77c8abfe92951eefe2e885d23eab79', size: this.size, status: this.status, kind: "primary", onClick: this.handleConfirm }, this.confirmText))))));
3305
- }
3306
- get host() { return getElement(this); }
3307
- static get watchers() { return {
3308
- "isOpen": ["handleOpenChange"]
3309
- }; }
3310
- };
3311
- BcmPopConfirm.style = popConfirmCss;
3312
-
3313
- const popoverCss = ".visible{visibility:visible}.transform{transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.border{border-width:1px}.transition{transition-duration:.15s;transition-property:color,background-color,border-color,text-decoration-color,fill,stroke,opacity,box-shadow,transform,filter,backdrop-filter;transition-timing-function:cubic-bezier(.4,0,.2,1)}:host{--popover-bg:var(--bcm-ui-color-background-base-default);display:inline-block}[popover]{border:none;overflow:visible;padding:0}[popover]:not(:popover-open){display:none}[popover]:popover-open{opacity:1;transform:scale(1);transition:opacity .15s ease-out,transform .15s ease-out}@starting-style{[popover]:popover-open{opacity:0;transform:scale(.95)}}[data-placement^=top] [part=arrow]{border-left:none;border-top:none}[data-placement^=bottom] [part=arrow]{border-bottom:none;border-right:none}[data-placement^=left] [part=arrow]{border-bottom:none;border-left:none}[data-placement^=right] [part=arrow]{border-right:none;border-top:none}.bcm-ui-element{-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;font-family:Inter,sans-serif}.static{position:static}.fixed{position:fixed}.absolute{position:absolute}.relative{position:relative}.m-0{margin:0}.inline-block{display:inline-block}.flex{display:flex}.h-3{height:.75rem}.w-3{width:.75rem}.min-w-max{min-width:max-content}.rotate-45{--tw-rotate:45deg}.rotate-45,.transform{transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.flex-col{flex-direction:column}.gap-1\\.5{gap:.375rem}.rounded-md{border-radius:var(--bcm-ui-border-radius-md,6px)}.bg-\\[--popover-bg\\]{background-color:var(--popover-bg)}.p-3{padding:.75rem}.text-size-3{font-size:var(--bcm-ui-font-size-3,12px);line-height:var(--bcm-ui-line-height-3,16px)}.text-size-4{font-size:var(--bcm-ui-font-size-4,14px);line-height:var(--bcm-ui-line-height-4,20px)}.text-size-5{font-size:var(--bcm-ui-font-size-5,16px);line-height:var(--bcm-ui-line-height-5,24px)}.font-normal{font-weight:400}.font-semibold{font-weight:600}.shadow{--tw-shadow:var(--bcm-ui-box-shadow-default);--tw-shadow-colored:var(--bcm-ui-box-shadow-default)}.shadow,.shadow-3{box-shadow:var(--tw-ring-offset-shadow,0 0 #0000),var(--tw-ring-shadow,0 0 #0000),var(--tw-shadow)}.shadow-3{--tw-shadow:var(--bcm-ui-box-shadow-3);--tw-shadow-colored:var(--bcm-ui-box-shadow-3)}.blur{--tw-blur:blur(8px);filter:var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow)}";
3314
-
3315
- const Popover = class {
3316
- constructor(hostRef) {
3317
- registerInstance(this, hostRef);
3318
- this.bcmBeforeOpen = createEvent(this, "bcmBeforeOpen", 1);
3319
- this.bcmOpen = createEvent(this, "bcmOpen", 1);
3320
- this.bcmBeforeClose = createEvent(this, "bcmBeforeClose", 1);
3321
- this.bcmClose = createEvent(this, "bcmClose", 1);
3322
- // Unique ID for ARIA
3323
- this.popoverId = `popover-${Math.random().toString(36).substring(2, 11)}`;
3324
- /**
3325
- * @prop {('small' | 'medium' | 'large')} size - Defines the size of the popover.
3326
- * Controls the text size and padding of the popover content.
3327
- * Default: 'medium'
3328
- */
3329
- this.size = 'medium';
3330
- /**
3331
- * @prop {('top' | 'right' | 'bottom' | 'left')} placement - Defines the position of the popover relative to the target element.
3332
- * Determines where the popover appears around the trigger element.
3333
- * Default: 'top'
3334
- */
3335
- this.placement = 'top';
3336
- /**
3337
- * @prop {('click' | 'hover' | 'hover focus')} trigger - Defines the interaction type to show/hide the popover.
3338
- * 'click' toggles on click, 'hover' shows on mouse enter and hides on mouse leave, 'hover focus' combines both.
3339
- * Default: 'click'
3340
- */
3341
- this.trigger = 'click';
3342
- /**
3343
- * @prop {number} showDelay - Delay in milliseconds before showing the popover.
3344
- * Useful to prevent popovers from appearing on quick mouse movements.
3345
- * Default: 0
3346
- */
3347
- this.showDelay = 0;
3348
- /**
3349
- * @prop {number} hideDelay - Delay in milliseconds before hiding the popover.
3350
- * Provides a grace period for mouse movements.
3351
- * Default: 0
3352
- */
3353
- this.hideDelay = 0;
3354
- /**
3355
- * @prop {boolean} open - Controls the open state of the popover.
3356
- * Can be set programmatically or toggled by user interaction.
3357
- * Default: false
3358
- */
3359
- this.open = false;
3360
- /**
3361
- * @prop {boolean} closeOnOutsideClick - Whether to close the popover when clicking outside.
3362
- * Default: true
3363
- */
3364
- this.closeOnOutsideClick = true;
3365
- /**
3366
- * @prop {boolean} closeOnEscape - Whether to close the popover when pressing Escape key.
3367
- * Default: true
3368
- */
3369
- this.closeOnEscape = true;
3370
- /**
3371
- * @prop {boolean} arrow - Whether to show an arrow pointing to the trigger element.
3372
- * Default: true
3373
- */
3374
- this.arrow = true;
3375
- // Internal state
3376
- this.isOpen = false;
3377
- this.handleSlotChange = () => {
3378
- var _a;
3379
- const slot = (_a = this.host.shadowRoot) === null || _a === void 0 ? void 0 : _a.querySelector('slot:not([name])');
3380
- if (!slot)
3381
- return;
3382
- const elements = slot.assignedElements();
3383
- if (elements.length > 0) {
3384
- // Remove old listeners
3385
- this.removeTriggerListeners();
3386
- this.triggerRef = elements[0];
3387
- this.setupTriggerListeners();
3388
- this.setupAriaAttributes();
3389
- }
3390
- };
3391
- this.handleMouseEnter = () => {
3392
- this.show();
3393
- };
3394
- this.handleMouseLeave = () => {
3395
- this.hide();
3396
- };
3397
- this.handlePopoverMouseEnter = () => {
3398
- this.clearTimeouts();
3399
- };
3400
- this.handlePopoverMouseLeave = () => {
3401
- this.hide();
3402
- };
3403
- this.handleTriggerClick = (event) => {
3404
- event.stopPropagation();
3405
- this.toggle();
3406
- };
3407
- this.handleFocus = () => {
3408
- this.show();
3409
- };
3410
- this.handleBlur = () => {
3411
- this.hide();
3412
- };
3413
- this.handleOutsideClick = (event) => {
3414
- var _a;
3415
- if (!this.closeOnOutsideClick || !this.open)
3416
- return;
3417
- const target = event.target;
3418
- const path = event.composedPath();
3419
- const isInsideHost = this.host.contains(target) || path.includes(this.host);
3420
- const isInsidePopover = ((_a = this.popoverRef) === null || _a === void 0 ? void 0 : _a.contains(target)) || (this.popoverRef && path.includes(this.popoverRef));
3421
- if (!isInsideHost && !isInsidePopover) {
3422
- this.hide();
3423
- }
3424
- };
3425
- this.handleToggle = (event) => {
3426
- // Sync internal state with native popover state
3427
- if (event.newState === 'open' && !this.isOpen) {
3428
- this.isOpen = true;
3429
- }
3430
- else if (event.newState === 'closed' && this.isOpen) {
3431
- this.isOpen = false;
3432
- }
3433
- };
3434
- this.updatePosition = async () => {
3435
- if (!this.triggerRef || !this.popoverRef)
3436
- return;
3437
- // Check if trigger element is still in viewport
3438
- const triggerRect = this.triggerRef.getBoundingClientRect();
3439
- const isInViewport = triggerRect.bottom > 0 && triggerRect.top < window.innerHeight && triggerRect.right > 0 && triggerRect.left < window.innerWidth;
3440
- // Hide popover if trigger is out of viewport
3441
- if (!isInViewport && this.open) {
3442
- this.hide();
3443
- return;
3444
- }
3445
- // Virtual element for shadow DOM boundary
3446
- const virtualElement = {
3447
- getBoundingClientRect: () => this.triggerRef.getBoundingClientRect(),
3448
- };
3449
- const middleware = [offset(12), flip({ fallbackPlacements: ['top', 'left', 'bottom', 'right'] }), shift({ padding: 8 })];
3450
- if (this.arrow && this.arrowRef) {
3451
- middleware.push(arrow({ element: this.arrowRef }));
3452
- }
3453
- const { x, y, placement, middlewareData } = await computePosition(virtualElement, this.popoverRef, {
3454
- placement: this.placement,
3455
- strategy: 'fixed',
3456
- middleware,
3457
- });
3458
- Object.assign(this.popoverRef.style, {
3459
- left: `${x}px`,
3460
- top: `${y}px`,
3461
- });
3462
- // Update placement attribute for CSS
3463
- this.popoverRef.setAttribute('data-placement', placement);
3464
- // Arrow positioning
3465
- if (this.arrow && this.arrowRef && middlewareData.arrow) {
3466
- const { x: arrowX, y: arrowY } = middlewareData.arrow;
3467
- const basePlacement = placement.split('-')[0];
3468
- const staticSide = {
3469
- top: 'bottom',
3470
- right: 'left',
3471
- bottom: 'top',
3472
- left: 'right',
3473
- }[basePlacement];
3474
- Object.assign(this.arrowRef.style, {
3475
- left: arrowX != null ? `${arrowX}px` : '',
3476
- top: arrowY != null ? `${arrowY}px` : '',
3477
- right: '',
3478
- bottom: '',
3479
- [staticSide]: '-4px',
3480
- });
3481
- }
3482
- };
3483
- this.popoverClass = tv({
3484
- slots: {
3485
- box: [
3486
- 'bcm-ui-element',
3487
- 'bcm-popover',
3488
- 'fixed',
3489
- 'm-0',
3490
- 'flex',
3491
- 'flex-col',
3492
- 'bg-[--popover-bg]',
3493
- 'rounded-md',
3494
- 'shadow-3',
3495
- 'p-3',
3496
- 'gap-1.5',
3497
- 'min-w-max',
3498
- ],
3499
- header: 'font-semibold text-color',
3500
- content: 'font-normal text-color',
3501
- arrow: 'absolute w-3 h-3 bg-[--popover-bg] transform rotate-45',
3502
- },
3503
- variants: {
3504
- size: {
3505
- small: { box: 'text-size-3' },
3506
- medium: { box: 'text-size-4' },
3507
- large: { box: 'text-size-5' },
3508
- },
3509
- },
3510
- defaultVariants: {
3511
- size: 'medium',
3512
- },
3513
- });
3514
- }
3515
- // Watch for open prop changes
3516
- handleOpenChange(newValue) {
3517
- if (newValue) {
3518
- this.showInternal();
3519
- }
3520
- else {
3521
- this.hideInternal();
3522
- }
3523
- }
3524
- // Internal show logic
3525
- showInternal() {
3526
- var _a;
3527
- if (!this.popoverRef)
3528
- return;
3529
- this.isOpen = true;
3530
- this.popoverRef.showPopover();
3531
- this.startAutoUpdate();
3532
- this.updatePosition();
3533
- (_a = this.triggerRef) === null || _a === void 0 ? void 0 : _a.setAttribute('aria-expanded', 'true');
3534
- this.bcmOpen.emit();
3535
- if (this.closeOnOutsideClick) {
3536
- this.addOutsideClickListener();
3537
- }
3538
- }
3539
- // Internal hide logic
3540
- hideInternal() {
3541
- var _a;
3542
- if (!this.popoverRef)
3543
- return;
3544
- this.isOpen = false;
3545
- this.popoverRef.hidePopover();
3546
- this.stopAutoUpdate();
3547
- (_a = this.triggerRef) === null || _a === void 0 ? void 0 : _a.setAttribute('aria-expanded', 'false');
3548
- this.bcmClose.emit();
3549
- this.removeOutsideClickListener();
3550
- }
3551
- /**
3552
- * Programmatically shows the popover.
3553
- * Respects the showDelay prop.
3554
- */
3555
- async show() {
3556
- if (this.open)
3557
- return;
3558
- this.clearTimeouts();
3559
- if (this.showDelay > 0) {
3560
- this.showTimeout = window.setTimeout(() => {
3561
- this.bcmBeforeOpen.emit();
3562
- this.open = true;
3563
- }, this.showDelay);
3564
- }
3565
- else {
3566
- this.bcmBeforeOpen.emit();
3567
- this.open = true;
3568
- }
3569
- }
3570
- /**
3571
- * Programmatically hides the popover.
3572
- * Respects the hideDelay prop.
3573
- */
3574
- async hide() {
3575
- if (!this.open)
3576
- return;
3577
- this.clearTimeouts();
3578
- if (this.hideDelay > 0) {
3579
- this.hideTimeout = window.setTimeout(() => {
3580
- this.bcmBeforeClose.emit();
3581
- this.open = false;
3582
- }, this.hideDelay);
3583
- }
3584
- else {
3585
- this.bcmBeforeClose.emit();
3586
- this.open = false;
3587
- }
3588
- }
3589
- /**
3590
- * Toggles the popover visibility.
3591
- */
3592
- async toggle() {
3593
- if (this.open) {
3594
- await this.hide();
3595
- }
3596
- else {
3597
- await this.show();
3598
- }
3599
- }
3600
- clearTimeouts() {
3601
- if (this.showTimeout) {
3602
- clearTimeout(this.showTimeout);
3603
- this.showTimeout = undefined;
3604
- }
3605
- if (this.hideTimeout) {
3606
- clearTimeout(this.hideTimeout);
3607
- this.hideTimeout = undefined;
3608
- }
3609
- }
3610
- startAutoUpdate() {
3611
- if (!this.triggerRef || !this.popoverRef)
3612
- return;
3613
- this.cleanupAutoUpdate = autoUpdate(this.triggerRef, this.popoverRef, () => this.updatePosition(), {
3614
- ancestorScroll: true,
3615
- ancestorResize: true,
3616
- elementResize: true,
3617
- layoutShift: true,
3618
- });
3619
- }
3620
- stopAutoUpdate() {
3621
- var _a;
3622
- (_a = this.cleanupAutoUpdate) === null || _a === void 0 ? void 0 : _a.call(this);
3623
- this.cleanupAutoUpdate = undefined;
3624
- }
3625
- setupTriggerListeners() {
3626
- var _a, _b;
3627
- if (!this.triggerRef)
3628
- return;
3629
- if (this.trigger === 'hover' || this.trigger === 'hover focus') {
3630
- this.triggerRef.addEventListener('mouseenter', this.handleMouseEnter);
3631
- this.triggerRef.addEventListener('mouseleave', this.handleMouseLeave);
3632
- (_a = this.popoverRef) === null || _a === void 0 ? void 0 : _a.addEventListener('mouseenter', this.handlePopoverMouseEnter);
3633
- (_b = this.popoverRef) === null || _b === void 0 ? void 0 : _b.addEventListener('mouseleave', this.handlePopoverMouseLeave);
3634
- }
3635
- if (this.trigger === 'click') {
3636
- this.triggerRef.addEventListener('click', this.handleTriggerClick);
3637
- }
3638
- if (this.trigger === 'hover focus') {
3639
- this.triggerRef.addEventListener('focus', this.handleFocus);
3640
- this.triggerRef.addEventListener('blur', this.handleBlur);
3641
- }
3642
- }
3643
- removeTriggerListeners() {
3644
- var _a, _b;
3645
- if (!this.triggerRef)
3646
- return;
3647
- this.triggerRef.removeEventListener('mouseenter', this.handleMouseEnter);
3648
- this.triggerRef.removeEventListener('mouseleave', this.handleMouseLeave);
3649
- this.triggerRef.removeEventListener('click', this.handleTriggerClick);
3650
- this.triggerRef.removeEventListener('focus', this.handleFocus);
3651
- this.triggerRef.removeEventListener('blur', this.handleBlur);
3652
- (_a = this.popoverRef) === null || _a === void 0 ? void 0 : _a.removeEventListener('mouseenter', this.handlePopoverMouseEnter);
3653
- (_b = this.popoverRef) === null || _b === void 0 ? void 0 : _b.removeEventListener('mouseleave', this.handlePopoverMouseLeave);
3654
- }
3655
- setupAriaAttributes() {
3656
- if (!this.triggerRef)
3657
- return;
3658
- this.triggerRef.setAttribute('aria-describedby', this.popoverId);
3659
- this.triggerRef.setAttribute('aria-expanded', String(this.open));
3660
- this.triggerRef.setAttribute('aria-haspopup', 'dialog');
3661
- }
3662
- handleKeyDown(event) {
3663
- var _a;
3664
- if (!this.closeOnEscape || !this.open)
3665
- return;
3666
- if (event.key === 'Escape') {
3667
- // Topmost popover check
3668
- const openPopovers = Array.from(document.querySelectorAll('bcm-popover[open]'));
3669
- const topPopover = openPopovers[openPopovers.length - 1];
3670
- if (topPopover === this.host) {
3671
- event.preventDefault();
3672
- this.hide();
3673
- (_a = this.triggerRef) === null || _a === void 0 ? void 0 : _a.focus();
3674
- }
3675
- }
3676
- }
3677
- addOutsideClickListener() {
3678
- // Add on next tick to avoid catching current click
3679
- setTimeout(() => {
3680
- document.addEventListener('click', this.handleOutsideClick, true);
3681
- }, 0);
3682
- }
3683
- removeOutsideClickListener() {
3684
- document.removeEventListener('click', this.handleOutsideClick, true);
3685
- }
3686
- componentDidLoad() {
3687
- var _a;
3688
- // Toggle event listener (Popover API)
3689
- (_a = this.popoverRef) === null || _a === void 0 ? void 0 : _a.addEventListener('toggle', this.handleToggle);
3690
- // Initial state sync
3691
- if (this.open) {
3692
- this.showInternal();
3693
- }
3694
- }
3695
- disconnectedCallback() {
3696
- this.clearTimeouts();
3697
- this.stopAutoUpdate();
3698
- this.removeTriggerListeners();
3699
- this.removeOutsideClickListener();
3700
- if (this.popoverRef) {
3701
- this.popoverRef.removeEventListener('toggle', this.handleToggle);
3702
- if (this.isOpen) {
3703
- try {
3704
- this.popoverRef.hidePopover();
3705
- }
3706
- catch (e) {
3707
- // Element might already be removed
3708
- }
3709
- }
3710
- }
3711
- }
3712
- render() {
3713
- const { box, header, content, arrow: arrowClass } = this.popoverClass({
3714
- size: this.size,
3715
- });
3716
- return (h("div", { key: '79e275204246ae56d255cf6eb3cd048631d4e89b', class: "inline-block" }, h("slot", { key: '787bce1db3d40d8e95631e4963011432f567ce38', onSlotchange: this.handleSlotChange }), h("div", { key: '11aac4ed45dfc6ea5ac73df72c1f95708c02b033', ref: el => (this.popoverRef = el), id: this.popoverId, part: "popover", class: box(),
3717
- // @ts-ignore - popover is a valid HTML attribute
3718
- popover: "manual", role: "dialog", "aria-labelledby": this.headerText ? `${this.popoverId}-header` : undefined }, this.arrow && h("div", { key: '86eff698c15414eac0b8341d0378deae0ffa9f22', ref: el => (this.arrowRef = el), part: "arrow", class: arrowClass() }), h("div", { key: '9ab131a4a26f552c9628dcec39dbfea8244abeb2', id: `${this.popoverId}-header`, part: "header", class: header() }, h("slot", { key: 'f9db05dc65149e097d086f7c93ee8962e7e2c32f', name: "header" }, this.headerText)), h("div", { key: '9e03b53071f8f3cf22e1347eaa812ecaf6e806a8', part: "content", class: content() }, h("slot", { key: '771733f668c6fd1d6f7a2f73b994a4ba906f2b6b', name: "content" }, this.message)))));
3719
- }
3720
- get host() { return getElement(this); }
3721
- static get watchers() { return {
3722
- "open": ["handleOpenChange"]
3723
- }; }
3724
- };
3725
- Popover.style = popoverCss;
3726
-
3727
- const tooltipCss = ".visible{visibility:visible}.transform{transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.border{border-width:1px}.transition{transition-duration:.15s;transition-property:color,background-color,border-color,text-decoration-color,fill,stroke,opacity,box-shadow,transform,filter,backdrop-filter;transition-timing-function:cubic-bezier(.4,0,.2,1)}:host{display:inline-block}[popover]{border:none;opacity:0;overflow:visible;padding:0;transform:scale(.95);transition:opacity .1s ease-out,transform .1s ease-out}[popover]:popover-open{opacity:1;transform:scale(1)}@starting-style{[popover]:popover-open{opacity:0;transform:scale(.95)}}.bcm-ui-element{-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;font-family:Inter,sans-serif}.pointer-events-none{pointer-events:none}.static{position:static}.fixed{position:fixed}.absolute{position:absolute}.relative{position:relative}.z-\\[9999\\]{z-index:9999}.m-0{margin:0}.inline-block{display:inline-block}.hidden{display:none}.h-2{height:.5rem}.w-2{width:.5rem}.rotate-45{--tw-rotate:45deg;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.rounded-md{border-radius:var(--bcm-ui-border-radius-md,6px)}.bg-color-default-dark{background-color:var(--bcm-ui-color-background-default-dark-default)}.px-2{padding-left:.5rem;padding-right:.5rem}.px-3{padding-left:.75rem;padding-right:.75rem}.px-4{padding-left:1rem;padding-right:1rem}.py-1{padding-bottom:.25rem;padding-top:.25rem}.py-1\\.5{padding-bottom:.375rem;padding-top:.375rem}.py-2{padding-bottom:.5rem;padding-top:.5rem}.text-size-3{font-size:var(--bcm-ui-font-size-3,12px);line-height:var(--bcm-ui-line-height-3,16px)}.text-size-4{font-size:var(--bcm-ui-font-size-4,14px);line-height:var(--bcm-ui-line-height-4,20px)}.text-size-5{font-size:var(--bcm-ui-font-size-5,16px);line-height:var(--bcm-ui-line-height-5,24px)}.font-medium{font-weight:500}.text-color-base{color:var(--bcm-ui-color-text-base)}.shadow{--tw-shadow:var(--bcm-ui-box-shadow-default);--tw-shadow-colored:var(--bcm-ui-box-shadow-default)}.shadow,.shadow-3{box-shadow:var(--tw-ring-offset-shadow,0 0 #0000),var(--tw-ring-shadow,0 0 #0000),var(--tw-shadow)}.shadow-3{--tw-shadow:var(--bcm-ui-box-shadow-3);--tw-shadow-colored:var(--bcm-ui-box-shadow-3)}";
3728
-
3729
- const BcmTooltip = class {
3730
- constructor(hostRef) {
3731
- registerInstance(this, hostRef);
3732
- this.mouseX = 0;
3733
- this.mouseY = 0;
3734
- /**
3735
- * How the tooltip is triggered
3736
- * - 'hover': Shows on mouse enter, hides on mouse leave
3737
- * - 'click': Toggles on click, closes on outside click or Escape key
3738
- */
3739
- this.trigger = 'hover';
3740
- /**
3741
- * Preferred placement of the tooltip relative to the trigger
3742
- * Note: Tooltip will automatically flip if there's not enough space
3743
- * - 'top': Above the trigger element
3744
- * - 'right': To the right of the trigger element
3745
- * - 'bottom': Below the trigger element
3746
- * - 'left': To the left of the trigger element
3747
- */
3748
- this.placement = 'top';
3749
- /**
3750
- * Size variant of the tooltip
3751
- * - 'small': Compact tooltip with minimal padding (text-size-3, py-1 px-2)
3752
- * - 'medium': Standard tooltip size (text-size-4, py-1.5 px-3)
3753
- * - 'large': Larger tooltip for more content (text-size-5, py-2 px-4)
3754
- */
3755
- this.size = 'medium';
3756
- /**
3757
- * Delay in milliseconds before showing the tooltip
3758
- * Useful to prevent tooltips from appearing on quick mouse movements
3759
- */
3760
- this.showDelay = 150;
3761
- /**
3762
- * Delay in milliseconds before hiding the tooltip
3763
- * Provides a grace period for mouse movements
3764
- */
3765
- this.hideDelay = 100;
3766
- /**
3767
- * Whether to show an arrow pointing to the trigger element
3768
- * Note: Arrow is automatically hidden in 'follow' mode
3769
- */
3770
- this.arrow = true;
3771
- /**
3772
- * Disables the tooltip, preventing it from showing
3773
- * Useful for conditional tooltips based on application state
3774
- */
3775
- this.disabled = false;
3776
- /**
3777
- * Distance in pixels between the tooltip and the trigger element
3778
- * Also used as the offset in 'follow' mode
3779
- */
3780
- this.offset = 12;
3781
- /**
3782
- * Makes the tooltip follow the mouse cursor
3783
- * When enabled:
3784
- * - Arrow is hidden
3785
- * - Tooltip position updates smoothly with cursor movement
3786
- * - Pointer events are disabled on tooltip to prevent interference
3787
- */
3788
- this.follow = false;
3789
- this.isOpen = false;
3790
- this.handleSlotChange = () => {
3791
- var _a;
3792
- const slot = (_a = this.host.shadowRoot) === null || _a === void 0 ? void 0 : _a.querySelector('slot:not([name])');
3793
- if (!slot)
3794
- return;
3795
- const elements = slot.assignedElements();
3796
- const assignedElement = elements[0];
3797
- // Get the actual element position from the host, not shadow DOM
3798
- // This ensures proper positioning across shadow boundaries
3799
- this.triggerRef = (assignedElement || this.host);
3800
- if (!this.triggerRef)
3801
- return;
3802
- // Setup ARIA relationship
3803
- if (this.tooltipRef && this.tooltipId) {
3804
- this.triggerRef.setAttribute('aria-describedby', this.tooltipId);
3805
- }
3806
- // Remove old listeners
3807
- this.removeTriggerListeners();
3808
- // Add new listeners
3809
- this.setupTriggerListeners();
3810
- };
3811
- this.handleMouseEnter = () => {
3812
- if (!this.disabled) {
3813
- this.show();
3814
- }
3815
- };
3816
- this.handleMouseLeave = () => {
3817
- this.hide();
3818
- };
3819
- this.handleMouseMove = (e) => {
3820
- this.mouseX = e.clientX;
3821
- this.mouseY = e.clientY;
3822
- };
3823
- this.handleClick = () => {
3824
- if (!this.disabled) {
3825
- this.toggle();
3826
- }
3827
- };
3828
- this.handleOutsideClick = (e) => {
3829
- var _a;
3830
- const target = e.target;
3831
- if (!this.host.contains(target) && !((_a = this.tooltipRef) === null || _a === void 0 ? void 0 : _a.contains(target))) {
3832
- this.hide();
3833
- }
3834
- };
3835
- this.handleKeyDown = (e) => {
3836
- if (e.key === 'Escape' && this.isOpen) {
3837
- // Only close if this tooltip's popover element is the topmost
3838
- const topmostPopover = document.querySelector('[popover]:popover-open:last-of-type');
3839
- if (topmostPopover === this.tooltipRef) {
3840
- e.stopPropagation(); // Prevent event from reaching parent popovers
3841
- this.hide();
3842
- // Return focus to trigger element
3843
- if (this.triggerRef && 'focus' in this.triggerRef) {
3844
- this.triggerRef.focus();
3845
- }
3846
- }
3847
- }
3848
- };
3849
- this.handleToggle = (e) => {
3850
- const toggleEvent = e;
3851
- // Sync our internal state with popover state
3852
- if (toggleEvent.newState === 'open' && !this.isOpen) {
3853
- this.isOpen = true;
3854
- }
3855
- else if (toggleEvent.newState === 'closed' && this.isOpen) {
3856
- this.isOpen = false;
3857
- }
3858
- };
3859
- this.tooltipClass = tv({
3860
- slots: {
3861
- tooltip: 'bcm-ui-element fixed m-0 bg-color-default-dark text-color-base rounded-md shadow-3 font-medium z-[9999]',
3862
- arrow: 'absolute w-2 h-2 bg-color-default-dark rotate-45',
3863
- content: '',
3864
- },
3865
- variants: {
3866
- size: {
3867
- small: {
3868
- tooltip: 'text-size-3 py-1 px-2',
3869
- },
3870
- medium: {
3871
- tooltip: 'text-size-4 py-1.5 px-3',
3872
- },
3873
- large: {
3874
- tooltip: 'text-size-5 py-2 px-4',
3875
- },
3876
- },
3877
- follow: {
3878
- true: {
3879
- tooltip: 'pointer-events-none',
3880
- },
3881
- },
3882
- },
3883
- });
3884
- }
3885
- handleDisabledChange(disabled) {
3886
- if (disabled && this.isOpen) {
3887
- this.hide();
3888
- }
3889
- }
3890
- handleTriggerChange() {
3891
- this.removeTriggerListeners();
3892
- this.setupOutsideClickListener();
3893
- if (this.triggerRef) {
3894
- this.setupTriggerListeners();
3895
- }
3896
- }
3897
- async handleOpenChange(open) {
3898
- if (!this.tooltipRef)
3899
- return;
3900
- if (open) {
3901
- this.tooltipRef.showPopover();
3902
- // Wait for next frame to ensure popover is rendered
3903
- await new Promise(resolve => requestAnimationFrame(() => resolve(undefined)));
3904
- if (this.follow) {
3905
- this.startFollowing();
3906
- }
3907
- else {
3908
- await this.updatePosition();
3909
- this.startAutoUpdate();
3910
- }
3911
- }
3912
- else {
3913
- this.tooltipRef.hidePopover();
3914
- this.stopFollowing();
3915
- this.stopAutoUpdate();
3916
- }
3917
- }
3918
- /**
3919
- * Programmatically shows the tooltip
3920
- * Respects the showDelay prop and disabled state
3921
- */
3922
- async show() {
3923
- if (this.disabled)
3924
- return;
3925
- this.clearTimeouts();
3926
- this.showTimeout = window.setTimeout(() => {
3927
- this.isOpen = true;
3928
- }, this.showDelay);
3929
- }
3930
- /**
3931
- * Programmatically hides the tooltip
3932
- * Respects the hideDelay prop
3933
- */
3934
- async hide() {
3935
- this.clearTimeouts();
3936
- this.hideTimeout = window.setTimeout(() => {
3937
- this.isOpen = false;
3938
- }, this.hideDelay);
3939
- }
3940
- /**
3941
- * Toggles the tooltip visibility
3942
- * If open, hides it; if closed, shows it
3943
- */
3944
- async toggle() {
3945
- if (this.isOpen) {
3946
- await this.hide();
3947
- }
3948
- else {
3949
- await this.show();
3950
- }
3951
- }
3952
- clearTimeouts() {
3953
- if (this.showTimeout) {
3954
- clearTimeout(this.showTimeout);
3955
- this.showTimeout = undefined;
3956
- }
3957
- if (this.hideTimeout) {
3958
- clearTimeout(this.hideTimeout);
3959
- this.hideTimeout = undefined;
3960
- }
3961
- }
3962
- startAutoUpdate() {
3963
- if (!this.triggerRef || !this.tooltipRef || this.follow)
3964
- return;
3965
- this.cleanupAutoUpdate = autoUpdate(this.triggerRef, this.tooltipRef, () => this.updatePosition(), {
3966
- ancestorScroll: true,
3967
- ancestorResize: true,
3968
- elementResize: true,
3969
- layoutShift: true,
3970
- });
3971
- }
3972
- stopAutoUpdate() {
3973
- if (this.cleanupAutoUpdate) {
3974
- this.cleanupAutoUpdate();
3975
- this.cleanupAutoUpdate = undefined;
3976
- }
3977
- }
3978
- startFollowing() {
3979
- if (!this.follow)
3980
- return;
3981
- const updateFollowPosition = () => {
3982
- if (!this.isOpen || !this.tooltipRef) {
3983
- this.rafId = undefined;
3984
- return;
3985
- }
3986
- const offsetX = this.offset;
3987
- const offsetY = this.offset;
3988
- this.tooltipRef.style.left = `${this.mouseX + offsetX}px`;
3989
- this.tooltipRef.style.top = `${this.mouseY + offsetY}px`;
3990
- this.rafId = requestAnimationFrame(updateFollowPosition);
3991
- };
3992
- this.rafId = requestAnimationFrame(updateFollowPosition);
3993
- }
3994
- stopFollowing() {
3995
- if (this.rafId) {
3996
- cancelAnimationFrame(this.rafId);
3997
- this.rafId = undefined;
3998
- }
3999
- }
4000
- async updatePosition() {
4001
- if (!this.triggerRef || !this.tooltipRef || this.follow)
4002
- return;
4003
- try {
4004
- // Check if trigger element is still in viewport
4005
- const triggerRect = this.triggerRef.getBoundingClientRect();
4006
- const isInViewport = triggerRect.bottom > 0 && triggerRect.top < window.innerHeight && triggerRect.right > 0 && triggerRect.left < window.innerWidth;
4007
- // Hide tooltip if trigger is out of viewport
4008
- if (!isInViewport && this.isOpen) {
4009
- this.hide();
4010
- return;
4011
- }
4012
- const middleware = [offset(this.offset), flip(), shift({ padding: 8 })];
4013
- if (this.arrow && this.arrowRef) {
4014
- middleware.push(arrow({ element: this.arrowRef }));
4015
- }
4016
- // Use virtual element to properly handle shadow DOM boundaries
4017
- const virtualElement = {
4018
- getBoundingClientRect: () => this.triggerRef.getBoundingClientRect(),
4019
- };
4020
- const { x, y, placement, middlewareData } = await computePosition(virtualElement, this.tooltipRef, {
4021
- placement: this.placement,
4022
- strategy: 'fixed',
4023
- middleware,
4024
- });
4025
- this.tooltipRef.style.left = `${x}px`;
4026
- this.tooltipRef.style.top = `${y}px`;
4027
- // Arrow positioning
4028
- if (this.arrow && this.arrowRef && middlewareData.arrow) {
4029
- const { x: arrowX, y: arrowY } = middlewareData.arrow;
4030
- const side = placement.split('-')[0];
4031
- const staticSide = {
4032
- top: 'bottom',
4033
- right: 'left',
4034
- bottom: 'top',
4035
- left: 'right',
4036
- }[side];
4037
- Object.assign(this.arrowRef.style, {
4038
- left: arrowX != null ? `${arrowX}px` : '',
4039
- top: arrowY != null ? `${arrowY}px` : '',
4040
- right: '',
4041
- bottom: '',
4042
- [staticSide]: '-4px',
4043
- });
4044
- }
4045
- }
4046
- catch (error) {
4047
- console.error('Failed to compute tooltip position:', error);
4048
- }
4049
- }
4050
- setupTriggerListeners() {
4051
- if (!this.triggerRef)
4052
- return;
4053
- // Add new listeners based on trigger type
4054
- if (this.trigger === 'hover') {
4055
- this.triggerRef.addEventListener('mouseenter', this.handleMouseEnter);
4056
- this.triggerRef.addEventListener('mouseleave', this.handleMouseLeave);
4057
- if (this.follow) {
4058
- this.triggerRef.addEventListener('mousemove', this.handleMouseMove);
4059
- }
4060
- }
4061
- else if (this.trigger === 'click') {
4062
- this.triggerRef.addEventListener('click', this.handleClick);
4063
- }
4064
- }
4065
- removeTriggerListeners() {
4066
- if (!this.triggerRef)
4067
- return;
4068
- this.triggerRef.removeEventListener('mouseenter', this.handleMouseEnter);
4069
- this.triggerRef.removeEventListener('mouseleave', this.handleMouseLeave);
4070
- this.triggerRef.removeEventListener('mousemove', this.handleMouseMove);
4071
- this.triggerRef.removeEventListener('click', this.handleClick);
4072
- }
4073
- setupOutsideClickListener() {
4074
- // Remove existing listener first
4075
- document.removeEventListener('click', this.handleOutsideClick);
4076
- // Add listener only for click trigger
4077
- if (this.trigger === 'click') {
4078
- document.addEventListener('click', this.handleOutsideClick);
4079
- }
4080
- }
4081
- componentDidLoad() {
4082
- // Generate unique ID for ARIA relationship
4083
- this.tooltipId = `tooltip-${Math.random().toString(36).substring(2, 11)}`;
4084
- // Setup outside click listener for click trigger
4085
- this.setupOutsideClickListener();
4086
- // Listen to popover toggle event to sync state
4087
- if (this.tooltipRef) {
4088
- this.tooltipRef.addEventListener('toggle', this.handleToggle);
4089
- }
4090
- // Setup keyboard listener for manual popover escape handling
4091
- document.addEventListener('keydown', this.handleKeyDown);
4092
- }
4093
- disconnectedCallback() {
4094
- this.clearTimeouts();
4095
- this.stopAutoUpdate();
4096
- this.stopFollowing();
4097
- this.removeTriggerListeners();
4098
- document.removeEventListener('click', this.handleOutsideClick);
4099
- document.removeEventListener('keydown', this.handleKeyDown);
4100
- if (this.tooltipRef) {
4101
- this.tooltipRef.removeEventListener('toggle', this.handleToggle);
4102
- }
4103
- }
4104
- render() {
4105
- const { tooltip, arrow: arrowClass } = this.tooltipClass({
4106
- size: this.size,
4107
- follow: this.follow,
4108
- });
4109
- return (h("div", { key: 'a539406275e1443e4446ec559cb3388ed2456328', class: "inline-block" }, h("slot", { key: 'b144f258b14a04369ff75ed90b7607ea05e23e67', onSlotchange: this.handleSlotChange }), h("div", { key: 'bbd08333a311e09e50bb2f1b3646892546f57164', ref: el => (this.tooltipRef = el), id: this.tooltipId, part: "tooltip", class: tooltip(),
4110
- // @ts-ignore - popover is a valid attribute
4111
- popover: "manual", role: "tooltip" }, this.arrow && !this.follow && h("div", { key: '7170aba70efdf413f4823cf2eff5618271b2fa70', ref: el => (this.arrowRef = el), part: "arrow", class: arrowClass() }), h("div", { key: '4fd9b56ce036663caaf1a75874e95ea566e214ef', part: "content" }, h("slot", { key: 'd5ab1ab3ef54e1c827ed1d009e226258a099378b', name: "content" }, this.message)))));
4112
- }
4113
- get host() { return getElement(this); }
4114
- static get watchers() { return {
4115
- "disabled": ["handleDisabledChange"],
4116
- "trigger": ["handleTriggerChange"],
4117
- "isOpen": ["handleOpenChange"]
4118
- }; }
4119
- };
4120
- BcmTooltip.style = tooltipCss;
4121
-
4122
- export { BcmButton as bcm_button, BcmDrawer as bcm_drawer, BcmLinked as bcm_linked, BcmModal as bcm_modal, BcmPopConfirm as bcm_pop_confirm, Popover as bcm_popover, BcmTooltip as bcm_tooltip };
4123
- //# sourceMappingURL=bcm-button.bcm-drawer.bcm-linked.bcm-modal.bcm-pop-confirm.bcm-popover.bcm-tooltip.entry.js.map