@purpur/library 10.1.0 → 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.
- package/CHANGELOG.json +57 -0
- package/CHANGELOG.md +26 -1
- package/dist/LICENSE.txt +14 -7
- package/dist/{RichText-B865Qkzj.js → RichText-CeYecUFV.js} +2 -2
- package/dist/{RichText-B865Qkzj.js.map → RichText-CeYecUFV.js.map} +1 -1
- package/dist/{RichText-CPkBwXNI.mjs → RichText-CwQfDo_S.mjs} +2 -2
- package/dist/{RichText-CPkBwXNI.mjs.map → RichText-CwQfDo_S.mjs.map} +1 -1
- package/dist/{ThemeProvider-BJGm3zai.js → ThemeProvider-BGep6X_i.js} +2 -2
- package/dist/{ThemeProvider-BJGm3zai.js.map → ThemeProvider-BGep6X_i.js.map} +1 -1
- package/dist/{ThemeProvider-BJ25_asg.mjs → ThemeProvider-BrAZhasG.mjs} +13 -13
- package/dist/{ThemeProvider-BJ25_asg.mjs.map → ThemeProvider-BrAZhasG.mjs.map} +1 -1
- package/dist/components/accordion/src/accordion-item.d.ts +3 -3
- package/dist/components/accordion/src/accordion.d.ts +1 -1
- package/dist/components/alert-badge/src/alert-badge.d.ts +1 -1
- package/dist/components/avatar/src/avatar.d.ts +1 -1
- package/dist/components/breadcrumbs/src/breadcrumbs.d.ts +1 -1
- package/dist/components/card/src/card-badge.d.ts +1 -1
- package/dist/components/card/src/card-content.d.ts +2 -2
- package/dist/components/card/src/card-cta.d.ts +2 -2
- package/dist/components/card/src/card-media-layout.d.ts +1 -1
- package/dist/components/card/src/card-root.d.ts +2 -2
- package/dist/components/comparison-table/src/components/OptionCard/option-card.d.ts +1 -1
- package/dist/components/container/src/container.d.ts +2 -2
- package/dist/components/container/src/container.visual.fixtures.d.ts +14 -0
- package/dist/components/container/src/container.visual.fixtures.d.ts.map +1 -0
- package/dist/components/content-block/src/content-block-group.d.ts +2 -2
- package/dist/components/content-block/src/content-block.d.ts +2 -2
- package/dist/components/countdown/src/countdown.d.ts +1 -1
- package/dist/components/countdown/src/countdown.d.ts.map +1 -1
- package/dist/components/countdown/src/countdown.types.d.ts +19 -3
- package/dist/components/countdown/src/countdown.types.d.ts.map +1 -1
- package/dist/components/counter-badge/src/counter-badge.d.ts +1 -1
- package/dist/components/cta-link/src/cta-link.d.ts +10 -10
- package/dist/components/date-field/src/date-field.d.ts +14 -6
- package/dist/components/date-field/src/date-field.d.ts.map +1 -1
- package/dist/components/date-field/src/utils.d.ts +40 -2
- package/dist/components/date-field/src/utils.d.ts.map +1 -1
- package/dist/components/date-picker/src/date-picker.d.ts +4 -4
- package/dist/components/date-range-field/src/date-range-field.d.ts +4 -2
- package/dist/components/date-range-field/src/date-range-field.d.ts.map +1 -1
- package/dist/components/dismissable-chip-group/src/dismissable-chip-group.d.ts +2 -2
- package/dist/components/drawer/src/drawer-container.d.ts +2 -2
- package/dist/components/drawer/src/drawer-scroll-area.d.ts +1 -1
- package/dist/components/drawer/src/drawer-trigger.d.ts +2 -2
- package/dist/components/drawer/src/drawer.d.ts +1 -1
- package/dist/components/dropdown/src/dropdown-combobox.d.ts.map +1 -1
- package/dist/components/dropdown/src/dropdown-shared.d.ts +3 -1
- package/dist/components/dropdown/src/dropdown-shared.d.ts.map +1 -1
- package/dist/components/dropdown/src/dropdown.types.d.ts +3 -0
- package/dist/components/dropdown/src/dropdown.types.d.ts.map +1 -1
- package/dist/components/dropdown/src/useDropdown.d.ts +1 -1
- package/dist/components/file-upload/src/file-upload-types.d.ts +1 -1
- package/dist/components/footer/src/footer-navigation.d.ts +2 -2
- package/dist/components/footer/src/footer-social-link.d.ts +3 -3
- package/dist/components/footer/src/footer.d.ts +1 -1
- package/dist/components/grid/src/grid.d.ts +1 -1
- package/dist/components/grid/src/grid.item.d.ts +1 -1
- package/dist/components/heading/src/heading.d.ts +1 -1
- package/dist/components/label/src/label.d.ts +1 -1
- package/dist/components/link/src/link.d.ts +1 -1
- package/dist/components/loading/src/loading-illustrative.d.ts +1 -1
- package/dist/components/logo/src/logo.types.d.ts +1 -1
- package/dist/components/modal/src/modal-content.d.ts +2 -2
- package/dist/components/modal/src/modal-trigger.d.ts +2 -2
- package/dist/components/notification/src/notification.d.ts +2 -2
- package/dist/components/pagination/src/pagination-page-selector.d.ts +1 -1
- package/dist/components/pagination/src/pagination-page-size-selector.d.ts +2 -2
- package/dist/components/pagination/src/pagination-pages.d.ts +1 -1
- package/dist/components/pagination/src/pagination-step-trigger.d.ts +1 -1
- package/dist/components/pagination/src/use-page-size-options.hook.d.ts +2 -2
- package/dist/components/password-field/src/password-field.d.ts +1 -1
- package/dist/components/password-field/src/password-strength-indicator.d.ts +2 -2
- package/dist/components/popover/src/popover-button.d.ts +2 -2
- package/dist/components/radio-card-group/src/radio-card-group.d.ts +2 -2
- package/dist/components/radio-card-group/src/radio-card-item.d.ts +1 -1
- package/dist/components/search-field/src/search-field-autocomplete.d.ts +7 -4
- package/dist/components/search-field/src/search-field-autocomplete.d.ts.map +1 -1
- package/dist/components/search-field/src/search-field-base.d.ts +4 -2
- package/dist/components/search-field/src/search-field-base.d.ts.map +1 -1
- package/dist/components/search-field/src/search-field.d.ts +6 -0
- package/dist/components/search-field/src/search-field.d.ts.map +1 -1
- package/dist/components/select/src/select.d.ts +2 -2
- package/dist/components/spacer/src/spacer.d.ts +1 -1
- package/dist/components/spinner/src/spinner.d.ts +1 -1
- package/dist/components/stepper/src/stepper-container.d.ts +1 -1
- package/dist/components/stepper/src/stepper-link.d.ts +1 -1
- package/dist/components/table/src/story-utils/table-data.d.ts +4 -4
- package/dist/components/table/src/test-utils/table-data.d.ts +3 -3
- package/dist/components/table/src/types.d.ts +3 -3
- package/dist/components/tabs/src/tab-content.d.ts +1 -1
- package/dist/components/text-area/src/text-area.d.ts +1 -1
- package/dist/components/text-spacing/src/text-spacing.d.ts +1 -1
- package/dist/components/toggle/src/toggle.d.ts +1 -1
- package/dist/components/tooltip/src/tooltip.d.ts +3 -3
- package/dist/components-metadata.js +1 -0
- package/dist/countdown-CdGFNLZq.js +2 -0
- package/dist/countdown-CdGFNLZq.js.map +1 -0
- package/dist/countdown-G7eg3CZj.mjs +188 -0
- package/dist/countdown-G7eg3CZj.mjs.map +1 -0
- package/dist/countdown.cjs.js +1 -1
- package/dist/countdown.es.js +1 -1
- package/dist/country-flag-icon/LICENSE.txt +0 -11
- package/dist/date-field-D8yGH1mw.js +2 -0
- package/dist/{date-field-CtpWDaSh.js.map → date-field-D8yGH1mw.js.map} +1 -1
- package/dist/{date-field-_rCuf15v.mjs → date-field-DVMPYoLT.mjs} +361 -311
- package/dist/{date-field-_rCuf15v.mjs.map → date-field-DVMPYoLT.mjs.map} +1 -1
- package/dist/date-field.cjs.js +1 -1
- package/dist/date-field.es.js +1 -1
- package/dist/{date-picker-sqcNAplg.mjs → date-picker-Ban9DLsx.mjs} +6 -6
- package/dist/{date-picker-sqcNAplg.mjs.map → date-picker-Ban9DLsx.mjs.map} +1 -1
- package/dist/{date-picker-BYlszX1W.js → date-picker-re3cPV_Z.js} +2 -2
- package/dist/{date-picker-BYlszX1W.js.map → date-picker-re3cPV_Z.js.map} +1 -1
- package/dist/date-picker.cjs.js +1 -1
- package/dist/date-picker.es.js +1 -1
- package/dist/date-range-field-8JmPw-Ei.js +2 -0
- package/dist/date-range-field-8JmPw-Ei.js.map +1 -0
- package/dist/{date-range-field-BmjQeiOv.mjs → date-range-field-dmJO66U_.mjs} +64 -61
- package/dist/date-range-field-dmJO66U_.mjs.map +1 -0
- package/dist/date-range-field.cjs.js +1 -1
- package/dist/date-range-field.es.js +1 -1
- package/dist/dismissable-chip-group-CVo3CS8K.js +2 -0
- package/dist/dismissable-chip-group-CVo3CS8K.js.map +1 -0
- package/dist/dismissable-chip-group-Dov2-9Fe.mjs +95 -0
- package/dist/dismissable-chip-group-Dov2-9Fe.mjs.map +1 -0
- package/dist/dismissable-chip-group.cjs.js +1 -1
- package/dist/dismissable-chip-group.es.js +1 -1
- package/dist/{drawer-oFJcxW58.js → drawer-CSagTJjN.js} +2 -2
- package/dist/{drawer-oFJcxW58.js.map → drawer-CSagTJjN.js.map} +1 -1
- package/dist/{drawer-Chx3H8EU.mjs → drawer-Cw-Y9XH9.mjs} +3 -3
- package/dist/{drawer-Chx3H8EU.mjs.map → drawer-Cw-Y9XH9.mjs.map} +1 -1
- package/dist/drawer.cjs.js +1 -1
- package/dist/drawer.es.js +1 -1
- package/dist/dropdown-BAM4nQhd.mjs +955 -0
- package/dist/dropdown-BAM4nQhd.mjs.map +1 -0
- package/dist/dropdown-Cr8DVw2T.js +2 -0
- package/dist/dropdown-Cr8DVw2T.js.map +1 -0
- package/dist/dropdown.cjs.js +1 -1
- package/dist/dropdown.es.js +1 -1
- package/dist/{file-upload-MvNuX4ks.js → file-upload-CdlYkCg8.js} +2 -2
- package/dist/{file-upload-MvNuX4ks.js.map → file-upload-CdlYkCg8.js.map} +1 -1
- package/dist/{file-upload-Ctw6LCTU.mjs → file-upload-ih5NqF67.mjs} +2 -2
- package/dist/{file-upload-Ctw6LCTU.mjs.map → file-upload-ih5NqF67.mjs.map} +1 -1
- package/dist/file-upload.cjs.js +1 -1
- package/dist/file-upload.es.js +1 -1
- package/dist/{footer-DkVmTd-f.mjs → footer-CVVt8hUE.mjs} +3 -3
- package/dist/{footer-DkVmTd-f.mjs.map → footer-CVVt8hUE.mjs.map} +1 -1
- package/dist/{footer-Bbemct3Z.js → footer-Cat9-v7l.js} +2 -2
- package/dist/{footer-Bbemct3Z.js.map → footer-Cat9-v7l.js.map} +1 -1
- package/dist/footer.cjs.js +1 -1
- package/dist/footer.es.js +1 -1
- package/dist/{hero-banner-Mag1OwL4.js → hero-banner-BNw3eNTs.js} +2 -2
- package/dist/{hero-banner-Mag1OwL4.js.map → hero-banner-BNw3eNTs.js.map} +1 -1
- package/dist/{hero-banner-ChDoFRhq.mjs → hero-banner-MnKuFSku.mjs} +2 -2
- package/dist/{hero-banner-ChDoFRhq.mjs.map → hero-banner-MnKuFSku.mjs.map} +1 -1
- package/dist/hero-banner.cjs.js +1 -1
- package/dist/hero-banner.es.js +1 -1
- package/dist/libraries/library/src/container.d.ts +1 -1
- package/dist/libraries/library/src/content-block.d.ts +1 -1
- package/dist/libraries/library/src/quantity-selector.d.ts +2 -2
- package/dist/libraries/theme/src/ThemeProvider.d.ts +1 -1
- package/dist/libraries/theme/src/theme-props.d.ts +1 -0
- package/dist/libraries/theme/src/theme-props.d.ts.map +1 -1
- package/dist/libraries/tokens/dist/color/variables.d.ts +1 -0
- package/dist/libraries/tokens/dist/color/variables.dark.d.ts +1 -0
- package/dist/library.cjs.js +1 -1
- package/dist/library.es.js +293 -292
- package/dist/{modal-CXOYUsJm.js → modal-BSN-wIcN.js} +2 -2
- package/dist/{modal-CXOYUsJm.js.map → modal-BSN-wIcN.js.map} +1 -1
- package/dist/{modal-Pwvhrzn-.mjs → modal-CnzUgU97.mjs} +3 -3
- package/dist/{modal-Pwvhrzn-.mjs.map → modal-CnzUgU97.mjs.map} +1 -1
- package/dist/modal.cjs.js +1 -1
- package/dist/modal.es.js +1 -1
- package/dist/{popover-B6ntmuEK.mjs → popover-B-oWzP-0.mjs} +3 -3
- package/dist/{popover-B6ntmuEK.mjs.map → popover-B-oWzP-0.mjs.map} +1 -1
- package/dist/{popover-DJHMEFXP.js → popover-BzoAQW0i.js} +2 -2
- package/dist/{popover-DJHMEFXP.js.map → popover-BzoAQW0i.js.map} +1 -1
- package/dist/popover.cjs.js +1 -1
- package/dist/popover.es.js +1 -1
- package/dist/{promotion-card-B3mz__m7.js → promotion-card-B8bnNVZ-.js} +2 -2
- package/dist/{promotion-card-B3mz__m7.js.map → promotion-card-B8bnNVZ-.js.map} +1 -1
- package/dist/{promotion-card-Co6qAkTZ.mjs → promotion-card-DwNbzSK3.mjs} +2 -2
- package/dist/{promotion-card-Co6qAkTZ.mjs.map → promotion-card-DwNbzSK3.mjs.map} +1 -1
- package/dist/promotion-card.cjs.js +1 -1
- package/dist/promotion-card.es.js +1 -1
- package/dist/purpur.css +1 -1
- package/dist/rich-text.cjs.js +1 -1
- package/dist/rich-text.es.js +1 -1
- package/dist/search-field-BR4gETPP.js +2 -0
- package/dist/search-field-BR4gETPP.js.map +1 -0
- package/dist/search-field-DyBcoB9g.mjs +186 -0
- package/dist/search-field-DyBcoB9g.mjs.map +1 -0
- package/dist/search-field.cjs.js +1 -1
- package/dist/search-field.es.js +1 -1
- package/dist/{stepper-D59T-Y2_.mjs → stepper-CGBjyjVw.mjs} +2 -2
- package/dist/{stepper-D59T-Y2_.mjs.map → stepper-CGBjyjVw.mjs.map} +1 -1
- package/dist/{stepper-Dao4XaDV.js → stepper-CbcFVE3v.js} +2 -2
- package/dist/{stepper-Dao4XaDV.js.map → stepper-CbcFVE3v.js.map} +1 -1
- package/dist/stepper.cjs.js +1 -1
- package/dist/stepper.es.js +1 -1
- package/dist/{table-BkXNxvjW.js → table-CFBK5Gv4.js} +3 -3
- package/dist/{table-BkXNxvjW.js.map → table-CFBK5Gv4.js.map} +1 -1
- package/dist/{table-CY8rjMoR.mjs → table-PdfWMFks.mjs} +8 -8
- package/dist/{table-CY8rjMoR.mjs.map → table-PdfWMFks.mjs.map} +1 -1
- package/dist/table.cjs.js +1 -1
- package/dist/table.es.js +1 -1
- package/dist/{text-area-9RUldq6W.js → text-area-AHqUSmEE.js} +2 -2
- package/dist/{text-area-9RUldq6W.js.map → text-area-AHqUSmEE.js.map} +1 -1
- package/dist/{text-area-C58aZEPa.mjs → text-area-DabB5eo_.mjs} +3 -3
- package/dist/{text-area-C58aZEPa.mjs.map → text-area-DabB5eo_.mjs.map} +1 -1
- package/dist/text-area.cjs.js +1 -1
- package/dist/text-area.es.js +1 -1
- package/dist/{text-spacing-BU0mkEf9.mjs → text-spacing-Bmkv_rmc.mjs} +3 -3
- package/dist/{text-spacing-BU0mkEf9.mjs.map → text-spacing-Bmkv_rmc.mjs.map} +1 -1
- package/dist/{text-spacing-CiGPZHuB.js → text-spacing-CdnbUO6z.js} +2 -2
- package/dist/{text-spacing-CiGPZHuB.js.map → text-spacing-CdnbUO6z.js.map} +1 -1
- package/dist/text-spacing.cjs.js +1 -1
- package/dist/text-spacing.es.js +1 -1
- package/dist/theme.cjs.js +1 -1
- package/dist/theme.es.js +3 -3
- package/dist/tokens/color/variables.css +1 -0
- package/dist/tokens/color/variables.d.ts +1 -0
- package/dist/tokens/color/variables.dark.css +1 -0
- package/dist/tokens/color/variables.dark.d.ts +1 -0
- package/dist/tokens/color/variables.dark.js +1 -0
- package/dist/tokens/color/variables.dark.json +1 -0
- package/dist/tokens/color/variables.dark.scss +1 -0
- package/dist/tokens/color/variables.js +1 -0
- package/dist/tokens/color/variables.json +1 -0
- package/dist/tokens/color/variables.scss +1 -0
- package/dist/tokens.cjs.js +1 -1
- package/dist/tokens.es.js +167 -166
- package/dist/{tooltip-DeP1UsPW.js → tooltip-DRW4N9Z-.js} +2 -2
- package/dist/{tooltip-DeP1UsPW.js.map → tooltip-DRW4N9Z-.js.map} +1 -1
- package/dist/{tooltip-bqdd2lJL.mjs → tooltip-DzY9olpb.mjs} +3 -3
- package/dist/{tooltip-bqdd2lJL.mjs.map → tooltip-DzY9olpb.mjs.map} +1 -1
- package/dist/tooltip.cjs.js +1 -1
- package/dist/tooltip.es.js +1 -1
- package/dist/use-autocomplete.es-CoAeiJiu.mjs +155 -0
- package/dist/use-autocomplete.es-CoAeiJiu.mjs.map +1 -0
- package/dist/use-autocomplete.es-Djt1u2i8.js +2 -0
- package/dist/use-autocomplete.es-Djt1u2i8.js.map +1 -0
- package/dist/useColorScheme-BtOgJUTy.js +2 -0
- package/dist/{useColorScheme-BHhPgv9q.js.map → useColorScheme-BtOgJUTy.js.map} +1 -1
- package/dist/{useColorScheme-B7lGBSe4.mjs → useColorScheme-DXAxJPXW.mjs} +2 -2
- package/dist/{useColorScheme-B7lGBSe4.mjs.map → useColorScheme-DXAxJPXW.mjs.map} +1 -1
- package/dist/useThemePortalContainer-Cs1c-2AI.js +2 -0
- package/dist/{useThemePortalContainer-CUcqV327.js.map → useThemePortalContainer-Cs1c-2AI.js.map} +1 -1
- package/dist/useThemePortalContainer-DeKoE-E_.mjs +9 -0
- package/dist/{useThemePortalContainer-D13Xx24N.mjs.map → useThemePortalContainer-DeKoE-E_.mjs.map} +1 -1
- package/dist/variables-CTBx79yI.js +2 -0
- package/dist/{variables-D1vNo1lO.js.map → variables-CTBx79yI.js.map} +1 -1
- package/dist/variables-Do6SfyT0.mjs +258 -0
- package/dist/{variables-BrsAsWIF.mjs.map → variables-Do6SfyT0.mjs.map} +1 -1
- package/package.json +18 -18
- package/src/library.ts +72 -2
- package/tokens/color/variables.css +1 -0
- package/tokens/color/variables.d.ts +1 -0
- package/tokens/color/variables.dark.css +1 -0
- package/tokens/color/variables.dark.d.ts +1 -0
- package/tokens/color/variables.dark.js +1 -0
- package/tokens/color/variables.dark.json +1 -0
- package/tokens/color/variables.dark.scss +1 -0
- package/tokens/color/variables.js +1 -0
- package/tokens/color/variables.json +1 -0
- package/tokens/color/variables.scss +1 -0
- package/dist/countdown-5Ni6OlVY.mjs +0 -189
- package/dist/countdown-5Ni6OlVY.mjs.map +0 -1
- package/dist/countdown-CGXJyzB2.js +0 -2
- package/dist/countdown-CGXJyzB2.js.map +0 -1
- package/dist/date-field-CtpWDaSh.js +0 -2
- package/dist/date-range-field-B33XeBW8.js +0 -2
- package/dist/date-range-field-B33XeBW8.js.map +0 -1
- package/dist/date-range-field-BmjQeiOv.mjs.map +0 -1
- package/dist/dismissable-chip-group-5ALErhD2.js +0 -2
- package/dist/dismissable-chip-group-5ALErhD2.js.map +0 -1
- package/dist/dismissable-chip-group-DMNU7g5e.mjs +0 -94
- package/dist/dismissable-chip-group-DMNU7g5e.mjs.map +0 -1
- package/dist/dropdown-DJr5COdU.mjs +0 -945
- package/dist/dropdown-DJr5COdU.mjs.map +0 -1
- package/dist/dropdown-s8FhNU5N.js +0 -2
- package/dist/dropdown-s8FhNU5N.js.map +0 -1
- package/dist/search-field-BTJtRyw5.mjs +0 -184
- package/dist/search-field-BTJtRyw5.mjs.map +0 -1
- package/dist/search-field-nzVXak1a.js +0 -2
- package/dist/search-field-nzVXak1a.js.map +0 -1
- package/dist/use-autocomplete.es-BwAzMcau.js +0 -2
- package/dist/use-autocomplete.es-BwAzMcau.js.map +0 -1
- package/dist/use-autocomplete.es-CKb0RHKG.mjs +0 -144
- package/dist/use-autocomplete.es-CKb0RHKG.mjs.map +0 -1
- package/dist/useColorScheme-BHhPgv9q.js +0 -2
- package/dist/useThemePortalContainer-CUcqV327.js +0 -2
- package/dist/useThemePortalContainer-D13Xx24N.mjs +0 -9
- package/dist/variables-BrsAsWIF.mjs +0 -257
- package/dist/variables-D1vNo1lO.js +0 -2
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"popover-B6ntmuEK.mjs","sources":["../../../components/popover/src/popover-flow.tsx","../../../components/popover/src/popover-internal-context.tsx","../../../components/popover/src/use-screen-size.hook.ts","../../../components/popover/src/popover-back.tsx","../../../components/popover/src/popover-button.tsx","../../../components/popover/src/popover-steps.tsx","../../../components/popover/src/popover-footer.tsx","../../../components/popover/src/popover-header.tsx","../../../components/popover/src/popover-next.tsx","../../../components/popover/src/popover-content.tsx","../../../components/popover/src/popover-standalone.tsx","../../../components/popover/src/use-smooth-scroll.ts","../../../components/popover/src/usePopoverTrigger.ts","../../../components/popover/src/popover-trigger.tsx","../../../components/popover/src/usePopoverWalkthrough.ts","../../../components/popover/src/popover-walkthrough.tsx","../../../components/popover/src/popover.tsx"],"sourcesContent":["import React, {\n createContext,\n type ReactNode,\n useCallback,\n useContext,\n useMemo,\n useState,\n} from \"react\";\n\ntype PopoverFlowContextType = {\n currentStep: number;\n totalSteps: number;\n next: () => void;\n back: () => void;\n dismiss: () => void;\n registerStep: (step: number) => void;\n unregisterStep: (step: number) => void;\n separatorText: string;\n stepText: string;\n backLabel: string;\n nextLabel: string;\n finishLabel: string;\n openDelay: number;\n};\n\nconst PopoverFlowContext = createContext<PopoverFlowContextType | null>(null);\n\nexport const usePopoverFlow = () => {\n const context = useContext(PopoverFlowContext);\n if (!context) {\n throw new Error(\"usePopoverFlow must be used within a PopoverFlow provider\");\n }\n return context;\n};\n\nexport const useOptionalPopoverFlow = (): PopoverFlowContextType | null => {\n return useContext(PopoverFlowContext);\n};\n\nexport type PopoverFlowProps = {\n /**\n * Child components, typically multiple Popover components with step numbers.\n */\n children: ReactNode;\n /**\n * The step number to show when the flow starts.\n * @default 1\n */\n initialStep?: number;\n /**\n * Callback fired when the user completes the last step of the flow.\n */\n onComplete?: () => void;\n /**\n * Callback fired when the user dismisses the flow before completing it.\n */\n onDismiss?: () => void;\n /**\n * Text used as separator in the step indicator (e.g., \"of\" in \"1 of 3\").\n */\n separatorText: string;\n /**\n * Text label for \"Step\" in the step indicator.\n */\n stepText: string;\n /**\n * Label for the back navigation button.\n */\n backLabel: string;\n /**\n * Label for the next navigation button.\n */\n nextLabel: string;\n /**\n * Label for the finish button on the last step.\n */\n finishLabel: string;\n /**\n * Delay in milliseconds before opening the next popover in the flow.\n * @default 0\n */\n openDelay?: number;\n};\n\nexport const PopoverFlow = ({\n children,\n initialStep = 1,\n onComplete,\n onDismiss,\n separatorText,\n stepText,\n backLabel,\n nextLabel,\n finishLabel,\n openDelay = 0,\n}: PopoverFlowProps) => {\n const [currentStep, setCurrentStep] = useState(initialStep);\n const [registeredSteps, setRegisteredSteps] = useState<Set<number>>(new Set());\n\n const registerStep = useCallback((step: number) => {\n setRegisteredSteps((prev) => {\n const next = new Set(prev);\n next.add(step);\n return next;\n });\n }, []);\n\n const unregisterStep = useCallback((step: number) => {\n setRegisteredSteps((prev) => {\n const next = new Set(prev);\n next.delete(step);\n return next;\n });\n }, []);\n\n const next = useCallback(() => {\n setCurrentStep((prev) => {\n const nextStep = prev + 1;\n if (nextStep > registeredSteps.size) {\n onComplete?.();\n return prev;\n }\n return nextStep;\n });\n }, [registeredSteps.size, onComplete]);\n\n const back = useCallback(() => {\n setCurrentStep((prev) => Math.max(1, prev - 1));\n }, []);\n\n const dismiss = useCallback(() => {\n setCurrentStep(0);\n onDismiss?.();\n }, [onDismiss]);\n\n const value = useMemo(\n () => ({\n currentStep,\n totalSteps: registeredSteps.size,\n next,\n back,\n dismiss,\n registerStep,\n unregisterStep,\n separatorText,\n stepText,\n backLabel,\n nextLabel,\n finishLabel,\n openDelay,\n }),\n [\n currentStep,\n registeredSteps.size,\n next,\n back,\n dismiss,\n registerStep,\n unregisterStep,\n separatorText,\n stepText,\n backLabel,\n nextLabel,\n finishLabel,\n openDelay,\n ]\n );\n\n return <PopoverFlowContext.Provider value={value}>{children}</PopoverFlowContext.Provider>;\n};\n","import { createContext, useContext } from \"react\";\n\nexport type PopoverInternalContextValue = {\n isOpen: boolean;\n walkthroughStep: number;\n onScrollComplete?: () => void;\n onScrollStart?: () => void;\n disableClickOutside?: boolean;\n};\n\nexport const PopoverInternalContext = createContext<PopoverInternalContextValue | null>(null);\n\nexport const usePopoverInternal = () => {\n const context = useContext(PopoverInternalContext);\n return context;\n};\n\n// Separate context for UI-specific props that are set at the Content level\nexport type PopoverNegativeContextValue = {\n negative: boolean;\n};\n\nexport const PopoverNegativeContext = createContext<PopoverNegativeContextValue>({ negative: false });\n\nexport const usePopoverNegative = () => {\n const context = useContext(PopoverNegativeContext);\n return context;\n};\n","import { useCallback, useEffect, useState } from \"react\";\nimport { purpurBreakpointMd } from \"@purpur/tokens\";\n\nconst DEBOUNCE_DELAY = 150;\n\nexport const SCREEN_MEDIA_QUERY = {\n MAX_MD: `(max-width: ${purpurBreakpointMd})`,\n} as const;\n\nexport const useScreenSize = () => {\n const maxMediumScreen = window.matchMedia(SCREEN_MEDIA_QUERY.MAX_MD);\n function updateSize() {\n setIsMdOrSmaller(maxMediumScreen.matches);\n }\n\n const [isMdOrSmaller, setIsMdOrSmaller] = useState(() => {\n if (typeof window === \"undefined\") return false;\n return window.matchMedia(SCREEN_MEDIA_QUERY.MAX_MD).matches;\n });\n\n const handleResize = useCallback(() => {\n let timeoutId: ReturnType<typeof setTimeout>;\n\n return () => {\n clearTimeout(timeoutId);\n timeoutId = setTimeout(() => updateSize(), DEBOUNCE_DELAY);\n };\n }, [updateSize]);\n\n useEffect(() => {\n if (typeof window === \"undefined\") return;\n\n window.addEventListener(\"resize\", handleResize);\n\n return () => window.removeEventListener(\"resize\", handleResize);\n }, [handleResize]);\n\n return { isMdOrSmaller };\n};\n","import React, { type ReactNode } from \"react\";\nimport { Button } from \"@purpur/button\";\n\nimport { usePopoverFlow } from \"./popover-flow\";\nimport { usePopoverNegative } from \"./popover-internal-context\";\nimport { useScreenSize } from \"./use-screen-size.hook\";\n\nexport const PopoverBack = ({\n children,\n onClick,\n}: {\n children: ReactNode;\n onClick?: () => void;\n}) => {\n const { back } = usePopoverFlow();\n const { negative: isNegative } = usePopoverNegative();\n const { isMdOrSmaller } = useScreenSize();\n\n // Invert negative: if popover is negative (light), buttons should be normal (dark)\n const negative = isNegative ? false : true;\n\n const handleClick = () => {\n onClick?.();\n back();\n };\n\n return (\n <Button\n size=\"sm\"\n variant=\"secondary\"\n onClick={handleClick}\n negative={negative}\n fullWidth={isMdOrSmaller}\n >\n {children}\n </Button>\n );\n};\n\nPopoverBack.displayName = \"PopoverBack\";\n","import React, { type ReactNode } from \"react\";\nimport { Button, type ButtonProps } from \"@purpur/button\";\nimport * as RadixPopover from \"@radix-ui/react-popover\";\n\nimport { useOptionalPopoverFlow } from \"./popover-flow\";\nimport { usePopoverNegative } from \"./popover-internal-context\";\nimport { useScreenSize } from \"./use-screen-size.hook\";\n\nexport type PopoverButtonProps = RadixPopover.PopoverCloseProps & {\n /**\n * Button label or content.\n */\n children: ReactNode;\n /**\n * Whether to use the child element as the button instead of wrapping in a Button component.\n * @default false\n */\n asChild?: boolean;\n /**\n * Click handler called when the button is clicked.\n */\n onClick?: () => void;\n /**\n * Visual variant of the button.\n * @default \"primary\"\n */\n variant?: ButtonProps[\"variant\"];\n /**\n * Whether clicking the button should dismiss/close the popover.\n * @default true\n */\n dismiss?: boolean;\n /**\n * Whether the button should take full width. If not specified, defaults to true on mobile (md or smaller).\n */\n fullWidth?: boolean;\n};\n\nexport const PopoverButton = ({\n children,\n asChild,\n onClick,\n variant = \"primary\",\n dismiss = true,\n fullWidth,\n}: PopoverButtonProps) => {\n const flow = useOptionalPopoverFlow();\n const { isMdOrSmaller } = useScreenSize();\n const { negative: isNegative } = usePopoverNegative();\n // Invert negative: if popover is negative (light), buttons should be normal (dark)\n const negative = isNegative ? false : true;\n\n const handleClick = () => {\n onClick?.();\n if (dismiss) {\n flow?.dismiss();\n }\n };\n\n const isFullWidth = fullWidth ?? isMdOrSmaller;\n\n const content = asChild ? (\n children\n ) : (\n <Button\n variant={variant}\n size=\"sm\"\n fullWidth={isFullWidth}\n negative={negative}\n onClick={handleClick}\n >\n {children}\n </Button>\n );\n\n // Always wrap with RadixPopover.Close for proper dismiss behavior\n if (dismiss) {\n return <RadixPopover.Close asChild>{content}</RadixPopover.Close>;\n }\n\n return content;\n};\n\nPopoverButton.displayName = \"PopoverButton\";\n","import React from \"react\";\nimport { Paragraph } from \"@purpur/paragraph\";\nimport c from \"classnames/bind\";\n\nimport styles from \"./popover.module.scss\";\nimport { usePopoverFlow } from \"./popover-flow\";\nimport { usePopoverInternal } from \"./popover-internal-context\";\n\nconst cx = c.bind(styles);\n\nexport const PopoverSteps = () => {\n const flow = usePopoverFlow();\n const context = usePopoverInternal();\n\n // Use walkthroughStep from context (each popover knows its own step number)\n const currentStep = context?.walkthroughStep || flow.currentStep;\n const { totalSteps, separatorText, stepText } = flow;\n return (\n <>\n <Paragraph\n className={cx(\"purpur-popover__steps\")}\n role=\"status\"\n aria-live=\"polite\"\n aria-atomic=\"true\"\n >\n {stepText} {currentStep} {separatorText} {totalSteps}\n </Paragraph>\n </>\n );\n};\n\nPopoverSteps.displayName = \"PopoverSteps\";\n","import React, { type ReactNode } from \"react\";\nimport c from \"classnames/bind\";\n\nimport styles from \"./popover.module.scss\";\nimport { useOptionalPopoverFlow } from \"./popover-flow\";\nimport { usePopoverInternal } from \"./popover-internal-context\";\nimport { PopoverSteps } from \"./popover-steps\";\n\nconst cx = c.bind(styles);\n\nexport type PopoverFooterProps = {\n /**\n * Footer content, typically navigation buttons like PopoverButton, PopoverNext, or PopoverBack.\n */\n children: ReactNode;\n /**\n * Optional CSS class name for custom styling.\n */\n className?: string;\n};\n\nexport const PopoverFooter = ({ children, className }: PopoverFooterProps) => {\n const flow = useOptionalPopoverFlow();\n const internal = usePopoverInternal();\n\n // Only show steps if we have a flow context AND this popover is part of the flow (walkthroughStep > 0)\n const showSteps = flow && internal && internal.walkthroughStep > 0;\n\n return (\n <div className={cx(\"purpur-popover__footer\", className)}>\n {showSteps && <PopoverSteps />}\n <div className={cx(\"purpur-popover__footer-button-group\")}>{children}</div>\n </div>\n );\n};\n\nPopoverFooter.displayName = \"PopoverFooter\";\n","import React, { forwardRef, type ReactNode } from \"react\";\nimport { Heading } from \"@purpur/heading\";\nimport c from \"classnames/bind\";\n\nimport styles from \"./popover.module.scss\";\n\nconst cx = c.bind(styles);\n\nexport type PopoverHeaderProps = {\n title: string;\n icon?: ReactNode;\n};\n\nexport const PopoverHeader = forwardRef<HTMLDivElement, PopoverHeaderProps>(\n ({ title, icon }, ref) => {\n return (\n <div ref={ref} className={cx(\"purpur-popover__header-content\")}>\n {icon && <span className={cx(\"purpur-popover__icon\")}>{icon}</span>}\n <Heading\n tag=\"h2\"\n variant=\"title-100\"\n className={cx(\"purpur-popover__title\")}\n id=\"popover-heading\"\n >\n {title}\n </Heading>\n </div>\n );\n }\n);\n\nPopoverHeader.displayName = \"PopoverHeader\";\n","import React, { type ReactNode } from \"react\";\nimport { Button } from \"@purpur/button\";\n\nimport { usePopoverFlow } from \"./popover-flow\";\nimport { usePopoverNegative } from \"./popover-internal-context\";\nimport { useScreenSize } from \"./use-screen-size.hook\";\n\nexport const PopoverNext = ({\n children,\n onClick,\n}: {\n children: ReactNode;\n onClick?: () => void;\n}) => {\n const { next } = usePopoverFlow();\n const { negative: isNegative } = usePopoverNegative();\n const { isMdOrSmaller } = useScreenSize();\n\n // Invert negative: if popover is negative (light), buttons should be normal (dark)\n const negative = isNegative ? false : true;\n\n const handleClick = () => {\n onClick?.();\n next();\n };\n\n return (\n <Button\n size=\"sm\"\n variant=\"primary\"\n onClick={handleClick}\n negative={negative}\n fullWidth={isMdOrSmaller}\n >\n {children}\n </Button>\n );\n};\n\nPopoverNext.displayName = \"PopoverNext\";\n","import React, { forwardRef, type ReactNode, useRef } from \"react\";\nimport { Button } from \"@purpur/button\";\nimport { IconClose } from \"@purpur/icon/close\";\nimport { Paragraph } from \"@purpur/paragraph\";\nimport { useThemePortalContainer } from \"@purpur/theme\";\nimport * as RadixPopover from \"@radix-ui/react-popover\";\nimport c from \"classnames/bind\";\n\nimport styles from \"./popover.module.scss\";\nimport { PopoverBack } from \"./popover-back\";\nimport { PopoverButton } from \"./popover-button\";\nimport { useOptionalPopoverFlow } from \"./popover-flow\";\nimport { PopoverFooter } from \"./popover-footer\";\nimport { PopoverHeader } from \"./popover-header\";\nimport { PopoverNegativeContext, usePopoverInternal } from \"./popover-internal-context\";\nimport { PopoverNext } from \"./popover-next\";\n\nconst cx = c.bind(styles);\n\nexport type PopoverAction = {\n type: \"next\" | \"back\" | \"finish\" | \"dismiss\";\n step?: number;\n};\n\nexport type PopoverContentProps = RadixPopover.PopoverContentProps & {\n /**\n * Position of the arrow/beak pointing to the trigger element.\n * Set to \"none\" to hide the arrow.\n * @default \"down\"\n */\n beakPosition?: \"up\" | \"right\" | \"down\" | \"left\" | \"none\";\n /**\n * Whether to use negative (light) styling for the popover content.\n * @default false\n */\n negative?: boolean;\n /**\n * Accessible label for the close button icon.\n */\n closeIconAriaLabel: string;\n /**\n * Main title text displayed in the popover header.\n */\n title: string;\n /**\n * Optional icon displayed in the popover header next to the title.\n */\n icon?: ReactNode;\n /**\n * Main body text content of the popover.\n */\n body: string;\n /**\n * Custom footer content. If not provided and used within PopoverFlow,\n * default navigation buttons will be rendered.\n */\n children?: ReactNode;\n /**\n * Callback fired when user interacts with navigation buttons (next, back, finish, dismiss).\n */\n onAction?: (action: PopoverAction) => void;\n /**\n * CSS z-index value for the popover content.\n * @default 210\n */\n zIndex?: number;\n /**\n * Optional DOM element to portal the popover content into. When omitted,\n * the popover renders inside the nearest `ThemeProvider` so it inherits\n * the active color scheme. Pass `document.body` (or any other element) to\n * override. Pass `null` to fall back to Radix' default (`document.body`).\n */\n container?: HTMLElement | null;\n};\n\nexport const PopoverContent = forwardRef<HTMLDivElement, PopoverContentProps>(\n (\n {\n children,\n className,\n beakPosition = \"down\",\n align = \"center\",\n alignOffset = 0,\n sideOffset = 5, // How close or far the popover is from the trigger\n negative = false,\n closeIconAriaLabel,\n title,\n icon,\n body,\n onAction,\n zIndex = 210,\n container,\n ...props\n },\n ref\n ) => {\n const flow = useOptionalPopoverFlow();\n const context = usePopoverInternal();\n const headerRef = useRef<HTMLDivElement>(null);\n const isFlowDismissRef = useRef(false);\n const themePortalContainer = useThemePortalContainer();\n const portalContainer = container === undefined ? themePortalContainer : container ?? undefined;\n\n // Map beakPosition to Radix side values\n const beakPositionMap: Record<\n \"up\" | \"right\" | \"down\" | \"left\" | \"none\",\n \"bottom\" | \"left\" | \"top\" | \"right\"\n > = {\n up: \"bottom\",\n right: \"left\",\n down: \"top\",\n left: \"right\",\n none: \"bottom\", // Default position when no arrow\n };\n\n const radixSide = beakPositionMap[beakPosition];\n const shouldShowArrow = beakPosition !== \"none\";\n\n const getFocusableElements = (container: HTMLElement): HTMLElement[] => {\n const focusableSelector =\n \"button:not([disabled]), [href], input:not([disabled]), select:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex='-1'])\";\n\n return Array.from(container.querySelectorAll<HTMLElement>(focusableSelector)).filter(\n (element) => !element.hasAttribute(\"aria-hidden\")\n );\n };\n\n const focusOutsidePopover = (\n contentElement: HTMLElement,\n activeElement: HTMLElement,\n direction: \"next\" | \"previous\"\n ) => {\n const allFocusableElements = getFocusableElements(document.body);\n const activeIndex = allFocusableElements.indexOf(activeElement);\n\n if (activeIndex === -1) {\n return;\n }\n\n const step = direction === \"next\" ? 1 : -1;\n\n for (\n let currentIndex = activeIndex + step;\n currentIndex >= 0 && currentIndex < allFocusableElements.length;\n currentIndex += step\n ) {\n const candidate = allFocusableElements[currentIndex];\n\n if (!contentElement.contains(candidate)) {\n candidate.focus();\n return;\n }\n }\n };\n\n let footerContent = children;\n\n if (flow && !children) {\n // Use walkthroughStep from context (0 for standalone, actual step for walkthrough)\n const currentStep = context?.walkthroughStep || flow.currentStep;\n const isFirstStep = currentStep === 1;\n const isLastStep = currentStep === flow.totalSteps;\n\n footerContent = (\n <PopoverFooter>\n {!isFirstStep && (\n <PopoverBack onClick={() => onAction?.({ type: \"back\", step: currentStep })}>\n {flow.backLabel}\n </PopoverBack>\n )}\n {isLastStep ? (\n <PopoverButton\n onClick={() => onAction?.({ type: \"finish\", step: currentStep })}\n dismiss\n >\n {flow.finishLabel}\n </PopoverButton>\n ) : (\n <PopoverNext onClick={() => onAction?.({ type: \"next\", step: currentStep })}>\n {flow.nextLabel}\n </PopoverNext>\n )}\n </PopoverFooter>\n );\n }\n\n const handleOpenAutoFocus = (event: Event) => {\n event.preventDefault();\n\n const contentElement = event.currentTarget as HTMLElement;\n const headingElement = headerRef.current?.querySelector(\n \"#popover-heading\"\n ) as HTMLElement | null;\n\n // In walkthrough mode, focus contextual content first so AT users hear title/body before actions.\n setTimeout(() => {\n if (flow && headingElement) {\n headingElement.setAttribute(\"tabindex\", \"-1\");\n headingElement.focus();\n return;\n }\n\n // Fallback for standalone and missing heading.\n contentElement.setAttribute(\"tabindex\", \"-1\");\n contentElement.focus();\n }, 0);\n\n props.onOpenAutoFocus?.(event);\n };\n\n const handleKeyDown = (event: React.KeyboardEvent<HTMLDivElement>) => {\n if (event.key !== \"Tab\") {\n props.onKeyDown?.(event);\n return;\n }\n\n const contentElement = event.currentTarget;\n const focusableElements = getFocusableElements(contentElement);\n\n if (focusableElements.length === 0) {\n props.onKeyDown?.(event);\n return;\n }\n\n const firstFocusable = focusableElements[0];\n const lastFocusable = focusableElements[focusableElements.length - 1];\n const activeElement = document.activeElement as HTMLElement | null;\n\n const isOnFirstFocusable = activeElement === firstFocusable;\n const isOnLastFocusable = activeElement === lastFocusable;\n const isOnNonTabbableContext =\n activeElement !== null &&\n contentElement.contains(activeElement) &&\n activeElement.tabIndex === -1;\n\n if (!flow) {\n if (activeElement !== null) {\n if (event.shiftKey && isOnFirstFocusable) {\n event.preventDefault();\n focusOutsidePopover(contentElement, activeElement, \"previous\");\n } else if (!event.shiftKey && isOnLastFocusable) {\n event.preventDefault();\n focusOutsidePopover(contentElement, activeElement, \"next\");\n }\n }\n\n props.onKeyDown?.(event);\n return;\n }\n\n if (event.shiftKey && (isOnFirstFocusable || isOnNonTabbableContext)) {\n event.preventDefault();\n lastFocusable.focus();\n } else if (!event.shiftKey && (isOnLastFocusable || isOnNonTabbableContext)) {\n event.preventDefault();\n firstFocusable.focus();\n }\n\n props.onKeyDown?.(event);\n };\n\n const handleCloseAutoFocus = (event: Event) => {\n // Prevent focus from returning to trigger in walkthrough flow\n // This allows the next popover to manage focus properly\n if (flow && !isFlowDismissRef.current) {\n event.preventDefault();\n }\n\n if (isFlowDismissRef.current) {\n isFlowDismissRef.current = false;\n }\n\n props.onCloseAutoFocus?.(event);\n };\n\n const handleClose = (event: React.MouseEvent) => {\n if (flow) {\n isFlowDismissRef.current = true;\n event.preventDefault();\n }\n\n onAction?.({ type: \"dismiss\", step: flow?.currentStep });\n flow?.dismiss();\n };\n\n const handleEscapeKey = (event: KeyboardEvent) => {\n if (flow) {\n isFlowDismissRef.current = true;\n event.preventDefault();\n }\n\n onAction?.({ type: \"dismiss\", step: flow?.currentStep });\n flow?.dismiss();\n };\n\n const handleInteractOutside = (event: Event) => {\n if (context?.disableClickOutside) {\n event.preventDefault();\n return;\n }\n\n if (flow) {\n const target = event.target as HTMLElement;\n const isPopoverInteraction =\n target.closest(\"[role='dialog']\") ||\n target.closest(\".purpur-popover__trigger\") ||\n target.closest(\"button[aria-haspopup='dialog']\");\n\n if (!isPopoverInteraction) {\n onAction?.({ type: \"dismiss\", step: flow.currentStep });\n setTimeout(() => {\n flow.dismiss();\n }, 0);\n }\n }\n };\n\n return (\n <RadixPopover.Portal container={portalContainer}>\n <RadixPopover.Content\n data-testid=\"popover-content\"\n role=\"dialog\"\n aria-modal=\"true\"\n aria-labelledby={props[\"aria-label\"] ? undefined : \"popover-heading\"}\n ref={ref}\n side={radixSide}\n sideOffset={sideOffset}\n align={align}\n alignOffset={alignOffset}\n style={\n {\n \"--popover-z-index\": zIndex,\n } as React.CSSProperties\n }\n className={cx(\n \"purpur-popover__content\",\n { \"purpur-popover__content--negative\": negative },\n className\n )}\n onOpenAutoFocus={handleOpenAutoFocus}\n onCloseAutoFocus={handleCloseAutoFocus}\n onKeyDown={handleKeyDown}\n onEscapeKeyDown={handleEscapeKey}\n onInteractOutside={handleInteractOutside}\n {...props}\n >\n <PopoverNegativeContext.Provider value={{ negative }}>\n <div className={cx(\"purpur-popover__inner\")}>\n <PopoverHeader ref={headerRef} title={title} icon={icon} />\n <Paragraph className={cx(\"purpur-popover__body\")}>{body}</Paragraph>\n </div>\n {footerContent}\n\n <RadixPopover.Close asChild onClick={handleClose}>\n <Button\n variant=\"text\"\n size=\"sm\"\n aria-label={closeIconAriaLabel}\n className={cx(\"purpur-popover__close\")}\n negative={!negative}\n iconOnly\n >\n <IconClose size=\"xs\" className={cx(\"purpur-popover__icon\")} />\n </Button>\n </RadixPopover.Close>\n </PopoverNegativeContext.Provider>\n {shouldShowArrow && (\n <RadixPopover.Arrow\n className={cx(\"purpur-popover__arrow\")}\n aria-hidden=\"true\"\n tabIndex={-1}\n />\n )}\n </RadixPopover.Content>\n </RadixPopover.Portal>\n );\n }\n);\n\nPopoverContent.displayName = \"PopoverContent\";\n","import React, { type ReactNode, useState } from \"react\";\nimport * as RadixPopover from \"@radix-ui/react-popover\";\n\nimport { PopoverInternalContext } from \"./popover-internal-context\";\n\nexport type PopoverStandaloneProps = RadixPopover.PopoverProps & {\n children: ReactNode;\n className?: string;\n disableClickOutside?: boolean;\n};\n\nexport const PopoverStandalone = ({\n children,\n open: controlledOpen,\n defaultOpen = false,\n onOpenChange,\n disableClickOutside,\n ...props\n}: PopoverStandaloneProps) => {\n // Internal state for uncontrolled mode\n const [internalOpen, setInternalOpen] = useState(defaultOpen);\n\n const isControlled = controlledOpen !== undefined;\n const isOpen = isControlled ? controlledOpen : internalOpen;\n\n const handleOpenChange = (newOpen: boolean) => {\n if (!isControlled) {\n setInternalOpen(newOpen);\n }\n onOpenChange?.(newOpen);\n };\n\n return (\n <RadixPopover.Root open={isOpen} onOpenChange={handleOpenChange} {...props}>\n <PopoverInternalContext.Provider\n value={{\n isOpen,\n walkthroughStep: 0,\n disableClickOutside,\n }}\n >\n {children}\n </PopoverInternalContext.Provider>\n </RadixPopover.Root>\n );\n};\n\nPopoverStandalone.displayName = \"PopoverStandalone\";\n","import { useCallback, useRef } from \"react\";\n\nexport const useSmoothScroll = (onComplete?: () => void) => {\n const scrollAnimationId = useRef<number | null>(null);\n\n const cancelScroll = useCallback(() => {\n if (scrollAnimationId.current) {\n cancelAnimationFrame(scrollAnimationId.current);\n scrollAnimationId.current = null;\n }\n }, []);\n\n const scrollToElement = useCallback(\n (element: HTMLElement, duration: number = 600) => {\n const prefersReducedMotion = window.matchMedia(\"(prefers-reduced-motion: reduce)\").matches;\n const rect = element.getBoundingClientRect();\n const absoluteTop = rect.top + window.pageYOffset;\n const elementHeight = rect.height;\n const viewportHeight = window.innerHeight;\n\n let targetY = absoluteTop - viewportHeight / 2 + elementHeight / 2;\n const documentHeight = document.documentElement.scrollHeight;\n const maxScroll = Math.max(0, documentHeight - viewportHeight);\n targetY = Math.max(0, Math.min(targetY, maxScroll));\n\n if (prefersReducedMotion) {\n window.scrollTo(0, targetY);\n onComplete?.();\n return;\n }\n\n const startY = window.pageYOffset;\n const distance = targetY - startY;\n const startTime = performance.now();\n\n const animateScroll = (currentTime: number) => {\n const elapsed = currentTime - startTime;\n const progress = Math.min(elapsed / duration, 1);\n\n const easeInOut =\n progress < 0.5 ? 2 * progress * progress : 1 - Math.pow(-2 * progress + 2, 2) / 2;\n\n const currentY = startY + distance * easeInOut;\n window.scrollTo(0, currentY);\n\n if (progress < 1) {\n scrollAnimationId.current = requestAnimationFrame(animateScroll);\n } else {\n scrollAnimationId.current = null;\n onComplete?.();\n }\n };\n\n cancelScroll();\n\n scrollAnimationId.current = requestAnimationFrame(animateScroll);\n },\n [onComplete, cancelScroll]\n );\n\n return { scrollToElement, cancelScroll };\n};\n","import { useEffect, useRef } from \"react\";\n\nimport { useOptionalPopoverFlow } from \"./popover-flow\";\nimport { usePopoverInternal } from \"./popover-internal-context\";\nimport { useSmoothScroll } from \"./use-smooth-scroll\";\n\nexport function usePopoverTrigger(ref: React.Ref<HTMLButtonElement>) {\n const triggerRef = useRef<HTMLButtonElement>(null);\n const context = usePopoverInternal();\n const flow = useOptionalPopoverFlow();\n const hasScrolled = useRef(false);\n const { scrollToElement, cancelScroll } = useSmoothScroll(context?.onScrollComplete);\n\n // Forward ref\n useEffect(() => {\n if (typeof ref === \"function\") {\n ref(triggerRef.current);\n } else if (ref) {\n (ref as React.MutableRefObject<HTMLButtonElement | null>).current = triggerRef.current;\n }\n }, [ref]);\n\n // Walkthrough scroll logic\n useEffect(() => {\n const isActiveStep =\n flow &&\n context?.walkthroughStep !== undefined &&\n flow.currentStep === context.walkthroughStep &&\n triggerRef.current &&\n !hasScrolled.current;\n\n if (isActiveStep) {\n const element = triggerRef.current!;\n const rect = element.getBoundingClientRect();\n const buffer = 100;\n const isVisible =\n rect.top >= -buffer &&\n rect.bottom <= window.innerHeight + buffer &&\n rect.left >= -buffer &&\n rect.right <= window.innerWidth + buffer;\n\n if (isVisible) {\n context?.onScrollComplete?.();\n } else {\n context?.onScrollStart?.();\n scrollToElement(element);\n }\n hasScrolled.current = true;\n } else if (flow?.currentStep !== context?.walkthroughStep) {\n hasScrolled.current = false;\n cancelScroll();\n }\n }, [flow?.currentStep, context?.walkthroughStep, flow, scrollToElement, cancelScroll, context]);\n\n // Radix Popover trigger applies aria-expanded by default; remove it to keep dialog trigger semantics.\n // Fixes expanded state in item \"The popover trigger button has an incorrect accessible name and communicates an inappropriate expanding state.\"\n useEffect(() => {\n if (triggerRef.current) {\n triggerRef.current.removeAttribute(\"aria-expanded\");\n }\n }, [context?.isOpen]);\n\n // Cancel scroll on unmount\n useEffect(() => cancelScroll, [cancelScroll]);\n\n return { triggerRef, context };\n}\n","import React, { forwardRef } from \"react\";\nimport * as RadixPopover from \"@radix-ui/react-popover\";\nimport c from \"classnames/bind\";\n\nimport styles from \"./popover.module.scss\";\nimport { usePopoverTrigger } from \"./usePopoverTrigger\";\n\nconst cx = c.bind(styles);\n\nexport type PopoverTriggerProps = RadixPopover.PopoverTriggerProps & {\n /**\n * Whether to show visual highlight effect around the trigger when popover is open.\n * @default true\n */\n highlight?: boolean;\n /**\n * Whether to use negative (light) styling for the highlight effect.\n * @default false\n */\n negative?: boolean;\n};\n\nexport const PopoverTrigger = forwardRef<HTMLButtonElement, PopoverTriggerProps>(\n ({ children, className, highlight = true, negative = false, ...props }, ref) => {\n const { triggerRef, context } = usePopoverTrigger(ref);\n\n return (\n <div\n className={cx(\n \"purpur-popover__trigger\",\n { \"purpur-popover__trigger--highlight\": context?.isOpen && highlight },\n className\n )}\n >\n {context?.isOpen && highlight && (\n <>\n {/* State 1: Outer glow effect */}\n <div\n className={cx(\n \"purpur-popover__trigger-highlight\",\n \"purpur-popover__trigger-highlight--state1\",\n { \"purpur-popover__trigger-highlight--negative\": negative }\n )}\n aria-hidden=\"true\"\n />\n {/* State 2: Inner border only */}\n <div\n className={cx(\n \"purpur-popover__trigger-highlight\",\n \"purpur-popover__trigger-highlight--state2\",\n { \"purpur-popover__trigger-highlight--negative\": negative }\n )}\n aria-hidden=\"true\"\n />\n </>\n )}\n <RadixPopover.Trigger\n ref={triggerRef}\n asChild\n aria-haspopup=\"dialog\"\n {...props}\n >\n {children}\n </RadixPopover.Trigger>\n </div>\n );\n }\n);\n\nPopoverTrigger.displayName = \"PopoverTrigger\";\n","import { useCallback, useEffect, useRef, useState } from \"react\";\n\nimport { useOptionalPopoverFlow } from \"./popover-flow\";\n\nexport function usePopoverWalkthrough(step: number) {\n const flow = useOptionalPopoverFlow();\n const [actuallyOpen, setActuallyOpen] = useState(false);\n const [waitingForScroll, setWaitingForScroll] = useState(false);\n const timeoutRef = useRef<number | null>(null);\n const openedAtRef = useRef<number>(0);\n\n useEffect(() => {\n if (flow) {\n flow.registerStep(step);\n return () => flow.unregisterStep(step);\n }\n return () => {};\n }, [flow, step]);\n\n const shouldBeOpen = flow?.currentStep === step;\n\n const onScrollStart = useCallback(() => {\n setWaitingForScroll(true);\n }, []);\n\n const onScrollComplete = useCallback(() => {\n setWaitingForScroll(false);\n if (shouldBeOpen) {\n const delay = flow.openDelay;\n timeoutRef.current = window.setTimeout(() => {\n setActuallyOpen(true);\n openedAtRef.current = Date.now();\n }, delay);\n }\n }, [shouldBeOpen, flow]);\n\n useEffect(() => {\n if (timeoutRef.current) {\n clearTimeout(timeoutRef.current);\n timeoutRef.current = null;\n }\n\n if (shouldBeOpen) {\n if (!waitingForScroll) {\n const delay = flow.openDelay;\n timeoutRef.current = window.setTimeout(() => {\n setActuallyOpen(true);\n openedAtRef.current = Date.now();\n }, delay);\n }\n } else {\n setActuallyOpen(false);\n setWaitingForScroll(false);\n openedAtRef.current = 0;\n }\n\n return () => {\n if (timeoutRef.current) {\n clearTimeout(timeoutRef.current);\n timeoutRef.current = null;\n }\n };\n }, [shouldBeOpen, waitingForScroll, flow]);\n\n const handleOpenChange = useCallback(\n (open: boolean, consumerOnOpenChange?: (open: boolean) => void) => {\n consumerOnOpenChange?.(open);\n if (!open && actuallyOpen && flow && flow.currentStep === step) {\n const timeSinceOpen = Date.now() - openedAtRef.current;\n if (timeSinceOpen < 10 || timeoutRef.current !== null) {\n return;\n }\n flow.dismiss();\n }\n },\n [actuallyOpen, flow, step]\n );\n\n return {\n actuallyOpen,\n onScrollStart,\n onScrollComplete,\n handleOpenChange,\n };\n}\n","import React, { type ReactNode } from \"react\";\nimport * as RadixPopover from \"@radix-ui/react-popover\";\n\nimport { PopoverInternalContext } from \"./popover-internal-context\";\nimport { usePopoverWalkthrough } from \"./usePopoverWalkthrough\";\n\nexport type PopoverWalkthroughProps = RadixPopover.PopoverProps & {\n children: ReactNode;\n step: number;\n className?: string;\n disableClickOutside?: boolean;\n};\n\nexport const PopoverWalkthrough = ({\n children,\n step,\n onOpenChange: consumerOnOpenChange,\n disableClickOutside = true,\n ...props\n}: PopoverWalkthroughProps) => {\n const { actuallyOpen, onScrollStart, onScrollComplete, handleOpenChange } =\n usePopoverWalkthrough(step);\n\n return (\n <RadixPopover.Root\n modal={true}\n open={actuallyOpen}\n onOpenChange={(open) => handleOpenChange(open, consumerOnOpenChange)}\n {...props}\n >\n <PopoverInternalContext.Provider\n value={{\n isOpen: actuallyOpen,\n walkthroughStep: step,\n onScrollStart,\n onScrollComplete,\n disableClickOutside,\n }}\n >\n {children}\n </PopoverInternalContext.Provider>\n </RadixPopover.Root>\n );\n};\n\nPopoverWalkthrough.displayName = \"PopoverWalkthrough\";\n","import React, { type ReactNode } from \"react\";\nimport type * as RadixPopover from \"@radix-ui/react-popover\";\n\nimport { PopoverBack } from \"./popover-back\";\nimport { PopoverButton } from \"./popover-button\";\nimport { type PopoverAction,PopoverContent } from \"./popover-content\";\nimport { PopoverFlow } from \"./popover-flow\";\nimport { PopoverFooter } from \"./popover-footer\";\nimport { PopoverNext } from \"./popover-next\";\nimport { PopoverStandalone } from \"./popover-standalone\";\nimport { PopoverTrigger } from \"./popover-trigger\";\nimport { PopoverWalkthrough } from \"./popover-walkthrough\";\n\nexport type { PopoverAction };\n\n// Base props shared by both variants\ntype BasePopoverProps = RadixPopover.PopoverProps & {\n children: ReactNode;\n className?: string;\n};\n\n// Standalone variant props\ntype StandalonePopoverProps = BasePopoverProps & {\n multistep?: false;\n step?: never;\n disableClickOutside?: boolean;\n};\n\n// Walkthrough variant props\ntype WalkthroughPopoverProps = BasePopoverProps & {\n multistep: true;\n step: number;\n disableClickOutside?: boolean;\n};\n\nexport type PopoverProps = StandalonePopoverProps | WalkthroughPopoverProps;\n\ntype PopoverCmp<P> = React.FunctionComponent<P> & {\n Back: typeof PopoverBack;\n Button: typeof PopoverButton;\n Content: typeof PopoverContent;\n Flow: typeof PopoverFlow;\n Footer: typeof PopoverFooter;\n Next: typeof PopoverNext;\n Trigger: typeof PopoverTrigger;\n};\n\nexport const Popover: PopoverCmp<PopoverProps> = (props) => {\n const { multistep = false, disableClickOutside, ...restProps } = props;\n\n if (multistep) {\n return (\n <PopoverWalkthrough\n {...(restProps as WalkthroughPopoverProps)}\n disableClickOutside={disableClickOutside ?? true}\n />\n );\n }\n\n return (\n <PopoverStandalone\n {...(restProps as StandalonePopoverProps)}\n disableClickOutside={disableClickOutside}\n />\n );\n};\n\nPopover.Back = PopoverBack;\nPopover.Button = PopoverButton;\nPopover.Content = PopoverContent;\nPopover.Flow = PopoverFlow;\nPopover.Footer = PopoverFooter;\nPopover.Next = PopoverNext;\nPopover.Trigger = PopoverTrigger;\n\nPopover.displayName = \"Popover\";\n"],"names":["PopoverFlowContext","createContext","usePopoverFlow","context","useContext","useOptionalPopoverFlow","PopoverFlow","children","initialStep","onComplete","onDismiss","separatorText","stepText","backLabel","nextLabel","finishLabel","openDelay","currentStep","setCurrentStep","useState","registeredSteps","setRegisteredSteps","registerStep","useCallback","step","prev","next","unregisterStep","nextStep","back","dismiss","value","useMemo","jsx","PopoverInternalContext","usePopoverInternal","PopoverNegativeContext","usePopoverNegative","DEBOUNCE_DELAY","SCREEN_MEDIA_QUERY","purpurBreakpointMd","useScreenSize","maxMediumScreen","updateSize","setIsMdOrSmaller","isMdOrSmaller","handleResize","timeoutId","useEffect","PopoverBack","onClick","isNegative","Button","PopoverButton","asChild","variant","fullWidth","flow","content","RadixPopover.Close","cx","c","styles","PopoverSteps","totalSteps","Fragment","jsxs","Paragraph","PopoverFooter","className","internal","showSteps","PopoverHeader","forwardRef","title","icon","ref","Heading","PopoverNext","PopoverContent","beakPosition","align","alignOffset","sideOffset","negative","closeIconAriaLabel","body","onAction","zIndex","container","props","headerRef","useRef","isFlowDismissRef","themePortalContainer","useThemePortalContainer","portalContainer","radixSide","shouldShowArrow","getFocusableElements","element","focusOutsidePopover","contentElement","activeElement","direction","allFocusableElements","activeIndex","currentIndex","candidate","footerContent","isFirstStep","isLastStep","handleOpenAutoFocus","event","headingElement","handleKeyDown","focusableElements","firstFocusable","lastFocusable","isOnFirstFocusable","isOnLastFocusable","isOnNonTabbableContext","handleCloseAutoFocus","handleClose","handleEscapeKey","handleInteractOutside","target","RadixPopover.Portal","RadixPopover.Content","IconClose","RadixPopover.Arrow","PopoverStandalone","controlledOpen","defaultOpen","onOpenChange","disableClickOutside","internalOpen","setInternalOpen","isControlled","isOpen","RadixPopover.Root","newOpen","useSmoothScroll","scrollAnimationId","cancelScroll","duration","prefersReducedMotion","rect","absoluteTop","elementHeight","viewportHeight","targetY","documentHeight","maxScroll","startY","distance","startTime","animateScroll","currentTime","elapsed","progress","easeInOut","currentY","usePopoverTrigger","triggerRef","hasScrolled","scrollToElement","buffer","PopoverTrigger","highlight","RadixPopover.Trigger","usePopoverWalkthrough","actuallyOpen","setActuallyOpen","waitingForScroll","setWaitingForScroll","timeoutRef","openedAtRef","shouldBeOpen","onScrollStart","onScrollComplete","delay","handleOpenChange","open","consumerOnOpenChange","PopoverWalkthrough","Popover","multistep","restProps"],"mappings":";;;;;;;;;;;AAyBA,MAAMA,IAAqBC,EAA6C,IAAI,GAE/DC,IAAiB,MAAM;AAClC,QAAMC,IAAUC,EAAWJ,CAAkB;AAC7C,MAAI,CAACG;AACH,UAAM,IAAI,MAAM,2DAA2D;AAE7E,SAAOA;AACT,GAEaE,IAAyB,MAC7BD,EAAWJ,CAAkB,GAgDzB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file":"popover-B-oWzP-0.mjs","sources":["../../../components/popover/src/popover-flow.tsx","../../../components/popover/src/popover-internal-context.tsx","../../../components/popover/src/use-screen-size.hook.ts","../../../components/popover/src/popover-back.tsx","../../../components/popover/src/popover-button.tsx","../../../components/popover/src/popover-steps.tsx","../../../components/popover/src/popover-footer.tsx","../../../components/popover/src/popover-header.tsx","../../../components/popover/src/popover-next.tsx","../../../components/popover/src/popover-content.tsx","../../../components/popover/src/popover-standalone.tsx","../../../components/popover/src/use-smooth-scroll.ts","../../../components/popover/src/usePopoverTrigger.ts","../../../components/popover/src/popover-trigger.tsx","../../../components/popover/src/usePopoverWalkthrough.ts","../../../components/popover/src/popover-walkthrough.tsx","../../../components/popover/src/popover.tsx"],"sourcesContent":["import React, {\n createContext,\n type ReactNode,\n useCallback,\n useContext,\n useMemo,\n useState,\n} from \"react\";\n\ntype PopoverFlowContextType = {\n currentStep: number;\n totalSteps: number;\n next: () => void;\n back: () => void;\n dismiss: () => void;\n registerStep: (step: number) => void;\n unregisterStep: (step: number) => void;\n separatorText: string;\n stepText: string;\n backLabel: string;\n nextLabel: string;\n finishLabel: string;\n openDelay: number;\n};\n\nconst PopoverFlowContext = createContext<PopoverFlowContextType | null>(null);\n\nexport const usePopoverFlow = () => {\n const context = useContext(PopoverFlowContext);\n if (!context) {\n throw new Error(\"usePopoverFlow must be used within a PopoverFlow provider\");\n }\n return context;\n};\n\nexport const useOptionalPopoverFlow = (): PopoverFlowContextType | null => {\n return useContext(PopoverFlowContext);\n};\n\nexport type PopoverFlowProps = {\n /**\n * Child components, typically multiple Popover components with step numbers.\n */\n children: ReactNode;\n /**\n * The step number to show when the flow starts.\n * @default 1\n */\n initialStep?: number;\n /**\n * Callback fired when the user completes the last step of the flow.\n */\n onComplete?: () => void;\n /**\n * Callback fired when the user dismisses the flow before completing it.\n */\n onDismiss?: () => void;\n /**\n * Text used as separator in the step indicator (e.g., \"of\" in \"1 of 3\").\n */\n separatorText: string;\n /**\n * Text label for \"Step\" in the step indicator.\n */\n stepText: string;\n /**\n * Label for the back navigation button.\n */\n backLabel: string;\n /**\n * Label for the next navigation button.\n */\n nextLabel: string;\n /**\n * Label for the finish button on the last step.\n */\n finishLabel: string;\n /**\n * Delay in milliseconds before opening the next popover in the flow.\n * @default 0\n */\n openDelay?: number;\n};\n\nexport const PopoverFlow = ({\n children,\n initialStep = 1,\n onComplete,\n onDismiss,\n separatorText,\n stepText,\n backLabel,\n nextLabel,\n finishLabel,\n openDelay = 0,\n}: PopoverFlowProps) => {\n const [currentStep, setCurrentStep] = useState(initialStep);\n const [registeredSteps, setRegisteredSteps] = useState<Set<number>>(new Set());\n\n const registerStep = useCallback((step: number) => {\n setRegisteredSteps((prev) => {\n const next = new Set(prev);\n next.add(step);\n return next;\n });\n }, []);\n\n const unregisterStep = useCallback((step: number) => {\n setRegisteredSteps((prev) => {\n const next = new Set(prev);\n next.delete(step);\n return next;\n });\n }, []);\n\n const next = useCallback(() => {\n setCurrentStep((prev) => {\n const nextStep = prev + 1;\n if (nextStep > registeredSteps.size) {\n onComplete?.();\n return prev;\n }\n return nextStep;\n });\n }, [registeredSteps.size, onComplete]);\n\n const back = useCallback(() => {\n setCurrentStep((prev) => Math.max(1, prev - 1));\n }, []);\n\n const dismiss = useCallback(() => {\n setCurrentStep(0);\n onDismiss?.();\n }, [onDismiss]);\n\n const value = useMemo(\n () => ({\n currentStep,\n totalSteps: registeredSteps.size,\n next,\n back,\n dismiss,\n registerStep,\n unregisterStep,\n separatorText,\n stepText,\n backLabel,\n nextLabel,\n finishLabel,\n openDelay,\n }),\n [\n currentStep,\n registeredSteps.size,\n next,\n back,\n dismiss,\n registerStep,\n unregisterStep,\n separatorText,\n stepText,\n backLabel,\n nextLabel,\n finishLabel,\n openDelay,\n ]\n );\n\n return <PopoverFlowContext.Provider value={value}>{children}</PopoverFlowContext.Provider>;\n};\n","import { createContext, useContext } from \"react\";\n\nexport type PopoverInternalContextValue = {\n isOpen: boolean;\n walkthroughStep: number;\n onScrollComplete?: () => void;\n onScrollStart?: () => void;\n disableClickOutside?: boolean;\n};\n\nexport const PopoverInternalContext = createContext<PopoverInternalContextValue | null>(null);\n\nexport const usePopoverInternal = () => {\n const context = useContext(PopoverInternalContext);\n return context;\n};\n\n// Separate context for UI-specific props that are set at the Content level\nexport type PopoverNegativeContextValue = {\n negative: boolean;\n};\n\nexport const PopoverNegativeContext = createContext<PopoverNegativeContextValue>({ negative: false });\n\nexport const usePopoverNegative = () => {\n const context = useContext(PopoverNegativeContext);\n return context;\n};\n","import { useCallback, useEffect, useState } from \"react\";\nimport { purpurBreakpointMd } from \"@purpur/tokens\";\n\nconst DEBOUNCE_DELAY = 150;\n\nexport const SCREEN_MEDIA_QUERY = {\n MAX_MD: `(max-width: ${purpurBreakpointMd})`,\n} as const;\n\nexport const useScreenSize = () => {\n const maxMediumScreen = window.matchMedia(SCREEN_MEDIA_QUERY.MAX_MD);\n function updateSize() {\n setIsMdOrSmaller(maxMediumScreen.matches);\n }\n\n const [isMdOrSmaller, setIsMdOrSmaller] = useState(() => {\n if (typeof window === \"undefined\") return false;\n return window.matchMedia(SCREEN_MEDIA_QUERY.MAX_MD).matches;\n });\n\n const handleResize = useCallback(() => {\n let timeoutId: ReturnType<typeof setTimeout>;\n\n return () => {\n clearTimeout(timeoutId);\n timeoutId = setTimeout(() => updateSize(), DEBOUNCE_DELAY);\n };\n }, [updateSize]);\n\n useEffect(() => {\n if (typeof window === \"undefined\") return;\n\n window.addEventListener(\"resize\", handleResize);\n\n return () => window.removeEventListener(\"resize\", handleResize);\n }, [handleResize]);\n\n return { isMdOrSmaller };\n};\n","import React, { type ReactNode } from \"react\";\nimport { Button } from \"@purpur/button\";\n\nimport { usePopoverFlow } from \"./popover-flow\";\nimport { usePopoverNegative } from \"./popover-internal-context\";\nimport { useScreenSize } from \"./use-screen-size.hook\";\n\nexport const PopoverBack = ({\n children,\n onClick,\n}: {\n children: ReactNode;\n onClick?: () => void;\n}) => {\n const { back } = usePopoverFlow();\n const { negative: isNegative } = usePopoverNegative();\n const { isMdOrSmaller } = useScreenSize();\n\n // Invert negative: if popover is negative (light), buttons should be normal (dark)\n const negative = isNegative ? false : true;\n\n const handleClick = () => {\n onClick?.();\n back();\n };\n\n return (\n <Button\n size=\"sm\"\n variant=\"secondary\"\n onClick={handleClick}\n negative={negative}\n fullWidth={isMdOrSmaller}\n >\n {children}\n </Button>\n );\n};\n\nPopoverBack.displayName = \"PopoverBack\";\n","import React, { type ReactNode } from \"react\";\nimport { Button, type ButtonProps } from \"@purpur/button\";\nimport * as RadixPopover from \"@radix-ui/react-popover\";\n\nimport { useOptionalPopoverFlow } from \"./popover-flow\";\nimport { usePopoverNegative } from \"./popover-internal-context\";\nimport { useScreenSize } from \"./use-screen-size.hook\";\n\nexport type PopoverButtonProps = RadixPopover.PopoverCloseProps & {\n /**\n * Button label or content.\n */\n children: ReactNode;\n /**\n * Whether to use the child element as the button instead of wrapping in a Button component.\n * @default false\n */\n asChild?: boolean;\n /**\n * Click handler called when the button is clicked.\n */\n onClick?: () => void;\n /**\n * Visual variant of the button.\n * @default \"primary\"\n */\n variant?: ButtonProps[\"variant\"];\n /**\n * Whether clicking the button should dismiss/close the popover.\n * @default true\n */\n dismiss?: boolean;\n /**\n * Whether the button should take full width. If not specified, defaults to true on mobile (md or smaller).\n */\n fullWidth?: boolean;\n};\n\nexport const PopoverButton = ({\n children,\n asChild,\n onClick,\n variant = \"primary\",\n dismiss = true,\n fullWidth,\n}: PopoverButtonProps) => {\n const flow = useOptionalPopoverFlow();\n const { isMdOrSmaller } = useScreenSize();\n const { negative: isNegative } = usePopoverNegative();\n // Invert negative: if popover is negative (light), buttons should be normal (dark)\n const negative = isNegative ? false : true;\n\n const handleClick = () => {\n onClick?.();\n if (dismiss) {\n flow?.dismiss();\n }\n };\n\n const isFullWidth = fullWidth ?? isMdOrSmaller;\n\n const content = asChild ? (\n children\n ) : (\n <Button\n variant={variant}\n size=\"sm\"\n fullWidth={isFullWidth}\n negative={negative}\n onClick={handleClick}\n >\n {children}\n </Button>\n );\n\n // Always wrap with RadixPopover.Close for proper dismiss behavior\n if (dismiss) {\n return <RadixPopover.Close asChild>{content}</RadixPopover.Close>;\n }\n\n return content;\n};\n\nPopoverButton.displayName = \"PopoverButton\";\n","import React from \"react\";\nimport { Paragraph } from \"@purpur/paragraph\";\nimport c from \"classnames/bind\";\n\nimport styles from \"./popover.module.scss\";\nimport { usePopoverFlow } from \"./popover-flow\";\nimport { usePopoverInternal } from \"./popover-internal-context\";\n\nconst cx = c.bind(styles);\n\nexport const PopoverSteps = () => {\n const flow = usePopoverFlow();\n const context = usePopoverInternal();\n\n // Use walkthroughStep from context (each popover knows its own step number)\n const currentStep = context?.walkthroughStep || flow.currentStep;\n const { totalSteps, separatorText, stepText } = flow;\n return (\n <>\n <Paragraph\n className={cx(\"purpur-popover__steps\")}\n role=\"status\"\n aria-live=\"polite\"\n aria-atomic=\"true\"\n >\n {stepText} {currentStep} {separatorText} {totalSteps}\n </Paragraph>\n </>\n );\n};\n\nPopoverSteps.displayName = \"PopoverSteps\";\n","import React, { type ReactNode } from \"react\";\nimport c from \"classnames/bind\";\n\nimport styles from \"./popover.module.scss\";\nimport { useOptionalPopoverFlow } from \"./popover-flow\";\nimport { usePopoverInternal } from \"./popover-internal-context\";\nimport { PopoverSteps } from \"./popover-steps\";\n\nconst cx = c.bind(styles);\n\nexport type PopoverFooterProps = {\n /**\n * Footer content, typically navigation buttons like PopoverButton, PopoverNext, or PopoverBack.\n */\n children: ReactNode;\n /**\n * Optional CSS class name for custom styling.\n */\n className?: string;\n};\n\nexport const PopoverFooter = ({ children, className }: PopoverFooterProps) => {\n const flow = useOptionalPopoverFlow();\n const internal = usePopoverInternal();\n\n // Only show steps if we have a flow context AND this popover is part of the flow (walkthroughStep > 0)\n const showSteps = flow && internal && internal.walkthroughStep > 0;\n\n return (\n <div className={cx(\"purpur-popover__footer\", className)}>\n {showSteps && <PopoverSteps />}\n <div className={cx(\"purpur-popover__footer-button-group\")}>{children}</div>\n </div>\n );\n};\n\nPopoverFooter.displayName = \"PopoverFooter\";\n","import React, { forwardRef, type ReactNode } from \"react\";\nimport { Heading } from \"@purpur/heading\";\nimport c from \"classnames/bind\";\n\nimport styles from \"./popover.module.scss\";\n\nconst cx = c.bind(styles);\n\nexport type PopoverHeaderProps = {\n title: string;\n icon?: ReactNode;\n};\n\nexport const PopoverHeader = forwardRef<HTMLDivElement, PopoverHeaderProps>(\n ({ title, icon }, ref) => {\n return (\n <div ref={ref} className={cx(\"purpur-popover__header-content\")}>\n {icon && <span className={cx(\"purpur-popover__icon\")}>{icon}</span>}\n <Heading\n tag=\"h2\"\n variant=\"title-100\"\n className={cx(\"purpur-popover__title\")}\n id=\"popover-heading\"\n >\n {title}\n </Heading>\n </div>\n );\n }\n);\n\nPopoverHeader.displayName = \"PopoverHeader\";\n","import React, { type ReactNode } from \"react\";\nimport { Button } from \"@purpur/button\";\n\nimport { usePopoverFlow } from \"./popover-flow\";\nimport { usePopoverNegative } from \"./popover-internal-context\";\nimport { useScreenSize } from \"./use-screen-size.hook\";\n\nexport const PopoverNext = ({\n children,\n onClick,\n}: {\n children: ReactNode;\n onClick?: () => void;\n}) => {\n const { next } = usePopoverFlow();\n const { negative: isNegative } = usePopoverNegative();\n const { isMdOrSmaller } = useScreenSize();\n\n // Invert negative: if popover is negative (light), buttons should be normal (dark)\n const negative = isNegative ? false : true;\n\n const handleClick = () => {\n onClick?.();\n next();\n };\n\n return (\n <Button\n size=\"sm\"\n variant=\"primary\"\n onClick={handleClick}\n negative={negative}\n fullWidth={isMdOrSmaller}\n >\n {children}\n </Button>\n );\n};\n\nPopoverNext.displayName = \"PopoverNext\";\n","import React, { forwardRef, type ReactNode, useRef } from \"react\";\nimport { Button } from \"@purpur/button\";\nimport { IconClose } from \"@purpur/icon/close\";\nimport { Paragraph } from \"@purpur/paragraph\";\nimport { useThemePortalContainer } from \"@purpur/theme\";\nimport * as RadixPopover from \"@radix-ui/react-popover\";\nimport c from \"classnames/bind\";\n\nimport styles from \"./popover.module.scss\";\nimport { PopoverBack } from \"./popover-back\";\nimport { PopoverButton } from \"./popover-button\";\nimport { useOptionalPopoverFlow } from \"./popover-flow\";\nimport { PopoverFooter } from \"./popover-footer\";\nimport { PopoverHeader } from \"./popover-header\";\nimport { PopoverNegativeContext, usePopoverInternal } from \"./popover-internal-context\";\nimport { PopoverNext } from \"./popover-next\";\n\nconst cx = c.bind(styles);\n\nexport type PopoverAction = {\n type: \"next\" | \"back\" | \"finish\" | \"dismiss\";\n step?: number;\n};\n\nexport type PopoverContentProps = RadixPopover.PopoverContentProps & {\n /**\n * Position of the arrow/beak pointing to the trigger element.\n * Set to \"none\" to hide the arrow.\n * @default \"down\"\n */\n beakPosition?: \"up\" | \"right\" | \"down\" | \"left\" | \"none\";\n /**\n * Whether to use negative (light) styling for the popover content.\n * @default false\n */\n negative?: boolean;\n /**\n * Accessible label for the close button icon.\n */\n closeIconAriaLabel: string;\n /**\n * Main title text displayed in the popover header.\n */\n title: string;\n /**\n * Optional icon displayed in the popover header next to the title.\n */\n icon?: ReactNode;\n /**\n * Main body text content of the popover.\n */\n body: string;\n /**\n * Custom footer content. If not provided and used within PopoverFlow,\n * default navigation buttons will be rendered.\n */\n children?: ReactNode;\n /**\n * Callback fired when user interacts with navigation buttons (next, back, finish, dismiss).\n */\n onAction?: (action: PopoverAction) => void;\n /**\n * CSS z-index value for the popover content.\n * @default 210\n */\n zIndex?: number;\n /**\n * Optional DOM element to portal the popover content into. When omitted,\n * the popover renders inside the nearest `ThemeProvider` so it inherits\n * the active color scheme. Pass `document.body` (or any other element) to\n * override. Pass `null` to fall back to Radix' default (`document.body`).\n */\n container?: HTMLElement | null;\n};\n\nexport const PopoverContent = forwardRef<HTMLDivElement, PopoverContentProps>(\n (\n {\n children,\n className,\n beakPosition = \"down\",\n align = \"center\",\n alignOffset = 0,\n sideOffset = 5, // How close or far the popover is from the trigger\n negative = false,\n closeIconAriaLabel,\n title,\n icon,\n body,\n onAction,\n zIndex = 210,\n container,\n ...props\n },\n ref\n ) => {\n const flow = useOptionalPopoverFlow();\n const context = usePopoverInternal();\n const headerRef = useRef<HTMLDivElement>(null);\n const isFlowDismissRef = useRef(false);\n const themePortalContainer = useThemePortalContainer();\n const portalContainer = container === undefined ? themePortalContainer : container ?? undefined;\n\n // Map beakPosition to Radix side values\n const beakPositionMap: Record<\n \"up\" | \"right\" | \"down\" | \"left\" | \"none\",\n \"bottom\" | \"left\" | \"top\" | \"right\"\n > = {\n up: \"bottom\",\n right: \"left\",\n down: \"top\",\n left: \"right\",\n none: \"bottom\", // Default position when no arrow\n };\n\n const radixSide = beakPositionMap[beakPosition];\n const shouldShowArrow = beakPosition !== \"none\";\n\n const getFocusableElements = (container: HTMLElement): HTMLElement[] => {\n const focusableSelector =\n \"button:not([disabled]), [href], input:not([disabled]), select:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex='-1'])\";\n\n return Array.from(container.querySelectorAll<HTMLElement>(focusableSelector)).filter(\n (element) => !element.hasAttribute(\"aria-hidden\")\n );\n };\n\n const focusOutsidePopover = (\n contentElement: HTMLElement,\n activeElement: HTMLElement,\n direction: \"next\" | \"previous\"\n ) => {\n const allFocusableElements = getFocusableElements(document.body);\n const activeIndex = allFocusableElements.indexOf(activeElement);\n\n if (activeIndex === -1) {\n return;\n }\n\n const step = direction === \"next\" ? 1 : -1;\n\n for (\n let currentIndex = activeIndex + step;\n currentIndex >= 0 && currentIndex < allFocusableElements.length;\n currentIndex += step\n ) {\n const candidate = allFocusableElements[currentIndex];\n\n if (!contentElement.contains(candidate)) {\n candidate.focus();\n return;\n }\n }\n };\n\n let footerContent = children;\n\n if (flow && !children) {\n // Use walkthroughStep from context (0 for standalone, actual step for walkthrough)\n const currentStep = context?.walkthroughStep || flow.currentStep;\n const isFirstStep = currentStep === 1;\n const isLastStep = currentStep === flow.totalSteps;\n\n footerContent = (\n <PopoverFooter>\n {!isFirstStep && (\n <PopoverBack onClick={() => onAction?.({ type: \"back\", step: currentStep })}>\n {flow.backLabel}\n </PopoverBack>\n )}\n {isLastStep ? (\n <PopoverButton\n onClick={() => onAction?.({ type: \"finish\", step: currentStep })}\n dismiss\n >\n {flow.finishLabel}\n </PopoverButton>\n ) : (\n <PopoverNext onClick={() => onAction?.({ type: \"next\", step: currentStep })}>\n {flow.nextLabel}\n </PopoverNext>\n )}\n </PopoverFooter>\n );\n }\n\n const handleOpenAutoFocus = (event: Event) => {\n event.preventDefault();\n\n const contentElement = event.currentTarget as HTMLElement;\n const headingElement = headerRef.current?.querySelector(\n \"#popover-heading\"\n ) as HTMLElement | null;\n\n // In walkthrough mode, focus contextual content first so AT users hear title/body before actions.\n setTimeout(() => {\n if (flow && headingElement) {\n headingElement.setAttribute(\"tabindex\", \"-1\");\n headingElement.focus();\n return;\n }\n\n // Fallback for standalone and missing heading.\n contentElement.setAttribute(\"tabindex\", \"-1\");\n contentElement.focus();\n }, 0);\n\n props.onOpenAutoFocus?.(event);\n };\n\n const handleKeyDown = (event: React.KeyboardEvent<HTMLDivElement>) => {\n if (event.key !== \"Tab\") {\n props.onKeyDown?.(event);\n return;\n }\n\n const contentElement = event.currentTarget;\n const focusableElements = getFocusableElements(contentElement);\n\n if (focusableElements.length === 0) {\n props.onKeyDown?.(event);\n return;\n }\n\n const firstFocusable = focusableElements[0];\n const lastFocusable = focusableElements[focusableElements.length - 1];\n const activeElement = document.activeElement as HTMLElement | null;\n\n const isOnFirstFocusable = activeElement === firstFocusable;\n const isOnLastFocusable = activeElement === lastFocusable;\n const isOnNonTabbableContext =\n activeElement !== null &&\n contentElement.contains(activeElement) &&\n activeElement.tabIndex === -1;\n\n if (!flow) {\n if (activeElement !== null) {\n if (event.shiftKey && isOnFirstFocusable) {\n event.preventDefault();\n focusOutsidePopover(contentElement, activeElement, \"previous\");\n } else if (!event.shiftKey && isOnLastFocusable) {\n event.preventDefault();\n focusOutsidePopover(contentElement, activeElement, \"next\");\n }\n }\n\n props.onKeyDown?.(event);\n return;\n }\n\n if (event.shiftKey && (isOnFirstFocusable || isOnNonTabbableContext)) {\n event.preventDefault();\n lastFocusable.focus();\n } else if (!event.shiftKey && (isOnLastFocusable || isOnNonTabbableContext)) {\n event.preventDefault();\n firstFocusable.focus();\n }\n\n props.onKeyDown?.(event);\n };\n\n const handleCloseAutoFocus = (event: Event) => {\n // Prevent focus from returning to trigger in walkthrough flow\n // This allows the next popover to manage focus properly\n if (flow && !isFlowDismissRef.current) {\n event.preventDefault();\n }\n\n if (isFlowDismissRef.current) {\n isFlowDismissRef.current = false;\n }\n\n props.onCloseAutoFocus?.(event);\n };\n\n const handleClose = (event: React.MouseEvent) => {\n if (flow) {\n isFlowDismissRef.current = true;\n event.preventDefault();\n }\n\n onAction?.({ type: \"dismiss\", step: flow?.currentStep });\n flow?.dismiss();\n };\n\n const handleEscapeKey = (event: KeyboardEvent) => {\n if (flow) {\n isFlowDismissRef.current = true;\n event.preventDefault();\n }\n\n onAction?.({ type: \"dismiss\", step: flow?.currentStep });\n flow?.dismiss();\n };\n\n const handleInteractOutside = (event: Event) => {\n if (context?.disableClickOutside) {\n event.preventDefault();\n return;\n }\n\n if (flow) {\n const target = event.target as HTMLElement;\n const isPopoverInteraction =\n target.closest(\"[role='dialog']\") ||\n target.closest(\".purpur-popover__trigger\") ||\n target.closest(\"button[aria-haspopup='dialog']\");\n\n if (!isPopoverInteraction) {\n onAction?.({ type: \"dismiss\", step: flow.currentStep });\n setTimeout(() => {\n flow.dismiss();\n }, 0);\n }\n }\n };\n\n return (\n <RadixPopover.Portal container={portalContainer}>\n <RadixPopover.Content\n data-testid=\"popover-content\"\n role=\"dialog\"\n aria-modal=\"true\"\n aria-labelledby={props[\"aria-label\"] ? undefined : \"popover-heading\"}\n ref={ref}\n side={radixSide}\n sideOffset={sideOffset}\n align={align}\n alignOffset={alignOffset}\n style={\n {\n \"--popover-z-index\": zIndex,\n } as React.CSSProperties\n }\n className={cx(\n \"purpur-popover__content\",\n { \"purpur-popover__content--negative\": negative },\n className\n )}\n onOpenAutoFocus={handleOpenAutoFocus}\n onCloseAutoFocus={handleCloseAutoFocus}\n onKeyDown={handleKeyDown}\n onEscapeKeyDown={handleEscapeKey}\n onInteractOutside={handleInteractOutside}\n {...props}\n >\n <PopoverNegativeContext.Provider value={{ negative }}>\n <div className={cx(\"purpur-popover__inner\")}>\n <PopoverHeader ref={headerRef} title={title} icon={icon} />\n <Paragraph className={cx(\"purpur-popover__body\")}>{body}</Paragraph>\n </div>\n {footerContent}\n\n <RadixPopover.Close asChild onClick={handleClose}>\n <Button\n variant=\"text\"\n size=\"sm\"\n aria-label={closeIconAriaLabel}\n className={cx(\"purpur-popover__close\")}\n negative={!negative}\n iconOnly\n >\n <IconClose size=\"xs\" className={cx(\"purpur-popover__icon\")} />\n </Button>\n </RadixPopover.Close>\n </PopoverNegativeContext.Provider>\n {shouldShowArrow && (\n <RadixPopover.Arrow\n className={cx(\"purpur-popover__arrow\")}\n aria-hidden=\"true\"\n tabIndex={-1}\n />\n )}\n </RadixPopover.Content>\n </RadixPopover.Portal>\n );\n }\n);\n\nPopoverContent.displayName = \"PopoverContent\";\n","import React, { type ReactNode, useState } from \"react\";\nimport * as RadixPopover from \"@radix-ui/react-popover\";\n\nimport { PopoverInternalContext } from \"./popover-internal-context\";\n\nexport type PopoverStandaloneProps = RadixPopover.PopoverProps & {\n children: ReactNode;\n className?: string;\n disableClickOutside?: boolean;\n};\n\nexport const PopoverStandalone = ({\n children,\n open: controlledOpen,\n defaultOpen = false,\n onOpenChange,\n disableClickOutside,\n ...props\n}: PopoverStandaloneProps) => {\n // Internal state for uncontrolled mode\n const [internalOpen, setInternalOpen] = useState(defaultOpen);\n\n const isControlled = controlledOpen !== undefined;\n const isOpen = isControlled ? controlledOpen : internalOpen;\n\n const handleOpenChange = (newOpen: boolean) => {\n if (!isControlled) {\n setInternalOpen(newOpen);\n }\n onOpenChange?.(newOpen);\n };\n\n return (\n <RadixPopover.Root open={isOpen} onOpenChange={handleOpenChange} {...props}>\n <PopoverInternalContext.Provider\n value={{\n isOpen,\n walkthroughStep: 0,\n disableClickOutside,\n }}\n >\n {children}\n </PopoverInternalContext.Provider>\n </RadixPopover.Root>\n );\n};\n\nPopoverStandalone.displayName = \"PopoverStandalone\";\n","import { useCallback, useRef } from \"react\";\n\nexport const useSmoothScroll = (onComplete?: () => void) => {\n const scrollAnimationId = useRef<number | null>(null);\n\n const cancelScroll = useCallback(() => {\n if (scrollAnimationId.current) {\n cancelAnimationFrame(scrollAnimationId.current);\n scrollAnimationId.current = null;\n }\n }, []);\n\n const scrollToElement = useCallback(\n (element: HTMLElement, duration: number = 600) => {\n const prefersReducedMotion = window.matchMedia(\"(prefers-reduced-motion: reduce)\").matches;\n const rect = element.getBoundingClientRect();\n const absoluteTop = rect.top + window.pageYOffset;\n const elementHeight = rect.height;\n const viewportHeight = window.innerHeight;\n\n let targetY = absoluteTop - viewportHeight / 2 + elementHeight / 2;\n const documentHeight = document.documentElement.scrollHeight;\n const maxScroll = Math.max(0, documentHeight - viewportHeight);\n targetY = Math.max(0, Math.min(targetY, maxScroll));\n\n if (prefersReducedMotion) {\n window.scrollTo(0, targetY);\n onComplete?.();\n return;\n }\n\n const startY = window.pageYOffset;\n const distance = targetY - startY;\n const startTime = performance.now();\n\n const animateScroll = (currentTime: number) => {\n const elapsed = currentTime - startTime;\n const progress = Math.min(elapsed / duration, 1);\n\n const easeInOut =\n progress < 0.5 ? 2 * progress * progress : 1 - Math.pow(-2 * progress + 2, 2) / 2;\n\n const currentY = startY + distance * easeInOut;\n window.scrollTo(0, currentY);\n\n if (progress < 1) {\n scrollAnimationId.current = requestAnimationFrame(animateScroll);\n } else {\n scrollAnimationId.current = null;\n onComplete?.();\n }\n };\n\n cancelScroll();\n\n scrollAnimationId.current = requestAnimationFrame(animateScroll);\n },\n [onComplete, cancelScroll]\n );\n\n return { scrollToElement, cancelScroll };\n};\n","import { useEffect, useRef } from \"react\";\n\nimport { useOptionalPopoverFlow } from \"./popover-flow\";\nimport { usePopoverInternal } from \"./popover-internal-context\";\nimport { useSmoothScroll } from \"./use-smooth-scroll\";\n\nexport function usePopoverTrigger(ref: React.Ref<HTMLButtonElement>) {\n const triggerRef = useRef<HTMLButtonElement>(null);\n const context = usePopoverInternal();\n const flow = useOptionalPopoverFlow();\n const hasScrolled = useRef(false);\n const { scrollToElement, cancelScroll } = useSmoothScroll(context?.onScrollComplete);\n\n // Forward ref\n useEffect(() => {\n if (typeof ref === \"function\") {\n ref(triggerRef.current);\n } else if (ref) {\n (ref as React.MutableRefObject<HTMLButtonElement | null>).current = triggerRef.current;\n }\n }, [ref]);\n\n // Walkthrough scroll logic\n useEffect(() => {\n const isActiveStep =\n flow &&\n context?.walkthroughStep !== undefined &&\n flow.currentStep === context.walkthroughStep &&\n triggerRef.current &&\n !hasScrolled.current;\n\n if (isActiveStep) {\n const element = triggerRef.current!;\n const rect = element.getBoundingClientRect();\n const buffer = 100;\n const isVisible =\n rect.top >= -buffer &&\n rect.bottom <= window.innerHeight + buffer &&\n rect.left >= -buffer &&\n rect.right <= window.innerWidth + buffer;\n\n if (isVisible) {\n context?.onScrollComplete?.();\n } else {\n context?.onScrollStart?.();\n scrollToElement(element);\n }\n hasScrolled.current = true;\n } else if (flow?.currentStep !== context?.walkthroughStep) {\n hasScrolled.current = false;\n cancelScroll();\n }\n }, [flow?.currentStep, context?.walkthroughStep, flow, scrollToElement, cancelScroll, context]);\n\n // Radix Popover trigger applies aria-expanded by default; remove it to keep dialog trigger semantics.\n // Fixes expanded state in item \"The popover trigger button has an incorrect accessible name and communicates an inappropriate expanding state.\"\n useEffect(() => {\n if (triggerRef.current) {\n triggerRef.current.removeAttribute(\"aria-expanded\");\n }\n }, [context?.isOpen]);\n\n // Cancel scroll on unmount\n useEffect(() => cancelScroll, [cancelScroll]);\n\n return { triggerRef, context };\n}\n","import React, { forwardRef } from \"react\";\nimport * as RadixPopover from \"@radix-ui/react-popover\";\nimport c from \"classnames/bind\";\n\nimport styles from \"./popover.module.scss\";\nimport { usePopoverTrigger } from \"./usePopoverTrigger\";\n\nconst cx = c.bind(styles);\n\nexport type PopoverTriggerProps = RadixPopover.PopoverTriggerProps & {\n /**\n * Whether to show visual highlight effect around the trigger when popover is open.\n * @default true\n */\n highlight?: boolean;\n /**\n * Whether to use negative (light) styling for the highlight effect.\n * @default false\n */\n negative?: boolean;\n};\n\nexport const PopoverTrigger = forwardRef<HTMLButtonElement, PopoverTriggerProps>(\n ({ children, className, highlight = true, negative = false, ...props }, ref) => {\n const { triggerRef, context } = usePopoverTrigger(ref);\n\n return (\n <div\n className={cx(\n \"purpur-popover__trigger\",\n { \"purpur-popover__trigger--highlight\": context?.isOpen && highlight },\n className\n )}\n >\n {context?.isOpen && highlight && (\n <>\n {/* State 1: Outer glow effect */}\n <div\n className={cx(\n \"purpur-popover__trigger-highlight\",\n \"purpur-popover__trigger-highlight--state1\",\n { \"purpur-popover__trigger-highlight--negative\": negative }\n )}\n aria-hidden=\"true\"\n />\n {/* State 2: Inner border only */}\n <div\n className={cx(\n \"purpur-popover__trigger-highlight\",\n \"purpur-popover__trigger-highlight--state2\",\n { \"purpur-popover__trigger-highlight--negative\": negative }\n )}\n aria-hidden=\"true\"\n />\n </>\n )}\n <RadixPopover.Trigger\n ref={triggerRef}\n asChild\n aria-haspopup=\"dialog\"\n {...props}\n >\n {children}\n </RadixPopover.Trigger>\n </div>\n );\n }\n);\n\nPopoverTrigger.displayName = \"PopoverTrigger\";\n","import { useCallback, useEffect, useRef, useState } from \"react\";\n\nimport { useOptionalPopoverFlow } from \"./popover-flow\";\n\nexport function usePopoverWalkthrough(step: number) {\n const flow = useOptionalPopoverFlow();\n const [actuallyOpen, setActuallyOpen] = useState(false);\n const [waitingForScroll, setWaitingForScroll] = useState(false);\n const timeoutRef = useRef<number | null>(null);\n const openedAtRef = useRef<number>(0);\n\n useEffect(() => {\n if (flow) {\n flow.registerStep(step);\n return () => flow.unregisterStep(step);\n }\n return () => {};\n }, [flow, step]);\n\n const shouldBeOpen = flow?.currentStep === step;\n\n const onScrollStart = useCallback(() => {\n setWaitingForScroll(true);\n }, []);\n\n const onScrollComplete = useCallback(() => {\n setWaitingForScroll(false);\n if (shouldBeOpen) {\n const delay = flow.openDelay;\n timeoutRef.current = window.setTimeout(() => {\n setActuallyOpen(true);\n openedAtRef.current = Date.now();\n }, delay);\n }\n }, [shouldBeOpen, flow]);\n\n useEffect(() => {\n if (timeoutRef.current) {\n clearTimeout(timeoutRef.current);\n timeoutRef.current = null;\n }\n\n if (shouldBeOpen) {\n if (!waitingForScroll) {\n const delay = flow.openDelay;\n timeoutRef.current = window.setTimeout(() => {\n setActuallyOpen(true);\n openedAtRef.current = Date.now();\n }, delay);\n }\n } else {\n setActuallyOpen(false);\n setWaitingForScroll(false);\n openedAtRef.current = 0;\n }\n\n return () => {\n if (timeoutRef.current) {\n clearTimeout(timeoutRef.current);\n timeoutRef.current = null;\n }\n };\n }, [shouldBeOpen, waitingForScroll, flow]);\n\n const handleOpenChange = useCallback(\n (open: boolean, consumerOnOpenChange?: (open: boolean) => void) => {\n consumerOnOpenChange?.(open);\n if (!open && actuallyOpen && flow && flow.currentStep === step) {\n const timeSinceOpen = Date.now() - openedAtRef.current;\n if (timeSinceOpen < 10 || timeoutRef.current !== null) {\n return;\n }\n flow.dismiss();\n }\n },\n [actuallyOpen, flow, step]\n );\n\n return {\n actuallyOpen,\n onScrollStart,\n onScrollComplete,\n handleOpenChange,\n };\n}\n","import React, { type ReactNode } from \"react\";\nimport * as RadixPopover from \"@radix-ui/react-popover\";\n\nimport { PopoverInternalContext } from \"./popover-internal-context\";\nimport { usePopoverWalkthrough } from \"./usePopoverWalkthrough\";\n\nexport type PopoverWalkthroughProps = RadixPopover.PopoverProps & {\n children: ReactNode;\n step: number;\n className?: string;\n disableClickOutside?: boolean;\n};\n\nexport const PopoverWalkthrough = ({\n children,\n step,\n onOpenChange: consumerOnOpenChange,\n disableClickOutside = true,\n ...props\n}: PopoverWalkthroughProps) => {\n const { actuallyOpen, onScrollStart, onScrollComplete, handleOpenChange } =\n usePopoverWalkthrough(step);\n\n return (\n <RadixPopover.Root\n modal={true}\n open={actuallyOpen}\n onOpenChange={(open) => handleOpenChange(open, consumerOnOpenChange)}\n {...props}\n >\n <PopoverInternalContext.Provider\n value={{\n isOpen: actuallyOpen,\n walkthroughStep: step,\n onScrollStart,\n onScrollComplete,\n disableClickOutside,\n }}\n >\n {children}\n </PopoverInternalContext.Provider>\n </RadixPopover.Root>\n );\n};\n\nPopoverWalkthrough.displayName = \"PopoverWalkthrough\";\n","import React, { type ReactNode } from \"react\";\nimport type * as RadixPopover from \"@radix-ui/react-popover\";\n\nimport { PopoverBack } from \"./popover-back\";\nimport { PopoverButton } from \"./popover-button\";\nimport { type PopoverAction,PopoverContent } from \"./popover-content\";\nimport { PopoverFlow } from \"./popover-flow\";\nimport { PopoverFooter } from \"./popover-footer\";\nimport { PopoverNext } from \"./popover-next\";\nimport { PopoverStandalone } from \"./popover-standalone\";\nimport { PopoverTrigger } from \"./popover-trigger\";\nimport { PopoverWalkthrough } from \"./popover-walkthrough\";\n\nexport type { PopoverAction };\n\n// Base props shared by both variants\ntype BasePopoverProps = RadixPopover.PopoverProps & {\n children: ReactNode;\n className?: string;\n};\n\n// Standalone variant props\ntype StandalonePopoverProps = BasePopoverProps & {\n multistep?: false;\n step?: never;\n disableClickOutside?: boolean;\n};\n\n// Walkthrough variant props\ntype WalkthroughPopoverProps = BasePopoverProps & {\n multistep: true;\n step: number;\n disableClickOutside?: boolean;\n};\n\nexport type PopoverProps = StandalonePopoverProps | WalkthroughPopoverProps;\n\ntype PopoverCmp<P> = React.FunctionComponent<P> & {\n Back: typeof PopoverBack;\n Button: typeof PopoverButton;\n Content: typeof PopoverContent;\n Flow: typeof PopoverFlow;\n Footer: typeof PopoverFooter;\n Next: typeof PopoverNext;\n Trigger: typeof PopoverTrigger;\n};\n\nexport const Popover: PopoverCmp<PopoverProps> = (props) => {\n const { multistep = false, disableClickOutside, ...restProps } = props;\n\n if (multistep) {\n return (\n <PopoverWalkthrough\n {...(restProps as WalkthroughPopoverProps)}\n disableClickOutside={disableClickOutside ?? true}\n />\n );\n }\n\n return (\n <PopoverStandalone\n {...(restProps as StandalonePopoverProps)}\n disableClickOutside={disableClickOutside}\n />\n );\n};\n\nPopover.Back = PopoverBack;\nPopover.Button = PopoverButton;\nPopover.Content = PopoverContent;\nPopover.Flow = PopoverFlow;\nPopover.Footer = PopoverFooter;\nPopover.Next = PopoverNext;\nPopover.Trigger = PopoverTrigger;\n\nPopover.displayName = \"Popover\";\n"],"names":["PopoverFlowContext","createContext","usePopoverFlow","context","useContext","useOptionalPopoverFlow","PopoverFlow","children","initialStep","onComplete","onDismiss","separatorText","stepText","backLabel","nextLabel","finishLabel","openDelay","currentStep","setCurrentStep","useState","registeredSteps","setRegisteredSteps","registerStep","useCallback","step","prev","next","unregisterStep","nextStep","back","dismiss","value","useMemo","jsx","PopoverInternalContext","usePopoverInternal","PopoverNegativeContext","usePopoverNegative","DEBOUNCE_DELAY","SCREEN_MEDIA_QUERY","purpurBreakpointMd","useScreenSize","maxMediumScreen","updateSize","setIsMdOrSmaller","isMdOrSmaller","handleResize","timeoutId","useEffect","PopoverBack","onClick","isNegative","Button","PopoverButton","asChild","variant","fullWidth","flow","content","RadixPopover.Close","cx","c","styles","PopoverSteps","totalSteps","Fragment","jsxs","Paragraph","PopoverFooter","className","internal","showSteps","PopoverHeader","forwardRef","title","icon","ref","Heading","PopoverNext","PopoverContent","beakPosition","align","alignOffset","sideOffset","negative","closeIconAriaLabel","body","onAction","zIndex","container","props","headerRef","useRef","isFlowDismissRef","themePortalContainer","useThemePortalContainer","portalContainer","radixSide","shouldShowArrow","getFocusableElements","element","focusOutsidePopover","contentElement","activeElement","direction","allFocusableElements","activeIndex","currentIndex","candidate","footerContent","isFirstStep","isLastStep","handleOpenAutoFocus","event","headingElement","handleKeyDown","focusableElements","firstFocusable","lastFocusable","isOnFirstFocusable","isOnLastFocusable","isOnNonTabbableContext","handleCloseAutoFocus","handleClose","handleEscapeKey","handleInteractOutside","target","RadixPopover.Portal","RadixPopover.Content","IconClose","RadixPopover.Arrow","PopoverStandalone","controlledOpen","defaultOpen","onOpenChange","disableClickOutside","internalOpen","setInternalOpen","isControlled","isOpen","RadixPopover.Root","newOpen","useSmoothScroll","scrollAnimationId","cancelScroll","duration","prefersReducedMotion","rect","absoluteTop","elementHeight","viewportHeight","targetY","documentHeight","maxScroll","startY","distance","startTime","animateScroll","currentTime","elapsed","progress","easeInOut","currentY","usePopoverTrigger","triggerRef","hasScrolled","scrollToElement","buffer","PopoverTrigger","highlight","RadixPopover.Trigger","usePopoverWalkthrough","actuallyOpen","setActuallyOpen","waitingForScroll","setWaitingForScroll","timeoutRef","openedAtRef","shouldBeOpen","onScrollStart","onScrollComplete","delay","handleOpenChange","open","consumerOnOpenChange","PopoverWalkthrough","Popover","multistep","restProps"],"mappings":";;;;;;;;;;;AAyBA,MAAMA,IAAqBC,EAA6C,IAAI,GAE/DC,IAAiB,MAAM;AAClC,QAAMC,IAAUC,EAAWJ,CAAkB;AAC7C,MAAI,CAACG;AACH,UAAM,IAAI,MAAM,2DAA2D;AAE7E,SAAOA;AACT,GAEaE,IAAyB,MAC7BD,EAAWJ,CAAkB,GAgDzBM,KAAc,CAAC;AAAA,EAC1B,UAAAC;AAAA,EACA,aAAAC,IAAc;AAAA,EACd,YAAAC;AAAA,EACA,WAAAC;AAAA,EACA,eAAAC;AAAA,EACA,UAAAC;AAAA,EACA,WAAAC;AAAA,EACA,WAAAC;AAAA,EACA,aAAAC;AAAA,EACA,WAAAC,IAAY;AACd,MAAwB;AACtB,QAAM,CAACC,GAAaC,CAAc,IAAIC,EAASX,CAAW,GACpD,CAACY,GAAiBC,CAAkB,IAAIF,EAAsB,oBAAI,KAAK,GAEvEG,IAAeC,EAAY,CAACC,MAAiB;AACjD,IAAAH,EAAmB,CAACI,MAAS;AAC3B,YAAMC,IAAO,IAAI,IAAID,CAAI;AACzBC,aAAAA,EAAK,IAAIF,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,OAAO;AAAA,YACL,QAAQ0I;AAAA,YACR,iBAAiBpJ;AAAA,YACjB,eAAA2J;AAAA,YACA,kBAAAC;AAAA,YACA,qBAAA7C;AAAA,UAAA;AAAA,UAGD,UAAAhI;AAAA,QAAA;AAAA,MAAA;AAAA,IACH;AAAA,EAAA;AAGN;AAEAkL,GAAmB,cAAc;ACE1B,MAAMC,IAAoC,CAAChG,MAAU;AAC1D,QAAM,EAAE,WAAAiG,IAAY,IAAO,qBAAApD,GAAqB,GAAGqD,MAAclG;AAEjE,SAAIiG,IAEA,gBAAA1J;AAAA,IAACwJ;AAAA,IAAA;AAAA,MACE,GAAIG;AAAA,MACL,qBAAqBrD,KAAuB;AAAA,IAAA;AAAA,EAAA,IAMhD,gBAAAtG;AAAA,IAACkG;AAAA,IAAA;AAAA,MACE,GAAIyD;AAAA,MACL,qBAAArD;AAAA,IAAA;AAAA,EAAA;AAGN;AAEAmD,EAAQ,OAAOzI;AACfyI,EAAQ,SAASrI;AACjBqI,EAAQ,UAAU3G;AAClB2G,EAAQ,OAAOpL;AACfoL,EAAQ,SAAStH;AACjBsH,EAAQ,OAAO5G;AACf4G,EAAQ,UAAUlB;AAElBkB,EAAQ,cAAc;"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";const n=require("react/jsx-runtime"),q=require("./button-C5CYysw5.js"),o=require("react"),xe=require("./variables-Buqm4JZc.js"),F=require("./index-BPY_9ddu.js"),Se=require("./close.es-VL3lKi1O.js"),ne=require("./paragraph-B8HFdNne.js");require("./ThemeProvider-BJGm3zai.js");const be=require("./useThemePortalContainer-CUcqV327.js"),A=require("./bind-DeUYJ6m9.js"),je=require("./heading-BPeRwNYu.js"),H=o.createContext(null),W=()=>{const t=o.useContext(H);if(!t)throw new Error("usePopoverFlow must be used within a PopoverFlow provider");return t},B=()=>o.useContext(H),Ce=({children:t,initialStep:e=1,onComplete:r,onDismiss:s,separatorText:u,stepText:l,backLabel:c,nextLabel:d,finishLabel:_,openDelay:h=0})=>{const[g,a]=o.useState(e),[f,j]=o.useState(new Set),w=o.useCallback(v=>{j(b=>{const k=new Set(b);return k.add(v),k})},[]),N=o.useCallback(v=>{j(b=>{const k=new Set(b);return k.delete(v),k})},[]),p=o.useCallback(()=>{a(v=>{const b=v+1;return b>f.size?(r?.(),v):b})},[f.size,r]),P=o.useCallback(()=>{a(v=>Math.max(1,v-1))},[]),O=o.useCallback(()=>{a(0),s?.()},[s]),C=o.useMemo(()=>({currentStep:g,totalSteps:f.size,next:p,back:P,dismiss:O,registerStep:w,unregisterStep:N,separatorText:u,stepText:l,backLabel:c,nextLabel:d,finishLabel:_,openDelay:h}),[g,f.size,p,P,O,w,N,u,l,c,d,_,h]);return n.jsx(H.Provider,{value:C,children:t})},Y=o.createContext(null),z=()=>o.useContext(Y),se=o.createContext({negative:!1}),$=()=>o.useContext(se),ye=150,re={MAX_MD:`(max-width: ${xe.purpurBreakpointMd})`},X=()=>{const t=window.matchMedia(re.MAX_MD);function e(){s(t.matches)}const[r,s]=o.useState(()=>typeof window>"u"?!1:window.matchMedia(re.MAX_MD).matches),u=o.useCallback(()=>{let l;return()=>{clearTimeout(l),l=setTimeout(()=>e(),ye)}},[e]);return o.useEffect(()=>{if(!(typeof window>"u"))return window.addEventListener("resize",u),()=>window.removeEventListener("resize",u)},[u]),{isMdOrSmaller:r}},U=({children:t,onClick:e})=>{const{back:r}=W(),{negative:s}=$(),{isMdOrSmaller:u}=X(),l=!s,c=()=>{e?.(),r()};return n.jsx(q.Button,{size:"sm",variant:"secondary",onClick:c,negative:l,fullWidth:u,children:t})};U.displayName="PopoverBack";const V=({children:t,asChild:e,onClick:r,variant:s="primary",dismiss:u=!0,fullWidth:l})=>{const c=B(),{isMdOrSmaller:d}=X(),{negative:_}=$(),h=!_,g=()=>{r?.(),u&&c?.dismiss()},a=l??d,f=e?t:n.jsx(q.Button,{variant:s,size:"sm",fullWidth:a,negative:h,onClick:g,children:t});return u?n.jsx(F.Close,{asChild:!0,children:f}):f};V.displayName="PopoverButton";const Pe="_highlightState1_1w9je_1",ke="_fadeIn_1w9je_1",Fe="_slideFromTop_1w9je_1",Oe="_slideFromBottom_1w9je_1",Te="_slideFromLeft_1w9je_1",Ne="_slideFromRight_1w9je_1",Re="_fadeOut_1w9je_1",Ee="_slideToTop_1w9je_1",Me="_slideToBottom_1w9je_1",De="_slideToLeft_1w9je_1",Ae="_slideToRight_1w9je_1",I={"purpur-popover__trigger":"_purpur-popover__trigger_1w9je_1","purpur-popover__trigger-highlight":"_purpur-popover__trigger-highlight_1w9je_5","purpur-popover__trigger-highlight--state1":"_purpur-popover__trigger-highlight--state1_1w9je_14",highlightState1:Pe,"purpur-popover__trigger-highlight--negative":"_purpur-popover__trigger-highlight--negative_1w9je_29","purpur-popover__trigger-highlight--state2":"_purpur-popover__trigger-highlight--state2_1w9je_33","purpur-popover__inner":"_purpur-popover__inner_1w9je_45","purpur-popover__content":"_purpur-popover__content_1w9je_52",fadeIn:ke,slideFromTop:Fe,slideFromBottom:Oe,slideFromLeft:Te,slideFromRight:Ne,fadeOut:Re,slideToTop:Ee,slideToBottom:Me,slideToLeft:De,slideToRight:Ae,"purpur-popover__arrow":"_purpur-popover__arrow_1w9je_103","purpur-popover__body":"_purpur-popover__body_1w9je_106","purpur-popover__icon":"_purpur-popover__icon_1w9je_107","purpur-popover__steps":"_purpur-popover__steps_1w9je_108","purpur-popover__title":"_purpur-popover__title_1w9je_109","purpur-popover__content--negative":"_purpur-popover__content--negative_1w9je_112","purpur-popover__header-content":"_purpur-popover__header-content_1w9je_124","purpur-popover__close":"_purpur-popover__close_1w9je_137","purpur-popover__footer":"_purpur-popover__footer_1w9je_142","purpur-popover__footer-button-group":"_purpur-popover__footer-button-group_1w9je_155"},Be=A.c.bind(I),ie=()=>{const t=W(),r=z()?.walkthroughStep||t.currentStep,{totalSteps:s,separatorText:u,stepText:l}=t;return n.jsx(n.Fragment,{children:n.jsxs(ne.Paragraph,{className:Be("purpur-popover__steps"),role:"status","aria-live":"polite","aria-atomic":"true",children:[l," ",r," ",u," ",s]})})};ie.displayName="PopoverSteps";const oe=A.c.bind(I),Q=({children:t,className:e})=>{const r=B(),s=z(),u=r&&s&&s.walkthroughStep>0;return n.jsxs("div",{className:oe("purpur-popover__footer",e),children:[u&&n.jsx(ie,{}),n.jsx("div",{className:oe("purpur-popover__footer-button-group"),children:t})]})};Q.displayName="PopoverFooter";const K=A.c.bind(I),ce=o.forwardRef(({title:t,icon:e},r)=>n.jsxs("div",{ref:r,className:K("purpur-popover__header-content"),children:[e&&n.jsx("span",{className:K("purpur-popover__icon"),children:e}),n.jsx(je.Heading,{tag:"h2",variant:"title-100",className:K("purpur-popover__title"),id:"popover-heading",children:t})]}));ce.displayName="PopoverHeader";const G=({children:t,onClick:e})=>{const{next:r}=W(),{negative:s}=$(),{isMdOrSmaller:u}=X(),l=!s,c=()=>{e?.(),r()};return n.jsx(q.Button,{size:"sm",variant:"primary",onClick:c,negative:l,fullWidth:u,children:t})};G.displayName="PopoverNext";const E=A.c.bind(I),ue=o.forwardRef(({children:t,className:e,beakPosition:r="down",align:s="center",alignOffset:u=0,sideOffset:l=5,negative:c=!1,closeIconAriaLabel:d,title:_,icon:h,body:g,onAction:a,zIndex:f=210,container:j,...w},N)=>{const p=B(),P=z(),O=o.useRef(null),C=o.useRef(!1),v=be.useThemePortalContainer(),b=j===void 0?v:j??void 0,de={up:"bottom",right:"left",down:"top",left:"right",none:"bottom"}[r],_e=r!=="none",J=i=>Array.from(i.querySelectorAll("button:not([disabled]), [href], input:not([disabled]), select:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex='-1'])")).filter(x=>!x.hasAttribute("aria-hidden")),Z=(i,m,x)=>{const R=J(document.body),M=R.indexOf(m);if(M===-1)return;const S=x==="next"?1:-1;for(let T=M+S;T>=0&&T<R.length;T+=S){const D=R[T];if(!i.contains(D)){D.focus();return}}};let ee=t;if(p&&!t){const i=P?.walkthroughStep||p.currentStep,m=i===1,x=i===p.totalSteps;ee=n.jsxs(Q,{children:[!m&&n.jsx(U,{onClick:()=>a?.({type:"back",step:i}),children:p.backLabel}),x?n.jsx(V,{onClick:()=>a?.({type:"finish",step:i}),dismiss:!0,children:p.finishLabel}):n.jsx(G,{onClick:()=>a?.({type:"next",step:i}),children:p.nextLabel})]})}const he=i=>{i.preventDefault();const m=i.currentTarget,x=O.current?.querySelector("#popover-heading");setTimeout(()=>{if(p&&x){x.setAttribute("tabindex","-1"),x.focus();return}m.setAttribute("tabindex","-1"),m.focus()},0),w.onOpenAutoFocus?.(i)},ge=i=>{if(i.key!=="Tab"){w.onKeyDown?.(i);return}const m=i.currentTarget,x=J(m);if(x.length===0){w.onKeyDown?.(i);return}const R=x[0],M=x[x.length-1],S=document.activeElement,T=S===R,D=S===M,te=S!==null&&m.contains(S)&&S.tabIndex===-1;if(!p){S!==null&&(i.shiftKey&&T?(i.preventDefault(),Z(m,S,"previous")):!i.shiftKey&&D&&(i.preventDefault(),Z(m,S,"next"))),w.onKeyDown?.(i);return}i.shiftKey&&(T||te)?(i.preventDefault(),M.focus()):!i.shiftKey&&(D||te)&&(i.preventDefault(),R.focus()),w.onKeyDown?.(i)},fe=i=>{p&&!C.current&&i.preventDefault(),C.current&&(C.current=!1),w.onCloseAutoFocus?.(i)},ve=i=>{p&&(C.current=!0,i.preventDefault()),a?.({type:"dismiss",step:p?.currentStep}),p?.dismiss()},me=i=>{p&&(C.current=!0,i.preventDefault()),a?.({type:"dismiss",step:p?.currentStep}),p?.dismiss()},we=i=>{if(P?.disableClickOutside){i.preventDefault();return}if(p){const m=i.target;m.closest("[role='dialog']")||m.closest(".purpur-popover__trigger")||m.closest("button[aria-haspopup='dialog']")||(a?.({type:"dismiss",step:p.currentStep}),setTimeout(()=>{p.dismiss()},0))}};return n.jsx(F.Portal,{container:b,children:n.jsxs(F.Content2,{"data-testid":"popover-content",role:"dialog","aria-modal":"true","aria-labelledby":w["aria-label"]?void 0:"popover-heading",ref:N,side:de,sideOffset:l,align:s,alignOffset:u,style:{"--popover-z-index":f},className:E("purpur-popover__content",{"purpur-popover__content--negative":c},e),onOpenAutoFocus:he,onCloseAutoFocus:fe,onKeyDown:ge,onEscapeKeyDown:me,onInteractOutside:we,...w,children:[n.jsxs(se.Provider,{value:{negative:c},children:[n.jsxs("div",{className:E("purpur-popover__inner"),children:[n.jsx(ce,{ref:O,title:_,icon:h}),n.jsx(ne.Paragraph,{className:E("purpur-popover__body"),children:g})]}),ee,n.jsx(F.Close,{asChild:!0,onClick:ve,children:n.jsx(q.Button,{variant:"text",size:"sm","aria-label":d,className:E("purpur-popover__close"),negative:!c,iconOnly:!0,children:n.jsx(Se.r,{size:"xs",className:E("purpur-popover__icon")})})})]}),_e&&n.jsx(F.Arrow2,{className:E("purpur-popover__arrow"),"aria-hidden":"true",tabIndex:-1})]})})});ue.displayName="PopoverContent";const le=({children:t,open:e,defaultOpen:r=!1,onOpenChange:s,disableClickOutside:u,...l})=>{const[c,d]=o.useState(r),_=e!==void 0,h=_?e:c,g=a=>{_||d(a),s?.(a)};return n.jsx(F.Root2,{open:h,onOpenChange:g,...l,children:n.jsx(Y.Provider,{value:{isOpen:h,walkthroughStep:0,disableClickOutside:u},children:t})})};le.displayName="PopoverStandalone";const Ie=t=>{const e=o.useRef(null),r=o.useCallback(()=>{e.current&&(cancelAnimationFrame(e.current),e.current=null)},[]);return{scrollToElement:o.useCallback((u,l=600)=>{const c=window.matchMedia("(prefers-reduced-motion: reduce)").matches,d=u.getBoundingClientRect(),_=d.top+window.pageYOffset,h=d.height,g=window.innerHeight;let a=_-g/2+h/2;const f=document.documentElement.scrollHeight,j=Math.max(0,f-g);if(a=Math.max(0,Math.min(a,j)),c){window.scrollTo(0,a),t?.();return}const w=window.pageYOffset,N=a-w,p=performance.now(),P=O=>{const C=O-p,v=Math.min(C/l,1),b=v<.5?2*v*v:1-Math.pow(-2*v+2,2)/2,k=w+N*b;window.scrollTo(0,k),v<1?e.current=requestAnimationFrame(P):(e.current=null,t?.())};r(),e.current=requestAnimationFrame(P)},[t,r]),cancelScroll:r}};function qe(t){const e=o.useRef(null),r=z(),s=B(),u=o.useRef(!1),{scrollToElement:l,cancelScroll:c}=Ie(r?.onScrollComplete);return o.useEffect(()=>{typeof t=="function"?t(e.current):t&&(t.current=e.current)},[t]),o.useEffect(()=>{if(s&&r?.walkthroughStep!==void 0&&s.currentStep===r.walkthroughStep&&e.current&&!u.current){const _=e.current,h=_.getBoundingClientRect(),g=100;h.top>=-g&&h.bottom<=window.innerHeight+g&&h.left>=-g&&h.right<=window.innerWidth+g?r?.onScrollComplete?.():(r?.onScrollStart?.(),l(_)),u.current=!0}else s?.currentStep!==r?.walkthroughStep&&(u.current=!1,c())},[s?.currentStep,r?.walkthroughStep,s,l,c,r]),o.useEffect(()=>{e.current&&e.current.removeAttribute("aria-expanded")},[r?.isOpen]),o.useEffect(()=>c,[c]),{triggerRef:e,context:r}}const L=A.c.bind(I),ae=o.forwardRef(({children:t,className:e,highlight:r=!0,negative:s=!1,...u},l)=>{const{triggerRef:c,context:d}=qe(l);return n.jsxs("div",{className:L("purpur-popover__trigger",{"purpur-popover__trigger--highlight":d?.isOpen&&r},e),children:[d?.isOpen&&r&&n.jsxs(n.Fragment,{children:[n.jsx("div",{className:L("purpur-popover__trigger-highlight","purpur-popover__trigger-highlight--state1",{"purpur-popover__trigger-highlight--negative":s}),"aria-hidden":"true"}),n.jsx("div",{className:L("purpur-popover__trigger-highlight","purpur-popover__trigger-highlight--state2",{"purpur-popover__trigger-highlight--negative":s}),"aria-hidden":"true"})]}),n.jsx(F.Trigger,{ref:c,asChild:!0,"aria-haspopup":"dialog",...u,children:t})]})});ae.displayName="PopoverTrigger";function ze(t){const e=B(),[r,s]=o.useState(!1),[u,l]=o.useState(!1),c=o.useRef(null),d=o.useRef(0);o.useEffect(()=>e?(e.registerStep(t),()=>e.unregisterStep(t)):()=>{},[e,t]);const _=e?.currentStep===t,h=o.useCallback(()=>{l(!0)},[]),g=o.useCallback(()=>{if(l(!1),_){const f=e.openDelay;c.current=window.setTimeout(()=>{s(!0),d.current=Date.now()},f)}},[_,e]);o.useEffect(()=>{if(c.current&&(clearTimeout(c.current),c.current=null),_){if(!u){const f=e.openDelay;c.current=window.setTimeout(()=>{s(!0),d.current=Date.now()},f)}}else s(!1),l(!1),d.current=0;return()=>{c.current&&(clearTimeout(c.current),c.current=null)}},[_,u,e]);const a=o.useCallback((f,j)=>{if(j?.(f),!f&&r&&e&&e.currentStep===t){if(Date.now()-d.current<10||c.current!==null)return;e.dismiss()}},[r,e,t]);return{actuallyOpen:r,onScrollStart:h,onScrollComplete:g,handleOpenChange:a}}const pe=({children:t,step:e,onOpenChange:r,disableClickOutside:s=!0,...u})=>{const{actuallyOpen:l,onScrollStart:c,onScrollComplete:d,handleOpenChange:_}=ze(e);return n.jsx(F.Root2,{modal:!0,open:l,onOpenChange:h=>_(h,r),...u,children:n.jsx(Y.Provider,{value:{isOpen:l,walkthroughStep:e,onScrollStart:c,onScrollComplete:d,disableClickOutside:s},children:t})})};pe.displayName="PopoverWalkthrough";const y=t=>{const{multistep:e=!1,disableClickOutside:r,...s}=t;return e?n.jsx(pe,{...s,disableClickOutside:r??!0}):n.jsx(le,{...s,disableClickOutside:r})};y.Back=U;y.Button=V;y.Content=ue;y.Flow=Ce;y.Footer=Q;y.Next=G;y.Trigger=ae;y.displayName="Popover";exports.Popover=y;
|
|
2
|
-
//# sourceMappingURL=popover-
|
|
1
|
+
"use strict";const n=require("react/jsx-runtime"),q=require("./button-C5CYysw5.js"),o=require("react"),xe=require("./variables-Buqm4JZc.js"),F=require("./index-BPY_9ddu.js"),Se=require("./close.es-VL3lKi1O.js"),ne=require("./paragraph-B8HFdNne.js");require("./ThemeProvider-BGep6X_i.js");const be=require("./useThemePortalContainer-Cs1c-2AI.js"),A=require("./bind-DeUYJ6m9.js"),je=require("./heading-BPeRwNYu.js"),H=o.createContext(null),W=()=>{const t=o.useContext(H);if(!t)throw new Error("usePopoverFlow must be used within a PopoverFlow provider");return t},B=()=>o.useContext(H),Ce=({children:t,initialStep:e=1,onComplete:r,onDismiss:s,separatorText:u,stepText:l,backLabel:c,nextLabel:d,finishLabel:_,openDelay:h=0})=>{const[g,a]=o.useState(e),[f,j]=o.useState(new Set),w=o.useCallback(v=>{j(b=>{const k=new Set(b);return k.add(v),k})},[]),N=o.useCallback(v=>{j(b=>{const k=new Set(b);return k.delete(v),k})},[]),p=o.useCallback(()=>{a(v=>{const b=v+1;return b>f.size?(r?.(),v):b})},[f.size,r]),P=o.useCallback(()=>{a(v=>Math.max(1,v-1))},[]),O=o.useCallback(()=>{a(0),s?.()},[s]),C=o.useMemo(()=>({currentStep:g,totalSteps:f.size,next:p,back:P,dismiss:O,registerStep:w,unregisterStep:N,separatorText:u,stepText:l,backLabel:c,nextLabel:d,finishLabel:_,openDelay:h}),[g,f.size,p,P,O,w,N,u,l,c,d,_,h]);return n.jsx(H.Provider,{value:C,children:t})},Y=o.createContext(null),z=()=>o.useContext(Y),se=o.createContext({negative:!1}),$=()=>o.useContext(se),ye=150,re={MAX_MD:`(max-width: ${xe.purpurBreakpointMd})`},X=()=>{const t=window.matchMedia(re.MAX_MD);function e(){s(t.matches)}const[r,s]=o.useState(()=>typeof window>"u"?!1:window.matchMedia(re.MAX_MD).matches),u=o.useCallback(()=>{let l;return()=>{clearTimeout(l),l=setTimeout(()=>e(),ye)}},[e]);return o.useEffect(()=>{if(!(typeof window>"u"))return window.addEventListener("resize",u),()=>window.removeEventListener("resize",u)},[u]),{isMdOrSmaller:r}},U=({children:t,onClick:e})=>{const{back:r}=W(),{negative:s}=$(),{isMdOrSmaller:u}=X(),l=!s,c=()=>{e?.(),r()};return n.jsx(q.Button,{size:"sm",variant:"secondary",onClick:c,negative:l,fullWidth:u,children:t})};U.displayName="PopoverBack";const V=({children:t,asChild:e,onClick:r,variant:s="primary",dismiss:u=!0,fullWidth:l})=>{const c=B(),{isMdOrSmaller:d}=X(),{negative:_}=$(),h=!_,g=()=>{r?.(),u&&c?.dismiss()},a=l??d,f=e?t:n.jsx(q.Button,{variant:s,size:"sm",fullWidth:a,negative:h,onClick:g,children:t});return u?n.jsx(F.Close,{asChild:!0,children:f}):f};V.displayName="PopoverButton";const Pe="_highlightState1_1w9je_1",ke="_fadeIn_1w9je_1",Fe="_slideFromTop_1w9je_1",Oe="_slideFromBottom_1w9je_1",Te="_slideFromLeft_1w9je_1",Ne="_slideFromRight_1w9je_1",Re="_fadeOut_1w9je_1",Ee="_slideToTop_1w9je_1",Me="_slideToBottom_1w9je_1",De="_slideToLeft_1w9je_1",Ae="_slideToRight_1w9je_1",I={"purpur-popover__trigger":"_purpur-popover__trigger_1w9je_1","purpur-popover__trigger-highlight":"_purpur-popover__trigger-highlight_1w9je_5","purpur-popover__trigger-highlight--state1":"_purpur-popover__trigger-highlight--state1_1w9je_14",highlightState1:Pe,"purpur-popover__trigger-highlight--negative":"_purpur-popover__trigger-highlight--negative_1w9je_29","purpur-popover__trigger-highlight--state2":"_purpur-popover__trigger-highlight--state2_1w9je_33","purpur-popover__inner":"_purpur-popover__inner_1w9je_45","purpur-popover__content":"_purpur-popover__content_1w9je_52",fadeIn:ke,slideFromTop:Fe,slideFromBottom:Oe,slideFromLeft:Te,slideFromRight:Ne,fadeOut:Re,slideToTop:Ee,slideToBottom:Me,slideToLeft:De,slideToRight:Ae,"purpur-popover__arrow":"_purpur-popover__arrow_1w9je_103","purpur-popover__body":"_purpur-popover__body_1w9je_106","purpur-popover__icon":"_purpur-popover__icon_1w9je_107","purpur-popover__steps":"_purpur-popover__steps_1w9je_108","purpur-popover__title":"_purpur-popover__title_1w9je_109","purpur-popover__content--negative":"_purpur-popover__content--negative_1w9je_112","purpur-popover__header-content":"_purpur-popover__header-content_1w9je_124","purpur-popover__close":"_purpur-popover__close_1w9je_137","purpur-popover__footer":"_purpur-popover__footer_1w9je_142","purpur-popover__footer-button-group":"_purpur-popover__footer-button-group_1w9je_155"},Be=A.c.bind(I),ie=()=>{const t=W(),r=z()?.walkthroughStep||t.currentStep,{totalSteps:s,separatorText:u,stepText:l}=t;return n.jsx(n.Fragment,{children:n.jsxs(ne.Paragraph,{className:Be("purpur-popover__steps"),role:"status","aria-live":"polite","aria-atomic":"true",children:[l," ",r," ",u," ",s]})})};ie.displayName="PopoverSteps";const oe=A.c.bind(I),Q=({children:t,className:e})=>{const r=B(),s=z(),u=r&&s&&s.walkthroughStep>0;return n.jsxs("div",{className:oe("purpur-popover__footer",e),children:[u&&n.jsx(ie,{}),n.jsx("div",{className:oe("purpur-popover__footer-button-group"),children:t})]})};Q.displayName="PopoverFooter";const K=A.c.bind(I),ce=o.forwardRef(({title:t,icon:e},r)=>n.jsxs("div",{ref:r,className:K("purpur-popover__header-content"),children:[e&&n.jsx("span",{className:K("purpur-popover__icon"),children:e}),n.jsx(je.Heading,{tag:"h2",variant:"title-100",className:K("purpur-popover__title"),id:"popover-heading",children:t})]}));ce.displayName="PopoverHeader";const G=({children:t,onClick:e})=>{const{next:r}=W(),{negative:s}=$(),{isMdOrSmaller:u}=X(),l=!s,c=()=>{e?.(),r()};return n.jsx(q.Button,{size:"sm",variant:"primary",onClick:c,negative:l,fullWidth:u,children:t})};G.displayName="PopoverNext";const E=A.c.bind(I),ue=o.forwardRef(({children:t,className:e,beakPosition:r="down",align:s="center",alignOffset:u=0,sideOffset:l=5,negative:c=!1,closeIconAriaLabel:d,title:_,icon:h,body:g,onAction:a,zIndex:f=210,container:j,...w},N)=>{const p=B(),P=z(),O=o.useRef(null),C=o.useRef(!1),v=be.useThemePortalContainer(),b=j===void 0?v:j??void 0,de={up:"bottom",right:"left",down:"top",left:"right",none:"bottom"}[r],_e=r!=="none",J=i=>Array.from(i.querySelectorAll("button:not([disabled]), [href], input:not([disabled]), select:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex='-1'])")).filter(x=>!x.hasAttribute("aria-hidden")),Z=(i,m,x)=>{const R=J(document.body),M=R.indexOf(m);if(M===-1)return;const S=x==="next"?1:-1;for(let T=M+S;T>=0&&T<R.length;T+=S){const D=R[T];if(!i.contains(D)){D.focus();return}}};let ee=t;if(p&&!t){const i=P?.walkthroughStep||p.currentStep,m=i===1,x=i===p.totalSteps;ee=n.jsxs(Q,{children:[!m&&n.jsx(U,{onClick:()=>a?.({type:"back",step:i}),children:p.backLabel}),x?n.jsx(V,{onClick:()=>a?.({type:"finish",step:i}),dismiss:!0,children:p.finishLabel}):n.jsx(G,{onClick:()=>a?.({type:"next",step:i}),children:p.nextLabel})]})}const he=i=>{i.preventDefault();const m=i.currentTarget,x=O.current?.querySelector("#popover-heading");setTimeout(()=>{if(p&&x){x.setAttribute("tabindex","-1"),x.focus();return}m.setAttribute("tabindex","-1"),m.focus()},0),w.onOpenAutoFocus?.(i)},ge=i=>{if(i.key!=="Tab"){w.onKeyDown?.(i);return}const m=i.currentTarget,x=J(m);if(x.length===0){w.onKeyDown?.(i);return}const R=x[0],M=x[x.length-1],S=document.activeElement,T=S===R,D=S===M,te=S!==null&&m.contains(S)&&S.tabIndex===-1;if(!p){S!==null&&(i.shiftKey&&T?(i.preventDefault(),Z(m,S,"previous")):!i.shiftKey&&D&&(i.preventDefault(),Z(m,S,"next"))),w.onKeyDown?.(i);return}i.shiftKey&&(T||te)?(i.preventDefault(),M.focus()):!i.shiftKey&&(D||te)&&(i.preventDefault(),R.focus()),w.onKeyDown?.(i)},fe=i=>{p&&!C.current&&i.preventDefault(),C.current&&(C.current=!1),w.onCloseAutoFocus?.(i)},ve=i=>{p&&(C.current=!0,i.preventDefault()),a?.({type:"dismiss",step:p?.currentStep}),p?.dismiss()},me=i=>{p&&(C.current=!0,i.preventDefault()),a?.({type:"dismiss",step:p?.currentStep}),p?.dismiss()},we=i=>{if(P?.disableClickOutside){i.preventDefault();return}if(p){const m=i.target;m.closest("[role='dialog']")||m.closest(".purpur-popover__trigger")||m.closest("button[aria-haspopup='dialog']")||(a?.({type:"dismiss",step:p.currentStep}),setTimeout(()=>{p.dismiss()},0))}};return n.jsx(F.Portal,{container:b,children:n.jsxs(F.Content2,{"data-testid":"popover-content",role:"dialog","aria-modal":"true","aria-labelledby":w["aria-label"]?void 0:"popover-heading",ref:N,side:de,sideOffset:l,align:s,alignOffset:u,style:{"--popover-z-index":f},className:E("purpur-popover__content",{"purpur-popover__content--negative":c},e),onOpenAutoFocus:he,onCloseAutoFocus:fe,onKeyDown:ge,onEscapeKeyDown:me,onInteractOutside:we,...w,children:[n.jsxs(se.Provider,{value:{negative:c},children:[n.jsxs("div",{className:E("purpur-popover__inner"),children:[n.jsx(ce,{ref:O,title:_,icon:h}),n.jsx(ne.Paragraph,{className:E("purpur-popover__body"),children:g})]}),ee,n.jsx(F.Close,{asChild:!0,onClick:ve,children:n.jsx(q.Button,{variant:"text",size:"sm","aria-label":d,className:E("purpur-popover__close"),negative:!c,iconOnly:!0,children:n.jsx(Se.r,{size:"xs",className:E("purpur-popover__icon")})})})]}),_e&&n.jsx(F.Arrow2,{className:E("purpur-popover__arrow"),"aria-hidden":"true",tabIndex:-1})]})})});ue.displayName="PopoverContent";const le=({children:t,open:e,defaultOpen:r=!1,onOpenChange:s,disableClickOutside:u,...l})=>{const[c,d]=o.useState(r),_=e!==void 0,h=_?e:c,g=a=>{_||d(a),s?.(a)};return n.jsx(F.Root2,{open:h,onOpenChange:g,...l,children:n.jsx(Y.Provider,{value:{isOpen:h,walkthroughStep:0,disableClickOutside:u},children:t})})};le.displayName="PopoverStandalone";const Ie=t=>{const e=o.useRef(null),r=o.useCallback(()=>{e.current&&(cancelAnimationFrame(e.current),e.current=null)},[]);return{scrollToElement:o.useCallback((u,l=600)=>{const c=window.matchMedia("(prefers-reduced-motion: reduce)").matches,d=u.getBoundingClientRect(),_=d.top+window.pageYOffset,h=d.height,g=window.innerHeight;let a=_-g/2+h/2;const f=document.documentElement.scrollHeight,j=Math.max(0,f-g);if(a=Math.max(0,Math.min(a,j)),c){window.scrollTo(0,a),t?.();return}const w=window.pageYOffset,N=a-w,p=performance.now(),P=O=>{const C=O-p,v=Math.min(C/l,1),b=v<.5?2*v*v:1-Math.pow(-2*v+2,2)/2,k=w+N*b;window.scrollTo(0,k),v<1?e.current=requestAnimationFrame(P):(e.current=null,t?.())};r(),e.current=requestAnimationFrame(P)},[t,r]),cancelScroll:r}};function qe(t){const e=o.useRef(null),r=z(),s=B(),u=o.useRef(!1),{scrollToElement:l,cancelScroll:c}=Ie(r?.onScrollComplete);return o.useEffect(()=>{typeof t=="function"?t(e.current):t&&(t.current=e.current)},[t]),o.useEffect(()=>{if(s&&r?.walkthroughStep!==void 0&&s.currentStep===r.walkthroughStep&&e.current&&!u.current){const _=e.current,h=_.getBoundingClientRect(),g=100;h.top>=-g&&h.bottom<=window.innerHeight+g&&h.left>=-g&&h.right<=window.innerWidth+g?r?.onScrollComplete?.():(r?.onScrollStart?.(),l(_)),u.current=!0}else s?.currentStep!==r?.walkthroughStep&&(u.current=!1,c())},[s?.currentStep,r?.walkthroughStep,s,l,c,r]),o.useEffect(()=>{e.current&&e.current.removeAttribute("aria-expanded")},[r?.isOpen]),o.useEffect(()=>c,[c]),{triggerRef:e,context:r}}const L=A.c.bind(I),ae=o.forwardRef(({children:t,className:e,highlight:r=!0,negative:s=!1,...u},l)=>{const{triggerRef:c,context:d}=qe(l);return n.jsxs("div",{className:L("purpur-popover__trigger",{"purpur-popover__trigger--highlight":d?.isOpen&&r},e),children:[d?.isOpen&&r&&n.jsxs(n.Fragment,{children:[n.jsx("div",{className:L("purpur-popover__trigger-highlight","purpur-popover__trigger-highlight--state1",{"purpur-popover__trigger-highlight--negative":s}),"aria-hidden":"true"}),n.jsx("div",{className:L("purpur-popover__trigger-highlight","purpur-popover__trigger-highlight--state2",{"purpur-popover__trigger-highlight--negative":s}),"aria-hidden":"true"})]}),n.jsx(F.Trigger,{ref:c,asChild:!0,"aria-haspopup":"dialog",...u,children:t})]})});ae.displayName="PopoverTrigger";function ze(t){const e=B(),[r,s]=o.useState(!1),[u,l]=o.useState(!1),c=o.useRef(null),d=o.useRef(0);o.useEffect(()=>e?(e.registerStep(t),()=>e.unregisterStep(t)):()=>{},[e,t]);const _=e?.currentStep===t,h=o.useCallback(()=>{l(!0)},[]),g=o.useCallback(()=>{if(l(!1),_){const f=e.openDelay;c.current=window.setTimeout(()=>{s(!0),d.current=Date.now()},f)}},[_,e]);o.useEffect(()=>{if(c.current&&(clearTimeout(c.current),c.current=null),_){if(!u){const f=e.openDelay;c.current=window.setTimeout(()=>{s(!0),d.current=Date.now()},f)}}else s(!1),l(!1),d.current=0;return()=>{c.current&&(clearTimeout(c.current),c.current=null)}},[_,u,e]);const a=o.useCallback((f,j)=>{if(j?.(f),!f&&r&&e&&e.currentStep===t){if(Date.now()-d.current<10||c.current!==null)return;e.dismiss()}},[r,e,t]);return{actuallyOpen:r,onScrollStart:h,onScrollComplete:g,handleOpenChange:a}}const pe=({children:t,step:e,onOpenChange:r,disableClickOutside:s=!0,...u})=>{const{actuallyOpen:l,onScrollStart:c,onScrollComplete:d,handleOpenChange:_}=ze(e);return n.jsx(F.Root2,{modal:!0,open:l,onOpenChange:h=>_(h,r),...u,children:n.jsx(Y.Provider,{value:{isOpen:l,walkthroughStep:e,onScrollStart:c,onScrollComplete:d,disableClickOutside:s},children:t})})};pe.displayName="PopoverWalkthrough";const y=t=>{const{multistep:e=!1,disableClickOutside:r,...s}=t;return e?n.jsx(pe,{...s,disableClickOutside:r??!0}):n.jsx(le,{...s,disableClickOutside:r})};y.Back=U;y.Button=V;y.Content=ue;y.Flow=Ce;y.Footer=Q;y.Next=G;y.Trigger=ae;y.displayName="Popover";exports.Popover=y;
|
|
2
|
+
//# sourceMappingURL=popover-BzoAQW0i.js.map
|