@chassis-ui/react 0.5.1 → 0.6.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/README.md +4 -3
- package/dist/accordion.js +1 -1
- package/dist/alert.js +1 -1
- package/dist/autocomplete.d.ts +1 -1
- package/dist/autocomplete.js +1 -1
- package/dist/avatar.js +1 -1
- package/dist/badge.js +1 -1
- package/dist/breadcrumb.js +1 -1
- package/dist/button-group.js +1 -1
- package/dist/button.js +1 -1
- package/dist/calendar.js +1 -1
- package/dist/card.js +1 -1
- package/dist/carousel.js +1 -1
- package/dist/checkbox.d.ts +1 -1
- package/dist/checkbox.js +1 -1
- package/dist/chip-input.js +1 -1
- package/dist/chip.js +1 -1
- package/dist/chunks/Button-Cjenm3ku.js +2 -0
- package/dist/chunks/Button-Cjenm3ku.js.map +1 -0
- package/dist/chunks/{Chip-C7QlFCvx.js → Chip-CXuYhjc3.js} +2 -2
- package/dist/chunks/{Chip-C7QlFCvx.js.map → Chip-CXuYhjc3.js.map} +1 -1
- package/dist/chunks/CloseButton-CAQ--0sB.js +2 -0
- package/dist/chunks/CloseButton-CAQ--0sB.js.map +1 -0
- package/dist/chunks/{DateField-4cdcwt0v.js → DateField-G1TP9ayt.js} +2 -2
- package/dist/chunks/{DateField-4cdcwt0v.js.map → DateField-G1TP9ayt.js.map} +1 -1
- package/dist/chunks/{FormHelp-B1eSoack.js → FormHelp-2U3P8C6b.js} +2 -2
- package/dist/chunks/{FormHelp-B1eSoack.js.map → FormHelp-2U3P8C6b.js.map} +1 -1
- package/dist/chunks/Link-B3SX50Od.js +2 -0
- package/dist/chunks/Link-B3SX50Od.js.map +1 -0
- package/dist/chunks/Menu-DBN4Mxak.js +2 -0
- package/dist/chunks/Menu-DBN4Mxak.js.map +1 -0
- package/dist/chunks/MenuToggle-DHzKm1Ed.js +2 -0
- package/dist/chunks/MenuToggle-DHzKm1Ed.js.map +1 -0
- package/dist/chunks/{RangeCalendar-mM3OeTlU.js → RangeCalendar-DRcg1Hp3.js} +2 -2
- package/dist/chunks/{RangeCalendar-mM3OeTlU.js.map → RangeCalendar-DRcg1Hp3.js.map} +1 -1
- package/dist/chunks/{VisuallyHidden-CGv-mBuQ.js → VisuallyHidden-24WfUCsJ.js} +2 -2
- package/dist/chunks/{VisuallyHidden-CGv-mBuQ.js.map → VisuallyHidden-24WfUCsJ.js.map} +1 -1
- package/dist/chunks/{accordion-BZlX2uk8.js → accordion-DiYPbV_r.js} +2 -2
- package/dist/chunks/{accordion-BZlX2uk8.js.map → accordion-DiYPbV_r.js.map} +1 -1
- package/dist/chunks/alert-oSKrhxkI.js +2 -0
- package/dist/chunks/{alert-DSLg5MBb.js.map → alert-oSKrhxkI.js.map} +1 -1
- package/dist/chunks/autocomplete-wjDWeWDh.js +2 -0
- package/dist/chunks/autocomplete-wjDWeWDh.js.map +1 -0
- package/dist/chunks/{avatar-BQBbcnk6.js → avatar-CvcvC9KA.js} +2 -2
- package/dist/chunks/{avatar-BQBbcnk6.js.map → avatar-CvcvC9KA.js.map} +1 -1
- package/dist/chunks/{badge-Ths1Qn1a.js → badge-D7XgWBXc.js} +2 -2
- package/dist/chunks/{badge-Ths1Qn1a.js.map → badge-D7XgWBXc.js.map} +1 -1
- package/dist/chunks/{breadcrumb-BTiQikk-.js → breadcrumb-DxCHVppV.js} +2 -2
- package/dist/chunks/{breadcrumb-BTiQikk-.js.map → breadcrumb-DxCHVppV.js.map} +1 -1
- package/dist/chunks/{button-group-CefkGeYL.js → button-group-CXMj0D4r.js} +2 -2
- package/dist/chunks/{button-group-CefkGeYL.js.map → button-group-CXMj0D4r.js.map} +1 -1
- package/dist/chunks/{card-CEQgHIaL.js → card-C6lPZs5J.js} +2 -2
- package/dist/chunks/{card-CEQgHIaL.js.map → card-C6lPZs5J.js.map} +1 -1
- package/dist/chunks/carousel-Ka9OA-HJ.js +2 -0
- package/dist/chunks/carousel-Ka9OA-HJ.js.map +1 -0
- package/dist/chunks/checkbox-5jv0YWoi.js +2 -0
- package/dist/chunks/checkbox-5jv0YWoi.js.map +1 -0
- package/dist/chunks/chip-input-D8EaNujM.js +2 -0
- package/dist/chunks/chip-input-D8EaNujM.js.map +1 -0
- package/dist/chunks/{collapse-CBi3RWTf.js → collapse-Bc7fnmyU.js} +2 -2
- package/dist/chunks/{collapse-CBi3RWTf.js.map → collapse-Bc7fnmyU.js.map} +1 -1
- package/dist/chunks/color-input-DBOd4Jba.js +2 -0
- package/dist/chunks/color-input-DBOd4Jba.js.map +1 -0
- package/dist/chunks/combobox-DByuUtwh.js +2 -0
- package/dist/chunks/{combobox-DNqR4d3V.js.map → combobox-DByuUtwh.js.map} +1 -1
- package/dist/chunks/context-HDVxTNPi.js.map +1 -1
- package/dist/chunks/context-menu-CGOGliw6.js +2 -0
- package/dist/chunks/context-menu-CGOGliw6.js.map +1 -0
- package/dist/chunks/datagrid-Dv_9uFef.js +2 -0
- package/dist/chunks/datagrid-Dv_9uFef.js.map +1 -0
- package/dist/chunks/datepicker-DuYmXiSe.js +2 -0
- package/dist/chunks/datepicker-DuYmXiSe.js.map +1 -0
- package/dist/chunks/dialogTitle-DMBvXZLT.js +2 -0
- package/dist/chunks/dialogTitle-DMBvXZLT.js.map +1 -0
- package/dist/chunks/{divider-C1-NoKMV.js → divider-DbWmMSrn.js} +2 -2
- package/dist/chunks/{divider-C1-NoKMV.js.map → divider-DbWmMSrn.js.map} +1 -1
- package/dist/chunks/drawer-DPxF30qn.js +2 -0
- package/dist/chunks/drawer-DPxF30qn.js.map +1 -0
- package/dist/chunks/file-input-B5YaBXjI.js +2 -0
- package/dist/chunks/file-input-B5YaBXjI.js.map +1 -0
- package/dist/chunks/{flex-C2jV5LyV.js → flex-C6CbAkVJ.js} +2 -2
- package/dist/chunks/{flex-C2jV5LyV.js.map → flex-C6CbAkVJ.js.map} +1 -1
- package/dist/chunks/floating-input-B9YAJ9d4.js +2 -0
- package/dist/chunks/floating-input-B9YAJ9d4.js.map +1 -0
- package/dist/chunks/{form-field-Bcx96ezd.js → form-field-D74QY_wP.js} +2 -2
- package/dist/chunks/{form-field-Bcx96ezd.js.map → form-field-D74QY_wP.js.map} +1 -1
- package/dist/chunks/grid-BCVkow3u.js +2 -0
- package/dist/chunks/grid-BCVkow3u.js.map +1 -0
- package/dist/chunks/{index-5qsV1-cc.d.ts → index--DV9l24Q.d.ts} +18 -14
- package/dist/chunks/{index-BAvt_oPe.d.ts → index-B2d_pjjy.d.ts} +6 -5
- package/dist/chunks/{index-CbcFEGCh.d.ts → index-BIWaMOr6.d.ts} +9 -2
- package/dist/chunks/{index-3JVLrDHv.d.ts → index-BMAdUGiM.d.ts} +7 -1
- package/dist/chunks/{index-Cpifcw5a.d.ts → index-BzYAMLX1.d.ts} +44 -4
- package/dist/chunks/{index-BbZzaApz.d.ts → index-C9RqZNjk.d.ts} +7 -1
- package/dist/chunks/{index-D0Dhs7YI.d.ts → index-CHtvpvUh.d.ts} +6 -1
- package/dist/chunks/{index-Bl-_sC4y.d.ts → index-CSmHNy8M.d.ts} +8 -2
- package/dist/chunks/{index-Davd7Cue.d.ts → index-CXzKYWtS.d.ts} +3 -2
- package/dist/chunks/{index-OnB4_h6x.d.ts → index-DV_JBDoF.d.ts} +2 -2
- package/dist/chunks/{index-Es9I0fIS.d.ts → index-DjmN2hBX.d.ts} +2 -2
- package/dist/chunks/{index-UjmJQRaG.d.ts → index-DyB9XXLJ.d.ts} +3 -3
- package/dist/chunks/{index-CSRGr7pU.d.ts → index-JCnEw-55.d.ts} +2 -6
- package/dist/chunks/{index-Ctf5hLue.d.ts → index-Me921MYl.d.ts} +15 -13
- package/dist/chunks/{index-C-IrFdKe.d.ts → index-OgWCTy2Y.d.ts} +2 -2
- package/dist/chunks/{index-BZpHSGlk.d.ts → index-bZRQGwY7.d.ts} +7 -2
- package/dist/chunks/{index-Cm3rPbI1.d.ts → index-qJGkO-ni.d.ts} +3 -3
- package/dist/chunks/{input-adorn-DV9tuWXh.js → input-adorn-D0E3Afdf.js} +2 -2
- package/dist/chunks/{input-adorn-DV9tuWXh.js.map → input-adorn-D0E3Afdf.js.map} +1 -1
- package/dist/chunks/{input-group-YB_zoKud.js → input-group-paIBtI1R.js} +2 -2
- package/dist/chunks/{input-group-YB_zoKud.js.map → input-group-paIBtI1R.js.map} +1 -1
- package/dist/chunks/{list-BPBZR66Y.js → list-Ch6vxaUs.js} +2 -2
- package/dist/chunks/{list-BPBZR66Y.js.map → list-Ch6vxaUs.js.map} +1 -1
- package/dist/chunks/menu-DTe27h5q.js +2 -0
- package/dist/chunks/{menu-Bqlhottl.js.map → menu-DTe27h5q.js.map} +1 -1
- package/dist/chunks/modal-BDQe7xyy.js +2 -0
- package/dist/chunks/modal-BDQe7xyy.js.map +1 -0
- package/dist/chunks/nativeFormReset-DgsRU9SA.js +2 -0
- package/dist/chunks/nativeFormReset-DgsRU9SA.js.map +1 -0
- package/dist/chunks/nav-DDI8Dv28.js +2 -0
- package/dist/chunks/nav-DDI8Dv28.js.map +1 -0
- package/dist/chunks/{nav-overflow-GWARvoQZ.js → nav-overflow-BxAhoMh3.js} +2 -2
- package/dist/chunks/{nav-overflow-GWARvoQZ.js.map → nav-overflow-BxAhoMh3.js.map} +1 -1
- package/dist/chunks/{navOverflow-C_QJmkPM.js → navOverflow-eSROB_mV.js} +2 -2
- package/dist/chunks/{navOverflow-C_QJmkPM.js.map → navOverflow-eSROB_mV.js.map} +1 -1
- package/dist/chunks/{navVariant-D4wiKS8I.js → navVariant-Bm5k8CY3.js} +2 -2
- package/dist/chunks/{navVariant-D4wiKS8I.js.map → navVariant-Bm5k8CY3.js.map} +1 -1
- package/dist/chunks/{navbar-C7dO0YRs.js → navbar-BYMKe2yW.js} +2 -2
- package/dist/chunks/{navbar-C7dO0YRs.js.map → navbar-BYMKe2yW.js.map} +1 -1
- package/dist/chunks/{notification-oIrUtDhl.js → notification-C1Sd4X7M.js} +2 -2
- package/dist/chunks/{notification-oIrUtDhl.js.map → notification-C1Sd4X7M.js.map} +1 -1
- package/dist/chunks/{number-field-ChPTSBwI.js → number-field-BIApgIlR.js} +2 -2
- package/dist/chunks/{number-field-ChPTSBwI.js.map → number-field-BIApgIlR.js.map} +1 -1
- package/dist/chunks/otp-input-CCkfFZID.js +2 -0
- package/dist/chunks/otp-input-CCkfFZID.js.map +1 -0
- package/dist/chunks/overlayPlacement-D2vfhhg3.js +2 -0
- package/dist/chunks/overlayPlacement-D2vfhhg3.js.map +1 -0
- package/dist/chunks/{pagination-Dvz8lccd.js → pagination-WINUPT_P.js} +2 -2
- package/dist/chunks/pagination-WINUPT_P.js.map +1 -0
- package/dist/chunks/placeholder-9rTlnMso.js +2 -0
- package/dist/chunks/{placeholder-SPoVRkKE.js.map → placeholder-9rTlnMso.js.map} +1 -1
- package/dist/chunks/polymorphic-mAKwlLiW.js +2 -0
- package/dist/chunks/{polymorphic-CZIFszAy.js.map → polymorphic-mAKwlLiW.js.map} +1 -1
- package/dist/chunks/popover-CrAJTevL.js +2 -0
- package/dist/chunks/popover-CrAJTevL.js.map +1 -0
- package/dist/chunks/{progress-CiSJDNwx.js → progress-CAqSu3jc.js} +2 -2
- package/dist/chunks/{progress-CiSJDNwx.js.map → progress-CAqSu3jc.js.map} +1 -1
- package/dist/chunks/{radio-C42F_5OD.js → radio-XlINMnQm.js} +2 -2
- package/dist/chunks/{radio-C42F_5OD.js.map → radio-XlINMnQm.js.map} +1 -1
- package/dist/chunks/range-input-tyImJHKI.js +2 -0
- package/dist/chunks/range-input-tyImJHKI.js.map +1 -0
- package/dist/chunks/{renderFormField-_6WswnEX.js → renderFormField-CaZ8-xrn.js} +2 -2
- package/dist/chunks/{renderFormField-_6WswnEX.js.map → renderFormField-CaZ8-xrn.js.map} +1 -1
- package/dist/chunks/{search-field-OFsb3t4L.js → search-field-CIYtMraB.js} +2 -2
- package/dist/chunks/{search-field-OFsb3t4L.js.map → search-field-CIYtMraB.js.map} +1 -1
- package/dist/chunks/select-CkucgA6H.js +2 -0
- package/dist/chunks/select-CkucgA6H.js.map +1 -0
- package/dist/chunks/{skeleton-B2blJGWj.js → skeleton-CXFwCjB9.js} +2 -2
- package/dist/chunks/{skeleton-B2blJGWj.js.map → skeleton-CXFwCjB9.js.map} +1 -1
- package/dist/chunks/slot-DagH0Gxq.js +2 -0
- package/dist/chunks/slot-DagH0Gxq.js.map +1 -0
- package/dist/chunks/{spinner-D8lQCW4u.js → spinner-BLQiCoQd.js} +2 -2
- package/dist/chunks/{spinner-D8lQCW4u.js.map → spinner-BLQiCoQd.js.map} +1 -1
- package/dist/chunks/{stack-DtzW54UK.js → stack-OItr30SC.js} +2 -2
- package/dist/chunks/{stack-DtzW54UK.js.map → stack-OItr30SC.js.map} +1 -1
- package/dist/chunks/{stepper-tSA84huJ.js → stepper-BLjW7UnC.js} +2 -2
- package/dist/chunks/{stepper-tSA84huJ.js.map → stepper-BLjW7UnC.js.map} +1 -1
- package/dist/chunks/switch-nt7aXQDX.js +2 -0
- package/dist/chunks/switch-nt7aXQDX.js.map +1 -0
- package/dist/chunks/table-KtPHx4FG.js +2 -0
- package/dist/chunks/table-KtPHx4FG.js.map +1 -0
- package/dist/chunks/{tabs-DMFSLjnV.js → tabs-Dh5kH5Ik.js} +2 -2
- package/dist/chunks/{tabs-DMFSLjnV.js.map → tabs-Dh5kH5Ik.js.map} +1 -1
- package/dist/chunks/{text-input-CR73x-8D.js → text-input-D3jBYiLn.js} +2 -2
- package/dist/chunks/{text-input-CR73x-8D.js.map → text-input-D3jBYiLn.js.map} +1 -1
- package/dist/chunks/{textarea-C-1cMyH4.js → textarea-2BJCzT97.js} +2 -2
- package/dist/chunks/{textarea-C-1cMyH4.js.map → textarea-2BJCzT97.js.map} +1 -1
- package/dist/chunks/{time-field-CbCfOQZz.js → time-field-ClPbatW3.js} +2 -2
- package/dist/chunks/{time-field-CbCfOQZz.js.map → time-field-ClPbatW3.js.map} +1 -1
- package/dist/chunks/toast-D5-58Ch1.js +2 -0
- package/dist/chunks/toast-D5-58Ch1.js.map +1 -0
- package/dist/chunks/tooltip-TGFFlOJL.js +2 -0
- package/dist/chunks/tooltip-TGFFlOJL.js.map +1 -0
- package/dist/chunks/tree-BO0WSxQa.js +2 -0
- package/dist/chunks/tree-BO0WSxQa.js.map +1 -0
- package/dist/chunks/useButtonSemantics-DN3OIXtG.js +2 -0
- package/dist/chunks/useButtonSemantics-DN3OIXtG.js.map +1 -0
- package/dist/chunks/{useDialogElement-BfygWBPZ.js → useDialogElement-yEgUSejP.js} +2 -2
- package/dist/chunks/useDialogElement-yEgUSejP.js.map +1 -0
- package/dist/chunks/{useFormField-DH2tlc3e.js → useFormField-q21MOgh8.js} +2 -2
- package/dist/chunks/{useFormField-DH2tlc3e.js.map → useFormField-q21MOgh8.js.map} +1 -1
- package/dist/chunks/useFormReset-BK5Yb24_.js +2 -0
- package/dist/chunks/useFormReset-BK5Yb24_.js.map +1 -0
- package/dist/chunks/useHeldBack-o-CsPcSe.js +2 -0
- package/dist/chunks/useHeldBack-o-CsPcSe.js.map +1 -0
- package/dist/chunks/{useOpenStateProps-BhjSQ3f6.js → useOpenStateProps-CdSO1nmI.js} +2 -2
- package/dist/chunks/{useOpenStateProps-BhjSQ3f6.js.map → useOpenStateProps-CdSO1nmI.js.map} +1 -1
- package/dist/chunks/useOverlayMaxHeight-5UnurH0W.js +2 -0
- package/dist/chunks/useOverlayMaxHeight-5UnurH0W.js.map +1 -0
- package/dist/chunks/{useRequiredValueInput-gYN8I-LY.js → useRequiredValueInput-CL7AIgqz.js} +2 -2
- package/dist/chunks/{useRequiredValueInput-gYN8I-LY.js.map → useRequiredValueInput-CL7AIgqz.js.map} +1 -1
- package/dist/chunks/useSelectionForMode-B_oTWvEy.js +2 -0
- package/dist/chunks/useSelectionForMode-B_oTWvEy.js.map +1 -0
- package/dist/chunks/useToastRegionQueue-QHa4v7k6.js +2 -0
- package/dist/chunks/useToastRegionQueue-QHa4v7k6.js.map +1 -0
- package/dist/chunks/useTransitionState-WEw9C0yn.js +2 -0
- package/dist/chunks/useTransitionState-WEw9C0yn.js.map +1 -0
- package/dist/chunks/{visibleState-CWyQak65.js → visibleState-DVyxSMUT.js} +2 -2
- package/dist/chunks/{visibleState-CWyQak65.js.map → visibleState-DVyxSMUT.js.map} +1 -1
- package/dist/close-button.js +1 -1
- package/dist/collapse.js +1 -1
- package/dist/color-input.d.ts +1 -1
- package/dist/color-input.js +1 -1
- package/dist/combobox.js +1 -1
- package/dist/context-menu.js +1 -1
- package/dist/datagrid.d.ts +1 -1
- package/dist/datagrid.js +1 -1
- package/dist/datepicker.js +1 -1
- package/dist/divider.js +1 -1
- package/dist/drawer.d.ts +1 -1
- package/dist/drawer.js +1 -1
- package/dist/file-input.d.ts +1 -1
- package/dist/file-input.js +1 -1
- package/dist/flex.js +1 -1
- package/dist/floating-input.d.ts +1 -1
- package/dist/floating-input.js +1 -1
- package/dist/form-field.js +1 -1
- package/dist/form.js +1 -1
- package/dist/grid.js +1 -1
- package/dist/index.d.ts +19 -19
- package/dist/index.js +1 -1
- package/dist/input-adorn.js +1 -1
- package/dist/input-group.js +1 -1
- package/dist/link.js +1 -1
- package/dist/list.js +1 -1
- package/dist/menu.js +1 -1
- package/dist/modal.d.ts +1 -1
- package/dist/modal.js +1 -1
- package/dist/nav-overflow.js +1 -1
- package/dist/nav.d.ts +1 -1
- package/dist/nav.js +1 -1
- package/dist/navbar.js +1 -1
- package/dist/notification.js +1 -1
- package/dist/number-field.js +1 -1
- package/dist/otp-input.d.ts +1 -1
- package/dist/otp-input.js +1 -1
- package/dist/pagination.d.ts +1 -1
- package/dist/pagination.js +1 -1
- package/dist/placeholder.js +1 -1
- package/dist/popover.js +1 -1
- package/dist/progress.js +1 -1
- package/dist/radio.d.ts +1 -1
- package/dist/radio.js +1 -1
- package/dist/range-input.d.ts +1 -1
- package/dist/range-input.js +1 -1
- package/dist/search-field.js +1 -1
- package/dist/select.d.ts +1 -1
- package/dist/select.js +1 -1
- package/dist/skeleton.js +1 -1
- package/dist/spinner.js +1 -1
- package/dist/stack.js +1 -1
- package/dist/stepper.js +1 -1
- package/dist/style.css +1 -1
- package/dist/switch.d.ts +1 -1
- package/dist/switch.js +1 -1
- package/dist/table.d.ts +1 -1
- package/dist/table.js +1 -1
- package/dist/tabs.js +1 -1
- package/dist/text-input.js +1 -1
- package/dist/textarea.js +1 -1
- package/dist/time-field.js +1 -1
- package/dist/toast.d.ts +1 -1
- package/dist/toast.js +1 -1
- package/dist/tooltip.js +1 -1
- package/dist/tree.js +1 -1
- package/dist/visually-hidden.js +1 -1
- package/package.json +11 -11
- package/dist/chunks/Button-ZU-x1uN_.js +0 -2
- package/dist/chunks/Button-ZU-x1uN_.js.map +0 -1
- package/dist/chunks/CloseButton-BPUI5iGX.js +0 -2
- package/dist/chunks/CloseButton-BPUI5iGX.js.map +0 -1
- package/dist/chunks/Link-DE8NSAXJ.js +0 -2
- package/dist/chunks/Link-DE8NSAXJ.js.map +0 -1
- package/dist/chunks/Menu-BiE9CzNk.js +0 -2
- package/dist/chunks/Menu-BiE9CzNk.js.map +0 -1
- package/dist/chunks/MenuToggle-W-ZSHFwF.js +0 -2
- package/dist/chunks/MenuToggle-W-ZSHFwF.js.map +0 -1
- package/dist/chunks/alert-DSLg5MBb.js +0 -2
- package/dist/chunks/autocomplete-Btcsjrh3.js +0 -2
- package/dist/chunks/autocomplete-Btcsjrh3.js.map +0 -1
- package/dist/chunks/carousel-DC-UGc6W.js +0 -2
- package/dist/chunks/carousel-DC-UGc6W.js.map +0 -1
- package/dist/chunks/checkbox-ko6CdtoT.js +0 -2
- package/dist/chunks/checkbox-ko6CdtoT.js.map +0 -1
- package/dist/chunks/chip-input-CugY8EOc.js +0 -2
- package/dist/chunks/chip-input-CugY8EOc.js.map +0 -1
- package/dist/chunks/color-input-C4zMWlvm.js +0 -2
- package/dist/chunks/color-input-C4zMWlvm.js.map +0 -1
- package/dist/chunks/combobox-DNqR4d3V.js +0 -2
- package/dist/chunks/context-menu-D3DNFN-P.js +0 -2
- package/dist/chunks/context-menu-D3DNFN-P.js.map +0 -1
- package/dist/chunks/datagrid-n9vFeXN1.js +0 -2
- package/dist/chunks/datagrid-n9vFeXN1.js.map +0 -1
- package/dist/chunks/datepicker-DqztYJD6.js +0 -2
- package/dist/chunks/datepicker-DqztYJD6.js.map +0 -1
- package/dist/chunks/drawer-CRv9jmbp.js +0 -2
- package/dist/chunks/drawer-CRv9jmbp.js.map +0 -1
- package/dist/chunks/file-input-D_Gl1h-T.js +0 -2
- package/dist/chunks/file-input-D_Gl1h-T.js.map +0 -1
- package/dist/chunks/floating-input-D4gWFfOU.js +0 -2
- package/dist/chunks/floating-input-D4gWFfOU.js.map +0 -1
- package/dist/chunks/grid-CkdPftit.js +0 -2
- package/dist/chunks/grid-CkdPftit.js.map +0 -1
- package/dist/chunks/menu-Bqlhottl.js +0 -2
- package/dist/chunks/modal-CHvsDTyl.js +0 -2
- package/dist/chunks/modal-CHvsDTyl.js.map +0 -1
- package/dist/chunks/nav-B4U_Hqs7.js +0 -2
- package/dist/chunks/nav-B4U_Hqs7.js.map +0 -1
- package/dist/chunks/otp-input-DUtCMg8P.js +0 -2
- package/dist/chunks/otp-input-DUtCMg8P.js.map +0 -1
- package/dist/chunks/overlayPlacement-Q6bcbXA5.js +0 -2
- package/dist/chunks/overlayPlacement-Q6bcbXA5.js.map +0 -1
- package/dist/chunks/pagination-Dvz8lccd.js.map +0 -1
- package/dist/chunks/placeholder-SPoVRkKE.js +0 -2
- package/dist/chunks/polymorphic-CZIFszAy.js +0 -2
- package/dist/chunks/popover-C_32yD9W.js +0 -2
- package/dist/chunks/popover-C_32yD9W.js.map +0 -1
- package/dist/chunks/range-input-DeZq_9S7.js +0 -2
- package/dist/chunks/range-input-DeZq_9S7.js.map +0 -1
- package/dist/chunks/select-DwyL6aqY.js +0 -2
- package/dist/chunks/select-DwyL6aqY.js.map +0 -1
- package/dist/chunks/slot-BQVx1Eew.js +0 -2
- package/dist/chunks/slot-BQVx1Eew.js.map +0 -1
- package/dist/chunks/switch-cp3IZg3L.js +0 -2
- package/dist/chunks/switch-cp3IZg3L.js.map +0 -1
- package/dist/chunks/table-CBTg5Yuq.js +0 -2
- package/dist/chunks/table-CBTg5Yuq.js.map +0 -1
- package/dist/chunks/toast-Dd0J2e1z.js +0 -2
- package/dist/chunks/toast-Dd0J2e1z.js.map +0 -1
- package/dist/chunks/tooltip-CmKeQwYw.js +0 -2
- package/dist/chunks/tooltip-CmKeQwYw.js.map +0 -1
- package/dist/chunks/tree-DNj_EfUl.js +0 -2
- package/dist/chunks/tree-DNj_EfUl.js.map +0 -1
- package/dist/chunks/useButtonSemantics-B1SbGaDO.js +0 -2
- package/dist/chunks/useButtonSemantics-B1SbGaDO.js.map +0 -1
- package/dist/chunks/useDialogElement-BfygWBPZ.js.map +0 -1
- package/dist/chunks/useDialogTitle-DiB4YDGI.js +0 -2
- package/dist/chunks/useDialogTitle-DiB4YDGI.js.map +0 -1
- package/dist/chunks/useFloatingOverlay-BuiI_CCn.js +0 -2
- package/dist/chunks/useFloatingOverlay-BuiI_CCn.js.map +0 -1
- package/dist/chunks/useHeldBack-eeTfpa_t.js +0 -2
- package/dist/chunks/useHeldBack-eeTfpa_t.js.map +0 -1
- package/dist/chunks/useOverlayMaxHeight-DTgbr4UQ.js +0 -2
- package/dist/chunks/useOverlayMaxHeight-DTgbr4UQ.js.map +0 -1
- package/dist/chunks/useToastRegionQueue-CuAMxAIA.js +0 -2
- package/dist/chunks/useToastRegionQueue-CuAMxAIA.js.map +0 -1
- package/dist/chunks/useTransitionState-sQUQey74.js +0 -2
- package/dist/chunks/useTransitionState-sQUQey74.js.map +0 -1
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"switch-cp3IZg3L.js","names":["useForkedRef","FormLabel","validationClassName","TOGGLE_PROPS","mergeUnhandledProps","React","classNames","renderSwitch","label","className","checkInputClassName","input","bareClassName","renderSwitchInput","inputClassName","invalid","valid","color","_className","size","inputProps","forkedRef","SwitchCheckbox","forwardRef","invalidProp","validProp","rest","inputRef","useRef","ref","useHeldBack","resolvedLabel","children","toggleState","useToggleState","disabled","switchProps","useSwitch","SwitchRadio","radioProps","isSelected","defaultSelected","onChange","event","Switch","type"],"sources":["../../src/components/switch/Switch.tsx"],"sourcesContent":["import React, { CSSProperties, forwardRef, InputHTMLAttributes, ReactNode, useRef } from 'react'\nimport classNames from 'classnames'\nimport { AriaSwitchProps, useSwitch } from 'react-aria'\nimport { useToggleState } from 'react-stately'\n\nimport { useForkedRef, useHeldBack } from '../../hooks'\nimport { ContextColor } from '../../types'\nimport { mergeUnhandledProps, TOGGLE_PROPS } from '../../utils/unhandledProps'\nimport { validationClassName } from '../../utils/validationClassName'\n\nimport { FormLabel } from '../form/FormLabel'\n\nexport interface SwitchProps extends Omit<\n InputHTMLAttributes<HTMLInputElement>,\n 'checked' | 'defaultChecked' | 'onChange' | 'size'\n> {\n /**\n * A string of all className you want applied to the component.\n */\n className?: string\n /**\n * Sets the color of the switch indicator to one of Chassis context colors.\n */\n color?: ContextColor\n /**\n * Whether the switch is selected, uncontrolled.\n */\n defaultSelected?: boolean\n /**\n * The id global attribute defines an identifier (ID) that must be unique in the whole document.\n */\n id?: string\n /**\n * Set component validation state to invalid. Left unset, the component shows as invalid by itself\n * from a submit it held back (an empty `required` one, say) until it no longer would, or its\n * form is reset. Set it, to `false` too, and it alone decides.\n */\n invalid?: boolean\n /**\n * Whether the switch is selected, controlled.\n */\n isSelected?: boolean\n /**\n * The element represents a caption for a component.\n *\n * Children are accepted as an alias for this prop — `label` wins when both are given.\n * react-aria, which backs this component, calls the same thing `children`; this package renames\n * it to `label`, and honouring both means the shape React developers reach for first still\n * names the control instead of silently producing an unlabelled one.\n */\n label?: ReactNode\n /**\n * Callback fired when the selected state changes.\n */\n onChange?: (isSelected: boolean) => void\n /**\n * Size the component sm or lg.\n */\n size?: 'sm' | 'lg'\n /**\n * Specifies the type of component.\n */\n type?: 'checkbox' | 'radio'\n /**\n * Set component validation state to valid.\n */\n valid?: boolean\n}\n\ntype SwitchVariantProps = Omit<SwitchProps, 'type'>\n\ninterface RenderSwitchOptions {\n bareClassName: string\n checkInputClassName: string\n className: string\n input: ReactNode\n label?: ReactNode\n style?: CSSProperties\n}\n\n// Mirrors renderFormCheck's nested-label/bare-span shape — Switch inlines its own markup (see\n// FORMS.md) rather than sharing that helper directly, since `role=\"switch\"` placement didn't fit\n// it cleanly. Keep this in sync with renderFormCheck by eye if either changes.\nconst renderSwitch = ({\n bareClassName,\n checkInputClassName,\n className,\n input,\n label,\n style\n}: RenderSwitchOptions) => {\n if (!label) {\n return (\n <span className={bareClassName} style={style}>\n {input}\n </span>\n )\n }\n return (\n <FormLabel customClassName={className} style={style}>\n <span className={checkInputClassName}>{input}</span>\n {label}\n </FormLabel>\n )\n}\n\ninterface RenderSwitchInputOptions {\n className?: string\n color?: ContextColor\n forkedRef: React.Ref<HTMLInputElement>\n id?: string\n inputProps: InputHTMLAttributes<HTMLInputElement>\n invalid?: boolean\n label?: ReactNode\n size?: 'sm' | 'lg'\n style?: CSSProperties\n valid?: boolean\n}\n\n// Shared className-building/markup for `SwitchCheckbox`/`SwitchRadio` — the two variants only\n// differ in how `inputProps` gets built (a react-aria hook vs. a hand-wired radio), everything\n// after that is identical. `style` goes on the outermost element, as `className` does: the\n// label, or the `.check-input` when there is no label.\nconst renderSwitchInput = ({\n className,\n color,\n forkedRef,\n id,\n inputProps,\n invalid,\n label,\n size,\n style,\n valid\n}: RenderSwitchInputOptions) => {\n const inputClassName = classNames(validationClassName(invalid, valid))\n const checkInputClassName = classNames('check-input', color, validationClassName(invalid, valid))\n const _className = classNames(\n 'form-check form-switch',\n size,\n validationClassName(invalid, valid),\n className\n )\n\n return renderSwitch({\n // With no label the `.check-input` is the outermost element, and takes the caller's\n // `className` as it takes `style`.\n bareClassName: classNames(checkInputClassName, className),\n checkInputClassName,\n className: _className,\n input: <input {...inputProps} className={inputClassName} id={id} ref={forkedRef} />,\n label,\n style\n })\n}\n\n// Checkbox-backed switch: a real toggle, so it goes through react-aria's useSwitch/useToggleState\n// like Checkbox does. Split into its own component (rather than branching inside one Switch on\n// `type`) so SwitchRadio below never has to call these hooks just to discard their result —\n// calling them unconditionally and ignoring the output risked react-aria's own dev-mode warnings\n// (e.g. its missing-accessible-name check) firing for state that was never actually rendered.\nconst SwitchCheckbox = forwardRef<HTMLInputElement, SwitchVariantProps>(\n (\n {\n className,\n children,\n color,\n defaultSelected,\n disabled,\n id,\n invalid: invalidProp,\n isSelected,\n label,\n onChange,\n size,\n style,\n valid: validProp,\n ...rest\n },\n ref\n ) => {\n const inputRef = useRef<HTMLInputElement>(null)\n const forkedRef = useForkedRef(ref, inputRef)\n // Shown as invalid from a submit it held back until it no longer would (`useHeldBack`):\n // react-aria cancels the browser's own message, and the form stayed with nothing to say why.\n const { invalid, valid } = useHeldBack(inputRef, { invalid: invalidProp, valid: validProp })\n // `label` is this package's name for what react-aria calls `children`. Accept either, so the\n // shape React developers reach for first names the control instead of vanishing.\n const resolvedLabel = label ?? children\n\n const toggleState = useToggleState({\n defaultSelected,\n isDisabled: disabled,\n isSelected,\n onChange\n })\n\n const { inputProps: switchProps } = useSwitch(\n {\n ...rest,\n children: resolvedLabel,\n isDisabled: disabled,\n isInvalid: invalid,\n value: rest.value as string | undefined\n } as AriaSwitchProps,\n toggleState,\n inputRef\n )\n\n return renderSwitchInput({\n className,\n color,\n forkedRef,\n id,\n // `aria-describedby` over react-aria's own, which adds ids it never renders (FORMS.md,\n // gotcha 6).\n inputProps: {\n ...mergeUnhandledProps(switchProps, rest, TOGGLE_PROPS),\n 'aria-describedby': rest['aria-describedby']\n },\n invalid,\n label: resolvedLabel,\n size,\n style,\n valid\n })\n }\n)\nSwitchCheckbox.displayName = 'SwitchCheckbox'\n\n// Radio-backed switch: react-aria has no ungrouped radio hook (see Checkbox's own split for the\n// same reason), so this stays a native, hand-wired `<input type=\"radio\" role=\"switch\">` — no\n// react-aria hook to call here at all.\nconst SwitchRadio = forwardRef<HTMLInputElement, SwitchVariantProps>(\n (\n {\n children,\n className,\n color,\n defaultSelected,\n disabled,\n id,\n invalid: invalidProp,\n isSelected,\n label,\n onChange,\n size,\n style,\n valid: validProp,\n ...rest\n },\n ref\n ) => {\n const inputRef = useRef<HTMLInputElement>(null)\n const forkedRef = useForkedRef(ref, inputRef)\n // Shown as invalid from a submit it held back until it no longer would (`useHeldBack`). The\n // browser's own message stays: no react-aria hook is given this control to cancel it. It is\n // on the first invalid control of the form alone, and gone at the next click.\n const { invalid, valid } = useHeldBack(inputRef, { invalid: invalidProp, valid: validProp })\n // `label` is this package's name for what react-aria calls `children`. Accept either, so the\n // shape React developers reach for first names the control instead of vanishing.\n const resolvedLabel = label ?? children\n\n const radioProps = {\n ...rest,\n 'aria-invalid': invalid || undefined,\n checked: isSelected,\n defaultChecked: defaultSelected,\n disabled,\n // Always a handler: React takes a `checked` input with none for a mistake and warns.\n onChange: (event: React.ChangeEvent<HTMLInputElement>) => onChange?.(event.target.checked),\n role: 'switch' as const,\n type: 'radio' as const\n }\n\n return renderSwitchInput({\n className,\n color,\n forkedRef,\n id,\n inputProps: radioProps,\n invalid,\n label: resolvedLabel,\n size,\n style,\n valid\n })\n }\n)\nSwitchRadio.displayName = 'SwitchRadio'\n\nexport const Switch = forwardRef<HTMLInputElement, SwitchProps>(\n ({ type = 'checkbox', ...rest }, ref) =>\n type === 'radio' ? <SwitchRadio {...rest} ref={ref} /> : <SwitchCheckbox {...rest} ref={ref} />\n)\n\nSwitch.displayName = 'Switch'\n"],"mappings":"A,qbAmFA,MAAMO,GAAgB,CACpB,gBACA,sBACA,YACA,QACA,QACA,WAEKC,EAQH,kBAAA,cAACP,EAAD,CAAW,gBAAiBQ,EAAkB,OAGnC,EAFT,kBAAA,cAAC,OAAD,CAAM,UAAWC,CAAkC,EAAZC,CAAY,EAClDH,CACQ,EATT,kBAAA,cAAC,OAAD,CAAM,UAAWI,EAAsB,OAEjC,EADHD,CACG,EA4BNE,GAAqB,CACzB,YACA,QACA,YACA,KACA,aACA,UACA,QACA,OACA,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AI,EACxCP,EAAYrB,EAAa6B,EAAKF,CAAQ,EAItC,CAAE,UAAS,SAAUG,EAAYH,EAAU,CAAE,QAASH,EAAa,MAAOC,CAAU,CAAC,EAGrFM,EAAgBvB,GAASwB,EAEzBO,EAAa,CACjB,GAAGb,EACH,eAAgBX,GAAW,IAAA,GAC3B,QAASyB,EACT,eAAgBC,EAChB,WAEA,SAAW,GAA+CC,IAAWC,EAAM,OAAO,OAAO,EACzF,KAAM,SACN,KAAM,OACR,EAEA,OAAO9B,EAAkB,CACvB,YACA,QACA,YACA,KACA,WAAY0B,EACZ,UACA,MAAOR,EACP,OACA,QACA,OACF,CAAC,CACH,CACF,EACA,EAAY,YAAc,cAE1B,MAAaa,EAASrB,GACnB,CAAE,OAAO,WAAY,GAAGG,GAAQ,IAC/BmB,IAAS,QAAU,kBAAA,cAACP,EAAD,CAAa,GAAIZ,EAAW,KAAM,CAAA,EAAI,kBAAA,cAACJ,EAAD,CAAgB,GAAII,EAAW,KAAM,CAAA,CAClG,EAEA,EAAO,YAAc,S"}
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import"./focus-ring-Bs80iIBN.js";import{t as e}from"./useForkedRef-WoqMqsWE.js";import{n as t,r as n}from"./tableClassName-jRfRDXA3.js";import r,{forwardRef as i,useRef as a}from"react";import o from"classnames";import{useCheckbox as s,useTable as c,useTableCell as l,useTableColumnHeader as u,useTableHeaderRow as d,useTableRow as f,useTableRowGroup as p,useTableSelectAllCheckbox as m,useTableSelectionCheckbox as h}from"react-aria";import{Cell as g,Column as _,Row as v,TableBody as y,TableHeader as b,useTableState as x,useToggleState as S}from"react-stately";const C=i(({align:i,bordered:o,borderless:s,caption:l,children:u,className:d,color:f,disabledKeys:p,footer:m,hover:h,id:g,onSelectionChange:_,onSortChange:v,responsive:y,selectedKeys:b,selectionMode:S=`none`,sm:C,sortDescriptor:j,stacked:M,striped:N,...P},F)=>{let I=x({children:u,disabledKeys:p,onSelectionChange:_,onSortChange:v,selectedKeys:b,selectionMode:S,showSelectionCheckboxes:S===`multiple`,sortDescriptor:j}),L=a(null),R=e(L,F),{gridProps:z}=c({"aria-label":P[`aria-label`],"aria-labelledby":P[`aria-labelledby`],id:g},I,L),B=t({align:i,bordered:o,borderless:s,className:d,color:f,hover:h,sm:C,stacked:M,striped:N}),V=/* @__PURE__ */ r.createElement(`table`,{...z,"aria-describedby":z[`aria-describedby`]||void 0,className:B,ref:R},l&&/* @__PURE__ */ r.createElement(`caption`,null,l),/* @__PURE__ */ r.createElement(w,{className:u[0].props.className,type:`thead`},I.collection.headerRows.map(e=>/* @__PURE__ */ r.createElement(T,{key:e.key,item:e,state:I},[...I.collection.getChildren?.(e.key)??[]].map(e=>e.props?.isSelectionCell?/* @__PURE__ */ r.createElement(D,{key:e.key,column:e,state:I}):/* @__PURE__ */ r.createElement(E,{key:e.key,column:e,state:I}))))),/* @__PURE__ */ r.createElement(w,{className:u[1].props.className,type:`tbody`},[...I.collection.body.childNodes].map(e=>/* @__PURE__ */ r.createElement(O,{key:e.key,item:e,state:I},[...I.collection.getChildren?.(e.key)??[]].map(e=>e.props?.isSelectionCell?/* @__PURE__ */ r.createElement(A,{key:e.key,cell:e,state:I}):/* @__PURE__ */ r.createElement(k,{key:e.key,cell:e,stacked:!!M,state:I}))))),m&&/* @__PURE__ */ r.createElement(`tfoot`,null,m)),H=n({responsive:y,stacked:M});return H?/* @__PURE__ */ r.createElement(`div`,{className:H},V):V});C.displayName=`Table`;const w=({className:e,type:t,children:n})=>{let{rowGroupProps:i}=p();return/* @__PURE__ */ r.createElement(t,{...i,className:e||void 0},n)},T=({children:e,item:t,state:n})=>{let i=a(null),{rowProps:o}=d({node:t},n,i);return/* @__PURE__ */ r.createElement(`tr`,{...o,ref:i},e)},E=({column:e,state:t})=>{let n=a(null),{columnHeaderProps:i}=u({node:e},t,n),o=t.sortDescriptor?.column===e.key,s=t.sortDescriptor?.direction===`ascending`?`▲`:`▼`;return/* @__PURE__ */ r.createElement(`th`,{...i,className:e.props?.className||void 0,colSpan:e.colSpan??void 0,scope:`col`,ref:n},e.rendered,e.props?.allowsSorting&&/* @__PURE__ */ r.createElement(`span`,{"aria-hidden":`true`,className:`table-sort-icon`},o?s:`⇅`))},D=({column:e,state:t})=>{let n=a(null),{columnHeaderProps:i}=u({node:e},t,n),{checkboxProps:o}=m(t);return/* @__PURE__ */ r.createElement(`th`,{...i,className:`table-selection-cell`,scope:`col`,suppressHydrationWarning:!0,ref:n},/* @__PURE__ */ r.createElement(j,{checkboxProps:o}))},O=({children:e,item:t,state:n})=>{let i=a(null),{rowProps:s}=f({node:t},n,i),c=n.selectionManager.isSelected(t.key);return/* @__PURE__ */ r.createElement(`tr`,{...s,className:o({active:c},t.props?.className),ref:i},e)},k=({cell:e,stacked:t,state:n})=>{let i=a(null),{gridCellProps:o}=l({node:e},n,i);return/* @__PURE__ */ r.createElement(`td`,{...o,className:e.props?.className||void 0,"data-cell":t&&e.column?.textValue||void 0,ref:i},e.rendered)},A=({cell:e,state:t})=>{let n=a(null),{gridCellProps:i}=l({node:e},t,n),{checkboxProps:o}=h({key:e.parentKey},t);return/* @__PURE__ */ r.createElement(`td`,{...i,className:`table-selection-cell`,suppressHydrationWarning:!0,ref:n},/* @__PURE__ */ r.createElement(j,{checkboxProps:o}))},j=({checkboxProps:e})=>{let t=S(e),n=a(null),{inputProps:i}=s(e,t,n);return/* @__PURE__ */ r.createElement(`input`,{...i,"aria-describedby":void 0,className:`check-input`,ref:n})},M=y,N=g,P=_,F=b,I=v;export{M as a,N as i,F as n,C as o,P as r,I as t};
|
|
2
|
-
//# sourceMappingURL=table-CBTg5Yuq.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"table-CBTg5Yuq.js","names":["TableRow","TableCell","TableBody","StatelyTableBody","TableHeader","StatelyTableHeader","useForkedRef","tableClassName","tableWrapperClassName","React","classNames","Table","forwardRef","rest","state","useTableState","selectionMode","internalRef","useRef","ref","forwardedRef","useTable","_className","tableEl","gridProps","caption","TableRowGroup","children","TableHeaderRow","headerRow","column","TableSelectAllCell","TableColumnHeader","TableRow$1","row","cell","TableSelectionCell","TableCell$1","stacked","footer","wrapperClassName","Element","useTableRowGroup","rowGroupProps","className","useTableHeaderRow","item","rowProps","useTableColumnHeader","sortActive","sortIcon","columnHeaderProps","useTableSelectAllCheckbox","TableCheckbox","useTableRow","isSelected","useTableCell","gridCellProps","useTableSelectionCheckbox","toggleState","useToggleState","checkboxProps","useCheckbox","inputProps","TableBody$1","TableBody","TableCell","Cell","TableColumn","Column","TableHeader$1","TableHeader","TableRow","Row"],"sources":["../../src/components/table/Table.tsx","../../src/components/table/TableBody.tsx","../../src/components/table/TableCell.tsx","../../src/components/table/TableColumn.tsx","../../src/components/table/TableHeader.tsx","../../src/components/table/TableRow.tsx"],"sourcesContent":["import React, { ReactElement, ReactNode, Ref, forwardRef, useRef } from 'react'\nimport classNames from 'classnames'\nimport {\n AriaCheckboxProps,\n Key,\n useCheckbox,\n useTable,\n useTableCell,\n useTableColumnHeader,\n useTableHeaderRow,\n useTableRow,\n useTableRowGroup,\n useTableSelectAllCheckbox,\n useTableSelectionCheckbox\n} from 'react-aria'\nimport {\n Selection,\n SortDescriptor,\n TableBodyProps,\n TableHeaderProps,\n TableState,\n useTableState,\n useToggleState\n} from 'react-stately'\n\nimport { useForkedRef } from '../../hooks/useForkedRef'\nimport { ContextColor } from '../../types'\nimport { tableClassName, tableWrapperClassName } from '../../utils/tableClassName'\nimport './Table.css'\n\n// `GridNode<T>` (from `@react-types/shared`) isn't re-exported by either package's public\n// surface — derived from the hooks' own parameter types instead of adding an undeclared\n// dependency on react-aria/react-stately's shared internals package.\ntype ColumnNode<T> = Parameters<typeof useTableColumnHeader<T>>[0]['node']\ntype RowNode<T> = Parameters<typeof useTableRow<T>>[0]['node']\ntype CellNode<T> = Parameters<typeof useTableCell<T>>[0]['node']\n\nexport interface TableProps<T extends object> {\n /**\n * An accessible label for the table, used when there's no visible heading.\n */\n 'aria-label'?: string\n /**\n * Identifies a visible heading element for the table.\n */\n 'aria-labelledby'?: string\n /**\n * Set the vertical alignment of cell content.\n */\n align?: 'bottom' | 'middle' | 'top'\n /**\n * Add borders on all sides of the table and cells.\n */\n bordered?: boolean\n /**\n * Remove borders on all sides of the table and cells.\n */\n borderless?: boolean\n /**\n * Content shown above the table, functioning as a heading for it.\n */\n caption?: ReactNode\n /**\n * A `TableHeader` and a `TableBody`, each built from `TableColumn`/`TableRow`/\n * `TableCell` — read as data to build the table's collection. Not rendered directly.\n */\n children: [\n ReactElement<TableHeaderProps<T> & { className?: string }>,\n ReactElement<TableBodyProps<T> & { className?: string }>\n ]\n /**\n * A string of all className you want applied to the component.\n */\n className?: string\n /**\n * Sets the color of the component.\n */\n color?: ContextColor\n /**\n * A list of row keys to disable. Disabled rows cannot be selected, focused, or interacted with.\n */\n disabledKeys?: Iterable<Key>\n /**\n * Content shown below the table in a `<tfoot>`, e.g. a totals row. Rendered as plain markup —\n * not part of the keyboard-navigable grid.\n */\n footer?: ReactNode\n /**\n * Enable a hover state on table rows.\n */\n hover?: boolean\n /**\n * `id` forwarded to the table element.\n */\n id?: string\n /**\n * Handler that is called when the selection changes.\n */\n onSelectionChange?: (keys: Selection) => void\n /**\n * Handler that is called when a column is sorted.\n */\n onSortChange?: (descriptor: SortDescriptor) => void\n /**\n * Make any table responsive across all viewports or pick a maximum breakpoint.\n */\n responsive?: boolean | 'sm' | 'md' | 'lg' | 'xl' | '2xl'\n /**\n * The currently selected row keys (controlled).\n */\n selectedKeys?: Selection\n /**\n * The type of selection that is allowed.\n */\n selectionMode?: 'none' | 'single' | 'multiple'\n /**\n * Make table more compact by cutting all cell padding.\n */\n sm?: boolean\n /**\n * The current sort column and direction.\n */\n sortDescriptor?: SortDescriptor\n /**\n * Convert rows into stacked label/value blocks below a container width, for tables with too\n * many columns to read comfortably even with horizontal scrolling. `true` always stacks; a\n * breakpoint name stacks only below it. Implies `responsive` when `responsive` isn't set\n * separately, since stacking needs the same `.table-responsive` container-query ancestor.\n * Labels come from each `TableColumn`'s text (or its `textValue`, for non-text headers).\n */\n stacked?: boolean | 'sm' | 'md' | 'lg' | 'xl' | '2xl'\n /**\n * Add zebra-striping to table rows.\n */\n striped?: boolean\n}\n\nconst TableInner = <T extends object>(\n {\n align,\n bordered,\n borderless,\n caption,\n children,\n className,\n color,\n disabledKeys,\n footer,\n hover,\n id,\n onSelectionChange,\n onSortChange,\n responsive,\n selectedKeys,\n selectionMode = 'none',\n sm,\n sortDescriptor,\n stacked,\n striped,\n ...rest\n }: TableProps<T>,\n forwardedRef: Ref<HTMLTableElement>\n) => {\n const state = useTableState<T>({\n children,\n disabledKeys,\n onSelectionChange,\n onSortChange,\n selectedKeys,\n selectionMode,\n showSelectionCheckboxes: selectionMode === 'multiple',\n sortDescriptor\n })\n\n const internalRef = useRef<HTMLTableElement>(null)\n const ref = useForkedRef(internalRef, forwardedRef)\n const { gridProps } = useTable(\n { 'aria-label': rest['aria-label'], 'aria-labelledby': rest['aria-labelledby'], id },\n state,\n internalRef\n )\n\n const _className = tableClassName({\n align,\n bordered,\n borderless,\n className,\n color,\n hover,\n sm,\n stacked,\n striped\n })\n\n const tableEl = (\n // react-aria joins the table's descriptions without dropping an empty result, so a table\n // with none had `aria-describedby=\"\"`.\n <table\n {...gridProps}\n aria-describedby={gridProps['aria-describedby'] || undefined}\n className={_className}\n ref={ref}\n >\n {caption && <caption>{caption}</caption>}\n <TableRowGroup className={children[0].props.className} type=\"thead\">\n {state.collection.headerRows.map((headerRow) => (\n <TableHeaderRow key={headerRow.key} item={headerRow} state={state}>\n {[...(state.collection.getChildren?.(headerRow.key) ?? [])].map((column) =>\n column.props?.isSelectionCell ? (\n <TableSelectAllCell key={column.key} column={column} state={state} />\n ) : (\n <TableColumnHeader key={column.key} column={column} state={state} />\n )\n )}\n </TableHeaderRow>\n ))}\n </TableRowGroup>\n <TableRowGroup className={children[1].props.className} type=\"tbody\">\n {[...state.collection.body.childNodes].map((row) => (\n <TableRow key={row.key} item={row} state={state}>\n {[...(state.collection.getChildren?.(row.key) ?? [])].map((cell) =>\n cell.props?.isSelectionCell ? (\n <TableSelectionCell key={cell.key} cell={cell} state={state} />\n ) : (\n <TableCell key={cell.key} cell={cell} stacked={!!stacked} state={state} />\n )\n )}\n </TableRow>\n ))}\n </TableRowGroup>\n {footer && <tfoot>{footer}</tfoot>}\n </table>\n )\n\n const wrapperClassName = tableWrapperClassName({ responsive, stacked })\n if (!wrapperClassName) return tableEl\n\n return <div className={wrapperClassName}>{tableEl}</div>\n}\n\n// `forwardRef` erases type parameters, so the generic component is cast back to a generic\n// signature for callers — same reasoning as `TableHeader`/`TableBody`'s casts above.\nexport const Table = forwardRef(TableInner) as <T extends object>(\n props: TableProps<T> & { ref?: Ref<HTMLTableElement> }\n) => ReactElement\n\n;(Table as { displayName?: string }).displayName = 'Table'\n\nconst TableRowGroup = ({\n className,\n type: Element,\n children\n}: {\n children: ReactNode\n className?: string\n type: 'thead' | 'tbody'\n}) => {\n const { rowGroupProps } = useTableRowGroup()\n return (\n <Element {...rowGroupProps} className={className || undefined}>\n {children}\n </Element>\n )\n}\n\ninterface TableHeaderRowProps<T> {\n children: ReactNode\n item: RowNode<T>\n state: TableState<T>\n}\n\nconst TableHeaderRow = <T extends object>({ children, item, state }: TableHeaderRowProps<T>) => {\n const ref = useRef<HTMLTableRowElement>(null)\n const { rowProps } = useTableHeaderRow({ node: item }, state, ref)\n return (\n <tr {...rowProps} ref={ref}>\n {children}\n </tr>\n )\n}\n\ninterface TableColumnHeaderProps<T> {\n column: ColumnNode<T>\n state: TableState<T>\n}\n\nconst TableColumnHeader = <T extends object>({ column, state }: TableColumnHeaderProps<T>) => {\n const ref = useRef<HTMLTableCellElement>(null)\n const { columnHeaderProps } = useTableColumnHeader({ node: column }, state, ref)\n const sortActive = state.sortDescriptor?.column === column.key\n const sortIcon = state.sortDescriptor?.direction === 'ascending' ? '▲' : '▼'\n\n return (\n <th\n {...columnHeaderProps}\n className={column.props?.className || undefined}\n colSpan={column.colSpan ?? undefined}\n // react-aria's `useTableColumnHeader` supplies `role=\"columnheader\"` for the ARIA grid\n // pattern but no `scope`, so the native table semantics were left ambiguous — a `<th>` with\n // no `scope` fails WCAG H63, and assistive technology reading the table natively (rather\n // than through the grid roles) has to guess whether the header applies to its column or its\n // row. These are always column headers; the row-header case doesn't exist in this API.\n scope=\"col\"\n ref={ref}\n >\n {column.rendered}\n {column.props?.allowsSorting && (\n <span aria-hidden=\"true\" className=\"table-sort-icon\">\n {sortActive ? sortIcon : '⇅'}\n </span>\n )}\n </th>\n )\n}\n\ninterface TableSelectAllCellProps<T> {\n column: ColumnNode<T>\n state: TableState<T>\n}\n\nconst TableSelectAllCell = <T extends object>({ column, state }: TableSelectAllCellProps<T>) => {\n const ref = useRef<HTMLTableCellElement>(null)\n const { columnHeaderProps } = useTableColumnHeader({ node: column }, state, ref)\n const { checkboxProps } = useTableSelectAllCheckbox(state)\n\n return (\n <th\n {...columnHeaderProps}\n className=\"table-selection-cell\"\n scope=\"col\"\n // react-stately's internal \"select all\" column key is a module-scoped\n // `'row-header-column-' + Math.random()` constant (@react-stately/table's TableCollection),\n // computed once per JS environment rather than per render. Under SSR this makes `id`/\n // `data-key` here differ between the server module instance and the browser's, on every\n // request — a real react-stately bug, not something this component can influence (the key\n // never reaches a public prop) — see README.md's Table/DataGrid known-issue section for the\n // upstream write-up. The mismatch is confined to this internal bookkeeping attribute (no\n // visible content, nothing else references this id), so suppressing the warning is safe\n // rather than papering over a real functional break.\n suppressHydrationWarning\n ref={ref}\n >\n <TableCheckbox checkboxProps={checkboxProps} />\n </th>\n )\n}\n\ninterface TableRowProps<T> {\n children: ReactNode\n item: RowNode<T>\n state: TableState<T>\n}\n\nconst TableRow = <T extends object>({ children, item, state }: TableRowProps<T>) => {\n const ref = useRef<HTMLTableRowElement>(null)\n const { rowProps } = useTableRow({ node: item }, state, ref)\n const isSelected = state.selectionManager.isSelected(item.key)\n\n return (\n <tr\n {...rowProps}\n className={classNames({ active: isSelected }, item.props?.className)}\n ref={ref}\n >\n {children}\n </tr>\n )\n}\n\ninterface TableCellProps<T> {\n cell: CellNode<T>\n stacked?: boolean\n state: TableState<T>\n}\n\nconst TableCell = <T extends object>({ cell, stacked, state }: TableCellProps<T>) => {\n const ref = useRef<HTMLTableCellElement>(null)\n const { gridCellProps } = useTableCell({ node: cell }, state, ref)\n\n return (\n <td\n {...gridCellProps}\n className={cell.props?.className || undefined}\n data-cell={stacked ? cell.column?.textValue || undefined : undefined}\n ref={ref}\n >\n {cell.rendered}\n </td>\n )\n}\n\nconst TableSelectionCell = <T extends object>({ cell, state }: TableCellProps<T>) => {\n const ref = useRef<HTMLTableCellElement>(null)\n const { gridCellProps } = useTableCell({ node: cell }, state, ref)\n const { checkboxProps } = useTableSelectionCheckbox({ key: cell.parentKey! }, state)\n\n return (\n // See `TableSelectAllCell`'s comment: this cell's `id`/`data-key` derive from the same\n // module-scoped random column key and mismatch between server and client under SSR.\n <td {...gridCellProps} className=\"table-selection-cell\" suppressHydrationWarning ref={ref}>\n <TableCheckbox checkboxProps={checkboxProps} />\n </td>\n )\n}\n\nconst TableCheckbox = ({ checkboxProps }: { checkboxProps: AriaCheckboxProps }) => {\n const toggleState = useToggleState(checkboxProps)\n const ref = useRef<HTMLInputElement>(null)\n const { inputProps } = useCheckbox(checkboxProps, toggleState, ref)\n\n // `aria-describedby` after the spread: react-aria's own adds ids it never renders (FORMS.md,\n // gotcha 6).\n return <input {...inputProps} aria-describedby={undefined} className=\"check-input\" ref={ref} />\n}\n","import { ReactElement } from 'react'\nimport { TableBody as StatelyTableBody } from 'react-stately'\n\nexport interface TableBodyProps<T> {\n /**\n * `TableRow` elements, or a render function paired with `items` for dynamic row generation.\n */\n children: ReactElement | ReactElement[] | ((item: T) => ReactElement)\n /**\n * A string of all className you want applied to the `<tbody>` element.\n */\n className?: string\n /**\n * A list of row data objects, rendered via the function form of `children`.\n */\n items?: Iterable<T>\n}\n\n/**\n * Collection node, data-only — read by `Table` to build the table's row collection. Never\n * rendered directly.\n */\nexport const TableBody = StatelyTableBody as unknown as <T>(\n props: TableBodyProps<T>\n) => ReactElement\n","import { ReactElement, ReactNode } from 'react'\nimport { Cell } from 'react-stately'\n\nexport interface TableCellProps {\n /**\n * The contents of the cell.\n */\n children: ReactNode\n /**\n * A string of all className you want applied to the cell.\n */\n className?: string\n /**\n * Indicates how many columns the cell spans.\n */\n colSpan?: number\n /**\n * A string representation of the cell's contents, used for typeahead.\n */\n textValue?: string\n}\n\n/**\n * Collection node, data-only — see `TableHeader`. Read by `Table` to build a cell in the\n * table's collection; never rendered directly.\n */\nexport const TableCell = Cell as unknown as (props: TableCellProps) => ReactElement\n","import { ReactElement, ReactNode } from 'react'\nimport { Column } from 'react-stately'\n\nexport interface TableColumnProps {\n /**\n * Whether the column allows sorting. Adds a sort indicator and makes the header\n * clickable/keyboard-activatable.\n */\n allowsSorting?: boolean\n /**\n * Rendered contents of the column header.\n */\n children: ReactNode\n /**\n * A string of all className you want applied to the column header.\n */\n className?: string\n /**\n * A string representation of the column header, used for accessibility announcements and,\n * when `Table`'s `stacked` prop is set, as the label shown before each row's value for this\n * column. Defaults to `children` when it's a plain string — set this explicitly when the\n * header contains anything else (an icon, a `Tooltip`, etc.).\n */\n textValue?: string\n}\n\n/**\n * Collection node, data-only — see `TableHeader`. Read by `Table` to build a column in the\n * table's collection; never rendered directly.\n */\nexport const TableColumn = Column as unknown as (props: TableColumnProps) => ReactElement\n","import { ReactElement } from 'react'\nimport { TableHeader as StatelyTableHeader } from 'react-stately'\n\nexport interface TableHeaderProps<T> {\n /**\n * `TableColumn` elements, or a render function paired with `columns` for dynamic column\n * generation.\n */\n children: ReactElement | ReactElement[] | ((column: T) => ReactElement)\n /**\n * A string of all className you want applied to the `<thead>` element.\n */\n className?: string\n /**\n * A list of column data objects, rendered via the function form of `children`.\n */\n columns?: readonly T[]\n}\n\n/**\n * Collection node, data-only — read by `Table` to build the table's column collection. Never\n * rendered directly.\n */\nexport const TableHeader = StatelyTableHeader as unknown as <T>(\n props: TableHeaderProps<T>\n) => ReactElement\n","import { Key, ReactElement } from 'react'\nimport { Row } from 'react-stately'\n\nexport interface TableRowProps {\n /**\n * `TableCell` elements, or a render function called once per column with that column's key —\n * required when the row's parent `TableBody` uses the `items`/render-function form.\n */\n children: ReactElement | ReactElement[] | ((columnKey: Key) => ReactElement)\n /**\n * A string of all className you want applied to the row.\n */\n className?: string\n /**\n * A string representation of the row's contents, used for typeahead.\n */\n textValue?: string\n}\n\n/**\n * Collection node, data-only — see `TableHeader`. Read by `Table` to build a row in the\n * table's collection; never rendered directly.\n */\nexport const TableRow = Row as unknown as (props: TableRowProps) => ReactElement\n"],"mappings":"A,ojBAkPA,MAAaW,EAAQC,GAxGnB,CACE,QACA,WACA,aACA,UACA,WACA,YACA,QACA,eACA,SACA,QACA,KACA,oBACA,eACA,aACA,eACA,gBAAgB,OAChB,KACA,iBACA,UACA,UACA,GAAGC,GAEL,IACG,CACH,IAAMC,EAAQC,EAAiB,CAC7B,WACA,eACA,oBACA,eACA,eACA,gBACA,wBAAyBC,IAAkB,WAC3C,gBACF,CAAC,EAEKC,EAAcC,EAAyB,IAAI,EAC3CC,EAAMb,EAAaW,EAAaG,CAAY,EAC5C,CAAE,aAAcC,EACpB,CAAE,aAAcR,EAAK,cAAe,kBAAmBA,EAAK,mBAAoB,IAAG,EACnFC,EACAG,CACF,EAEMK,EAAaf,EAAe,CAChC,QACA,WACA,aACA,YACA,QACA,QACA,KACA,UACA,SACF,CAAC,EAEKgB,EAGJ,kBAAA,cAAC,QAAD,CACE,GAAIC,EACJ,mBAAkBA,EAAU,qBAAuB,IAAA,GACnD,UAAWF,EACN,KA8BA,EA5BJG,GAAW,kBAAA,cAAC,UAAA,KAASA,CAAiB,EACvC,kBAAA,cAACC,EAAD,CAAe,UAAWC,EAAS,EAAE,CAAC,MAAM,UAAW,KAAK,OAY7C,EAXZb,EAAM,WAAW,WAAW,IAAK,GAChC,kBAAA,cAACc,EAA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"./polymorphic-CZIFszAy.js";import{n as t,r as n,t as r}from"./useToastRegionQueue-CuAMxAIA.js";import{t as i}from"./Icon-Dk5_q79o.js";import{n as a}from"./iconSlot-DU_WcSL_.js";import{t as o}from"./Portal-BTDylxAi.js";import{t as s}from"./CloseButton-BPUI5iGX.js";import c,{createContext as l,forwardRef as u,useContext as d}from"react";import f from"classnames";import{mergeProps as p}from"react-aria";import{ToastQueue as m}from"react-stately";const h=l({close:()=>{}}),g=()=>d(h);function _({children:e,className:t,closeButton:n,closeLabel:r,component:i,...a},o){let{close:l}=g(),u=i??`div`,d=f(`toast-body`,{"d-flex align-items-start justify-content-between gap-sm":n},t);return/* @__PURE__ */ c.createElement(u,{className:d,...a,ref:o},n?/* @__PURE__ */ c.createElement(`div`,null,e):e,n&&/* @__PURE__ */ c.createElement(s,{label:r,onClick:l}))}const v=e(_,`ToastBody`);function y({children:e,className:t,component:n,...r},i){let a=n??`div`,o=f(`toast-footer`,t);return/* @__PURE__ */ c.createElement(a,{className:o,...r,ref:i},e)}const b=e(y,`ToastFooter`);function x({children:e,className:t,closeButton:n,closeLabel:r,component:i,icon:o,time:l,titleId:u,...d},p){let{close:m}=g(),h=i??`div`,_=f(`toast-header`,t);return/* @__PURE__ */ c.createElement(h,{className:_,...d,ref:p},o!=null&&(typeof o==`string`?/* @__PURE__ */ c.createElement(`span`,{"aria-hidden":`true`,className:`me-sm`},/* @__PURE__ */ c.createElement(a,{value:o,className:`toast-icon`})):/* @__PURE__ */ c.createElement(`span`,{className:`me-sm`},o)),e!=null&&/* @__PURE__ */ c.createElement(`strong`,{id:u,className:`me-auto`},e),l!=null&&/* @__PURE__ */ c.createElement(`small`,null,l),n&&/* @__PURE__ */ c.createElement(s,{label:r,onClick:m}))}const S=e(x,`ToastHeader`),C=u(({children:e,animation:r=!0,autohide:i=!0,className:a,closeButton:o,closeLabel:s,color:l,defaultVisible:u=!1,delay:d=5e3,footer:m,icon:g,message:_,role:y=`status`,solid:x,time:C,title:w,translucent:T,visible:E,onClose:D,onShow:O,onVisibleChange:k,...A},j)=>{let{close:M,entered:N,forkedRef:P,isMounted:F,textId:I,titleId:L,transitionClass:R,visible:z}=t({defaultVisible:u,displayName:`Toast`,onClose:D,onShow:O,onVisibleChange:k,ref:j,visible:E}),B=n({enabled:i,delay:d,visible:z&&N,onHide:M}),V={visible:z,close:M},H=f(`toast`,{fade:r,context:!!l,solid:!!(x&&l),translucent:T},l,a),U=g!=null||w!=null||C!=null,W=o&&(U||_==null),G=o&&!U&&_!=null,K=U||W;return F?/* @__PURE__ */ c.createElement(h.Provider,{value:V},/* @__PURE__ */ c.createElement(`div`,{className:f(H,R),role:y,"aria-labelledby":w==null?void 0:L,"aria-describedby":w!=null&&_!=null?I:void 0,...p(A,B),ref:P},K&&/* @__PURE__ */ c.createElement(S,{icon:g,time:C,titleId:w==null?void 0:L,closeButton:W,closeLabel:s},w),_!=null&&/* @__PURE__ */ c.createElement(v,{id:w!=null&&_!=null?I:void 0,closeButton:G,closeLabel:s},_),e,m!=null&&/* @__PURE__ */ c.createElement(b,null,typeof m==`function`?m(M):m))):null});C.displayName=`Toast`;const w=u(({className:e,...t},n)=>{let r=f(`toast-icon`,e);return/* @__PURE__ */ c.createElement(i,{className:r,...t,ref:n})});w.displayName=`ToastIcon`;const T=new m;function E(e,t={}){return T.add({children:e,...t})}function D(e){T.close(e)}const O=u(({children:e,className:t,placement:n,...i},a)=>{let{forkedRef:s,regionProps:l,state:u}=r(T,a),d=f(`toaster toast-container p-md`,{"position-fixed":n,"position-static":!n,"top-0":n&&n.includes(`top`),"top-50 translate-middle-y":n&&n.includes(`middle`),"bottom-0":n&&n.includes(`bottom`),"start-0":n&&n.includes(`start`),"start-50 translate-middle-x":n&&n.includes(`center`),"end-0":n&&n.includes(`end`)},t),p=t=>u.visibleToasts.length>0||e?/* @__PURE__ */ c.createElement(`div`,{className:d,...l,...i,ref:t},e,u.visibleToasts.map(e=>{let{children:t,...n}=e.content;return/* @__PURE__ */ c.createElement(C,{key:e.key,defaultVisible:!0,...n,onClose:()=>u.close(e.key)},t)})):null;return n?/* @__PURE__ */ c.createElement(o,null,p(s)):p(s)});O.displayName=`Toaster`;export{w as a,b as c,T as i,v as l,E as n,C as o,D as r,S as s,O as t,g as u};
|
|
2
|
-
//# sourceMappingURL=toast-Dd0J2e1z.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"toast-Dd0J2e1z.js","names":["createPolymorphicComponent","useDismissibleTransition","useAutoDismiss","useToastRegionQueue","Icon","ResolvedIcon","Portal","CloseButton","React","classNames","ToastContext","createContext","useToast","useContext","ToastBodyRender","rest","Component","component","_className","closeButton","className","children","closeLabel","close","ToastBody","ToastFooterRender","ToastFooter","ToastHeaderRender","icon","titleId","time","ToastHeader","Toast","forwardRef","_visible","autoDismissProps","autohide","entered","contextValues","animation","color","solid","hasHeaderShorthand","title","headerGetsCloseButton","message","bodyGetsCloseButton","hasHeaderContent","isMounted","transitionClass","textId","mergeProps","forkedRef","footer","ToastIcon","toastQueue","ToastQueue","addToast","options","closeToast","key","Toaster","ref","placement","toaster","state","regionProps","toasterRef","toastChildren","toastProps","queued"],"sources":["../../src/components/toast/context.ts","../../src/components/toast/useToast.ts","../../src/components/toast/ToastBody.tsx","../../src/components/toast/ToastFooter.tsx","../../src/components/toast/ToastHeader.tsx","../../src/components/toast/Toast.tsx","../../src/components/toast/ToastIcon.tsx","../../src/components/toast/toastQueue.ts","../../src/components/toast/Toaster.tsx"],"sourcesContent":["import { createContext } from 'react'\n\nexport interface ToastContextProps {\n /**\n * Whether the toast is currently visible.\n */\n visible?: boolean\n /**\n * Dismisses the toast. Wire this to any element's `onClick` — see `useToast`.\n */\n close: () => void\n}\n\nexport const ToastContext = createContext<ToastContextProps>({ close: () => {} })\n","import { useContext } from 'react'\nimport { ToastContext, ToastContextProps } from './context'\n\nexport type UseToastResult = ToastContextProps\n\n// Reach the enclosing `Toast`'s dismiss handler from anywhere in its composed markup — e.g. to\n// close it from a plain `Button` placed in a `ToastFooter`, instead of a dedicated close\n// component. Only meaningful inside a `Toast`; outside one it returns a no-op `close`.\nexport const useToast = (): UseToastResult => useContext(ToastContext)\n","import React, { ElementType, ForwardRefRenderFunction, ReactElement } from 'react'\nimport classNames from 'classnames'\n\nimport { CloseButton } from '../close-button/CloseButton'\nimport { useToast } from './useToast'\nimport {\n createPolymorphicComponent,\n PolymorphicComponentProps,\n PolymorphicRef\n} from '../../utils/polymorphic'\n\ntype ToastBodyOwnProps<C extends ElementType> = {\n /**\n * A string of all className you want applied to the base component.\n */\n className?: string\n /**\n * Adds a close button alongside the body content, so a toast composed without a\n * `ToastHeader` still gets a dismiss control without any manual layout markup.\n */\n closeButton?: boolean\n /**\n * Overrides the close button's accessible name (defaults to `'Close'`). Set this for\n * non-English UIs.\n */\n closeLabel?: string\n /**\n * Component used for the root node. Either a string to use a HTML element or a component.\n */\n component?: C\n}\n\nexport type ToastBodyProps<C extends ElementType = 'div'> = PolymorphicComponentProps<\n C,\n ToastBodyOwnProps<C>\n>\n\ntype ToastBodyComponent = (<C extends ElementType = 'div'>(\n props: ToastBodyProps<C> & { ref?: PolymorphicRef<C> }\n) => ReactElement | null) & { displayName?: string }\n\nfunction ToastBodyRender<C extends ElementType = 'div'>(\n { children, className, closeButton, closeLabel, component, ...rest }: ToastBodyProps<C>,\n ref: PolymorphicRef<C>\n) {\n const { close } = useToast()\n const Component = component ?? 'div'\n const _className = classNames(\n 'toast-body',\n { 'd-flex align-items-start justify-content-between gap-sm': closeButton },\n className\n )\n return (\n <Component className={_className} {...rest} ref={ref}>\n {closeButton ? <div>{children}</div> : children}\n {closeButton && <CloseButton label={closeLabel} onClick={close} />}\n </Component>\n )\n}\n\nexport const ToastBody = createPolymorphicComponent<ToastBodyComponent>(\n ToastBodyRender as ForwardRefRenderFunction<Element, ToastBodyProps<ElementType>>,\n 'ToastBody'\n)\n","import React, { ElementType, ForwardRefRenderFunction, ReactElement } from 'react'\nimport classNames from 'classnames'\n\nimport {\n createPolymorphicComponent,\n PolymorphicComponentProps,\n PolymorphicRef\n} from '../../utils/polymorphic'\n\ntype ToastFooterOwnProps<C extends ElementType> = {\n /**\n * A string of all className you want applied to the base component.\n */\n className?: string\n /**\n * Component used for the root node. Either a string to use a HTML element or a component.\n */\n component?: C\n}\n\nexport type ToastFooterProps<C extends ElementType = 'div'> = PolymorphicComponentProps<\n C,\n ToastFooterOwnProps<C>\n>\n\ntype ToastFooterComponent = (<C extends ElementType = 'div'>(\n props: ToastFooterProps<C> & { ref?: PolymorphicRef<C> }\n) => ReactElement | null) & { displayName?: string }\n\nfunction ToastFooterRender<C extends ElementType = 'div'>(\n { children, className, component, ...rest }: ToastFooterProps<C>,\n ref: PolymorphicRef<C>\n) {\n const Component = component ?? 'div'\n const _className = classNames('toast-footer', className)\n\n return (\n <Component className={_className} {...rest} ref={ref}>\n {children}\n </Component>\n )\n}\n\nexport const ToastFooter = createPolymorphicComponent<ToastFooterComponent>(\n ToastFooterRender as ForwardRefRenderFunction<Element, ToastFooterProps<ElementType>>,\n 'ToastFooter'\n)\n","import React, { ElementType, ForwardRefRenderFunction, ReactElement, ReactNode } from 'react'\nimport classNames from 'classnames'\n\nimport { CloseButton } from '../close-button/CloseButton'\nimport { useToast } from './useToast'\nimport {\n createPolymorphicComponent,\n PolymorphicComponentProps,\n PolymorphicRef\n} from '../../utils/polymorphic'\nimport { ResolvedIcon } from '../icon/iconSlot'\n\ntype ToastHeaderOwnProps<C extends ElementType> = {\n /**\n * Heading, rendered before `time` as a `<strong>`.\n */\n children?: ReactNode\n /**\n * A string of all className you want applied to the base component.\n */\n className?: string\n /**\n * Automatically add a close button to the header.\n */\n closeButton?: boolean\n /**\n * Overrides the close button's accessible name (defaults to `'Close'`). Set this for\n * non-English UIs.\n */\n closeLabel?: string\n /**\n * Component used for the root node. Either a string to use a HTML element or a component.\n */\n component?: C\n /**\n * Leading icon. A string is an icon name, rendered like `<ToastIcon name={icon} />` (or by\n * `IconProvider`'s `component`) and hidden from\n * assistive technology by default, since it duplicates the heading visually. Pass any other\n * node for a fully custom icon (typically a logo or avatar) — a custom node is left as-is,\n * since it may carry its own meaningful accessible name (e.g. an avatar's `alt` text).\n */\n icon?: string | ReactNode\n /**\n * Trailing timestamp, rendered after the heading.\n */\n time?: ReactNode\n /**\n * Sets the `id` on the rendered heading element, for `aria-labelledby` wiring. Set\n * automatically by `Toast` when both `title` and `message` are used together; only needed\n * here for manual wiring in a fully custom composition.\n */\n titleId?: string\n}\n\nexport type ToastHeaderProps<C extends ElementType = 'div'> = PolymorphicComponentProps<\n C,\n ToastHeaderOwnProps<C>\n>\n\ntype ToastHeaderComponent = (<C extends ElementType = 'div'>(\n props: ToastHeaderProps<C> & { ref?: PolymorphicRef<C> }\n) => ReactElement | null) & { displayName?: string }\n\nfunction ToastHeaderRender<C extends ElementType = 'div'>(\n {\n children,\n className,\n closeButton,\n closeLabel,\n component,\n icon,\n time,\n titleId,\n ...rest\n }: ToastHeaderProps<C>,\n ref: PolymorphicRef<C>\n) {\n const { close } = useToast()\n const Component = component ?? 'div'\n const _className = classNames('toast-header', className)\n return (\n <Component className={_className} {...rest} ref={ref}>\n {icon != null &&\n (typeof icon === 'string' ? (\n <span aria-hidden=\"true\" className=\"me-sm\">\n <ResolvedIcon value={icon} className=\"toast-icon\" />\n </span>\n ) : (\n <span className=\"me-sm\">{icon}</span>\n ))}\n {children != null && (\n <strong id={titleId} className=\"me-auto\">\n {children}\n </strong>\n )}\n {time != null && <small>{time}</small>}\n {closeButton && <CloseButton label={closeLabel} onClick={close} />}\n </Component>\n )\n}\n\nexport const ToastHeader = createPolymorphicComponent<ToastHeaderComponent>(\n ToastHeaderRender as ForwardRefRenderFunction<Element, ToastHeaderProps<ElementType>>,\n 'ToastHeader'\n)\n","import React, { forwardRef, HTMLAttributes, ReactNode } from 'react'\nimport { mergeProps } from 'react-aria'\nimport classNames from 'classnames'\n\nimport { ContextColor } from '../../types'\nimport { useAutoDismiss, useDismissibleTransition } from '../../hooks'\nimport { ToastContext } from './context'\nimport { ToastBody } from './ToastBody'\nimport { ToastFooter } from './ToastFooter'\nimport { ToastHeader } from './ToastHeader'\n\nexport interface ToastProps extends Omit<HTMLAttributes<HTMLDivElement>, 'title'> {\n /**\n * Apply a CSS fade transition to the toast.\n */\n animation?: boolean\n /**\n * Auto hide the toast. The timer starts once the show transition completes and pauses\n * while the pointer is over the toast or focus is within it.\n */\n autohide?: boolean\n /**\n * A string of all className you want applied to the base component.\n */\n className?: string\n /**\n * Adds a close button — shorthand for `ToastHeader`'s/`ToastBody`'s `closeButton` prop.\n * Placed in the header when `icon`/`title`/`time` is set; otherwise placed in the body\n * alongside `message`, or in a header containing only the close button if `message` is\n * also unset.\n */\n closeButton?: boolean\n /**\n * Overrides the close button's accessible name (defaults to `'Close'`). Set this for\n * non-English UIs. Shorthand for `ToastHeader`'s `closeLabel` prop.\n */\n closeLabel?: string\n /**\n * Sets the color of the component to one of Chassis context colors.\n */\n color?: ContextColor\n /**\n * Whether the toast is shown when it first renders. Such a toast is uncontrolled: its close\n * button and the `autohide` timer hide it. Use `visible` to show and hide it from outside.\n */\n defaultVisible?: boolean\n /**\n * Delay hiding the toast (ms).\n */\n delay?: number\n /**\n * Trailing content — typically a row of `Button`s — rendered via a single `ToastFooter`,\n * after `message`/`children`. Pass a function to receive `close` directly, instead of\n * calling `useToast()` from a child component to wire up a \"Close\" action.\n */\n footer?: ReactNode | ((close: () => void) => ReactNode)\n /**\n * Leading icon for the header. A string is an icon name, rendered like\n * `<ToastIcon name={icon} />` (or by `IconProvider`'s `component`); pass\n * any other node for a fully custom icon (typically a logo or avatar). Shorthand for\n * `ToastHeader`'s `icon` prop; hidden from assistive technology by default, since it\n * duplicates `title` visually.\n */\n icon?: string | ReactNode\n /**\n * Message body, rendered via a single `ToastBody`. For multi-block content, compose\n * `children` manually instead — `message` wraps everything in one element.\n */\n message?: ReactNode\n /**\n * Header timestamp, rendered after `title`. Shorthand for `ToastHeader`'s `time` prop.\n */\n time?: ReactNode\n /**\n * Header heading, rendered before `time`. Shorthand for `ToastHeader`'s children. When set\n * alongside `message`, wires the toast's `aria-labelledby`/`aria-describedby` to them\n * automatically.\n */\n title?: ReactNode\n /**\n * Callback fired once the toast has hidden: after its exit transition.\n */\n onClose?: () => void\n /**\n * Callback fired when the toast starts to show.\n */\n onShow?: () => void\n /**\n * Callback fired with `false` when the toast asks to hide: its close button, `close` from\n * `useToast` or `footer`, or the `autohide` timer. With `visible` set, the toast hides only\n * when `visible` becomes `false`.\n */\n onVisibleChange?: (visible: boolean) => void\n /**\n * ARIA live-region role. Use `status` (the default) for confirmation, progress, and\n * informational messages, which announce politely. Use `alert` for messages that need\n * immediate attention — validation errors, failed operations — which interrupt speech.\n */\n role?: 'status' | 'alert'\n /**\n * Apply a full-color background with inverted text. Only meaningful alongside `color`.\n */\n solid?: boolean\n /**\n * Apply a semi-transparent background.\n */\n translucent?: boolean\n /**\n * Whether the toast is shown. Setting it makes the toast controlled: it hides only when this\n * becomes `false`, so pair it with `onVisibleChange`. Without either `visible` or\n * `defaultVisible` a toast renders nothing.\n */\n visible?: boolean\n}\n\nexport const Toast = forwardRef<HTMLDivElement, ToastProps>(\n (\n {\n children,\n animation = true,\n autohide = true,\n className,\n closeButton,\n closeLabel,\n color,\n defaultVisible = false,\n delay = 5000,\n footer,\n icon,\n message,\n role = 'status',\n solid,\n time,\n title,\n translucent,\n visible,\n onClose,\n onShow,\n onVisibleChange,\n ...rest\n },\n ref\n ) => {\n const {\n close,\n entered,\n forkedRef,\n isMounted,\n textId,\n titleId,\n transitionClass,\n visible: _visible\n } = useDismissibleTransition({\n defaultVisible,\n displayName: 'Toast',\n onClose,\n onShow,\n onVisibleChange,\n ref,\n visible\n })\n\n // The autohide timer is only meaningful once the show transition has actually finished (see\n // `autohide`'s JSDoc) — gating on `_visible` alone would start it the instant the toast is\n // asked to show, while it is still fading/sliding in.\n const autoDismissProps = useAutoDismiss({\n enabled: autohide,\n delay,\n visible: _visible && entered,\n onHide: close\n })\n\n const contextValues = {\n visible: _visible,\n close\n }\n\n const _className = classNames(\n 'toast',\n {\n fade: animation,\n context: !!color,\n solid: Boolean(solid && color),\n translucent\n },\n color,\n className\n )\n\n const hasHeaderShorthand = icon != null || title != null || time != null\n const headerGetsCloseButton = closeButton && (hasHeaderShorthand || message == null)\n const bodyGetsCloseButton = closeButton && !hasHeaderShorthand && message != null\n const hasHeaderContent = hasHeaderShorthand || headerGetsCloseButton\n\n if (!isMounted) return null\n\n return (\n <ToastContext.Provider value={contextValues}>\n <div\n className={classNames(_className, transitionClass)}\n role={role}\n aria-labelledby={title != null ? titleId : undefined}\n aria-describedby={title != null && message != null ? textId : undefined}\n {...mergeProps(rest, autoDismissProps)}\n ref={forkedRef}\n >\n {hasHeaderContent && (\n <ToastHeader\n icon={icon}\n time={time}\n titleId={title != null ? titleId : undefined}\n closeButton={headerGetsCloseButton}\n closeLabel={closeLabel}\n >\n {title}\n </ToastHeader>\n )}\n {message != null && (\n <ToastBody\n id={title != null && message != null ? textId : undefined}\n closeButton={bodyGetsCloseButton}\n closeLabel={closeLabel}\n >\n {message}\n </ToastBody>\n )}\n {children}\n {footer != null && (\n <ToastFooter>{typeof footer === 'function' ? footer(close) : footer}</ToastFooter>\n )}\n </div>\n </ToastContext.Provider>\n )\n }\n)\n\nToast.displayName = 'Toast'\n","import React, { forwardRef } from 'react'\nimport classNames from 'classnames'\n\nimport { Icon, IconProps } from '../icon/Icon'\n\nexport type ToastIconProps = IconProps & {\n /**\n * A string of all className you want applied to the base component.\n */\n className?: string\n}\n\nexport const ToastIcon = forwardRef<HTMLSpanElement | SVGSVGElement, ToastIconProps>(\n ({ className, ...rest }, ref) => {\n const _className = classNames('toast-icon', className)\n\n return <Icon className={_className} {...rest} ref={ref} />\n }\n)\n\nToastIcon.displayName = 'ToastIcon'\n","import { ReactNode } from 'react'\nimport { ToastQueue } from 'react-stately'\n\nimport { ToastProps } from './Toast'\n\n// What `Toaster` spreads onto the `<Toast>` it renders for a queued toast: every `Toast` prop\n// that describes the toast itself. The queue owns whether it is shown.\nexport interface ToastContent extends Pick<\n ToastProps,\n | 'animation'\n | 'autohide'\n | 'closeButton'\n | 'closeLabel'\n | 'color'\n | 'delay'\n | 'footer'\n | 'icon'\n | 'message'\n | 'role'\n | 'solid'\n | 'time'\n | 'title'\n | 'translucent'\n> {\n /**\n * Content of the toast. Compose manually (typically a `ToastHeader`/`ToastBody`/\n * `ToastFooter`), or leave empty and use the `title`/`message`/`footer` shorthand options\n * instead.\n */\n children?: ReactNode\n}\n\n// The queue backing `Toaster` — a module-level singleton so `addToast()` is callable from\n// anywhere (an event handler, an async callback) without threading a `push` prop through\n// render. `Toaster` subscribes to it via `useToastQueue`; nothing renders until a\n// `<Toaster />` is actually mounted somewhere to display the queue's contents.\nexport const toastQueue = new ToastQueue<ToastContent>()\n\n// Adds a toast to the queue. Returns the toast's key, which can be passed to `closeToast` to\n// dismiss it programmatically. `children` is optional — omit it for a toast composed entirely\n// from the `title`/`message`/`footer` shorthand options.\nexport function addToast(\n children?: ReactNode,\n options: Omit<ToastContent, 'children'> = {}\n): string {\n return toastQueue.add({ children, ...options })\n}\n\n// Removes a queued toast immediately, bypassing its own exit animation.\nexport function closeToast(key: string): void {\n toastQueue.close(key)\n}\n","import React, { forwardRef, HTMLAttributes } from 'react'\nimport classNames from 'classnames'\n\nimport { useToastRegionQueue } from '../../hooks'\nimport { Portal } from '../portal/Portal'\nimport { Toast } from './Toast'\nimport { toastQueue } from './toastQueue'\n\nexport interface ToasterProps extends HTMLAttributes<HTMLDivElement> {\n /**\n * Overrides the toast region's accessible name (defaults to `'Notifications'`, per\n * react-aria). Set this for non-English UIs, or to distinguish multiple toasters on the\n * same page.\n */\n 'aria-label'?: string\n /**\n * A string of all className you want applied to the base component.\n */\n className?: string\n /**\n * Describes the placement of your component.\n *\n * @type 'top-start' | 'top-center' | 'top-end' | 'middle-start' | 'middle-center' | 'middle-end' | 'bottom-start' | 'bottom-center' | 'bottom-end' | string\n */\n placement?:\n | 'top-start'\n | 'top-center'\n | 'top-end'\n | 'middle-start'\n | 'middle-center'\n | 'middle-end'\n | 'bottom-start'\n | 'bottom-center'\n | 'bottom-end'\n | string\n}\n\n// Renders the shared `toastQueue` (see `toastQueue.ts` — `addToast()` is how toasts get added\n// to it from anywhere in the app) plus any statically-passed `children`, e.g. a permanently\n// pinned toast alongside dynamic ones.\nexport const Toaster = forwardRef<HTMLDivElement, ToasterProps>(\n ({ children, className, placement, ...rest }, ref) => {\n const { forkedRef, regionProps, state } = useToastRegionQueue(toastQueue, ref)\n\n const _className = classNames(\n 'toaster toast-container p-md',\n {\n 'position-fixed': placement,\n 'position-static': !placement,\n 'top-0': placement && placement.includes('top'),\n 'top-50 translate-middle-y': placement && placement.includes('middle'),\n 'bottom-0': placement && placement.includes('bottom'),\n 'start-0': placement && placement.includes('start'),\n 'start-50 translate-middle-x': placement && placement.includes('center'),\n 'end-0': placement && placement.includes('end')\n },\n className\n )\n\n const toaster = (toasterRef?: React.Ref<HTMLDivElement>) => {\n return state.visibleToasts.length > 0 || children ? (\n <div className={_className} {...regionProps} {...rest} ref={toasterRef}>\n {children}\n {state.visibleToasts.map((queued) => {\n const { children: toastChildren, ...toastProps } = queued.content\n return (\n <Toast\n key={queued.key}\n defaultVisible\n {...toastProps}\n onClose={() => state.close(queued.key)}\n >\n {toastChildren}\n </Toast>\n )\n })}\n </div>\n ) : null\n }\n\n // A placed region is portaled to `document.body`, on the server as on the client: it renders\n // nothing until hydration has finished, instead of rendering inline on the server and moving\n // on the client, which discarded the server's markup.\n return placement ? <Portal>{toaster(forkedRef)}</Portal> : toaster(forkedRef)\n }\n)\n\nToaster.displayName = 'Toaster'\n"],"mappings":"A,kfAaA,MAAaU,EAAeC,EAAiC,CAAE,UAAa,CAAC,CAAE,CAAC,ECLnEC,MAAiCC,EAAWH,CAAY,ECiCrE,SAASI,EACP,CAAE,WAAU,YAAW,cAAa,aAAY,YAAW,GAAGC,GAC9D,EACA,CACA,GAAM,CAA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M,IAAKoD,CAevD,EAdF9C,EACA4C,EAAM,cAAc,IAAK,GAAW,CACnC,GAAM,CAAE,SAAUG,EAAe,GAAGC,GAAeC,EAAO,QAC1D,MACE,kBAAA,cAACtC,EAAD,CACE,IAAKsC,EAAO,IACZ,eAAA,GACA,GAAID,EACJ,YAAeJ,EAAM,MAAMK,EAAO,GAAG,CAGhC,EADJF,CACI,CAEX,CAAC,CACE,EACH,KAMN,OAAOL,EAAY,kBAAA,cAACzD,EAAA,KAAQ0D,EAAQZ,CAAS,CAAU,EAAIY,EAAQZ,CAAS,CAC9E,CACF,EAEA,EAAQ,YAAc,U"}
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import"./focus-ring-Bs80iIBN.js";import{i as e,o as t}from"./slot-BQVx1Eew.js";import{t as n}from"./useForkedRef-WoqMqsWE.js";import{t as r}from"./useHydrated-Dud4JEwp.js";import{t as i}from"./useTransitionState-sQUQey74.js";import{n as a,r as o,t as s}from"./useFloatingOverlay-BuiI_CCn.js";import{t as c}from"./useOpenStateProps-BhjSQ3f6.js";import{i as l,n as u}from"./overlayPlacement-Q6bcbXA5.js";import{t as d}from"./Portal-BTDylxAi.js";import f,{forwardRef as p,useEffect as m,useRef as h}from"react";import g from"classnames";import{mergeProps as _,useOverlayPosition as v,useTooltip as y,useTooltipTrigger as b}from"react-aria";import{useTooltipTriggerState as x}from"react-stately";const S=p(function({children:p,className:S,content:C,defaultVisible:w,placement:T=`top`,offset:E=[0,6],onHide:D,onShow:O,onVisibleChange:k,style:A,trigger:j,visible:M,...N},P){let F=h(null),I=h(null),L=h(null),ee=n(P,L),R=e(p,`Tooltip`),z=x({...c({defaultVisible:w,onVisibleChange:k,visible:M},`Tooltip`),trigger:j,delay:0,closeDelay:0}),B=M!==void 0&&!k,{triggerProps:V,tooltipProps:H}=b({trigger:j},B?{...z,isOpen:!1}:z,I),{tooltipProps:U}=y({},z),W=z.open;m(()=>{z.isOpen&&W(!0)},[z.isOpen]);let G=o({close:()=>z.close(!0),isOpen:z.isOpen,onHide:D,onShow:O,triggerRef:I}),{overlayProps:K,arrowProps:q,placement:J}=v({targetRef:I,overlayRef:L,placement:l(T),offset:E[1],crossOffset:E[0],arrowSize:8,arrowRef:F,isOpen:z.isOpen}),Y={...A,position:K.style?.position,top:K.style?.top,left:K.style?.left},X=u(T,J),{isMounted:Z,phase:Q}=i({in:z.isOpen&&G!==null,mountOnEnter:!0,nodeRef:L,unmountOnExit:!0}),$=r();return/* @__PURE__ */ f.createElement(f.Fragment,null,R?t(R,_($?V:{...V,"aria-describedby":void 0},$&&B&&z.isOpen?{"aria-describedby":H.id}:{}),I):p,/* @__PURE__ */ f.createElement(d,{container:G},Z&&/* @__PURE__ */ f.createElement(`div`,{..._(H,U,N),className:g(`tooltip cx-tooltip-auto`,a(Q),S),"data-cx-placement":X,ref:ee,style:Y},/* @__PURE__ */ f.createElement(`div`,{className:`tooltip-arrow`,...q,style:s(q)}),/* @__PURE__ */ f.createElement(`div`,{className:`tooltip-inner`},C))))});S.displayName=`Tooltip`;export{S as t};
|
|
2
|
-
//# sourceMappingURL=tooltip-CmKeQwYw.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"tooltip-CmKeQwYw.js","names":["getTriggerChild","renderSlotted","useForkedRef","useHydrated","useTransitionState","getOverlayTransitionClass","useFloatingOverlay","getOverlayArrowStyle","useOpenStateProps","toAriaPlacement","resolveDataPlacement","Portal","React","classNames","Tooltip","forwardRef","offsetProp","rest","arrowRef","useRef","triggerRef","floatingRef","forkedFloatingRef","ref","triggerElement","children","state","useTooltipTriggerState","isHeld","visible","onVisibleChange","tooltipTriggerProps","useTooltipTrigger","useTooltip","registerOpen","useEffect","portalContainer","resolvedPlacement","useOverlayPosition","placement","floatingStyle","style","overlayProps","placementAttr","hydrated","mergeProps","triggerProps","isMounted","tooltipProps","phase","className","arrowProps","content"],"sources":["../../src/components/tooltip/Tooltip.tsx"],"sourcesContent":["import React, {\n forwardRef,\n HTMLAttributes,\n ReactElement,\n ReactNode,\n useEffect,\n useRef\n} from 'react'\nimport classNames from 'classnames'\nimport { mergeProps, useOverlayPosition, useTooltip, useTooltipTrigger } from 'react-aria'\nimport { useTooltipTriggerState } from 'react-stately'\n\nimport {\n getOverlayArrowStyle,\n getOverlayTransitionClass,\n useFloatingOverlay,\n useForkedRef,\n useOpenStateProps,\n useTransitionState\n} from '../../hooks'\nimport { Placement, resolveDataPlacement, toAriaPlacement } from '../../utils/overlayPlacement'\nimport { useHydrated } from '../../hooks/useHydrated'\nimport { Portal } from '../portal/Portal'\nimport { getTriggerChild, renderSlotted } from '../../utils/slot'\n\nexport type { Placement }\n\n// Every attribute besides the component's own props goes to the panel, the `.tooltip` element:\n// `className`, `style`, `id`, `data-*`, ARIA attributes and event handlers. So does the ref.\nexport interface TooltipProps extends Omit<HTMLAttributes<HTMLDivElement>, 'children' | 'content'> {\n /**\n * The trigger: a single element, which shows the tooltip on hover and focus.\n */\n children: ReactElement\n /**\n * Content node for your component.\n */\n content: ReactNode | string\n /**\n * Whether the tooltip is shown when it first renders. Use it instead of `visible` when nothing\n * outside needs to control the tooltip.\n */\n defaultVisible?: boolean\n /**\n * Offset of the tooltip relative to its target, as `[crossAxis, mainAxis]`.\n */\n offset?: [number, number]\n /**\n * Callback fired when the tooltip hides.\n */\n onHide?: () => void\n /**\n * Callback fired when the tooltip shows.\n */\n onShow?: () => void\n /**\n * Callback fired when the tooltip asks to show or hide: hover, focus, blur, the Escape key, or\n * the closing of the dialog it is in. Receives the state it asks for. With `visible` set, the\n * tooltip changes only when `visible` does.\n */\n onVisibleChange?: (visible: boolean) => void\n /**\n * Describes the preferred placement of your component. Chassis will flip it to keep it in\n * view.\n */\n placement?: Placement\n /**\n * Tooltips always show on focus, since keyboard/screen-reader users need them too. Set to\n * `'focus'` to disable the hover trigger and show on focus only.\n */\n trigger?: 'hover' | 'focus'\n /**\n * Whether the tooltip is shown. Setting it makes the tooltip controlled: it shows and hides\n * only when this changes, so pair it with `onVisibleChange`. Leave it unset, or use\n * `defaultVisible`, for a tooltip that shows and hides itself.\n */\n visible?: boolean\n}\n\nexport const Tooltip = forwardRef<HTMLDivElement, TooltipProps>(function Tooltip(\n {\n children,\n className,\n content,\n defaultVisible,\n placement = 'top',\n offset: offsetProp = [0, 6],\n onHide,\n onShow,\n onVisibleChange,\n style,\n trigger,\n visible,\n ...rest\n },\n ref\n) {\n const arrowRef = useRef<HTMLDivElement>(null)\n const triggerRef = useRef<HTMLElement | null>(null)\n const floatingRef = useRef<HTMLDivElement>(null)\n const forkedFloatingRef = useForkedRef(ref, floatingRef)\n\n // The trigger is rendered as `asChild` renders a child (`renderSlotted`): `triggerProps` merge\n // into the child's own props, so its handlers chain and its `aria-describedby` adds up, and\n // `triggerRef` is forked with the ref the caller put on the child.\n const triggerElement = getTriggerChild(children, 'Tooltip')\n\n // react-stately defaults to a 1500ms warmup delay (and 500ms cooldown) before a first tooltip\n // shows, spectrum-style — chassis-css's own JS plugin defaults to instant (`delay: 0`), so\n // match that here rather than leaving new adopters to wonder why the first hover lags.\n const state = useTooltipTriggerState({\n ...useOpenStateProps({ defaultVisible, onVisibleChange, visible }, 'Tooltip'),\n trigger,\n delay: 0,\n closeDelay: 0\n })\n // While a tooltip is open, react-aria stops every Escape at the document and closes the\n // tooltip with it. One held open by `visible` with no `onVisibleChange` never closes, so it\n // would swallow Escape for the whole page: a popover, a menu or a dialog beside it could no\n // longer be closed by it. Such a tooltip is passed as closed, which is all the hook reads the\n // state for besides `aria-describedby`, set below.\n const isHeld = visible !== undefined && !onVisibleChange\n const { triggerProps, tooltipProps: tooltipTriggerProps } = useTooltipTrigger(\n { trigger },\n isHeld ? { ...state, isOpen: false } : state,\n triggerRef\n )\n const { tooltipProps } = useTooltip({}, state)\n\n // react-stately shows one tooltip at a time, but counts only a tooltip it opened through\n // `open()`. One shown by `visible` or `defaultVisible` joins here, so the next tooltip to open\n // asks it to hide, and it closes the ones already open.\n const registerOpen = state.open\n useEffect(() => {\n if (state.isOpen) registerOpen(true)\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [state.isOpen])\n\n // Bypasses the hook's hover-warmup delay (`close`'s `immediate` argument): a containing dialog\n // closing applies right away.\n const portalContainer = useFloatingOverlay({\n close: () => state.close(true),\n isOpen: state.isOpen,\n onHide,\n onShow,\n triggerRef\n })\n\n const {\n overlayProps,\n arrowProps,\n placement: resolvedPlacement\n } = useOverlayPosition({\n targetRef: triggerRef,\n overlayRef: floatingRef,\n placement: toAriaPlacement(placement),\n offset: offsetProp[1],\n crossOffset: offsetProp[0],\n arrowSize: 8,\n arrowRef,\n isOpen: state.isOpen\n })\n\n // The caller's `style` first: the position is the component's to set.\n const floatingStyle: React.CSSProperties = {\n ...style,\n position: overlayProps.style?.position as React.CSSProperties['position'],\n top: overlayProps.style?.top,\n left: overlayProps.style?.left\n }\n const placementAttr = resolveDataPlacement(placement, resolvedPlacement)\n\n // The panel mounts once its container is known (`useFloatingOverlay`), and only there.\n const { isMounted, phase } = useTransitionState({\n in: state.isOpen && portalContainer !== null,\n mountOnEnter: true,\n nodeRef: floatingRef,\n unmountOnExit: true\n })\n\n // The tooltip is portaled, so it exists only once hydration has finished: until then the\n // trigger isn't described by it, or its HTML would refer to an id no element has.\n const hydrated = useHydrated()\n\n return (\n <>\n {triggerElement\n ? renderSlotted(\n triggerElement,\n mergeProps(\n hydrated ? triggerProps : { ...triggerProps, 'aria-describedby': undefined },\n hydrated && isHeld && state.isOpen\n ? { 'aria-describedby': tooltipTriggerProps.id }\n : {}\n ),\n triggerRef\n )\n : children}\n <Portal container={portalContainer}>\n {isMounted && (\n <div\n {...mergeProps(tooltipTriggerProps, tooltipProps, rest)}\n className={classNames(\n 'tooltip cx-tooltip-auto',\n getOverlayTransitionClass(phase),\n className\n )}\n data-cx-placement={placementAttr}\n ref={forkedFloatingRef}\n style={floatingStyle}\n >\n <div\n className=\"tooltip-arrow\"\n {...arrowProps}\n style={getOverlayArrowStyle(arrowProps)}\n ></div>\n <div className=\"tooltip-inner\">{content}</div>\n </div>\n )}\n </Portal>\n </>\n )\n})\n\nTooltip.displayName = 'Tooltip'\n"],"mappings":"A,orBA+EA,MAAac,EAAUC,EAAyC,SAC9D,CACE,WACA,YACA,UACA,iBACA,YAAY,MACZ,OAAQC,EAAa,CAAC,EAAG,CAAC,EAC1B,SACA,SACA,kBACA,QACA,UACA,UACA,GAAGC,GAEL,EACA,CACA,IAAMC,EAAWC,EAAuB,IAAI,EACtCC,EAAaD,EAA2B,IAAI,EAC5CE,EAAcF,EAAuB,IAAI,EACzCG,GAAoBpB,EAAaqB,EAAKF,CAAW,EAKjDG,EAAiBxB,EAAgByB,EAAU,SAAS,EAKpDC,EAAQC,EAAuB,CACnC,GAAGnB,EAAkB,CAAE,iBAAgB,kBAAiB,SAAQ,EAAG,SAAS,EAC5E,UACA,MAAO,EACP,WAAY,CACd,CAAC,EAMKoB,EAASC,IAAY,IAAA,IAAa,CAACC,EACnC,CAAE,eAAc,aAAcC,GAAwBC,EAC1D,CAAE,SAAQ,EACVJ,EAAS,CAAE,GAAGF,EAAO,OAAQ,EAAM,EAAIA,EACvCN,CACF,EACM,CAAE,gBAAiBa,EAAW,CAAC,EAAGP,CAAK,EAKvCQ,EAAeR,EAAM,KAC3BS,MAAgB,CACVT,EAAM,QAAQQ,EAAa,EAAI,CAErC,EAAG,CAACR,EAAM,MAAM,CAAC,EAIjB,IAAMU,EAAkB9B,EAAmB,CACzC,UAAaoB,EAAM,MAAM,EAAI,EAC7B,OAAQA,EAAM,OACd,SACA,SACA,YACF,CAAC,EAEK,CACJ,eACA,aACA,UAAWW,GACTC,EAAmB,CACrB,UAAWlB,EACX,WAAYC,EACZ,UAAWZ,EAAgB8B,CAAS,EACpC,OAAQvB,EAAW,GACnB,YAAaA,EAAW,GACxB,UAAW,EACX,WACA,OAAQU,EAAM,MAChB,CAAC,EAGKc,EAAqC,CACzC,GAAGC,EACH,SAAUC,EAAa,OAAO,SAC9B,IAAKA,EAAa,OAAO,IACzB,KAAMA,EAAa,OAAO,IAC5B,EACMC,EAAgBjC,EAAqB6B,EAAWF,CAAiB,EAGjE,CAAE,YAAW,SAAUjC,EAAmB,CAC9C,GAAIsB,EAAM,QAAUU,IAAoB,KACxC,aAAc,GACd,QAASf,EACT,cAAe,EACjB,CAAC,EAIKuB,EAAWzC,EAAY,EAE7B,MACE,kBAAA,cAAAS,EAAA,SAAA,KACGY,EACGvB,EACEuB,EACAqB,EACED,EAAWE,EAAe,CAAE,GAAGA,EAAc,mBAAoB,IAAA,EAAU,EAC3EF,GAAYhB,GAAUF,EAAM,OACxB,CAAE,mBAAoBK,EAAoB,EAAG,EAC7C,CAAC,CACP,EACAX,CACF,EACAK,EACJ,kBAAA,cAACd,EAAD,CAAQ,UAAWyB,CAqBX,EApBLW,GACC,kBAAA,cAAC,MAAD,CACE,GAAIF,EAAWd,EAAqBiB,EAAc/B,CAAI,EACtD,UAAWJ,EACT,0BACAR,EAA0B4C,CAAK,EAC/BC,CACF,EACA,oBAAmBP,EACnB,IAAKrB,GACL,MAAOkB,CAQJ,EANH,kBAAA,cAAC,MAAD,CACE,UAAU,gBACV,GAAIW,EACJ,MAAO5C,EAAqB4C,CAAU,CAClC,CAAA,EACN,kBAAA,cAAC,MAAD,CAAK,UAAU,eAA8B,EAAbC,CAAa,CAC1C,CAED,CACR,CAEN,CAAC,EAED,EAAQ,YAAc,U"}
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import"./focus-ring-Bs80iIBN.js";import{t as e}from"./iconSlot-DU_WcSL_.js";import t,{createContext as n,forwardRef as r,useContext as i,useMemo as a,useRef as o}from"react";import s from"classnames";import{useButton as c,useCheckbox as l}from"react-aria";import{useToggleState as u}from"react-stately";import{ButtonContext as d,CheckboxContext as f,Collection as p,Tree as m,TreeItem as h,TreeItemContent as g,useContextProps as _,useSlottedContext as v}from"react-aria-components";const y=n({checkboxes:!1}),b=r(({autoFocus:e,checkboxes:n,children:r,className:i,expandIcon:o,renderEmptyState:c,selectionBehavior:l=`toggle`,selectionMode:u=`none`,...d},f)=>{let p=a(()=>({checkboxes:n??(u===`multiple`&&l===`toggle`),expandIcon:o}),[n,o,l,u]);return/* @__PURE__ */ t.createElement(y.Provider,{value:p},/* @__PURE__ */ t.createElement(m,{...d,autoFocus:e===!0?`first`:e,className:s(`tree`,i),ref:f,renderEmptyState:c&&(()=>c()),selectionBehavior:l,selectionMode:u},r))});b.displayName=`Tree`;const x=({disabled:n})=>{let{expandIcon:r}=i(y),[a,o]=_({slot:`chevron`},null,d),{buttonProps:s}=c({...a,isDisabled:n},o);return/* @__PURE__ */ t.createElement(`button`,{...s,className:`tree-item-toggle`,ref:o},/* @__PURE__ */ t.createElement(e,{className:`tree-item-toggle-icon`,icon:`expand`,override:r}))},S=()=>{let e=v(f,`selection`),n=u(e),r=o(null),{inputProps:i}=l(e,n,r);return/* @__PURE__ */ t.createElement(`input`,{...i,"aria-describedby":void 0,className:`check-input tree-item-check`,ref:r})},C=e=>/* @__PURE__ */ t.createElement(`div`,{...e,"aria-labelledby":void 0}),w=({hasChildItems:e,icon:n,isDisabled:r,label:a,selectionMode:o})=>{let{checkboxes:s}=i(y);return/* @__PURE__ */ t.createElement(t.Fragment,null,e?/* @__PURE__ */ t.createElement(x,{disabled:r}):/* @__PURE__ */ t.createElement(`span`,{className:`tree-item-spacer`}),s&&o!==`none`&&/* @__PURE__ */ t.createElement(S,null),n!=null&&/* @__PURE__ */ t.createElement(`span`,{"aria-hidden":`true`,className:`tree-item-icon`},n),/* @__PURE__ */ t.createElement(`span`,{className:`tree-item-label`},a))},T=r(({children:e,className:n,dependencies:r,disabled:i,icon:a,id:o,items:c,label:l,onAction:u,style:d,textValue:f},m)=>{let _=f??(typeof l==`string`||typeof l==`number`?String(l):``);return/* @__PURE__ */ t.createElement(h,{className:({isDisabled:e,isExpanded:t,isSelected:r})=>s(`tree-item`,{active:r,disabled:e,expanded:t},n),id:o,isDisabled:i,onAction:u,ref:m,render:C,style:({level:e})=>({...d,"--cx-tree-level":e}),textValue:_},/* @__PURE__ */ t.createElement(g,null,({hasChildItems:e,isDisabled:n,selectionMode:r})=>/* @__PURE__ */ t.createElement(w,{hasChildItems:e,icon:a,isDisabled:n,label:l,selectionMode:r})),c?/* @__PURE__ */ t.createElement(p,{dependencies:r,items:c},e):typeof e==`function`?null:e)});T.displayName=`TreeItem`;export{b as n,T as t};
|
|
2
|
-
//# sourceMappingURL=tree-DNj_EfUl.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"tree-DNj_EfUl.js","names":["AriaTree","Tree","AriaTreeItem","TreeItem","IconSlot","React","classNames","TreeConfigContext","createContext","Tree$1","forwardRef","rest","config","useMemo","checkboxes","selectionMode","selectionBehavior","expandIcon","Tree","autoFocus","className","renderEmptyState","children","TreeItemToggle","useContext","props","ref","useContextProps","ButtonContext","useButton","disabled","buttonProps","TreeItemCheckbox","useSlottedContext","CheckboxContext","state","useToggleState","useRef","useCheckbox","inputProps","renderRow","TreeItemBody","hasChildItems","isDisabled","icon","label","TreeItem$1","text","textValue","TreeItem","isSelected","isExpanded","style","level","TreeItemContent","items","Collection"],"sources":["../../src/components/tree/context.ts","../../src/components/tree/Tree.tsx","../../src/components/tree/TreeItem.tsx"],"sourcesContent":["import { createContext } from 'react'\n\nimport { IconValue } from '../../utils/iconConfig'\n\n// What a `Tree` tells its items: whether a selectable item draws a checkbox, and the chevron to\n// draw. Private to this folder: an item reads it, nothing outside the tree does.\nexport interface TreeConfig {\n checkboxes: boolean\n expandIcon?: IconValue\n}\n\nexport const TreeConfigContext = createContext<TreeConfig>({ checkboxes: false })\n","import React, { CSSProperties, forwardRef, ReactElement, ReactNode, Ref, useMemo } from 'react'\nimport classNames from 'classnames'\nimport { Key, Selection, Tree as AriaTree } from 'react-aria-components'\n\nimport { IconValue } from '../../utils/iconConfig'\nimport { TreeConfigContext } from './context'\nimport './Tree.scss'\n\nexport interface TreeProps<T extends object> {\n /**\n * An accessible name for the tree, when no visible heading names it.\n */\n 'aria-label'?: string\n /**\n * The id of the visible heading that names the tree.\n */\n 'aria-labelledby'?: string\n /**\n * Focus the tree when it mounts: `true` or `'first'` focuses its first item, `'last'` its last.\n */\n autoFocus?: boolean | 'first' | 'last'\n /**\n * Draw a checkbox in every item, which selects the item. On by default with\n * `selectionMode=\"multiple\"` and the `'toggle'` selection behavior, off otherwise.\n */\n checkboxes?: boolean\n /**\n * `TreeItem` elements, or a render function called once per entry of `items`, returning that\n * entry's `TreeItem`.\n */\n children: ReactNode | ((item: T) => ReactElement)\n /**\n * A string of all className you want applied to the component.\n */\n className?: string\n /**\n * The keys of the items expanded at first (uncontrolled).\n */\n defaultExpandedKeys?: Iterable<Key>\n /**\n * The keys of the items selected at first (uncontrolled): `'all'`, or an iterable of keys.\n */\n defaultSelectedKeys?: 'all' | Iterable<Key>\n /**\n * Values that should rebuild the items when using the `items`/render-function form of\n * `children` — e.g. a value from outside `items` that the render function reads. Without this,\n * changing that value won't re-render the items, which are only rebuilt when `items` or\n * `dependencies` change by reference.\n */\n dependencies?: ReadonlyArray<unknown>\n /**\n * Whether `disabledKeys` disables every interaction with an item, or only its selection.\n *\n * @default 'all'\n */\n disabledBehavior?: 'all' | 'selection'\n /**\n * The keys of the items that are disabled.\n */\n disabledKeys?: Iterable<Key>\n /**\n * Keep at least one item selected: the last selected item can't be deselected.\n */\n disallowEmptySelection?: boolean\n /**\n * The keys of the expanded items (controlled).\n */\n expandedKeys?: Iterable<Key>\n /**\n * The chevron of an item with child items, in place of `IconProvider`'s `expand` icon: an icon\n * name, or an element.\n */\n expandIcon?: IconValue\n /**\n * The id of the tree element.\n */\n id?: string\n /**\n * The data to render as items, through the function form of `children`.\n */\n items?: Iterable<T>\n /**\n * Called with an item's key when the item is activated: with Enter, or with a click when the\n * tree has no selection. An item's own `onAction` is called too.\n */\n onAction?: (key: Key) => void\n /**\n * Called with the keys of the expanded items when an item expands or collapses.\n */\n onExpandedChange?: (keys: Set<Key>) => void\n /**\n * Called with the keys of the selected items (`'all'`, or a `Set`) when the selection changes.\n */\n onSelectionChange?: (keys: Selection) => void\n /**\n * What to render in place of the items when there are none.\n */\n renderEmptyState?: () => ReactNode\n /**\n * The keys of the selected items (controlled): `'all'`, or an iterable of keys.\n */\n selectedKeys?: 'all' | Iterable<Key>\n /**\n * How a click changes a multiple selection: `'toggle'` adds or removes the clicked item,\n * `'replace'` selects it alone, with Ctrl, Cmd and Shift for more, as a file manager does.\n *\n * @default 'toggle'\n */\n selectionBehavior?: 'toggle' | 'replace'\n /**\n * Whether items can be selected, and how many at a time.\n *\n * @default 'none'\n */\n selectionMode?: 'none' | 'single' | 'multiple'\n /**\n * Inline styles for the tree element.\n */\n style?: CSSProperties\n}\n\nconst TreeInner = <T extends object>(\n {\n autoFocus,\n checkboxes,\n children,\n className,\n expandIcon,\n renderEmptyState,\n selectionBehavior = 'toggle',\n selectionMode = 'none',\n ...rest\n }: TreeProps<T>,\n ref: Ref<HTMLDivElement>\n) => {\n // A checkbox per item is the toggle behavior's way of selecting several; the replace behavior\n // selects by click, as a file manager does.\n const config = useMemo(\n () => ({\n checkboxes: checkboxes ?? (selectionMode === 'multiple' && selectionBehavior === 'toggle'),\n expandIcon\n }),\n [checkboxes, expandIcon, selectionBehavior, selectionMode]\n )\n\n // react-aria-components builds the collection from `children`, flattens it by `expandedKeys`\n // and renders every visible item as a row of a `treegrid`, on the server too, so the server's\n // HTML holds the expanded items.\n return (\n <TreeConfigContext.Provider value={config}>\n <AriaTree\n {...rest}\n // react-aria focuses the tree element itself for `true`; the first item is what a\n // keyboard user expects.\n autoFocus={autoFocus === true ? 'first' : autoFocus}\n className={classNames('tree', className)}\n ref={ref}\n renderEmptyState={renderEmptyState && (() => renderEmptyState())}\n selectionBehavior={selectionBehavior}\n selectionMode={selectionMode}\n >\n {children}\n </AriaTree>\n </TreeConfigContext.Provider>\n )\n}\n\n// `forwardRef` erases type parameters, so the generic component is cast back to a generic\n// signature for callers — the pattern `DataGrid` uses.\nexport const Tree = forwardRef(TreeInner) as <T extends object>(\n props: TreeProps<T> & { ref?: Ref<HTMLDivElement> }\n) => ReactElement\n\n;(Tree as { displayName?: string }).displayName = 'Tree'\n","import React, {\n CSSProperties,\n forwardRef,\n ReactElement,\n ReactNode,\n Ref,\n useContext,\n useRef\n} from 'react'\nimport classNames from 'classnames'\nimport { AriaButtonProps, AriaCheckboxProps, useButton, useCheckbox } from 'react-aria'\nimport { useToggleState } from 'react-stately'\nimport {\n ButtonContext,\n ButtonProps,\n CheckboxContext,\n CheckboxProps,\n Collection,\n Key,\n TreeItem as AriaTreeItem,\n TreeItemContent,\n TreeItemContentRenderProps,\n useContextProps,\n useSlottedContext\n} from 'react-aria-components'\n\nimport { IconSlot } from '../icon/iconSlot'\nimport { TreeConfigContext } from './context'\n\nexport interface TreeItemProps<T extends object = object> {\n /**\n * The item's child items: `TreeItem` elements, or a render function called once per entry of\n * `items`, returning that entry's `TreeItem`.\n */\n children?: ReactNode | ((item: T) => ReactElement)\n /**\n * A string of all className you want applied to the item.\n */\n className?: string\n /**\n * Values that should rebuild the child items when using the `items`/render-function form of\n * `children`, as `Tree`'s `dependencies`.\n */\n dependencies?: ReadonlyArray<unknown>\n /**\n * Toggle the disabled state for the item, as a key in the tree's `disabledKeys` does.\n */\n disabled?: boolean\n /**\n * An icon drawn before the label.\n */\n icon?: ReactNode\n /**\n * The item's key, named by `expandedKeys`, `selectedKeys` and `disabledKeys`. Defaults to the\n * key of the data entry the item renders, or to the item's position.\n */\n id?: Key\n /**\n * The data to render as child items, through the function form of `children`.\n */\n items?: Iterable<T>\n /**\n * The item's content.\n */\n label: ReactNode\n /**\n * Called when the item is activated: with Enter, or with a click when the tree has no\n * selection.\n */\n onAction?: () => void\n /**\n * Inline styles for the item's row.\n */\n style?: CSSProperties\n /**\n * The item's text, which typing a letter in the tree searches. Defaults to `label` when it is a\n * string.\n */\n textValue?: string\n}\n\n// The chevron: a button react-aria-components hands its props (the toggle, \"Expand\"/\"Collapse\"\n// named after the row, out of the tab order) through `ButtonContext`'s `chevron` slot, and whose\n// ref it checks for, so it is read from that slot rather than rendered as its own `Button`. The\n// icon goes through `IconSlot`, so `IconProvider` and the tree's `expandIcon` can replace it.\nconst TreeItemToggle = ({ disabled }: { disabled: boolean }) => {\n const { expandIcon } = useContext(TreeConfigContext)\n const [props, ref] = useContextProps({ slot: 'chevron' } as ButtonProps, null, ButtonContext)\n // The slot's `onPress` does nothing on a disabled row, but says nothing of it: the button is\n // disabled too.\n const { buttonProps } = useButton({ ...(props as AriaButtonProps), isDisabled: disabled }, ref)\n return (\n <button {...buttonProps} className=\"tree-item-toggle\" ref={ref}>\n <IconSlot className=\"tree-item-toggle-icon\" icon=\"expand\" override={expandIcon} />\n </button>\n )\n}\n\n// The selection checkbox: react-aria-components publishes its props (selected, disabled, named\n// \"Select\" after the row) on `CheckboxContext`'s `selection` slot, as `DataGridSelectionCell`\n// reads them. A native `<input class=\"check-input\">` takes chassis-css's checkbox styles as is.\nconst TreeItemCheckbox = () => {\n const props = useSlottedContext(CheckboxContext, 'selection') as CheckboxProps\n const state = useToggleState(props as AriaCheckboxProps)\n const ref = useRef<HTMLInputElement>(null)\n const { inputProps } = useCheckbox(props as AriaCheckboxProps, state, ref)\n // `aria-describedby` after the spread: react-aria's own adds ids it never renders (FORMS.md,\n // gotcha 6), on the server only.\n return (\n <input\n {...inputProps}\n aria-describedby={undefined}\n className=\"check-input tree-item-check\"\n ref={ref}\n />\n )\n}\n\n// The row's element. react-aria's `useGridListItem` names the row by itself and a description\n// slot (`aria-labelledby=\"<row> <description>\"`) that nothing renders: the slot id is written on\n// the server and dropped once the browser finds no element with it (FORMS.md, gotcha 6), so the\n// settled row has `aria-label` alone. react-aria-components' `TreeItem` doesn't declare the\n// `render` prop its elements take, hence the cast where it is passed.\nconst renderRow = (props: React.JSX.IntrinsicElements['div']) => (\n <div {...props} aria-labelledby={undefined} />\n)\n\nconst TreeItemBody = ({\n hasChildItems,\n icon,\n isDisabled,\n label,\n selectionMode\n}: Pick<TreeItemContentRenderProps, 'hasChildItems' | 'isDisabled' | 'selectionMode'> & {\n icon?: ReactNode\n label: ReactNode\n}) => {\n const { checkboxes } = useContext(TreeConfigContext)\n return (\n <>\n {hasChildItems ? (\n <TreeItemToggle disabled={isDisabled} />\n ) : (\n <span className=\"tree-item-spacer\" />\n )}\n {checkboxes && selectionMode !== 'none' && <TreeItemCheckbox />}\n {icon != null && (\n <span aria-hidden=\"true\" className=\"tree-item-icon\">\n {icon}\n </span>\n )}\n <span className=\"tree-item-label\">{label}</span>\n </>\n )\n}\n\nconst TreeItemInner = <T extends object>(\n {\n children,\n className,\n dependencies,\n disabled,\n icon,\n id,\n items,\n label,\n onAction,\n style,\n textValue\n }: TreeItemProps<T>,\n ref: Ref<HTMLDivElement>\n) => {\n const text =\n textValue ?? (typeof label === 'string' || typeof label === 'number' ? String(label) : '')\n\n // The row is a `div` with `role=\"row\"`, holding one `gridcell` with the content; child items\n // render as the rows after it, not inside it. `--cx-tree-level` carries the level to the\n // stylesheet, which indents by it; written prefixed here because the build prefixes the\n // stylesheet's custom properties, not this inline one.\n return (\n <AriaTreeItem\n className={({ isDisabled, isExpanded, isSelected }) =>\n classNames(\n 'tree-item',\n { active: isSelected, disabled: isDisabled, expanded: isExpanded },\n className\n )\n }\n id={id}\n isDisabled={disabled}\n onAction={onAction}\n ref={ref}\n {...({ render: renderRow } as object)}\n style={({ level }) => ({ ...style, '--cx-tree-level': level }) as CSSProperties}\n textValue={text}\n >\n <TreeItemContent>\n {({ hasChildItems, isDisabled, selectionMode }) => (\n <TreeItemBody\n hasChildItems={hasChildItems}\n icon={icon}\n isDisabled={isDisabled}\n label={label}\n selectionMode={selectionMode}\n />\n )}\n </TreeItemContent>\n {items ? (\n <Collection dependencies={dependencies} items={items}>\n {children as (item: T) => ReactElement}\n </Collection>\n ) : typeof children === 'function' ? null : (\n // A render function with no `items` has nothing to render: the leaf of a tree whose\n // one function renders every level.\n children\n )}\n </AriaTreeItem>\n )\n}\n\n/**\n * An item of a `Tree`: a row with a label, an optional icon, and child items among its children.\n */\nexport const TreeItem = forwardRef(TreeItemInner) as <T extends object = object>(\n props: TreeItemProps<T> & { ref?: Ref<HTMLDivElement> }\n) => ReactElement\n\n;(TreeItem as { displayName?: string }).displayName = 'TreeItem'\n"],"mappings":"A,meAWA,MAAaO,EAAoBC,EAA0B,CAAE,WAAY,EAAM,CAAC,EC8JnEP,EAAOS,GA/ClB,CACE,YACA,aACA,WACA,YACA,aACA,mBACA,oBAAoB,SACpB,gBAAgB,OAChB,GAAGC,GAEL,IACG,CAGH,IAAMC,EAASC,OACN,CACL,WAAYC,IAAeC,IAAkB,YAAcC,IAAsB,UACjF,YACF,GACA,CAACF,EAAYG,EAAYD,EAAmBD,CAAa,CAC3D,EAKA,MACE,kBAAA,cAACR,EAAkB,SAAnB,CAA4B,MAAOK,CAcP,EAb1B,kBAAA,cAACZ,EAAD,CACE,GAAIW,EAGJ,UAAWQ,IAAc,GAAO,QAAUA,EAC1C,UAAWb,EAAW,OAAQc,CAAS,EAClC,MACL,iBAAkBC,QAA2BA,EAAiB,GAC3C,oBACJ,eAGP,EADPC,CACO,CACgB,CAEhC,CAIwC,EAIvC,EAAmC,YAAc,OCxFlD,MAAMC,GAAkB,CAAE,cAAsC,CAC9D,GAAM,CAAE,cAAeC,EAAWjB,CAAiB,EAC7C,CAACkB,EAAOC,GAAOC,EAAgB,CAAE,KAAM,SAAU,EAAkB,KAAMC,CAAa,EAGtF,CAAE,eAAgBC,EAAU,CAAE,GAAIJ,EAA2B,WAAYK,CAAS,EAAGJ,CAAG,EAC9F,MACE,kBAAA,cAAC,SAAD,CAAQ,GAAIK,EAAa,UAAU,mBAAwB,KAEnD,EADN,kBAAA,cAAC3B,EAAD,CAAU,UAAU,wBAAwB,KAAK,SAAS,SAAUa,CAAa,CAAA,CAC3E,CAEZ,EAKMe,MAAyB,CAC7B,IAAMP,EAAQQ,EAAkBC,EAAiB,WAAW,EACtDC,EAAQC,EAAeX,CAA0B,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BACT,OACM,aACL,QACQ,eAChB,CAAA,CAEY,EAChBc,EACC,kBAAA,cAACC,EAAD,CAA0B,eAAqB,OAEnC,EADTlC,CACS,EACV,OAAOA,GAAa,WAAa,KAGnCA,CAEU,CAElB,CAKgD,EAI/C,EAAuC,YAAc,W"}
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{t as e}from"./useForkedRef-WoqMqsWE.js";import{useRef as t}from"react";import{useButton as n}from"react-aria";const r=(r,{disabled:i,onClick:a})=>{let o=t(null),s=e(r,o),{buttonProps:c}=n({elementType:`div`,isDisabled:i,onClick:a},o);return{buttonProps:c,forkedRef:s}};export{r as t};
|
|
2
|
-
//# sourceMappingURL=useButtonSemantics-B1SbGaDO.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"useButtonSemantics-B1SbGaDO.js","names":["useForkedRef","useButtonSemantics","buttonRef","useRef","forkedRef","ref","useButton","disabled"],"sources":["../../src/hooks/useButtonSemantics.ts"],"sourcesContent":["import { MouseEventHandler, Ref, RefObject, useRef } from 'react'\nimport { AriaButtonProps, useButton } from 'react-aria'\n\nimport { useForkedRef } from './useForkedRef'\n\ninterface UseButtonSemanticsOptions<T extends HTMLElement> {\n disabled?: boolean\n onClick?: MouseEventHandler<T>\n}\n\n// Synthesizes native button semantics (role, tabIndex, Enter/Space activation) for a\n// non-native `component` — a `<button>`/`<a>`/`<input>` gets all of this for free from the\n// browser, but an arbitrary `component` (e.g. `'div'`, `'span'`) doesn't. Shared by\n// `Link`/`Button`/`CloseButton`, which otherwise duplicated this ref/hook wiring near-verbatim.\n// `elementType: 'div'` and the `HTMLDivElement` cast below are fixed regardless of the actual\n// rendered tag — `useButton` only uses `elementType` to pick which ARIA attributes apply\n// (a `div`-shaped set is the right one for an arbitrary non-native element either way), not to\n// constrain the ref's real type.\nexport const useButtonSemantics = <T extends HTMLElement>(\n ref: Ref<T>,\n { disabled, onClick }: UseButtonSemanticsOptions<T>\n) => {\n const buttonRef = useRef<T | null>(null)\n const forkedRef = useForkedRef(ref, buttonRef)\n const buttonAriaProps: AriaButtonProps<'div'> = {\n elementType: 'div',\n isDisabled: disabled,\n onClick: onClick as unknown as AriaButtonProps<'div'>['onClick']\n }\n const { buttonProps } = useButton(buttonAriaProps, buttonRef as RefObject<HTMLDivElement | null>)\n\n return { buttonProps, forkedRef }\n}\n"],"mappings":"A,qHAkBA,MAAaC,GACX,EACA,CAAE,WAAU,aACT,CACH,IAAMC,EAAYC,EAAiB,IAAI,EACjCC,EAAYJ,EAAaK,EAAKH,CAAS,EAMvC,CAAE,eAAgBI,EAAU,CAJhC,YAAa,MACb,WAAYC,EACH,SAEqC,EAAGL,CAA6C,EAEhG,MAAO,CAAE,cAAa,WAAU,CAClC,E"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"useDialogElement-BfygWBPZ.js","names":["useForkedRef","useIsomorphicLayoutEffect","executeAfterTransition","pushOverlay","hasOverlayWithin","restoreTargets","resolveRestoreTarget","seen","target","trigger","owner","useDialogElement","isModal","dialogRef","useRef","forkedRef","ref","_visible","setVisible","useControllableState","visible","defaultVisible","open","onVisibleChange","phase","setPhaseState","useState","phaseRef","setPhase","next","staticBounce","setStaticBounce","scrollLocked","setScrollLocked","openedAsModalRef","lockedScrollRef","triggerRef","usePreventScroll","close","onClose","triggerStaticBounce","onClosePrevented","dialog","instant","callbacks","callbacksRef","finishHide","active","ownsFocus","current","lockScroll","autofocusEl","element","useEffect","mountedRef","isOpen","onClick","event","backdrop","keyboard","onKeyDown"],"sources":["../../src/hooks/useDialogElement.ts"],"sourcesContent":["import {\n ForwardedRef,\n KeyboardEvent as ReactKeyboardEvent,\n KeyboardEventHandler,\n MouseEvent as ReactMouseEvent,\n MouseEventHandler,\n SyntheticEvent,\n useEffect,\n useRef,\n useState\n} from 'react'\nimport { usePreventScroll } from 'react-aria'\n\nimport { useControllableState } from './useControllableState'\nimport { useForkedRef } from './useForkedRef'\nimport { useIsomorphicLayoutEffect } from './useIsomorphicLayoutEffect'\nimport { executeAfterTransition } from '../utils/dialogTransition'\nimport { hasOverlayWithin, pushOverlay } from '../utils/overlayStack'\n\nexport interface UseDialogElementOptions {\n /**\n * Same-named prop from the caller (`Modal`/`Drawer`) — only ever consulted here to\n * distinguish `'static'` from everything else for the backdrop-click/Escape bounce.\n */\n backdrop?: boolean | 'static'\n /**\n * Initial open state of an uncontrolled dialog.\n */\n defaultVisible?: boolean\n /**\n * Disables the open/close transition entirely.\n */\n instant?: boolean\n /**\n * Whether this open should use `showModal()` (top-layer, native backdrop, scroll-locked) or\n * `show()` — `Modal` passes its own `modal` prop straight through; `Drawer` derives it from\n * `backdrop`/`scroll` instead, since its vanilla chassis-css counterpart does the same.\n */\n isModal: boolean\n /**\n * Whether a modal open locks the page's scroll, for as long as the dialog is open. Defaults to\n * `isModal`. `Drawer` passes `!scroll`: its `scroll` lets the page scroll behind a drawer that is\n * still modal for its backdrop.\n */\n lockScroll?: boolean\n /**\n * Closes on the escape key / native `cancel` event.\n */\n keyboard?: boolean\n /**\n * Fires synchronously right before a closed dialog actually opens (after the \"already open\"\n * bail-out, before capturing the pre-open trigger element) — `Drawer`'s only hook into the\n * show effect, used to auto-close every other open drawer first.\n */\n onBeforeShow?: (dialog: HTMLDialogElement) => void\n /**\n * The caller's own `onClick`, chained ahead of the backdrop-click handling below rather than\n * left in the props spread — a `<dialog>` needs `onClick` for its own backdrop detection, so\n * spreading the caller's alongside it silently dropped one of the two. Fires for every click\n * on the dialog, not just backdrop ones.\n */\n onClick?: MouseEventHandler<HTMLDialogElement>\n onClose?: () => void\n onClosePrevented?: () => void\n onHidden?: () => void\n /**\n * The caller's own `onKeyDown`, chained ahead of the Escape handling of a non-modal dialog, for\n * the reason `onClick` is.\n */\n onKeyDown?: KeyboardEventHandler<HTMLDialogElement>\n onShow?: () => void\n onShown?: () => void\n /**\n * Fired with `false` for each close request, beside `onClose`.\n */\n onVisibleChange?: (visible: boolean) => void\n /**\n * The native `open` attribute the caller renders. Without `visible` or `defaultVisible`, it is\n * the initial state: the dialog is rendered open (non-modal) from the first paint, server HTML\n * included, and stays open until a close request, instead of being closed on mount.\n */\n open?: boolean\n ref: ForwardedRef<HTMLDialogElement>\n /**\n * Controlled open state; `undefined` means uncontrolled.\n */\n visible?: boolean\n}\n\n// Where a dialog is in its show/hide cycle. The native dialog is open in every phase but\n// `closed`: it stays in the top layer for as long as its exit lasts.\ntype DialogPhase = 'closed' | 'opening' | 'open' | 'closing'\n\n// The element each open dialog returns focus to when it closes.\nconst restoreTargets = new WeakMap<HTMLDialogElement, HTMLElement | null>()\n\n// The element a closing dialog returns focus to. A dialog opened from another dialog that has\n// closed since (the second alert of a chain) can't return focus to its trigger, which is hidden,\n// so it follows that dialog's own target, and so on. A loop (going back and forth between two\n// dialogs) gives up.\nfunction resolveRestoreTarget(trigger: HTMLElement | null): HTMLElement | null {\n const seen = new Set<HTMLDialogElement>()\n let target = trigger\n let owner = target?.closest('dialog') ?? null\n while (target && owner && !owner.open) {\n if (seen.has(owner)) return null\n seen.add(owner)\n target = restoreTargets.get(owner) ?? null\n owner = target?.closest('dialog') ?? null\n }\n return target\n}\n\n// Shared open/close machinery for a native `<dialog>`-based component — `Modal`, `Alert` and\n// `Drawer` otherwise duplicated this near-verbatim: forked ref, the show/begin-hide effect\n// (showModal() vs. show(), initial focus, scroll lock), the effect that waits out the enter and\n// exit transitions, the non-modal Escape-key handler (the native `cancel` event only fires for\n// dialogs opened with `showModal()`), the native `close` event, and the static-backdrop \"bounce\"\n// used by both the backdrop-click handler and the Escape/`cancel` handler. What's left in each\n// caller is only what's genuinely component-specific: `Modal`/`Drawer`'s own `_className`\n// building, and `Drawer`'s cross-instance \"auto-close every other open drawer\" registry (wired in\n// via `onBeforeShow`, since it needs to run at one precise point inside the show effect).\n//\n// A dialog has no trigger of its own, so the only change it asks for is a close: Escape, a\n// backdrop click, a close button. That request fires `onClose` and `onVisibleChange(false)`.\n// Controlled by `visible`, the dialog stays open until the caller sets it to `false`; with\n// `defaultVisible` it closes itself.\nexport const useDialogElement = ({\n backdrop,\n defaultVisible,\n instant,\n isModal,\n keyboard = true,\n lockScroll = isModal,\n onBeforeShow,\n onClick,\n onClose,\n onClosePrevented,\n onHidden,\n onKeyDown,\n onShow,\n onShown,\n onVisibleChange,\n open,\n ref,\n visible\n}: UseDialogElementOptions) => {\n const dialogRef = useRef<HTMLDialogElement>(null)\n const forkedRef = useForkedRef(ref, dialogRef)\n\n const [_visible, setVisible] = useControllableState(\n visible,\n defaultVisible ?? open ?? false,\n onVisibleChange\n )\n // A dialog rendered with the native `open` attribute is open before any effect has run.\n const [phase, setPhaseState] = useState<DialogPhase>(open ? 'open' : 'closed')\n // Mirrors `phase` at the moment it is set, not at the next render, as `useTransitionState`\n // does: StrictMode runs the show effect twice on mount, and the second run has to see that the\n // first has shown the dialog. It is also what tells a reopening during the exit from a first\n // opening, and the browser's `close` event from the one that follows our own `close()`.\n const phaseRef = useRef(phase)\n const setPhase = (next: DialogPhase) => {\n phaseRef.current = next\n setPhaseState(next)\n }\n const [staticBounce, setStaticBounce] = useState(false)\n const [scrollLocked, setScrollLocked] = useState(false)\n const openedAsModalRef = useRef(false)\n const lockedScrollRef = useRef(false)\n const triggerRef = useRef<HTMLElement | null>(null)\n\n // Locked from showModal() until the exit transition finishes (see the show/hide effect\n // below) — usePreventScroll releases it automatically on unmount too, even mid-transition.\n usePreventScroll({ isDisabled: !scrollLocked })\n\n // Several things can ask an open dialog to close while it is closing; only the first is a\n // request, for `onClose` as for `onVisibleChange`.\n const close = () => {\n if (!_visible) return\n onClose?.()\n setVisible(false)\n }\n\n const triggerStaticBounce = () => {\n onClosePrevented?.()\n const dialog = dialogRef.current\n if (!dialog) return\n setStaticBounce(true)\n executeAfterTransition(dialog, () => setStaticBounce(false), !instant)\n }\n\n // Read through a ref, kept current every render, so a transition that ends renders later\n // calls the callbacks of that moment, and a caller can pass them inline.\n const callbacks = { onBeforeShow, onHidden, onShow, onShown }\n const callbacksRef = useRef(callbacks)\n callbacksRef.current = callbacks\n\n const finishHide = (dialog: HTMLDialogElement) => {\n // Focus goes back only if this dialog still has it, or nothing does: another dialog\n // opened from this one (the next alert of a chain) keeps its own. Mirrors `Popover`.\n const active = document.activeElement\n const ownsFocus = !active || active === document.body || dialog.contains(active)\n // Settled before `close()`, so the native `close` event it fires isn't taken for the\n // browser's (`handleNativeClose`).\n setPhase('closed')\n if (dialog.open) {\n dialog.close()\n }\n if (lockedScrollRef.current) {\n lockedScrollRef.current = false\n setScrollLocked(false)\n }\n callbacksRef.current.onHidden?.()\n const trigger = ownsFocus ? resolveRestoreTarget(triggerRef.current) : null\n if (trigger && document.contains(trigger)) {\n trigger.focus()\n }\n }\n\n // Show / begin-hide\n useIsomorphicLayoutEffect(() => {\n const dialog = dialogRef.current\n if (!dialog) return\n\n const current = phaseRef.current\n const isShown = current === 'opening' || current === 'open'\n if (_visible === isShown) return\n\n if (_visible) {\n callbacksRef.current.onBeforeShow?.(dialog)\n\n // Reopened while its exit runs, the dialog is still open: it stays as it is, with the\n // trigger and the scroll lock of its first opening, and leaving the `closing` phase drops\n // the wait that would have closed it.\n if (!dialog.open) {\n triggerRef.current =\n document.activeElement instanceof HTMLElement ? document.activeElement : null\n\n restoreTargets.set(dialog, triggerRef.current)\n\n openedAsModalRef.current = isModal\n lockedScrollRef.current = isModal && lockScroll\n if (isModal) {\n dialog.showModal()\n } else {\n dialog.show()\n }\n if (lockedScrollRef.current) setScrollLocked(true)\n\n // `data-autofocus` too: React doesn't write the `autofocus` attribute in a client render\n // (it calls `focus()` on mount, which a closed dialog ignores), so `autoFocus` alone only\n // works in server-rendered HTML.\n // Only this dialog's own: one inside a nested dialog (an `Alert` in a `Modal`) is hidden\n // while that dialog is closed, and focusing it would fail silently.\n const autofocusEl = [\n ...dialog.querySelectorAll<HTMLElement>(\n '[autofocus], [data-autofocus]:not([data-autofocus=\"false\"])'\n )\n ].find((element) => element.closest('dialog') === dialog)\n if (autofocusEl) {\n autofocusEl.focus()\n } else {\n dialog.setAttribute('tabindex', '-1')\n dialog.focus()\n }\n }\n\n callbacksRef.current.onShow?.()\n setPhase('opening')\n return\n }\n\n // Closed by the browser already, with its `close` event still to come.\n if (!dialog.open) {\n finishHide(dialog)\n return\n }\n setPhase('closing')\n }, [_visible])\n\n // Finish the show or the hide once the transition (or lack thereof) completes. A phase that is\n // left before that drops its wait: a dialog closed while it opens never reports `onShown`, and\n // one reopened while it closes is never closed.\n useEffect(() => {\n const dialog = dialogRef.current\n if (!dialog) return undefined\n\n if (phase === 'opening') {\n return executeAfterTransition(\n dialog,\n () => {\n setPhase('open')\n callbacksRef.current.onShown?.()\n },\n !instant\n )\n }\n if (phase === 'closing') {\n return executeAfterTransition(dialog, () => finishHide(dialog), !instant)\n }\n return undefined\n }, [phase])\n\n // Unmounted while open (`{open && <Modal visible>}`), the dialog never reaches `finishHide`, so\n // focus it held fell to `<body>` with it. Focus goes back to the trigger here instead, under the\n // same condition. Whether the dialog held focus is read in the layout cleanup, before React\n // takes the element out; the focus waits for a microtask, by which time the dialog has left the\n // top layer and the trigger is no longer inert. StrictMode's simulated unmount runs this cleanup\n // too, and mounts again within the same task: `mountedRef` tells the two apart.\n const mountedRef = useRef(false)\n useIsomorphicLayoutEffect(() => {\n mountedRef.current = true\n return () => {\n mountedRef.current = false\n const dialog = dialogRef.current\n const active = document.activeElement\n if (!dialog || phaseRef.current === 'closed' || !active || !dialog.contains(active)) return\n const trigger = triggerRef.current\n queueMicrotask(() => {\n if (mountedRef.current) return\n const current = document.activeElement\n if (current && current !== document.body) return\n const target = resolveRestoreTarget(trigger)\n if (target && document.contains(target)) target.focus()\n })\n }\n }, [])\n\n // A modal dialog holds a place among the open overlays for as long as it is open, so Escape\n // doesn't reach a popover or a menu left open under it (`overlayStack`).\n const isOpen = phase !== 'closed'\n useEffect(() => {\n if (!isOpen || !openedAsModalRef.current) return undefined\n return pushOverlay({ nodes: () => [dialogRef.current] })\n }, [isOpen])\n\n // The native `close` event. After our own `close()` the phase is settled and there is nothing\n // left to do. Otherwise the browser closed the dialog by itself: a second Escape in a row,\n // whose `cancel` it doesn't let a page prevent, a `<form method=\"dialog\">`, or a caller's own\n // `close()`. The state follows: a close request, the scroll lock released, `onHidden`. A\n // caller that holds `visible` through that request has a closed dialog until `visible` changes.\n const handleNativeClose = () => {\n const dialog = dialogRef.current\n if (!dialog || phaseRef.current === 'closed') return\n close()\n finishHide(dialog)\n }\n\n // Escape key for non-modal (show()) dialogs — the native `cancel` event below only fires for\n // dialogs opened with showModal(). A React handler, so an Escape that something inside the\n // dialog has handled and stopped never arrives, wherever that thing is portaled. One it has\n // only prevented, or that an overlay open inside this dialog is about to take on `window`\n // (`overlayStack`), is left alone too: Escape closes the innermost overlay only.\n const handleKeyDown = (event: ReactKeyboardEvent<HTMLDialogElement>) => {\n onKeyDown?.(event)\n if (event.key !== 'Escape' || event.defaultPrevented || openedAsModalRef.current) return\n const dialog = dialogRef.current\n if (dialog && hasOverlayWithin(dialog)) return\n event.preventDefault()\n if (!keyboard) {\n triggerStaticBounce()\n return\n }\n close()\n }\n\n const handleCancel = (event: SyntheticEvent<HTMLDialogElement>) => {\n event.preventDefault()\n if (!keyboard) {\n triggerStaticBounce()\n return\n }\n close()\n }\n\n const handleBackdropClick = (event: ReactMouseEvent<HTMLDialogElement>) => {\n onClick?.(event)\n if (event.target !== dialogRef.current || !openedAsModalRef.current) return\n if (backdrop === 'static') {\n triggerStaticBounce()\n return\n }\n close()\n }\n\n return {\n close,\n dialogRef,\n forkedRef,\n handleBackdropClick,\n handleCancel,\n handleKeyDown,\n handleNativeClose,\n hiding: phase === 'closing',\n staticBounce\n }\n}\n"],"mappings":"A,gXA8FA,MAAMK,kBAAiB,IAAI,QAM3B,SAASC,EAAqB,EAAiD,CAC7E,IAAMC,kBAAO,IAAI,IACbC,EAASC,EACTC,EAAQF,GAAQ,QAAQ,QAAQ,GAAK,KACzC,KAAOA,GAAUE,GAAS,CAACA,EAAM,MAAM,CACrC,GAAI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,EAIxB,EA4BE,sBAnD8B,CAC9B,IAAME,EAAS7B,EAAU,QACpB6B,GAAUf,EAAS,UAAY,WACpCW,EAAM,EACNQ,EAAWJ,CAAM,EACnB,EA+CE,OAAQlB,IAAU,UAClB,cACF,CACF,E"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"useDialogTitle-DiB4YDGI.js","names":["useHydrated","useDialogTitle","hydrated","titleId","setTitleId","useState","registerTitle","useCallback","id","current","generatedId"],"sources":["../../src/hooks/useDialogTitle.ts"],"sourcesContent":["import { useCallback, useState } from 'react'\n\nimport { useHydrated } from './useHydrated'\n\nexport type RegisterDialogTitle = (id: string) => () => void\n\n// The title a `Modal` or a `Drawer` is labelled by. `ModalTitle` and `DrawerTitle` register the id\n// they have in the DOM, from a layout effect, and take it out when they unmount, so the dialog's\n// `aria-labelledby` names an element that is there: the generated id of the context, or the `id`\n// a caller gave the title. A dialog with no title has no `aria-labelledby`, which would be a\n// dangling reference, and one that outranks a caller's `aria-label` besides.\n//\n// A server can't know what the dialog's children render, and an effect doesn't run there. Its\n// HTML names `generatedId`, the id a title takes by default, so a dialog rendered open is named\n// before the JavaScript loads; hydration then settles on what registered.\nexport function useDialogTitle(generatedId: string): [string | undefined, RegisterDialogTitle] {\n const hydrated = useHydrated()\n const [titleId, setTitleId] = useState<string>()\n const registerTitle = useCallback<RegisterDialogTitle>((id) => {\n setTitleId(id)\n return () => setTitleId((current) => (current === id ? undefined : current))\n }, [])\n\n return [hydrated ? titleId : generatedId, registerTitle]\n}\n"],"mappings":"A,gGAeA,SAAgBC,EAAe,EAAgE,CAC7F,IAAMC,EAAWF,EAAY,EACvB,CAACG,EAASC,GAAcC,EAAiB,EACzCC,EAAgBC,EAAkC,IACtDH,EAAWI,CAAE,MACAJ,EAAY,GAAaK,IAAYD,EAAK,IAAA,GAAYC,CAAQ,GAC1E,CAAC,CAAC,EAEL,MAAO,CAACP,EAAWC,EAAUO,EAAaJ,CAAa,CACzD,C"}
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{useEffect as e,useRef as t,useState as n}from"react";const r=e=>e.closest(`dialog[open]`)??document.body;function i({close:i,isOpen:a,onHide:o,onShow:s,triggerRef:c}){let[l,u]=n(null);a&&!l?.open&&c.current?u({container:r(c.current),open:!0}):!a&&l?.open&&u({container:l.container,open:!1}),e(()=>{let e=c.current;if(!a||!e)return;let t=r(e);u(e=>e?.open&&e.container===t?e:{container:t,open:!0})},[a]);let d=t(a);e(()=>{d.current!==a&&(d.current=a,a?s?.():o?.())},[a]);let f=a&&!l?.open?null:l?.container??null,p=t(i);return p.current=i,e(()=>{let e=f?.closest(`dialog`);if(!a||!e)return;let t=()=>p.current();return e.addEventListener(`close`,t),()=>e.removeEventListener(`close`,t)},[a,f]),f}function a(e){return{position:`absolute`,...e.style,transform:e.style?.top===void 0?`translateX(-50%)`:`translateY(-50%)`}}function o(e){return e===`entering`||e===`entered`?`fade show`:`fade`}export{o as n,i as r,a as t};
|
|
2
|
-
//# sourceMappingURL=useFloatingOverlay-BuiI_CCn.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"useFloatingOverlay-BuiI_CCn.js","names":["resolvePortalContainer","trigger","useFloatingOverlay","portal","setPortal","useState","isOpen","triggerRef","useEffect","container","current","reportedOpenRef","useRef","onShow","onHide","portalContainer","closeRef","close","dialog","handleClose","getOverlayArrowStyle","arrowProps","getOverlayTransitionClass","phase"],"sources":["../../src/hooks/useFloatingOverlay.ts"],"sourcesContent":["import { CSSProperties, HTMLAttributes, RefObject, useEffect, useRef, useState } from 'react'\n\nimport { TransitionPhase } from './useTransitionState'\n\nexport interface UseFloatingOverlayOptions {\n /**\n * Imperatively closes the overlay — called when the containing `<dialog>` fires its native\n * `close` event. Pass a stable callback (e.g. the trigger state's own `close`) where possible;\n * an inline arrow is fine too, since only its latest value is ever invoked.\n */\n close: () => void\n /**\n * Whether the overlay is currently open — drives `onShow`/`onHide` and portal-container\n * resolution.\n */\n isOpen: boolean\n onHide?: () => void\n onShow?: () => void\n /**\n * Ref to the element that triggers the overlay, used to resolve which `<dialog>` (if any) it\n * lives inside.\n */\n triggerRef: RefObject<HTMLElement | null>\n}\n\n// The open dialog a trigger is in, where its overlay is portaled, so it renders in that dialog's\n// top layer and closes with it. `document.body` otherwise.\nconst resolvePortalContainer = (trigger: HTMLElement): Element =>\n trigger.closest('dialog[open]') ?? document.body\n\n/**\n * Shared portal-container/visibility wiring for `Popover` and `Tooltip`: resolves the `<dialog>`\n * a trigger lives inside (if any), `null` while an open overlay's isn't known yet, fires `onShow`/`onHide`, and resets on the containing dialog's\n * native `close` event. The open state itself is the trigger state's, which each component builds\n * from `visible`/`defaultVisible`/`onVisibleChange` (`toOpenStateProps`). Positioning-specific\n * concerns (placement, arrow, escape/outside-click dismissal) stay in each component.\n */\nexport function useFloatingOverlay({\n close,\n isOpen,\n onHide,\n onShow,\n triggerRef\n}: UseFloatingOverlayOptions): Element | null {\n // The container, and whether it was resolved for the open that is current.\n const [portal, setPortal] = useState<{ container: Element; open: boolean } | null>(null)\n\n // Resolved in the render that opens the overlay, while the trigger the user pressed is in the\n // DOM, so the panel mounts straight into its container. A passive effect resolved it after the\n // panel had mounted into `document.body`: inside a dialog the panel then mounted a second time,\n // its effects ran twice, its state was lost and its first fade with it.\n if (isOpen && !portal?.open && triggerRef.current) {\n setPortal({ container: resolvePortalContainer(triggerRef.current), open: true })\n } else if (!isOpen && portal?.open) {\n setPortal({ container: portal.container, open: false })\n }\n\n // Checked again once the commit is done, after the layout effects that open dialogs: an overlay\n // mounted open has no trigger element in its first render, and one opened in the same commit\n // as the dialog around it found that dialog still closed. Only these move the panel. An overlay\n // waits for its container (`null` while open), so one mounted open mounts its panel once too.\n useEffect(() => {\n const trigger = triggerRef.current\n if (!isOpen || !trigger) return\n const container = resolvePortalContainer(trigger)\n setPortal((current) =>\n current?.open && current.container === container ? current : { container, open: true }\n )\n }, [isOpen])\n\n // `onShow`/`onHide` report changes of the open state, against the value of the last run: not\n // the first commit (mounting closed is not a hide, mounting open not a show), and not\n // StrictMode's second run of the effect on mount, which a `mounted` flag let through.\n const reportedOpenRef = useRef(isOpen)\n useEffect(() => {\n if (reportedOpenRef.current === isOpen) return\n reportedOpenRef.current = isOpen\n if (isOpen) onShow?.()\n else onHide?.()\n }, [isOpen])\n\n // `null` while the container of the current open isn't known yet. Kept through the exit, so a\n // closing panel stays where it is.\n const portalContainer = isOpen && !portal?.open ? null : (portal?.container ?? null)\n\n // `close` is read through a ref so this effect only re-subscribes when `isOpen`/\n // `portalContainer` actually change, regardless of whether the caller passes a stable\n // callback or a fresh inline arrow each render.\n const closeRef = useRef(close)\n closeRef.current = close\n\n // A dialog fires a native `close` event on ESC, backdrop click, or `.close()`, so resetting\n // on it keeps a reopened dialog from showing a stale, already-open overlay.\n useEffect(() => {\n const dialog = portalContainer?.closest('dialog')\n if (!isOpen || !dialog) return\n\n const handleClose = () => closeRef.current()\n dialog.addEventListener('close', handleClose)\n return () => dialog.removeEventListener('close', handleClose)\n }, [isOpen, portalContainer])\n\n return portalContainer\n}\n\n// `useOverlayPosition`'s `arrowProps.style` sets a single cross-axis offset (`top` for a\n// left/right overlay, `left` for a top/bottom one) to the trigger's center point, not the arrow\n// element's top-left corner — so it must be recentered by half the arrow's own size on that\n// axis. Chassis-css's JS plugin never has this problem since Floating UI's `arrow` middleware\n// returns a top-left-corner coordinate directly; react-aria's is center-based. Unlike the\n// chassis-css JS plugin, react-aria also never sets `position: absolute` on the arrow element\n// itself, so without it the offset has no effect and the arrow renders in normal document flow.\nexport function getOverlayArrowStyle(arrowProps: HTMLAttributes<HTMLDivElement>): CSSProperties {\n return {\n position: 'absolute',\n ...arrowProps.style,\n transform: arrowProps.style?.top !== undefined ? 'translateY(-50%)' : 'translateX(-50%)'\n }\n}\n\n// Mounted without `show`, shown once those styles are computed, and without it again for as\n// long as the exit lasts: chassis-css's `.fade` transitions the opacity between the two.\nexport function getOverlayTransitionClass(phase: TransitionPhase): string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SAAU,WACV,GAAGC,EAAW,MACd,UAAWA,EAAW,OAAO,MAAQ,IAAA,GAAiC,mBAArB,kBACnD,CACF,CAIA,SAAgBC,EAA0B,EAAgC,CACxE,OAAOC,IAAU,YAAcA,IAAU,UAAY,YAAc,MACrE,C"}
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{t as e}from"./useIsomorphicLayoutEffect-BbqRwuqn.js";import{t}from"./context-DCg95BgR.js";import{useContext as n,useEffect as r,useRef as i,useState as a}from"react";const o=`input, select, textarea`,s=e=>e.matches(o),c=e=>s(e)?[e]:Array.from(e.querySelectorAll(o)),l=e=>e.willValidate&&!e.validity.valid,u=e=>{let t=e?c(e).filter(e=>e.willValidate):[];return t.length===0?`none`:t.some(l)?`invalid`:`valid`},d=e=>Array.from(e.elements).find(e=>e.validity?.valid===!1),f=(o,{enabled:l=!0,focus:f,invalid:p,valid:m})=>{let h=n(t),g=i(h);g.current=h;let[_,v]=a(!1),[y,b]=a(`none`),x=i(f);x.current=f;let S=i(null);r(()=>{let e=l?o.current:null,t=e?(s(e)?e:c(e)[0])?.form??e.closest(`form`):null,n=S.current;if(n?.target===e&&n?.form===t||(n?.stop(),S.current=null,!e))return;let r=e=>{v(!0),x.current&&(!e.defaultPrevented&&t&&d(t)===e.target&&x.current(),e.preventDefault())},i=()=>v(!1),a=e.ownerDocument.defaultView,f=t=>{if(!(t.target instanceof Node)||!e.contains(t.target))return;let n=u(e);n!==`invalid`&&v(!1),g.current&&b(n)},p=!s(e);e.addEventListener(`invalid`,r,p),a?.addEventListener(`input`,f),a?.addEventListener(`change`,f),t?.addEventListener(`reset`,i),S.current={form:t,stop:()=>{e.removeEventListener(`invalid`,r,p),a?.removeEventListener(`input`,f),a?.removeEventListener(`change`,f),t?.removeEventListener(`reset`,i)},target:e}}),r(()=>()=>{S.current?.stop(),S.current=null},[]),e(()=>{if(!_&&!h)return;let e=u(l?o.current:null);e!==`invalid`&&v(!1),h&&b(e)});let C=p!==void 0||!!m,w=_&&!C,T=h&&!C?y:`none`;return{heldBack:w,invalid:p??(w||T===`invalid`||void 0),valid:m||T===`valid`||void 0}};export{f as t};
|
|
2
|
-
//# sourceMappingURL=useHeldBack-eeTfpa_t.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"useHeldBack-eeTfpa_t.js","names":["useIsomorphicLayoutEffect","CONTROLS","isControl","element","controlsOf","target","holdsBack","control","validityOf","controls","firstInvalidControl","form","useHeldBack","validated","useContext","FormValidatedContext","validatedRef","useRef","blocked","setBlocked","useState","validity","setValidity","focusRef","focus","listening","useEffect","enabled","ref","current","onInvalid","event","onReset","view","onEdit","next","capture","decided","invalid","valid","heldBack","shown"],"sources":["../../src/hooks/useHeldBack.ts"],"sourcesContent":["import { RefObject, useContext, useEffect, useRef, useState } from 'react'\n\nimport { FormValidatedContext } from '../components/form/context'\nimport { useIsomorphicLayoutEffect } from './useIsomorphicLayoutEffect'\n\ntype Control = HTMLInputElement | HTMLSelectElement | HTMLTextAreaElement\n\nexport interface UseHeldBackOptions {\n /**\n * Whether to listen at all. `false` for a field with nothing a form would validate: a value\n * input that is `type=\"hidden\"` until the field is required.\n */\n enabled?: boolean\n /**\n * Moves focus into the field once a form is held back and this control is its first invalid\n * one, and cancels the event: for a control that isn't displayed, which a browser can neither\n * focus nor show a message on. Omit it where react-aria's own listener does both already,\n * which is every control one of its hooks was given.\n */\n focus?: () => void\n /**\n * The caller's `invalid`. Once it is set, to `false` too, the caller decides how the field\n * looks: it is never shown as held back, nor by its form's `validated`.\n */\n invalid?: boolean\n /**\n * The caller's `valid`. While it is `true`, the caller decides how the field looks, as it does\n * once `invalid` is set.\n */\n valid?: boolean\n}\n\nexport interface UseHeldBackResult {\n /**\n * `true` from a submit the field held back until it would no longer hold one back, or its form\n * is reset.\n */\n heldBack: boolean\n /**\n * What the field shows as invalid: the caller's `invalid` where it is set, `true` while\n * `heldBack` or while its form is `validated` and it would hold the form back.\n */\n invalid: boolean | undefined\n /**\n * What the field shows as valid: the caller's `valid`, or `true` while its form is `validated`\n * and it would let the form submit. Unless the caller decides how the field looks.\n */\n valid: boolean | undefined\n}\n\ninterface Listening {\n form: HTMLFormElement | null\n stop: () => void\n target: HTMLElement\n}\n\n// By its tag and not by a `validity` property: a `<fieldset>` has one too, and validates nothing.\nconst CONTROLS = 'input, select, textarea'\nconst isControl = (element: HTMLElement): element is Control => element.matches(CONTROLS)\n\n// The controls a form validates under `target`: itself, or the inputs inside a group.\nconst controlsOf = (target: HTMLElement): Control[] =>\n isControl(target) ? [target] : Array.from(target.querySelectorAll<Control>(CONTROLS))\n\nconst holdsBack = (control: Control) => control.willValidate && !control.validity.valid\n\ntype Validity = 'invalid' | 'none' | 'valid'\n\n// What a form would make of the controls under `target`. `none` when it validates none of them:\n// a disabled control, a `type=\"hidden\"` one, or a group with no control.\nconst validityOf = (target: HTMLElement | null): Validity => {\n const controls = target ? controlsOf(target).filter((control) => control.willValidate) : []\n if (controls.length === 0) return 'none'\n return controls.some(holdsBack) ? 'invalid' : 'valid'\n}\n\nconst firstInvalidControl = (form: HTMLFormElement) =>\n Array.from(form.elements).find(\n (control) => (control as HTMLInputElement).validity?.valid === false\n )\n\n// A field that held its form back from submitting shows as invalid until it no longer would.\n//\n// A form with an invalid control isn't submitted, and the browser says why in a message beside\n// the first such control. react-aria cancels that message for every control its hooks are given\n// (`useFormValidation` calls `preventDefault()` on the `invalid` event, whatever\n// `validationBehavior` is) and focuses the control instead, and a control that isn't displayed\n// has no message to begin with. Either way the form stayed and nothing said why. A native control\n// no hook is given keeps the browser's message, on the first invalid one alone: the others, and\n// it once the message has gone, looked as they did before the submit. So the field\n// reads the `invalid` event itself and shows it as it shows the `invalid` prop: the class, the\n// ARIA state and the caller's `invalidFeedback`. react-stately's `displayValidation` doesn't\n// have it: it stays empty unless the whole field is under `validationBehavior: 'native'`, which\n// also moves every other validation to blur.\n//\n// A `Form` with `validated` shows each of its fields by the same test from then on, with no\n// submit, and as valid once it would let the form submit (FORMS.md, gotcha 10).\n// chassis-css's own gate, `[data-cx-validate]` with `:user-valid`/`:user-invalid`, styles the\n// control alone, never the feedback the field renders, and wins over the class the caller's\n// `invalid` or `valid` sets.\n//\n// `ref` is the control, or the element around several: the fieldset of a group, the boxes of a\n// code. The event doesn't bubble, so a group hears its controls in the capture phase.\nexport const useHeldBack = (\n ref: RefObject<HTMLElement | null>,\n { enabled = true, focus, invalid, valid }: UseHeldBackOptions\n): UseHeldBackResult => {\n const validated = useContext(FormValidatedContext)\n const validatedRef = useRef(validated)\n validatedRef.current = validated\n const [blocked, setBlocked] = useState(false)\n // Read only while the form is `validated`.\n const [validity, setValidity] = useState<Validity>('none')\n const focusRef = useRef(focus)\n focusRef.current = focus\n const listening = useRef<Listening | null>(null)\n\n // Runs after every render and listens again only when the target is another element (an\n // `Autocomplete` that turns `multiple`) or belongs to another form (`form`). The listeners\n // stay the same ones otherwise: a browser runs the render a listener asked for before it calls\n // the next listener of the same event, and one removed and added again by that render is not\n // called at all. A `reset` after react-aria's own listener, or after the other input's of a\n // `DateRangePicker`, was lost that way.\n useEffect(() => {\n const target = enabled ? ref.current : null\n const form = target\n ? ((isControl(target) ? target : controlsOf(target)[0])?.form ?? target.closest('form'))\n : null\n const current = listening.current\n if (current?.target === target && current?.form === form) return\n current?.stop()\n listening.current = null\n if (!target) return\n\n // `checkValidity()` and `reportValidity()` fire it too, as a submit does.\n const onInvalid = (event: Event) => {\n setBlocked(true)\n if (!focusRef.current) return\n if (!event.defaultPrevented && form && firstInvalidControl(form) === event.target) {\n focusRef.current()\n }\n // Cancelled, as react-aria cancels it: the browser has nothing to show for a control that\n // isn't displayed, and Chromium logs an error for an invalid control it can't focus.\n event.preventDefault()\n }\n const onReset = () => setBlocked(false)\n // A native control that keeps its own value (a `Select` with no `value`, a `FileInput`)\n // changes with no render to follow, and the effect below would never look again.\n //\n // Heard on the window, after React's own listener on its root. For a real keystroke the\n // browser runs the render a listener asks for before the next listener: a render asked for\n // on the control itself ran before React had read the edit, wrote the old value back, and an\n // empty field lost the first character typed into it.\n const view = target.ownerDocument.defaultView\n const onEdit = (event: Event) => {\n if (!(event.target instanceof Node) || !target.contains(event.target)) return\n const next = validityOf(target)\n if (next !== 'invalid') setBlocked(false)\n if (validatedRef.current) setValidity(next)\n }\n const capture = !isControl(target)\n\n target.addEventListener('invalid', onInvalid, capture)\n view?.addEventListener('input', onEdit)\n view?.addEventListener('change', onEdit)\n form?.addEventListener('reset', onReset)\n listening.current = {\n form,\n stop: () => {\n target.removeEventListener('invalid', onInvalid, capture)\n view?.removeEventListener('input', onEdit)\n view?.removeEventListener('change', onEdit)\n form?.removeEventListener('reset', onReset)\n },\n target\n }\n })\n useEffect(\n () => () => {\n listening.current?.stop()\n listening.current = null\n },\n []\n )\n\n // The mark lasts while the field would still hold the form back. Read after each render, where\n // its controls have the values just rendered, and before the paint: the field never shows a\n // value and the mark together. A control that has gone, is disabled or is no longer invalid\n // doesn't hold anything back either.\n // A `validated` form's field is read at the same point, for the same reason.\n useIsomorphicLayoutEffect(() => {\n if (!blocked && !validated) return\n const next = validityOf(enabled ? ref.current : null)\n if (next !== 'invalid') setBlocked(false)\n if (validated) setValidity(next)\n })\n\n const decided = invalid !== undefined || Boolean(valid)\n const heldBack = blocked && !decided\n const shown = validated && !decided ? validity : 'none'\n return {\n heldBack,\n invalid: invalid ?? (heldBack || shown === 'invalid' || undefined),\n valid: valid || shown === 'valid' || undefined\n }\n}\n"],"mappings":"A,6KAyDA,MAAMC,EAAW,0BACXC,EAAa,GAA6CC,EAAQ,QAAQF,CAAQ,EAGlFG,EAAc,GAClBF,EAAUG,CAAM,EAAI,CAACA,CAAM,EAAI,MAAM,KAAKA,EAAO,iBAA0BJ,CAAQ,CAAC,EAEhFK,EAAa,GAAqBC,EAAQ,cAAgB,CAACA,EAAQ,SAAS,MAM5EC,EAAc,GAAyC,CAC3D,IAAMC,EAAWJ,EAASD,EAAWC,CAAM,CAAC,CAAC,OAAQ,GAAYE,EAAQ,YAAY,EA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,EACMC,EAAU,CAAClC,EAAUG,CAAM,EAEjCA,EAAO,iBAAiB,UAAWyB,EAAWM,CAAO,EACrDH,GAAM,iBAAiB,QAASC,CAAM,EACtCD,GAAM,iBAAiB,SAAUC,CAAM,EACvCvB,GAAM,iBAAiB,QAASqB,CAAO,EACvC,EAAU,QAAU,CAClB,OACA,SAAY,CACV3B,EAAO,oBAAoB,UAAWyB,EAAWM,CAAO,EACxDH,GAAM,oBAAoB,QAASC,CAAM,EACzCD,GAAM,oBAAoB,SAAUC,CAAM,EAC1CvB,GAAM,oBAAoB,QAASqB,CAAO,CAC5C,EACA,QACF,CACF,CAAC,EACDN,UACc,CACVD,EAAU,SAAS,KAAK,EACxB,EAAU,QAAU,IACtB,EACA,CAAC,CACH,EAOAzB,MAAgC,CAC9B,GAAI,CAACkB,GAAW,CAACL,EAAW,OAC5B,IAAMsB,EAAO3B,EAAWmB,EAAUC,EAAI,QAAU,IAAI,EAChDO,IAAS,WAAWhB,EAAW,EAAK,EACpCN,GAAWS,EAAYa,CAAI,CACjC,CAAC,EAED,IAAME,EAAUC,IAAY,IAAA,IAAa,EAAQC,EAC3CC,EAAWtB,GAAW,CAACmB,EACvBI,EAAQ5B,GAAa,CAACwB,EAAUhB,EAAW,OACjD,MAAO,CACL,WACA,QAASiB,IAAYE,GAAYC,IAAU,WAAa,IAAA,IACxD,MAAOF,GAASE,IAAU,SAAW,IAAA,EACvC,CACF,E"}
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{t as e}from"./useIsomorphicLayoutEffect-BbqRwuqn.js";import{useEffect as t,useRef as n}from"react";const r=/* @__PURE__ */ new WeakMap,i=e=>{let t=e.style.maxHeight;t!==r.get(e)&&(r.delete(e)&&e.style.removeProperty(`overflow-y`),t&&(e.style.removeProperty(`max-height`),!(Number.parseFloat(t)>=Number.parseFloat(getComputedStyle(e).maxHeight))&&(e.style.maxHeight=t,e.style.overflowY=`auto`,r.set(e,t))))};function a(r,a){let o=n(null);e(()=>{let e=a?r.current:null,t=o.current;if(e&&i(e),t?.node===e||(t?.observer.disconnect(),o.current=null,!e||typeof MutationObserver>`u`))return;let n=new MutationObserver(()=>i(e));n.observe(e,{attributes:!0,attributeFilter:[`style`]}),o.current={node:e,observer:n}}),t(()=>()=>{o.current?.observer.disconnect(),o.current=null},[])}export{a as t};
|
|
2
|
-
//# sourceMappingURL=useOverlayMaxHeight-DTgbr4UQ.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"useOverlayMaxHeight-DTgbr4UQ.js","names":["useIsomorphicLayoutEffect","kept","fitToRoom","room","node","useOverlayMaxHeight","observedRef","useRef","isOpen","overlayRef","observed","observer","useEffect"],"sources":["../../src/hooks/useOverlayMaxHeight.ts"],"sourcesContent":["import { RefObject, useEffect, useRef } from 'react'\n\nimport { useIsomorphicLayoutEffect } from './useIsomorphicLayoutEffect'\n\n// The room a panel keeps, by panel, so that writing it back isn't read as a new placement.\nconst kept = new WeakMap<HTMLElement, string>()\n\nconst fitToRoom = (node: HTMLElement) => {\n const room = node.style.maxHeight\n if (room === kept.get(node)) return\n if (kept.delete(node)) node.style.removeProperty('overflow-y')\n if (!room) return\n node.style.removeProperty('max-height')\n // `none` parses to NaN, which no room reaches: with no cap, the room is the height.\n if (Number.parseFloat(room) >= Number.parseFloat(getComputedStyle(node).maxHeight)) return\n node.style.maxHeight = room\n node.style.overflowY = 'auto'\n kept.set(node, room)\n}\n\n// Gives a `.menu` panel the smaller of chassis-css's `--cx-menu-max-height` and the room\n// react-aria's `useOverlayPosition` finds for it beside its trigger. The hook writes that room as\n// an inline `max-height`, on the element itself rather than in the style it returns, and again each\n// time it places the overlay (a resize, the overlay's own size changing). Inline, it outranks the\n// theme's cap: a `Combobox` list 360.5px tall against a 320px token. So it is taken off where the\n// cap is smaller, and kept where it is the smaller one, with the list scrolling inside it: a menu\n// taller than the room on either side of its trigger otherwise runs off the viewport. Each write\n// is handled before the paint.\n//\n// For `Menu`, `MenuSubmenu`, `ContextMenu`, `Combobox` and `Autocomplete`, which take only the\n// position from the hook (`resolveMenuOverlayPositioning`). Call it after `useOverlayPosition`, so\n// its layout effect runs after the hook's own.\nexport function useOverlayMaxHeight(overlayRef: RefObject<HTMLElement | null>, isOpen: boolean) {\n const observedRef = useRef<{ node: HTMLElement; observer: MutationObserver } | null>(null)\n\n // Every commit: the panel can be a new element (a list moved into a dialog), and the hook\n // places it again in its own layout effect.\n useIsomorphicLayoutEffect(() => {\n const node = isOpen ? overlayRef.current : null\n const observed = observedRef.current\n if (node) fitToRoom(node)\n if (observed?.node === node) return\n observed?.observer.disconnect()\n observedRef.current = null\n if (!node || typeof MutationObserver === 'undefined') return\n const observer = new MutationObserver(() => fitToRoom(node))\n observer.observe(node, { attributes: true, attributeFilter: ['style'] })\n observedRef.current = { node, observer }\n })\n\n useEffect(\n () => () => {\n observedRef.current?.observer.disconnect()\n observedRef.current = null\n },\n []\n )\n}\n"],"mappings":"A,0GAKA,MAAMC,kBAAO,IAAI,QAEXC,EAAa,GAAsB,CACvC,IAAMC,EAAOC,EAAK,MAAM,UACpBD,IAASF,EAAK,IAAIG,CAAI,IACtBH,EAAK,OAAOG,CAAI,GAAGA,EAAK,MAAM,eAAe,YAAY,EACxDD,IACLC,EAAK,MAAM,eAAe,YAAY,EAElC,SAAO,WAAWD,CAAI,GAAK,OAAO,WAAW,iBAAiBC,CAAI,CAAC,CAAC,SAAS,KACjF,EAAK,MAAM,UAAYD,EACvB,EAAK,MAAM,UAAY,OACvBF,EAAK,IAAIG,EAAMD,CAAI,IACrB,EAcA,SAAgBE,EAAoB,EAA2C,EAAiB,CAC9F,IAAMC,EAAcC,EAAiE,IAAI,EAIzFP,MAAgC,CAC9B,IAAMI,EAAOI,EAASC,EAAW,QAAU,KACrCC,EAAWJ,EAAY,QAK7B,GAJIF,GAAMF,EAAUE,CAAI,EACpBM,GAAU,OAASN,IACvBM,GAAU,SAAS,WAAW,EAC9B,EAAY,QAAU,KAClB,CAACN,GAAQ,OAAO,iBAAqB,KAAa,OACtD,IAAMO,EAAW,IAAI,qBAAuBT,EAAUE,CAAI,CAAC,EAC3DO,EAAS,QAAQP,EAAM,CAAE,WAAY,GAAM,gBAAiB,CAAC,OAAO,CAAE,CAAC,EACvE,EAAY,QAAU,CAAE,OAAM,UAAS,CACzC,CAAC,EAEDQ,UACc,CACVN,EAAY,SAAS,SAAS,WAAW,EACzC,EAAY,QAAU,IACxB,EACA,CAAC,CACH,CACF,C"}
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{t as e}from"./useForkedRef-WoqMqsWE.js";import{t}from"./useControllableState-CPUJxfKW.js";import{t as n}from"./useIsomorphicLayoutEffect-BbqRwuqn.js";import{t as r}from"./useHydrated-Dud4JEwp.js";import{t as i}from"./visibleState-CWyQak65.js";import{t as a}from"./useTransitionState-sQUQey74.js";import{useCallback as o,useEffect as s,useId as c,useRef as l}from"react";import{mergeProps as u,useToastRegion as d}from"react-aria";import{useToastQueue as f}from"react-stately";const p=2**31-1;function m({enabled:e=!1,delay:t=5e3,visible:n,onHide:r}){let i=l(void 0),a=l(!1),c=l(!1),u=o(()=>{clearTimeout(i.current),i.current=void 0},[]),d=o(()=>{u(),!(!e||!Number.isFinite(t)||t>p||a.current||c.current)&&(i.current=window.setTimeout(r,t))},[e,t,r,u]);return s(()=>u,[u]),s(()=>{n?d():(u(),a.current=!1,c.current=!1)},[n,e,t,d,u]),{onMouseEnter:o(()=>{a.current=!0,u()},[u]),onMouseLeave:o(()=>{a.current=!1,d()},[d]),onFocus:o(()=>{c.current=!0,u()},[u]),onBlur:o(()=>{c.current=!1,d()},[d])}}function h({defaultVisible:n,displayName:u,onClose:d,onShow:f,onVisibleChange:p,ref:m,visible:h}){let g=h!==void 0,[_,v]=t(h,n,p),y=l(null),b=e(m,y),x=c(),S=c(),C=l(!1),w=l(d);w.current=d;let T=o(()=>{C.current&&(C.current=!1,w.current?.())},[]),E=l(()=>{});E.current=()=>{_&&(g||(C.current=!0),i({onVisibleChange:p,visible:h},!1,u),v(!1))};let D=o(()=>E.current(),[]),O=r(),{isMounted:k,phase:A}=a({appear:O,in:_,nodeRef:y,onEnter:()=>{C.current=!1,f?.()},onExit:()=>{C.current=!0},onExited:T,unmountOnExit:!0});s(()=>T,[T]);let j=l(!O&&_);return s(()=>{j.current&&(j.current=!1,f?.())},[]),{close:D,entered:A===`entered`,forkedRef:b,isMounted:k,textId:S,titleId:x,transitionClass:A===`entering`||A===`exiting`?`show showing`:A===`entered`?`show`:void 0,visible:_}}const g=e=>{let t=e.querySelector(`a[href], button:not([disabled]), input:not([disabled]), select:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex="-1"])`);t?t.focus():(e.hasAttribute(`tabindex`)||e.setAttribute(`tabindex`,`-1`),e.focus())};function _(t,r){let i=f(t),a=l(null),{regionProps:o}=d({},i,a),s=e(r,a),c=l(-1),p=l(null);return n(()=>{let e=c.current;if(e===-1)return;let t=a.current?Array.from(a.current.children):[],n=document.activeElement;if(n&&n!==document.body){let e=t.findIndex(e=>e.contains(n));e!==-1&&(c.current=e);return}let r=t[e]??t[e-1];if(r){g(r);return}c.current=-1;let i=p.current;p.current=null,i?.isConnected&&i.focus()},[i.visibleToasts]),{forkedRef:s,regionProps:u(o,{onFocus:e=>{let t=e.currentTarget;c.current=Array.from(t.children).findIndex(t=>t.contains(e.target));let n=e.relatedTarget;n instanceof HTMLElement&&!t.contains(n)&&(p.current=n)},onBlur:e=>{let t=e.relatedTarget;t&&!e.currentTarget.contains(t)&&(c.current=-1,p.current=null)}}),state:i}}export{h as n,m as r,_ as t};
|
|
2
|
-
//# sourceMappingURL=useToastRegionQueue-CuAMxAIA.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"useToastRegionQueue-CuAMxAIA.js","names":["useForkedRef","useIsomorphicLayoutEffect","useHydrated","warnDroppedVisibleRequest","useTransitionState","MAX_TIMEOUT_DELAY","useAutoDismiss","timeout","useRef","hasMouseInteraction","hasKeyboardInteraction","clearAutoDismissTimeout","useCallback","maybeScheduleHide","enabled","delay","onHide","useEffect","visible","useDismissibleTransition","isControlled","_visible","setVisible","useControllableState","defaultVisible","onVisibleChange","nodeRef","forkedRef","ref","titleId","useId","textId","closeOwedRef","onCloseRef","onClose","reportClose","requestHideRef","displayName","close","hydrated","onShow","showOwedRef","phase","focusToast","control","toast","useToastRegionQueue","state","useToastQueue","queue","regionRef","useToastRegion","focusedIndexRef","returnFocusRef","index","toasts","active","moved","next","back","mergeProps","regionProps","region","event","child","from","to"],"sources":["../../src/hooks/useAutoDismiss.ts","../../src/hooks/useDismissibleTransition.ts","../../src/hooks/useToastRegionQueue.ts"],"sourcesContent":["import { useCallback, useEffect, useRef } from 'react'\n\nexport interface UseAutoDismissOptions {\n /**\n * Enables the auto-dismiss timer. When `false`, `onHide` is never called and the returned\n * handlers are no-ops.\n */\n enabled?: boolean\n /**\n * Delay in ms before `onHide` fires once the timer is (re)started. One a timer can't hold (not\n * finite, or over 2^31 - 1 ms) runs no timer.\n */\n delay?: number\n /**\n * Whether the dismissible element is currently visible. The timer only runs while `true`.\n */\n visible: boolean\n /**\n * Called once the delay elapses without an intervening pointer/focus interaction.\n */\n onHide: () => void\n}\n\nexport interface UseAutoDismissResult {\n onMouseEnter: () => void\n onMouseLeave: () => void\n onFocus: () => void\n onBlur: () => void\n}\n\n// The longest delay `setTimeout` holds. A longer one, `Infinity` included, fires at once.\nconst MAX_TIMEOUT_DELAY = 2 ** 31 - 1\n\n// Shared timer logic for components that auto-dismiss after a delay, pausing while the pointer\n// or focus is on the element (mirrors the behavior `Toast` already implements). Extracted so new\n// auto-dismissing components don't reimplement the pause/resume bookkeeping.\nexport function useAutoDismiss({\n enabled = false,\n delay = 5000,\n visible,\n onHide\n}: UseAutoDismissOptions): UseAutoDismissResult {\n // `useRef<number>()` (no argument) isn't valid under @types/react 19 — the overload requires\n // an initial value, and the ref has to admit `undefined` for `clearAutoDismissTimeout` to reset\n // it back to \"no timer scheduled\".\n const timeout = useRef<number | undefined>(undefined)\n const hasMouseInteraction = useRef(false)\n const hasKeyboardInteraction = useRef(false)\n\n const clearAutoDismissTimeout = useCallback(() => {\n clearTimeout(timeout.current)\n timeout.current = undefined\n }, [])\n\n const maybeScheduleHide = useCallback(() => {\n clearAutoDismissTimeout()\n if (\n !enabled ||\n !Number.isFinite(delay) ||\n delay > MAX_TIMEOUT_DELAY ||\n hasMouseInteraction.current ||\n hasKeyboardInteraction.current\n ) {\n return\n }\n timeout.current = window.setTimeout(onHide, delay)\n }, [enabled, delay, onHide, clearAutoDismissTimeout])\n\n // Clears on unmount.\n useEffect(() => clearAutoDismissTimeout, [clearAutoDismissTimeout])\n\n useEffect(() => {\n if (visible) {\n maybeScheduleHide()\n } else {\n clearAutoDismissTimeout()\n // A hidden element has no pointer or focus on it, and one hidden while it had them (by its\n // close button, which takes focus) gets no `mouseleave` or `blur` to say so: shown again,\n // it would never dismiss itself.\n hasMouseInteraction.current = false\n hasKeyboardInteraction.current = false\n }\n }, [visible, enabled, delay, maybeScheduleHide, clearAutoDismissTimeout])\n\n const onMouseEnter = useCallback(() => {\n hasMouseInteraction.current = true\n clearAutoDismissTimeout()\n }, [clearAutoDismissTimeout])\n\n const onMouseLeave = useCallback(() => {\n hasMouseInteraction.current = false\n maybeScheduleHide()\n }, [maybeScheduleHide])\n\n const onFocus = useCallback(() => {\n hasKeyboardInteraction.current = true\n clearAutoDismissTimeout()\n }, [clearAutoDismissTimeout])\n\n const onBlur = useCallback(() => {\n hasKeyboardInteraction.current = false\n maybeScheduleHide()\n }, [maybeScheduleHide])\n\n return { onMouseEnter, onMouseLeave, onFocus, onBlur }\n}\n","import { ForwardedRef, useCallback, useEffect, useId, useRef } from 'react'\n\nimport { useHydrated } from './useHydrated'\nimport { warnDroppedVisibleRequest } from '../utils/visibleState'\nimport { useControllableState } from './useControllableState'\nimport { useForkedRef } from './useForkedRef'\nimport { useTransitionState } from './useTransitionState'\n\nexport interface UseDismissibleTransitionOptions {\n /**\n * Initial state of an uncontrolled component. `Toast` starts hidden, `Notification` shown.\n */\n defaultVisible: boolean\n /**\n * The component's name, for the development warning about a dropped close request.\n */\n displayName: string\n /**\n * Callback fired once the exit transition completes and the component is fully hidden, or\n * when the component unmounts before its exit could complete.\n */\n onClose?: () => void\n /**\n * Callback fired when the component starts to show.\n */\n onShow?: () => void\n /**\n * Callback fired with `false` when the component asks to hide: its close button, `close()`\n * from its context, or the autohide timer.\n */\n onVisibleChange?: (visible: boolean) => void\n ref: ForwardedRef<HTMLDivElement>\n /**\n * Controlled state; `undefined` means uncontrolled.\n */\n visible?: boolean\n}\n\nexport interface UseDismissibleTransitionResult {\n /**\n * Requests the component be closed. Uncontrolled, that hides it: the exit transition starts\n * and `onClose` fires once it finishes. Controlled by `visible`, it only reports to\n * `onVisibleChange`. Stable across re-renders (see the hook's own doc comment for why that\n * matters).\n */\n close: () => void\n /**\n * Whether the entrance transition has actually finished — `false` while still fading/sliding\n * in, even though `visible` is already `true`. Gate anything that should only start once the\n * component is fully, visibly present (e.g. an autohide timer) on this rather than `visible`\n * alone.\n */\n entered: boolean\n forkedRef: ReturnType<typeof useForkedRef<HTMLDivElement>>\n /**\n * `false` before the component first shows and after it has exited: render nothing.\n */\n isMounted: boolean\n textId: string\n titleId: string\n /**\n * chassis-css's classes for the current phase: `show showing` while entering or exiting,\n * `show` once settled, none while hidden.\n */\n transitionClass: string | undefined\n /**\n * The state that drives the transition: the `visible` prop when it is set, the component's own\n * state otherwise.\n */\n visible: boolean\n}\n\n// Shared dismiss/transition machinery for `Toast` and `Notification` — both otherwise duplicated\n// this near-verbatim: visible-state + prop-sync effect, a forked ref, the phase-to-class mapping,\n// `titleId`/`textId` via `useId()`, and the enter/exit callback wiring of `useTransitionState`.\n//\n// `close` is memoized once here with `useCallback` (empty deps — it reads everything it needs\n// through refs) specifically so it has a stable identity across re-renders. Previously each component built its own unmemoized\n// `() => setVisible(false)` inline and passed it straight into `useAutoDismiss`, whose scheduling\n// effect depends on that closure's identity — since `Toaster`/`NotificationStack` re-render every\n// mounted item whenever the shared queue changes (`ToastQueue.add()`/`.close()` notify all\n// subscribers synchronously), that meant adding or dismissing any one toast/notification silently\n// restarted every other visible one's autohide countdown, with no code change needed to trigger\n// it beyond normal multi-item usage.\n//\n// `entered` similarly gates \"has the entrance transition actually finished\" uniformly for both —\n// `Toast` already had this (gating on `visible` alone would start the autohide timer the instant\n// `visible` flips true, while still fading/sliding in); `Notification` didn't, so this extraction\n// gives it the same fix for free.\n//\n// `onClose` normally fires when the exit transition has finished. A component that unmounts\n// before that (a `Toaster` remounted by a navigation 50 ms after its toast's action was clicked,\n// issue #40) would never report the close it was asked for, and a queued toast would come back\n// with the next `Toaster`. So an unmount with a close still owed reports it then. It is owed from\n// the `close()` call itself, not from the start of the exit, because the unmount can land in the\n// same commit as the state change `close()` asked for. That holds for an uncontrolled component,\n// where `close()` is the change. A controlled one owes `onClose` only once `visible` has become\n// `false` and the exit has started: until then `close()` is a request its owner may decline.\nexport function useDismissibleTransition({\n defaultVisible,\n displayName,\n onClose,\n onShow,\n onVisibleChange,\n ref,\n visible\n}: UseDismissibleTransitionOptions): UseDismissibleTransitionResult {\n const isControlled = visible !== undefined\n const [_visible, setVisible] = useControllableState(visible, defaultVisible, onVisibleChange)\n const nodeRef = useRef<HTMLDivElement>(null)\n const forkedRef = useForkedRef(ref, nodeRef)\n const titleId = useId()\n const textId = useId()\n\n const closeOwedRef = useRef(false)\n const onCloseRef = useRef(onClose)\n onCloseRef.current = onClose\n\n const reportClose = useCallback(() => {\n if (!closeOwedRef.current) return\n closeOwedRef.current = false\n onCloseRef.current?.()\n }, [])\n\n // Replaced every render, so the stable `close` below always reports to the current props.\n const requestHideRef = useRef(() => {})\n requestHideRef.current = () => {\n // Closing what is already hidden asks for nothing, so it owes no `onClose`.\n if (!_visible) return\n if (!isControlled) closeOwedRef.current = true\n warnDroppedVisibleRequest({ onVisibleChange, visible }, false, displayName)\n setVisible(false)\n }\n\n const close = useCallback(() => requestHideRef.current(), [])\n\n // A component mounted visible plays its enter transition, except in the server's HTML and\n // while hydrating it: there is nothing on screen to animate from, and starting hidden left the\n // page without the component until the JavaScript had loaded. It starts settled, with `show`.\n const hydrated = useHydrated()\n\n const { isMounted, phase } = useTransitionState({\n appear: hydrated,\n in: _visible,\n nodeRef,\n onEnter: () => {\n closeOwedRef.current = false\n onShow?.()\n },\n onExit: () => {\n closeOwedRef.current = true\n },\n onExited: reportClose,\n unmountOnExit: true\n })\n\n useEffect(() => reportClose, [reportClose])\n\n // Settled from the start, the component never enters, which is where `onShow` fires: fire it\n // once on mount instead, since it did show. The ref keeps StrictMode's second run from firing\n // it again.\n const showOwedRef = useRef(!hydrated && _visible)\n useEffect(() => {\n if (!showOwedRef.current) return\n showOwedRef.current = false\n onShow?.()\n }, [])\n\n return {\n close,\n entered: phase === 'entered',\n forkedRef,\n isMounted,\n textId,\n titleId,\n transitionClass:\n phase === 'entering' || phase === 'exiting'\n ? 'show showing'\n : phase === 'entered'\n ? 'show'\n : undefined,\n visible: _visible\n }\n}\n","import { FocusEvent, ForwardedRef, useRef } from 'react'\nimport { mergeProps, ToastRegionAria, useToastRegion } from 'react-aria'\nimport { ToastQueue, ToastState, useToastQueue } from 'react-stately'\n\nimport { useForkedRef } from './useForkedRef'\nimport { useIsomorphicLayoutEffect } from './useIsomorphicLayoutEffect'\n\nexport interface UseToastRegionQueueResult<T> {\n forkedRef: ReturnType<typeof useForkedRef<HTMLDivElement>>\n regionProps: ToastRegionAria['regionProps']\n state: ToastState<T>\n}\n\nconst FOCUSABLE =\n 'a[href], button:not([disabled]), input:not([disabled]), select:not([disabled]), ' +\n 'textarea:not([disabled]), [tabindex]:not([tabindex=\"-1\"])'\n\n// Focus for a toast that takes the place of the one that had it: its first control (its close\n// button), or the toast itself.\nconst focusToast = (toast: HTMLElement) => {\n const control = toast.querySelector<HTMLElement>(FOCUSABLE)\n if (control) {\n control.focus()\n return\n }\n if (!toast.hasAttribute('tabindex')) toast.setAttribute('tabindex', '-1')\n toast.focus()\n}\n\n// Shared setup for `Toaster`/`NotificationStack` — both otherwise duplicated this near-verbatim:\n// subscribe to a `ToastQueue` singleton, wire up react-aria's toast-region accessibility\n// plumbing, and fork the caller's ref onto the same node the region hook needs. Differs only in\n// which queue is passed.\n//\n// react-aria's region moves focus off a toast that is removed, but only among elements with\n// `role=\"alertdialog\"`. These toasts are `status` or `alert`, so one closed from the keyboard\n// took focus to `<body>` with it. The region hands it on itself: to the toast that takes the\n// closed one's place, or the one before it, and with none left to the element focused before\n// focus entered the region.\nexport function useToastRegionQueue<T>(\n queue: ToastQueue<T>,\n ref: ForwardedRef<HTMLDivElement>\n): UseToastRegionQueueResult<T> {\n const state = useToastQueue(queue)\n const regionRef = useRef<HTMLDivElement>(null)\n const { regionProps } = useToastRegion({}, state, regionRef)\n const forkedRef = useForkedRef(ref, regionRef)\n\n // The position, among the region's children, of the toast that holds focus; -1 for none.\n const focusedIndexRef = useRef(-1)\n // Where focus was before it entered the region.\n const returnFocusRef = useRef<HTMLElement | null>(null)\n\n const onFocus = (event: FocusEvent<HTMLDivElement>) => {\n const region = event.currentTarget\n focusedIndexRef.current = Array.from(region.children).findIndex((child) =>\n child.contains(event.target)\n )\n const from = event.relatedTarget\n if (from instanceof HTMLElement && !region.contains(from)) returnFocusRef.current = from\n }\n\n // Focus that leaves for another element is the user's. A toast taken out of the DOM leaves no\n // element to go to, and is handled below.\n const onBlur = (event: FocusEvent<HTMLDivElement>) => {\n const to = event.relatedTarget\n if (to && !event.currentTarget.contains(to)) {\n focusedIndexRef.current = -1\n returnFocusRef.current = null\n }\n }\n\n useIsomorphicLayoutEffect(() => {\n const index = focusedIndexRef.current\n if (index === -1) return\n const toasts = regionRef.current\n ? (Array.from(regionRef.current.children) as HTMLElement[])\n : []\n const active = document.activeElement\n if (active && active !== document.body) {\n // Still on its toast, which another toast closing may have moved.\n const moved = toasts.findIndex((toast) => toast.contains(active))\n if (moved !== -1) focusedIndexRef.current = moved\n return\n }\n const next = toasts[index] ?? toasts[index - 1]\n if (next) {\n focusToast(next)\n return\n }\n focusedIndexRef.current = -1\n const back = returnFocusRef.current\n returnFocusRef.current = null\n if (back?.isConnected) back.focus()\n }, [state.visibleToasts])\n\n return { forkedRef, regionProps: mergeProps(regionProps, { onFocus, onBlur }), state }\n}\n"],"mappings":"A,meA+BA,MAAMK,EAAoB,GAAK,GAAK,EAKpC,SAAgBC,EAAe,CAC7B,UAAU,GACV,QAAQ,IACR,UACA,UAC8C,CAI9C,IAAMC,EAAUC,EAA2B,IAAA,EAAS,EAC9CC,EAAsBD,EAAO,EAAK,EAClCE,EAAyBF,EAAO,EAAK,EAErCG,EAA0BC,MAAkB,CAChD,aAAaL,EAAQ,OAAO,EAC5B,EAAQ,QAAU,IAAA,EACpB,EAAG,CAAC,CAAC,EAECM,EAAoBD,MAAkB,CAC1CD,EAAwB,EAEtB,GAACG,GACD,CAAC,OAAO,SAASC,CAAK,GACtBA,EAAQV,GACRI,EAAoB,SACpBC,EAAuB,WAIzB,EAAQ,QAAU,OAAO,WAAWM,EAAQD,CAAK,EACnD,EAAG,CAACD,EAASC,EAAOC,EAAQL,CAAuB,CAAC,EAsCpD,OAnCAM,MAAgBN,EAAyB,CAACA,CAAuB,CAAC,EAElEM,MAAgB,CACVC,EACFL,EAAkB,GAElBF,EAAwB,EAIxB,EAAoB,QAAU,GAC9B,EAAuB,QAAU,GAErC,EAAG,CAACO,EAASJ,EAASC,EAAOF,EAAmBF,CAAuB,CAAC,EAsBjE,CAAE,aApBYC,MAAkB,CACrC,EAAoB,QAAU,GAC9BD,EAAwB,CAC1B,EAAG,CAACA,CAAuB,CAiBP,EAAG,aAfFC,MAAkB,CACrC,EAAoB,QAAU,GAC9BC,EAAkB,CACpB,EAAG,CAACA,CAAiB,CAYa,EAAG,QAVrBD,MAAkB,CAChC,EAAuB,QAAU,GACjCD,EAAwB,CAC1B,EAAG,CAACA,CAAuB,CAOgB,EAAG,OAL/BC,MAAkB,CAC/B,EAAuB,QAAU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EAAM,cACfE,aAAgB,aAAe,CAACH,EAAO,SAASG,CAAI,IAAG,EAAe,QAAUA,EACtF,EAoCoE,OAhCpD,GAAsC,CACpD,IAAMC,EAAKH,EAAM,cACbG,GAAM,CAACH,EAAM,cAAc,SAASG,CAAE,IACxC,EAAgB,QAAU,GAC1B,EAAe,QAAU,KAE7B,CA0B2E,CAAC,EAAG,OAAM,CACvF,C"}
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{t as e}from"./useIsomorphicLayoutEffect-BbqRwuqn.js";import{t}from"./dialogTransition-C8fYTsSa.js";import{useRef as n,useState as r}from"react";const i=e=>void e?.offsetHeight;function a({appear:a=!1,in:o,mountOnEnter:s=!1,nodeRef:c,onEnter:l,onEntering:u,onEntered:d,onExit:f,onExiting:p,onExited:m,unmountOnExit:h=!1}){let[g,_]=r(()=>o?a?`exited`:`entered`:s||h?`unmounted`:`exited`),v=n(g),y=e=>{v.current=e,_(e)},b={onEnter:l,onEntering:u,onEntered:d,onExit:f,onExiting:p,onExited:m},x=n(b);x.current=b,e(()=>{let e=v.current;o!==(e===`entering`||e===`entered`)&&(o?(i(c.current),x.current.onEnter?.(),y(`entering`)):(x.current.onExit?.(),y(`exiting`)))},[o]),e(()=>{if(g!==`entering`&&g!==`exiting`)return;let e=()=>{g===`entering`?(y(`entered`),x.current.onEntered?.()):(y(h?`unmounted`:`exited`),x.current.onExited?.())};g===`entering`?x.current.onEntering?.():x.current.onExiting?.();let n=c.current;if(!n)e();else return t(n,e,!0)},[g]);let S=o&&g===`unmounted`?`exited`:g;return{isMounted:S!==`unmounted`,phase:S}}export{a as t};
|
|
2
|
-
//# sourceMappingURL=useTransitionState-sQUQey74.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"useTransitionState-sQUQey74.js","names":["useIsomorphicLayoutEffect","forceReflow","node","useTransitionState","inProp","phase","setPhaseState","useState","appear","mountOnEnter","unmountOnExit","phaseRef","useRef","setPhase","next","callbacks","callbacksRef","current","nodeRef","finish","executeAfterTransition","rendered"],"sources":["../../src/hooks/useTransitionState.ts"],"sourcesContent":["import { RefObject, useRef, useState } from 'react'\n\nimport { executeAfterTransition } from '../utils/dialogTransition'\nimport { useIsomorphicLayoutEffect } from './useIsomorphicLayoutEffect'\n\n/**\n * Where a component is in its show/hide cycle. `exited` is mounted and hidden, `unmounted` is\n * not rendered at all.\n */\nexport type TransitionPhase = 'unmounted' | 'exited' | 'entering' | 'entered' | 'exiting'\n\nexport interface UseTransitionStateOptions {\n /**\n * Plays the enter transition on the first mount too, when `in` is already `true`. Without it\n * a component mounted visible starts settled, in `entered`.\n */\n appear?: boolean\n /**\n * Whether the component is shown.\n */\n in: boolean\n /**\n * Keeps the component out of the DOM until it is first shown.\n */\n mountOnEnter?: boolean\n /**\n * The element the classes are applied to. Its own CSS transition decides how long `entering`\n * and `exiting` last.\n */\n nodeRef: RefObject<HTMLElement | null>\n /**\n * Fires before `entering` is rendered, while the element still has its hidden styles.\n */\n onEnter?: () => void\n /**\n * Fires once `entering` is in the DOM, before the browser paints it.\n */\n onEntering?: () => void\n /**\n * Fires when the enter transition has finished.\n */\n onEntered?: () => void\n /**\n * Fires before `exiting` is rendered, while the element still has its shown styles.\n */\n onExit?: () => void\n /**\n * Fires once `exiting` is in the DOM, before the browser paints it.\n */\n onExiting?: () => void\n /**\n * Fires when the exit transition has finished. With `unmountOnExit` the element is still in\n * the DOM at this point.\n */\n onExited?: () => void\n /**\n * Takes the component out of the DOM once it has exited.\n */\n unmountOnExit?: boolean\n}\n\nexport interface UseTransitionStateResult {\n /**\n * `false` while there is nothing to render.\n */\n isMounted: boolean\n phase: TransitionPhase\n}\n\nconst forceReflow = (node: HTMLElement | null) => void node?.offsetHeight\n\n// The show/hide state machine behind `Collapse`, `TabPanel`, `Toast`, `Notification`, `Tooltip`\n// and `Popover`. It only reports a phase. Each component maps phases to chassis-css's classes\n// (`fade`, `show`, `showing`, `collapsing`), because those mappings differ.\n//\n// A phase lasts as long as the element's own CSS transition: it ends on `transitionend`, or\n// after the computed duration when that event never comes (`executeAfterTransition`, which\n// chassis-css's own plugins and `Modal`/`Drawer`/`Menu` use too). Nothing here holds a duration,\n// so a theme that changes one, and `prefers-reduced-motion`, under which chassis-css sets\n// `transition: none`, are followed without a second source of truth.\n//\n// Every step runs in a layout effect, so the browser never paints a state between two steps,\n// and a step that needs the previous styles computed first (an element that was just mounted,\n// or `display: none` a moment ago) forces a reflow itself.\nexport function useTransitionState({\n appear = false,\n in: inProp,\n mountOnEnter = false,\n nodeRef,\n onEnter,\n onEntering,\n onEntered,\n onExit,\n onExiting,\n onExited,\n unmountOnExit = false\n}: UseTransitionStateOptions): UseTransitionStateResult {\n const [phase, setPhaseState] = useState<TransitionPhase>(() => {\n if (inProp) return appear ? 'exited' : 'entered'\n return mountOnEnter || unmountOnExit ? 'unmounted' : 'exited'\n })\n\n // Mirrors `phase` at the moment it is set, not at the next render: StrictMode runs the effect\n // below twice on mount, and the second run has to see that the first already started.\n const phaseRef = useRef(phase)\n const setPhase = (next: TransitionPhase) => {\n phaseRef.current = next\n setPhaseState(next)\n }\n\n // Read through a ref so a caller can pass inline callbacks without restarting a transition.\n const callbacks = { onEnter, onEntering, onEntered, onExit, onExiting, onExited }\n const callbacksRef = useRef(callbacks)\n callbacksRef.current = callbacks\n\n useIsomorphicLayoutEffect(() => {\n const current = phaseRef.current\n const isIn = current === 'entering' || current === 'entered'\n if (inProp === isIn) return\n\n if (inProp) {\n forceReflow(nodeRef.current)\n callbacksRef.current.onEnter?.()\n setPhase('entering')\n } else {\n callbacksRef.current.onExit?.()\n setPhase('exiting')\n }\n }, [inProp])\n\n useIsomorphicLayoutEffect(() => {\n if (phase !== 'entering' && phase !== 'exiting') return undefined\n\n const finish = () => {\n if (phase === 'entering') {\n setPhase('entered')\n callbacksRef.current.onEntered?.()\n } else {\n setPhase(unmountOnExit ? 'unmounted' : 'exited')\n callbacksRef.current.onExited?.()\n }\n }\n\n if (phase === 'entering') callbacksRef.current.onEntering?.()\n else callbacksRef.current.onExiting?.()\n\n // Nothing rendered means nothing to wait for.\n const node = nodeRef.current\n if (!node) {\n finish()\n return undefined\n }\n return executeAfterTransition(node, finish, true)\n }, [phase])\n\n // Shown while still `unmounted`: render it hidden in this same pass, so the element exists\n // when the effect above starts the enter from it.\n const rendered = inProp && phase === 'unmounted' ? 'exited' : phase\n\n return { isMounted: rendered !== 'unmounted', phase: rendered }\n}\n"],"mappings":"A,uJAqEA,MAAMC,EAAe,GAA6B,KAAKC,GAAM,aAe7D,SAAgBC,EAAmB,CACjC,SAAS,GACT,GAAIC,EACJ,eAAe,GACf,UACA,UACA,aACA,YACA,SACA,YACA,WACA,gBAAgB,IACsC,CACtD,GAAM,CAACC,EAAOC,GAAiBC,MACzBH,EAAeI,EAAS,SAAW,UAChCC,GAAgBC,EAAgB,YAAc,QACtD,EAIKC,EAAWC,EAAOP,CAAK,EACvBQ,EAAY,GAA0B,CAC1C,EAAS,QAAUC,EACnBR,EAAcQ,CAAI,CACpB,EAGMC,EAAY,CAAE,UAAS,aAAY,YAAW,SAAQ,YAAW,UAAS,EAC1EC,EAAeJ,EAAOG,CAAS,EACrC,EAAa,QAAUA,EAEvBf,MAAgC,CAC9B,IAAMiB,EAAUN,EAAS,QAErBP,KADSa,IAAY,YAAcA,IAAY,aAG/Cb,GACFH,EAAYiB,EAAQ,OAAO,EAC3BF,EAAa,QAAQ,UAAU,EAC/BH,EAAS,UAAU,IAEnBG,EAAa,QAAQ,SAAS,EAC9BH,EAAS,SAAS,GAEtB,EAAG,CAACT,CAAM,CAAC,EAEXJ,MAAgC,CAC9B,GAAIK,IAAU,YAAcA,IAAU,UAAW,OAEjD,IAAMc,MAAe,CACfd,IAAU,YACZQ,EAAS,SAAS,EAClBG,EAAa,QAAQ,YAAY,IAEjCH,EAASH,EAAgB,YAAc,QAAQ,EAC/CM,EAAa,QAAQ,WAAW,EAEpC,EAEIX,IAAU,WAAYW,EAAa,QAAQ,aAAa,EACvDA,EAAa,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