@spark-ui/components 14.0.0-beta.1 → 14.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/Button-B6rA3-e5.js +2 -0
- package/dist/{Button-C3xHNaGl.js.map → Button-B6rA3-e5.js.map} +1 -1
- package/dist/{Button-D32Avk2j.mjs → Button-C3C0aixy.mjs} +4 -4
- package/dist/{Button-D32Avk2j.mjs.map → Button-C3C0aixy.mjs.map} +1 -1
- package/dist/DialogContent.styles-BSfXHt21.mjs +61 -0
- package/dist/DialogContent.styles-BSfXHt21.mjs.map +1 -0
- package/dist/DialogContent.styles-bBs6l8Cy.js +2 -0
- package/dist/DialogContent.styles-bBs6l8Cy.js.map +1 -0
- package/dist/Icon-CF0W0LKr.js +2 -0
- package/dist/{Icon-Bf0XrmiR.js.map → Icon-CF0W0LKr.js.map} +1 -1
- package/dist/{Icon-D1RueiPY.mjs → Icon-Ck-dhfLd.mjs} +6 -6
- package/dist/{Icon-D1RueiPY.mjs.map → Icon-Ck-dhfLd.mjs.map} +1 -1
- package/dist/{IconButton-BY3gYXtU.mjs → IconButton-C62-axzv.mjs} +6 -6
- package/dist/{IconButton-BY3gYXtU.mjs.map → IconButton-C62-axzv.mjs.map} +1 -1
- package/dist/IconButton-D3g86WpZ.js +2 -0
- package/dist/{IconButton-Bf-EDzpI.js.map → IconButton-D3g86WpZ.js.map} +1 -1
- package/dist/Slot-D2Bbf8Gw.mjs +14 -0
- package/dist/{Slot-C98rL4yy.mjs.map → Slot-D2Bbf8Gw.mjs.map} +1 -1
- package/dist/Slot-DQ8z2zsy.js +2 -0
- package/dist/{Slot-ghrohQLA.js.map → Slot-DQ8z2zsy.js.map} +1 -1
- package/dist/Spinner-_Kffli3B.js +2 -0
- package/dist/{Spinner-DK8VEsaR.js.map → Spinner-_Kffli3B.js.map} +1 -1
- package/dist/{Spinner-CYL5kyzM.mjs → Spinner-jF3-zoh_.mjs} +3 -3
- package/dist/{Spinner-CYL5kyzM.mjs.map → Spinner-jF3-zoh_.mjs.map} +1 -1
- package/dist/{TextLink-3MEVs3No.mjs → TextLink-BuzFRWO6.mjs} +3 -3
- package/dist/{TextLink-3MEVs3No.mjs.map → TextLink-BuzFRWO6.mjs.map} +1 -1
- package/dist/TextLink-C3xDLsbC.js +2 -0
- package/dist/{TextLink-DD0VO37q.js.map → TextLink-C3xDLsbC.js.map} +1 -1
- package/dist/{VisuallyHidden-AoRh4WRK.js → VisuallyHidden-CB6Nx76j.js} +2 -2
- package/dist/{VisuallyHidden-AoRh4WRK.js.map → VisuallyHidden-CB6Nx76j.js.map} +1 -1
- package/dist/{VisuallyHidden-ByNP7ZUI.mjs → VisuallyHidden-KH1biLx-.mjs} +2 -2
- package/dist/{VisuallyHidden-ByNP7ZUI.mjs.map → VisuallyHidden-KH1biLx-.mjs.map} +1 -1
- package/dist/accordion/index.d.mts +15 -0
- package/dist/accordion/index.js +1 -1
- package/dist/accordion/index.js.map +1 -1
- package/dist/accordion/index.mjs +90 -608
- package/dist/accordion/index.mjs.map +1 -1
- package/dist/alert-dialog/AlertDialogPortal.d.ts +1 -1
- package/dist/alert-dialog/index.d.mts +38 -0
- package/dist/alert-dialog/index.js +1 -34
- package/dist/alert-dialog/index.js.map +1 -1
- package/dist/alert-dialog/index.mjs +139 -2475
- package/dist/alert-dialog/index.mjs.map +1 -1
- package/dist/avatar/index.d.mts +15 -0
- package/dist/avatar/index.js +1 -1
- package/dist/avatar/index.js.map +1 -1
- package/dist/avatar/index.mjs +4 -4
- package/dist/badge/index.d.mts +1 -0
- package/dist/badge/index.js +1 -1
- package/dist/badge/index.js.map +1 -1
- package/dist/badge/index.mjs +6 -6
- package/dist/breadcrumb/index.d.mts +12 -0
- package/dist/breadcrumb/index.js +1 -1
- package/dist/breadcrumb/index.js.map +1 -1
- package/dist/breadcrumb/index.mjs +21 -21
- package/dist/button/Button.d.ts +1 -1
- package/dist/button/index.d.mts +1 -0
- package/dist/button/index.js +1 -1
- package/dist/button/index.mjs +1 -1
- package/dist/button/variants/index.d.mts +5 -0
- package/dist/card/index.d.mts +8 -0
- package/dist/card/index.js +1 -1
- package/dist/card/index.js.map +1 -1
- package/dist/card/index.mjs +2 -2
- package/dist/carousel/index.d.mts +19 -0
- package/dist/carousel/index.js +1 -1
- package/dist/carousel/index.js.map +1 -1
- package/dist/carousel/index.mjs +3 -3
- package/dist/checkbox/index.d.mts +2 -0
- package/dist/checkbox/index.js +1 -1
- package/dist/checkbox/index.js.map +1 -1
- package/dist/checkbox/index.mjs +128 -364
- package/dist/checkbox/index.mjs.map +1 -1
- package/dist/chip/index.d.mts +15 -0
- package/dist/chip/index.js +1 -1
- package/dist/chip/index.js.map +1 -1
- package/dist/chip/index.mjs +196 -370
- package/dist/chip/index.mjs.map +1 -1
- package/dist/chip/variants/index.d.mts +3 -0
- package/dist/collapsible/index.d.mts +7 -0
- package/dist/collapsible/index.js +1 -1
- package/dist/collapsible/index.js.map +1 -1
- package/dist/collapsible/index.mjs +38 -213
- package/dist/collapsible/index.mjs.map +1 -1
- package/dist/combobox/index.d.mts +35 -0
- package/dist/combobox/index.js +1 -1
- package/dist/combobox/index.js.map +1 -1
- package/dist/combobox/index.mjs +7 -7
- package/dist/combobox/utils/index.d.mts +14 -0
- package/dist/dialog/Dialog.d.ts +13 -13
- package/dist/dialog/DialogClose.d.ts +9 -8
- package/dist/dialog/DialogContent.d.ts +4 -4
- package/dist/dialog/DialogDescription.d.ts +3 -3
- package/dist/dialog/DialogOverlay.d.ts +5 -5
- package/dist/dialog/DialogPortal.d.ts +4 -4
- package/dist/dialog/DialogTitle.d.ts +3 -3
- package/dist/dialog/DialogTrigger.d.ts +5 -9
- package/dist/dialog/index.d.mts +37 -0
- package/dist/dialog/index.js +1 -1
- package/dist/dialog/index.js.map +1 -1
- package/dist/dialog/index.mjs +149 -159
- package/dist/dialog/index.mjs.map +1 -1
- package/dist/divider/index.d.mts +6 -0
- package/dist/divider/index.js +1 -1
- package/dist/divider/index.js.map +1 -1
- package/dist/divider/index.mjs +58 -76
- package/dist/divider/index.mjs.map +1 -1
- package/dist/drawer/Drawer.d.ts +12 -19
- package/dist/drawer/DrawerClose.d.ts +9 -5
- package/dist/drawer/DrawerContent.d.ts +5 -5
- package/dist/drawer/DrawerDescription.d.ts +4 -4
- package/dist/drawer/DrawerOverlay.d.ts +5 -5
- package/dist/drawer/DrawerPortal.d.ts +4 -4
- package/dist/drawer/DrawerTitle.d.ts +5 -5
- package/dist/drawer/DrawerTrigger.d.ts +5 -5
- package/dist/drawer/index.d.mts +37 -0
- package/dist/drawer/index.d.ts +2 -0
- package/dist/drawer/index.js +1 -1
- package/dist/drawer/index.js.map +1 -1
- package/dist/drawer/index.mjs +143 -114
- package/dist/drawer/index.mjs.map +1 -1
- package/dist/drawer/useRenderSlot.d.ts +3 -0
- package/dist/dropdown/index.d.mts +29 -0
- package/dist/dropdown/index.js +1 -1
- package/dist/dropdown/index.js.map +1 -1
- package/dist/dropdown/index.mjs +5 -5
- package/dist/file-upload/index.d.mts +22 -0
- package/dist/file-upload/index.js +1 -1
- package/dist/file-upload/index.js.map +1 -1
- package/dist/file-upload/index.mjs +6 -6
- package/dist/form-field/index.d.mts +31 -0
- package/dist/form-field/index.js +1 -1
- package/dist/form-field/index.js.map +1 -1
- package/dist/form-field/index.mjs +47 -47
- package/dist/icon/index.d.mts +1 -0
- package/dist/icon/index.js +1 -1
- package/dist/icon/index.mjs +1 -1
- package/dist/icon-button/index.d.mts +1 -0
- package/dist/icon-button/index.js +1 -1
- package/dist/icon-button/index.mjs +1 -1
- package/dist/input/index.d.mts +21 -0
- package/dist/input/index.js +1 -1
- package/dist/input/index.js.map +1 -1
- package/dist/input/index.mjs +4 -4
- package/dist/input-otp/index.d.mts +14 -0
- package/dist/input-otp/index.js +1 -1
- package/dist/input-otp/index.js.map +1 -1
- package/dist/input-otp/index.mjs +139 -137
- package/dist/input-otp/index.mjs.map +1 -1
- package/dist/kbd/index.d.mts +1 -0
- package/dist/label/index.d.mts +7 -0
- package/dist/label/index.js +1 -1
- package/dist/label/index.js.map +1 -1
- package/dist/label/index.mjs +37 -2
- package/dist/label/index.mjs.map +1 -1
- package/dist/link-box/index.d.mts +9 -0
- package/dist/link-box/index.js +1 -1
- package/dist/link-box/index.js.map +1 -1
- package/dist/link-box/index.mjs +7 -7
- package/dist/pagination/index.d.mts +18 -0
- package/dist/pagination/index.js +1 -1
- package/dist/pagination/index.js.map +1 -1
- package/dist/pagination/index.mjs +126 -844
- package/dist/pagination/index.mjs.map +1 -1
- package/dist/popover/index.d.mts +17 -0
- package/dist/popover/index.js +1 -1
- package/dist/popover/index.js.map +1 -1
- package/dist/popover/index.mjs +119 -1748
- package/dist/popover/index.mjs.map +1 -1
- package/dist/portal/index.d.mts +1 -0
- package/dist/portal/index.js +1 -1
- package/dist/portal/index.js.map +1 -1
- package/dist/portal/index.mjs +3 -3
- package/dist/portal/index.mjs.map +1 -1
- package/dist/progress/index.d.mts +13 -0
- package/dist/progress/index.js +1 -6
- package/dist/progress/index.js.map +1 -1
- package/dist/progress/index.mjs +87 -162
- package/dist/progress/index.mjs.map +1 -1
- package/dist/progress-tracker/index.d.mts +10 -0
- package/dist/progress-tracker/index.js +1 -1
- package/dist/progress-tracker/index.js.map +1 -1
- package/dist/progress-tracker/index.mjs +14 -14
- package/dist/radio-group/index.d.mts +7 -0
- package/dist/radio-group/index.js +1 -1
- package/dist/radio-group/index.js.map +1 -1
- package/dist/radio-group/index.mjs +85 -312
- package/dist/radio-group/index.mjs.map +1 -1
- package/dist/rating/index.d.mts +1 -0
- package/dist/rating/index.js +1 -1
- package/dist/rating/index.js.map +1 -1
- package/dist/rating/index.mjs +11 -11
- package/dist/scrolling-list/index.d.mts +15 -0
- package/dist/scrolling-list/index.js +1 -1
- package/dist/scrolling-list/index.js.map +1 -1
- package/dist/scrolling-list/index.mjs +168 -333
- package/dist/scrolling-list/index.mjs.map +1 -1
- package/dist/segmented-gauge/index.d.mts +13 -0
- package/dist/segmented-gauge/index.js +1 -1
- package/dist/segmented-gauge/index.js.map +1 -1
- package/dist/segmented-gauge/index.mjs +1 -1
- package/dist/select/index.d.mts +21 -0
- package/dist/select/index.js +1 -1
- package/dist/select/index.js.map +1 -1
- package/dist/select/index.mjs +21 -21
- package/dist/skeleton/index.d.mts +8 -0
- package/dist/skeleton/index.js +1 -1
- package/dist/skeleton/index.js.map +1 -1
- package/dist/skeleton/index.mjs +2 -2
- package/dist/slider/Slider.d.ts +6 -1
- package/dist/slider/SliderContext.d.ts +4 -1
- package/dist/slider/index.d.mts +8 -0
- package/dist/slider/index.js +1 -1
- package/dist/slider/index.js.map +1 -1
- package/dist/slider/index.mjs +96 -496
- package/dist/slider/index.mjs.map +1 -1
- package/dist/slot/index.d.mts +1 -0
- package/dist/slot/index.js +1 -1
- package/dist/slot/index.mjs +1 -1
- package/dist/snackbar/index.d.mts +13 -0
- package/dist/snackbar/index.js +1 -1
- package/dist/snackbar/index.js.map +1 -1
- package/dist/snackbar/index.mjs +189 -1105
- package/dist/snackbar/index.mjs.map +1 -1
- package/dist/spinner/index.d.mts +1 -0
- package/dist/spinner/index.js +1 -1
- package/dist/spinner/index.mjs +1 -1
- package/dist/stepper/index.d.mts +9 -0
- package/dist/stepper/index.js +1 -7
- package/dist/stepper/index.js.map +1 -1
- package/dist/stepper/index.mjs +137 -2317
- package/dist/stepper/index.mjs.map +1 -1
- package/dist/switch/index.d.mts +1 -0
- package/dist/switch/index.js +1 -1
- package/dist/switch/index.js.map +1 -1
- package/dist/switch/index.mjs +85 -208
- package/dist/switch/index.mjs.map +1 -1
- package/dist/tabs/index.d.mts +13 -0
- package/dist/tabs/index.js +1 -1
- package/dist/tabs/index.js.map +1 -1
- package/dist/tabs/index.mjs +179 -329
- package/dist/tabs/index.mjs.map +1 -1
- package/dist/tag/index.d.mts +1 -0
- package/dist/tag/index.js +1 -1
- package/dist/tag/index.js.map +1 -1
- package/dist/tag/index.mjs +2 -2
- package/dist/tag/variants/index.d.mts +3 -0
- package/dist/text-link/index.d.mts +1 -0
- package/dist/text-link/index.js +1 -1
- package/dist/text-link/index.mjs +1 -1
- package/dist/textarea/index.d.mts +14 -0
- package/dist/textarea/index.js +1 -1
- package/dist/textarea/index.js.map +1 -1
- package/dist/textarea/index.mjs +6 -6
- package/dist/toast/index.d.mts +20 -0
- package/dist/toast/index.js +1 -1
- package/dist/toast/index.js.map +1 -1
- package/dist/toast/index.mjs +146 -1008
- package/dist/toast/index.mjs.map +1 -1
- package/dist/useRenderSlot-DATwjgpo.js +2 -0
- package/dist/useRenderSlot-DATwjgpo.js.map +1 -0
- package/dist/useRenderSlot-LwWj8QbC.mjs +10 -0
- package/dist/useRenderSlot-LwWj8QbC.mjs.map +1 -0
- package/dist/visually-hidden/index.d.mts +1 -0
- package/dist/visually-hidden/index.js +1 -1
- package/dist/visually-hidden/index.mjs +1 -1
- package/package.json +7 -6
- package/dist/Button-C3xHNaGl.js +0 -2
- package/dist/DialogContent.styles-BrhKaHc_.js +0 -2
- package/dist/DialogContent.styles-BrhKaHc_.js.map +0 -1
- package/dist/DialogContent.styles-WGWJS9dj.mjs +0 -48
- package/dist/DialogContent.styles-WGWJS9dj.mjs.map +0 -1
- package/dist/Icon-Bf0XrmiR.js +0 -2
- package/dist/IconButton-Bf-EDzpI.js +0 -2
- package/dist/Slot-C98rL4yy.mjs +0 -14
- package/dist/Slot-ghrohQLA.js +0 -2
- package/dist/Spinner-DK8VEsaR.js +0 -2
- package/dist/TextLink-DD0VO37q.js +0 -2
- package/dist/composite-Br3kM5N9.mjs +0 -40
- package/dist/composite-Br3kM5N9.mjs.map +0 -1
- package/dist/composite-fJD9R7R0.js +0 -2
- package/dist/composite-fJD9R7R0.js.map +0 -1
- package/dist/detectBrowser-Bc7rk5fI.mjs +0 -44
- package/dist/detectBrowser-Bc7rk5fI.mjs.map +0 -1
- package/dist/detectBrowser-DTbs_30X.js +0 -2
- package/dist/detectBrowser-DTbs_30X.js.map +0 -1
- package/dist/downshift.esm-Ncwetv0s.mjs +0 -3038
- package/dist/downshift.esm-Ncwetv0s.mjs.map +0 -1
- package/dist/downshift.esm-PfCOUbxq.js +0 -37
- package/dist/downshift.esm-PfCOUbxq.js.map +0 -1
- package/dist/floating-ui.utils.dom-CCN4I08l.js +0 -2
- package/dist/floating-ui.utils.dom-CCN4I08l.js.map +0 -1
- package/dist/floating-ui.utils.dom-uiDUZc_y.mjs +0 -136
- package/dist/floating-ui.utils.dom-uiDUZc_y.mjs.map +0 -1
- package/dist/index-0KYGKeVg.js +0 -2
- package/dist/index-0KYGKeVg.js.map +0 -1
- package/dist/index-1WIgmEZh.js +0 -2
- package/dist/index-1WIgmEZh.js.map +0 -1
- package/dist/index-BRi38DTc.mjs +0 -21
- package/dist/index-BRi38DTc.mjs.map +0 -1
- package/dist/index-BZAtNKwE.mjs +0 -71
- package/dist/index-BZAtNKwE.mjs.map +0 -1
- package/dist/index-BZPx6jYI.mjs +0 -9
- package/dist/index-BZPx6jYI.mjs.map +0 -1
- package/dist/index-BlkdpEIe.mjs +0 -55
- package/dist/index-BlkdpEIe.mjs.map +0 -1
- package/dist/index-BmAFn37q.mjs +0 -49
- package/dist/index-BmAFn37q.mjs.map +0 -1
- package/dist/index-C-J_tHdS.js +0 -6
- package/dist/index-C-J_tHdS.js.map +0 -1
- package/dist/index-C1qb0595.mjs +0 -28
- package/dist/index-C1qb0595.mjs.map +0 -1
- package/dist/index-C34GgsKQ.mjs +0 -54
- package/dist/index-C34GgsKQ.mjs.map +0 -1
- package/dist/index-CCKe-Mpx.mjs +0 -7
- package/dist/index-CCKe-Mpx.mjs.map +0 -1
- package/dist/index-CDBBjNXc.js +0 -2
- package/dist/index-CDBBjNXc.js.map +0 -1
- package/dist/index-CYjGhVvU.mjs +0 -243
- package/dist/index-CYjGhVvU.mjs.map +0 -1
- package/dist/index-ChLwd62c.js +0 -2
- package/dist/index-ChLwd62c.js.map +0 -1
- package/dist/index-Cjj_rUPu.js +0 -2
- package/dist/index-Cjj_rUPu.js.map +0 -1
- package/dist/index-CyMbLkj0.js +0 -2
- package/dist/index-CyMbLkj0.js.map +0 -1
- package/dist/index-DFZozV_h.mjs +0 -69
- package/dist/index-DFZozV_h.mjs.map +0 -1
- package/dist/index-DKuHkHFX.js +0 -2
- package/dist/index-DKuHkHFX.js.map +0 -1
- package/dist/index-DLHLIYPI.mjs +0 -16
- package/dist/index-DLHLIYPI.mjs.map +0 -1
- package/dist/index-DO-atGp-.js +0 -2
- package/dist/index-DO-atGp-.js.map +0 -1
- package/dist/index-DWlg8lkk.mjs +0 -179
- package/dist/index-DWlg8lkk.mjs.map +0 -1
- package/dist/index-DYxWvftI.js +0 -2
- package/dist/index-DYxWvftI.js.map +0 -1
- package/dist/index-D_lWkK39.mjs +0 -803
- package/dist/index-D_lWkK39.mjs.map +0 -1
- package/dist/index-DdkVj7D0.js +0 -18
- package/dist/index-DdkVj7D0.js.map +0 -1
- package/dist/index-De-6atSi.js +0 -2
- package/dist/index-De-6atSi.js.map +0 -1
- package/dist/index-DhGWNzsz.mjs +0 -83
- package/dist/index-DhGWNzsz.mjs.map +0 -1
- package/dist/index-Dkj4QRX8.js +0 -2
- package/dist/index-Dkj4QRX8.js.map +0 -1
- package/dist/index-DlIFg0Eu.mjs +0 -60
- package/dist/index-DlIFg0Eu.mjs.map +0 -1
- package/dist/index-DnaHaH_0.js +0 -2
- package/dist/index-DnaHaH_0.js.map +0 -1
- package/dist/index-MHF2-CYX.js +0 -2
- package/dist/index-MHF2-CYX.js.map +0 -1
- package/dist/index-MQ0c3ZX_.js +0 -2
- package/dist/index-MQ0c3ZX_.js.map +0 -1
- package/dist/index-MSR-vgWR.mjs +0 -37
- package/dist/index-MSR-vgWR.mjs.map +0 -1
- package/dist/index-VL0YEmOW.mjs +0 -125
- package/dist/index-VL0YEmOW.mjs.map +0 -1
- package/dist/index-tXqxYME3.js +0 -42
- package/dist/index-tXqxYME3.js.map +0 -1
- package/dist/inertValue-Bif5Sqs6.mjs +0 -522
- package/dist/inertValue-Bif5Sqs6.mjs.map +0 -1
- package/dist/inertValue-ShwihJSN.js +0 -5
- package/dist/inertValue-ShwihJSN.js.map +0 -1
- package/dist/useCollapsiblePanel-D1dCo0lf.js +0 -4
- package/dist/useCollapsiblePanel-D1dCo0lf.js.map +0 -1
- package/dist/useCollapsiblePanel-kbMNl4Z4.mjs +0 -287
- package/dist/useCollapsiblePanel-kbMNl4Z4.mjs.map +0 -1
- package/dist/useFocusWithin-CFNEka2I.js +0 -2
- package/dist/useFocusWithin-CFNEka2I.js.map +0 -1
- package/dist/useFocusWithin-CoL4390f.mjs +0 -796
- package/dist/useFocusWithin-CoL4390f.mjs.map +0 -1
- package/dist/useOpenChangeComplete-Dk-u_f2y.js +0 -2
- package/dist/useOpenChangeComplete-Dk-u_f2y.js.map +0 -1
- package/dist/useOpenChangeComplete-RUbg6RBw.mjs +0 -582
- package/dist/useOpenChangeComplete-RUbg6RBw.mjs.map +0 -1
- package/dist/useTransitionStatus-CktVVKxz.mjs +0 -46
- package/dist/useTransitionStatus-CktVVKxz.mjs.map +0 -1
- package/dist/useTransitionStatus-CqbEyvIj.js +0 -2
- package/dist/useTransitionStatus-CqbEyvIj.js.map +0 -1
|
@@ -1,2582 +1,246 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import { a as
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
|
|
10
|
-
import { i as ao, d as lo, s as co, e as yt, f as en, g as uo, C as fo } from "../composite-Br3kM5N9.mjs";
|
|
11
|
-
import { a as po } from "../Slot-C98rL4yy.mjs";
|
|
12
|
-
import { useMergeRefs as tn } from "@spark-ui/hooks/use-merge-refs";
|
|
13
|
-
import { useScrollOverflow as go } from "@spark-ui/hooks/use-scroll-overflow";
|
|
14
|
-
import { a as Te } from "../index-BmAFn37q.mjs";
|
|
15
|
-
import { d as mo } from "../DialogContent.styles-WGWJS9dj.mjs";
|
|
16
|
-
function Se(e, t, n = !0) {
|
|
17
|
-
return e.filter((r) => r.parentId === t && (!n || r.context?.open)).flatMap((r) => [r, ...Se(e, r.id, n)]);
|
|
18
|
-
}
|
|
19
|
-
function bt(e, t) {
|
|
20
|
-
let n = [], o = e.find((r) => r.id === t)?.parentId;
|
|
21
|
-
for (; o; ) {
|
|
22
|
-
const r = e.find((s) => s.id === o);
|
|
23
|
-
o = r?.parentId, r && (n = n.concat(r));
|
|
24
|
-
}
|
|
25
|
-
return n;
|
|
26
|
-
}
|
|
27
|
-
let vt = {}, St = {}, Ct = "";
|
|
28
|
-
function ho(e) {
|
|
29
|
-
if (typeof document > "u")
|
|
30
|
-
return !1;
|
|
31
|
-
const t = Ue(e);
|
|
32
|
-
return $e(t).innerWidth - t.documentElement.clientWidth > 0;
|
|
33
|
-
}
|
|
34
|
-
function Eo(e) {
|
|
35
|
-
const t = Ue(e), n = t.documentElement, o = t.body, r = $t(n) ? n : o, s = r.style.overflow;
|
|
36
|
-
return r.style.overflow = "hidden", () => {
|
|
37
|
-
r.style.overflow = s;
|
|
38
|
-
};
|
|
39
|
-
}
|
|
40
|
-
function yo(e) {
|
|
41
|
-
const t = Ue(e), n = t.documentElement, o = t.body, r = $e(n);
|
|
42
|
-
let s = 0, a = 0;
|
|
43
|
-
const l = Ln.create(), i = typeof CSS < "u" && CSS.supports?.("scrollbar-gutter", "stable");
|
|
44
|
-
if (Yn && (r.visualViewport?.scale ?? 1) !== 1)
|
|
45
|
-
return () => {
|
|
46
|
-
};
|
|
47
|
-
function c() {
|
|
48
|
-
const p = r.getComputedStyle(n), m = r.getComputedStyle(o), C = (p.scrollbarGutter || "").includes("both-edges") ? "stable both-edges" : "stable";
|
|
49
|
-
s = n.scrollTop, a = n.scrollLeft, vt = {
|
|
50
|
-
scrollbarGutter: n.style.scrollbarGutter,
|
|
51
|
-
overflowY: n.style.overflowY,
|
|
52
|
-
overflowX: n.style.overflowX
|
|
53
|
-
}, Ct = n.style.scrollBehavior, St = {
|
|
54
|
-
position: o.style.position,
|
|
55
|
-
height: o.style.height,
|
|
56
|
-
width: o.style.width,
|
|
57
|
-
boxSizing: o.style.boxSizing,
|
|
58
|
-
overflowY: o.style.overflowY,
|
|
59
|
-
overflowX: o.style.overflowX,
|
|
60
|
-
scrollBehavior: o.style.scrollBehavior
|
|
61
|
-
};
|
|
62
|
-
const T = n.scrollHeight > n.clientHeight, y = n.scrollWidth > n.clientWidth, E = p.overflowY === "scroll" || m.overflowY === "scroll", x = p.overflowX === "scroll" || m.overflowX === "scroll", k = Math.max(0, r.innerWidth - n.clientWidth), w = Math.max(0, r.innerHeight - n.clientHeight), D = parseFloat(m.marginTop) + parseFloat(m.marginBottom), I = parseFloat(m.marginLeft) + parseFloat(m.marginRight), B = $t(n) ? n : o;
|
|
63
|
-
if (i) {
|
|
64
|
-
n.style.scrollbarGutter = C, B.style.overflowY = "hidden", B.style.overflowX = "hidden";
|
|
65
|
-
return;
|
|
66
|
-
}
|
|
67
|
-
Object.assign(n.style, {
|
|
68
|
-
scrollbarGutter: C,
|
|
69
|
-
overflowY: "hidden",
|
|
70
|
-
overflowX: "hidden"
|
|
71
|
-
}), (T || E) && (n.style.overflowY = "scroll"), (y || x) && (n.style.overflowX = "scroll"), Object.assign(o.style, {
|
|
72
|
-
position: "relative",
|
|
73
|
-
height: D || w ? `calc(100dvh - ${D + w}px)` : "100dvh",
|
|
74
|
-
width: I || k ? `calc(100vw - ${I + k}px)` : "100vw",
|
|
75
|
-
boxSizing: "border-box",
|
|
76
|
-
overflow: "hidden",
|
|
77
|
-
scrollBehavior: "unset"
|
|
78
|
-
}), o.scrollTop = s, o.scrollLeft = a, n.setAttribute("data-base-ui-scroll-locked", ""), n.style.scrollBehavior = "unset";
|
|
79
|
-
}
|
|
80
|
-
function f() {
|
|
81
|
-
Object.assign(n.style, vt), Object.assign(o.style, St), i || (n.scrollTop = s, n.scrollLeft = a, n.removeAttribute("data-base-ui-scroll-locked"), n.style.scrollBehavior = Ct);
|
|
82
|
-
}
|
|
83
|
-
function h() {
|
|
84
|
-
f(), l.request(c);
|
|
85
|
-
}
|
|
86
|
-
return c(), r.addEventListener("resize", h), () => {
|
|
87
|
-
l.cancel(), f(), typeof r.removeEventListener == "function" && r.removeEventListener("resize", h);
|
|
88
|
-
};
|
|
89
|
-
}
|
|
90
|
-
class bo {
|
|
91
|
-
lockCount = 0;
|
|
92
|
-
restore = null;
|
|
93
|
-
timeoutLock = nt.create();
|
|
94
|
-
timeoutUnlock = nt.create();
|
|
95
|
-
acquire(t) {
|
|
96
|
-
return this.lockCount += 1, this.lockCount === 1 && this.restore === null && this.timeoutLock.start(0, () => this.lock(t)), this.release;
|
|
97
|
-
}
|
|
98
|
-
release = () => {
|
|
99
|
-
this.lockCount -= 1, this.lockCount === 0 && this.restore && this.timeoutUnlock.start(0, this.unlock);
|
|
100
|
-
};
|
|
101
|
-
unlock = () => {
|
|
102
|
-
this.lockCount === 0 && this.restore && (this.restore?.(), this.restore = null);
|
|
103
|
-
};
|
|
104
|
-
lock(t) {
|
|
105
|
-
if (this.lockCount === 0 || this.restore !== null)
|
|
106
|
-
return;
|
|
107
|
-
const o = Ue(t).documentElement, r = $e(o).getComputedStyle(o).overflowY;
|
|
108
|
-
if (r === "hidden" || r === "clip") {
|
|
109
|
-
this.restore = Lt;
|
|
110
|
-
return;
|
|
111
|
-
}
|
|
112
|
-
const s = Gn || !ho(t);
|
|
113
|
-
this.restore = s ? Eo(t) : yo(t);
|
|
114
|
-
}
|
|
115
|
-
}
|
|
116
|
-
const vo = new bo();
|
|
117
|
-
function So(e = !0, t = null) {
|
|
118
|
-
Z(() => {
|
|
119
|
-
if (e)
|
|
120
|
-
return vo.acquire(t);
|
|
121
|
-
}, [e, t]);
|
|
122
|
-
}
|
|
123
|
-
function Co() {
|
|
124
|
-
const e = /* @__PURE__ */ new Map();
|
|
125
|
-
return {
|
|
126
|
-
emit(t, n) {
|
|
127
|
-
e.get(t)?.forEach((o) => o(n));
|
|
128
|
-
},
|
|
129
|
-
on(t, n) {
|
|
130
|
-
e.has(t) || e.set(t, /* @__PURE__ */ new Set()), e.get(t).add(n);
|
|
131
|
-
},
|
|
132
|
-
off(t, n) {
|
|
133
|
-
e.get(t)?.delete(n);
|
|
134
|
-
}
|
|
135
|
-
};
|
|
136
|
-
}
|
|
137
|
-
const nn = /* @__PURE__ */ u.createContext(null);
|
|
138
|
-
process.env.NODE_ENV !== "production" && (nn.displayName = "FloatingNodeContext");
|
|
139
|
-
const on = /* @__PURE__ */ u.createContext(null);
|
|
140
|
-
process.env.NODE_ENV !== "production" && (on.displayName = "FloatingTreeContext");
|
|
141
|
-
const rn = () => u.useContext(nn)?.id || null, sn = (e) => {
|
|
142
|
-
const t = u.useContext(on);
|
|
143
|
-
return e ?? t;
|
|
144
|
-
};
|
|
145
|
-
let Rt = 0;
|
|
146
|
-
function Je(e, t = {}) {
|
|
147
|
-
const {
|
|
148
|
-
preventScroll: n = !1,
|
|
149
|
-
cancelPrevious: o = !0,
|
|
150
|
-
sync: r = !1
|
|
151
|
-
} = t;
|
|
152
|
-
o && cancelAnimationFrame(Rt);
|
|
153
|
-
const s = () => e?.focus({
|
|
154
|
-
preventScroll: n
|
|
155
|
-
});
|
|
156
|
-
r ? s() : Rt = requestAnimationFrame(s);
|
|
157
|
-
}
|
|
158
|
-
const Ce = {
|
|
159
|
-
inert: /* @__PURE__ */ new WeakMap(),
|
|
160
|
-
"aria-hidden": /* @__PURE__ */ new WeakMap(),
|
|
161
|
-
none: /* @__PURE__ */ new WeakMap()
|
|
162
|
-
};
|
|
163
|
-
function Tt(e) {
|
|
164
|
-
return e === "inert" ? Ce.inert : e === "aria-hidden" ? Ce["aria-hidden"] : Ce.none;
|
|
165
|
-
}
|
|
166
|
-
let Be = /* @__PURE__ */ new WeakSet(), We = {}, Qe = 0;
|
|
167
|
-
const an = (e) => e && (e.host || an(e.parentNode)), Ro = (e, t) => t.map((n) => {
|
|
168
|
-
if (e.contains(n))
|
|
169
|
-
return n;
|
|
170
|
-
const o = an(n);
|
|
171
|
-
return e.contains(o) ? o : null;
|
|
172
|
-
}).filter((n) => n != null);
|
|
173
|
-
function To(e, t, n, o) {
|
|
174
|
-
const r = "data-base-ui-inert", s = o ? "inert" : n ? "aria-hidden" : null, a = Ro(t, e), l = /* @__PURE__ */ new Set(), i = new Set(a), c = [];
|
|
175
|
-
We[r] || (We[r] = /* @__PURE__ */ new WeakMap());
|
|
176
|
-
const f = We[r];
|
|
177
|
-
a.forEach(h), p(t), l.clear();
|
|
178
|
-
function h(m) {
|
|
179
|
-
!m || l.has(m) || (l.add(m), m.parentNode && h(m.parentNode));
|
|
180
|
-
}
|
|
181
|
-
function p(m) {
|
|
182
|
-
!m || i.has(m) || [].forEach.call(m.children, (g) => {
|
|
183
|
-
if (Ut(g) !== "script")
|
|
184
|
-
if (l.has(g))
|
|
185
|
-
p(g);
|
|
186
|
-
else {
|
|
187
|
-
const b = s ? g.getAttribute(s) : null, C = b !== null && b !== "false", T = Tt(s), y = (T.get(g) || 0) + 1, E = (f.get(g) || 0) + 1;
|
|
188
|
-
T.set(g, y), f.set(g, E), c.push(g), y === 1 && C && Be.add(g), E === 1 && g.setAttribute(r, ""), !C && s && g.setAttribute(s, s === "inert" ? "" : "true");
|
|
189
|
-
}
|
|
190
|
-
});
|
|
191
|
-
}
|
|
192
|
-
return Qe += 1, () => {
|
|
193
|
-
c.forEach((m) => {
|
|
194
|
-
const g = Tt(s), C = (g.get(m) || 0) - 1, T = (f.get(m) || 0) - 1;
|
|
195
|
-
g.set(m, C), f.set(m, T), C || (!Be.has(m) && s && m.removeAttribute(s), Be.delete(m)), T || m.removeAttribute(r);
|
|
196
|
-
}), Qe -= 1, Qe || (Ce.inert = /* @__PURE__ */ new WeakMap(), Ce["aria-hidden"] = /* @__PURE__ */ new WeakMap(), Ce.none = /* @__PURE__ */ new WeakMap(), Be = /* @__PURE__ */ new WeakSet(), We = {});
|
|
197
|
-
};
|
|
198
|
-
}
|
|
199
|
-
function Oo(e, t = !1, n = !1) {
|
|
200
|
-
const o = oe(e[0]).body;
|
|
201
|
-
return To(e.concat(Array.from(o.querySelectorAll("[aria-live]"))), o, t, n);
|
|
202
|
-
}
|
|
203
|
-
function wo(e, t) {
|
|
204
|
-
const n = $e(e.target);
|
|
205
|
-
return e instanceof n.KeyboardEvent ? "keyboard" : e instanceof n.FocusEvent ? t || "keyboard" : "pointerType" in e ? e.pointerType || "keyboard" : "touches" in e ? "touch" : e instanceof n.MouseEvent ? t || (e.detail === 0 ? "keyboard" : "mouse") : "";
|
|
206
|
-
}
|
|
207
|
-
const Ot = 20;
|
|
208
|
-
let ue = [];
|
|
209
|
-
function at() {
|
|
210
|
-
ue = ue.filter((e) => e.isConnected);
|
|
211
|
-
}
|
|
212
|
-
function xo(e) {
|
|
213
|
-
at(), e && Ut(e) !== "body" && (ue.push(e), ue.length > Ot && (ue = ue.slice(-Ot)));
|
|
214
|
-
}
|
|
215
|
-
function Ze() {
|
|
216
|
-
return at(), ue[ue.length - 1];
|
|
217
|
-
}
|
|
218
|
-
function Do(e) {
|
|
219
|
-
if (!e)
|
|
220
|
-
return null;
|
|
221
|
-
const t = st();
|
|
222
|
-
return qt(e, t) ? e : Yt(e, t)[0] || e;
|
|
223
|
-
}
|
|
224
|
-
function ko(e) {
|
|
225
|
-
return !e || !e.isConnected ? !1 : typeof e.checkVisibility == "function" ? e.checkVisibility() : Gt(e).display !== "none";
|
|
226
|
-
}
|
|
227
|
-
function wt(e, t) {
|
|
228
|
-
if (!t.current.includes("floating") && !e.getAttribute("role")?.includes("dialog"))
|
|
229
|
-
return;
|
|
230
|
-
const n = st(), r = Zn(e, n).filter((a) => {
|
|
231
|
-
const l = a.getAttribute("data-tabindex") || "";
|
|
232
|
-
return qt(a, n) || a.hasAttribute("data-tabindex") && !l.startsWith("-");
|
|
233
|
-
}), s = e.getAttribute("tabindex");
|
|
234
|
-
t.current.includes("floating") || r.length === 0 ? s !== "0" && e.setAttribute("tabindex", "0") : (s !== "-1" || e.hasAttribute("data-tabindex") && e.getAttribute("data-tabindex") !== "-1") && (e.setAttribute("tabindex", "-1"), e.setAttribute("data-tabindex", "-1"));
|
|
235
|
-
}
|
|
236
|
-
function Io(e) {
|
|
237
|
-
const {
|
|
238
|
-
context: t,
|
|
239
|
-
children: n,
|
|
240
|
-
disabled: o = !1,
|
|
241
|
-
order: r = ["content"],
|
|
242
|
-
initialFocus: s = !0,
|
|
243
|
-
returnFocus: a = !0,
|
|
244
|
-
restoreFocus: l = !1,
|
|
245
|
-
modal: i = !0,
|
|
246
|
-
closeOnFocusOut: c = !0,
|
|
247
|
-
openInteractionType: f = "",
|
|
248
|
-
getInsideElements: h = () => [],
|
|
249
|
-
nextFocusableElement: p,
|
|
250
|
-
previousFocusableElement: m,
|
|
251
|
-
beforeContentFocusGuardRef: g,
|
|
252
|
-
externalTree: b
|
|
253
|
-
} = e, C = "rootStore" in t ? t.rootStore : t, T = C.useState("open"), y = C.useState("domReferenceElement"), E = C.useState("floatingElement"), {
|
|
254
|
-
events: x,
|
|
255
|
-
dataRef: k
|
|
256
|
-
} = C.context, w = V(() => k.current.floatingContext?.nodeId), D = V(h), I = s === !1, B = mt(y) && I, W = Ve(r), H = Ve(s), q = Ve(a), Oe = Ve(f), G = sn(b), F = qn(), ae = u.useRef(null), Ge = u.useRef(null), U = u.useRef(!1), ie = u.useRef(!1), me = u.useRef(!1), Pe = u.useRef(-1), he = u.useRef(""), te = u.useRef(""), Ae = Ne(), Ee = Ne(), Fe = Vt(), fe = F != null, N = ot(E), J = V((S = N) => S ? Yt(S, st()) : []), ce = V((S) => {
|
|
257
|
-
const O = J(S);
|
|
258
|
-
return W.current.map(() => O).filter(Boolean).flat();
|
|
259
|
-
});
|
|
260
|
-
u.useEffect(() => {
|
|
261
|
-
if (o || !i)
|
|
262
|
-
return;
|
|
263
|
-
function S(j) {
|
|
264
|
-
j.key === "Tab" && $(N, xe(oe(N))) && J().length === 0 && !B && co(j);
|
|
265
|
-
}
|
|
266
|
-
const O = oe(N);
|
|
267
|
-
return O.addEventListener("keydown", S), () => {
|
|
268
|
-
O.removeEventListener("keydown", S);
|
|
269
|
-
};
|
|
270
|
-
}, [o, y, N, i, W, B, J, ce]), u.useEffect(() => {
|
|
271
|
-
if (o || !E)
|
|
272
|
-
return;
|
|
273
|
-
function S(O) {
|
|
274
|
-
const j = re(O), z = J().indexOf(j);
|
|
275
|
-
z !== -1 && (Pe.current = z);
|
|
276
|
-
}
|
|
277
|
-
return E.addEventListener("focusin", S), () => {
|
|
278
|
-
E.removeEventListener("focusin", S);
|
|
279
|
-
};
|
|
280
|
-
}, [o, E, J]), u.useEffect(() => {
|
|
281
|
-
if (o || !T)
|
|
282
|
-
return;
|
|
283
|
-
const S = oe(N);
|
|
284
|
-
function O() {
|
|
285
|
-
me.current = !1;
|
|
286
|
-
}
|
|
287
|
-
function j(z) {
|
|
288
|
-
const v = re(z), M = $(E, v) || $(y, v) || $(F?.portalNode, v);
|
|
289
|
-
me.current = !M, te.current = z.pointerType || "keyboard";
|
|
290
|
-
}
|
|
291
|
-
function L() {
|
|
292
|
-
te.current = "keyboard";
|
|
293
|
-
}
|
|
294
|
-
return S.addEventListener("pointerdown", j, !0), S.addEventListener("pointerup", O, !0), S.addEventListener("pointercancel", O, !0), S.addEventListener("keydown", L, !0), () => {
|
|
295
|
-
S.removeEventListener("pointerdown", j, !0), S.removeEventListener("pointerup", O, !0), S.removeEventListener("pointercancel", O, !0), S.removeEventListener("keydown", L, !0);
|
|
296
|
-
};
|
|
297
|
-
}, [o, E, y, N, T, F]), u.useEffect(() => {
|
|
298
|
-
if (o || !c)
|
|
299
|
-
return;
|
|
300
|
-
function S() {
|
|
301
|
-
ie.current = !0, Ee.start(0, () => {
|
|
302
|
-
ie.current = !1;
|
|
303
|
-
});
|
|
304
|
-
}
|
|
305
|
-
function O(v) {
|
|
306
|
-
const M = v.relatedTarget, le = v.currentTarget, X = re(v);
|
|
307
|
-
queueMicrotask(() => {
|
|
308
|
-
const ye = w(), _e = C.context.triggerElements, Ye = !($(y, M) || $(E, M) || $(M, E) || $(F?.portalNode, M) || M != null && _e.hasElement(M) || _e.hasMatchingElement((Q) => $(Q, M)) || M?.hasAttribute(rt("focus-guard")) || G && (Se(G.nodesRef.current, ye).find((Q) => $(Q.context?.elements.floating, M) || $(Q.context?.elements.domReference, M)) || bt(G.nodesRef.current, ye).find((Q) => [Q.context?.elements.floating, ot(Q.context?.elements.floating)].includes(M) || Q.context?.elements.domReference === M)));
|
|
309
|
-
if (le === y && N && wt(N, W), l && le !== y && !ko(X) && xe(oe(N)) === oe(N).body) {
|
|
310
|
-
if (ve(N) && (N.focus(), l === "popup")) {
|
|
311
|
-
Fe.request(() => {
|
|
312
|
-
N.focus();
|
|
313
|
-
});
|
|
314
|
-
return;
|
|
315
|
-
}
|
|
316
|
-
const Q = Pe.current, we = J(), Le = we[Q] || we[we.length - 1] || N;
|
|
317
|
-
ve(Le) && Le.focus();
|
|
318
|
-
}
|
|
319
|
-
if (k.current.insideReactTree) {
|
|
320
|
-
k.current.insideReactTree = !1;
|
|
321
|
-
return;
|
|
322
|
-
}
|
|
323
|
-
(B || !i) && M && Ye && !ie.current && // Fix React 18 Strict Mode returnFocus due to double rendering.
|
|
324
|
-
// For an "untrapped" typeable combobox (input role=combobox with
|
|
325
|
-
// initialFocus=false), re-opening the popup and tabbing out should still close it even
|
|
326
|
-
// when the previously focused element (e.g. the next tabbable outside the popup) is
|
|
327
|
-
// focused again. Otherwise, the popup remains open on the second Tab sequence:
|
|
328
|
-
// click input -> Tab (closes) -> click input -> Tab.
|
|
329
|
-
// Allow closing when `isUntrappedTypeableCombobox` regardless of the previously focused element.
|
|
330
|
-
(B || M !== Ze()) && (U.current = !0, C.setOpen(!1, se(Bn, v)));
|
|
331
|
-
});
|
|
332
|
-
}
|
|
333
|
-
function j() {
|
|
334
|
-
me.current || (k.current.insideReactTree = !0, Ae.start(0, () => {
|
|
335
|
-
k.current.insideReactTree = !1;
|
|
336
|
-
}));
|
|
337
|
-
}
|
|
338
|
-
const L = ve(y) ? y : null, z = [];
|
|
339
|
-
if (!(!E && !L))
|
|
340
|
-
return L && (L.addEventListener("focusout", O), L.addEventListener("pointerdown", S), z.push(() => {
|
|
341
|
-
L.removeEventListener("focusout", O), L.removeEventListener("pointerdown", S);
|
|
342
|
-
})), E && (E.addEventListener("focusout", O), F && (E.addEventListener("focusout", j, !0), z.push(() => {
|
|
343
|
-
E.removeEventListener("focusout", j, !0);
|
|
344
|
-
})), z.push(() => {
|
|
345
|
-
E.removeEventListener("focusout", O);
|
|
346
|
-
})), () => {
|
|
347
|
-
z.forEach((v) => {
|
|
348
|
-
v();
|
|
349
|
-
});
|
|
350
|
-
};
|
|
351
|
-
}, [o, y, E, N, i, G, F, C, c, l, J, B, w, W, k, Ae, Ee, Fe]);
|
|
352
|
-
const d = u.useRef(null), P = u.useRef(null), R = pt(d, g, F?.beforeInsideRef), Y = pt(P, F?.afterInsideRef);
|
|
353
|
-
u.useEffect(() => {
|
|
354
|
-
if (o || !E || !T)
|
|
355
|
-
return;
|
|
356
|
-
const S = Array.from(F?.portalNode?.querySelectorAll(`[${rt("portal")}]`) || []), j = (G ? bt(G.nodesRef.current, w()) : []).find((v) => mt(v.context?.elements.domReference || null))?.context?.elements.domReference, L = [E, j, ...S, ...D(), ae.current, Ge.current, d.current, P.current, F?.beforeOutsideRef.current, F?.afterOutsideRef.current, be(m), be(p), B ? y : null].filter((v) => v != null), z = Oo(L, i || B);
|
|
357
|
-
return () => {
|
|
358
|
-
z();
|
|
359
|
-
};
|
|
360
|
-
}, [T, o, y, E, i, W, F, B, G, w, D, p, m]), Z(() => {
|
|
361
|
-
if (!T || o || !ve(N))
|
|
362
|
-
return;
|
|
363
|
-
const S = oe(N), O = xe(S);
|
|
364
|
-
queueMicrotask(() => {
|
|
365
|
-
const j = ce(N), L = H.current, z = typeof L == "function" ? L(Oe.current || "") : L;
|
|
366
|
-
if (z === void 0 || z === !1)
|
|
367
|
-
return;
|
|
368
|
-
let v;
|
|
369
|
-
z === !0 || z === null ? v = j[0] || N : v = be(z), v = v || j[0] || N, !$(N, O) && Je(v, {
|
|
370
|
-
preventScroll: v === N
|
|
371
|
-
});
|
|
372
|
-
});
|
|
373
|
-
}, [o, T, N, I, ce, H, Oe]), Z(() => {
|
|
374
|
-
if (o || !N)
|
|
375
|
-
return;
|
|
376
|
-
const S = oe(N), O = xe(S);
|
|
377
|
-
xo(O);
|
|
378
|
-
function j(v) {
|
|
379
|
-
if (v.open || (he.current = wo(v.nativeEvent, te.current)), v.reason === Vn && v.nativeEvent.type === "mouseleave" && (U.current = !0), v.reason === Bt)
|
|
380
|
-
if (v.nested)
|
|
381
|
-
U.current = !1;
|
|
382
|
-
else if (ao(v.nativeEvent) || lo(v.nativeEvent))
|
|
383
|
-
U.current = !1;
|
|
384
|
-
else {
|
|
385
|
-
let M = !1;
|
|
386
|
-
document.createElement("div").focus({
|
|
387
|
-
get preventScroll() {
|
|
388
|
-
return M = !0, !1;
|
|
389
|
-
}
|
|
390
|
-
}), M ? U.current = !1 : U.current = !0;
|
|
391
|
-
}
|
|
392
|
-
}
|
|
393
|
-
x.on("openchange", j);
|
|
394
|
-
const L = S.createElement("span");
|
|
395
|
-
L.setAttribute("tabindex", "-1"), L.setAttribute("aria-hidden", "true"), Object.assign(L.style, Xn), fe && y && y.insertAdjacentElement("afterend", L);
|
|
396
|
-
function z() {
|
|
397
|
-
const v = q.current;
|
|
398
|
-
let M = typeof v == "function" ? v(he.current) : v;
|
|
399
|
-
if (M === void 0 || M === !1)
|
|
400
|
-
return null;
|
|
401
|
-
if (M === null && (M = !0), typeof M == "boolean") {
|
|
402
|
-
const X = y || Ze();
|
|
403
|
-
return X && X.isConnected ? X : L;
|
|
404
|
-
}
|
|
405
|
-
const le = y || Ze() || L;
|
|
406
|
-
return be(M) || le;
|
|
407
|
-
}
|
|
408
|
-
return () => {
|
|
409
|
-
x.off("openchange", j);
|
|
410
|
-
const v = xe(S), M = $(E, v) || G && Se(G.nodesRef.current, w(), !1).some((X) => $(X.context?.elements.floating, v)), le = z();
|
|
411
|
-
queueMicrotask(() => {
|
|
412
|
-
const X = Do(le), ye = typeof q.current != "boolean";
|
|
413
|
-
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
414
|
-
q.current && !U.current && ve(X) && // If the focus moved somewhere else after mount, avoid returning focus
|
|
415
|
-
// since it likely entered a different element which should be
|
|
416
|
-
// respected: https://github.com/floating-ui/floating-ui/issues/2607
|
|
417
|
-
(!(!ye && X !== v && v !== S.body) || M) && X.focus({
|
|
418
|
-
preventScroll: !0
|
|
419
|
-
}), L.remove();
|
|
420
|
-
});
|
|
421
|
-
};
|
|
422
|
-
}, [o, E, N, q, k, x, G, fe, y, w]), u.useEffect(() => {
|
|
423
|
-
queueMicrotask(() => {
|
|
424
|
-
U.current = !1;
|
|
425
|
-
});
|
|
426
|
-
}, [o]), u.useEffect(() => {
|
|
427
|
-
if (o || !T)
|
|
428
|
-
return;
|
|
429
|
-
function S(j) {
|
|
430
|
-
re(j)?.closest(`[${Xt}]`) && (ie.current = !0);
|
|
431
|
-
}
|
|
432
|
-
const O = oe(N);
|
|
433
|
-
return O.addEventListener("pointerdown", S, !0), () => {
|
|
434
|
-
O.removeEventListener("pointerdown", S, !0);
|
|
435
|
-
};
|
|
436
|
-
}, [o, T, N]), Z(() => {
|
|
437
|
-
if (!o && F)
|
|
438
|
-
return F.setFocusManagerState({
|
|
439
|
-
modal: i,
|
|
440
|
-
closeOnFocusOut: c,
|
|
441
|
-
open: T,
|
|
442
|
-
onOpenChange: C.setOpen,
|
|
443
|
-
domReference: y
|
|
444
|
-
}), () => {
|
|
445
|
-
F.setFocusManagerState(null);
|
|
446
|
-
};
|
|
447
|
-
}, [o, F, i, T, C, c, y]), Z(() => {
|
|
448
|
-
if (!(o || !N))
|
|
449
|
-
return wt(N, W), () => {
|
|
450
|
-
queueMicrotask(at);
|
|
451
|
-
};
|
|
452
|
-
}, [o, N, W]);
|
|
453
|
-
const A = !o && (i ? !B : !0) && (fe || i);
|
|
454
|
-
return /* @__PURE__ */ At(u.Fragment, {
|
|
455
|
-
children: [A && /* @__PURE__ */ K(ht, {
|
|
456
|
-
"data-type": "inside",
|
|
457
|
-
ref: R,
|
|
458
|
-
onFocus: (S) => {
|
|
459
|
-
if (i) {
|
|
460
|
-
const O = ce();
|
|
461
|
-
Je(O[O.length - 1]);
|
|
462
|
-
} else F?.portalNode && (U.current = !1, Et(S, F.portalNode) ? Jn(y)?.focus() : be(m ?? F.beforeOutsideRef)?.focus());
|
|
463
|
-
}
|
|
464
|
-
}), n, A && /* @__PURE__ */ K(ht, {
|
|
465
|
-
"data-type": "inside",
|
|
466
|
-
ref: Y,
|
|
467
|
-
onFocus: (S) => {
|
|
468
|
-
i ? Je(ce()[0]) : F?.portalNode && (c && (U.current = !0), Et(S, F.portalNode) ? Qn(y)?.focus() : be(p ?? F.afterOutsideRef)?.focus());
|
|
469
|
-
}
|
|
470
|
-
})]
|
|
471
|
-
});
|
|
472
|
-
}
|
|
473
|
-
function No(e, t = {}) {
|
|
474
|
-
const n = "rootStore" in e ? e.rootStore : e, o = n.context.dataRef, {
|
|
475
|
-
enabled: r = !0,
|
|
476
|
-
event: s = "click",
|
|
477
|
-
toggle: a = !0,
|
|
478
|
-
ignoreMouse: l = !1,
|
|
479
|
-
stickIfOpen: i = !0,
|
|
480
|
-
touchOpenDelay: c = 0
|
|
481
|
-
} = t, f = u.useRef(void 0), h = Vt(), p = Ne(), m = u.useMemo(() => ({
|
|
482
|
-
onPointerDown(g) {
|
|
483
|
-
f.current = g.pointerType;
|
|
484
|
-
},
|
|
485
|
-
onMouseDown(g) {
|
|
486
|
-
const b = f.current, C = g.nativeEvent, T = n.select("open");
|
|
487
|
-
if (g.button !== 0 || s === "click" || yt(b) && l)
|
|
488
|
-
return;
|
|
489
|
-
const y = o.current.openEvent, E = y?.type, x = n.select("domReferenceElement") !== g.currentTarget, k = T && x || !(T && a && (!(y && i) || E === "click" || E === "mousedown"));
|
|
490
|
-
if (eo(C.target)) {
|
|
491
|
-
const D = se(De, C, C.target);
|
|
492
|
-
k && b === "touch" && c > 0 ? p.start(c, () => {
|
|
493
|
-
n.setOpen(!0, D);
|
|
494
|
-
}) : n.setOpen(k, D);
|
|
495
|
-
return;
|
|
496
|
-
}
|
|
497
|
-
const w = g.currentTarget;
|
|
498
|
-
h.request(() => {
|
|
499
|
-
const D = se(De, C, w);
|
|
500
|
-
k && b === "touch" && c > 0 ? p.start(c, () => {
|
|
501
|
-
n.setOpen(!0, D);
|
|
502
|
-
}) : n.setOpen(k, D);
|
|
503
|
-
});
|
|
504
|
-
},
|
|
505
|
-
onClick(g) {
|
|
506
|
-
if (s === "mousedown-only")
|
|
507
|
-
return;
|
|
508
|
-
const b = f.current;
|
|
509
|
-
if (s === "mousedown" && b) {
|
|
510
|
-
f.current = void 0;
|
|
511
|
-
return;
|
|
512
|
-
}
|
|
513
|
-
if (yt(b) && l)
|
|
514
|
-
return;
|
|
515
|
-
const C = n.select("open"), T = o.current.openEvent, y = n.select("domReferenceElement") !== g.currentTarget, E = C && y || !(C && a && (!(T && i) || en(T))), x = se(De, g.nativeEvent, g.currentTarget);
|
|
516
|
-
E && b === "touch" && c > 0 ? p.start(c, () => {
|
|
517
|
-
n.setOpen(!0, x);
|
|
518
|
-
}) : n.setOpen(E, x);
|
|
519
|
-
},
|
|
520
|
-
onKeyDown() {
|
|
521
|
-
f.current = void 0;
|
|
522
|
-
}
|
|
523
|
-
}), [o, s, l, n, i, a, h, p, c]);
|
|
524
|
-
return u.useMemo(() => r ? {
|
|
525
|
-
reference: m
|
|
526
|
-
} : ke, [r, m]);
|
|
527
|
-
}
|
|
528
|
-
const Mo = {
|
|
529
|
-
intentional: "onClick",
|
|
530
|
-
sloppy: "onPointerDown"
|
|
531
|
-
};
|
|
532
|
-
function Po(e) {
|
|
533
|
-
return {
|
|
534
|
-
escapeKey: typeof e == "boolean" ? e : e?.escapeKey ?? !1,
|
|
535
|
-
outsidePress: typeof e == "boolean" ? e : e?.outsidePress ?? !0
|
|
536
|
-
};
|
|
537
|
-
}
|
|
538
|
-
function Ao(e, t = {}) {
|
|
539
|
-
const n = "rootStore" in e ? e.rootStore : e, o = n.useState("open"), r = n.useState("floatingElement"), s = n.useState("referenceElement"), a = n.useState("domReferenceElement"), {
|
|
540
|
-
onOpenChange: l,
|
|
541
|
-
dataRef: i
|
|
542
|
-
} = n.context, {
|
|
543
|
-
enabled: c = !0,
|
|
544
|
-
escapeKey: f = !0,
|
|
545
|
-
outsidePress: h = !0,
|
|
546
|
-
outsidePressEvent: p = "sloppy",
|
|
547
|
-
referencePress: m = !1,
|
|
548
|
-
referencePressEvent: g = "sloppy",
|
|
549
|
-
ancestorScroll: b = !1,
|
|
550
|
-
bubbles: C,
|
|
551
|
-
externalTree: T
|
|
552
|
-
} = t, y = sn(T), E = V(typeof h == "function" ? h : () => !1), x = typeof h == "function" ? E : h, k = u.useRef(!1), {
|
|
553
|
-
escapeKey: w,
|
|
554
|
-
outsidePress: D
|
|
555
|
-
} = Po(C), I = u.useRef(null), B = Ne(), W = Ne(), H = V(() => {
|
|
556
|
-
W.clear(), i.current.insideReactTree = !1;
|
|
557
|
-
}), q = u.useRef(!1), Oe = u.useRef(""), G = V((d) => {
|
|
558
|
-
Oe.current = d.pointerType;
|
|
559
|
-
}), F = V(() => {
|
|
560
|
-
const d = Oe.current, P = d === "pen" || !d ? "mouse" : d, R = typeof p == "function" ? p() : p;
|
|
561
|
-
return typeof R == "string" ? R : R[P];
|
|
562
|
-
}), ae = V((d) => {
|
|
563
|
-
if (!o || !c || !f || d.key !== "Escape" || q.current)
|
|
564
|
-
return;
|
|
565
|
-
const P = i.current.floatingContext?.nodeId, R = y ? Se(y.nodesRef.current, P) : [];
|
|
566
|
-
if (!w && R.length > 0) {
|
|
567
|
-
let S = !0;
|
|
568
|
-
if (R.forEach((O) => {
|
|
569
|
-
O.context?.open && !O.context.dataRef.current.__escapeKeyBubbles && (S = !1);
|
|
570
|
-
}), !S)
|
|
571
|
-
return;
|
|
572
|
-
}
|
|
573
|
-
const Y = uo(d) ? d.nativeEvent : d, A = se(Wn, Y);
|
|
574
|
-
n.setOpen(!1, A), !w && !A.isPropagationAllowed && d.stopPropagation();
|
|
575
|
-
}), Ge = V((d) => {
|
|
576
|
-
const P = F();
|
|
577
|
-
return P === "intentional" && d.type !== "click" || P === "sloppy" && d.type === "click";
|
|
578
|
-
}), U = V(() => {
|
|
579
|
-
i.current.insideReactTree = !0, W.start(0, H);
|
|
580
|
-
}), ie = V((d, P = !1) => {
|
|
581
|
-
if (Ge(d)) {
|
|
582
|
-
H();
|
|
583
|
-
return;
|
|
584
|
-
}
|
|
585
|
-
if (i.current.insideReactTree) {
|
|
586
|
-
H();
|
|
587
|
-
return;
|
|
588
|
-
}
|
|
589
|
-
if (F() === "intentional" && P || typeof x == "function" && !x(d))
|
|
590
|
-
return;
|
|
591
|
-
const R = re(d), Y = `[${rt("inert")}]`, A = oe(n.select("floatingElement")).querySelectorAll(Y), S = n.context.triggerElements;
|
|
592
|
-
if (R && (S.hasElement(R) || S.hasMatchingElement((v) => $(v, R))))
|
|
593
|
-
return;
|
|
594
|
-
let O = pe(R) ? R : null;
|
|
595
|
-
for (; O && !qe(O); ) {
|
|
596
|
-
const v = $n(O);
|
|
597
|
-
if (qe(v) || !pe(v))
|
|
598
|
-
break;
|
|
599
|
-
O = v;
|
|
600
|
-
}
|
|
601
|
-
if (A.length && pe(R) && !to(R) && // Clicked on a direct ancestor (e.g. FloatingOverlay).
|
|
602
|
-
!$(R, n.select("floatingElement")) && // If the target root element contains none of the markers, then the
|
|
603
|
-
// element was injected after the floating element rendered.
|
|
604
|
-
Array.from(A).every((v) => !$(O, v)))
|
|
605
|
-
return;
|
|
606
|
-
if (ve(R) && !("touches" in d)) {
|
|
607
|
-
const v = qe(R), M = Gt(R), le = /auto|scroll/, X = v || le.test(M.overflowX), ye = v || le.test(M.overflowY), _e = X && R.clientWidth > 0 && R.scrollWidth > R.clientWidth, Ye = ye && R.clientHeight > 0 && R.scrollHeight > R.clientHeight, Q = M.direction === "rtl", we = Ye && (Q ? d.offsetX <= R.offsetWidth - R.clientWidth : d.offsetX > R.clientWidth), Le = _e && d.offsetY > R.clientHeight;
|
|
608
|
-
if (we || Le)
|
|
609
|
-
return;
|
|
610
|
-
}
|
|
611
|
-
const j = i.current.floatingContext?.nodeId, L = y && Se(y.nodesRef.current, j).some((v) => ne(d, v.context?.elements.floating));
|
|
612
|
-
if (ne(d, n.select("floatingElement")) || ne(d, n.select("domReferenceElement")) || L)
|
|
613
|
-
return;
|
|
614
|
-
const z = y ? Se(y.nodesRef.current, j) : [];
|
|
615
|
-
if (z.length > 0) {
|
|
616
|
-
let v = !0;
|
|
617
|
-
if (z.forEach((M) => {
|
|
618
|
-
M.context?.open && !M.context.dataRef.current.__outsidePressBubbles && (v = !1);
|
|
619
|
-
}), !v)
|
|
620
|
-
return;
|
|
621
|
-
}
|
|
622
|
-
n.setOpen(!1, se(Bt, d)), H();
|
|
623
|
-
}), me = V((d) => {
|
|
624
|
-
F() !== "sloppy" || d.pointerType === "touch" || !n.select("open") || !c || ne(d, n.select("floatingElement")) || ne(d, n.select("domReferenceElement")) || ie(d);
|
|
625
|
-
}), Pe = V((d) => {
|
|
626
|
-
if (F() !== "sloppy" || !n.select("open") || !c || ne(d, n.select("floatingElement")) || ne(d, n.select("domReferenceElement")))
|
|
627
|
-
return;
|
|
628
|
-
const P = d.touches[0];
|
|
629
|
-
P && (I.current = {
|
|
630
|
-
startTime: Date.now(),
|
|
631
|
-
startX: P.clientX,
|
|
632
|
-
startY: P.clientY,
|
|
633
|
-
dismissOnTouchEnd: !1,
|
|
634
|
-
dismissOnMouseDown: !0
|
|
635
|
-
}, B.start(1e3, () => {
|
|
636
|
-
I.current && (I.current.dismissOnTouchEnd = !1, I.current.dismissOnMouseDown = !1);
|
|
637
|
-
}));
|
|
638
|
-
}), he = V((d) => {
|
|
639
|
-
const P = re(d);
|
|
640
|
-
function R() {
|
|
641
|
-
Pe(d), P?.removeEventListener(d.type, R);
|
|
642
|
-
}
|
|
643
|
-
P?.addEventListener(d.type, R);
|
|
644
|
-
}), te = V((d) => {
|
|
645
|
-
const P = k.current;
|
|
646
|
-
if (k.current = !1, B.clear(), d.type === "mousedown" && I.current && !I.current.dismissOnMouseDown)
|
|
647
|
-
return;
|
|
648
|
-
const R = re(d);
|
|
649
|
-
function Y() {
|
|
650
|
-
d.type === "pointerdown" ? me(d) : ie(d, P), R?.removeEventListener(d.type, Y);
|
|
651
|
-
}
|
|
652
|
-
R?.addEventListener(d.type, Y);
|
|
653
|
-
}), Ae = V((d) => {
|
|
654
|
-
if (F() !== "sloppy" || !I.current || ne(d, n.select("floatingElement")) || ne(d, n.select("domReferenceElement")))
|
|
655
|
-
return;
|
|
656
|
-
const P = d.touches[0];
|
|
657
|
-
if (!P)
|
|
658
|
-
return;
|
|
659
|
-
const R = Math.abs(P.clientX - I.current.startX), Y = Math.abs(P.clientY - I.current.startY), A = Math.sqrt(R * R + Y * Y);
|
|
660
|
-
A > 5 && (I.current.dismissOnTouchEnd = !0), A > 10 && (ie(d), B.clear(), I.current = null);
|
|
661
|
-
}), Ee = V((d) => {
|
|
662
|
-
const P = re(d);
|
|
663
|
-
function R() {
|
|
664
|
-
Ae(d), P?.removeEventListener(d.type, R);
|
|
665
|
-
}
|
|
666
|
-
P?.addEventListener(d.type, R);
|
|
667
|
-
}), Fe = V((d) => {
|
|
668
|
-
F() !== "sloppy" || !I.current || ne(d, n.select("floatingElement")) || ne(d, n.select("domReferenceElement")) || (I.current.dismissOnTouchEnd && ie(d), B.clear(), I.current = null);
|
|
669
|
-
}), fe = V((d) => {
|
|
670
|
-
const P = re(d);
|
|
671
|
-
function R() {
|
|
672
|
-
Fe(d), P?.removeEventListener(d.type, R);
|
|
673
|
-
}
|
|
674
|
-
P?.addEventListener(d.type, R);
|
|
675
|
-
});
|
|
676
|
-
u.useEffect(() => {
|
|
677
|
-
if (!o || !c)
|
|
678
|
-
return;
|
|
679
|
-
i.current.__escapeKeyBubbles = w, i.current.__outsidePressBubbles = D;
|
|
680
|
-
const d = new nt();
|
|
681
|
-
function P(O) {
|
|
682
|
-
n.setOpen(!1, se(jn, O));
|
|
683
|
-
}
|
|
684
|
-
function R() {
|
|
685
|
-
d.clear(), q.current = !0;
|
|
686
|
-
}
|
|
687
|
-
function Y() {
|
|
688
|
-
d.start(
|
|
689
|
-
// 0ms or 1ms don't work in Safari. 5ms appears to consistently work.
|
|
690
|
-
// Only apply to WebKit for the test to remain 0ms.
|
|
691
|
-
Un() ? 5 : 0,
|
|
692
|
-
() => {
|
|
693
|
-
q.current = !1;
|
|
694
|
-
}
|
|
695
|
-
);
|
|
696
|
-
}
|
|
697
|
-
const A = oe(r);
|
|
698
|
-
A.addEventListener("pointerdown", G, !0), f && (A.addEventListener("keydown", ae), A.addEventListener("compositionstart", R), A.addEventListener("compositionend", Y)), x && (A.addEventListener("click", te, !0), A.addEventListener("pointerdown", te, !0), A.addEventListener("touchstart", he, !0), A.addEventListener("touchmove", Ee, !0), A.addEventListener("touchend", fe, !0), A.addEventListener("mousedown", te, !0));
|
|
699
|
-
let S = [];
|
|
700
|
-
return b && (pe(a) && (S = Xe(a)), pe(r) && (S = S.concat(Xe(r))), !pe(s) && s && s.contextElement && (S = S.concat(Xe(s.contextElement)))), S = S.filter((O) => O !== A.defaultView?.visualViewport), S.forEach((O) => {
|
|
701
|
-
O.addEventListener("scroll", P, {
|
|
702
|
-
passive: !0
|
|
703
|
-
});
|
|
704
|
-
}), () => {
|
|
705
|
-
A.removeEventListener("pointerdown", G, !0), f && (A.removeEventListener("keydown", ae), A.removeEventListener("compositionstart", R), A.removeEventListener("compositionend", Y)), x && (A.removeEventListener("click", te, !0), A.removeEventListener("pointerdown", te, !0), A.removeEventListener("touchstart", he, !0), A.removeEventListener("touchmove", Ee, !0), A.removeEventListener("touchend", fe, !0), A.removeEventListener("mousedown", te, !0)), S.forEach((O) => {
|
|
706
|
-
O.removeEventListener("scroll", P);
|
|
707
|
-
}), d.clear();
|
|
708
|
-
};
|
|
709
|
-
}, [i, r, s, a, f, x, o, l, b, c, w, D, ae, ie, te, me, he, Ee, fe, G, n]), u.useEffect(H, [x, H]);
|
|
710
|
-
const N = u.useMemo(() => ({
|
|
711
|
-
onKeyDown: ae,
|
|
712
|
-
...m && {
|
|
713
|
-
[Mo[g]]: (d) => {
|
|
714
|
-
n.setOpen(!1, se(De, d.nativeEvent));
|
|
715
|
-
},
|
|
716
|
-
...g !== "intentional" && {
|
|
717
|
-
onClick(d) {
|
|
718
|
-
n.setOpen(!1, se(De, d.nativeEvent));
|
|
719
|
-
}
|
|
720
|
-
}
|
|
721
|
-
}
|
|
722
|
-
}), [ae, n, m, g]), J = V((d) => {
|
|
723
|
-
const P = re(d.nativeEvent);
|
|
724
|
-
!$(n.select("floatingElement"), P) || d.button !== 0 || (k.current = !0);
|
|
725
|
-
}), ce = u.useMemo(() => ({
|
|
726
|
-
onKeyDown: ae,
|
|
727
|
-
// `onMouseDown` may be blocked if `event.preventDefault()` is called in
|
|
728
|
-
// `onPointerDown`, such as with <NumberField.ScrubArea>.
|
|
729
|
-
// See https://github.com/mui/base-ui/pull/3379
|
|
730
|
-
onPointerDown: J,
|
|
731
|
-
onMouseDown: J,
|
|
732
|
-
onMouseUp: J,
|
|
733
|
-
onClickCapture: U,
|
|
734
|
-
onMouseDownCapture: U,
|
|
735
|
-
onPointerDownCapture: U,
|
|
736
|
-
onMouseUpCapture: U,
|
|
737
|
-
onTouchEndCapture: U,
|
|
738
|
-
onTouchMoveCapture: U
|
|
739
|
-
}), [ae, J, U]);
|
|
740
|
-
return u.useMemo(() => c ? {
|
|
741
|
-
reference: N,
|
|
742
|
-
floating: ce,
|
|
743
|
-
trigger: N
|
|
744
|
-
} : {}, [c, N, ce]);
|
|
745
|
-
}
|
|
746
|
-
var Fo = (e, t, n) => {
|
|
747
|
-
if (t.length === 1 && t[0] === n) {
|
|
748
|
-
let o = !1;
|
|
749
|
-
try {
|
|
750
|
-
const r = {};
|
|
751
|
-
e(r) === r && (o = !0);
|
|
752
|
-
} catch {
|
|
753
|
-
}
|
|
754
|
-
if (o) {
|
|
755
|
-
let r;
|
|
756
|
-
try {
|
|
757
|
-
throw new Error();
|
|
758
|
-
} catch (s) {
|
|
759
|
-
({ stack: r } = s);
|
|
760
|
-
}
|
|
761
|
-
console.warn(
|
|
762
|
-
`The result function returned its own inputs without modification. e.g
|
|
763
|
-
\`createSelector([state => state.todos], todos => todos)\`
|
|
764
|
-
This could lead to inefficient memoization and unnecessary re-renders.
|
|
765
|
-
Ensure transformation logic is in the result function, and extraction logic is in the input selectors.`,
|
|
766
|
-
{ stack: r }
|
|
767
|
-
);
|
|
768
|
-
}
|
|
769
|
-
}
|
|
770
|
-
}, _o = (e, t, n) => {
|
|
771
|
-
const { memoize: o, memoizeOptions: r } = t, { inputSelectorResults: s, inputSelectorResultsCopy: a } = e, l = o(() => ({}), ...r);
|
|
772
|
-
if (!(l.apply(null, s) === l.apply(null, a))) {
|
|
773
|
-
let c;
|
|
774
|
-
try {
|
|
775
|
-
throw new Error();
|
|
776
|
-
} catch (f) {
|
|
777
|
-
({ stack: c } = f);
|
|
778
|
-
}
|
|
779
|
-
console.warn(
|
|
780
|
-
`An input selector returned a different result when passed same arguments.
|
|
781
|
-
This means your output selector will likely run more frequently than intended.
|
|
782
|
-
Avoid returning a new reference inside your input selector, e.g.
|
|
783
|
-
\`createSelector([state => state.todos.map(todo => todo.id)], todoIds => todoIds.length)\``,
|
|
784
|
-
{
|
|
785
|
-
arguments: n,
|
|
786
|
-
firstInputs: s,
|
|
787
|
-
secondInputs: a,
|
|
788
|
-
stack: c
|
|
789
|
-
}
|
|
790
|
-
);
|
|
791
|
-
}
|
|
792
|
-
}, Lo = {
|
|
793
|
-
inputStabilityCheck: "once",
|
|
794
|
-
identityFunctionCheck: "once"
|
|
795
|
-
}, He = /* @__PURE__ */ Symbol("NOT_FOUND");
|
|
796
|
-
function Vo(e, t = `expected a function, instead received ${typeof e}`) {
|
|
797
|
-
if (typeof e != "function")
|
|
798
|
-
throw new TypeError(t);
|
|
799
|
-
}
|
|
800
|
-
function Bo(e, t = `expected an object, instead received ${typeof e}`) {
|
|
801
|
-
if (typeof e != "object")
|
|
802
|
-
throw new TypeError(t);
|
|
803
|
-
}
|
|
804
|
-
function Wo(e, t = "expected all items to be functions, instead received the following types: ") {
|
|
805
|
-
if (!e.every((n) => typeof n == "function")) {
|
|
806
|
-
const n = e.map(
|
|
807
|
-
(o) => typeof o == "function" ? `function ${o.name || "unnamed"}()` : typeof o
|
|
808
|
-
).join(", ");
|
|
809
|
-
throw new TypeError(`${t}[${n}]`);
|
|
810
|
-
}
|
|
811
|
-
}
|
|
812
|
-
var xt = (e) => Array.isArray(e) ? e : [e];
|
|
813
|
-
function jo(e) {
|
|
814
|
-
const t = Array.isArray(e[0]) ? e[0] : e;
|
|
815
|
-
return Wo(
|
|
816
|
-
t,
|
|
817
|
-
"createSelector expects all input-selectors to be functions, but received the following types: "
|
|
818
|
-
), t;
|
|
819
|
-
}
|
|
820
|
-
function Dt(e, t) {
|
|
821
|
-
const n = [], { length: o } = e;
|
|
822
|
-
for (let r = 0; r < o; r++)
|
|
823
|
-
n.push(e[r].apply(null, t));
|
|
824
|
-
return n;
|
|
825
|
-
}
|
|
826
|
-
var zo = (e, t) => {
|
|
827
|
-
const { identityFunctionCheck: n, inputStabilityCheck: o } = {
|
|
828
|
-
...Lo,
|
|
829
|
-
...t
|
|
830
|
-
};
|
|
831
|
-
return {
|
|
832
|
-
identityFunctionCheck: {
|
|
833
|
-
shouldRun: n === "always" || n === "once" && e,
|
|
834
|
-
run: Fo
|
|
835
|
-
},
|
|
836
|
-
inputStabilityCheck: {
|
|
837
|
-
shouldRun: o === "always" || o === "once" && e,
|
|
838
|
-
run: _o
|
|
839
|
-
}
|
|
840
|
-
};
|
|
841
|
-
};
|
|
842
|
-
function Ko(e) {
|
|
843
|
-
let t;
|
|
844
|
-
return {
|
|
845
|
-
get(n) {
|
|
846
|
-
return t && e(t.key, n) ? t.value : He;
|
|
847
|
-
},
|
|
848
|
-
put(n, o) {
|
|
849
|
-
t = { key: n, value: o };
|
|
850
|
-
},
|
|
851
|
-
getEntries() {
|
|
852
|
-
return t ? [t] : [];
|
|
853
|
-
},
|
|
854
|
-
clear() {
|
|
855
|
-
t = void 0;
|
|
856
|
-
}
|
|
857
|
-
};
|
|
858
|
-
}
|
|
859
|
-
function Ho(e, t) {
|
|
860
|
-
let n = [];
|
|
861
|
-
function o(l) {
|
|
862
|
-
const i = n.findIndex((c) => t(l, c.key));
|
|
863
|
-
if (i > -1) {
|
|
864
|
-
const c = n[i];
|
|
865
|
-
return i > 0 && (n.splice(i, 1), n.unshift(c)), c.value;
|
|
866
|
-
}
|
|
867
|
-
return He;
|
|
868
|
-
}
|
|
869
|
-
function r(l, i) {
|
|
870
|
-
o(l) === He && (n.unshift({ key: l, value: i }), n.length > e && n.pop());
|
|
871
|
-
}
|
|
872
|
-
function s() {
|
|
873
|
-
return n;
|
|
874
|
-
}
|
|
875
|
-
function a() {
|
|
876
|
-
n = [];
|
|
877
|
-
}
|
|
878
|
-
return { get: o, put: r, getEntries: s, clear: a };
|
|
879
|
-
}
|
|
880
|
-
var $o = (e, t) => e === t;
|
|
881
|
-
function Uo(e) {
|
|
882
|
-
return function(n, o) {
|
|
883
|
-
if (n === null || o === null || n.length !== o.length)
|
|
884
|
-
return !1;
|
|
885
|
-
const { length: r } = n;
|
|
886
|
-
for (let s = 0; s < r; s++)
|
|
887
|
-
if (!e(n[s], o[s]))
|
|
888
|
-
return !1;
|
|
889
|
-
return !0;
|
|
890
|
-
};
|
|
891
|
-
}
|
|
892
|
-
function Go(e, t) {
|
|
893
|
-
const n = typeof t == "object" ? t : { equalityCheck: t }, {
|
|
894
|
-
equalityCheck: o = $o,
|
|
895
|
-
maxSize: r = 1,
|
|
896
|
-
resultEqualityCheck: s
|
|
897
|
-
} = n, a = Uo(o);
|
|
898
|
-
let l = 0;
|
|
899
|
-
const i = r <= 1 ? Ko(a) : Ho(r, a);
|
|
900
|
-
function c() {
|
|
901
|
-
let f = i.get(arguments);
|
|
902
|
-
if (f === He) {
|
|
903
|
-
if (f = e.apply(null, arguments), l++, s) {
|
|
904
|
-
const p = i.getEntries().find(
|
|
905
|
-
(m) => s(m.value, f)
|
|
906
|
-
);
|
|
907
|
-
p && (f = p.value, l !== 0 && l--);
|
|
908
|
-
}
|
|
909
|
-
i.put(arguments, f);
|
|
910
|
-
}
|
|
911
|
-
return f;
|
|
912
|
-
}
|
|
913
|
-
return c.clearCache = () => {
|
|
914
|
-
i.clear(), c.resetResultsCount();
|
|
915
|
-
}, c.resultsCount = () => l, c.resetResultsCount = () => {
|
|
916
|
-
l = 0;
|
|
917
|
-
}, c;
|
|
918
|
-
}
|
|
919
|
-
var Yo = class {
|
|
920
|
-
constructor(e) {
|
|
921
|
-
this.value = e;
|
|
922
|
-
}
|
|
923
|
-
deref() {
|
|
924
|
-
return this.value;
|
|
925
|
-
}
|
|
926
|
-
}, qo = typeof WeakRef < "u" ? WeakRef : Yo, Xo = 0, kt = 1;
|
|
927
|
-
function je() {
|
|
928
|
-
return {
|
|
929
|
-
s: Xo,
|
|
930
|
-
v: void 0,
|
|
931
|
-
o: null,
|
|
932
|
-
p: null
|
|
933
|
-
};
|
|
934
|
-
}
|
|
935
|
-
function ln(e, t = {}) {
|
|
936
|
-
let n = je();
|
|
937
|
-
const { resultEqualityCheck: o } = t;
|
|
938
|
-
let r, s = 0;
|
|
939
|
-
function a() {
|
|
940
|
-
let l = n;
|
|
941
|
-
const { length: i } = arguments;
|
|
942
|
-
for (let h = 0, p = i; h < p; h++) {
|
|
943
|
-
const m = arguments[h];
|
|
944
|
-
if (typeof m == "function" || typeof m == "object" && m !== null) {
|
|
945
|
-
let g = l.o;
|
|
946
|
-
g === null && (l.o = g = /* @__PURE__ */ new WeakMap());
|
|
947
|
-
const b = g.get(m);
|
|
948
|
-
b === void 0 ? (l = je(), g.set(m, l)) : l = b;
|
|
949
|
-
} else {
|
|
950
|
-
let g = l.p;
|
|
951
|
-
g === null && (l.p = g = /* @__PURE__ */ new Map());
|
|
952
|
-
const b = g.get(m);
|
|
953
|
-
b === void 0 ? (l = je(), g.set(m, l)) : l = b;
|
|
954
|
-
}
|
|
955
|
-
}
|
|
956
|
-
const c = l;
|
|
957
|
-
let f;
|
|
958
|
-
if (l.s === kt)
|
|
959
|
-
f = l.v;
|
|
960
|
-
else if (f = e.apply(null, arguments), s++, o) {
|
|
961
|
-
const h = r?.deref?.() ?? r;
|
|
962
|
-
h != null && o(h, f) && (f = h, s !== 0 && s--), r = typeof f == "object" && f !== null || typeof f == "function" ? new qo(f) : f;
|
|
963
|
-
}
|
|
964
|
-
return c.s = kt, c.v = f, f;
|
|
965
|
-
}
|
|
966
|
-
return a.clearCache = () => {
|
|
967
|
-
n = je(), a.resetResultsCount();
|
|
968
|
-
}, a.resultsCount = () => s, a.resetResultsCount = () => {
|
|
969
|
-
s = 0;
|
|
970
|
-
}, a;
|
|
971
|
-
}
|
|
972
|
-
function cn(e, ...t) {
|
|
973
|
-
const n = typeof e == "function" ? {
|
|
974
|
-
memoize: e,
|
|
975
|
-
memoizeOptions: t
|
|
976
|
-
} : e, o = (...r) => {
|
|
977
|
-
let s = 0, a = 0, l, i = {}, c = r.pop();
|
|
978
|
-
typeof c == "object" && (i = c, c = r.pop()), Vo(
|
|
979
|
-
c,
|
|
980
|
-
`createSelector expects an output function after the inputs, but received: [${typeof c}]`
|
|
981
|
-
);
|
|
982
|
-
const f = {
|
|
983
|
-
...n,
|
|
984
|
-
...i
|
|
985
|
-
}, {
|
|
986
|
-
memoize: h,
|
|
987
|
-
memoizeOptions: p = [],
|
|
988
|
-
argsMemoize: m = ln,
|
|
989
|
-
argsMemoizeOptions: g = [],
|
|
990
|
-
devModeChecks: b = {}
|
|
991
|
-
} = f, C = xt(p), T = xt(g), y = jo(r), E = h(function() {
|
|
992
|
-
return s++, c.apply(
|
|
993
|
-
null,
|
|
994
|
-
arguments
|
|
995
|
-
);
|
|
996
|
-
}, ...C);
|
|
997
|
-
let x = !0;
|
|
998
|
-
const k = m(function() {
|
|
999
|
-
a++;
|
|
1000
|
-
const D = Dt(
|
|
1001
|
-
y,
|
|
1002
|
-
arguments
|
|
1003
|
-
);
|
|
1004
|
-
if (l = E.apply(null, D), process.env.NODE_ENV !== "production") {
|
|
1005
|
-
const { identityFunctionCheck: I, inputStabilityCheck: B } = zo(x, b);
|
|
1006
|
-
if (I.shouldRun && I.run(
|
|
1007
|
-
c,
|
|
1008
|
-
D,
|
|
1009
|
-
l
|
|
1010
|
-
), B.shouldRun) {
|
|
1011
|
-
const W = Dt(
|
|
1012
|
-
y,
|
|
1013
|
-
arguments
|
|
1014
|
-
);
|
|
1015
|
-
B.run(
|
|
1016
|
-
{ inputSelectorResults: D, inputSelectorResultsCopy: W },
|
|
1017
|
-
{ memoize: h, memoizeOptions: C },
|
|
1018
|
-
arguments
|
|
1019
|
-
);
|
|
1020
|
-
}
|
|
1021
|
-
x && (x = !1);
|
|
1022
|
-
}
|
|
1023
|
-
return l;
|
|
1024
|
-
}, ...T);
|
|
1025
|
-
return Object.assign(k, {
|
|
1026
|
-
resultFunc: c,
|
|
1027
|
-
memoizedResultFunc: E,
|
|
1028
|
-
dependencies: y,
|
|
1029
|
-
dependencyRecomputations: () => a,
|
|
1030
|
-
resetDependencyRecomputations: () => {
|
|
1031
|
-
a = 0;
|
|
1032
|
-
},
|
|
1033
|
-
lastResult: () => l,
|
|
1034
|
-
recomputations: () => s,
|
|
1035
|
-
resetRecomputations: () => {
|
|
1036
|
-
s = 0;
|
|
1037
|
-
},
|
|
1038
|
-
memoize: h,
|
|
1039
|
-
argsMemoize: m
|
|
1040
|
-
});
|
|
1041
|
-
};
|
|
1042
|
-
return Object.assign(o, {
|
|
1043
|
-
withTypes: () => o
|
|
1044
|
-
}), o;
|
|
1045
|
-
}
|
|
1046
|
-
var Jo = /* @__PURE__ */ cn(ln), Qo = Object.assign(
|
|
1047
|
-
(e, t = Jo) => {
|
|
1048
|
-
Bo(
|
|
1049
|
-
e,
|
|
1050
|
-
`createStructuredSelector expects first argument to be an object where each property is a selector, instead received a ${typeof e}`
|
|
1051
|
-
);
|
|
1052
|
-
const n = Object.keys(e), o = n.map(
|
|
1053
|
-
(s) => e[s]
|
|
1054
|
-
);
|
|
1055
|
-
return t(
|
|
1056
|
-
o,
|
|
1057
|
-
(...s) => s.reduce((a, l, i) => (a[n[i]] = l, a), {})
|
|
1058
|
-
);
|
|
1059
|
-
},
|
|
1060
|
-
{ withTypes: () => Qo }
|
|
1061
|
-
);
|
|
1062
|
-
cn({
|
|
1063
|
-
memoize: Go,
|
|
1064
|
-
memoizeOptions: {
|
|
1065
|
-
maxSize: 1,
|
|
1066
|
-
equalityCheck: Object.is
|
|
1067
|
-
}
|
|
1068
|
-
});
|
|
1069
|
-
const _ = (e, t, n, o, r, s, ...a) => {
|
|
1070
|
-
if (a.length > 0)
|
|
1071
|
-
throw new Error(process.env.NODE_ENV !== "production" ? "Unsupported number of selectors" : Me(1));
|
|
1072
|
-
let l;
|
|
1073
|
-
if (e)
|
|
1074
|
-
l = e;
|
|
1075
|
-
else
|
|
1076
|
-
throw new Error("Missing arguments");
|
|
1077
|
-
return l;
|
|
1078
|
-
};
|
|
1079
|
-
var ze = { exports: {} }, et = {};
|
|
1080
|
-
/**
|
|
1081
|
-
* @license React
|
|
1082
|
-
* use-sync-external-store-shim/with-selector.production.js
|
|
1083
|
-
*
|
|
1084
|
-
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
1085
|
-
*
|
|
1086
|
-
* This source code is licensed under the MIT license found in the
|
|
1087
|
-
* LICENSE file in the root directory of this source tree.
|
|
1088
|
-
*/
|
|
1089
|
-
var It;
|
|
1090
|
-
function Zo() {
|
|
1091
|
-
if (It) return et;
|
|
1092
|
-
It = 1;
|
|
1093
|
-
var e = Ft, t = Zt();
|
|
1094
|
-
function n(c, f) {
|
|
1095
|
-
return c === f && (c !== 0 || 1 / c === 1 / f) || c !== c && f !== f;
|
|
1096
|
-
}
|
|
1097
|
-
var o = typeof Object.is == "function" ? Object.is : n, r = t.useSyncExternalStore, s = e.useRef, a = e.useEffect, l = e.useMemo, i = e.useDebugValue;
|
|
1098
|
-
return et.useSyncExternalStoreWithSelector = function(c, f, h, p, m) {
|
|
1099
|
-
var g = s(null);
|
|
1100
|
-
if (g.current === null) {
|
|
1101
|
-
var b = { hasValue: !1, value: null };
|
|
1102
|
-
g.current = b;
|
|
1103
|
-
} else b = g.current;
|
|
1104
|
-
g = l(
|
|
1105
|
-
function() {
|
|
1106
|
-
function T(w) {
|
|
1107
|
-
if (!y) {
|
|
1108
|
-
if (y = !0, E = w, w = p(w), m !== void 0 && b.hasValue) {
|
|
1109
|
-
var D = b.value;
|
|
1110
|
-
if (m(D, w))
|
|
1111
|
-
return x = D;
|
|
1112
|
-
}
|
|
1113
|
-
return x = w;
|
|
1114
|
-
}
|
|
1115
|
-
if (D = x, o(E, w)) return D;
|
|
1116
|
-
var I = p(w);
|
|
1117
|
-
return m !== void 0 && m(D, I) ? (E = w, D) : (E = w, x = I);
|
|
1118
|
-
}
|
|
1119
|
-
var y = !1, E, x, k = h === void 0 ? null : h;
|
|
1120
|
-
return [
|
|
1121
|
-
function() {
|
|
1122
|
-
return T(f());
|
|
1123
|
-
},
|
|
1124
|
-
k === null ? void 0 : function() {
|
|
1125
|
-
return T(k());
|
|
1126
|
-
}
|
|
1127
|
-
];
|
|
1128
|
-
},
|
|
1129
|
-
[f, h, p, m]
|
|
1130
|
-
);
|
|
1131
|
-
var C = r(c, g[0], g[1]);
|
|
1132
|
-
return a(
|
|
1133
|
-
function() {
|
|
1134
|
-
b.hasValue = !0, b.value = C;
|
|
1135
|
-
},
|
|
1136
|
-
[C]
|
|
1137
|
-
), i(C), C;
|
|
1138
|
-
}, et;
|
|
1139
|
-
}
|
|
1140
|
-
var tt = {};
|
|
1141
|
-
/**
|
|
1142
|
-
* @license React
|
|
1143
|
-
* use-sync-external-store-shim/with-selector.development.js
|
|
1144
|
-
*
|
|
1145
|
-
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
1146
|
-
*
|
|
1147
|
-
* This source code is licensed under the MIT license found in the
|
|
1148
|
-
* LICENSE file in the root directory of this source tree.
|
|
1149
|
-
*/
|
|
1150
|
-
var Nt;
|
|
1151
|
-
function er() {
|
|
1152
|
-
return Nt || (Nt = 1, process.env.NODE_ENV !== "production" && (function() {
|
|
1153
|
-
function e(c, f) {
|
|
1154
|
-
return c === f && (c !== 0 || 1 / c === 1 / f) || c !== c && f !== f;
|
|
1155
|
-
}
|
|
1156
|
-
typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ < "u" && typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart == "function" && __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(Error());
|
|
1157
|
-
var t = Ft, n = Zt(), o = typeof Object.is == "function" ? Object.is : e, r = n.useSyncExternalStore, s = t.useRef, a = t.useEffect, l = t.useMemo, i = t.useDebugValue;
|
|
1158
|
-
tt.useSyncExternalStoreWithSelector = function(c, f, h, p, m) {
|
|
1159
|
-
var g = s(null);
|
|
1160
|
-
if (g.current === null) {
|
|
1161
|
-
var b = { hasValue: !1, value: null };
|
|
1162
|
-
g.current = b;
|
|
1163
|
-
} else b = g.current;
|
|
1164
|
-
g = l(
|
|
1165
|
-
function() {
|
|
1166
|
-
function T(w) {
|
|
1167
|
-
if (!y) {
|
|
1168
|
-
if (y = !0, E = w, w = p(w), m !== void 0 && b.hasValue) {
|
|
1169
|
-
var D = b.value;
|
|
1170
|
-
if (m(D, w))
|
|
1171
|
-
return x = D;
|
|
1172
|
-
}
|
|
1173
|
-
return x = w;
|
|
1174
|
-
}
|
|
1175
|
-
if (D = x, o(E, w))
|
|
1176
|
-
return D;
|
|
1177
|
-
var I = p(w);
|
|
1178
|
-
return m !== void 0 && m(D, I) ? (E = w, D) : (E = w, x = I);
|
|
1179
|
-
}
|
|
1180
|
-
var y = !1, E, x, k = h === void 0 ? null : h;
|
|
1181
|
-
return [
|
|
1182
|
-
function() {
|
|
1183
|
-
return T(f());
|
|
1184
|
-
},
|
|
1185
|
-
k === null ? void 0 : function() {
|
|
1186
|
-
return T(k());
|
|
1187
|
-
}
|
|
1188
|
-
];
|
|
1189
|
-
},
|
|
1190
|
-
[f, h, p, m]
|
|
1191
|
-
);
|
|
1192
|
-
var C = r(c, g[0], g[1]);
|
|
1193
|
-
return a(
|
|
1194
|
-
function() {
|
|
1195
|
-
b.hasValue = !0, b.value = C;
|
|
1196
|
-
},
|
|
1197
|
-
[C]
|
|
1198
|
-
), i(C), C;
|
|
1199
|
-
}, typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ < "u" && typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop == "function" && __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(Error());
|
|
1200
|
-
})()), tt;
|
|
1201
|
-
}
|
|
1202
|
-
var Mt;
|
|
1203
|
-
function tr() {
|
|
1204
|
-
return Mt || (Mt = 1, process.env.NODE_ENV === "production" ? ze.exports = Zo() : ze.exports = er()), ze.exports;
|
|
1205
|
-
}
|
|
1206
|
-
var nr = tr();
|
|
1207
|
-
const or = zn(19), rr = or ? ir : ar;
|
|
1208
|
-
function sr(e, t, n, o, r) {
|
|
1209
|
-
return rr(e, t, n, o, r);
|
|
1210
|
-
}
|
|
1211
|
-
function ir(e, t, n, o, r) {
|
|
1212
|
-
const s = u.useCallback(() => t(e.getSnapshot(), n, o, r), [e, t, n, o, r]);
|
|
1213
|
-
return io.useSyncExternalStore(e.subscribe, s, s);
|
|
1214
|
-
}
|
|
1215
|
-
function ar(e, t, n, o, r) {
|
|
1216
|
-
return nr.useSyncExternalStoreWithSelector(e.subscribe, e.getSnapshot, e.getSnapshot, (s) => t(s, n, o, r));
|
|
1217
|
-
}
|
|
1218
|
-
class Ie {
|
|
1219
|
-
/**
|
|
1220
|
-
* The current state of the store.
|
|
1221
|
-
* This property is updated immediately when the state changes as a result of calling {@link setState}, {@link update}, or {@link set}.
|
|
1222
|
-
* To subscribe to state changes, use the {@link useState} method. The value returned by {@link useState} is updated after the component renders (similarly to React's useState).
|
|
1223
|
-
* The values can be used directly (to avoid subscribing to the store) in effects or event handlers.
|
|
1224
|
-
*
|
|
1225
|
-
* Do not modify properties in state directly. Instead, use the provided methods to ensure proper state management and listener notification.
|
|
1226
|
-
*/
|
|
1227
|
-
// Internal state to handle recursive `setState()` calls
|
|
1228
|
-
constructor(t) {
|
|
1229
|
-
this.state = t, this.listeners = /* @__PURE__ */ new Set(), this.updateTick = 0;
|
|
1230
|
-
}
|
|
1231
|
-
/**
|
|
1232
|
-
* Registers a listener that will be called whenever the store's state changes.
|
|
1233
|
-
*
|
|
1234
|
-
* @param fn The listener function to be called on state changes.
|
|
1235
|
-
* @returns A function to unsubscribe the listener.
|
|
1236
|
-
*/
|
|
1237
|
-
subscribe = (t) => (this.listeners.add(t), () => {
|
|
1238
|
-
this.listeners.delete(t);
|
|
1239
|
-
});
|
|
1240
|
-
/**
|
|
1241
|
-
* Returns the current state of the store.
|
|
1242
|
-
*/
|
|
1243
|
-
getSnapshot = () => this.state;
|
|
1244
|
-
/**
|
|
1245
|
-
* Updates the entire store's state and notifies all registered listeners.
|
|
1246
|
-
*
|
|
1247
|
-
* @param newState The new state to set for the store.
|
|
1248
|
-
*/
|
|
1249
|
-
setState(t) {
|
|
1250
|
-
if (this.state === t)
|
|
1251
|
-
return;
|
|
1252
|
-
this.state = t, this.updateTick += 1;
|
|
1253
|
-
const n = this.updateTick;
|
|
1254
|
-
for (const o of this.listeners) {
|
|
1255
|
-
if (n !== this.updateTick)
|
|
1256
|
-
return;
|
|
1257
|
-
o(t);
|
|
1258
|
-
}
|
|
1259
|
-
}
|
|
1260
|
-
/**
|
|
1261
|
-
* Merges the provided changes into the current state and notifies listeners if there are changes.
|
|
1262
|
-
*
|
|
1263
|
-
* @param changes An object containing the changes to apply to the current state.
|
|
1264
|
-
*/
|
|
1265
|
-
update(t) {
|
|
1266
|
-
for (const n in t)
|
|
1267
|
-
if (!Object.is(this.state[n], t[n])) {
|
|
1268
|
-
Ie.prototype.setState.call(this, {
|
|
1269
|
-
...this.state,
|
|
1270
|
-
...t
|
|
1271
|
-
});
|
|
1272
|
-
return;
|
|
1273
|
-
}
|
|
1274
|
-
}
|
|
1275
|
-
/**
|
|
1276
|
-
* Sets a specific key in the store's state to a new value and notifies listeners if the value has changed.
|
|
1277
|
-
*
|
|
1278
|
-
* @param key The key in the store's state to update.
|
|
1279
|
-
* @param value The new value to set for the specified key.
|
|
1280
|
-
*/
|
|
1281
|
-
set(t, n) {
|
|
1282
|
-
Object.is(this.state[t], n) || Ie.prototype.setState.call(this, {
|
|
1283
|
-
...this.state,
|
|
1284
|
-
[t]: n
|
|
1285
|
-
});
|
|
1286
|
-
}
|
|
1287
|
-
/**
|
|
1288
|
-
* Gives the state a new reference and updates all registered listeners.
|
|
1289
|
-
*/
|
|
1290
|
-
notifyAll() {
|
|
1291
|
-
const t = {
|
|
1292
|
-
...this.state
|
|
1293
|
-
};
|
|
1294
|
-
Ie.prototype.setState.call(this, t);
|
|
1295
|
-
}
|
|
1296
|
-
}
|
|
1297
|
-
class un extends Ie {
|
|
1298
|
-
/**
|
|
1299
|
-
* Creates a new ReactStore instance.
|
|
1300
|
-
*
|
|
1301
|
-
* @param state Initial state of the store.
|
|
1302
|
-
* @param context Non-reactive context values.
|
|
1303
|
-
* @param selectors Optional selectors for use with `useState`.
|
|
1304
|
-
*/
|
|
1305
|
-
constructor(t, n = {}, o) {
|
|
1306
|
-
super(t), this.context = n, this.selectors = o;
|
|
1307
|
-
}
|
|
1308
|
-
/**
|
|
1309
|
-
* Non-reactive values such as refs, callbacks, etc.
|
|
1310
|
-
*/
|
|
1311
|
-
/**
|
|
1312
|
-
* Keeps track of which properties are controlled.
|
|
1313
|
-
*/
|
|
1314
|
-
controlledValues = /* @__PURE__ */ new Map();
|
|
1315
|
-
/**
|
|
1316
|
-
* Synchronizes a single external value into the store.
|
|
1317
|
-
*
|
|
1318
|
-
* Note that the while the value in `state` is updated immediately, the value returned
|
|
1319
|
-
* by `useState` is updated before the next render (similarly to React's `useState`).
|
|
1320
|
-
*/
|
|
1321
|
-
useSyncedValue(t, n) {
|
|
1322
|
-
u.useDebugValue(t), Z(() => {
|
|
1323
|
-
this.state[t] !== n && this.set(t, n);
|
|
1324
|
-
}, [t, n]);
|
|
1325
|
-
}
|
|
1326
|
-
/**
|
|
1327
|
-
* Synchronizes a single external value into the store and
|
|
1328
|
-
* cleans it up (sets to `undefined`) on unmount.
|
|
1329
|
-
*
|
|
1330
|
-
* Note that the while the value in `state` is updated immediately, the value returned
|
|
1331
|
-
* by `useState` is updated before the next render (similarly to React's `useState`).
|
|
1332
|
-
*/
|
|
1333
|
-
useSyncedValueWithCleanup(t, n) {
|
|
1334
|
-
Z(() => (this.state[t] !== n && this.set(t, n), () => {
|
|
1335
|
-
this.set(t, void 0);
|
|
1336
|
-
}), [t, n]);
|
|
1337
|
-
}
|
|
1338
|
-
/**
|
|
1339
|
-
* Synchronizes multiple external values into the store.
|
|
1340
|
-
*
|
|
1341
|
-
* Note that the while the values in `state` are updated immediately, the values returned
|
|
1342
|
-
* by `useState` are updated before the next render (similarly to React's `useState`).
|
|
1343
|
-
*/
|
|
1344
|
-
useSyncedValues(t) {
|
|
1345
|
-
if (process.env.NODE_ENV !== "production") {
|
|
1346
|
-
u.useDebugValue(t, (s) => Object.keys(s));
|
|
1347
|
-
const o = u.useRef(Object.keys(t)).current, r = Object.keys(t);
|
|
1348
|
-
(o.length !== r.length || o.some((s, a) => s !== r[a])) && console.error("ReactStore.useSyncedValues expects the same prop keys on every render. Keys should be stable.");
|
|
1349
|
-
}
|
|
1350
|
-
const n = Object.values(t);
|
|
1351
|
-
Z(() => {
|
|
1352
|
-
this.update(t);
|
|
1353
|
-
}, n);
|
|
1354
|
-
}
|
|
1355
|
-
/**
|
|
1356
|
-
* Registers a controllable prop pair (`controlled`, `defaultValue`) for a specific key.
|
|
1357
|
-
* - If `controlled` is non-undefined, the key is marked as controlled and the store's
|
|
1358
|
-
* state at `key` is updated to match `controlled`. Local writes to that key are ignored.
|
|
1359
|
-
* - If `controlled` is undefined, the key is marked as uncontrolled. The store's state
|
|
1360
|
-
* is initialized to `defaultValue` on first render and can be updated with local writes.
|
|
1361
|
-
*/
|
|
1362
|
-
useControlledProp(t, n, o) {
|
|
1363
|
-
u.useDebugValue(t);
|
|
1364
|
-
const r = n !== void 0;
|
|
1365
|
-
if (process.env.NODE_ENV !== "production") {
|
|
1366
|
-
const s = this.controlledValues.get(t);
|
|
1367
|
-
s !== void 0 && s !== r && console.error(`A component is changing the ${r ? "" : "un"}controlled state of ${t.toString()} to be ${r ? "un" : ""}controlled. Elements should not switch from uncontrolled to controlled (or vice versa).`);
|
|
1368
|
-
}
|
|
1369
|
-
this.controlledValues.has(t) || (this.controlledValues.set(t, r), !r && !Object.is(this.state[t], o) && super.setState({
|
|
1370
|
-
...this.state,
|
|
1371
|
-
[t]: o
|
|
1372
|
-
})), Z(() => {
|
|
1373
|
-
r && !Object.is(this.state[t], n) && super.setState({
|
|
1374
|
-
...this.state,
|
|
1375
|
-
[t]: n
|
|
1376
|
-
});
|
|
1377
|
-
}, [t, n, o, r]);
|
|
1378
|
-
}
|
|
1379
|
-
/**
|
|
1380
|
-
* Sets a specific key in the store's state to a new value and notifies listeners if the value has changed.
|
|
1381
|
-
* If the key is controlled (registered via {@link useControlledProp} with a non-undefined value),
|
|
1382
|
-
* the update is ignored and no listeners are notified.
|
|
1383
|
-
*
|
|
1384
|
-
* @param key The state key to update.
|
|
1385
|
-
* @param value The new value to set for the specified key.
|
|
1386
|
-
*/
|
|
1387
|
-
set(t, n) {
|
|
1388
|
-
this.controlledValues.get(t) !== !0 && super.set(t, n);
|
|
1389
|
-
}
|
|
1390
|
-
/**
|
|
1391
|
-
* Merges the provided changes into the current state and notifies listeners if there are changes.
|
|
1392
|
-
* Controlled keys are filtered out and not updated.
|
|
1393
|
-
*
|
|
1394
|
-
* @param values An object containing the changes to apply to the current state.
|
|
1395
|
-
*/
|
|
1396
|
-
update(t) {
|
|
1397
|
-
const n = {
|
|
1398
|
-
...t
|
|
1399
|
-
};
|
|
1400
|
-
for (const o in n)
|
|
1401
|
-
if (Object.hasOwn(n, o) && this.controlledValues.get(o) === !0) {
|
|
1402
|
-
delete n[o];
|
|
1403
|
-
continue;
|
|
1404
|
-
}
|
|
1405
|
-
super.update(n);
|
|
1406
|
-
}
|
|
1407
|
-
/**
|
|
1408
|
-
* Updates the entire store's state and notifies all registered listeners.
|
|
1409
|
-
* Controlled keys are left unchanged; only uncontrolled keys from `newState` are applied.
|
|
1410
|
-
*
|
|
1411
|
-
* @param newState The new state to set for the store.
|
|
1412
|
-
*/
|
|
1413
|
-
setState(t) {
|
|
1414
|
-
const n = {
|
|
1415
|
-
...t
|
|
1416
|
-
};
|
|
1417
|
-
for (const o in n)
|
|
1418
|
-
if (Object.hasOwn(n, o) && this.controlledValues.get(o) === !0) {
|
|
1419
|
-
delete n[o];
|
|
1420
|
-
continue;
|
|
1421
|
-
}
|
|
1422
|
-
super.setState({
|
|
1423
|
-
...this.state,
|
|
1424
|
-
...n
|
|
1425
|
-
});
|
|
1426
|
-
}
|
|
1427
|
-
/** Gets the current value from the store using a selector with the provided key.
|
|
1428
|
-
*
|
|
1429
|
-
* @param key Key of the selector to use.
|
|
1430
|
-
*/
|
|
1431
|
-
select = (t, n, o, r) => {
|
|
1432
|
-
const s = this.selectors[t];
|
|
1433
|
-
return s(this.state, n, o, r);
|
|
1434
|
-
};
|
|
1435
|
-
/**
|
|
1436
|
-
* Returns a value from the store's state using a selector function.
|
|
1437
|
-
* Used to subscribe to specific parts of the state.
|
|
1438
|
-
* This methods causes a rerender whenever the selected state changes.
|
|
1439
|
-
*
|
|
1440
|
-
* @param key Key of the selector to use.
|
|
1441
|
-
*/
|
|
1442
|
-
useState = (t, n, o, r) => {
|
|
1443
|
-
u.useDebugValue(t);
|
|
1444
|
-
const s = this.selectors[t];
|
|
1445
|
-
return sr(this, s, n, o, r);
|
|
1446
|
-
};
|
|
1447
|
-
/**
|
|
1448
|
-
* Wraps a function with `useStableCallback` to ensure it has a stable reference
|
|
1449
|
-
* and assigns it to the context.
|
|
1450
|
-
*
|
|
1451
|
-
* @param key Key of the event callback. Must be a function in the context.
|
|
1452
|
-
* @param fn Function to assign.
|
|
1453
|
-
*/
|
|
1454
|
-
useContextCallback(t, n) {
|
|
1455
|
-
u.useDebugValue(t);
|
|
1456
|
-
const o = V(n ?? Lt);
|
|
1457
|
-
this.context[t] = o;
|
|
1458
|
-
}
|
|
1459
|
-
/**
|
|
1460
|
-
* Returns a stable setter function for a specific key in the store's state.
|
|
1461
|
-
* It's commonly used to pass as a ref callback to React elements.
|
|
1462
|
-
*
|
|
1463
|
-
* @param key Key of the state to set.
|
|
1464
|
-
*/
|
|
1465
|
-
useStateSetter(t) {
|
|
1466
|
-
const n = u.useRef(void 0);
|
|
1467
|
-
return n.current === void 0 && (n.current = (o) => {
|
|
1468
|
-
this.set(t, o);
|
|
1469
|
-
}), n.current;
|
|
1470
|
-
}
|
|
1471
|
-
/**
|
|
1472
|
-
* Observes changes derived from the store's selectors and calls the listener when the selected value changes.
|
|
1473
|
-
*
|
|
1474
|
-
* @param key Key of the selector to observe.
|
|
1475
|
-
* @param listener Listener function called when the selector result changes.
|
|
1476
|
-
*/
|
|
1477
|
-
observe(t, n) {
|
|
1478
|
-
let o;
|
|
1479
|
-
typeof t == "function" ? o = t : o = this.selectors[t];
|
|
1480
|
-
let r = o(this.state);
|
|
1481
|
-
return n(r, r, this), this.subscribe((s) => {
|
|
1482
|
-
const a = o(s);
|
|
1483
|
-
if (!Object.is(r, a)) {
|
|
1484
|
-
const l = r;
|
|
1485
|
-
r = a, n(a, l, this);
|
|
1486
|
-
}
|
|
1487
|
-
});
|
|
1488
|
-
}
|
|
1489
|
-
}
|
|
1490
|
-
const lr = {
|
|
1491
|
-
open: _((e) => e.open),
|
|
1492
|
-
domReferenceElement: _((e) => e.domReferenceElement),
|
|
1493
|
-
referenceElement: _((e) => e.positionReference ?? e.referenceElement),
|
|
1494
|
-
floatingElement: _((e) => e.floatingElement),
|
|
1495
|
-
floatingId: _((e) => e.floatingId)
|
|
1496
|
-
};
|
|
1497
|
-
class dn extends un {
|
|
1498
|
-
constructor(t) {
|
|
1499
|
-
const {
|
|
1500
|
-
nested: n,
|
|
1501
|
-
noEmit: o,
|
|
1502
|
-
onOpenChange: r,
|
|
1503
|
-
triggerElements: s,
|
|
1504
|
-
...a
|
|
1505
|
-
} = t;
|
|
1506
|
-
super({
|
|
1507
|
-
...a,
|
|
1508
|
-
positionReference: a.referenceElement,
|
|
1509
|
-
domReferenceElement: a.referenceElement
|
|
1510
|
-
}, {
|
|
1511
|
-
onOpenChange: r,
|
|
1512
|
-
dataRef: {
|
|
1513
|
-
current: {}
|
|
1514
|
-
},
|
|
1515
|
-
events: Co(),
|
|
1516
|
-
nested: n,
|
|
1517
|
-
noEmit: o,
|
|
1518
|
-
triggerElements: s
|
|
1519
|
-
}, lr);
|
|
1520
|
-
}
|
|
1521
|
-
/**
|
|
1522
|
-
* Emits the `openchange` event through the internal event emitter and calls the `onOpenChange` handler with the provided arguments.
|
|
1523
|
-
*
|
|
1524
|
-
* @param newOpen The new open state.
|
|
1525
|
-
* @param eventDetails Details about the event that triggered the open state change.
|
|
1526
|
-
*/
|
|
1527
|
-
setOpen = (t, n) => {
|
|
1528
|
-
if ((!t || !this.state.open || // Prevent a pending hover-open from overwriting a click-open event, while allowing
|
|
1529
|
-
// click events to upgrade a hover-open.
|
|
1530
|
-
en(n.event)) && (this.context.dataRef.current.openEvent = t ? n.event : void 0), !this.context.noEmit) {
|
|
1531
|
-
const o = {
|
|
1532
|
-
open: t,
|
|
1533
|
-
reason: n.reason,
|
|
1534
|
-
nativeEvent: n.event,
|
|
1535
|
-
nested: this.context.nested,
|
|
1536
|
-
triggerElement: n.trigger
|
|
1537
|
-
};
|
|
1538
|
-
this.context.events.emit("openchange", o);
|
|
1539
|
-
}
|
|
1540
|
-
this.context.onOpenChange?.(t, n);
|
|
1541
|
-
};
|
|
1542
|
-
}
|
|
1543
|
-
function cr(e, t) {
|
|
1544
|
-
const n = u.useRef(null);
|
|
1545
|
-
return u.useCallback((o) => {
|
|
1546
|
-
e !== void 0 && (n.current !== null && (t.context.triggerElements.delete(n.current), n.current = null), o !== null && (n.current = e, t.context.triggerElements.add(e, o)));
|
|
1547
|
-
}, [t, e]);
|
|
1548
|
-
}
|
|
1549
|
-
function ur(e, t, n, o) {
|
|
1550
|
-
const r = n.useState("isMountedByTrigger", e), s = cr(e, n), a = V((l) => {
|
|
1551
|
-
s(l), l !== null && n.select("open") && n.select("activeTriggerId") == null && n.update({
|
|
1552
|
-
activeTriggerId: e,
|
|
1553
|
-
activeTriggerElement: l,
|
|
1554
|
-
...o
|
|
1555
|
-
});
|
|
1556
|
-
});
|
|
1557
|
-
return Z(() => {
|
|
1558
|
-
r && n.update({
|
|
1559
|
-
activeTriggerElement: t.current,
|
|
1560
|
-
...o
|
|
1561
|
-
});
|
|
1562
|
-
}, [r, n, t, ...Object.values(o)]), {
|
|
1563
|
-
registerTrigger: a,
|
|
1564
|
-
isMountedByThisTrigger: r
|
|
1565
|
-
};
|
|
1566
|
-
}
|
|
1567
|
-
function dr(e) {
|
|
1568
|
-
const t = e.useState("open");
|
|
1569
|
-
Z(() => {
|
|
1570
|
-
if (t && !e.select("activeTriggerId") && e.context.triggerElements.size === 1) {
|
|
1571
|
-
const n = e.context.triggerElements.entries().next();
|
|
1572
|
-
if (!n.done) {
|
|
1573
|
-
const [o, r] = n.value;
|
|
1574
|
-
e.update({
|
|
1575
|
-
activeTriggerId: o,
|
|
1576
|
-
activeTriggerElement: r
|
|
1577
|
-
});
|
|
1578
|
-
}
|
|
1579
|
-
}
|
|
1580
|
-
}, [t, e]);
|
|
1581
|
-
}
|
|
1582
|
-
function fr(e, t, n) {
|
|
1583
|
-
const {
|
|
1584
|
-
mounted: o,
|
|
1585
|
-
setMounted: r,
|
|
1586
|
-
transitionStatus: s
|
|
1587
|
-
} = so(e);
|
|
1588
|
-
t.useSyncedValues({
|
|
1589
|
-
mounted: o,
|
|
1590
|
-
transitionStatus: s
|
|
1591
|
-
});
|
|
1592
|
-
const a = V(() => {
|
|
1593
|
-
r(!1), t.update({
|
|
1594
|
-
activeTriggerId: null,
|
|
1595
|
-
activeTriggerElement: null,
|
|
1596
|
-
mounted: !1
|
|
1597
|
-
}), n?.(), t.context.onOpenChangeComplete?.(!1);
|
|
1598
|
-
}), l = t.useState("preventUnmountingOnClose");
|
|
1599
|
-
return Wt({
|
|
1600
|
-
enabled: !l,
|
|
1601
|
-
open: e,
|
|
1602
|
-
ref: t.context.popupRef,
|
|
1603
|
-
onComplete() {
|
|
1604
|
-
e || a();
|
|
1605
|
-
}
|
|
1606
|
-
}), {
|
|
1607
|
-
forceUnmount: a,
|
|
1608
|
-
transitionStatus: s
|
|
1609
|
-
};
|
|
1610
|
-
}
|
|
1611
|
-
class fn {
|
|
1612
|
-
constructor() {
|
|
1613
|
-
this.elements = /* @__PURE__ */ new Set(), this.idMap = /* @__PURE__ */ new Map();
|
|
1614
|
-
}
|
|
1615
|
-
/**
|
|
1616
|
-
* Adds a trigger element with the given ID.
|
|
1617
|
-
*
|
|
1618
|
-
* Note: The provided element is assumed to not be registered under multiple IDs.
|
|
1619
|
-
*/
|
|
1620
|
-
add(t, n) {
|
|
1621
|
-
const o = this.idMap.get(t);
|
|
1622
|
-
if (o !== n && (o !== void 0 && this.elements.delete(o), this.elements.add(n), this.idMap.set(t, n), process.env.NODE_ENV !== "production" && this.elements.size !== this.idMap.size))
|
|
1623
|
-
throw new Error(process.env.NODE_ENV !== "production" ? "Base UI: A trigger element cannot be registered under multiple IDs in PopupTriggerMap." : Me(87));
|
|
1624
|
-
}
|
|
1625
|
-
/**
|
|
1626
|
-
* Removes the trigger element with the given ID.
|
|
1627
|
-
*/
|
|
1628
|
-
delete(t) {
|
|
1629
|
-
const n = this.idMap.get(t);
|
|
1630
|
-
n && (this.elements.delete(n), this.idMap.delete(t));
|
|
1631
|
-
}
|
|
1632
|
-
/**
|
|
1633
|
-
* Whether the given element is registered as a trigger.
|
|
1634
|
-
*/
|
|
1635
|
-
hasElement(t) {
|
|
1636
|
-
return this.elements.has(t);
|
|
1637
|
-
}
|
|
1638
|
-
/**
|
|
1639
|
-
* Whether there is a registered trigger element matching the given predicate.
|
|
1640
|
-
*/
|
|
1641
|
-
hasMatchingElement(t) {
|
|
1642
|
-
for (const n of this.elements)
|
|
1643
|
-
if (t(n))
|
|
1644
|
-
return !0;
|
|
1645
|
-
return !1;
|
|
1646
|
-
}
|
|
1647
|
-
getById(t) {
|
|
1648
|
-
return this.idMap.get(t);
|
|
1649
|
-
}
|
|
1650
|
-
entries() {
|
|
1651
|
-
return this.idMap.entries();
|
|
1652
|
-
}
|
|
1653
|
-
get size() {
|
|
1654
|
-
return this.idMap.size;
|
|
1655
|
-
}
|
|
1656
|
-
}
|
|
1657
|
-
function pr() {
|
|
1658
|
-
return new dn({
|
|
1659
|
-
open: !1,
|
|
1660
|
-
floatingElement: null,
|
|
1661
|
-
referenceElement: null,
|
|
1662
|
-
triggerElements: new fn(),
|
|
1663
|
-
floatingId: "",
|
|
1664
|
-
nested: !1,
|
|
1665
|
-
noEmit: !1,
|
|
1666
|
-
onOpenChange: void 0
|
|
1667
|
-
});
|
|
1668
|
-
}
|
|
1669
|
-
function gr() {
|
|
1670
|
-
return {
|
|
1671
|
-
open: !1,
|
|
1672
|
-
mounted: !1,
|
|
1673
|
-
transitionStatus: "idle",
|
|
1674
|
-
floatingRootContext: pr(),
|
|
1675
|
-
preventUnmountingOnClose: !1,
|
|
1676
|
-
payload: void 0,
|
|
1677
|
-
activeTriggerId: null,
|
|
1678
|
-
activeTriggerElement: null,
|
|
1679
|
-
popupElement: null,
|
|
1680
|
-
positionerElement: null,
|
|
1681
|
-
activeTriggerProps: ke,
|
|
1682
|
-
inactiveTriggerProps: ke,
|
|
1683
|
-
popupProps: ke
|
|
1684
|
-
};
|
|
1685
|
-
}
|
|
1686
|
-
const mr = {
|
|
1687
|
-
open: _((e) => e.open),
|
|
1688
|
-
mounted: _((e) => e.mounted),
|
|
1689
|
-
transitionStatus: _((e) => e.transitionStatus),
|
|
1690
|
-
floatingRootContext: _((e) => e.floatingRootContext),
|
|
1691
|
-
preventUnmountingOnClose: _((e) => e.preventUnmountingOnClose),
|
|
1692
|
-
payload: _((e) => e.payload),
|
|
1693
|
-
activeTriggerId: _((e) => e.activeTriggerId),
|
|
1694
|
-
activeTriggerElement: _((e) => e.mounted ? e.activeTriggerElement : null),
|
|
1695
|
-
/**
|
|
1696
|
-
* Whether the trigger with the given ID was used to open the popup.
|
|
1697
|
-
*/
|
|
1698
|
-
isTriggerActive: _((e, t) => t !== void 0 && e.activeTriggerId === t),
|
|
1699
|
-
/**
|
|
1700
|
-
* Whether the popup is open and was activated by a trigger with the given ID.
|
|
1701
|
-
*/
|
|
1702
|
-
isOpenedByTrigger: _((e, t) => t !== void 0 && e.activeTriggerId === t && e.open),
|
|
1703
|
-
/**
|
|
1704
|
-
* Whether the popup is mounted and was activated by a trigger with the given ID.
|
|
1705
|
-
*/
|
|
1706
|
-
isMountedByTrigger: _((e, t) => t !== void 0 && e.activeTriggerId === t && e.mounted),
|
|
1707
|
-
triggerProps: _((e, t) => t ? e.activeTriggerProps : e.inactiveTriggerProps),
|
|
1708
|
-
popupProps: _((e) => e.popupProps),
|
|
1709
|
-
popupElement: _((e) => e.popupElement),
|
|
1710
|
-
positionerElement: _((e) => e.positionerElement)
|
|
1711
|
-
};
|
|
1712
|
-
function hr(e) {
|
|
1713
|
-
const {
|
|
1714
|
-
popupStore: t,
|
|
1715
|
-
noEmit: n = !1,
|
|
1716
|
-
treatPopupAsFloatingElement: o = !1,
|
|
1717
|
-
onOpenChange: r
|
|
1718
|
-
} = e, s = jt(), a = rn() != null, l = t.useState("open"), i = t.useState("activeTriggerElement"), c = t.useState(o ? "popupElement" : "positionerElement"), f = t.context.triggerElements, h = zt(() => new dn({
|
|
1719
|
-
open: l,
|
|
1720
|
-
referenceElement: i,
|
|
1721
|
-
floatingElement: c,
|
|
1722
|
-
triggerElements: f,
|
|
1723
|
-
onOpenChange: r,
|
|
1724
|
-
floatingId: s,
|
|
1725
|
-
nested: a,
|
|
1726
|
-
noEmit: n
|
|
1727
|
-
})).current;
|
|
1728
|
-
return Z(() => {
|
|
1729
|
-
const p = {
|
|
1730
|
-
open: l,
|
|
1731
|
-
floatingId: s,
|
|
1732
|
-
referenceElement: i,
|
|
1733
|
-
floatingElement: c
|
|
1734
|
-
};
|
|
1735
|
-
pe(i) && (p.domReferenceElement = i), h.update(p);
|
|
1736
|
-
}, [l, s, i, c, h]), h.context.onOpenChange = r, h.context.nested = a, h.context.noEmit = n, h;
|
|
1737
|
-
}
|
|
1738
|
-
function pn(e = []) {
|
|
1739
|
-
const t = e.map((c) => c?.reference), n = e.map((c) => c?.floating), o = e.map((c) => c?.item), r = e.map((c) => c?.trigger), s = u.useCallback(
|
|
1740
|
-
(c) => Ke(c, e, "reference"),
|
|
1741
|
-
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
1742
|
-
t
|
|
1743
|
-
), a = u.useCallback(
|
|
1744
|
-
(c) => Ke(c, e, "floating"),
|
|
1745
|
-
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
1746
|
-
n
|
|
1747
|
-
), l = u.useCallback(
|
|
1748
|
-
(c) => Ke(c, e, "item"),
|
|
1749
|
-
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
1750
|
-
o
|
|
1751
|
-
), i = u.useCallback(
|
|
1752
|
-
(c) => Ke(c, e, "trigger"),
|
|
1753
|
-
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
1754
|
-
r
|
|
1755
|
-
);
|
|
1756
|
-
return u.useMemo(() => ({
|
|
1757
|
-
getReferenceProps: s,
|
|
1758
|
-
getFloatingProps: a,
|
|
1759
|
-
getItemProps: l,
|
|
1760
|
-
getTriggerProps: i
|
|
1761
|
-
}), [s, a, l, i]);
|
|
1762
|
-
}
|
|
1763
|
-
function Ke(e, t, n) {
|
|
1764
|
-
const o = /* @__PURE__ */ new Map(), r = n === "item", s = {};
|
|
1765
|
-
n === "floating" && (s.tabIndex = -1, s[no] = "");
|
|
1766
|
-
for (const a in e)
|
|
1767
|
-
r && e && (a === Jt || a === Qt) || (s[a] = e[a]);
|
|
1768
|
-
for (let a = 0; a < t.length; a += 1) {
|
|
1769
|
-
let l;
|
|
1770
|
-
const i = t[a]?.[n];
|
|
1771
|
-
typeof i == "function" ? l = e ? i(e) : null : l = i, l && Pt(s, l, r, o);
|
|
1772
|
-
}
|
|
1773
|
-
return Pt(s, e, r, o), s;
|
|
1774
|
-
}
|
|
1775
|
-
function Pt(e, t, n, o) {
|
|
1776
|
-
for (const r in t) {
|
|
1777
|
-
const s = t[r];
|
|
1778
|
-
n && (r === Jt || r === Qt) || (r.startsWith("on") ? (o.has(r) || o.set(r, []), typeof s == "function" && (o.get(r)?.push(s), e[r] = (...a) => o.get(r)?.map((l) => l(...a)).find((l) => l !== void 0))) : e[r] = s);
|
|
1779
|
-
}
|
|
1780
|
-
}
|
|
1781
|
-
const Er = /* @__PURE__ */ new Map([["select", "listbox"], ["combobox", "listbox"], ["label", !1]]);
|
|
1782
|
-
function yr(e, t = {}) {
|
|
1783
|
-
const n = "rootStore" in e ? e.rootStore : e, o = n.useState("open"), r = n.useState("floatingId"), s = n.useState("domReferenceElement"), a = n.useState("floatingElement"), {
|
|
1784
|
-
enabled: l = !0,
|
|
1785
|
-
role: i = "dialog"
|
|
1786
|
-
} = t, c = jt(), f = s?.id || c, h = u.useMemo(() => ot(a)?.id || r, [a, r]), p = Er.get(i) ?? i, g = rn() != null, b = u.useMemo(() => p === "tooltip" || i === "label" ? ke : {
|
|
1787
|
-
"aria-haspopup": p === "alertdialog" ? "dialog" : p,
|
|
1788
|
-
"aria-expanded": "false",
|
|
1789
|
-
...p === "listbox" && {
|
|
1790
|
-
role: "combobox"
|
|
1791
|
-
},
|
|
1792
|
-
...p === "menu" && g && {
|
|
1793
|
-
role: "menuitem"
|
|
1794
|
-
},
|
|
1795
|
-
...i === "select" && {
|
|
1796
|
-
"aria-autocomplete": "none"
|
|
1797
|
-
},
|
|
1798
|
-
...i === "combobox" && {
|
|
1799
|
-
"aria-autocomplete": "list"
|
|
1800
|
-
}
|
|
1801
|
-
}, [p, g, i]), C = u.useMemo(() => p === "tooltip" || i === "label" ? {
|
|
1802
|
-
[`aria-${i === "label" ? "labelledby" : "describedby"}`]: o ? h : void 0
|
|
1803
|
-
} : {
|
|
1804
|
-
...b,
|
|
1805
|
-
"aria-expanded": o ? "true" : "false",
|
|
1806
|
-
"aria-controls": o ? h : void 0,
|
|
1807
|
-
...p === "menu" && {
|
|
1808
|
-
id: f
|
|
1809
|
-
}
|
|
1810
|
-
}, [p, h, o, f, i, b]), T = u.useMemo(() => {
|
|
1811
|
-
const E = {
|
|
1812
|
-
id: h,
|
|
1813
|
-
...p && {
|
|
1814
|
-
role: p
|
|
1815
|
-
}
|
|
1816
|
-
};
|
|
1817
|
-
return p === "tooltip" || i === "label" ? E : {
|
|
1818
|
-
...E,
|
|
1819
|
-
...p === "menu" && {
|
|
1820
|
-
"aria-labelledby": f
|
|
1821
|
-
}
|
|
1822
|
-
};
|
|
1823
|
-
}, [p, h, f, i]), y = u.useCallback(({
|
|
1824
|
-
active: E,
|
|
1825
|
-
selected: x
|
|
1826
|
-
}) => {
|
|
1827
|
-
const k = {
|
|
1828
|
-
role: "option",
|
|
1829
|
-
...E && {
|
|
1830
|
-
id: `${h}-fui-option`
|
|
1831
|
-
}
|
|
1832
|
-
};
|
|
1833
|
-
switch (i) {
|
|
1834
|
-
case "select":
|
|
1835
|
-
case "combobox":
|
|
1836
|
-
return {
|
|
1837
|
-
...k,
|
|
1838
|
-
"aria-selected": x
|
|
1839
|
-
};
|
|
1840
|
-
}
|
|
1841
|
-
return {};
|
|
1842
|
-
}, [h, i]);
|
|
1843
|
-
return u.useMemo(() => l ? {
|
|
1844
|
-
reference: C,
|
|
1845
|
-
floating: T,
|
|
1846
|
-
item: y,
|
|
1847
|
-
trigger: b
|
|
1848
|
-
} : {}, [l, C, T, b, y]);
|
|
1849
|
-
}
|
|
1850
|
-
function br(e) {
|
|
1851
|
-
const t = u.useRef(""), n = u.useCallback((r) => {
|
|
1852
|
-
r.defaultPrevented || (t.current = r.pointerType, e(r, r.pointerType));
|
|
1853
|
-
}, [e]);
|
|
1854
|
-
return {
|
|
1855
|
-
onClick: u.useCallback((r) => {
|
|
1856
|
-
if (r.detail === 0) {
|
|
1857
|
-
e(r, "keyboard");
|
|
1858
|
-
return;
|
|
1859
|
-
}
|
|
1860
|
-
"pointerType" in r && e(r, r.pointerType), e(r, t.current), t.current = "";
|
|
1861
|
-
}, [e]),
|
|
1862
|
-
onPointerDown: n
|
|
1863
|
-
};
|
|
1864
|
-
}
|
|
1865
|
-
function vr(e) {
|
|
1866
|
-
const [t, n] = u.useState(null), o = V((l, i) => {
|
|
1867
|
-
e || n(i);
|
|
1868
|
-
}), r = u.useCallback(() => {
|
|
1869
|
-
n(null);
|
|
1870
|
-
}, []), {
|
|
1871
|
-
onClick: s,
|
|
1872
|
-
onPointerDown: a
|
|
1873
|
-
} = br(o);
|
|
1874
|
-
return u.useMemo(() => ({
|
|
1875
|
-
openMethod: t,
|
|
1876
|
-
reset: r,
|
|
1877
|
-
triggerProps: {
|
|
1878
|
-
onClick: s,
|
|
1879
|
-
onPointerDown: a
|
|
1880
|
-
}
|
|
1881
|
-
}), [t, r, s, a]);
|
|
1882
|
-
}
|
|
1883
|
-
function Sr(e) {
|
|
1884
|
-
const {
|
|
1885
|
-
store: t,
|
|
1886
|
-
parentContext: n,
|
|
1887
|
-
actionsRef: o
|
|
1888
|
-
} = e, r = t.useState("open"), s = t.useState("disablePointerDismissal"), a = t.useState("modal"), l = t.useState("popupElement"), {
|
|
1889
|
-
openMethod: i,
|
|
1890
|
-
triggerProps: c,
|
|
1891
|
-
reset: f
|
|
1892
|
-
} = vr(r);
|
|
1893
|
-
dr(t);
|
|
1894
|
-
const {
|
|
1895
|
-
forceUnmount: h
|
|
1896
|
-
} = fr(r, t, () => {
|
|
1897
|
-
f();
|
|
1898
|
-
}), p = V((W) => {
|
|
1899
|
-
const H = se(W);
|
|
1900
|
-
return H.preventUnmountOnClose = () => {
|
|
1901
|
-
t.set("preventUnmountingOnClose", !0);
|
|
1902
|
-
}, H;
|
|
1903
|
-
}), m = u.useCallback(() => {
|
|
1904
|
-
t.setOpen(!1, p(Kn));
|
|
1905
|
-
}, [t, p]);
|
|
1906
|
-
u.useImperativeHandle(o, () => ({
|
|
1907
|
-
unmount: h,
|
|
1908
|
-
close: m
|
|
1909
|
-
}), [h, m]);
|
|
1910
|
-
const g = hr({
|
|
1911
|
-
popupStore: t,
|
|
1912
|
-
onOpenChange: t.setOpen,
|
|
1913
|
-
treatPopupAsFloatingElement: !0,
|
|
1914
|
-
noEmit: !0
|
|
1915
|
-
}), [b, C] = u.useState(0), T = b === 0, y = yr(g), E = Ao(g, {
|
|
1916
|
-
outsidePressEvent() {
|
|
1917
|
-
return t.context.internalBackdropRef.current || t.context.backdropRef.current ? "intentional" : {
|
|
1918
|
-
mouse: a === "trap-focus" ? "sloppy" : "intentional",
|
|
1919
|
-
touch: "sloppy"
|
|
1920
|
-
};
|
|
1921
|
-
},
|
|
1922
|
-
outsidePress(W) {
|
|
1923
|
-
if ("button" in W && W.button !== 0 || "touches" in W && W.touches.length !== 1)
|
|
1924
|
-
return !1;
|
|
1925
|
-
const H = re(W);
|
|
1926
|
-
if (T && !s) {
|
|
1927
|
-
const q = H;
|
|
1928
|
-
return a && (t.context.internalBackdropRef.current || t.context.backdropRef.current) ? t.context.internalBackdropRef.current === q || t.context.backdropRef.current === q || $(q, l) && !q?.hasAttribute("data-base-ui-portal") : !0;
|
|
1929
|
-
}
|
|
1930
|
-
return !1;
|
|
1931
|
-
},
|
|
1932
|
-
escapeKey: T
|
|
1933
|
-
});
|
|
1934
|
-
So(r && a === !0, l);
|
|
1935
|
-
const {
|
|
1936
|
-
getReferenceProps: x,
|
|
1937
|
-
getFloatingProps: k,
|
|
1938
|
-
getTriggerProps: w
|
|
1939
|
-
} = pn([y, E]);
|
|
1940
|
-
t.useContextCallback("onNestedDialogOpen", (W) => {
|
|
1941
|
-
C(W + 1);
|
|
1942
|
-
}), t.useContextCallback("onNestedDialogClose", () => {
|
|
1943
|
-
C(0);
|
|
1944
|
-
}), u.useEffect(() => (n?.onNestedDialogOpen && r && n.onNestedDialogOpen(b), n?.onNestedDialogClose && !r && n.onNestedDialogClose(), () => {
|
|
1945
|
-
n?.onNestedDialogClose && r && n.onNestedDialogClose();
|
|
1946
|
-
}), [r, n, b]);
|
|
1947
|
-
const D = u.useMemo(() => x(c), [x, c]), I = u.useMemo(() => w(c), [w, c]), B = u.useMemo(() => k(), [k]);
|
|
1948
|
-
t.useSyncedValues({
|
|
1949
|
-
openMethod: i,
|
|
1950
|
-
activeTriggerProps: D,
|
|
1951
|
-
inactiveTriggerProps: I,
|
|
1952
|
-
popupProps: B,
|
|
1953
|
-
floatingRootContext: g,
|
|
1954
|
-
nestedOpenDialogCount: b
|
|
1955
|
-
});
|
|
1956
|
-
}
|
|
1957
|
-
const lt = /* @__PURE__ */ u.createContext(void 0);
|
|
1958
|
-
process.env.NODE_ENV !== "production" && (lt.displayName = "DialogRootContext");
|
|
1959
|
-
function de(e) {
|
|
1960
|
-
const t = u.useContext(lt);
|
|
1961
|
-
if (e === !1 && t === void 0)
|
|
1962
|
-
throw new Error(process.env.NODE_ENV !== "production" ? "Base UI: DialogRootContext is missing. Dialog parts must be placed within <Dialog.Root>." : Me(27));
|
|
1963
|
-
return t;
|
|
1964
|
-
}
|
|
1965
|
-
const Cr = {
|
|
1966
|
-
...mr,
|
|
1967
|
-
modal: _((e) => e.modal),
|
|
1968
|
-
nested: _((e) => e.nested),
|
|
1969
|
-
nestedOpenDialogCount: _((e) => e.nestedOpenDialogCount),
|
|
1970
|
-
disablePointerDismissal: _((e) => e.disablePointerDismissal),
|
|
1971
|
-
openMethod: _((e) => e.openMethod),
|
|
1972
|
-
descriptionElementId: _((e) => e.descriptionElementId),
|
|
1973
|
-
titleElementId: _((e) => e.titleElementId),
|
|
1974
|
-
viewportElement: _((e) => e.viewportElement),
|
|
1975
|
-
role: _((e) => e.role)
|
|
1976
|
-
};
|
|
1977
|
-
class Rr extends un {
|
|
1978
|
-
constructor(t) {
|
|
1979
|
-
super(Tr(t), {
|
|
1980
|
-
popupRef: /* @__PURE__ */ u.createRef(),
|
|
1981
|
-
backdropRef: /* @__PURE__ */ u.createRef(),
|
|
1982
|
-
internalBackdropRef: /* @__PURE__ */ u.createRef(),
|
|
1983
|
-
triggerElements: new fn(),
|
|
1984
|
-
onOpenChange: void 0,
|
|
1985
|
-
onOpenChangeComplete: void 0
|
|
1986
|
-
}, Cr);
|
|
1987
|
-
}
|
|
1988
|
-
setOpen = (t, n) => {
|
|
1989
|
-
if (n.preventUnmountOnClose = () => {
|
|
1990
|
-
this.set("preventUnmountingOnClose", !0);
|
|
1991
|
-
}, !t && n.trigger == null && this.state.activeTriggerId != null && (n.trigger = this.state.activeTriggerElement ?? void 0), this.context.onOpenChange?.(t, n), n.isCanceled)
|
|
1992
|
-
return;
|
|
1993
|
-
const o = {
|
|
1994
|
-
open: t,
|
|
1995
|
-
nativeEvent: n.event,
|
|
1996
|
-
reason: n.reason,
|
|
1997
|
-
nested: this.state.nested
|
|
1998
|
-
};
|
|
1999
|
-
this.state.floatingRootContext.context.events?.emit("openchange", o);
|
|
2000
|
-
const r = {
|
|
2001
|
-
open: t
|
|
2002
|
-
}, s = n.trigger?.id ?? null;
|
|
2003
|
-
(s || t) && (r.activeTriggerId = s, r.activeTriggerElement = n.trigger ?? null), this.update(r);
|
|
2004
|
-
};
|
|
2005
|
-
}
|
|
2006
|
-
function Tr(e = {}) {
|
|
2007
|
-
return {
|
|
2008
|
-
...gr(),
|
|
2009
|
-
modal: !0,
|
|
2010
|
-
disablePointerDismissal: !1,
|
|
2011
|
-
popupElement: null,
|
|
2012
|
-
viewportElement: null,
|
|
2013
|
-
descriptionElementId: void 0,
|
|
2014
|
-
titleElementId: void 0,
|
|
2015
|
-
openMethod: null,
|
|
2016
|
-
nested: !1,
|
|
2017
|
-
nestedOpenDialogCount: 0,
|
|
2018
|
-
role: "dialog",
|
|
2019
|
-
...e
|
|
2020
|
-
};
|
|
2021
|
-
}
|
|
2022
|
-
function Or(e) {
|
|
2023
|
-
const {
|
|
2024
|
-
children: t,
|
|
2025
|
-
open: n,
|
|
2026
|
-
defaultOpen: o = !1,
|
|
2027
|
-
onOpenChange: r,
|
|
2028
|
-
onOpenChangeComplete: s,
|
|
2029
|
-
actionsRef: a,
|
|
2030
|
-
handle: l,
|
|
2031
|
-
triggerId: i,
|
|
2032
|
-
defaultTriggerId: c = null
|
|
2033
|
-
} = e, f = de(), h = !!f, p = zt(() => l?.store ?? new Rr({
|
|
2034
|
-
open: n ?? o,
|
|
2035
|
-
activeTriggerId: i !== void 0 ? i : c,
|
|
2036
|
-
modal: !0,
|
|
2037
|
-
disablePointerDismissal: !0,
|
|
2038
|
-
nested: h,
|
|
2039
|
-
role: "alertdialog"
|
|
2040
|
-
})).current;
|
|
2041
|
-
p.useControlledProp("open", n, o), p.useControlledProp("activeTriggerId", i, c), p.useSyncedValue("nested", h), p.useContextCallback("onOpenChange", r), p.useContextCallback("onOpenChangeComplete", s);
|
|
2042
|
-
const m = p.useState("payload");
|
|
2043
|
-
Sr({
|
|
2044
|
-
store: p,
|
|
2045
|
-
actionsRef: a,
|
|
2046
|
-
parentContext: f?.store.context
|
|
2047
|
-
});
|
|
2048
|
-
const g = u.useMemo(() => ({
|
|
2049
|
-
store: p
|
|
2050
|
-
}), [p]);
|
|
2051
|
-
return /* @__PURE__ */ K(lt.Provider, {
|
|
2052
|
-
value: g,
|
|
2053
|
-
children: typeof t == "function" ? t({
|
|
2054
|
-
payload: m
|
|
2055
|
-
}) : t
|
|
2056
|
-
});
|
|
2057
|
-
}
|
|
2058
|
-
let ge = (function(e) {
|
|
2059
|
-
return e.open = "data-open", e.closed = "data-closed", e[e.startingStyle = gt.startingStyle] = "startingStyle", e[e.endingStyle = gt.endingStyle] = "endingStyle", e.anchorHidden = "data-anchor-hidden", e;
|
|
2060
|
-
})({}), wr = /* @__PURE__ */ (function(e) {
|
|
2061
|
-
return e.popupOpen = "data-popup-open", e.pressed = "data-pressed", e;
|
|
2062
|
-
})({});
|
|
2063
|
-
const xr = {
|
|
2064
|
-
[wr.popupOpen]: ""
|
|
2065
|
-
}, Dr = {
|
|
2066
|
-
[ge.open]: ""
|
|
2067
|
-
}, kr = {
|
|
2068
|
-
[ge.closed]: ""
|
|
2069
|
-
}, Ir = {
|
|
2070
|
-
[ge.anchorHidden]: ""
|
|
2071
|
-
}, Nr = {
|
|
2072
|
-
open(e) {
|
|
2073
|
-
return e ? xr : null;
|
|
2074
|
-
}
|
|
2075
|
-
}, gn = {
|
|
2076
|
-
open(e) {
|
|
2077
|
-
return e ? Dr : kr;
|
|
2078
|
-
},
|
|
2079
|
-
anchorHidden(e) {
|
|
2080
|
-
return e ? Ir : null;
|
|
2081
|
-
}
|
|
2082
|
-
}, Mr = {
|
|
2083
|
-
...gn,
|
|
2084
|
-
...Kt
|
|
2085
|
-
}, mn = /* @__PURE__ */ u.forwardRef(function(t, n) {
|
|
2086
|
-
const {
|
|
2087
|
-
render: o,
|
|
2088
|
-
className: r,
|
|
2089
|
-
forceRender: s = !1,
|
|
2090
|
-
...a
|
|
2091
|
-
} = t, {
|
|
2092
|
-
store: l
|
|
2093
|
-
} = de(), i = l.useState("open"), c = l.useState("nested"), f = l.useState("mounted"), h = l.useState("transitionStatus"), p = u.useMemo(() => ({
|
|
2094
|
-
open: i,
|
|
2095
|
-
transitionStatus: h
|
|
2096
|
-
}), [i, h]);
|
|
2097
|
-
return Re("div", t, {
|
|
2098
|
-
state: p,
|
|
2099
|
-
ref: [l.context.backdropRef, n],
|
|
2100
|
-
stateAttributesMapping: Mr,
|
|
2101
|
-
props: [{
|
|
2102
|
-
role: "presentation",
|
|
2103
|
-
hidden: !f,
|
|
2104
|
-
style: {
|
|
2105
|
-
userSelect: "none",
|
|
2106
|
-
WebkitUserSelect: "none"
|
|
2107
|
-
}
|
|
2108
|
-
}, a],
|
|
2109
|
-
enabled: s || !c
|
|
2110
|
-
});
|
|
2111
|
-
});
|
|
2112
|
-
process.env.NODE_ENV !== "production" && (mn.displayName = "DialogBackdrop");
|
|
2113
|
-
const ct = /* @__PURE__ */ u.forwardRef(function(t, n) {
|
|
2114
|
-
const {
|
|
2115
|
-
render: o,
|
|
2116
|
-
className: r,
|
|
2117
|
-
disabled: s = !1,
|
|
2118
|
-
nativeButton: a = !0,
|
|
2119
|
-
...l
|
|
2120
|
-
} = t, {
|
|
2121
|
-
store: i
|
|
2122
|
-
} = de(), c = i.useState("open");
|
|
2123
|
-
function f(g) {
|
|
2124
|
-
c && i.setOpen(!1, se(Hn, g.nativeEvent));
|
|
2125
|
-
}
|
|
2126
|
-
const {
|
|
2127
|
-
getButtonProps: h,
|
|
2128
|
-
buttonRef: p
|
|
2129
|
-
} = Ht({
|
|
2130
|
-
disabled: s,
|
|
2131
|
-
native: a
|
|
2132
|
-
}), m = u.useMemo(() => ({
|
|
2133
|
-
disabled: s
|
|
2134
|
-
}), [s]);
|
|
2135
|
-
return Re("button", t, {
|
|
2136
|
-
state: m,
|
|
2137
|
-
ref: [n, p],
|
|
2138
|
-
props: [{
|
|
2139
|
-
onClick: f
|
|
2140
|
-
}, l, h]
|
|
2141
|
-
});
|
|
2142
|
-
});
|
|
2143
|
-
process.env.NODE_ENV !== "production" && (ct.displayName = "DialogClose");
|
|
2144
|
-
const hn = /* @__PURE__ */ u.forwardRef(function(t, n) {
|
|
2145
|
-
const {
|
|
2146
|
-
render: o,
|
|
2147
|
-
className: r,
|
|
2148
|
-
id: s,
|
|
2149
|
-
...a
|
|
2150
|
-
} = t, {
|
|
2151
|
-
store: l
|
|
2152
|
-
} = de(), i = it(s);
|
|
2153
|
-
return l.useSyncedValueWithCleanup("descriptionElementId", i), Re("p", t, {
|
|
2154
|
-
ref: n,
|
|
2155
|
-
props: [{
|
|
2156
|
-
id: i
|
|
2157
|
-
}, a]
|
|
2158
|
-
});
|
|
2159
|
-
});
|
|
2160
|
-
process.env.NODE_ENV !== "production" && (hn.displayName = "DialogDescription");
|
|
2161
|
-
let Pr = /* @__PURE__ */ (function(e) {
|
|
2162
|
-
return e.nestedDialogs = "--nested-dialogs", e;
|
|
2163
|
-
})({}), Ar = (function(e) {
|
|
2164
|
-
return e[e.open = ge.open] = "open", e[e.closed = ge.closed] = "closed", e[e.startingStyle = ge.startingStyle] = "startingStyle", e[e.endingStyle = ge.endingStyle] = "endingStyle", e.nested = "data-nested", e.nestedDialogOpen = "data-nested-dialog-open", e;
|
|
2165
|
-
})({});
|
|
2166
|
-
const ut = /* @__PURE__ */ u.createContext(void 0);
|
|
2167
|
-
process.env.NODE_ENV !== "production" && (ut.displayName = "DialogPortalContext");
|
|
2168
|
-
function Fr() {
|
|
2169
|
-
const e = u.useContext(ut);
|
|
2170
|
-
if (e === void 0)
|
|
2171
|
-
throw new Error(process.env.NODE_ENV !== "production" ? "Base UI: <Dialog.Portal> is missing." : Me(26));
|
|
2172
|
-
return e;
|
|
2173
|
-
}
|
|
2174
|
-
const _r = {
|
|
2175
|
-
...gn,
|
|
2176
|
-
...Kt,
|
|
2177
|
-
nestedDialogOpen(e) {
|
|
2178
|
-
return e ? {
|
|
2179
|
-
[Ar.nestedDialogOpen]: ""
|
|
2180
|
-
} : null;
|
|
2181
|
-
}
|
|
2182
|
-
}, En = /* @__PURE__ */ u.forwardRef(function(t, n) {
|
|
2183
|
-
const {
|
|
2184
|
-
className: o,
|
|
2185
|
-
finalFocus: r,
|
|
2186
|
-
initialFocus: s,
|
|
2187
|
-
render: a,
|
|
2188
|
-
...l
|
|
2189
|
-
} = t, {
|
|
2190
|
-
store: i
|
|
2191
|
-
} = de(), c = i.useState("descriptionElementId"), f = i.useState("disablePointerDismissal"), h = i.useState("floatingRootContext"), p = i.useState("popupProps"), m = i.useState("modal"), g = i.useState("mounted"), b = i.useState("nested"), C = i.useState("nestedOpenDialogCount"), T = i.useState("open"), y = i.useState("openMethod"), E = i.useState("titleElementId"), x = i.useState("transitionStatus"), k = i.useState("role");
|
|
2192
|
-
Fr(), Wt({
|
|
2193
|
-
open: T,
|
|
2194
|
-
ref: i.context.popupRef,
|
|
2195
|
-
onComplete() {
|
|
2196
|
-
T && i.context.onOpenChangeComplete?.(!0);
|
|
2197
|
-
}
|
|
2198
|
-
});
|
|
2199
|
-
function w(H) {
|
|
2200
|
-
return H === "touch" ? i.context.popupRef.current : !0;
|
|
2201
|
-
}
|
|
2202
|
-
const D = s === void 0 ? w : s, I = C > 0, B = u.useMemo(() => ({
|
|
2203
|
-
open: T,
|
|
2204
|
-
nested: b,
|
|
2205
|
-
transitionStatus: x,
|
|
2206
|
-
nestedDialogOpen: I
|
|
2207
|
-
}), [T, b, x, I]), W = Re("div", t, {
|
|
2208
|
-
state: B,
|
|
2209
|
-
props: [p, {
|
|
2210
|
-
"aria-labelledby": E ?? void 0,
|
|
2211
|
-
"aria-describedby": c ?? void 0,
|
|
2212
|
-
role: k,
|
|
2213
|
-
tabIndex: -1,
|
|
2214
|
-
hidden: !g,
|
|
2215
|
-
onKeyDown(H) {
|
|
2216
|
-
fo.has(H.key) && H.stopPropagation();
|
|
2217
|
-
},
|
|
2218
|
-
style: {
|
|
2219
|
-
[Pr.nestedDialogs]: C
|
|
2220
|
-
}
|
|
2221
|
-
}, l],
|
|
2222
|
-
ref: [n, i.context.popupRef, i.useStateSetter("popupElement")],
|
|
2223
|
-
stateAttributesMapping: _r
|
|
2224
|
-
});
|
|
2225
|
-
return /* @__PURE__ */ K(Io, {
|
|
2226
|
-
context: h,
|
|
2227
|
-
openInteractionType: y,
|
|
2228
|
-
disabled: !g,
|
|
2229
|
-
closeOnFocusOut: !f,
|
|
2230
|
-
initialFocus: D,
|
|
2231
|
-
returnFocus: r,
|
|
2232
|
-
modal: m !== !1,
|
|
2233
|
-
restoreFocus: "popup",
|
|
2234
|
-
children: W
|
|
2235
|
-
});
|
|
2236
|
-
});
|
|
2237
|
-
process.env.NODE_ENV !== "production" && (En.displayName = "DialogPopup");
|
|
2238
|
-
const yn = /* @__PURE__ */ u.forwardRef(function(t, n) {
|
|
2239
|
-
const {
|
|
2240
|
-
cutout: o,
|
|
2241
|
-
...r
|
|
2242
|
-
} = t;
|
|
2243
|
-
let s;
|
|
2244
|
-
if (o) {
|
|
2245
|
-
const a = o?.getBoundingClientRect();
|
|
2246
|
-
s = `polygon(
|
|
2247
|
-
0% 0%,
|
|
2248
|
-
100% 0%,
|
|
2249
|
-
100% 100%,
|
|
2250
|
-
0% 100%,
|
|
2251
|
-
0% 0%,
|
|
2252
|
-
${a.left}px ${a.top}px,
|
|
2253
|
-
${a.left}px ${a.bottom}px,
|
|
2254
|
-
${a.right}px ${a.bottom}px,
|
|
2255
|
-
${a.right}px ${a.top}px,
|
|
2256
|
-
${a.left}px ${a.top}px
|
|
2257
|
-
)`;
|
|
2258
|
-
}
|
|
2259
|
-
return /* @__PURE__ */ K("div", {
|
|
2260
|
-
ref: n,
|
|
2261
|
-
role: "presentation",
|
|
2262
|
-
"data-base-ui-inert": "",
|
|
2263
|
-
...r,
|
|
2264
|
-
style: {
|
|
2265
|
-
position: "fixed",
|
|
2266
|
-
inset: 0,
|
|
2267
|
-
userSelect: "none",
|
|
2268
|
-
WebkitUserSelect: "none",
|
|
2269
|
-
clipPath: s
|
|
2270
|
-
}
|
|
2271
|
-
});
|
|
2272
|
-
});
|
|
2273
|
-
process.env.NODE_ENV !== "production" && (yn.displayName = "InternalBackdrop");
|
|
2274
|
-
const bn = /* @__PURE__ */ u.forwardRef(function(t, n) {
|
|
2275
|
-
const {
|
|
2276
|
-
keepMounted: o = !1,
|
|
2277
|
-
...r
|
|
2278
|
-
} = t, {
|
|
2279
|
-
store: s
|
|
2280
|
-
} = de(), a = s.useState("mounted"), l = s.useState("modal");
|
|
2281
|
-
return a || o ? /* @__PURE__ */ K(ut.Provider, {
|
|
2282
|
-
value: o,
|
|
2283
|
-
children: /* @__PURE__ */ At(oo, {
|
|
2284
|
-
ref: n,
|
|
2285
|
-
...r,
|
|
2286
|
-
children: [a && l === !0 && /* @__PURE__ */ K(yn, {
|
|
2287
|
-
ref: s.context.internalBackdropRef,
|
|
2288
|
-
inert: ro(!open)
|
|
2289
|
-
}), t.children]
|
|
2290
|
-
})
|
|
2291
|
-
}) : null;
|
|
2292
|
-
});
|
|
2293
|
-
process.env.NODE_ENV !== "production" && (bn.displayName = "DialogPortal");
|
|
2294
|
-
const vn = /* @__PURE__ */ u.forwardRef(function(t, n) {
|
|
2295
|
-
const {
|
|
2296
|
-
render: o,
|
|
2297
|
-
className: r,
|
|
2298
|
-
id: s,
|
|
2299
|
-
...a
|
|
2300
|
-
} = t, {
|
|
2301
|
-
store: l
|
|
2302
|
-
} = de(), i = it(s);
|
|
2303
|
-
return l.useSyncedValueWithCleanup("titleElementId", i), Re("h2", t, {
|
|
2304
|
-
ref: n,
|
|
2305
|
-
props: [{
|
|
2306
|
-
id: i
|
|
2307
|
-
}, a]
|
|
2308
|
-
});
|
|
2309
|
-
});
|
|
2310
|
-
process.env.NODE_ENV !== "production" && (vn.displayName = "DialogTitle");
|
|
2311
|
-
const Sn = /* @__PURE__ */ u.forwardRef(function(t, n) {
|
|
2312
|
-
const {
|
|
2313
|
-
render: o,
|
|
2314
|
-
className: r,
|
|
2315
|
-
disabled: s = !1,
|
|
2316
|
-
nativeButton: a = !0,
|
|
2317
|
-
id: l,
|
|
2318
|
-
payload: i,
|
|
2319
|
-
handle: c,
|
|
2320
|
-
...f
|
|
2321
|
-
} = t, h = de(!0), p = c?.store ?? h?.store;
|
|
2322
|
-
if (!p)
|
|
2323
|
-
throw new Error(process.env.NODE_ENV !== "production" ? "Base UI: <Dialog.Trigger> must be used within <Dialog.Root> or provided with a handle." : Me(79));
|
|
2324
|
-
const m = it(l), g = p.useState("floatingRootContext"), b = p.useState("isOpenedByTrigger", m), C = u.useRef(null), {
|
|
2325
|
-
registerTrigger: T,
|
|
2326
|
-
isMountedByThisTrigger: y
|
|
2327
|
-
} = ur(m, C, p, {
|
|
2328
|
-
payload: i
|
|
2329
|
-
}), {
|
|
2330
|
-
getButtonProps: E,
|
|
2331
|
-
buttonRef: x
|
|
2332
|
-
} = Ht({
|
|
2333
|
-
disabled: s,
|
|
2334
|
-
native: a
|
|
2335
|
-
}), k = No(g, {
|
|
2336
|
-
enabled: g != null
|
|
2337
|
-
}), w = pn([k]), D = u.useMemo(() => ({
|
|
2338
|
-
disabled: s,
|
|
2339
|
-
open: b
|
|
2340
|
-
}), [s, b]), I = p.useState("triggerProps", y);
|
|
2341
|
-
return Re("button", t, {
|
|
2342
|
-
state: D,
|
|
2343
|
-
ref: [x, n, T, C],
|
|
2344
|
-
props: [w.getReferenceProps(), I, {
|
|
2345
|
-
[Xt]: "",
|
|
2346
|
-
id: m
|
|
2347
|
-
}, f, E],
|
|
2348
|
-
stateAttributesMapping: Nr
|
|
2349
|
-
});
|
|
2350
|
-
});
|
|
2351
|
-
process.env.NODE_ENV !== "production" && (Sn.displayName = "DialogTrigger");
|
|
2352
|
-
const Cn = Fn(null), Lr = ({
|
|
1
|
+
import { jsx as o } from "react/jsx-runtime";
|
|
2
|
+
import { AlertDialog as i } from "@base-ui/react/alert-dialog";
|
|
3
|
+
import { createContext as R, useContext as S, useRef as y } from "react";
|
|
4
|
+
import { a as F } from "../Slot-D2Bbf8Gw.mjs";
|
|
5
|
+
import { useMergeRefs as D } from "@spark-ui/hooks/use-merge-refs";
|
|
6
|
+
import { useScrollOverflow as B } from "@spark-ui/hooks/use-scroll-overflow";
|
|
7
|
+
import { cx as d } from "class-variance-authority";
|
|
8
|
+
import { d as z } from "../DialogContent.styles-BSfXHt21.mjs";
|
|
9
|
+
const A = R(null), H = ({
|
|
2353
10
|
children: e,
|
|
2354
11
|
withFade: t = !1,
|
|
2355
|
-
cancelRef:
|
|
2356
|
-
}) => /* @__PURE__ */
|
|
2357
|
-
|
|
12
|
+
cancelRef: a
|
|
13
|
+
}) => /* @__PURE__ */ o(
|
|
14
|
+
A.Provider,
|
|
2358
15
|
{
|
|
2359
16
|
value: {
|
|
2360
|
-
cancelRef:
|
|
17
|
+
cancelRef: a,
|
|
2361
18
|
withFade: t
|
|
2362
19
|
},
|
|
2363
20
|
children: e
|
|
2364
21
|
}
|
|
2365
|
-
),
|
|
2366
|
-
const e =
|
|
22
|
+
), p = () => {
|
|
23
|
+
const e = S(A);
|
|
2367
24
|
if (!e)
|
|
2368
25
|
throw Error("useAlertDialog must be used within an AlertDialog provider");
|
|
2369
26
|
return e;
|
|
2370
|
-
},
|
|
2371
|
-
const
|
|
2372
|
-
|
|
2373
|
-
|
|
27
|
+
}, u = ({ onOpenChange: e, withFade: t = !1, ...a }) => {
|
|
28
|
+
const l = y(null), s = e ? (n, c) => {
|
|
29
|
+
e(n);
|
|
30
|
+
} : void 0;
|
|
31
|
+
return /* @__PURE__ */ o(H, { withFade: t, cancelRef: l, children: /* @__PURE__ */ o(
|
|
32
|
+
i.Root,
|
|
2374
33
|
{
|
|
2375
34
|
"data-spark-component": "alert-dialog",
|
|
2376
|
-
onOpenChange:
|
|
2377
|
-
|
|
2378
|
-
} : void 0,
|
|
2379
|
-
...n
|
|
35
|
+
onOpenChange: s,
|
|
36
|
+
...a
|
|
2380
37
|
}
|
|
2381
38
|
) });
|
|
2382
39
|
};
|
|
2383
|
-
|
|
2384
|
-
function
|
|
2385
|
-
const
|
|
2386
|
-
return e ? ({ ...
|
|
2387
|
-
}
|
|
2388
|
-
const
|
|
2389
|
-
const
|
|
2390
|
-
return /* @__PURE__ */
|
|
2391
|
-
|
|
40
|
+
u.displayName = "AlertDialog";
|
|
41
|
+
function m(e, t) {
|
|
42
|
+
const a = e ? F : t;
|
|
43
|
+
return e ? ({ ...l }) => /* @__PURE__ */ o(a, { ...l }) : void 0;
|
|
44
|
+
}
|
|
45
|
+
const f = ({ asChild: e = !1, ...t }) => {
|
|
46
|
+
const a = m(e, "button");
|
|
47
|
+
return /* @__PURE__ */ o(
|
|
48
|
+
i.Close,
|
|
2392
49
|
{
|
|
2393
50
|
"data-spark-component": "alert-dialog-action",
|
|
2394
|
-
render:
|
|
51
|
+
render: a,
|
|
2395
52
|
...t
|
|
2396
53
|
}
|
|
2397
54
|
);
|
|
2398
55
|
};
|
|
2399
|
-
|
|
2400
|
-
const
|
|
56
|
+
f.displayName = "AlertDialog.Action";
|
|
57
|
+
const N = ({
|
|
2401
58
|
children: e,
|
|
2402
59
|
className: t,
|
|
2403
|
-
inset:
|
|
2404
|
-
ref:
|
|
2405
|
-
...
|
|
60
|
+
inset: a = !1,
|
|
61
|
+
ref: l,
|
|
62
|
+
...s
|
|
2406
63
|
}) => {
|
|
2407
|
-
const
|
|
2408
|
-
return /* @__PURE__ */
|
|
64
|
+
const n = y(null), c = D(l, n), { withFade: O } = p(), { overflow: g } = B(n);
|
|
65
|
+
return /* @__PURE__ */ o(
|
|
2409
66
|
"div",
|
|
2410
67
|
{
|
|
2411
68
|
"data-spark-component": "alert-dialog-body",
|
|
2412
|
-
ref:
|
|
2413
|
-
className:
|
|
69
|
+
ref: c,
|
|
70
|
+
className: d(
|
|
2414
71
|
"focus-visible:u-outline relative grow overflow-y-auto outline-hidden",
|
|
2415
72
|
"transition-all duration-300",
|
|
2416
73
|
{
|
|
2417
|
-
"px-xl py-lg": !
|
|
74
|
+
"px-xl py-lg": !a
|
|
2418
75
|
},
|
|
2419
76
|
t
|
|
2420
77
|
),
|
|
2421
78
|
style: {
|
|
2422
|
-
...
|
|
79
|
+
...O && {
|
|
2423
80
|
maskImage: "linear-gradient(to bottom, rgba(0, 0, 0, 0), rgba(0, 0, 0, 1) 44px, rgba(0, 0, 0, 1) calc(100% - 44px), rgba(0, 0, 0, 0))",
|
|
2424
|
-
maskSize: `100% calc(100% + ${
|
|
2425
|
-
maskPosition: `0 ${
|
|
81
|
+
maskSize: `100% calc(100% + ${g.top ? "0px" : "44px"} + ${g.bottom ? "0px" : "44px"})`,
|
|
82
|
+
maskPosition: `0 ${g.top ? "0px" : "-44px"}`
|
|
2426
83
|
}
|
|
2427
84
|
},
|
|
2428
|
-
...
|
|
85
|
+
...s,
|
|
2429
86
|
children: e
|
|
2430
87
|
}
|
|
2431
88
|
);
|
|
2432
89
|
};
|
|
2433
|
-
|
|
2434
|
-
const
|
|
90
|
+
N.displayName = "AlertDialog.Body";
|
|
91
|
+
const x = ({
|
|
2435
92
|
asChild: e = !1,
|
|
2436
93
|
ref: t,
|
|
2437
|
-
...
|
|
94
|
+
...a
|
|
2438
95
|
}) => {
|
|
2439
|
-
const { cancelRef:
|
|
2440
|
-
return /* @__PURE__ */
|
|
2441
|
-
|
|
96
|
+
const { cancelRef: l } = p(), s = D(t, l), n = m(e, "button");
|
|
97
|
+
return /* @__PURE__ */ o(
|
|
98
|
+
i.Close,
|
|
2442
99
|
{
|
|
2443
|
-
ref:
|
|
100
|
+
ref: s,
|
|
2444
101
|
"data-spark-component": "alert-dialog-cancel",
|
|
2445
|
-
render:
|
|
2446
|
-
...
|
|
102
|
+
render: n,
|
|
103
|
+
...a
|
|
2447
104
|
}
|
|
2448
105
|
);
|
|
2449
106
|
};
|
|
2450
|
-
|
|
2451
|
-
const
|
|
107
|
+
x.displayName = "AlertDialog.Cancel";
|
|
108
|
+
const v = ({
|
|
2452
109
|
className: e,
|
|
2453
110
|
ref: t,
|
|
2454
|
-
initialFocus:
|
|
2455
|
-
...
|
|
111
|
+
initialFocus: a,
|
|
112
|
+
...l
|
|
2456
113
|
}) => {
|
|
2457
|
-
const { cancelRef:
|
|
2458
|
-
return /* @__PURE__ */
|
|
2459
|
-
|
|
114
|
+
const { cancelRef: s } = p(), n = a !== void 0 ? a : () => s.current;
|
|
115
|
+
return /* @__PURE__ */ o(
|
|
116
|
+
i.Popup,
|
|
2460
117
|
{
|
|
2461
118
|
ref: t,
|
|
2462
119
|
"data-spark-component": "alert-dialog-content",
|
|
2463
120
|
role: "alertdialog",
|
|
2464
|
-
className: (
|
|
2465
|
-
|
|
121
|
+
className: (c) => d(
|
|
122
|
+
z({ size: "md", isNarrow: !0 }),
|
|
2466
123
|
"min-w-sz-288",
|
|
2467
124
|
// Base UI automatically adds data-[starting-style] and data-[ending-style] attributes
|
|
2468
125
|
// Transition with opacity and scale for smooth open/close animations
|
|
2469
126
|
"transition-all duration-150",
|
|
2470
127
|
"data-starting-style:scale-90 data-starting-style:opacity-0",
|
|
2471
128
|
"data-ending-style:scale-90 data-ending-style:opacity-0",
|
|
2472
|
-
typeof e == "function" ? e(
|
|
129
|
+
typeof e == "function" ? e(c) : e
|
|
2473
130
|
),
|
|
2474
|
-
initialFocus: n
|
|
2475
|
-
...
|
|
131
|
+
initialFocus: n,
|
|
132
|
+
...l
|
|
2476
133
|
}
|
|
2477
134
|
);
|
|
2478
135
|
};
|
|
2479
|
-
|
|
2480
|
-
const
|
|
2481
|
-
|
|
2482
|
-
const
|
|
136
|
+
v.displayName = "AlertDialog.Content";
|
|
137
|
+
const C = (e) => /* @__PURE__ */ o(i.Description, { "data-spark-component": "alert-dialog-description", ...e });
|
|
138
|
+
C.displayName = "AlertDialog.Description";
|
|
139
|
+
const k = ({
|
|
2483
140
|
children: e,
|
|
2484
141
|
className: t,
|
|
2485
|
-
ref:
|
|
2486
|
-
...
|
|
2487
|
-
}) => /* @__PURE__ */
|
|
142
|
+
ref: a,
|
|
143
|
+
...l
|
|
144
|
+
}) => /* @__PURE__ */ o(
|
|
2488
145
|
"footer",
|
|
2489
146
|
{
|
|
2490
147
|
"data-spark-component": "alert-dialog-footer",
|
|
2491
|
-
ref:
|
|
2492
|
-
className:
|
|
2493
|
-
...
|
|
148
|
+
ref: a,
|
|
149
|
+
className: d(t, ["px-xl", "py-lg"]),
|
|
150
|
+
...l,
|
|
2494
151
|
children: e
|
|
2495
152
|
}
|
|
2496
153
|
);
|
|
2497
|
-
|
|
2498
|
-
const
|
|
154
|
+
k.displayName = "AlertDialog.Footer";
|
|
155
|
+
const b = ({
|
|
2499
156
|
children: e,
|
|
2500
157
|
className: t,
|
|
2501
|
-
ref:
|
|
2502
|
-
...
|
|
2503
|
-
}) => /* @__PURE__ */
|
|
158
|
+
ref: a,
|
|
159
|
+
...l
|
|
160
|
+
}) => /* @__PURE__ */ o(
|
|
2504
161
|
"header",
|
|
2505
162
|
{
|
|
2506
163
|
"data-spark-component": "alert-dialog-header",
|
|
2507
|
-
ref:
|
|
2508
|
-
className:
|
|
2509
|
-
...
|
|
164
|
+
ref: a,
|
|
165
|
+
className: d(t, ["px-xl", "py-lg"]),
|
|
166
|
+
...l,
|
|
2510
167
|
children: e
|
|
2511
168
|
}
|
|
2512
169
|
);
|
|
2513
|
-
|
|
2514
|
-
const
|
|
2515
|
-
|
|
170
|
+
b.displayName = "AlertDialog.Header";
|
|
171
|
+
const T = ({ className: e, ...t }) => /* @__PURE__ */ o(
|
|
172
|
+
i.Backdrop,
|
|
2516
173
|
{
|
|
2517
174
|
"data-spark-component": "alert-dialog-overlay",
|
|
2518
|
-
className: (
|
|
175
|
+
className: (a) => d(
|
|
2519
176
|
"z-overlay fixed top-0 left-0 h-screen w-screen",
|
|
2520
177
|
"bg-overlay/dim-1",
|
|
2521
178
|
// Base UI automatically adds data-[starting-style] and data-[ending-style] attributes
|
|
2522
|
-
"data-
|
|
2523
|
-
"data-
|
|
2524
|
-
typeof e == "function" ? e(
|
|
179
|
+
"data-starting-style:animate-fade-in",
|
|
180
|
+
"data-ending-style:animate-fade-out",
|
|
181
|
+
typeof e == "function" ? e(a) : e
|
|
2525
182
|
),
|
|
2526
183
|
...t
|
|
2527
184
|
}
|
|
2528
185
|
);
|
|
2529
|
-
|
|
2530
|
-
const
|
|
2531
|
-
|
|
2532
|
-
|
|
2533
|
-
|
|
186
|
+
T.displayName = "AlertDialog.Overlay";
|
|
187
|
+
const h = ({ className: e, ...t }) => /* @__PURE__ */ o(
|
|
188
|
+
i.Portal,
|
|
189
|
+
{
|
|
190
|
+
"data-spark-component": "alert-dialog-portal",
|
|
191
|
+
className: d(e, "z-modal absolute"),
|
|
192
|
+
...t
|
|
193
|
+
}
|
|
194
|
+
);
|
|
195
|
+
h.displayName = "AlertDialog.Portal";
|
|
196
|
+
const w = ({ className: e, ...t }) => /* @__PURE__ */ o(
|
|
197
|
+
i.Title,
|
|
2534
198
|
{
|
|
2535
199
|
"data-spark-component": "alert-dialog-title",
|
|
2536
|
-
className:
|
|
200
|
+
className: d("text-headline-1 text-on-surface", e),
|
|
2537
201
|
...t
|
|
2538
202
|
}
|
|
2539
203
|
);
|
|
2540
|
-
|
|
2541
|
-
const
|
|
2542
|
-
const
|
|
2543
|
-
return /* @__PURE__ */
|
|
2544
|
-
|
|
204
|
+
w.displayName = "AlertDialog.Title";
|
|
205
|
+
const P = ({ asChild: e = !1, ...t }) => {
|
|
206
|
+
const a = m(e, "button");
|
|
207
|
+
return /* @__PURE__ */ o(
|
|
208
|
+
i.Trigger,
|
|
2545
209
|
{
|
|
2546
210
|
"data-spark-component": "alert-dialog-trigger",
|
|
2547
|
-
render:
|
|
211
|
+
render: a,
|
|
2548
212
|
...t
|
|
2549
213
|
}
|
|
2550
214
|
);
|
|
2551
215
|
};
|
|
2552
|
-
|
|
2553
|
-
const
|
|
2554
|
-
Action:
|
|
2555
|
-
Body:
|
|
2556
|
-
Cancel:
|
|
2557
|
-
Content:
|
|
2558
|
-
Description:
|
|
2559
|
-
Footer:
|
|
2560
|
-
Header:
|
|
2561
|
-
Overlay:
|
|
2562
|
-
Portal:
|
|
2563
|
-
Title:
|
|
2564
|
-
Trigger:
|
|
216
|
+
P.displayName = "AlertDialog.Trigger";
|
|
217
|
+
const r = Object.assign(u, {
|
|
218
|
+
Action: f,
|
|
219
|
+
Body: N,
|
|
220
|
+
Cancel: x,
|
|
221
|
+
Content: v,
|
|
222
|
+
Description: C,
|
|
223
|
+
Footer: k,
|
|
224
|
+
Header: b,
|
|
225
|
+
Overlay: T,
|
|
226
|
+
Portal: h,
|
|
227
|
+
Title: w,
|
|
228
|
+
Trigger: P
|
|
2565
229
|
});
|
|
2566
|
-
|
|
2567
|
-
|
|
2568
|
-
|
|
2569
|
-
|
|
2570
|
-
|
|
2571
|
-
|
|
2572
|
-
|
|
2573
|
-
|
|
2574
|
-
|
|
2575
|
-
|
|
2576
|
-
|
|
2577
|
-
|
|
230
|
+
r.displayName = "AlertDialog";
|
|
231
|
+
r.Action.displayName = "AlertDialog.Action";
|
|
232
|
+
r.Body.displayName = "AlertDialog.Body";
|
|
233
|
+
r.Cancel.displayName = "AlertDialog.Cancel";
|
|
234
|
+
r.Content.displayName = "AlertDialog.Content";
|
|
235
|
+
r.Description.displayName = "AlertDialog.Description";
|
|
236
|
+
r.Footer.displayName = "AlertDialog.Footer";
|
|
237
|
+
r.Header.displayName = "AlertDialog.Header";
|
|
238
|
+
r.Overlay.displayName = "AlertDialog.Overlay";
|
|
239
|
+
r.Portal.displayName = "AlertDialog.Portal";
|
|
240
|
+
r.Title.displayName = "AlertDialog.Title";
|
|
241
|
+
r.Trigger.displayName = "AlertDialog.Trigger";
|
|
2578
242
|
export {
|
|
2579
|
-
|
|
2580
|
-
|
|
243
|
+
r as AlertDialog,
|
|
244
|
+
p as useAlertDialog
|
|
2581
245
|
};
|
|
2582
246
|
//# sourceMappingURL=index.mjs.map
|