@chassis-ui/react 0.4.1 → 0.5.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 +7 -6
- package/dist/accordion.d.ts +1 -1
- package/dist/accordion.js +1 -1
- package/dist/alert.d.ts +1 -1
- package/dist/alert.js +1 -1
- package/dist/autocomplete.d.ts +1 -1
- package/dist/autocomplete.js +1 -1
- package/dist/avatar.d.ts +1 -1
- package/dist/avatar.js +1 -1
- package/dist/badge.d.ts +1 -1
- package/dist/badge.js +1 -1
- package/dist/breadcrumb.d.ts +1 -1
- package/dist/breadcrumb.js +1 -1
- package/dist/button-group.d.ts +1 -1
- package/dist/button-group.js +1 -1
- package/dist/button.d.ts +2 -2
- package/dist/button.js +1 -1
- package/dist/calendar.d.ts +1 -1
- package/dist/calendar.js +1 -1
- package/dist/card.d.ts +1 -1
- package/dist/card.js +1 -1
- package/dist/carousel.d.ts +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.d.ts +1 -1
- package/dist/chip-input.js +1 -1
- package/dist/chip.d.ts +1 -1
- package/dist/chip.js +1 -1
- package/dist/chunks/{Button-BuZ_GOHS.d.ts → Button-DblYVwl-.d.ts} +4 -2
- package/dist/chunks/Button-ZU-x1uN_.js +2 -0
- package/dist/chunks/Button-ZU-x1uN_.js.map +1 -0
- package/dist/chunks/Chip-C7QlFCvx.js +2 -0
- package/dist/chunks/Chip-C7QlFCvx.js.map +1 -0
- package/dist/chunks/CloseButton-BPUI5iGX.js +2 -0
- package/dist/chunks/CloseButton-BPUI5iGX.js.map +1 -0
- package/dist/chunks/ComboboxListBox-Db0rSM3w.js +2 -0
- package/dist/chunks/ComboboxListBox-Db0rSM3w.js.map +1 -0
- package/dist/chunks/DateField-4cdcwt0v.js +2 -0
- package/dist/chunks/DateField-4cdcwt0v.js.map +1 -0
- package/dist/chunks/FormHelp-B1eSoack.js +2 -0
- package/dist/chunks/FormHelp-B1eSoack.js.map +1 -0
- package/dist/chunks/FormLabel-CpzWYh6U.js +2 -0
- package/dist/chunks/FormLabel-CpzWYh6U.js.map +1 -0
- package/dist/chunks/{Icon-DLB1f88W.js → Icon-Dk5_q79o.js} +2 -2
- package/dist/chunks/Icon-Dk5_q79o.js.map +1 -0
- package/dist/chunks/Link-DE8NSAXJ.js +2 -0
- package/dist/chunks/Link-DE8NSAXJ.js.map +1 -0
- package/dist/chunks/Menu-264aGoBR.js +2 -0
- package/dist/chunks/Menu-264aGoBR.js.map +1 -0
- package/dist/chunks/{Menu-QeYOzrUL.d.ts → Menu-CCYshRuL.d.ts} +3 -2
- package/dist/chunks/MenuToggle-DcPEh55c.js +2 -0
- package/dist/chunks/MenuToggle-DcPEh55c.js.map +1 -0
- package/dist/chunks/Portal-BTDylxAi.js +2 -0
- package/dist/chunks/Portal-BTDylxAi.js.map +1 -0
- package/dist/chunks/RangeCalendar-mM3OeTlU.js +2 -0
- package/dist/chunks/RangeCalendar-mM3OeTlU.js.map +1 -0
- package/dist/chunks/VisuallyHidden-CGv-mBuQ.js +2 -0
- package/dist/chunks/VisuallyHidden-CGv-mBuQ.js.map +1 -0
- package/dist/chunks/accordion-BZlX2uk8.js +2 -0
- package/dist/chunks/accordion-BZlX2uk8.js.map +1 -0
- package/dist/chunks/alert-DSLg5MBb.js +2 -0
- package/dist/chunks/alert-DSLg5MBb.js.map +1 -0
- package/dist/chunks/autocomplete-99usnvgh.js +2 -0
- package/dist/chunks/autocomplete-99usnvgh.js.map +1 -0
- package/dist/chunks/avatar-BQBbcnk6.js +2 -0
- package/dist/chunks/avatar-BQBbcnk6.js.map +1 -0
- package/dist/chunks/{badge-D2oztCvs.js → badge-Ths1Qn1a.js} +2 -2
- package/dist/chunks/badge-Ths1Qn1a.js.map +1 -0
- package/dist/chunks/breadcrumb-BTiQikk-.js +2 -0
- package/dist/chunks/breadcrumb-BTiQikk-.js.map +1 -0
- package/dist/chunks/breakpoints-CGk8szzR.js.map +1 -1
- package/dist/chunks/button-group-CefkGeYL.js +2 -0
- package/dist/chunks/button-group-CefkGeYL.js.map +1 -0
- package/dist/chunks/card-CEQgHIaL.js +2 -0
- package/dist/chunks/card-CEQgHIaL.js.map +1 -0
- package/dist/chunks/carousel-DC-UGc6W.js +2 -0
- package/dist/chunks/carousel-DC-UGc6W.js.map +1 -0
- package/dist/chunks/checkbox-ko6CdtoT.js +2 -0
- package/dist/chunks/checkbox-ko6CdtoT.js.map +1 -0
- package/dist/chunks/chip-input-CugY8EOc.js +2 -0
- package/dist/chunks/chip-input-CugY8EOc.js.map +1 -0
- package/dist/chunks/{collapse--Go2Y73B.js → collapse-CBi3RWTf.js} +2 -2
- package/dist/chunks/collapse-CBi3RWTf.js.map +1 -0
- package/dist/chunks/color-input-C4zMWlvm.js +2 -0
- package/dist/chunks/color-input-C4zMWlvm.js.map +1 -0
- package/dist/chunks/colorClassNames-YzGWu6qm.js +2 -0
- package/dist/chunks/colorClassNames-YzGWu6qm.js.map +1 -0
- package/dist/chunks/combobox-BQh3uJWB.js +2 -0
- package/dist/chunks/combobox-BQh3uJWB.js.map +1 -0
- package/dist/chunks/context-DCg95BgR.js +2 -0
- package/dist/chunks/context-DCg95BgR.js.map +1 -0
- package/dist/chunks/context-HDVxTNPi.js +2 -0
- package/dist/chunks/context-HDVxTNPi.js.map +1 -0
- package/dist/chunks/context-menu-8KIuH4cJ.js +2 -0
- package/dist/chunks/context-menu-8KIuH4cJ.js.map +1 -0
- package/dist/chunks/datagrid-n9vFeXN1.js +2 -0
- package/dist/chunks/datagrid-n9vFeXN1.js.map +1 -0
- package/dist/chunks/datepicker-DqztYJD6.js +2 -0
- package/dist/chunks/datepicker-DqztYJD6.js.map +1 -0
- package/dist/chunks/{dialogTransition-i9vw0i2Z.js → dialogTransition-C8fYTsSa.js} +2 -2
- package/dist/chunks/dialogTransition-C8fYTsSa.js.map +1 -0
- package/dist/chunks/direction-LN6uwsK5.js.map +1 -1
- package/dist/chunks/divider-C1-NoKMV.js +2 -0
- package/dist/chunks/divider-C1-NoKMV.js.map +1 -0
- package/dist/chunks/drawer-CRv9jmbp.js +2 -0
- package/dist/chunks/drawer-CRv9jmbp.js.map +1 -0
- package/dist/chunks/file-input-D_Gl1h-T.js +2 -0
- package/dist/chunks/file-input-D_Gl1h-T.js.map +1 -0
- package/dist/chunks/{flex-B52oLCCC.js → flex-C2jV5LyV.js} +2 -2
- package/dist/chunks/flex-C2jV5LyV.js.map +1 -0
- package/dist/chunks/floating-input-D4gWFfOU.js +2 -0
- package/dist/chunks/floating-input-D4gWFfOU.js.map +1 -0
- package/dist/chunks/focus-ring-Bs80iIBN.js +2 -0
- package/dist/chunks/focus-ring-Bs80iIBN.js.map +1 -0
- package/dist/chunks/focusRedirect-CrBl4p_n.js +2 -0
- package/dist/chunks/focusRedirect-CrBl4p_n.js.map +1 -0
- package/dist/chunks/form-CPS2eNw1.js +2 -0
- package/dist/chunks/form-CPS2eNw1.js.map +1 -0
- package/dist/chunks/{form-field-CNPGTMiW.js → form-field-Bcx96ezd.js} +2 -2
- package/dist/chunks/form-field-Bcx96ezd.js.map +1 -0
- package/dist/chunks/grid-CkdPftit.js +2 -0
- package/dist/chunks/grid-CkdPftit.js.map +1 -0
- package/dist/chunks/icon-CVD3rTr-.js +2 -0
- package/dist/chunks/icon-CVD3rTr-.js.map +1 -0
- package/dist/chunks/iconSlot-DU_WcSL_.js +2 -0
- package/dist/chunks/iconSlot-DU_WcSL_.js.map +1 -0
- package/dist/chunks/{index-91YA-jkp.d.ts → index-3JVLrDHv.d.ts} +11 -3
- package/dist/chunks/{index-DMbdEm__.d.ts → index-5mW1Y9Lm.d.ts} +7 -4
- package/dist/chunks/{index-Cc4SSslb.d.ts → index-5qsV1-cc.d.ts} +3 -3
- package/dist/chunks/{index-CYvVmTPR.d.ts → index-6PnrAJmb.d.ts} +4 -4
- package/dist/chunks/{index-BA-raEMm.d.ts → index-B5f6haU-.d.ts} +2 -2
- package/dist/chunks/{index-4cKG9KWB.d.ts → index-B8OIYfGw.d.ts} +2 -2
- package/dist/chunks/{index-CjT_4IZx.d.ts → index-BAvt_oPe.d.ts} +14 -5
- package/dist/chunks/{index-DtbUXxjz.d.ts → index-BB8UNxnM.d.ts} +2 -2
- package/dist/chunks/{index-aRdgpeRb.d.ts → index-BEAZrhyV.d.ts} +2 -2
- package/dist/chunks/{index-BOx8v-oT.d.ts → index-BISMaKaC.d.ts} +14 -2
- package/dist/chunks/{index-DtvHH_Mb.d.ts → index-BOroLDDZ.d.ts} +2 -2
- package/dist/chunks/{index-C4Dks__B.d.ts → index-BZpHSGlk.d.ts} +2 -2
- package/dist/chunks/{index-C9gzVqwX.d.ts → index-BbZzaApz.d.ts} +2 -2
- package/dist/chunks/{index-DAoPg59I.d.ts → index-Bca_HQWF.d.ts} +7 -3
- package/dist/chunks/{index-B0-8n-Gs.d.ts → index-Bl-_sC4y.d.ts} +12 -4
- package/dist/chunks/{index-BSLneLYu.d.ts → index-BxJ6Vrhm.d.ts} +2 -2
- package/dist/chunks/{index-CTpwB1yR.d.ts → index-BxrIOrAc.d.ts} +11 -6
- package/dist/chunks/{index-DHcztR18.d.ts → index-ByBbC4Jh.d.ts} +3 -3
- package/dist/chunks/{index-DHGgezXU.d.ts → index-C-IrFdKe.d.ts} +2 -2
- package/dist/chunks/{index-B8uaSJA9.d.ts → index-C0g8NSXY.d.ts} +13 -4
- package/dist/chunks/{index-CFnQubsV.d.ts → index-C1RKm3hQ.d.ts} +5 -3
- package/dist/chunks/{index-BxROljJI.d.ts → index-C3qqMzs5.d.ts} +2 -2
- package/dist/chunks/{index-Dcc_W6Kv.d.ts → index-C6F3DQCd.d.ts} +2 -2
- package/dist/chunks/{index-x0vZRyoU.d.ts → index-CEPAXElM.d.ts} +4 -3
- package/dist/chunks/{index-DaHQdNul.d.ts → index-COVY45gK.d.ts} +2 -2
- package/dist/chunks/{index-DJfga0Ce.d.ts → index-COq1jJ6Y.d.ts} +2 -2
- package/dist/chunks/{index-HrKN6s8z.d.ts → index-CSRGr7pU.d.ts} +2 -2
- package/dist/chunks/{index-B1kw0jzM.d.ts → index-CTNqEMug.d.ts} +6 -3
- package/dist/chunks/{index-6uob77s9.d.ts → index-CW94lG-e.d.ts} +7 -4
- package/dist/chunks/{index-Ddd7iWfm.d.ts → index-CY-A60p6.d.ts} +2 -2
- package/dist/chunks/{index-lSPcxiii.d.ts → index-CbcFEGCh.d.ts} +5 -3
- package/dist/chunks/{index-9rQeMqVI.d.ts → index-Ce0f-bDM.d.ts} +2 -2
- package/dist/chunks/{index-Ci7AEgEc.d.ts → index-Cf3gHDjh.d.ts} +2 -2
- package/dist/chunks/{index-BVGGIaPX.d.ts → index-Cm3rPbI1.d.ts} +10 -5
- package/dist/chunks/{index-DPCwFiJL.d.ts → index-CmljNQ8F.d.ts} +2 -2
- package/dist/chunks/{index-DQImhbhy.d.ts → index-Cpifcw5a.d.ts} +2 -2
- package/dist/chunks/{index-B_UzbGOa.d.ts → index-Ctf5hLue.d.ts} +3 -3
- package/dist/chunks/{index-DM01FX3a.d.ts → index-D0Dhs7YI.d.ts} +18 -6
- package/dist/chunks/{index-BAsbRx5n.d.ts → index-D5KJRfMg.d.ts} +2 -2
- package/dist/chunks/{index-Bz8MDq0H.d.ts → index-DD6Z5NW-.d.ts} +7 -4
- package/dist/chunks/{index-Dfg4Ftb8.d.ts → index-DFKBJxqA.d.ts} +7 -4
- package/dist/chunks/{index-BMkbJVHg.d.ts → index-DGGyvlEQ.d.ts} +3 -3
- package/dist/chunks/{index-YJ9QdBuq.d.ts → index-DOxVxbb9.d.ts} +6 -5
- package/dist/chunks/{index-CxjNw4ss.d.ts → index-DVK16_FU.d.ts} +2 -2
- package/dist/chunks/{index-DHOG_rjE.d.ts → index-DVfH_2Ma.d.ts} +7 -4
- package/dist/chunks/{index-0jbACjYQ.d.ts → index-DXBkVdWc.d.ts} +2 -2
- package/dist/chunks/{index-CsARGAzD.d.ts → index-Davd7Cue.d.ts} +10 -5
- package/dist/chunks/{index-Bi8FFadV.d.ts → index-Dc50UjJy.d.ts} +13 -4
- package/dist/chunks/{index-BF3OWUVc.d.ts → index-Dci43Xhl.d.ts} +3 -3
- package/dist/chunks/{index-B2K-O9kl.d.ts → index-DdFipHYL.d.ts} +5 -4
- package/dist/chunks/{index-Du9fBqkT.d.ts → index-DmmLEHVo.d.ts} +2 -2
- package/dist/chunks/{index-Dzga1f4w.d.ts → index-DsU3M0oP.d.ts} +2 -2
- package/dist/chunks/{index-DP5xugE-.d.ts → index-Es9I0fIS.d.ts} +3 -3
- package/dist/chunks/{index-CqZ68Z8R.d.ts → index-HNUhTj5e.d.ts} +25 -6
- package/dist/chunks/{index-CCXJXToc.d.ts → index-OnB4_h6x.d.ts} +7 -4
- package/dist/chunks/{index-CftERHnE.d.ts → index-QeI-KSng.d.ts} +3 -2
- package/dist/chunks/{index-BLS1jhSJ.d.ts → index-RyE80_VH.d.ts} +2 -2
- package/dist/chunks/{index-CIwzgZJi.d.ts → index-UjmJQRaG.d.ts} +2 -2
- package/dist/chunks/{index-B19ZH3fm.d.ts → index-YzIZhXZ1.d.ts} +2 -2
- package/dist/chunks/{index-CHQR8x8_.d.ts → index-Z_5ArZpE.d.ts} +4 -2
- package/dist/chunks/{index-BNf0jIIL.d.ts → index-doVyX-4i.d.ts} +7 -4
- package/dist/chunks/{index-NGgDkhyn.d.ts → index-mLtlx-d9.d.ts} +6 -3
- package/dist/chunks/{index-g74gO0pc.d.ts → index-sT0Hnr_n.d.ts} +12 -10
- package/dist/chunks/{index-Bkj17NEQ.d.ts → index-t3k_T3Dv.d.ts} +2 -2
- package/dist/chunks/{index-BfEJYF4c.d.ts → index-yVsGuikp.d.ts} +2 -2
- package/dist/chunks/input-adorn-DV9tuWXh.js +2 -0
- package/dist/chunks/input-adorn-DV9tuWXh.js.map +1 -0
- package/dist/chunks/input-group-YB_zoKud.js +2 -0
- package/dist/chunks/input-group-YB_zoKud.js.map +1 -0
- package/dist/chunks/insideEvents-CWcNrMu7.js +2 -0
- package/dist/chunks/insideEvents-CWcNrMu7.js.map +1 -0
- package/dist/chunks/lazyElement-tfMG21pZ.js.map +1 -1
- package/dist/chunks/list-BPBZR66Y.js +2 -0
- package/dist/chunks/list-BPBZR66Y.js.map +1 -0
- package/dist/chunks/menu-DEu-Nbv8.js +2 -0
- package/dist/chunks/menu-DEu-Nbv8.js.map +1 -0
- package/dist/chunks/modal-CHvsDTyl.js +2 -0
- package/dist/chunks/modal-CHvsDTyl.js.map +1 -0
- package/dist/chunks/nav-B4U_Hqs7.js +2 -0
- package/dist/chunks/nav-B4U_Hqs7.js.map +1 -0
- package/dist/chunks/nav-overflow-DpX_lRYf.js +2 -0
- package/dist/chunks/nav-overflow-DpX_lRYf.js.map +1 -0
- package/dist/chunks/navOverflow-C_QJmkPM.js +2 -0
- package/dist/chunks/navOverflow-C_QJmkPM.js.map +1 -0
- package/dist/chunks/{navVariant-DeGTk9B7.js → navVariant-D4wiKS8I.js} +2 -2
- package/dist/chunks/navVariant-D4wiKS8I.js.map +1 -0
- package/dist/chunks/navbar-C7dO0YRs.js +2 -0
- package/dist/chunks/navbar-C7dO0YRs.js.map +1 -0
- package/dist/chunks/notification-oIrUtDhl.js +2 -0
- package/dist/chunks/notification-oIrUtDhl.js.map +1 -0
- package/dist/chunks/number-field-ChPTSBwI.js +2 -0
- package/dist/chunks/number-field-ChPTSBwI.js.map +1 -0
- package/dist/chunks/otp-input-DUtCMg8P.js +2 -0
- package/dist/chunks/otp-input-DUtCMg8P.js.map +1 -0
- package/dist/chunks/{overlayPlacement-BtS90IVf.js → overlayPlacement-Q6bcbXA5.js} +2 -2
- package/dist/chunks/overlayPlacement-Q6bcbXA5.js.map +1 -0
- package/dist/chunks/overlayStack-BXtTGCRm.js +2 -0
- package/dist/chunks/overlayStack-BXtTGCRm.js.map +1 -0
- package/dist/chunks/pagination-Dvz8lccd.js +2 -0
- package/dist/chunks/pagination-Dvz8lccd.js.map +1 -0
- package/dist/chunks/{password-strength-DDK8pHRq.js → password-strength-Qg5GHBmu.js} +2 -2
- package/dist/chunks/password-strength-Qg5GHBmu.js.map +1 -0
- package/dist/chunks/placeholder-SPoVRkKE.js +2 -0
- package/dist/chunks/placeholder-SPoVRkKE.js.map +1 -0
- package/dist/chunks/polymorphic-CZIFszAy.js +2 -0
- package/dist/chunks/polymorphic-CZIFszAy.js.map +1 -0
- package/dist/chunks/popover-C_32yD9W.js +2 -0
- package/dist/chunks/popover-C_32yD9W.js.map +1 -0
- package/dist/chunks/progress-CiSJDNwx.js +2 -0
- package/dist/chunks/progress-CiSJDNwx.js.map +1 -0
- package/dist/chunks/radio-C42F_5OD.js +2 -0
- package/dist/chunks/radio-C42F_5OD.js.map +1 -0
- package/dist/chunks/range-input-DeZq_9S7.js +2 -0
- package/dist/chunks/range-input-DeZq_9S7.js.map +1 -0
- package/dist/chunks/renderFormCheck-DvpfK_I4.js +2 -0
- package/dist/chunks/renderFormCheck-DvpfK_I4.js.map +1 -0
- package/dist/chunks/renderFormField-_6WswnEX.js +2 -0
- package/dist/chunks/renderFormField-_6WswnEX.js.map +1 -0
- package/dist/chunks/renderMenuItemContent-DNdj-Ukz.js +2 -0
- package/dist/chunks/renderMenuItemContent-DNdj-Ukz.js.map +1 -0
- package/dist/chunks/scrollspy-BEZEVyIw.js +2 -0
- package/dist/chunks/scrollspy-BEZEVyIw.js.map +1 -0
- package/dist/chunks/scrollspy-D_lPjb92.js.map +1 -1
- package/dist/chunks/search-field-OFsb3t4L.js +2 -0
- package/dist/chunks/search-field-OFsb3t4L.js.map +1 -0
- package/dist/chunks/select-DwyL6aqY.js +2 -0
- package/dist/chunks/select-DwyL6aqY.js.map +1 -0
- package/dist/chunks/skeleton-B2blJGWj.js +2 -0
- package/dist/chunks/skeleton-B2blJGWj.js.map +1 -0
- package/dist/chunks/slot-BQVx1Eew.js +2 -0
- package/dist/chunks/slot-BQVx1Eew.js.map +1 -0
- package/dist/chunks/spacingClassName-DVhk8m3P.js.map +1 -1
- package/dist/chunks/spinner-D8lQCW4u.js +2 -0
- package/dist/chunks/spinner-D8lQCW4u.js.map +1 -0
- package/dist/chunks/stack-DtzW54UK.js +2 -0
- package/dist/chunks/stack-DtzW54UK.js.map +1 -0
- package/dist/chunks/static-table-C7ZtFQ66.js +2 -0
- package/dist/chunks/static-table-C7ZtFQ66.js.map +1 -0
- package/dist/chunks/stepper-tSA84huJ.js +2 -0
- package/dist/chunks/stepper-tSA84huJ.js.map +1 -0
- package/dist/chunks/switch-cp3IZg3L.js +2 -0
- package/dist/chunks/switch-cp3IZg3L.js.map +1 -0
- package/dist/chunks/table-CBTg5Yuq.js +2 -0
- package/dist/chunks/table-CBTg5Yuq.js.map +1 -0
- package/dist/chunks/tableClassName-jRfRDXA3.js +2 -0
- package/dist/chunks/tableClassName-jRfRDXA3.js.map +1 -0
- package/dist/chunks/tabs-DMFSLjnV.js +2 -0
- package/dist/chunks/tabs-DMFSLjnV.js.map +1 -0
- package/dist/chunks/text-input-CR73x-8D.js +2 -0
- package/dist/chunks/text-input-CR73x-8D.js.map +1 -0
- package/dist/chunks/textarea-C-1cMyH4.js +2 -0
- package/dist/chunks/textarea-C-1cMyH4.js.map +1 -0
- package/dist/chunks/time-field-CbCfOQZz.js +2 -0
- package/dist/chunks/time-field-CbCfOQZz.js.map +1 -0
- package/dist/chunks/toast-Dd0J2e1z.js +2 -0
- package/dist/chunks/toast-Dd0J2e1z.js.map +1 -0
- package/dist/chunks/tooltip-CmKeQwYw.js +2 -0
- package/dist/chunks/tooltip-CmKeQwYw.js.map +1 -0
- package/dist/chunks/tree-DNj_EfUl.js +2 -0
- package/dist/chunks/tree-DNj_EfUl.js.map +1 -0
- package/dist/chunks/unhandledProps-9Kdj7WVf.js.map +1 -1
- package/dist/chunks/{useButtonSemantics-CILM_lhi.js → useButtonSemantics-B1SbGaDO.js} +2 -2
- package/dist/chunks/useButtonSemantics-B1SbGaDO.js.map +1 -0
- package/dist/chunks/useControllableState-CPUJxfKW.js.map +1 -1
- package/dist/chunks/useDialogElement-BfygWBPZ.js +2 -0
- package/dist/chunks/useDialogElement-BfygWBPZ.js.map +1 -0
- package/dist/chunks/useDialogTitle-DiB4YDGI.js +2 -0
- package/dist/chunks/useDialogTitle-DiB4YDGI.js.map +1 -0
- package/dist/chunks/useDisabledAnchorGuard-CH6df46a.js +2 -0
- package/dist/chunks/useDisabledAnchorGuard-CH6df46a.js.map +1 -0
- package/dist/chunks/useFloatingOverlay-BuiI_CCn.js +2 -0
- package/dist/chunks/useFloatingOverlay-BuiI_CCn.js.map +1 -0
- package/dist/chunks/useForkedRef-WoqMqsWE.js +2 -0
- package/dist/chunks/useForkedRef-WoqMqsWE.js.map +1 -0
- package/dist/chunks/useFormField-DH2tlc3e.js +2 -0
- package/dist/chunks/useFormField-DH2tlc3e.js.map +1 -0
- package/dist/chunks/useHeldBack-eeTfpa_t.js +2 -0
- package/dist/chunks/useHeldBack-eeTfpa_t.js.map +1 -0
- package/dist/chunks/useHydrated-Dud4JEwp.js +2 -0
- package/dist/chunks/useHydrated-Dud4JEwp.js.map +1 -0
- package/dist/chunks/useIsomorphicLayoutEffect-BbqRwuqn.js.map +1 -1
- package/dist/chunks/{useOpenStateProps-DykUbnPJ.js → useOpenStateProps-BhjSQ3f6.js} +2 -2
- package/dist/chunks/useOpenStateProps-BhjSQ3f6.js.map +1 -0
- package/dist/chunks/useOverlayMaxHeight-8mQL2Q6d.js +2 -0
- package/dist/chunks/useOverlayMaxHeight-8mQL2Q6d.js.map +1 -0
- package/dist/chunks/useRequiredValueInput-gYN8I-LY.js +2 -0
- package/dist/chunks/useRequiredValueInput-gYN8I-LY.js.map +1 -0
- package/dist/chunks/useToastRegionQueue-CuAMxAIA.js +2 -0
- package/dist/chunks/useToastRegionQueue-CuAMxAIA.js.map +1 -0
- package/dist/chunks/{useTransitionState-e5ToY7eX.js → useTransitionState-sQUQey74.js} +2 -2
- package/dist/chunks/useTransitionState-sQUQey74.js.map +1 -0
- package/dist/chunks/validationClassName-gRGs4KBm.js.map +1 -1
- package/dist/chunks/{visibleState-B_i1zHu2.js → visibleState-CWyQak65.js} +2 -2
- package/dist/chunks/visibleState-CWyQak65.js.map +1 -0
- package/dist/close-button.d.ts +1 -1
- package/dist/close-button.js +1 -1
- package/dist/collapse.d.ts +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.d.ts +1 -1
- package/dist/combobox.js +1 -1
- package/dist/context-menu.d.ts +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.d.ts +1 -1
- package/dist/datepicker.js +1 -1
- package/dist/divider.d.ts +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.d.ts +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.d.ts +1 -1
- package/dist/form-field.js +1 -1
- package/dist/form.d.ts +1 -1
- package/dist/form.js +1 -1
- package/dist/grid.d.ts +1 -1
- package/dist/grid.js +1 -1
- package/dist/icon.d.ts +1 -1
- package/dist/icon.js +1 -1
- package/dist/index.d.ts +68 -68
- package/dist/index.js +1 -1
- package/dist/input-adorn.d.ts +1 -1
- package/dist/input-adorn.js +1 -1
- package/dist/input-group.d.ts +1 -1
- package/dist/input-group.js +1 -1
- package/dist/link.d.ts +1 -1
- package/dist/link.js +1 -1
- package/dist/list.d.ts +1 -1
- package/dist/list.js +1 -1
- package/dist/menu.d.ts +2 -2
- package/dist/menu.js +1 -1
- package/dist/modal.d.ts +1 -1
- package/dist/modal.js +1 -1
- package/dist/nav-overflow.d.ts +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.d.ts +1 -1
- package/dist/navbar.js +1 -1
- package/dist/notification.d.ts +1 -1
- package/dist/notification.js +1 -1
- package/dist/number-field.d.ts +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/password-strength.d.ts +1 -1
- package/dist/password-strength.js +1 -1
- package/dist/placeholder.d.ts +1 -1
- package/dist/placeholder.js +1 -1
- package/dist/popover.d.ts +1 -1
- package/dist/popover.js +1 -1
- package/dist/portal.d.ts +1 -1
- package/dist/portal.js +1 -1
- package/dist/progress.d.ts +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/scrollspy.d.ts +1 -1
- package/dist/scrollspy.js +1 -1
- package/dist/search-field.d.ts +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.d.ts +1 -1
- package/dist/skeleton.js +1 -1
- package/dist/spinner.d.ts +1 -1
- package/dist/spinner.js +1 -1
- package/dist/stack.d.ts +1 -1
- package/dist/stack.js +1 -1
- package/dist/static-table.js +1 -1
- package/dist/stepper.d.ts +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.d.ts +1 -1
- package/dist/tabs.js +1 -1
- package/dist/text-input.d.ts +1 -1
- package/dist/text-input.js +1 -1
- package/dist/textarea.d.ts +1 -1
- package/dist/textarea.js +1 -1
- package/dist/time-field.d.ts +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.d.ts +1 -1
- package/dist/tooltip.js +1 -1
- package/dist/tree.d.ts +1 -1
- package/dist/tree.js +1 -1
- package/dist/visually-hidden.d.ts +1 -1
- package/dist/visually-hidden.js +1 -1
- package/package.json +29 -28
- package/dist/chunks/Button-BoymWE-L.js +0 -2
- package/dist/chunks/Button-BoymWE-L.js.map +0 -1
- package/dist/chunks/Chip-DCaWaBqo.js +0 -2
- package/dist/chunks/Chip-DCaWaBqo.js.map +0 -1
- package/dist/chunks/CloseButton-DPgQztE0.js +0 -2
- package/dist/chunks/CloseButton-DPgQztE0.js.map +0 -1
- package/dist/chunks/ComboboxListBox-Cm3L1ULl.js +0 -2
- package/dist/chunks/ComboboxListBox-Cm3L1ULl.js.map +0 -1
- package/dist/chunks/DateSegment-2agXAd0f.js +0 -2
- package/dist/chunks/DateSegment-2agXAd0f.js.map +0 -1
- package/dist/chunks/FormHelp-AE6_iSLJ.js +0 -2
- package/dist/chunks/FormHelp-AE6_iSLJ.js.map +0 -1
- package/dist/chunks/FormLabel-CYcQiFUI.js +0 -2
- package/dist/chunks/FormLabel-CYcQiFUI.js.map +0 -1
- package/dist/chunks/Icon-DLB1f88W.js.map +0 -1
- package/dist/chunks/Link-DyZyAQFj.js +0 -2
- package/dist/chunks/Link-DyZyAQFj.js.map +0 -1
- package/dist/chunks/Menu-CSBg2Zmc.js +0 -2
- package/dist/chunks/Menu-CSBg2Zmc.js.map +0 -1
- package/dist/chunks/MenuToggle-7RQ0dmtZ.js +0 -2
- package/dist/chunks/MenuToggle-7RQ0dmtZ.js.map +0 -1
- package/dist/chunks/Portal-CgeR1WXV.js +0 -2
- package/dist/chunks/Portal-CgeR1WXV.js.map +0 -1
- package/dist/chunks/RangeCalendar-BJl-j4W2.js +0 -2
- package/dist/chunks/RangeCalendar-BJl-j4W2.js.map +0 -1
- package/dist/chunks/VisuallyHidden-C2dM7HhC.js +0 -2
- package/dist/chunks/VisuallyHidden-C2dM7HhC.js.map +0 -1
- package/dist/chunks/accordion-B8UWyvQB.js +0 -2
- package/dist/chunks/accordion-B8UWyvQB.js.map +0 -1
- package/dist/chunks/alert-3kTBfWFw.js +0 -2
- package/dist/chunks/alert-3kTBfWFw.js.map +0 -1
- package/dist/chunks/autocomplete-Baf9VSHN.js +0 -2
- package/dist/chunks/autocomplete-Baf9VSHN.js.map +0 -1
- package/dist/chunks/avatar-MklqAKcz.js +0 -2
- package/dist/chunks/avatar-MklqAKcz.js.map +0 -1
- package/dist/chunks/badge-D2oztCvs.js.map +0 -1
- package/dist/chunks/breadcrumb-CHxTiZLt.js +0 -2
- package/dist/chunks/breadcrumb-CHxTiZLt.js.map +0 -1
- package/dist/chunks/button-group-BGppPrIv.js +0 -2
- package/dist/chunks/button-group-BGppPrIv.js.map +0 -1
- package/dist/chunks/card-CTP9K8xG.js +0 -2
- package/dist/chunks/card-CTP9K8xG.js.map +0 -1
- package/dist/chunks/carousel-fTVPqnSV.js +0 -2
- package/dist/chunks/carousel-fTVPqnSV.js.map +0 -1
- package/dist/chunks/checkbox-ZyQn5Ku5.js +0 -2
- package/dist/chunks/checkbox-ZyQn5Ku5.js.map +0 -1
- package/dist/chunks/chip-input-BpVDRERg.js +0 -2
- package/dist/chunks/chip-input-BpVDRERg.js.map +0 -1
- package/dist/chunks/collapse--Go2Y73B.js.map +0 -1
- package/dist/chunks/color-input-Bwl5ef5B.js +0 -2
- package/dist/chunks/color-input-Bwl5ef5B.js.map +0 -1
- package/dist/chunks/colorClassNames-CEh5Yzfp.js +0 -2
- package/dist/chunks/colorClassNames-CEh5Yzfp.js.map +0 -1
- package/dist/chunks/combobox-Bp1tIaiW.js +0 -2
- package/dist/chunks/combobox-Bp1tIaiW.js.map +0 -1
- package/dist/chunks/context-menu-B4a0tS-h.js +0 -2
- package/dist/chunks/context-menu-B4a0tS-h.js.map +0 -1
- package/dist/chunks/datagrid-DOYxx0sF.js +0 -3
- package/dist/chunks/datagrid-DOYxx0sF.js.map +0 -1
- package/dist/chunks/datepicker-bOiM_zhJ.js +0 -2
- package/dist/chunks/datepicker-bOiM_zhJ.js.map +0 -1
- package/dist/chunks/dialogTransition-i9vw0i2Z.js.map +0 -1
- package/dist/chunks/divider-CjbF4OfA.js +0 -2
- package/dist/chunks/divider-CjbF4OfA.js.map +0 -1
- package/dist/chunks/drawer-C7Tz4XU_.js +0 -2
- package/dist/chunks/drawer-C7Tz4XU_.js.map +0 -1
- package/dist/chunks/file-input-CDM6qrmV.js +0 -2
- package/dist/chunks/file-input-CDM6qrmV.js.map +0 -1
- package/dist/chunks/flex-B52oLCCC.js.map +0 -1
- package/dist/chunks/floating-input-DmSZZc27.js +0 -2
- package/dist/chunks/floating-input-DmSZZc27.js.map +0 -1
- package/dist/chunks/focus-ring-SR_LwaN7.js +0 -2
- package/dist/chunks/focus-ring-SR_LwaN7.js.map +0 -1
- package/dist/chunks/focusRedirect-BrvK3U_o.js +0 -2
- package/dist/chunks/focusRedirect-BrvK3U_o.js.map +0 -1
- package/dist/chunks/form-GpdAyWWi.js +0 -2
- package/dist/chunks/form-GpdAyWWi.js.map +0 -1
- package/dist/chunks/form-field-CNPGTMiW.js.map +0 -1
- package/dist/chunks/grid-C7tO-ppc.js +0 -2
- package/dist/chunks/grid-C7tO-ppc.js.map +0 -1
- package/dist/chunks/icon-BQsT6YtE.js +0 -2
- package/dist/chunks/icon-BQsT6YtE.js.map +0 -1
- package/dist/chunks/iconSlot-BNu2MrFI.js +0 -2
- package/dist/chunks/iconSlot-BNu2MrFI.js.map +0 -1
- package/dist/chunks/input-adorn-DwdX-jxA.js +0 -2
- package/dist/chunks/input-adorn-DwdX-jxA.js.map +0 -1
- package/dist/chunks/input-group-Cuiuf4Dl.js +0 -2
- package/dist/chunks/input-group-Cuiuf4Dl.js.map +0 -1
- package/dist/chunks/list-07e2a1Ym.js +0 -2
- package/dist/chunks/list-07e2a1Ym.js.map +0 -1
- package/dist/chunks/menu-Upf6P-2P.js +0 -2
- package/dist/chunks/menu-Upf6P-2P.js.map +0 -1
- package/dist/chunks/modal-bgDR29Jh.js +0 -2
- package/dist/chunks/modal-bgDR29Jh.js.map +0 -1
- package/dist/chunks/nav-DI6oEULI.js +0 -2
- package/dist/chunks/nav-DI6oEULI.js.map +0 -1
- package/dist/chunks/nav-overflow-DlLer6EK.js +0 -2
- package/dist/chunks/nav-overflow-DlLer6EK.js.map +0 -1
- package/dist/chunks/navOverflow-B5krZe6D.js +0 -2
- package/dist/chunks/navOverflow-B5krZe6D.js.map +0 -1
- package/dist/chunks/navVariant-DeGTk9B7.js.map +0 -1
- package/dist/chunks/navbar-DxIwt0sc.js +0 -2
- package/dist/chunks/navbar-DxIwt0sc.js.map +0 -1
- package/dist/chunks/notification-Dbci5Ka3.js +0 -2
- package/dist/chunks/notification-Dbci5Ka3.js.map +0 -1
- package/dist/chunks/number-field-IBIX2IWH.js +0 -2
- package/dist/chunks/number-field-IBIX2IWH.js.map +0 -1
- package/dist/chunks/otp-input-ws393uPB.js +0 -2
- package/dist/chunks/otp-input-ws393uPB.js.map +0 -1
- package/dist/chunks/overlayPlacement-BtS90IVf.js.map +0 -1
- package/dist/chunks/pagination-BREQp-ZC.js +0 -2
- package/dist/chunks/pagination-BREQp-ZC.js.map +0 -1
- package/dist/chunks/password-strength-DDK8pHRq.js.map +0 -1
- package/dist/chunks/placeholder-DhNpUJqv.js +0 -2
- package/dist/chunks/placeholder-DhNpUJqv.js.map +0 -1
- package/dist/chunks/polymorphic-BhGNZQja.js +0 -2
- package/dist/chunks/polymorphic-BhGNZQja.js.map +0 -1
- package/dist/chunks/popover-Bdg8D4sm.js +0 -2
- package/dist/chunks/popover-Bdg8D4sm.js.map +0 -1
- package/dist/chunks/progress-BqgWezdG.js +0 -2
- package/dist/chunks/progress-BqgWezdG.js.map +0 -1
- package/dist/chunks/radio-B6gJdtoN.js +0 -2
- package/dist/chunks/radio-B6gJdtoN.js.map +0 -1
- package/dist/chunks/range-input-CT_8TKL7.js +0 -2
- package/dist/chunks/range-input-CT_8TKL7.js.map +0 -1
- package/dist/chunks/renderFormCheck-DN_-V62U.js +0 -2
- package/dist/chunks/renderFormCheck-DN_-V62U.js.map +0 -1
- package/dist/chunks/renderFormField-Brkw1yA6.js +0 -2
- package/dist/chunks/renderFormField-Brkw1yA6.js.map +0 -1
- package/dist/chunks/renderMenuItemContent-DUezZrpj.js +0 -2
- package/dist/chunks/renderMenuItemContent-DUezZrpj.js.map +0 -1
- package/dist/chunks/scrollspy-C2HmrnZ4.js +0 -2
- package/dist/chunks/scrollspy-C2HmrnZ4.js.map +0 -1
- package/dist/chunks/search-field--nDoCI_E.js +0 -2
- package/dist/chunks/search-field--nDoCI_E.js.map +0 -1
- package/dist/chunks/select-BwJIfv9f.js +0 -2
- package/dist/chunks/select-BwJIfv9f.js.map +0 -1
- package/dist/chunks/skeleton-Bjv9gGd3.js +0 -2
- package/dist/chunks/skeleton-Bjv9gGd3.js.map +0 -1
- package/dist/chunks/slot-CNhFZdHF.js +0 -2
- package/dist/chunks/slot-CNhFZdHF.js.map +0 -1
- package/dist/chunks/spinner-DBuvQvMR.js +0 -2
- package/dist/chunks/spinner-DBuvQvMR.js.map +0 -1
- package/dist/chunks/stack-DK5F53VT.js +0 -2
- package/dist/chunks/stack-DK5F53VT.js.map +0 -1
- package/dist/chunks/static-table-uu297Liz.js +0 -2
- package/dist/chunks/static-table-uu297Liz.js.map +0 -1
- package/dist/chunks/stepper-CVXMJ2yg.js +0 -2
- package/dist/chunks/stepper-CVXMJ2yg.js.map +0 -1
- package/dist/chunks/switch-C6s3LxEv.js +0 -2
- package/dist/chunks/switch-C6s3LxEv.js.map +0 -1
- package/dist/chunks/table-DPLOygg0.js +0 -2
- package/dist/chunks/table-DPLOygg0.js.map +0 -1
- package/dist/chunks/tableClassName-DleBjOj2.js +0 -2
- package/dist/chunks/tableClassName-DleBjOj2.js.map +0 -1
- package/dist/chunks/tabs-91T7-8qq.js +0 -2
- package/dist/chunks/tabs-91T7-8qq.js.map +0 -1
- package/dist/chunks/text-input-B4pTv6SU.js +0 -2
- package/dist/chunks/text-input-B4pTv6SU.js.map +0 -1
- package/dist/chunks/textarea-1A1nABQE.js +0 -2
- package/dist/chunks/textarea-1A1nABQE.js.map +0 -1
- package/dist/chunks/time-field-B3MA7ED_.js +0 -2
- package/dist/chunks/time-field-B3MA7ED_.js.map +0 -1
- package/dist/chunks/toast-CGHl3-oU.js +0 -2
- package/dist/chunks/toast-CGHl3-oU.js.map +0 -1
- package/dist/chunks/tooltip-Bc-u6nIW.js +0 -2
- package/dist/chunks/tooltip-Bc-u6nIW.js.map +0 -1
- package/dist/chunks/tree-Cql1veeZ.js +0 -2
- package/dist/chunks/tree-Cql1veeZ.js.map +0 -1
- package/dist/chunks/useButtonSemantics-CILM_lhi.js.map +0 -1
- package/dist/chunks/useDialogElement-CgOnJAzu.js +0 -2
- package/dist/chunks/useDialogElement-CgOnJAzu.js.map +0 -1
- package/dist/chunks/useDisabledAnchorGuard-Cz58UCXy.js +0 -2
- package/dist/chunks/useDisabledAnchorGuard-Cz58UCXy.js.map +0 -1
- package/dist/chunks/useFloatingOverlay-DLIvwx-8.js +0 -2
- package/dist/chunks/useFloatingOverlay-DLIvwx-8.js.map +0 -1
- package/dist/chunks/useForkedRef-DVEfT-KI.js +0 -2
- package/dist/chunks/useForkedRef-DVEfT-KI.js.map +0 -1
- package/dist/chunks/useFormField-BOqmBTC4.js +0 -2
- package/dist/chunks/useFormField-BOqmBTC4.js.map +0 -1
- package/dist/chunks/useOpenStateProps-DykUbnPJ.js.map +0 -1
- package/dist/chunks/useToastRegionQueue-CIV5SdiE.js +0 -2
- package/dist/chunks/useToastRegionQueue-CIV5SdiE.js.map +0 -1
- package/dist/chunks/useTransitionState-e5ToY7eX.js.map +0 -1
- package/dist/chunks/visibleState-B_i1zHu2.js.map +0 -1
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"context-menu-B4a0tS-h.js","names":[],"sources":["../../src/components/context-menu/ContextMenu.tsx"],"sourcesContent":["import React, {\n ElementType,\n ForwardRefRenderFunction,\n ReactElement,\n useEffect,\n useId,\n useMemo,\n useRef,\n useState\n} from 'react'\nimport classNames from 'classnames'\nimport { mergeProps, useLocale, useOverlayPosition } from 'react-aria'\nimport { useMenuTriggerState } from 'react-stately'\n\nimport {\n useFloatingOverlay,\n useForkedRef,\n useIsomorphicLayoutEffect,\n useOpenStateProps\n} from '../../hooks'\nimport { resolveMenuOverlayPositioning, toAriaPlacement } from '../../utils/overlayPlacement'\nimport {\n createPolymorphicComponent,\n PolymorphicComponentProps,\n PolymorphicRef\n} from '../../utils/polymorphic'\nimport { MenuAutoClose, MenuContext, MenuContextProps, MenuFocusStrategy } from '../menu/Menu'\n\n// How long a touch or pen has to stay down, and how far it may travel meanwhile, for a long\n// press. react-aria's `useLongPress` uses the same threshold; it isn't used here because its\n// `usePress` prevents the default of key and pointer events on the element it is given, which\n// would break the buttons and links inside a region.\nconst LONG_PRESS_MS = 500\nconst LONG_PRESS_TOLERANCE_PX = 10\n// iOS emits a click when the finger that long-pressed lifts, on whatever is under it by then: the\n// first item of the menu that has just opened at the finger. A click this soon after a long press\n// is that release, not a choice.\nconst LONG_PRESS_CLICK_WINDOW_MS = 1000\n\n// Where the menu opens: at a point (the pointer, or a finger's long press), or at an element (the\n// one focused when the keyboard asked for it). Read from a ref inside `getTargetRect`, since\n// `useOverlayPosition` captures that function once.\ntype Anchor = { kind: 'point'; x: number; y: number } | { kind: 'element'; element: Element }\n\nconst pointRect = (x: number, y: number): DOMRect =>\n ({\n x,\n y,\n top: y,\n left: x,\n right: x,\n bottom: y,\n width: 0,\n height: 0,\n toJSON: () => ({ x, y, width: 0, height: 0 })\n }) as DOMRect\n\ntype ContextMenuOwnProps<C extends ElementType> = {\n /**\n * Controls which presses close the menu. `true` closes on a click on an item and on a press\n * outside the menu. `false` leaves closing to the Escape key and `visible`. `'inside'` closes\n * only on a click on an item. `'outside'` closes only on a press outside the menu.\n */\n autoClose?: MenuAutoClose\n /**\n * A string of all className you want applied to the component.\n */\n className?: string\n /**\n * Component used for the root node, the region the menu opens from. Either a string to use an\n * HTML element or a component.\n *\n * @default 'div'\n */\n component?: C\n /**\n * Whether the menu is open when it first renders. Use it instead of `visible` when nothing\n * outside needs to control the menu. Opened this way, the menu sits under the region's start\n * edge, since no pointer has asked for it anywhere.\n */\n defaultVisible?: boolean\n /**\n * Leaves the region to the browser: a right-click shows the browser's own menu, a long press\n * and the keys do nothing.\n */\n disabled?: boolean\n /**\n * Callback fired when the menu hides.\n */\n onHide?: () => void\n /**\n * Callback fired when the menu shows.\n */\n onShow?: () => void\n /**\n * Callback fired when the menu asks to show or hide: a right-click, a long press or Shift+F10\n * in the region, a click on an item, a press outside, the Escape key, or the closing of the\n * dialog it is in. Receives the state it asks for. With `visible` set, the menu changes only\n * when `visible` does.\n */\n onVisibleChange?: (visible: boolean) => void\n /**\n * Whether the menu is open. Setting it makes the menu controlled: it shows and hides only when\n * this changes, so pair it with `onVisibleChange`. Leave it unset, or use `defaultVisible`, for\n * a menu that opens and closes itself.\n */\n visible?: boolean\n}\n\nexport type ContextMenuProps<C extends ElementType = 'div'> = PolymorphicComponentProps<\n C,\n ContextMenuOwnProps<C>\n>\n\ntype ContextMenuComponent = (<C extends ElementType = 'div'>(\n props: ContextMenuProps<C> & { ref?: PolymorphicRef<C> }\n) => ReactElement | null) & { displayName?: string }\n\n// The region a context menu belongs to. The region is the component's own element: `className`,\n// `style`, the rest of the props and the ref go to it. The menu is a `MenuList` among its\n// children, with `Menu`'s own items, headers, dividers and submenus: this component provides\n// `Menu`'s context, so `MenuList` renders, positions, portals and navigates the list as it does\n// under a `Menu`. What differs is the trigger, the whole region rather than a button, and the\n// position, the pointer rather than that button.\nfunction ContextMenuRender<C extends ElementType = 'div'>(\n {\n children,\n autoClose = true,\n className,\n component,\n defaultVisible,\n disabled = false,\n id,\n onHide,\n onShow,\n onVisibleChange,\n visible,\n ...rest\n }: ContextMenuProps<C>,\n ref: PolymorphicRef<C>\n) {\n const Component = component ?? 'div'\n const generatedId = useId()\n // The list is labelled by the region, the way `Menu`'s is labelled by its toggle. A caller\n // that names the list itself (`aria-label` on the `MenuList`) drops that link.\n const [triggerId, setTriggerId] = useState(\n () => (id as string | undefined) ?? `${generatedId}-trigger`\n )\n const menuId = `${generatedId}-menu`\n const regionRef = useRef<HTMLElement | null>(null)\n const forkedRef = useForkedRef(ref, regionRef)\n\n // Under `asChild` the child's own `id` wins the merge (`Slot`), so the label follows the element\n // that rendered rather than the id this component asked for. The list exists only after\n // hydration, so the server's HTML never refers to the id this corrects.\n useIsomorphicLayoutEffect(() => {\n const rendered = regionRef.current?.id\n if (rendered && rendered !== triggerId) setTriggerId(rendered)\n }, [triggerId])\n\n // iOS shows its own callout for a long press on a link or an image; the region's menu takes\n // its place. Set on the element rather than through `style`, which a slotted child's own\n // `style` would replace. The property is inherited, so the region's children lose it too.\n useIsomorphicLayoutEffect(() => {\n regionRef.current?.style.setProperty('-webkit-touch-callout', 'none')\n }, [])\n const overlayRef = useRef<HTMLElement | null>(null)\n // `MenuToggle` writes into these two: a `MenuToggle` inside a region belongs to no `Menu`, so\n // it gets refs of its own to write to rather than the region's.\n const toggleNodeRef = useRef<HTMLElement | null>(null)\n const targetRef = useRef<HTMLElement | null>(null)\n // Portaled `MenuSubmenu` panels register themselves here, so a press inside one counts as inside\n // the menu (see `MenuContext.registerOverlay`).\n const submenuOverlaysRef = useRef<Map<string, HTMLElement>>(new Map())\n const registerOverlay = (overlayId: string, node: HTMLElement | null) => {\n if (node) submenuOverlaysRef.current.set(overlayId, node)\n else submenuOverlaysRef.current.delete(overlayId)\n }\n\n const state = useMenuTriggerState(\n useOpenStateProps({ defaultVisible, onVisibleChange, visible }, 'ContextMenu')\n )\n\n const anchorRef = useRef<Anchor | null>(null)\n // Bumped with each request to open, so the menu is placed again when a second right-click\n // moves an open menu: `useOverlayPosition` positions on its own only when the open state\n // changes.\n const [anchorVersion, setAnchorVersion] = useState(0)\n // The element focused when the menu opened, focused again when the menu closes from the\n // keyboard or an item. Cleared by a press outside, which puts focus somewhere else itself.\n const restoreFocusRef = useRef<HTMLElement | null>(null)\n\n const openAt = (anchor: Anchor) => {\n if (disabled) return\n anchorRef.current = anchor\n if (!state.isOpen) restoreFocusRef.current = document.activeElement as HTMLElement | null\n setAnchorVersion((version) => version + 1)\n state.open('first')\n }\n\n const hide = () => {\n restoreFocusRef.current = null\n state.close()\n }\n const close = () => state.close()\n\n useEffect(() => {\n if (state.isOpen) return\n const element = restoreFocusRef.current\n restoreFocusRef.current = null\n if (!element || !document.contains(element)) return\n // Only when the menu still holds focus, or nothing does: focus the user has put on another\n // control since, or an app closing the menu through `visible` while they type elsewhere,\n // stays there (`Popover` does the same).\n const active = document.activeElement\n const focusIsLoose = !active || active === document.body\n const focusIsInMenu = !!active && !!overlayRef.current?.contains(active)\n if (focusIsLoose || focusIsInMenu) element.focus()\n }, [state.isOpen])\n\n // Resolves the `<dialog>` the region is in, if any, so the list portals into its top layer and\n // closes with it, and fires `onShow`/`onHide`.\n const portalContainer = useFloatingOverlay({\n close: state.close,\n isOpen: state.isOpen,\n onHide,\n onShow,\n triggerRef: regionRef\n })\n\n // A context menu opens toward the reading direction: its start edge at the pointer, and flipped\n // above the pointer when there is no room below (`useOverlayPosition`'s own flip).\n const { direction } = useLocale()\n const placement = direction === 'rtl' ? 'bottom-end' : 'bottom-start'\n\n const {\n overlayProps,\n placement: resolvedPlacement,\n updatePosition\n } = useOverlayPosition({\n // The region is the target `useOverlayPosition` measures; `getTargetRect` replaces its\n // rectangle with the anchor's. A menu opened by `defaultVisible` or `visible` alone, with no\n // anchor yet, sits under the region's start edge.\n targetRef: regionRef,\n overlayRef,\n placement: toAriaPlacement(placement),\n containerPadding: 8,\n isOpen: state.isOpen,\n // See `Menu`: `null` opts out of closing on any window scroll, so the menu scrolls with the\n // page instead of vanishing.\n onClose: null,\n getTargetRect: () => {\n const anchor = anchorRef.current\n if (!anchor) return undefined\n return anchor.kind === 'point'\n ? pointRect(anchor.x, anchor.y)\n : anchor.element.getBoundingClientRect()\n }\n })\n\n useIsomorphicLayoutEffect(() => {\n if (state.isOpen) updatePosition()\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [state.isOpen, anchorVersion])\n\n const { menuStyle, placementAttr } = resolveMenuOverlayPositioning(\n overlayProps.style,\n placement,\n resolvedPlacement\n )\n\n // Presses outside the menu, and clicks on its items. A press rather than a click outside, as\n // a native menu closes: the click that follows a long press's release then finds no open menu\n // to close, and a right-click elsewhere closes this menu before it opens another.\n useEffect(() => {\n if (!state.isOpen || autoClose === false) return undefined\n\n const isInMenu = (target: Node) =>\n !!overlayRef.current?.contains(target) ||\n Array.from(submenuOverlaysRef.current.values()).some((node) => node.contains(target))\n\n const handlePointerDown = (event: PointerEvent) => {\n const target = event.target as Node\n if (isInMenu(target) || autoClose === 'inside') return\n // A right-click inside the region asks for the menu at a new place: the `contextmenu`\n // event that follows moves it.\n if (event.button === 2 && regionRef.current?.contains(target)) return\n hide()\n }\n\n const handleClick = (event: MouseEvent) => {\n const target = event.target as HTMLElement\n if (!isInMenu(target) || autoClose === 'outside') return\n // A form control inside the menu is used in place, as in `Menu`.\n if (/input|select|option|textarea|form/i.test(target.tagName ?? '')) return\n close()\n }\n\n // Tab has moved focus out of the menu by the time the key comes up.\n const handleKeyUp = (event: KeyboardEvent) => {\n if (event.key !== 'Tab' || isInMenu(event.target as Node)) return\n hide()\n }\n\n window.addEventListener('pointerdown', handlePointerDown)\n window.addEventListener('click', handleClick)\n window.addEventListener('keyup', handleKeyUp)\n\n return () => {\n window.removeEventListener('pointerdown', handlePointerDown)\n window.removeEventListener('click', handleClick)\n window.removeEventListener('keyup', handleKeyUp)\n }\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [state.isOpen, autoClose])\n\n // Escape closes the menu wherever focus is, independent of `autoClose`, as in `Menu`.\n useEffect(() => {\n if (!state.isOpen) return undefined\n\n const handleEscape = (event: KeyboardEvent) => {\n if (event.key === 'Escape') close()\n }\n\n window.addEventListener('keydown', handleEscape)\n return () => window.removeEventListener('keydown', handleEscape)\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [state.isOpen])\n\n // Becoming `disabled` closes an open menu. Not on mount: `disabled` with `visible` is the\n // caller's to hold.\n const wasDisabledRef = useRef(disabled)\n useEffect(() => {\n if (disabled && !wasDisabledRef.current) hide()\n wasDisabledRef.current = disabled\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [disabled])\n\n // The list is a React child of the region, so its events reach these handlers through the\n // portal: a right-click on an item, or Shift+F10 with an item focused, is not a request to open\n // the menu somewhere else. Only what happens in the region's own element counts.\n const isInRegion = (event: React.SyntheticEvent<HTMLElement>) =>\n event.currentTarget.contains(event.target as Node)\n\n // The browser's own menu is replaced. When `disabled`, the event isn't handled at all, so the\n // browser's menu shows.\n const handleContextMenu = (event: React.MouseEvent<HTMLElement>) => {\n if (disabled) return\n // Prevented for the list too: a browser that fires `contextmenu` for the context menu key on\n // key up (Chromium) fires it at the item the key down has just focused.\n event.preventDefault()\n if (!isInRegion(event)) return\n openAt({ kind: 'point', x: event.clientX, y: event.clientY })\n }\n\n const isContextMenuKey = (event: React.KeyboardEvent<HTMLElement>) =>\n event.key === 'ContextMenu' || (event.key === 'F10' && event.shiftKey)\n\n // Shift+F10 and the context menu key, on any element in the region: the menu opens under that\n // element. Preventing the default keeps the browser from firing its own `contextmenu` event\n // for the key, which would move the menu to where the browser reports the key. Firefox fires\n // it from the key down, Chromium from the key up, so both are prevented.\n const handleKeyDown = (event: React.KeyboardEvent<HTMLElement>) => {\n if (disabled || !isContextMenuKey(event)) return\n event.preventDefault()\n if (!isInRegion(event)) return\n openAt({ kind: 'element', element: event.target as Element })\n }\n\n const handleKeyUp = (event: React.KeyboardEvent<HTMLElement>) => {\n if (!disabled && isContextMenuKey(event)) event.preventDefault()\n }\n\n // A long press by a finger or a pen. A browser that fires `contextmenu` for it as well (Android)\n // opens the menu through `handleContextMenu` at the same point.\n const longPressRef = useRef<{ timer: number; x: number; y: number } | null>(null)\n // While a finger is down, the region selects no text: iOS starts selecting at about the same\n // time the press becomes long. Restored when the finger lifts.\n const userSelectRef = useRef<string | null>(null)\n const restoreUserSelect = () => {\n const region = regionRef.current\n if (!region || userSelectRef.current === null) return\n region.style.setProperty('-webkit-user-select', userSelectRef.current)\n region.style.setProperty('user-select', userSelectRef.current)\n userSelectRef.current = null\n }\n const cancelLongPress = () => {\n if (!longPressRef.current) return\n window.clearTimeout(longPressRef.current.timer)\n longPressRef.current = null\n }\n const endPress = () => {\n cancelLongPress()\n restoreUserSelect()\n }\n // The click the release of a long press emits (iOS) lands on the item that has just opened\n // under the finger: swallowed before it reaches the item or the click-inside dismissal.\n const clickSwallowRef = useRef<(() => void) | null>(null)\n const stopSwallowingClicks = () => {\n clickSwallowRef.current?.()\n clickSwallowRef.current = null\n }\n const swallowNextClick = () => {\n stopSwallowingClicks()\n const swallow = (event: MouseEvent) => {\n event.preventDefault()\n event.stopPropagation()\n stopSwallowingClicks()\n }\n window.addEventListener('click', swallow, { capture: true })\n const timer = window.setTimeout(stopSwallowingClicks, LONG_PRESS_CLICK_WINDOW_MS)\n clickSwallowRef.current = () => {\n window.removeEventListener('click', swallow, { capture: true })\n window.clearTimeout(timer)\n }\n }\n\n useEffect(\n () => () => {\n endPress()\n stopSwallowingClicks()\n },\n // eslint-disable-next-line react-hooks/exhaustive-deps\n []\n )\n\n const handlePointerDown = (event: React.PointerEvent<HTMLElement>) => {\n if (disabled || event.pointerType === 'mouse' || !isInRegion(event)) return\n endPress()\n const region = event.currentTarget\n userSelectRef.current = region.style.getPropertyValue('user-select')\n region.style.setProperty('-webkit-user-select', 'none')\n region.style.setProperty('user-select', 'none')\n const { clientX: x, clientY: y } = event\n longPressRef.current = {\n x,\n y,\n timer: window.setTimeout(() => {\n longPressRef.current = null\n swallowNextClick()\n openAt({ kind: 'point', x, y })\n }, LONG_PRESS_MS)\n }\n }\n\n const handlePointerMove = (event: React.PointerEvent<HTMLElement>) => {\n const press = longPressRef.current\n if (!press) return\n if (Math.hypot(event.clientX - press.x, event.clientY - press.y) > LONG_PRESS_TOLERANCE_PX) {\n cancelLongPress()\n }\n }\n\n const contextValue: MenuContextProps = useMemo(\n () => ({\n autoClose,\n close,\n container: portalContainer ?? true,\n focusStrategy: state.focusStrategy as MenuFocusStrategy | null,\n hide,\n menuId,\n menuStyle,\n menuTriggerProps: {},\n overlayRef,\n placementAttr,\n reference: 'toggle',\n registerOverlay,\n show: (focusStrategy) => state.open(focusStrategy ?? 'first'),\n targetRef,\n toggle: (focusStrategy) => state.toggle(focusStrategy ?? 'first'),\n toggleNodeRef,\n triggerId,\n visible: state.isOpen\n }),\n // eslint-disable-next-line react-hooks/exhaustive-deps\n [\n autoClose,\n menuId,\n menuStyle,\n placementAttr,\n portalContainer,\n state.focusStrategy,\n state.isOpen,\n triggerId\n ]\n )\n\n return (\n <MenuContext.Provider value={contextValue}>\n <Component\n id={triggerId}\n className={classNames('context-menu', className)}\n {...(mergeProps(\n {\n onContextMenu: handleContextMenu,\n onKeyDown: handleKeyDown,\n onKeyUp: handleKeyUp,\n onPointerDown: handlePointerDown,\n onPointerMove: handlePointerMove,\n onPointerUp: endPress,\n onPointerCancel: endPress,\n onPointerLeave: endPress\n },\n rest\n ) as Record<string, unknown>)}\n ref={forkedRef}\n >\n {children}\n </Component>\n </MenuContext.Provider>\n )\n}\n\nexport const ContextMenu = createPolymorphicComponent<ContextMenuComponent>(\n ContextMenuRender as ForwardRefRenderFunction<Element, ContextMenuProps<ElementType>>,\n 'ContextMenu'\n)\n"],"mappings":"knBAgCA,MAYM,GAAa,EAAW,KAC3B,CACC,IACA,IACA,IAAK,EACL,KAAM,EACN,MAAO,EACP,OAAQ,EACR,MAAO,EACP,OAAQ,EACR,YAAe,CAAE,IAAG,IAAG,MAAO,EAAG,OAAQ,CAAE,EAC7C,GAqEF,SAAS,EACP,CACE,WACA,YAAY,GACZ,YACA,YACA,iBACA,WAAW,GACX,KACA,UACA,UACA,mBACA,WACA,GAAG,IAEL,GACA,CACA,IAAM,GAAY,GAAa,MACzB,EAAc,EAAM,EAGpB,CAAC,EAAW,IAAgB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AC9B,CACL,YACA,QACA,UAAW,GAAmB,GAC9B,cAAe,EAAM,cACrB,OACA,SACA,YACA,iBAAkB,CAAC,EACnB,aACA,gBACA,UAAW,SACX,kBACA,KAAO,GAAkB,EAAM,KAAK,GAAiB,OAAO,EAC5D,YACA,OAAS,GAAkB,EAAM,OAAO,GAAiB,OAAO,EAChE,gBACA,YACA,QAAS,EAAM,MACjB,GAEA,CACE,EACA,EACA,EACA,EACA,EACA,EAAM,cACN,EAAM,OACN,CACF,CACF,EAEA,OACE,EAAA,cAAC,GAAY,SAAb,CAAsB,MAAO,EAqBP,EApBpB,EAAA,cAAC,GAAD,CACE,GAAI,EACJ,UAAW,GAAW,eAAgB,CAAS,EAC/C,GAAK,EACH,CACE,cAAe,GACf,UAAW,GACX,QAAS,GACT,cAAe,GACf,cAAe,GACf,YAAa,EACb,gBAAiB,EACjB,eAAgB,CAClB,EACA,EACF,EACA,IAAK,CAGI,EADR,CACQ,CACS,CAE1B,CAEA,MAAa,EAAc,EACzB,EACA,aACF"}
|
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
import"./focus-ring-SR_LwaN7.js";import{t as e}from"./useForkedRef-DVEfT-KI.js";import{n as t}from"./lazyElement-tfMG21pZ.js";import{t as n}from"./tableClassName-DleBjOj2.js";import r,{forwardRef as i,useEffect as a,useId as o,useMemo as s,useRef as c,useState as l}from"react";import u from"classnames";import{useCheckbox as d}from"react-aria";import{useToggleState as f}from"react-stately";import{Cell as p,CheckboxContext as m,Column as h,Row as g,Table as _,TableBody as v,TableHeader as y,TableLayout as b,TableLoadMoreItem as x,Virtualizer as S,useSlottedContext as C}from"react-aria-components";const w=/^\d+(\.\d+)?%?$/,T=e=>e!=null&&(typeof e==`number`||w.test(e)),E=(e,t)=>typeof e==`number`?e:e.endsWith(`%`)?parseFloat(e)/100*t:parseFloat(e);function D(e,t){let n=new Map,r=0,i=!0;for(let a of e){if(!i||!T(a.defaultWidth)){i=!1,n.set(a.id,null);continue}let e=E(a.defaultWidth,t);T(a.minWidth)&&(e=Math.max(e,E(a.minWidth,t))),T(a.maxWidth)&&(e=Math.min(e,E(a.maxWidth,t))),n.set(a.id,{id:a.id,offset:r,width:e}),r+=e}return n}const O=e=>{let t=new Map;return e.querySelectorAll(`[role="columnheader"]`).forEach(e=>{let n=Number(e.getAttribute(`aria-colindex`));!Number.isInteger(n)||n<1||t.set(n-1,{offset:e.offsetLeft,width:e.offsetWidth})}),t};function k(e,t){let[n,r]=l(0),[i,o]=l(()=>new Map);a(()=>{let e=t.current;if(!e||typeof ResizeObserver>`u`)return;let n=()=>{r(e.clientWidth),o(O(e))};n();let i=new ResizeObserver(n);return i.observe(e),()=>i.disconnect()},[t]);let c=s(()=>D(e,n),[e,n]);return s(()=>{let t=new Map;return e.forEach((e,n)=>{let r=c.get(e.id),a=i.get(n);r?t.set(e.id,r):a&&t.set(e.id,{id:e.id,...a})}),t},[e,c,i])}const A=e=>`[aria-colindex="${e+1}"]`,j=({header:e,instanceClassName:n,containerRef:i})=>{let o=t(e).props.children,c=s(()=>typeof o==`function`?[]:r.Children.toArray(o),[o]),l=c.map(e=>{if(!r.isValidElement(e))return``;let{defaultWidth:t,maxWidth:n,minWidth:i,pin:a}=e.props;return`${t??``}/${i??``}/${n??``}/${a??``}`}).join(`|`),{all:u,endIndices:d,startIndices:f}=s(()=>{let e={all:[],endIndices:[],startIndices:[]};return c.forEach((t,n)=>{if(!r.isValidElement(t))return;let{defaultWidth:i,maxWidth:a,minWidth:o,pin:s}=t.props;e.all.push({id:n,defaultWidth:i,maxWidth:a,minWidth:o}),s===`start`?e.startIndices.push(n):s===`end`&&e.endIndices.push(n)}),e},[l]),p=k(u,i),m=s(()=>{let e=new Map,t=0;for(let n=d.length-1;n>=0;n--){let r=d[n];if(r==null)continue;let i=p.get(r)?.width??0;e.set(r,{index:r,rightOffset:t}),t+=i}return e},[d,p]);if(a(()=>{let e=i.current;if(!e||m.size===0)return;let t=null,n=new Set,r=()=>{t=null;let r=e.clientWidth,i=e.scrollLeft;e.querySelectorAll(`[role="row"]`).forEach(e=>{m.forEach(({index:t,rightOffset:a})=>{let o=e.querySelector(A(t))?.parentElement;if(!o)return;let s=p.get(t);if(!s)return;let c=s.offset+s.width,l=r-a-c+i;o.style.transform=`translateX(${l}px)`,o.style.zIndex=`2`,n.add(o)})})},a=()=>{t??=requestAnimationFrame(r)};a(),e.addEventListener(`scroll`,a,{passive:!0});let o=typeof ResizeObserver>`u`?null:new ResizeObserver(a);o?.observe(e);let s=typeof MutationObserver>`u`?null:new MutationObserver(a);return s?.observe(e,{childList:!0,subtree:!0}),()=>{t!=null&&cancelAnimationFrame(t),e.removeEventListener(`scroll`,a),o?.disconnect(),s?.disconnect(),n.forEach(e=>{e.style.transform=``,e.style.zIndex=``})}},[i,m,p]),f.length===0&&d.length===0)return null;let h=[];if(f.length>0){let e=Math.max(...f);h.push(`.${n}.datagrid-scrolled-start ${A(e)} { box-shadow: var(--datagrid-pin-cue-shadow-start); }`)}if(d.length>0){let e=Math.min(...d);h.push(`.${n}.datagrid-scrolled-end ${A(e)} { box-shadow: var(--datagrid-pin-cue-shadow-end); }`)}return r.createElement(`style`,null,h.join(`
|
|
2
|
-
`))};var M=class extends b{isStickyColumn(e){let t=e.type===`column`?e.index:e.colIndex??e.index;return t!=null&&this.collection.columns[t]?.props?.pin===`start`}buildRowGroup(...e){let t=super.buildRowGroup(...e);return t.layoutInfo.rect.height=Math.max(0,t.layoutInfo.rect.height),t}};const N=i(({align:t,bordered:i,borderless:d,children:f,className:p,color:m,disabledKeys:h,estimatedRowHeight:g,footer:v,hover:y,onSelectionChange:b,onSortChange:x,rowHeight:C,selectedKeys:w,selectionMode:T=`none`,sm:E,sortDescriptor:D,...O},k)=>{let A=C===`auto`,N=s(()=>new M(A?{estimatedRowHeight:g,headingHeight:g}:{rowHeight:C}),[A,C,g]),P=c(null),F=e(k,P),I=`datagrid-${o().replace(/[^a-zA-Z0-9]/g,``)}`,[L,R]=l(!1),[z,B]=l(!1);a(()=>{let e=P.current;if(!e)return;let t=()=>{R(e.scrollLeft>0),B(Math.ceil(e.scrollLeft+e.clientWidth)<e.scrollWidth)};t(),e.addEventListener(`scroll`,t,{passive:!0});let n=typeof ResizeObserver>`u`?null:new ResizeObserver(t);return n?.observe(e),()=>{e.removeEventListener(`scroll`,t),n?.disconnect()}},[]);let V=u(`datagrid`,I,m,t&&n[t],{bordered:i,borderless:d,hoverable:y,sm:E,"datagrid-scrolled-start":L,"datagrid-scrolled-end":z},p);return r.createElement(S,{layout:N,shouldObserveItemSize:A},r.createElement(_,{"aria-label":O[`aria-label`],"aria-labelledby":O[`aria-labelledby`],className:V||void 0,disabledKeys:h,onSelectionChange:b,onSortChange:x,ref:F,selectedKeys:w,selectionMode:T,sortDescriptor:D,render:e=>r.createElement(`div`,{...e,"aria-describedby":e[`aria-describedby`]||void 0})},f),v&&r.createElement(`div`,{className:u(`datagrid-footer`,{borderless:d})},v),r.createElement(j,{containerRef:P,header:f[0],instanceClassName:I}))});N.displayName=`DataGrid`;const P={id:`__datagrid-body-loader__`},F=({children:e,className:t,dependencies:n,isLoading:i,items:a,loadingContent:o,onLoadMore:c,renderEmptyState:l})=>{let d=c!=null&&a!=null,f=s(()=>d?[...a,P]:a,[d,a]),p=s(()=>d?[...n??[],i,c,o]:n,[n,d,i,c,o]),m=d?t=>t===P?r.createElement(x,{className:`datagrid-loader`,isLoading:i,onLoadMore:i?void 0:c},o):e(t):e;return r.createElement(v,{className:u(`datagrid-body`,t),dependencies:p,items:f,renderEmptyState:l},m)},I=({children:e,className:t,colSpan:n,id:i,textValue:a})=>r.createElement(p,{className:u(`datagrid-cell`,t),colSpan:n,id:i,textValue:a},e),L=({allowsSorting:e,children:t,className:n,defaultWidth:i,id:a,isRowHeader:o,maxWidth:s,minWidth:c,pin:l,textValue:d})=>r.createElement(h,{allowsSorting:e,className:u(`datagrid-col`,l&&`datagrid-col-pinned-${l}`,n),defaultWidth:i,id:a,isRowHeader:o,maxWidth:s,minWidth:c,textValue:d,pin:l},e?({sortDirection:e})=>r.createElement(r.Fragment,null,t,r.createElement(`span`,{"aria-hidden":`true`,className:`datagrid-sort-icon`},e===`ascending`?`▲`:e===`descending`?`▼`:`⇅`)):t),R=({children:e,className:t,columns:n,dependencies:i})=>r.createElement(y,{className:u(`datagrid-header`,t),columns:n,dependencies:i},e),z=({children:e,className:t,columns:n,id:i,textValue:a})=>r.createElement(g,{className:u(`datagrid-row`,t),columns:n,id:i,textValue:a},e),B=e=>{let t=C(m,`selection`);if(!t)throw Error(`${e} must be rendered inside a DataGrid with selection enabled.`);return t},V=({className:e})=>{let t=B(`DataGridSelectionCell`);return r.createElement(U,{checkboxProps:t,className:e})},H=({className:e})=>{let t=B(`DataGridSelectAllCell`);return r.createElement(U,{checkboxProps:t,className:e})},U=({checkboxProps:e,className:t})=>{let n=f(e),i=c(null),{inputProps:a}=d(e,n,i);return r.createElement(`input`,{...a,"aria-describedby":void 0,className:t??`check-input`,ref:i})};export{L as a,N as c,R as i,V as n,I as o,z as r,F as s,H as t};
|
|
3
|
-
//# sourceMappingURL=datagrid-DOYxx0sF.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"datagrid-DOYxx0sF.js","names":["AriaTable","AriaTableBody","AriaCell","AriaColumn","AriaTableHeader","AriaRow"],"sources":["../../src/components/datagrid/useColumnGeometry.ts","../../src/components/datagrid/DataGridPinBehavior.tsx","../../src/components/datagrid/DataGridTableLayout.ts","../../src/components/datagrid/DataGrid.tsx","../../src/components/datagrid/DataGridBody.tsx","../../src/components/datagrid/DataGridCell.tsx","../../src/components/datagrid/DataGridColumn.tsx","../../src/components/datagrid/DataGridHeader.tsx","../../src/components/datagrid/DataGridRow.tsx","../../src/components/datagrid/DataGridSelectionCell.tsx"],"sourcesContent":["import { RefObject, useEffect, useMemo, useState } from 'react'\nimport { Key } from 'react-aria-components'\nimport { ColumnSize, ColumnStaticSize } from 'react-stately'\n\nexport interface ColumnGeometryColumn {\n /**\n * The column's unique id — matches `DataGridColumn`'s `id`/collection key.\n */\n id: Key\n /**\n * Mirrors `DataGridColumn`'s prop of the same name.\n */\n defaultWidth?: ColumnSize | null\n /**\n * Mirrors `DataGridColumn`'s prop of the same name.\n */\n minWidth?: ColumnStaticSize | null\n /**\n * Mirrors `DataGridColumn`'s prop of the same name.\n */\n maxWidth?: ColumnStaticSize | null\n}\n\nexport interface ColumnOffset {\n id: Key\n /**\n * Cumulative distance in pixels from the start edge of the row to this column's start edge.\n */\n offset: number\n width: number\n}\n\nconst STATIC_SIZE_PATTERN = /^\\d+(\\.\\d+)?%?$/\n\n/**\n * Whether a `ColumnSize` resolves to a definite pixel value without waiting for layout: a plain\n * number, a numeric string (`'150'`), or a percentage string (`'50%'`) — resolvable as soon as\n * the container's own width is known. An `'<n>fr'` string is proportional — it only resolves to\n * pixels once the layout engine has distributed the container's remaining space among every\n * fractional column, so it's excluded here.\n */\nexport const isStaticColumnSize = (size: ColumnSize | null | undefined): size is ColumnStaticSize =>\n size != null && (typeof size === 'number' || STATIC_SIZE_PATTERN.test(size))\n\nconst resolveStaticWidth = (size: ColumnStaticSize, containerWidth: number): number => {\n if (typeof size === 'number') return size\n return size.endsWith('%') ? (parseFloat(size) / 100) * containerWidth : parseFloat(size)\n}\n\n/**\n * Computes cumulative left-edge offsets for a list of columns from their declared\n * `defaultWidth`/`minWidth`/`maxWidth` props, without reading the DOM. Only correct for a column\n * whose own width — and every preceding column's width — is statically resolvable (see\n * `isStaticColumnSize`): a column at or after the first `fr`-sized column has no offset that can\n * be known before layout runs, so it resolves to `null`. Callers should fall back to\n * `useColumnGeometry`'s DOM measurement for those.\n */\nexport function calculateStaticColumnOffsets(\n columns: readonly ColumnGeometryColumn[],\n containerWidth: number\n): Map<Key, ColumnOffset | null> {\n const offsets = new Map<Key, ColumnOffset | null>()\n let offset = 0\n let resolvable = true\n\n for (const column of columns) {\n if (!resolvable || !isStaticColumnSize(column.defaultWidth)) {\n resolvable = false\n offsets.set(column.id, null)\n continue\n }\n\n let width = resolveStaticWidth(column.defaultWidth, containerWidth)\n if (isStaticColumnSize(column.minWidth)) {\n width = Math.max(width, resolveStaticWidth(column.minWidth, containerWidth))\n }\n if (isStaticColumnSize(column.maxWidth)) {\n width = Math.min(width, resolveStaticWidth(column.maxWidth, containerWidth))\n }\n\n offsets.set(column.id, { id: column.id, offset, width })\n offset += width\n }\n\n return offsets\n}\n\ninterface MeasuredRect {\n offset: number\n width: number\n}\n\n/**\n * Measures the mounted column-header cells, keyed by their 0-based column position.\n *\n * Keyed off each cell's own `aria-colindex` (1-based, assigned from the column's position in the\n * resolved collection) rather than its position among the cells that happen to be in the DOM: the\n * layout engine windows columns horizontally as well as rows, so `querySelectorAll` returns only\n * the headers intersecting the horizontal viewport. Matching those positionally to the full column\n * list — as this used to — mapped every column past the first unmounted one onto the wrong rect.\n * A header without the attribute is skipped rather than guessed at.\n */\nconst measureColumnHeaders = (container: HTMLElement): Map<number, MeasuredRect> => {\n const measured = new Map<number, MeasuredRect>()\n container.querySelectorAll<HTMLElement>('[role=\"columnheader\"]').forEach((cell) => {\n const colIndex = Number(cell.getAttribute('aria-colindex'))\n if (!Number.isInteger(colIndex) || colIndex < 1) return\n measured.set(colIndex - 1, { offset: cell.offsetLeft, width: cell.offsetWidth })\n })\n return measured\n}\n\n/**\n * Resolves each column's rendered left-offset and width, independent of the virtualizer's\n * private layout internals. Statically-sized columns (see `isStaticColumnSize`) resolve\n * immediately from their declared props; `fr`-sized (proportional) columns fall back to\n * `ResizeObserver`-measured DOM rects of the mounted `[role=\"columnheader\"]` cells inside\n * `containerRef`, matched to `columns` by `aria-colindex` (see `measureColumnHeaders`), since\n * those only resolve to real pixels after the layout engine has actually distributed space.\n */\nexport function useColumnGeometry(\n columns: readonly ColumnGeometryColumn[],\n containerRef: RefObject<HTMLElement | null>\n): Map<Key, ColumnOffset> {\n const [containerWidth, setContainerWidth] = useState(0)\n const [measured, setMeasured] = useState<Map<number, MeasuredRect>>(() => new Map())\n\n useEffect(() => {\n const container = containerRef.current\n if (!container || typeof ResizeObserver === 'undefined') return\n\n const measure = () => {\n setContainerWidth(container.clientWidth)\n setMeasured(measureColumnHeaders(container))\n }\n\n measure()\n const observer = new ResizeObserver(measure)\n observer.observe(container)\n return () => observer.disconnect()\n }, [containerRef])\n\n const staticOffsets = useMemo(\n () => calculateStaticColumnOffsets(columns, containerWidth),\n [columns, containerWidth]\n )\n\n return useMemo(() => {\n const result = new Map<Key, ColumnOffset>()\n columns.forEach((column, index) => {\n const staticOffset = staticOffsets.get(column.id)\n const measuredRect = measured.get(index)\n if (staticOffset) {\n result.set(column.id, staticOffset)\n } else if (measuredRect) {\n result.set(column.id, { id: column.id, ...measuredRect })\n }\n })\n return result\n }, [columns, staticOffsets, measured])\n}\n","import React, { ReactElement, RefObject, useEffect, useMemo } from 'react'\n\nimport { resolveLazy } from '../../utils/lazyElement'\nimport { DataGridColumnProps } from './DataGridColumn'\nimport { DataGridHeaderProps } from './DataGridHeader'\nimport { ColumnGeometryColumn, useColumnGeometry } from './useColumnGeometry'\n\nexport interface DataGridPinBehaviorProps<T> {\n /**\n * The same header element passed as `DataGrid`'s first child. Read directly (rather than via\n * `TableStateContext`) because react-aria-components' virtualized `<Table>` only ever renders\n * DOM output for its own collection-derived tree — an arbitrary extra child (like this\n * component, if it were nested inside `<Table>`) never mounts, regardless of context\n * availability. Only the static-children form of `DataGridHeader` can be introspected this\n * way; the `columns`/render-function form gets no pinned-column behavior from here (`pin=\n * \"start\"`'s positioning still works either way — see `DataGridTableLayout`, which reads pin\n * state off the resolved collection instead, not off this introspection).\n */\n header: ReactElement<DataGridHeaderProps<T>>\n /**\n * A CSS class unique to this `DataGrid` instance, scoping the generated rules below so\n * multiple grids on the same page (with different pinned columns) don't collide.\n */\n instanceClassName: string\n /**\n * Ref to `DataGrid`'s own scrolling root — used both to measure `fr`-sized pinned columns via\n * `useColumnGeometry` and, for `pin=\"end\"`, to find and reposition its cells on scroll (see\n * below).\n */\n containerRef: RefObject<HTMLElement | null>\n}\n\ninterface PinnedColumnInfo {\n index: number\n /** Cumulative width of the end-pinned columns after this one — its distance from the edge. */\n rightOffset: number\n}\n\ninterface DeclaredColumns {\n all: ColumnGeometryColumn[]\n endIndices: number[]\n startIndices: number[]\n}\n\n/**\n * A cell's (1-based) `aria-colindex` for the (0-based) column position it was declared at.\n *\n * Every cell and column header react-aria-components renders carries `aria-colindex`, set from the\n * column's position in the resolved collection — which is the declaration order this component\n * reads off the header's JSX. That makes it the one stable handle from a declared column back to\n * its rendered DOM, and the reason nothing here counts DOM children: the layout engine windows\n * columns horizontally as well as rows (only the cells intersecting the horizontal viewport are\n * mounted, see `datagrid.mdx`'s Scope section), so a row's child count is the size of the mounted\n * window, not the column count. The `nth-child`/`nth-last-child` arithmetic this used to do was\n * therefore only correct while every column happened to be mounted, and silently moved and\n * shadowed the wrong cells in exactly the wide grids pinning exists for.\n */\nconst colIndexSelector = (index: number) => `[aria-colindex=\"${index + 1}\"]`\n\n/**\n * Handles the two things `DataGrid`'s own layout subclass (`DataGridTableLayout`) can't:\n *\n * - `pin=\"end\"`'s positioning. `DataGridTableLayout` reuses the layout engine's own sticky\n * mechanism for `pin=\"start\"`, but that mechanism is hardcoded to the leading edge — there's no\n * upstream hook for a trailing-edge pin. A pure-CSS `position: sticky; right: 0` equivalent\n * doesn't work either: for the *last* child of a horizontally-scrolling container, the browser's\n * own max-scroll bound is defined such that its gap to the viewport's trailing edge never goes\n * negative until the very last pixel of scroll — sticky has nothing to correct until then, so it\n * renders exactly like `position: absolute` for the entire scroll range up to that point (this is\n * a well-known, verified-here CSS limitation, not specific to this layout). So `pin=\"end\"` is\n * positioned imperatively instead: on every scroll (and on mount/resize), each `pin=\"end\"`\n * column's auto-generated wrapper div gets a `transform: translateX(...)` that keeps it flush\n * against the scroll viewport's trailing edge, computed from `useColumnGeometry`'s cumulative\n * offsets, plus the `z-index` that keeps it above the cells it now overlaps. This bypasses React\n * for those two styles, similar to how other virtualized grids (e.g. AG-Grid) handle right-pinned\n * columns — react-aria-components' own layout doesn't re-render an already-mounted cell's style on\n * a plain scroll (its `layoutInfo` doesn't depend on scroll position), so there's no fight between\n * this and React's own reconciliation; newly-mounted rows (from vertical scroll bringing fresh\n * cells into the virtualized window) are covered by the same scroll-driven sync running again.\n * - The scroll-cue box-shadow on the boundary column of each pinned group (the last `pin=\"start\"`\n * column, the first `pin=\"end\"` column) — shown only once the grid has actually scrolled far\n * enough to hide content under it, via the `datagrid-scrolled-start`/`datagrid-scrolled-end`\n * classes `DataGrid` toggles on scroll. This part stays pure CSS since box-shadow, unlike\n * sticky's position offsets, has no \"last child\" gotcha.\n *\n * Rendered as a plain sibling of `DataGrid`'s `<Table>`, not inside it.\n */\nexport const DataGridPinBehavior = <T extends object>({\n header,\n instanceClassName,\n containerRef\n}: DataGridPinBehaviorProps<T>) => {\n // A header written in a Server Component can arrive as a lazy node (see `utils/lazyElement`).\n const headerChildren = resolveLazy(header).props.children\n\n // Re-derived only when a column's own sizing/pin props actually change, not on every parent\n // render: `useColumnGeometry` keys its memoized result off this array's identity, and the\n // scroll-sync effect below keys off that result in turn — rebuilding it unconditionally tore\n // down and re-registered the effect's scroll listener and its two observers on every single\n // `DataGrid` render.\n const columnElements = useMemo(\n () => (typeof headerChildren === 'function' ? [] : React.Children.toArray(headerChildren)),\n [headerChildren]\n )\n const declaredKey = columnElements\n .map((element) => {\n if (!React.isValidElement<DataGridColumnProps>(element)) return ''\n const { defaultWidth, maxWidth, minWidth, pin } = element.props\n return `${defaultWidth ?? ''}/${minWidth ?? ''}/${maxWidth ?? ''}/${pin ?? ''}`\n })\n .join('|')\n\n const {\n all: allColumns,\n endIndices,\n startIndices\n } = useMemo<DeclaredColumns>(() => {\n const declared: DeclaredColumns = { all: [], endIndices: [], startIndices: [] }\n columnElements.forEach((element, index) => {\n if (!React.isValidElement<DataGridColumnProps>(element)) return\n const { defaultWidth, maxWidth, minWidth, pin } = element.props\n declared.all.push({ id: index, defaultWidth, maxWidth, minWidth })\n if (pin === 'start') declared.startIndices.push(index)\n else if (pin === 'end') declared.endIndices.push(index)\n })\n return declared\n // `declaredKey` is the value-based identity of `columnElements` — a fresh JSX array every\n // render, so its own reference can't be the dependency.\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [declaredKey])\n\n const offsets = useColumnGeometry(allColumns, containerRef)\n\n // Cumulative width of the end-pinned columns after this one, keyed by column index — how far\n // from the viewport's trailing edge each one needs to sit so they stack correctly.\n const endPinnedInfo = useMemo(() => {\n const info = new Map<number, PinnedColumnInfo>()\n let right = 0\n for (let i = endIndices.length - 1; i >= 0; i--) {\n const index = endIndices[i]\n if (index == null) continue\n const width = offsets.get(index)?.width ?? 0\n info.set(index, { index, rightOffset: right })\n right += width\n }\n return info\n }, [endIndices, offsets])\n\n useEffect(() => {\n const container = containerRef.current\n if (!container || endPinnedInfo.size === 0) return\n\n let frame: number | null = null\n // The wrappers this effect has written inline styles onto, so they can be handed back\n // unstyled when it tears down — un-pinning a column at runtime (or unmounting this behavior\n // while the grid stays) otherwise left its cells stuck at their last scroll offset.\n const styled = new Set<HTMLElement>()\n\n const sync = () => {\n frame = null\n const clientWidth = container.clientWidth\n const scrollLeft = container.scrollLeft\n const rows = container.querySelectorAll<HTMLElement>('[role=\"row\"]')\n rows.forEach((row) => {\n endPinnedInfo.forEach(({ index, rightOffset }) => {\n const cell = row.querySelector<HTMLElement>(colIndexSelector(index))\n const wrapper = cell?.parentElement\n if (!wrapper) return\n const offset = offsets.get(index)\n if (!offset) return\n const rightEdge = offset.offset + offset.width\n const delta = clientWidth - rightOffset - rightEdge + scrollLeft\n wrapper.style.transform = `translateX(${delta}px)`\n // Above the unpinned cells it now overlaps. Set here rather than in the generated\n // stylesheet below because the virtualizer writes the wrapper's own `z-index` inline,\n // which no plain rule can outrank without `!important`.\n wrapper.style.zIndex = '2'\n styled.add(wrapper)\n })\n })\n }\n\n const scheduleSync = () => {\n if (frame == null) frame = requestAnimationFrame(sync)\n }\n\n scheduleSync()\n container.addEventListener('scroll', scheduleSync, { passive: true })\n const resizeObserver =\n typeof ResizeObserver === 'undefined' ? null : new ResizeObserver(scheduleSync)\n resizeObserver?.observe(container)\n const mutationObserver =\n typeof MutationObserver === 'undefined' ? null : new MutationObserver(scheduleSync)\n mutationObserver?.observe(container, { childList: true, subtree: true })\n\n return () => {\n if (frame != null) cancelAnimationFrame(frame)\n container.removeEventListener('scroll', scheduleSync)\n resizeObserver?.disconnect()\n mutationObserver?.disconnect()\n styled.forEach((wrapper) => {\n wrapper.style.transform = ''\n wrapper.style.zIndex = ''\n })\n }\n }, [containerRef, endPinnedInfo, offsets])\n\n if (startIndices.length === 0 && endIndices.length === 0) return null\n\n const rules: string[] = []\n\n if (startIndices.length > 0) {\n const lastStartIndex = Math.max(...startIndices)\n rules.push(\n `.${instanceClassName}.datagrid-scrolled-start ${colIndexSelector(lastStartIndex)} { box-shadow: var(--datagrid-pin-cue-shadow-start); }`\n )\n }\n\n if (endIndices.length > 0) {\n const firstEndIndex = Math.min(...endIndices)\n rules.push(\n `.${instanceClassName}.datagrid-scrolled-end ${colIndexSelector(firstEndIndex)} { box-shadow: var(--datagrid-pin-cue-shadow-end); }`\n )\n }\n\n return <style>{rules.join('\\n')}</style>\n}\n","import { TableLayout } from 'react-aria-components'\n\ninterface StickyColumnNode {\n type: string\n index: number\n colIndex?: number | null\n}\n\n/**\n * `DataGrid`'s own subclass of react-aria-components' `TableLayout`, overriding the (protected,\n * hardcoded-`false` upstream) `isStickyColumn` hook so a `pin=\"start\"` `DataGridColumn` uses the\n * layout engine's own sticky-positioning machinery — the same mechanism that already makes the\n * header row pin to the top (`buildTableHeader` sets `layoutInfo.isSticky = true` unconditionally\n * there). The subclass exists instead of a pure-CSS `position: sticky` override because\n * react-aria-components' own `TableLayout` never overrides `isStickyColumn`, so no column becomes\n * visually sticky by default — and because the engine, not CSS, owns each cell wrapper's `left`.\n *\n * `pin=\"end\"` isn't handled here — the engine's sticky positioning is hardcoded to the leading\n * edge (`position: sticky; left: ...`, mirrored to `right` only for RTL *direction*, never per\n * column), so there's no upstream mechanism to reuse for a trailing pin in an LTR grid. See\n * `DataGrid.scss`'s `nth-last-child`-based rules for that half instead.\n */\nexport class DataGridTableLayout<T> extends TableLayout<T> {\n protected isStickyColumn(node: StickyColumnNode): boolean {\n const colIndex = node.type === 'column' ? node.index : (node.colIndex ?? node.index)\n if (colIndex == null) return false\n const column = this.collection.columns[colIndex]\n return (column?.props as { pin?: 'start' | 'end' } | undefined)?.pin === 'start'\n }\n\n // An empty body fills the viewport below the header. On the server the viewport has no size,\n // so the body came out as tall as minus the header (`height: -40px`), which CSS doesn't allow.\n protected buildRowGroup(...args: Parameters<TableLayout<T>['buildRowGroup']>) {\n const group = super.buildRowGroup(...args)\n group.layoutInfo.rect.height = Math.max(0, group.layoutInfo.rect.height)\n return group\n }\n}\n","import React, {\n ReactElement,\n ReactNode,\n Ref,\n forwardRef,\n useEffect,\n useId,\n useMemo,\n useRef,\n useState\n} from 'react'\nimport classNames from 'classnames'\nimport {\n Key,\n Selection,\n SortDescriptor,\n Table as AriaTable,\n Virtualizer\n} from 'react-aria-components'\n\nimport { useForkedRef } from '../../hooks/useForkedRef'\nimport { ContextColor } from '../../types'\nimport { TABLE_ALIGN_CLASS_NAMES } from '../../utils/tableClassName'\nimport { DataGridBodyProps } from './DataGridBody'\nimport { DataGridHeaderProps } from './DataGridHeader'\nimport { DataGridPinBehavior } from './DataGridPinBehavior'\nimport { DataGridTableLayout } from './DataGridTableLayout'\nimport './DataGrid.scss'\n\n// No `striped`/`stacked` props: zebra-striping via CSS `:nth-of-type` (Table's approach) isn't\n// virtualization-safe — a windowed row's DOM siblings are only the currently-mounted rows, not\n// every logical row, so the stripe parity would flip as the mounted window's starting index\n// changes during scroll. A correct implementation needs the row's real index at render time, not\n// a pure-CSS trick; deferred rather than shipped broken.\ninterface DataGridOwnProps<T extends object> {\n /**\n * An accessible label for the grid, used when there's no visible heading.\n */\n 'aria-label'?: string\n /**\n * Identifies a visible heading element for the grid.\n */\n 'aria-labelledby'?: string\n /**\n * Set the vertical alignment of cell content. Mirrors `Table`'s prop of the same name for API\n * parity — same as `Table`, this awaits chassis-css adding the matching `.align-*` styles.\n */\n align?: 'bottom' | 'middle' | 'top'\n /**\n * Add borders on all sides of the grid and cells.\n */\n bordered?: boolean\n /**\n * Remove borders on all sides of the grid and cells.\n */\n borderless?: boolean\n /**\n * A `DataGridHeader` and a `DataGridBody`, each built from `DataGridColumn`/`DataGridRow`/\n * `DataGridCell`.\n */\n children: [ReactElement<DataGridHeaderProps<T>>, ReactElement<DataGridBodyProps<T>>]\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 grid, e.g. a totals row or a \"load more\" control. Rendered as plain\n * markup outside the grid's own scrollable/virtualized region — not part of the\n * keyboard-navigable grid, and never scrolls out of view along with the body rows. Mirrors\n * `Table`'s `footer` prop for API parity.\n */\n footer?: ReactNode\n /**\n * Enable a hover state on grid rows.\n */\n hover?: boolean\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 * 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 the grid 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\ntype DataGridRowHeightProps =\n | {\n /**\n * Row height in pixels, or `\"auto\"` to measure each row from its own rendered content\n * instead of a single fixed height shared by every row (pair it with a required\n * `estimatedRowHeight`, and see the docs site's \"Variable row height\" section for the\n * tradeoffs). A fixed number renders every row, including the header, at that exact\n * height; content taller than it visually overflows rather than growing the row.\n */\n rowHeight: number\n estimatedRowHeight?: never\n }\n | {\n rowHeight: 'auto'\n /**\n * Seeds the virtualizer's scroll-position math for rows that haven't been measured yet.\n * Required when `rowHeight=\"auto\"` — pick a value close to the typical row's real height\n * to minimize scroll-jump on first measurement. A row's real height can still turn out far\n * from this estimate once it renders, which can cause a visible scroll-jump for rows the\n * viewport hasn't reached yet.\n */\n estimatedRowHeight: number\n }\n\nexport type DataGridProps<T extends object> = DataGridOwnProps<T> & DataGridRowHeightProps\n\nconst DataGridInner = <T extends object>(\n {\n align,\n bordered,\n borderless,\n children,\n className,\n color,\n disabledKeys,\n estimatedRowHeight,\n footer,\n hover,\n onSelectionChange,\n onSortChange,\n rowHeight,\n selectedKeys,\n selectionMode = 'none',\n sm,\n sortDescriptor,\n ...rest\n }: DataGridProps<T>,\n forwardedRef: Ref<HTMLDivElement>\n) => {\n const isVariableRowHeight = rowHeight === 'auto'\n const layout = useMemo(\n () =>\n new DataGridTableLayout<T>(\n // `headingHeight` is pinned to `estimatedRowHeight` (fixed, not itself an estimate) in\n // variable-height mode — leaving it unset falls back to `estimatedRowHeight` as an\n // *estimate* for the header too, which sounds harmless but isn't: the header's own\n // sticky-positioned outer wrapper (built once in `buildTableHeader`, see\n // `DataGridTableLayout`'s doc comment for why the header is sticky at all) is never\n // recomputed when a column-header cell's later real measurement corrects its height, so\n // the outer wrapper's stale height desyncs from the cell's real one, spilling header\n // content into the body's first row instead of the header growing to fit it. Fixing the\n // header's height sidesteps that gap instead of shipping it.\n isVariableRowHeight\n ? { estimatedRowHeight, headingHeight: estimatedRowHeight }\n : { rowHeight }\n ),\n [isVariableRowHeight, rowHeight, estimatedRowHeight]\n )\n const gridRef = useRef<HTMLDivElement>(null)\n const ref = useForkedRef(forwardedRef, gridRef)\n\n // A stable per-instance class, scoping DataGridPinBehavior's generated CSS so multiple grids on\n // the same page (each with their own pinned columns) don't collide.\n const rawId = useId()\n const instanceClassName = `datagrid-${rawId.replace(/[^a-zA-Z0-9]/g, '')}`\n\n // Drives the pin=start/pin=end scroll-cue box-shadow — see DataGridPinBehavior — which should\n // only appear once there's actually hidden content under the pinned column to cue.\n const [scrolledStart, setScrolledStart] = useState(false)\n const [scrolledEnd, setScrolledEnd] = useState(false)\n\n useEffect(() => {\n const grid = gridRef.current\n if (!grid) return\n\n const updateScrollState = () => {\n setScrolledStart(grid.scrollLeft > 0)\n setScrolledEnd(Math.ceil(grid.scrollLeft + grid.clientWidth) < grid.scrollWidth)\n }\n\n updateScrollState()\n grid.addEventListener('scroll', updateScrollState, { passive: true })\n const observer =\n typeof ResizeObserver === 'undefined' ? null : new ResizeObserver(updateScrollState)\n observer?.observe(grid)\n return () => {\n grid.removeEventListener('scroll', updateScrollState)\n observer?.disconnect()\n }\n }, [])\n\n const _className = classNames(\n 'datagrid',\n instanceClassName,\n color,\n align && TABLE_ALIGN_CLASS_NAMES[align],\n {\n bordered,\n borderless,\n hoverable: hover,\n sm,\n 'datagrid-scrolled-start': scrolledStart,\n 'datagrid-scrolled-end': scrolledEnd\n },\n className\n )\n\n return (\n <Virtualizer layout={layout} shouldObserveItemSize={isVariableRowHeight}>\n <AriaTable\n aria-label={rest['aria-label']}\n aria-labelledby={rest['aria-labelledby']}\n className={_className || undefined}\n disabledKeys={disabledKeys}\n onSelectionChange={onSelectionChange}\n onSortChange={onSortChange}\n ref={ref}\n selectedKeys={selectedKeys}\n selectionMode={selectionMode}\n sortDescriptor={sortDescriptor}\n // react-aria joins the grid's descriptions without dropping an empty result, so a grid\n // with none had `aria-describedby=\"\"`.\n render={(props) => (\n <div\n {...(props as React.ComponentProps<'div'>)}\n aria-describedby={props['aria-describedby'] || undefined}\n />\n )}\n >\n {children}\n </AriaTable>\n {footer && <div className={classNames('datagrid-footer', { borderless })}>{footer}</div>}\n <DataGridPinBehavior\n containerRef={gridRef}\n header={children[0]}\n instanceClassName={instanceClassName}\n />\n </Virtualizer>\n )\n}\n\n// `forwardRef` erases type parameters, so the generic component is cast back to a generic\n// signature for callers — same pattern `Table` uses.\nexport const DataGrid = forwardRef(DataGridInner) as <T extends object>(\n props: DataGridProps<T> & { ref?: Ref<HTMLDivElement> }\n) => ReactElement\n\n;(DataGrid as { displayName?: string }).displayName = 'DataGrid'\n","import React, { ReactElement, ReactNode, useMemo } from 'react'\nimport classNames from 'classnames'\nimport {\n TableBody as AriaTableBody,\n TableBodyRenderProps,\n TableLoadMoreItem\n} from 'react-aria-components'\n\n// A unique value appended to `items` internally to represent the trailing \"load more\" row in\n// react-aria-components' collection. `TableLoadMoreItem` has to be returned from the per-item\n// render function like any other row — react-aria-components' `useCachedChildren` only supports\n// EITHER `items` + a render function OR static `children`, never a mix of both in the same\n// `children` prop, so a `<TableLoadMoreItem>` placed as a plain JSX sibling inside `<TableBody>`\n// is silently dropped (or crashes, if `children` becomes an array mixing the render function in).\n// Checked by reference (`item === LOADER_ITEM`), so it can never collide with a real `T` the way a\n// `{ __loader: true }` marker object might if compared structurally. Its `id` matters too, not\n// just its identity: react-aria-components derives each rendered item's React key from\n// `rendered.props.id ?? item?.key ?? item?.id ?? <positional index>` (`useCachedChildren`) —\n// `TableLoadMoreItem` doesn't accept an `id` prop itself, so without this object's own `id` the\n// loader's key falls back to its position in the array, which collides with a real row whenever a\n// row's own `id` happens to equal that count (e.g. a 2-item list with a row literally id `\"2\"`).\nconst LOADER_ITEM = { id: '__datagrid-body-loader__' }\n\ninterface DataGridBodyOwnProps {\n /**\n * A string of all className you want applied to the body row group.\n */\n className?: string\n /**\n * Values that should invalidate the row cache 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 outside value won't re-render already-cached rows, since dynamic rows are only\n * rebuilt when `items` or `dependencies` change by reference, not on every parent re-render.\n */\n dependencies?: ReadonlyArray<unknown>\n /**\n * Content shown in place of rows when `items` is empty.\n */\n renderEmptyState?: (props: TableBodyRenderProps) => React.ReactNode\n}\n\n/**\n * The `items` + render-function form. `isLoading`/`loadingContent`/`onLoadMore` live here rather\n * than alongside the static form because the loader row is generated by appending to `items` and\n * rendering through that same function — there's no growing dataset to load more of, and nothing\n * to render the loader with, in a hand-written list of `DataGridRow` elements.\n */\ninterface DataGridBodyDynamicProps<T> {\n /**\n * A render function called once per item in `items`, returning that row's `DataGridRow`.\n */\n children: (item: T) => ReactElement\n /**\n * Whether more items are currently being fetched. Shows `loadingContent` in the loader row while\n * true, and — until this goes back to `false` — suppresses further `onLoadMore` calls, so one\n * scroll-into-view doesn't fire the callback again before the in-flight fetch resolves.\n */\n isLoading?: boolean\n /**\n * A list of row data objects, rendered via the function form of `children`.\n */\n items: Iterable<T>\n /**\n * Content rendered inside the loader row while `isLoading` is true, e.g. a spinner. Only takes\n * effect alongside `onLoadMore`.\n */\n loadingContent?: ReactNode\n /**\n * Called when the grid scrolls near its last row, so more data can be fetched and appended to\n * `items`. Pair with `isLoading` so a fetch already in flight isn't triggered again before it\n * resolves.\n */\n onLoadMore?: () => void\n}\n\n/** The static form: `DataGridRow` elements written out directly. */\ninterface DataGridBodyStaticProps {\n /**\n * `DataGridRow` elements.\n */\n children: ReactElement | ReactElement[]\n isLoading?: never\n items?: never\n loadingContent?: never\n onLoadMore?: never\n}\n\n/**\n * Split into a static and a dynamic form so the two can't be mixed: the loader row is appended to\n * `items` and rendered through `children`, so `onLoadMore` alongside a static list of elements used\n * to type-check and then throw at render (\"children is not a function\") the moment the loader row\n * came up.\n */\nexport type DataGridBodyProps<T> = DataGridBodyOwnProps &\n (DataGridBodyDynamicProps<T> | DataGridBodyStaticProps)\n\n/**\n * Body row group for `DataGrid`, containing `DataGridRow`s. Unlike `Table`'s sub-parts, this\n * renders directly — it's a thin wrapper over react-aria-components' own `TableBody`.\n *\n * Always carries the `datagrid-body` class — see `DataGridHeader`'s equivalent note.\n */\nexport const DataGridBody = <T extends object>({\n children,\n className,\n dependencies,\n isLoading,\n items,\n loadingContent,\n onLoadMore,\n renderEmptyState\n}: DataGridBodyProps<T>) => {\n const hasLoader = onLoadMore != null && items != null\n\n const itemsWithLoader = useMemo(() => {\n if (!hasLoader) return items\n return [...(items as Iterable<T>), LOADER_ITEM] as Iterable<T>\n }, [hasLoader, items])\n\n // react-aria-components caches each rendered row by item identity (see `dependencies`'s own doc\n // comment above) — the loader branch below reads `isLoading`/`onLoadMore`/`loadingContent`, none\n // of which are part of `items`, so without surfacing them here the cached loader row would keep\n // whatever `isLoading` value (and stale `onLoadMore` closure) was in scope the first time it\n // rendered, never picking up a later change.\n const dependenciesWithLoader = useMemo(\n () =>\n hasLoader ? [...(dependencies ?? []), isLoading, onLoadMore, loadingContent] : dependencies,\n [dependencies, hasLoader, isLoading, onLoadMore, loadingContent]\n )\n\n const bodyChildren = hasLoader\n ? (item: T) =>\n (item as unknown) === LOADER_ITEM ? (\n <TableLoadMoreItem\n className=\"datagrid-loader\"\n isLoading={isLoading}\n // Suppresses re-triggering onLoadMore while a fetch is already in flight — the\n // underlying sentinel has no built-in debounce of its own and calls onLoadMore again\n // whenever it (re-)observes the sentinel still intersecting, e.g. after the collection\n // changes but the loader row hasn't yet scrolled out of view.\n onLoadMore={isLoading ? undefined : onLoadMore}\n >\n {loadingContent}\n </TableLoadMoreItem>\n ) : (\n // `hasLoader` implies the dynamic form of the props union, whose `children` is the\n // render function — `onLoadMore` isn't assignable alongside static children.\n (children as (item: T) => ReactElement)(item)\n )\n : children\n\n return (\n <AriaTableBody\n className={classNames('datagrid-body', className)}\n dependencies={dependenciesWithLoader}\n items={itemsWithLoader}\n renderEmptyState={renderEmptyState}\n >\n {bodyChildren}\n </AriaTableBody>\n )\n}\n","import React, { ReactNode } from 'react'\nimport { Key, Cell as AriaCell } from 'react-aria-components'\nimport classNames from 'classnames'\n\nexport interface DataGridCellProps {\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 * The unique id of the cell.\n */\n id?: Key\n /**\n * A string representation of the cell's contents, used for typeahead.\n */\n textValue?: string\n}\n\n/**\n * A cell within a `DataGrid` row. Unlike `Table`'s sub-parts, this renders directly — it's a\n * thin wrapper over react-aria-components' own `Cell`.\n */\nexport const DataGridCell = ({\n children,\n className,\n colSpan,\n id,\n textValue\n}: DataGridCellProps) => (\n <AriaCell\n className={classNames('datagrid-cell', className)}\n colSpan={colSpan}\n id={id}\n textValue={textValue}\n >\n {children}\n </AriaCell>\n)\n","import React, { ReactNode } from 'react'\nimport classNames from 'classnames'\nimport { Key, Column as AriaColumn } from 'react-aria-components'\nimport { ColumnSize, ColumnStaticSize } from 'react-stately'\n\nexport interface DataGridColumnProps {\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 * The initial width of the column, e.g. for a narrow selection/icon column — a plain number or\n * `'<n>%'` for a fixed size, or `'<n>fr'` to share remaining space with other fractional\n * columns in proportion (columns default to `'1fr'`, so they split space evenly unless given\n * one of these). Unlike `Table`, which sizes a narrow column via `width: 1%` relying on native\n * `<table>` auto-layout, `DataGrid`'s virtualized layout computes every column's width itself —\n * a CSS `width` rule on the cell has no effect, so this prop is the only way to size a column.\n */\n defaultWidth?: ColumnSize | null\n /**\n * The unique id of the column, referenced by `sortDescriptor.column`.\n */\n id?: Key\n /**\n * Whether this column is a row header, announced by assistive technology during row\n * navigation.\n */\n isRowHeader?: boolean\n /**\n * The maximum width of the column, as a fixed pixel number or `'<n>%'`.\n */\n maxWidth?: ColumnStaticSize | null\n /**\n * The minimum width of the column, as a fixed pixel number or `'<n>%'`.\n */\n minWidth?: ColumnStaticSize | null\n /**\n * Pin the column so it stays visible while the grid scrolls horizontally: `'start'` pins it to\n * the leading edge, `'end'` to the trailing edge. Stacks correctly with other pinned columns on\n * the same side, in declaration order.\n */\n pin?: 'start' | 'end'\n /**\n * A string representation of the column header, used for accessibility announcements. Defaults\n * to `children` when it's a plain string — set this explicitly when the header contains\n * anything else (an icon, a `Tooltip`, etc.).\n */\n textValue?: string\n}\n\n/**\n * A column within `DataGrid`. Unlike `Table`'s sub-parts, this renders directly — it's a thin\n * wrapper over react-aria-components' own `Column`.\n *\n * When `allowsSorting` is set, renders a sort indicator after `children` — mirrors `Table`'s own\n * `TableColumnHeader`, but reads the active direction from react-aria-components' own\n * `ColumnRenderProps` (via the `children` render-prop form) instead of reaching into table state\n * directly, since this wrapper has no state of its own to read.\n */\nexport const DataGridColumn = ({\n allowsSorting,\n children,\n className,\n defaultWidth,\n id,\n isRowHeader,\n maxWidth,\n minWidth,\n pin,\n textValue\n}: DataGridColumnProps) => (\n <AriaColumn\n allowsSorting={allowsSorting}\n className={classNames('datagrid-col', pin && `datagrid-col-pinned-${pin}`, className)}\n defaultWidth={defaultWidth}\n id={id}\n isRowHeader={isRowHeader}\n maxWidth={maxWidth}\n minWidth={minWidth}\n textValue={textValue}\n // `pin` isn't a react-aria-components `Column` prop, but its collection builder preserves\n // the full props object it's given verbatim (see react-stately's `Column.getCollectionNode`)\n // — passing it through here is what makes it reach `column.props.pin` in\n // `DataGridTableLayout`'s `isStickyColumn` override, which is what positions `pin=\"start\"`.\n // `pin=\"end\"` is handled separately by `DataGridPinBehavior`, which reads the same prop off\n // the header's JSX rather than the resolved collection.\n {...({ pin } as Record<string, unknown>)}\n >\n {allowsSorting\n ? ({ sortDirection }) => (\n <>\n {children}\n <span aria-hidden=\"true\" className=\"datagrid-sort-icon\">\n {sortDirection === 'ascending' ? '▲' : sortDirection === 'descending' ? '▼' : '⇅'}\n </span>\n </>\n )\n : children}\n </AriaColumn>\n)\n","import React, { ReactElement, ReactNode } from 'react'\nimport classNames from 'classnames'\nimport { TableHeader as AriaTableHeader } from 'react-aria-components'\n\nexport interface DataGridHeaderProps<T> {\n /**\n * `DataGridColumn` elements, or a render function paired with `columns` for dynamic column\n * generation.\n */\n children: ReactNode | ((column: T) => ReactElement)\n /**\n * A string of all className you want applied to the header row group.\n */\n className?: string\n /**\n * A list of column data objects, rendered via the function form of `children`.\n */\n columns?: Iterable<T>\n /**\n * Values that should invalidate the column cache when using the `columns`/render-function form\n * of `children` — see `DataGridBody`'s `dependencies` for why this matters.\n */\n dependencies?: ReadonlyArray<unknown>\n}\n\n/**\n * Header row group for `DataGrid`, containing `DataGridColumn`s. Unlike `Table`'s sub-parts,\n * this renders directly — it's a thin wrapper over react-aria-components' own `TableHeader`.\n *\n * Always carries the `datagrid-header` class (not just the caller's `className`) — `DataGrid.scss`\n * uses it to tell header cells from body cells, since react-aria-components renders both as plain\n * `[role=\"rowgroup\"]` divs with no structural difference to select on otherwise.\n */\nexport const DataGridHeader = <T extends object>({\n children,\n className,\n columns,\n dependencies\n}: DataGridHeaderProps<T>) => (\n <AriaTableHeader\n className={classNames('datagrid-header', className)}\n columns={columns}\n dependencies={dependencies}\n >\n {children}\n </AriaTableHeader>\n)\n","import React, { ReactElement, ReactNode } from 'react'\nimport classNames from 'classnames'\nimport { Key, Row as AriaRow } from 'react-aria-components'\n\nexport interface DataGridRowProps<T> {\n /**\n * `DataGridCell` elements, or a render function called once per column with that column's\n * data — required when the row's parent `DataGridBody` uses the `items`/render-function form.\n */\n children: ReactNode | ((column: T) => ReactElement)\n /**\n * A string of all className you want applied to the row.\n */\n className?: string\n /**\n * A list of column data objects, rendered via the function form of `children`.\n */\n columns?: Iterable<T>\n /**\n * The unique id of the row, referenced by `selectedKeys`/`disabledKeys`.\n */\n id?: Key\n /**\n * A string representation of the row's contents, used for typeahead.\n */\n textValue?: string\n}\n\n/**\n * A row within `DataGrid`. Unlike `Table`'s sub-parts, this renders directly — it's a thin\n * wrapper over react-aria-components' own `Row`.\n */\nexport const DataGridRow = <T extends object>({\n children,\n className,\n columns,\n id,\n textValue\n}: DataGridRowProps<T>) => (\n <AriaRow\n className={classNames('datagrid-row', className)}\n columns={columns}\n id={id}\n textValue={textValue}\n >\n {children}\n </AriaRow>\n)\n","import React, { useRef } from 'react'\nimport { AriaCheckboxProps, useCheckbox } from 'react-aria'\nimport { useToggleState } from 'react-stately'\nimport { CheckboxContext, CheckboxProps, useSlottedContext } from 'react-aria-components'\n\nexport interface DataGridSelectionCellProps {\n /**\n * A string of all className you want applied to the checkbox, replacing the default\n * `check-input`.\n */\n className?: string\n}\n\n/**\n * Reads the selection checkbox props react-aria-components' own `Row`/`TableHeader` publish on\n * `CheckboxContext`'s `selection` slot — the same ones its `<Checkbox slot=\"selection\">` would\n * consume, already carrying the localized label, the row-header `aria-labelledby`, and the\n * selected/disabled/indeterminate state.\n *\n * Reading them off that context (rather than calling react-aria's `useTableSelectionCheckbox`/\n * `useTableSelectAllCheckbox` against `TableStateContext` ourselves, as this file used to) is what\n * keeps this working when more than one copy of `react-aria` is installed. Those hooks resolve the\n * grid's id through a module-scoped `WeakMap` that only `useTable` populates, in whichever copy\n * ran it — always the copy bundled inside `react-aria-components` here, since its `Table` is what\n * calls `useTable`. `react-aria-components` pins `react-aria` to an exact version, so a consumer\n * whose own `react-aria` resolves anywhere else in our `^` range gets a second copy and the lookup\n * throws `Error: Unknown grid` on every selection cell. Letting react-aria-components compute the\n * props in its own copy sidesteps that entirely, and drops the duplicated `rowKey` this component\n * used to need — the context is already scoped to the row it's rendered in, so a `rowKey` that\n * disagreed with the surrounding `DataGridRow` can no longer silently toggle a different row.\n */\nconst useSelectionCheckboxProps = (component: string): AriaCheckboxProps => {\n const props = useSlottedContext(CheckboxContext, 'selection') as CheckboxProps | null | undefined\n if (!props) {\n throw new Error(`${component} must be rendered inside a DataGrid with selection enabled.`)\n }\n return props as AriaCheckboxProps\n}\n\n/**\n * Selection checkbox for one `DataGrid` row — place inside a `DataGridCell`.\n *\n * react-aria-components' own `Checkbox` always visually hides its native `<input>` behind a custom\n * indicator the caller must supply. This renders a plain native `<input className=\"check-input\">`\n * instead, wired to the same state, so it picks up chassis-css's existing checkbox styling for\n * free with no new CSS of its own.\n */\nexport const DataGridSelectionCell = ({ className }: DataGridSelectionCellProps) => {\n const checkboxProps = useSelectionCheckboxProps('DataGridSelectionCell')\n return <DataGridCheckboxInput checkboxProps={checkboxProps} className={className} />\n}\n\n/**\n * \"Select all\" checkbox for `DataGrid`'s header row — place inside a `DataGridColumn`. See\n * `DataGridSelectionCell` for why this bypasses react-aria-components' own `Checkbox`.\n */\nexport const DataGridSelectAllCell = ({ className }: DataGridSelectionCellProps) => {\n const checkboxProps = useSelectionCheckboxProps('DataGridSelectAllCell')\n return <DataGridCheckboxInput checkboxProps={checkboxProps} className={className} />\n}\n\nconst DataGridCheckboxInput = ({\n checkboxProps,\n className\n}: {\n checkboxProps: AriaCheckboxProps\n className?: string\n}) => {\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 (\n <input\n {...inputProps}\n aria-describedby={undefined}\n className={className ?? 'check-input'}\n ref={ref}\n />\n )\n}\n"],"mappings":"0lBAgCA,MAAM,EAAsB,kBASf,EAAsB,GACjC,GAAQ,OAAS,OAAO,GAAS,UAAY,EAAoB,KAAK,CAAI,GAEtE,GAAsB,EAAwB,IAC9C,OAAO,GAAS,SAAiB,EAC9B,EAAK,SAAS,GAAG,EAAK,WAAW,CAAI,EAAI,IAAO,EAAiB,WAAW,CAAI,EAWzF,SAAgB,EACd,EACA,EAC+B,CAC/B,IAAM,EAAU,IAAI,IAChB,EAAS,EACT,EAAa,GAEjB,IAAK,IAAM,KAAU,EAAS,CAC5B,GAAI,CAAC,GAAc,CAAC,EAAmB,EAAO,YAAY,EAAG,CAC3D,EAAa,GACb,EAAQ,IAAI,EAAO,GAAI,IAAI,EAC3B,QACF,CAEA,IAAI,EAAQ,EAAmB,EAAO,aAAc,CAAc,EAC9D,EAAmB,EAAO,QAAQ,IACpC,EAAQ,KAAK,IAAI,EAAO,EAAmB,EAAO,SAAU,CAAc,CAAC,GAEzE,EAAmB,EAAO,Q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K,cAGC,EADd,CACc,ECbN,GAAiC,CAC5C,WACA,YACA,UACA,KACA,eAEA,EAAA,cAACC,EAAD,CACE,UAAW,EAAW,eAAgB,CAAS,EACtC,UACL,KACO,WAGJ,EADN,CACM,ECfL,EAA6B,GAAyC,CAC1E,IAAM,EAAQ,EAAkB,EAAiB,WAAW,EAC5D,GAAI,CAAC,EACH,MAAU,MAAM,GAAG,EAAU,4DAA4D,EAE3F,OAAO,CACT,EAUa,GAAyB,CAAE,eAA4C,CAClF,IAAM,EAAgB,EAA0B,uBAAuB,EACvE,OAAO,EAAA,cAAC,EAAD,CAAsC,gBAA0B,WAAY,CAAA,CACrF,EAMa,GAAyB,CAAE,eAA4C,CAClF,IAAM,EAAgB,EAA0B,uBAAuB,EACvE,OAAO,EAAA,cAAC,EAAD,CAAsC,gBAA0B,WAAY,CAAA,CACrF,EAEM,GAAyB,CAC7B,gBACA,eAII,CACJ,IAAM,EAAc,EAAe,CAAa,EAC1C,EAAM,EAAyB,IAAI,EACnC,CAAE,cAAe,EAAY,EAAe,EAAa,CAAG,EAIlE,OACE,EAAA,cAAC,QAAD,CACE,GAAI,EACJ,mBAAkB,IAAA,GAClB,UAAW,GAAa,cACnB,KACN,CAAA,CAEL"}
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import"./focus-ring-SR_LwaN7.js";import{l as e}from"./slot-CNhFZdHF.js";import{t}from"./useForkedRef-DVEfT-KI.js";import{t as n}from"./useFormField-BOqmBTC4.js";import{t as r}from"./useOpenStateProps-DykUbnPJ.js";import{i,n as a}from"./overlayPlacement-BtS90IVf.js";import{t as o}from"./renderFormField-Brkw1yA6.js";import{a as s,i as c,n as l,o as u,r as d,t as f}from"./RangeCalendar-BJl-j4W2.js";import{t as p}from"./validationClassName-gRGs4KBm.js";import{t as m}from"./DateSegment-2agXAd0f.js";import h,{forwardRef as g,useMemo as ee,useRef as _,useState as te}from"react";import v from"classnames";import{FocusScope as y,mergeProps as ne,useButton as b,useDateField as x,useDateFormatter as S,useDatePicker as C,useDateRangePicker as re,useDialog as ie,useLocale as w,useOverlay as T,useOverlayPosition as E}from"react-aria";import{useDateFieldState as D,useDatePickerState as O,useDateRangePickerState as ae,useOverlayTriggerState as oe}from"react-stately";import{createCalendar as se,toCalendarDate as k}from"@internationalized/date";const ce=({overlayRef:e,state:t,triggerRef:n})=>{let{overlayProps:r}=T({isDismissable:!0,isOpen:t.isOpen,onClose:t.close,shouldCloseOnBlur:!0,shouldCloseOnInteractOutside:e=>!n.current?.contains(e)},e),{overlayProps:o,placement:s}=E({isOpen:t.isOpen,offset:2,onClose:null,overlayRef:e,placement:i(`bottom-start`),targetRef:n}),{style:c,...l}=ne(r,o);return{overlayStyle:{position:c?.position,top:c?.top,left:c?.left},placementAttr:a(`bottom-start`,s),overlayDismissProps:l}},le=g(({buttonProps:e,state:n},r)=>{let i=_(null),a=t(i,r),{buttonProps:o}=b({...e,onPress:()=>n.toggle()},i);return h.createElement(`button`,{...o,className:`input-adorn`,ref:a,type:`button`},h.createElement(`svg`,{fill:`none`,height:`16`,viewBox:`0 0 16 16`,width:`16`,xmlns:`http://www.w3.org/2000/svg`},h.createElement(`rect`,{height:`12`,rx:`1.5`,stroke:`currentColor`,strokeWidth:`1.25`,width:`13`,x:`1.5`,y:`3`}),h.createElement(`path`,{d:`M1.5 6.5h13`,stroke:`currentColor`,strokeWidth:`1.25`}),h.createElement(`path`,{d:`M4.5 1.5v3M11.5 1.5v3`,stroke:`currentColor`,strokeLinecap:`round`,strokeWidth:`1.25`})))});le.displayName=`CalendarToggleButton`;const ue=({isDisabled:e,onPress:t})=>{let n=_(null),r=u(),{buttonProps:i}=b({"aria-label":r.clear,isDisabled:e,onPress:t},n);return h.createElement(`button`,{...i,className:`input-adorn`,ref:n,type:`button`},h.createElement(`svg`,{fill:`none`,height:`16`,viewBox:`0 0 16 16`,width:`16`,xmlns:`http://www.w3.org/2000/svg`},h.createElement(`path`,{d:`M4 4l8 8M12 4l-8 8`,stroke:`currentColor`,strokeLinecap:`round`,strokeWidth:`1.25`})))},A=({fieldProps:t})=>{let{locale:n}=w(),r=D({...t,createCalendar:se,locale:n}),i=_(null),{descriptionProps:a,errorMessageProps:o,fieldProps:s}=x(t,r,i);return h.createElement(`div`,{...e(s,a,o),className:`datepicker-field`,ref:i},r.segments.map((e,n)=>h.createElement(m,{fieldLabelledBy:t[`aria-labelledby`],key:n,segment:e,slots:[a,o],state:r})))},de=({calendar:e,className:t,clearButton:n,disabled:r,field:i,fieldClassName:a,groupProps:o,groupRef:s,invalid:c,isOpen:l,overlayDismissProps:u,overlayRef:d,overlayStyle:f,placementAttr:m,size:g,toggleButton:ee,valid:_})=>h.createElement(h.Fragment,null,h.createElement(`div`,{...o,className:v(`form-input`,g,{disabled:r},p(c,_),t),ref:s},h.createElement(`div`,{className:a},i),n,ee),h.createElement(`div`,{className:`datepicker`,"data-cx-placement":m,hidden:!l,ref:d,...u,style:f},l&&h.createElement(y,{contain:!0,restoreFocus:!0},e))),j=g((e,t)=>e.selectionMode===`multiple`?h.createElement(N,{...e,ref:t}):h.createElement(M,{...e,ref:t}));j.displayName=`DatePicker`;const M=g(({className:i,defaultOpen:a,defaultValue:s,defaultVisible:u,disabled:f,firstDayOfWeek:p,granularity:m,help:g,hideTimeZone:te,hourCycle:v,id:y,invalid:b,invalidFeedback:x,isDateUnavailable:S,isOpen:re,label:w,labels:T,maxValue:E,minValue:D,name:ae,onChange:oe,onOpenChange:se,onVisibleChange:k,placeholderValue:j,selectionMode:M,shouldForceLeadingZeros:N,size:fe,unavailableDates:P,valid:F,validFeedback:I,value:pe,visible:L,visibleMonths:me,...R},z)=>{let B=ee(()=>d(P,S),[P,S]),V={defaultValue:s,granularity:m,hideTimeZone:te,hourCycle:v,isDateUnavailable:B,isDisabled:f,isInvalid:b||void 0,maxValue:E,minValue:D,onChange:oe,placeholderValue:j,shouldForceLeadingZeros:N,value:pe},H=O({...r({defaultOpen:a,defaultVisible:u,isOpen:re,onOpenChange:se,onVisibleChange:k,visible:L},`DatePicker`),...V}),U=b||H.displayValidation.isInvalid,W=F&&!U,G=_(null),he=t(z,G),K=_(null),q=_(null),J=_(null),{describedBy:ge,feedbackId:_e,helpId:ve,inputId:ye,labelId:be,labelledBy:Y}=n({ariaDescribedBy:R[`aria-describedby`],ariaLabelledBy:R[`aria-labelledby`],help:g,id:y,invalid:U,invalidFeedback:x,label:w,valid:W,validFeedback:I}),{buttonProps:X,calendarProps:Z,descriptionProps:Q,dialogProps:xe,errorMessageProps:Se,fieldProps:$,groupProps:Ce}=C({...V,"aria-label":R[`aria-label`],"aria-labelledby":Y,id:ye},H,G),{overlayStyle:we,placementAttr:Te,overlayDismissProps:Ee}=ce({overlayRef:q,state:H,triggerRef:G}),{dialogProps:De}=ie(xe,K),Oe=T?.calendar?{...X,"aria-label":T.calendar}:X;return h.createElement(c,{labels:T},o({children:h.createElement(h.Fragment,null,de({calendar:h.createElement(l,{...De,autoFocus:!0,defaultFocusedValue:Z.defaultFocusedValue,disabled:f,firstDayOfWeek:p,isDateUnavailable:B,maxValue:E,minValue:D,onChange:Z.onChange,ref:K,value:Z.value,visibleMonths:me}),className:i,clearButton:H.value&&!f&&h.createElement(ue,{onPress:()=>{H.setValue(null),J.current?.focus()}}),disabled:f,field:h.createElement(A,{fieldProps:e($,Q,Se)}),fieldClassName:`w-100 overflow-x-scroll`,groupProps:{...ne(Ce,R),"aria-describedby":ge,"aria-labelledby":Y},groupRef:he,invalid:U,isOpen:H.isOpen,overlayDismissProps:Ee,overlayRef:q,overlayStyle:we,placementAttr:Te,size:fe,toggleButton:h.createElement(le,{buttonProps:e(Oe,Q,Se),ref:J,state:H}),valid:W}),ae&&h.createElement(`input`,{disabled:f,name:ae,type:`hidden`,value:H.value?H.value.toString():``})),help:g,ids:{feedback:_e,help:ve,label:be},invalid:U,invalidFeedback:x,label:w,valid:W,validFeedback:I}))});M.displayName=`DatePickerSingle`;const N=g(({className:e,defaultOpen:i,defaultValue:a,defaultVisible:u,disabled:f,firstDayOfWeek:p,help:m,id:g,invalid:v,invalidFeedback:y,isDateUnavailable:b,isOpen:x,label:S,labels:C,maxValue:re,minValue:w,name:T,onChange:E,onOpenChange:D,onVisibleChange:O,selectionMode:ae,size:se,unavailableDates:k,valid:A,validFeedback:j,value:M,visible:N,visibleMonths:P,...F},I)=>{let pe=ee(()=>d(k,b),[k,b]),L=M!==void 0,[me,R]=te(a??[]),z=L?M??[]:me,B=e=>{L||R(e),E?.(e)},V=oe(r({defaultOpen:i,defaultVisible:u,isOpen:x,onOpenChange:D,onVisibleChange:O,visible:N},`DatePicker`)),H=_(null),U=t(I,H),W=_(null),G=_(null),he=_(null),{describedBy:K,feedbackId:q,helpId:J,inputId:ge,labelId:_e,labelledBy:ve}=n({ariaDescribedBy:F[`aria-describedby`],ariaLabelledBy:F[`aria-labelledby`],help:m,id:g,invalid:v,invalidFeedback:y,label:S,valid:A,validFeedback:j}),{overlayStyle:ye,placementAttr:be,overlayDismissProps:Y}=ce({overlayRef:G,state:V,triggerRef:H}),{dialogProps:X}=ie({"aria-label":F[`aria-label`],"aria-labelledby":ve},W),Z={...s,...C},Q={"aria-expanded":V.isOpen,"aria-haspopup":`dialog`,"aria-label":Z.calendar,isDisabled:f};return h.createElement(c,{labels:C},o({children:h.createElement(h.Fragment,null,de({calendar:h.createElement(l,{...X,autoFocus:!0,disabled:f,firstDayOfWeek:p,isDateUnavailable:pe,maxValue:re,minValue:w,onChange:B,ref:W,selectionMode:`multiple`,value:z,visibleMonths:P}),className:e,clearButton:z.length>0&&!f&&h.createElement(ue,{onPress:()=>{B([]),he.current?.focus()}}),disabled:f,field:h.createElement(fe,{values:z}),fieldClassName:`w-100 overflow-x-scroll`,groupProps:{...ne(F),"aria-describedby":K,"aria-disabled":f||void 0,"aria-labelledby":ve,id:ge,role:`group`},groupRef:U,invalid:v,isOpen:V.isOpen,overlayDismissProps:Y,overlayRef:G,overlayStyle:ye,placementAttr:be,size:se,toggleButton:h.createElement(le,{buttonProps:Q,ref:he,state:V}),valid:A}),T&&z.map(e=>h.createElement(`input`,{disabled:f,key:e.toString(),name:T,type:`hidden`,value:e.toString()}))),help:m,ids:{feedback:q,help:J,label:_e},invalid:v,invalidFeedback:y,label:S,valid:A,validFeedback:j}))});N.displayName=`DatePickerMultiple`;const fe=({values:e})=>{let t=S({dateStyle:`medium`,timeZone:`UTC`});return h.createElement(`div`,{className:`datepicker-field`},e.length>0&&h.createElement(h.Fragment,null,e.slice().sort((e,t)=>e.compare(t)).map(e=>t.format(k(e).toDate(`UTC`))).join(`, `)))},P=g(({className:i,defaultOpen:a,defaultValue:s,defaultVisible:l,disabled:u,firstDayOfWeek:p,granularity:m,help:g,hideTimeZone:te,hourCycle:v,id:y,invalid:b,invalidFeedback:x,isDateUnavailable:S,isOpen:C,label:w,labels:T,maxValue:E,minValue:D,name:O,onChange:oe,onOpenChange:se,onVisibleChange:k,placeholderValue:j,presets:M,shouldForceLeadingZeros:N,size:fe,unavailableDates:P,valid:F,validFeedback:I,value:pe,visible:L,visibleMonths:me,...R},z)=>{let B=ee(()=>d(P,S),[P,S]),V={defaultValue:s,granularity:m,hideTimeZone:te,hourCycle:v,isDateUnavailable:B,isDisabled:u,isInvalid:b||void 0,maxValue:E,minValue:D,onChange:oe,placeholderValue:j,shouldForceLeadingZeros:N,value:pe},H=ae({...r({defaultOpen:a,defaultVisible:l,isOpen:C,onOpenChange:se,onVisibleChange:k,visible:L},`DateRangePicker`),...V}),U=b||H.displayValidation.isInvalid,W=F&&!U,G=_(null),he=t(z,G),K=_(null),q=_(null),J=_(null),{describedBy:ge,feedbackId:_e,helpId:ve,inputId:ye,labelId:be,labelledBy:Y}=n({ariaDescribedBy:R[`aria-describedby`],ariaLabelledBy:R[`aria-labelledby`],help:g,id:y,invalid:U,invalidFeedback:x,label:w,valid:W,validFeedback:I}),{buttonProps:X,calendarProps:Z,descriptionProps:Q,dialogProps:xe,endFieldProps:Se,errorMessageProps:$,groupProps:Ce,startFieldProps:we}=re({...V,"aria-label":R[`aria-label`],"aria-labelledby":Y,id:ye},H,G),{overlayStyle:Te,placementAttr:Ee,overlayDismissProps:De}=ce({overlayRef:q,state:H,triggerRef:G}),{dialogProps:Oe}=ie(xe,K),ke=T?.calendar?{...X,"aria-label":T.calendar}:X;return h.createElement(c,{labels:T},o({children:h.createElement(h.Fragment,null,de({calendar:h.createElement(f,{...Oe,autoFocus:!0,defaultFocusedValue:Z.defaultFocusedValue,disabled:u,firstDayOfWeek:p,isDateUnavailable:B,maxValue:E,minValue:D,onChange:Z.onChange,presets:M,ref:K,value:Z.value,visibleMonths:me}),className:i,clearButton:(H.value?.start||H.value?.end)&&!u&&h.createElement(ue,{onPress:()=>{H.setValue(null),J.current?.focus()}}),disabled:u,field:h.createElement(h.Fragment,null,h.createElement(A,{fieldProps:e(we,Q,$)}),h.createElement(`span`,{"aria-hidden":`true`,className:`daterangepicker-separator`},`–`),h.createElement(A,{fieldProps:e(Se,Q,$)})),fieldClassName:`d-flex w-100`,groupProps:{...ne(Ce,R),"aria-describedby":ge,"aria-labelledby":Y},groupRef:he,invalid:U,isOpen:H.isOpen,overlayDismissProps:De,overlayRef:q,overlayStyle:Te,placementAttr:Ee,size:fe,toggleButton:h.createElement(le,{buttonProps:e(ke,Q,$),ref:J,state:H}),valid:W}),O&&h.createElement(h.Fragment,null,h.createElement(`input`,{disabled:u,name:`${O}Start`,type:`hidden`,value:H.value?.start?H.value.start.toString():``}),h.createElement(`input`,{disabled:u,name:`${O}End`,type:`hidden`,value:H.value?.end?H.value.end.toString():``}))),help:g,ids:{feedback:_e,help:ve,label:be},invalid:U,invalidFeedback:x,label:w,valid:W,validFeedback:I}))});P.displayName=`DateRangePicker`;export{j as n,P as t};
|
|
2
|
-
//# sourceMappingURL=datepicker-bOiM_zhJ.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"datepicker-bOiM_zhJ.js","names":[],"sources":["../../src/hooks/useOverlayPlacement.ts","../../src/components/datepicker/CalendarToggleButton.tsx","../../src/components/datepicker/ClearButton.tsx","../../src/components/datepicker/DateField.tsx","../../src/components/datepicker/renderDatePickerShell.tsx","../../src/components/datepicker/DatePicker.tsx","../../src/components/datepicker/DateRangePicker.tsx"],"sourcesContent":["import { CSSProperties, HTMLAttributes, RefObject } from 'react'\nimport { mergeProps, useOverlay, useOverlayPosition } from 'react-aria'\nimport { OverlayTriggerState } from 'react-stately'\n\nimport { resolveDataPlacement, toAriaPlacement } from '../utils/overlayPlacement'\n\ninterface UseOverlayPlacementProps {\n overlayRef: RefObject<HTMLElement | null>\n state: OverlayTriggerState\n triggerRef: RefObject<HTMLElement | null>\n}\n\ninterface UseOverlayPlacementResult {\n overlayStyle: CSSProperties\n placementAttr: string\n // Re-typed as plain HTML attributes for the same `rollup-plugin-dts` portability reason as\n // before (see git history) — react-aria's own return type pulls in a `FocusableElement`\n // reference the bundled `.d.ts` can't always resolve a portable name for.\n overlayDismissProps: HTMLAttributes<HTMLElement>\n}\n\n// Shared by `DatePicker` and `DateRangePicker` — both position their calendar overlay the same\n// way (`bottom-start`, 2px offset, closing on Escape, on any click outside it, or when focus leaves\n// the trigger group). Lives in `hooks/` rather than `components/datepicker/` like every other hook\n// in this library, regardless of how many components use it — see `useFormField` for the same\n// treatment despite having many more callers.\n//\n// Built directly on `useOverlay` + `useOverlayPosition` rather than the higher-level `usePopover`\n// combo hook. `usePopover` computes its own internal `onClose` for `useOverlayPosition` from\n// `isNonModal` (`isNonModal && !isSubmenu ? state.close : null`, neither overridable by a caller),\n// and `isNonModal: true` — needed so the calendar doesn't lock page scroll or aria-hide the rest of\n// the page, since it was never meant to be modal — unconditionally arms `useOverlayPosition`'s\n// close-on-any-window-scroll listener (`useCloseOnScroll`, keyed off `onClose !== null`) as a side\n// effect. That's wrong here: the calendar should reposition with its trigger when the page scrolls,\n// not disappear. Calling the two lower-level hooks directly, with `onClose: null` passed to\n// `useOverlayPosition` alone, gets the positioning and Escape/blur dismissal this calendar needs\n// without arming that listener — the same fix already applied to `Autocomplete`/`Combobox`/\n// `Menu`/`MenuSubmenu`/`Popover`, none of which use `usePopover` either, all for this same reason.\nexport const useOverlayPlacement = ({\n overlayRef,\n state,\n triggerRef\n}: UseOverlayPlacementProps): UseOverlayPlacementResult => {\n // The trigger's own toggle button lives inside `triggerRef`, not `overlayRef` — without this,\n // focus moving there when the button is pressed would count as an \"outside\" interaction and\n // close the overlay, which the button's own `onPress` then immediately reopens on click.\n const shouldCloseOnInteractOutside = (element: Element) => !triggerRef.current?.contains(element)\n\n // Escape key + outside-interaction dismissal — the two pieces of `usePopover`'s bundled behavior\n // this calendar still needs. `isDismissable: true` — *not* `usePopover`'s own default of `false`\n // whenever `isNonModal` is true — is required to actually get outside-*click* dismissal:\n // `useOverlay`'s `shouldCloseOnBlur` only closes on a focus-based blur, and explicitly bails when\n // the click target isn't focusable (`relatedTarget` is `null`, i.e. focus lands on `document.body`,\n // as it does for an ordinary click on plain page content) — its own source comments that this case\n // is intentionally left to the separate pointerdown-outside listener `useOverlay` only wires up\n // when `isDismissable` is true. Leaving it at the `usePopover`-matching default therefore silently\n // drops the single most common way users try to dismiss a popover.\n const { overlayProps } = useOverlay(\n {\n isDismissable: true,\n isOpen: state.isOpen,\n onClose: state.close,\n shouldCloseOnBlur: true,\n shouldCloseOnInteractOutside\n },\n overlayRef\n )\n\n const { overlayProps: positionProps, placement: resolvedPlacement } = useOverlayPosition({\n isOpen: state.isOpen,\n offset: 2,\n // Opts out of `useOverlayPosition`'s own close-on-any-window-scroll listener — see this hook's\n // own comment above. Leaving this `undefined` would NOT disable it: `useCloseOnScroll` only\n // early-returns on `onClose === null`, not merely falsy.\n onClose: null,\n overlayRef,\n placement: toAriaPlacement('bottom-start'),\n targetRef: triggerRef\n })\n\n const { style: overlayPositionStyle, ...overlayDismissProps } = mergeProps(\n overlayProps,\n positionProps\n )\n const overlayStyle: CSSProperties = {\n position: overlayPositionStyle?.position as CSSProperties['position'],\n top: overlayPositionStyle?.top,\n left: overlayPositionStyle?.left\n }\n const placementAttr = resolveDataPlacement('bottom-start', resolvedPlacement)\n\n return { overlayStyle, placementAttr, overlayDismissProps }\n}\n","import React, { forwardRef, useRef } from 'react'\nimport { AriaButtonProps, useButton } from 'react-aria'\nimport { OverlayTriggerState } from 'react-stately'\n\nimport { useForkedRef } from '../../hooks'\n\ninterface CalendarToggleButtonProps {\n buttonProps: AriaButtonProps\n state: OverlayTriggerState\n}\n\n// Shared by `DatePicker` and `DateRangePicker` — both trigger their calendar overlay with an\n// identical calendar-icon button. `buttonProps.onPress` (from that caller's own `useDatePicker`/\n// `useDateRangePicker`) only ever opens the overlay (matches upstream react-aria), so re-clicking\n// the button while it's already open would otherwise do nothing — overridden here to actually\n// toggle. Forwards its ref so callers can move focus onto it explicitly — e.g. `ClearButton` sits\n// immediately before it and unmounts itself on press, so focus needs somewhere to land.\nexport const CalendarToggleButton = forwardRef<HTMLButtonElement, CalendarToggleButtonProps>(\n ({ buttonProps, state }, forwardedRef) => {\n const internalRef = useRef<HTMLButtonElement>(null)\n const ref = useForkedRef(internalRef, forwardedRef)\n const { buttonProps: toggleProps } = useButton(\n { ...buttonProps, onPress: () => state.toggle() },\n internalRef\n )\n\n return (\n <button {...toggleProps} className=\"input-adorn\" ref={ref} type=\"button\">\n <svg\n fill=\"none\"\n height=\"16\"\n viewBox=\"0 0 16 16\"\n width=\"16\"\n xmlns=\"http://www.w3.org/2000/svg\"\n >\n <rect\n height=\"12\"\n rx=\"1.5\"\n stroke=\"currentColor\"\n strokeWidth=\"1.25\"\n width=\"13\"\n x=\"1.5\"\n y=\"3\"\n />\n <path d=\"M1.5 6.5h13\" stroke=\"currentColor\" strokeWidth=\"1.25\" />\n <path\n d=\"M4.5 1.5v3M11.5 1.5v3\"\n stroke=\"currentColor\"\n strokeLinecap=\"round\"\n strokeWidth=\"1.25\"\n />\n </svg>\n </button>\n )\n }\n)\n\nCalendarToggleButton.displayName = 'CalendarToggleButton'\n","import React, { useRef } from 'react'\nimport { useButton } from 'react-aria'\n\nimport { useCalendarLabels } from '../calendar/labels'\n\ninterface ClearButtonProps {\n isDisabled?: boolean\n onPress: () => void\n}\n\n// Shared by `DatePicker` and `DateRangePicker` — a trailing \"×\" adornment that resets the\n// current selection to empty. Rendered only while there's something to clear (see each caller's\n// own conditional). `useButton` for the same reason `CalendarToggleButton` uses it: proper\n// press/keyboard semantics consistent with the rest of this library, rather than a raw `onClick`.\nexport const ClearButton = ({ isDisabled, onPress }: ClearButtonProps) => {\n const ref = useRef<HTMLButtonElement>(null)\n const labels = useCalendarLabels()\n const { buttonProps } = useButton({ 'aria-label': labels.clear, isDisabled, onPress }, ref)\n\n return (\n <button {...buttonProps} className=\"input-adorn\" ref={ref} type=\"button\">\n <svg\n fill=\"none\"\n height=\"16\"\n viewBox=\"0 0 16 16\"\n width=\"16\"\n xmlns=\"http://www.w3.org/2000/svg\"\n >\n <path\n d=\"M4 4l8 8M12 4l-8 8\"\n stroke=\"currentColor\"\n strokeLinecap=\"round\"\n strokeWidth=\"1.25\"\n />\n </svg>\n </button>\n )\n}\n","import React, { useRef } from 'react'\nimport { AriaDateFieldProps, DateValue, useDateField, useLocale } from 'react-aria'\nimport { useDateFieldState } from 'react-stately'\nimport { createCalendar } from '@internationalized/date'\n\nimport { withoutSlotIds } from '../../utils/idRefs'\nimport { DateSegment } from './DateSegment'\n\ninterface DateFieldProps {\n fieldProps: AriaDateFieldProps<DateValue>\n}\n\n// Builds its own segment state from the `fieldProps` `DatePicker` hands down — mirrors react\n// aria's own documented composition (the top-level `useDatePickerState`/`useDatePicker` pair\n// manages the *selected value*; the field's individually-editable segments are a separate piece\n// of state derived from `locale`/`createCalendar`, owned here).\nexport const DateField = ({ fieldProps }: DateFieldProps) => {\n const { locale } = useLocale()\n const state = useDateFieldState({\n ...fieldProps,\n createCalendar,\n locale\n })\n\n const ref = useRef<HTMLDivElement>(null)\n const {\n descriptionProps,\n errorMessageProps,\n fieldProps: domFieldProps\n } = useDateField(fieldProps, state, ref)\n\n return (\n <div\n {...withoutSlotIds(domFieldProps, descriptionProps, errorMessageProps)}\n className=\"datepicker-field\"\n ref={ref}\n >\n {state.segments.map((segment, index) => (\n <DateSegment\n fieldLabelledBy={fieldProps['aria-labelledby']}\n // eslint-disable-next-line react/no-array-index-key\n key={index}\n segment={segment}\n slots={[descriptionProps, errorMessageProps]}\n state={state}\n />\n ))}\n </div>\n )\n}\n","import React, { CSSProperties, HTMLAttributes, ReactNode, Ref } from 'react'\nimport classNames from 'classnames'\nimport { FocusScope } from 'react-aria'\n\nimport { validationClassName } from '../../utils/validationClassName'\n\nexport interface RenderDatePickerShellOptions {\n /**\n * The fully-built calendar element (`Calendar`/`RangeCalendar`, with its own dialog role/ref\n * already applied) — only ever mounted while `isOpen`, inside a `FocusScope`.\n */\n calendar: ReactNode\n className?: string\n /**\n * The `ClearButton` element, or `null`/`undefined` when there's nothing to clear.\n */\n clearButton?: ReactNode\n disabled?: boolean\n /**\n * The field itself — a single segmented `DateField`, a read-only `MultiDateField`, or a pair\n * of `DateField`s either side of a separator.\n */\n field: ReactNode\n /**\n * className for the wrapper directly around `field` — differs slightly by variant\n * (`DateRangePicker`'s two side-by-side fields need `d-flex`, the single-field variants don't).\n */\n fieldClassName: string\n /**\n * Already-merged props (react-aria's `groupProps`/`mergeProps(rest)`, plus\n * `aria-describedby`/`aria-labelledby` and any variant-specific ARIA attributes) for the\n * `.form-input` wrapper — assembling this is the caller's job since react-aria only returns a\n * `groupProps` shape for the single-select hooks, not the manually-assembled multi-select case.\n */\n groupProps: HTMLAttributes<HTMLDivElement>\n groupRef: Ref<HTMLDivElement>\n invalid?: boolean\n isOpen: boolean\n overlayDismissProps: HTMLAttributes<HTMLElement>\n overlayRef: Ref<HTMLDivElement>\n overlayStyle?: CSSProperties\n placementAttr?: string\n size?: 'sm' | 'lg'\n toggleButton: ReactNode\n valid?: boolean\n}\n\n// Shared `.form-input` adorn-wrapper + popover-overlay shell for `DatePicker`'s two internal\n// variants (single/multiple selection) and `DateRangePicker` — otherwise duplicated near-verbatim\n// three times. What's left in each caller is only the genuinely variant-specific pieces: which\n// field(s) render inside the wrapper, which calendar (`Calendar`/`RangeCalendar`, single- vs.\n// range-typed props) renders inside the overlay, and how each variant's own `groupProps`/hidden\n// inputs get built.\nexport const renderDatePickerShell = ({\n calendar,\n className,\n clearButton,\n disabled,\n field,\n fieldClassName,\n groupProps,\n groupRef,\n invalid,\n isOpen,\n overlayDismissProps,\n overlayRef,\n overlayStyle,\n placementAttr,\n size,\n toggleButton,\n valid\n}: RenderDatePickerShellOptions): ReactNode => (\n <>\n <div\n {...groupProps}\n className={classNames(\n 'form-input',\n size,\n { disabled },\n validationClassName(invalid, valid),\n className\n )}\n ref={groupRef}\n >\n <div className={fieldClassName}>{field}</div>\n {clearButton}\n {toggleButton}\n </div>\n <div\n className=\"datepicker\"\n data-cx-placement={placementAttr}\n hidden={!isOpen}\n ref={overlayRef}\n {...overlayDismissProps}\n style={overlayStyle}\n >\n {isOpen && (\n <FocusScope contain restoreFocus>\n {calendar}\n </FocusScope>\n )}\n </div>\n </>\n)\n","import React, { forwardRef, HTMLAttributes, ReactNode, useMemo, useRef, useState } from 'react'\nimport { AriaButtonProps, mergeProps, useDateFormatter, useDatePicker, useDialog } from 'react-aria'\nimport {\n DateValue,\n OverlayTriggerState,\n useDatePickerState,\n useOverlayTriggerState\n} from 'react-stately'\nimport { toCalendarDate } from '@internationalized/date'\n\nimport { useForkedRef, useFormField, useOpenStateProps, useOverlayPlacement } from '../../hooks'\nimport { mergeIsDateUnavailable } from '../../utils/mergeIsDateUnavailable'\nimport { withoutSlotIds } from '../../utils/idRefs'\nimport { renderFormField } from '../form-field/renderFormField'\nimport { Calendar } from '../calendar/Calendar'\nimport { CalendarToggleButton } from './CalendarToggleButton'\nimport { ClearButton } from './ClearButton'\nimport { DateField } from './DateField'\nimport { renderDatePickerShell } from './renderDatePickerShell'\nimport './DatePicker.scss'\nimport { CalendarLabels, CalendarLabelsProvider, DEFAULT_CALENDAR_LABELS } from '../calendar/labels'\n\ninterface DatePickerBaseProps extends Omit<\n HTMLAttributes<HTMLDivElement>,\n 'onChange' | 'defaultValue'\n> {\n /**\n * An accessible label for the date picker, used when there's no visible `<label>`.\n */\n 'aria-label'?: string\n /**\n * Identifies a visible `<label>` element for the date picker.\n */\n 'aria-labelledby'?: string\n /**\n * A string of all className you want applied to the base component.\n */\n className?: string\n /**\n * Whether the calendar popover is open by default (uncontrolled).\n *\n * @deprecated Use `defaultVisible`.\n */\n defaultOpen?: boolean\n /**\n * Whether the calendar popover is open when the date picker first renders. Use it instead of\n * `visible` when nothing outside needs to control the popover.\n *\n * @default false\n */\n defaultVisible?: boolean\n /**\n * Prevents the date picker from being focused or interacted with.\n */\n disabled?: boolean\n /**\n * The day that starts the week in the calendar overlay, overriding the default set by the\n * active locale.\n *\n * @default 'mon'\n */\n firstDayOfWeek?: 'sun' | 'mon' | 'tue' | 'wed' | 'thu' | 'fri' | 'sat'\n /**\n * A description for the field, rendered below the date picker.\n */\n help?: ReactNode\n /**\n * `id` forwarded to the field's grouping element — useful for pairing with a `<label for>`.\n */\n id?: string\n /**\n * Set component validation state to invalid.\n */\n invalid?: boolean\n /**\n * An error message for the field, rendered below the date picker when `invalid` is set.\n */\n invalidFeedback?: ReactNode\n /**\n * Callback that is called for each date in the calendar. If it returns `true`, that date is\n * shown but cannot be selected.\n */\n isDateUnavailable?: (date: DateValue) => boolean\n /**\n * Overrides for the strings this component and its calendar render themselves rather than\n * getting from the active locale — the calendar trigger, the clear adornment, and the calendar's\n * own year-view arrows/announcements. Date segment order, month and weekday names all follow\n * `I18nProvider`'s locale via react-aria and need no override. Merged over the English defaults,\n * so passing one key leaves the rest alone.\n */\n labels?: Partial<CalendarLabels>\n /**\n * Whether the calendar popover is open (controlled).\n *\n * @deprecated Use `visible`.\n */\n isOpen?: boolean\n /**\n * The field's caption, rendered as a `FormLabel` associated with the field group.\n */\n label?: ReactNode\n /**\n * The maximum allowed date that a user may select.\n */\n maxValue?: DateValue | null\n /**\n * The minimum allowed date that a user may select.\n */\n minValue?: DateValue | null\n /**\n * `name` of an auto-created hidden input, kept in sync with the selection, for native form\n * submission — one input when `selectionMode` is `'single'`, one per selected date when it's\n * `'multiple'` (same `name` on each, which browsers serialize as multiple form values). Omit to\n * skip creating any. The value is the date's `toString()`: `2026-03-15`, with a time\n * `2026-03-15T09:30:00`, and with a time zone `2026-03-15T09:30:00+09:00[Asia/Tokyo]`, which\n * `parseZonedDateTime` reads back.\n */\n name?: string\n /**\n * Callback fired when the calendar popover's open state changes.\n *\n * @deprecated Use `onVisibleChange`.\n */\n onOpenChange?: (isOpen: boolean) => void\n /**\n * Callback fired when the calendar popover asks to open or close: the calendar button, a\n * completed selection, the Escape key or a click outside. Receives the state it asks for.\n * With `visible` set, the popover changes only when `visible` does.\n */\n onVisibleChange?: (visible: boolean) => void\n /**\n * Size the component sm or lg.\n */\n size?: 'sm' | 'lg'\n /**\n * ISO 8601 dates (`YYYY-MM-DD`) to mark unselectable, as a convenience alternative to\n * `isDateUnavailable` for data-driven cases (e.g. booked dates fetched from an API). Composed\n * with `isDateUnavailable` when both are given — a date unavailable by either is unavailable.\n * Applies to both the calendar overlay and typing a date directly into the field.\n */\n unavailableDates?: string[]\n /**\n * Set component validation state to valid.\n */\n valid?: boolean\n /**\n * A success message for the field, rendered below the date picker when `valid` is set.\n */\n validFeedback?: ReactNode\n /**\n * Whether the calendar popover is open. Setting it makes the popover controlled: it opens and\n * closes only when this changes, so pair it with `onVisibleChange`.\n */\n visible?: boolean\n /**\n * Number of months to display side by side in the calendar overlay.\n *\n * @default 1\n */\n visibleMonths?: number\n}\n\nexport interface DatePickerSingleProps extends DatePickerBaseProps {\n /**\n * The initial selected date (uncontrolled).\n */\n defaultValue?: DateValue | null\n /**\n * The smallest unit the field shows and edits. `'hour'`, `'minute'` and `'second'` add a time\n * to the date: the value is then a `CalendarDateTime`, or a `ZonedDateTime` when `value`,\n * `defaultValue` or `placeholderValue` is one, and a value or placeholder given must carry a\n * time. Picking a day in the calendar keeps the time. A day picked in an empty field takes the\n * time, and zone, of `defaultValue`, else `placeholderValue`, else midnight with no zone: a\n * controlled zoned `value`, once cleared, needs a zoned `placeholderValue` to stay zoned.\n *\n * @default 'day', or 'minute' for a value with a time\n */\n granularity?: 'day' | 'hour' | 'minute' | 'second'\n /**\n * Hide the time zone of a `ZonedDateTime` value.\n */\n hideTimeZone?: boolean\n /**\n * Show 12 or 24 hours. Defaults to the locale's.\n */\n hourCycle?: 12 | 24\n /**\n * The date the segments start from while the field is empty, such as\n * `new CalendarDateTime(2026, 1, 1, 9)`, and the month the calendar opens on. With no\n * `defaultValue`, its time is the one a day picked in the calendar gets, and its type the type\n * of value `onChange` receives: a `ZonedDateTime` gives zoned values. With a time\n * `granularity` it must carry a time.\n */\n placeholderValue?: DateValue\n /**\n * Show a leading zero on the day, month and hour, as `03/05` rather than `3/5`, whatever the\n * locale does.\n */\n shouldForceLeadingZeros?: boolean\n /**\n * Callback fired when the selected date changes. With a time (`granularity`), it receives a\n * `CalendarDateTime` or `ZonedDateTime`.\n */\n onChange?: (value: DateValue | null) => void\n /**\n * Whether a single date or multiple, independently toggled dates can be selected. Multiple\n * selection replaces the editable segmented field with a read-only, comma-separated list of\n * the selected dates — a segmented day/month/year field has no way to represent more than one\n * date.\n *\n * @default 'single'\n */\n selectionMode?: 'single'\n /**\n * The selected date (controlled).\n */\n value?: DateValue | null\n}\n\nexport interface DatePickerMultipleProps extends DatePickerBaseProps {\n /**\n * The initial selected dates (uncontrolled).\n */\n defaultValue?: DateValue[] | null\n /**\n * Callback fired when the set of selected dates changes.\n */\n onChange?: (value: DateValue[]) => void\n /**\n * Whether a single date or multiple, independently toggled dates can be selected. Multiple\n * selection replaces the editable segmented field with a read-only, comma-separated list of\n * the selected dates — a segmented day/month/year field has no way to represent more than one\n * date.\n *\n * @default 'single'\n */\n selectionMode: 'multiple'\n /**\n * The selected dates (controlled).\n */\n value?: DateValue[] | null\n}\n\nexport type DatePickerProps = DatePickerSingleProps | DatePickerMultipleProps\n\n// Dispatches on `selectionMode` between two internal implementations that share little beyond\n// the field/overlay shell and `useFormField` — `selectionMode: 'multiple'` has no\n// `useDatePickerState`/`useDatePicker` equivalent to build on (see `DatePickerMultiple`'s own\n// comment), so bolting an array value onto the single-value hook pair isn't an option.\nexport const DatePicker = forwardRef<HTMLDivElement, DatePickerProps>((props, ref) => {\n if (props.selectionMode === 'multiple') return <DatePickerMultiple {...props} ref={ref} />\n return <DatePickerSingle {...props} ref={ref} />\n})\n\nDatePicker.displayName = 'DatePicker'\n\nconst DatePickerSingle = forwardRef<HTMLDivElement, DatePickerSingleProps>(\n (\n {\n className,\n defaultOpen,\n defaultValue,\n defaultVisible,\n disabled,\n firstDayOfWeek,\n granularity,\n help,\n hideTimeZone,\n hourCycle,\n id,\n invalid,\n invalidFeedback,\n isDateUnavailable,\n isOpen,\n label,\n labels,\n maxValue,\n minValue,\n name,\n onChange,\n onOpenChange,\n onVisibleChange,\n placeholderValue,\n selectionMode: _selectionMode,\n shouldForceLeadingZeros,\n size,\n unavailableDates,\n valid,\n validFeedback,\n value,\n visible,\n visibleMonths,\n ...rest\n }: DatePickerSingleProps,\n ref\n ) => {\n const combinedIsDateUnavailable = useMemo(\n () => mergeIsDateUnavailable(unavailableDates, isDateUnavailable),\n [unavailableDates, isDateUnavailable]\n )\n\n // What both react-stately's state and react-aria's hook read: the hook hands the time props\n // on to the field's segments.\n const pickerProps = {\n defaultValue,\n granularity,\n hideTimeZone,\n hourCycle,\n isDateUnavailable: combinedIsDateUnavailable,\n isDisabled: disabled,\n // `false` would override the state's own check of the range and unavailable dates:\n // react-stately takes a defined `isInvalid` as the whole validation state.\n isInvalid: invalid || undefined,\n maxValue,\n minValue,\n onChange,\n placeholderValue,\n shouldForceLeadingZeros,\n value\n }\n\n const state = useDatePickerState({\n ...useOpenStateProps(\n { defaultOpen, defaultVisible, isOpen, onOpenChange, onVisibleChange, visible },\n 'DatePicker'\n ),\n ...pickerProps\n })\n // A value outside `minValue`/`maxValue`, or on an unavailable date, is invalid too, shown as\n // `invalid` is, as `TimeField` shows it.\n const showInvalid = invalid || state.displayValidation.isInvalid\n const showValid = valid && !showInvalid\n\n const groupRef = useRef<HTMLDivElement>(null)\n const forkedGroupRef = useForkedRef(ref, groupRef)\n const calendarRef = useRef<HTMLDivElement>(null)\n const overlayRef = useRef<HTMLDivElement>(null)\n const toggleButtonRef = useRef<HTMLButtonElement>(null)\n\n const {\n describedBy,\n feedbackId,\n helpId,\n inputId: groupId,\n labelId,\n labelledBy\n } = useFormField({\n ariaDescribedBy: rest['aria-describedby'],\n ariaLabelledBy: rest['aria-labelledby'],\n help,\n id,\n invalid: showInvalid,\n invalidFeedback,\n label,\n valid: showValid,\n validFeedback\n })\n\n const {\n buttonProps,\n calendarProps,\n descriptionProps,\n dialogProps,\n errorMessageProps,\n fieldProps,\n groupProps\n } = useDatePicker(\n {\n ...pickerProps,\n 'aria-label': rest['aria-label'],\n 'aria-labelledby': labelledBy,\n id: groupId\n },\n state,\n groupRef\n )\n\n const { overlayStyle, placementAttr, overlayDismissProps } = useOverlayPlacement({\n overlayRef,\n state,\n triggerRef: groupRef\n })\n\n // `Calendar` is dialog-agnostic by design (see its own comment) — applying `role=\"dialog\"`\n // etc. is this component's concern, layered on via the generic HTML-attribute passthrough\n // `Calendar` merges onto its root.\n const { dialogProps: domDialogProps } = useDialog(dialogProps, calendarRef)\n\n // react-aria names the trigger in the active locale; `labels.calendar` replaces that name.\n const triggerProps = labels?.calendar\n ? { ...buttonProps, 'aria-label': labels.calendar }\n : buttonProps\n\n return (\n <CalendarLabelsProvider labels={labels}>\n {renderFormField({\n children: (\n <>\n {renderDatePickerShell({\n calendar: (\n <Calendar\n {...domDialogProps}\n autoFocus\n defaultFocusedValue={calendarProps.defaultFocusedValue}\n disabled={disabled}\n firstDayOfWeek={firstDayOfWeek}\n isDateUnavailable={combinedIsDateUnavailable}\n maxValue={maxValue}\n minValue={minValue}\n onChange={calendarProps.onChange}\n ref={calendarRef}\n value={calendarProps.value}\n visibleMonths={visibleMonths}\n />\n ),\n className,\n clearButton: state.value && !disabled && (\n <ClearButton\n onPress={() => {\n state.setValue(null)\n // `ClearButton` unmounts itself once `state.value` clears — without this, focus\n // would otherwise drop to `document.body` (same failure mode fixed for the\n // calendar's own month/year view switch — see `CalendarMonthYearPicker`'s comment).\n toggleButtonRef.current?.focus()\n }}\n />\n ),\n disabled,\n field: (\n <DateField\n fieldProps={withoutSlotIds(fieldProps, descriptionProps, errorMessageProps)}\n />\n ),\n fieldClassName: 'w-100 overflow-x-scroll',\n groupProps: {\n ...mergeProps(groupProps, rest),\n 'aria-describedby': describedBy,\n 'aria-labelledby': labelledBy\n },\n groupRef: forkedGroupRef,\n invalid: showInvalid,\n isOpen: state.isOpen,\n overlayDismissProps,\n overlayRef,\n overlayStyle,\n placementAttr,\n size,\n toggleButton: (\n <CalendarToggleButton\n buttonProps={withoutSlotIds(triggerProps, descriptionProps, errorMessageProps)}\n ref={toggleButtonRef}\n state={state}\n />\n ),\n valid: showValid\n })}\n {name && (\n <input\n disabled={disabled}\n name={name}\n type=\"hidden\"\n value={state.value ? state.value.toString() : ''}\n />\n )}\n </>\n ),\n help,\n ids: { feedback: feedbackId, help: helpId, label: labelId },\n invalid: showInvalid,\n invalidFeedback,\n label,\n valid: showValid,\n validFeedback\n })}\n </CalendarLabelsProvider>\n )\n }\n)\n\nDatePickerSingle.displayName = 'DatePickerSingle'\n\n// `selectionMode: 'multiple'` counterpart to `DatePickerSingle` — deliberately not built on\n// `useDatePickerState`/`useDatePicker`, since neither has any multi-value concept (a single\n// `DateValue`, edited through one segmented day/month/year field that has no way to represent\n// more than one date — see react-stately's own `useDatePickerState` types). Instead this is\n// assembled from the same lower-level pieces already used elsewhere in this codebase:\n// `useOverlayTriggerState` for open/close (the same `OverlayTriggerState` shape\n// `useOverlayPlacement`/`CalendarToggleButton` already expect, so both are reused unchanged), the\n// manual controlled/uncontrolled pattern `ChipInput` already uses for its own array value, and\n// a read-only comma-separated field in place of `DateField`'s editable segments.\nconst DatePickerMultiple = forwardRef<HTMLDivElement, DatePickerMultipleProps>(\n (\n {\n className,\n defaultOpen,\n defaultValue,\n defaultVisible,\n disabled,\n firstDayOfWeek,\n help,\n id,\n invalid,\n invalidFeedback,\n isDateUnavailable,\n isOpen,\n label,\n labels,\n maxValue,\n minValue,\n name,\n onChange,\n onOpenChange,\n onVisibleChange,\n selectionMode: _selectionMode,\n size,\n unavailableDates,\n valid,\n validFeedback,\n value,\n visible,\n visibleMonths,\n ...rest\n }: DatePickerMultipleProps,\n ref\n ) => {\n const combinedIsDateUnavailable = useMemo(\n () => mergeIsDateUnavailable(unavailableDates, isDateUnavailable),\n [unavailableDates, isDateUnavailable]\n )\n\n const isControlled = value !== undefined\n const [uncontrolledValues, setUncontrolledValues] = useState<DateValue[]>(defaultValue ?? [])\n const values = isControlled ? (value ?? []) : uncontrolledValues\n\n const setValues = (next: DateValue[]) => {\n if (!isControlled) setUncontrolledValues(next)\n onChange?.(next)\n }\n\n const state: OverlayTriggerState = useOverlayTriggerState(\n useOpenStateProps(\n { defaultOpen, defaultVisible, isOpen, onOpenChange, onVisibleChange, visible },\n 'DatePicker'\n )\n )\n\n const groupRef = useRef<HTMLDivElement>(null)\n const forkedGroupRef = useForkedRef(ref, groupRef)\n const calendarRef = useRef<HTMLDivElement>(null)\n const overlayRef = useRef<HTMLDivElement>(null)\n const toggleButtonRef = useRef<HTMLButtonElement>(null)\n\n const {\n describedBy,\n feedbackId,\n helpId,\n inputId: groupId,\n labelId,\n labelledBy\n } = useFormField({\n ariaDescribedBy: rest['aria-describedby'],\n ariaLabelledBy: rest['aria-labelledby'],\n help,\n id,\n invalid,\n invalidFeedback,\n label,\n valid,\n validFeedback\n })\n\n const { overlayStyle, placementAttr, overlayDismissProps } = useOverlayPlacement({\n overlayRef,\n state,\n triggerRef: groupRef\n })\n\n const { dialogProps: domDialogProps } = useDialog(\n { 'aria-label': rest['aria-label'], 'aria-labelledby': labelledBy },\n calendarRef\n )\n\n // This variant builds its own trigger button props rather than getting them from\n // `useDatePicker` (see the component comment), so it has to resolve the label itself — it's\n // the provider here, so it can't read the context it's about to publish.\n const mergedLabels = { ...DEFAULT_CALENDAR_LABELS, ...labels }\n\n const buttonProps: AriaButtonProps = {\n 'aria-expanded': state.isOpen,\n 'aria-haspopup': 'dialog',\n 'aria-label': mergedLabels.calendar,\n isDisabled: disabled\n }\n\n return (\n <CalendarLabelsProvider labels={labels}>\n {renderFormField({\n children: (\n <>\n {renderDatePickerShell({\n calendar: (\n <Calendar\n {...domDialogProps}\n autoFocus\n disabled={disabled}\n firstDayOfWeek={firstDayOfWeek}\n isDateUnavailable={combinedIsDateUnavailable}\n maxValue={maxValue}\n minValue={minValue}\n onChange={setValues}\n ref={calendarRef}\n selectionMode=\"multiple\"\n value={values}\n visibleMonths={visibleMonths}\n />\n ),\n className,\n clearButton: values.length > 0 && !disabled && (\n <ClearButton\n onPress={() => {\n setValues([])\n // See the single-selection `ClearButton` usage above for why this is needed.\n toggleButtonRef.current?.focus()\n }}\n />\n ),\n disabled,\n field: <MultiDateField values={values} />,\n fieldClassName: 'w-100 overflow-x-scroll',\n groupProps: {\n ...mergeProps(rest),\n 'aria-describedby': describedBy,\n 'aria-disabled': disabled || undefined,\n 'aria-labelledby': labelledBy,\n id: groupId,\n role: 'group'\n },\n groupRef: forkedGroupRef,\n invalid,\n isOpen: state.isOpen,\n overlayDismissProps,\n overlayRef,\n overlayStyle,\n placementAttr,\n size,\n toggleButton: (\n <CalendarToggleButton\n buttonProps={buttonProps}\n ref={toggleButtonRef}\n state={state}\n />\n ),\n valid\n })}\n {name &&\n values.map((date) => (\n <input\n disabled={disabled}\n key={date.toString()}\n name={name}\n type=\"hidden\"\n value={date.toString()}\n />\n ))}\n </>\n ),\n help,\n ids: { feedback: feedbackId, help: helpId, label: labelId },\n invalid,\n invalidFeedback,\n label,\n valid,\n validFeedback\n })}\n </CalendarLabelsProvider>\n )\n }\n)\n\nDatePickerMultiple.displayName = 'DatePickerMultiple'\n\ninterface MultiDateFieldProps {\n values: DateValue[]\n}\n\n// Read-only stand-in for `DateField`'s editable segments — a segmented day/month/year field can\n// only ever represent one date, so multiple selection instead shows every selected date, formatted\n// per the active locale and joined with commas. Each is formatted as its own calendar day, in UTC\n// on both sides: a `ZonedDateTime`'s instant, formatted in the viewer's time zone, is another day\n// for a viewer far enough from the value's zone.\nconst MultiDateField = ({ values }: MultiDateFieldProps) => {\n const formatter = useDateFormatter({ dateStyle: 'medium', timeZone: 'UTC' })\n\n return (\n <div className=\"datepicker-field\">\n {values.length > 0 && (\n <>\n {values\n .slice()\n .sort((a, b) => a.compare(b))\n .map((date) => formatter.format(toCalendarDate(date).toDate('UTC')))\n .join(', ')}\n </>\n )}\n </div>\n )\n}\n","import React, { forwardRef, HTMLAttributes, ReactNode, useMemo, useRef } from 'react'\nimport { mergeProps, RangeValue, useDateRangePicker, useDialog } from 'react-aria'\nimport { DateValue, useDateRangePickerState } from 'react-stately'\n\nimport { useForkedRef, useFormField, useOpenStateProps, useOverlayPlacement } from '../../hooks'\nimport { DateRangePreset } from '../../utils/dateRangePresets'\nimport { mergeIsDateUnavailable } from '../../utils/mergeIsDateUnavailable'\nimport { withoutSlotIds } from '../../utils/idRefs'\nimport { renderFormField } from '../form-field/renderFormField'\nimport { RangeCalendar } from '../calendar/RangeCalendar'\nimport { CalendarToggleButton } from './CalendarToggleButton'\nimport { ClearButton } from './ClearButton'\nimport { DateField } from './DateField'\nimport { renderDatePickerShell } from './renderDatePickerShell'\nimport './DatePicker.scss'\nimport './DateRangePicker.scss'\nimport { CalendarLabels, CalendarLabelsProvider } from '../calendar/labels'\n\nexport interface DateRangePickerProps extends Omit<\n HTMLAttributes<HTMLDivElement>,\n 'onChange' | 'defaultValue'\n> {\n /**\n * An accessible label for the date range picker, used when there's no visible `<label>`.\n */\n 'aria-label'?: string\n /**\n * Identifies a visible `<label>` element for the date range picker.\n */\n 'aria-labelledby'?: string\n /**\n * A string of all className you want applied to the base component.\n */\n className?: string\n /**\n * Whether the calendar popover is open by default (uncontrolled).\n *\n * @deprecated Use `defaultVisible`.\n */\n defaultOpen?: boolean\n /**\n * The initial selected date range (uncontrolled).\n */\n defaultValue?: RangeValue<DateValue> | null\n /**\n * Whether the calendar popover is open when the date range picker first renders. Use it\n * instead of `visible` when nothing outside needs to control the popover.\n *\n * @default false\n */\n defaultVisible?: boolean\n /**\n * Prevents the date range picker from being focused or interacted with.\n */\n disabled?: boolean\n /**\n * The day that starts the week in the calendar overlay, overriding the default set by the\n * active locale.\n *\n * @default 'mon'\n */\n firstDayOfWeek?: 'sun' | 'mon' | 'tue' | 'wed' | 'thu' | 'fri' | 'sat'\n /**\n * The smallest unit the fields show and edit. `'hour'`, `'minute'` and `'second'` add a time\n * to both dates: the range's dates are then `CalendarDateTime`s, or `ZonedDateTime`s when\n * `value`, `defaultValue` or `placeholderValue` holds them, and a range or placeholder given\n * must carry times. Picking a range in the calendar keeps the times. A range picked in an\n * empty field takes the time, and zone, of `placeholderValue`, else midnight with no zone: a\n * zoned range, once cleared, needs a zoned `placeholderValue` to stay zoned.\n *\n * @default 'day', or 'minute' for a range with times\n */\n granularity?: 'day' | 'hour' | 'minute' | 'second'\n /**\n * A description for the field, rendered below the date range picker.\n */\n help?: ReactNode\n /**\n * Hide the time zone of `ZonedDateTime` dates.\n */\n hideTimeZone?: boolean\n /**\n * Show 12 or 24 hours. Defaults to the locale's.\n */\n hourCycle?: 12 | 24\n /**\n * `id` forwarded to the field's grouping element — useful for pairing with a `<label for>`.\n */\n id?: string\n /**\n * Set component validation state to invalid.\n */\n invalid?: boolean\n /**\n * An error message for the field, rendered below the date range picker when `invalid` is set.\n */\n invalidFeedback?: ReactNode\n /**\n * Callback that is called for each date in the calendar. If it returns `true`, that date is\n * shown but cannot be selected.\n */\n isDateUnavailable?: (date: DateValue) => boolean\n /**\n * Overrides for the strings this component and its calendar render themselves rather than\n * getting from the active locale — the calendar trigger, the clear adornment and the calendar's\n * own year-view arrows/announcements. Date segment order, month and weekday names all follow\n * `I18nProvider`'s locale via react-aria and need no override. Merged over the English defaults,\n * so passing one key leaves the rest alone.\n */\n labels?: Partial<CalendarLabels>\n /**\n * Whether the calendar popover is open (controlled).\n *\n * @deprecated Use `visible`.\n */\n isOpen?: boolean\n /**\n * The field's caption, rendered as a `FormLabel` associated with the field group.\n */\n label?: ReactNode\n /**\n * The maximum allowed date that a user may select.\n */\n maxValue?: DateValue | null\n /**\n * The minimum allowed date that a user may select.\n */\n minValue?: DateValue | null\n /**\n * Base `name` for a pair of auto-created hidden inputs, kept in sync with the selection, for\n * native form submission — rendered as `${name}Start` and `${name}End`. Omit to skip creating\n * them. Each value is the date's `toString()`: `2026-03-15`, with a time `2026-03-15T09:30:00`,\n * and with a time zone `2026-03-15T09:30:00+09:00[Asia/Tokyo]`, which `parseZonedDateTime`\n * reads back.\n */\n name?: string\n /**\n * Callback fired when the selected date range changes. With a time (`granularity`), its dates\n * are `CalendarDateTime`s or `ZonedDateTime`s.\n */\n onChange?: (value: RangeValue<DateValue> | null) => void\n /**\n * Callback fired when the calendar popover's open state changes.\n *\n * @deprecated Use `onVisibleChange`.\n */\n onOpenChange?: (isOpen: boolean) => void\n /**\n * Callback fired when the calendar popover asks to open or close: the calendar button, a\n * completed selection, the Escape key or a click outside. Receives the state it asks for.\n * With `visible` set, the popover changes only when `visible` does.\n */\n onVisibleChange?: (visible: boolean) => void\n /**\n * The date both fields start from while empty, such as `new CalendarDateTime(2026, 1, 1, 9)`,\n * and the month the calendar opens on. Its time is the one a range picked in the calendar gets,\n * and its type the type of the dates `onChange` receives: a `ZonedDateTime` gives zoned dates.\n * With a time `granularity` it must carry a time.\n */\n placeholderValue?: DateValue\n /**\n * A list of quick-select range presets shown in the overlay next to the calendar. Selecting a\n * preset commits its range immediately, the same as picking a start and end date from the\n * calendar. The preset matching the current selection (if any) is marked selected. Omit to not\n * show a preset list.\n */\n presets?: DateRangePreset[]\n /**\n * Show a leading zero on the day, month and hour, as `03/05` rather than `3/5`, whatever the\n * locale does.\n */\n shouldForceLeadingZeros?: boolean\n /**\n * Size the component sm or lg.\n */\n size?: 'sm' | 'lg'\n /**\n * ISO 8601 dates (`YYYY-MM-DD`) to mark unselectable, as a convenience alternative to\n * `isDateUnavailable` for data-driven cases (e.g. booked dates fetched from an API). Composed\n * with `isDateUnavailable` when both are given — a date unavailable by either is unavailable.\n * Applies to both the calendar overlay and typing a date directly into either field.\n */\n unavailableDates?: string[]\n /**\n * Set component validation state to valid.\n */\n valid?: boolean\n /**\n * A success message for the field, rendered below the date range picker when `valid` is set.\n */\n validFeedback?: ReactNode\n /**\n * The selected date range (controlled).\n */\n value?: RangeValue<DateValue> | null\n /**\n * Whether the calendar popover is open. Setting it makes the popover controlled: it opens and\n * closes only when this changes, so pair it with `onVisibleChange`.\n */\n visible?: boolean\n /**\n * Number of months to display side by side in the calendar overlay.\n *\n * @default 1\n */\n visibleMonths?: number\n}\n\n// Mirrors `DatePicker` closely — same field/overlay/dialog composition, just with two\n// segmented fields (`startFieldProps`/`endFieldProps` in place of a single `fieldProps`) and\n// `RangeCalendar` in place of `Calendar` in the overlay, dialog role/ref landing directly on\n// it exactly as `Calendar` does for `DatePicker`. `presets` is passed straight through —\n// `RangeCalendar` owns rendering and selecting them (it's also usable standalone), so completing\n// one goes through the same `state.setValue`/`onChange` path a two-click grid selection does,\n// which is what closes this overlay automatically.\nexport const DateRangePicker = forwardRef<HTMLDivElement, DateRangePickerProps>(\n (\n {\n className,\n defaultOpen,\n defaultValue,\n defaultVisible,\n disabled,\n firstDayOfWeek,\n granularity,\n help,\n hideTimeZone,\n hourCycle,\n id,\n invalid,\n invalidFeedback,\n isDateUnavailable,\n isOpen,\n label,\n labels,\n maxValue,\n minValue,\n name,\n onChange,\n onOpenChange,\n onVisibleChange,\n placeholderValue,\n presets,\n shouldForceLeadingZeros,\n size,\n unavailableDates,\n valid,\n validFeedback,\n value,\n visible,\n visibleMonths,\n ...rest\n }: DateRangePickerProps,\n ref\n ): ReactNode => {\n const combinedIsDateUnavailable = useMemo(\n () => mergeIsDateUnavailable(unavailableDates, isDateUnavailable),\n [unavailableDates, isDateUnavailable]\n )\n\n // What both react-stately's state and react-aria's hook read: the hook hands the time props\n // on to the fields' segments.\n const pickerProps = {\n defaultValue,\n granularity,\n hideTimeZone,\n hourCycle,\n isDateUnavailable: combinedIsDateUnavailable,\n isDisabled: disabled,\n // `false` would override the state's own check of the range, unavailable dates and an end\n // before the start: react-stately takes a defined `isInvalid` as the whole validation state.\n isInvalid: invalid || undefined,\n maxValue,\n minValue,\n onChange,\n placeholderValue,\n shouldForceLeadingZeros,\n value\n }\n\n const state = useDateRangePickerState({\n ...useOpenStateProps(\n { defaultOpen, defaultVisible, isOpen, onOpenChange, onVisibleChange, visible },\n 'DateRangePicker'\n ),\n ...pickerProps\n })\n // A range outside `minValue`/`maxValue`, over an unavailable date or ending before it starts\n // is invalid too, shown as `invalid` is, as `TimeField` shows a time out of range.\n const showInvalid = invalid || state.displayValidation.isInvalid\n const showValid = valid && !showInvalid\n\n const groupRef = useRef<HTMLDivElement>(null)\n const forkedGroupRef = useForkedRef(ref, groupRef)\n const calendarRef = useRef<HTMLDivElement>(null)\n const overlayRef = useRef<HTMLDivElement>(null)\n const toggleButtonRef = useRef<HTMLButtonElement>(null)\n\n const {\n describedBy,\n feedbackId,\n helpId,\n inputId: groupId,\n labelId,\n labelledBy\n } = useFormField({\n ariaDescribedBy: rest['aria-describedby'],\n ariaLabelledBy: rest['aria-labelledby'],\n help,\n id,\n invalid: showInvalid,\n invalidFeedback,\n label,\n valid: showValid,\n validFeedback\n })\n\n const {\n buttonProps,\n calendarProps,\n descriptionProps,\n dialogProps,\n endFieldProps,\n errorMessageProps,\n groupProps,\n startFieldProps\n } = useDateRangePicker(\n {\n ...pickerProps,\n 'aria-label': rest['aria-label'],\n 'aria-labelledby': labelledBy,\n id: groupId\n },\n state,\n groupRef\n )\n\n const { overlayStyle, placementAttr, overlayDismissProps } = useOverlayPlacement({\n overlayRef,\n state,\n triggerRef: groupRef\n })\n\n const { dialogProps: domDialogProps } = useDialog(dialogProps, calendarRef)\n\n // react-aria names the trigger in the active locale; `labels.calendar` replaces that name.\n const triggerProps = labels?.calendar\n ? { ...buttonProps, 'aria-label': labels.calendar }\n : buttonProps\n\n return (\n <CalendarLabelsProvider labels={labels}>\n {renderFormField({\n children: (\n <>\n {renderDatePickerShell({\n calendar: (\n <RangeCalendar\n {...domDialogProps}\n autoFocus\n defaultFocusedValue={calendarProps.defaultFocusedValue}\n disabled={disabled}\n firstDayOfWeek={firstDayOfWeek}\n isDateUnavailable={combinedIsDateUnavailable}\n maxValue={maxValue}\n minValue={minValue}\n onChange={calendarProps.onChange}\n presets={presets}\n ref={calendarRef}\n value={calendarProps.value}\n visibleMonths={visibleMonths}\n />\n ),\n className,\n // `state.value` is always a `{ start, end }` object, never `null` itself — even with\n // nothing picked yet — so the endpoints are what actually indicate a selection to\n // clear (matching the hidden-input `value`s below, which check the same way).\n clearButton: (state.value?.start || state.value?.end) && !disabled && (\n <ClearButton\n onPress={() => {\n state.setValue(null)\n // See `DatePicker`'s identical `ClearButton` usage for why this is needed —\n // this button unmounts itself once cleared, so focus needs somewhere to land.\n toggleButtonRef.current?.focus()\n }}\n />\n ),\n disabled,\n field: (\n <>\n <DateField\n fieldProps={withoutSlotIds(\n startFieldProps,\n descriptionProps,\n errorMessageProps\n )}\n />\n <span aria-hidden=\"true\" className=\"daterangepicker-separator\">\n –\n </span>\n <DateField\n fieldProps={withoutSlotIds(\n endFieldProps,\n descriptionProps,\n errorMessageProps\n )}\n />\n </>\n ),\n fieldClassName: 'd-flex w-100',\n groupProps: {\n ...mergeProps(groupProps, rest),\n 'aria-describedby': describedBy,\n 'aria-labelledby': labelledBy\n },\n groupRef: forkedGroupRef,\n invalid: showInvalid,\n isOpen: state.isOpen,\n overlayDismissProps,\n overlayRef,\n overlayStyle,\n placementAttr,\n size,\n toggleButton: (\n <CalendarToggleButton\n buttonProps={withoutSlotIds(triggerProps, descriptionProps, errorMessageProps)}\n ref={toggleButtonRef}\n state={state}\n />\n ),\n valid: showValid\n })}\n {name && (\n <>\n <input\n disabled={disabled}\n name={`${name}Start`}\n type=\"hidden\"\n value={state.value?.start ? state.value.start.toString() : ''}\n />\n <input\n disabled={disabled}\n name={`${name}End`}\n type=\"hidden\"\n value={state.value?.end ? state.value.end.toString() : ''}\n />\n </>\n )}\n </>\n ),\n help,\n ids: { feedback: feedbackId, help: helpId, label: labelId },\n invalid: showInvalid,\n invalidFeedback,\n label,\n valid: showValid,\n validFeedback\n })}\n </CalendarLabelsProvider>\n )\n }\n)\n\nDateRangePicker.displayName = 'DateRangePicker'\n"],"mappings":"khCAsCA,MAAa,IAAuB,CAClC,aACA,QACA,gBACyD,CAezD,GAAM,CAAE,gBAAiB,EACvB,CACE,cAAe,GACf,OAAQ,EAAM,OACd,QAAS,EAAM,MACf,kBAAmB,GACnB,6BAjBkC,GAAqB,CAAC,EAAW,SAAS,SAAS,CAAO,CAkB9F,EACA,CACF,EAEM,CAAE,aAAc,EAAe,UAAW,GAAsB,EAAmB,CACvF,OAAQ,EAAM,OACd,OAAQ,EAIR,QAAS,KACT,aACA,UAAW,EAAgB,cAAc,EACzC,UAAW,CACb,CAAC,EAEK,CAAE,MAAO,EAAsB,GAAG,GAAwB,GAC9D,EACA,CACF,EAQA,MAAO,CAAE,aAAA,CANP,SAAU,GAAsB,SAChC,IAAK,GAAsB,IAC3B,KAAM,GAAsB,IAIV,EAAG,cAFD,EAAqB,eAAgB,CAExB,EAAG,qBAAoB,CAC5D,EC3Ea,GAAuB,GACjC,CAAE,cAAa,SAAS,IAAiB,CACxC,IAAM,EAAc,EAA0B,IAAI,EAC5C,EAAM,EAAa,EAAa,CAAY,EAC5C,CAAE,YAAa,GAAgB,EACnC,CAAE,GAAG,EAAa,YAAe,EAAM,OAAO,CAAE,EAChD,CACF,EAEA,OACE,EAAA,cAAC,SAAD,CAAQ,GAAI,EAAa,UAAU,cAAmB,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AA,CACD,EAEJ,eAAgB,eAChB,WAAY,CACV,GAAG,GAAW,GAAY,CAAI,EAC9B,mBAAoB,GACpB,kBAAmB,CACrB,EACA,SAAU,GACV,QAAS,EACT,OAAQ,EAAM,OACd,uBACA,aACA,gBACA,iBACA,QACA,aACE,EAAA,cAAC,GAAD,CACE,YAAa,EAAe,GAAc,EAAkB,CAAiB,EAC7E,IAAK,EACE,OACR,CAAA,EAEH,MAAO,CACT,CAAC,EACA,GACC,EAAA,cAAA,EAAA,SAAA,KACE,EAAA,cAAC,QAAD,CACY,WACV,KAAM,GAAG,EAAK,OACd,KAAK,SACL,MAAO,EAAM,OAAO,MAAQ,EAAM,MAAM,MAAM,SAAS,EAAI,EAC5D,CAAA,EACD,EAAA,cAAC,QAAD,CACY,WACV,KAAM,GAAG,EAAK,KACd,KAAK,SACL,MAAO,EAAM,OAAO,IAAM,EAAM,MAAM,IAAI,SAAS,EAAI,EACxD,CAAA,CACD,CAEJ,EAEJ,OACA,IAAK,CAAE,SAAU,GAAY,KAAM,GAAQ,MAAO,EAAQ,EAC1D,QAAS,EACT,kBACA,QACA,MAAO,EACP,eACF,CAAC,CACqB,CAE5B,CACF,EAEA,EAAgB,YAAc"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"dialogTransition-i9vw0i2Z.js","names":[],"sources":["../../src/utils/dialogTransition.ts"],"sourcesContent":["// Shared transition timing for native <dialog>-based components (Modal, Drawer). Body-scroll\n// locking is handled by react-aria's usePreventScroll directly in each component.\n\nexport const getTransitionDuration = (element: HTMLElement) => {\n const { transitionDuration, transitionDelay } = window.getComputedStyle(element)\n const duration = Number.parseFloat(transitionDuration) || 0\n const delay = Number.parseFloat(transitionDelay) || 0\n if (!duration && !delay) return 0\n return (duration + delay) * 1000\n}\n\nexport const executeAfterTransition = (\n element: HTMLElement,\n callback: () => void,\n animated: boolean\n) => {\n if (!animated) {\n callback()\n return () => undefined\n }\n\n let called = false\n const done = () => {\n if (called) return\n called = true\n element.removeEventListener('transitionend', handleEnd)\n clearTimeout(timer)\n callback()\n }\n const handleEnd = (event: Event) => {\n if (event.target === element) done()\n }\n element.addEventListener('transitionend', handleEnd)\n const timer = setTimeout(done, getTransitionDuration(element) + 50)\n return () => {\n element.removeEventListener('transitionend', handleEnd)\n clearTimeout(timer)\n }\n}\n"],"mappings":"AAGA,MAAa,EAAyB,GAAyB,CAC7D,GAAM,CAAE,qBAAoB,mBAAoB,OAAO,iBAAiB,CAAO,EACzE,EAAW,OAAO,WAAW,CAAkB,GAAK,EACpD,EAAQ,OAAO,WAAW,CAAe,GAAK,EAEpD,MADI,CAAC,GAAY,CAAC,EAAc,GACxB,EAAW,GAAS,GAC9B,EAEa,GACX,EACA,EACA,IACG,CACH,GAAI,CAAC,EAEH,OADA,EAAS,MACI,IAAA,GAGf,IAAI,EAAS,GACP,MAAa,CACb,IACJ,EAAS,GACT,EAAQ,oBAAoB,gBAAiB,CAAS,EACtD,aAAa,CAAK,EAClB,EAAS,EACX,EACM,EAAa,GAAiB,CAC9B,EAAM,SAAW,GAAS,EAAK,CACrC,EACA,EAAQ,iBAAiB,gBAAiB,CAAS,EACnD,IAAM,EAAQ,WAAW,EAAM,EAAsB,CAAO,EAAI,EAAE,EAClE,UAAa,CACX,EAAQ,oBAAoB,gBAAiB,CAAS,EACtD,aAAa,CAAK,CACpB,CACF"}
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import"./focus-ring-SR_LwaN7.js";import{m as e,v as t}from"./slot-CNhFZdHF.js";import{t as n}from"./polymorphic-BhGNZQja.js";import r,{Children as i,useId as a}from"react";import o from"classnames";import{useSeparator as s}from"react-aria";function c({children:n,className:c,component:l,labelPlacement:u=`center`,orientation:d=`horizontal`,...f},p){let m=i.toArray(n).some(e=>e!==``),h=l??(d===`vertical`||m?`div`:`hr`),g=e(h),_=a();t(g===`hr`&&m,"Divider: an `<hr>` cannot hold a label, so the label is not rendered. Leave `component` unset, or render another element.");let v=m&&g!==`hr`,y=f,b=y[`aria-label`]!=null||y[`aria-labelledby`]!=null,{separatorProps:x}=s({elementType:g,orientation:d});return g===`hr`&&d===`vertical`&&(x[`aria-orientation`]=`vertical`),r.createElement(h,{className:o(`divider`,d===`vertical`&&`divider-vertical`,v&&`divider-labelled`,v&&u!==`center`&&`divider-${u}`,c),...x,"aria-labelledby":v&&!b?_:void 0,...f,ref:p},v?r.createElement(`span`,{className:`divider-label`,id:_},n):void 0)}const l=n(c,`Divider`);export{l as t};
|
|
2
|
-
//# sourceMappingURL=divider-CjbF4OfA.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"divider-CjbF4OfA.js","names":[],"sources":["../../src/components/divider/Divider.tsx"],"sourcesContent":["import React, {\n Children,\n ElementType,\n ForwardRefRenderFunction,\n ReactElement,\n ReactNode,\n useId\n} from 'react'\nimport classNames from 'classnames'\nimport { useSeparator } from 'react-aria'\n\nimport './Divider.scss'\nimport { devWarning } from '../../utils/devWarning'\nimport { resolveElementTag } from '../../utils/elementKind'\nimport {\n createPolymorphicComponent,\n PolymorphicComponentProps,\n PolymorphicRef,\n PolymorphicRefWithFallback\n} from '../../utils/polymorphic'\n\ntype DividerOwnProps<C extends ElementType> = {\n /**\n * A label shown in the line, such as \"or\" between two ways to sign in. It names the separator\n * for screen readers. Not possible on an `<hr>`, which can't hold content.\n */\n children?: ReactNode\n /**\n * A string of all className you want applied to the component.\n */\n className?: string\n /**\n * Component used for the root node. Either a string to use an HTML element or a component.\n * Defaults to `hr`, or `div` for a vertical divider or one with a label.\n */\n component?: C\n /**\n * Where the label sits along the line. `start` and `end` draw the line on one side only.\n *\n * @default 'center'\n */\n labelPlacement?: 'start' | 'center' | 'end'\n /**\n * The direction of the line. A vertical divider stretches to the height of its flex row.\n *\n * @default 'horizontal'\n */\n orientation?: 'horizontal' | 'vertical'\n}\n\nexport type DividerProps<C extends ElementType = 'hr'> = PolymorphicComponentProps<\n C,\n DividerOwnProps<C>\n>\n\ntype DividerComponent = (<C extends ElementType = 'hr'>(\n // A vertical or labelled divider renders a `<div>` while `C` stays `'hr'`.\n props: DividerProps<C> & { ref?: PolymorphicRefWithFallback<C, HTMLDivElement> }\n) => ReactElement | null) & { displayName?: string }\n\nfunction DividerRender<C extends ElementType = 'hr'>(\n {\n children,\n className,\n component,\n labelPlacement = 'center',\n orientation = 'horizontal',\n ...rest\n }: DividerProps<C>,\n ref: PolymorphicRef<C>\n) {\n // What renders nothing (`null`, a boolean, `''`, an empty array) is no label.\n const hasLabel = Children.toArray(children).some((child) => child !== '')\n const Component = component ?? (orientation === 'vertical' || hasLabel ? 'div' : 'hr')\n const rootTag = resolveElementTag(Component)\n const labelId = useId()\n\n // An `<hr>` is a void element: React throws on its children.\n devWarning(\n rootTag === 'hr' && hasLabel,\n 'Divider: an `<hr>` cannot hold a label, so the label is not rendered. Leave `component` ' +\n 'unset, or render another element.'\n )\n const label = hasLabel && rootTag !== 'hr'\n const labelling = rest as { 'aria-label'?: string; 'aria-labelledby'?: string }\n const named = labelling['aria-label'] != null || labelling['aria-labelledby'] != null\n\n const { separatorProps } = useSeparator({ elementType: rootTag, orientation })\n // react-aria leaves an `<hr>`'s orientation to its implicit role, which is horizontal.\n if (rootTag === 'hr' && orientation === 'vertical')\n separatorProps['aria-orientation'] = 'vertical'\n\n return (\n <Component\n className={classNames(\n 'divider',\n orientation === 'vertical' && 'divider-vertical',\n label && 'divider-labelled',\n label && labelPlacement !== 'center' && `divider-${labelPlacement}`,\n className\n )}\n {...separatorProps}\n aria-labelledby={label && !named ? labelId : undefined}\n {...rest}\n ref={ref}\n >\n {label ? (\n <span className=\"divider-label\" id={labelId}>\n {children}\n </span>\n ) : undefined}\n </Component>\n )\n}\n\nexport const Divider = createPolymorphicComponent<DividerComponent>(\n DividerRender as ForwardRefRenderFunction<Element, DividerProps<ElementType>>,\n 'Divider'\n)\n"],"mappings":"gPA4DA,SAAS,EACP,CACE,WACA,YACA,YACA,iBAAiB,SACjB,cAAc,aACd,GAAG,GAEL,EACA,CAEA,IAAM,EAAW,EAAS,QAAQ,CAAQ,CAAC,CAAC,KAAM,GAAU,IAAU,EAAE,EAClE,EAAY,IAAc,IAAgB,YAAc,EAAW,MAAQ,MAC3E,EAAU,EAAkB,CAAS,EACrC,EAAU,EAAM,EAGtB,EACE,IAAY,MAAQ,EACpB,2HAEF,EACA,IAAM,EAAQ,GAAY,IAAY,KAChC,EAAY,EACZ,EAAQ,EAAU,eAAiB,MAAQ,EAAU,oBAAsB,KAE3E,CAAE,kBAAmB,EAAa,CAAE,YAAa,EAAS,aAAY,CAAC,EAK7E,OAHI,IAAY,MAAQ,IAAgB,aACtC,EAAe,oBAAsB,YAGrC,EAAA,cAAC,EAAD,CACE,UAAW,EACT,UACA,IAAgB,YAAc,mBAC9B,GAAS,mBACT,GAAS,IAAmB,UAAY,WAAW,IACnD,CACF,EACA,GAAI,EACJ,kBAAiB,GAAS,CAAC,EAAQ,EAAU,IAAA,GAC7C,GAAI,EACC,KAOI,EALR,EACC,EAAA,cAAC,OAAD,CAAM,UAAU,gBAAgB,GAAI,CAE9B,EADH,CACG,EACJ,IAAA,EACK,CAEf,CAEA,MAAa,EAAU,EACrB,EACA,SACF"}
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import"./focus-ring-SR_LwaN7.js";import{t as e}from"./polymorphic-BhGNZQja.js";import{t}from"./useDialogElement-CgOnJAzu.js";import{t as n}from"./CloseButton-DPgQztE0.js";import r,{createContext as i,forwardRef as a,useContext as o,useEffect as s,useId as c,useRef as l}from"react";import u from"classnames";const d=i({close:()=>{}}),f=new Set,p=a(({children:e,backdrop:n=!0,className:i,defaultVisible:a,fitContent:o,fullscreen:p,instant:m,keyboard:h=!0,onClick:g,onClose:_,onClosePrevented:v,onHidden:y,onShow:b,onShown:x,onVisibleChange:S,placement:C,responsive:w,scroll:T=!1,sheet:E,translucent:D,open:O,visible:k,...A},j)=>{let{close:M,dialogRef:N,forkedRef:P,handleBackdropClick:F,handleCancel:I,hiding:L,staticBounce:R}=t({backdrop:n,defaultVisible:a,instant:m,isModal:!!n||!T,keyboard:h,onBeforeShow:e=>{for(let t of f)t.dialog!==e&&t.close()},onClick:g,onClose:_,onClosePrevented:v,onHidden:y,onShow:b,onShown:x,onVisibleChange:S,open:O,ref:j,visible:k}),z=c(),B=l(M);B.current=M,s(()=>{let e=N.current;if(!e)return;let t={dialog:e,close:()=>B.current()};return f.add(t),()=>{f.delete(t)}},[N]);let V=u(w?`max-${w}:drawer`:`drawer`,`drawer-${C}`,{fullscreen:p,sheet:E,translucent:D,instant:m,"drawer-fit-content":o,nonmodal:!(n||!T),static:R,hiding:L},i);return r.createElement(d.Provider,{value:{close:M,titleId:z}},r.createElement(`dialog`,{"aria-labelledby":z,...A,open:O,className:V,onCancel:I,onClick:F,ref:P},e))});p.displayName=`Drawer`;const m=()=>o(d);function h({children:e,className:t,component:n,...i},a){let o=n??`div`,s=u(`drawer-body`,t);return r.createElement(o,{className:s,...i,ref:a},e)}const g=e(h,`DrawerBody`);function _({children:e,className:t,component:n,stacked:i,...a},o){let s=n??`div`,c=u(`drawer-footer`,{stacked:i},t);return r.createElement(s,{className:c,...a,ref:o},e)}const v=e(_,`DrawerFooter`);function y({children:e,className:t,closeButton:i=!0,closeLabel:a,component:o,...s},c){let l=o??`div`,{close:d}=m(),f=u(`drawer-header`,t);return r.createElement(l,{className:f,...s,ref:c},e,i&&r.createElement(n,{label:a,onClick:d}))}const b=e(y,`DrawerHeader`);function x({children:e,component:t,className:n,id:i,...a},o){let{titleId:s}=m(),c=t??`h2`,l=u(`drawer-title`,n);return r.createElement(c,{className:l,id:i??s,...a,ref:o},e)}const S=e(x,`DrawerTitle`);export{m as a,g as i,b as n,p as o,v as r,S as t};
|
|
2
|
-
//# sourceMappingURL=drawer-C7Tz4XU_.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"drawer-C7Tz4XU_.js","names":[],"sources":["../../src/components/drawer/Drawer.tsx","../../src/hooks/useDrawer.ts","../../src/components/drawer/DrawerBody.tsx","../../src/components/drawer/DrawerFooter.tsx","../../src/components/drawer/DrawerHeader.tsx","../../src/components/drawer/DrawerTitle.tsx"],"sourcesContent":["import React, {\n createContext,\n DialogHTMLAttributes,\n forwardRef,\n useEffect,\n useId,\n useRef\n} from 'react'\nimport classNames from 'classnames'\n\nimport { useDialogElement } from '../../hooks'\n\nexport interface DrawerProps extends Omit<\n DialogHTMLAttributes<HTMLDialogElement>,\n 'onCancel' | 'onClose'\n> {\n /**\n * Show a backdrop while the drawer is open. `'static'` blocks closing on backdrop click\n * (the drawer nudges instead).\n */\n backdrop?: boolean | 'static'\n /**\n * A string of all className you want applied to the base component.\n */\n className?: string\n /**\n * Whether the drawer is open when it first renders. Such a drawer is uncontrolled: it closes\n * itself on a close request. Use `visible` to open and close it from outside.\n */\n defaultVisible?: boolean\n /**\n * Size the height to the drawer's content instead of `--drawer-height`. Meaningful for\n * `placement=\"bottom\"`.\n */\n fitContent?: boolean\n /**\n * Expand the panel to fill the viewport, animating in from the direction of `placement`.\n */\n fullscreen?: boolean\n /**\n * Disable the open/close transition entirely.\n */\n instant?: boolean\n /**\n * Closes the drawer when the escape key is pressed.\n */\n keyboard?: boolean\n /**\n * Renders the drawer open from its first paint, server HTML included, as a non-modal dialog: a\n * static preview. It stays open until a close request. Use `visible` or `defaultVisible` to\n * open it as a modal dialog.\n */\n open?: boolean\n /**\n * Callback fired when the drawer requests to be closed (escape, backdrop click, close button,\n * or another drawer opening).\n */\n onClose?: () => void\n /**\n * Callback fired when a close attempt is blocked (static backdrop click, or escape with `keyboard=false`).\n */\n onClosePrevented?: () => void\n /**\n * Callback fired after the exit transition completes and the drawer is fully hidden.\n */\n onHidden?: () => void\n /**\n * Callback fired when the drawer starts to open.\n */\n onShow?: () => void\n /**\n * Callback fired after the entry transition completes and the drawer is fully visible.\n */\n onShown?: () => void\n /**\n * Callback fired with `false` when the drawer requests to be closed, at the same moments as\n * `onClose`. It makes `visible` and `onVisibleChange` a pair that takes a state setter.\n */\n onVisibleChange?: (visible: boolean) => void\n /**\n * Which viewport edge the panel slides in from. Always required — there is no default\n * off-screen transform without one.\n */\n placement: 'start' | 'end' | 'top' | 'bottom'\n /**\n * Renders as a drawer only below this breakpoint — inline as a flex container above it.\n */\n responsive?: 'sm' | 'md' | 'lg' | 'xl' | '2xl'\n /**\n * Allow the page behind the drawer to scroll while it's open.\n */\n scroll?: boolean\n /**\n * Remove the inset gap, border radius, and border so the panel sits flush against the\n * viewport edge.\n */\n sheet?: boolean\n /**\n * Apply a frosted-glass background to the panel.\n */\n translucent?: boolean\n /**\n * Whether the drawer is open. The drawer is then controlled: a close request only fires\n * `onClose` and `onVisibleChange`, and the drawer closes when this becomes `false`.\n */\n visible?: boolean\n}\n\nexport interface DrawerContextProps {\n /**\n * Requests the drawer be closed — fires `onClose`. Wire this to any element's `onClick`; see\n * `useDrawer`.\n */\n close: () => void\n /**\n * Id generated by `Drawer` and applied automatically by `DrawerTitle` to itself, so the\n * dialog's `aria-labelledby` resolves to it without any manual wiring.\n */\n titleId?: string\n}\n\nexport const DrawerContext = createContext<DrawerContextProps>({ close: () => {} })\n\n// Currently-open drawers, so opening one can auto-close any other open drawer\n// (\"When a second drawer opens while one is already open, the first closes automatically\").\nconst openDrawers = new Set<{ dialog: HTMLDialogElement; close: () => void }>()\n\nexport const Drawer = forwardRef<HTMLDialogElement, DrawerProps>(\n (\n {\n children,\n backdrop = true,\n className,\n defaultVisible,\n fitContent,\n fullscreen,\n instant,\n keyboard = true,\n onClick,\n onClose,\n onClosePrevented,\n onHidden,\n onShow,\n onShown,\n onVisibleChange,\n placement,\n responsive,\n scroll = false,\n sheet,\n translucent,\n open,\n visible,\n ...rest\n },\n ref\n ) => {\n const { close, dialogRef, forkedRef, handleBackdropClick, handleCancel, hiding, staticBounce } =\n useDialogElement({\n backdrop,\n defaultVisible,\n instant,\n isModal: Boolean(backdrop) || !scroll,\n keyboard,\n onBeforeShow: (dialog) => {\n for (const entry of openDrawers) {\n if (entry.dialog !== dialog) entry.close()\n }\n },\n onClick,\n onClose,\n onClosePrevented,\n onHidden,\n onShow,\n onShown,\n onVisibleChange,\n open,\n ref,\n visible\n })\n\n const titleId = useId()\n\n const closeRef = useRef(close)\n closeRef.current = close\n\n // Register in the cross-instance registry so other drawers can auto-close this one.\n useEffect(() => {\n const dialog = dialogRef.current\n if (!dialog) return undefined\n const entry = { dialog, close: () => closeRef.current() }\n openDrawers.add(entry)\n return () => {\n openDrawers.delete(entry)\n }\n }, [dialogRef])\n\n // `hiding` has to stay on the class list for the whole exit transition: the native `open`\n // attribute — and with it, the `[class*=\"drawer\"]:not([open], .hiding)` escape hatch\n // chassis-css's navbar styles use to suppress the drawer-flash transition when the navbar\n // itself crosses its `expand` breakpoint — would otherwise get stripped the instant `open`\n // is removed, which would also strip the *intentional* close transition this class exists\n // to protect.\n const _className = classNames(\n responsive ? `max-${responsive}:drawer` : 'drawer',\n `drawer-${placement}`,\n {\n fullscreen,\n sheet,\n translucent,\n instant,\n 'drawer-fit-content': fitContent,\n nonmodal: !(Boolean(backdrop) || !scroll),\n static: staticBounce,\n hiding\n },\n className\n )\n\n return (\n <DrawerContext.Provider value={{ close, titleId }}>\n <dialog\n aria-labelledby={titleId}\n {...rest}\n open={open}\n className={_className}\n onCancel={handleCancel}\n onClick={handleBackdropClick}\n ref={forkedRef}\n >\n {children}\n </dialog>\n </DrawerContext.Provider>\n )\n }\n)\n\nDrawer.displayName = 'Drawer'\n","import { useContext } from 'react'\nimport { DrawerContext, DrawerContextProps } from '../components/drawer/Drawer'\n\nexport type UseDrawerResult = DrawerContextProps\n\n// Reach the enclosing `Drawer`'s close handler from anywhere in its composed markup — e.g. to\n// close it from a plain `Button` placed in a `DrawerFooter`. Only meaningful inside a `Drawer`;\n// outside one it returns a no-op `close`.\nexport const useDrawer = (): UseDrawerResult => useContext(DrawerContext)\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 DrawerBodyOwnProps<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 DrawerBodyProps<C extends ElementType = 'div'> = PolymorphicComponentProps<\n C,\n DrawerBodyOwnProps<C>\n>\n\ntype DrawerBodyComponent = (<C extends ElementType = 'div'>(\n props: DrawerBodyProps<C> & { ref?: PolymorphicRef<C> }\n) => ReactElement | null) & { displayName?: string }\n\nfunction DrawerBodyRender<C extends ElementType = 'div'>(\n { children, className, component, ...rest }: DrawerBodyProps<C>,\n ref: PolymorphicRef<C>\n) {\n const Component = component ?? 'div'\n const _className = classNames('drawer-body', className)\n\n return (\n <Component className={_className} {...rest} ref={ref}>\n {children}\n </Component>\n )\n}\n\nexport const DrawerBody = createPolymorphicComponent<DrawerBodyComponent>(\n DrawerBodyRender as ForwardRefRenderFunction<Element, DrawerBodyProps<ElementType>>,\n 'DrawerBody'\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 DrawerFooterOwnProps<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 * Stack the footer actions as full-width columns instead of a right-aligned row.\n */\n stacked?: boolean\n}\n\nexport type DrawerFooterProps<C extends ElementType = 'div'> = PolymorphicComponentProps<\n C,\n DrawerFooterOwnProps<C>\n>\n\ntype DrawerFooterComponent = (<C extends ElementType = 'div'>(\n props: DrawerFooterProps<C> & { ref?: PolymorphicRef<C> }\n) => ReactElement | null) & { displayName?: string }\n\nfunction DrawerFooterRender<C extends ElementType = 'div'>(\n { children, className, component, stacked, ...rest }: DrawerFooterProps<C>,\n ref: PolymorphicRef<C>\n) {\n const Component = component ?? 'div'\n const _className = classNames('drawer-footer', { stacked }, className)\n\n return (\n <Component className={_className} {...rest} ref={ref}>\n {children}\n </Component>\n )\n}\n\nexport const DrawerFooter = createPolymorphicComponent<DrawerFooterComponent>(\n DrawerFooterRender as ForwardRefRenderFunction<Element, DrawerFooterProps<ElementType>>,\n 'DrawerFooter'\n)\n","import React, { ElementType, ForwardRefRenderFunction, ReactElement } from 'react'\nimport classNames from 'classnames'\n\nimport { useDrawer } from '../../hooks'\nimport {\n createPolymorphicComponent,\n PolymorphicComponentProps,\n PolymorphicRef\n} from '../../utils/polymorphic'\nimport { CloseButton } from '../close-button/CloseButton'\n\ntype DrawerHeaderOwnProps<C extends ElementType> = {\n /**\n * A string of all className you want applied to the base component.\n */\n className?: string\n /**\n * Add a close button component 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\nexport type DrawerHeaderProps<C extends ElementType = 'div'> = PolymorphicComponentProps<\n C,\n DrawerHeaderOwnProps<C>\n>\n\ntype DrawerHeaderComponent = (<C extends ElementType = 'div'>(\n props: DrawerHeaderProps<C> & { ref?: PolymorphicRef<C> }\n) => ReactElement | null) & { displayName?: string }\n\nfunction DrawerHeaderRender<C extends ElementType = 'div'>(\n { children, className, closeButton = true, closeLabel, component, ...rest }: DrawerHeaderProps<C>,\n ref: PolymorphicRef<C>\n) {\n const Component = component ?? 'div'\n const { close } = useDrawer()\n const _className = classNames('drawer-header', className)\n\n return (\n <Component className={_className} {...rest} ref={ref}>\n {children}\n {closeButton && <CloseButton label={closeLabel} onClick={close} />}\n </Component>\n )\n}\n\nexport const DrawerHeader = createPolymorphicComponent<DrawerHeaderComponent>(\n DrawerHeaderRender as ForwardRefRenderFunction<Element, DrawerHeaderProps<ElementType>>,\n 'DrawerHeader'\n)\n","import React, { ElementType, ForwardRefRenderFunction, ReactElement } from 'react'\nimport classNames from 'classnames'\n\nimport { useDrawer } from '../../hooks'\nimport {\n createPolymorphicComponent,\n PolymorphicComponentProps,\n PolymorphicRef\n} from '../../utils/polymorphic'\n\ntype DrawerTitleOwnProps<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 DrawerTitleProps<C extends ElementType = 'h2'> = PolymorphicComponentProps<\n C,\n DrawerTitleOwnProps<C>\n>\n\ntype DrawerTitleComponent = (<C extends ElementType = 'h2'>(\n props: DrawerTitleProps<C> & { ref?: PolymorphicRef<C> }\n) => ReactElement | null) & { displayName?: string }\n\nfunction DrawerTitleRender<C extends ElementType = 'h2'>(\n { children, component, className, id, ...rest }: DrawerTitleProps<C>,\n ref: PolymorphicRef<C>\n) {\n const { titleId } = useDrawer()\n const Component = component ?? 'h2'\n const _className = classNames('drawer-title', className)\n\n return (\n <Component className={_className} id={id ?? titleId} {...rest} ref={ref}>\n {children}\n </Component>\n )\n}\n\nexport const DrawerTitle = createPolymorphicComponent<DrawerTitleComponent>(\n DrawerTitleRender as ForwardRefRenderFunction<Element, DrawerTitleProps<ElementType>>,\n 'DrawerTitle'\n)\n"],"mappings":"oTAyHA,MAAa,EAAgB,EAAkC,CAAE,UAAa,CAAC,CAAE,CAAC,EAI5E,EAAc,IAAI,IAEX,EAAS,GAElB,CACE,WACA,WAAW,GACX,YACA,iBACA,aACA,aACA,UACA,WAAW,GACX,UACA,UACA,mBACA,WACA,SACA,UACA,kBACA,YACA,aACA,SAAS,GACT,QACA,cACA,OACA,UACA,GAAG,GAEL,IACG,CACH,GAAM,CAAE,QAAO,YAAW,YAAW,sBAAqB,eAAc,SAAQ,gBAC9E,EAAiB,CACf,WACA,iBACA,UACA,QAAS,EAAQ,GAAa,CAAC,EAC/B,WACA,aAAe,GAAW,CACxB,IAAK,IAAM,KAAS,E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,EADR,CACQ,CAEf,CAEA,MAAa,EAAe,EAC1B,EACA,cACF,ECVA,SAAS,EACP,CAAE,WAAU,YAAW,cAAc,GAAM,aAAY,YAAW,GAAG,GACrE,EACA,CACA,IAAM,EAAY,GAAa,MACzB,CAAE,SAAU,EAAU,EACtB,EAAa,EAAW,gBAAiB,CAAS,EAExD,OACE,EAAA,cAAC,EAAD,CAAW,UAAW,EAAY,GAAI,EAAW,KAGtC,EAFR,EACA,GAAe,EAAA,cAAC,EAAD,CAAa,MAAO,EAAY,QAAS,CAAQ,CAAA,CACxD,CAEf,CAEA,MAAa,EAAe,EAC1B,EACA,cACF,EC7BA,SAAS,EACP,CAAE,WAAU,YAAW,YAAW,KAAI,GAAG,GACzC,EACA,CACA,GAAM,CAAE,WAAY,EAAU,EACxB,EAAY,GAAa,KACzB,EAAa,EAAW,eAAgB,CAAS,EAEvD,OACE,EAAA,cAAC,EAAD,CAAW,UAAW,EAAY,GAAI,GAAM,EAAS,GAAI,EAAW,KAEzD,EADR,CACQ,CAEf,CAEA,MAAa,EAAc,EACzB,EACA,aACF"}
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import"./focus-ring-SR_LwaN7.js";import{t as e}from"./useFormField-BOqmBTC4.js";import{t}from"./renderFormField-Brkw1yA6.js";import{t as n}from"./validationClassName-gRGs4KBm.js";import r,{forwardRef as i}from"react";import a from"classnames";const o=i(({className:i,help:o,id:s,invalid:c,invalidFeedback:l,label:u,size:d,valid:f,validFeedback:p,...m},h)=>{let{describedBy:g,feedbackId:_,helpId:v,inputId:y}=e({ariaDescribedBy:m[`aria-describedby`],help:o,id:s,invalid:c,invalidFeedback:l,valid:f,validFeedback:p}),b=a(`form-input`,d,n(c,f),i);return t({children:r.createElement(`input`,{...m,"aria-describedby":g,"aria-invalid":c||void 0,className:b,id:y,ref:h,type:`file`}),help:o,ids:{feedback:_,help:v,input:y},invalid:c,invalidFeedback:l,label:u,valid:f,validFeedback:p})});o.displayName=`FileInput`;export{o as t};
|
|
2
|
-
//# sourceMappingURL=file-input-CDM6qrmV.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"file-input-CDM6qrmV.js","names":[],"sources":["../../src/components/file-input/FileInput.tsx"],"sourcesContent":["import React, { ChangeEventHandler, forwardRef, InputHTMLAttributes, ReactNode } from 'react'\nimport classNames from 'classnames'\n\nimport { useFormField } from '../../hooks'\nimport { validationClassName } from '../../utils/validationClassName'\nimport { renderFormField } from '../form-field/renderFormField'\n\nexport interface FileInputProps extends Omit<InputHTMLAttributes<HTMLInputElement>, 'size'> {\n /**\n * A string of all className you want applied to the component.\n */\n className?: string\n /**\n * Toggle the disabled state for the component.\n */\n disabled?: boolean\n /**\n * A description for the field, rendered below the input.\n */\n help?: ReactNode\n /**\n * Set component validation state to invalid.\n */\n invalid?: boolean\n /**\n * An error message for the field, rendered below the input when `invalid` is set.\n */\n invalidFeedback?: ReactNode\n /**\n * The field's caption, rendered as a `FormLabel` associated with this input.\n */\n label?: ReactNode\n /**\n * Allows selecting more than one file.\n */\n multiple?: boolean\n /**\n * Method called when the selected file(s) change.\n */\n onChange?: ChangeEventHandler<HTMLInputElement>\n /**\n * Size the component sm or lg.\n */\n size?: 'sm' | 'lg'\n /**\n * Set component validation state to valid.\n */\n valid?: boolean\n /**\n * A success message for the field, rendered below the input when `valid` is set.\n */\n validFeedback?: ReactNode\n}\n\nexport const FileInput = forwardRef<HTMLInputElement, FileInputProps>(\n (\n { className, help, id, invalid, invalidFeedback, label, size, valid, validFeedback, ...rest },\n ref\n ) => {\n const { describedBy, feedbackId, helpId, inputId } = useFormField({\n ariaDescribedBy: rest['aria-describedby'],\n help,\n id,\n invalid,\n invalidFeedback,\n valid,\n validFeedback\n })\n\n const _className = classNames(\n 'form-input',\n size,\n validationClassName(invalid, valid),\n className\n )\n\n return renderFormField({\n children: (\n <input\n {...rest}\n aria-describedby={describedBy}\n aria-invalid={invalid || undefined}\n className={_className}\n id={inputId}\n ref={ref}\n type=\"file\"\n />\n ),\n help,\n ids: { feedback: feedbackId, help: helpId, input: inputId },\n invalid,\n invalidFeedback,\n label,\n valid,\n validFeedback\n })\n }\n)\n\nFileInput.displayName = 'FileInput'\n"],"mappings":"mPAsDA,MAAa,EAAY,GAErB,CAAE,YAAW,OAAM,KAAI,UAAS,kBAAiB,QAAO,OAAM,QAAO,gBAAe,GAAG,GACvF,IACG,CACH,GAAM,CAAE,cAAa,aAAY,SAAQ,WAAY,EAAa,CAChE,gBAAiB,EAAK,oBACtB,OACA,KACA,UACA,kBACA,QACA,eACF,CAAC,EAEK,EAAa,EACjB,aACA,EACA,EAAoB,EAAS,CAAK,EAClC,CACF,EAEA,OAAO,EAAgB,CACrB,SACE,EAAA,cAAC,QAAD,CACE,GAAI,EACJ,mBAAkB,EAClB,eAAc,GAAW,IAAA,GACzB,UAAW,EACX,GAAI,EACC,MACL,KAAK,MACN,CAAA,EAEH,OACA,IAAK,CAAE,SAAU,EAAY,KAAM,EAAQ,MAAO,CAAQ,EAC1D,UACA,kBACA,QACA,QACA,eACF,CAAC,CACH,CACF,EAEA,EAAU,YAAc"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"flex-B52oLCCC.js","names":[],"sources":["../../src/components/flex/Flex.tsx"],"sourcesContent":["import React, { ElementType, ForwardRefRenderFunction, ReactElement } from 'react'\nimport classNames from 'classnames'\n\nimport {\n createPolymorphicComponent,\n PolymorphicComponentProps,\n PolymorphicRef\n} from '../../utils/polymorphic'\nimport { responsiveClassNames, responsiveProp } from '../../utils/breakpoints'\nimport { spacingClassName } from '../../utils/spacingClassName'\nimport { Responsive, Spacing } from '../../types'\n\ntype FlexOwnProps<C extends ElementType> = {\n /**\n * A string of all className you want applied to the 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 * Renders an inline flex container (`.d-inline-flex`) instead of a block-level one (`.d-flex`,\n * the default).\n */\n inline?: boolean\n /**\n * Sets `flex-direction`. Omit for the browser default (`row`). An object sets it per\n * breakpoint, `base` being the narrowest width: `{ base: 'column', md: 'row' }`. The\n * breakpoints are widths of the viewport, so unlike `Stack`'s `direction` they need no\n * `.contains-inline` ancestor.\n */\n direction?: Responsive<'row' | 'column' | 'row-reverse' | 'column-reverse'>\n /**\n * Sets `flex-wrap`. Omit for the browser default (`nowrap`). Takes an object per breakpoint,\n * as `direction` does.\n */\n wrap?: Responsive<'wrap' | 'nowrap' | 'wrap-reverse'>\n /**\n * Sets `justify-content`, aligning items along the main axis. Takes an object per breakpoint,\n * as `direction` does.\n */\n justify?: Responsive<'start' | 'end' | 'center' | 'between' | 'around' | 'evenly'>\n /**\n * Sets `align-items`, aligning items along the cross axis. Takes an object per breakpoint, as\n * `direction` does.\n */\n align?: Responsive<'start' | 'end' | 'center' | 'baseline' | 'stretch'>\n /**\n * Sets `align-content`, distributing wrapped lines along the cross axis. Has no effect on\n * single-line (non-wrapping) containers. Takes an object per breakpoint, as `direction` does.\n */\n alignContent?: Responsive<'start' | 'end' | 'center' | 'between' | 'around' | 'stretch'>\n /**\n * Spacing between children on both axes, mapped to the `gap-*` utility classes. Overridden per\n * axis by `rowGap`/`columnGap` where set. Takes an object per breakpoint, as `direction` does.\n *\n * @type { Responsive<Spacing | 0> }\n */\n gap?: Responsive<Spacing | 0>\n /**\n * Spacing between rows (the cross axis when wrapped), mapped to the `row-gap-*` utility\n * classes. Independent of `gap`/`columnGap`. Takes an object per breakpoint, as `direction`\n * does.\n *\n * @type { Responsive<Spacing | 0> }\n */\n rowGap?: Responsive<Spacing | 0>\n /**\n * Spacing between columns (the main axis), mapped to the `column-gap-*` utility classes.\n * Independent of `gap`/`rowGap`. Takes an object per breakpoint, as `direction` does.\n *\n * @type { Responsive<Spacing | 0> }\n */\n columnGap?: Responsive<Spacing | 0>\n}\n\nexport type FlexProps<C extends ElementType = 'div'> = PolymorphicComponentProps<C, FlexOwnProps<C>>\n\ntype FlexComponent = (<C extends ElementType = 'div'>(\n props: FlexProps<C> & { ref?: PolymorphicRef<C> }\n) => ReactElement | null) & { displayName?: string }\n\nfunction FlexRender<C extends ElementType = 'div'>(\n {\n children,\n className,\n component,\n inline,\n direction,\n wrap,\n justify,\n align,\n alignContent,\n gap,\n rowGap,\n columnGap,\n ...rest\n }: FlexProps<C>,\n ref: PolymorphicRef<C>\n) {\n const Component = component ?? 'div'\n const _className = classNames(\n inline ? 'd-inline-flex' : 'd-flex',\n responsiveClassNames([\n responsiveProp(direction, (value, prefix) => `${prefix}flex-${value}`),\n responsiveProp(wrap, (value, prefix) => `${prefix}flex-${value}`),\n responsiveProp(justify, (value, prefix) => `${prefix}justify-content-${value}`),\n responsiveProp(align, (value, prefix) => `${prefix}align-items-${value}`),\n responsiveProp(alignContent, (value, prefix) => `${prefix}align-content-${value}`),\n responsiveProp(gap, (value, prefix) => spacingClassName('gap', value, prefix)),\n responsiveProp(rowGap, (value, prefix) => spacingClassName('row-gap', value, prefix)),\n responsiveProp(columnGap, (value, prefix) => spacingClassName('column-gap', value, prefix))\n ]),\n className\n )\n\n return (\n <Component className={_className} {...rest} ref={ref}>\n {children}\n </Component>\n )\n}\n\nexport const Flex = createPolymorphicComponent<FlexComponent>(\n FlexRender as ForwardRefRenderFunction<Element, FlexProps<ElementType>>,\n 'Flex'\n)\n"],"mappings":"sOAmFA,SAAS,EACP,CACE,WACA,YACA,YACA,SACA,YACA,OACA,UACA,QACA,eACA,MACA,SACA,YACA,GAAG,GAEL,EACA,CACA,IAAM,EAAY,GAAa,MACzB,EAAa,EACjB,EAAS,gBAAkB,SAC3B,EAAqB,CACnB,EAAe,GAAY,EAAO,IAAW,GAAG,EAAO,OAAO,GAAO,EACrE,EAAe,GAAO,EAAO,IAAW,GAAG,EAAO,OAAO,GAAO,EAChE,EAAe,GAAU,EAAO,IAAW,GAAG,EAAO,kBAAkB,GAAO,EAC9E,EAAe,GAAQ,EAAO,IAAW,GAAG,EAAO,cAAc,GAAO,EACxE,EAAe,GAAe,EAAO,IAAW,GAAG,EAAO,gBAAgB,GAAO,EACjF,EAAe,GAAM,EAAO,IAAW,EAAiB,MAAO,EAAO,CAAM,CAAC,EAC7E,EAAe,GAAS,EAAO,IAAW,EAAiB,UAAW,EAAO,CAAM,CAAC,EACpF,EAAe,GAAY,EAAO,IAAW,EAAiB,aAAc,EAAO,CAAM,CAAC,CAC5F,CAAC,EACD,CACF,EAEA,OACE,EAAA,cAAC,EAAD,CAAW,UAAW,EAAY,GAAI,EAAW,KAEtC,EADR,CACQ,CAEf,CAEA,MAAa,EAAO,EAClB,EACA,MACF"}
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import"./focus-ring-SR_LwaN7.js";import{v as e}from"./slot-CNhFZdHF.js";import{t}from"./FormLabel-CYcQiFUI.js";import{t as n}from"./renderFormField-Brkw1yA6.js";import r,{forwardRef as i}from"react";import a from"classnames";const o=i(({children:i,className:o,help:s,ids:c,invalid:l,invalidFeedback:u,label:d,valid:f,validFeedback:p,...m},h)=>(e(!c?.input&&!c?.label,"FloatingInput: `ids.input`/`ids.label` are not set — the rendered label won't be associated with your control (no `htmlFor`, no `aria-labelledby` target). Pass `ids={{ input: yourControlId }}` (or `ids.label` for a group with no single input) so the label has something to point at."),n({children:r.createElement(`div`,{className:a(`form-floating`,o),...m,ref:h},r.createElement(t,{htmlFor:c?.input,id:c?.label},d),i),help:s,ids:{feedback:c?.feedback,help:c?.help},invalid:l,invalidFeedback:u,valid:f,validFeedback:p})));o.displayName=`FloatingInput`;export{o as t};
|
|
2
|
-
//# sourceMappingURL=floating-input-DmSZZc27.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"floating-input-DmSZZc27.js","names":[],"sources":["../../src/components/floating-input/FloatingInput.tsx"],"sourcesContent":["import React, { forwardRef, HTMLAttributes, ReactNode } from 'react'\nimport classNames from 'classnames'\n\nimport { FormLabel } from '../form/FormLabel'\nimport { FormFieldIds, renderFormField } from '../form-field/renderFormField'\nimport { devWarning } from '../../utils/devWarning'\n\nexport interface FloatingInputProps extends Omit<HTMLAttributes<HTMLDivElement>, 'children'> {\n /**\n * The form control (e.g. a `TextInput`, `Select`, or `Textarea`) the floating label attaches\n * to. Chassis-css's floating-label CSS relies on a `label:has(~ .form-input)` selector, so this\n * must render an element carrying the `form-input` class as a direct child.\n */\n children: ReactNode\n /**\n * A string of all className you want applied to the `.form-floating` element.\n */\n className?: string\n /**\n * A description for the field, rendered below the control. Setting this (or `invalidFeedback`/\n * `validFeedback`) wraps the floating input in a `.form-field`.\n */\n help?: ReactNode\n /**\n * The DOM ids of the wrapped control, used to associate the label (`htmlFor`) and point your\n * control's own `aria-describedby` at the rendered help/feedback text.\n */\n ids?: FormFieldIds\n /**\n * Set field validation state to invalid.\n */\n invalid?: boolean\n /**\n * An error message for the field, rendered below the control when `invalid` is set.\n */\n invalidFeedback?: ReactNode\n /**\n * The field's caption, rendered as a floating `FormLabel` associated with `ids.input`.\n */\n label: ReactNode\n /**\n * Set field validation state to valid.\n */\n valid?: boolean\n /**\n * A success message for the field, rendered below the control when `valid` is set.\n */\n validFeedback?: ReactNode\n}\n\nexport const FloatingInput = forwardRef<HTMLDivElement, FloatingInputProps>(\n (\n {\n children,\n className,\n help,\n ids,\n invalid,\n invalidFeedback,\n label,\n valid,\n validFeedback,\n ...rest\n },\n ref\n ) => {\n devWarning(\n !ids?.input && !ids?.label,\n 'FloatingInput: `ids.input`/`ids.label` are not set — the rendered label ' +\n \"won't be associated with your control (no `htmlFor`, no `aria-labelledby` target). \" +\n 'Pass `ids={{ input: yourControlId }}` (or `ids.label` for a group with no single ' +\n 'input) so the label has something to point at.'\n )\n\n return renderFormField({\n children: (\n <div className={classNames('form-floating', className)} {...rest} ref={ref}>\n <FormLabel htmlFor={ids?.input} id={ids?.label}>\n {label}\n </FormLabel>\n {children}\n </div>\n ),\n help,\n ids: { feedback: ids?.feedback, help: ids?.help },\n invalid,\n invalidFeedback,\n valid,\n validFeedback\n })\n }\n)\n\nFloatingInput.displayName = 'FloatingInput'\n"],"mappings":"iOAkDA,MAAa,EAAgB,GAEzB,CACE,WACA,YACA,OACA,MACA,UACA,kBACA,QACA,QACA,gBACA,GAAG,GAEL,KAEA,EACE,CAAC,GAAK,OAAS,CAAC,GAAK,MACrB,4RAIF,EAEO,EAAgB,CACrB,SACE,EAAA,cAAC,MAAD,CAAK,UAAW,EAAW,gBAAiB,CAAS,EAAG,GAAI,EAAW,KAKlE,EAJH,EAAA,cAAC,EAAD,CAAW,QAAS,GAAK,MAAO,GAAI,GAAK,KAE9B,EADR,CACQ,EACV,CACE,EAEP,OACA,IAAK,CAAE,SAAU,GAAK,SAAU,KAAM,GAAK,IAAK,EAChD,UACA,kBACA,QACA,eACF,CAAC,EAEL,EAEA,EAAc,YAAc"}
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
const e=new WeakSet,t=[`outline`];function n(n,r=t){if(n.classList.contains(`form-input`)||e.has(n))return;e.add(n);let i=r.map(e=>[e,n.style[e]]);for(let[e]of i)n.style[e]=`none`;n.addEventListener(`blur`,()=>{for(let[e,t]of i)n.style[e]=t;e.delete(n)},{once:!0})}function r(e){let t=e.target;if(!(t instanceof Element))return;let r=t.closest(`a[href], button, input, select, textarea, [tabindex]`);r&&n(r)}let i=!1;function a(){i||typeof document>`u`||(i=!0,document.addEventListener(`pointerdown`,r,!0))}a();export{n as t};
|
|
2
|
-
//# sourceMappingURL=focus-ring-SR_LwaN7.js.map
|