@servicetitan/anvil2 1.29.0 → 1.31.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (334) hide show
  1. package/CHANGELOG.md +43 -0
  2. package/dist/{Alert-CRv6t4jJ-g1uOIz5i.js → Alert-BW0jYz7s-C_bALro8.js} +6 -7
  3. package/dist/{Alert-CRv6t4jJ-g1uOIz5i.js.map → Alert-BW0jYz7s-C_bALro8.js.map} +1 -1
  4. package/dist/{Alert-DPNaYO2Q.js → Alert-KVBpZzAt.js} +2 -2
  5. package/dist/{Alert-DPNaYO2Q.js.map → Alert-KVBpZzAt.js.map} +1 -1
  6. package/dist/Alert.js +1 -1
  7. package/dist/{Announcement-CJmTMhbr.js → Announcement-DnaX0j_E.js} +5 -6
  8. package/dist/{Announcement-CJmTMhbr.js.map → Announcement-DnaX0j_E.js.map} +1 -1
  9. package/dist/Announcement.js +1 -1
  10. package/dist/{AnvilProvider-C7Li86-d.js → AnvilProvider-C3E7FZAC.js} +2 -2
  11. package/dist/{AnvilProvider-C7Li86-d.js.map → AnvilProvider-C3E7FZAC.js.map} +1 -1
  12. package/dist/AnvilProvider.js +1 -1
  13. package/dist/{Avatar-BbOnZyM_.js → Avatar-CylY-nHK.js} +5 -5
  14. package/dist/Avatar-CylY-nHK.js.map +1 -0
  15. package/dist/Avatar.js +1 -1
  16. package/dist/{Badge-CH8sBsJh.js → Badge-Lt1iCyYK.js} +2 -2
  17. package/dist/{Badge-CH8sBsJh.js.map → Badge-Lt1iCyYK.js.map} +1 -1
  18. package/dist/Badge.js +1 -1
  19. package/dist/{Breadcrumbs-ByNGkX5w.js → Breadcrumbs-DicsW4mk.js} +5 -5
  20. package/dist/{Breadcrumbs-ByNGkX5w.js.map → Breadcrumbs-DicsW4mk.js.map} +1 -1
  21. package/dist/Breadcrumbs.js +1 -1
  22. package/dist/{Button-3sLNiaQN.js → Button-CRGbkHTO.js} +2 -2
  23. package/dist/{Button-3sLNiaQN.js.map → Button-CRGbkHTO.js.map} +1 -1
  24. package/dist/{Button-Ce--YZ9L-Csh0Zzuf.js → Button-CpDA5JHI-DOaf7xjY.js} +7 -33
  25. package/dist/Button-CpDA5JHI-DOaf7xjY.js.map +1 -0
  26. package/dist/Button.js +1 -1
  27. package/dist/Button.module-BdSA8wlr-BdSA8wlr.js +25 -0
  28. package/dist/Button.module-BdSA8wlr-BdSA8wlr.js.map +1 -0
  29. package/dist/{ButtonCompound-CGci3MbQ.js → ButtonCompound-DbOF1Uyo-D4_cdbXr.js} +5 -23
  30. package/dist/ButtonCompound-DbOF1Uyo-D4_cdbXr.js.map +1 -0
  31. package/dist/ButtonCompound-Dq-3iCqQ.js +24 -0
  32. package/dist/ButtonCompound-Dq-3iCqQ.js.map +1 -0
  33. package/dist/ButtonCompound.js +1 -1
  34. package/dist/{ButtonLink-DcFTS_ob.js → ButtonLink-B1b4NVwl.js} +2 -2
  35. package/dist/{ButtonLink-DcFTS_ob.js.map → ButtonLink-B1b4NVwl.js.map} +1 -1
  36. package/dist/ButtonLink.js +1 -1
  37. package/dist/{ButtonToggle-CEHlQT_K.js → ButtonToggle-BdIwMXdH.js} +2 -2
  38. package/dist/{ButtonToggle-CEHlQT_K.js.map → ButtonToggle-BdIwMXdH.js.map} +1 -1
  39. package/dist/{ButtonToggle-BYwKq0iP-B4gHrxUt.js → ButtonToggle-D5b-K9BR-g1A3w7M3.js} +6 -5
  40. package/dist/ButtonToggle-D5b-K9BR-g1A3w7M3.js.map +1 -0
  41. package/dist/ButtonToggle.js +1 -1
  42. package/dist/{Calendar-CFsWEulW.js → Calendar-CqEPLYlk.js} +2 -2
  43. package/dist/{Calendar-CFsWEulW.js.map → Calendar-CqEPLYlk.js.map} +1 -1
  44. package/dist/{Calendar-9iYMS0Iw-D_XWYjOE.js → Calendar-DGlqu1W3-Bi5Q7PZR.js} +22 -26
  45. package/dist/{Calendar-9iYMS0Iw-D_XWYjOE.js.map → Calendar-DGlqu1W3-Bi5Q7PZR.js.map} +1 -1
  46. package/dist/Calendar.js +1 -1
  47. package/dist/{Card-CWGAMe-7.js → Card-D-ntWPsN.js} +2 -2
  48. package/dist/{Card-CWGAMe-7.js.map → Card-D-ntWPsN.js.map} +1 -1
  49. package/dist/{Card-js75vKLt-Bk6ujopM.js → Card-DukbBYaA-JN-eYW_v.js} +11 -11
  50. package/dist/{Card-js75vKLt-Bk6ujopM.js.map → Card-DukbBYaA-JN-eYW_v.js.map} +1 -1
  51. package/dist/{Card-js75vKLt.css → Card-DukbBYaA.css} +25 -10
  52. package/dist/Card.js +1 -1
  53. package/dist/{Checkbox-D6-kiZ0g-6jox0aDW.js → Checkbox-B1OkhWY6-DAwwh6to.js} +13 -10
  54. package/dist/Checkbox-B1OkhWY6-DAwwh6to.js.map +1 -0
  55. package/dist/{Checkbox-DJguu7Kw.js → Checkbox-K1ZrRTEZ.js} +2 -2
  56. package/dist/{Checkbox-DJguu7Kw.js.map → Checkbox-K1ZrRTEZ.js.map} +1 -1
  57. package/dist/Checkbox.js +1 -1
  58. package/dist/{Checkbox.module-DMrZNVpb-DL8zOKBQ.js → Checkbox.module-DMrZNVpb-DOdjd86H.js} +2 -2
  59. package/dist/{Checkbox.module-DMrZNVpb-DL8zOKBQ.js.map → Checkbox.module-DMrZNVpb-DOdjd86H.js.map} +1 -1
  60. package/dist/{Chip-CAxTyjIZ-DfkCTnYy.js → Chip-DX922SMw-13SW9xaV.js} +7 -9
  61. package/dist/Chip-DX922SMw-13SW9xaV.js.map +1 -0
  62. package/dist/{Chip-C5ElPVsb.js → Chip-i-OBdpYm.js} +2 -2
  63. package/dist/{Chip-C5ElPVsb.js.map → Chip-i-OBdpYm.js.map} +1 -1
  64. package/dist/Chip.js +1 -1
  65. package/dist/{Combobox-DCrEfyl2.js → Combobox-3SWKXAYu.js} +119 -135
  66. package/dist/Combobox-3SWKXAYu.js.map +1 -0
  67. package/dist/Combobox.js +1 -1
  68. package/dist/{DateField-4jR9NvbC.js → DateField-YjnaTpA4.js} +63 -41
  69. package/dist/DateField-YjnaTpA4.js.map +1 -0
  70. package/dist/DateField.js +1 -1
  71. package/dist/{Details-B1wMLkdg.js → Details-CtCidzce.js} +8 -8
  72. package/dist/Details-CtCidzce.js.map +1 -0
  73. package/dist/Details.js +1 -1
  74. package/dist/{Dialog-CL3bfZuB.js → Dialog-DDF9Xyrs.js} +2 -2
  75. package/dist/{Dialog-CL3bfZuB.js.map → Dialog-DDF9Xyrs.js.map} +1 -1
  76. package/dist/Dialog.js +1 -1
  77. package/dist/{Divider-CLnPwn7z.js → Divider-By5PjW0_.js} +2 -2
  78. package/dist/{Divider-CLnPwn7z.js.map → Divider-By5PjW0_.js.map} +1 -1
  79. package/dist/Divider.js +1 -1
  80. package/dist/DndSort.css +148 -0
  81. package/dist/DndSort.d.ts +2 -0
  82. package/dist/DndSort.js +5622 -0
  83. package/dist/DndSort.js.map +1 -0
  84. package/dist/{Drawer-8nHrKktU.js → Drawer-Bffoaren.js} +2 -2
  85. package/dist/{Drawer-8nHrKktU.js.map → Drawer-Bffoaren.js.map} +1 -1
  86. package/dist/Drawer.js +1 -1
  87. package/dist/{EditCard-Nwz2BjY0.js → EditCard-DripZNiC.js} +21 -23
  88. package/dist/EditCard-DripZNiC.js.map +1 -0
  89. package/dist/EditCard.css +15 -12
  90. package/dist/EditCard.js +1 -1
  91. package/dist/{Flex-D92F03lr.js → Flex-CbkDTKfn.js} +2 -2
  92. package/dist/{Flex-D92F03lr.js.map → Flex-CbkDTKfn.js.map} +1 -1
  93. package/dist/{Flex-pdHNcZrF-CdQdYhOU.js → Flex-DlNiHX1G-DiUzqGqj.js} +3 -3
  94. package/dist/{Flex-pdHNcZrF-CdQdYhOU.js.map → Flex-DlNiHX1G-DiUzqGqj.js.map} +1 -1
  95. package/dist/Flex.js +1 -1
  96. package/dist/{Grid-DaeLjn0g.js → Grid-LhlvpLTc.js} +2 -2
  97. package/dist/{Grid-DaeLjn0g.js.map → Grid-LhlvpLTc.js.map} +1 -1
  98. package/dist/Grid.js +1 -1
  99. package/dist/{HammerProvider-DuxhW0gv-C2voN5ro.js → HammerProvider-B4ULvVBh-DKGRrw3q.js} +4 -3
  100. package/dist/{HammerProvider-DuxhW0gv-C2voN5ro.js.map → HammerProvider-B4ULvVBh-DKGRrw3q.js.map} +1 -1
  101. package/dist/{Helper-Ba5DBS51-DBtASfJG.js → Helper-DBmwQvEP-Z2T8bXHx.js} +3 -3
  102. package/dist/{Helper-Ba5DBS51-DBtASfJG.js.map → Helper-DBmwQvEP-Z2T8bXHx.js.map} +1 -1
  103. package/dist/{Icon-DbHA5GV1-DwO2aGkj.js → Icon-DuwR7O2z-DwPHQiBF.js} +4 -4
  104. package/dist/Icon-DuwR7O2z-DwPHQiBF.js.map +1 -0
  105. package/dist/{Icon-CrE5UgZV.js → Icon-U0zxixxg.js} +2 -2
  106. package/dist/{Icon-CrE5UgZV.js.map → Icon-U0zxixxg.js.map} +1 -1
  107. package/dist/Icon.js +1 -1
  108. package/dist/{InputMask-jsL7rSOk.js → InputMask-DdF90b0D.js} +2 -2
  109. package/dist/{InputMask-jsL7rSOk.js.map → InputMask-DdF90b0D.js.map} +1 -1
  110. package/dist/{InputMask-B8N8PP1W-DlUKpMR4.js → InputMask-MW0aui2v-d0ziTRnR.js} +4 -4
  111. package/dist/InputMask-MW0aui2v-d0ziTRnR.js.map +1 -0
  112. package/dist/InputMask.js +1 -1
  113. package/dist/{Link-CBkwLJrX.js → Link-DDBu_8WX.js} +2 -2
  114. package/dist/{Link-CBkwLJrX.js.map → Link-DDBu_8WX.js.map} +1 -1
  115. package/dist/{Link-BZ7vy96e-DolN6mMF.js → Link-DIyZHRIV-DXK6prKs.js} +4 -4
  116. package/dist/{Link-BZ7vy96e-DolN6mMF.js.map → Link-DIyZHRIV-DXK6prKs.js.map} +1 -1
  117. package/dist/Link.js +1 -1
  118. package/dist/{ListView-DX7NxNSw.js → ListView-BU0TCQ4k.js} +5 -5
  119. package/dist/{ListView-DX7NxNSw.js.map → ListView-BU0TCQ4k.js.map} +1 -1
  120. package/dist/ListView.js +1 -1
  121. package/dist/{ListView.module-BqvHsIQ9-BqvHsIQ9.js → ListView.module-3I2M0Pia-3I2M0Pia.js} +2 -4
  122. package/dist/ListView.module-3I2M0Pia-3I2M0Pia.js.map +1 -0
  123. package/dist/{Listbox-DcMJEUMo.js → Listbox-BQP8FRTF.js} +2 -2
  124. package/dist/{Listbox-DcMJEUMo.js.map → Listbox-BQP8FRTF.js.map} +1 -1
  125. package/dist/{Listbox-CCUnPdBn-DwvTVF0i.js → Listbox-CthJSHQ3-Zsuei4zJ.js} +12 -12
  126. package/dist/Listbox-CthJSHQ3-Zsuei4zJ.js.map +1 -0
  127. package/dist/Listbox.js +1 -1
  128. package/dist/{LocalizationProvider-wckXpCYz-BnJmp0tU.js → LocalizationProvider-BrxC1a2D-B1iQENoJ.js} +2 -2
  129. package/dist/{LocalizationProvider-wckXpCYz-BnJmp0tU.js.map → LocalizationProvider-BrxC1a2D-B1iQENoJ.js.map} +1 -1
  130. package/dist/LocalizationProvider.js +1 -1
  131. package/dist/{Menu-CsfX8-_z.js → Menu-BtinbJQ_.js} +11 -20
  132. package/dist/Menu-BtinbJQ_.js.map +1 -0
  133. package/dist/Menu.js +1 -1
  134. package/dist/{Overflow-Codc9CEy.js → Overflow-CKVmrb1N.js} +2 -2
  135. package/dist/{Overflow-Codc9CEy.js.map → Overflow-CKVmrb1N.js.map} +1 -1
  136. package/dist/{Overflow-Cv9sOPm3-AYGUgSQn.js → Overflow-DXWJ1gWT-tN8GInwt.js} +7 -7
  137. package/dist/Overflow-DXWJ1gWT-tN8GInwt.js.map +1 -0
  138. package/dist/Overflow.js +1 -1
  139. package/dist/{Page-vKi5JkDS.js → Page-DnroZYyr.js} +20 -16
  140. package/dist/Page-DnroZYyr.js.map +1 -0
  141. package/dist/Page.js +1 -1
  142. package/dist/{Popover-OFlyW8gN.js → Popover-C7aIgvIl.js} +2 -2
  143. package/dist/{Popover-OFlyW8gN.js.map → Popover-C7aIgvIl.js.map} +1 -1
  144. package/dist/{Popover-tu_N1aS6-CSLR1Xzc.js → Popover-DDhjaX2z-waNj8Iba.js} +13 -16
  145. package/dist/Popover-DDhjaX2z-waNj8Iba.js.map +1 -0
  146. package/dist/Popover.js +1 -1
  147. package/dist/{ProgressBar-gVRLaKPz.js → ProgressBar-BfdgLTrw.js} +2 -2
  148. package/dist/{ProgressBar-gVRLaKPz.js.map → ProgressBar-BfdgLTrw.js.map} +1 -1
  149. package/dist/ProgressBar-YrCJtlvK-BlhqSUr-.js +2539 -0
  150. package/dist/ProgressBar-YrCJtlvK-BlhqSUr-.js.map +1 -0
  151. package/dist/ProgressBar-YrCJtlvK.css +736 -0
  152. package/dist/ProgressBar.js +1 -1
  153. package/dist/{Radio-BBwG1fqT-vopD4gzD.js → Radio-DE79qJFW-Dt9tFahU.js} +6 -6
  154. package/dist/{Radio-BBwG1fqT-vopD4gzD.js.map → Radio-DE79qJFW-Dt9tFahU.js.map} +1 -1
  155. package/dist/{Radio-CtFSLOYa.js → Radio-vM4P73jb.js} +2 -2
  156. package/dist/{Radio-CtFSLOYa.js.map → Radio-vM4P73jb.js.map} +1 -1
  157. package/dist/Radio.js +1 -1
  158. package/dist/{SearchField-C-4icPUa.js → SearchField-DMx9YWba.js} +6 -9
  159. package/dist/SearchField-DMx9YWba.js.map +1 -0
  160. package/dist/SearchField.js +1 -1
  161. package/dist/{SegmentedControl-DyeWOOF3.js → SegmentedControl-D-kdk7BJ.js} +5 -5
  162. package/dist/{SegmentedControl-DyeWOOF3.js.map → SegmentedControl-D-kdk7BJ.js.map} +1 -1
  163. package/dist/SegmentedControl.js +1 -1
  164. package/dist/SelectCard.js +1 -1
  165. package/dist/{SelectCardGroup-Ch56Mp-k.js → SelectCardGroup-u0bbiRwe.js} +13 -10
  166. package/dist/SelectCardGroup-u0bbiRwe.js.map +1 -0
  167. package/dist/{SideNav-Mdwo6zfi.js → SideNav-BIV-c-1o.js} +10 -31
  168. package/dist/SideNav-BIV-c-1o.js.map +1 -0
  169. package/dist/SideNav.js +1 -1
  170. package/dist/{Skeleton-DHDzs9qd.js → Skeleton-CO1kBH8A.js} +2 -2
  171. package/dist/{Skeleton-DHDzs9qd.js.map → Skeleton-CO1kBH8A.js.map} +1 -1
  172. package/dist/Skeleton.js +1 -1
  173. package/dist/{Spinner-DdirfhPp-c7cDfIit.js → Spinner-B55mSnmk-B3oOSVLo.js} +3 -6
  174. package/dist/Spinner-B55mSnmk-B3oOSVLo.js.map +1 -0
  175. package/dist/{Spinner-C0SZj1Xr.js → Spinner-DUXjTDlr.js} +2 -2
  176. package/dist/{Spinner-C0SZj1Xr.js.map → Spinner-DUXjTDlr.js.map} +1 -1
  177. package/dist/Spinner.js +1 -1
  178. package/dist/{Stepper-c7C22LVq.js → Stepper-tJSGpsW1.js} +14 -14
  179. package/dist/Stepper-tJSGpsW1.js.map +1 -0
  180. package/dist/Stepper.js +1 -1
  181. package/dist/{Switch-D2mURCX4.js → Switch-CksM88Ks.js} +3 -3
  182. package/dist/{Switch-D2mURCX4.js.map → Switch-CksM88Ks.js.map} +1 -1
  183. package/dist/Switch.js +1 -1
  184. package/dist/{Tab-x6_xtr13.js → Tab-qn_tnvF4.js} +11 -11
  185. package/dist/Tab-qn_tnvF4.js.map +1 -0
  186. package/dist/Tab.js +1 -1
  187. package/dist/{Text-C2n3GDdC-rz_AelM0.js → Text-BCRKWTMM-BvIdEgVR.js} +3 -3
  188. package/dist/{Text-C2n3GDdC-rz_AelM0.js.map → Text-BCRKWTMM-BvIdEgVR.js.map} +1 -1
  189. package/dist/{Text-BnRrIF-W.js → Text-CF2KcnWA.js} +2 -2
  190. package/dist/{Text-BnRrIF-W.js.map → Text-CF2KcnWA.js.map} +1 -1
  191. package/dist/Text.js +1 -1
  192. package/dist/{TextField-DgxJO1a7.js → TextField-B7Asq1aB.js} +2 -2
  193. package/dist/{TextField-DgxJO1a7.js.map → TextField-B7Asq1aB.js.map} +1 -1
  194. package/dist/{TextField-B8LHWOoC-DSV9zY-z.js → TextField-BTgxdt7I-Da1U7oOT.js} +8 -8
  195. package/dist/{TextField-B8LHWOoC-DSV9zY-z.js.map → TextField-BTgxdt7I-Da1U7oOT.js.map} +1 -1
  196. package/dist/TextField.js +1 -1
  197. package/dist/{TextField.module-B411p3ST-B411p3ST.js → TextField.module-ZWACK1yV-ZWACK1yV.js} +2 -4
  198. package/dist/TextField.module-ZWACK1yV-ZWACK1yV.js.map +1 -0
  199. package/dist/{Textarea-B-Dv2RXs.js → Textarea-CaMvxI9Y.js} +10 -12
  200. package/dist/Textarea-CaMvxI9Y.js.map +1 -0
  201. package/dist/Textarea.js +1 -1
  202. package/dist/{ThemeProvider-CioBp3gk-B6HyDICa.js → ThemeProvider-DKkyZPDr-BH0VGW7C.js} +6 -6
  203. package/dist/ThemeProvider-DKkyZPDr-BH0VGW7C.js.map +1 -0
  204. package/dist/{ThemeProvider-CioBp3gk.css → ThemeProvider-DKkyZPDr.css} +912 -120
  205. package/dist/{ThemeProvider-CRXKTOvG.js → ThemeProvider-Drjj0EtN.js} +2 -2
  206. package/dist/{ThemeProvider-CRXKTOvG.js.map → ThemeProvider-Drjj0EtN.js.map} +1 -1
  207. package/dist/ThemeProvider.js +1 -1
  208. package/dist/Toast.js +1 -1
  209. package/dist/{Toolbar-7BeCY61H.js → Toolbar-OYgCC3Up.js} +14 -14
  210. package/dist/Toolbar-OYgCC3Up.js.map +1 -0
  211. package/dist/Toolbar.js +1 -1
  212. package/dist/{Tooltip-BVBq-KxK.js → Tooltip-rDXwk4az.js} +2 -2
  213. package/dist/{Tooltip-BVBq-KxK.js.map → Tooltip-rDXwk4az.js.map} +1 -1
  214. package/dist/Tooltip.js +1 -1
  215. package/dist/assets/css-utils/border.css +4 -0
  216. package/dist/assets/css-utils/color.css +12 -0
  217. package/dist/assets/css-utils/utils.css +14 -0
  218. package/dist/{check_circle-C3DDoVXp.js → check_circle-BGfigqq-.js} +4 -2
  219. package/dist/check_circle-BGfigqq-.js.map +1 -0
  220. package/dist/components/DateField/DateField.d.ts +3 -1
  221. package/dist/components/DndSort/index.d.ts +2 -0
  222. package/dist/components/SelectCard/SelectCard.d.ts +4 -1
  223. package/dist/components/Toast/Toaster.d.ts +11 -5
  224. package/dist/components/Toast/toast.d.ts +1 -4
  225. package/dist/{floating-ui.react-4AwURJA3.js → floating-ui.react-Domgunz0.js} +667 -124
  226. package/dist/floating-ui.react-Domgunz0.js.map +1 -0
  227. package/dist/hooks/index.d.ts +1 -0
  228. package/dist/hooks/useBreakpoint/index.d.ts +1 -0
  229. package/dist/index.js +54 -53
  230. package/dist/index.js.map +1 -1
  231. package/dist/internal/components/Shadow.d.ts +3 -0
  232. package/dist/{proxy-Cy56d5Wf.js → proxy-CreWmH-e.js} +64 -53
  233. package/dist/proxy-CreWmH-e.js.map +1 -0
  234. package/dist/toast-KF3GWYbk.js +96 -0
  235. package/dist/toast-KF3GWYbk.js.map +1 -0
  236. package/dist/token/core/css-utils/border.css +4 -0
  237. package/dist/token/core/css-utils/color.css +12 -0
  238. package/dist/token/core/css-utils/utils.css +14 -0
  239. package/dist/token/core/raw.js +6 -0
  240. package/dist/token/core/semantic-variables.scss +6 -0
  241. package/dist/token/core/semantic.js +30 -0
  242. package/dist/token/core/semantic.scss +3 -0
  243. package/dist/token.js +33 -0
  244. package/dist/token.js.map +1 -1
  245. package/dist/{use-reduced-motion-BR76mHGj.js → use-reduced-motion-znCm41qB.js} +2 -2
  246. package/dist/{use-reduced-motion-BR76mHGj.js.map → use-reduced-motion-znCm41qB.js.map} +1 -1
  247. package/dist/{useAccessibleColor-CR4Gw85S-D9BFnrDq.js → useAccessibleColor-Dc6B_M-Z-BYKjkGRg.js} +4 -4
  248. package/dist/useAccessibleColor-Dc6B_M-Z-BYKjkGRg.js.map +1 -0
  249. package/dist/useAccessibleColor.js +1 -1
  250. package/dist/useBreakpoint-7QkBkSeP-Cv5fnZxs.js +50 -0
  251. package/dist/useBreakpoint-7QkBkSeP-Cv5fnZxs.js.map +1 -0
  252. package/dist/useBreakpoint.d.ts +6 -0
  253. package/dist/useBreakpoint.js +2 -0
  254. package/dist/useBreakpoint.js.map +1 -0
  255. package/dist/{useLayoutPropsUtil-C6qizVc6-BkgAan7h.js → useLayoutPropsUtil-3B2XYWSr-ChuzrydG.js} +9 -50
  256. package/dist/useLayoutPropsUtil-3B2XYWSr-ChuzrydG.js.map +1 -0
  257. package/dist/useLinkStyles.js +1 -1
  258. package/dist/useSize.js +4 -4
  259. package/dist/useSize.js.map +1 -1
  260. package/dist/useTrackingId.js +1 -1
  261. package/dist/useTrackingId.js.map +1 -1
  262. package/package.json +3 -6
  263. package/dist/Avatar-BbOnZyM_.js.map +0 -1
  264. package/dist/Button-Ce--YZ9L-Csh0Zzuf.js.map +0 -1
  265. package/dist/ButtonCompound-CGci3MbQ.js.map +0 -1
  266. package/dist/ButtonToggle-BYwKq0iP-B4gHrxUt.js.map +0 -1
  267. package/dist/Checkbox-D6-kiZ0g-6jox0aDW.js.map +0 -1
  268. package/dist/Chip-CAxTyjIZ-DfkCTnYy.js.map +0 -1
  269. package/dist/Combobox-DCrEfyl2.js.map +0 -1
  270. package/dist/DateField-4jR9NvbC.js.map +0 -1
  271. package/dist/Details-B1wMLkdg.js.map +0 -1
  272. package/dist/Dialog-CYBt_JdP-CmF0MUHL.js +0 -307
  273. package/dist/Dialog-CYBt_JdP-CmF0MUHL.js.map +0 -1
  274. package/dist/Dialog-CYBt_JdP.css +0 -140
  275. package/dist/Drawer-UQlX-LQG-BSCnMRad.js +0 -297
  276. package/dist/Drawer-UQlX-LQG-BSCnMRad.js.map +0 -1
  277. package/dist/Drawer-UQlX-LQG.css +0 -153
  278. package/dist/EditCard-Nwz2BjY0.js.map +0 -1
  279. package/dist/Icon-DbHA5GV1-DwO2aGkj.js.map +0 -1
  280. package/dist/InputMask-B8N8PP1W-DlUKpMR4.js.map +0 -1
  281. package/dist/Label-CUVr-jvI-BXhER5eQ.js +0 -51
  282. package/dist/Label-CUVr-jvI-BXhER5eQ.js.map +0 -1
  283. package/dist/Label-CUVr-jvI.css +0 -62
  284. package/dist/ListView.module-BqvHsIQ9-BqvHsIQ9.js.map +0 -1
  285. package/dist/Listbox-CCUnPdBn-DwvTVF0i.js.map +0 -1
  286. package/dist/Menu-CsfX8-_z.js.map +0 -1
  287. package/dist/Overflow-Cv9sOPm3-AYGUgSQn.js.map +0 -1
  288. package/dist/Page-vKi5JkDS.js.map +0 -1
  289. package/dist/Popover-tu_N1aS6-CSLR1Xzc.js.map +0 -1
  290. package/dist/ProgressBar-DQ1lsFk2-Ci4eqzM0.js +0 -130
  291. package/dist/ProgressBar-DQ1lsFk2-Ci4eqzM0.js.map +0 -1
  292. package/dist/ProgressBar-DQ1lsFk2.css +0 -91
  293. package/dist/SearchField-C-4icPUa.js.map +0 -1
  294. package/dist/SelectCardGroup-Ch56Mp-k.js.map +0 -1
  295. package/dist/SideNav-Mdwo6zfi.js.map +0 -1
  296. package/dist/Spinner-DdirfhPp-c7cDfIit.js.map +0 -1
  297. package/dist/Stepper-c7C22LVq.js.map +0 -1
  298. package/dist/Tab-x6_xtr13.js.map +0 -1
  299. package/dist/TextField.module-B411p3ST-B411p3ST.js.map +0 -1
  300. package/dist/Textarea-B-Dv2RXs.js.map +0 -1
  301. package/dist/ThemeProvider-CioBp3gk-B6HyDICa.js.map +0 -1
  302. package/dist/Toolbar-7BeCY61H.js.map +0 -1
  303. package/dist/Tooltip-C8sCGmKM-CLrDofvy.js +0 -631
  304. package/dist/Tooltip-C8sCGmKM-CLrDofvy.js.map +0 -1
  305. package/dist/Tooltip-C8sCGmKM.css +0 -102
  306. package/dist/check_circle-C3DDoVXp.js.map +0 -1
  307. package/dist/floating-ui.react-4AwURJA3.js.map +0 -1
  308. package/dist/index.esm-CunAFnrh.js +0 -546
  309. package/dist/index.esm-CunAFnrh.js.map +0 -1
  310. package/dist/info-CYpG6tcI.js +0 -6
  311. package/dist/info-CYpG6tcI.js.map +0 -1
  312. package/dist/proxy-Cy56d5Wf.js.map +0 -1
  313. package/dist/supportsPopover-8aJR37cf-8aJR37cf.js +0 -6
  314. package/dist/supportsPopover-8aJR37cf-8aJR37cf.js.map +0 -1
  315. package/dist/toast-CbokOkfo.js +0 -937
  316. package/dist/toast-CbokOkfo.js.map +0 -1
  317. package/dist/toast.css +0 -216
  318. package/dist/useAccessibleColor-CR4Gw85S-D9BFnrDq.js.map +0 -1
  319. package/dist/useKeyboardFocusables-CwVMAe5C-DtjYOAmt.js +0 -61
  320. package/dist/useKeyboardFocusables-CwVMAe5C-DtjYOAmt.js.map +0 -1
  321. package/dist/useLayoutPropsUtil-C6qizVc6-BkgAan7h.js.map +0 -1
  322. /package/dist/{Alert-CRv6t4jJ.css → Alert-BW0jYz7s.css} +0 -0
  323. /package/dist/{Button-Ce--YZ9L.css → Button.css} +0 -0
  324. /package/dist/{Calendar-9iYMS0Iw.css → Calendar-DGlqu1W3.css} +0 -0
  325. /package/dist/{Chip-CAxTyjIZ.css → Chip-DX922SMw.css} +0 -0
  326. /package/dist/{Flex-pdHNcZrF.css → Flex-DlNiHX1G.css} +0 -0
  327. /package/dist/{Helper-Ba5DBS51.css → Helper-DBmwQvEP.css} +0 -0
  328. /package/dist/{Icon-DbHA5GV1.css → Icon-DuwR7O2z.css} +0 -0
  329. /package/dist/{Link-BZ7vy96e.css → Link-DIyZHRIV.css} +0 -0
  330. /package/dist/{Overflow-Cv9sOPm3.css → Overflow-DXWJ1gWT.css} +0 -0
  331. /package/dist/{Popover-tu_N1aS6.css → Popover-DDhjaX2z.css} +0 -0
  332. /package/dist/{Radio-BBwG1fqT.css → Radio-DE79qJFW.css} +0 -0
  333. /package/dist/{Spinner-DdirfhPp.css → Spinner-B55mSnmk.css} +0 -0
  334. /package/dist/{Text-C2n3GDdC.css → Text-BCRKWTMM.css} +0 -0
