@purpur/library 10.1.1 → 10.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (286) hide show
  1. package/CHANGELOG.json +45 -0
  2. package/CHANGELOG.md +19 -1
  3. package/dist/LICENSE.txt +14 -7
  4. package/dist/{RichText-B865Qkzj.js → RichText-CeYecUFV.js} +2 -2
  5. package/dist/{RichText-B865Qkzj.js.map → RichText-CeYecUFV.js.map} +1 -1
  6. package/dist/{RichText-CPkBwXNI.mjs → RichText-CwQfDo_S.mjs} +2 -2
  7. package/dist/{RichText-CPkBwXNI.mjs.map → RichText-CwQfDo_S.mjs.map} +1 -1
  8. package/dist/{ThemeProvider-BJGm3zai.js → ThemeProvider-BGep6X_i.js} +2 -2
  9. package/dist/{ThemeProvider-BJGm3zai.js.map → ThemeProvider-BGep6X_i.js.map} +1 -1
  10. package/dist/{ThemeProvider-BJ25_asg.mjs → ThemeProvider-BrAZhasG.mjs} +13 -13
  11. package/dist/{ThemeProvider-BJ25_asg.mjs.map → ThemeProvider-BrAZhasG.mjs.map} +1 -1
  12. package/dist/components/avatar/src/avatar.d.ts +1 -1
  13. package/dist/components/card/src/card-content-container.d.ts +2 -2
  14. package/dist/components/comparison-table/src/components/OptionCard/option-card.d.ts +1 -1
  15. package/dist/components/container/src/container.visual.fixtures.d.ts +14 -0
  16. package/dist/components/container/src/container.visual.fixtures.d.ts.map +1 -0
  17. package/dist/components/content-block/src/content-block-group.d.ts +2 -2
  18. package/dist/components/content-block/src/content-block.d.ts +2 -2
  19. package/dist/components/countdown/src/countdown.d.ts +1 -1
  20. package/dist/components/countdown/src/countdown.d.ts.map +1 -1
  21. package/dist/components/countdown/src/countdown.types.d.ts +19 -3
  22. package/dist/components/countdown/src/countdown.types.d.ts.map +1 -1
  23. package/dist/components/date-field/src/date-field.d.ts +14 -6
  24. package/dist/components/date-field/src/date-field.d.ts.map +1 -1
  25. package/dist/components/date-field/src/utils.d.ts +40 -2
  26. package/dist/components/date-field/src/utils.d.ts.map +1 -1
  27. package/dist/components/date-picker/src/date-picker.d.ts +4 -4
  28. package/dist/components/date-range-field/src/date-range-field.d.ts +3 -1
  29. package/dist/components/date-range-field/src/date-range-field.d.ts.map +1 -1
  30. package/dist/components/dismissable-chip-group/src/dismissable-chip-group-item.d.ts +2 -2
  31. package/dist/components/dismissable-chip-group/src/dismissable-chip-group.d.ts +2 -2
  32. package/dist/components/drawer/src/drawer-container.d.ts +2 -2
  33. package/dist/components/drawer/src/drawer-content.d.ts +2 -2
  34. package/dist/components/drawer/src/drawer-scroll-area.d.ts +1 -1
  35. package/dist/components/dropdown/src/dropdown-combobox.d.ts.map +1 -1
  36. package/dist/components/dropdown/src/dropdown-shared.d.ts +3 -1
  37. package/dist/components/dropdown/src/dropdown-shared.d.ts.map +1 -1
  38. package/dist/components/dropdown/src/dropdown.types.d.ts +3 -0
  39. package/dist/components/dropdown/src/dropdown.types.d.ts.map +1 -1
  40. package/dist/components/dropdown/src/useDropdown.d.ts +1 -1
  41. package/dist/components/field-error-text/src/field-error-text.d.ts +1 -1
  42. package/dist/components/file-upload/src/file-upload-types.d.ts +1 -1
  43. package/dist/components/footer/src/footer-navigation.d.ts +2 -2
  44. package/dist/components/footer/src/footer-social-link.d.ts +2 -2
  45. package/dist/components/footer/src/footer.d.ts +3 -3
  46. package/dist/components/hero-banner/src/hero-banner-actions.d.ts +2 -2
  47. package/dist/components/hero-banner/src/hero-banner-media.d.ts +2 -2
  48. package/dist/components/hero-banner/src/hero-banner-types.d.ts +3 -3
  49. package/dist/components/link/src/link.d.ts +1 -1
  50. package/dist/components/listbox/src/listbox-item.d.ts +2 -2
  51. package/dist/components/loading/src/loading-illustrative.d.ts +1 -1
  52. package/dist/components/modal/src/modal-content.d.ts +2 -2
  53. package/dist/components/modal/src/modal-trigger.d.ts +2 -2
  54. package/dist/components/pagination/src/pagination-page-selector.d.ts +2 -2
  55. package/dist/components/pagination/src/pagination-page-trigger.d.ts +2 -2
  56. package/dist/components/pagination/src/pagination-step-trigger.d.ts +1 -1
  57. package/dist/components/pagination/src/types.d.ts +2 -2
  58. package/dist/components/pagination/src/use-page-options.hook.d.ts +2 -2
  59. package/dist/components/pagination/src/use-page-size-options.hook.d.ts +2 -2
  60. package/dist/components/password-field/src/password-field.d.ts +1 -1
  61. package/dist/components/password-field/src/password-strength-indicator.d.ts +2 -2
  62. package/dist/components/password-field/src/password-strength.d.ts +2 -2
  63. package/dist/components/popover/src/popover-button.d.ts +2 -2
  64. package/dist/components/product-card/src/product-card.d.ts +3 -3
  65. package/dist/components/promotion-card/src/promotion-card.d.ts +3 -3
  66. package/dist/components/quantity-selector/src/quantity-selector.d.ts +1 -1
  67. package/dist/components/radio-button-group/src/radio-button-group-root.d.ts +3 -3
  68. package/dist/components/radio-card-group/src/radio-card-item.d.ts +1 -1
  69. package/dist/components/rich-text/src/types.d.ts +1 -1
  70. package/dist/components/search-field/src/search-field-autocomplete.d.ts +7 -4
  71. package/dist/components/search-field/src/search-field-autocomplete.d.ts.map +1 -1
  72. package/dist/components/search-field/src/search-field-base.d.ts +4 -2
  73. package/dist/components/search-field/src/search-field-base.d.ts.map +1 -1
  74. package/dist/components/search-field/src/search-field.d.ts +12 -6
  75. package/dist/components/search-field/src/search-field.d.ts.map +1 -1
  76. package/dist/components/spinner/src/spinner.d.ts +1 -1
  77. package/dist/components/stepper/src/stepper-container.d.ts +2 -2
  78. package/dist/components/stepper/src/stepper-content.d.ts +2 -2
  79. package/dist/components/stepper/src/stepper-link.d.ts +1 -1
  80. package/dist/components/stepper/src/stepper.d.ts +1 -1
  81. package/dist/components/table/src/cell-types/button-group-cell.d.ts +3 -3
  82. package/dist/components/table/src/table-content.d.ts +2 -2
  83. package/dist/components/table/src/table.d.ts +2 -2
  84. package/dist/components/table/src/types.d.ts +4 -4
  85. package/dist/components/tabs/src/tab-content.d.ts +2 -2
  86. package/dist/components/text-field/src/text-field.d.ts +1 -1
  87. package/dist/components/text-spacing/src/text-spacing.d.ts +1 -1
  88. package/dist/components/toggle/src/toggle.d.ts +1 -1
  89. package/dist/components/tooltip/src/tooltip.d.ts +3 -3
  90. package/dist/components-metadata.js +1 -0
  91. package/dist/countdown-CdGFNLZq.js +2 -0
  92. package/dist/countdown-CdGFNLZq.js.map +1 -0
  93. package/dist/countdown-G7eg3CZj.mjs +188 -0
  94. package/dist/countdown-G7eg3CZj.mjs.map +1 -0
  95. package/dist/countdown.cjs.js +1 -1
  96. package/dist/countdown.es.js +1 -1
  97. package/dist/date-field-D8yGH1mw.js +2 -0
  98. package/dist/{date-field-CtpWDaSh.js.map → date-field-D8yGH1mw.js.map} +1 -1
  99. package/dist/{date-field-_rCuf15v.mjs → date-field-DVMPYoLT.mjs} +361 -311
  100. package/dist/{date-field-_rCuf15v.mjs.map → date-field-DVMPYoLT.mjs.map} +1 -1
  101. package/dist/date-field.cjs.js +1 -1
  102. package/dist/date-field.es.js +1 -1
  103. package/dist/{date-picker-sqcNAplg.mjs → date-picker-Ban9DLsx.mjs} +6 -6
  104. package/dist/{date-picker-sqcNAplg.mjs.map → date-picker-Ban9DLsx.mjs.map} +1 -1
  105. package/dist/{date-picker-BYlszX1W.js → date-picker-re3cPV_Z.js} +2 -2
  106. package/dist/{date-picker-BYlszX1W.js.map → date-picker-re3cPV_Z.js.map} +1 -1
  107. package/dist/date-picker.cjs.js +1 -1
  108. package/dist/date-picker.es.js +1 -1
  109. package/dist/date-range-field-8JmPw-Ei.js +2 -0
  110. package/dist/date-range-field-8JmPw-Ei.js.map +1 -0
  111. package/dist/{date-range-field-BmjQeiOv.mjs → date-range-field-dmJO66U_.mjs} +64 -61
  112. package/dist/date-range-field-dmJO66U_.mjs.map +1 -0
  113. package/dist/date-range-field.cjs.js +1 -1
  114. package/dist/date-range-field.es.js +1 -1
  115. package/dist/dismissable-chip-group-CVo3CS8K.js +2 -0
  116. package/dist/dismissable-chip-group-CVo3CS8K.js.map +1 -0
  117. package/dist/dismissable-chip-group-Dov2-9Fe.mjs +95 -0
  118. package/dist/dismissable-chip-group-Dov2-9Fe.mjs.map +1 -0
  119. package/dist/dismissable-chip-group.cjs.js +1 -1
  120. package/dist/dismissable-chip-group.es.js +1 -1
  121. package/dist/{drawer-oFJcxW58.js → drawer-CSagTJjN.js} +2 -2
  122. package/dist/{drawer-oFJcxW58.js.map → drawer-CSagTJjN.js.map} +1 -1
  123. package/dist/{drawer-Chx3H8EU.mjs → drawer-Cw-Y9XH9.mjs} +3 -3
  124. package/dist/{drawer-Chx3H8EU.mjs.map → drawer-Cw-Y9XH9.mjs.map} +1 -1
  125. package/dist/drawer.cjs.js +1 -1
  126. package/dist/drawer.es.js +1 -1
  127. package/dist/dropdown-BAM4nQhd.mjs +955 -0
  128. package/dist/dropdown-BAM4nQhd.mjs.map +1 -0
  129. package/dist/dropdown-Cr8DVw2T.js +2 -0
  130. package/dist/dropdown-Cr8DVw2T.js.map +1 -0
  131. package/dist/dropdown.cjs.js +1 -1
  132. package/dist/dropdown.es.js +1 -1
  133. package/dist/{file-upload-MvNuX4ks.js → file-upload-CdlYkCg8.js} +2 -2
  134. package/dist/{file-upload-MvNuX4ks.js.map → file-upload-CdlYkCg8.js.map} +1 -1
  135. package/dist/{file-upload-Ctw6LCTU.mjs → file-upload-ih5NqF67.mjs} +2 -2
  136. package/dist/{file-upload-Ctw6LCTU.mjs.map → file-upload-ih5NqF67.mjs.map} +1 -1
  137. package/dist/file-upload.cjs.js +1 -1
  138. package/dist/file-upload.es.js +1 -1
  139. package/dist/{footer-DkVmTd-f.mjs → footer-CVVt8hUE.mjs} +3 -3
  140. package/dist/{footer-DkVmTd-f.mjs.map → footer-CVVt8hUE.mjs.map} +1 -1
  141. package/dist/{footer-Bbemct3Z.js → footer-Cat9-v7l.js} +2 -2
  142. package/dist/{footer-Bbemct3Z.js.map → footer-Cat9-v7l.js.map} +1 -1
  143. package/dist/footer.cjs.js +1 -1
  144. package/dist/footer.es.js +1 -1
  145. package/dist/{hero-banner-Mag1OwL4.js → hero-banner-BNw3eNTs.js} +2 -2
  146. package/dist/{hero-banner-Mag1OwL4.js.map → hero-banner-BNw3eNTs.js.map} +1 -1
  147. package/dist/{hero-banner-ChDoFRhq.mjs → hero-banner-MnKuFSku.mjs} +2 -2
  148. package/dist/{hero-banner-ChDoFRhq.mjs.map → hero-banner-MnKuFSku.mjs.map} +1 -1
  149. package/dist/hero-banner.cjs.js +1 -1
  150. package/dist/hero-banner.es.js +1 -1
  151. package/dist/libraries/library/src/quantity-selector.d.ts +2 -2
  152. package/dist/libraries/library/src/toggle.d.ts +2 -2
  153. package/dist/libraries/theme/src/theme-props.d.ts +1 -0
  154. package/dist/libraries/theme/src/theme-props.d.ts.map +1 -1
  155. package/dist/libraries/tokens/dist/color/variables.d.ts +1 -0
  156. package/dist/libraries/tokens/dist/color/variables.dark.d.ts +1 -0
  157. package/dist/library.cjs.js +1 -1
  158. package/dist/library.es.js +293 -292
  159. package/dist/{modal-CXOYUsJm.js → modal-BSN-wIcN.js} +2 -2
  160. package/dist/{modal-CXOYUsJm.js.map → modal-BSN-wIcN.js.map} +1 -1
  161. package/dist/{modal-Pwvhrzn-.mjs → modal-CnzUgU97.mjs} +3 -3
  162. package/dist/{modal-Pwvhrzn-.mjs.map → modal-CnzUgU97.mjs.map} +1 -1
  163. package/dist/modal.cjs.js +1 -1
  164. package/dist/modal.es.js +1 -1
  165. package/dist/{popover-B6ntmuEK.mjs → popover-B-oWzP-0.mjs} +3 -3
  166. package/dist/{popover-B6ntmuEK.mjs.map → popover-B-oWzP-0.mjs.map} +1 -1
  167. package/dist/{popover-DJHMEFXP.js → popover-BzoAQW0i.js} +2 -2
  168. package/dist/{popover-DJHMEFXP.js.map → popover-BzoAQW0i.js.map} +1 -1
  169. package/dist/popover.cjs.js +1 -1
  170. package/dist/popover.es.js +1 -1
  171. package/dist/{promotion-card-B3mz__m7.js → promotion-card-B8bnNVZ-.js} +2 -2
  172. package/dist/{promotion-card-B3mz__m7.js.map → promotion-card-B8bnNVZ-.js.map} +1 -1
  173. package/dist/{promotion-card-Co6qAkTZ.mjs → promotion-card-DwNbzSK3.mjs} +2 -2
  174. package/dist/{promotion-card-Co6qAkTZ.mjs.map → promotion-card-DwNbzSK3.mjs.map} +1 -1
  175. package/dist/promotion-card.cjs.js +1 -1
  176. package/dist/promotion-card.es.js +1 -1
  177. package/dist/purpur.css +1 -1
  178. package/dist/rich-text.cjs.js +1 -1
  179. package/dist/rich-text.es.js +1 -1
  180. package/dist/search-field-BR4gETPP.js +2 -0
  181. package/dist/search-field-BR4gETPP.js.map +1 -0
  182. package/dist/search-field-DyBcoB9g.mjs +186 -0
  183. package/dist/search-field-DyBcoB9g.mjs.map +1 -0
  184. package/dist/search-field.cjs.js +1 -1
  185. package/dist/search-field.es.js +1 -1
  186. package/dist/{stepper-D59T-Y2_.mjs → stepper-CGBjyjVw.mjs} +2 -2
  187. package/dist/{stepper-D59T-Y2_.mjs.map → stepper-CGBjyjVw.mjs.map} +1 -1
  188. package/dist/{stepper-Dao4XaDV.js → stepper-CbcFVE3v.js} +2 -2
  189. package/dist/{stepper-Dao4XaDV.js.map → stepper-CbcFVE3v.js.map} +1 -1
  190. package/dist/stepper.cjs.js +1 -1
  191. package/dist/stepper.es.js +1 -1
  192. package/dist/{table-CllIkAkM.js → table-CFBK5Gv4.js} +3 -3
  193. package/dist/{table-CllIkAkM.js.map → table-CFBK5Gv4.js.map} +1 -1
  194. package/dist/{table-7-6k_wGH.mjs → table-PdfWMFks.mjs} +8 -8
  195. package/dist/{table-7-6k_wGH.mjs.map → table-PdfWMFks.mjs.map} +1 -1
  196. package/dist/table.cjs.js +1 -1
  197. package/dist/table.es.js +1 -1
  198. package/dist/{text-area-9RUldq6W.js → text-area-AHqUSmEE.js} +2 -2
  199. package/dist/{text-area-9RUldq6W.js.map → text-area-AHqUSmEE.js.map} +1 -1
  200. package/dist/{text-area-C58aZEPa.mjs → text-area-DabB5eo_.mjs} +3 -3
  201. package/dist/{text-area-C58aZEPa.mjs.map → text-area-DabB5eo_.mjs.map} +1 -1
  202. package/dist/text-area.cjs.js +1 -1
  203. package/dist/text-area.es.js +1 -1
  204. package/dist/{text-spacing-BU0mkEf9.mjs → text-spacing-Bmkv_rmc.mjs} +3 -3
  205. package/dist/{text-spacing-BU0mkEf9.mjs.map → text-spacing-Bmkv_rmc.mjs.map} +1 -1
  206. package/dist/{text-spacing-CiGPZHuB.js → text-spacing-CdnbUO6z.js} +2 -2
  207. package/dist/{text-spacing-CiGPZHuB.js.map → text-spacing-CdnbUO6z.js.map} +1 -1
  208. package/dist/text-spacing.cjs.js +1 -1
  209. package/dist/text-spacing.es.js +1 -1
  210. package/dist/theme.cjs.js +1 -1
  211. package/dist/theme.es.js +3 -3
  212. package/dist/tokens/color/variables.css +1 -0
  213. package/dist/tokens/color/variables.d.ts +1 -0
  214. package/dist/tokens/color/variables.dark.css +1 -0
  215. package/dist/tokens/color/variables.dark.d.ts +1 -0
  216. package/dist/tokens/color/variables.dark.js +1 -0
  217. package/dist/tokens/color/variables.dark.json +1 -0
  218. package/dist/tokens/color/variables.dark.scss +1 -0
  219. package/dist/tokens/color/variables.js +1 -0
  220. package/dist/tokens/color/variables.json +1 -0
  221. package/dist/tokens/color/variables.scss +1 -0
  222. package/dist/tokens.cjs.js +1 -1
  223. package/dist/tokens.es.js +167 -166
  224. package/dist/{tooltip-DeP1UsPW.js → tooltip-DRW4N9Z-.js} +2 -2
  225. package/dist/{tooltip-DeP1UsPW.js.map → tooltip-DRW4N9Z-.js.map} +1 -1
  226. package/dist/{tooltip-bqdd2lJL.mjs → tooltip-DzY9olpb.mjs} +3 -3
  227. package/dist/{tooltip-bqdd2lJL.mjs.map → tooltip-DzY9olpb.mjs.map} +1 -1
  228. package/dist/tooltip.cjs.js +1 -1
  229. package/dist/tooltip.es.js +1 -1
  230. package/dist/use-autocomplete.es-CoAeiJiu.mjs +155 -0
  231. package/dist/use-autocomplete.es-CoAeiJiu.mjs.map +1 -0
  232. package/dist/use-autocomplete.es-Djt1u2i8.js +2 -0
  233. package/dist/use-autocomplete.es-Djt1u2i8.js.map +1 -0
  234. package/dist/useColorScheme-BtOgJUTy.js +2 -0
  235. package/dist/{useColorScheme-BHhPgv9q.js.map → useColorScheme-BtOgJUTy.js.map} +1 -1
  236. package/dist/{useColorScheme-B7lGBSe4.mjs → useColorScheme-DXAxJPXW.mjs} +2 -2
  237. package/dist/{useColorScheme-B7lGBSe4.mjs.map → useColorScheme-DXAxJPXW.mjs.map} +1 -1
  238. package/dist/useThemePortalContainer-Cs1c-2AI.js +2 -0
  239. package/dist/{useThemePortalContainer-CUcqV327.js.map → useThemePortalContainer-Cs1c-2AI.js.map} +1 -1
  240. package/dist/useThemePortalContainer-DeKoE-E_.mjs +9 -0
  241. package/dist/{useThemePortalContainer-D13Xx24N.mjs.map → useThemePortalContainer-DeKoE-E_.mjs.map} +1 -1
  242. package/dist/variables-CTBx79yI.js +2 -0
  243. package/dist/{variables-D1vNo1lO.js.map → variables-CTBx79yI.js.map} +1 -1
  244. package/dist/variables-Do6SfyT0.mjs +258 -0
  245. package/dist/{variables-BrsAsWIF.mjs.map → variables-Do6SfyT0.mjs.map} +1 -1
  246. package/package.json +18 -18
  247. package/src/library.ts +72 -2
  248. package/tokens/color/variables.css +1 -0
  249. package/tokens/color/variables.d.ts +1 -0
  250. package/tokens/color/variables.dark.css +1 -0
  251. package/tokens/color/variables.dark.d.ts +1 -0
  252. package/tokens/color/variables.dark.js +1 -0
  253. package/tokens/color/variables.dark.json +1 -0
  254. package/tokens/color/variables.dark.scss +1 -0
  255. package/tokens/color/variables.js +1 -0
  256. package/tokens/color/variables.json +1 -0
  257. package/tokens/color/variables.scss +1 -0
  258. package/dist/countdown-5Ni6OlVY.mjs +0 -189
  259. package/dist/countdown-5Ni6OlVY.mjs.map +0 -1
  260. package/dist/countdown-CGXJyzB2.js +0 -2
  261. package/dist/countdown-CGXJyzB2.js.map +0 -1
  262. package/dist/date-field-CtpWDaSh.js +0 -2
  263. package/dist/date-range-field-B33XeBW8.js +0 -2
  264. package/dist/date-range-field-B33XeBW8.js.map +0 -1
  265. package/dist/date-range-field-BmjQeiOv.mjs.map +0 -1
  266. package/dist/dismissable-chip-group-5ALErhD2.js +0 -2
  267. package/dist/dismissable-chip-group-5ALErhD2.js.map +0 -1
  268. package/dist/dismissable-chip-group-DMNU7g5e.mjs +0 -94
  269. package/dist/dismissable-chip-group-DMNU7g5e.mjs.map +0 -1
  270. package/dist/dropdown-B7W5fErJ.js +0 -2
  271. package/dist/dropdown-B7W5fErJ.js.map +0 -1
  272. package/dist/dropdown-CxEElxNf.mjs +0 -952
  273. package/dist/dropdown-CxEElxNf.mjs.map +0 -1
  274. package/dist/search-field-BTJtRyw5.mjs +0 -184
  275. package/dist/search-field-BTJtRyw5.mjs.map +0 -1
  276. package/dist/search-field-nzVXak1a.js +0 -2
  277. package/dist/search-field-nzVXak1a.js.map +0 -1
  278. package/dist/use-autocomplete.es-BwAzMcau.js +0 -2
  279. package/dist/use-autocomplete.es-BwAzMcau.js.map +0 -1
  280. package/dist/use-autocomplete.es-CKb0RHKG.mjs +0 -144
  281. package/dist/use-autocomplete.es-CKb0RHKG.mjs.map +0 -1
  282. package/dist/useColorScheme-BHhPgv9q.js +0 -2
  283. package/dist/useThemePortalContainer-CUcqV327.js +0 -2
  284. package/dist/useThemePortalContainer-D13Xx24N.mjs +0 -9
  285. package/dist/variables-BrsAsWIF.mjs +0 -257
  286. package/dist/variables-D1vNo1lO.js +0 -2
