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