@purpur/library 9.0.6 → 9.0.7

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 (251) hide show
  1. package/CHANGELOG.json +33 -0
  2. package/CHANGELOG.md +15 -1
  3. package/dist/{RichText-DRacgpis.mjs → RichText-Bi51HE6X.mjs} +3 -3
  4. package/dist/{RichText-DRacgpis.mjs.map → RichText-Bi51HE6X.mjs.map} +1 -1
  5. package/dist/{RichText-DMyGiMN0.js → RichText-DNroJJXv.js} +2 -2
  6. package/dist/{RichText-DMyGiMN0.js.map → RichText-DNroJJXv.js.map} +1 -1
  7. package/dist/{ThemeProvider-CrjMv3M8.mjs → ThemeProvider-BR1hJQOD.mjs} +85 -85
  8. package/dist/{ThemeProvider-CrjMv3M8.mjs.map → ThemeProvider-BR1hJQOD.mjs.map} +1 -1
  9. package/dist/{accordion-DWflnyWa.mjs → accordion-BKTz9DM6.mjs} +18 -18
  10. package/dist/{accordion-DWflnyWa.mjs.map → accordion-BKTz9DM6.mjs.map} +1 -1
  11. package/dist/{accordion-CF2fj2uq.js → accordion-DX8efWOt.js} +2 -2
  12. package/dist/{accordion-CF2fj2uq.js.map → accordion-DX8efWOt.js.map} +1 -1
  13. package/dist/accordion.cjs.js +1 -1
  14. package/dist/accordion.es.js +1 -1
  15. package/dist/{alert-badge-u7qAhYbR.mjs → alert-badge-DR8cigWu.mjs} +3 -3
  16. package/dist/{alert-badge-u7qAhYbR.mjs.map → alert-badge-DR8cigWu.mjs.map} +1 -1
  17. package/dist/alert-badge.es.js +1 -1
  18. package/dist/{autocomplete-yD0-1vlF.js → autocomplete-6qSqK3SI.js} +2 -2
  19. package/dist/{autocomplete-yD0-1vlF.js.map → autocomplete-6qSqK3SI.js.map} +1 -1
  20. package/dist/{autocomplete-0kGG_STe.mjs → autocomplete-B4dZx9zF.mjs} +3 -3
  21. package/dist/{autocomplete-0kGG_STe.mjs.map → autocomplete-B4dZx9zF.mjs.map} +1 -1
  22. package/dist/autocomplete.cjs.js +1 -1
  23. package/dist/autocomplete.es.js +1 -1
  24. package/dist/button-BfYKNBmC.mjs +102 -0
  25. package/dist/button-BfYKNBmC.mjs.map +1 -0
  26. package/dist/button-DDYGuqZ0.js +2 -0
  27. package/dist/button-DDYGuqZ0.js.map +1 -0
  28. package/dist/button.cjs.js +1 -1
  29. package/dist/button.es.js +1 -1
  30. package/dist/{calendar-pMM0fKEu.js → calendar-CxkJMONO.js} +2 -2
  31. package/dist/{calendar-pMM0fKEu.js.map → calendar-CxkJMONO.js.map} +1 -1
  32. package/dist/{calendar-DDie8jSH.mjs → calendar-vALLklKV.mjs} +2 -2
  33. package/dist/{calendar-DDie8jSH.mjs.map → calendar-vALLklKV.mjs.map} +1 -1
  34. package/dist/calendar.cjs.js +1 -1
  35. package/dist/calendar.es.js +1 -1
  36. package/dist/{card-DiMVw06l.mjs → card-CkZQZOz1.mjs} +9 -9
  37. package/dist/{card-DiMVw06l.mjs.map → card-CkZQZOz1.mjs.map} +1 -1
  38. package/dist/{card-B512KHpr.js → card-VMa3cGCP.js} +2 -2
  39. package/dist/{card-B512KHpr.js.map → card-VMa3cGCP.js.map} +1 -1
  40. package/dist/card.cjs.js +1 -1
  41. package/dist/card.es.js +1 -1
  42. package/dist/{checkbox-LYzMiXu7.mjs → checkbox-D6qWgpWR.mjs} +8 -8
  43. package/dist/{checkbox-LYzMiXu7.mjs.map → checkbox-D6qWgpWR.mjs.map} +1 -1
  44. package/dist/checkbox.es.js +1 -1
  45. package/dist/{chip-group-aj1fdnjC.js → chip-group-B775zvKD.js} +2 -2
  46. package/dist/{chip-group-aj1fdnjC.js.map → chip-group-B775zvKD.js.map} +1 -1
  47. package/dist/{chip-group-CJVvfl_J.mjs → chip-group-xuOe7nL3.mjs} +3 -3
  48. package/dist/{chip-group-CJVvfl_J.mjs.map → chip-group-xuOe7nL3.mjs.map} +1 -1
  49. package/dist/chip-group.cjs.js +1 -1
  50. package/dist/chip-group.es.js +1 -1
  51. package/dist/components/button/src/button.d.ts +1 -2
  52. package/dist/components/button/src/button.d.ts.map +1 -1
  53. package/dist/components/date-field/src/date-field.d.ts.map +1 -1
  54. package/dist/components/stepper/src/stepper-button.d.ts.map +1 -1
  55. package/dist/components/table/src/table-toolbar.d.ts.map +1 -1
  56. package/dist/components/tabs/src/tab-content.d.ts.map +1 -1
  57. package/dist/components/tabs/src/tabs.d.ts.map +1 -1
  58. package/dist/{container-Bw12NgHN.mjs → container-DLjBTB_w.mjs} +3 -3
  59. package/dist/{container-Bw12NgHN.mjs.map → container-DLjBTB_w.mjs.map} +1 -1
  60. package/dist/container.es.js +1 -1
  61. package/dist/{content-block-DUcjAZgG.mjs → content-block-BMOvlH7a.mjs} +6 -6
  62. package/dist/{content-block-DUcjAZgG.mjs.map → content-block-BMOvlH7a.mjs.map} +1 -1
  63. package/dist/{content-block-kzdUWgvH.js → content-block-Cd7xSE8t.js} +2 -2
  64. package/dist/{content-block-kzdUWgvH.js.map → content-block-Cd7xSE8t.js.map} +1 -1
  65. package/dist/content-block.cjs.js +1 -1
  66. package/dist/content-block.es.js +1 -1
  67. package/dist/{countdown-DxAGVUFI.mjs → countdown-DZ4IwkNy.mjs} +12 -12
  68. package/dist/{countdown-DxAGVUFI.mjs.map → countdown-DZ4IwkNy.mjs.map} +1 -1
  69. package/dist/countdown.es.js +1 -1
  70. package/dist/date-field-CORqon6B.js +2 -0
  71. package/dist/{date-field-CPiTZqa0.js.map → date-field-CORqon6B.js.map} +1 -1
  72. package/dist/{date-field-D_6iP2fC.mjs → date-field-CTJB8O0e.mjs} +325 -310
  73. package/dist/{date-field-D_6iP2fC.mjs.map → date-field-CTJB8O0e.mjs.map} +1 -1
  74. package/dist/date-field.cjs.js +1 -1
  75. package/dist/date-field.es.js +1 -1
  76. package/dist/{date-picker-BRnwwZv1.mjs → date-picker-CJcIJ5VL.mjs} +5 -5
  77. package/dist/{date-picker-BRnwwZv1.mjs.map → date-picker-CJcIJ5VL.mjs.map} +1 -1
  78. package/dist/{date-picker-DlJGggam.js → date-picker-Dv3W05Hf.js} +2 -2
  79. package/dist/{date-picker-DlJGggam.js.map → date-picker-Dv3W05Hf.js.map} +1 -1
  80. package/dist/date-picker.cjs.js +1 -1
  81. package/dist/date-picker.es.js +1 -1
  82. package/dist/{dismissable-chip-group-DsO2cZaF.js → dismissable-chip-group-CnziecOt.js} +2 -2
  83. package/dist/{dismissable-chip-group-DsO2cZaF.js.map → dismissable-chip-group-CnziecOt.js.map} +1 -1
  84. package/dist/{dismissable-chip-group-Bl0D18qM.mjs → dismissable-chip-group-ZCYOt1sB.mjs} +2 -2
  85. package/dist/{dismissable-chip-group-Bl0D18qM.mjs.map → dismissable-chip-group-ZCYOt1sB.mjs.map} +1 -1
  86. package/dist/dismissable-chip-group.cjs.js +1 -1
  87. package/dist/dismissable-chip-group.es.js +1 -1
  88. package/dist/{drawer-nBpCtIdI.js → drawer-Ce5LNpU2.js} +2 -2
  89. package/dist/{drawer-nBpCtIdI.js.map → drawer-Ce5LNpU2.js.map} +1 -1
  90. package/dist/{drawer-Boqmgh-i.mjs → drawer-DSFZ61OH.mjs} +14 -14
  91. package/dist/{drawer-Boqmgh-i.mjs.map → drawer-DSFZ61OH.mjs.map} +1 -1
  92. package/dist/drawer.cjs.js +1 -1
  93. package/dist/drawer.es.js +1 -1
  94. package/dist/{floating-ui.react-dom-0ol4sFzt.mjs → floating-ui.react-dom-gsHLgcoR.mjs} +5 -5
  95. package/dist/{floating-ui.react-dom-0ol4sFzt.mjs.map → floating-ui.react-dom-gsHLgcoR.mjs.map} +1 -1
  96. package/dist/{footer-DrjAwjuL.js → footer-BL0ewBZT.js} +2 -2
  97. package/dist/{footer-DrjAwjuL.js.map → footer-BL0ewBZT.js.map} +1 -1
  98. package/dist/{footer-DcWsihxS.mjs → footer-cH07Xqil.mjs} +5 -5
  99. package/dist/{footer-DcWsihxS.mjs.map → footer-cH07Xqil.mjs.map} +1 -1
  100. package/dist/footer.cjs.js +1 -1
  101. package/dist/footer.es.js +1 -1
  102. package/dist/heading-drD5ugCC.js +2 -0
  103. package/dist/{heading-DLCdW6gx.js.map → heading-drD5ugCC.js.map} +1 -1
  104. package/dist/heading-xwBuT_-9.mjs +75 -0
  105. package/dist/{heading-gqtQNo5n.mjs.map → heading-xwBuT_-9.mjs.map} +1 -1
  106. package/dist/heading.cjs.js +1 -1
  107. package/dist/heading.es.js +1 -1
  108. package/dist/{hero-banner-B8fRHxXc.mjs → hero-banner-CkSSlxTW.mjs} +5 -5
  109. package/dist/{hero-banner-B8fRHxXc.mjs.map → hero-banner-CkSSlxTW.mjs.map} +1 -1
  110. package/dist/{hero-banner-D3peC1NR.js → hero-banner-JFaqW20R.js} +2 -2
  111. package/dist/{hero-banner-D3peC1NR.js.map → hero-banner-JFaqW20R.js.map} +1 -1
  112. package/dist/hero-banner.cjs.js +1 -1
  113. package/dist/hero-banner.es.js +1 -1
  114. package/dist/library.cjs.js +1 -1
  115. package/dist/library.es.js +44 -44
  116. package/dist/{listbox-u6__DsLw.mjs → listbox-oDeP8FvH.mjs} +2 -2
  117. package/dist/{listbox-u6__DsLw.mjs.map → listbox-oDeP8FvH.mjs.map} +1 -1
  118. package/dist/listbox.es.js +1 -1
  119. package/dist/{modal-C2UQsW-g.mjs → modal-2ymCXTup.mjs} +19 -19
  120. package/dist/{modal-C2UQsW-g.mjs.map → modal-2ymCXTup.mjs.map} +1 -1
  121. package/dist/{modal-nyhf5zxG.js → modal-CXi2xez5.js} +2 -2
  122. package/dist/{modal-nyhf5zxG.js.map → modal-CXi2xez5.js.map} +1 -1
  123. package/dist/modal.cjs.js +1 -1
  124. package/dist/modal.es.js +1 -1
  125. package/dist/{notification-C32wHljA.mjs → notification-BFSOuDp8.mjs} +22 -22
  126. package/dist/{notification-C32wHljA.mjs.map → notification-BFSOuDp8.mjs.map} +1 -1
  127. package/dist/{notification-Bg1vQkQ3.js → notification-DdnI2rOh.js} +2 -2
  128. package/dist/{notification-Bg1vQkQ3.js.map → notification-DdnI2rOh.js.map} +1 -1
  129. package/dist/{notification-banner-BY2iZOIa.mjs → notification-banner-CQvBezAL.mjs} +3 -3
  130. package/dist/{notification-banner-BY2iZOIa.mjs.map → notification-banner-CQvBezAL.mjs.map} +1 -1
  131. package/dist/{notification-banner-C8XsBDTq.js → notification-banner-CT4ew8IQ.js} +2 -2
  132. package/dist/{notification-banner-C8XsBDTq.js.map → notification-banner-CT4ew8IQ.js.map} +1 -1
  133. package/dist/notification-banner.cjs.js +1 -1
  134. package/dist/notification-banner.es.js +1 -1
  135. package/dist/notification.cjs.js +1 -1
  136. package/dist/notification.es.js +1 -1
  137. package/dist/{pagination-CVVCAQ65.mjs → pagination-BdCjh1Pi.mjs} +2 -2
  138. package/dist/{pagination-CVVCAQ65.mjs.map → pagination-BdCjh1Pi.mjs.map} +1 -1
  139. package/dist/pagination.es.js +1 -1
  140. package/dist/{paragraph-DNtj7OLr.mjs → paragraph-Ci50OF1u.mjs} +3 -3
  141. package/dist/{paragraph-DNtj7OLr.mjs.map → paragraph-Ci50OF1u.mjs.map} +1 -1
  142. package/dist/paragraph.es.js +1 -1
  143. package/dist/{popover-B1BgSoQx.js → popover-D3qWbbU4.js} +2 -2
  144. package/dist/{popover-B1BgSoQx.js.map → popover-D3qWbbU4.js.map} +1 -1
  145. package/dist/{popover-DBMI9Jy1.mjs → popover-ZeQKmyEb.mjs} +25 -25
  146. package/dist/{popover-DBMI9Jy1.mjs.map → popover-ZeQKmyEb.mjs.map} +1 -1
  147. package/dist/popover.cjs.js +1 -1
  148. package/dist/popover.es.js +1 -1
  149. package/dist/{product-card-rfpJbzzV.mjs → product-card-BU1ThhCx.mjs} +12 -12
  150. package/dist/{product-card-rfpJbzzV.mjs.map → product-card-BU1ThhCx.mjs.map} +1 -1
  151. package/dist/{product-card-DOBHGAa2.js → product-card-CNBegEBW.js} +2 -2
  152. package/dist/{product-card-DOBHGAa2.js.map → product-card-CNBegEBW.js.map} +1 -1
  153. package/dist/product-card.cjs.js +1 -1
  154. package/dist/product-card.es.js +1 -1
  155. package/dist/{promotion-card-BIFOwMrw.js → promotion-card-CXNhskRl.js} +2 -2
  156. package/dist/{promotion-card-BIFOwMrw.js.map → promotion-card-CXNhskRl.js.map} +1 -1
  157. package/dist/{promotion-card-DeyqFnyP.mjs → promotion-card-_bPyVr9t.mjs} +9 -9
  158. package/dist/{promotion-card-DeyqFnyP.mjs.map → promotion-card-_bPyVr9t.mjs.map} +1 -1
  159. package/dist/promotion-card.cjs.js +1 -1
  160. package/dist/promotion-card.es.js +1 -1
  161. package/dist/purpur.css +1 -1
  162. package/dist/{quantity-selector-DPOTlMSq.js → quantity-selector-CjSAaj7d.js} +2 -2
  163. package/dist/{quantity-selector-DPOTlMSq.js.map → quantity-selector-CjSAaj7d.js.map} +1 -1
  164. package/dist/{quantity-selector-_VcZYLjR.mjs → quantity-selector-HvyYSKah.mjs} +5 -5
  165. package/dist/{quantity-selector-_VcZYLjR.mjs.map → quantity-selector-HvyYSKah.mjs.map} +1 -1
  166. package/dist/quantity-selector.cjs.js +1 -1
  167. package/dist/quantity-selector.es.js +1 -1
  168. package/dist/{radio-button-group-CZ_FnVAi.js → radio-button-group-BaFpGAcD.js} +2 -2
  169. package/dist/{radio-button-group-CZ_FnVAi.js.map → radio-button-group-BaFpGAcD.js.map} +1 -1
  170. package/dist/{radio-button-group-BnCPcmSN.mjs → radio-button-group-CFqPsu5A.mjs} +5 -5
  171. package/dist/{radio-button-group-BnCPcmSN.mjs.map → radio-button-group-CFqPsu5A.mjs.map} +1 -1
  172. package/dist/radio-button-group.cjs.js +1 -1
  173. package/dist/radio-button-group.es.js +1 -1
  174. package/dist/{radio-card-group-DkaMcmen.mjs → radio-card-group-BlRZBa-9.mjs} +16 -16
  175. package/dist/{radio-card-group-DkaMcmen.mjs.map → radio-card-group-BlRZBa-9.mjs.map} +1 -1
  176. package/dist/{radio-card-group-BT5pV3tA.js → radio-card-group-sYcfDPJq.js} +2 -2
  177. package/dist/{radio-card-group-BT5pV3tA.js.map → radio-card-group-sYcfDPJq.js.map} +1 -1
  178. package/dist/radio-card-group.cjs.js +1 -1
  179. package/dist/radio-card-group.es.js +1 -1
  180. package/dist/rich-text.cjs.js +1 -1
  181. package/dist/rich-text.es.js +1 -1
  182. package/dist/scss/heading.mixins.scss +1 -1
  183. package/dist/{search-field-DH0xeW_J.mjs → search-field-BOmCVr5b.mjs} +11 -11
  184. package/dist/{search-field-DH0xeW_J.mjs.map → search-field-BOmCVr5b.mjs.map} +1 -1
  185. package/dist/{search-field-CxX4BBcg.js → search-field-CanOlkIY.js} +2 -2
  186. package/dist/{search-field-CxX4BBcg.js.map → search-field-CanOlkIY.js.map} +1 -1
  187. package/dist/search-field.cjs.js +1 -1
  188. package/dist/search-field.es.js +1 -1
  189. package/dist/{stepper-BfIbJwZn.mjs → stepper-D7T0wed7.mjs} +68 -71
  190. package/dist/stepper-D7T0wed7.mjs.map +1 -0
  191. package/dist/stepper-DYjJgEHL.js +2 -0
  192. package/dist/stepper-DYjJgEHL.js.map +1 -0
  193. package/dist/stepper.cjs.js +1 -1
  194. package/dist/stepper.es.js +1 -1
  195. package/dist/{table-DvcpczWf.mjs → table-B4pts_r4.mjs} +181 -179
  196. package/dist/{table-DvcpczWf.mjs.map → table-B4pts_r4.mjs.map} +1 -1
  197. package/dist/{table-BNeo_B1h.js → table-Bv_BISXV.js} +4 -4
  198. package/dist/{table-BNeo_B1h.js.map → table-Bv_BISXV.js.map} +1 -1
  199. package/dist/table.cjs.js +1 -1
  200. package/dist/table.es.js +1 -1
  201. package/dist/tabs-Bye5lgZ1.mjs +424 -0
  202. package/dist/tabs-Bye5lgZ1.mjs.map +1 -0
  203. package/dist/tabs-D-nfZHIA.js +2 -0
  204. package/dist/tabs-D-nfZHIA.js.map +1 -0
  205. package/dist/tabs.cjs.js +1 -1
  206. package/dist/tabs.es.js +1 -1
  207. package/dist/{text-area-Cb9Hm2Z9.mjs → text-area-CpYWt99s.mjs} +3 -3
  208. package/dist/{text-area-Cb9Hm2Z9.mjs.map → text-area-CpYWt99s.mjs.map} +1 -1
  209. package/dist/text-area.es.js +1 -1
  210. package/dist/{text-field-PKAaXO1N.mjs → text-field-5rIuW8gc.mjs} +2 -2
  211. package/dist/{text-field-PKAaXO1N.mjs.map → text-field-5rIuW8gc.mjs.map} +1 -1
  212. package/dist/{text-field-B8a-NKm4.js → text-field-Xt6T3zjO.js} +2 -2
  213. package/dist/{text-field-B8a-NKm4.js.map → text-field-Xt6T3zjO.js.map} +1 -1
  214. package/dist/text-field.cjs.js +1 -1
  215. package/dist/text-field.es.js +1 -1
  216. package/dist/theme.es.js +2 -2
  217. package/dist/{toggle-Cezg5MUc.mjs → toggle-D23x1wWk.mjs} +9 -9
  218. package/dist/{toggle-Cezg5MUc.mjs.map → toggle-D23x1wWk.mjs.map} +1 -1
  219. package/dist/toggle.es.js +1 -1
  220. package/dist/tokens.es.js +3 -3
  221. package/dist/{tooltip-DXi7ikUT.mjs → tooltip-DkwyNxrQ.mjs} +12 -12
  222. package/dist/{tooltip-DXi7ikUT.mjs.map → tooltip-DkwyNxrQ.mjs.map} +1 -1
  223. package/dist/{tooltip-CLQLxoaf.js → tooltip-svlZkXBs.js} +2 -2
  224. package/dist/{tooltip-CLQLxoaf.js.map → tooltip-svlZkXBs.js.map} +1 -1
  225. package/dist/tooltip.cjs.js +1 -1
  226. package/dist/tooltip.es.js +1 -1
  227. package/dist/{useColorScheme-DRQcbSog.mjs → useColorScheme-9rgSgG0N.mjs} +2 -2
  228. package/dist/{useColorScheme-DRQcbSog.mjs.map → useColorScheme-9rgSgG0N.mjs.map} +1 -1
  229. package/dist/{variables-91UvS2rU.mjs → variables-BVgnpUH9.mjs} +253 -253
  230. package/dist/{variables-91UvS2rU.mjs.map → variables-BVgnpUH9.mjs.map} +1 -1
  231. package/dist/{variables-BSsIx39i.mjs → variables-DkCN2x27.mjs} +7 -7
  232. package/dist/{variables-BSsIx39i.mjs.map → variables-DkCN2x27.mjs.map} +1 -1
  233. package/dist/{variables-BUfnQw6H.mjs → variables-Dr3Hsdn-.mjs} +9 -9
  234. package/dist/{variables-BUfnQw6H.mjs.map → variables-Dr3Hsdn-.mjs.map} +1 -1
  235. package/package.json +18 -18
  236. package/scripts/generate.mts +4 -1
  237. package/vite-plugin-generate-components-metadata.js +4 -1
  238. package/dist/button-ChYUPi2k.js +0 -2
  239. package/dist/button-ChYUPi2k.js.map +0 -1
  240. package/dist/button-DBX_tvfJ.mjs +0 -105
  241. package/dist/button-DBX_tvfJ.mjs.map +0 -1
  242. package/dist/date-field-CPiTZqa0.js +0 -2
  243. package/dist/heading-DLCdW6gx.js +0 -2
  244. package/dist/heading-gqtQNo5n.mjs +0 -75
  245. package/dist/stepper-B248FwO-.js +0 -2
  246. package/dist/stepper-B248FwO-.js.map +0 -1
  247. package/dist/stepper-BfIbJwZn.mjs.map +0 -1
  248. package/dist/tabs-CfHd4UQ2.js +0 -2
  249. package/dist/tabs-CfHd4UQ2.js.map +0 -1
  250. package/dist/tabs-CoXMAwMx.mjs +0 -396
  251. package/dist/tabs-CoXMAwMx.mjs.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"file":"modal-C2UQsW-g.mjs","sources":["../../../components/modal/src/modal-content.tsx","../../../components/modal/src/modal-trigger.tsx","../../../components/modal/src/modal.tsx"],"sourcesContent":["import React, { forwardRef, type ReactNode, useCallback, useEffect, useRef, useState } from \"react\";\nimport { Button } from \"@purpur/button\";\nimport type { BaseProps } from \"@purpur/common-types\";\nimport { Heading } from \"@purpur/heading\";\nimport { IconClose } from \"@purpur/icon/close\";\nimport { Paragraph } from \"@purpur/paragraph\";\nimport { VisuallyHidden } from \"@purpur/visually-hidden\";\nimport {\n Close as RadixClose,\n Content as RadixContent,\n Description as RadixDescription,\n Overlay as RadixOverlay,\n Portal as RadixPortal,\n Title as RadixTitle,\n} from \"@radix-ui/react-dialog\";\nimport c from \"classnames/bind\";\n\nimport \"@purpur/notification/styles\";\nimport styles from \"./modal-content.module.scss\";\n\nexport type DefaultProps = Omit<BaseProps, \"children\"> & {\n /**\n * One or several CTA links or buttons\n * */\n actions?: ReactNode;\n children: ReactNode;\n /**\n * An optional accessible description to be announced when the dialog is opened.\n * */\n description?: string;\n /**\n * Prevents the modal from closing on click outside if set to `true`.\n * */\n disableCloseOnClickOutside?: boolean;\n /**\n * Visually hides the description if set to `true`.\n * */\n hideDescription?: boolean;\n /**\n * An optional image to be displayed at the top of the modal.\n * */\n image?: ReactNode;\n /**\n * Provide a Purpur Notification which will render beneath the modal buttons, otherwise leave it undefined.\n * */\n notification?: ReactNode;\n /**\n * Determines whether the button group should be fixed at the bottom or scroll with the content.\n * */\n stickyButtons?: boolean;\n /**\n * An accessible title to be announced when the dialog is opened.\n * */\n title: string;\n /**\n * z-index of the modal\n * */\n zIndex?: number;\n /**\n * Event handler called when focus moves to the trigger after closing.\n * */\n onCloseAutoFocus?: (e: Event) => void;\n};\n\ntype NoCloseButtonProps = {\n /**\n * An accessible label for the close button.\n * */\n closeButtonAriaLabel?: never;\n /**\n * Shows the close button if set to `true`. Must be used in conjunction with `closeButtonAriaLabel`.\n * */\n showCloseButton?: false;\n};\n\ntype CloseButtonProps = {\n /**\n * An accessible label for the close button.\n * */\n closeButtonAriaLabel: string;\n /**\n * Shows the close button if set to `true`. Must be used in conjunction with `closeButtonAriaLabel`.\n * */\n showCloseButton: true;\n};\n\nexport type ModalContentProps = DefaultProps & (CloseButtonProps | NoCloseButtonProps);\n\nconst hasCloseButtonProps = (\n props: CloseButtonProps | NoCloseButtonProps\n): props is CloseButtonProps => (props as CloseButtonProps).showCloseButton === true;\n\nconst cx = c.bind(styles);\nconst rootClassName = \"purpur-modal-content\";\n\nexport const ModalContent = forwardRef<HTMLDivElement, ModalContentProps>(\n (\n {\n [\"data-testid\"]: dataTestId,\n actions,\n children,\n className,\n description,\n disableCloseOnClickOutside,\n hideDescription,\n image,\n stickyButtons = true,\n title,\n notification = undefined,\n zIndex,\n onCloseAutoFocus,\n ...props\n },\n ref\n ) => {\n const { closeButtonAriaLabel, showCloseButton, ...rest } = props;\n const [contentOverflow, setContentOverflow] = useState(false);\n const [scrollbarWidth, setScrollbarWidth] = useState(0);\n const wrapperRef = useRef<HTMLDivElement>(null);\n const wrapperInnerRef = useRef<HTMLDivElement>(null);\n\n const classes = cx(\n rootClassName,\n { [`${rootClassName}--with-image`]: !!image },\n { [`${rootClassName}--overflow`]: contentOverflow },\n { [`${rootClassName}--sticky-footer`]: stickyButtons },\n className\n );\n\n const getTestId = (id: string) => (dataTestId ? `${dataTestId} ${id}` : undefined);\n\n const handlePointerDownOutside = (event: CustomEvent<{ originalEvent: PointerEvent }>) => {\n if (disableCloseOnClickOutside) {\n event.preventDefault();\n }\n };\n\n const handleContentOverflow = useCallback(() => {\n if (!wrapperRef.current || !wrapperInnerRef.current) {\n return;\n }\n\n const computedStyle = window.getComputedStyle(wrapperRef.current, null);\n const wrapperHeight = parseFloat(computedStyle.getPropertyValue(\"height\"));\n const innerHeight = wrapperInnerRef.current.offsetHeight;\n\n setContentOverflow(wrapperHeight < innerHeight);\n\n setScrollbarWidth(\n (wrapperRef.current.offsetWidth ?? 0) - (wrapperRef.current.clientWidth ?? 0)\n );\n }, []);\n\n const handleInitialFocus = () => {\n const frame = wrapperInnerRef.current;\n if (frame) {\n const heading = frame.querySelector(\"h2\");\n\n heading &&\n setTimeout(() => {\n heading.focus();\n });\n }\n };\n\n const handleEscapeKeyDown = (event: KeyboardEvent) => {\n if (disableCloseOnClickOutside && !showCloseButton) {\n event.preventDefault();\n }\n };\n\n useEffect(() => {\n window.addEventListener(\"resize\", handleContentOverflow);\n\n return () => {\n window.removeEventListener(\"resize\", handleContentOverflow);\n };\n }, [handleContentOverflow]);\n\n useEffect(() => {\n handleContentOverflow();\n }, [notification, children, handleContentOverflow]);\n\n return (\n <RadixPortal>\n <RadixOverlay className={cx(`${rootClassName}__overlay`)} style={{ zIndex }} />\n <RadixContent\n {...rest}\n className={classes}\n data-testid={dataTestId}\n ref={ref}\n {...(!description && { [\"aria-describedby\"]: undefined })}\n onPointerDownOutside={handlePointerDownOutside}\n onOpenAutoFocus={() => {\n handleContentOverflow();\n handleInitialFocus();\n }}\n onEscapeKeyDown={handleEscapeKeyDown}\n onCloseAutoFocus={onCloseAutoFocus}\n style={{ zIndex: `calc(${zIndex} + 1)` }}\n >\n <div ref={wrapperRef} className={cx(`${rootClassName}__wrapper`)}>\n {hasCloseButtonProps(props) && closeButtonAriaLabel && image && (\n <CloseButton\n aria-label={closeButtonAriaLabel}\n hasImage\n scrollbarWidth={scrollbarWidth}\n data-testid={getTestId(\"close-button\")}\n />\n )}\n <div ref={wrapperInnerRef} className={cx(`${rootClassName}__wrapper-inner`)}>\n <div className={cx(`${rootClassName}__header`)}>\n {hasCloseButtonProps(props) && closeButtonAriaLabel && !image && (\n <CloseButton\n aria-label={closeButtonAriaLabel}\n data-testid={getTestId(\"close-button\")}\n />\n )}\n <RadixTitle\n asChild\n className={cx(`${rootClassName}__title`)}\n data-testid={getTestId(\"title\")}\n >\n <Heading tag=\"h2\" variant=\"title-200\" tabIndex={-1}>\n {title}\n </Heading>\n </RadixTitle>\n </div>\n {image && (\n <div\n className={cx(`${rootClassName}__image-wrapper`)}\n data-testid={getTestId(\"image\")}\n >\n {image}\n </div>\n )}\n <div className={cx(`${rootClassName}__body`)}>\n <div className={cx(`${rootClassName}__body-inner`)}>\n {description && hideDescription && (\n <VisuallyHidden asChild>\n <RadixDescription data-testid={getTestId(\"description\")}>\n {description}\n </RadixDescription>\n </VisuallyHidden>\n )}\n {description && !hideDescription && (\n <RadixDescription\n asChild\n className={cx(`${rootClassName}__description`)}\n data-testid={getTestId(\"description\")}\n >\n <Paragraph variant=\"paragraph-100\">{description}</Paragraph>\n </RadixDescription>\n )}\n <div>{children}</div>\n {!stickyButtons && <ModalActions actions={actions} notification={notification} />}\n </div>\n </div>\n </div>\n </div>\n\n {stickyButtons && <ModalActions actions={actions} notification={notification} />}\n </RadixContent>\n </RadixPortal>\n );\n }\n);\n\nconst CloseButton = ({\n [\"aria-label\"]: ariaLabel,\n hasImage,\n scrollbarWidth,\n [\"data-testid\"]: dataTestId,\n}: {\n [\"aria-label\"]: string;\n hasImage?: boolean;\n scrollbarWidth?: number;\n [\"data-testid\"]?: string;\n}) => (\n <RadixClose asChild>\n <Button\n variant={hasImage ? \"primary\" : \"tertiary-purple\"}\n negative={hasImage}\n size=\"sm\"\n iconOnly\n aria-label={ariaLabel}\n className={cx(`${rootClassName}__close-button`)}\n style={{ right: `calc(var(--purpur-spacing-100) + ${scrollbarWidth || 0}px)` }}\n data-testid={dataTestId}\n >\n <IconClose />\n </Button>\n </RadixClose>\n);\n\nexport const MAX_NUMBER_OF_ACTIONS = 3;\n\nexport const ModalActions = ({\n actions,\n notification,\n}: Pick<ModalContentProps, \"actions\" | \"notification\">) => {\n const notificationRef = useRef<HTMLDivElement>(null);\n\n useEffect(() => {\n if (notification) {\n notificationRef?.current?.scrollIntoView?.(false);\n }\n }, [notification]);\n\n return actions ? (\n <div className={cx(`${rootClassName}__actions`)}>\n <div className={cx(`${rootClassName}__actions-buttons`)} data-testid=\"modal actions\">\n {actions}\n </div>\n {notification && (\n <div className={cx(`${rootClassName}__notification`)} ref={notificationRef}>\n {notification}\n </div>\n )}\n <span className={cx(`${rootClassName}__actions-separator`)} />\n </div>\n ) : null;\n};\n","import React, { forwardRef, type ReactNode } from \"react\";\nimport type { BaseProps } from \"@purpur/common-types\";\nimport { Trigger as RadixTrigger } from \"@radix-ui/react-dialog\";\n\nexport type ModalTriggerProps = Omit<BaseProps<\"button\">, \"children\"> & {\n children: ReactNode;\n};\n\nexport const ModalTrigger = forwardRef<HTMLButtonElement, ModalTriggerProps>(\n ({ children, ...props }, ref) => {\n return (\n <RadixTrigger asChild ref={ref} {...props}>\n {children}\n </RadixTrigger>\n );\n }\n);\n","import React, { type ReactNode } from \"react\";\nimport { Root as RadixRoot } from \"@radix-ui/react-dialog\";\n\nimport { ModalContent } from \"./modal-content\";\nimport { ModalTrigger } from \"./modal-trigger\";\n\nexport type ModalProps = {\n [\"data-testid\"]?: string;\n children: ReactNode;\n /**\n * Event handler called when the open state of the dialog changes.\n * */\n onOpenChange?: (value: boolean) => void;\n /**\n * The controlled open state of the dialog. Must be used in conjunction with `onOpenChange`.\n * */\n open?: boolean;\n};\n\nexport const Modal = ({\n [\"data-testid\"]: dataTestId,\n children,\n open,\n onOpenChange,\n}: ModalProps) => (\n <RadixRoot open={open} onOpenChange={onOpenChange} data-testid={dataTestId}>\n {children}\n </RadixRoot>\n);\n\nModal.Trigger = ModalTrigger;\nModal.Content = ModalContent;\n\nModal.displayName = \"Modal\";\n"],"names":["hasCloseButtonProps","props","cx","c","styles","rootClassName","ModalContent","forwardRef","dataTestId","actions","children","className","description","disableCloseOnClickOutside","hideDescription","image","stickyButtons","title","notification","zIndex","onCloseAutoFocus","ref","closeButtonAriaLabel","showCloseButton","rest","contentOverflow","setContentOverflow","useState","scrollbarWidth","setScrollbarWidth","wrapperRef","useRef","wrapperInnerRef","classes","getTestId","id","handlePointerDownOutside","event","handleContentOverflow","useCallback","computedStyle","wrapperHeight","innerHeight","handleInitialFocus","frame","heading","handleEscapeKeyDown","useEffect","RadixPortal","jsx","RadixOverlay","jsxs","RadixContent","CloseButton","RadixTitle","Heading","VisuallyHidden","RadixDescription","Paragraph","ModalActions","ariaLabel","hasImage","RadixClose","Button","IconClose","notificationRef","ModalTrigger","RadixTrigger","Modal","open","onOpenChange","RadixRoot"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAwFMA,IAAsB,CAC1BC,MAC+BA,EAA2B,oBAAoB,IAE1EC,IAAKC,GAAE,KAAKC,EAAM,GAClBC,IAAgB,wBAETC,KAAeC;AAAA,EAC1B,CACE;AAAA,IACE,CAAC,gBAAgBC;AAAA,IACjB,SAAAC;AAAA,IACA,UAAAC;AAAA,IACA,WAAAC;AAAA,IACA,aAAAC;AAAA,IACA,4BAAAC;AAAA,IACA,iBAAAC;AAAA,IACA,OAAAC;AAAA,IAC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Y,CAAC,GAEVT,sBACJ,OAAA,EAAI,WAAWP,EAAG,GAAGG,CAAa,WAAW,GAC5C,UAAA;AAAA,IAAA,gBAAA4C,EAAC,OAAA,EAAI,WAAW/C,EAAG,GAAGG,CAAa,mBAAmB,GAAG,eAAY,iBAClE,UAAAI,EAAA,CACH;AAAA,IACCS,KACC,gBAAA+B,EAAC,OAAA,EAAI,WAAW/C,EAAG,GAAGG,CAAa,gBAAgB,GAAG,KAAK4D,GACxD,UAAA/C,EAAA,CACH;AAAA,sBAED,QAAA,EAAK,WAAWhB,EAAG,GAAGG,CAAa,qBAAqB,EAAA,CAAG;AAAA,EAAA,EAAA,CAC9D,IACE;AACN,GC1Ta6D,KAAe3D;AAAA,EAC1B,CAAC,EAAE,UAAAG,GAAU,GAAGT,EAAA,GAASoB,wBAEpB8C,GAAA,EAAa,SAAO,IAAC,KAAA9C,GAAW,GAAGpB,GACjC,UAAAS,GACH;AAGN,GCGa0D,IAAQ,CAAC;AAAA,EACpB,CAAC,gBAAgB5D;AAAA,EACjB,UAAAE;AAAA,EACA,MAAA2D;AAAA,EACA,cAAAC;AACF,wBACGC,GAAA,EAAU,MAAAF,GAAY,cAAAC,GAA4B,eAAa9D,GAC7D,UAAAE,EAAA,CACH;AAGF0D,EAAM,UAAUF;AAChBE,EAAM,UAAU9D;AAEhB8D,EAAM,cAAc;"}
1
+ {"version":3,"file":"modal-2ymCXTup.mjs","sources":["../../../components/modal/src/modal-content.tsx","../../../components/modal/src/modal-trigger.tsx","../../../components/modal/src/modal.tsx"],"sourcesContent":["import React, { forwardRef, type ReactNode, useCallback, useEffect, useRef, useState } from \"react\";\nimport { Button } from \"@purpur/button\";\nimport type { BaseProps } from \"@purpur/common-types\";\nimport { Heading } from \"@purpur/heading\";\nimport { IconClose } from \"@purpur/icon/close\";\nimport { Paragraph } from \"@purpur/paragraph\";\nimport { VisuallyHidden } from \"@purpur/visually-hidden\";\nimport {\n Close as RadixClose,\n Content as RadixContent,\n Description as RadixDescription,\n Overlay as RadixOverlay,\n Portal as RadixPortal,\n Title as RadixTitle,\n} from \"@radix-ui/react-dialog\";\nimport c from \"classnames/bind\";\n\nimport \"@purpur/notification/styles\";\nimport styles from \"./modal-content.module.scss\";\n\nexport type DefaultProps = Omit<BaseProps, \"children\"> & {\n /**\n * One or several CTA links or buttons\n * */\n actions?: ReactNode;\n children: ReactNode;\n /**\n * An optional accessible description to be announced when the dialog is opened.\n * */\n description?: string;\n /**\n * Prevents the modal from closing on click outside if set to `true`.\n * */\n disableCloseOnClickOutside?: boolean;\n /**\n * Visually hides the description if set to `true`.\n * */\n hideDescription?: boolean;\n /**\n * An optional image to be displayed at the top of the modal.\n * */\n image?: ReactNode;\n /**\n * Provide a Purpur Notification which will render beneath the modal buttons, otherwise leave it undefined.\n * */\n notification?: ReactNode;\n /**\n * Determines whether the button group should be fixed at the bottom or scroll with the content.\n * */\n stickyButtons?: boolean;\n /**\n * An accessible title to be announced when the dialog is opened.\n * */\n title: string;\n /**\n * z-index of the modal\n * */\n zIndex?: number;\n /**\n * Event handler called when focus moves to the trigger after closing.\n * */\n onCloseAutoFocus?: (e: Event) => void;\n};\n\ntype NoCloseButtonProps = {\n /**\n * An accessible label for the close button.\n * */\n closeButtonAriaLabel?: never;\n /**\n * Shows the close button if set to `true`. Must be used in conjunction with `closeButtonAriaLabel`.\n * */\n showCloseButton?: false;\n};\n\ntype CloseButtonProps = {\n /**\n * An accessible label for the close button.\n * */\n closeButtonAriaLabel: string;\n /**\n * Shows the close button if set to `true`. Must be used in conjunction with `closeButtonAriaLabel`.\n * */\n showCloseButton: true;\n};\n\nexport type ModalContentProps = DefaultProps & (CloseButtonProps | NoCloseButtonProps);\n\nconst hasCloseButtonProps = (\n props: CloseButtonProps | NoCloseButtonProps\n): props is CloseButtonProps => (props as CloseButtonProps).showCloseButton === true;\n\nconst cx = c.bind(styles);\nconst rootClassName = \"purpur-modal-content\";\n\nexport const ModalContent = forwardRef<HTMLDivElement, ModalContentProps>(\n (\n {\n [\"data-testid\"]: dataTestId,\n actions,\n children,\n className,\n description,\n disableCloseOnClickOutside,\n hideDescription,\n image,\n stickyButtons = true,\n title,\n notification = undefined,\n zIndex,\n onCloseAutoFocus,\n ...props\n },\n ref\n ) => {\n const { closeButtonAriaLabel, showCloseButton, ...rest } = props;\n const [contentOverflow, setContentOverflow] = useState(false);\n const [scrollbarWidth, setScrollbarWidth] = useState(0);\n const wrapperRef = useRef<HTMLDivElement>(null);\n const wrapperInnerRef = useRef<HTMLDivElement>(null);\n\n const classes = cx(\n rootClassName,\n { [`${rootClassName}--with-image`]: !!image },\n { [`${rootClassName}--overflow`]: contentOverflow },\n { [`${rootClassName}--sticky-footer`]: stickyButtons },\n className\n );\n\n const getTestId = (id: string) => (dataTestId ? `${dataTestId} ${id}` : undefined);\n\n const handlePointerDownOutside = (event: CustomEvent<{ originalEvent: PointerEvent }>) => {\n if (disableCloseOnClickOutside) {\n event.preventDefault();\n }\n };\n\n const handleContentOverflow = useCallback(() => {\n if (!wrapperRef.current || !wrapperInnerRef.current) {\n return;\n }\n\n const computedStyle = window.getComputedStyle(wrapperRef.current, null);\n const wrapperHeight = parseFloat(computedStyle.getPropertyValue(\"height\"));\n const innerHeight = wrapperInnerRef.current.offsetHeight;\n\n setContentOverflow(wrapperHeight < innerHeight);\n\n setScrollbarWidth(\n (wrapperRef.current.offsetWidth ?? 0) - (wrapperRef.current.clientWidth ?? 0)\n );\n }, []);\n\n const handleInitialFocus = () => {\n const frame = wrapperInnerRef.current;\n if (frame) {\n const heading = frame.querySelector(\"h2\");\n\n heading &&\n setTimeout(() => {\n heading.focus();\n });\n }\n };\n\n const handleEscapeKeyDown = (event: KeyboardEvent) => {\n if (disableCloseOnClickOutside && !showCloseButton) {\n event.preventDefault();\n }\n };\n\n useEffect(() => {\n window.addEventListener(\"resize\", handleContentOverflow);\n\n return () => {\n window.removeEventListener(\"resize\", handleContentOverflow);\n };\n }, [handleContentOverflow]);\n\n useEffect(() => {\n handleContentOverflow();\n }, [notification, children, handleContentOverflow]);\n\n return (\n <RadixPortal>\n <RadixOverlay className={cx(`${rootClassName}__overlay`)} style={{ zIndex }} />\n <RadixContent\n {...rest}\n className={classes}\n data-testid={dataTestId}\n ref={ref}\n {...(!description && { [\"aria-describedby\"]: undefined })}\n onPointerDownOutside={handlePointerDownOutside}\n onOpenAutoFocus={() => {\n handleContentOverflow();\n handleInitialFocus();\n }}\n onEscapeKeyDown={handleEscapeKeyDown}\n onCloseAutoFocus={onCloseAutoFocus}\n style={{ zIndex: `calc(${zIndex} + 1)` }}\n >\n <div ref={wrapperRef} className={cx(`${rootClassName}__wrapper`)}>\n {hasCloseButtonProps(props) && closeButtonAriaLabel && image && (\n <CloseButton\n aria-label={closeButtonAriaLabel}\n hasImage\n scrollbarWidth={scrollbarWidth}\n data-testid={getTestId(\"close-button\")}\n />\n )}\n <div ref={wrapperInnerRef} className={cx(`${rootClassName}__wrapper-inner`)}>\n <div className={cx(`${rootClassName}__header`)}>\n {hasCloseButtonProps(props) && closeButtonAriaLabel && !image && (\n <CloseButton\n aria-label={closeButtonAriaLabel}\n data-testid={getTestId(\"close-button\")}\n />\n )}\n <RadixTitle\n asChild\n className={cx(`${rootClassName}__title`)}\n data-testid={getTestId(\"title\")}\n >\n <Heading tag=\"h2\" variant=\"title-200\" tabIndex={-1}>\n {title}\n </Heading>\n </RadixTitle>\n </div>\n {image && (\n <div\n className={cx(`${rootClassName}__image-wrapper`)}\n data-testid={getTestId(\"image\")}\n >\n {image}\n </div>\n )}\n <div className={cx(`${rootClassName}__body`)}>\n <div className={cx(`${rootClassName}__body-inner`)}>\n {description && hideDescription && (\n <VisuallyHidden asChild>\n <RadixDescription data-testid={getTestId(\"description\")}>\n {description}\n </RadixDescription>\n </VisuallyHidden>\n )}\n {description && !hideDescription && (\n <RadixDescription\n asChild\n className={cx(`${rootClassName}__description`)}\n data-testid={getTestId(\"description\")}\n >\n <Paragraph variant=\"paragraph-100\">{description}</Paragraph>\n </RadixDescription>\n )}\n <div>{children}</div>\n {!stickyButtons && <ModalActions actions={actions} notification={notification} />}\n </div>\n </div>\n </div>\n </div>\n\n {stickyButtons && <ModalActions actions={actions} notification={notification} />}\n </RadixContent>\n </RadixPortal>\n );\n }\n);\n\nconst CloseButton = ({\n [\"aria-label\"]: ariaLabel,\n hasImage,\n scrollbarWidth,\n [\"data-testid\"]: dataTestId,\n}: {\n [\"aria-label\"]: string;\n hasImage?: boolean;\n scrollbarWidth?: number;\n [\"data-testid\"]?: string;\n}) => (\n <RadixClose asChild>\n <Button\n variant={hasImage ? \"primary\" : \"tertiary-purple\"}\n negative={hasImage}\n size=\"sm\"\n iconOnly\n aria-label={ariaLabel}\n className={cx(`${rootClassName}__close-button`)}\n style={{ right: `calc(var(--purpur-spacing-100) + ${scrollbarWidth || 0}px)` }}\n data-testid={dataTestId}\n >\n <IconClose />\n </Button>\n </RadixClose>\n);\n\nexport const MAX_NUMBER_OF_ACTIONS = 3;\n\nexport const ModalActions = ({\n actions,\n notification,\n}: Pick<ModalContentProps, \"actions\" | \"notification\">) => {\n const notificationRef = useRef<HTMLDivElement>(null);\n\n useEffect(() => {\n if (notification) {\n notificationRef?.current?.scrollIntoView?.(false);\n }\n }, [notification]);\n\n return actions ? (\n <div className={cx(`${rootClassName}__actions`)}>\n <div className={cx(`${rootClassName}__actions-buttons`)} data-testid=\"modal actions\">\n {actions}\n </div>\n {notification && (\n <div className={cx(`${rootClassName}__notification`)} ref={notificationRef}>\n {notification}\n </div>\n )}\n <span className={cx(`${rootClassName}__actions-separator`)} />\n </div>\n ) : null;\n};\n","import React, { forwardRef, type ReactNode } from \"react\";\nimport type { BaseProps } from \"@purpur/common-types\";\nimport { Trigger as RadixTrigger } from \"@radix-ui/react-dialog\";\n\nexport type ModalTriggerProps = Omit<BaseProps<\"button\">, \"children\"> & {\n children: ReactNode;\n};\n\nexport const ModalTrigger = forwardRef<HTMLButtonElement, ModalTriggerProps>(\n ({ children, ...props }, ref) => {\n return (\n <RadixTrigger asChild ref={ref} {...props}>\n {children}\n </RadixTrigger>\n );\n }\n);\n","import React, { type ReactNode } from \"react\";\nimport { Root as RadixRoot } from \"@radix-ui/react-dialog\";\n\nimport { ModalContent } from \"./modal-content\";\nimport { ModalTrigger } from \"./modal-trigger\";\n\nexport type ModalProps = {\n [\"data-testid\"]?: string;\n children: ReactNode;\n /**\n * Event handler called when the open state of the dialog changes.\n * */\n onOpenChange?: (value: boolean) => void;\n /**\n * The controlled open state of the dialog. Must be used in conjunction with `onOpenChange`.\n * */\n open?: boolean;\n};\n\nexport const Modal = ({\n [\"data-testid\"]: dataTestId,\n children,\n open,\n onOpenChange,\n}: ModalProps) => (\n <RadixRoot open={open} onOpenChange={onOpenChange} data-testid={dataTestId}>\n {children}\n </RadixRoot>\n);\n\nModal.Trigger = ModalTrigger;\nModal.Content = ModalContent;\n\nModal.displayName = \"Modal\";\n"],"names":["hasCloseButtonProps","props","cx","c","styles","rootClassName","ModalContent","forwardRef","dataTestId","actions","children","className","description","disableCloseOnClickOutside","hideDescription","image","stickyButtons","title","notification","zIndex","onCloseAutoFocus","ref","closeButtonAriaLabel","showCloseButton","rest","contentOverflow","setContentOverflow","useState","scrollbarWidth","setScrollbarWidth","wrapperRef","useRef","wrapperInnerRef","classes","getTestId","id","handlePointerDownOutside","event","handleContentOverflow","useCallback","computedStyle","wrapperHeight","innerHeight","handleInitialFocus","frame","heading","handleEscapeKeyDown","useEffect","RadixPortal","jsx","RadixOverlay","jsxs","RadixContent","CloseButton","RadixTitle","Heading","VisuallyHidden","RadixDescription","Paragraph","ModalActions","ariaLabel","hasImage","RadixClose","Button","IconClose","notificationRef","ModalTrigger","RadixTrigger","Modal","open","onOpenChange","RadixRoot"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAwFMA,IAAsB,CAC1BC,MAC+BA,EAA2B,oBAAoB,IAE1EC,IAAKC,GAAE,KAAKC,EAAM,GAClBC,IAAgB,wBAETC,KAAeC;AAAA,EAC1B,CACE;AAAA,IAC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AACF,MAA2D;AACzD,QAAM+C,IAAkBlC,EAAuB,IAAI;AAEnD,SAAAgB,EAAU,MAAM;AACd,IAAI7B,KACF+C,GAAiB,SAAS,iBAAiB,EAAK;AAAA,EAEpD,GAAG,CAAC/C,CAAY,CAAC,GAEVT,sBACJ,OAAA,EAAI,WAAWP,EAAG,GAAGG,CAAa,WAAW,GAC5C,UAAA;AAAA,IAAA,gBAAA4C,EAAC,OAAA,EAAI,WAAW/C,EAAG,GAAGG,CAAa,mBAAmB,GAAG,eAAY,iBAClE,UAAAI,EAAA,CACH;AAAA,IACCS,KACC,gBAAA+B,EAAC,OAAA,EAAI,WAAW/C,EAAG,GAAGG,CAAa,gBAAgB,GAAG,KAAK4D,GACxD,UAAA/C,EAAA,CACH;AAAA,sBAED,QAAA,EAAK,WAAWhB,EAAG,GAAGG,CAAa,qBAAqB,EAAA,CAAG;AAAA,EAAA,EAAA,CAC9D,IACE;AACN,GC1Ta6D,KAAe3D;AAAA,EAC1B,CAAC,EAAE,UAAAG,GAAU,GAAGT,EAAA,GAASoB,wBAEpB8C,GAAA,EAAa,SAAO,IAAC,KAAA9C,GAAW,GAAGpB,GACjC,UAAAS,GACH;AAGN,GCGa0D,IAAQ,CAAC;AAAA,EACpB,CAAC,gBAAgB5D;AAAA,EACjB,UAAAE;AAAA,EACA,MAAA2D;AAAA,EACA,cAAAC;AACF,wBACGC,GAAA,EAAU,MAAAF,GAAY,cAAAC,GAA4B,eAAa9D,GAC7D,UAAAE,EAAA,CACH;AAGF0D,EAAM,UAAUF;AAChBE,EAAM,UAAU9D;AAEhB8D,EAAM,cAAc;"}
@@ -1,2 +1,2 @@
1
- "use strict";const e=require("react/jsx-runtime"),d=require("./index-2cFVyGXq.js"),a=require("react"),F=require("./button-ChYUPi2k.js"),L=require("./heading-DLCdW6gx.js"),U=require("./close.es-VL3lKi1O.js"),V=require("./paragraph-BsI53OR0.js"),K=require("./visually-hidden-C2CKovZx.js"),k=require("./bind-DeUYJ6m9.js"),G="_fadeIn_slvdi_1",J="_fadeOut_slvdi_1",Q="_slideUp_slvdi_1",X="_slideDown_slvdi_1",Y={"purpur-modal-content":"_purpur-modal-content_slvdi_1",fadeIn:G,fadeOut:J,slideUp:Q,slideDown:X,"purpur-modal-content__overlay":"_purpur-modal-content__overlay_slvdi_49","purpur-modal-content__close-button":"_purpur-modal-content__close-button_slvdi_65","purpur-modal-content__wrapper":"_purpur-modal-content__wrapper_slvdi_75","purpur-modal-content__wrapper-inner":"_purpur-modal-content__wrapper-inner_slvdi_85","purpur-modal-content__image-wrapper":"_purpur-modal-content__image-wrapper_slvdi_89","purpur-modal-content__header":"_purpur-modal-content__header_slvdi_112","purpur-modal-content__title":"_purpur-modal-content__title_slvdi_125","purpur-modal-content__description":"_purpur-modal-content__description_slvdi_128","purpur-modal-content__body":"_purpur-modal-content__body_slvdi_131","purpur-modal-content__body-inner":"_purpur-modal-content__body-inner_slvdi_139","purpur-modal-content__actions-buttons":"_purpur-modal-content__actions-buttons_slvdi_151","purpur-modal-content__notification":"_purpur-modal-content__notification_slvdi_169","purpur-modal-content--with-image":"_purpur-modal-content--with-image_slvdi_172","purpur-modal-content--overflow":"_purpur-modal-content--overflow_slvdi_172","purpur-modal-content__actions":"_purpur-modal-content__actions_slvdi_151","purpur-modal-content__actions-separator":"_purpur-modal-content__actions-separator_slvdi_203","purpur-modal-content--sticky-footer":"_purpur-modal-content--sticky-footer_slvdi_213"},N=n=>n.showCloseButton===!0,r=k.c.bind(Y),t="purpur-modal-content",Z=a.forwardRef(({["data-testid"]:n,actions:o,children:s,className:u,description:_,disableCloseOnClickOutside:b,hideDescription:g,image:p,stickyButtons:x=!0,title:q,notification:j=void 0,zIndex:$,onCloseAutoFocus:D,...y},O)=>{const{closeButtonAriaLabel:v,showCloseButton:E,...H}=y,[I,M]=a.useState(!1),[P,S]=a.useState(0),m=a.useRef(null),h=a.useRef(null),B=r(t,{[`${t}--with-image`]:!!p},{[`${t}--overflow`]:I},{[`${t}--sticky-footer`]:x},u),i=l=>n?`${n} ${l}`:void 0,T=l=>{b&&l.preventDefault()},c=a.useCallback(()=>{if(!m.current||!h.current)return;const l=window.getComputedStyle(m.current,null),f=parseFloat(l.getPropertyValue("height")),A=h.current.offsetHeight;M(f<A),S((m.current.offsetWidth??0)-(m.current.clientWidth??0))},[]),W=()=>{const l=h.current;if(l){const f=l.querySelector("h2");f&&setTimeout(()=>{f.focus()})}},z=l=>{b&&!E&&l.preventDefault()};return a.useEffect(()=>(window.addEventListener("resize",c),()=>{window.removeEventListener("resize",c)}),[c]),a.useEffect(()=>{c()},[j,s,c]),e.jsxs(d.Portal,{children:[e.jsx(d.Overlay,{className:r(`${t}__overlay`),style:{zIndex:$}}),e.jsxs(d.Content,{...H,className:B,"data-testid":n,ref:O,...!_&&{"aria-describedby":void 0},onPointerDownOutside:T,onOpenAutoFocus:()=>{c(),W()},onEscapeKeyDown:z,onCloseAutoFocus:D,style:{zIndex:`calc(${$} + 1)`},children:[e.jsxs("div",{ref:m,className:r(`${t}__wrapper`),children:[N(y)&&v&&p&&e.jsx(C,{"aria-label":v,hasImage:!0,scrollbarWidth:P,"data-testid":i("close-button")}),e.jsxs("div",{ref:h,className:r(`${t}__wrapper-inner`),children:[e.jsxs("div",{className:r(`${t}__header`),children:[N(y)&&v&&!p&&e.jsx(C,{"aria-label":v,"data-testid":i("close-button")}),e.jsx(d.Title,{asChild:!0,className:r(`${t}__title`),"data-testid":i("title"),children:e.jsx(L.Heading,{tag:"h2",variant:"title-200",tabIndex:-1,children:q})})]}),p&&e.jsx("div",{className:r(`${t}__image-wrapper`),"data-testid":i("image"),children:p}),e.jsx("div",{className:r(`${t}__body`),children:e.jsxs("div",{className:r(`${t}__body-inner`),children:[_&&g&&e.jsx(K.VisuallyHidden,{asChild:!0,children:e.jsx(d.Description,{"data-testid":i("description"),children:_})}),_&&!g&&e.jsx(d.Description,{asChild:!0,className:r(`${t}__description`),"data-testid":i("description"),children:e.jsx(V.Paragraph,{variant:"paragraph-100",children:_})}),e.jsx("div",{children:s}),!x&&e.jsx(R,{actions:o,notification:j})]})})]})]}),x&&e.jsx(R,{actions:o,notification:j})]})]})}),C=({["aria-label"]:n,hasImage:o,scrollbarWidth:s,["data-testid"]:u})=>e.jsx(d.Close,{asChild:!0,children:e.jsx(F.Button,{variant:o?"primary":"tertiary-purple",negative:o,size:"sm",iconOnly:!0,"aria-label":n,className:r(`${t}__close-button`),style:{right:`calc(var(--purpur-spacing-100) + ${s||0}px)`},"data-testid":u,children:e.jsx(U.r,{})})}),R=({actions:n,notification:o})=>{const s=a.useRef(null);return a.useEffect(()=>{o&&s?.current?.scrollIntoView?.(!1)},[o]),n?e.jsxs("div",{className:r(`${t}__actions`),children:[e.jsx("div",{className:r(`${t}__actions-buttons`),"data-testid":"modal actions",children:n}),o&&e.jsx("div",{className:r(`${t}__notification`),ref:s,children:o}),e.jsx("span",{className:r(`${t}__actions-separator`)})]}):null},ee=a.forwardRef(({children:n,...o},s)=>e.jsx(d.Trigger,{asChild:!0,ref:s,...o,children:n})),w=({["data-testid"]:n,children:o,open:s,onOpenChange:u})=>e.jsx(d.Root,{open:s,onOpenChange:u,"data-testid":n,children:o});w.Trigger=ee;w.Content=Z;w.displayName="Modal";exports.Modal=w;
2
- //# sourceMappingURL=modal-nyhf5zxG.js.map
1
+ "use strict";const e=require("react/jsx-runtime"),d=require("./index-2cFVyGXq.js"),a=require("react"),F=require("./button-DDYGuqZ0.js"),L=require("./heading-drD5ugCC.js"),U=require("./close.es-VL3lKi1O.js"),V=require("./paragraph-BsI53OR0.js"),K=require("./visually-hidden-C2CKovZx.js"),k=require("./bind-DeUYJ6m9.js"),G="_fadeIn_slvdi_1",J="_fadeOut_slvdi_1",Q="_slideUp_slvdi_1",X="_slideDown_slvdi_1",Y={"purpur-modal-content":"_purpur-modal-content_slvdi_1",fadeIn:G,fadeOut:J,slideUp:Q,slideDown:X,"purpur-modal-content__overlay":"_purpur-modal-content__overlay_slvdi_49","purpur-modal-content__close-button":"_purpur-modal-content__close-button_slvdi_65","purpur-modal-content__wrapper":"_purpur-modal-content__wrapper_slvdi_75","purpur-modal-content__wrapper-inner":"_purpur-modal-content__wrapper-inner_slvdi_85","purpur-modal-content__image-wrapper":"_purpur-modal-content__image-wrapper_slvdi_89","purpur-modal-content__header":"_purpur-modal-content__header_slvdi_112","purpur-modal-content__title":"_purpur-modal-content__title_slvdi_125","purpur-modal-content__description":"_purpur-modal-content__description_slvdi_128","purpur-modal-content__body":"_purpur-modal-content__body_slvdi_131","purpur-modal-content__body-inner":"_purpur-modal-content__body-inner_slvdi_139","purpur-modal-content__actions-buttons":"_purpur-modal-content__actions-buttons_slvdi_151","purpur-modal-content__notification":"_purpur-modal-content__notification_slvdi_169","purpur-modal-content--with-image":"_purpur-modal-content--with-image_slvdi_172","purpur-modal-content--overflow":"_purpur-modal-content--overflow_slvdi_172","purpur-modal-content__actions":"_purpur-modal-content__actions_slvdi_151","purpur-modal-content__actions-separator":"_purpur-modal-content__actions-separator_slvdi_203","purpur-modal-content--sticky-footer":"_purpur-modal-content--sticky-footer_slvdi_213"},N=n=>n.showCloseButton===!0,r=k.c.bind(Y),t="purpur-modal-content",Z=a.forwardRef(({["data-testid"]:n,actions:o,children:s,className:u,description:_,disableCloseOnClickOutside:b,hideDescription:g,image:p,stickyButtons:x=!0,title:q,notification:j=void 0,zIndex:$,onCloseAutoFocus:D,...y},O)=>{const{closeButtonAriaLabel:v,showCloseButton:E,...H}=y,[I,M]=a.useState(!1),[P,S]=a.useState(0),m=a.useRef(null),h=a.useRef(null),B=r(t,{[`${t}--with-image`]:!!p},{[`${t}--overflow`]:I},{[`${t}--sticky-footer`]:x},u),i=l=>n?`${n} ${l}`:void 0,T=l=>{b&&l.preventDefault()},c=a.useCallback(()=>{if(!m.current||!h.current)return;const l=window.getComputedStyle(m.current,null),f=parseFloat(l.getPropertyValue("height")),A=h.current.offsetHeight;M(f<A),S((m.current.offsetWidth??0)-(m.current.clientWidth??0))},[]),W=()=>{const l=h.current;if(l){const f=l.querySelector("h2");f&&setTimeout(()=>{f.focus()})}},z=l=>{b&&!E&&l.preventDefault()};return a.useEffect(()=>(window.addEventListener("resize",c),()=>{window.removeEventListener("resize",c)}),[c]),a.useEffect(()=>{c()},[j,s,c]),e.jsxs(d.Portal,{children:[e.jsx(d.Overlay,{className:r(`${t}__overlay`),style:{zIndex:$}}),e.jsxs(d.Content,{...H,className:B,"data-testid":n,ref:O,...!_&&{"aria-describedby":void 0},onPointerDownOutside:T,onOpenAutoFocus:()=>{c(),W()},onEscapeKeyDown:z,onCloseAutoFocus:D,style:{zIndex:`calc(${$} + 1)`},children:[e.jsxs("div",{ref:m,className:r(`${t}__wrapper`),children:[N(y)&&v&&p&&e.jsx(C,{"aria-label":v,hasImage:!0,scrollbarWidth:P,"data-testid":i("close-button")}),e.jsxs("div",{ref:h,className:r(`${t}__wrapper-inner`),children:[e.jsxs("div",{className:r(`${t}__header`),children:[N(y)&&v&&!p&&e.jsx(C,{"aria-label":v,"data-testid":i("close-button")}),e.jsx(d.Title,{asChild:!0,className:r(`${t}__title`),"data-testid":i("title"),children:e.jsx(L.Heading,{tag:"h2",variant:"title-200",tabIndex:-1,children:q})})]}),p&&e.jsx("div",{className:r(`${t}__image-wrapper`),"data-testid":i("image"),children:p}),e.jsx("div",{className:r(`${t}__body`),children:e.jsxs("div",{className:r(`${t}__body-inner`),children:[_&&g&&e.jsx(K.VisuallyHidden,{asChild:!0,children:e.jsx(d.Description,{"data-testid":i("description"),children:_})}),_&&!g&&e.jsx(d.Description,{asChild:!0,className:r(`${t}__description`),"data-testid":i("description"),children:e.jsx(V.Paragraph,{variant:"paragraph-100",children:_})}),e.jsx("div",{children:s}),!x&&e.jsx(R,{actions:o,notification:j})]})})]})]}),x&&e.jsx(R,{actions:o,notification:j})]})]})}),C=({["aria-label"]:n,hasImage:o,scrollbarWidth:s,["data-testid"]:u})=>e.jsx(d.Close,{asChild:!0,children:e.jsx(F.Button,{variant:o?"primary":"tertiary-purple",negative:o,size:"sm",iconOnly:!0,"aria-label":n,className:r(`${t}__close-button`),style:{right:`calc(var(--purpur-spacing-100) + ${s||0}px)`},"data-testid":u,children:e.jsx(U.r,{})})}),R=({actions:n,notification:o})=>{const s=a.useRef(null);return a.useEffect(()=>{o&&s?.current?.scrollIntoView?.(!1)},[o]),n?e.jsxs("div",{className:r(`${t}__actions`),children:[e.jsx("div",{className:r(`${t}__actions-buttons`),"data-testid":"modal actions",children:n}),o&&e.jsx("div",{className:r(`${t}__notification`),ref:s,children:o}),e.jsx("span",{className:r(`${t}__actions-separator`)})]}):null},ee=a.forwardRef(({children:n,...o},s)=>e.jsx(d.Trigger,{asChild:!0,ref:s,...o,children:n})),w=({["data-testid"]:n,children:o,open:s,onOpenChange:u})=>e.jsx(d.Root,{open:s,onOpenChange:u,"data-testid":n,children:o});w.Trigger=ee;w.Content=Z;w.displayName="Modal";exports.Modal=w;
2
+ //# sourceMappingURL=modal-CXi2xez5.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"modal-nyhf5zxG.js","sources":["../../../components/modal/src/modal-content.tsx","../../../components/modal/src/modal-trigger.tsx","../../../components/modal/src/modal.tsx"],"sourcesContent":["import React, { forwardRef, type ReactNode, useCallback, useEffect, useRef, useState } from \"react\";\nimport { Button } from \"@purpur/button\";\nimport type { BaseProps } from \"@purpur/common-types\";\nimport { Heading } from \"@purpur/heading\";\nimport { IconClose } from \"@purpur/icon/close\";\nimport { Paragraph } from \"@purpur/paragraph\";\nimport { VisuallyHidden } from \"@purpur/visually-hidden\";\nimport {\n Close as RadixClose,\n Content as RadixContent,\n Description as RadixDescription,\n Overlay as RadixOverlay,\n Portal as RadixPortal,\n Title as RadixTitle,\n} from \"@radix-ui/react-dialog\";\nimport c from \"classnames/bind\";\n\nimport \"@purpur/notification/styles\";\nimport styles from \"./modal-content.module.scss\";\n\nexport type DefaultProps = Omit<BaseProps, \"children\"> & {\n /**\n * One or several CTA links or buttons\n * */\n actions?: ReactNode;\n children: ReactNode;\n /**\n * An optional accessible description to be announced when the dialog is opened.\n * */\n description?: string;\n /**\n * Prevents the modal from closing on click outside if set to `true`.\n * */\n disableCloseOnClickOutside?: boolean;\n /**\n * Visually hides the description if set to `true`.\n * */\n hideDescription?: boolean;\n /**\n * An optional image to be displayed at the top of the modal.\n * */\n image?: ReactNode;\n /**\n * Provide a Purpur Notification which will render beneath the modal buttons, otherwise leave it undefined.\n * */\n notification?: ReactNode;\n /**\n * Determines whether the button group should be fixed at the bottom or scroll with the content.\n * */\n stickyButtons?: boolean;\n /**\n * An accessible title to be announced when the dialog is opened.\n * */\n title: string;\n /**\n * z-index of the modal\n * */\n zIndex?: number;\n /**\n * Event handler called when focus moves to the trigger after closing.\n * */\n onCloseAutoFocus?: (e: Event) => void;\n};\n\ntype NoCloseButtonProps = {\n /**\n * An accessible label for the close button.\n * */\n closeButtonAriaLabel?: never;\n /**\n * Shows the close button if set to `true`. Must be used in conjunction with `closeButtonAriaLabel`.\n * */\n showCloseButton?: false;\n};\n\ntype CloseButtonProps = {\n /**\n * An accessible label for the close button.\n * */\n closeButtonAriaLabel: string;\n /**\n * Shows the close button if set to `true`. Must be used in conjunction with `closeButtonAriaLabel`.\n * */\n showCloseButton: true;\n};\n\nexport type ModalContentProps = DefaultProps & (CloseButtonProps | NoCloseButtonProps);\n\nconst hasCloseButtonProps = (\n props: CloseButtonProps | NoCloseButtonProps\n): props is CloseButtonProps => (props as CloseButtonProps).showCloseButton === true;\n\nconst cx = c.bind(styles);\nconst rootClassName = \"purpur-modal-content\";\n\nexport const ModalContent = forwardRef<HTMLDivElement, ModalContentProps>(\n (\n {\n [\"data-testid\"]: dataTestId,\n actions,\n children,\n className,\n description,\n disableCloseOnClickOutside,\n hideDescription,\n image,\n stickyButtons = true,\n title,\n notification = undefined,\n zIndex,\n onCloseAutoFocus,\n ...props\n },\n ref\n ) => {\n const { closeButtonAriaLabel, showCloseButton, ...rest } = props;\n const [contentOverflow, setContentOverflow] = useState(false);\n const [scrollbarWidth, setScrollbarWidth] = useState(0);\n const wrapperRef = useRef<HTMLDivElement>(null);\n const wrapperInnerRef = useRef<HTMLDivElement>(null);\n\n const classes = cx(\n rootClassName,\n { [`${rootClassName}--with-image`]: !!image },\n { [`${rootClassName}--overflow`]: contentOverflow },\n { [`${rootClassName}--sticky-footer`]: stickyButtons },\n className\n );\n\n const getTestId = (id: string) => (dataTestId ? `${dataTestId} ${id}` : undefined);\n\n const handlePointerDownOutside = (event: CustomEvent<{ originalEvent: PointerEvent }>) => {\n if (disableCloseOnClickOutside) {\n event.preventDefault();\n }\n };\n\n const handleContentOverflow = useCallback(() => {\n if (!wrapperRef.current || !wrapperInnerRef.current) {\n return;\n }\n\n const computedStyle = window.getComputedStyle(wrapperRef.current, null);\n const wrapperHeight = parseFloat(computedStyle.getPropertyValue(\"height\"));\n const innerHeight = wrapperInnerRef.current.offsetHeight;\n\n setContentOverflow(wrapperHeight < innerHeight);\n\n setScrollbarWidth(\n (wrapperRef.current.offsetWidth ?? 0) - (wrapperRef.current.clientWidth ?? 0)\n );\n }, []);\n\n const handleInitialFocus = () => {\n const frame = wrapperInnerRef.current;\n if (frame) {\n const heading = frame.querySelector(\"h2\");\n\n heading &&\n setTimeout(() => {\n heading.focus();\n });\n }\n };\n\n const handleEscapeKeyDown = (event: KeyboardEvent) => {\n if (disableCloseOnClickOutside && !showCloseButton) {\n event.preventDefault();\n }\n };\n\n useEffect(() => {\n window.addEventListener(\"resize\", handleContentOverflow);\n\n return () => {\n window.removeEventListener(\"resize\", handleContentOverflow);\n };\n }, [handleContentOverflow]);\n\n useEffect(() => {\n handleContentOverflow();\n }, [notification, children, handleContentOverflow]);\n\n return (\n <RadixPortal>\n <RadixOverlay className={cx(`${rootClassName}__overlay`)} style={{ zIndex }} />\n <RadixContent\n {...rest}\n className={classes}\n data-testid={dataTestId}\n ref={ref}\n {...(!description && { [\"aria-describedby\"]: undefined })}\n onPointerDownOutside={handlePointerDownOutside}\n onOpenAutoFocus={() => {\n handleContentOverflow();\n handleInitialFocus();\n }}\n onEscapeKeyDown={handleEscapeKeyDown}\n onCloseAutoFocus={onCloseAutoFocus}\n style={{ zIndex: `calc(${zIndex} + 1)` }}\n >\n <div ref={wrapperRef} className={cx(`${rootClassName}__wrapper`)}>\n {hasCloseButtonProps(props) && closeButtonAriaLabel && image && (\n <CloseButton\n aria-label={closeButtonAriaLabel}\n hasImage\n scrollbarWidth={scrollbarWidth}\n data-testid={getTestId(\"close-button\")}\n />\n )}\n <div ref={wrapperInnerRef} className={cx(`${rootClassName}__wrapper-inner`)}>\n <div className={cx(`${rootClassName}__header`)}>\n {hasCloseButtonProps(props) && closeButtonAriaLabel && !image && (\n <CloseButton\n aria-label={closeButtonAriaLabel}\n data-testid={getTestId(\"close-button\")}\n />\n )}\n <RadixTitle\n asChild\n className={cx(`${rootClassName}__title`)}\n data-testid={getTestId(\"title\")}\n >\n <Heading tag=\"h2\" variant=\"title-200\" tabIndex={-1}>\n {title}\n </Heading>\n </RadixTitle>\n </div>\n {image && (\n <div\n className={cx(`${rootClassName}__image-wrapper`)}\n data-testid={getTestId(\"image\")}\n >\n {image}\n </div>\n )}\n <div className={cx(`${rootClassName}__body`)}>\n <div className={cx(`${rootClassName}__body-inner`)}>\n {description && hideDescription && (\n <VisuallyHidden asChild>\n <RadixDescription data-testid={getTestId(\"description\")}>\n {description}\n </RadixDescription>\n </VisuallyHidden>\n )}\n {description && !hideDescription && (\n <RadixDescription\n asChild\n className={cx(`${rootClassName}__description`)}\n data-testid={getTestId(\"description\")}\n >\n <Paragraph variant=\"paragraph-100\">{description}</Paragraph>\n </RadixDescription>\n )}\n <div>{children}</div>\n {!stickyButtons && <ModalActions actions={actions} notification={notification} />}\n </div>\n </div>\n </div>\n </div>\n\n {stickyButtons && <ModalActions actions={actions} notification={notification} />}\n </RadixContent>\n </RadixPortal>\n );\n }\n);\n\nconst CloseButton = ({\n [\"aria-label\"]: ariaLabel,\n hasImage,\n scrollbarWidth,\n [\"data-testid\"]: dataTestId,\n}: {\n [\"aria-label\"]: string;\n hasImage?: boolean;\n scrollbarWidth?: number;\n [\"data-testid\"]?: string;\n}) => (\n <RadixClose asChild>\n <Button\n variant={hasImage ? \"primary\" : \"tertiary-purple\"}\n negative={hasImage}\n size=\"sm\"\n iconOnly\n aria-label={ariaLabel}\n className={cx(`${rootClassName}__close-button`)}\n style={{ right: `calc(var(--purpur-spacing-100) + ${scrollbarWidth || 0}px)` }}\n data-testid={dataTestId}\n >\n <IconClose />\n </Button>\n </RadixClose>\n);\n\nexport const MAX_NUMBER_OF_ACTIONS = 3;\n\nexport const ModalActions = ({\n actions,\n notification,\n}: Pick<ModalContentProps, \"actions\" | \"notification\">) => {\n const notificationRef = useRef<HTMLDivElement>(null);\n\n useEffect(() => {\n if (notification) {\n notificationRef?.current?.scrollIntoView?.(false);\n }\n }, [notification]);\n\n return actions ? (\n <div className={cx(`${rootClassName}__actions`)}>\n <div className={cx(`${rootClassName}__actions-buttons`)} data-testid=\"modal actions\">\n {actions}\n </div>\n {notification && (\n <div className={cx(`${rootClassName}__notification`)} ref={notificationRef}>\n {notification}\n </div>\n )}\n <span className={cx(`${rootClassName}__actions-separator`)} />\n </div>\n ) : null;\n};\n","import React, { forwardRef, type ReactNode } from \"react\";\nimport type { BaseProps } from \"@purpur/common-types\";\nimport { Trigger as RadixTrigger } from \"@radix-ui/react-dialog\";\n\nexport type ModalTriggerProps = Omit<BaseProps<\"button\">, \"children\"> & {\n children: ReactNode;\n};\n\nexport const ModalTrigger = forwardRef<HTMLButtonElement, ModalTriggerProps>(\n ({ children, ...props }, ref) => {\n return (\n <RadixTrigger asChild ref={ref} {...props}>\n {children}\n </RadixTrigger>\n );\n }\n);\n","import React, { type ReactNode } from \"react\";\nimport { Root as RadixRoot } from \"@radix-ui/react-dialog\";\n\nimport { ModalContent } from \"./modal-content\";\nimport { ModalTrigger } from \"./modal-trigger\";\n\nexport type ModalProps = {\n [\"data-testid\"]?: string;\n children: ReactNode;\n /**\n * Event handler called when the open state of the dialog changes.\n * */\n onOpenChange?: (value: boolean) => void;\n /**\n * The controlled open state of the dialog. Must be used in conjunction with `onOpenChange`.\n * */\n open?: boolean;\n};\n\nexport const Modal = ({\n [\"data-testid\"]: dataTestId,\n children,\n open,\n onOpenChange,\n}: ModalProps) => (\n <RadixRoot open={open} onOpenChange={onOpenChange} data-testid={dataTestId}>\n {children}\n </RadixRoot>\n);\n\nModal.Trigger = ModalTrigger;\nModal.Content = ModalContent;\n\nModal.displayName = \"Modal\";\n"],"names":["hasCloseButtonProps","props","cx","c","styles","rootClassName","ModalContent","forwardRef","dataTestId","actions","children","className","description","disableCloseOnClickOutside","hideDescription","image","stickyButtons","title","notification","zIndex","onCloseAutoFocus","ref","closeButtonAriaLabel","showCloseButton","rest","contentOverflow","setContentOverflow","useState","scrollbarWidth","setScrollbarWidth","wrapperRef","useRef","wrapperInnerRef","classes","getTestId","id","handlePointerDownOutside","event","handleContentOverflow","useCallback","computedStyle","wrapperHeight","innerHeight","handleInitialFocus","frame","heading","handleEscapeKeyDown","useEffect","RadixPortal","jsx","RadixOverlay","jsxs","RadixContent","CloseButton","RadixTitle","Heading","VisuallyHidden","RadixDescription","Paragraph","ModalActions","ariaLabel","hasImage","RadixClose","Button","IconClose","notificationRef","ModalTrigger","RadixTrigger","Modal","open","onOpenChange","RadixRoot"],"mappings":"o1DAwFMA,EACJC,GAC+BA,EAA2B,kBAAoB,GAE1EC,EAAKC,EAAAA,EAAE,KAAKC,CAAM,EAClBC,EAAgB,uBAETC,EAAeC,EAAAA,WAC1B,CACE,CACE,CAAC,eAAgBC,EACjB,QAAAC,EACA,SAAAC,EACA,UAAAC,EACA,YAAAC,EACA,2BAAAC,EACA,gBAAAC,EACA,MAAAC,EACA,cAAAC,EAAgB,GAChB,MAAAC,EACA,aAAAC,EAAe,OACf,OAAAC,EACA,iBAAAC,EACA,GAAGnB,CAAA,EAELoB,IACG,CACH,KAAM,CAAE,qBAAAC,EAAsB,gBAAAC,EAAiB,GAAGC,GAASvB,EACrD,CAAC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AgB,EAC9C,MAAO,CAAE,MAAO,oCAAoCuB,GAAkB,CAAC,KAAA,EACvE,cAAapB,EAEb,eAACwD,EAAAA,EAAA,CAAA,CAAU,CAAA,CACb,EACF,EAKWL,EAAe,CAAC,CAC3B,QAAAlD,EACA,aAAAS,CACF,IAA2D,CACzD,MAAM+C,EAAkBlC,EAAAA,OAAuB,IAAI,EAEnDgB,OAAAA,EAAAA,UAAU,IAAM,CACV7B,GACF+C,GAAiB,SAAS,iBAAiB,EAAK,CAEpD,EAAG,CAAC/C,CAAY,CAAC,EAEVT,SACJ,MAAA,CAAI,UAAWP,EAAG,GAAGG,CAAa,WAAW,EAC5C,SAAA,CAAA4C,EAAAA,IAAC,MAAA,CAAI,UAAW/C,EAAG,GAAGG,CAAa,mBAAmB,EAAG,cAAY,gBAClE,SAAAI,CAAA,CACH,EACCS,GACC+B,EAAAA,IAAC,MAAA,CAAI,UAAW/C,EAAG,GAAGG,CAAa,gBAAgB,EAAG,IAAK4D,EACxD,SAAA/C,CAAA,CACH,QAED,OAAA,CAAK,UAAWhB,EAAG,GAAGG,CAAa,qBAAqB,CAAA,CAAG,CAAA,CAAA,CAC9D,EACE,IACN,EC1Ta6D,GAAe3D,EAAAA,WAC1B,CAAC,CAAE,SAAAG,EAAU,GAAGT,CAAA,EAASoB,UAEpB8C,EAAAA,QAAA,CAAa,QAAO,GAAC,IAAA9C,EAAW,GAAGpB,EACjC,SAAAS,EACH,CAGN,ECGa0D,EAAQ,CAAC,CACpB,CAAC,eAAgB5D,EACjB,SAAAE,EACA,KAAA2D,EACA,aAAAC,CACF,UACGC,EAAAA,KAAA,CAAU,KAAAF,EAAY,aAAAC,EAA4B,cAAa9D,EAC7D,SAAAE,CAAA,CACH,EAGF0D,EAAM,QAAUF,GAChBE,EAAM,QAAU9D,EAEhB8D,EAAM,YAAc"}
1
+ {"version":3,"file":"modal-CXi2xez5.js","sources":["../../../components/modal/src/modal-content.tsx","../../../components/modal/src/modal-trigger.tsx","../../../components/modal/src/modal.tsx"],"sourcesContent":["import React, { forwardRef, type ReactNode, useCallback, useEffect, useRef, useState } from \"react\";\nimport { Button } from \"@purpur/button\";\nimport type { BaseProps } from \"@purpur/common-types\";\nimport { Heading } from \"@purpur/heading\";\nimport { IconClose } from \"@purpur/icon/close\";\nimport { Paragraph } from \"@purpur/paragraph\";\nimport { VisuallyHidden } from \"@purpur/visually-hidden\";\nimport {\n Close as RadixClose,\n Content as RadixContent,\n Description as RadixDescription,\n Overlay as RadixOverlay,\n Portal as RadixPortal,\n Title as RadixTitle,\n} from \"@radix-ui/react-dialog\";\nimport c from \"classnames/bind\";\n\nimport \"@purpur/notification/styles\";\nimport styles from \"./modal-content.module.scss\";\n\nexport type DefaultProps = Omit<BaseProps, \"children\"> & {\n /**\n * One or several CTA links or buttons\n * */\n actions?: ReactNode;\n children: ReactNode;\n /**\n * An optional accessible description to be announced when the dialog is opened.\n * */\n description?: string;\n /**\n * Prevents the modal from closing on click outside if set to `true`.\n * */\n disableCloseOnClickOutside?: boolean;\n /**\n * Visually hides the description if set to `true`.\n * */\n hideDescription?: boolean;\n /**\n * An optional image to be displayed at the top of the modal.\n * */\n image?: ReactNode;\n /**\n * Provide a Purpur Notification which will render beneath the modal buttons, otherwise leave it undefined.\n * */\n notification?: ReactNode;\n /**\n * Determines whether the button group should be fixed at the bottom or scroll with the content.\n * */\n stickyButtons?: boolean;\n /**\n * An accessible title to be announced when the dialog is opened.\n * */\n title: string;\n /**\n * z-index of the modal\n * */\n zIndex?: number;\n /**\n * Event handler called when focus moves to the trigger after closing.\n * */\n onCloseAutoFocus?: (e: Event) => void;\n};\n\ntype NoCloseButtonProps = {\n /**\n * An accessible label for the close button.\n * */\n closeButtonAriaLabel?: never;\n /**\n * Shows the close button if set to `true`. Must be used in conjunction with `closeButtonAriaLabel`.\n * */\n showCloseButton?: false;\n};\n\ntype CloseButtonProps = {\n /**\n * An accessible label for the close button.\n * */\n closeButtonAriaLabel: string;\n /**\n * Shows the close button if set to `true`. Must be used in conjunction with `closeButtonAriaLabel`.\n * */\n showCloseButton: true;\n};\n\nexport type ModalContentProps = DefaultProps & (CloseButtonProps | NoCloseButtonProps);\n\nconst hasCloseButtonProps = (\n props: CloseButtonProps | NoCloseButtonProps\n): props is CloseButtonProps => (props as CloseButtonProps).showCloseButton === true;\n\nconst cx = c.bind(styles);\nconst rootClassName = \"purpur-modal-content\";\n\nexport const ModalContent = forwardRef<HTMLDivElement, ModalContentProps>(\n (\n {\n [\"data-testid\"]: dataTestId,\n actions,\n children,\n className,\n description,\n disableCloseOnClickOutside,\n hideDescription,\n image,\n stickyButtons = true,\n title,\n notification = undefined,\n zIndex,\n onCloseAutoFocus,\n ...props\n },\n ref\n ) => {\n const { closeButtonAriaLabel, showCloseButton, ...rest } = props;\n const [contentOverflow, setContentOverflow] = useState(false);\n const [scrollbarWidth, setScrollbarWidth] = useState(0);\n const wrapperRef = useRef<HTMLDivElement>(null);\n const wrapperInnerRef = useRef<HTMLDivElement>(null);\n\n const classes = cx(\n rootClassName,\n { [`${rootClassName}--with-image`]: !!image },\n { [`${rootClassName}--overflow`]: contentOverflow },\n { [`${rootClassName}--sticky-footer`]: stickyButtons },\n className\n );\n\n const getTestId = (id: string) => (dataTestId ? `${dataTestId} ${id}` : undefined);\n\n const handlePointerDownOutside = (event: CustomEvent<{ originalEvent: PointerEvent }>) => {\n if (disableCloseOnClickOutside) {\n event.preventDefault();\n }\n };\n\n const handleContentOverflow = useCallback(() => {\n if (!wrapperRef.current || !wrapperInnerRef.current) {\n return;\n }\n\n const computedStyle = window.getComputedStyle(wrapperRef.current, null);\n const wrapperHeight = parseFloat(computedStyle.getPropertyValue(\"height\"));\n const innerHeight = wrapperInnerRef.current.offsetHeight;\n\n setContentOverflow(wrapperHeight < innerHeight);\n\n setScrollbarWidth(\n (wrapperRef.current.offsetWidth ?? 0) - (wrapperRef.current.clientWidth ?? 0)\n );\n }, []);\n\n const handleInitialFocus = () => {\n const frame = wrapperInnerRef.current;\n if (frame) {\n const heading = frame.querySelector(\"h2\");\n\n heading &&\n setTimeout(() => {\n heading.focus();\n });\n }\n };\n\n const handleEscapeKeyDown = (event: KeyboardEvent) => {\n if (disableCloseOnClickOutside && !showCloseButton) {\n event.preventDefault();\n }\n };\n\n useEffect(() => {\n window.addEventListener(\"resize\", handleContentOverflow);\n\n return () => {\n window.removeEventListener(\"resize\", handleContentOverflow);\n };\n }, [handleContentOverflow]);\n\n useEffect(() => {\n handleContentOverflow();\n }, [notification, children, handleContentOverflow]);\n\n return (\n <RadixPortal>\n <RadixOverlay className={cx(`${rootClassName}__overlay`)} style={{ zIndex }} />\n <RadixContent\n {...rest}\n className={classes}\n data-testid={dataTestId}\n ref={ref}\n {...(!description && { [\"aria-describedby\"]: undefined })}\n onPointerDownOutside={handlePointerDownOutside}\n onOpenAutoFocus={() => {\n handleContentOverflow();\n handleInitialFocus();\n }}\n onEscapeKeyDown={handleEscapeKeyDown}\n onCloseAutoFocus={onCloseAutoFocus}\n style={{ zIndex: `calc(${zIndex} + 1)` }}\n >\n <div ref={wrapperRef} className={cx(`${rootClassName}__wrapper`)}>\n {hasCloseButtonProps(props) && closeButtonAriaLabel && image && (\n <CloseButton\n aria-label={closeButtonAriaLabel}\n hasImage\n scrollbarWidth={scrollbarWidth}\n data-testid={getTestId(\"close-button\")}\n />\n )}\n <div ref={wrapperInnerRef} className={cx(`${rootClassName}__wrapper-inner`)}>\n <div className={cx(`${rootClassName}__header`)}>\n {hasCloseButtonProps(props) && closeButtonAriaLabel && !image && (\n <CloseButton\n aria-label={closeButtonAriaLabel}\n data-testid={getTestId(\"close-button\")}\n />\n )}\n <RadixTitle\n asChild\n className={cx(`${rootClassName}__title`)}\n data-testid={getTestId(\"title\")}\n >\n <Heading tag=\"h2\" variant=\"title-200\" tabIndex={-1}>\n {title}\n </Heading>\n </RadixTitle>\n </div>\n {image && (\n <div\n className={cx(`${rootClassName}__image-wrapper`)}\n data-testid={getTestId(\"image\")}\n >\n {image}\n </div>\n )}\n <div className={cx(`${rootClassName}__body`)}>\n <div className={cx(`${rootClassName}__body-inner`)}>\n {description && hideDescription && (\n <VisuallyHidden asChild>\n <RadixDescription data-testid={getTestId(\"description\")}>\n {description}\n </RadixDescription>\n </VisuallyHidden>\n )}\n {description && !hideDescription && (\n <RadixDescription\n asChild\n className={cx(`${rootClassName}__description`)}\n data-testid={getTestId(\"description\")}\n >\n <Paragraph variant=\"paragraph-100\">{description}</Paragraph>\n </RadixDescription>\n )}\n <div>{children}</div>\n {!stickyButtons && <ModalActions actions={actions} notification={notification} />}\n </div>\n </div>\n </div>\n </div>\n\n {stickyButtons && <ModalActions actions={actions} notification={notification} />}\n </RadixContent>\n </RadixPortal>\n );\n }\n);\n\nconst CloseButton = ({\n [\"aria-label\"]: ariaLabel,\n hasImage,\n scrollbarWidth,\n [\"data-testid\"]: dataTestId,\n}: {\n [\"aria-label\"]: string;\n hasImage?: boolean;\n scrollbarWidth?: number;\n [\"data-testid\"]?: string;\n}) => (\n <RadixClose asChild>\n <Button\n variant={hasImage ? \"primary\" : \"tertiary-purple\"}\n negative={hasImage}\n size=\"sm\"\n iconOnly\n aria-label={ariaLabel}\n className={cx(`${rootClassName}__close-button`)}\n style={{ right: `calc(var(--purpur-spacing-100) + ${scrollbarWidth || 0}px)` }}\n data-testid={dataTestId}\n >\n <IconClose />\n </Button>\n </RadixClose>\n);\n\nexport const MAX_NUMBER_OF_ACTIONS = 3;\n\nexport const ModalActions = ({\n actions,\n notification,\n}: Pick<ModalContentProps, \"actions\" | \"notification\">) => {\n const notificationRef = useRef<HTMLDivElement>(null);\n\n useEffect(() => {\n if (notification) {\n notificationRef?.current?.scrollIntoView?.(false);\n }\n }, [notification]);\n\n return actions ? (\n <div className={cx(`${rootClassName}__actions`)}>\n <div className={cx(`${rootClassName}__actions-buttons`)} data-testid=\"modal actions\">\n {actions}\n </div>\n {notification && (\n <div className={cx(`${rootClassName}__notification`)} ref={notificationRef}>\n {notification}\n </div>\n )}\n <span className={cx(`${rootClassName}__actions-separator`)} />\n </div>\n ) : null;\n};\n","import React, { forwardRef, type ReactNode } from \"react\";\nimport type { BaseProps } from \"@purpur/common-types\";\nimport { Trigger as RadixTrigger } from \"@radix-ui/react-dialog\";\n\nexport type ModalTriggerProps = Omit<BaseProps<\"button\">, \"children\"> & {\n children: ReactNode;\n};\n\nexport const ModalTrigger = forwardRef<HTMLButtonElement, ModalTriggerProps>(\n ({ children, ...props }, ref) => {\n return (\n <RadixTrigger asChild ref={ref} {...props}>\n {children}\n </RadixTrigger>\n );\n }\n);\n","import React, { type ReactNode } from \"react\";\nimport { Root as RadixRoot } from \"@radix-ui/react-dialog\";\n\nimport { ModalContent } from \"./modal-content\";\nimport { ModalTrigger } from \"./modal-trigger\";\n\nexport type ModalProps = {\n [\"data-testid\"]?: string;\n children: ReactNode;\n /**\n * Event handler called when the open state of the dialog changes.\n * */\n onOpenChange?: (value: boolean) => void;\n /**\n * The controlled open state of the dialog. Must be used in conjunction with `onOpenChange`.\n * */\n open?: boolean;\n};\n\nexport const Modal = ({\n [\"data-testid\"]: dataTestId,\n children,\n open,\n onOpenChange,\n}: ModalProps) => (\n <RadixRoot open={open} onOpenChange={onOpenChange} data-testid={dataTestId}>\n {children}\n </RadixRoot>\n);\n\nModal.Trigger = ModalTrigger;\nModal.Content = ModalContent;\n\nModal.displayName = \"Modal\";\n"],"names":["hasCloseButtonProps","props","cx","c","styles","rootClassName","ModalContent","forwardRef","dataTestId","actions","children","className","description","disableCloseOnClickOutside","hideDescription","image","stickyButtons","title","notification","zIndex","onCloseAutoFocus","ref","closeButtonAriaLabel","showCloseButton","rest","contentOverflow","setContentOverflow","useState","scrollbarWidth","setScrollbarWidth","wrapperRef","useRef","wrapperInnerRef","classes","getTestId","id","handlePointerDownOutside","event","handleContentOverflow","useCallback","computedStyle","wrapperHeight","innerHeight","handleInitialFocus","frame","heading","handleEscapeKeyDown","useEffect","RadixPortal","jsx","RadixOverlay","jsxs","RadixContent","CloseButton","RadixTitle","Heading","VisuallyHidden","RadixDescription","Paragraph","ModalActions","ariaLabel","hasImage","RadixClose","Button","IconClose","notificationRef","ModalTrigger","RadixTrigger","Modal","open","onOpenChange","RadixRoot"],"mappings":"o1DAwFMA,EACJC,GAC+BA,EAA2B,kBAAoB,GAE1EC,EAAKC,EAAAA,EAAE,KAAKC,CAAM,EAClBC,EAAgB,uBAETC,EAAeC,EAAAA,WAC1B,CACE,CACE,CAAC,eAAgBC,EACjB,QAAAC,EACA,SAAAC,EACA,UAAAC,EACA,YAAAC,EACA,2BAAAC,EACA,gBAAAC,EACA,MAAAC,EACA,cAAAC,EAAgB,GAChB,MAAAC,EACA,aAAAC,EAAe,OACf,OAAAC,EACA,iBAAAC,EACA,GAAGnB,CAAA,EAELoB,IACG,CACH,KAAM,CAAE,qBAAAC,EAAsB,gBAAAC,EAAiB,GAAGC,GAASvB,EACrD,CAACwB,EAAiBC,CAAkB,EAAIC,EAAAA,SAAS,EAAK,EACtD,CAACC,EAAgBC,CAAiB,EAAIF,EAAAA,SAAS,CAAC,EAChDG,EAAaC,EAAAA,OAAuB,IAAI,EACxCC,EAAkBD,EAAAA,OAAuB,IAAI,EAE7CE,EAAU/B,EACdG,EACA,CAAE,CAAC,GAAGA,CAAa,cAAc,EAAG,CAAC,CAACU,CAAA,EACtC,CAAE,CAAC,GAAGV,CAAa,YAAY,EAAGoB,CAAA,EAClC,CAAE,CAAC,GAAGpB,CAAa,iBAAiB,EAAGW,CAAA,EACvCL,CAAA,EAGIuB,EAAaC,GAAgB3B,EAAa,GAAGA,CAAU,IAAI2B,CAAE,GAAK,OAElEC,EAA4BC,GAAwD,CACpFxB,GACFwB,EAAM,eAAA,CAEV,EAEMC,EAAwBC,EAAAA,YAAY,IAAM,CAC9C,GAAI,CAACT,EAAW,SAAW,CAACE,EAAgB,QAC1C,OAGF,MAAMQ,EAAgB,OAAO,iBAAiBV,EAAW,QAAS,IAAI,EAChEW,EAAgB,WAAWD,EAAc,iBAAiB,QAAQ,CAAC,EACnEE,EAAc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G,CAAA,CAAA,CAC9D,EACE,IACN,EC1Ta6D,GAAe3D,EAAAA,WAC1B,CAAC,CAAE,SAAAG,EAAU,GAAGT,CAAA,EAASoB,UAEpB8C,EAAAA,QAAA,CAAa,QAAO,GAAC,IAAA9C,EAAW,GAAGpB,EACjC,SAAAS,EACH,CAGN,ECGa0D,EAAQ,CAAC,CACpB,CAAC,eAAgB5D,EACjB,SAAAE,EACA,KAAA2D,EACA,aAAAC,CACF,UACGC,EAAAA,KAAA,CAAU,KAAAF,EAAY,aAAAC,EAA4B,cAAa9D,EAC7D,SAAAE,CAAA,CACH,EAGF0D,EAAM,QAAUF,GAChBE,EAAM,QAAU9D,EAEhB8D,EAAM,YAAc"}
package/dist/modal.cjs.js CHANGED
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./modal-nyhf5zxG.js");exports.Modal=e.Modal;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./modal-CXi2xez5.js");exports.Modal=e.Modal;
2
2
  //# sourceMappingURL=modal.cjs.js.map
package/dist/modal.es.js CHANGED
@@ -1,4 +1,4 @@
1
- import { M as r } from "./modal-C2UQsW-g.mjs";
1
+ import { M as r } from "./modal-2ymCXTup.mjs";
2
2
  export {
3
3
  r as Modal
4
4
  };
@@ -1,10 +1,10 @@
1
1
  import { jsx as r, jsxs as l } from "react/jsx-runtime";
2
2
  import { forwardRef as N } from "react";
3
- import { c as $ } from "./button-DBX_tvfJ.mjs";
4
- import { a as O } from "./heading-gqtQNo5n.mjs";
3
+ import { b as $ } from "./button-BfYKNBmC.mjs";
4
+ import { H as O } from "./heading-xwBuT_-9.mjs";
5
5
  import { b as f } from "./icon.es-CZcKxTaM.mjs";
6
6
  import { e as x } from "./error-filled.es-C0Amnd7Y.mjs";
7
- import { a as R } from "./paragraph-DNtj7OLr.mjs";
7
+ import { P as R } from "./paragraph-Ci50OF1u.mjs";
8
8
  import { c as S } from "./bind-CU-R61T-.mjs";
9
9
  const A = {
10
10
  name: "alert-filled",
@@ -41,12 +41,12 @@ const A = {
41
41
  "purpur-notification--info": "_purpur-notification--info_53c05_66",
42
42
  "purpur-notification--hidden": "_purpur-notification--hidden_53c05_75",
43
43
  "purpur-notification--has-close-button": "_purpur-notification--has-close-button_53c05_79"
44
- }, a = S.bind(I), n = {
44
+ }, n = S.bind(I), a = {
45
45
  SUCCESS: "success",
46
46
  WARNING: "warning",
47
47
  ERROR: "error",
48
48
  INFO: "info"
49
- }, P = Object.values(n), Z = {
49
+ }, D = Object.values(a), Z = {
50
50
  POLITE: "polite",
51
51
  ASSERTIVE: "assertive"
52
52
  }, T = Object.values(Z), k = {
@@ -55,13 +55,13 @@ const A = {
55
55
  ALERTDIALOG: "alertdialog"
56
56
  }, W = Object.values(k), o = "purpur-notification", j = (i) => {
57
57
  switch (i) {
58
- case n.INFO:
58
+ case a.INFO:
59
59
  return C;
60
- case n.SUCCESS:
60
+ case a.SUCCESS:
61
61
  return L;
62
- case n.WARNING:
62
+ case a.WARNING:
63
63
  return A;
64
- case n.ERROR:
64
+ case a.ERROR:
65
65
  return x;
66
66
  }
67
67
  }, B = N(
@@ -89,7 +89,7 @@ const A = {
89
89
  "aria-labelledby": t ? `${t}-heading` : void 0,
90
90
  "aria-describedby": t ? `${t}-body` : void 0,
91
91
  "aria-hidden": !!p,
92
- className: a(g, o, `${o}--${u}`, {
92
+ className: n(g, o, `${o}--${u}`, {
93
93
  [`${o}--hidden`]: p,
94
94
  [`${o}--has-close-button`]: !!c
95
95
  }),
@@ -97,12 +97,12 @@ const A = {
97
97
  ref: y,
98
98
  ...b,
99
99
  children: [
100
- d && /* @__PURE__ */ r("div", { className: a(`${o}__top`), children: /* @__PURE__ */ l("div", { className: a(`${o}__header`), children: [
100
+ d && /* @__PURE__ */ r("div", { className: n(`${o}__top`), children: /* @__PURE__ */ l("div", { className: n(`${o}__header`), children: [
101
101
  !_ && /* @__PURE__ */ r(
102
102
  f,
103
103
  {
104
104
  "data-testid": i ? `${i}-icon` : void 0,
105
- className: a(`${o}__icon`),
105
+ className: n(`${o}__icon`),
106
106
  svg: j(u),
107
107
  size: "md"
108
108
  }
@@ -113,7 +113,7 @@ const A = {
113
113
  "data-testid": i ? `${i}-heading` : void 0,
114
114
  variant: "subsection-100",
115
115
  tag: h,
116
- className: a(`${o}__heading`),
116
+ className: n(`${o}__heading`),
117
117
  children: /* @__PURE__ */ l("span", { id: t ? `${t}-heading` : void 0, children: [
118
118
  " ",
119
119
  s
@@ -130,7 +130,7 @@ const A = {
130
130
  iconOnly: !0,
131
131
  "aria-label": m,
132
132
  onClick: c,
133
- className: a(`${o}__close-button`),
133
+ className: n(`${o}__close-button`),
134
134
  children: /* @__PURE__ */ r(f, { svg: E, size: "sm" })
135
135
  }
136
136
  ),
@@ -138,7 +138,7 @@ const A = {
138
138
  "div",
139
139
  {
140
140
  "data-testid": i ? `${i}-body` : void 0,
141
- className: a(`${o}__body`, {
141
+ className: n(`${o}__body`, {
142
142
  [`${o}__body--extra-padding`]: !d && !!c
143
143
  }),
144
144
  id: t ? `${t}-body` : void 0,
@@ -159,12 +159,12 @@ const A = {
159
159
  );
160
160
  B.displayName = "Notification";
161
161
  export {
162
- n as N,
163
- Z as a,
164
- T as b,
165
- k as c,
162
+ Z as N,
163
+ k as a,
164
+ a as b,
165
+ B as c,
166
166
  W as d,
167
- B as e,
168
- P as n
167
+ D as e,
168
+ T as n
169
169
  };
170
- //# sourceMappingURL=notification-C32wHljA.mjs.map
170
+ //# sourceMappingURL=notification-BFSOuDp8.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"notification-C32wHljA.mjs","sources":["../../../components/icon/dist/assets/alert-filled.es.js","../../../components/icon/dist/assets/check-circle-filled.es.js","../../../components/icon/dist/assets/close.es.js","../../../components/icon/dist/assets/info-filled.es.js","../../../components/notification/src/notification.tsx"],"sourcesContent":["const l = {\n name: \"alert-filled\",\n svg: '<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 24 24\" fill=\"currentColor\"><path fill-rule=\"evenodd\" d=\"M12 22c5.523 0 10-4.477 10-10S17.523 2 12 2 2 6.477 2 12s4.477 10 10 10Zm1.038-14.81-.247 6.875h-1.566l-.247-6.876a1.03 1.03 0 1 1 2.06 0Zm.212 8.916c0 .649-.585 1.234-1.25 1.234-.649 0-1.25-.585-1.25-1.234 0-.633.601-1.234 1.25-1.234.665 0 1.25.601 1.25 1.234Z\" clip-rule=\"evenodd\"/></svg>',\n keywords: [\"alert-filled\"],\n category: \"status\"\n};\nexport {\n l as alertFilled\n};\n//# sourceMappingURL=alert-filled.es.js.map\n","const e = {\n name: \"check-circle-filled\",\n svg: '<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 24 24\" fill=\"currentColor\"><path fill-rule=\"evenodd\" d=\"M12 22c5.523 0 10-4.477 10-10S17.523 2 12 2 2 6.477 2 12s4.477 10 10 10Zm4.712-12.491a.875.875 0 1 0-1.424-1.018l-4.4 6.16-2.27-2.27a.875.875 0 0 0-1.237 1.238l3 3a.875.875 0 0 0 1.331-.11l5-7Z\" clip-rule=\"evenodd\"/></svg>',\n keywords: [\"check-circle-filled\"],\n category: \"status\"\n};\nexport {\n e as checkCircleFilled\n};\n//# sourceMappingURL=check-circle-filled.es.js.map\n","const l = {\n name: \"close\",\n svg: '<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 24 24\" fill=\"currentColor\"><path fill-rule=\"evenodd\" d=\"M4.864 4.864a.9.9 0 0 1 1.273 0L12 10.727l5.864-5.863a.9.9 0 0 1 1.272 1.272L13.273 12l5.863 5.864a.9.9 0 1 1-1.272 1.272L12 13.273l-5.863 5.863a.9.9 0 0 1-1.273-1.272L10.727 12 4.864 6.136a.9.9 0 0 1 0-1.272Z\" clip-rule=\"evenodd\"/></svg>',\n keywords: [\"close\"],\n category: \"utility\"\n};\nexport {\n l as close\n};\n//# sourceMappingURL=close.es.js.map\n","const e = {\n name: \"info-filled\",\n svg: '<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 24 24\" fill=\"currentColor\"><path fill-rule=\"evenodd\" d=\"M12 22c5.523 0 10-4.477 10-10S17.523 2 12 2 2 6.477 2 12s4.477 10 10 10ZM10.9 7.786c0 .591.516 1.077 1.108 1.077.576 0 1.092-.486 1.092-1.077 0-.592-.516-1.078-1.092-1.078-.592 0-1.108.486-1.108 1.078Zm.167 9.74h1.866V9.94h-1.866v7.586Z\" clip-rule=\"evenodd\"/></svg>',\n keywords: [\"info-filled\"],\n category: \"status\"\n};\nexport {\n e as infoFilled\n};\n//# sourceMappingURL=info-filled.es.js.map\n","import React, { forwardRef } from \"react\";\nimport { Button } from \"@purpur/button\";\nimport type { BaseProps } from \"@purpur/common-types\";\nimport { Heading, type HeadingTagType } from \"@purpur/heading\";\nimport { Icon } from \"@purpur/icon\";\nimport { alertFilled } from \"@purpur/icon/assets/alert-filled\";\nimport { checkCircleFilled } from \"@purpur/icon/assets/check-circle-filled\";\nimport { close } from \"@purpur/icon/assets/close\";\nimport { errorFilled } from \"@purpur/icon/assets/error-filled\";\nimport { infoFilled } from \"@purpur/icon/assets/info-filled\";\nimport { Paragraph } from \"@purpur/paragraph\";\nimport c from \"classnames/bind\";\n\nimport styles from \"./notification.module.scss\";\n\nconst cx = c.bind(styles);\n\nexport const NOTIFICATION_STATUS = {\n SUCCESS: \"success\",\n WARNING: \"warning\",\n ERROR: \"error\",\n INFO: \"info\",\n} as const;\n\nexport const notificationStatuses = Object.values(NOTIFICATION_STATUS);\nexport type NotificationStatus = (typeof NOTIFICATION_STATUS)[keyof typeof NOTIFICATION_STATUS];\n\nexport const NOTIFICATION_ARIA_LIVE = {\n POLITE: \"polite\",\n ASSERTIVE: \"assertive\",\n} as const;\n\nexport const notificationAriaLiveValues = Object.values(NOTIFICATION_ARIA_LIVE);\nexport type NotificationAriaLive =\n (typeof NOTIFICATION_ARIA_LIVE)[keyof typeof NOTIFICATION_ARIA_LIVE];\n\nexport const NOTIFICATION_ROLE = {\n ALERT: \"alert\",\n DIALOG: \"dialog\",\n ALERTDIALOG: \"alertdialog\",\n} as const;\n\nexport const notificationRoles = Object.values(NOTIFICATION_ROLE);\nexport type NotificationRole = (typeof NOTIFICATION_ROLE)[keyof typeof NOTIFICATION_ROLE];\n\nconst rootClassName = \"purpur-notification\";\n\nconst getStatusIcon = (status: NotificationStatus) => {\n switch (status) {\n case NOTIFICATION_STATUS.INFO:\n return infoFilled;\n case NOTIFICATION_STATUS.SUCCESS:\n return checkCircleFilled;\n case NOTIFICATION_STATUS.WARNING:\n return alertFilled;\n case NOTIFICATION_STATUS.ERROR:\n return errorFilled;\n }\n};\n\ntype DefaultProps = BaseProps & {\n [\"aria-live\"]?: NotificationAriaLive;\n headingTag?: HeadingTagType;\n status?: NotificationStatus;\n heading?: string;\n role?: NotificationRole;\n hidden?: boolean;\n /**\n * Use to explicitly not open the notification initially and open it programatically to trigger\n * that the aria-live message is read by the screen reader correctly.\n */\n open?: boolean;\n hideIcon?: boolean;\n};\n\ntype CloseButtonProps = {\n onClose: () => void;\n closeButtonAriaLabel: string;\n};\n\ntype NoCloseButtonProps = {\n onClose?: never;\n closeButtonAriaLabel?: never;\n};\n\nexport type NotificationProps = DefaultProps & (CloseButtonProps | NoCloseButtonProps);\n\nexport const Notification = forwardRef<HTMLDivElement, NotificationProps>(\n (\n {\n [\"data-testid\"]: dataTestId,\n [\"aria-live\"]: ariaLive,\n children,\n className,\n closeButtonAriaLabel,\n headingTag = \"h4\",\n status = \"info\",\n heading,\n hidden,\n id,\n onClose,\n open = true,\n hideIcon,\n ...props\n },\n ref\n ) => {\n const showHeader = !!heading || !hideIcon;\n\n return (\n <div aria-live={ariaLive}>\n {open && (\n <div\n id={id}\n aria-labelledby={id ? `${id}-heading` : undefined}\n aria-describedby={id ? `${id}-body` : undefined}\n aria-hidden={!!hidden}\n className={cx(className, rootClassName, `${rootClassName}--${status}`, {\n [`${rootClassName}--hidden`]: hidden,\n [`${rootClassName}--has-close-button`]: !!onClose,\n })}\n data-testid={dataTestId}\n ref={ref}\n {...props}\n >\n {showHeader && (\n <div className={cx(`${rootClassName}__top`)}>\n <div className={cx(`${rootClassName}__header`)}>\n {!hideIcon && (\n <Icon\n data-testid={dataTestId ? `${dataTestId}-icon` : undefined}\n className={cx(`${rootClassName}__icon`)}\n svg={getStatusIcon(status)}\n size=\"md\"\n />\n )}\n {!!heading && (\n <Heading\n data-testid={dataTestId ? `${dataTestId}-heading` : undefined}\n variant=\"subsection-100\"\n tag={headingTag}\n className={cx(`${rootClassName}__heading`)}\n >\n <span id={id ? `${id}-heading` : undefined}> {heading}</span>\n </Heading>\n )}\n </div>\n </div>\n )}\n {onClose && (\n <Button\n data-testid={dataTestId ? `${dataTestId}-close-button` : undefined}\n variant=\"tertiary-purple\"\n size=\"sm\"\n iconOnly\n aria-label={closeButtonAriaLabel}\n onClick={onClose}\n className={cx(`${rootClassName}__close-button`)}\n >\n <Icon svg={close} size=\"sm\" />\n </Button>\n )}\n {children && (\n <div\n data-testid={dataTestId ? `${dataTestId}-body` : undefined}\n className={cx(`${rootClassName}__body`, {\n [`${rootClassName}__body--extra-padding`]: !showHeader && !!onClose,\n })}\n id={id ? `${id}-body` : undefined}\n >\n {typeof children === \"string\" ? (\n <Paragraph\n data-testid={dataTestId ? `${dataTestId}-paragraph` : undefined}\n variant=\"paragraph-100\"\n >\n {children}\n </Paragraph>\n ) : (\n children\n )}\n </div>\n )}\n </div>\n )}\n </div>\n );\n }\n);\n\nNotification.displayName = \"Notification\";\n"],"names":["l","e","cx","c","styles","NOTIFICATION_STATUS","notificationStatuses","NOTIFICATION_ARIA_LIVE","notificationAriaLiveValues","NOTIFICATION_ROLE","notificationRoles","rootClassName","getStatusIcon","status","infoFilled","checkCircleFilled","alertFilled","errorFilled","Notification","forwardRef","dataTestId","ariaLive","children","className","closeButtonAriaLabel","headingTag","heading","hidden","id","onClose","open","hideIcon","props","ref","showHeader","jsx","jsxs","Icon","Heading","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es.js","../../../components/icon/dist/assets/check-circle-filled.es.js","../../../components/icon/dist/assets/close.es.js","../../../components/icon/dist/assets/info-filled.es.js","../../../components/notification/src/notification.tsx"],"sourcesContent":["const l = {\n name: \"alert-filled\",\n svg: '<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 24 24\" fill=\"currentColor\"><path fill-rule=\"evenodd\" d=\"M12 22c5.523 0 10-4.477 10-10S17.523 2 12 2 2 6.477 2 12s4.477 10 10 10Zm1.038-14.81-.247 6.875h-1.566l-.247-6.876a1.03 1.03 0 1 1 2.06 0Zm.212 8.916c0 .649-.585 1.234-1.25 1.234-.649 0-1.25-.585-1.25-1.234 0-.633.601-1.234 1.25-1.234.665 0 1.25.601 1.25 1.234Z\" clip-rule=\"evenodd\"/></svg>',\n keywords: [\"alert-filled\"],\n category: \"status\"\n};\nexport {\n l as alertFilled\n};\n//# sourceMappingURL=alert-filled.es.js.map\n","const e = {\n name: \"check-circle-filled\",\n svg: '<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 24 24\" fill=\"currentColor\"><path fill-rule=\"evenodd\" d=\"M12 22c5.523 0 10-4.477 10-10S17.523 2 12 2 2 6.477 2 12s4.477 10 10 10Zm4.712-12.491a.875.875 0 1 0-1.424-1.018l-4.4 6.16-2.27-2.27a.875.875 0 0 0-1.237 1.238l3 3a.875.875 0 0 0 1.331-.11l5-7Z\" clip-rule=\"evenodd\"/></svg>',\n keywords: [\"check-circle-filled\"],\n category: \"status\"\n};\nexport {\n e as checkCircleFilled\n};\n//# sourceMappingURL=check-circle-filled.es.js.map\n","const l = {\n name: \"close\",\n svg: '<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 24 24\" fill=\"currentColor\"><path fill-rule=\"evenodd\" d=\"M4.864 4.864a.9.9 0 0 1 1.273 0L12 10.727l5.864-5.863a.9.9 0 0 1 1.272 1.272L13.273 12l5.863 5.864a.9.9 0 1 1-1.272 1.272L12 13.273l-5.863 5.863a.9.9 0 0 1-1.273-1.272L10.727 12 4.864 6.136a.9.9 0 0 1 0-1.272Z\" clip-rule=\"evenodd\"/></svg>',\n keywords: [\"close\"],\n category: \"utility\"\n};\nexport {\n l as close\n};\n//# sourceMappingURL=close.es.js.map\n","const e = {\n name: \"info-filled\",\n svg: '<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 24 24\" fill=\"currentColor\"><path fill-rule=\"evenodd\" d=\"M12 22c5.523 0 10-4.477 10-10S17.523 2 12 2 2 6.477 2 12s4.477 10 10 10ZM10.9 7.786c0 .591.516 1.077 1.108 1.077.576 0 1.092-.486 1.092-1.077 0-.592-.516-1.078-1.092-1.078-.592 0-1.108.486-1.108 1.078Zm.167 9.74h1.866V9.94h-1.866v7.586Z\" clip-rule=\"evenodd\"/></svg>',\n keywords: [\"info-filled\"],\n category: \"status\"\n};\nexport {\n e as infoFilled\n};\n//# sourceMappingURL=info-filled.es.js.map\n","import React, { forwardRef } from \"react\";\nimport { Button } from \"@purpur/button\";\nimport type { BaseProps } from \"@purpur/common-types\";\nimport { Heading, type HeadingTagType } from \"@purpur/heading\";\nimport { Icon } from \"@purpur/icon\";\nimport { alertFilled } from \"@purpur/icon/assets/alert-filled\";\nimport { checkCircleFilled } from \"@purpur/icon/assets/check-circle-filled\";\nimport { close } from \"@purpur/icon/assets/close\";\nimport { errorFilled } from \"@purpur/icon/assets/error-filled\";\nimport { infoFilled } from \"@purpur/icon/assets/info-filled\";\nimport { Paragraph } from \"@purpur/paragraph\";\nimport c from \"classnames/bind\";\n\nimport styles from \"./notification.module.scss\";\n\nconst cx = c.bind(styles);\n\nexport const NOTIFICATION_STATUS = {\n SUCCESS: \"success\",\n WARNING: \"warning\",\n ERROR: \"error\",\n INFO: \"info\",\n} as const;\n\nexport const notificationStatuses = Object.values(NOTIFICATION_STATUS);\nexport type NotificationStatus = (typeof NOTIFICATION_STATUS)[keyof typeof NOTIFICATION_STATUS];\n\nexport const NOTIFICATION_ARIA_LIVE = {\n POLITE: \"polite\",\n ASSERTIVE: \"assertive\",\n} as const;\n\nexport const notificationAriaLiveValues = Object.values(NOTIFICATION_ARIA_LIVE);\nexport type NotificationAriaLive =\n (typeof NOTIFICATION_ARIA_LIVE)[keyof typeof NOTIFICATION_ARIA_LIVE];\n\nexport const NOTIFICATION_ROLE = {\n ALERT: \"alert\",\n DIALOG: \"dialog\",\n ALERTDIALOG: \"alertdialog\",\n} as const;\n\nexport const notificationRoles = Object.values(NOTIFICATION_ROLE);\nexport type NotificationRole = (typeof NOTIFICATION_ROLE)[keyof typeof NOTIFICATION_ROLE];\n\nconst rootClassName = \"purpur-notification\";\n\nconst getStatusIcon = (status: NotificationStatus) => {\n switch (status) {\n case NOTIFICATION_STATUS.INFO:\n return infoFilled;\n case NOTIFICATION_STATUS.SUCCESS:\n return checkCircleFilled;\n case NOTIFICATION_STATUS.WARNING:\n return alertFilled;\n case NOTIFICATION_STATUS.ERROR:\n return errorFilled;\n }\n};\n\ntype DefaultProps = BaseProps & {\n [\"aria-live\"]?: NotificationAriaLive;\n headingTag?: HeadingTagType;\n status?: NotificationStatus;\n heading?: string;\n role?: NotificationRole;\n hidden?: boolean;\n /**\n * Use to explicitly not open the notification initially and open it programatically to trigger\n * that the aria-live message is read by the screen reader correctly.\n */\n open?: boolean;\n hideIcon?: boolean;\n};\n\ntype CloseButtonProps = {\n onClose: () => void;\n closeButtonAriaLabel: string;\n};\n\ntype NoCloseButtonProps = {\n onClose?: never;\n closeButtonAriaLabel?: never;\n};\n\nexport type NotificationProps = DefaultProps & (CloseButtonProps | NoCloseButtonProps);\n\nexport const Notification = forwardRef<HTMLDivElement, NotificationProps>(\n (\n {\n [\"data-testid\"]: dataTestId,\n [\"aria-live\"]: ariaLive,\n children,\n className,\n closeButtonAriaLabel,\n headingTag = \"h4\",\n status = \"info\",\n heading,\n hidden,\n id,\n onClose,\n open = true,\n hideIcon,\n ...props\n },\n ref\n ) => {\n const showHeader = !!heading || !hideIcon;\n\n return (\n <div aria-live={ariaLive}>\n {open && (\n <div\n id={id}\n aria-labelledby={id ? `${id}-heading` : undefined}\n aria-describedby={id ? `${id}-body` : undefined}\n aria-hidden={!!hidden}\n className={cx(className, rootClassName, `${rootClassName}--${status}`, {\n [`${rootClassName}--hidden`]: hidden,\n [`${rootClassName}--has-close-button`]: !!onClose,\n })}\n data-testid={dataTestId}\n ref={ref}\n {...props}\n >\n {showHeader && (\n <div className={cx(`${rootClassName}__top`)}>\n <div className={cx(`${rootClassName}__header`)}>\n {!hideIcon && (\n <Icon\n data-testid={dataTestId ? `${dataTestId}-icon` : undefined}\n className={cx(`${rootClassName}__icon`)}\n svg={getStatusIcon(status)}\n size=\"md\"\n />\n )}\n {!!heading && (\n <Heading\n data-testid={dataTestId ? `${dataTestId}-heading` : undefined}\n variant=\"subsection-100\"\n tag={headingTag}\n className={cx(`${rootClassName}__heading`)}\n >\n <span id={id ? `${id}-heading` : undefined}> {heading}</span>\n </Heading>\n )}\n </div>\n </div>\n )}\n {onClose && (\n <Button\n data-testid={dataTestId ? `${dataTestId}-close-button` : undefined}\n variant=\"tertiary-purple\"\n size=\"sm\"\n iconOnly\n aria-label={closeButtonAriaLabel}\n onClick={onClose}\n className={cx(`${rootClassName}__close-button`)}\n >\n <Icon svg={close} size=\"sm\" />\n </Button>\n )}\n {children && (\n <div\n data-testid={dataTestId ? `${dataTestId}-body` : undefined}\n className={cx(`${rootClassName}__body`, {\n [`${rootClassName}__body--extra-padding`]: !showHeader && !!onClose,\n })}\n id={id ? `${id}-body` : undefined}\n >\n {typeof children === \"string\" ? (\n <Paragraph\n data-testid={dataTestId ? `${dataTestId}-paragraph` : undefined}\n variant=\"paragraph-100\"\n >\n {children}\n </Paragraph>\n ) : (\n children\n )}\n </div>\n )}\n </div>\n )}\n </div>\n );\n }\n);\n\nNotification.displayName = \"Notification\";\n"],"names":["l","e","cx","c","styles","NOTIFICATION_STATUS","notificationStatuses","NOTIFICATION_ARIA_LIVE","notificationAriaLiveValues","NOTIFICATION_ROLE","notificationRoles","rootClassName","getStatusIcon","status","infoFilled","checkCircleFilled","alertFilled","errorFilled","Notification","forwardRef","dataTestId","ariaLive","children","className","closeButtonAriaLabel","headingTag","heading","hidden","id","onClose","open","hideIcon","props","ref","showHeader","jsx","jsxs","Icon","Heading","Button","close","Paragraph"],"mappings":";;;;;;;;AAAA,MAAMA,IAAI;AAAA,EACR,MAAM;AAAA,EACN,KAAK;AAAA,EACL,UAAU,CAAC,cAAc;AAAA,EACzB,UAAU;AACZ,GCLMC,IAAI;AAAA,EACR,MAAM;AAAA,EACN,KAAK;AAAA,EACL,UAAU,CAAC,qBAAqB;AAAA,EAChC,UAAU;AACZ,GCLMD,IAAI;AAAA,EACR,MAAM;AAAA,EACN,KAAK;AAAA,EACL,UAAU,CAAC,OAAO;AAAA,EAClB,UAAU;AACZ,GCLMC,IAAI;AAAA,EACR,MAAM;AAAA,EACN,KAAK;AAAA,EACL,UAAU,CAAC,aAAa;AAAA,EACxB,UAAU;AACZ;;;;;;;;;;;;;;;GCUMC,IAAKC,EAAE,KAAKC,CAAM,GAEXC,IAAsB;AAAA,EACjC,SAAS;AAAA,EACT,SAAS;AAAA,EACT,OAAO;AAAA,EACP,MAAM;AACR,GAEaC,IAAuB,OAAO,OAAOD,CAAmB,GAGxDE,IAAyB;AAAA,EACpC,QAAQ;AAAA,EACR,WAAW;AACb,GAEaC,IAA6B,OAAO,OAAOD,CAAsB,GAIjEE,IAAoB;AAAA,EAC/B,OAAO;AAAA,EACP,QAAQ;AAAA,EACR,aAAa;AACf,GAEaC,IAAoB,OAAO,OAAOD,CAAiB,GAG1DE,IAAgB,uBAEhBC,IAAgB,CAACC,MAA+B;AACpD,UAAQA,GAAA;AAAA,IACN,KAAKR,EAAoB;AACvB,aAAOS;AAAAA,IACT,KAAKT,EAAoB;AACvB,aAAOU;AAAAA,IACT,KAAKV,EAAoB;AACvB,aAAOW;AAAAA,IACT,KAAKX,EAAoB;AACvB,aAAOY;AAAAA,EAAA;AAEb,GA6B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AAAA,YAAA;AAAA,UAAA;AAAA,QAEJ;AAAA,MAAA;AAAA,IAAA,GAIR;AAAA,EAEJ;AACF;AAEAJ,EAAa,cAAc;"}
@@ -1,2 +1,2 @@
1
- "use strict";const o=require("react/jsx-runtime"),x=require("react"),A=require("./button-ChYUPi2k.js"),I=require("./heading-DLCdW6gx.js"),d=require("./icon.es-j3eRib6d.js"),R=require("./error-filled.es-BbS_Oggw.js"),$=require("./paragraph-BsI53OR0.js"),S=require("./bind-DeUYJ6m9.js"),j={name:"alert-filled",svg:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="currentColor"><path fill-rule="evenodd" d="M12 22c5.523 0 10-4.477 10-10S17.523 2 12 2 2 6.477 2 12s4.477 10 10 10Zm1.038-14.81-.247 6.875h-1.566l-.247-6.876a1.03 1.03 0 1 1 2.06 0Zm.212 8.916c0 .649-.585 1.234-1.25 1.234-.649 0-1.25-.585-1.25-1.234 0-.633.601-1.234 1.25-1.234.665 0 1.25.601 1.25 1.234Z" clip-rule="evenodd"/></svg>',keywords:["alert-filled"],category:"status"},L={name:"check-circle-filled",svg:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="currentColor"><path fill-rule="evenodd" d="M12 22c5.523 0 10-4.477 10-10S17.523 2 12 2 2 6.477 2 12s4.477 10 10 10Zm4.712-12.491a.875.875 0 1 0-1.424-1.018l-4.4 6.16-2.27-2.27a.875.875 0 0 0-1.237 1.238l3 3a.875.875 0 0 0 1.331-.11l5-7Z" clip-rule="evenodd"/></svg>',keywords:["check-circle-filled"],category:"status"},C={name:"close",svg:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="currentColor"><path fill-rule="evenodd" d="M4.864 4.864a.9.9 0 0 1 1.273 0L12 10.727l5.864-5.863a.9.9 0 0 1 1.272 1.272L13.273 12l5.863 5.864a.9.9 0 1 1-1.272 1.272L12 13.273l-5.863 5.863a.9.9 0 0 1-1.273-1.272L10.727 12 4.864 6.136a.9.9 0 0 1 0-1.272Z" clip-rule="evenodd"/></svg>',keywords:["close"],category:"utility"},E={name:"info-filled",svg:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="currentColor"><path fill-rule="evenodd" d="M12 22c5.523 0 10-4.477 10-10S17.523 2 12 2 2 6.477 2 12s4.477 10 10 10ZM10.9 7.786c0 .591.516 1.077 1.108 1.077.576 0 1.092-.486 1.092-1.077 0-.592-.516-1.078-1.092-1.078-.592 0-1.108.486-1.108 1.078Zm.167 9.74h1.866V9.94h-1.866v7.586Z" clip-rule="evenodd"/></svg>',keywords:["info-filled"],category:"status"},T={"purpur-notification":"_purpur-notification_53c05_1","purpur-notification__top":"_purpur-notification__top_53c05_14","purpur-notification__header":"_purpur-notification__header_53c05_20","purpur-notification__close-button":"_purpur-notification__close-button_53c05_25","purpur-notification__icon":"_purpur-notification__icon_53c05_30","purpur-notification__body":"_purpur-notification__body_53c05_33","purpur-notification__body--extra-padding":"_purpur-notification__body--extra-padding_53c05_36","purpur-notification--success":"_purpur-notification--success_53c05_39","purpur-notification__heading":"_purpur-notification__heading_53c05_42","purpur-notification--warning":"_purpur-notification--warning_53c05_48","purpur-notification--error":"_purpur-notification--error_53c05_57","purpur-notification--info":"_purpur-notification--info_53c05_66","purpur-notification--hidden":"_purpur-notification--hidden_53c05_75","purpur-notification--has-close-button":"_purpur-notification--has-close-button_53c05_79"},n=S.c.bind(T),e={SUCCESS:"success",WARNING:"warning",ERROR:"error",INFO:"info"},F=Object.values(e),f={POLITE:"polite",ASSERTIVE:"assertive"},Z=Object.values(f),v={ALERT:"alert",DIALOG:"dialog",ALERTDIALOG:"alertdialog"},q=Object.values(v),t="purpur-notification",k=i=>{switch(i){case e.INFO:return E;case e.SUCCESS:return L;case e.WARNING:return j;case e.ERROR:return R.e}},g=x.forwardRef(({["data-testid"]:i,["aria-live"]:h,children:a,className:b,closeButtonAriaLabel:w,headingTag:N="h4",status:u="info",heading:s,hidden:l,id:r,onClose:c,open:m=!0,hideIcon:_,...y},O)=>{const p=!!s||!_;return o.jsx("div",{"aria-live":h,children:m&&o.jsxs("div",{id:r,"aria-labelledby":r?`${r}-heading`:void 0,"aria-describedby":r?`${r}-body`:void 0,"aria-hidden":!!l,className:n(b,t,`${t}--${u}`,{[`${t}--hidden`]:l,[`${t}--has-close-button`]:!!c}),"data-testid":i,ref:O,...y,children:[p&&o.jsx("div",{className:n(`${t}__top`),children:o.jsxs("div",{className:n(`${t}__header`),children:[!_&&o.jsx(d.b,{"data-testid":i?`${i}-icon`:void 0,className:n(`${t}__icon`),svg:k(u),size:"md"}),!!s&&o.jsx(I.Heading,{"data-testid":i?`${i}-heading`:void 0,variant:"subsection-100",tag:N,className:n(`${t}__heading`),children:o.jsxs("span",{id:r?`${r}-heading`:void 0,children:[" ",s]})})]})}),c&&o.jsx(A.Button,{"data-testid":i?`${i}-close-button`:void 0,variant:"tertiary-purple",size:"sm",iconOnly:!0,"aria-label":w,onClick:c,className:n(`${t}__close-button`),children:o.jsx(d.b,{svg:C,size:"sm"})}),a&&o.jsx("div",{"data-testid":i?`${i}-body`:void 0,className:n(`${t}__body`,{[`${t}__body--extra-padding`]:!p&&!!c}),id:r?`${r}-body`:void 0,children:typeof a=="string"?o.jsx($.Paragraph,{"data-testid":i?`${i}-paragraph`:void 0,variant:"paragraph-100",children:a}):a})]})})});g.displayName="Notification";exports.NOTIFICATION_ARIA_LIVE=f;exports.NOTIFICATION_ROLE=v;exports.NOTIFICATION_STATUS=e;exports.Notification=g;exports.notificationAriaLiveValues=Z;exports.notificationRoles=q;exports.notificationStatuses=F;
2
- //# sourceMappingURL=notification-Bg1vQkQ3.js.map
1
+ "use strict";const o=require("react/jsx-runtime"),x=require("react"),A=require("./button-DDYGuqZ0.js"),I=require("./heading-drD5ugCC.js"),d=require("./icon.es-j3eRib6d.js"),R=require("./error-filled.es-BbS_Oggw.js"),$=require("./paragraph-BsI53OR0.js"),S=require("./bind-DeUYJ6m9.js"),j={name:"alert-filled",svg:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="currentColor"><path fill-rule="evenodd" d="M12 22c5.523 0 10-4.477 10-10S17.523 2 12 2 2 6.477 2 12s4.477 10 10 10Zm1.038-14.81-.247 6.875h-1.566l-.247-6.876a1.03 1.03 0 1 1 2.06 0Zm.212 8.916c0 .649-.585 1.234-1.25 1.234-.649 0-1.25-.585-1.25-1.234 0-.633.601-1.234 1.25-1.234.665 0 1.25.601 1.25 1.234Z" clip-rule="evenodd"/></svg>',keywords:["alert-filled"],category:"status"},L={name:"check-circle-filled",svg:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="currentColor"><path fill-rule="evenodd" d="M12 22c5.523 0 10-4.477 10-10S17.523 2 12 2 2 6.477 2 12s4.477 10 10 10Zm4.712-12.491a.875.875 0 1 0-1.424-1.018l-4.4 6.16-2.27-2.27a.875.875 0 0 0-1.237 1.238l3 3a.875.875 0 0 0 1.331-.11l5-7Z" clip-rule="evenodd"/></svg>',keywords:["check-circle-filled"],category:"status"},C={name:"close",svg:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="currentColor"><path fill-rule="evenodd" d="M4.864 4.864a.9.9 0 0 1 1.273 0L12 10.727l5.864-5.863a.9.9 0 0 1 1.272 1.272L13.273 12l5.863 5.864a.9.9 0 1 1-1.272 1.272L12 13.273l-5.863 5.863a.9.9 0 0 1-1.273-1.272L10.727 12 4.864 6.136a.9.9 0 0 1 0-1.272Z" clip-rule="evenodd"/></svg>',keywords:["close"],category:"utility"},E={name:"info-filled",svg:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="currentColor"><path fill-rule="evenodd" d="M12 22c5.523 0 10-4.477 10-10S17.523 2 12 2 2 6.477 2 12s4.477 10 10 10ZM10.9 7.786c0 .591.516 1.077 1.108 1.077.576 0 1.092-.486 1.092-1.077 0-.592-.516-1.078-1.092-1.078-.592 0-1.108.486-1.108 1.078Zm.167 9.74h1.866V9.94h-1.866v7.586Z" clip-rule="evenodd"/></svg>',keywords:["info-filled"],category:"status"},T={"purpur-notification":"_purpur-notification_53c05_1","purpur-notification__top":"_purpur-notification__top_53c05_14","purpur-notification__header":"_purpur-notification__header_53c05_20","purpur-notification__close-button":"_purpur-notification__close-button_53c05_25","purpur-notification__icon":"_purpur-notification__icon_53c05_30","purpur-notification__body":"_purpur-notification__body_53c05_33","purpur-notification__body--extra-padding":"_purpur-notification__body--extra-padding_53c05_36","purpur-notification--success":"_purpur-notification--success_53c05_39","purpur-notification__heading":"_purpur-notification__heading_53c05_42","purpur-notification--warning":"_purpur-notification--warning_53c05_48","purpur-notification--error":"_purpur-notification--error_53c05_57","purpur-notification--info":"_purpur-notification--info_53c05_66","purpur-notification--hidden":"_purpur-notification--hidden_53c05_75","purpur-notification--has-close-button":"_purpur-notification--has-close-button_53c05_79"},n=S.c.bind(T),e={SUCCESS:"success",WARNING:"warning",ERROR:"error",INFO:"info"},F=Object.values(e),f={POLITE:"polite",ASSERTIVE:"assertive"},Z=Object.values(f),v={ALERT:"alert",DIALOG:"dialog",ALERTDIALOG:"alertdialog"},q=Object.values(v),t="purpur-notification",k=i=>{switch(i){case e.INFO:return E;case e.SUCCESS:return L;case e.WARNING:return j;case e.ERROR:return R.e}},g=x.forwardRef(({["data-testid"]:i,["aria-live"]:h,children:a,className:b,closeButtonAriaLabel:w,headingTag:N="h4",status:u="info",heading:s,hidden:l,id:r,onClose:c,open:m=!0,hideIcon:_,...y},O)=>{const p=!!s||!_;return o.jsx("div",{"aria-live":h,children:m&&o.jsxs("div",{id:r,"aria-labelledby":r?`${r}-heading`:void 0,"aria-describedby":r?`${r}-body`:void 0,"aria-hidden":!!l,className:n(b,t,`${t}--${u}`,{[`${t}--hidden`]:l,[`${t}--has-close-button`]:!!c}),"data-testid":i,ref:O,...y,children:[p&&o.jsx("div",{className:n(`${t}__top`),children:o.jsxs("div",{className:n(`${t}__header`),children:[!_&&o.jsx(d.b,{"data-testid":i?`${i}-icon`:void 0,className:n(`${t}__icon`),svg:k(u),size:"md"}),!!s&&o.jsx(I.Heading,{"data-testid":i?`${i}-heading`:void 0,variant:"subsection-100",tag:N,className:n(`${t}__heading`),children:o.jsxs("span",{id:r?`${r}-heading`:void 0,children:[" ",s]})})]})}),c&&o.jsx(A.Button,{"data-testid":i?`${i}-close-button`:void 0,variant:"tertiary-purple",size:"sm",iconOnly:!0,"aria-label":w,onClick:c,className:n(`${t}__close-button`),children:o.jsx(d.b,{svg:C,size:"sm"})}),a&&o.jsx("div",{"data-testid":i?`${i}-body`:void 0,className:n(`${t}__body`,{[`${t}__body--extra-padding`]:!p&&!!c}),id:r?`${r}-body`:void 0,children:typeof a=="string"?o.jsx($.Paragraph,{"data-testid":i?`${i}-paragraph`:void 0,variant:"paragraph-100",children:a}):a})]})})});g.displayName="Notification";exports.NOTIFICATION_ARIA_LIVE=f;exports.NOTIFICATION_ROLE=v;exports.NOTIFICATION_STATUS=e;exports.Notification=g;exports.notificationAriaLiveValues=Z;exports.notificationRoles=q;exports.notificationStatuses=F;
2
+ //# sourceMappingURL=notification-DdnI2rOh.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"notification-Bg1vQkQ3.js","sources":["../../../components/icon/dist/assets/alert-filled.es.js","../../../components/icon/dist/assets/check-circle-filled.es.js","../../../components/icon/dist/assets/close.es.js","../../../components/icon/dist/assets/info-filled.es.js","../../../components/notification/src/notification.tsx"],"sourcesContent":["const l = {\n name: \"alert-filled\",\n svg: '<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 24 24\" fill=\"currentColor\"><path fill-rule=\"evenodd\" d=\"M12 22c5.523 0 10-4.477 10-10S17.523 2 12 2 2 6.477 2 12s4.477 10 10 10Zm1.038-14.81-.247 6.875h-1.566l-.247-6.876a1.03 1.03 0 1 1 2.06 0Zm.212 8.916c0 .649-.585 1.234-1.25 1.234-.649 0-1.25-.585-1.25-1.234 0-.633.601-1.234 1.25-1.234.665 0 1.25.601 1.25 1.234Z\" clip-rule=\"evenodd\"/></svg>',\n keywords: [\"alert-filled\"],\n category: \"status\"\n};\nexport {\n l as alertFilled\n};\n//# sourceMappingURL=alert-filled.es.js.map\n","const e = {\n name: \"check-circle-filled\",\n svg: '<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 24 24\" fill=\"currentColor\"><path fill-rule=\"evenodd\" d=\"M12 22c5.523 0 10-4.477 10-10S17.523 2 12 2 2 6.477 2 12s4.477 10 10 10Zm4.712-12.491a.875.875 0 1 0-1.424-1.018l-4.4 6.16-2.27-2.27a.875.875 0 0 0-1.237 1.238l3 3a.875.875 0 0 0 1.331-.11l5-7Z\" clip-rule=\"evenodd\"/></svg>',\n keywords: [\"check-circle-filled\"],\n category: \"status\"\n};\nexport {\n e as checkCircleFilled\n};\n//# sourceMappingURL=check-circle-filled.es.js.map\n","const l = {\n name: \"close\",\n svg: '<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 24 24\" fill=\"currentColor\"><path fill-rule=\"evenodd\" d=\"M4.864 4.864a.9.9 0 0 1 1.273 0L12 10.727l5.864-5.863a.9.9 0 0 1 1.272 1.272L13.273 12l5.863 5.864a.9.9 0 1 1-1.272 1.272L12 13.273l-5.863 5.863a.9.9 0 0 1-1.273-1.272L10.727 12 4.864 6.136a.9.9 0 0 1 0-1.272Z\" clip-rule=\"evenodd\"/></svg>',\n keywords: [\"close\"],\n category: \"utility\"\n};\nexport {\n l as close\n};\n//# sourceMappingURL=close.es.js.map\n","const e = {\n name: \"info-filled\",\n svg: '<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 24 24\" fill=\"currentColor\"><path fill-rule=\"evenodd\" d=\"M12 22c5.523 0 10-4.477 10-10S17.523 2 12 2 2 6.477 2 12s4.477 10 10 10ZM10.9 7.786c0 .591.516 1.077 1.108 1.077.576 0 1.092-.486 1.092-1.077 0-.592-.516-1.078-1.092-1.078-.592 0-1.108.486-1.108 1.078Zm.167 9.74h1.866V9.94h-1.866v7.586Z\" clip-rule=\"evenodd\"/></svg>',\n keywords: [\"info-filled\"],\n category: \"status\"\n};\nexport {\n e as infoFilled\n};\n//# sourceMappingURL=info-filled.es.js.map\n","import React, { forwardRef } from \"react\";\nimport { Button } from \"@purpur/button\";\nimport type { BaseProps } from \"@purpur/common-types\";\nimport { Heading, type HeadingTagType } from \"@purpur/heading\";\nimport { Icon } from \"@purpur/icon\";\nimport { alertFilled } from \"@purpur/icon/assets/alert-filled\";\nimport { checkCircleFilled } from \"@purpur/icon/assets/check-circle-filled\";\nimport { close } from \"@purpur/icon/assets/close\";\nimport { errorFilled } from \"@purpur/icon/assets/error-filled\";\nimport { infoFilled } from \"@purpur/icon/assets/info-filled\";\nimport { Paragraph } from \"@purpur/paragraph\";\nimport c from \"classnames/bind\";\n\nimport styles from \"./notification.module.scss\";\n\nconst cx = c.bind(styles);\n\nexport const NOTIFICATION_STATUS = {\n SUCCESS: \"success\",\n WARNING: \"warning\",\n ERROR: \"error\",\n INFO: \"info\",\n} as const;\n\nexport const notificationStatuses = Object.values(NOTIFICATION_STATUS);\nexport type NotificationStatus = (typeof NOTIFICATION_STATUS)[keyof typeof NOTIFICATION_STATUS];\n\nexport const NOTIFICATION_ARIA_LIVE = {\n POLITE: \"polite\",\n ASSERTIVE: \"assertive\",\n} as const;\n\nexport const notificationAriaLiveValues = Object.values(NOTIFICATION_ARIA_LIVE);\nexport type NotificationAriaLive =\n (typeof NOTIFICATION_ARIA_LIVE)[keyof typeof NOTIFICATION_ARIA_LIVE];\n\nexport const NOTIFICATION_ROLE = {\n ALERT: \"alert\",\n DIALOG: \"dialog\",\n ALERTDIALOG: \"alertdialog\",\n} as const;\n\nexport const notificationRoles = Object.values(NOTIFICATION_ROLE);\nexport type NotificationRole = (typeof NOTIFICATION_ROLE)[keyof typeof NOTIFICATION_ROLE];\n\nconst rootClassName = \"purpur-notification\";\n\nconst getStatusIcon = (status: NotificationStatus) => {\n switch (status) {\n case NOTIFICATION_STATUS.INFO:\n return infoFilled;\n case NOTIFICATION_STATUS.SUCCESS:\n return checkCircleFilled;\n case NOTIFICATION_STATUS.WARNING:\n return alertFilled;\n case NOTIFICATION_STATUS.ERROR:\n return errorFilled;\n }\n};\n\ntype DefaultProps = BaseProps & {\n [\"aria-live\"]?: NotificationAriaLive;\n headingTag?: HeadingTagType;\n status?: NotificationStatus;\n heading?: string;\n role?: NotificationRole;\n hidden?: boolean;\n /**\n * Use to explicitly not open the notification initially and open it programatically to trigger\n * that the aria-live message is read by the screen reader correctly.\n */\n open?: boolean;\n hideIcon?: boolean;\n};\n\ntype CloseButtonProps = {\n onClose: () => void;\n closeButtonAriaLabel: string;\n};\n\ntype NoCloseButtonProps = {\n onClose?: never;\n closeButtonAriaLabel?: never;\n};\n\nexport type NotificationProps = DefaultProps & (CloseButtonProps | NoCloseButtonProps);\n\nexport const Notification = forwardRef<HTMLDivElement, NotificationProps>(\n (\n {\n [\"data-testid\"]: dataTestId,\n [\"aria-live\"]: ariaLive,\n children,\n className,\n closeButtonAriaLabel,\n headingTag = \"h4\",\n status = \"info\",\n heading,\n hidden,\n id,\n onClose,\n open = true,\n hideIcon,\n ...props\n },\n ref\n ) => {\n const showHeader = !!heading || !hideIcon;\n\n return (\n <div aria-live={ariaLive}>\n {open && (\n <div\n id={id}\n aria-labelledby={id ? `${id}-heading` : undefined}\n aria-describedby={id ? `${id}-body` : undefined}\n aria-hidden={!!hidden}\n className={cx(className, rootClassName, `${rootClassName}--${status}`, {\n [`${rootClassName}--hidden`]: hidden,\n [`${rootClassName}--has-close-button`]: !!onClose,\n })}\n data-testid={dataTestId}\n ref={ref}\n {...props}\n >\n {showHeader && (\n <div className={cx(`${rootClassName}__top`)}>\n <div className={cx(`${rootClassName}__header`)}>\n {!hideIcon && (\n <Icon\n data-testid={dataTestId ? `${dataTestId}-icon` : undefined}\n className={cx(`${rootClassName}__icon`)}\n svg={getStatusIcon(status)}\n size=\"md\"\n />\n )}\n {!!heading && (\n <Heading\n data-testid={dataTestId ? `${dataTestId}-heading` : undefined}\n variant=\"subsection-100\"\n tag={headingTag}\n className={cx(`${rootClassName}__heading`)}\n >\n <span id={id ? `${id}-heading` : undefined}> {heading}</span>\n </Heading>\n )}\n </div>\n </div>\n )}\n {onClose && (\n <Button\n data-testid={dataTestId ? `${dataTestId}-close-button` : undefined}\n variant=\"tertiary-purple\"\n size=\"sm\"\n iconOnly\n aria-label={closeButtonAriaLabel}\n onClick={onClose}\n className={cx(`${rootClassName}__close-button`)}\n >\n <Icon svg={close} size=\"sm\" />\n </Button>\n )}\n {children && (\n <div\n data-testid={dataTestId ? `${dataTestId}-body` : undefined}\n className={cx(`${rootClassName}__body`, {\n [`${rootClassName}__body--extra-padding`]: !showHeader && !!onClose,\n })}\n id={id ? `${id}-body` : undefined}\n >\n {typeof children === \"string\" ? (\n <Paragraph\n data-testid={dataTestId ? `${dataTestId}-paragraph` : undefined}\n variant=\"paragraph-100\"\n >\n {children}\n </Paragraph>\n ) : (\n children\n )}\n </div>\n )}\n </div>\n )}\n </div>\n );\n }\n);\n\nNotification.displayName = \"Notification\";\n"],"names":["l","e","cx","c","styles","NOTIFICATION_STATUS","notificationStatuses","NOTIFICATION_ARIA_LIVE","notificationAriaLiveValues","NOTIFICATION_ROLE","notificationRoles","rootClassName","getStatusIcon","status","infoFilled","checkCircleFilled","alertFilled","errorFilled","Notification","forwardRef","dataTestId","ariaLive","children","className","closeButtonAriaLabel","headingTag","heading","hidden","id","onClose","open","hideIcon","props","ref","showHeader","jsx","jsxs","Icon","Heading","Button","close","Paragraph"],"mappings":"6RAAMA,EAAI,CACR,KAAM,eACN,IAAK,kZACL,SAAU,CAAC,cAAc,EACzB,SAAU,QACZ,ECLMC,EAAI,CACR,KAAM,sBACN,IAAK,8UACL,SAAU,CAAC,qBAAqB,EAChC,SAAU,QACZ,ECLMD,EAAI,CACR,KAAM,QACN,IAAK,8VACL,SAAU,CAAC,OAAO,EAClB,SAAU,SACZ,ECLMC,EAAI,CACR,K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A,UAAA,CACC,cAAarB,EAAa,GAAGA,CAAU,aAAe,OACtD,QAAQ,gBAEP,SAAAE,CAAA,CAAA,EAGHA,CAAA,CAAA,CAEJ,CAAA,CAAA,EAIR,CAEJ,CACF,EAEAJ,EAAa,YAAc"}
1
+ {"version":3,"file":"notification-DdnI2rOh.js","sources":["../../../components/icon/dist/assets/alert-filled.es.js","../../../components/icon/dist/assets/check-circle-filled.es.js","../../../components/icon/dist/assets/close.es.js","../../../components/icon/dist/assets/info-filled.es.js","../../../components/notification/src/notification.tsx"],"sourcesContent":["const l = {\n name: \"alert-filled\",\n svg: '<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 24 24\" fill=\"currentColor\"><path fill-rule=\"evenodd\" d=\"M12 22c5.523 0 10-4.477 10-10S17.523 2 12 2 2 6.477 2 12s4.477 10 10 10Zm1.038-14.81-.247 6.875h-1.566l-.247-6.876a1.03 1.03 0 1 1 2.06 0Zm.212 8.916c0 .649-.585 1.234-1.25 1.234-.649 0-1.25-.585-1.25-1.234 0-.633.601-1.234 1.25-1.234.665 0 1.25.601 1.25 1.234Z\" clip-rule=\"evenodd\"/></svg>',\n keywords: [\"alert-filled\"],\n category: \"status\"\n};\nexport {\n l as alertFilled\n};\n//# sourceMappingURL=alert-filled.es.js.map\n","const e = {\n name: \"check-circle-filled\",\n svg: '<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 24 24\" fill=\"currentColor\"><path fill-rule=\"evenodd\" d=\"M12 22c5.523 0 10-4.477 10-10S17.523 2 12 2 2 6.477 2 12s4.477 10 10 10Zm4.712-12.491a.875.875 0 1 0-1.424-1.018l-4.4 6.16-2.27-2.27a.875.875 0 0 0-1.237 1.238l3 3a.875.875 0 0 0 1.331-.11l5-7Z\" clip-rule=\"evenodd\"/></svg>',\n keywords: [\"check-circle-filled\"],\n category: \"status\"\n};\nexport {\n e as checkCircleFilled\n};\n//# sourceMappingURL=check-circle-filled.es.js.map\n","const l = {\n name: \"close\",\n svg: '<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 24 24\" fill=\"currentColor\"><path fill-rule=\"evenodd\" d=\"M4.864 4.864a.9.9 0 0 1 1.273 0L12 10.727l5.864-5.863a.9.9 0 0 1 1.272 1.272L13.273 12l5.863 5.864a.9.9 0 1 1-1.272 1.272L12 13.273l-5.863 5.863a.9.9 0 0 1-1.273-1.272L10.727 12 4.864 6.136a.9.9 0 0 1 0-1.272Z\" clip-rule=\"evenodd\"/></svg>',\n keywords: [\"close\"],\n category: \"utility\"\n};\nexport {\n l as close\n};\n//# sourceMappingURL=close.es.js.map\n","const e = {\n name: \"info-filled\",\n svg: '<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 24 24\" fill=\"currentColor\"><path fill-rule=\"evenodd\" d=\"M12 22c5.523 0 10-4.477 10-10S17.523 2 12 2 2 6.477 2 12s4.477 10 10 10ZM10.9 7.786c0 .591.516 1.077 1.108 1.077.576 0 1.092-.486 1.092-1.077 0-.592-.516-1.078-1.092-1.078-.592 0-1.108.486-1.108 1.078Zm.167 9.74h1.866V9.94h-1.866v7.586Z\" clip-rule=\"evenodd\"/></svg>',\n keywords: [\"info-filled\"],\n category: \"status\"\n};\nexport {\n e as infoFilled\n};\n//# sourceMappingURL=info-filled.es.js.map\n","import React, { forwardRef } from \"react\";\nimport { Button } from \"@purpur/button\";\nimport type { BaseProps } from \"@purpur/common-types\";\nimport { Heading, type HeadingTagType } from \"@purpur/heading\";\nimport { Icon } from \"@purpur/icon\";\nimport { alertFilled } from \"@purpur/icon/assets/alert-filled\";\nimport { checkCircleFilled } from \"@purpur/icon/assets/check-circle-filled\";\nimport { close } from \"@purpur/icon/assets/close\";\nimport { errorFilled } from \"@purpur/icon/assets/error-filled\";\nimport { infoFilled } from \"@purpur/icon/assets/info-filled\";\nimport { Paragraph } from \"@purpur/paragraph\";\nimport c from \"classnames/bind\";\n\nimport styles from \"./notification.module.scss\";\n\nconst cx = c.bind(styles);\n\nexport const NOTIFICATION_STATUS = {\n SUCCESS: \"success\",\n WARNING: \"warning\",\n ERROR: \"error\",\n INFO: \"info\",\n} as const;\n\nexport const notificationStatuses = Object.values(NOTIFICATION_STATUS);\nexport type NotificationStatus = (typeof NOTIFICATION_STATUS)[keyof typeof NOTIFICATION_STATUS];\n\nexport const NOTIFICATION_ARIA_LIVE = {\n POLITE: \"polite\",\n ASSERTIVE: \"assertive\",\n} as const;\n\nexport const notificationAriaLiveValues = Object.values(NOTIFICATION_ARIA_LIVE);\nexport type NotificationAriaLive =\n (typeof NOTIFICATION_ARIA_LIVE)[keyof typeof NOTIFICATION_ARIA_LIVE];\n\nexport const NOTIFICATION_ROLE = {\n ALERT: \"alert\",\n DIALOG: \"dialog\",\n ALERTDIALOG: \"alertdialog\",\n} as const;\n\nexport const notificationRoles = Object.values(NOTIFICATION_ROLE);\nexport type NotificationRole = (typeof NOTIFICATION_ROLE)[keyof typeof NOTIFICATION_ROLE];\n\nconst rootClassName = \"purpur-notification\";\n\nconst getStatusIcon = (status: NotificationStatus) => {\n switch (status) {\n case NOTIFICATION_STATUS.INFO:\n return infoFilled;\n case NOTIFICATION_STATUS.SUCCESS:\n return checkCircleFilled;\n case NOTIFICATION_STATUS.WARNING:\n return alertFilled;\n case NOTIFICATION_STATUS.ERROR:\n return errorFilled;\n }\n};\n\ntype DefaultProps = BaseProps & {\n [\"aria-live\"]?: NotificationAriaLive;\n headingTag?: HeadingTagType;\n status?: NotificationStatus;\n heading?: string;\n role?: NotificationRole;\n hidden?: boolean;\n /**\n * Use to explicitly not open the notification initially and open it programatically to trigger\n * that the aria-live message is read by the screen reader correctly.\n */\n open?: boolean;\n hideIcon?: boolean;\n};\n\ntype CloseButtonProps = {\n onClose: () => void;\n closeButtonAriaLabel: string;\n};\n\ntype NoCloseButtonProps = {\n onClose?: never;\n closeButtonAriaLabel?: never;\n};\n\nexport type NotificationProps = DefaultProps & (CloseButtonProps | NoCloseButtonProps);\n\nexport const Notification = forwardRef<HTMLDivElement, NotificationProps>(\n (\n {\n [\"data-testid\"]: dataTestId,\n [\"aria-live\"]: ariaLive,\n children,\n className,\n closeButtonAriaLabel,\n headingTag = \"h4\",\n status = \"info\",\n heading,\n hidden,\n id,\n onClose,\n open = true,\n hideIcon,\n ...props\n },\n ref\n ) => {\n const showHeader = !!heading || !hideIcon;\n\n return (\n <div aria-live={ariaLive}>\n {open && (\n <div\n id={id}\n aria-labelledby={id ? `${id}-heading` : undefined}\n aria-describedby={id ? `${id}-body` : undefined}\n aria-hidden={!!hidden}\n className={cx(className, rootClassName, `${rootClassName}--${status}`, {\n [`${rootClassName}--hidden`]: hidden,\n [`${rootClassName}--has-close-button`]: !!onClose,\n })}\n data-testid={dataTestId}\n ref={ref}\n {...props}\n >\n {showHeader && (\n <div className={cx(`${rootClassName}__top`)}>\n <div className={cx(`${rootClassName}__header`)}>\n {!hideIcon && (\n <Icon\n data-testid={dataTestId ? `${dataTestId}-icon` : undefined}\n className={cx(`${rootClassName}__icon`)}\n svg={getStatusIcon(status)}\n size=\"md\"\n />\n )}\n {!!heading && (\n <Heading\n data-testid={dataTestId ? `${dataTestId}-heading` : undefined}\n variant=\"subsection-100\"\n tag={headingTag}\n className={cx(`${rootClassName}__heading`)}\n >\n <span id={id ? `${id}-heading` : undefined}> {heading}</span>\n </Heading>\n )}\n </div>\n </div>\n )}\n {onClose && (\n <Button\n data-testid={dataTestId ? `${dataTestId}-close-button` : undefined}\n variant=\"tertiary-purple\"\n size=\"sm\"\n iconOnly\n aria-label={closeButtonAriaLabel}\n onClick={onClose}\n className={cx(`${rootClassName}__close-button`)}\n >\n <Icon svg={close} size=\"sm\" />\n </Button>\n )}\n {children && (\n <div\n data-testid={dataTestId ? `${dataTestId}-body` : undefined}\n className={cx(`${rootClassName}__body`, {\n [`${rootClassName}__body--extra-padding`]: !showHeader && !!onClose,\n })}\n id={id ? `${id}-body` : undefined}\n >\n {typeof children === \"string\" ? (\n <Paragraph\n data-testid={dataTestId ? `${dataTestId}-paragraph` : undefined}\n variant=\"paragraph-100\"\n >\n {children}\n </Paragraph>\n ) : (\n children\n )}\n </div>\n )}\n </div>\n )}\n </div>\n );\n }\n);\n\nNotification.displayName = \"Notification\";\n"],"names":["l","e","cx","c","styles","NOTIFICATION_STATUS","notificationStatuses","NOTIFICATION_ARIA_LIVE","notificationAriaLiveValues","NOTIFICATION_ROLE","notificationRoles","rootClassName","getStatusIcon","status","infoFilled","checkCircleFilled","alertFilled","errorFilled","Notification","forwardRef","dataTestId","ariaLive","children","className","closeButtonAriaLabel","headingTag","heading","hidden","id","onClose","open","hideIcon","props","ref","showHeader","jsx","jsxs","Icon","Heading","Button","close","Paragraph"],"mappings":"6RAAMA,EAAI,CACR,KAAM,eACN,IAAK,kZACL,SAAU,CAAC,cAAc,EACzB,SAAU,QACZ,ECLMC,EAAI,CACR,KAAM,sBACN,IAAK,8UACL,SAAU,CAAC,qBAAqB,EAChC,SAAU,QACZ,ECLMD,EAAI,CACR,KAAM,QACN,IAAK,8VACL,SAAU,CAAC,OAAO,EAClB,SAAU,SACZ,ECLMC,EAAI,CACR,KAAM,cACN,IAAK,yXACL,SAAU,CAAC,aAAa,EACxB,SAAU,QACZ,q/BCUMC,EAAKC,EAAAA,EAAE,KAAKC,CAAM,EAEXC,EAAsB,CACjC,QAAS,UACT,QAAS,UACT,MAAO,QACP,KAAM,MACR,EAEaC,EAAuB,OAAO,OAAOD,CAAmB,EAGxDE,EAAyB,CACpC,OAAQ,SACR,UAAW,WACb,EAEaC,EAA6B,OAAO,OAAOD,CAAsB,EAIjEE,EAAoB,CAC/B,MAAO,QACP,OAAQ,SACR,YAAa,aACf,EAEaC,EAAoB,OAAO,OAAOD,CAAiB,EAG1DE,EAAgB,sBAEhBC,EAAiBC,GAA+B,CACpD,OAAQA,EAAA,CACN,KAAKR,EAAoB,KACvB,OAAOS,EACT,KAAKT,EAAoB,QACvB,OAAOU,EACT,KAAKV,EAAoB,QACvB,OAAOW,EACT,KAAKX,EAAoB,MACvB,O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C,OAAA,CAAK,GAAIiB,EAAK,GAAGA,CAAE,WAAa,OAAW,SAAA,CAAA,IAAEF,CAAA,CAAA,CAAQ,CAAA,CAAA,CACxD,CAAA,CAEJ,CAAA,CACF,EAEDG,GACCM,EAAAA,IAACI,EAAAA,OAAA,CACC,cAAanB,EAAa,GAAGA,CAAU,gBAAkB,OACzD,QAAQ,kBACR,KAAK,KACL,SAAQ,GACR,aAAYI,EACZ,QAASK,EACT,UAAW3B,EAAG,GAAGS,CAAa,gBAAgB,EAE9C,SAAAwB,EAAAA,IAACE,IAAA,CAAK,IAAKG,EAAO,KAAK,IAAA,CAAK,CAAA,CAAA,EAG/BlB,GACCa,EAAAA,IAAC,MAAA,CACC,cAAaf,EAAa,GAAGA,CAAU,QAAU,OACjD,UAAWlB,EAAG,GAAGS,CAAa,SAAU,CACtC,CAAC,GAAGA,CAAa,uBAAuB,EAAG,CAACuB,GAAc,CAAC,CAACL,CAAA,CAC7D,EACD,GAAID,EAAK,GAAGA,CAAE,QAAU,OAEvB,SAAA,OAAON,GAAa,SACnBa,EAAAA,IAACM,EAAAA,UAAA,CACC,cAAarB,EAAa,GAAGA,CAAU,aAAe,OACtD,QAAQ,gBAEP,SAAAE,CAAA,CAAA,EAGHA,CAAA,CAAA,CAEJ,CAAA,CAAA,EAIR,CAEJ,CACF,EAEAJ,EAAa,YAAc"}
@@ -1,8 +1,8 @@
1
1
  import { jsx as i, jsxs as t } from "react/jsx-runtime";
2
2
  import { forwardRef as N } from "react";
3
- import { c as v } from "./button-DBX_tvfJ.mjs";
3
+ import { b as v } from "./button-BfYKNBmC.mjs";
4
4
  import { G as $ } from "./grid-DGnCQgwf.mjs";
5
- import { a as g } from "./heading-gqtQNo5n.mjs";
5
+ import { H as g } from "./heading-xwBuT_-9.mjs";
6
6
  import { r as x } from "./close.es-BPmk2wkU.mjs";
7
7
  import { r as y } from "./info.es-u0pS2u7W.mjs";
8
8
  import { c as z } from "./bind-CU-R61T-.mjs";
@@ -72,4 +72,4 @@ j.displayName = "NotificationBanner";
72
72
  export {
73
73
  j as N
74
74
  };
75
- //# sourceMappingURL=notification-banner-BY2iZOIa.mjs.map
75
+ //# sourceMappingURL=notification-banner-CQvBezAL.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"notification-banner-BY2iZOIa.mjs","sources":["../../../components/notification-banner/src/notification-banner.tsx"],"sourcesContent":["import React, { forwardRef, type ReactNode } from \"react\";\nimport { Button } from \"@purpur/button\";\nimport type { BaseProps } from \"@purpur/common-types\";\nimport { Grid } from \"@purpur/grid\";\nimport { Heading, type HeadingTagType } from \"@purpur/heading\";\nimport { IconClose } from \"@purpur/icon/close\";\nimport { IconInfo } from \"@purpur/icon/info\";\nimport c from \"classnames/bind\";\n\nimport styles from \"./notification-banner.module.scss\";\n\nconst cx = c.bind(styles);\n\nexport type DefaultProps = BaseProps & {\n closeButtonAriaLabel?: string;\n description?: string;\n hideIcon?: boolean;\n icon?: ReactNode;\n link?: ReactNode;\n titleTag?: HeadingTagType;\n title?: string;\n};\n\ntype CloseButtonProps = {\n onClose: () => void;\n closeButtonAriaLabel: string;\n};\n\ntype NoCloseButtonProps = {\n onClose?: never;\n closeButtonAriaLabel?: never;\n};\n\nexport type NotificationBannerProps = DefaultProps & (CloseButtonProps | NoCloseButtonProps);\n\nconst rootClassName = \"purpur-notification-banner\";\n\nexport const NotificationBanner = forwardRef<HTMLDivElement, NotificationBannerProps>(\n (\n {\n [\"data-testid\"]: dataTestId,\n children,\n className,\n closeButtonAriaLabel,\n description,\n hideIcon,\n icon,\n link,\n onClose,\n titleTag = \"h4\",\n title,\n ...props\n },\n ref\n ) => {\n const classes = cx(className, rootClassName);\n\n return (\n <div {...props} className={classes} role=\"alert\" ref={ref} data-testid={dataTestId}>\n <Grid>\n <div className={cx(`${rootClassName}__container`)}>\n {!hideIcon ? (\n icon ? (\n <span className={cx(`${rootClassName}__icon`)}>{icon}</span>\n ) : (\n <IconInfo className={cx(`${rootClassName}__icon`)} size=\"sm\" />\n )\n ) : null}\n <div className={cx(`${rootClassName}__content`)}>\n <Heading\n tag={titleTag}\n variant=\"subsection-100\"\n className={cx([\n `${rootClassName}__heading`,\n { [`${rootClassName}__heading--no-overlap`]: onClose },\n ])}\n >\n {title}\n </Heading>\n <div>\n {description} {link}\n </div>\n {children}\n </div>\n {onClose && (\n <Button\n data-testid={dataTestId ? `${dataTestId}-close-button` : undefined}\n variant=\"tertiary-purple\"\n size=\"sm\"\n iconOnly\n aria-label={closeButtonAriaLabel}\n onClick={onClose}\n className={cx(`${rootClassName}__close-button`)}\n >\n <IconClose size=\"sm\" />\n </Button>\n )}\n </div>\n </Grid>\n </div>\n );\n }\n);\n\nNotificationBanner.displayName = \"NotificationBanner\";\n"],"names":["cx","c","styles","rootClassName","NotificationBanner","forwardRef","dataTestId","children","className","closeButtonAriaLabel","description","hideIcon","icon","link","onClose","titleTag","title","props","ref","classes","jsx","Grid","IconInfo","Heading","Button","IconClose"],"mappings":";;;;;;;;;;;;;;;;GAWMA,IAAKC,EAAE,KAAKC,CAAM,GAwBlBC,IAAgB,8BAETC,IAAqBC;AAAA,EAChC,CACE;AAAA,IACE,CAAC,gBAAgBC;AAAA,IACjB,UAAAC;AAAA,IACA,WAAAC;AAAA,IACA,sBAAAC;AAAA,IACA,aAAAC;AAAA,IACA,UAAAC;AAAA,IACA,MAAAC;AAAA,IACA,MAAAC;AAAA,IACA,SAAAC;AAAA,IACA,UAAAC,IAAW;AAAA,IACX,OAAAC;AAAA,IACA,GAAGC;AAAA,EAAA,GAELC,MACG;AACH,UAAMC,IAAUnB,EAAGQ,GAAWL,CAAa;AAE3C,WACE,gBAAAiB,EAAC,SAAK,GAAGH,GAAO,WAAWE,GAAS,MAAK,SAAQ,KAAAD,GAAU,eAAaZ,GACtE,UAAA,gBAAAc,EAACC,GAAA,EACC,4BAAC,OAAA,EAAI,WAAWrB,EAAG,GAAGG,CAAa,aAAa,GAC7C,UAAA;AAAA,MAACQ,IAME,OALFC,IACE,gBAAAQ,EAAC,QAAA,EAAK,WAAWpB,EAAG,GAAGG,CAAa,QAAQ,GAAI,UAAAS,GAAK,IAErD,gBAAAQ,EAACE,GAAA,EAAS,WAAWtB,EAAG,GAAGG,CAAa,QAAQ,GAAG,MAAK,KAAA,CAAK;AAAA,wBAGhE,OAAA,EAAI,WAAWH,EAAG,GAAGG,CAAa,WAAW,GAC5C,UAAA;AAAA,QAAA,gBAAAiB;AAAA,UAACG;AAAA,UAAA;AAAA,YACC,KAAKR;AAAA,YACL,SAAQ;AAAA,YACR,WAAWf,EAAG;AAAA,cACZ,GAAGG,CAAa;AAAA,cAChB,EAAE,CAAC,GAAGA,CAAa,uBAAuB,GAAGW,EAAA;AAAA,YAAQ,CACtD;AAAA,YAEA,UAAAE;AAAA,UAAA;AAAA,QAAA;AAAA,0BAEF,OAAA,EACE,UAAA;AAAA,UAAAN;AAAA,UAAY;AAAA,UAAEG;AAAA,QAAA,GACjB;AAAA,QACCN;AAAA,MAAA,GACH;AAAA,MACCO,KACC,gBAAAM;AAAA,QAACI;AAAA,QAAA;AAAA,UACC,eAAalB,IAAa,GAAGA,CAAU,kBAAkB;AAAA,UACzD,SAAQ;AAAA,UACR,MAAK;AAAA,UACL,UAAQ;AAAA,UACR,cAAYG;AAAA,UACZ,SAASK;AAAA,UACT,WAAWd,EAAG,GAAGG,CAAa,gBAAgB;AAAA,UAE9C,UAAA,gBAAAiB,EAACK,GAAA,EAAU,MAAK,KAAA,CAAK;AAAA,QAAA;AAAA,MAAA;AAAA,IACvB,EAAA,CAEJ,GACF,GACF;AAAA,EAEJ;AACF;AAEArB,EAAmB,cAAc;"}
1
+ {"version":3,"file":"notification-banner-CQvBezAL.mjs","sources":["../../../components/notification-banner/src/notification-banner.tsx"],"sourcesContent":["import React, { forwardRef, type ReactNode } from \"react\";\nimport { Button } from \"@purpur/button\";\nimport type { BaseProps } from \"@purpur/common-types\";\nimport { Grid } from \"@purpur/grid\";\nimport { Heading, type HeadingTagType } from \"@purpur/heading\";\nimport { IconClose } from \"@purpur/icon/close\";\nimport { IconInfo } from \"@purpur/icon/info\";\nimport c from \"classnames/bind\";\n\nimport styles from \"./notification-banner.module.scss\";\n\nconst cx = c.bind(styles);\n\nexport type DefaultProps = BaseProps & {\n closeButtonAriaLabel?: string;\n description?: string;\n hideIcon?: boolean;\n icon?: ReactNode;\n link?: ReactNode;\n titleTag?: HeadingTagType;\n title?: string;\n};\n\ntype CloseButtonProps = {\n onClose: () => void;\n closeButtonAriaLabel: string;\n};\n\ntype NoCloseButtonProps = {\n onClose?: never;\n closeButtonAriaLabel?: never;\n};\n\nexport type NotificationBannerProps = DefaultProps & (CloseButtonProps | NoCloseButtonProps);\n\nconst rootClassName = \"purpur-notification-banner\";\n\nexport const NotificationBanner = forwardRef<HTMLDivElement, NotificationBannerProps>(\n (\n {\n [\"data-testid\"]: dataTestId,\n children,\n className,\n closeButtonAriaLabel,\n description,\n hideIcon,\n icon,\n link,\n onClose,\n titleTag = \"h4\",\n title,\n ...props\n },\n ref\n ) => {\n const classes = cx(className, rootClassName);\n\n return (\n <div {...props} className={classes} role=\"alert\" ref={ref} data-testid={dataTestId}>\n <Grid>\n <div className={cx(`${rootClassName}__container`)}>\n {!hideIcon ? (\n icon ? (\n <span className={cx(`${rootClassName}__icon`)}>{icon}</span>\n ) : (\n <IconInfo className={cx(`${rootClassName}__icon`)} size=\"sm\" />\n )\n ) : null}\n <div className={cx(`${rootClassName}__content`)}>\n <Heading\n tag={titleTag}\n variant=\"subsection-100\"\n className={cx([\n `${rootClassName}__heading`,\n { [`${rootClassName}__heading--no-overlap`]: onClose },\n ])}\n >\n {title}\n </Heading>\n <div>\n {description} {link}\n </div>\n {children}\n </div>\n {onClose && (\n <Button\n data-testid={dataTestId ? `${dataTestId}-close-button` : undefined}\n variant=\"tertiary-purple\"\n size=\"sm\"\n iconOnly\n aria-label={closeButtonAriaLabel}\n onClick={onClose}\n className={cx(`${rootClassName}__close-button`)}\n >\n <IconClose size=\"sm\" />\n </Button>\n )}\n </div>\n </Grid>\n </div>\n );\n }\n);\n\nNotificationBanner.displayName = \"NotificationBanner\";\n"],"names":["cx","c","styles","rootClassName","NotificationBanner","forwardRef","dataTestId","children","className","closeButtonAriaLabel","description","hideIcon","icon","link","onClose","titleTag","title","props","ref","classes","jsx","Grid","IconInfo","Heading","Button","IconClose"],"mappings":";;;;;;;;;;;;;;;;GAWMA,IAAKC,EAAE,KAAKC,CAAM,GAwBlBC,IAAgB,8BAETC,IAAqBC;AAAA,EAChC,CACE;AAAA,IACE,CAAC,gBAAgBC;AAAA,IACjB,UAAAC;AAAA,IACA,WAAAC;AAAA,IACA,sBAAAC;AAAA,IACA,aAAAC;AAAA,IACA,UAAAC;AAAA,IACA,MAAAC;AAAA,IACA,MAAAC;AAAA,IACA,SAAAC;AAAA,IACA,UAAAC,IAAW;AAAA,IACX,OAAAC;AAAA,IACA,GAAGC;AAAA,EAAA,GAELC,MACG;AACH,UAAMC,IAAUnB,EAAGQ,GAAWL,CAAa;AAE3C,WACE,gBAAAiB,EAAC,SAAK,GAAGH,GAAO,WAAWE,GAAS,MAAK,SAAQ,KAAAD,GAAU,eAAaZ,GACtE,UAAA,gBAAAc,EAACC,GAAA,EACC,4BAAC,OAAA,EAAI,WAAWrB,EAAG,GAAGG,CAAa,aAAa,GAC7C,UAAA;AAAA,MAACQ,IAME,OALFC,IACE,gBAAAQ,EAAC,QAAA,EAAK,WAAWpB,EAAG,GAAGG,CAAa,QAAQ,GAAI,UAAAS,GAAK,IAErD,gBAAAQ,EAACE,GAAA,EAAS,WAAWtB,EAAG,GAAGG,CAAa,QAAQ,GAAG,MAAK,KAAA,CAAK;AAAA,wBAGhE,OAAA,EAAI,WAAWH,EAAG,GAAGG,CAAa,WAAW,GAC5C,UAAA;AAAA,QAAA,gBAAAiB;AAAA,UAACG;AAAA,UAAA;AAAA,YACC,KAAKR;AAAA,YACL,SAAQ;AAAA,YACR,WAAWf,EAAG;AAAA,cACZ,GAAGG,CAAa;AAAA,cAChB,EAAE,CAAC,GAAGA,CAAa,uBAAuB,GAAGW,EAAA;AAAA,YAAQ,CACtD;AAAA,YAEA,UAAAE;AAAA,UAAA;AAAA,QAAA;AAAA,0BAEF,OAAA,EACE,UAAA;AAAA,UAAAN;AAAA,UAAY;AAAA,UAAEG;AAAA,QAAA,GACjB;AAAA,QACCN;AAAA,MAAA,GACH;AAAA,MACCO,KACC,gBAAAM;AAAA,QAACI;AAAA,QAAA;AAAA,UACC,eAAalB,IAAa,GAAGA,CAAU,kBAAkB;AAAA,UACzD,SAAQ;AAAA,UACR,MAAK;AAAA,UACL,UAAQ;AAAA,UACR,cAAYG;AAAA,UACZ,SAASK;AAAA,UACT,WAAWd,EAAG,GAAGG,CAAa,gBAAgB;AAAA,UAE9C,UAAA,gBAAAiB,EAACK,GAAA,EAAU,MAAK,KAAA,CAAK;AAAA,QAAA;AAAA,MAAA;AAAA,IACvB,EAAA,CAEJ,GACF,GACF;AAAA,EAEJ;AACF;AAEArB,EAAmB,cAAc;"}
@@ -1,2 +1,2 @@
1
- "use strict";const n=require("react/jsx-runtime"),x=require("react"),N=require("./button-ChYUPi2k.js"),j=require("./grid-uGMD2euo.js"),g=require("./heading-DLCdW6gx.js"),v=require("./close.es-VL3lKi1O.js"),q=require("./info.es-Br84jly5.js"),$=require("./bind-DeUYJ6m9.js"),y={"purpur-notification-banner":"_purpur-notification-banner_llblm_1","purpur-notification-banner__container":"_purpur-notification-banner__container_llblm_6","purpur-notification-banner__content":"_purpur-notification-banner__content_llblm_11","purpur-notification-banner__icon":"_purpur-notification-banner__icon_llblm_16","purpur-notification-banner__heading":"_purpur-notification-banner__heading_llblm_19","purpur-notification-banner__heading--no-overlap":"_purpur-notification-banner__heading--no-overlap_llblm_22","purpur-notification-banner__close-button":"_purpur-notification-banner__close-button_llblm_25"},r=$.c.bind(y),i="purpur-notification-banner",o=x.forwardRef(({["data-testid"]:e,children:c,className:s,closeButtonAriaLabel:_,description:l,hideIcon:u,icon:a,link:p,onClose:t,titleTag:b="h4",title:d,...f},m)=>{const h=r(s,i);return n.jsx("div",{...f,className:h,role:"alert",ref:m,"data-testid":e,children:n.jsx(j.Grid,{children:n.jsxs("div",{className:r(`${i}__container`),children:[u?null:a?n.jsx("span",{className:r(`${i}__icon`),children:a}):n.jsx(q.r,{className:r(`${i}__icon`),size:"sm"}),n.jsxs("div",{className:r(`${i}__content`),children:[n.jsx(g.Heading,{tag:b,variant:"subsection-100",className:r([`${i}__heading`,{[`${i}__heading--no-overlap`]:t}]),children:d}),n.jsxs("div",{children:[l," ",p]}),c]}),t&&n.jsx(N.Button,{"data-testid":e?`${e}-close-button`:void 0,variant:"tertiary-purple",size:"sm",iconOnly:!0,"aria-label":_,onClick:t,className:r(`${i}__close-button`),children:n.jsx(v.r,{size:"sm"})})]})})})});o.displayName="NotificationBanner";exports.NotificationBanner=o;
2
- //# sourceMappingURL=notification-banner-C8XsBDTq.js.map
1
+ "use strict";const n=require("react/jsx-runtime"),x=require("react"),N=require("./button-DDYGuqZ0.js"),j=require("./grid-uGMD2euo.js"),g=require("./heading-drD5ugCC.js"),v=require("./close.es-VL3lKi1O.js"),q=require("./info.es-Br84jly5.js"),$=require("./bind-DeUYJ6m9.js"),y={"purpur-notification-banner":"_purpur-notification-banner_llblm_1","purpur-notification-banner__container":"_purpur-notification-banner__container_llblm_6","purpur-notification-banner__content":"_purpur-notification-banner__content_llblm_11","purpur-notification-banner__icon":"_purpur-notification-banner__icon_llblm_16","purpur-notification-banner__heading":"_purpur-notification-banner__heading_llblm_19","purpur-notification-banner__heading--no-overlap":"_purpur-notification-banner__heading--no-overlap_llblm_22","purpur-notification-banner__close-button":"_purpur-notification-banner__close-button_llblm_25"},r=$.c.bind(y),i="purpur-notification-banner",o=x.forwardRef(({["data-testid"]:e,children:c,className:s,closeButtonAriaLabel:_,description:l,hideIcon:u,icon:a,link:p,onClose:t,titleTag:b="h4",title:d,...f},m)=>{const h=r(s,i);return n.jsx("div",{...f,className:h,role:"alert",ref:m,"data-testid":e,children:n.jsx(j.Grid,{children:n.jsxs("div",{className:r(`${i}__container`),children:[u?null:a?n.jsx("span",{className:r(`${i}__icon`),children:a}):n.jsx(q.r,{className:r(`${i}__icon`),size:"sm"}),n.jsxs("div",{className:r(`${i}__content`),children:[n.jsx(g.Heading,{tag:b,variant:"subsection-100",className:r([`${i}__heading`,{[`${i}__heading--no-overlap`]:t}]),children:d}),n.jsxs("div",{children:[l," ",p]}),c]}),t&&n.jsx(N.Button,{"data-testid":e?`${e}-close-button`:void 0,variant:"tertiary-purple",size:"sm",iconOnly:!0,"aria-label":_,onClick:t,className:r(`${i}__close-button`),children:n.jsx(v.r,{size:"sm"})})]})})})});o.displayName="NotificationBanner";exports.NotificationBanner=o;
2
+ //# sourceMappingURL=notification-banner-CT4ew8IQ.js.map