package/CHANGELOG.json CHANGED
@@ -1,6 +1,51 @@
1
1
  {
2
2
  "name": "@purpur/library",
3
3
  "entries": [
4
+ {
5
+ "version": "10.2.0",
6
+ "tag": "@purpur/library_v10.2.0",
7
+ "date": "Tue, 08 Sep 2026 12:34:25 GMT",
8
+ "comments": {
9
+ "none": [
10
+ {
11
+ "comment": "TextSpacing: Fix typo in class name for title-700"
12
+ },
13
+ {
14
+ "comment": "Container: Add visual regression tests"
15
+ },
16
+ {
17
+ "comment": "DateField: Add `format` for custom field order and separator, single-digit day and month padding, and `invalidDateErrorText` / `onInputValidityChange` for complete but impossible dates"
18
+ },
19
+ {
20
+ "comment": "DatePicker: Forward the new DateField `format` prop in both single and range mode"
21
+ },
22
+ {
23
+ "comment": "DateRangeField: Forward the new DateField `format` prop to both fields of the range"
24
+ },
25
+ {
26
+ "comment": "Dropdown: Combobox options are now highlighted where the typed text matches by default (via new @purpur/highlight-match package); override with the new formatOption prop"
27
+ },
28
+ {
29
+ "comment": "HighlightMatch: New shared hook/component (@purpur/highlight-match) for splitting text into matched/unmatched parts and bolding matches; used by Dropdown and SearchField to highlight typed text by default"
30
+ },
31
+ {
32
+ "comment": "SearchField: Suggestions are now highlighted where the typed text matches by default (via new @purpur/highlight-match package); override with the new formatOption prop"
33
+ },
34
+ {
35
+ "comment": "DismissableChipGroup: Fixed sm chips with two-line labels changing height on hover and the dismiss icon shrinking on hover"
36
+ },
37
+ {
38
+ "comment": "Countdown: a11y fixes for Countdown"
39
+ },
40
+ {
41
+ "comment": "1 new token - core-purple-negative"
42
+ },
43
+ {
44
+ "comment": "Table: Remove unwanted padding from the \"Columns\" tabs in table settings drawer"
45
+ }
46
+ ]
47
+ }
48
+ },
4
49
  {
5
50
  "version": "10.1.1",
6
51
  "tag": "@purpur/library_v10.1.1",
package/CHANGELOG.md CHANGED
@@ -1,6 +1,24 @@
1
1
  # Change Log - @purpur/library
2
2
 
3
- This log was last generated on Fri, 28 Aug 2026 09:52:12 GMT and should not be manually modified.
3
+ This log was last generated on Tue, 08 Sep 2026 12:34:25 GMT and should not be manually modified.
4
+
5
+ ## 10.2.0
6
+ Tue, 08 Sep 2026 12:34:25 GMT
7
+
8
+ ### Updates
9
+
10
+ - TextSpacing: Fix typo in class name for title-700
11
+ - Container: Add visual regression tests
12
+ - DateField: Add `format` for custom field order and separator, single-digit day and month padding, and `invalidDateErrorText` / `onInputValidityChange` for complete but impossible dates
13
+ - DatePicker: Forward the new DateField `format` prop in both single and range mode
14
+ - DateRangeField: Forward the new DateField `format` prop to both fields of the range
15
+ - Dropdown: Combobox options are now highlighted where the typed text matches by default (via new @purpur/highlight-match package); override with the new formatOption prop
16
+ - HighlightMatch: New shared hook/component (@purpur/highlight-match) for splitting text into matched/unmatched parts and bolding matches; used by Dropdown and SearchField to highlight typed text by default
17
+ - SearchField: Suggestions are now highlighted where the typed text matches by default (via new @purpur/highlight-match package); override with the new formatOption prop
18
+ - DismissableChipGroup: Fixed sm chips with two-line labels changing height on hover and the dismiss icon shrinking on hover
19
+ - Countdown: a11y fixes for Countdown
20
+ - 1 new token - core-purple-negative
21
+ - Table: Remove unwanted padding from the "Columns" tabs in table settings drawer
4
22
 
5
23
  ## 10.1.1
6
24
  Fri, 28 Aug 2026 09:52:12 GMT
package/dist/LICENSE.txt CHANGED
@@ -85,13 +85,6 @@ SOFTWARE.
85
85
 
86
86
  ---
87
87
 
88
- Name: @purpur/use-autocomplete
89
- Version: 0.1.0
90
- License: AGPL-3.0-only
91
- Private: false
92
-
93
- ---
94
-
95
88
  Name: @radix-ui/react-compose-refs
96
89
  Version: 1.1.2
97
90
  License: MIT
@@ -304,6 +297,20 @@ Private: false
304
297
 
305
298
  ---
306
299
 
300
+ Name: @purpur/highlight-match
301
+ Version: 0.1.0
302
+ License: AGPL-3.0-only
303
+ Private: false
304
+
305
+ ---
306
+
307
+ Name: @purpur/use-autocomplete
308
+ Version: 0.1.0
309
+ License: AGPL-3.0-only
310
+ Private: false
311
+
312
+ ---
313
+
307
314
  Name: @radix-ui/react-slot
308
315
  Version: 1.2.0
309
316
  License: MIT
@@ -1,2 +1,2 @@
1
- "use strict";const n=require("react/jsx-runtime"),I=require("react"),h=require("./heading-BPeRwNYu.js"),d=require("./link-Dzqd0QuD.js"),H=require("./paragraph-B8HFdNne.js"),j=require("./text-spacing-CiGPZHuB.js"),f={HYPERLINK:"hyperlink",ENTRY_HYPERLINK:"entry-hyperlink",ASSET_HYPERLINK:"asset-hyperlink",RESOURCE_HYPERLINK:"resource-hyperlink",EMBEDDED_ENTRY:"embedded-entry-inline"},s={DOCUMENT:"document",PARAGRAPH:"paragraph",TEXT:"text",HYPERLINK:"hyperlink",ENTRY_HYPERLINK:"entry-hyperlink",HEADER_1:"header-1",HEADER_2:"header-2",HEADER_3:"header-3",HEADER_4:"header-4",HEADER_5:"header-5",HEADER_6:"header-6",HEADING_1:"heading-1",HEADING_2:"heading-2",HEADING_3:"heading-3",HEADING_4:"heading-4",HEADING_5:"heading-5",HEADING_6:"heading-6",TABLE:"table",TABLE_ROW:"table-row",TABLE_HEADER_CELL:"table-header-cell",TABLE_CELL:"table-cell",TABLE_BODY:"table-body",OL_LIST:"ordered-list",UL_LIST:"unordered-list",LIST_ITEM:"list-item",HR:"horizontal-row",QUOTE:"blockquote",EMBEDDED_ENTRY:"embedded-entity",EMBEDDED_ASSET:"embedded-asset-block",IMAGE:"image",VIDEO:"video",RICHTEXTDOCUMENT:"rich-text-document",TEASER:"teaser"},_={BOLD:"bold",ITALIC:"italic",UNDERLINE:"underline",CODE:"code"},N=e=>e.type===s.TABLE_ROW&&!!e.content?.every(i=>i.type===s.TABLE_HEADER_CELL),b=(e,i)=>{if(e.type!==s.TABLE)return i;const{content:l}=e,[r,t]=(l||[]).reduce(([u,a],o)=>N(o)?[[...u,o],a]:[u,[...a,o]],[[],[]]),E=i.slice(0,r.length),c=i.slice(r.length,i.length);return n.jsx("div",{className:"purpur-rich-text-table-scroll-container",children:n.jsx("div",{className:"purpur-rich-text-table-inner-scroll-container",children:n.jsxs("table",{children:[r.length>0&&n.jsx("thead",{children:E}),t.length>0&&n.jsx("tbody",{children:c})]})})})},x=(e,i)=>Object.values(e).includes(i),L=e=>e?.type==="text",T=e=>!g(e)&&!L(e)&&x(s,e?.type),g=e=>x(f,e?.type),O=e=>{try{return JSON.parse(e)}catch{return null}},A=(e,i=" ")=>{const l=O(e);return!l||!l.content?"":l.content.reduce((r,t,E)=>{let c="";if(L(t))c=t.value;else if((T(t)||g(t))&&(c=A(JSON.stringify(t),i),!c.length))return r;const u=l?.content?.[E+1],a=T(u)?i:"";return r+c+a},"")};function v(e){return e.type===s.IMAGE&&typeof e.value=="object"&&e?.value&&"image"in e.value&&e?.value?.image?.url?{...e,value:{...e.value,url:e.value.image.url}}:e.type===s.VIDEO&&typeof e.value=="object"&&e?.value&&"video"in e.value&&e.value.video?.url?{...e,value:{...e.value,url:e.value.video.url}}:e}const B={[_.BOLD]:e=>n.jsx("b",{children:e}),[_.ITALIC]:e=>n.jsx("i",{children:e}),[_.UNDERLINE]:e=>n.jsx("u",{children:e}),[_.CODE]:e=>n.jsx("code",{children:e})},y=e=>{const i=e.type??e.nodeType;return i.startsWith("heading-")?i.replace("heading-","header-"):i.startsWith("entry-hyperlink")?i.replace("entry-hyperlink","hyperlink"):i};function m(e,i,l){return{[s.RICHTEXTDOCUMENT]:(r,t)=>t,[s.DOCUMENT]:(r,t)=>t,[s.PARAGRAPH]:(r,t)=>n.jsx(H.Paragraph,{variant:"paragraph-200",children:t}),[s.TEXT]:r=>{const{value:t,marks:E}=r,c=typeof t=="string"?t.replace(/\n/g,"<br />"):t,u=n.jsx("span",{dangerouslySetInnerHTML:{__html:c}});return E?E.reduce((a,o)=>B[typeof o=="string"?o:o.type](a),u):u},[s.HYPERLINK]:(r,t)=>{const E=r.uri??r.data?.uri;return e?n.jsx(d.Link,{variant:"text",children:e(t,E)}):n.jsx(d.Link,{variant:"text",children:n.jsx("a",{href:E,children:t})})},[s.HR]:()=>n.jsx("hr",{}),[s.HEADER_2]:(r,t)=>n.jsx(h.Heading,{tag:"h2",variant:"title-300",children:t}),[s.HEADER_3]:(r,t)=>n.jsx(h.Heading,{tag:"h3",variant:"title-200",children:t}),[s.HEADER_4]:(r,t)=>n.jsx(h.Heading,{tag:"h4",variant:"title-100",children:t}),[s.HEADER_5]:(r,t)=>n.jsx(h.Heading,{tag:"h5",variant:"title-100",children:t}),[s.HEADER_6]:(r,t)=>n.jsx(h.Heading,{tag:"h6",variant:"title-100",children:t}),[s.TABLE]:b,[s.TABLE_ROW]:(r,t)=>n.jsx("tr",{children:t}),[s.TABLE_HEADER_CELL]:(r,t)=>n.jsx("th",{scope:"col",children:t}),[s.TABLE_CELL]:(r,t)=>n.jsx("td",{children:t}),[s.TABLE_BODY]:(r,t)=>n.jsx("tbody",{children:t}),[s.LIST_ITEM]:(r,t)=>n.jsx("li",{children:t}),[s.OL_LIST]:(r,t)=>n.jsx("ol",{children:t}),[s.UL_LIST]:(r,t)=>n.jsx("ul",{children:t}),[s.QUOTE]:(r,t)=>n.jsxs("blockquote",{children:["“",t,"”"]}),[s.EMBEDDED_ENTRY]:(r,t)=>t,[s.EMBEDDED_ASSET]:(r,t)=>t,[s.IMAGE]:({value:r})=>typeof r=="object"&&r&&"url"in r&&r.url?i?i(r.url,r.altText,r.image?.contentType):n.jsx("img",{src:r.url,alt:r.altText??"",loading:"lazy"}):null,[s.VIDEO]:({value:r})=>{if(typeof r=="object"&&r&&"posterImage"in r){const t=r.posterImage?.url;return n.jsx("video",{"data-testid":"rich text video",controls:!0,src:r.url,poster:l&&t?l(t):t})}return null}}}const p=e=>!e.replace(/\s+/g,""),C=e=>{const{content:i,value:l}=e;if(!i)return typeof l=="string"&&p(l);for(const r of i)if(y(r)===s.HYPERLINK)return!1;return i.length>0&&typeof i[0].value=="string"&&p(i[0].value)},R=(e,i,l,r,t)=>{let E=0;const c={...m(l,r,t),...i},u=a=>{const o=c[y(a)];if(typeof o>"u"||C(a))return null;const D=a.content?a.content.map(u):[];return n.jsx(I.Fragment,{children:o(v(a),D)},E++)};return u(e)};function S({data:e,className:i,customNodeTypes:l,noTextSpacing:r=!1,link:t,image:E,videoPoster:c,element:u="div",...a}){return e?r?n.jsx(u,{className:i,...a,children:R(e,l,t,E,c)}):n.jsx(j.TextSpacing,{className:i,element:u,...a,children:R(e,l,t,E,c)}):null}exports.RichText=S;exports.richToPlainText=A;
2
- //# sourceMappingURL=RichText-B865Qkzj.js.map
1
+ "use strict";const n=require("react/jsx-runtime"),I=require("react"),h=require("./heading-BPeRwNYu.js"),d=require("./link-Dzqd0QuD.js"),H=require("./paragraph-B8HFdNne.js"),j=require("./text-spacing-CdnbUO6z.js"),f={HYPERLINK:"hyperlink",ENTRY_HYPERLINK:"entry-hyperlink",ASSET_HYPERLINK:"asset-hyperlink",RESOURCE_HYPERLINK:"resource-hyperlink",EMBEDDED_ENTRY:"embedded-entry-inline"},s={DOCUMENT:"document",PARAGRAPH:"paragraph",TEXT:"text",HYPERLINK:"hyperlink",ENTRY_HYPERLINK:"entry-hyperlink",HEADER_1:"header-1",HEADER_2:"header-2",HEADER_3:"header-3",HEADER_4:"header-4",HEADER_5:"header-5",HEADER_6:"header-6",HEADING_1:"heading-1",HEADING_2:"heading-2",HEADING_3:"heading-3",HEADING_4:"heading-4",HEADING_5:"heading-5",HEADING_6:"heading-6",TABLE:"table",TABLE_ROW:"table-row",TABLE_HEADER_CELL:"table-header-cell",TABLE_CELL:"table-cell",TABLE_BODY:"table-body",OL_LIST:"ordered-list",UL_LIST:"unordered-list",LIST_ITEM:"list-item",HR:"horizontal-row",QUOTE:"blockquote",EMBEDDED_ENTRY:"embedded-entity",EMBEDDED_ASSET:"embedded-asset-block",IMAGE:"image",VIDEO:"video",RICHTEXTDOCUMENT:"rich-text-document",TEASER:"teaser"},_={BOLD:"bold",ITALIC:"italic",UNDERLINE:"underline",CODE:"code"},N=e=>e.type===s.TABLE_ROW&&!!e.content?.every(i=>i.type===s.TABLE_HEADER_CELL),b=(e,i)=>{if(e.type!==s.TABLE)return i;const{content:l}=e,[r,t]=(l||[]).reduce(([u,a],o)=>N(o)?[[...u,o],a]:[u,[...a,o]],[[],[]]),E=i.slice(0,r.length),c=i.slice(r.length,i.length);return n.jsx("div",{className:"purpur-rich-text-table-scroll-container",children:n.jsx("div",{className:"purpur-rich-text-table-inner-scroll-container",children:n.jsxs("table",{children:[r.length>0&&n.jsx("thead",{children:E}),t.length>0&&n.jsx("tbody",{children:c})]})})})},x=(e,i)=>Object.values(e).includes(i),L=e=>e?.type==="text",T=e=>!g(e)&&!L(e)&&x(s,e?.type),g=e=>x(f,e?.type),O=e=>{try{return JSON.parse(e)}catch{return null}},A=(e,i=" ")=>{const l=O(e);return!l||!l.content?"":l.content.reduce((r,t,E)=>{let c="";if(L(t))c=t.value;else if((T(t)||g(t))&&(c=A(JSON.stringify(t),i),!c.length))return r;const u=l?.content?.[E+1],a=T(u)?i:"";return r+c+a},"")};function v(e){return e.type===s.IMAGE&&typeof e.value=="object"&&e?.value&&"image"in e.value&&e?.value?.image?.url?{...e,value:{...e.value,url:e.value.image.url}}:e.type===s.VIDEO&&typeof e.value=="object"&&e?.value&&"video"in e.value&&e.value.video?.url?{...e,value:{...e.value,url:e.value.video.url}}:e}const B={[_.BOLD]:e=>n.jsx("b",{children:e}),[_.ITALIC]:e=>n.jsx("i",{children:e}),[_.UNDERLINE]:e=>n.jsx("u",{children:e}),[_.CODE]:e=>n.jsx("code",{children:e})},y=e=>{const i=e.type??e.nodeType;return i.startsWith("heading-")?i.replace("heading-","header-"):i.startsWith("entry-hyperlink")?i.replace("entry-hyperlink","hyperlink"):i};function m(e,i,l){return{[s.RICHTEXTDOCUMENT]:(r,t)=>t,[s.DOCUMENT]:(r,t)=>t,[s.PARAGRAPH]:(r,t)=>n.jsx(H.Paragraph,{variant:"paragraph-200",children:t}),[s.TEXT]:r=>{const{value:t,marks:E}=r,c=typeof t=="string"?t.replace(/\n/g,"<br />"):t,u=n.jsx("span",{dangerouslySetInnerHTML:{__html:c}});return E?E.reduce((a,o)=>B[typeof o=="string"?o:o.type](a),u):u},[s.HYPERLINK]:(r,t)=>{const E=r.uri??r.data?.uri;return e?n.jsx(d.Link,{variant:"text",children:e(t,E)}):n.jsx(d.Link,{variant:"text",children:n.jsx("a",{href:E,children:t})})},[s.HR]:()=>n.jsx("hr",{}),[s.HEADER_2]:(r,t)=>n.jsx(h.Heading,{tag:"h2",variant:"title-300",children:t}),[s.HEADER_3]:(r,t)=>n.jsx(h.Heading,{tag:"h3",variant:"title-200",children:t}),[s.HEADER_4]:(r,t)=>n.jsx(h.Heading,{tag:"h4",variant:"title-100",children:t}),[s.HEADER_5]:(r,t)=>n.jsx(h.Heading,{tag:"h5",variant:"title-100",children:t}),[s.HEADER_6]:(r,t)=>n.jsx(h.Heading,{tag:"h6",variant:"title-100",children:t}),[s.TABLE]:b,[s.TABLE_ROW]:(r,t)=>n.jsx("tr",{children:t}),[s.TABLE_HEADER_CELL]:(r,t)=>n.jsx("th",{scope:"col",children:t}),[s.TABLE_CELL]:(r,t)=>n.jsx("td",{children:t}),[s.TABLE_BODY]:(r,t)=>n.jsx("tbody",{children:t}),[s.LIST_ITEM]:(r,t)=>n.jsx("li",{children:t}),[s.OL_LIST]:(r,t)=>n.jsx("ol",{children:t}),[s.UL_LIST]:(r,t)=>n.jsx("ul",{children:t}),[s.QUOTE]:(r,t)=>n.jsxs("blockquote",{children:["“",t,"”"]}),[s.EMBEDDED_ENTRY]:(r,t)=>t,[s.EMBEDDED_ASSET]:(r,t)=>t,[s.IMAGE]:({value:r})=>typeof r=="object"&&r&&"url"in r&&r.url?i?i(r.url,r.altText,r.image?.contentType):n.jsx("img",{src:r.url,alt:r.altText??"",loading:"lazy"}):null,[s.VIDEO]:({value:r})=>{if(typeof r=="object"&&r&&"posterImage"in r){const t=r.posterImage?.url;return n.jsx("video",{"data-testid":"rich text video",controls:!0,src:r.url,poster:l&&t?l(t):t})}return null}}}const p=e=>!e.replace(/\s+/g,""),C=e=>{const{content:i,value:l}=e;if(!i)return typeof l=="string"&&p(l);for(const r of i)if(y(r)===s.HYPERLINK)return!1;return i.length>0&&typeof i[0].value=="string"&&p(i[0].value)},R=(e,i,l,r,t)=>{let E=0;const c={...m(l,r,t),...i},u=a=>{const o=c[y(a)];if(typeof o>"u"||C(a))return null;const D=a.content?a.content.map(u):[];return n.jsx(I.Fragment,{children:o(v(a),D)},E++)};return u(e)};function S({data:e,className:i,customNodeTypes:l,noTextSpacing:r=!1,link:t,image:E,videoPoster:c,element:u="div",...a}){return e?r?n.jsx(u,{className:i,...a,children:R(e,l,t,E,c)}):n.jsx(j.TextSpacing,{className:i,element:u,...a,children:R(e,l,t,E,c)}):null}exports.RichText=S;exports.richToPlainText=A;
2
+ //# sourceMappingURL=RichText-CeYecUFV.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"RichText-B865Qkzj.js","sources":["../../../components/rich-text/src/constants.ts","../../../components/rich-text/src/renderers.tsx","../../../components/rich-text/src/utils.ts","../../../components/rich-text/src/RichText.tsx"],"sourcesContent":["export const INLINE = {\n HYPERLINK: \"hyperlink\",\n ENTRY_HYPERLINK: \"entry-hyperlink\",\n ASSET_HYPERLINK: \"asset-hyperlink\",\n RESOURCE_HYPERLINK: \"resource-hyperlink\",\n EMBEDDED_ENTRY: \"embedded-entry-inline\",\n} as const;\n\nexport const BLOCK = {\n DOCUMENT: \"document\",\n PARAGRAPH: \"paragraph\",\n TEXT: \"text\",\n HYPERLINK: \"hyperlink\",\n ENTRY_HYPERLINK: \"entry-hyperlink\",\n\n HEADER_1: \"header-1\",\n HEADER_2: \"header-2\",\n HEADER_3: \"header-3\",\n HEADER_4: \"header-4\",\n HEADER_5: \"header-5\",\n HEADER_6: \"header-6\",\n\n HEADING_1: \"heading-1\",\n HEADING_2: \"heading-2\",\n HEADING_3: \"heading-3\",\n HEADING_4: \"heading-4\",\n HEADING_5: \"heading-5\",\n HEADING_6: \"heading-6\",\n\n TABLE: \"table\",\n TABLE_ROW: \"table-row\",\n TABLE_HEADER_CELL: \"table-header-cell\",\n TABLE_CELL: \"table-cell\",\n TABLE_BODY: \"table-body\",\n\n OL_LIST: \"ordered-list\",\n UL_LIST: \"unordered-list\",\n LIST_ITEM: \"list-item\",\n\n HR: \"horizontal-row\",\n QUOTE: \"blockquote\",\n\n EMBEDDED_ENTRY: \"embedded-entity\",\n EMBEDDED_ASSET: \"embedded-asset-block\",\n\n IMAGE: \"image\",\n VIDEO: \"video\",\n RICHTEXTDOCUMENT: \"rich-text-document\",\n TEASER: \"teaser\",\n} as const;\n\nexport const MARK = {\n BOLD: \"bold\",\n ITALIC: \"italic\",\n UNDERLINE: \"underline\",\n CODE: \"code\",\n} as const;\n\nexport const ELEMENT = {\n DIV: \"div\",\n SPAN: \"span\",\n} as const;\n","import React, { type ReactNode } from \"react\";\n\nimport { BLOCK } from \"./constants\";\nimport { type RichTextNode } from \"./types\";\n\nconst isHeaderRow = (row: RichTextNode): boolean =>\n row.type === BLOCK.TABLE_ROW &&\n !!row.content?.every((node) => node.type === BLOCK.TABLE_HEADER_CELL);\n\n/**\n * Wrap the first rows with <thead /> if it consists of only <th> elements.\n * Wrap the rest of the rows with <tbody />.\n */\nexport const tableRenderer = (richTextNode: RichTextNode, children: ReactNode[]) => {\n if (richTextNode.type !== BLOCK.TABLE) {\n return children;\n }\n const { content: tableContent } = richTextNode;\n const [headerRows, bodyRows] = (tableContent || []).reduce<[RichTextNode[], RichTextNode[]]>(\n ([headers, body], row) => {\n return isHeaderRow(row) ? [[...headers, row], body] : [headers, [...body, row]];\n },\n [[], []]\n );\n const headerRowChildren = children.slice(0, headerRows.length);\n const bodyRowChildren = children.slice(headerRows.length, children.length);\n return (\n <div className=\"purpur-rich-text-table-scroll-container\">\n <div className=\"purpur-rich-text-table-inner-scroll-container\">\n <table>\n {headerRows.length > 0 && <thead>{headerRowChildren}</thead>}\n {bodyRows.length > 0 && <tbody>{bodyRowChildren}</tbody>}\n </table>\n </div>\n </div>\n );\n};\n","import { BLOCK, INLINE } from \"./constants\";\nimport { type Block, type Inline, type Mark, type RichTextNode, type Value } from \"./types\";\n\nexport type MarkNode = {\n type: Mark;\n};\n\ntype TextNode<T> = RichTextNode<T> & {\n type: \"text\";\n value: string;\n marks: MarkNode[];\n};\n\ntype InlineNode<T> = RichTextNode<T> & {\n type: Inline;\n content: Array<Inline | Text>;\n};\n\ntype BlockNode<T> = RichTextNode<T> & {\n type: Block;\n content: Array<Block | Inline | Text>;\n};\n\nconst hasValue = (obj: Record<string, unknown>, value: unknown) =>\n Object.values(obj).includes(value);\n\nconst isText = <T>(node: RichTextNode<T> | undefined): node is TextNode<T> => node?.type === \"text\";\n\nconst isBlock = <T>(node: RichTextNode<T> | undefined): node is BlockNode<T> =>\n !isInline(node) && !isText(node) && hasValue(BLOCK, node?.type);\n\nconst isInline = <T>(node: RichTextNode<T> | undefined): node is InlineNode<T> =>\n hasValue(INLINE, node?.type);\n\nexport const safeJsonParse = <T>(jsonString: string): T | null => {\n try {\n return JSON.parse(jsonString);\n } catch {\n return null;\n }\n};\n\n// This is equivalent to https://github.com/contentful/rich-text/tree/master/packages/rich-text-plain-text-renderer\nexport const richToPlainText = <T>(data: string, blockDivisor = \" \"): string => {\n const rootNode = safeJsonParse<RichTextNode<T>>(data);\n\n if (!rootNode || !rootNode.content) {\n return \"\";\n }\n\n return rootNode.content.reduce((acc: string, node: RichTextNode<T>, i) => {\n let nodeTextValue = \"\";\n\n if (isText(node)) {\n nodeTextValue = node.value;\n } else if (isBlock(node) || isInline(node)) {\n nodeTextValue = richToPlainText(JSON.stringify(node), blockDivisor);\n if (!nodeTextValue.length) {\n return acc;\n }\n }\n\n const nextNode = rootNode?.content?.[i + 1];\n const divisor = isBlock(nextNode) ? blockDivisor : \"\";\n\n return acc + nodeTextValue + divisor;\n }, \"\");\n};\n\nexport function normalizeNode<T = Value>(node: RichTextNode<T>) {\n if (\n node.type === BLOCK.IMAGE &&\n typeof node.value === \"object\" &&\n node?.value &&\n \"image\" in node.value &&\n node?.value?.image?.url\n ) {\n return { ...node, value: { ...node.value, url: node.value.image.url } };\n }\n\n if (\n node.type === BLOCK.VIDEO &&\n typeof node.value === \"object\" &&\n node?.value &&\n \"video\" in node.value &&\n node.value.video?.url\n ) {\n return { ...node, value: { ...node.value, url: node.value.video.url } };\n }\n\n return node;\n}\n","import React, { Fragment, type ReactNode } from \"react\";\nimport { Heading } from \"@purpur/heading\";\nimport { Link } from \"@purpur/link\";\nimport { Paragraph } from \"@purpur/paragraph\";\nimport { TextSpacing } from \"@purpur/text-spacing\";\n\nimport { BLOCK, MARK } from \"./constants\";\nimport { tableRenderer } from \"./renderers\";\nimport type {\n ImageProp,\n LinkProp,\n Mark,\n NodeTypes,\n RichTextNode,\n RichTextProps,\n Value,\n VideoPosterProp,\n} from \"./types\";\nimport { normalizeNode } from \"./utils\";\n\n// Inspired by https://github.com/contentful/rich-text/blob/master/packages/rich-text-react-renderer/src/index.tsx\nconst MARK_TYPES = {\n [MARK.BOLD]: (children: ReactNode) => <b>{children}</b>,\n [MARK.ITALIC]: (children: ReactNode) => <i>{children}</i>,\n [MARK.UNDERLINE]: (children: ReactNode) => <u>{children}</u>,\n [MARK.CODE]: (children: ReactNode) => <code>{children}</code>,\n};\n\nconst getNodeType = (node: RichTextNode) => {\n const type = node.type ?? node.nodeType!;\n if (type.startsWith(\"heading-\")) return type.replace(\"heading-\", \"header-\");\n if (type.startsWith(\"entry-hyperlink\")) return type.replace(\"entry-hyperlink\", \"hyperlink\");\n return type;\n};\n\nfunction getNodeTypes<T = Value>(\n link: LinkProp,\n image: ImageProp,\n videoPoster: VideoPosterProp\n): NodeTypes<T> {\n return {\n [BLOCK.RICHTEXTDOCUMENT]: (_, children) => children,\n [BLOCK.DOCUMENT]: (_, children) => children,\n [BLOCK.PARAGRAPH]: (_, children) => <Paragraph variant=\"paragraph-200\">{children}</Paragraph>,\n [BLOCK.TEXT]: (node) => {\n const { value: nodeValue, marks } = node;\n const value = typeof nodeValue === \"string\" ? nodeValue.replace(/\\n/g, \"<br />\") : nodeValue;\n\n const element = <span dangerouslySetInnerHTML={{ __html: value as string }} />;\n\n if (!marks) {\n return element;\n }\n return marks.reduce((accumulator: ReactNode, currentValue: Mark | { type: Mark }) => {\n return MARK_TYPES[typeof currentValue === \"string\" ? currentValue : currentValue.type](\n accumulator\n );\n }, element);\n },\n [BLOCK.HYPERLINK]: (node, children) => {\n const uri = node.uri ?? (node.data?.uri as string);\n\n if (link) {\n return <Link variant=\"text\">{link(children, uri)}</Link>;\n }\n return (\n <Link variant=\"text\">\n <a href={uri}>{children}</a>\n </Link>\n );\n },\n [BLOCK.HR]: () => <hr />,\n [BLOCK.HEADER_2]: (_, children) => (\n <Heading tag=\"h2\" variant=\"title-300\">\n {children}\n </Heading>\n ),\n [BLOCK.HEADER_3]: (_, children) => (\n <Heading tag=\"h3\" variant=\"title-200\">\n {children}\n </Heading>\n ),\n [BLOCK.HEADER_4]: (_, children) => (\n <Heading tag=\"h4\" variant=\"title-100\">\n {children}\n </Heading>\n ),\n [BLOCK.HEADER_5]: (_, children) => (\n <Heading tag=\"h5\" variant=\"title-100\">\n {children}\n </Heading>\n ),\n [BLOCK.HEADER_6]: (_, children) => (\n <Heading tag=\"h6\" variant=\"title-100\">\n {children}\n </Heading>\n ),\n [BLOCK.TABLE]: tableRenderer,\n [BLOCK.TABLE_ROW]: (_, children) => <tr>{children}</tr>,\n [BLOCK.TABLE_HEADER_CELL]: (_, children) => <th scope=\"col\">{children}</th>,\n [BLOCK.TABLE_CELL]: (_, children) => {\n return <td>{children}</td>;\n },\n [BLOCK.TABLE_BODY]: (_, children) => <tbody>{children}</tbody>,\n [BLOCK.LIST_ITEM]: (_, children) => <li>{children}</li>,\n [BLOCK.OL_LIST]: (_, children) => <ol>{children}</ol>,\n [BLOCK.UL_LIST]: (_, children) => <ul>{children}</ul>,\n [BLOCK.QUOTE]: (_, children) => <blockquote>&#8220;{children}&#8221;</blockquote>,\n [BLOCK.EMBEDDED_ENTRY]: (_, children) => children,\n [BLOCK.EMBEDDED_ASSET]: (_, children) => children,\n [BLOCK.IMAGE]: ({ value }) => {\n if (typeof value === \"object\" && value && \"url\" in value && value.url) {\n if (image) {\n return image(value.url, value.altText, value.image?.contentType);\n }\n return <img src={value.url} alt={value.altText ?? \"\"} loading=\"lazy\" />;\n }\n return null;\n },\n [BLOCK.VIDEO]: ({ value }) => {\n if (typeof value === \"object\" && value && \"posterImage\" in value) {\n const posterImage = value.posterImage?.url;\n\n return (\n // eslint-disable-next-line jsx-a11y/media-has-caption\n <video\n data-testid=\"rich text video\"\n controls\n src={value.url}\n poster={videoPoster && posterImage ? videoPoster(posterImage) : posterImage}\n />\n );\n }\n return null;\n },\n };\n}\n\nconst isValueWhitespaceOnly = (value: string): boolean => {\n return !value.replace(/\\s+/g, \"\");\n};\n\n/**\n * Strictly checks if a singular node value OR nested node content is an empty element.\n */\n\nconst isNodeOrContentEmpty = <T,>(node: RichTextNode<T>): boolean => {\n const { content, value } = node;\n\n if (!content) {\n return typeof value === \"string\" && isValueWhitespaceOnly(value);\n }\n\n for (const item of content) {\n if (getNodeType(item) === BLOCK.HYPERLINK) {\n return false;\n }\n }\n\n return (\n content.length > 0 &&\n typeof content[0].value === \"string\" &&\n isValueWhitespaceOnly(content[0].value)\n );\n};\n\nconst serializeRichText = <T,>(\n node: RichTextNode<T>,\n customNodeTypes?: NodeTypes<T>,\n link?: LinkProp,\n image?: ImageProp,\n videoPoster?: VideoPosterProp\n): ReactNode => {\n let index = 0; // nodes in rich text does not contain ids, we'll use index as keys for react\n\n const nodes = {\n ...getNodeTypes(link, image, videoPoster),\n ...customNodeTypes,\n };\n\n const renderNode = (node: RichTextNode<T>): ReactNode => {\n const renderFunc = nodes[getNodeType(node)];\n\n // node types that are missing from both default NODE_TYPES and custom are never rendered\n if (typeof renderFunc === \"undefined\") {\n return null;\n }\n\n if (isNodeOrContentEmpty(node)) {\n return null;\n }\n\n const children = node.content ? node.content.map(renderNode) : [];\n\n return <Fragment key={index++}>{renderFunc(normalizeNode(node), children)}</Fragment>;\n };\n\n return renderNode(node);\n};\n\n/* Not using a arrow function here since the default generic will mess with the highlighting\n and it still needs a eslint-disable-next-line because it still lints incorrect */\n\nfunction RichText<T = Value>({\n data,\n className,\n customNodeTypes,\n noTextSpacing = false,\n link,\n image,\n videoPoster,\n element: ElementTag = \"div\",\n ...rest\n}: RichTextProps<T>) {\n return data ? (\n noTextSpacing ? (\n <ElementTag className={className} {...rest}>\n {serializeRichText(data, customNodeTypes, link, image, videoPoster)}\n </ElementTag>\n ) : (\n <TextSpacing className={className} element={ElementTag} {...rest}>\n {serializeRichText(data, customNodeTypes, link, image, videoPoster)}\n </TextSpacing>\n )\n ) : null;\n}\n\nexport { getNodeTypes, RichText, serializeRichText };\n"],"names":["INLINE","BLOCK","MARK","isHeaderRow","row","node","tableRenderer","richTextNode","children","tableContent","headerRows","bodyRows","headers","body","headerRowChildren","bodyRowChildren","jsx","jsxs","hasValue","obj","value","isText","isBlock","isInline","safeJsonParse","jsonString","richToPlainText","data","blockDivisor","rootNode","acc","i","nodeTextValue","nextNode","divisor","normalizeNode","MARK_TYPES","getNodeType","type","getNodeTypes","link","image","videoPoster","_","Paragraph","nodeValue","marks","element","accumulator","currentValue","uri","Link","Heading","posterImage","isValueWhitespaceOnly","isNodeOrContentEmpty","content","item","serializeRichText","customNodeTypes","index","nodes","renderNode","renderFunc","Fragment","RichText","className","noTextSpacing","ElementTag","rest","TextSpacing"],"mappings":"qNAAaA,EAAS,CACpB,UAAW,YACX,gBAAiB,kBACjB,gBAAiB,kBACjB,mBAAoB,qBACpB,eAAgB,uBAClB,EAEaC,EAAQ,CACnB,SAAU,WACV,UAAW,YACX,KAAM,OACN,UAAW,YACX,gBAAiB,kBAEjB,SAAU,WACV,SAAU,WACV,SAAU,WACV,SAAU,WACV,SAAU,WACV,SAAU,WAEV,UAAW,YACX,UAAW,YACX,UAAW,YACX,UAAW,YACX,UAAW,YACX,UAAW,YAEX,MAAO,QACP,UAAW,YACX,kBAAmB,oBACnB,WAAY,aACZ,WAAY,aAEZ,QAAS,eACT,QAAS,iBACT,UAAW,YAEX,GAAI,iBACJ,MAAO,aAEP,eAAgB,kBAChB,eAAgB,uBAEhB,MAAO,QACP,MAAO,QACP,iBAAkB,qBAClB,OAAQ,QACV,EAEaC,EAAO,CAClB,KAAM,OACN,OAAQ,SACR,UAAW,YACX,KAAM,MACR,ECnDMC,EAAeC,GACnBA,EAAI,OAASH,EAAM,WACnB,CAAC,CAACG,EAAI,SAAS,MAAOC,G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K,CAE1C,EAEME,EAAoB,CACxBrD,EACAsD,EACAnB,EACAC,EACAC,IACc,CACd,IAAIkB,EAAQ,EAEZ,MAAMC,EAAQ,CACZ,GAAGtB,EAAaC,EAAMC,EAAOC,CAAW,EACxC,GAAGiB,CAAA,EAGCG,EAAczD,GAAqC,CACvD,MAAM0D,EAAaF,EAAMxB,EAAYhC,CAAI,CAAC,EAO1C,GAJI,OAAO0D,EAAe,KAItBR,EAAqBlD,CAAI,EAC3B,OAAO,KAGT,MAAMG,EAAWH,EAAK,QAAUA,EAAK,QAAQ,IAAIyD,CAAU,EAAI,CAAA,EAE/D,OAAO9C,MAACgD,EAAAA,UAAwB,SAAAD,EAAW5B,EAAc9B,CAAI,EAAGG,CAAQ,GAAlDoD,GAAoD,CAC5E,EAEA,OAAOE,EAAWzD,CAAI,CACxB,EAKA,SAAS4D,EAAoB,CAC3B,KAAAtC,EACA,UAAAuC,EACA,gBAAAP,EACA,cAAAQ,EAAgB,GAChB,KAAA3B,EACA,MAAAC,EACA,YAAAC,EACA,QAAS0B,EAAa,MACtB,GAAGC,CACL,EAAqB,CACnB,OAAO1C,EACLwC,EACEnD,EAAAA,IAACoD,EAAA,CAAW,UAAAF,EAAuB,GAAGG,EACnC,SAAAX,EAAkB/B,EAAMgC,EAAiBnB,EAAMC,EAAOC,CAAW,CAAA,CACpE,EAEA1B,EAAAA,IAACsD,EAAAA,YAAA,CAAY,UAAAJ,EAAsB,QAASE,EAAa,GAAGC,EACzD,SAAAX,EAAkB/B,EAAMgC,EAAiBnB,EAAMC,EAAOC,CAAW,EACpE,EAEA,IACN"}
1
+ {"version":3,"file":"RichText-CeYecUFV.js","sources":["../../../components/rich-text/src/constants.ts","../../../components/rich-text/src/renderers.tsx","../../../components/rich-text/src/utils.ts","../../../components/rich-text/src/RichText.tsx"],"sourcesContent":["export const INLINE = {\n HYPERLINK: \"hyperlink\",\n ENTRY_HYPERLINK: \"entry-hyperlink\",\n ASSET_HYPERLINK: \"asset-hyperlink\",\n RESOURCE_HYPERLINK: \"resource-hyperlink\",\n EMBEDDED_ENTRY: \"embedded-entry-inline\",\n} as const;\n\nexport const BLOCK = {\n DOCUMENT: \"document\",\n PARAGRAPH: \"paragraph\",\n TEXT: \"text\",\n HYPERLINK: \"hyperlink\",\n ENTRY_HYPERLINK: \"entry-hyperlink\",\n\n HEADER_1: \"header-1\",\n HEADER_2: \"header-2\",\n HEADER_3: \"header-3\",\n HEADER_4: \"header-4\",\n HEADER_5: \"header-5\",\n HEADER_6: \"header-6\",\n\n HEADING_1: \"heading-1\",\n HEADING_2: \"heading-2\",\n HEADING_3: \"heading-3\",\n HEADING_4: \"heading-4\",\n HEADING_5: \"heading-5\",\n HEADING_6: \"heading-6\",\n\n TABLE: \"table\",\n TABLE_ROW: \"table-row\",\n TABLE_HEADER_CELL: \"table-header-cell\",\n TABLE_CELL: \"table-cell\",\n TABLE_BODY: \"table-body\",\n\n OL_LIST: \"ordered-list\",\n UL_LIST: \"unordered-list\",\n LIST_ITEM: \"list-item\",\n\n HR: \"horizontal-row\",\n QUOTE: \"blockquote\",\n\n EMBEDDED_ENTRY: \"embedded-entity\",\n EMBEDDED_ASSET: \"embedded-asset-block\",\n\n IMAGE: \"image\",\n VIDEO: \"video\",\n RICHTEXTDOCUMENT: \"rich-text-document\",\n TEASER: \"teaser\",\n} as const;\n\nexport const MARK = {\n BOLD: \"bold\",\n ITALIC: \"italic\",\n UNDERLINE: \"underline\",\n CODE: \"code\",\n} as const;\n\nexport const ELEMENT = {\n DIV: \"div\",\n SPAN: \"span\",\n} as const;\n","import React, { type ReactNode } from \"react\";\n\nimport { BLOCK } from \"./constants\";\nimport { type RichTextNode } from \"./types\";\n\nconst isHeaderRow = (row: RichTextNode): boolean =>\n row.type === BLOCK.TABLE_ROW &&\n !!row.content?.every((node) => node.type === BLOCK.TABLE_HEADER_CELL);\n\n/**\n * Wrap the first rows with <thead /> if it consists of only <th> elements.\n * Wrap the rest of the rows with <tbody />.\n */\nexport const tableRenderer = (richTextNode: RichTextNode, children: ReactNode[]) => {\n if (richTextNode.type !== BLOCK.TABLE) {\n return children;\n }\n const { content: tableContent } = richTextNode;\n const [headerRows, bodyRows] = (tableContent || []).reduce<[RichTextNode[], RichTextNode[]]>(\n ([headers, body], row) => {\n return isHeaderRow(row) ? [[...headers, row], body] : [headers, [...body, row]];\n },\n [[], []]\n );\n const headerRowChildren = children.slice(0, headerRows.length);\n const bodyRowChildren = children.slice(headerRows.length, children.length);\n return (\n <div className=\"purpur-rich-text-table-scroll-container\">\n <div className=\"purpur-rich-text-table-inner-scroll-container\">\n <table>\n {headerRows.length > 0 && <thead>{headerRowChildren}</thead>}\n {bodyRows.length > 0 && <tbody>{bodyRowChildren}</tbody>}\n </table>\n </div>\n </div>\n );\n};\n","import { BLOCK, INLINE } from \"./constants\";\nimport { type Block, type Inline, type Mark, type RichTextNode, type Value } from \"./types\";\n\nexport type MarkNode = {\n type: Mark;\n};\n\ntype TextNode<T> = RichTextNode<T> & {\n type: \"text\";\n value: string;\n marks: MarkNode[];\n};\n\ntype InlineNode<T> = RichTextNode<T> & {\n type: Inline;\n content: Array<Inline | Text>;\n};\n\ntype BlockNode<T> = RichTextNode<T> & {\n type: Block;\n content: Array<Block | Inline | Text>;\n};\n\nconst hasValue = (obj: Record<string, unknown>, value: unknown) =>\n Object.values(obj).includes(value);\n\nconst isText = <T>(node: RichTextNode<T> | undefined): node is TextNode<T> => node?.type === \"text\";\n\nconst isBlock = <T>(node: RichTextNode<T> | undefined): node is BlockNode<T> =>\n !isInline(node) && !isText(node) && hasValue(BLOCK, node?.type);\n\nconst isInline = <T>(node: RichTextNode<T> | undefined): node is InlineNode<T> =>\n hasValue(INLINE, node?.type);\n\nexport const safeJsonParse = <T>(jsonString: string): T | null => {\n try {\n return JSON.parse(jsonString);\n } catch {\n return null;\n }\n};\n\n// This is equivalent to https://github.com/contentful/rich-text/tree/master/packages/rich-text-plain-text-renderer\nexport const richToPlainText = <T>(data: string, blockDivisor = \" \"): string => {\n const rootNode = safeJsonParse<RichTextNode<T>>(data);\n\n if (!rootNode || !rootNode.content) {\n return \"\";\n }\n\n return rootNode.content.reduce((acc: string, node: RichTextNode<T>, i) => {\n let nodeTextValue = \"\";\n\n if (isText(node)) {\n nodeTextValue = node.value;\n } else if (isBlock(node) || isInline(node)) {\n nodeTextValue = richToPlainText(JSON.stringify(node), blockDivisor);\n if (!nodeTextValue.length) {\n return acc;\n }\n }\n\n const nextNode = rootNode?.content?.[i + 1];\n const divisor = isBlock(nextNode) ? blockDivisor : \"\";\n\n return acc + nodeTextValue + divisor;\n }, \"\");\n};\n\nexport function normalizeNode<T = Value>(node: RichTextNode<T>) {\n if (\n node.type === BLOCK.IMAGE &&\n typeof node.value === \"object\" &&\n node?.value &&\n \"image\" in node.value &&\n node?.value?.image?.url\n ) {\n return { ...node, value: { ...node.value, url: node.value.image.url } };\n }\n\n if (\n node.type === BLOCK.VIDEO &&\n typeof node.value === \"object\" &&\n node?.value &&\n \"video\" in node.value &&\n node.value.video?.url\n ) {\n return { ...node, value: { ...node.value, url: node.value.video.url } };\n }\n\n return node;\n}\n","import React, { Fragment, type ReactNode } from \"react\";\nimport { Heading } from \"@purpur/heading\";\nimport { Link } from \"@purpur/link\";\nimport { Paragraph } from \"@purpur/paragraph\";\nimport { TextSpacing } from \"@purpur/text-spacing\";\n\nimport { BLOCK, MARK } from \"./constants\";\nimport { tableRenderer } from \"./renderers\";\nimport type {\n ImageProp,\n LinkProp,\n Mark,\n NodeTypes,\n RichTextNode,\n RichTextProps,\n Value,\n VideoPosterProp,\n} from \"./types\";\nimport { normalizeNode } from \"./utils\";\n\n// Inspired by https://github.com/contentful/rich-text/blob/master/packages/rich-text-react-renderer/src/index.tsx\nconst MARK_TYPES = {\n [MARK.BOLD]: (children: ReactNode) => <b>{children}</b>,\n [MARK.ITALIC]: (children: ReactNode) => <i>{children}</i>,\n [MARK.UNDERLINE]: (children: ReactNode) => <u>{children}</u>,\n [MARK.CODE]: (children: ReactNode) => <code>{children}</code>,\n};\n\nconst getNodeType = (node: RichTextNode) => {\n const type = node.type ?? node.nodeType!;\n if (type.startsWith(\"heading-\")) return type.replace(\"heading-\", \"header-\");\n if (type.startsWith(\"entry-hyperlink\")) return type.replace(\"entry-hyperlink\", \"hyperlink\");\n return type;\n};\n\nfunction getNodeTypes<T = Value>(\n link: LinkProp,\n image: ImageProp,\n videoPoster: VideoPosterProp\n): NodeTypes<T> {\n return {\n [BLOCK.RICHTEXTDOCUMENT]: (_, children) => children,\n [BLOCK.DOCUMENT]: (_, children) => children,\n [BLOCK.PARAGRAPH]: (_, children) => <Paragraph variant=\"paragraph-200\">{children}</Paragraph>,\n [BLOCK.TEXT]: (node) => {\n const { value: nodeValue, marks } = node;\n const value = typeof nodeValue === \"string\" ? nodeValue.replace(/\\n/g, \"<br />\") : nodeValue;\n\n const element = <span dangerouslySetInnerHTML={{ __html: value as string }} />;\n\n if (!marks) {\n return element;\n }\n return marks.reduce((accumulator: ReactNode, currentValue: Mark | { type: Mark }) => {\n return MARK_TYPES[typeof currentValue === \"string\" ? currentValue : currentValue.type](\n accumulator\n );\n }, element);\n },\n [BLOCK.HYPERLINK]: (node, children) => {\n const uri = node.uri ?? (node.data?.uri as string);\n\n if (link) {\n return <Link variant=\"text\">{link(children, uri)}</Link>;\n }\n return (\n <Link variant=\"text\">\n <a href={uri}>{children}</a>\n </Link>\n );\n },\n [BLOCK.HR]: () => <hr />,\n [BLOCK.HEADER_2]: (_, children) => (\n <Heading tag=\"h2\" variant=\"title-300\">\n {children}\n </Heading>\n ),\n [BLOCK.HEADER_3]: (_, children) => (\n <Heading tag=\"h3\" variant=\"title-200\">\n {children}\n </Heading>\n ),\n [BLOCK.HEADER_4]: (_, children) => (\n <Heading tag=\"h4\" variant=\"title-100\">\n {children}\n </Heading>\n ),\n [BLOCK.HEADER_5]: (_, children) => (\n <Heading tag=\"h5\" variant=\"title-100\">\n {children}\n </Heading>\n ),\n [BLOCK.HEADER_6]: (_, children) => (\n <Heading tag=\"h6\" variant=\"title-100\">\n {children}\n </Heading>\n ),\n [BLOCK.TABLE]: tableRenderer,\n [BLOCK.TABLE_ROW]: (_, children) => <tr>{children}</tr>,\n [BLOCK.TABLE_HEADER_CELL]: (_, children) => <th scope=\"col\">{children}</th>,\n [BLOCK.TABLE_CELL]: (_, children) => {\n return <td>{children}</td>;\n },\n [BLOCK.TABLE_BODY]: (_, children) => <tbody>{children}</tbody>,\n [BLOCK.LIST_ITEM]: (_, children) => <li>{children}</li>,\n [BLOCK.OL_LIST]: (_, children) => <ol>{children}</ol>,\n [BLOCK.UL_LIST]: (_, children) => <ul>{children}</ul>,\n [BLOCK.QUOTE]: (_, children) => <blockquote>&#8220;{children}&#8221;</blockquote>,\n [BLOCK.EMBEDDED_ENTRY]: (_, children) => children,\n [BLOCK.EMBEDDED_ASSET]: (_, children) => children,\n [BLOCK.IMAGE]: ({ value }) => {\n if (typeof value === \"object\" && value && \"url\" in value && value.url) {\n if (image) {\n return image(value.url, value.altText, value.image?.contentType);\n }\n return <img src={value.url} alt={value.altText ?? \"\"} loading=\"lazy\" />;\n }\n return null;\n },\n [BLOCK.VIDEO]: ({ value }) => {\n if (typeof value === \"object\" && value && \"posterImage\" in value) {\n const posterImage = value.posterImage?.url;\n\n return (\n // eslint-disable-next-line jsx-a11y/media-has-caption\n <video\n data-testid=\"rich text video\"\n controls\n src={value.url}\n poster={videoPoster && posterImage ? videoPoster(posterImage) : posterImage}\n />\n );\n }\n return null;\n },\n };\n}\n\nconst isValueWhitespaceOnly = (value: string): boolean => {\n return !value.replace(/\\s+/g, \"\");\n};\n\n/**\n * Strictly checks if a singular node value OR nested node content is an empty element.\n */\n\nconst isNodeOrContentEmpty = <T,>(node: RichTextNode<T>): boolean => {\n const { content, value } = node;\n\n if (!content) {\n return typeof value === \"string\" && isValueWhitespaceOnly(value);\n }\n\n for (const item of content) {\n if (getNodeType(item) === BLOCK.HYPERLINK) {\n return false;\n }\n }\n\n return (\n content.length > 0 &&\n typeof content[0].value === \"string\" &&\n isValueWhitespaceOnly(content[0].value)\n );\n};\n\nconst serializeRichText = <T,>(\n node: RichTextNode<T>,\n customNodeTypes?: NodeTypes<T>,\n link?: LinkProp,\n image?: ImageProp,\n videoPoster?: VideoPosterProp\n): ReactNode => {\n let index = 0; // nodes in rich text does not contain ids, we'll use index as keys for react\n\n const nodes = {\n ...getNodeTypes(link, image, videoPoster),\n ...customNodeTypes,\n };\n\n const renderNode = (node: RichTextNode<T>): ReactNode => {\n const renderFunc = nodes[getNodeType(node)];\n\n // node types that are missing from both default NODE_TYPES and custom are never rendered\n if (typeof renderFunc === \"undefined\") {\n return null;\n }\n\n if (isNodeOrContentEmpty(node)) {\n return null;\n }\n\n const children = node.content ? node.content.map(renderNode) : [];\n\n return <Fragment key={index++}>{renderFunc(normalizeNode(node), children)}</Fragment>;\n };\n\n return renderNode(node);\n};\n\n/* Not using a arrow function here since the default generic will mess with the highlighting\n and it still needs a eslint-disable-next-line because it still lints incorrect */\n\nfunction RichText<T = Value>({\n data,\n className,\n customNodeTypes,\n noTextSpacing = false,\n link,\n image,\n videoPoster,\n element: ElementTag = \"div\",\n ...rest\n}: RichTextProps<T>) {\n return data ? (\n noTextSpacing ? (\n <ElementTag className={className} {...rest}>\n {serializeRichText(data, customNodeTypes, link, image, videoPoster)}\n </ElementTag>\n ) : (\n <TextSpacing className={className} element={ElementTag} {...rest}>\n {serializeRichText(data, customNodeTypes, link, image, videoPoster)}\n </TextSpacing>\n )\n ) : null;\n}\n\nexport { getNodeTypes, RichText, serializeRichText };\n"],"names":["INLINE","BLOCK","MARK","isHeaderRow","row","node","tableRenderer","richTextNode","children","tableContent","headerRows","bodyRows","headers","body","headerRowChildren","bodyRowChildren","jsx","jsxs","hasValue","obj","value","isText","isBlock","isInline","safeJsonParse","jsonString","richToPlainText","data","blockDivisor","rootNode","acc","i","nodeTextValue","nextNode","divisor","normalizeNode","MARK_TYPES","getNodeType","type","getNodeTypes","link","image","videoPoster","_","Paragraph","nodeValue","marks","element","accumulator","currentValue","uri","Link","Heading","posterImage","isValueWhitespaceOnly","isNodeOrContentEmpty","content","item","serializeRichText","customNodeTypes","index","nodes","renderNode","renderFunc","Fragment","RichText","className","noTextSpacing","ElementTag","rest","TextSpacing"],"mappings":"qNAAaA,EAAS,CACpB,UAAW,YACX,gBAAiB,kBACjB,gBAAiB,kBACjB,mBAAoB,qBACpB,eAAgB,uBAClB,EAEaC,EAAQ,CACnB,SAAU,WACV,UAAW,YACX,KAAM,OACN,UAAW,YACX,gBAAiB,kBAEjB,SAAU,WACV,SAAU,WACV,SAAU,WACV,SAAU,WACV,SAAU,WACV,SAAU,WAEV,UAAW,YACX,UAAW,YACX,UAAW,YACX,UAAW,YACX,UAAW,YACX,UAAW,YAEX,MAAO,QACP,UAAW,YACX,kBAAmB,oBACnB,WAAY,aACZ,WAAY,aAEZ,QAAS,eACT,QAAS,iBACT,UAAW,YAEX,GAAI,iBACJ,MAAO,aAEP,eAAgB,kBAChB,eAAgB,uBAEhB,MAAO,QACP,MAAO,QACP,iBAAkB,qBAClB,OAAQ,QACV,EAEaC,EAAO,CAClB,KAAM,OACN,OAAQ,SACR,UAAW,YACX,KAAM,MACR,ECnDMC,EAAeC,GACnBA,EAAI,OAASH,EAAM,WACnB,CAAC,CAACG,EAAI,SAAS,MAAOC,GAASA,EAAK,OAASJ,EAAM,iBAAiB,EAMzDK,EAAgB,CAACC,EAA4BC,IAA0B,CAClF,GAAID,EAAa,OAASN,EAAM,MAC9B,OAAOO,EAET,KAAM,CAAE,QAASC,CAAA,EAAiBF,EAC5B,CAACG,EAAYC,CAAQ,GAAKF,GAAgB,CAAA,GAAI,OAClD,CAAC,CAACG,EAASC,CAAI,EAAGT,IACTD,EAAYC,CAAG,EAAI,CAAC,CAAC,GAAGQ,EAASR,CAAG,EAAGS,CAAI,EAAI,CAACD,EAAS,CAAC,GAAGC,EAAMT,CAAG,CAAC,EAEhF,CAAC,CAAA,EAAI,CAAA,CAAE,CAAA,EAEHU,EAAo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,EAAW5B,EAAc9B,CAAI,EAAGG,CAAQ,GAAlDoD,GAAoD,CAC5E,EAEA,OAAOE,EAAWzD,CAAI,CACxB,EAKA,SAAS4D,EAAoB,CAC3B,KAAAtC,EACA,UAAAuC,EACA,gBAAAP,EACA,cAAAQ,EAAgB,GAChB,KAAA3B,EACA,MAAAC,EACA,YAAAC,EACA,QAAS0B,EAAa,MACtB,GAAGC,CACL,EAAqB,CACnB,OAAO1C,EACLwC,EACEnD,EAAAA,IAACoD,EAAA,CAAW,UAAAF,EAAuB,GAAGG,EACnC,SAAAX,EAAkB/B,EAAMgC,EAAiBnB,EAAMC,EAAOC,CAAW,CAAA,CACpE,EAEA1B,EAAAA,IAACsD,EAAAA,YAAA,CAAY,UAAAJ,EAAsB,QAASE,EAAa,GAAGC,EACzD,SAAAX,EAAkB/B,EAAMgC,EAAiBnB,EAAMC,EAAOC,CAAW,EACpE,EAEA,IACN"}
@@ -3,7 +3,7 @@ import { Fragment as I } from "react";
3
3
  import { H as h } from "./heading-BG7JTFO1.mjs";
4
4
  import { a as p } from "./link-ccCdDvBc.mjs";
5
5
  import { P as H } from "./paragraph-CwAdFoIm.mjs";
6
- import { T as N } from "./text-spacing-BU0mkEf9.mjs";
6
+ import { T as N } from "./text-spacing-Bmkv_rmc.mjs";
7
7
  const m = {
8
8
  HYPERLINK: "hyperlink",
9
9
  ENTRY_HYPERLINK: "entry-hyperlink",
@@ -186,4 +186,4 @@ export {
186
186
  j as R,
187
187
  B as r
188
188
  };
189
- //# sourceMappingURL=RichText-CPkBwXNI.mjs.map
189
+ //# sourceMappingURL=RichText-CwQfDo_S.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"RichText-CPkBwXNI.mjs","sources":["../../../components/rich-text/src/constants.ts","../../../components/rich-text/src/renderers.tsx","../../../components/rich-text/src/utils.ts","../../../components/rich-text/src/RichText.tsx"],"sourcesContent":["export const INLINE = {\n HYPERLINK: \"hyperlink\",\n ENTRY_HYPERLINK: \"entry-hyperlink\",\n ASSET_HYPERLINK: \"asset-hyperlink\",\n RESOURCE_HYPERLINK: \"resource-hyperlink\",\n EMBEDDED_ENTRY: \"embedded-entry-inline\",\n} as const;\n\nexport const BLOCK = {\n DOCUMENT: \"document\",\n PARAGRAPH: \"paragraph\",\n TEXT: \"text\",\n HYPERLINK: \"hyperlink\",\n ENTRY_HYPERLINK: \"entry-hyperlink\",\n\n HEADER_1: \"header-1\",\n HEADER_2: \"header-2\",\n HEADER_3: \"header-3\",\n HEADER_4: \"header-4\",\n HEADER_5: \"header-5\",\n HEADER_6: \"header-6\",\n\n HEADING_1: \"heading-1\",\n HEADING_2: \"heading-2\",\n HEADING_3: \"heading-3\",\n HEADING_4: \"heading-4\",\n HEADING_5: \"heading-5\",\n HEADING_6: \"heading-6\",\n\n TABLE: \"table\",\n TABLE_ROW: \"table-row\",\n TABLE_HEADER_CELL: \"table-header-cell\",\n TABLE_CELL: \"table-cell\",\n TABLE_BODY: \"table-body\",\n\n OL_LIST: \"ordered-list\",\n UL_LIST: \"unordered-list\",\n LIST_ITEM: \"list-item\",\n\n HR: \"horizontal-row\",\n QUOTE: \"blockquote\",\n\n EMBEDDED_ENTRY: \"embedded-entity\",\n EMBEDDED_ASSET: \"embedded-asset-block\",\n\n IMAGE: \"image\",\n VIDEO: \"video\",\n RICHTEXTDOCUMENT: \"rich-text-document\",\n TEASER: \"teaser\",\n} as const;\n\nexport const MARK = {\n BOLD: \"bold\",\n ITALIC: \"italic\",\n UNDERLINE: \"underline\",\n CODE: \"code\",\n} as const;\n\nexport const ELEMENT = {\n DIV: \"div\",\n SPAN: \"span\",\n} as const;\n","import React, { type ReactNode } from \"react\";\n\nimport { BLOCK } from \"./constants\";\nimport { type RichTextNode } from \"./types\";\n\nconst isHeaderRow = (row: RichTextNode): boolean =>\n row.type === BLOCK.TABLE_ROW &&\n !!row.content?.every((node) => node.type === BLOCK.TABLE_HEADER_CELL);\n\n/**\n * Wrap the first rows with <thead /> if it consists of only <th> elements.\n * Wrap the rest of the rows with <tbody />.\n */\nexport const tableRenderer = (richTextNode: RichTextNode, children: ReactNode[]) => {\n if (richTextNode.type !== BLOCK.TABLE) {\n return children;\n }\n const { content: tableContent } = richTextNode;\n const [headerRows, bodyRows] = (tableContent || []).reduce<[RichTextNode[], RichTextNode[]]>(\n ([headers, body], row) => {\n return isHeaderRow(row) ? [[...headers, row], body] : [headers, [...body, row]];\n },\n [[], []]\n );\n const headerRowChildren = children.slice(0, headerRows.length);\n const bodyRowChildren = children.slice(headerRows.length, children.length);\n return (\n <div className=\"purpur-rich-text-table-scroll-container\">\n <div className=\"purpur-rich-text-table-inner-scroll-container\">\n <table>\n {headerRows.length > 0 && <thead>{headerRowChildren}</thead>}\n {bodyRows.length > 0 && <tbody>{bodyRowChildren}</tbody>}\n </table>\n </div>\n </div>\n );\n};\n","import { BLOCK, INLINE } from \"./constants\";\nimport { type Block, type Inline, type Mark, type RichTextNode, type Value } from \"./types\";\n\nexport type MarkNode = {\n type: Mark;\n};\n\ntype TextNode<T> = RichTextNode<T> & {\n type: \"text\";\n value: string;\n marks: MarkNode[];\n};\n\ntype InlineNode<T> = RichTextNode<T> & {\n type: Inline;\n content: Array<Inline | Text>;\n};\n\ntype BlockNode<T> = RichTextNode<T> & {\n type: Block;\n content: Array<Block | Inline | Text>;\n};\n\nconst hasValue = (obj: Record<string, unknown>, value: unknown) =>\n Object.values(obj).includes(value);\n\nconst isText = <T>(node: RichTextNode<T> | undefined): node is TextNode<T> => node?.type === \"text\";\n\nconst isBlock = <T>(node: RichTextNode<T> | undefined): node is BlockNode<T> =>\n !isInline(node) && !isText(node) && hasValue(BLOCK, node?.type);\n\nconst isInline = <T>(node: RichTextNode<T> | undefined): node is InlineNode<T> =>\n hasValue(INLINE, node?.type);\n\nexport const safeJsonParse = <T>(jsonString: string): T | null => {\n try {\n return JSON.parse(jsonString);\n } catch {\n return null;\n }\n};\n\n// This is equivalent to https://github.com/contentful/rich-text/tree/master/packages/rich-text-plain-text-renderer\nexport const richToPlainText = <T>(data: string, blockDivisor = \" \"): string => {\n const rootNode = safeJsonParse<RichTextNode<T>>(data);\n\n if (!rootNode || !rootNode.content) {\n return \"\";\n }\n\n return rootNode.content.reduce((acc: string, node: RichTextNode<T>, i) => {\n let nodeTextValue = \"\";\n\n if (isText(node)) {\n nodeTextValue = node.value;\n } else if (isBlock(node) || isInline(node)) {\n nodeTextValue = richToPlainText(JSON.stringify(node), blockDivisor);\n if (!nodeTextValue.length) {\n return acc;\n }\n }\n\n const nextNode = rootNode?.content?.[i + 1];\n const divisor = isBlock(nextNode) ? blockDivisor : \"\";\n\n return acc + nodeTextValue + divisor;\n }, \"\");\n};\n\nexport function normalizeNode<T = Value>(node: RichTextNode<T>) {\n if (\n node.type === BLOCK.IMAGE &&\n typeof node.value === \"object\" &&\n node?.value &&\n \"image\" in node.value &&\n node?.value?.image?.url\n ) {\n return { ...node, value: { ...node.value, url: node.value.image.url } };\n }\n\n if (\n node.type === BLOCK.VIDEO &&\n typeof node.value === \"object\" &&\n node?.value &&\n \"video\" in node.value &&\n node.value.video?.url\n ) {\n return { ...node, value: { ...node.value, url: node.value.video.url } };\n }\n\n return node;\n}\n","import React, { Fragment, type ReactNode } from \"react\";\nimport { Heading } from \"@purpur/heading\";\nimport { Link } from \"@purpur/link\";\nimport { Paragraph } from \"@purpur/paragraph\";\nimport { TextSpacing } from \"@purpur/text-spacing\";\n\nimport { BLOCK, MARK } from \"./constants\";\nimport { tableRenderer } from \"./renderers\";\nimport type {\n ImageProp,\n LinkProp,\n Mark,\n NodeTypes,\n RichTextNode,\n RichTextProps,\n Value,\n VideoPosterProp,\n} from \"./types\";\nimport { normalizeNode } from \"./utils\";\n\n// Inspired by https://github.com/contentful/rich-text/blob/master/packages/rich-text-react-renderer/src/index.tsx\nconst MARK_TYPES = {\n [MARK.BOLD]: (children: ReactNode) => <b>{children}</b>,\n [MARK.ITALIC]: (children: ReactNode) => <i>{children}</i>,\n [MARK.UNDERLINE]: (children: ReactNode) => <u>{children}</u>,\n [MARK.CODE]: (children: ReactNode) => <code>{children}</code>,\n};\n\nconst getNodeType = (node: RichTextNode) => {\n const type = node.type ?? node.nodeType!;\n if (type.startsWith(\"heading-\")) return type.replace(\"heading-\", \"header-\");\n if (type.startsWith(\"entry-hyperlink\")) return type.replace(\"entry-hyperlink\", \"hyperlink\");\n return type;\n};\n\nfunction getNodeTypes<T = Value>(\n link: LinkProp,\n image: ImageProp,\n videoPoster: VideoPosterProp\n): NodeTypes<T> {\n return {\n [BLOCK.RICHTEXTDOCUMENT]: (_, children) => children,\n [BLOCK.DOCUMENT]: (_, children) => children,\n [BLOCK.PARAGRAPH]: (_, children) => <Paragraph variant=\"paragraph-200\">{children}</Paragraph>,\n [BLOCK.TEXT]: (node) => {\n const { value: nodeValue, marks } = node;\n const value = typeof nodeValue === \"string\" ? nodeValue.replace(/\\n/g, \"<br />\") : nodeValue;\n\n const element = <span dangerouslySetInnerHTML={{ __html: value as string }} />;\n\n if (!marks) {\n return element;\n }\n return marks.reduce((accumulator: ReactNode, currentValue: Mark | { type: Mark }) => {\n return MARK_TYPES[typeof currentValue === \"string\" ? currentValue : currentValue.type](\n accumulator\n );\n }, element);\n },\n [BLOCK.HYPERLINK]: (node, children) => {\n const uri = node.uri ?? (node.data?.uri as string);\n\n if (link) {\n return <Link variant=\"text\">{link(children, uri)}</Link>;\n }\n return (\n <Link variant=\"text\">\n <a href={uri}>{children}</a>\n </Link>\n );\n },\n [BLOCK.HR]: () => <hr />,\n [BLOCK.HEADER_2]: (_, children) => (\n <Heading tag=\"h2\" variant=\"title-300\">\n {children}\n </Heading>\n ),\n [BLOCK.HEADER_3]: (_, children) => (\n <Heading tag=\"h3\" variant=\"title-200\">\n {children}\n </Heading>\n ),\n [BLOCK.HEADER_4]: (_, children) => (\n <Heading tag=\"h4\" variant=\"title-100\">\n {children}\n </Heading>\n ),\n [BLOCK.HEADER_5]: (_, children) => (\n <Heading tag=\"h5\" variant=\"title-100\">\n {children}\n </Heading>\n ),\n [BLOCK.HEADER_6]: (_, children) => (\n <Heading tag=\"h6\" variant=\"title-100\">\n {children}\n </Heading>\n ),\n [BLOCK.TABLE]: tableRenderer,\n [BLOCK.TABLE_ROW]: (_, children) => <tr>{children}</tr>,\n [BLOCK.TABLE_HEADER_CELL]: (_, children) => <th scope=\"col\">{children}</th>,\n [BLOCK.TABLE_CELL]: (_, children) => {\n return <td>{children}</td>;\n },\n [BLOCK.TABLE_BODY]: (_, children) => <tbody>{children}</tbody>,\n [BLOCK.LIST_ITEM]: (_, children) => <li>{children}</li>,\n [BLOCK.OL_LIST]: (_, children) => <ol>{children}</ol>,\n [BLOCK.UL_LIST]: (_, children) => <ul>{children}</ul>,\n [BLOCK.QUOTE]: (_, children) => <blockquote>&#8220;{children}&#8221;</blockquote>,\n [BLOCK.EMBEDDED_ENTRY]: (_, children) => children,\n [BLOCK.EMBEDDED_ASSET]: (_, children) => children,\n [BLOCK.IMAGE]: ({ value }) => {\n if (typeof value === \"object\" && value && \"url\" in value && value.url) {\n if (image) {\n return image(value.url, value.altText, value.image?.contentType);\n }\n return <img src={value.url} alt={value.altText ?? \"\"} loading=\"lazy\" />;\n }\n return null;\n },\n [BLOCK.VIDEO]: ({ value }) => {\n if (typeof value === \"object\" && value && \"posterImage\" in value) {\n const posterImage = value.posterImage?.url;\n\n return (\n // eslint-disable-next-line jsx-a11y/media-has-caption\n <video\n data-testid=\"rich text video\"\n controls\n src={value.url}\n poster={videoPoster && posterImage ? videoPoster(posterImage) : posterImage}\n />\n );\n }\n return null;\n },\n };\n}\n\nconst isValueWhitespaceOnly = (value: string): boolean => {\n return !value.replace(/\\s+/g, \"\");\n};\n\n/**\n * Strictly checks if a singular node value OR nested node content is an empty element.\n */\n\nconst isNodeOrContentEmpty = <T,>(node: RichTextNode<T>): boolean => {\n const { content, value } = node;\n\n if (!content) {\n return typeof value === \"string\" && isValueWhitespaceOnly(value);\n }\n\n for (const item of content) {\n if (getNodeType(item) === BLOCK.HYPERLINK) {\n return false;\n }\n }\n\n return (\n content.length > 0 &&\n typeof content[0].value === \"string\" &&\n isValueWhitespaceOnly(content[0].value)\n );\n};\n\nconst serializeRichText = <T,>(\n node: RichTextNode<T>,\n customNodeTypes?: NodeTypes<T>,\n link?: LinkProp,\n image?: ImageProp,\n videoPoster?: VideoPosterProp\n): ReactNode => {\n let index = 0; // nodes in rich text does not contain ids, we'll use index as keys for react\n\n const nodes = {\n ...getNodeTypes(link, image, videoPoster),\n ...customNodeTypes,\n };\n\n const renderNode = (node: RichTextNode<T>): ReactNode => {\n const renderFunc = nodes[getNodeType(node)];\n\n // node types that are missing from both default NODE_TYPES and custom are never rendered\n if (typeof renderFunc === \"undefined\") {\n return null;\n }\n\n if (isNodeOrContentEmpty(node)) {\n return null;\n }\n\n const children = node.content ? node.content.map(renderNode) : [];\n\n return <Fragment key={index++}>{renderFunc(normalizeNode(node), children)}</Fragment>;\n };\n\n return renderNode(node);\n};\n\n/* Not using a arrow function here since the default generic will mess with the highlighting\n and it still needs a eslint-disable-next-line because it still lints incorrect */\n\nfunction RichText<T = Value>({\n data,\n className,\n customNodeTypes,\n noTextSpacing = false,\n link,\n image,\n videoPoster,\n element: ElementTag = \"div\",\n ...rest\n}: RichTextProps<T>) {\n return data ? (\n noTextSpacing ? (\n <ElementTag className={className} {...rest}>\n {serializeRichText(data, customNodeTypes, link, image, videoPoster)}\n </ElementTag>\n ) : (\n <TextSpacing className={className} element={ElementTag} {...rest}>\n {serializeRichText(data, customNodeTypes, link, image, videoPoster)}\n </TextSpacing>\n )\n ) : null;\n}\n\nexport { getNodeTypes, RichText, serializeRichText };\n"],"names":["INLINE","BLOCK","MARK","isHeaderRow","row","node","tableRenderer","richTextNode","children","tableContent","headerRows","bodyRows","headers","body","headerRowChildren","bodyRowChildren","jsx","jsxs","hasValue","obj","value","isText","isBlock","isInline","safeJsonParse","jsonString","richToPlainText","data","blockDivisor","rootNode","acc","i","nodeTextValue","nextNode","divisor","normalizeNode","MARK_TYPES","getNodeType","type","getNodeTypes","link","image","videoPoster","_","Paragraph","nodeValue","marks","element","accumulator","currentValue","uri","Link","Heading","posterImage","isValueWhitespaceOnly","isNodeOrContentEmpty","content","item","serializeRichText","customNodeTypes","index","nodes","renderNode","renderFunc","Fragment","RichText","className","noTextSpacing","ElementTag","rest","TextSpacing"],"mappings":";;;;;;AAAO,MAAMA,IAAS;AAAA,EACpB,WAAW;AAAA,EACX,iBAAiB;AAAA,EACjB,iBAAiB;AAAA,EACjB,oBAAoB;AAAA,EACpB,gBAAgB;AAClB,GAEaC,IAAQ;AAAA,EACnB,UAAU;AAAA,EACV,WAAW;AAAA,EACX,MAAM;AAAA,EACN,WAAW;AAAA,EACX,iBAAiB;AAAA,EAEjB,UAAU;AAAA,EACV,UAAU;AAAA,EACV,UAAU;AAAA,EACV,UAAU;AAAA,EACV,UAAU;AAAA,EACV,UAAU;AAAA,EAEV,WAAW;AAAA,EACX,WAAW;AAAA,EACX,WAAW;AAAA,EACX,WAAW;AAAA,EACX,WAAW;AAAA,EACX,WAAW;AAAA,EAEX,OAAO;AAAA,EACP,WAAW;AAAA,EACX,mBAAmB;AAAA,EACnB,YAAY;AAAA,EACZ,YAAY;AAAA,EAEZ,SAAS;AAAA,EACT,SAAS;AAAA,EACT,WAAW;AAAA,EAEX,IAAI;AAAA,EACJ,OAAO;AAAA,EAEP,gBAAgB;AAAA,EAChB,gBAAgB;AAAA,EAEhB,OAAO;AAAA,EACP,OAAO;AAAA,EACP,kBAAkB;AAAA,EAClB,QAAQ;AACV,GAEaC,IAAO;AAAA,EAClB,MAAM;AAAA,EACN,QAAQ;AAAA,EACR,WAAW;AAAA,EACX,MAAM;AACR,GCnDMC,IAAc,CAACC,MACnBA,EAAI,SAASH,EAAM,aACnB,CAAC,CAACG,EAAI,SAAS,MAAM,CAACC,MAASA,EAAK,SAASJ,EAAM,iBAAiB,GAMzDK,IAAgB,CAACC,GAA4BC,MAA0B;AAClF,MAAID,EAAa,SAASN,EAAM;AAC9B,WAAOO;AAET,QAA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MgC,GAAiBnB,GAAMC,GAAOC,CAAW,EAAA,CACpE,IAEA,gBAAA1B,EAACsD,GAAA,EAAY,WAAAJ,GAAsB,SAASE,GAAa,GAAGC,GACzD,UAAAX,EAAkB/B,GAAMgC,GAAiBnB,GAAMC,GAAOC,CAAW,GACpE,IAEA;AACN;"}
1
+ {"version":3,"file":"RichText-CwQfDo_S.mjs","sources":["../../../components/rich-text/src/constants.ts","../../../components/rich-text/src/renderers.tsx","../../../components/rich-text/src/utils.ts","../../../components/rich-text/src/RichText.tsx"],"sourcesContent":["export const INLINE = {\n HYPERLINK: \"hyperlink\",\n ENTRY_HYPERLINK: \"entry-hyperlink\",\n ASSET_HYPERLINK: \"asset-hyperlink\",\n RESOURCE_HYPERLINK: \"resource-hyperlink\",\n EMBEDDED_ENTRY: \"embedded-entry-inline\",\n} as const;\n\nexport const BLOCK = {\n DOCUMENT: \"document\",\n PARAGRAPH: \"paragraph\",\n TEXT: \"text\",\n HYPERLINK: \"hyperlink\",\n ENTRY_HYPERLINK: \"entry-hyperlink\",\n\n HEADER_1: \"header-1\",\n HEADER_2: \"header-2\",\n HEADER_3: \"header-3\",\n HEADER_4: \"header-4\",\n HEADER_5: \"header-5\",\n HEADER_6: \"header-6\",\n\n HEADING_1: \"heading-1\",\n HEADING_2: \"heading-2\",\n HEADING_3: \"heading-3\",\n HEADING_4: \"heading-4\",\n HEADING_5: \"heading-5\",\n HEADING_6: \"heading-6\",\n\n TABLE: \"table\",\n TABLE_ROW: \"table-row\",\n TABLE_HEADER_CELL: \"table-header-cell\",\n TABLE_CELL: \"table-cell\",\n TABLE_BODY: \"table-body\",\n\n OL_LIST: \"ordered-list\",\n UL_LIST: \"unordered-list\",\n LIST_ITEM: \"list-item\",\n\n HR: \"horizontal-row\",\n QUOTE: \"blockquote\",\n\n EMBEDDED_ENTRY: \"embedded-entity\",\n EMBEDDED_ASSET: \"embedded-asset-block\",\n\n IMAGE: \"image\",\n VIDEO: \"video\",\n RICHTEXTDOCUMENT: \"rich-text-document\",\n TEASER: \"teaser\",\n} as const;\n\nexport const MARK = {\n BOLD: \"bold\",\n ITALIC: \"italic\",\n UNDERLINE: \"underline\",\n CODE: \"code\",\n} as const;\n\nexport const ELEMENT = {\n DIV: \"div\",\n SPAN: \"span\",\n} as const;\n","import React, { type ReactNode } from \"react\";\n\nimport { BLOCK } from \"./constants\";\nimport { type RichTextNode } from \"./types\";\n\nconst isHeaderRow = (row: RichTextNode): boolean =>\n row.type === BLOCK.TABLE_ROW &&\n !!row.content?.every((node) => node.type === BLOCK.TABLE_HEADER_CELL);\n\n/**\n * Wrap the first rows with <thead /> if it consists of only <th> elements.\n * Wrap the rest of the rows with <tbody />.\n */\nexport const tableRenderer = (richTextNode: RichTextNode, children: ReactNode[]) => {\n if (richTextNode.type !== BLOCK.TABLE) {\n return children;\n }\n const { content: tableContent } = richTextNode;\n const [headerRows, bodyRows] = (tableContent || []).reduce<[RichTextNode[], RichTextNode[]]>(\n ([headers, body], row) => {\n return isHeaderRow(row) ? [[...headers, row], body] : [headers, [...body, row]];\n },\n [[], []]\n );\n const headerRowChildren = children.slice(0, headerRows.length);\n const bodyRowChildren = children.slice(headerRows.length, children.length);\n return (\n <div className=\"purpur-rich-text-table-scroll-container\">\n <div className=\"purpur-rich-text-table-inner-scroll-container\">\n <table>\n {headerRows.length > 0 && <thead>{headerRowChildren}</thead>}\n {bodyRows.length > 0 && <tbody>{bodyRowChildren}</tbody>}\n </table>\n </div>\n </div>\n );\n};\n","import { BLOCK, INLINE } from \"./constants\";\nimport { type Block, type Inline, type Mark, type RichTextNode, type Value } from \"./types\";\n\nexport type MarkNode = {\n type: Mark;\n};\n\ntype TextNode<T> = RichTextNode<T> & {\n type: \"text\";\n value: string;\n marks: MarkNode[];\n};\n\ntype InlineNode<T> = RichTextNode<T> & {\n type: Inline;\n content: Array<Inline | Text>;\n};\n\ntype BlockNode<T> = RichTextNode<T> & {\n type: Block;\n content: Array<Block | Inline | Text>;\n};\n\nconst hasValue = (obj: Record<string, unknown>, value: unknown) =>\n Object.values(obj).includes(value);\n\nconst isText = <T>(node: RichTextNode<T> | undefined): node is TextNode<T> => node?.type === \"text\";\n\nconst isBlock = <T>(node: RichTextNode<T> | undefined): node is BlockNode<T> =>\n !isInline(node) && !isText(node) && hasValue(BLOCK, node?.type);\n\nconst isInline = <T>(node: RichTextNode<T> | undefined): node is InlineNode<T> =>\n hasValue(INLINE, node?.type);\n\nexport const safeJsonParse = <T>(jsonString: string): T | null => {\n try {\n return JSON.parse(jsonString);\n } catch {\n return null;\n }\n};\n\n// This is equivalent to https://github.com/contentful/rich-text/tree/master/packages/rich-text-plain-text-renderer\nexport const richToPlainText = <T>(data: string, blockDivisor = \" \"): string => {\n const rootNode = safeJsonParse<RichTextNode<T>>(data);\n\n if (!rootNode || !rootNode.content) {\n return \"\";\n }\n\n return rootNode.content.reduce((acc: string, node: RichTextNode<T>, i) => {\n let nodeTextValue = \"\";\n\n if (isText(node)) {\n nodeTextValue = node.value;\n } else if (isBlock(node) || isInline(node)) {\n nodeTextValue = richToPlainText(JSON.stringify(node), blockDivisor);\n if (!nodeTextValue.length) {\n return acc;\n }\n }\n\n const nextNode = rootNode?.content?.[i + 1];\n const divisor = isBlock(nextNode) ? blockDivisor : \"\";\n\n return acc + nodeTextValue + divisor;\n }, \"\");\n};\n\nexport function normalizeNode<T = Value>(node: RichTextNode<T>) {\n if (\n node.type === BLOCK.IMAGE &&\n typeof node.value === \"object\" &&\n node?.value &&\n \"image\" in node.value &&\n node?.value?.image?.url\n ) {\n return { ...node, value: { ...node.value, url: node.value.image.url } };\n }\n\n if (\n node.type === BLOCK.VIDEO &&\n typeof node.value === \"object\" &&\n node?.value &&\n \"video\" in node.value &&\n node.value.video?.url\n ) {\n return { ...node, value: { ...node.value, url: node.value.video.url } };\n }\n\n return node;\n}\n","import React, { Fragment, type ReactNode } from \"react\";\nimport { Heading } from \"@purpur/heading\";\nimport { Link } from \"@purpur/link\";\nimport { Paragraph } from \"@purpur/paragraph\";\nimport { TextSpacing } from \"@purpur/text-spacing\";\n\nimport { BLOCK, MARK } from \"./constants\";\nimport { tableRenderer } from \"./renderers\";\nimport type {\n ImageProp,\n LinkProp,\n Mark,\n NodeTypes,\n RichTextNode,\n RichTextProps,\n Value,\n VideoPosterProp,\n} from \"./types\";\nimport { normalizeNode } from \"./utils\";\n\n// Inspired by https://github.com/contentful/rich-text/blob/master/packages/rich-text-react-renderer/src/index.tsx\nconst MARK_TYPES = {\n [MARK.BOLD]: (children: ReactNode) => <b>{children}</b>,\n [MARK.ITALIC]: (children: ReactNode) => <i>{children}</i>,\n [MARK.UNDERLINE]: (children: ReactNode) => <u>{children}</u>,\n [MARK.CODE]: (children: ReactNode) => <code>{children}</code>,\n};\n\nconst getNodeType = (node: RichTextNode) => {\n const type = node.type ?? node.nodeType!;\n if (type.startsWith(\"heading-\")) return type.replace(\"heading-\", \"header-\");\n if (type.startsWith(\"entry-hyperlink\")) return type.replace(\"entry-hyperlink\", \"hyperlink\");\n return type;\n};\n\nfunction getNodeTypes<T = Value>(\n link: LinkProp,\n image: ImageProp,\n videoPoster: VideoPosterProp\n): NodeTypes<T> {\n return {\n [BLOCK.RICHTEXTDOCUMENT]: (_, children) => children,\n [BLOCK.DOCUMENT]: (_, children) => children,\n [BLOCK.PARAGRAPH]: (_, children) => <Paragraph variant=\"paragraph-200\">{children}</Paragraph>,\n [BLOCK.TEXT]: (node) => {\n const { value: nodeValue, marks } = node;\n const value = typeof nodeValue === \"string\" ? nodeValue.replace(/\\n/g, \"<br />\") : nodeValue;\n\n const element = <span dangerouslySetInnerHTML={{ __html: value as string }} />;\n\n if (!marks) {\n return element;\n }\n return marks.reduce((accumulator: ReactNode, currentValue: Mark | { type: Mark }) => {\n return MARK_TYPES[typeof currentValue === \"string\" ? currentValue : currentValue.type](\n accumulator\n );\n }, element);\n },\n [BLOCK.HYPERLINK]: (node, children) => {\n const uri = node.uri ?? (node.data?.uri as string);\n\n if (link) {\n return <Link variant=\"text\">{link(children, uri)}</Link>;\n }\n return (\n <Link variant=\"text\">\n <a href={uri}>{children}</a>\n </Link>\n );\n },\n [BLOCK.HR]: () => <hr />,\n [BLOCK.HEADER_2]: (_, children) => (\n <Heading tag=\"h2\" variant=\"title-300\">\n {children}\n </Heading>\n ),\n [BLOCK.HEADER_3]: (_, children) => (\n <Heading tag=\"h3\" variant=\"title-200\">\n {children}\n </Heading>\n ),\n [BLOCK.HEADER_4]: (_, children) => (\n <Heading tag=\"h4\" variant=\"title-100\">\n {children}\n </Heading>\n ),\n [BLOCK.HEADER_5]: (_, children) => (\n <Heading tag=\"h5\" variant=\"title-100\">\n {children}\n </Heading>\n ),\n [BLOCK.HEADER_6]: (_, children) => (\n <Heading tag=\"h6\" variant=\"title-100\">\n {children}\n </Heading>\n ),\n [BLOCK.TABLE]: tableRenderer,\n [BLOCK.TABLE_ROW]: (_, children) => <tr>{children}</tr>,\n [BLOCK.TABLE_HEADER_CELL]: (_, children) => <th scope=\"col\">{children}</th>,\n [BLOCK.TABLE_CELL]: (_, children) => {\n return <td>{children}</td>;\n },\n [BLOCK.TABLE_BODY]: (_, children) => <tbody>{children}</tbody>,\n [BLOCK.LIST_ITEM]: (_, children) => <li>{children}</li>,\n [BLOCK.OL_LIST]: (_, children) => <ol>{children}</ol>,\n [BLOCK.UL_LIST]: (_, children) => <ul>{children}</ul>,\n [BLOCK.QUOTE]: (_, children) => <blockquote>&#8220;{children}&#8221;</blockquote>,\n [BLOCK.EMBEDDED_ENTRY]: (_, children) => children,\n [BLOCK.EMBEDDED_ASSET]: (_, children) => children,\n [BLOCK.IMAGE]: ({ value }) => {\n if (typeof value === \"object\" && value && \"url\" in value && value.url) {\n if (image) {\n return image(value.url, value.altText, value.image?.contentType);\n }\n return <img src={value.url} alt={value.altText ?? \"\"} loading=\"lazy\" />;\n }\n return null;\n },\n [BLOCK.VIDEO]: ({ value }) => {\n if (typeof value === \"object\" && value && \"posterImage\" in value) {\n const posterImage = value.posterImage?.url;\n\n return (\n // eslint-disable-next-line jsx-a11y/media-has-caption\n <video\n data-testid=\"rich text video\"\n controls\n src={value.url}\n poster={videoPoster && posterImage ? videoPoster(posterImage) : posterImage}\n />\n );\n }\n return null;\n },\n };\n}\n\nconst isValueWhitespaceOnly = (value: string): boolean => {\n return !value.replace(/\\s+/g, \"\");\n};\n\n/**\n * Strictly checks if a singular node value OR nested node content is an empty element.\n */\n\nconst isNodeOrContentEmpty = <T,>(node: RichTextNode<T>): boolean => {\n const { content, value } = node;\n\n if (!content) {\n return typeof value === \"string\" && isValueWhitespaceOnly(value);\n }\n\n for (const item of content) {\n if (getNodeType(item) === BLOCK.HYPERLINK) {\n return false;\n }\n }\n\n return (\n content.length > 0 &&\n typeof content[0].value === \"string\" &&\n isValueWhitespaceOnly(content[0].value)\n );\n};\n\nconst serializeRichText = <T,>(\n node: RichTextNode<T>,\n customNodeTypes?: NodeTypes<T>,\n link?: LinkProp,\n image?: ImageProp,\n videoPoster?: VideoPosterProp\n): ReactNode => {\n let index = 0; // nodes in rich text does not contain ids, we'll use index as keys for react\n\n const nodes = {\n ...getNodeTypes(link, image, videoPoster),\n ...customNodeTypes,\n };\n\n const renderNode = (node: RichTextNode<T>): ReactNode => {\n const renderFunc = nodes[getNodeType(node)];\n\n // node types that are missing from both default NODE_TYPES and custom are never rendered\n if (typeof renderFunc === \"undefined\") {\n return null;\n }\n\n if (isNodeOrContentEmpty(node)) {\n return null;\n }\n\n const children = node.content ? node.content.map(renderNode) : [];\n\n return <Fragment key={index++}>{renderFunc(normalizeNode(node), children)}</Fragment>;\n };\n\n return renderNode(node);\n};\n\n/* Not using a arrow function here since the default generic will mess with the highlighting\n and it still needs a eslint-disable-next-line because it still lints incorrect */\n\nfunction RichText<T = Value>({\n data,\n className,\n customNodeTypes,\n noTextSpacing = false,\n link,\n image,\n videoPoster,\n element: ElementTag = \"div\",\n ...rest\n}: RichTextProps<T>) {\n return data ? (\n noTextSpacing ? (\n <ElementTag className={className} {...rest}>\n {serializeRichText(data, customNodeTypes, link, image, videoPoster)}\n </ElementTag>\n ) : (\n <TextSpacing className={className} element={ElementTag} {...rest}>\n {serializeRichText(data, customNodeTypes, link, image, videoPoster)}\n </TextSpacing>\n )\n ) : null;\n}\n\nexport { getNodeTypes, RichText, serializeRichText };\n"],"names":["INLINE","BLOCK","MARK","isHeaderRow","row","node","tableRenderer","richTextNode","children","tableContent","headerRows","bodyRows","headers","body","headerRowChildren","bodyRowChildren","jsx","jsxs","hasValue","obj","value","isText","isBlock","isInline","safeJsonParse","jsonString","richToPlainText","data","blockDivisor","rootNode","acc","i","nodeTextValue","nextNode","divisor","normalizeNode","MARK_TYPES","getNodeType","type","getNodeTypes","link","image","videoPoster","_","Paragraph","nodeValue","marks","element","accumulator","currentValue","uri","Link","Heading","posterImage","isValueWhitespaceOnly","isNodeOrContentEmpty","content","item","serializeRichText","customNodeTypes","index","nodes","renderNode","renderFunc","Fragment","RichText","className","noTextSpacing","ElementTag","rest","TextSpacing"],"mappings":";;;;;;AAAO,MAAMA,IAAS;AAAA,EACpB,WAAW;AAAA,EACX,iBAAiB;AAAA,EACjB,iBAAiB;AAAA,EACjB,oBAAoB;AAAA,EACpB,gBAAgB;AAClB,GAEaC,IAAQ;AAAA,EACnB,UAAU;AAAA,EACV,WAAW;AAAA,EACX,MAAM;AAAA,EACN,WAAW;AAAA,EACX,iBAAiB;AAAA,EAEjB,UAAU;AAAA,EACV,UAAU;AAAA,EACV,UAAU;AAAA,EACV,UAAU;AAAA,EACV,UAAU;AAAA,EACV,UAAU;AAAA,EAEV,WAAW;AAAA,EACX,WAAW;AAAA,EACX,WAAW;AAAA,EACX,WAAW;AAAA,EACX,WAAW;AAAA,EACX,WAAW;AAAA,EAEX,OAAO;AAAA,EACP,WAAW;AAAA,EACX,mBAAmB;AAAA,EACnB,YAAY;AAAA,EACZ,YAAY;AAAA,EAEZ,SAAS;AAAA,EACT,SAAS;AAAA,EACT,WAAW;AAAA,EAEX,IAAI;AAAA,EACJ,OAAO;AAAA,EAEP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CAAI,GAAGG,CAAQ,KAAlDoD,GAAoD;AAAA,EAC5E;AAEA,SAAOE,EAAWzD,CAAI;AACxB;AAKA,SAAS4D,EAAoB;AAAA,EAC3B,MAAAtC;AAAA,EACA,WAAAuC;AAAA,EACA,iBAAAP;AAAA,EACA,eAAAQ,IAAgB;AAAA,EAChB,MAAA3B;AAAA,EACA,OAAAC;AAAA,EACA,aAAAC;AAAA,EACA,SAAS0B,IAAa;AAAA,EACtB,GAAGC;AACL,GAAqB;AACnB,SAAO1C,IACLwC,IACE,gBAAAnD,EAACoD,GAAA,EAAW,WAAAF,GAAuB,GAAGG,GACnC,UAAAX,EAAkB/B,GAAMgC,GAAiBnB,GAAMC,GAAOC,CAAW,EAAA,CACpE,IAEA,gBAAA1B,EAACsD,GAAA,EAAY,WAAAJ,GAAsB,SAASE,GAAa,GAAGC,GACzD,UAAAX,EAAkB/B,GAAMgC,GAAiBnB,GAAMC,GAAOC,CAAW,GACpE,IAEA;AACN;"}
@@ -1,2 +1,2 @@
1
- "use strict";const S=require("react/jsx-runtime"),a=require("react"),r=require("./variables-D1vNo1lO.js"),f="#f4e0ff",m="#c461f7",N="#29003e",y="#ede1d8",P="#4f4741",E="#3b332d",O="#ffffff",b="#202022",A="rgba(255, 255, 255, 0.95)",H="rgba(255, 255, 255, 0.66)",M="rgba(255, 255, 255, 0.37)",W="rgba(0, 0, 0, 0.8)",D="rgba(0, 0, 0, 0.54)",h="rgba(0, 0, 0, 0.44)",F="#f4e0ff",L="#faf0ff",R="#ffffff",w="#4e0174",Q="#ffffff",j="#6d02a3",q="#4e0174",$="#29003e",z="#ffffff",K="#ffffff",Z="#29003e",G="#ffffff",J="#29003e",U="#ffffff",X="#ffffff",Y="#d58df9",_="#d58df9",V="#ffafc9",rr="#980233",er="#fb4885",or="#e4175c",tr="#79d9a7",ar="#02562b",ur="#1fa15e",cr="#f9bb5b",nr="#f39200",ir="#a86602",lr="#91cdf4",pr="#3694d3",vr="#ffffff",sr="#ffffff",gr="#4e0174",dr="#202022",Br="#29003e",Sr="#f4e0ff",Cr="#ffffff",Tr="#121212",Ir="#ffffff",kr="#202022",xr="#f5f5fa",fr="rgba(0, 0, 0, 0.71)",mr="rgba(255, 255, 255, 0.84)",Nr="#4e0174",yr="#f4e0ff",Pr="#e4b6fb",Er="#d58df9",Or="#4e0174",br="#6d02a3",Ar="#8c07d0",Hr="#990ae3",Mr="#c461f7",Wr="#d58df9",Dr="#990ae3",hr="#6d02a3",Fr="#4e0174",Lr="rgba(255, 255, 255, 0.11)",Rr="rgba(0, 0, 0, 0.1)",wr="#4e0174",Qr="#e4b6fb",jr="#6d02a3",qr="#d58df9",$r="rgba(255, 255, 255, 0.16)",zr="rgba(0, 0, 0, 0.05)",Kr="rgba(255, 255, 255, 0.07)",Zr="rgba(0, 0, 0, 0.05)",Gr="#e4175c",Jr="#c00543",Ur="#980233",Xr="#03385b",Yr="#62b2e7",_r="#003e1e",Vr="#3dbf7c",re="#1fa15e",ee="#700025",oe="#ff80ab",te="#fb4885",ae="#4c2f03",ue="#f39200",ce="#f39200",ne="#353537",ie="#6d02a3",le="#f4e0ff",pe="#ffffff",ve="#f4e0ff",se="#29003e",ge="#4f4741",de="#2d2824",Be="rgba(255, 255, 255, 0.29)",Se="rgba(0, 0, 0, 0.33)",Ce="rgba(255, 255, 255, 0.46)",Te="rgba(0, 0, 0, 0.54)",Ie="rgba(255, 255, 255, 0.16)",ke="rgba(0, 0, 0, 0.16)",xe="#c461f7",fe="#f4e0ff",me="#6d02a3",Ne="#faf0ff",ye="#ffffff",Pe="#4e0174",Ee="#29003e",Oe="#990ae3",be="#d58df9",Ae="rgba(255, 255, 255, 0.37)",He="rgba(0, 0, 0, 0.44)",Me="#e4b6fb",We="#6d02a3",De="#fb4885",he="#e4175c",Fe="#f39200",Le="#3694d3",Re="#1fa15e",we="#018842",Qe={colorBrandDeepPurple:f,colorBrandCorePurple:m,colorBrandLightPurple:N,colorBrandDeepBeige:y,colorBrandBeige:P,colorBrandLightBeige:E,colorBrandOffBlack:O,colorBrandWhite:b,colorTextDefault:A,colorTextMedium:H,colorTextWeak:M,colorTextDefaultNegative:W,colorTextMediumNegative:D,colorTextWeakNegative:h,colorTextInteractivePrimary:F,colorTextInteractivePrimaryHover:L,colorTextInteractivePrimaryActive:R,colorTextInteractiveOnPrimary:w,colorTextInteractiveOnExpressive:z,colorTextInteractiveOnExpressiveHover:Z,colorTextInteractiveOnExpressiveActive:J,colorTextInteractiveOnDestructive:X,colorTextInteractiveSelected:Y,colorTextInteractivePrimaryNegative:j,colorTextInteractivePrimaryHoverNegative:q,colorTextInteractivePrimaryActiveNegative:$,colorTextInteractiveOnPrimaryNegative:Q,colorTextInteractiveOnExpressiveNegative:K,colorTextInteractiveOnExpressiveHoverNegative:G,colorTextInteractiveOnExpressiveActiveNegative:U,colorTextStatusInfoMedium:pr,colorTextStatusInfoStrong:lr,colorTextStatusSuccessMedium:ur,colorTextStatusSuccessStrong:tr,colorTextStatusWarningMedium:nr,colorTextStatusWarningStrong:cr,colorTextStatusErrorMedium:er,colorTextStatusErrorStrong:V,colorTextStatusNeutral:vr,colorTextStatusSpecial:sr,colorTextStatusAttention:gr,colorTextStatusDiscount:_,colorTextStatusBlackFriday:dr,colorTextStatusSuccessStrongNegative:ar,colorTextStatusErrorMediumNegative:or,colorTextStatusErrorStrongNegative:rr,colorTextStatusWarningMediumNegative:ir,colorTextToneOnTonePrimary:Br,colorTextToneOnToneSecondary:Sr,colorTextToneOnToneTertiary:Cr,colorBackgroundPrimary:Tr,colorBackgroundSecondary:kr,colorBackgroundOnImage:fr,colorBackgroundPrimaryNegative:Ir,colorBackgroundSecondaryNegative:xr,colorBackgroundOnImageNegative:mr,colorBackgroundInteractivePrimary:yr,colorBackgroundInteractivePrimaryHover:Pr,colorBackgroundInteractivePrimaryActive:Er,colorBackgroundInteractiveExpressive:Hr,colorBackgroundInteractiveExpressiveHover:Mr,colorBackgroundInteractiveExpressiveActive:Wr,colorBackgroundInteractiveTransparentHover:wr,colorBackgroundInteractiveTransparentActive:jr,colorBackgroundInteractiveDisabled:Lr,colorBackgroundInteractiveReadOnly:Kr,colorBackgroundInteractiveInactive:$r,colorBackgroundInteractiveDestructive:Gr,colorBackgroundInteractiveDestructiveHover:Jr,colorBackgroundInteractiveDestructiveActive:Ur,colorBackgroundInteractiveAutoFill:Nr,colorBackgroundInteractivePrimaryNegative:Or,colorBackgroundInteractivePrimaryHoverNegative:br,colorBackgroundInteractivePrimaryActiveNegative:Ar,colorBackgroundInteractiveExpressiveNegative:Dr,colorBackgroundInteractiveExpressiveHoverNegative:hr,colorBackgroundInteractiveExpressiveActiveNegative:Fr,colorBackgroundInteractiveTransparentHoverNegative:Qr,colorBackgroundInteractiveTransparentActiveNegative:qr,colorBackgroundInteractiveDisabledNegative:Rr,colorBackgroundInteractiveInactiveNegative:zr,colorBackgroundInteractiveReadOnlyNegative:Zr,colorBackgroundStatusInfoMedium:Xr,colorBackgroundStatusInfoStrong:Yr,colorBackgroundStatusSuccessMedium:_r,colorBackgroundStatusSuccessStrong:Vr,colorBackgroundStatusWarningMedium:ae,colorBackgroundStatusWarningStrong:ue,colorBackgroundStatusErrorMedium:ee,colorBackgroundStatusErrorStrong:oe,colorBackgroundStatusNeutral:ne,colorBackgroundStatusSpecial:ie,colorBackgroundStatusAttention:le,colorBackgroundStatusBlackFriday:pe,colorBackgroundStatusSuccessStrongNegative:re,colorBackgroundStatusWarningStrongNegative:ce,colorBackgroundStatusErrorStrongNegative:te,colorBackgroundToneOnTonePrimary:ve,colorBackgroundToneOnToneSecondary:se,colorBackgroundToneOnToneTertiary:ge,colorBackgroundToneOnToneQuaternary:de,colorBorderWeak:Ie,colorBorderMedium:Be,colorBorderStrong:Ce,colorBorderWeakNegative:ke,colorBorderMediumNegative:Se,colorBorderStrongNegative:Te,colorBorderInteractivePrimary:fe,colorBorderInteractivePrimaryHover:Ne,colorBorderInteractivePrimaryActive:ye,colorBorderInteractiveFocus:xe,colorBorderInteractiveExpressive:Oe,colorBorderInteractiveSubtle:Ae,colorBorderInteractiveSubtleHover:Me,colorBorderInteractiveSelected:be,colorBorderInteractivePrimaryNegative:me,colorBorderInteractivePrimaryHoverNegative:Pe,colorBorderInteractivePrimaryActiveNegative:Ee,colorBorderInteractiveSubtleNegative:He,colorBorderInteractiveSubtleHoverNegative:We,colorBorderStatusError:De,colorBorderStatusWarning:Fe,colorBorderStatusInfo:Le,colorBorderStatusSuccess:Re,colorBorderStatusErrorNegative:he,colorBorderStatusSuccessNegative:we},je={colorBrandDeepPurple:r.purpurColorBrandDeepPurple,colorBrandCorePurple:r.purpurColorBrandCorePurple,colorBrandLightPurple:r.purpurColorBrandLightPurple,colorBrandDeepBeige:r.purpurColorBrandDeepBeige,colorBrandBeige:r.purpurColorBrandBeige,colorBrandLightBeige:r.purpurColorBrandLightBeige,colorBrandOffBlack:r.purpurColorBrandOffBlack,colorBrandWhite:r.purpurColorBrandWhite,colorTextDefault:r.purpurColorTextDefault,colorTextMedium:r.purpurColorTextMedium,colorTextWeak:r.purpurColorTextWeak,colorTextDefaultNegative:r.purpurColorTextDefaultNegative,colorTextMediumNegative:r.purpurColorTextMediumNegative,colorTextWeakNegative:r.purpurColorTextWeakNegative,colorTextInteractivePrimary:r.purpurColorTextInteractivePrimary,colorTextInteractivePrimaryHover:r.purpurColorTextInteractivePrimaryHover,colorTextInteractivePrimaryActive:r.purpurColorTextInteractivePrimaryActive,colorTextInteractiveOnPrimary:r.purpurColorTextInteractiveOnPrimary,colorTextInteractiveOnExpressive:r.purpurColorTextInteractiveOnExpressive,colorTextInteractiveOnExpressiveHover:r.purpurColorTextInteractiveOnExpressiveHover,colorTextInteractiveOnExpressiveActive:r.purpurColorTextInteractiveOnExpressiveActive,colorTextInteractiveOnDestructive:r.purpurColorTextInteractiveOnDestructive,colorTextInteractiveSelected:r.purpurColorTextInteractiveSelected,colorTextInteractivePrimaryNegative:r.purpurColorTextInteractivePrimaryNegative,colorTextInteractivePrimaryHoverNegative:r.purpurColorTextInteractivePrimaryHoverNegative,colorTextInteractivePrimaryActiveNegative:r.purpurColorTextInteractivePrimaryActiveNegative,colorTextInteractiveOnPrimaryNegative:r.purpurColorTextInteractiveOnPrimaryNegative,colorTextInteractiveOnExpressiveNegative:r.purpurColorTextInteractiveOnExpressiveNegative,colorTextInteractiveOnExpressiveHoverNegative:r.purpurColorTextInteractiveOnExpressiveHoverNegative,colorTextInteractiveOnExpressiveActiveNegative:r.purpurColorTextInteractiveOnExpressiveActiveNegative,colorTextStatusInfoMedium:r.purpurColorTextStatusInfoMedium,colorTextStatusInfoStrong:r.purpurColorTextStatusInfoStrong,colorTextStatusSuccessMedium:r.purpurColorTextStatusSuccessMedium,colorTextStatusSuccessStrong:r.purpurColorTextStatusSuccessStrong,colorTextStatusWarningMedium:r.purpurColorTextStatusWarningMedium,colorTextStatusWarningStrong:r.purpurColorTextStatusWarningStrong,colorTextStatusErrorMedium:r.purpurColorTextStatusErrorMedium,colorTextStatusErrorStrong:r.purpurColorTextStatusErrorStrong,colorTextStatusNeutral:r.purpurColorTextStatusNeutral,colorTextStatusSpecial:r.purpurColorTextStatusSpecial,colorTextStatusAttention:r.purpurColorTextStatusAttention,colorTextStatusDiscount:r.purpurColorTextStatusDiscount,colorTextStatusBlackFriday:r.purpurColorTextStatusBlackFriday,colorTextStatusSuccessStrongNegative:r.purpurColorTextStatusSuccessStrongNegative,colorTextStatusErrorMediumNegative:r.purpurColorTextStatusErrorMediumNegative,colorTextStatusErrorStrongNegative:r.purpurColorTextStatusErrorStrongNegative,colorTextStatusWarningMediumNegative:r.purpurColorTextStatusWarningMediumNegative,colorTextToneOnTonePrimary:r.purpurColorTextToneOnTonePrimary,colorTextToneOnToneSecondary:r.purpurColorTextToneOnToneSecondary,colorTextToneOnToneTertiary:r.purpurColorTextToneOnToneTertiary,colorBackgroundPrimary:r.purpurColorBackgroundPrimary,colorBackgroundSecondary:r.purpurColorBackgroundSecondary,colorBackgroundOnImage:r.purpurColorBackgroundOnImage,colorBackgroundPrimaryNegative:r.purpurColorBackgroundPrimaryNegative,colorBackgroundSecondaryNegative:r.purpurColorBackgroundSecondaryNegative,colorBackgroundOnImageNegative:r.purpurColorBackgroundOnImageNegative,colorBackgroundInteractivePrimary:r.purpurColorBackgroundInteractivePrimary,colorBackgroundInteractivePrimaryHover:r.purpurColorBackgroundInteractivePrimaryHover,colorBackgroundInteractivePrimaryActive:r.purpurColorBackgroundInteractivePrimaryActive,colorBackgroundInteractiveExpressive:r.purpurColorBackgroundInteractiveExpressive,colorBackgroundInteractiveExpressiveHover:r.purpurColorBackgroundInteractiveExpressiveHover,colorBackgroundInteractiveExpressiveActive:r.purpurColorBackgroundInteractiveExpressiveActive,colorBackgroundInteractiveTransparentHover:r.purpurColorBackgroundInteractiveTransparentHover,colorBackgroundInteractiveTransparentActive:r.purpurColorBackgroundInteractiveTransparentActive,colorBackgroundInteractiveDisabled:r.purpurColorBackgroundInteractiveDisabled,colorBackgroundInteractiveReadOnly:r.purpurColorBackgroundInteractiveReadOnly,colorBackgroundInteractiveInactive:r.purpurColorBackgroundInteractiveInactive,colorBackgroundInteractiveDestructive:r.purpurColorBackgroundInteractiveDestructive,colorBackgroundInteractiveDestructiveHover:r.purpurColorBackgroundInteractiveDestructiveHover,colorBackgroundInteractiveDestructiveActive:r.purpurColorBackgroundInteractiveDestructiveActive,colorBackgroundInteractiveAutoFill:r.purpurColorBackgroundInteractiveAutoFill,colorBackgroundInteractivePrimaryNegative:r.purpurColorBackgroundInteractivePrimaryNegative,colorBackgroundInteractivePrimaryHoverNegative:r.purpurColorBackgroundInteractivePrimaryHoverNegative,colorBackgroundInteractivePrimaryActiveNegative:r.purpurColorBackgroundInteractivePrimaryActiveNegative,colorBackgroundInteractiveExpressiveNegative:r.purpurColorBackgroundInteractiveExpressiveNegative,colorBackgroundInteractiveExpressiveHoverNegative:r.purpurColorBackgroundInteractiveExpressiveHoverNegative,colorBackgroundInteractiveExpressiveActiveNegative:r.purpurColorBackgroundInteractiveExpressiveActiveNegative,colorBackgroundInteractiveTransparentHoverNegative:r.purpurColorBackgroundInteractiveTransparentHoverNegative,colorBackgroundInteractiveTransparentActiveNegative:r.purpurColorBackgroundInteractiveTransparentActiveNegative,colorBackgroundInteractiveDisabledNegative:r.purpurColorBackgroundInteractiveDisabledNegative,colorBackgroundInteractiveInactiveNegative:r.purpurColorBackgroundInteractiveInactiveNegative,colorBackgroundInteractiveReadOnlyNegative:r.purpurColorBackgroundInteractiveReadOnlyNegative,colorBackgroundStatusInfoMedium:r.purpurColorBackgroundStatusInfoMedium,colorBackgroundStatusInfoStrong:r.purpurColorBackgroundStatusInfoStrong,colorBackgroundStatusSuccessMedium:r.purpurColorBackgroundStatusSuccessMedium,colorBackgroundStatusSuccessStrong:r.purpurColorBackgroundStatusSuccessStrong,colorBackgroundStatusWarningMedium:r.purpurColorBackgroundStatusWarningMedium,colorBackgroundStatusWarningStrong:r.purpurColorBackgroundStatusWarningStrong,colorBackgroundStatusErrorMedium:r.purpurColorBackgroundStatusErrorMedium,colorBackgroundStatusErrorStrong:r.purpurColorBackgroundStatusErrorStrong,colorBackgroundStatusNeutral:r.purpurColorBackgroundStatusNeutral,colorBackgroundStatusSpecial:r.purpurColorBackgroundStatusSpecial,colorBackgroundStatusAttention:r.purpurColorBackgroundStatusAttention,colorBackgroundStatusBlackFriday:r.purpurColorBackgroundStatusBlackFriday,colorBackgroundStatusSuccessStrongNegative:r.purpurColorBackgroundStatusSuccessStrongNegative,colorBackgroundStatusWarningStrongNegative:r.purpurColorBackgroundStatusWarningStrongNegative,colorBackgroundStatusErrorStrongNegative:r.purpurColorBackgroundStatusErrorStrongNegative,colorBackgroundToneOnTonePrimary:r.purpurColorBackgroundToneOnTonePrimary,colorBackgroundToneOnToneSecondary:r.purpurColorBackgroundToneOnToneSecondary,colorBackgroundToneOnToneTertiary:r.purpurColorBackgroundToneOnToneTertiary,colorBackgroundToneOnToneQuaternary:r.purpurColorBackgroundToneOnToneQuaternary,colorBorderWeak:r.purpurColorBorderWeak,colorBorderMedium:r.purpurColorBorderMedium,colorBorderStrong:r.purpurColorBorderStrong,colorBorderWeakNegative:r.purpurColorBorderWeakNegative,colorBorderMediumNegative:r.purpurColorBorderMediumNegative,colorBorderStrongNegative:r.purpurColorBorderStrongNegative,colorBorderInteractivePrimary:r.purpurColorBorderInteractivePrimary,colorBorderInteractivePrimaryHover:r.purpurColorBorderInteractivePrimaryHover,colorBorderInteractivePrimaryActive:r.purpurColorBorderInteractivePrimaryActive,colorBorderInteractiveFocus:r.purpurColorBorderInteractiveFocus,colorBorderInteractiveExpressive:r.purpurColorBorderInteractiveExpressive,colorBorderInteractiveSubtle:r.purpurColorBorderInteractiveSubtle,colorBorderInteractiveSubtleHover:r.purpurColorBorderInteractiveSubtleHover,colorBorderInteractiveSelected:r.purpurColorBorderInteractiveSelected,colorBorderInteractivePrimaryNegative:r.purpurColorBorderInteractivePrimaryNegative,colorBorderInteractivePrimaryHoverNegative:r.purpurColorBorderInteractivePrimaryHoverNegative,colorBorderInteractivePrimaryActiveNegative:r.purpurColorBorderInteractivePrimaryActiveNegative,colorBorderInteractiveSubtleNegative:r.purpurColorBorderInteractiveSubtleNegative,colorBorderInteractiveSubtleHoverNegative:r.purpurColorBorderInteractiveSubtleHoverNegative,colorBorderStatusError:r.purpurColorBorderStatusError,colorBorderStatusWarning:r.purpurColorBorderStatusWarning,colorBorderStatusInfo:r.purpurColorBorderStatusInfo,colorBorderStatusSuccess:r.purpurColorBorderStatusSuccess,colorBorderStatusErrorNegative:r.purpurColorBorderStatusErrorNegative,colorBorderStatusSuccessNegative:r.purpurColorBorderStatusSuccessNegative},s={light:je,dark:Qe},qe=o=>o.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),C=({theme:o=s,cssVariablesSelector:e,currentColorScheme:u})=>{a.useEffect(()=>{u&&Object.entries(o?.[u]??s[u]).forEach(([i,l])=>{((e?document.querySelector(e):null)??document.documentElement).style.setProperty(`--purpur-${qe(i)}`,l)})},[o,e,u])},T=a.createContext({colorScheme:"light",currentColorScheme:"light",setColorScheme:()=>{},options:{},portalContainer:null}),$e=({cssVariablesSelector:o,forceColorScheme:e,theme:u,children:i,options:l={},...g})=>{const[c,p]=a.useState(e??"auto"),[n,v]=a.useState(e??"light"),[d,I]=a.useState(null);a.useEffect(()=>{if(e)p(e);else{const t=localStorage.getItem("colorScheme");t&&p(t)}},[e]),a.useEffect(()=>{const t=window.matchMedia("(prefers-color-scheme: dark)");v(c==="auto"?t.matches?"dark":"light":c);const B=x=>{!e&&c==="auto"&&v(x.matches?"dark":"light")};return t.addEventListener("change",B),()=>{t.removeEventListener("change",B)}},[c,e]),C({theme:u,cssVariablesSelector:o,currentColorScheme:u!==void 0?n:void 0});const k=a.useMemo(()=>({colorScheme:c,currentColorScheme:n,setColorScheme:t=>{e||(p(t),localStorage.setItem("colorScheme",t))},portalContainer:d}),[c,n,e,d]);return S.jsx(T.Provider,{value:{...k,options:l},children:S.jsx("div",{"data-color-scheme":n,className:n,ref:I,...g,children:i})})},ze=()=>{const o=a.useContext(T);if(!o)throw new Error("useTheme must be used within a ThemeProvider");return o};exports.ThemeProvider=$e;exports.teliaTheme=s;exports.useApplyTheme=C;exports.useTheme=ze;
2
- //# sourceMappingURL=ThemeProvider-BJGm3zai.js.map
1
+ "use strict";const S=require("react/jsx-runtime"),a=require("react"),r=require("./variables-CTBx79yI.js"),f="#f4e0ff",m="#c461f7",N="#29003e",y="#ede1d8",P="#4f4741",E="#3b332d",O="#ffffff",b="#202022",A="rgba(255, 255, 255, 0.95)",H="rgba(255, 255, 255, 0.66)",M="rgba(255, 255, 255, 0.37)",W="rgba(0, 0, 0, 0.8)",D="rgba(0, 0, 0, 0.54)",h="rgba(0, 0, 0, 0.44)",F="#f4e0ff",L="#faf0ff",R="#ffffff",w="#4e0174",Q="#ffffff",j="#6d02a3",q="#4e0174",$="#29003e",z="#ffffff",K="#ffffff",Z="#29003e",G="#ffffff",J="#29003e",U="#ffffff",X="#ffffff",Y="#d58df9",_="#d58df9",V="#ffafc9",rr="#980233",er="#fb4885",or="#e4175c",tr="#79d9a7",ar="#02562b",ur="#1fa15e",cr="#f9bb5b",nr="#f39200",ir="#a86602",lr="#91cdf4",pr="#3694d3",vr="#ffffff",sr="#ffffff",gr="#4e0174",dr="#202022",Br="#29003e",Sr="#f4e0ff",Cr="#ffffff",Tr="#121212",Ir="#ffffff",kr="#202022",xr="#f5f5fa",fr="rgba(0, 0, 0, 0.71)",mr="rgba(255, 255, 255, 0.84)",Nr="#4e0174",yr="#f4e0ff",Pr="#e4b6fb",Er="#d58df9",Or="#4e0174",br="#6d02a3",Ar="#8c07d0",Hr="#990ae3",Mr="#c461f7",Wr="#d58df9",Dr="#990ae3",hr="#6d02a3",Fr="#4e0174",Lr="rgba(255, 255, 255, 0.11)",Rr="rgba(0, 0, 0, 0.1)",wr="#4e0174",Qr="#e4b6fb",jr="#6d02a3",qr="#d58df9",$r="rgba(255, 255, 255, 0.16)",zr="rgba(0, 0, 0, 0.05)",Kr="rgba(255, 255, 255, 0.07)",Zr="rgba(0, 0, 0, 0.05)",Gr="#e4175c",Jr="#c00543",Ur="#980233",Xr="#03385b",Yr="#62b2e7",_r="#003e1e",Vr="#3dbf7c",re="#1fa15e",ee="#700025",oe="#ff80ab",te="#fb4885",ae="#4c2f03",ue="#f39200",ce="#f39200",ne="#353537",ie="#6d02a3",le="#f4e0ff",pe="#ffffff",ve="#f4e0ff",se="#29003e",ge="#4f4741",de="#2d2824",Be="rgba(255, 255, 255, 0.29)",Se="rgba(0, 0, 0, 0.33)",Ce="rgba(255, 255, 255, 0.46)",Te="rgba(0, 0, 0, 0.54)",Ie="rgba(255, 255, 255, 0.16)",ke="rgba(0, 0, 0, 0.16)",xe="#c461f7",fe="#f4e0ff",me="#6d02a3",Ne="#faf0ff",ye="#ffffff",Pe="#4e0174",Ee="#29003e",Oe="#990ae3",be="#d58df9",Ae="rgba(255, 255, 255, 0.37)",He="rgba(0, 0, 0, 0.44)",Me="#e4b6fb",We="#6d02a3",De="#fb4885",he="#e4175c",Fe="#f39200",Le="#3694d3",Re="#1fa15e",we="#018842",Qe={colorBrandDeepPurple:f,colorBrandCorePurple:m,colorBrandLightPurple:N,colorBrandDeepBeige:y,colorBrandBeige:P,colorBrandLightBeige:E,colorBrandOffBlack:O,colorBrandWhite:b,colorTextDefault:A,colorTextMedium:H,colorTextWeak:M,colorTextDefaultNegative:W,colorTextMediumNegative:D,colorTextWeakNegative:h,colorTextInteractivePrimary:F,colorTextInteractivePrimaryHover:L,colorTextInteractivePrimaryActive:R,colorTextInteractiveOnPrimary:w,colorTextInteractiveOnExpressive:z,colorTextInteractiveOnExpressiveHover:Z,colorTextInteractiveOnExpressiveActive:J,colorTextInteractiveOnDestructive:X,colorTextInteractiveSelected:Y,colorTextInteractivePrimaryNegative:j,colorTextInteractivePrimaryHoverNegative:q,colorTextInteractivePrimaryActiveNegative:$,colorTextInteractiveOnPrimaryNegative:Q,colorTextInteractiveOnExpressiveNegative:K,colorTextInteractiveOnExpressiveHoverNegative:G,colorTextInteractiveOnExpressiveActiveNegative:U,colorTextStatusInfoMedium:pr,colorTextStatusInfoStrong:lr,colorTextStatusSuccessMedium:ur,colorTextStatusSuccessStrong:tr,colorTextStatusWarningMedium:nr,colorTextStatusWarningStrong:cr,colorTextStatusErrorMedium:er,colorTextStatusErrorStrong:V,colorTextStatusNeutral:vr,colorTextStatusSpecial:sr,colorTextStatusAttention:gr,colorTextStatusDiscount:_,colorTextStatusBlackFriday:dr,colorTextStatusSuccessStrongNegative:ar,colorTextStatusErrorMediumNegative:or,colorTextStatusErrorStrongNegative:rr,colorTextStatusWarningMediumNegative:ir,colorTextToneOnTonePrimary:Br,colorTextToneOnToneSecondary:Sr,colorTextToneOnToneTertiary:Cr,colorBackgroundPrimary:Tr,colorBackgroundSecondary:kr,colorBackgroundOnImage:fr,colorBackgroundPrimaryNegative:Ir,colorBackgroundSecondaryNegative:xr,colorBackgroundOnImageNegative:mr,colorBackgroundInteractivePrimary:yr,colorBackgroundInteractivePrimaryHover:Pr,colorBackgroundInteractivePrimaryActive:Er,colorBackgroundInteractiveExpressive:Hr,colorBackgroundInteractiveExpressiveHover:Mr,colorBackgroundInteractiveExpressiveActive:Wr,colorBackgroundInteractiveTransparentHover:wr,colorBackgroundInteractiveTransparentActive:jr,colorBackgroundInteractiveDisabled:Lr,colorBackgroundInteractiveReadOnly:Kr,colorBackgroundInteractiveInactive:$r,colorBackgroundInteractiveDestructive:Gr,colorBackgroundInteractiveDestructiveHover:Jr,colorBackgroundInteractiveDestructiveActive:Ur,colorBackgroundInteractiveAutoFill:Nr,colorBackgroundInteractivePrimaryNegative:Or,colorBackgroundInteractivePrimaryHoverNegative:br,colorBackgroundInteractivePrimaryActiveNegative:Ar,colorBackgroundInteractiveExpressiveNegative:Dr,colorBackgroundInteractiveExpressiveHoverNegative:hr,colorBackgroundInteractiveExpressiveActiveNegative:Fr,colorBackgroundInteractiveTransparentHoverNegative:Qr,colorBackgroundInteractiveTransparentActiveNegative:qr,colorBackgroundInteractiveDisabledNegative:Rr,colorBackgroundInteractiveInactiveNegative:zr,colorBackgroundInteractiveReadOnlyNegative:Zr,colorBackgroundStatusInfoMedium:Xr,colorBackgroundStatusInfoStrong:Yr,colorBackgroundStatusSuccessMedium:_r,colorBackgroundStatusSuccessStrong:Vr,colorBackgroundStatusWarningMedium:ae,colorBackgroundStatusWarningStrong:ue,colorBackgroundStatusErrorMedium:ee,colorBackgroundStatusErrorStrong:oe,colorBackgroundStatusNeutral:ne,colorBackgroundStatusSpecial:ie,colorBackgroundStatusAttention:le,colorBackgroundStatusBlackFriday:pe,colorBackgroundStatusSuccessStrongNegative:re,colorBackgroundStatusWarningStrongNegative:ce,colorBackgroundStatusErrorStrongNegative:te,colorBackgroundToneOnTonePrimary:ve,colorBackgroundToneOnToneSecondary:se,colorBackgroundToneOnToneTertiary:ge,colorBackgroundToneOnToneQuaternary:de,colorBorderWeak:Ie,colorBorderMedium:Be,colorBorderStrong:Ce,colorBorderWeakNegative:ke,colorBorderMediumNegative:Se,colorBorderStrongNegative:Te,colorBorderInteractivePrimary:fe,colorBorderInteractivePrimaryHover:Ne,colorBorderInteractivePrimaryActive:ye,colorBorderInteractiveFocus:xe,colorBorderInteractiveExpressive:Oe,colorBorderInteractiveSubtle:Ae,colorBorderInteractiveSubtleHover:Me,colorBorderInteractiveSelected:be,colorBorderInteractivePrimaryNegative:me,colorBorderInteractivePrimaryHoverNegative:Pe,colorBorderInteractivePrimaryActiveNegative:Ee,colorBorderInteractiveSubtleNegative:He,colorBorderInteractiveSubtleHoverNegative:We,colorBorderStatusError:De,colorBorderStatusWarning:Fe,colorBorderStatusInfo:Le,colorBorderStatusSuccess:Re,colorBorderStatusErrorNegative:he,colorBorderStatusSuccessNegative:we},je={colorBrandDeepPurple:r.purpurColorBrandDeepPurple,colorBrandCorePurple:r.purpurColorBrandCorePurple,colorBrandLightPurple:r.purpurColorBrandLightPurple,colorBrandDeepBeige:r.purpurColorBrandDeepBeige,colorBrandBeige:r.purpurColorBrandBeige,colorBrandLightBeige:r.purpurColorBrandLightBeige,colorBrandOffBlack:r.purpurColorBrandOffBlack,colorBrandWhite:r.purpurColorBrandWhite,colorTextDefault:r.purpurColorTextDefault,colorTextMedium:r.purpurColorTextMedium,colorTextWeak:r.purpurColorTextWeak,colorTextDefaultNegative:r.purpurColorTextDefaultNegative,colorTextMediumNegative:r.purpurColorTextMediumNegative,colorTextWeakNegative:r.purpurColorTextWeakNegative,colorTextInteractivePrimary:r.purpurColorTextInteractivePrimary,colorTextInteractivePrimaryHover:r.purpurColorTextInteractivePrimaryHover,colorTextInteractivePrimaryActive:r.purpurColorTextInteractivePrimaryActive,colorTextInteractiveOnPrimary:r.purpurColorTextInteractiveOnPrimary,colorTextInteractiveOnExpressive:r.purpurColorTextInteractiveOnExpressive,colorTextInteractiveOnExpressiveHover:r.purpurColorTextInteractiveOnExpressiveHover,colorTextInteractiveOnExpressiveActive:r.purpurColorTextInteractiveOnExpressiveActive,colorTextInteractiveOnDestructive:r.purpurColorTextInteractiveOnDestructive,colorTextInteractiveSelected:r.purpurColorTextInteractiveSelected,colorTextInteractivePrimaryNegative:r.purpurColorTextInteractivePrimaryNegative,colorTextInteractivePrimaryHoverNegative:r.purpurColorTextInteractivePrimaryHoverNegative,colorTextInteractivePrimaryActiveNegative:r.purpurColorTextInteractivePrimaryActiveNegative,colorTextInteractiveOnPrimaryNegative:r.purpurColorTextInteractiveOnPrimaryNegative,colorTextInteractiveOnExpressiveNegative:r.purpurColorTextInteractiveOnExpressiveNegative,colorTextInteractiveOnExpressiveHoverNegative:r.purpurColorTextInteractiveOnExpressiveHoverNegative,colorTextInteractiveOnExpressiveActiveNegative:r.purpurColorTextInteractiveOnExpressiveActiveNegative,colorTextStatusInfoMedium:r.purpurColorTextStatusInfoMedium,colorTextStatusInfoStrong:r.purpurColorTextStatusInfoStrong,colorTextStatusSuccessMedium:r.purpurColorTextStatusSuccessMedium,colorTextStatusSuccessStrong:r.purpurColorTextStatusSuccessStrong,colorTextStatusWarningMedium:r.purpurColorTextStatusWarningMedium,colorTextStatusWarningStrong:r.purpurColorTextStatusWarningStrong,colorTextStatusErrorMedium:r.purpurColorTextStatusErrorMedium,colorTextStatusErrorStrong:r.purpurColorTextStatusErrorStrong,colorTextStatusNeutral:r.purpurColorTextStatusNeutral,colorTextStatusSpecial:r.purpurColorTextStatusSpecial,colorTextStatusAttention:r.purpurColorTextStatusAttention,colorTextStatusDiscount:r.purpurColorTextStatusDiscount,colorTextStatusBlackFriday:r.purpurColorTextStatusBlackFriday,colorTextStatusSuccessStrongNegative:r.purpurColorTextStatusSuccessStrongNegative,colorTextStatusErrorMediumNegative:r.purpurColorTextStatusErrorMediumNegative,colorTextStatusErrorStrongNegative:r.purpurColorTextStatusErrorStrongNegative,colorTextStatusWarningMediumNegative:r.purpurColorTextStatusWarningMediumNegative,colorTextToneOnTonePrimary:r.purpurColorTextToneOnTonePrimary,colorTextToneOnToneSecondary:r.purpurColorTextToneOnToneSecondary,colorTextToneOnToneTertiary:r.purpurColorTextToneOnToneTertiary,colorBackgroundPrimary:r.purpurColorBackgroundPrimary,colorBackgroundSecondary:r.purpurColorBackgroundSecondary,colorBackgroundOnImage:r.purpurColorBackgroundOnImage,colorBackgroundPrimaryNegative:r.purpurColorBackgroundPrimaryNegative,colorBackgroundSecondaryNegative:r.purpurColorBackgroundSecondaryNegative,colorBackgroundOnImageNegative:r.purpurColorBackgroundOnImageNegative,colorBackgroundInteractivePrimary:r.purpurColorBackgroundInteractivePrimary,colorBackgroundInteractivePrimaryHover:r.purpurColorBackgroundInteractivePrimaryHover,colorBackgroundInteractivePrimaryActive:r.purpurColorBackgroundInteractivePrimaryActive,colorBackgroundInteractiveExpressive:r.purpurColorBackgroundInteractiveExpressive,colorBackgroundInteractiveExpressiveHover:r.purpurColorBackgroundInteractiveExpressiveHover,colorBackgroundInteractiveExpressiveActive:r.purpurColorBackgroundInteractiveExpressiveActive,colorBackgroundInteractiveTransparentHover:r.purpurColorBackgroundInteractiveTransparentHover,colorBackgroundInteractiveTransparentActive:r.purpurColorBackgroundInteractiveTransparentActive,colorBackgroundInteractiveDisabled:r.purpurColorBackgroundInteractiveDisabled,colorBackgroundInteractiveReadOnly:r.purpurColorBackgroundInteractiveReadOnly,colorBackgroundInteractiveInactive:r.purpurColorBackgroundInteractiveInactive,colorBackgroundInteractiveDestructive:r.purpurColorBackgroundInteractiveDestructive,colorBackgroundInteractiveDestructiveHover:r.purpurColorBackgroundInteractiveDestructiveHover,colorBackgroundInteractiveDestructiveActive:r.purpurColorBackgroundInteractiveDestructiveActive,colorBackgroundInteractiveAutoFill:r.purpurColorBackgroundInteractiveAutoFill,colorBackgroundInteractivePrimaryNegative:r.purpurColorBackgroundInteractivePrimaryNegative,colorBackgroundInteractivePrimaryHoverNegative:r.purpurColorBackgroundInteractivePrimaryHoverNegative,colorBackgroundInteractivePrimaryActiveNegative:r.purpurColorBackgroundInteractivePrimaryActiveNegative,colorBackgroundInteractiveExpressiveNegative:r.purpurColorBackgroundInteractiveExpressiveNegative,colorBackgroundInteractiveExpressiveHoverNegative:r.purpurColorBackgroundInteractiveExpressiveHoverNegative,colorBackgroundInteractiveExpressiveActiveNegative:r.purpurColorBackgroundInteractiveExpressiveActiveNegative,colorBackgroundInteractiveTransparentHoverNegative:r.purpurColorBackgroundInteractiveTransparentHoverNegative,colorBackgroundInteractiveTransparentActiveNegative:r.purpurColorBackgroundInteractiveTransparentActiveNegative,colorBackgroundInteractiveDisabledNegative:r.purpurColorBackgroundInteractiveDisabledNegative,colorBackgroundInteractiveInactiveNegative:r.purpurColorBackgroundInteractiveInactiveNegative,colorBackgroundInteractiveReadOnlyNegative:r.purpurColorBackgroundInteractiveReadOnlyNegative,colorBackgroundStatusInfoMedium:r.purpurColorBackgroundStatusInfoMedium,colorBackgroundStatusInfoStrong:r.purpurColorBackgroundStatusInfoStrong,colorBackgroundStatusSuccessMedium:r.purpurColorBackgroundStatusSuccessMedium,colorBackgroundStatusSuccessStrong:r.purpurColorBackgroundStatusSuccessStrong,colorBackgroundStatusWarningMedium:r.purpurColorBackgroundStatusWarningMedium,colorBackgroundStatusWarningStrong:r.purpurColorBackgroundStatusWarningStrong,colorBackgroundStatusErrorMedium:r.purpurColorBackgroundStatusErrorMedium,colorBackgroundStatusErrorStrong:r.purpurColorBackgroundStatusErrorStrong,colorBackgroundStatusNeutral:r.purpurColorBackgroundStatusNeutral,colorBackgroundStatusSpecial:r.purpurColorBackgroundStatusSpecial,colorBackgroundStatusAttention:r.purpurColorBackgroundStatusAttention,colorBackgroundStatusBlackFriday:r.purpurColorBackgroundStatusBlackFriday,colorBackgroundStatusSuccessStrongNegative:r.purpurColorBackgroundStatusSuccessStrongNegative,colorBackgroundStatusWarningStrongNegative:r.purpurColorBackgroundStatusWarningStrongNegative,colorBackgroundStatusErrorStrongNegative:r.purpurColorBackgroundStatusErrorStrongNegative,colorBackgroundToneOnTonePrimary:r.purpurColorBackgroundToneOnTonePrimary,colorBackgroundToneOnToneSecondary:r.purpurColorBackgroundToneOnToneSecondary,colorBackgroundToneOnToneTertiary:r.purpurColorBackgroundToneOnToneTertiary,colorBackgroundToneOnToneQuaternary:r.purpurColorBackgroundToneOnToneQuaternary,colorBorderWeak:r.purpurColorBorderWeak,colorBorderMedium:r.purpurColorBorderMedium,colorBorderStrong:r.purpurColorBorderStrong,colorBorderWeakNegative:r.purpurColorBorderWeakNegative,colorBorderMediumNegative:r.purpurColorBorderMediumNegative,colorBorderStrongNegative:r.purpurColorBorderStrongNegative,colorBorderInteractivePrimary:r.purpurColorBorderInteractivePrimary,colorBorderInteractivePrimaryHover:r.purpurColorBorderInteractivePrimaryHover,colorBorderInteractivePrimaryActive:r.purpurColorBorderInteractivePrimaryActive,colorBorderInteractiveFocus:r.purpurColorBorderInteractiveFocus,colorBorderInteractiveExpressive:r.purpurColorBorderInteractiveExpressive,colorBorderInteractiveSubtle:r.purpurColorBorderInteractiveSubtle,colorBorderInteractiveSubtleHover:r.purpurColorBorderInteractiveSubtleHover,colorBorderInteractiveSelected:r.purpurColorBorderInteractiveSelected,colorBorderInteractivePrimaryNegative:r.purpurColorBorderInteractivePrimaryNegative,colorBorderInteractivePrimaryHoverNegative:r.purpurColorBorderInteractivePrimaryHoverNegative,colorBorderInteractivePrimaryActiveNegative:r.purpurColorBorderInteractivePrimaryActiveNegative,colorBorderInteractiveSubtleNegative:r.purpurColorBorderInteractiveSubtleNegative,colorBorderInteractiveSubtleHoverNegative:r.purpurColorBorderInteractiveSubtleHoverNegative,colorBorderStatusError:r.purpurColorBorderStatusError,colorBorderStatusWarning:r.purpurColorBorderStatusWarning,colorBorderStatusInfo:r.purpurColorBorderStatusInfo,colorBorderStatusSuccess:r.purpurColorBorderStatusSuccess,colorBorderStatusErrorNegative:r.purpurColorBorderStatusErrorNegative,colorBorderStatusSuccessNegative:r.purpurColorBorderStatusSuccessNegative},s={light:je,dark:Qe},qe=o=>o.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),C=({theme:o=s,cssVariablesSelector:e,currentColorScheme:u})=>{a.useEffect(()=>{u&&Object.entries(o?.[u]??s[u]).forEach(([i,l])=>{((e?document.querySelector(e):null)??document.documentElement).style.setProperty(`--purpur-${qe(i)}`,l)})},[o,e,u])},T=a.createContext({colorScheme:"light",currentColorScheme:"light",setColorScheme:()=>{},options:{},portalContainer:null}),$e=({cssVariablesSelector:o,forceColorScheme:e,theme:u,children:i,options:l={},...g})=>{const[c,p]=a.useState(e??"auto"),[n,v]=a.useState(e??"light"),[d,I]=a.useState(null);a.useEffect(()=>{if(e)p(e);else{const t=localStorage.getItem("colorScheme");t&&p(t)}},[e]),a.useEffect(()=>{const t=window.matchMedia("(prefers-color-scheme: dark)");v(c==="auto"?t.matches?"dark":"light":c);const B=x=>{!e&&c==="auto"&&v(x.matches?"dark":"light")};return t.addEventListener("change",B),()=>{t.removeEventListener("change",B)}},[c,e]),C({theme:u,cssVariablesSelector:o,currentColorScheme:u!==void 0?n:void 0});const k=a.useMemo(()=>({colorScheme:c,currentColorScheme:n,setColorScheme:t=>{e||(p(t),localStorage.setItem("colorScheme",t))},portalContainer:d}),[c,n,e,d]);return S.jsx(T.Provider,{value:{...k,options:l},children:S.jsx("div",{"data-color-scheme":n,className:n,ref:I,...g,children:i})})},ze=()=>{const o=a.useContext(T);if(!o)throw new Error("useTheme must be used within a ThemeProvider");return o};exports.ThemeProvider=$e;exports.teliaTheme=s;exports.useApplyTheme=C;exports.useTheme=ze;
2
+ //# sourceMappingURL=ThemeProvider-BGep6X_i.js.map