@@ -0,0 +1,2539 @@
1
+ import { jsxs, jsx, Fragment } from 'react/jsx-runtime';
2
+ import { useState, useRef, useEffect, forwardRef, useId, useContext, createContext, useCallback, useMemo, cloneElement, useLayoutEffect } from 'react';
3
+ import { c as cx } from './index-tZvMCc77.js';
4
+ import { I as Icon } from './Icon-DuwR7O2z-DwPHQiBF.js';
5
+ import { a as SvgCheckCircle, S as SvgError, b as SvgInfo } from './check_circle-BGfigqq-.js';
6
+ import { t as tabbable, q as useDelayGroup, F as FloatingPortal, b as FloatingArrow, p as computePosition, n as autoUpdate, o as offset, f as flip, d as shift, e as arrow$1, l as limitShift, r as useDelayGroupContext, c as useFloating, h as useHover, i as safePolygon, v as useFocus, j as useDismiss, k as useRole, m as useInteractions } from './floating-ui.react-Domgunz0.js';
7
+ import { a as PortalProviderContext } from './PortalProvider-9lXkQ0xY-BKoGegS1.js';
8
+ import { S as SvgClose } from './close-DZj38AEh.js';
9
+ import { T as Text } from './Text-BCRKWTMM-BvIdEgVR.js';
10
+ import { B as Button } from './Button-CpDA5JHI-DOaf7xjY.js';
11
+ import { A as Alert } from './Alert-BW0jYz7s-C_bALro8.js';
12
+ import { F as Flex } from './Flex-DlNiHX1G-DiUzqGqj.js';
13
+ import { u as useLayoutPropsUtil } from './useLayoutPropsUtil-3B2XYWSr-ChuzrydG.js';
14
+ import { H as Helper } from './Helper-DBmwQvEP-Z2T8bXHx.js';
15
+ import { u as useSwipe } from './useSwipe-DIUHs7T5-DIUHs7T5.js';
16
+ import { S as SrOnly } from './SrOnly-BXm1DGl3-BJVodjQp.js';
17
+ import { u as useMergeRefs } from './useMergeRefs-Bde85AWI-Bde85AWI.js';
18
+ import { T as ThemeProvider, a as ThemeProviderContext } from './ThemeProvider-DKkyZPDr-BH0VGW7C.js';
19
+ import { g as getKeyboardFocusableElements } from './getKeyboardFocusableElements-QqcABz0D.js';
20
+ import { u as useTooltipLegacyGroup } from './HammerProvider-B4ULvVBh-DKGRrw3q.js';
21
+
22
+ import './ProgressBar-YrCJtlvK.css';/**
23
+ * Convert array of 16 byte values to UUID string format of the form:
24
+ * XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX
25
+ */
26
+ var byteToHex = [];
27
+ for (var i = 0; i < 256; ++i) {
28
+ byteToHex.push((i + 0x100).toString(16).slice(1));
29
+ }
30
+ function unsafeStringify(arr, offset = 0) {
31
+ // Note: Be careful editing this code! It's been tuned for performance
32
+ // and works in ways you may not expect. See https://github.com/uuidjs/uuid/pull/434
33
+ //
34
+ // Note to future-self: No, you can't remove the `toLowerCase()` call.
35
+ // REF: https://github.com/uuidjs/uuid/pull/677#issuecomment-1757351351
36
+ return (byteToHex[arr[offset + 0]] + byteToHex[arr[offset + 1]] + byteToHex[arr[offset + 2]] + byteToHex[arr[offset + 3]] + '-' + byteToHex[arr[offset + 4]] + byteToHex[arr[offset + 5]] + '-' + byteToHex[arr[offset + 6]] + byteToHex[arr[offset + 7]] + '-' + byteToHex[arr[offset + 8]] + byteToHex[arr[offset + 9]] + '-' + byteToHex[arr[offset + 10]] + byteToHex[arr[offset + 11]] + byteToHex[arr[offset + 12]] + byteToHex[arr[offset + 13]] + byteToHex[arr[offset + 14]] + byteToHex[arr[offset + 15]]).toLowerCase();
37
+ }
38
+
39
+ // Unique ID creation requires a high quality random # generator. In the browser we therefore
40
+ // require the crypto API and do not support built-in fallback to lower quality random number
41
+ // generators (like Math.random()).
42
+
43
+ var getRandomValues;
44
+ var rnds8 = new Uint8Array(16);
45
+ function rng() {
46
+ // lazy load so that environments that need to polyfill have a chance to do so
47
+ if (!getRandomValues) {
48
+ // getRandomValues needs to be invoked in a context where "this" is a Crypto implementation.
49
+ getRandomValues = typeof crypto !== 'undefined' && crypto.getRandomValues && crypto.getRandomValues.bind(crypto);
50
+ if (!getRandomValues) {
51
+ throw new Error('crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported');
52
+ }
53
+ }
54
+ return getRandomValues(rnds8);
55
+ }
56
+
57
+ var randomUUID = typeof crypto !== 'undefined' && crypto.randomUUID && crypto.randomUUID.bind(crypto);
58
+ const native = {
59
+ randomUUID
60
+ };
61
+
62
+ function v4(options, buf, offset) {
63
+ if (native.randomUUID && true && !options) {
64
+ return native.randomUUID();
65
+ }
66
+ options = options || {};
67
+ var rnds = options.random || (options.rng || rng)();
68
+
69
+ // Per 4.4, set bits for version and `clock_seq_hi_and_reserved`
70
+ rnds[6] = rnds[6] & 0x0f | 0x40;
71
+ rnds[8] = rnds[8] & 0x3f | 0x80;
72
+ return unsafeStringify(rnds);
73
+ }
74
+
75
+ const useKeyboardFocusables = (element, options = {
76
+ observeChange: true,
77
+ attributes: true,
78
+ characterData: true,
79
+ childList: true,
80
+ subtree: true
81
+ }) => {
82
+ const [focusables, setFocusables] = useState(null);
83
+ const observerRef = useRef();
84
+ useEffect(() => {
85
+ const target = element instanceof HTMLElement ? element : element?.current;
86
+ if (!target) return;
87
+ if (observerRef.current) return;
88
+ if (!options.observeChange && !focusables) {
89
+ setFocusables(tabbable(target));
90
+ return;
91
+ }
92
+ let timeoutId = null;
93
+ const debounceDelay = 100;
94
+ const mutationCallback = () => {
95
+ const targetArr = tabbable(target);
96
+ if (targetArr.length === 0) return;
97
+ if (timeoutId) {
98
+ clearTimeout(timeoutId);
99
+ }
100
+ timeoutId = setTimeout(() => {
101
+ setFocusables(targetArr);
102
+ }, debounceDelay);
103
+ };
104
+ const observer = new MutationObserver(mutationCallback);
105
+ observerRef.current = observer;
106
+ observer.observe(target, {
107
+ childList: true,
108
+ // Observe changes to child elements
109
+ subtree: true,
110
+ // Observe changes to descendants of the target
111
+ attributes: true,
112
+ // Observe changes to attributes
113
+ characterData: true
114
+ // Observe changes to text content
115
+ });
116
+ }, [element, options]);
117
+ useEffect(() => {
118
+ return () => {
119
+ if (!observerRef.current) return;
120
+ observerRef.current.disconnect();
121
+ };
122
+ }, []);
123
+ const updateFocusables = () => {
124
+ const target = element instanceof HTMLElement ? element : element?.current;
125
+ if (!target) return;
126
+ setFocusables(tabbable(target));
127
+ };
128
+ return { focusables, updateFocusables };
129
+ };
130
+
131
+ const dialog = "_dialog_1uzo4_3";
132
+ const container$1 = "_container_1uzo4_23";
133
+ const content$2 = "_content_1uzo4_36";
134
+ const header$1 = "_header_1uzo4_43";
135
+ const footer$1 = "_footer_1uzo4_63";
136
+ const large$1 = "_large_1uzo4_100";
137
+ const fullscreen = "_fullscreen_1uzo4_100";
138
+ const sticky$1 = "_sticky_1uzo4_119";
139
+ const styles$6 = {
140
+ dialog: dialog,
141
+ container: container$1,
142
+ content: content$2,
143
+ header: header$1,
144
+ "close-container": "_close-container_1uzo4_56",
145
+ footer: footer$1,
146
+ large: large$1,
147
+ fullscreen: fullscreen,
148
+ sticky: sticky$1,
149
+ "close-button": "_close-button_1uzo4_125"
150
+ };
151
+
152
+ const DialogCancelButton = forwardRef((props, ref) => {
153
+ const { onClick, ...rest } = props;
154
+ const { close } = useDialogContext();
155
+ const onClickHandler = (e) => {
156
+ onClick?.(e);
157
+ close();
158
+ };
159
+ return /* @__PURE__ */ jsx(
160
+ Button,
161
+ {
162
+ "aria-label": "Close dialog",
163
+ "data-anv": "dialog-cancel-button",
164
+ onClick: onClickHandler,
165
+ ref,
166
+ ...rest
167
+ }
168
+ );
169
+ });
170
+ DialogCancelButton.displayName = "DialogCancelButton";
171
+
172
+ const DialogHeader = forwardRef(
173
+ (props, ref) => {
174
+ const { children, className, ...rest } = props;
175
+ const headerClassNames = cx(className, styles$6["header"]);
176
+ return /* @__PURE__ */ jsxs(
177
+ "header",
178
+ {
179
+ className: headerClassNames,
180
+ "data-anv": "dialog-header",
181
+ ref,
182
+ ...rest,
183
+ children: [
184
+ /* @__PURE__ */ jsx(Text, { variant: "headline", el: "h1", children }),
185
+ /* @__PURE__ */ jsx("span", { className: styles$6["close-container"], children: /* @__PURE__ */ jsx(
186
+ DialogCancelButton,
187
+ {
188
+ className: styles$6["close-button"],
189
+ size: "small",
190
+ appearance: "ghost",
191
+ "aria-label": "Close dialog",
192
+ icon: SvgClose
193
+ }
194
+ ) })
195
+ ]
196
+ }
197
+ );
198
+ }
199
+ );
200
+ DialogHeader.displayName = "DialogHeader";
201
+
202
+ const DialogFooter = forwardRef(
203
+ (props, ref) => {
204
+ const { children, className, sticky = false, ...rest } = props;
205
+ const footerClassNames = cx(styles$6["footer"], className, {
206
+ [styles$6["sticky"]]: sticky
207
+ });
208
+ return /* @__PURE__ */ jsx(
209
+ "footer",
210
+ {
211
+ className: footerClassNames,
212
+ "data-anv": "dialog-footer",
213
+ ref,
214
+ ...rest,
215
+ children
216
+ }
217
+ );
218
+ }
219
+ );
220
+ DialogFooter.displayName = "DialogFooter";
221
+
222
+ const DialogContent = forwardRef(
223
+ (props, ref) => {
224
+ const { children, className, ...rest } = props;
225
+ const contentClassNames = cx(styles$6["content"], className);
226
+ return /* @__PURE__ */ jsx(
227
+ "div",
228
+ {
229
+ className: contentClassNames,
230
+ "data-anv": "dialog-content",
231
+ ref,
232
+ ...rest,
233
+ children
234
+ }
235
+ );
236
+ }
237
+ );
238
+ DialogContent.displayName = "DialogContent";
239
+
240
+ const ToastProviderContext = createContext({
241
+ toasts: [],
242
+ setToasts: () => [],
243
+ toastHeights: [],
244
+ setToastHeights: () => [],
245
+ getToastStackHeight: () => 0,
246
+ toastsBeforeStack: 3,
247
+ setToastsBeforeStack: () => [],
248
+ extraToastsVisible: false,
249
+ setExtraToastsVisible: () => [],
250
+ isDialogToaster: false
251
+ });
252
+ const ToastProvider = ({
253
+ children,
254
+ isDialogToaster: isDialogToasterProp = false
255
+ }) => {
256
+ const [toasts, setToasts] = useState([]);
257
+ const [toastHeights, setToastHeights] = useState([]);
258
+ const [toastsBeforeStack, setToastsBeforeStack] = useState(3);
259
+ const [extraToastsVisible, setExtraToastsVisible] = useState(false);
260
+ const [isDialogToaster, setIsDialogToaster] = useState(isDialogToasterProp);
261
+ const removeDuplicateToasts = (toasts2) => {
262
+ const toastIds = /* @__PURE__ */ new Set();
263
+ const uniqueToasts = toasts2.filter((toast) => {
264
+ if (toastIds.has(toast.id)) {
265
+ console.error(
266
+ `Encountered toast with duplicate id ${toast.id}. Each toast id needs to be unique.`
267
+ );
268
+ return false;
269
+ } else {
270
+ toastIds.add(toast.id);
271
+ return true;
272
+ }
273
+ });
274
+ return uniqueToasts;
275
+ };
276
+ useEffect(() => {
277
+ const uniqueToasts = removeDuplicateToasts(toasts);
278
+ if (toasts.length !== uniqueToasts.length) {
279
+ setToasts(uniqueToasts);
280
+ }
281
+ }, [toasts]);
282
+ useEffect(() => {
283
+ setIsDialogToaster(isDialogToasterProp);
284
+ }, [isDialogToasterProp]);
285
+ const getToastStackHeight = useCallback(
286
+ (index) => {
287
+ const toastHeightsOnly = toastHeights.filter((t, i) => {
288
+ return index !== void 0 ? i > index : true;
289
+ }).map((t) => t.height);
290
+ if (toastHeightsOnly.length > 0) {
291
+ if (extraToastsVisible) {
292
+ return toastHeightsOnly.reduce((totalHeight, currentHeight) => {
293
+ return totalHeight + currentHeight;
294
+ });
295
+ }
296
+ return toastHeightsOnly.filter((t, i) => i >= toastHeightsOnly.length - toastsBeforeStack).reduce((totalHeight, currentHeight) => {
297
+ return totalHeight + currentHeight;
298
+ });
299
+ }
300
+ return 0;
301
+ },
302
+ [toastHeights, extraToastsVisible, toastsBeforeStack]
303
+ );
304
+ const value = useMemo(
305
+ () => ({
306
+ toasts,
307
+ setToasts,
308
+ toastHeights,
309
+ setToastHeights,
310
+ getToastStackHeight,
311
+ toastsBeforeStack,
312
+ setToastsBeforeStack,
313
+ extraToastsVisible,
314
+ setExtraToastsVisible,
315
+ isDialogToaster
316
+ }),
317
+ [
318
+ extraToastsVisible,
319
+ getToastStackHeight,
320
+ toastHeights,
321
+ toasts,
322
+ toastsBeforeStack,
323
+ isDialogToaster
324
+ ]
325
+ );
326
+ return /* @__PURE__ */ jsx(ToastProviderContext.Provider, { value, children });
327
+ };
328
+ const useToasts = () => {
329
+ const context = useContext(ToastProviderContext);
330
+ if (context == null) {
331
+ throw new Error("useToasts must be wrapped in <ToastProvider />");
332
+ }
333
+ return context;
334
+ };
335
+
336
+ const popover = "_popover_lombm_3";
337
+ const toaster = "_toaster_lombm_10";
338
+ const hidden = "_hidden_lombm_25";
339
+ const stacked = "_stacked_lombm_89";
340
+ const open = "_open_lombm_184";
341
+ const close = "_close_lombm_185";
342
+ const styles$5 = {
343
+ popover: popover,
344
+ toaster: toaster,
345
+ hidden: hidden,
346
+ "toast-stack": "_toast-stack_lombm_28",
347
+ "toast-wrapper": "_toast-wrapper_lombm_45",
348
+ "toast-alert": "_toast-alert_lombm_59",
349
+ "alert-action": "_alert-action_lombm_64",
350
+ "message-container": "_message-container_lombm_70",
351
+ "show-extra-toast": "_show-extra-toast_lombm_79",
352
+ stacked: stacked,
353
+ "stack-one": "_stack-one_lombm_92",
354
+ "stack-two": "_stack-two_lombm_92",
355
+ "stacked-show-extra": "_stacked-show-extra_lombm_108",
356
+ "stacked-extra": "_stacked-extra_lombm_122",
357
+ "show-more-button-container": "_show-more-button-container_lombm_135",
358
+ "show-collapse-button-container": "_show-collapse-button-container_lombm_136",
359
+ "show-collapse-button": "_show-collapse-button_lombm_136",
360
+ "disable-animations": "_disable-animations_lombm_160",
361
+ open: open,
362
+ close: close};
363
+
364
+ const ANIMATION_DURATION = 300;
365
+ const useShowMoreButtonPositionStyles = () => {
366
+ const { toastHeights, toastsBeforeStack } = useToasts();
367
+ const totalToasts = toastHeights.length;
368
+ const extraSpace = totalToasts > toastsBeforeStack + 1 ? "2rem" : "1rem";
369
+ const top = useMemo(() => {
370
+ if (totalToasts > toastsBeforeStack) {
371
+ return toastHeights.filter((t, i) => i >= totalToasts - toastsBeforeStack).map((t) => t.height).reduce((t, c) => t + c);
372
+ }
373
+ return "unset";
374
+ }, [toastHeights, toastsBeforeStack]);
375
+ return {
376
+ // -0.75px fixes hover issue when 1rem != 16px due to pixel rounding
377
+ top: `calc(${top}px + ${extraSpace} - 0.75px)`,
378
+ position: "absolute",
379
+ display: totalToasts > toastsBeforeStack ? void 0 : "none"
380
+ };
381
+ };
382
+ const STACKED_TOAST_HEIGHT = "5.3125rem";
383
+ const STACKED_TOAST_PEEK_HEIGHT = "1rem";
384
+ const TOAST_GAP = `${24 / 16}rem`;
385
+ const useToastPositionStyles = (index) => {
386
+ const {
387
+ toasts,
388
+ toastHeights,
389
+ getToastStackHeight,
390
+ toastsBeforeStack,
391
+ extraToastsVisible
392
+ } = useToasts();
393
+ const toastCount = toasts.length;
394
+ const toasterHeight = getToastStackHeight(index);
395
+ return useMemo(() => {
396
+ if (index === toastCount - 1) {
397
+ return {
398
+ top: TOAST_GAP,
399
+ zIndex: 3
400
+ };
401
+ } else if (
402
+ // all toasts when show more is clicked
403
+ extraToastsVisible || // or visible toasts when stacked
404
+ !extraToastsVisible && (toastCount <= toastsBeforeStack || toastCount > toastsBeforeStack && index >= toastCount - toastsBeforeStack)
405
+ ) {
406
+ return {
407
+ top: `calc(${toasterHeight}px + ${TOAST_GAP})`
408
+ };
409
+ } else {
410
+ if (toastCount > toastsBeforeStack) {
411
+ if (index === toastCount - toastsBeforeStack - 1) {
412
+ return {
413
+ top: `calc(${toasterHeight || 0}px - ${STACKED_TOAST_HEIGHT} +
414
+ ${STACKED_TOAST_PEEK_HEIGHT})`,
415
+ zIndex: 1
416
+ };
417
+ } else if (index <= toastCount - toastsBeforeStack - 2) {
418
+ return {
419
+ top: `calc(${toasterHeight || 0}px -
420
+ ${STACKED_TOAST_HEIGHT}
421
+ + ${STACKED_TOAST_PEEK_HEIGHT} * 2)`,
422
+ zIndex: 0
423
+ };
424
+ }
425
+ }
426
+ }
427
+ return void 0;
428
+ }, [toastHeights]);
429
+ };
430
+ const addOrUpdateToastHeight = (toastId, toastHeight, setToastHeights) => {
431
+ setToastHeights((prev) => {
432
+ if (prev.find((t) => t.id === toastId)) {
433
+ return prev.map((t) => {
434
+ if (t.id === toastId) {
435
+ return { ...t, height: toastHeight };
436
+ }
437
+ return t;
438
+ });
439
+ }
440
+ return [
441
+ ...prev,
442
+ {
443
+ id: toastId,
444
+ height: toastHeight
445
+ }
446
+ ];
447
+ });
448
+ };
449
+ const setToastsAfterClose = (setToasts, setToastHeights, id) => {
450
+ setToasts((prev) => id ? prev.filter((t) => t.id !== id) : []);
451
+ setToastHeights((prev) => id ? prev.filter((t) => t.id !== id) : []);
452
+ };
453
+ const closeToast = (setToasts, setToastHeights, closingToastClassName, id) => {
454
+ const prefersReducedMotion = globalThis.matchMedia(
455
+ `(prefers-reduced-motion: reduce)`
456
+ ).matches;
457
+ if (prefersReducedMotion) {
458
+ setToastsAfterClose(setToasts, setToastHeights, id);
459
+ } else {
460
+ setToasts(
461
+ (prev) => prev.map((t) => {
462
+ if (!id || t.id === id) {
463
+ return {
464
+ ...t,
465
+ toastClassName: closingToastClassName
466
+ };
467
+ }
468
+ return t;
469
+ })
470
+ );
471
+ setTimeout(() => {
472
+ setToastsAfterClose(setToasts, setToastHeights, id);
473
+ }, ANIMATION_DURATION - 10);
474
+ }
475
+ };
476
+ const useCloseToast = (closingToastClassName) => {
477
+ const { setToasts, setToastHeights } = useToasts();
478
+ return (id) => {
479
+ closeToast(setToasts, setToastHeights, closingToastClassName, id);
480
+ };
481
+ };
482
+
483
+ const toast = () => {
484
+ const toastMethods = [
485
+ "info",
486
+ "success",
487
+ "warning",
488
+ "danger",
489
+ "promise",
490
+ "update",
491
+ "dismiss"
492
+ ];
493
+ console.error(
494
+ "Please use one of the following toast methods:\n",
495
+ ...toastMethods.map((m) => ` toast.${m}()
496
+ `)
497
+ );
498
+ };
499
+ const TOAST_EVENT_NAME = "hammer-toast";
500
+ const TOAST_TYPES = ["info", "success", "warning", "danger"];
501
+ const methods = {};
502
+ TOAST_TYPES.forEach((type) => {
503
+ methods[type] = (props) => {
504
+ const uniqueId = v4();
505
+ const ToastAddEvent = new CustomEvent(TOAST_EVENT_NAME, {
506
+ composed: true,
507
+ detail: {
508
+ id: uniqueId,
509
+ eventType: "add",
510
+ status: type,
511
+ createdAt: Date.now(),
512
+ ...props
513
+ }
514
+ });
515
+ dispatchEvent(ToastAddEvent);
516
+ return uniqueId;
517
+ };
518
+ });
519
+ const update = (id, props) => {
520
+ const ToastEvent = new CustomEvent(
521
+ TOAST_EVENT_NAME,
522
+ {
523
+ composed: true,
524
+ detail: {
525
+ eventType: "update",
526
+ id,
527
+ ...props
528
+ }
529
+ }
530
+ );
531
+ dispatchEvent(ToastEvent);
532
+ };
533
+ const dismiss = (id) => {
534
+ const ToastEvent = new CustomEvent(
535
+ TOAST_EVENT_NAME,
536
+ {
537
+ composed: true,
538
+ detail: {
539
+ eventType: "dismiss",
540
+ id
541
+ }
542
+ }
543
+ );
544
+ dispatchEvent(ToastEvent);
545
+ };
546
+ const promise = async (promise2, toastConfig) => {
547
+ const { onClose, ...loadingToastConfig } = toastConfig.loading;
548
+ let closedWhileLoading = false;
549
+ const onCloseWhileLoading = (e) => {
550
+ toastConfig.loading.onClose?.(e);
551
+ closedWhileLoading = true;
552
+ };
553
+ const id = toast.info({
554
+ ...loadingToastConfig,
555
+ onClose: onCloseWhileLoading,
556
+ duration: false
557
+ });
558
+ await Promise.resolve(promise2).then((res) => {
559
+ if (closedWhileLoading) {
560
+ toast.success({
561
+ ...toastConfig.success(res)
562
+ });
563
+ } else {
564
+ toast.update(id, {
565
+ ...toastConfig.success(res),
566
+ status: "success"
567
+ });
568
+ }
569
+ }).catch((err) => {
570
+ if (closedWhileLoading) {
571
+ toast.danger({
572
+ ...toastConfig.error(err)
573
+ });
574
+ } else {
575
+ toast.update(id, {
576
+ ...toastConfig.error(err),
577
+ status: "danger"
578
+ });
579
+ }
580
+ });
581
+ return id;
582
+ };
583
+ toast.info = methods.info;
584
+ toast.success = methods.success;
585
+ toast.warning = methods.warning;
586
+ toast.danger = methods.danger;
587
+ toast.update = update;
588
+ toast.dismiss = dismiss;
589
+ toast.promise = promise;
590
+
591
+ const Toast = forwardRef(
592
+ ({
593
+ actions,
594
+ containerClassName,
595
+ createdAt,
596
+ duration: durationProp,
597
+ index = 0,
598
+ isBelowStackIndex,
599
+ isStacked,
600
+ message,
601
+ onClose,
602
+ onDismiss,
603
+ pausedStatus,
604
+ progress,
605
+ toastClassName,
606
+ ...alertProps
607
+ }, ref) => {
608
+ const { setToastHeights, extraToastsVisible, isDialogToaster } = useToasts();
609
+ const closeToast = useCloseToast(styles$5.close);
610
+ const toastPositionStyles = useToastPositionStyles(index);
611
+ const toastWrapperRef = useRef(null);
612
+ const timerRef = useRef();
613
+ const pausedAtRef = useRef(0);
614
+ const createdAtRef = useRef(createdAt ?? 0);
615
+ const hasBeenStackedRef = useRef(false);
616
+ const [transitionClass, setTransitionClass] = useState(
617
+ styles$5.hidden
618
+ );
619
+ const [toastOpened, setToastOpened] = useState(false);
620
+ const duration = actions ? false : durationProp;
621
+ const alertClasses = cx(
622
+ styles$5["toast-alert"],
623
+ toastClassName,
624
+ transitionClass
625
+ );
626
+ useEffect(() => {
627
+ if (!toastOpened) {
628
+ setTransitionClass(styles$5.open);
629
+ setTimeout(() => {
630
+ setTransitionClass(void 0);
631
+ }, ANIMATION_DURATION);
632
+ setToastOpened(true);
633
+ }
634
+ return () => {
635
+ onDismiss?.();
636
+ };
637
+ }, []);
638
+ useEffect(() => {
639
+ if (toastWrapperRef.current && toastOpened && !isStacked) {
640
+ if (isBelowStackIndex && extraToastsVisible || isDialogToaster) {
641
+ const delay = isDialogToaster ? 0 : ANIMATION_DURATION;
642
+ setTimeout(() => {
643
+ const height = toastWrapperRef.current?.clientHeight;
644
+ addOrUpdateToastHeight(alertProps.id, height ?? 0, setToastHeights);
645
+ }, delay);
646
+ } else {
647
+ const height = toastWrapperRef.current.clientHeight;
648
+ addOrUpdateToastHeight(alertProps.id, height, setToastHeights);
649
+ }
650
+ }
651
+ }, [
652
+ toastOpened,
653
+ isStacked,
654
+ extraToastsVisible,
655
+ isDialogToaster,
656
+ // toast updates
657
+ actions,
658
+ message,
659
+ alertProps.title
660
+ ]);
661
+ useEffect(() => {
662
+ if (duration && !isStacked) {
663
+ if (!pausedStatus) {
664
+ timerRef.current = setTimeout(
665
+ () => closeToast(alertProps.id),
666
+ duration
667
+ );
668
+ return () => clearTimeout(timerRef.current);
669
+ } else if (typeof pausedStatus === "number") {
670
+ clearTimeout(timerRef.current);
671
+ pausedAtRef.current = pausedStatus;
672
+ } else if (pausedStatus === "resumed") {
673
+ const remainingDuration = (
674
+ // rendering new toast after initial hover
675
+ pausedAtRef.current === 0 ? duration : (
676
+ // resume timer after valid hover
677
+ duration + (createdAtRef.current || 0) - pausedAtRef.current
678
+ )
679
+ );
680
+ timerRef.current = setTimeout(() => {
681
+ closeToast(alertProps.id);
682
+ pausedAtRef.current = 0;
683
+ }, remainingDuration);
684
+ return () => clearTimeout(timerRef.current);
685
+ }
686
+ }
687
+ }, [createdAtRef.current, duration, pausedStatus]);
688
+ useEffect(() => {
689
+ if (duration) {
690
+ if (isStacked) {
691
+ clearTimeout(timerRef.current);
692
+ hasBeenStackedRef.current = true;
693
+ } else if (!isStacked && hasBeenStackedRef.current && !(typeof pausedStatus === "number")) {
694
+ createdAtRef.current = Date.now();
695
+ timerRef.current = setTimeout(() => {
696
+ closeToast(alertProps.id);
697
+ hasBeenStackedRef.current = false;
698
+ }, duration);
699
+ return () => clearTimeout(timerRef.current);
700
+ }
701
+ }
702
+ }, [isStacked, duration]);
703
+ const onSwipe = (dir) => {
704
+ if (dir === "right") {
705
+ toast.dismiss(alertProps.id);
706
+ return;
707
+ }
708
+ };
709
+ const { direction, ...touchProps } = useSwipe(onSwipe);
710
+ const alertCloseProps = isStacked && !extraToastsVisible ? {} : {
711
+ onClose
712
+ };
713
+ const hasMessage = message && message !== "";
714
+ const hasProgress = progress != null;
715
+ return /* @__PURE__ */ jsx(
716
+ "div",
717
+ {
718
+ "data-anv": "toast",
719
+ className: containerClassName,
720
+ style: toastPositionStyles ?? { top: "1.5rem" },
721
+ ref: toastWrapperRef,
722
+ onAnimationStart: () => setToastOpened(true),
723
+ role: isStacked ? "presentation" : void 0,
724
+ ...touchProps,
725
+ children: /* @__PURE__ */ jsx(
726
+ Alert,
727
+ {
728
+ className: alertClasses,
729
+ ...alertProps,
730
+ ...alertCloseProps,
731
+ ref,
732
+ tabIndex: isStacked && !extraToastsVisible ? -1 : 0,
733
+ children: hasMessage || hasProgress || actions ? /* @__PURE__ */ jsxs(Fragment, { children: [
734
+ hasMessage ? /* @__PURE__ */ jsx(
735
+ "div",
736
+ {
737
+ className: styles$5["message-container"],
738
+ id: `toast-message-${alertProps.id}`,
739
+ children: message
740
+ }
741
+ ) : null,
742
+ hasProgress ? /* @__PURE__ */ jsx(Fragment, { children: progress === "indeterminate" ? /* @__PURE__ */ jsx(
743
+ ProgressBar,
744
+ {
745
+ "aria-labelledby": `toast-message-${alertProps.id}`,
746
+ indeterminate: true
747
+ }
748
+ ) : /* @__PURE__ */ jsx(
749
+ ProgressBar,
750
+ {
751
+ "aria-labelledby": `toast-message-${alertProps.id}`,
752
+ value: progress
753
+ }
754
+ ) }) : null,
755
+ actions ? /* @__PURE__ */ jsxs("div", { className: styles$5["alert-action"], children: [
756
+ /* @__PURE__ */ jsx(
757
+ Button,
758
+ {
759
+ appearance: actions.primary.appearance,
760
+ onClick: actions.primary.onClick,
761
+ size: "small",
762
+ children: actions.primary.label
763
+ }
764
+ ),
765
+ actions.secondary && /* @__PURE__ */ jsx(
766
+ Button,
767
+ {
768
+ appearance: actions.secondary.appearance,
769
+ onClick: actions.secondary.onClick,
770
+ size: "small",
771
+ children: actions.secondary.label
772
+ }
773
+ )
774
+ ] }) : null
775
+ ] }) : null
776
+ }
777
+ )
778
+ }
779
+ );
780
+ }
781
+ );
782
+ Toast.displayName = "Toast";
783
+
784
+ function useHotkeyFocus({
785
+ disabled,
786
+ hotkey,
787
+ onHotkeyIn,
788
+ onHotkeyOut,
789
+ refToFocus,
790
+ rootRef
791
+ }) {
792
+ const [shouldEscapeRefocus, setShouldEscapeRefocus] = useState(false);
793
+ const previousFocusElement = useRef(null);
794
+ useEffect(() => {
795
+ if (disabled || typeof document === "undefined") return;
796
+ const rootElement = rootRef.current;
797
+ const blurHandler = (e) => {
798
+ if (e.relatedTarget && rootElement.contains(e.relatedTarget)) {
799
+ return;
800
+ }
801
+ setShouldEscapeRefocus(false);
802
+ };
803
+ const keyDownHandler = async (e) => {
804
+ const activeElement = document.activeElement?.shadowRoot?.activeElement || document.activeElement;
805
+ if (activeElement?.tagName.toLowerCase() !== "input" && activeElement?.tagName.toLowerCase() !== "textarea" && activeElement?.tagName.toLowerCase() !== "pre" && e.key === hotkey) {
806
+ e.preventDefault();
807
+ previousFocusElement.current = activeElement;
808
+ await onHotkeyIn?.();
809
+ if (refToFocus.current) {
810
+ refToFocus.current.focus();
811
+ setShouldEscapeRefocus(true);
812
+ if (refToFocus.current.scrollTo) {
813
+ refToFocus.current.scrollTo();
814
+ }
815
+ }
816
+ } else if (e.code === "Escape" && shouldEscapeRefocus) {
817
+ onHotkeyOut?.();
818
+ if (previousFocusElement.current && previousFocusElement.current.tagName.toLowerCase() !== "body") {
819
+ previousFocusElement.current.focus();
820
+ } else {
821
+ activeElement.blur();
822
+ }
823
+ }
824
+ };
825
+ document.addEventListener("keydown", keyDownHandler);
826
+ rootElement.addEventListener("focusout", blurHandler);
827
+ return () => {
828
+ document.removeEventListener("keydown", keyDownHandler);
829
+ rootElement.removeEventListener("focusout", blurHandler);
830
+ };
831
+ }, [
832
+ hotkey,
833
+ disabled,
834
+ rootRef,
835
+ shouldEscapeRefocus,
836
+ onHotkeyIn,
837
+ refToFocus,
838
+ onHotkeyOut
839
+ ]);
840
+ return { returnFocusRef: previousFocusElement };
841
+ }
842
+
843
+ const ToastStack = forwardRef(
844
+ ({
845
+ className,
846
+ duration = false,
847
+ focusKey = "t",
848
+ toasts,
849
+ toastsBeforeStack = 3,
850
+ ...props
851
+ }, ref) => {
852
+ const toastStackRef = useRef(null);
853
+ const firstToastRef = useRef(null);
854
+ const mergedToastStackRef = useMergeRefs([toastStackRef, ref]);
855
+ const {
856
+ setToastsBeforeStack,
857
+ extraToastsVisible,
858
+ setExtraToastsVisible,
859
+ getToastStackHeight,
860
+ isDialogToaster
861
+ } = useToasts();
862
+ const toastCount = toasts.length;
863
+ const isToastStackEmpty = toastCount === 0;
864
+ const lastToastCount = useRef(0);
865
+ const [toastStackHeight, setToastStackHeight] = useState(0);
866
+ const [disableAnimations, setDisableAnimations] = useState(false);
867
+ const [toastPausedStatus, setToastPausedStatus] = useState(void 0);
868
+ useEffect(() => {
869
+ const scrollListener = (e) => {
870
+ e.preventDefault();
871
+ e.stopPropagation();
872
+ toastStackRef.current?.scrollTo({
873
+ top: toastStackRef.current.scrollTop + e.deltaY
874
+ });
875
+ };
876
+ if (isDialogToaster) {
877
+ setDisableAnimations(isDialogToaster);
878
+ setTimeout(() => {
879
+ setDisableAnimations(false);
880
+ }, 500);
881
+ const toastStackRefCurrent = toastStackRef.current;
882
+ toastStackRefCurrent?.addEventListener("wheel", scrollListener, {
883
+ passive: false
884
+ });
885
+ return () => {
886
+ toastStackRefCurrent?.removeEventListener("wheel", scrollListener);
887
+ };
888
+ }
889
+ }, [isDialogToaster]);
890
+ useEffect(() => {
891
+ let timer;
892
+ if (toastCount > lastToastCount.current || isDialogToaster) {
893
+ setToastStackHeight(getToastStackHeight());
894
+ } else {
895
+ timer = setTimeout(
896
+ () => setToastStackHeight(getToastStackHeight()),
897
+ ANIMATION_DURATION - 10
898
+ );
899
+ }
900
+ lastToastCount.current = toastCount;
901
+ return () => {
902
+ clearTimeout(timer);
903
+ };
904
+ }, [getToastStackHeight, isDialogToaster]);
905
+ useEffect(() => {
906
+ setToastsBeforeStack(toastsBeforeStack);
907
+ }, [setToastsBeforeStack, toastsBeforeStack]);
908
+ const handleToastStackBlur = useCallback(() => {
909
+ setExtraToastsVisible(false);
910
+ setToastPausedStatus("resumed");
911
+ if (toastStackRef.current?.scrollTo) {
912
+ toastStackRef.current?.scrollTo(0, 0);
913
+ }
914
+ }, [setExtraToastsVisible]);
915
+ const { returnFocusRef } = useHotkeyFocus({
916
+ disabled: isToastStackEmpty,
917
+ hotkey: focusKey,
918
+ onHotkeyIn: async () => {
919
+ setExtraToastsVisible(true);
920
+ return new Promise((resolve) => {
921
+ setTimeout(() => {
922
+ resolve();
923
+ }, 100);
924
+ });
925
+ },
926
+ onHotkeyOut: () => {
927
+ setExtraToastsVisible(false);
928
+ handleToastStackBlur();
929
+ },
930
+ refToFocus: firstToastRef,
931
+ rootRef: toastStackRef
932
+ });
933
+ const showMoreButtonPositionStyles = useShowMoreButtonPositionStyles();
934
+ const showMoreButton = !extraToastsVisible && toastCount > toastsBeforeStack;
935
+ const extraToastsLength = toastCount - toastsBeforeStack;
936
+ const showMoreButtonText = `${extraToastsLength} more message${extraToastsLength > 1 ? "s" : ""}`;
937
+ const toastStackClasses = cx(styles$5["toast-stack"], className, {
938
+ [styles$5["show-more-button"]]: showMoreButton,
939
+ [styles$5["show-extra-toast"]]: extraToastsVisible,
940
+ [styles$5["disable-animations"]]: disableAnimations
941
+ });
942
+ const handleToastStackFocusHover = () => {
943
+ if (toastPausedStatus === "resumed" || toastPausedStatus === void 0) {
944
+ setToastPausedStatus(Date.now());
945
+ }
946
+ };
947
+ const handleToastStackOnBlur = () => {
948
+ if (!toastStackRef.current?.matches(":focus-within")) {
949
+ handleToastStackBlur();
950
+ }
951
+ };
952
+ const handleShowMoreButtonClick = () => {
953
+ setExtraToastsVisible(true);
954
+ };
955
+ const toastStackHeightStyle = extraToastsVisible ? "calc(100vh - var(--toast-stack-padding) * 2)" : toastCount > 0 ? `calc(${toastStackHeight}px + 2rem + var(--toast-stack-padding))` : 0;
956
+ return /* @__PURE__ */ jsxs(Fragment, { children: [
957
+ /* @__PURE__ */ jsxs(
958
+ "div",
959
+ {
960
+ "data-anv": "ToastStack",
961
+ className: toastStackClasses,
962
+ ref: mergedToastStackRef,
963
+ onMouseOver: handleToastStackFocusHover,
964
+ onMouseLeave: handleToastStackBlur,
965
+ onFocus: handleToastStackFocusHover,
966
+ onBlur: handleToastStackOnBlur,
967
+ style: {
968
+ height: toastStackHeightStyle
969
+ },
970
+ ...props,
971
+ children: [
972
+ toasts.map(({ toastClassName, onClose, ...toastProps }, index) => {
973
+ const isStacked = !extraToastsVisible && index < toastCount - toastsBeforeStack;
974
+ const isLastToastDisplayed = index === toastCount - toastsBeforeStack;
975
+ const isHidden = index < toastCount - toastsBeforeStack - 2;
976
+ const toastClasses = cx(styles$5.toast, toastClassName);
977
+ const toastContainerClasses = cx(styles$5["toast-wrapper"], {
978
+ [styles$5.stacked]: isStacked || isLastToastDisplayed,
979
+ [styles$5["stack-one"]]: isStacked && index === toastCount - toastsBeforeStack - 1,
980
+ [styles$5["stack-two"]]: isStacked && index === toastCount - toastsBeforeStack - 2,
981
+ [styles$5["stacked-extra"]]: isHidden,
982
+ [styles$5["stacked-show-extra"]]: extraToastsVisible
983
+ });
984
+ const handleOnClose = (e) => {
985
+ onClose?.(e);
986
+ returnFocusRef.current?.focus();
987
+ toast.dismiss(toastProps.id);
988
+ };
989
+ return /* @__PURE__ */ jsx(
990
+ Toast,
991
+ {
992
+ containerClassName: toastContainerClasses,
993
+ duration,
994
+ index,
995
+ isStacked,
996
+ isBelowStackIndex: index < toastCount - toastsBeforeStack,
997
+ onClose: handleOnClose,
998
+ pausedStatus: toastPausedStatus,
999
+ toastClassName: toastClasses,
1000
+ ref: index === 0 ? firstToastRef : void 0,
1001
+ ...toastProps
1002
+ },
1003
+ toastProps.id
1004
+ );
1005
+ }),
1006
+ showMoreButton && /* @__PURE__ */ jsx(
1007
+ "div",
1008
+ {
1009
+ className: styles$5["show-more-button-container"],
1010
+ style: showMoreButtonPositionStyles,
1011
+ children: /* @__PURE__ */ jsx(
1012
+ Button,
1013
+ {
1014
+ className: styles$5["show-collapse-button"],
1015
+ onClick: handleShowMoreButtonClick,
1016
+ appearance: "secondary",
1017
+ tabIndex: 0,
1018
+ children: showMoreButtonText
1019
+ }
1020
+ )
1021
+ }
1022
+ ),
1023
+ /* @__PURE__ */ jsxs(SrOnly, { "aria-live": "polite", children: [
1024
+ "New toast message appeared. Press the ",
1025
+ focusKey,
1026
+ " key to focus on the toast messages. Press escape to return focus to previous position."
1027
+ ] })
1028
+ ]
1029
+ }
1030
+ ),
1031
+ extraToastsVisible && /* @__PURE__ */ jsx("div", { className: styles$5["show-collapse-button-container"], children: /* @__PURE__ */ jsx(
1032
+ Button,
1033
+ {
1034
+ className: styles$5["show-collapse-button"],
1035
+ onClick: handleToastStackBlur,
1036
+ appearance: "secondary",
1037
+ children: "Collapse Messages"
1038
+ }
1039
+ ) })
1040
+ ] });
1041
+ }
1042
+ );
1043
+ ToastStack.displayName = "ToastStack";
1044
+
1045
+ const ToasterPopover = forwardRef(
1046
+ (props, ref) => {
1047
+ const { isDialogToaster } = useToasts();
1048
+ const popoverRef = useRef(null);
1049
+ const combinedRef = useMergeRefs([popoverRef, ref]);
1050
+ const { toasts } = useToasts();
1051
+ const toastCount = useMemo(() => toasts.length, [toasts]);
1052
+ useEffect(() => {
1053
+ if (!popoverRef.current) return;
1054
+ const currentPopover = popoverRef.current;
1055
+ let timeout;
1056
+ if (toastCount > 0) {
1057
+ if (isDialogToaster) {
1058
+ timeout = setTimeout(() => {
1059
+ currentPopover?.hidePopover();
1060
+ currentPopover?.showPopover();
1061
+ });
1062
+ } else {
1063
+ currentPopover.showPopover();
1064
+ }
1065
+ } else {
1066
+ currentPopover.hidePopover();
1067
+ }
1068
+ return () => {
1069
+ if (timeout) clearTimeout(timeout);
1070
+ if (toastCount === 0) {
1071
+ currentPopover.hidePopover();
1072
+ }
1073
+ };
1074
+ }, [toastCount, isDialogToaster]);
1075
+ return /* @__PURE__ */ jsx("div", { ref: combinedRef, className: styles$5.popover, popover: "manual", children: props.children });
1076
+ }
1077
+ );
1078
+ ToasterPopover.displayName = "ToasterPopover";
1079
+
1080
+ const ToasterContent = forwardRef(
1081
+ ({
1082
+ className,
1083
+ disableEvents = false,
1084
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars -- pulling out of props
1085
+ forceRender = false,
1086
+ id,
1087
+ onToastEvent,
1088
+ // ToastStackProps
1089
+ duration,
1090
+ focusKey,
1091
+ toastsBeforeStack,
1092
+ ...props
1093
+ }, ref) => {
1094
+ const toasterRef = useRef(null);
1095
+ const mergedToasterRef = useMergeRefs([toasterRef, ref]);
1096
+ const { toasts, setToasts, isDialogToaster } = useToasts();
1097
+ const disableEventsRef = useRef(disableEvents);
1098
+ const toastCountRef = useRef(0);
1099
+ const isDialogToasterRef = useRef(isDialogToaster);
1100
+ const [shouldHideToaster, setShouldHideToaster] = useState(false);
1101
+ const updateDialogToasterStorage = useCallback(
1102
+ (isDialogToaster2) => {
1103
+ const dialogToasters = JSON.parse(
1104
+ window.sessionStorage.getItem("dialog-toasters") ?? "[]"
1105
+ );
1106
+ if (isDialogToaster2) {
1107
+ if (!dialogToasters.includes(id)) {
1108
+ window.sessionStorage.setItem(
1109
+ "dialog-toasters",
1110
+ JSON.stringify([...dialogToasters, id])
1111
+ );
1112
+ }
1113
+ } else if (dialogToasters.includes(id)) {
1114
+ window.sessionStorage.setItem(
1115
+ "dialog-toasters",
1116
+ JSON.stringify(
1117
+ dialogToasters.filter(
1118
+ (dialogToaster) => dialogToaster !== id
1119
+ )
1120
+ )
1121
+ );
1122
+ }
1123
+ },
1124
+ [id]
1125
+ );
1126
+ useEffect(() => {
1127
+ disableEventsRef.current = disableEvents;
1128
+ }, [disableEvents]);
1129
+ useEffect(() => {
1130
+ toastCountRef.current = toasts.length;
1131
+ }, [toasts.length]);
1132
+ useEffect(() => {
1133
+ updateDialogToasterStorage(isDialogToaster);
1134
+ isDialogToasterRef.current = isDialogToaster;
1135
+ const DialogToasterEvent = new CustomEvent("dialog-toaster", {
1136
+ composed: true,
1137
+ detail: {
1138
+ eventType: "dialog-toaster"
1139
+ }
1140
+ });
1141
+ dispatchEvent(DialogToasterEvent);
1142
+ }, [isDialogToaster]);
1143
+ const closeToast = useCloseToast(styles$5.close);
1144
+ useEffect(() => {
1145
+ let timeout;
1146
+ updateDialogToasterStorage(isDialogToaster);
1147
+ const toastEventListener = (e) => {
1148
+ if (disableEventsRef.current) {
1149
+ return;
1150
+ }
1151
+ const { eventType, ...toastProps } = e.detail;
1152
+ if (eventType === "add") {
1153
+ const toastAddProps = toastProps;
1154
+ if (!toastAddProps.toasterId || toastAddProps.toasterId === id) {
1155
+ setToasts((prev) => [...prev, toastProps]);
1156
+ }
1157
+ timeout = setTimeout(() => {
1158
+ onToastEvent?.({
1159
+ eventType: "add",
1160
+ toastCount: toastCountRef.current,
1161
+ id: toastAddProps.id,
1162
+ toasterId: id,
1163
+ toastProps: toastAddProps
1164
+ });
1165
+ });
1166
+ } else if (eventType === "update") {
1167
+ const toastUpdateProps = toastProps;
1168
+ setToasts((prev) => {
1169
+ return prev.map((t) => {
1170
+ if (t.id === toastUpdateProps.id) {
1171
+ return {
1172
+ ...t,
1173
+ ...toastUpdateProps
1174
+ };
1175
+ } else {
1176
+ return t;
1177
+ }
1178
+ });
1179
+ });
1180
+ onToastEvent?.({
1181
+ eventType: "update",
1182
+ toastCount: toastCountRef.current,
1183
+ id: toastUpdateProps.id,
1184
+ toasterId: id,
1185
+ toastProps: toastUpdateProps
1186
+ });
1187
+ } else if (eventType === "dismiss") {
1188
+ if (toastProps.id) {
1189
+ closeToast(toastProps.id);
1190
+ timeout = setTimeout(() => {
1191
+ onToastEvent?.({
1192
+ eventType: "dismiss",
1193
+ toastCount: toastCountRef.current,
1194
+ id: toastProps.id,
1195
+ toasterId: id
1196
+ });
1197
+ }, ANIMATION_DURATION);
1198
+ } else {
1199
+ closeToast();
1200
+ onToastEvent?.({
1201
+ eventType: "dismiss-all",
1202
+ toastCount: 0,
1203
+ toasterId: id
1204
+ });
1205
+ }
1206
+ }
1207
+ };
1208
+ const dialogToasterEventListener = (e) => {
1209
+ const { eventType } = e.detail;
1210
+ if (eventType === "dialog-toaster") {
1211
+ const dialogToasters = JSON.parse(
1212
+ window.sessionStorage.getItem("dialog-toasters") ?? "[]"
1213
+ );
1214
+ if (dialogToasters.length > 0) {
1215
+ if (isDialogToasterRef.current && dialogToasters[dialogToasters.length - 1] === id) {
1216
+ setShouldHideToaster(false);
1217
+ } else {
1218
+ setShouldHideToaster(true);
1219
+ }
1220
+ } else {
1221
+ setShouldHideToaster(false);
1222
+ }
1223
+ }
1224
+ };
1225
+ const onPageRefreshListener = () => {
1226
+ window.sessionStorage.removeItem("dialog-toasters");
1227
+ };
1228
+ window.addEventListener("hammer-toast", toastEventListener);
1229
+ window.addEventListener("dialog-toaster", dialogToasterEventListener);
1230
+ window.addEventListener("beforeunload", onPageRefreshListener);
1231
+ return () => {
1232
+ window.removeEventListener("hammer-toast", toastEventListener);
1233
+ window.removeEventListener(
1234
+ "dialog-toaster",
1235
+ dialogToasterEventListener
1236
+ );
1237
+ window.removeEventListener("beforeunload", onPageRefreshListener);
1238
+ clearTimeout(timeout);
1239
+ updateDialogToasterStorage(false);
1240
+ };
1241
+ }, []);
1242
+ const toasterClasses = cx(styles$5.toaster, {
1243
+ [styles$5["hidden"]]: shouldHideToaster,
1244
+ [`${className}`]: className != null
1245
+ });
1246
+ return /* @__PURE__ */ jsx(
1247
+ "div",
1248
+ {
1249
+ "data-anv": "toaster",
1250
+ "data-toaster-id": id,
1251
+ "aria-hidden": shouldHideToaster,
1252
+ className: toasterClasses,
1253
+ ref: mergedToasterRef,
1254
+ ...props,
1255
+ children: /* @__PURE__ */ jsx(
1256
+ ToastStack,
1257
+ {
1258
+ toasts,
1259
+ duration,
1260
+ focusKey,
1261
+ toastsBeforeStack
1262
+ }
1263
+ )
1264
+ }
1265
+ );
1266
+ }
1267
+ );
1268
+ const Toaster = forwardRef(
1269
+ (props, ref) => {
1270
+ return /* @__PURE__ */ jsx(ToastProvider, { children: /* @__PURE__ */ jsx(ToasterPopover, { children: /* @__PURE__ */ jsx(ToasterContent, { ...props, ref }) }) });
1271
+ }
1272
+ );
1273
+ Toaster.displayName = "Toaster";
1274
+ ToasterContent.displayName = "ToasterContent";
1275
+
1276
+ const DialogContext = createContext(null);
1277
+ const DialogElement = forwardRef(
1278
+ (props, ref) => {
1279
+ const {
1280
+ className,
1281
+ open = false,
1282
+ children,
1283
+ onOpen,
1284
+ onOpenChange,
1285
+ onClose,
1286
+ onCancel,
1287
+ onKeyDown,
1288
+ fullScreen = false,
1289
+ disableCloseOnEscape = false,
1290
+ disableCloseOnClickOutside = false,
1291
+ size,
1292
+ enableScrollChaining,
1293
+ ...rest
1294
+ } = props;
1295
+ const elRef = useRef(null);
1296
+ const contentRef = useRef(null);
1297
+ const [hasOpenPopover, setHasOpenPopover] = useState(false);
1298
+ const id = useId();
1299
+ const DialogClassNames = cx([styles$6["dialog"]], className, {
1300
+ [styles$6["fullscreen"]]: fullScreen,
1301
+ [styles$6["large"]]: size === "large"
1302
+ });
1303
+ const { focusables } = useKeyboardFocusables(contentRef, {
1304
+ observeChange: true
1305
+ });
1306
+ useEffect(() => {
1307
+ if (!open || enableScrollChaining) return;
1308
+ let blockDocumentScroll = false;
1309
+ const content = contentRef.current;
1310
+ const scrollHandler = (e) => {
1311
+ const target = e.target;
1312
+ const isShadow2 = contentRef.current?.getRootNode() instanceof ShadowRoot;
1313
+ const isOverflowing = elRef.current && elRef.current.scrollHeight > elRef.current.clientHeight;
1314
+ if (isShadow2) {
1315
+ if (blockDocumentScroll) {
1316
+ e.preventDefault();
1317
+ return;
1318
+ }
1319
+ return;
1320
+ }
1321
+ if (!isOverflowing || !content?.contains(target)) {
1322
+ e.preventDefault();
1323
+ return;
1324
+ }
1325
+ return;
1326
+ };
1327
+ const shadowScrollHandler = (e) => {
1328
+ const target = e.target;
1329
+ const isTargetInsideContent = content?.contains(target);
1330
+ const isOverflowing = elRef.current && elRef.current.scrollHeight > elRef.current.clientHeight;
1331
+ blockDocumentScroll = !isTargetInsideContent;
1332
+ if (!isOverflowing || !content?.contains(target)) {
1333
+ e.preventDefault();
1334
+ }
1335
+ return;
1336
+ };
1337
+ const isShadow = content?.getRootNode() instanceof ShadowRoot;
1338
+ document.addEventListener("wheel", scrollHandler, {
1339
+ passive: false
1340
+ });
1341
+ if (isShadow) {
1342
+ content?.getRootNode().addEventListener("wheel", shadowScrollHandler, {
1343
+ passive: false
1344
+ });
1345
+ }
1346
+ return () => {
1347
+ document.getRootNode().removeEventListener("wheel", scrollHandler);
1348
+ if (isShadow) {
1349
+ content?.getRootNode().removeEventListener("wheel", shadowScrollHandler);
1350
+ }
1351
+ };
1352
+ }, [enableScrollChaining, open]);
1353
+ useEffect(() => {
1354
+ if (typeof document === "undefined" || disableCloseOnClickOutside) return;
1355
+ const onClickOutsideHandler = (e) => {
1356
+ if (hasOpenPopover) return;
1357
+ if (e.composedPath()[0] === elRef.current) {
1358
+ onClose?.();
1359
+ }
1360
+ };
1361
+ document.addEventListener("mousedown", onClickOutsideHandler);
1362
+ return () => document.removeEventListener("mousedown", onClickOutsideHandler);
1363
+ }, [disableCloseOnClickOutside, onClose, onOpenChange, hasOpenPopover]);
1364
+ const initial = useRef(true);
1365
+ useEffect(() => {
1366
+ if (initial.current) {
1367
+ initial.current = false;
1368
+ } else {
1369
+ onOpenChange?.(open);
1370
+ }
1371
+ if (open) {
1372
+ onOpen?.();
1373
+ elRef.current?.showModal();
1374
+ return;
1375
+ }
1376
+ setTimeout(() => {
1377
+ elRef.current?.close();
1378
+ }, 1);
1379
+ }, [id, onOpen, onOpenChange, open]);
1380
+ useEffect(() => {
1381
+ if (!open) return;
1382
+ if (!focusables) return;
1383
+ const activeElement = document.activeElement;
1384
+ if (activeElement.dataset.anv !== "dialog-header-close-button" && focusables.includes(activeElement)) {
1385
+ return;
1386
+ }
1387
+ if (focusables[0]?.dataset.anv === "dialog-header-close-button" && focusables[1]) {
1388
+ focusables[1].focus();
1389
+ } else {
1390
+ focusables[0]?.focus();
1391
+ }
1392
+ }, [open, focusables]);
1393
+ const onKeyDownHandler = (e) => {
1394
+ onKeyDown?.(e);
1395
+ if (e.code === "Escape") {
1396
+ e.preventDefault();
1397
+ if (disableCloseOnEscape) return;
1398
+ if (hasOpenPopover) return;
1399
+ onClose?.();
1400
+ return;
1401
+ }
1402
+ if (e.code === "Tab") {
1403
+ if (e.shiftKey && e.target === focusables?.[0]) {
1404
+ e.preventDefault();
1405
+ focusables[focusables.length - 1]?.focus();
1406
+ return;
1407
+ }
1408
+ if (e.target === focusables?.[focusables.length - 1] && !e.shiftKey) {
1409
+ e.preventDefault();
1410
+ focusables[0].focus();
1411
+ return;
1412
+ }
1413
+ }
1414
+ };
1415
+ const close = useCallback(() => {
1416
+ onClose?.();
1417
+ }, [onClose]);
1418
+ return (
1419
+ // dialog element does seem to be interactive on MDN guideline
1420
+ // eslint-disable-next-line jsx-a11y/no-noninteractive-element-interactions
1421
+ /* @__PURE__ */ jsxs(
1422
+ "dialog",
1423
+ {
1424
+ className: DialogClassNames,
1425
+ "data-anv": "dialog",
1426
+ ref: useMergeRefs([ref, elRef]),
1427
+ onKeyDown: onKeyDownHandler,
1428
+ ...rest,
1429
+ children: [
1430
+ /* @__PURE__ */ jsx(ToastProvider, { isDialogToaster: open, children: /* @__PURE__ */ jsx(ToasterPopover, { children: /* @__PURE__ */ jsx(ToasterContent, { id: "dialog-toaster" }) }) }),
1431
+ /* @__PURE__ */ jsx(
1432
+ DialogContext.Provider,
1433
+ {
1434
+ value: { close, ref: elRef, hasOpenPopover, setHasOpenPopover },
1435
+ children: /* @__PURE__ */ jsx(
1436
+ "section",
1437
+ {
1438
+ ref: contentRef,
1439
+ className: styles$6["container"],
1440
+ "data-open": open,
1441
+ children
1442
+ }
1443
+ )
1444
+ }
1445
+ )
1446
+ ]
1447
+ }
1448
+ )
1449
+ );
1450
+ }
1451
+ );
1452
+ function useDialogContext() {
1453
+ const context = useContext(DialogContext);
1454
+ if (!context) {
1455
+ throw new Error(
1456
+ "useDialogContext must be used within a DialogContextProvider"
1457
+ );
1458
+ }
1459
+ return context;
1460
+ }
1461
+ DialogElement.displayName = "Dialog";
1462
+ const Dialog = Object.assign(DialogElement, {
1463
+ Header: DialogHeader,
1464
+ Footer: DialogFooter,
1465
+ Content: DialogContent,
1466
+ CancelButton: DialogCancelButton
1467
+ });
1468
+
1469
+ const drawer = "_drawer_pysn1_3";
1470
+ const container = "_container_pysn1_29";
1471
+ const content$1 = "_content_pysn1_42";
1472
+ const header = "_header_pysn1_49";
1473
+ const footer = "_footer_pysn1_73";
1474
+ const remove = "_remove_pysn1_91";
1475
+ const large = "_large_pysn1_100";
1476
+ const sticky = "_sticky_pysn1_103";
1477
+ const styles$4 = {
1478
+ drawer: drawer,
1479
+ container: container,
1480
+ content: content$1,
1481
+ header: header,
1482
+ "close-container": "_close-container_pysn1_66",
1483
+ footer: footer,
1484
+ remove: remove,
1485
+ large: large,
1486
+ sticky: sticky,
1487
+ "close-button": "_close-button_pysn1_109"
1488
+ };
1489
+
1490
+ const DrawerCancelButton = forwardRef((props, ref) => {
1491
+ const { onClick, ...rest } = props;
1492
+ const { close } = useDrawerContext();
1493
+ const onClickHandler = (e) => {
1494
+ onClick?.(e);
1495
+ close();
1496
+ };
1497
+ return /* @__PURE__ */ jsx(
1498
+ Button,
1499
+ {
1500
+ "aria-label": "Close drawer",
1501
+ "data-anv": "drawer-cancel-button",
1502
+ onClick: onClickHandler,
1503
+ ref,
1504
+ ...rest
1505
+ }
1506
+ );
1507
+ });
1508
+ DrawerCancelButton.displayName = "DrawerCancelButton";
1509
+
1510
+ const DrawerHeader = forwardRef(
1511
+ (props, ref) => {
1512
+ const { children } = props;
1513
+ return /* @__PURE__ */ jsxs("header", { className: styles$4.header, "data-anv": "drawer-header", ref, children: [
1514
+ /* @__PURE__ */ jsx(Text, { variant: "headline", el: "h1", children }),
1515
+ /* @__PURE__ */ jsx("span", { className: styles$4["close-container"], children: /* @__PURE__ */ jsx(
1516
+ DrawerCancelButton,
1517
+ {
1518
+ className: styles$4["close-button"],
1519
+ size: "small",
1520
+ appearance: "ghost",
1521
+ "aria-label": "Close drawer",
1522
+ "data-anv": "drawer-header-close-button",
1523
+ icon: SvgClose
1524
+ }
1525
+ ) })
1526
+ ] });
1527
+ }
1528
+ );
1529
+ DrawerHeader.displayName = "DrawerHeader";
1530
+
1531
+ const DrawerFooter = forwardRef(
1532
+ (props, ref) => {
1533
+ const { children, sticky = false, ...rest } = props;
1534
+ const DrawerFooterCX = cx(styles$4.footer, {
1535
+ [styles$4["sticky"]]: sticky
1536
+ });
1537
+ return /* @__PURE__ */ jsx(
1538
+ "footer",
1539
+ {
1540
+ className: DrawerFooterCX,
1541
+ "data-anv": "drawer-footer",
1542
+ ref,
1543
+ ...rest,
1544
+ children
1545
+ }
1546
+ );
1547
+ }
1548
+ );
1549
+ DrawerFooter.displayName = "DrawerFooter";
1550
+
1551
+ const DrawerContent = forwardRef(
1552
+ (props, ref) => {
1553
+ const { children, ...rest } = props;
1554
+ const DrawerContentCX = cx(styles$4.content, {});
1555
+ return /* @__PURE__ */ jsx(
1556
+ "div",
1557
+ {
1558
+ className: DrawerContentCX,
1559
+ "data-anv": "drawer-content",
1560
+ ref,
1561
+ ...rest,
1562
+ children
1563
+ }
1564
+ );
1565
+ }
1566
+ );
1567
+ DrawerContent.displayName = "DrawerContent";
1568
+
1569
+ const DrawerContext = createContext(null);
1570
+ const DrawerElement = forwardRef(
1571
+ (props, ref) => {
1572
+ const {
1573
+ className,
1574
+ open = false,
1575
+ children,
1576
+ onOpen,
1577
+ onClose,
1578
+ onCancel,
1579
+ onClick,
1580
+ onKeyDown,
1581
+ disableCloseOnEscape = false,
1582
+ disableCloseOnClickOutside = false,
1583
+ size = "medium",
1584
+ enableScrollChaining,
1585
+ ...rest
1586
+ } = props;
1587
+ const elRef = useRef(null);
1588
+ const contentRef = useRef(null);
1589
+ const toasterRef = useRef(null);
1590
+ const combinedRef = useMergeRefs([elRef, ref]);
1591
+ const [remove, setRemove] = useState(false);
1592
+ const DrawerClassNames = cx([styles$4.drawer], className, {
1593
+ [styles$4.remove]: remove,
1594
+ [styles$4.large]: size === "large"
1595
+ });
1596
+ const { focusables } = useKeyboardFocusables(contentRef, {
1597
+ observeChange: false
1598
+ });
1599
+ const firstFocusable = focusables?.[0];
1600
+ const lastFocusable = focusables?.[focusables.length - 1];
1601
+ useEffect(() => {
1602
+ if (open) {
1603
+ onOpen?.();
1604
+ elRef.current?.showModal();
1605
+ return;
1606
+ }
1607
+ setRemove(true);
1608
+ setTimeout(() => {
1609
+ elRef.current?.close();
1610
+ setRemove(false);
1611
+ }, 200);
1612
+ }, [onOpen, open]);
1613
+ useEffect(() => {
1614
+ if (!open) return;
1615
+ if (!focusables) return;
1616
+ const activeElement = document.activeElement;
1617
+ if (activeElement.dataset.anv !== "drawer-header-close-button" && focusables.includes(activeElement)) {
1618
+ return;
1619
+ }
1620
+ if (focusables[0]?.dataset.anv === "drawer-header-close-button" && focusables[1]) {
1621
+ focusables[1].focus();
1622
+ } else {
1623
+ focusables[0]?.focus();
1624
+ }
1625
+ }, [open, focusables]);
1626
+ useEffect(() => {
1627
+ if (!open || enableScrollChaining) return;
1628
+ let blockDocumentScroll = false;
1629
+ const content = contentRef.current;
1630
+ const scrollHandler = (e) => {
1631
+ const target = e.target;
1632
+ const isShadow2 = contentRef.current?.getRootNode() instanceof ShadowRoot;
1633
+ const isOverflowing = elRef.current && elRef.current.scrollHeight > elRef.current.clientHeight;
1634
+ if (isShadow2) {
1635
+ if (blockDocumentScroll) {
1636
+ e.preventDefault();
1637
+ return;
1638
+ }
1639
+ return;
1640
+ }
1641
+ if (!isOverflowing || !content?.contains(target)) {
1642
+ e.preventDefault();
1643
+ return;
1644
+ }
1645
+ return;
1646
+ };
1647
+ const shadowScrollHandler = (e) => {
1648
+ const target = e.target;
1649
+ const isTargetInsideContent = content?.contains(target);
1650
+ const isOverflowing = elRef.current && elRef.current.scrollHeight > elRef.current.clientHeight;
1651
+ blockDocumentScroll = !isTargetInsideContent;
1652
+ if (!isOverflowing || !content?.contains(target)) {
1653
+ e.preventDefault();
1654
+ }
1655
+ return;
1656
+ };
1657
+ const isShadow = content?.getRootNode() instanceof ShadowRoot;
1658
+ document.addEventListener("wheel", scrollHandler, {
1659
+ passive: false
1660
+ });
1661
+ if (isShadow) {
1662
+ content?.getRootNode().addEventListener("wheel", shadowScrollHandler, {
1663
+ passive: false
1664
+ });
1665
+ }
1666
+ return () => {
1667
+ document.getRootNode().removeEventListener("wheel", scrollHandler);
1668
+ if (isShadow) {
1669
+ content?.getRootNode().removeEventListener("wheel", shadowScrollHandler);
1670
+ }
1671
+ };
1672
+ }, [enableScrollChaining, open]);
1673
+ const onCancelHandler = (e) => {
1674
+ e.preventDefault();
1675
+ if (disableCloseOnEscape) return;
1676
+ onClose?.();
1677
+ };
1678
+ const onClickHandler = (e) => {
1679
+ onClick?.(e);
1680
+ const target = e.target;
1681
+ if (!contentRef.current?.contains(target) && !toasterRef.current?.contains(target)) {
1682
+ e.preventDefault();
1683
+ if (disableCloseOnClickOutside) return;
1684
+ onClose?.();
1685
+ }
1686
+ };
1687
+ const onKeyDownHandler = (e) => {
1688
+ onKeyDown?.(e);
1689
+ if (e.code === "Tab") {
1690
+ if (e.shiftKey && e.target === firstFocusable) {
1691
+ e.preventDefault();
1692
+ lastFocusable?.focus();
1693
+ return;
1694
+ }
1695
+ if (e.target === lastFocusable && !e.shiftKey) {
1696
+ e.preventDefault();
1697
+ firstFocusable?.focus();
1698
+ return;
1699
+ }
1700
+ }
1701
+ };
1702
+ const value = useMemo(() => {
1703
+ const close = () => {
1704
+ setRemove(true);
1705
+ setTimeout(() => {
1706
+ elRef.current?.close();
1707
+ onClose?.();
1708
+ }, 200);
1709
+ };
1710
+ return { close };
1711
+ }, [onClose]);
1712
+ return (
1713
+ // dialog element does seem to be interactive on MDN guideline
1714
+ // eslint-disable-next-line jsx-a11y/no-noninteractive-element-interactions
1715
+ /* @__PURE__ */ jsxs(
1716
+ "dialog",
1717
+ {
1718
+ className: DrawerClassNames,
1719
+ "data-anv": "drawer",
1720
+ ref: combinedRef,
1721
+ onCancel: onCancelHandler,
1722
+ onClick: onClickHandler,
1723
+ onKeyDown: onKeyDownHandler,
1724
+ ...rest,
1725
+ children: [
1726
+ /* @__PURE__ */ jsx(ToastProvider, { isDialogToaster: open, children: /* @__PURE__ */ jsx(ToasterPopover, { children: /* @__PURE__ */ jsx(ToasterContent, { id: "drawer-toaster", ref: toasterRef }) }) }),
1727
+ /* @__PURE__ */ jsx(DrawerContext.Provider, { value, children: /* @__PURE__ */ jsx(
1728
+ "section",
1729
+ {
1730
+ ref: contentRef,
1731
+ className: styles$4.container,
1732
+ "data-open": open,
1733
+ children
1734
+ }
1735
+ ) })
1736
+ ]
1737
+ }
1738
+ )
1739
+ );
1740
+ }
1741
+ );
1742
+ function useDrawerContext() {
1743
+ const context = useContext(DrawerContext);
1744
+ if (!context) {
1745
+ throw new Error(
1746
+ "useDrawerContext must be used within a DrawerContextProvider"
1747
+ );
1748
+ }
1749
+ return context;
1750
+ }
1751
+ DrawerElement.displayName = "Drawer";
1752
+ const Drawer = Object.assign(DrawerElement, {
1753
+ Header: DrawerHeader,
1754
+ Footer: DrawerFooter,
1755
+ Content: DrawerContent,
1756
+ CancelButton: DrawerCancelButton
1757
+ });
1758
+
1759
+ function supportsPopover() {
1760
+ return Object.prototype.hasOwnProperty.call(HTMLElement.prototype, "popover");
1761
+ }
1762
+
1763
+ const label = "_label_iolth_3";
1764
+ const required = "_required_iolth_47";
1765
+ const styles$3 = {
1766
+ label: label,
1767
+ "top-container": "_top-container_iolth_38",
1768
+ "label-text": "_label-text_iolth_43",
1769
+ required: required,
1770
+ "info-trigger": "_info-trigger_iolth_52",
1771
+ "info-content": "_info-content_iolth_57"
1772
+ };
1773
+
1774
+ const content = "_content_tjoaw_3";
1775
+ const scroller = "_scroller_tjoaw_30";
1776
+ const arrow = "_arrow_tjoaw_33";
1777
+ const trigger = "_trigger_tjoaw_39";
1778
+ const styles$2 = {
1779
+ content: content,
1780
+ scroller: scroller,
1781
+ arrow: arrow,
1782
+ trigger: trigger
1783
+ };
1784
+
1785
+ function useTooltipContext() {
1786
+ const context = useContext(TooltipContext);
1787
+ const invokerRef = useRef(null);
1788
+ const popoverRef = useRef(null);
1789
+ const arrowRef = useRef(null);
1790
+ useLayoutEffect(() => {
1791
+ if (!invokerRef.current) return;
1792
+ context?.setInvoker?.(invokerRef.current);
1793
+ if (!context?.openState) return;
1794
+ context.openTooltip();
1795
+ }, [context, invokerRef]);
1796
+ useLayoutEffect(() => {
1797
+ if (!popoverRef.current) return;
1798
+ context?.setTooltip?.(popoverRef.current);
1799
+ context?.setRootNode?.(popoverRef.current.getRootNode());
1800
+ if (!arrowRef.current) return;
1801
+ context?.setArrowElement?.(arrowRef.current);
1802
+ }, [context, popoverRef]);
1803
+ const onMouseEnterHandler = () => {
1804
+ context?.openTooltip();
1805
+ };
1806
+ const onMouseLeaveHandler = () => {
1807
+ context?.closeTooltip();
1808
+ };
1809
+ const onFocusHandler = () => {
1810
+ if (context?.controlled) return;
1811
+ context?.openTooltip();
1812
+ };
1813
+ const onBlurHandler = () => {
1814
+ if (context?.controlled) return;
1815
+ context?.closeTooltip();
1816
+ };
1817
+ const onKeyDownHandler = (e) => {
1818
+ if (!context?.openState) return;
1819
+ if (e.code === "Escape" && !context.controlled) {
1820
+ context?.closeTooltip();
1821
+ return;
1822
+ }
1823
+ };
1824
+ if (!context || !invokerRef || !popoverRef) return;
1825
+ return {
1826
+ invoker: {
1827
+ ref: invokerRef,
1828
+ element: context.invoker,
1829
+ onMouseEnter: onMouseEnterHandler,
1830
+ onMouseLeave: onMouseLeaveHandler,
1831
+ onKeyDown: onKeyDownHandler,
1832
+ onFocus: onFocusHandler,
1833
+ onBlur: onBlurHandler,
1834
+ "aria-haspopup": true,
1835
+ "aria-expanded": context.openState,
1836
+ "aria-details": context.tooltipId,
1837
+ "data-state": context.openState ? "open" : "closed",
1838
+ "aria-describedby": context.tooltipId
1839
+ },
1840
+ tooltip: {
1841
+ ref: popoverRef,
1842
+ element: context.popover,
1843
+ id: context.tooltipId,
1844
+ show: context.openTooltip,
1845
+ close: context.closeTooltip,
1846
+ style: context.tooltipStyle,
1847
+ arrowRef,
1848
+ key: context.resetKey
1849
+ },
1850
+ setOpen: context.setOpenState,
1851
+ open: context.openState,
1852
+ controlled: context.controlled,
1853
+ placement: context.placement,
1854
+ disableFlipFallback: context.disableFlipFallback
1855
+ };
1856
+ }
1857
+
1858
+ const TooltipLegacyContext = createContext(null);
1859
+ const useTooltipLegacyContext = () => {
1860
+ const context = useContext(TooltipLegacyContext);
1861
+ if (context == null) {
1862
+ throw new Error(
1863
+ "TooltipLegacy components must be wrapped in <TooltipLegacy />"
1864
+ );
1865
+ }
1866
+ return context;
1867
+ };
1868
+
1869
+ const styles$1 = {
1870
+ "content-legacy": "_content-legacy_19gkz_4",
1871
+ "arrow-legacy": "_arrow-legacy_19gkz_30",
1872
+ "trigger-legacy": "_trigger-legacy_19gkz_33"
1873
+ };
1874
+
1875
+ const TooltipLegacyContent = forwardRef(function TooltipLegacyContent2({ style, className, ...props }, propRef) {
1876
+ const {
1877
+ context: floatingContext,
1878
+ theme,
1879
+ mode,
1880
+ root,
1881
+ ...context
1882
+ } = useTooltipLegacyContext();
1883
+ const { root: portalRoot } = useContext(PortalProviderContext);
1884
+ const dialogContext = useContext(DialogContext);
1885
+ const drawerContext = useContext(DrawerContext);
1886
+ const id = useId();
1887
+ useDelayGroup(floatingContext, { id });
1888
+ const ref = useMergeRefs([context.refs.setFloating, propRef]);
1889
+ if (!floatingContext.open) return null;
1890
+ const contentCx = cx(styles$1["content-legacy"], className);
1891
+ return /* @__PURE__ */ jsx(
1892
+ FloatingPortal,
1893
+ {
1894
+ root: root ?? dialogContext?.ref?.current ?? drawerContext?.ref?.current ?? portalRoot ?? context.refs.reference,
1895
+ children: /* @__PURE__ */ jsx(ThemeProvider, { theme, mode, children: /* @__PURE__ */ jsxs(
1896
+ "div",
1897
+ {
1898
+ ref,
1899
+ className: contentCx,
1900
+ "data-anv": "tooltip-content",
1901
+ style: {
1902
+ ...context.floatingStyles,
1903
+ ...style
1904
+ },
1905
+ onBlur: () => context.setOpen(false),
1906
+ ...context.getFloatingProps(props),
1907
+ children: [
1908
+ /* @__PURE__ */ jsx(
1909
+ FloatingArrow,
1910
+ {
1911
+ ref: context.arrowRef,
1912
+ context: floatingContext,
1913
+ className: styles$1["arrow-legacy"]
1914
+ }
1915
+ ),
1916
+ props.children
1917
+ ]
1918
+ }
1919
+ ) })
1920
+ }
1921
+ );
1922
+ });
1923
+
1924
+ const TooltipContentElement = forwardRef(
1925
+ function TooltipContent2(props, ref) {
1926
+ const {
1927
+ children,
1928
+ className,
1929
+ style,
1930
+ onMouseEnter,
1931
+ onMouseLeave,
1932
+ onKeyDown,
1933
+ onFocus,
1934
+ onBlur,
1935
+ ...rest
1936
+ } = props;
1937
+ const context = useTooltipContext();
1938
+ const tooltipClassNames = cx(className, styles$2["content"]);
1939
+ const childrenRef = useRef(null);
1940
+ const focusItems = useRef();
1941
+ const combinedStyles = {
1942
+ ...style,
1943
+ ...context?.tooltip.style
1944
+ };
1945
+ useLayoutEffect(() => {
1946
+ if (!childrenRef.current) return;
1947
+ const focusElements = getKeyboardFocusableElements(childrenRef.current);
1948
+ focusItems.current = focusElements;
1949
+ }, [childrenRef, children, context?.open]);
1950
+ const onMouseEnterHandler = (e) => {
1951
+ onMouseEnter?.(e);
1952
+ context?.tooltip.show();
1953
+ };
1954
+ const onMouseLeaveHandler = (e) => {
1955
+ onMouseLeave?.(e);
1956
+ context?.tooltip.close();
1957
+ };
1958
+ const onFocusHandler = (e) => {
1959
+ onFocus?.(e);
1960
+ context?.tooltip.show();
1961
+ };
1962
+ const onBlurHandler = (e) => {
1963
+ onBlur?.(e);
1964
+ if (context?.controlled) return;
1965
+ context?.tooltip.close();
1966
+ };
1967
+ const onKeyDownHandler = (e) => {
1968
+ onKeyDown?.(e);
1969
+ if (!context?.open) return;
1970
+ if (e.code === "Escape") {
1971
+ context?.tooltip.close();
1972
+ }
1973
+ };
1974
+ const tooltipWrapperRef = useMergeRefs([context?.tooltip.ref, ref]);
1975
+ return /* @__PURE__ */ jsxs(
1976
+ "div",
1977
+ {
1978
+ popover: "manual",
1979
+ id: context?.tooltip.id,
1980
+ "data-anv": "tooltip-content",
1981
+ className: tooltipClassNames,
1982
+ ref: tooltipWrapperRef,
1983
+ style: combinedStyles,
1984
+ onMouseEnter: onMouseEnterHandler,
1985
+ onMouseLeave: onMouseLeaveHandler,
1986
+ onBlur: onBlurHandler,
1987
+ onFocus: onFocusHandler,
1988
+ role: "tooltip",
1989
+ ...rest,
1990
+ children: [
1991
+ /* @__PURE__ */ jsx(
1992
+ "div",
1993
+ {
1994
+ className: styles$2.scroller,
1995
+ role: "presentation",
1996
+ tabIndex: -1,
1997
+ ref: childrenRef,
1998
+ onKeyDown: onKeyDownHandler,
1999
+ children
2000
+ },
2001
+ context?.tooltip.key
2002
+ ),
2003
+ /* @__PURE__ */ jsx("span", { className: styles$2["arrow"], ref: context?.tooltip.arrowRef, children: /* @__PURE__ */ jsxs("svg", { "aria-hidden": "true", width: "14", height: "14", viewBox: "0 0 14 14", children: [
2004
+ /* @__PURE__ */ jsx("path", { stroke: "none", d: "M0,0 H14 L7,7 Q7,7 7,7 Z" }),
2005
+ /* @__PURE__ */ jsx("clipPath", { id: ":r9:", children: /* @__PURE__ */ jsx("rect", { x: "0", y: "0", width: "14", height: "14" }) })
2006
+ ] }) })
2007
+ ]
2008
+ }
2009
+ );
2010
+ }
2011
+ );
2012
+ const TooltipContent = forwardRef(
2013
+ function TooltipContent3(props, ref) {
2014
+ if (!supportsPopover())
2015
+ return /* @__PURE__ */ jsx(TooltipLegacyContent, { ...props, ref });
2016
+ return /* @__PURE__ */ jsx(TooltipContentElement, { ...props, ref });
2017
+ }
2018
+ );
2019
+
2020
+ const TooltipLegacyTrigger = forwardRef(function TooltipLegacyTrigger2({ children, className, ...props }, propRef) {
2021
+ const context = useTooltipLegacyContext();
2022
+ const ref = useMergeRefs([context.refs.setReference, propRef]);
2023
+ const { "aria-describedby": ariaDescribedBy, ...restOfContextProps } = context.getReferenceProps(props);
2024
+ const child = cloneElement(children, {
2025
+ ref,
2026
+ "aria-describedby": ariaDescribedBy
2027
+ });
2028
+ return /* @__PURE__ */ jsx(
2029
+ "span",
2030
+ {
2031
+ ref,
2032
+ className: cx([styles$1["trigger-legacy"]], className),
2033
+ "data-anv": "tooltip-trigger",
2034
+ "data-state": context.open ? "open" : "closed",
2035
+ ...restOfContextProps,
2036
+ children: child
2037
+ }
2038
+ );
2039
+ });
2040
+
2041
+ const TooltipTriggerElement = forwardRef(
2042
+ function TooltipTrigger2(props, propRef) {
2043
+ const {
2044
+ children,
2045
+ className,
2046
+ onMouseEnter,
2047
+ onMouseLeave,
2048
+ onKeyDown,
2049
+ onFocus,
2050
+ onBlur,
2051
+ ...rest
2052
+ } = props;
2053
+ const context = useTooltipContext();
2054
+ const child = cloneElement(children, {
2055
+ ref: context?.invoker.ref,
2056
+ "aria-haspopup": context?.invoker["aria-haspopup"],
2057
+ "aria-expanded": context?.invoker["aria-expanded"],
2058
+ "aria-details": context?.invoker["aria-details"],
2059
+ "data-state": context?.invoker["data-state"],
2060
+ "aria-describedby": context?.invoker["aria-describedby"]
2061
+ });
2062
+ const onMouseEnterHandler = (e) => {
2063
+ onMouseEnter?.(e);
2064
+ context?.invoker.onMouseEnter();
2065
+ };
2066
+ const onMouseLeaveHandler = (e) => {
2067
+ onMouseLeave?.(e);
2068
+ context?.invoker.onMouseLeave();
2069
+ };
2070
+ const onKeyDownHandler = (e) => {
2071
+ onKeyDown?.(e);
2072
+ context?.invoker.onKeyDown(e);
2073
+ };
2074
+ const onFocusHandler = (e) => {
2075
+ onFocus?.(e);
2076
+ context?.invoker.onFocus();
2077
+ };
2078
+ const onBlurHandler = (e) => {
2079
+ onBlur?.(e);
2080
+ context?.invoker.onBlur();
2081
+ };
2082
+ if (!supportsPopover()) return /* @__PURE__ */ jsx(TooltipLegacyTrigger, { ...props });
2083
+ return /* @__PURE__ */ jsx(
2084
+ "span",
2085
+ {
2086
+ className: cx([styles$2["trigger"]], className),
2087
+ "data-anv": "tooltip-trigger",
2088
+ ref: propRef,
2089
+ onMouseEnter: onMouseEnterHandler,
2090
+ onMouseLeave: onMouseLeaveHandler,
2091
+ onKeyDown: onKeyDownHandler,
2092
+ onFocus: onFocusHandler,
2093
+ onBlur: onBlurHandler,
2094
+ role: "presentation",
2095
+ ...rest,
2096
+ children: child
2097
+ }
2098
+ );
2099
+ }
2100
+ );
2101
+ const TooltipTrigger = forwardRef(
2102
+ function TooltipTrigger3(props, propRef) {
2103
+ if (!supportsPopover())
2104
+ return /* @__PURE__ */ jsx(TooltipLegacyTrigger, { ...props, ref: propRef });
2105
+ return /* @__PURE__ */ jsx(TooltipTriggerElement, { ...props, ref: propRef });
2106
+ }
2107
+ );
2108
+
2109
+ function useTooltipLegacy({
2110
+ defaultOpen = false,
2111
+ offset: offsetProp = 5,
2112
+ open: controlledOpen,
2113
+ placement = "top",
2114
+ fallbackPlacements,
2115
+ disableFlip,
2116
+ disableShift,
2117
+ root
2118
+ } = {}) {
2119
+ const [uncontrolledOpen, setUncontrolledOpen] = useState(defaultOpen);
2120
+ const open = controlledOpen ?? uncontrolledOpen;
2121
+ const setOpen = setUncontrolledOpen;
2122
+ const { disableDelayGroup } = useTooltipLegacyGroup();
2123
+ useEffect(() => {
2124
+ if (!defaultOpen && !controlledOpen) {
2125
+ disableDelayGroup(true);
2126
+ }
2127
+ disableDelayGroup(false);
2128
+ }, [defaultOpen, controlledOpen, disableDelayGroup]);
2129
+ const arrowRef = useRef(null);
2130
+ const { delay } = useDelayGroupContext();
2131
+ const data = useFloating({
2132
+ placement,
2133
+ open,
2134
+ onOpenChange: setOpen,
2135
+ whileElementsMounted: autoUpdate,
2136
+ middleware: [
2137
+ offset(offsetProp),
2138
+ flip({
2139
+ crossAxis: !disableFlip ? placement.includes("-") : false,
2140
+ mainAxis: !disableFlip,
2141
+ fallbackAxisSideDirection: "start",
2142
+ fallbackPlacements,
2143
+ padding: 5
2144
+ }),
2145
+ shift({
2146
+ padding: 5,
2147
+ mainAxis: !disableShift,
2148
+ crossAxis: false,
2149
+ limiter: limitShift({
2150
+ mainAxis: !disableShift
2151
+ })
2152
+ }),
2153
+ arrow$1({ element: arrowRef, padding: 5 })
2154
+ ]
2155
+ });
2156
+ const context = data.context;
2157
+ const hover = useHover(context, {
2158
+ move: false,
2159
+ handleClose: safePolygon(),
2160
+ delay
2161
+ });
2162
+ const focus = useFocus(context, {});
2163
+ const dismiss = useDismiss(context);
2164
+ const role = useRole(context, { role: "tooltip" });
2165
+ const interactions = useInteractions([hover, focus, dismiss, role]);
2166
+ return useMemo(
2167
+ () => ({
2168
+ open,
2169
+ setOpen,
2170
+ arrowRef,
2171
+ root,
2172
+ ...interactions,
2173
+ ...data
2174
+ }),
2175
+ [open, setOpen, interactions, data, root]
2176
+ );
2177
+ }
2178
+
2179
+ function TooltipLegacyElement({
2180
+ children,
2181
+ ...options
2182
+ }) {
2183
+ const tooltip = useTooltipLegacy(options);
2184
+ const { theme, mode } = useContext(ThemeProviderContext);
2185
+ const value = useMemo(
2186
+ () => ({ ...tooltip, theme, mode }),
2187
+ [mode, theme, tooltip]
2188
+ );
2189
+ return /* @__PURE__ */ jsx(TooltipLegacyContext.Provider, { value, children });
2190
+ }
2191
+ const TooltipLegacy = Object.assign(TooltipLegacyElement, {
2192
+ Trigger: TooltipLegacyTrigger,
2193
+ Content: TooltipLegacyContent
2194
+ });
2195
+
2196
+ const TooltipContext = createContext(null);
2197
+ const TooltipElement = (props) => {
2198
+ const {
2199
+ children,
2200
+ delay = 100,
2201
+ placement = "top",
2202
+ open,
2203
+ defaultOpen = false,
2204
+ disableShift,
2205
+ disableFlip,
2206
+ disableFlipFallback,
2207
+ id,
2208
+ offset: offsetProp = 5,
2209
+ fallbackPlacements,
2210
+ root
2211
+ } = props;
2212
+ const uid = useId();
2213
+ const [invoker, setInvoker] = useState(void 0);
2214
+ const [tooltip, setTooltip] = useState(void 0);
2215
+ const [rootNode, setRootNode] = useState();
2216
+ const [arrowElement, setArrowElement] = useState(void 0);
2217
+ const [openState, setOpenState] = useState(
2218
+ open ?? defaultOpen
2219
+ );
2220
+ const arrowRef = useRef(null);
2221
+ const dialogContext = useContext(DialogContext);
2222
+ const updatePosition = useCallback(() => {
2223
+ if (!invoker || !tooltip) return;
2224
+ if (!openState) return;
2225
+ computePosition(invoker, tooltip, {
2226
+ placement,
2227
+ middleware: [
2228
+ offset(offsetProp),
2229
+ flip({
2230
+ mainAxis: !disableFlip,
2231
+ crossAxis: false,
2232
+ fallbackAxisSideDirection: disableFlipFallback ? "none" : "end",
2233
+ fallbackPlacements,
2234
+ padding: 5
2235
+ }),
2236
+ shift({
2237
+ padding: 5,
2238
+ mainAxis: !disableShift,
2239
+ crossAxis: false,
2240
+ limiter: limitShift({
2241
+ mainAxis: !disableShift
2242
+ })
2243
+ }),
2244
+ arrow$1({
2245
+ element: arrowElement ? arrowElement : null,
2246
+ padding: 5
2247
+ })
2248
+ ]
2249
+ }).then(({ x, y, placement: placement2, middlewareData }) => {
2250
+ const side = placement2.split("-")[0];
2251
+ const staticSide = {
2252
+ top: "bottom",
2253
+ right: "left",
2254
+ bottom: "top",
2255
+ left: "right"
2256
+ }[side];
2257
+ const arrowDeg = () => {
2258
+ if (staticSide === "top") return 180;
2259
+ if (staticSide === "bottom") return 0;
2260
+ if (staticSide === "left") return 90;
2261
+ return 270;
2262
+ };
2263
+ Object.assign(tooltip.style, {
2264
+ left: `${x}px`,
2265
+ top: `${y}px`
2266
+ });
2267
+ if (middlewareData.arrow && arrowElement) {
2268
+ const { x: x2, y: y2 } = middlewareData.arrow;
2269
+ Object.assign(arrowElement.style, {
2270
+ left: x2 != null ? `${x2}px` : "",
2271
+ top: y2 != null ? `${y2}px` : "",
2272
+ right: "",
2273
+ bottom: "",
2274
+ [staticSide]: `${-arrowElement.offsetWidth + 2}px`,
2275
+ transform: `rotate(${arrowDeg()}deg)`
2276
+ });
2277
+ }
2278
+ });
2279
+ }, [
2280
+ invoker,
2281
+ tooltip,
2282
+ openState,
2283
+ placement,
2284
+ offsetProp,
2285
+ disableFlip,
2286
+ disableFlipFallback,
2287
+ fallbackPlacements,
2288
+ disableShift,
2289
+ arrowElement
2290
+ ]);
2291
+ const resetKey = useRef(0);
2292
+ useLayoutEffect(() => {
2293
+ if (!tooltip || !invoker) return;
2294
+ if (!openState) {
2295
+ resetKey.current += 1;
2296
+ return;
2297
+ }
2298
+ let requestID = null;
2299
+ const cleanup = autoUpdate(invoker, tooltip, () => {
2300
+ requestID = requestAnimationFrame(updatePosition);
2301
+ });
2302
+ return () => {
2303
+ requestID && cancelAnimationFrame(requestID);
2304
+ cleanup();
2305
+ };
2306
+ }, [invoker, tooltip, updatePosition, openState]);
2307
+ const popoverHoverTriggered = useRef();
2308
+ const openTooltip = useCallback(async () => {
2309
+ popoverHoverTriggered.current = true;
2310
+ await new Promise((resolve) => setTimeout(resolve, delay));
2311
+ if (!popoverHoverTriggered.current || !tooltip || !rootNode?.querySelector(`#${id ?? `tooltip-${uid.replace(/:/g, "")}`}`))
2312
+ return;
2313
+ tooltip.showPopover();
2314
+ setOpenState(true);
2315
+ dialogContext?.setHasOpenPopover?.(true);
2316
+ }, [tooltip, rootNode, id, uid, dialogContext, delay]);
2317
+ const closeTooltip = useCallback(
2318
+ async (fn) => {
2319
+ popoverHoverTriggered.current = false;
2320
+ await new Promise((resolve) => setTimeout(resolve, 100));
2321
+ if (popoverHoverTriggered.current || !tooltip || !openState) return;
2322
+ fn?.();
2323
+ setOpenState(false);
2324
+ tooltip?.hidePopover();
2325
+ dialogContext?.setHasOpenPopover?.(false);
2326
+ },
2327
+ [tooltip, openState, dialogContext]
2328
+ );
2329
+ const isControlled = typeof open !== "undefined";
2330
+ const initialRender = useRef(true);
2331
+ useEffect(() => {
2332
+ if (!isControlled) return;
2333
+ if (initialRender.current === true) {
2334
+ open && tooltip && openTooltip();
2335
+ initialRender.current = false;
2336
+ return;
2337
+ }
2338
+ setOpenState(open);
2339
+ open ? openTooltip() : closeTooltip();
2340
+ }, [closeTooltip, isControlled, open, openTooltip, tooltip]);
2341
+ const value = useMemo(() => {
2342
+ updatePosition();
2343
+ return {
2344
+ tooltipId: id ?? `tooltip-${uid.replace(/:/g, "")}`,
2345
+ invoker,
2346
+ setInvoker,
2347
+ tooltip,
2348
+ setTooltip,
2349
+ arrowElement,
2350
+ setArrowElement,
2351
+ openTooltip,
2352
+ closeTooltip,
2353
+ placement,
2354
+ openState,
2355
+ setOpenState,
2356
+ disableFlipFallback,
2357
+ controlled: isControlled,
2358
+ arrowRef,
2359
+ resetKey: resetKey.current,
2360
+ rootNode,
2361
+ setRootNode
2362
+ };
2363
+ }, [
2364
+ updatePosition,
2365
+ id,
2366
+ uid,
2367
+ invoker,
2368
+ tooltip,
2369
+ arrowElement,
2370
+ openTooltip,
2371
+ closeTooltip,
2372
+ placement,
2373
+ openState,
2374
+ disableFlipFallback,
2375
+ isControlled,
2376
+ arrowRef,
2377
+ resetKey,
2378
+ rootNode,
2379
+ setRootNode
2380
+ ]);
2381
+ if (!supportsPopover()) return /* @__PURE__ */ jsx(TooltipLegacy, { ...props });
2382
+ return /* @__PURE__ */ jsx(TooltipContext.Provider, { value, children });
2383
+ };
2384
+ const Tooltip = Object.assign(TooltipElement, {
2385
+ Trigger: TooltipTrigger,
2386
+ Content: TooltipContent,
2387
+ Context: TooltipContext
2388
+ });
2389
+
2390
+ const Label = forwardRef((props, ref) => {
2391
+ const { children, className, moreInfo, required, openMoreInfo, ...rest } = props;
2392
+ const LabelClassNames = cx([styles$3["label"]], className);
2393
+ return /* @__PURE__ */ jsxs("label", { className: LabelClassNames, "data-anv": "label", ref, ...rest, children: [
2394
+ /* @__PURE__ */ jsxs("div", { className: styles$3["top-container"], "aria-atomic": "true", children: [
2395
+ /* @__PURE__ */ jsxs("span", { className: styles$3["label-text"], children: [
2396
+ children,
2397
+ required ? /* @__PURE__ */ jsxs(Fragment, { children: [
2398
+ /* @__PURE__ */ jsx("span", { "aria-hidden": true, className: styles$3["required"], children: "*" }),
2399
+ /* @__PURE__ */ jsx(SrOnly, { children: "Required" })
2400
+ ] }) : null
2401
+ ] }),
2402
+ moreInfo ? /* @__PURE__ */ jsxs(
2403
+ Tooltip,
2404
+ {
2405
+ open: openMoreInfo ? openMoreInfo : void 0,
2406
+ placement: "top",
2407
+ fallbackPlacements: ["right", "bottom", "left"],
2408
+ children: [
2409
+ /* @__PURE__ */ jsx(Tooltip.Trigger, { className: styles$3["info-trigger"], children: /* @__PURE__ */ jsx(Icon, { svg: SvgInfo }) }),
2410
+ /* @__PURE__ */ jsx(Tooltip.Content, { className: styles$3["info-content"], children: moreInfo })
2411
+ ]
2412
+ }
2413
+ ) : null
2414
+ ] }),
2415
+ moreInfo ? /* @__PURE__ */ jsx(SrOnly, { children: moreInfo }) : null
2416
+ ] });
2417
+ });
2418
+ Label.displayName = "Label";
2419
+
2420
+ const bar = "_bar_1uffu_24";
2421
+ const indeterminate = "_indeterminate_1uffu_1";
2422
+ const success = "_success_1uffu_67";
2423
+ const error = "_error_1uffu_53";
2424
+ const styles = {
2425
+ "progress-bar": "_progress-bar_1uffu_3",
2426
+ "bar-container": "_bar-container_1uffu_24",
2427
+ bar: bar,
2428
+ "check-icon": "_check-icon_1uffu_50",
2429
+ "error-icon": "_error-icon_1uffu_53",
2430
+ indeterminate: indeterminate,
2431
+ success: success,
2432
+ error: error
2433
+ };
2434
+
2435
+ const ProgressBar = forwardRef(
2436
+ (props, ref) => {
2437
+ const { layoutStyles, componentProps } = useLayoutPropsUtil(props);
2438
+ const {
2439
+ className,
2440
+ style,
2441
+ value,
2442
+ children,
2443
+ indeterminate,
2444
+ errorAriaLive,
2445
+ description,
2446
+ error = false,
2447
+ max = 100,
2448
+ ...mainProps
2449
+ } = componentProps;
2450
+ const styleCombined = {
2451
+ ...style,
2452
+ ...layoutStyles
2453
+ };
2454
+ const errorMessage = typeof error !== "boolean" ? error : void 0;
2455
+ const labelUid = useId();
2456
+ const isSuccess = typeof value !== "undefined" && +value === +max;
2457
+ if ("label" in props && !!props.label) {
2458
+ const { label, labelProps, ...rest } = mainProps;
2459
+ const ProgressBarClassNames2 = cx(
2460
+ [styles["progress-bar"]],
2461
+ className,
2462
+ {
2463
+ [styles[`error`]]: error,
2464
+ [styles[`success`]]: isSuccess
2465
+ }
2466
+ );
2467
+ return /* @__PURE__ */ jsxs(
2468
+ "div",
2469
+ {
2470
+ className: ProgressBarClassNames2,
2471
+ "data-anv": "progress-bar",
2472
+ style: styleCombined,
2473
+ ref,
2474
+ children: [
2475
+ /* @__PURE__ */ jsxs(Flex, { justifyContent: "space-between", alignItems: "center", children: [
2476
+ /* @__PURE__ */ jsx(Label, { id: labelUid, ...labelProps, children: label }),
2477
+ isSuccess && !error ? /* @__PURE__ */ jsx(Icon, { className: styles["check-icon"], svg: SvgCheckCircle }) : null,
2478
+ error ? /* @__PURE__ */ jsx(Icon, { className: styles["error-icon"], svg: SvgError }) : null
2479
+ ] }),
2480
+ /* @__PURE__ */ jsx("div", { className: styles["bar-container"], children: /* @__PURE__ */ jsx(
2481
+ "progress",
2482
+ {
2483
+ "aria-labelledby": labelUid,
2484
+ className: styles["bar"],
2485
+ value,
2486
+ max,
2487
+ ...rest
2488
+ }
2489
+ ) }),
2490
+ errorMessage || description ? /* @__PURE__ */ jsx(
2491
+ Helper,
2492
+ {
2493
+ errorMessage,
2494
+ errorAriaLive,
2495
+ description
2496
+ }
2497
+ ) : null
2498
+ ]
2499
+ }
2500
+ );
2501
+ }
2502
+ const ProgressBarClassNames = cx([styles["progress-bar"]], className, {
2503
+ [styles[`error`]]: error,
2504
+ [styles[`success`]]: isSuccess
2505
+ });
2506
+ return /* @__PURE__ */ jsxs(
2507
+ "div",
2508
+ {
2509
+ className: ProgressBarClassNames,
2510
+ "data-anv": "progress-bar",
2511
+ style: styleCombined,
2512
+ ref,
2513
+ children: [
2514
+ /* @__PURE__ */ jsx("div", { className: styles["bar-container"], children: /* @__PURE__ */ jsx(
2515
+ "progress",
2516
+ {
2517
+ className: styles["bar"],
2518
+ max,
2519
+ value,
2520
+ ...mainProps
2521
+ }
2522
+ ) }),
2523
+ errorMessage || description ? /* @__PURE__ */ jsx(
2524
+ Helper,
2525
+ {
2526
+ errorMessage,
2527
+ errorAriaLive,
2528
+ description
2529
+ }
2530
+ ) : null
2531
+ ]
2532
+ }
2533
+ );
2534
+ }
2535
+ );
2536
+ ProgressBar.displayName = "ProgressBar";
2537
+
2538
+ export { DialogHeader as D, Label as L, ProgressBar as P, TooltipTrigger as T, DialogFooter as a, DialogContent as b, DialogCancelButton as c, Dialog as d, DrawerCancelButton as e, DrawerFooter as f, DrawerHeader as g, DrawerContent as h, Drawer as i, TooltipContent as j, Tooltip as k, Toaster as l, DialogContext as m, DrawerContext as n, supportsPopover as s, toast as t, useKeyboardFocusables as u };
2539
+ //# sourceMappingURL=ProgressBar-YrCJtlvK-BlhqSUr-.js.map