@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
package/dist/toast-BckKmAqz.js
DELETED
|
@@ -1,937 +0,0 @@
|
|
|
1
|
-
import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
|
2
|
-
import { createContext, forwardRef, useRef, useState, useEffect, useCallback, useMemo, useContext } from 'react';
|
|
3
|
-
import { c as cx } from './index-tZvMCc77.js';
|
|
4
|
-
import { B as Button } from './Button-d6MSiD0q-Cu4AHmR0.js';
|
|
5
|
-
import { A as Alert } from './Alert-DQbOVF2P-CWBL0dB1.js';
|
|
6
|
-
import { P as ProgressBar } from './ProgressBar-DAjwDjpq-DaeVMPEZ.js';
|
|
7
|
-
import { u as useSwipe } from './useSwipe-DIUHs7T5-DIUHs7T5.js';
|
|
8
|
-
import { S as SrOnly } from './SrOnly-BXm1DGl3-BJVodjQp.js';
|
|
9
|
-
import { u as useMergeRefs } from './useMergeRefs-Bde85AWI-Bde85AWI.js';
|
|
10
|
-
|
|
11
|
-
import './toast.css';/**
|
|
12
|
-
* Convert array of 16 byte values to UUID string format of the form:
|
|
13
|
-
* XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX
|
|
14
|
-
*/
|
|
15
|
-
var byteToHex = [];
|
|
16
|
-
for (var i = 0; i < 256; ++i) {
|
|
17
|
-
byteToHex.push((i + 0x100).toString(16).slice(1));
|
|
18
|
-
}
|
|
19
|
-
function unsafeStringify(arr, offset = 0) {
|
|
20
|
-
// Note: Be careful editing this code! It's been tuned for performance
|
|
21
|
-
// and works in ways you may not expect. See https://github.com/uuidjs/uuid/pull/434
|
|
22
|
-
//
|
|
23
|
-
// Note to future-self: No, you can't remove the `toLowerCase()` call.
|
|
24
|
-
// REF: https://github.com/uuidjs/uuid/pull/677#issuecomment-1757351351
|
|
25
|
-
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();
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
// Unique ID creation requires a high quality random # generator. In the browser we therefore
|
|
29
|
-
// require the crypto API and do not support built-in fallback to lower quality random number
|
|
30
|
-
// generators (like Math.random()).
|
|
31
|
-
|
|
32
|
-
var getRandomValues;
|
|
33
|
-
var rnds8 = new Uint8Array(16);
|
|
34
|
-
function rng() {
|
|
35
|
-
// lazy load so that environments that need to polyfill have a chance to do so
|
|
36
|
-
if (!getRandomValues) {
|
|
37
|
-
// getRandomValues needs to be invoked in a context where "this" is a Crypto implementation.
|
|
38
|
-
getRandomValues = typeof crypto !== 'undefined' && crypto.getRandomValues && crypto.getRandomValues.bind(crypto);
|
|
39
|
-
if (!getRandomValues) {
|
|
40
|
-
throw new Error('crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported');
|
|
41
|
-
}
|
|
42
|
-
}
|
|
43
|
-
return getRandomValues(rnds8);
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
var randomUUID = typeof crypto !== 'undefined' && crypto.randomUUID && crypto.randomUUID.bind(crypto);
|
|
47
|
-
const native = {
|
|
48
|
-
randomUUID
|
|
49
|
-
};
|
|
50
|
-
|
|
51
|
-
function v4(options, buf, offset) {
|
|
52
|
-
if (native.randomUUID && true && !options) {
|
|
53
|
-
return native.randomUUID();
|
|
54
|
-
}
|
|
55
|
-
options = options || {};
|
|
56
|
-
var rnds = options.random || (options.rng || rng)();
|
|
57
|
-
|
|
58
|
-
// Per 4.4, set bits for version and `clock_seq_hi_and_reserved`
|
|
59
|
-
rnds[6] = rnds[6] & 0x0f | 0x40;
|
|
60
|
-
rnds[8] = rnds[8] & 0x3f | 0x80;
|
|
61
|
-
return unsafeStringify(rnds);
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
const toaster = "_toaster_nxs96_3";
|
|
65
|
-
const hidden = "_hidden_nxs96_65";
|
|
66
|
-
const stacked = "_stacked_nxs96_72";
|
|
67
|
-
const open = "_open_nxs96_164";
|
|
68
|
-
const close = "_close_nxs96_165";
|
|
69
|
-
const slideIn = "_slideIn_nxs96_1";
|
|
70
|
-
const slideOut = "_slideOut_nxs96_1";
|
|
71
|
-
const styles = {
|
|
72
|
-
toaster: toaster,
|
|
73
|
-
"toast-wrapper": "_toast-wrapper_nxs96_28",
|
|
74
|
-
"toast-alert": "_toast-alert_nxs96_42",
|
|
75
|
-
"alert-action": "_alert-action_nxs96_47",
|
|
76
|
-
"message-container": "_message-container_nxs96_53",
|
|
77
|
-
"show-extra-toast": "_show-extra-toast_nxs96_62",
|
|
78
|
-
hidden: hidden,
|
|
79
|
-
stacked: stacked,
|
|
80
|
-
"stack-one": "_stack-one_nxs96_75",
|
|
81
|
-
"stack-two": "_stack-two_nxs96_75",
|
|
82
|
-
"stacked-show-extra": "_stacked-show-extra_nxs96_91",
|
|
83
|
-
"stacked-extra": "_stacked-extra_nxs96_105",
|
|
84
|
-
"show-more-button-container": "_show-more-button-container_nxs96_118",
|
|
85
|
-
"show-collapse-button-container": "_show-collapse-button-container_nxs96_119",
|
|
86
|
-
"show-collapse-button": "_show-collapse-button_nxs96_119",
|
|
87
|
-
open: open,
|
|
88
|
-
close: close,
|
|
89
|
-
slideIn: slideIn,
|
|
90
|
-
slideOut: slideOut
|
|
91
|
-
};
|
|
92
|
-
|
|
93
|
-
const ToastProviderContext = createContext({
|
|
94
|
-
toasts: [],
|
|
95
|
-
setToasts: () => [],
|
|
96
|
-
toastHeights: [],
|
|
97
|
-
setToastHeights: () => [],
|
|
98
|
-
getToasterHeight: () => 0,
|
|
99
|
-
toastsBeforeStack: 3,
|
|
100
|
-
setToastsBeforeStack: () => [],
|
|
101
|
-
extraToastsVisible: false,
|
|
102
|
-
setExtraToastsVisible: () => []
|
|
103
|
-
});
|
|
104
|
-
const ToastProvider = (children) => {
|
|
105
|
-
const [toasts, setToasts] = useState([]);
|
|
106
|
-
const [toastHeights, setToastHeights] = useState([]);
|
|
107
|
-
const [toastsBeforeStack, setToastsBeforeStack] = useState(3);
|
|
108
|
-
const [extraToastsVisible, setExtraToastsVisible] = useState(false);
|
|
109
|
-
const removeDuplicateToasts = (toasts2) => {
|
|
110
|
-
const toastIds = /* @__PURE__ */ new Set();
|
|
111
|
-
const uniqueToasts = toasts2.filter((toast) => {
|
|
112
|
-
if (toastIds.has(toast.id)) {
|
|
113
|
-
console.error(
|
|
114
|
-
`Encountered toast with duplicate id ${toast.id}. Each toast id needs to be unique.`
|
|
115
|
-
);
|
|
116
|
-
return false;
|
|
117
|
-
} else {
|
|
118
|
-
toastIds.add(toast.id);
|
|
119
|
-
return true;
|
|
120
|
-
}
|
|
121
|
-
});
|
|
122
|
-
return uniqueToasts;
|
|
123
|
-
};
|
|
124
|
-
useEffect(() => {
|
|
125
|
-
const uniqueToasts = removeDuplicateToasts(toasts);
|
|
126
|
-
if (toasts.length !== uniqueToasts.length) {
|
|
127
|
-
setToasts(uniqueToasts);
|
|
128
|
-
}
|
|
129
|
-
}, [toasts]);
|
|
130
|
-
const getToasterHeight = useCallback(
|
|
131
|
-
(index) => {
|
|
132
|
-
const toastHeightsOnly = toastHeights.filter((t, i) => {
|
|
133
|
-
return index !== undefined ? i > index : true;
|
|
134
|
-
}).map((t) => t.height);
|
|
135
|
-
if (toastHeightsOnly.length > 0) {
|
|
136
|
-
if (extraToastsVisible) {
|
|
137
|
-
return toastHeightsOnly.reduce((totalHeight, currentHeight) => {
|
|
138
|
-
return totalHeight + currentHeight;
|
|
139
|
-
});
|
|
140
|
-
}
|
|
141
|
-
return toastHeightsOnly.filter((t, i) => i >= toastHeightsOnly.length - toastsBeforeStack).reduce((totalHeight, currentHeight) => {
|
|
142
|
-
return totalHeight + currentHeight;
|
|
143
|
-
});
|
|
144
|
-
}
|
|
145
|
-
return 0;
|
|
146
|
-
},
|
|
147
|
-
[toastHeights, extraToastsVisible, toastsBeforeStack]
|
|
148
|
-
);
|
|
149
|
-
const value = useMemo(
|
|
150
|
-
() => ({
|
|
151
|
-
toasts,
|
|
152
|
-
setToasts,
|
|
153
|
-
toastHeights,
|
|
154
|
-
setToastHeights,
|
|
155
|
-
getToasterHeight,
|
|
156
|
-
toastsBeforeStack,
|
|
157
|
-
setToastsBeforeStack,
|
|
158
|
-
extraToastsVisible,
|
|
159
|
-
setExtraToastsVisible
|
|
160
|
-
}),
|
|
161
|
-
[
|
|
162
|
-
extraToastsVisible,
|
|
163
|
-
getToasterHeight,
|
|
164
|
-
toastHeights,
|
|
165
|
-
toasts,
|
|
166
|
-
toastsBeforeStack
|
|
167
|
-
]
|
|
168
|
-
);
|
|
169
|
-
return /* @__PURE__ */ jsx(ToastProviderContext.Provider, { value, ...children });
|
|
170
|
-
};
|
|
171
|
-
const useToasts = () => {
|
|
172
|
-
const context = useContext(ToastProviderContext);
|
|
173
|
-
if (context == null) {
|
|
174
|
-
throw new Error("useToasts must be wrapped in <ToastProvider />");
|
|
175
|
-
}
|
|
176
|
-
return context;
|
|
177
|
-
};
|
|
178
|
-
|
|
179
|
-
const toast$1 = () => {
|
|
180
|
-
const toastMethods = [
|
|
181
|
-
"info",
|
|
182
|
-
"success",
|
|
183
|
-
"warning",
|
|
184
|
-
"danger",
|
|
185
|
-
"promise",
|
|
186
|
-
"update",
|
|
187
|
-
"dismiss"
|
|
188
|
-
];
|
|
189
|
-
console.error(
|
|
190
|
-
"Please use one of the following toast methods:\n",
|
|
191
|
-
...toastMethods.map((m) => ` toast.${m}()
|
|
192
|
-
`)
|
|
193
|
-
);
|
|
194
|
-
};
|
|
195
|
-
const TOAST_EVENT_NAME = "hammer-toast";
|
|
196
|
-
const TOAST_TYPES = ["info", "success", "warning", "danger"];
|
|
197
|
-
const methods = {};
|
|
198
|
-
TOAST_TYPES.forEach((type) => {
|
|
199
|
-
methods[type] = (props) => {
|
|
200
|
-
const uniqueId = v4();
|
|
201
|
-
const ToastAddEvent = new CustomEvent(TOAST_EVENT_NAME, {
|
|
202
|
-
composed: true,
|
|
203
|
-
detail: {
|
|
204
|
-
id: uniqueId,
|
|
205
|
-
eventType: "add",
|
|
206
|
-
status: type,
|
|
207
|
-
createdAt: Date.now(),
|
|
208
|
-
...props
|
|
209
|
-
}
|
|
210
|
-
});
|
|
211
|
-
dispatchEvent(ToastAddEvent);
|
|
212
|
-
return uniqueId;
|
|
213
|
-
};
|
|
214
|
-
});
|
|
215
|
-
const update = (id, props) => {
|
|
216
|
-
const ToastEvent = new CustomEvent(
|
|
217
|
-
TOAST_EVENT_NAME,
|
|
218
|
-
{
|
|
219
|
-
composed: true,
|
|
220
|
-
detail: {
|
|
221
|
-
eventType: "update",
|
|
222
|
-
id,
|
|
223
|
-
...props
|
|
224
|
-
}
|
|
225
|
-
}
|
|
226
|
-
);
|
|
227
|
-
dispatchEvent(ToastEvent);
|
|
228
|
-
};
|
|
229
|
-
const dismiss = (id) => {
|
|
230
|
-
const ToastEvent = new CustomEvent(
|
|
231
|
-
TOAST_EVENT_NAME,
|
|
232
|
-
{
|
|
233
|
-
composed: true,
|
|
234
|
-
detail: {
|
|
235
|
-
eventType: "dismiss",
|
|
236
|
-
id
|
|
237
|
-
}
|
|
238
|
-
}
|
|
239
|
-
);
|
|
240
|
-
dispatchEvent(ToastEvent);
|
|
241
|
-
};
|
|
242
|
-
const promise = async (promise2, toastConfig) => {
|
|
243
|
-
const { onClose, ...loadingToastConfig } = toastConfig.loading;
|
|
244
|
-
let closedWhileLoading = false;
|
|
245
|
-
const onCloseWhileLoading = (e) => {
|
|
246
|
-
toastConfig.loading.onClose?.(e);
|
|
247
|
-
closedWhileLoading = true;
|
|
248
|
-
};
|
|
249
|
-
const id = toast$1.info({
|
|
250
|
-
...loadingToastConfig,
|
|
251
|
-
onClose: onCloseWhileLoading,
|
|
252
|
-
duration: false
|
|
253
|
-
});
|
|
254
|
-
await Promise.resolve(promise2).then((res) => {
|
|
255
|
-
if (closedWhileLoading) {
|
|
256
|
-
toast$1.success({
|
|
257
|
-
...toastConfig.success(res)
|
|
258
|
-
});
|
|
259
|
-
} else {
|
|
260
|
-
toast$1.update(id, {
|
|
261
|
-
...toastConfig.success(res),
|
|
262
|
-
status: "success"
|
|
263
|
-
});
|
|
264
|
-
}
|
|
265
|
-
}).catch((err) => {
|
|
266
|
-
if (closedWhileLoading) {
|
|
267
|
-
toast$1.danger({
|
|
268
|
-
...toastConfig.error(err)
|
|
269
|
-
});
|
|
270
|
-
} else {
|
|
271
|
-
toast$1.update(id, {
|
|
272
|
-
...toastConfig.error(err),
|
|
273
|
-
status: "danger"
|
|
274
|
-
});
|
|
275
|
-
}
|
|
276
|
-
});
|
|
277
|
-
return id;
|
|
278
|
-
};
|
|
279
|
-
toast$1.info = methods.info;
|
|
280
|
-
toast$1.success = methods.success;
|
|
281
|
-
toast$1.warning = methods.warning;
|
|
282
|
-
toast$1.danger = methods.danger;
|
|
283
|
-
toast$1.update = update;
|
|
284
|
-
toast$1.dismiss = dismiss;
|
|
285
|
-
toast$1.promise = promise;
|
|
286
|
-
|
|
287
|
-
const useShowMoreButtonPositionStyles = () => {
|
|
288
|
-
const { toastHeights, toastsBeforeStack } = useToasts();
|
|
289
|
-
const totalToasts = toastHeights.length;
|
|
290
|
-
const extraSpace = totalToasts > toastsBeforeStack + 1 ? "2rem" : "1rem";
|
|
291
|
-
const top = useMemo(() => {
|
|
292
|
-
if (totalToasts > toastsBeforeStack) {
|
|
293
|
-
return toastHeights.filter((t, i) => i >= totalToasts - toastsBeforeStack).map((t) => t.height).reduce((t, c) => t + c);
|
|
294
|
-
}
|
|
295
|
-
return "unset";
|
|
296
|
-
}, [toastHeights, toastsBeforeStack]);
|
|
297
|
-
return {
|
|
298
|
-
// -0.75px fixes hover issue when 1rem != 16px due to pixel rounding
|
|
299
|
-
top: `calc(${top}px + ${extraSpace} - 0.75px)`,
|
|
300
|
-
position: "absolute",
|
|
301
|
-
display: totalToasts > toastsBeforeStack ? undefined : "none"
|
|
302
|
-
};
|
|
303
|
-
};
|
|
304
|
-
const STACKED_TOAST_HEIGHT = "5.3125rem";
|
|
305
|
-
const STACKED_TOAST_PEEK_HEIGHT = "1rem";
|
|
306
|
-
const TOAST_GAP = `${24 / 16}rem`;
|
|
307
|
-
const useToastPositionStyles = (index) => {
|
|
308
|
-
const {
|
|
309
|
-
toasts,
|
|
310
|
-
toastHeights,
|
|
311
|
-
getToasterHeight,
|
|
312
|
-
toastsBeforeStack,
|
|
313
|
-
extraToastsVisible
|
|
314
|
-
} = useToasts();
|
|
315
|
-
const toastCount = toasts.length;
|
|
316
|
-
const toasterHeight = getToasterHeight(index);
|
|
317
|
-
return useMemo(() => {
|
|
318
|
-
if (index === toastCount - 1) {
|
|
319
|
-
return {
|
|
320
|
-
top: TOAST_GAP,
|
|
321
|
-
zIndex: 3
|
|
322
|
-
};
|
|
323
|
-
} else if (
|
|
324
|
-
// all toasts when show more is clicked
|
|
325
|
-
extraToastsVisible || // or visible toasts when stacked
|
|
326
|
-
!extraToastsVisible && (toastCount <= toastsBeforeStack || toastCount > toastsBeforeStack && index >= toastCount - toastsBeforeStack)
|
|
327
|
-
) {
|
|
328
|
-
return {
|
|
329
|
-
top: `calc(${toasterHeight}px + ${TOAST_GAP})`
|
|
330
|
-
};
|
|
331
|
-
} else {
|
|
332
|
-
if (toastCount > toastsBeforeStack) {
|
|
333
|
-
if (index === toastCount - toastsBeforeStack - 1) {
|
|
334
|
-
return {
|
|
335
|
-
top: `calc(${toasterHeight || 0}px - ${STACKED_TOAST_HEIGHT} +
|
|
336
|
-
${STACKED_TOAST_PEEK_HEIGHT})`,
|
|
337
|
-
zIndex: 1
|
|
338
|
-
};
|
|
339
|
-
} else if (index <= toastCount - toastsBeforeStack - 2) {
|
|
340
|
-
return {
|
|
341
|
-
top: `calc(${toasterHeight || 0}px -
|
|
342
|
-
${STACKED_TOAST_HEIGHT}
|
|
343
|
-
+ ${STACKED_TOAST_PEEK_HEIGHT} * 2)`,
|
|
344
|
-
zIndex: 0
|
|
345
|
-
};
|
|
346
|
-
}
|
|
347
|
-
}
|
|
348
|
-
}
|
|
349
|
-
return undefined;
|
|
350
|
-
}, [toastHeights]);
|
|
351
|
-
};
|
|
352
|
-
const addOrUpdateToastHeight = (toastId, toastHeight, setToastHeights) => {
|
|
353
|
-
setToastHeights((prev) => {
|
|
354
|
-
if (prev.find((t) => t.id === toastId)) {
|
|
355
|
-
return prev.map((t) => {
|
|
356
|
-
if (t.id === toastId) {
|
|
357
|
-
return { ...t, height: toastHeight };
|
|
358
|
-
}
|
|
359
|
-
return t;
|
|
360
|
-
});
|
|
361
|
-
}
|
|
362
|
-
return [
|
|
363
|
-
...prev,
|
|
364
|
-
{
|
|
365
|
-
id: toastId,
|
|
366
|
-
height: toastHeight
|
|
367
|
-
}
|
|
368
|
-
];
|
|
369
|
-
});
|
|
370
|
-
};
|
|
371
|
-
const setToastsAfterClose = (setToasts, setToastHeights, id) => {
|
|
372
|
-
setToasts((prev) => id ? prev.filter((t) => t.id !== id) : []);
|
|
373
|
-
setToastHeights((prev) => id ? prev.filter((t) => t.id !== id) : []);
|
|
374
|
-
};
|
|
375
|
-
const closeToast = (setToasts, setToastHeights, closingToastClassName, id) => {
|
|
376
|
-
const prefersReducedMotion = globalThis.matchMedia(
|
|
377
|
-
`(prefers-reduced-motion: reduce)`
|
|
378
|
-
).matches;
|
|
379
|
-
if (prefersReducedMotion) {
|
|
380
|
-
setToastsAfterClose(setToasts, setToastHeights, id);
|
|
381
|
-
} else {
|
|
382
|
-
setToasts(
|
|
383
|
-
(prev) => prev.map((t) => {
|
|
384
|
-
if (!id || t.id === id) {
|
|
385
|
-
return {
|
|
386
|
-
...t,
|
|
387
|
-
toastClassName: closingToastClassName
|
|
388
|
-
};
|
|
389
|
-
}
|
|
390
|
-
return t;
|
|
391
|
-
})
|
|
392
|
-
);
|
|
393
|
-
setTimeout(() => {
|
|
394
|
-
setToastsAfterClose(setToasts, setToastHeights, id);
|
|
395
|
-
}, 290);
|
|
396
|
-
}
|
|
397
|
-
};
|
|
398
|
-
const useCloseToast = (closingToastClassName) => {
|
|
399
|
-
const { setToasts, setToastHeights } = useToasts();
|
|
400
|
-
return (id) => {
|
|
401
|
-
closeToast(setToasts, setToastHeights, closingToastClassName, id);
|
|
402
|
-
};
|
|
403
|
-
};
|
|
404
|
-
|
|
405
|
-
const Toast = forwardRef(
|
|
406
|
-
({
|
|
407
|
-
actions,
|
|
408
|
-
containerClassName,
|
|
409
|
-
createdAt,
|
|
410
|
-
duration,
|
|
411
|
-
index = 0,
|
|
412
|
-
isBelowStackIndex,
|
|
413
|
-
isStacked,
|
|
414
|
-
message,
|
|
415
|
-
onClose,
|
|
416
|
-
onDismiss,
|
|
417
|
-
pausedStatus,
|
|
418
|
-
progress,
|
|
419
|
-
toastClassName,
|
|
420
|
-
...alertProps
|
|
421
|
-
}, ref) => {
|
|
422
|
-
const { setToastHeights, extraToastsVisible } = useToasts();
|
|
423
|
-
const closeToast = useCloseToast(styles.close);
|
|
424
|
-
const toastPositionStyles = useToastPositionStyles(index);
|
|
425
|
-
const toastWrapperRef = useRef(null);
|
|
426
|
-
const timerRef = useRef();
|
|
427
|
-
const pausedAtRef = useRef(0);
|
|
428
|
-
const createdAtRef = useRef(createdAt ?? 0);
|
|
429
|
-
const hasBeenStackedRef = useRef(false);
|
|
430
|
-
const [transitionClass, setTransitionClass] = useState(
|
|
431
|
-
styles.hidden
|
|
432
|
-
);
|
|
433
|
-
const [toastOpened, setToastOpened] = useState(false);
|
|
434
|
-
const alertClasses = cx(
|
|
435
|
-
styles["toast-alert"],
|
|
436
|
-
toastClassName,
|
|
437
|
-
transitionClass
|
|
438
|
-
);
|
|
439
|
-
useEffect(() => {
|
|
440
|
-
if (!toastOpened) {
|
|
441
|
-
setTransitionClass(styles.open);
|
|
442
|
-
setToastOpened(true);
|
|
443
|
-
}
|
|
444
|
-
return () => {
|
|
445
|
-
onDismiss?.();
|
|
446
|
-
};
|
|
447
|
-
}, []);
|
|
448
|
-
useEffect(() => {
|
|
449
|
-
if (toastWrapperRef.current && toastOpened && !isStacked) {
|
|
450
|
-
if (isBelowStackIndex && extraToastsVisible) {
|
|
451
|
-
setTimeout(() => {
|
|
452
|
-
const height = toastWrapperRef.current?.clientHeight;
|
|
453
|
-
addOrUpdateToastHeight(alertProps.id, height ?? 0, setToastHeights);
|
|
454
|
-
}, 300);
|
|
455
|
-
} else {
|
|
456
|
-
const height = toastWrapperRef.current.clientHeight;
|
|
457
|
-
addOrUpdateToastHeight(alertProps.id, height, setToastHeights);
|
|
458
|
-
}
|
|
459
|
-
}
|
|
460
|
-
}, [
|
|
461
|
-
toastOpened,
|
|
462
|
-
isStacked,
|
|
463
|
-
extraToastsVisible,
|
|
464
|
-
// toast updates
|
|
465
|
-
actions,
|
|
466
|
-
message,
|
|
467
|
-
alertProps.title
|
|
468
|
-
]);
|
|
469
|
-
useEffect(() => {
|
|
470
|
-
if (duration && !isStacked) {
|
|
471
|
-
if (!pausedStatus) {
|
|
472
|
-
timerRef.current = setTimeout(
|
|
473
|
-
() => closeToast(alertProps.id),
|
|
474
|
-
duration
|
|
475
|
-
);
|
|
476
|
-
return () => clearTimeout(timerRef.current);
|
|
477
|
-
} else if (typeof pausedStatus === "number") {
|
|
478
|
-
clearTimeout(timerRef.current);
|
|
479
|
-
pausedAtRef.current = pausedStatus;
|
|
480
|
-
} else if (pausedStatus === "resumed") {
|
|
481
|
-
const remainingDuration = (
|
|
482
|
-
// rendering new toast after initial hover
|
|
483
|
-
pausedAtRef.current === 0 ? duration : (
|
|
484
|
-
// resume timer after valid hover
|
|
485
|
-
duration + (createdAtRef.current || 0) - pausedAtRef.current
|
|
486
|
-
)
|
|
487
|
-
);
|
|
488
|
-
timerRef.current = setTimeout(() => {
|
|
489
|
-
closeToast(alertProps.id);
|
|
490
|
-
pausedAtRef.current = 0;
|
|
491
|
-
}, remainingDuration);
|
|
492
|
-
return () => clearTimeout(timerRef.current);
|
|
493
|
-
}
|
|
494
|
-
}
|
|
495
|
-
}, [createdAtRef.current, duration, pausedStatus]);
|
|
496
|
-
useEffect(() => {
|
|
497
|
-
if (duration) {
|
|
498
|
-
if (isStacked) {
|
|
499
|
-
clearTimeout(timerRef.current);
|
|
500
|
-
hasBeenStackedRef.current = true;
|
|
501
|
-
} else if (!isStacked && hasBeenStackedRef.current && !(typeof pausedStatus === "number")) {
|
|
502
|
-
createdAtRef.current = Date.now();
|
|
503
|
-
timerRef.current = setTimeout(() => {
|
|
504
|
-
closeToast(alertProps.id);
|
|
505
|
-
hasBeenStackedRef.current = false;
|
|
506
|
-
}, duration);
|
|
507
|
-
return () => clearTimeout(timerRef.current);
|
|
508
|
-
}
|
|
509
|
-
}
|
|
510
|
-
}, [isStacked, duration]);
|
|
511
|
-
const onSwipe = (dir) => {
|
|
512
|
-
if (dir === "right") {
|
|
513
|
-
toast$1.dismiss(alertProps.id);
|
|
514
|
-
return;
|
|
515
|
-
}
|
|
516
|
-
};
|
|
517
|
-
const { direction, ...touchProps } = useSwipe(onSwipe);
|
|
518
|
-
const alertCloseProps = isStacked && !extraToastsVisible ? {} : {
|
|
519
|
-
onClose
|
|
520
|
-
};
|
|
521
|
-
if (duration !== false && actions) {
|
|
522
|
-
throw new Error(
|
|
523
|
-
"If actions are provided to toast message, duration must be false."
|
|
524
|
-
);
|
|
525
|
-
}
|
|
526
|
-
const hasMessage = message && message !== "";
|
|
527
|
-
const hasProgress = progress != null;
|
|
528
|
-
const hasActions = actions && duration === false;
|
|
529
|
-
return /* @__PURE__ */ jsx(
|
|
530
|
-
"div",
|
|
531
|
-
{
|
|
532
|
-
"data-anv": "toast",
|
|
533
|
-
className: containerClassName,
|
|
534
|
-
style: toastPositionStyles ?? { top: "1.5rem" },
|
|
535
|
-
ref: toastWrapperRef,
|
|
536
|
-
onAnimationStart: () => setToastOpened(true),
|
|
537
|
-
role: isStacked ? "presentation" : undefined,
|
|
538
|
-
...touchProps,
|
|
539
|
-
children: /* @__PURE__ */ jsx(
|
|
540
|
-
Alert,
|
|
541
|
-
{
|
|
542
|
-
className: alertClasses,
|
|
543
|
-
...alertProps,
|
|
544
|
-
...alertCloseProps,
|
|
545
|
-
ref,
|
|
546
|
-
tabIndex: isStacked && !extraToastsVisible ? -1 : 0,
|
|
547
|
-
children: hasMessage || hasProgress || hasActions ? /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
548
|
-
hasMessage ? /* @__PURE__ */ jsx(
|
|
549
|
-
"div",
|
|
550
|
-
{
|
|
551
|
-
className: styles["message-container"],
|
|
552
|
-
id: `toast-message-${alertProps.id}`,
|
|
553
|
-
children: message
|
|
554
|
-
}
|
|
555
|
-
) : null,
|
|
556
|
-
hasProgress ? /* @__PURE__ */ jsx(Fragment, { children: progress === "indeterminate" ? /* @__PURE__ */ jsx(
|
|
557
|
-
ProgressBar,
|
|
558
|
-
{
|
|
559
|
-
"aria-labelledby": `toast-message-${alertProps.id}`,
|
|
560
|
-
indeterminate: true
|
|
561
|
-
}
|
|
562
|
-
) : /* @__PURE__ */ jsx(
|
|
563
|
-
ProgressBar,
|
|
564
|
-
{
|
|
565
|
-
"aria-labelledby": `toast-message-${alertProps.id}`,
|
|
566
|
-
value: progress
|
|
567
|
-
}
|
|
568
|
-
) }) : null,
|
|
569
|
-
hasActions ? /* @__PURE__ */ jsxs("div", { className: styles["alert-action"], children: [
|
|
570
|
-
/* @__PURE__ */ jsx(
|
|
571
|
-
Button,
|
|
572
|
-
{
|
|
573
|
-
appearance: actions.primary.appearance,
|
|
574
|
-
onClick: actions.primary.onClick,
|
|
575
|
-
size: "small",
|
|
576
|
-
children: actions.primary.label
|
|
577
|
-
}
|
|
578
|
-
),
|
|
579
|
-
actions.secondary && /* @__PURE__ */ jsx(
|
|
580
|
-
Button,
|
|
581
|
-
{
|
|
582
|
-
appearance: actions.secondary.appearance,
|
|
583
|
-
onClick: actions.secondary.onClick,
|
|
584
|
-
size: "small",
|
|
585
|
-
children: actions.secondary.label
|
|
586
|
-
}
|
|
587
|
-
)
|
|
588
|
-
] }) : null
|
|
589
|
-
] }) : null
|
|
590
|
-
}
|
|
591
|
-
)
|
|
592
|
-
}
|
|
593
|
-
);
|
|
594
|
-
}
|
|
595
|
-
);
|
|
596
|
-
Toast.displayName = "Toast";
|
|
597
|
-
|
|
598
|
-
function useHotkeyFocus({
|
|
599
|
-
disabled,
|
|
600
|
-
hotkey,
|
|
601
|
-
onHotkeyIn,
|
|
602
|
-
onHotkeyOut,
|
|
603
|
-
refToFocus,
|
|
604
|
-
rootRef
|
|
605
|
-
}) {
|
|
606
|
-
const [shouldEscapeRefocus, setShouldEscapeRefocus] = useState(false);
|
|
607
|
-
const previousFocusElement = useRef(null);
|
|
608
|
-
useEffect(() => {
|
|
609
|
-
if (disabled || typeof document === "undefined") return;
|
|
610
|
-
const rootElement = rootRef.current;
|
|
611
|
-
const blurHandler = (e) => {
|
|
612
|
-
if (e.relatedTarget && rootElement.contains(e.relatedTarget)) {
|
|
613
|
-
return;
|
|
614
|
-
}
|
|
615
|
-
setShouldEscapeRefocus(false);
|
|
616
|
-
};
|
|
617
|
-
const keyDownHandler = async (e) => {
|
|
618
|
-
const activeElement = document.activeElement?.shadowRoot?.activeElement || document.activeElement;
|
|
619
|
-
if (activeElement?.tagName.toLowerCase() !== "input" && activeElement?.tagName.toLowerCase() !== "textarea" && activeElement?.tagName.toLowerCase() !== "pre" && e.key === hotkey) {
|
|
620
|
-
e.preventDefault();
|
|
621
|
-
previousFocusElement.current = activeElement;
|
|
622
|
-
await onHotkeyIn?.();
|
|
623
|
-
if (refToFocus.current) {
|
|
624
|
-
refToFocus.current.focus();
|
|
625
|
-
setShouldEscapeRefocus(true);
|
|
626
|
-
if (refToFocus.current.scrollTo) {
|
|
627
|
-
refToFocus.current.scrollTo();
|
|
628
|
-
}
|
|
629
|
-
}
|
|
630
|
-
} else if (e.code === "Escape" && shouldEscapeRefocus) {
|
|
631
|
-
onHotkeyOut?.();
|
|
632
|
-
if (previousFocusElement.current && previousFocusElement.current.tagName.toLowerCase() !== "body") {
|
|
633
|
-
previousFocusElement.current.focus();
|
|
634
|
-
} else {
|
|
635
|
-
activeElement.blur();
|
|
636
|
-
}
|
|
637
|
-
}
|
|
638
|
-
};
|
|
639
|
-
document.addEventListener("keydown", keyDownHandler);
|
|
640
|
-
rootElement.addEventListener("focusout", blurHandler);
|
|
641
|
-
return () => {
|
|
642
|
-
document.removeEventListener("keydown", keyDownHandler);
|
|
643
|
-
rootElement.removeEventListener("focusout", blurHandler);
|
|
644
|
-
};
|
|
645
|
-
}, [
|
|
646
|
-
hotkey,
|
|
647
|
-
disabled,
|
|
648
|
-
rootRef,
|
|
649
|
-
shouldEscapeRefocus,
|
|
650
|
-
onHotkeyIn,
|
|
651
|
-
refToFocus,
|
|
652
|
-
onHotkeyOut
|
|
653
|
-
]);
|
|
654
|
-
return { returnFocusRef: previousFocusElement };
|
|
655
|
-
}
|
|
656
|
-
|
|
657
|
-
const Toaster$1 = forwardRef(
|
|
658
|
-
(props, ref) => {
|
|
659
|
-
return /* @__PURE__ */ jsx(ToastProvider, { children: /* @__PURE__ */ jsx(ToasterContent, { ...props, ...ref }) });
|
|
660
|
-
}
|
|
661
|
-
);
|
|
662
|
-
const ToasterContent = forwardRef(
|
|
663
|
-
({
|
|
664
|
-
className,
|
|
665
|
-
duration = false,
|
|
666
|
-
focusKey = "t",
|
|
667
|
-
forceRender = false,
|
|
668
|
-
id,
|
|
669
|
-
toastsBeforeStack = 3,
|
|
670
|
-
...props
|
|
671
|
-
}, ref) => {
|
|
672
|
-
const toasterRef = useRef(null);
|
|
673
|
-
const firstToastRef = useRef(null);
|
|
674
|
-
const mergedToasterRef = useMergeRefs([toasterRef, ref]);
|
|
675
|
-
const {
|
|
676
|
-
toasts,
|
|
677
|
-
setToastsBeforeStack,
|
|
678
|
-
extraToastsVisible,
|
|
679
|
-
setExtraToastsVisible,
|
|
680
|
-
setToasts,
|
|
681
|
-
getToasterHeight
|
|
682
|
-
} = useToasts();
|
|
683
|
-
const toastCount = toasts.length;
|
|
684
|
-
const lastToastCount = useRef(0);
|
|
685
|
-
const a1ToastGroupObserver = useRef(null);
|
|
686
|
-
const a1ToastGroupObserverConnected = useRef(false);
|
|
687
|
-
const closeToast = useCloseToast(styles.close);
|
|
688
|
-
const [toasterHeight, setToasterHeight] = useState(0);
|
|
689
|
-
const [a1ToastGroups, setA1ToastGroups] = useState([]);
|
|
690
|
-
const updateA1ToastGroups = () => {
|
|
691
|
-
const mfeRoots = document.querySelectorAll(
|
|
692
|
-
"[data-mfe-portal-name],[data-mfe-name]"
|
|
693
|
-
);
|
|
694
|
-
const a1ToastGroupsLocal = [
|
|
695
|
-
...document.getElementsByClassName("ToastGroup")
|
|
696
|
-
];
|
|
697
|
-
if (mfeRoots.length > 0) {
|
|
698
|
-
mfeRoots.forEach((el) => {
|
|
699
|
-
setTimeout(() => {
|
|
700
|
-
if (el.shadowRoot) {
|
|
701
|
-
a1ToastGroupsLocal.push(
|
|
702
|
-
...el.shadowRoot.querySelectorAll(".ToastGroup")
|
|
703
|
-
);
|
|
704
|
-
}
|
|
705
|
-
setA1ToastGroups(a1ToastGroupsLocal);
|
|
706
|
-
});
|
|
707
|
-
});
|
|
708
|
-
} else {
|
|
709
|
-
setA1ToastGroups(a1ToastGroupsLocal);
|
|
710
|
-
}
|
|
711
|
-
};
|
|
712
|
-
const handleToasterBlur = useCallback(() => {
|
|
713
|
-
setExtraToastsVisible(false);
|
|
714
|
-
setToastPausedStatus("resumed");
|
|
715
|
-
if (toasterRef.current?.scrollTo) {
|
|
716
|
-
toasterRef.current?.scrollTo(0, 0);
|
|
717
|
-
}
|
|
718
|
-
}, [setExtraToastsVisible]);
|
|
719
|
-
useEffect(() => {
|
|
720
|
-
const toastEventListener = (e) => {
|
|
721
|
-
const toasters = document.querySelectorAll("[data-anv='toaster']");
|
|
722
|
-
const shadowToasters = toasterRef.current?.getRootNode()?.querySelectorAll("[data-anv='toaster']") || [];
|
|
723
|
-
if (toasters.length && id !== toasters[0].getAttribute("data-toaster-id")) {
|
|
724
|
-
return;
|
|
725
|
-
} else if (
|
|
726
|
-
// Toaster(s) exist in the shadow dom, bail out if this toaster is not the first one
|
|
727
|
-
shadowToasters.length && id !== shadowToasters[0].getAttribute("data-toaster-id")
|
|
728
|
-
) {
|
|
729
|
-
return;
|
|
730
|
-
}
|
|
731
|
-
const { eventType, ...toastProps } = e.detail;
|
|
732
|
-
if (eventType === "add") {
|
|
733
|
-
const toastAddProps = toastProps;
|
|
734
|
-
if (!toastAddProps.toasterId || toastAddProps.toasterId === id) {
|
|
735
|
-
setToasts((prev) => [...prev, toastProps]);
|
|
736
|
-
}
|
|
737
|
-
} else if (eventType === "update") {
|
|
738
|
-
setToasts((prev) => {
|
|
739
|
-
return prev.map((t) => {
|
|
740
|
-
if (t.id === toastProps.id) {
|
|
741
|
-
return {
|
|
742
|
-
...t,
|
|
743
|
-
...toastProps
|
|
744
|
-
};
|
|
745
|
-
} else {
|
|
746
|
-
return t;
|
|
747
|
-
}
|
|
748
|
-
});
|
|
749
|
-
});
|
|
750
|
-
} else if (eventType === "dismiss") {
|
|
751
|
-
if (toastProps.id) {
|
|
752
|
-
closeToast(toastProps.id);
|
|
753
|
-
} else {
|
|
754
|
-
closeToast();
|
|
755
|
-
}
|
|
756
|
-
}
|
|
757
|
-
};
|
|
758
|
-
window.addEventListener("hammer-toast", toastEventListener);
|
|
759
|
-
a1ToastGroupObserver.current = new MutationObserver(updateA1ToastGroups);
|
|
760
|
-
return () => window.removeEventListener("hammer-toast", toastEventListener);
|
|
761
|
-
}, []);
|
|
762
|
-
useEffect(() => {
|
|
763
|
-
if (a1ToastGroupObserver.current !== null) {
|
|
764
|
-
if (toastCount > 0 && a1ToastGroupObserverConnected.current === false) {
|
|
765
|
-
a1ToastGroupObserver.current.observe(document.body, {
|
|
766
|
-
childList: true,
|
|
767
|
-
subtree: true
|
|
768
|
-
});
|
|
769
|
-
a1ToastGroupObserverConnected.current = true;
|
|
770
|
-
updateA1ToastGroups();
|
|
771
|
-
} else if (toastCount === 0 && a1ToastGroupObserverConnected.current === true) {
|
|
772
|
-
a1ToastGroupObserver.current.disconnect();
|
|
773
|
-
a1ToastGroupObserverConnected.current = false;
|
|
774
|
-
}
|
|
775
|
-
}
|
|
776
|
-
}, [toastCount]);
|
|
777
|
-
useEffect(() => {
|
|
778
|
-
if (a1ToastGroups && a1ToastGroups.length > 0) {
|
|
779
|
-
a1ToastGroups.forEach((group) => {
|
|
780
|
-
group.style.top = toastCount === 0 ? "16px" : `calc(${toasterHeight}px + 3.5rem)`;
|
|
781
|
-
});
|
|
782
|
-
}
|
|
783
|
-
}, [toasterHeight, a1ToastGroups.length]);
|
|
784
|
-
useEffect(() => {
|
|
785
|
-
let timer;
|
|
786
|
-
if (toastCount > lastToastCount.current) {
|
|
787
|
-
setToasterHeight(getToasterHeight());
|
|
788
|
-
} else {
|
|
789
|
-
timer = setTimeout(() => setToasterHeight(getToasterHeight()), 290);
|
|
790
|
-
}
|
|
791
|
-
lastToastCount.current = toastCount;
|
|
792
|
-
return () => {
|
|
793
|
-
clearTimeout(timer);
|
|
794
|
-
};
|
|
795
|
-
}, [getToasterHeight]);
|
|
796
|
-
useEffect(() => {
|
|
797
|
-
setToastsBeforeStack(toastsBeforeStack);
|
|
798
|
-
}, [setToastsBeforeStack, toastsBeforeStack]);
|
|
799
|
-
const isToasterEmpty = toastCount === 0;
|
|
800
|
-
const { returnFocusRef } = useHotkeyFocus({
|
|
801
|
-
disabled: isToasterEmpty,
|
|
802
|
-
hotkey: focusKey,
|
|
803
|
-
onHotkeyIn: async () => {
|
|
804
|
-
setExtraToastsVisible(true);
|
|
805
|
-
return new Promise((resolve) => {
|
|
806
|
-
setTimeout(() => {
|
|
807
|
-
resolve();
|
|
808
|
-
}, 100);
|
|
809
|
-
});
|
|
810
|
-
},
|
|
811
|
-
onHotkeyOut: () => {
|
|
812
|
-
setExtraToastsVisible(false);
|
|
813
|
-
handleToasterBlur();
|
|
814
|
-
},
|
|
815
|
-
refToFocus: firstToastRef,
|
|
816
|
-
rootRef: toasterRef
|
|
817
|
-
});
|
|
818
|
-
const showMoreButtonPositionStyles = useShowMoreButtonPositionStyles();
|
|
819
|
-
const [toastPausedStatus, setToastPausedStatus] = useState(undefined);
|
|
820
|
-
const showMoreButton = !extraToastsVisible && toastCount > toastsBeforeStack;
|
|
821
|
-
const extraToastsLength = toastCount - toastsBeforeStack;
|
|
822
|
-
const showMoreButtonText = `${extraToastsLength} more message${extraToastsLength > 1 ? "s" : ""}`;
|
|
823
|
-
const toasterClasses = cx(styles.toaster, className, {
|
|
824
|
-
[styles["show-more-button"]]: showMoreButton,
|
|
825
|
-
[styles["show-extra-toast"]]: extraToastsVisible
|
|
826
|
-
});
|
|
827
|
-
const handleToasterFocusHover = () => {
|
|
828
|
-
if (toastPausedStatus === "resumed" || toastPausedStatus === undefined) {
|
|
829
|
-
setToastPausedStatus(Date.now());
|
|
830
|
-
}
|
|
831
|
-
};
|
|
832
|
-
const handleToasterOnBlur = () => {
|
|
833
|
-
if (!toasterRef.current?.matches(":focus-within")) {
|
|
834
|
-
handleToasterBlur();
|
|
835
|
-
}
|
|
836
|
-
};
|
|
837
|
-
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
838
|
-
/* @__PURE__ */ jsxs(
|
|
839
|
-
"div",
|
|
840
|
-
{
|
|
841
|
-
"data-anv": "toaster",
|
|
842
|
-
"data-toaster-id": id,
|
|
843
|
-
className: toasterClasses,
|
|
844
|
-
ref: mergedToasterRef,
|
|
845
|
-
onMouseOver: handleToasterFocusHover,
|
|
846
|
-
onMouseLeave: handleToasterBlur,
|
|
847
|
-
onFocus: handleToasterFocusHover,
|
|
848
|
-
onBlur: handleToasterOnBlur,
|
|
849
|
-
style: {
|
|
850
|
-
height: extraToastsVisible ? "100vh" : `calc(${toasterHeight}px + 2rem + var(--toaster-padding))`
|
|
851
|
-
},
|
|
852
|
-
...props,
|
|
853
|
-
children: [
|
|
854
|
-
toasts.map(({ toastClassName, onClose, ...toastProps }, index) => {
|
|
855
|
-
const isStacked = !extraToastsVisible && index < toastCount - toastsBeforeStack;
|
|
856
|
-
const isLastToastDisplayed = index === toastCount - toastsBeforeStack;
|
|
857
|
-
const isHidden = index < toastCount - toastsBeforeStack - 2;
|
|
858
|
-
const toastClasses = cx(styles.toast, toastClassName);
|
|
859
|
-
const toastContainerClasses = cx(styles["toast-wrapper"], {
|
|
860
|
-
[styles.stacked]: isStacked || isLastToastDisplayed,
|
|
861
|
-
[styles["stack-one"]]: isStacked && index === toastCount - toastsBeforeStack - 1,
|
|
862
|
-
[styles["stack-two"]]: isStacked && index === toastCount - toastsBeforeStack - 2,
|
|
863
|
-
[styles["stacked-extra"]]: isHidden,
|
|
864
|
-
[styles["stacked-show-extra"]]: extraToastsVisible
|
|
865
|
-
});
|
|
866
|
-
const handleOnClose = (e) => {
|
|
867
|
-
onClose?.(e);
|
|
868
|
-
returnFocusRef.current?.focus();
|
|
869
|
-
toast$1.dismiss(toastProps.id);
|
|
870
|
-
};
|
|
871
|
-
return /* @__PURE__ */ jsx(
|
|
872
|
-
Toast,
|
|
873
|
-
{
|
|
874
|
-
containerClassName: toastContainerClasses,
|
|
875
|
-
duration,
|
|
876
|
-
index,
|
|
877
|
-
isStacked,
|
|
878
|
-
isBelowStackIndex: index < toastCount - toastsBeforeStack,
|
|
879
|
-
onClose: handleOnClose,
|
|
880
|
-
pausedStatus: toastPausedStatus,
|
|
881
|
-
toastClassName: toastClasses,
|
|
882
|
-
ref: index === 0 ? firstToastRef : undefined,
|
|
883
|
-
...toastProps
|
|
884
|
-
},
|
|
885
|
-
toastProps.id
|
|
886
|
-
);
|
|
887
|
-
}),
|
|
888
|
-
showMoreButton && /* @__PURE__ */ jsx(
|
|
889
|
-
"div",
|
|
890
|
-
{
|
|
891
|
-
className: styles["show-more-button-container"],
|
|
892
|
-
style: showMoreButtonPositionStyles,
|
|
893
|
-
children: /* @__PURE__ */ jsx(
|
|
894
|
-
Button,
|
|
895
|
-
{
|
|
896
|
-
className: styles["show-collapse-button"],
|
|
897
|
-
onClick: () => setExtraToastsVisible(true),
|
|
898
|
-
appearance: "secondary",
|
|
899
|
-
tabIndex: 0,
|
|
900
|
-
children: showMoreButtonText
|
|
901
|
-
}
|
|
902
|
-
)
|
|
903
|
-
}
|
|
904
|
-
),
|
|
905
|
-
/* @__PURE__ */ jsxs(SrOnly, { "aria-live": "polite", children: [
|
|
906
|
-
"New toast message appeared. Press the ",
|
|
907
|
-
focusKey,
|
|
908
|
-
" key to focus on the toast messages. Press escape to return focus to previous position."
|
|
909
|
-
] })
|
|
910
|
-
]
|
|
911
|
-
}
|
|
912
|
-
),
|
|
913
|
-
extraToastsVisible && /* @__PURE__ */ jsx("div", { className: styles["show-collapse-button-container"], children: /* @__PURE__ */ jsx(
|
|
914
|
-
Button,
|
|
915
|
-
{
|
|
916
|
-
className: styles["show-collapse-button"],
|
|
917
|
-
onClick: handleToasterBlur,
|
|
918
|
-
appearance: "secondary",
|
|
919
|
-
children: "Collapse Messages"
|
|
920
|
-
}
|
|
921
|
-
) })
|
|
922
|
-
] });
|
|
923
|
-
}
|
|
924
|
-
);
|
|
925
|
-
Toaster$1.displayName = "Toaster";
|
|
926
|
-
ToasterContent.displayName = "ToasterContent";
|
|
927
|
-
|
|
928
|
-
const Toaster = forwardRef(
|
|
929
|
-
(props, ref) => {
|
|
930
|
-
return /* @__PURE__ */ jsx(Toaster$1, { ref, ...props });
|
|
931
|
-
}
|
|
932
|
-
);
|
|
933
|
-
|
|
934
|
-
const toast = toast$1;
|
|
935
|
-
|
|
936
|
-
export { Toaster as T, toast as t };
|
|
937
|
-
//# sourceMappingURL=toast-BckKmAqz.js.map
|