@chassis-ui/react 0.1.3 → 0.3.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/LICENSE +1 -1
- package/README.md +56 -23
- package/dist/accordion.d.ts +2 -0
- package/dist/accordion.js +1 -0
- package/dist/alert.d.ts +2 -0
- package/dist/alert.js +1 -0
- package/dist/autocomplete.d.ts +2 -0
- package/dist/autocomplete.js +1 -0
- package/dist/avatar.d.ts +2 -0
- package/dist/avatar.js +1 -0
- package/dist/badge.d.ts +2 -0
- package/dist/badge.js +1 -0
- package/dist/breadcrumb.d.ts +2 -0
- package/dist/breadcrumb.js +1 -0
- package/dist/button-group.d.ts +2 -0
- package/dist/button-group.js +1 -0
- package/dist/button.d.ts +3 -0
- package/dist/button.js +1 -0
- package/dist/calendar.d.ts +3 -0
- package/dist/calendar.js +1 -0
- package/dist/card.d.ts +2 -0
- package/dist/card.js +1 -0
- package/dist/carousel.d.ts +2 -0
- package/dist/carousel.js +1 -0
- package/dist/checkbox.d.ts +3 -0
- package/dist/checkbox.js +1 -0
- package/dist/chip-input.d.ts +2 -0
- package/dist/chip-input.js +1 -0
- package/dist/chip.d.ts +2 -0
- package/dist/chip.js +1 -0
- package/dist/chunks/Button-BoymWE-L.js +2 -0
- package/dist/chunks/Button-BoymWE-L.js.map +1 -0
- package/dist/chunks/Button-Cptd4Yk7.d.ts +66 -0
- package/dist/chunks/Chip-DCaWaBqo.js +2 -0
- package/dist/chunks/Chip-DCaWaBqo.js.map +1 -0
- package/dist/chunks/CloseButton-DPgQztE0.js +2 -0
- package/dist/chunks/CloseButton-DPgQztE0.js.map +1 -0
- package/dist/chunks/ComboboxItem-C9TpoJOI.d.ts +55 -0
- package/dist/chunks/ComboboxListBox-Cm3L1ULl.js +2 -0
- package/dist/chunks/ComboboxListBox-Cm3L1ULl.js.map +1 -0
- package/dist/chunks/DateSegment-2agXAd0f.js +2 -0
- package/dist/chunks/DateSegment-2agXAd0f.js.map +1 -0
- package/dist/chunks/FormHelp-AE6_iSLJ.js +2 -0
- package/dist/chunks/FormHelp-AE6_iSLJ.js.map +1 -0
- package/dist/chunks/FormLabel-CYcQiFUI.js +2 -0
- package/dist/chunks/FormLabel-CYcQiFUI.js.map +1 -0
- package/dist/chunks/Icon-CioraWLF.d.ts +37 -0
- package/dist/chunks/Icon-DLB1f88W.js +2 -0
- package/dist/chunks/Icon-DLB1f88W.js.map +1 -0
- package/dist/chunks/Link-CZsWCnQb.js +2 -0
- package/dist/chunks/Link-CZsWCnQb.js.map +1 -0
- package/dist/chunks/Link-nrd0JWlO.d.ts +71 -0
- package/dist/chunks/Menu-CSBg2Zmc.js +2 -0
- package/dist/chunks/Menu-CSBg2Zmc.js.map +1 -0
- package/dist/chunks/Menu-QeYOzrUL.d.ts +95 -0
- package/{src/components/menu/MenuItemDef.ts → dist/chunks/MenuItemDef-D0VDtYIQ.d.ts} +25 -25
- package/dist/chunks/MenuToggle-BdQtF7FV.js +2 -0
- package/dist/chunks/MenuToggle-BdQtF7FV.js.map +1 -0
- package/dist/chunks/Portal-CgeR1WXV.js +2 -0
- package/dist/chunks/Portal-CgeR1WXV.js.map +1 -0
- package/dist/chunks/RangeCalendar-BJl-j4W2.js +2 -0
- package/dist/chunks/RangeCalendar-BJl-j4W2.js.map +1 -0
- package/dist/chunks/VisuallyHidden-C2dM7HhC.js +2 -0
- package/dist/chunks/VisuallyHidden-C2dM7HhC.js.map +1 -0
- package/dist/chunks/accordion-B8UWyvQB.js +2 -0
- package/dist/chunks/accordion-B8UWyvQB.js.map +1 -0
- package/dist/chunks/alert-BXI-_qlt.js +2 -0
- package/dist/chunks/alert-BXI-_qlt.js.map +1 -0
- package/dist/chunks/autocomplete-Baf9VSHN.js +2 -0
- package/dist/chunks/autocomplete-Baf9VSHN.js.map +1 -0
- package/dist/chunks/avatar-S3dGy6Qc.js +2 -0
- package/dist/chunks/avatar-S3dGy6Qc.js.map +1 -0
- package/dist/chunks/badge-D2oztCvs.js +2 -0
- package/dist/chunks/badge-D2oztCvs.js.map +1 -0
- package/dist/chunks/breadcrumb-s6J9itez.js +2 -0
- package/dist/chunks/breadcrumb-s6J9itez.js.map +1 -0
- package/dist/chunks/breakpoints-CJ-498B7.d.ts +7 -0
- package/dist/chunks/breakpoints-o_2Ev7ir.js +2 -0
- package/dist/chunks/breakpoints-o_2Ev7ir.js.map +1 -0
- package/dist/chunks/button-group-BGppPrIv.js +2 -0
- package/dist/chunks/button-group-BGppPrIv.js.map +1 -0
- package/dist/chunks/card-YXn3bj_d.js +2 -0
- package/dist/chunks/card-YXn3bj_d.js.map +1 -0
- package/dist/chunks/carousel-fTVPqnSV.js +2 -0
- package/dist/chunks/carousel-fTVPqnSV.js.map +1 -0
- package/dist/chunks/checkbox-ChACalAw.js +2 -0
- package/dist/chunks/checkbox-ChACalAw.js.map +1 -0
- package/dist/chunks/chip-input-BpVDRERg.js +2 -0
- package/dist/chunks/chip-input-BpVDRERg.js.map +1 -0
- package/dist/chunks/collapse--Go2Y73B.js +2 -0
- package/dist/chunks/collapse--Go2Y73B.js.map +1 -0
- package/dist/chunks/color-input-Bwl5ef5B.js +2 -0
- package/dist/chunks/color-input-Bwl5ef5B.js.map +1 -0
- package/dist/chunks/combobox-Bp1tIaiW.js +2 -0
- package/dist/chunks/combobox-Bp1tIaiW.js.map +1 -0
- package/dist/chunks/context-menu-B4a0tS-h.js +2 -0
- package/dist/chunks/context-menu-B4a0tS-h.js.map +1 -0
- package/dist/chunks/datagrid-CH3Cy-q7.js +3 -0
- package/dist/chunks/datagrid-CH3Cy-q7.js.map +1 -0
- package/dist/chunks/dateRangePresets-R1FtA1zp.d.ts +42 -0
- package/dist/chunks/datepicker-bOiM_zhJ.js +2 -0
- package/dist/chunks/datepicker-bOiM_zhJ.js.map +1 -0
- package/dist/chunks/dialogTransition-i9vw0i2Z.js +2 -0
- package/dist/chunks/dialogTransition-i9vw0i2Z.js.map +1 -0
- package/dist/chunks/direction-LN6uwsK5.js +2 -0
- package/dist/chunks/direction-LN6uwsK5.js.map +1 -0
- package/dist/chunks/divider-CjbF4OfA.js +2 -0
- package/dist/chunks/divider-CjbF4OfA.js.map +1 -0
- package/dist/chunks/drawer-C7Tz4XU_.js +2 -0
- package/dist/chunks/drawer-C7Tz4XU_.js.map +1 -0
- package/dist/chunks/file-input-CDM6qrmV.js +2 -0
- package/dist/chunks/file-input-CDM6qrmV.js.map +1 -0
- package/dist/chunks/flex-CmlJbKVj.js +2 -0
- package/dist/chunks/flex-CmlJbKVj.js.map +1 -0
- package/dist/chunks/floating-input-DmSZZc27.js +2 -0
- package/dist/chunks/floating-input-DmSZZc27.js.map +1 -0
- package/dist/chunks/focus-ring-SR_LwaN7.js +2 -0
- package/dist/chunks/focus-ring-SR_LwaN7.js.map +1 -0
- package/dist/chunks/focusRedirect-BrvK3U_o.js +2 -0
- package/dist/chunks/focusRedirect-BrvK3U_o.js.map +1 -0
- package/dist/chunks/form-GpdAyWWi.js +2 -0
- package/dist/chunks/form-GpdAyWWi.js.map +1 -0
- package/dist/chunks/form-field-CNPGTMiW.js +2 -0
- package/dist/chunks/form-field-CNPGTMiW.js.map +1 -0
- package/dist/chunks/grid-DK_vxz-4.js +2 -0
- package/dist/chunks/grid-DK_vxz-4.js.map +1 -0
- package/dist/chunks/icon-BQsT6YtE.js +2 -0
- package/dist/chunks/icon-BQsT6YtE.js.map +1 -0
- package/dist/chunks/iconConfig-C6gbYhsD.d.ts +71 -0
- package/dist/chunks/iconSlot-BNu2MrFI.js +2 -0
- package/dist/chunks/iconSlot-BNu2MrFI.js.map +1 -0
- package/dist/chunks/index-4cKG9KWB.d.ts +85 -0
- package/dist/chunks/index-6uob77s9.d.ts +81 -0
- package/dist/chunks/index-91YA-jkp.d.ts +127 -0
- package/dist/chunks/index-9rQeMqVI.d.ts +42 -0
- package/dist/chunks/index-B0-8n-Gs.d.ts +106 -0
- package/dist/chunks/index-B2K-O9kl.d.ts +59 -0
- package/dist/chunks/index-B8uaSJA9.d.ts +96 -0
- package/dist/chunks/index-BA-raEMm.d.ts +29 -0
- package/dist/chunks/index-BAsbRx5n.d.ts +54 -0
- package/dist/chunks/index-BF3OWUVc.d.ts +66 -0
- package/dist/chunks/index-BNf0jIIL.d.ts +213 -0
- package/dist/chunks/index-BO9jLOIb.d.ts +59 -0
- package/dist/chunks/index-BTTeKpiE.d.ts +364 -0
- package/dist/chunks/index-BVGGIaPX.d.ts +111 -0
- package/dist/chunks/index-B_UzbGOa.d.ts +195 -0
- package/dist/chunks/index-Bi8FFadV.d.ts +99 -0
- package/dist/chunks/index-Bkj17NEQ.d.ts +51 -0
- package/dist/chunks/index-Bm2NpgND.d.ts +82 -0
- package/dist/chunks/index-BnR7wjax.d.ts +68 -0
- package/dist/chunks/index-BxROljJI.d.ts +18 -0
- package/dist/chunks/index-Bz8MDq0H.d.ts +85 -0
- package/dist/chunks/index-C4Dks__B.d.ts +139 -0
- package/dist/chunks/index-CCXJXToc.d.ts +53 -0
- package/dist/chunks/index-CFnQubsV.d.ts +123 -0
- package/dist/chunks/index-CJXKl97l.d.ts +120 -0
- package/dist/chunks/index-CJzKu7QI.d.ts +41 -0
- package/dist/chunks/index-CKx1KHED.d.ts +303 -0
- package/dist/chunks/index-COsIPd8L.d.ts +63 -0
- package/dist/chunks/index-CRfm7W6C.d.ts +231 -0
- package/dist/chunks/index-CTpwB1yR.d.ts +236 -0
- package/dist/chunks/index-CVUMS0x7.d.ts +74 -0
- package/dist/chunks/index-CYgBmZ8w.d.ts +271 -0
- package/dist/chunks/index-Cc4SSslb.d.ts +205 -0
- package/dist/chunks/index-CftERHnE.d.ts +25 -0
- package/dist/chunks/index-Ci7AEgEc.d.ts +47 -0
- package/dist/chunks/index-CqZ68Z8R.d.ts +415 -0
- package/dist/chunks/index-CsARGAzD.d.ts +50 -0
- package/dist/chunks/index-CsMIgBsd.d.ts +40 -0
- package/dist/chunks/index-D9PZHY_I.d.ts +136 -0
- package/dist/chunks/index-DAoPg59I.d.ts +81 -0
- package/dist/chunks/index-DHGgezXU.d.ts +59 -0
- package/dist/chunks/index-DHOG_rjE.d.ts +121 -0
- package/dist/chunks/index-DJfga0Ce.d.ts +57 -0
- package/dist/chunks/index-DJr_ZK4b.d.ts +110 -0
- package/dist/chunks/index-DMbdEm__.d.ts +119 -0
- package/dist/chunks/index-DXjbI7Yv.d.ts +133 -0
- package/dist/chunks/index-DaHQdNul.d.ts +182 -0
- package/dist/chunks/index-Dcc_W6Kv.d.ts +147 -0
- package/dist/chunks/index-DceCODH9.d.ts +138 -0
- package/dist/chunks/index-Ddd7iWfm.d.ts +32 -0
- package/dist/chunks/index-Dfg4Ftb8.d.ts +69 -0
- package/dist/chunks/index-Dfy1YW5j.d.ts +74 -0
- package/dist/chunks/index-DgHvXzVh.d.ts +208 -0
- package/dist/chunks/index-Dh5CaHTP.d.ts +45 -0
- package/dist/chunks/index-DjXRq-n3.d.ts +98 -0
- package/dist/chunks/index-DjrEvKd-.d.ts +193 -0
- package/dist/chunks/index-DtbUXxjz.d.ts +54 -0
- package/dist/chunks/index-Du9fBqkT.d.ts +56 -0
- package/dist/chunks/index-FKh7iFQE.d.ts +95 -0
- package/dist/chunks/index-HrKN6s8z.d.ts +67 -0
- package/dist/chunks/index-I-H3VJ-L.d.ts +229 -0
- package/dist/chunks/index-RHJhkSY-.d.ts +273 -0
- package/dist/chunks/index-e7SJkI_m.d.ts +102 -0
- package/dist/chunks/index-g74gO0pc.d.ts +36 -0
- package/dist/chunks/index-qMq_-GY2.d.ts +105 -0
- package/dist/chunks/index-t_x6jj7l.d.ts +97 -0
- package/dist/chunks/input-adorn-DwdX-jxA.js +2 -0
- package/dist/chunks/input-adorn-DwdX-jxA.js.map +1 -0
- package/dist/chunks/input-group-Cuiuf4Dl.js +2 -0
- package/dist/chunks/input-group-Cuiuf4Dl.js.map +1 -0
- package/dist/chunks/lazyElement-tfMG21pZ.js +2 -0
- package/dist/chunks/lazyElement-tfMG21pZ.js.map +1 -0
- package/dist/chunks/list-BQCkwWjF.js +2 -0
- package/dist/chunks/list-BQCkwWjF.js.map +1 -0
- package/dist/chunks/menu-98EAD9nj.js +2 -0
- package/dist/chunks/menu-98EAD9nj.js.map +1 -0
- package/dist/chunks/modal-bgDR29Jh.js +2 -0
- package/dist/chunks/modal-bgDR29Jh.js.map +1 -0
- package/dist/chunks/nav-TiZuTHC6.js +2 -0
- package/dist/chunks/nav-TiZuTHC6.js.map +1 -0
- package/dist/chunks/nav-overflow-Ay5mM5Gc.js +2 -0
- package/dist/chunks/nav-overflow-Ay5mM5Gc.js.map +1 -0
- package/dist/chunks/navOverflow-B5krZe6D.js +2 -0
- package/dist/chunks/navOverflow-B5krZe6D.js.map +1 -0
- package/dist/chunks/navVariant-CnD21GBS.d.ts +5 -0
- package/dist/chunks/navVariant-DeGTk9B7.js +2 -0
- package/dist/chunks/navVariant-DeGTk9B7.js.map +1 -0
- package/dist/chunks/navbar-DxIwt0sc.js +2 -0
- package/dist/chunks/navbar-DxIwt0sc.js.map +1 -0
- package/dist/chunks/notification-Ds24wnPq.js +2 -0
- package/dist/chunks/notification-Ds24wnPq.js.map +1 -0
- package/dist/chunks/number-field-IBIX2IWH.js +2 -0
- package/dist/chunks/number-field-IBIX2IWH.js.map +1 -0
- package/dist/chunks/otp-input-ws393uPB.js +2 -0
- package/dist/chunks/otp-input-ws393uPB.js.map +1 -0
- package/dist/chunks/overlayPlacement-BtS90IVf.js +2 -0
- package/dist/chunks/overlayPlacement-BtS90IVf.js.map +1 -0
- package/dist/chunks/overlayPlacement-CIsLpycT.d.ts +7 -0
- package/dist/chunks/pagination-BkOquk-x.js +2 -0
- package/dist/chunks/pagination-BkOquk-x.js.map +1 -0
- package/dist/chunks/password-strength-DDK8pHRq.js +2 -0
- package/dist/chunks/password-strength-DDK8pHRq.js.map +1 -0
- package/dist/chunks/placeholder-BCr83sUn.js +2 -0
- package/dist/chunks/placeholder-BCr83sUn.js.map +1 -0
- package/dist/chunks/polymorphic-BhGNZQja.js +2 -0
- package/dist/chunks/polymorphic-BhGNZQja.js.map +1 -0
- package/dist/chunks/polymorphic-CVHbTHSN.d.ts +41 -0
- package/dist/chunks/popover-Bdg8D4sm.js +2 -0
- package/dist/chunks/popover-Bdg8D4sm.js.map +1 -0
- package/dist/chunks/progress-zWkTltor.js +2 -0
- package/dist/chunks/progress-zWkTltor.js.map +1 -0
- package/dist/chunks/radio-DOFYCfJi.js +2 -0
- package/dist/chunks/radio-DOFYCfJi.js.map +1 -0
- package/dist/chunks/range-input-CT_8TKL7.js +2 -0
- package/dist/chunks/range-input-CT_8TKL7.js.map +1 -0
- package/dist/chunks/renderFormCheck-DN_-V62U.js +2 -0
- package/dist/chunks/renderFormCheck-DN_-V62U.js.map +1 -0
- package/dist/chunks/renderFormCheck-DZh_5Df8.d.ts +24 -0
- package/dist/chunks/renderFormField-Brkw1yA6.js +2 -0
- package/dist/chunks/renderFormField-Brkw1yA6.js.map +1 -0
- package/dist/chunks/renderFormField-ChNagAFN.d.ts +15 -0
- package/dist/chunks/renderMenuItemContent-DUezZrpj.js +2 -0
- package/dist/chunks/renderMenuItemContent-DUezZrpj.js.map +1 -0
- package/dist/chunks/scrollspy-C2HmrnZ4.js +2 -0
- package/dist/chunks/scrollspy-C2HmrnZ4.js.map +1 -0
- package/dist/chunks/scrollspy-D_lPjb92.js +2 -0
- package/dist/chunks/scrollspy-D_lPjb92.js.map +1 -0
- package/dist/chunks/search-field--nDoCI_E.js +2 -0
- package/dist/chunks/search-field--nDoCI_E.js.map +1 -0
- package/dist/chunks/select-BwJIfv9f.js +2 -0
- package/dist/chunks/select-BwJIfv9f.js.map +1 -0
- package/dist/chunks/skeleton-BrD2JwNx.js +2 -0
- package/dist/chunks/skeleton-BrD2JwNx.js.map +1 -0
- package/dist/chunks/slot-CNhFZdHF.js +2 -0
- package/dist/chunks/slot-CNhFZdHF.js.map +1 -0
- package/dist/chunks/spacingClassName-DVhk8m3P.js +2 -0
- package/dist/chunks/spacingClassName-DVhk8m3P.js.map +1 -0
- package/dist/chunks/spinner-DblhvrHL.js +2 -0
- package/dist/chunks/spinner-DblhvrHL.js.map +1 -0
- package/dist/chunks/stack-CsMiQbpq.js +2 -0
- package/dist/chunks/stack-CsMiQbpq.js.map +1 -0
- package/dist/chunks/static-table-D0M4oc_t.js +2 -0
- package/dist/chunks/static-table-D0M4oc_t.js.map +1 -0
- package/dist/chunks/stepper-CVXMJ2yg.js +2 -0
- package/dist/chunks/stepper-CVXMJ2yg.js.map +1 -0
- package/dist/chunks/switch-C6s3LxEv.js +2 -0
- package/dist/chunks/switch-C6s3LxEv.js.map +1 -0
- package/dist/chunks/table-Cy6uEuEP.js +2 -0
- package/dist/chunks/table-Cy6uEuEP.js.map +1 -0
- package/dist/chunks/tableClassName-CZA2Bse8.js +2 -0
- package/dist/chunks/tableClassName-CZA2Bse8.js.map +1 -0
- package/dist/chunks/tabs-91T7-8qq.js +2 -0
- package/dist/chunks/tabs-91T7-8qq.js.map +1 -0
- package/dist/chunks/text-input-B4pTv6SU.js +2 -0
- package/dist/chunks/text-input-B4pTv6SU.js.map +1 -0
- package/dist/chunks/textarea-1A1nABQE.js +2 -0
- package/dist/chunks/textarea-1A1nABQE.js.map +1 -0
- package/dist/chunks/time-field-B3MA7ED_.js +2 -0
- package/dist/chunks/time-field-B3MA7ED_.js.map +1 -0
- package/dist/chunks/toast-CGHl3-oU.js +2 -0
- package/dist/chunks/toast-CGHl3-oU.js.map +1 -0
- package/dist/chunks/tooltip-Bc-u6nIW.js +2 -0
- package/dist/chunks/tooltip-Bc-u6nIW.js.map +1 -0
- package/dist/chunks/tree-Cql1veeZ.js +2 -0
- package/dist/chunks/tree-Cql1veeZ.js.map +1 -0
- package/dist/chunks/types-CS_40Txv.d.ts +35 -0
- package/dist/chunks/unhandledProps-9Kdj7WVf.js +2 -0
- package/dist/chunks/unhandledProps-9Kdj7WVf.js.map +1 -0
- package/dist/chunks/useButtonSemantics-CILM_lhi.js +2 -0
- package/dist/chunks/useButtonSemantics-CILM_lhi.js.map +1 -0
- package/dist/chunks/useControllableState-CPUJxfKW.js +2 -0
- package/dist/chunks/useControllableState-CPUJxfKW.js.map +1 -0
- package/dist/chunks/useDialogElement-CgOnJAzu.js +2 -0
- package/dist/chunks/useDialogElement-CgOnJAzu.js.map +1 -0
- package/dist/chunks/useDisabledAnchorGuard-Cz58UCXy.js +2 -0
- package/dist/chunks/useDisabledAnchorGuard-Cz58UCXy.js.map +1 -0
- package/dist/chunks/useFloatingOverlay-DLIvwx-8.js +2 -0
- package/dist/chunks/useFloatingOverlay-DLIvwx-8.js.map +1 -0
- package/dist/chunks/useForkedRef-DVEfT-KI.js +2 -0
- package/dist/chunks/useForkedRef-DVEfT-KI.js.map +1 -0
- package/dist/chunks/useFormField-BOqmBTC4.js +2 -0
- package/dist/chunks/useFormField-BOqmBTC4.js.map +1 -0
- package/dist/chunks/useIsomorphicLayoutEffect-BbqRwuqn.js +2 -0
- package/dist/chunks/useIsomorphicLayoutEffect-BbqRwuqn.js.map +1 -0
- package/dist/chunks/useOpenStateProps-DykUbnPJ.js +2 -0
- package/dist/chunks/useOpenStateProps-DykUbnPJ.js.map +1 -0
- package/dist/chunks/useToastRegionQueue-CIV5SdiE.js +2 -0
- package/dist/chunks/useToastRegionQueue-CIV5SdiE.js.map +1 -0
- package/dist/chunks/useTransitionState-e5ToY7eX.js +2 -0
- package/dist/chunks/useTransitionState-e5ToY7eX.js.map +1 -0
- package/dist/chunks/validationClassName-gRGs4KBm.js +2 -0
- package/dist/chunks/validationClassName-gRGs4KBm.js.map +1 -0
- package/dist/chunks/visibleState-B_i1zHu2.js +2 -0
- package/dist/chunks/visibleState-B_i1zHu2.js.map +1 -0
- package/dist/close-button.d.ts +2 -0
- package/dist/close-button.js +1 -0
- package/dist/collapse.d.ts +2 -0
- package/dist/collapse.js +1 -0
- package/dist/color-input.d.ts +2 -0
- package/dist/color-input.js +1 -0
- package/dist/combobox.d.ts +3 -0
- package/dist/combobox.js +1 -0
- package/dist/context-menu.d.ts +2 -0
- package/dist/context-menu.js +1 -0
- package/dist/datagrid.d.ts +2 -0
- package/dist/datagrid.js +1 -0
- package/dist/datepicker.d.ts +2 -0
- package/dist/datepicker.js +1 -0
- package/dist/divider.d.ts +2 -0
- package/dist/divider.js +1 -0
- package/dist/drawer.d.ts +2 -0
- package/dist/drawer.js +1 -0
- package/dist/file-input.d.ts +2 -0
- package/dist/file-input.js +1 -0
- package/dist/flex.d.ts +2 -0
- package/dist/flex.js +1 -0
- package/dist/floating-input.d.ts +2 -0
- package/dist/floating-input.js +1 -0
- package/dist/form-field.d.ts +2 -0
- package/dist/form-field.js +1 -0
- package/dist/form.d.ts +2 -0
- package/dist/form.js +1 -0
- package/dist/grid.d.ts +2 -0
- package/dist/grid.js +1 -0
- package/dist/icon.d.ts +4 -0
- package/dist/icon.js +1 -0
- package/dist/index.d.ts +84 -6369
- package/dist/index.js +1 -2
- package/dist/input-adorn.d.ts +2 -0
- package/dist/input-adorn.js +1 -0
- package/dist/input-group.d.ts +2 -0
- package/dist/input-group.js +1 -0
- package/dist/link.d.ts +3 -0
- package/dist/link.js +1 -0
- package/dist/list.d.ts +2 -0
- package/dist/list.js +1 -0
- package/dist/menu.d.ts +4 -0
- package/dist/menu.js +1 -0
- package/dist/modal.d.ts +2 -0
- package/dist/modal.js +1 -0
- package/dist/nav-overflow.d.ts +2 -0
- package/dist/nav-overflow.js +1 -0
- package/dist/nav.d.ts +2 -0
- package/dist/nav.js +1 -0
- package/dist/navbar.d.ts +2 -0
- package/dist/navbar.js +1 -0
- package/dist/notification.d.ts +2 -0
- package/dist/notification.js +1 -0
- package/dist/number-field.d.ts +2 -0
- package/dist/number-field.js +1 -0
- package/dist/otp-input.d.ts +2 -0
- package/dist/otp-input.js +1 -0
- package/dist/pagination.d.ts +2 -0
- package/dist/pagination.js +1 -0
- package/dist/password-strength.d.ts +2 -0
- package/dist/password-strength.js +1 -0
- package/dist/placeholder.d.ts +2 -0
- package/dist/placeholder.js +1 -0
- package/dist/popover.d.ts +2 -0
- package/dist/popover.js +1 -0
- package/dist/portal.d.ts +2 -0
- package/dist/portal.js +1 -0
- package/dist/progress.d.ts +2 -0
- package/dist/progress.js +1 -0
- package/dist/radio.d.ts +2 -0
- package/dist/radio.js +1 -0
- package/dist/range-input.d.ts +2 -0
- package/dist/range-input.js +1 -0
- package/dist/scrollspy.d.ts +2 -0
- package/dist/scrollspy.js +1 -0
- package/dist/search-field.d.ts +2 -0
- package/dist/search-field.js +1 -0
- package/dist/select.d.ts +2 -0
- package/dist/select.js +1 -0
- package/dist/skeleton.d.ts +2 -0
- package/dist/skeleton.js +1 -0
- package/dist/spinner.d.ts +2 -0
- package/dist/spinner.js +1 -0
- package/dist/stack.d.ts +2 -0
- package/dist/stack.js +1 -0
- package/dist/static-table.d.ts +2 -0
- package/dist/static-table.js +1 -0
- package/dist/stepper.d.ts +2 -0
- package/dist/stepper.js +1 -0
- package/dist/style.css +1 -1
- package/dist/switch.d.ts +2 -0
- package/dist/switch.js +1 -0
- package/dist/table.d.ts +2 -0
- package/dist/table.js +1 -0
- package/dist/tabs.d.ts +2 -0
- package/dist/tabs.js +1 -0
- package/dist/text-input.d.ts +2 -0
- package/dist/text-input.js +1 -0
- package/dist/textarea.d.ts +2 -0
- package/dist/textarea.js +1 -0
- package/dist/time-field.d.ts +2 -0
- package/dist/time-field.js +1 -0
- package/dist/toast.d.ts +2 -0
- package/dist/toast.js +1 -0
- package/dist/tooltip.d.ts +2 -0
- package/dist/tooltip.js +1 -0
- package/dist/tree.d.ts +2 -0
- package/dist/tree.js +1 -0
- package/dist/visually-hidden.d.ts +2 -0
- package/dist/visually-hidden.js +1 -0
- package/package.json +120 -53
- package/src/components/accordion/Accordion.tsx +0 -190
- package/src/components/accordion/AccordionBody.tsx +0 -46
- package/src/components/accordion/AccordionHeader.tsx +0 -21
- package/src/components/accordion/AccordionItem.tsx +0 -59
- package/src/components/accordion/context.ts +0 -8
- package/src/components/accordion/index.ts +0 -8
- package/src/components/autocomplete/Autocomplete.tsx +0 -464
- package/src/components/autocomplete/AutocompleteGroup.tsx +0 -20
- package/src/components/autocomplete/AutocompleteItem.tsx +0 -18
- package/src/components/autocomplete/index.ts +0 -6
- package/src/components/avatar/Avatar.tsx +0 -137
- package/src/components/avatar/AvatarImage.tsx +0 -19
- package/src/components/avatar/AvatarStack.tsx +0 -98
- package/src/components/avatar/index.ts +0 -6
- package/src/components/badge/Badge.tsx +0 -94
- package/src/components/badge/index.ts +0 -2
- package/src/components/breadcrumb/Breadcrumb.tsx +0 -68
- package/src/components/breadcrumb/BreadcrumbItem.tsx +0 -38
- package/src/components/breadcrumb/index.ts +0 -4
- package/src/components/button/Button.tsx +0 -232
- package/src/components/button/index.ts +0 -2
- package/src/components/button-group/ButtonGroup.tsx +0 -55
- package/src/components/button-group/ButtonToolbar.tsx +0 -47
- package/src/components/button-group/index.ts +0 -4
- package/src/components/calendar/Calendar.scss +0 -57
- package/src/components/calendar/Calendar.tsx +0 -338
- package/src/components/calendar/CalendarMonthBlock.tsx +0 -57
- package/src/components/calendar/CalendarMonthGrid.tsx +0 -94
- package/src/components/calendar/CalendarMonthYearPicker.tsx +0 -164
- package/src/components/calendar/CalendarNavButton.tsx +0 -24
- package/src/components/calendar/CalendarWeekGrid.tsx +0 -58
- package/src/components/calendar/CalendarYearGrid.tsx +0 -128
- package/src/components/calendar/RangeCalendar.scss +0 -95
- package/src/components/calendar/RangeCalendar.tsx +0 -373
- package/src/components/calendar/index.ts +0 -6
- package/src/components/calendar/labels.tsx +0 -71
- package/src/components/card/Card.tsx +0 -173
- package/src/components/card/CardBody.tsx +0 -75
- package/src/components/card/CardFooter.tsx +0 -47
- package/src/components/card/CardGroup.tsx +0 -51
- package/src/components/card/CardHeader.tsx +0 -47
- package/src/components/card/CardImage.tsx +0 -70
- package/src/components/card/CardImageOverlay.tsx +0 -47
- package/src/components/card/CardLink.tsx +0 -40
- package/src/components/card/CardSubtitle.tsx +0 -47
- package/src/components/card/CardText.tsx +0 -47
- package/src/components/card/CardTitle.tsx +0 -47
- package/src/components/card/index.ts +0 -22
- package/src/components/carousel/Carousel.tsx +0 -753
- package/src/components/carousel/CarouselControlButton.tsx +0 -74
- package/src/components/carousel/CarouselControlNext.tsx +0 -22
- package/src/components/carousel/CarouselControlPrev.tsx +0 -22
- package/src/components/carousel/CarouselIndicators.tsx +0 -44
- package/src/components/carousel/CarouselInner.tsx +0 -56
- package/src/components/carousel/CarouselItem.tsx +0 -51
- package/src/components/carousel/CarouselOverlay.tsx +0 -51
- package/src/components/carousel/CarouselPlayPause.tsx +0 -61
- package/src/components/carousel/carouselEngine.ts +0 -170
- package/src/components/carousel/context.ts +0 -29
- package/src/components/carousel/index.ts +0 -21
- package/src/components/checkbox/Checkbox.tsx +0 -252
- package/src/components/checkbox/CheckboxGroup.tsx +0 -145
- package/src/components/checkbox/context.ts +0 -14
- package/src/components/checkbox/index.ts +0 -4
- package/src/components/chip/Chip.tsx +0 -184
- package/src/components/chip/index.ts +0 -2
- package/src/components/chip-input/ChipInput.tsx +0 -371
- package/src/components/chip-input/ChipList.tsx +0 -95
- package/src/components/chip-input/index.ts +0 -2
- package/src/components/close-button/CloseButton.tsx +0 -205
- package/src/components/close-button/index.ts +0 -2
- package/src/components/collapse/Collapse.tsx +0 -128
- package/src/components/collapse/index.ts +0 -2
- package/src/components/color-input/ColorInput.tsx +0 -106
- package/src/components/color-input/index.ts +0 -2
- package/src/components/combobox/Combobox.tsx +0 -320
- package/src/components/combobox/ComboboxGroup.tsx +0 -27
- package/src/components/combobox/ComboboxItem.tsx +0 -44
- package/src/components/combobox/ComboboxListBox.tsx +0 -98
- package/src/components/combobox/index.ts +0 -6
- package/src/components/datagrid/DataGrid.scss +0 -203
- package/src/components/datagrid/DataGrid.tsx +0 -259
- package/src/components/datagrid/DataGridBody.tsx +0 -162
- package/src/components/datagrid/DataGridCell.tsx +0 -47
- package/src/components/datagrid/DataGridColumn.tsx +0 -109
- package/src/components/datagrid/DataGridHeader.tsx +0 -47
- package/src/components/datagrid/DataGridPinBehavior.tsx +0 -225
- package/src/components/datagrid/DataGridRow.tsx +0 -48
- package/src/components/datagrid/DataGridSelectionCell.tsx +0 -74
- package/src/components/datagrid/DataGridTableLayout.ts +0 -30
- package/src/components/datagrid/index.ts +0 -14
- package/src/components/datagrid/useColumnGeometry.ts +0 -161
- package/src/components/datepicker/CalendarToggleButton.tsx +0 -58
- package/src/components/datepicker/ClearButton.tsx +0 -38
- package/src/components/datepicker/DateField.tsx +0 -54
- package/src/components/datepicker/DatePicker.scss +0 -51
- package/src/components/datepicker/DatePicker.tsx +0 -606
- package/src/components/datepicker/DateRangePicker.scss +0 -11
- package/src/components/datepicker/DateRangePicker.tsx +0 -361
- package/src/components/datepicker/index.ts +0 -4
- package/src/components/datepicker/renderDatePickerShell.tsx +0 -104
- package/src/components/drawer/Drawer.tsx +0 -213
- package/src/components/drawer/DrawerBody.tsx +0 -47
- package/src/components/drawer/DrawerFooter.tsx +0 -51
- package/src/components/drawer/DrawerHeader.tsx +0 -60
- package/src/components/drawer/DrawerTitle.tsx +0 -49
- package/src/components/drawer/index.ts +0 -10
- package/src/components/file-input/FileInput.tsx +0 -100
- package/src/components/file-input/index.ts +0 -2
- package/src/components/flex/Flex.tsx +0 -134
- package/src/components/flex/index.ts +0 -2
- package/src/components/floating-input/FloatingInput.tsx +0 -94
- package/src/components/floating-input/index.ts +0 -2
- package/src/components/form/Form.tsx +0 -26
- package/src/components/form/FormFeedback.tsx +0 -64
- package/src/components/form/FormHelp.tsx +0 -46
- package/src/components/form/FormLabel.tsx +0 -26
- package/src/components/form/index.ts +0 -8
- package/src/components/form/renderFormCheck.tsx +0 -86
- package/src/components/form-field/FormField.tsx +0 -84
- package/src/components/form-field/index.ts +0 -2
- package/src/components/form-field/renderFormField.tsx +0 -85
- package/src/components/grid/Col.tsx +0 -69
- package/src/components/grid/Container.tsx +0 -59
- package/src/components/grid/Grid.tsx +0 -86
- package/src/components/grid/GridItem.tsx +0 -123
- package/src/components/grid/Row.tsx +0 -71
- package/src/components/grid/gap.ts +0 -8
- package/src/components/grid/index.ts +0 -10
- package/src/components/icon/Icon.tsx +0 -74
- package/src/components/icon/index.ts +0 -2
- package/src/components/input-adorn/InputAdorn.tsx +0 -55
- package/src/components/input-adorn/index.ts +0 -2
- package/src/components/input-group/InputGroup.tsx +0 -50
- package/src/components/input-group/InputGroupAddon.tsx +0 -50
- package/src/components/input-group/index.ts +0 -4
- package/src/components/link/Link.tsx +0 -148
- package/src/components/link/index.ts +0 -2
- package/src/components/list/List.tsx +0 -193
- package/src/components/list/ListItem.tsx +0 -91
- package/src/components/list/index.ts +0 -4
- package/src/components/menu/Menu.tsx +0 -408
- package/src/components/menu/MenuDivider.tsx +0 -19
- package/src/components/menu/MenuHeader.tsx +0 -55
- package/src/components/menu/MenuItem.tsx +0 -85
- package/src/components/menu/MenuList.tsx +0 -142
- package/src/components/menu/MenuSubmenu.tsx +0 -284
- package/src/components/menu/MenuSubmenuBack.tsx +0 -39
- package/src/components/menu/MenuText.tsx +0 -47
- package/src/components/menu/MenuToggle.tsx +0 -148
- package/src/components/menu/index.ts +0 -19
- package/src/components/menu/menuNavigation.ts +0 -106
- package/src/components/menu/submenuGroup.ts +0 -43
- package/src/components/modal/Modal.tsx +0 -164
- package/src/components/modal/ModalBody.tsx +0 -47
- package/src/components/modal/ModalFooter.tsx +0 -51
- package/src/components/modal/ModalHeader.tsx +0 -60
- package/src/components/modal/ModalTitle.tsx +0 -49
- package/src/components/modal/index.ts +0 -10
- package/src/components/nav/Nav.tsx +0 -97
- package/src/components/nav/NavItem.tsx +0 -42
- package/src/components/nav/NavLink.tsx +0 -48
- package/src/components/nav/NavTitle.tsx +0 -22
- package/src/components/nav/index.ts +0 -7
- package/src/components/navbar/Navbar.tsx +0 -112
- package/src/components/navbar/NavbarBrand.tsx +0 -58
- package/src/components/navbar/NavbarNav.tsx +0 -47
- package/src/components/navbar/NavbarText.tsx +0 -47
- package/src/components/navbar/NavbarToggler.tsx +0 -34
- package/src/components/navbar/index.ts +0 -10
- package/src/components/notification/Notification.scss +0 -15
- package/src/components/notification/Notification.tsx +0 -187
- package/src/components/notification/NotificationIcon.tsx +0 -21
- package/src/components/notification/NotificationStack.tsx +0 -66
- package/src/components/notification/NotificationText.tsx +0 -47
- package/src/components/notification/NotificationTitle.tsx +0 -47
- package/src/components/notification/context.ts +0 -14
- package/src/components/notification/index.ts +0 -17
- package/src/components/notification/notificationQueue.ts +0 -48
- package/src/components/otp-input/OtpBox.tsx +0 -68
- package/src/components/otp-input/OtpInput.tsx +0 -342
- package/src/components/otp-input/index.ts +0 -2
- package/src/components/pagination/Pagination.tsx +0 -199
- package/src/components/pagination/PaginationItem.tsx +0 -152
- package/src/components/pagination/index.ts +0 -4
- package/src/components/password-strength/PasswordStrength.tsx +0 -155
- package/src/components/password-strength/index.ts +0 -2
- package/src/components/password-strength/strengthScore.ts +0 -79
- package/src/components/placeholder/Placeholder.tsx +0 -178
- package/src/components/placeholder/index.ts +0 -2
- package/src/components/popover/Popover.tsx +0 -269
- package/src/components/popover/index.ts +0 -2
- package/src/components/progress/Progress.tsx +0 -154
- package/src/components/progress/ProgressBar.tsx +0 -88
- package/src/components/progress/index.ts +0 -4
- package/src/components/radio/Radio.tsx +0 -98
- package/src/components/radio/RadioGroup.tsx +0 -142
- package/src/components/radio/context.ts +0 -14
- package/src/components/radio/index.ts +0 -4
- package/src/components/range-input/RangeInput.tsx +0 -109
- package/src/components/range-input/index.ts +0 -2
- package/src/components/select/Select.tsx +0 -277
- package/src/components/select/index.ts +0 -2
- package/src/components/skeleton/Skeleton.tsx +0 -89
- package/src/components/skeleton/SkeletonLoader.tsx +0 -91
- package/src/components/skeleton/index.ts +0 -4
- package/src/components/spinner/Spinner.tsx +0 -77
- package/src/components/spinner/index.ts +0 -2
- package/src/components/stack/Stack.tsx +0 -81
- package/src/components/stack/index.ts +0 -2
- package/src/components/stepper/Stepper.tsx +0 -172
- package/src/components/stepper/StepperItem.tsx +0 -66
- package/src/components/stepper/index.ts +0 -4
- package/src/components/switch/Switch.tsx +0 -259
- package/src/components/switch/index.ts +0 -2
- package/src/components/table/Table.css +0 -39
- package/src/components/table/Table.tsx +0 -413
- package/src/components/table/TableBody.tsx +0 -25
- package/src/components/table/TableCell.tsx +0 -27
- package/src/components/table/TableColumn.tsx +0 -31
- package/src/components/table/TableHeader.tsx +0 -26
- package/src/components/table/TableRow.tsx +0 -24
- package/src/components/table/index.ts +0 -12
- package/src/components/tabs/Tab.tsx +0 -36
- package/src/components/tabs/TabList.tsx +0 -76
- package/src/components/tabs/TabPanel.tsx +0 -68
- package/src/components/tabs/Tabs.tsx +0 -136
- package/src/components/tabs/context.ts +0 -24
- package/src/components/tabs/index.ts +0 -8
- package/src/components/text-input/TextInput.tsx +0 -188
- package/src/components/text-input/index.ts +0 -2
- package/src/components/textarea/Textarea.tsx +0 -145
- package/src/components/textarea/index.ts +0 -2
- package/src/components/toast/Toast.tsx +0 -219
- package/src/components/toast/ToastBody.tsx +0 -64
- package/src/components/toast/ToastFooter.tsx +0 -47
- package/src/components/toast/ToastHeader.tsx +0 -104
- package/src/components/toast/ToastIcon.tsx +0 -21
- package/src/components/toast/Toaster.tsx +0 -87
- package/src/components/toast/context.ts +0 -14
- package/src/components/toast/index.ts +0 -18
- package/src/components/toast/toastQueue.ts +0 -56
- package/src/components/tooltip/Tooltip.tsx +0 -171
- package/src/components/tooltip/index.ts +0 -2
- package/src/global.d.ts +0 -2
- package/src/hooks/index.ts +0 -57
- package/src/hooks/useAutoDismiss.ts +0 -91
- package/src/hooks/useButtonSemantics.ts +0 -33
- package/src/hooks/useControllableState.ts +0 -24
- package/src/hooks/useDialogElement.ts +0 -226
- package/src/hooks/useDisabledAnchorGuard.ts +0 -22
- package/src/hooks/useDismissibleTransition.ts +0 -126
- package/src/hooks/useDrawer.ts +0 -9
- package/src/hooks/useFloatingOverlay.ts +0 -125
- package/src/hooks/useForkedRef.ts +0 -50
- package/src/hooks/useFormField.ts +0 -89
- package/src/hooks/useIsomorphicLayoutEffect.ts +0 -9
- package/src/hooks/useModal.ts +0 -9
- package/src/hooks/useNotification.ts +0 -10
- package/src/hooks/useOverlayPlacement.ts +0 -93
- package/src/hooks/usePagination.ts +0 -89
- package/src/hooks/useToast.ts +0 -9
- package/src/hooks/useToastRegionQueue.ts +0 -27
- package/src/index.ts +0 -502
- package/src/types.ts +0 -133
- package/src/utils/breakpoints.ts +0 -43
- package/src/utils/comboboxCollection.tsx +0 -152
- package/src/utils/dateRangePresets.ts +0 -6
- package/src/utils/devWarning.ts +0 -58
- package/src/utils/dialogTransition.ts +0 -39
- package/src/utils/direction.ts +0 -14
- package/src/utils/focusRedirect.ts +0 -23
- package/src/utils/isWholeUnitDisabled.ts +0 -17
- package/src/utils/mergeIsDateUnavailable.ts +0 -15
- package/src/utils/overlayPlacement.ts +0 -93
- package/src/utils/pointerInteraction.ts +0 -21
- package/src/utils/polymorphic.ts +0 -53
- package/src/utils/renderMenuItemContent.tsx +0 -62
- package/src/utils/setVisibleRangeStart.ts +0 -64
- package/src/utils/spacingClassName.ts +0 -14
- package/src/utils/suppressFocusRingGlobally.ts +0 -84
- package/src/utils/triggerElement.ts +0 -25
- package/src/utils/validationClassName.ts +0 -8
- package/src/utils/virtualFocusStyle.ts +0 -16
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import e,{createContext as t,forwardRef as n,useContext as r}from"react";import i from"classnames";const a={check:`check-solid`,previous:`chevron-left-outline`,next:`chevron-right-outline`,menu:`bars-outline`,more:`ellipsis-h-solid`,play:`play-solid`,pause:`pause-solid`,increment:`chevron-up-outline`,decrement:`chevron-down-outline`,search:`search-outline`,clear:`xmark-outline`,expand:`chevron-right-outline`},o=t({}),s=()=>r(o),c=n((t,n)=>{let r=s(),{name:a,className:o,font:c=r.font??!1,size:l,sprite:u=r.sprite??``,style:d,title:f,...p}=t,m=l==null?d:{"--cx-icon-size":typeof l==`number`?`${l}px`:l,...d},h=i(`icon`,{[`${r.fontPrefix??`cx-`}${a}`]:c},r.className,o);return c?e.createElement(`span`,{className:h,role:f?`img`:void 0,"aria-hidden":!f||void 0,"aria-label":f,style:m,ref:n,...p}):e.createElement(`svg`,{className:h,width:l??24,height:l??24,role:f?`img`:void 0,"aria-hidden":!f||void 0,style:m,ref:n,...p},f&&e.createElement(`title`,null,f),e.createElement(`use`,{href:`${u}#${a}`}))});c.displayName=`Icon`;export{o as i,s as n,a as r,c as t};
|
|
2
|
+
//# sourceMappingURL=Icon-DLB1f88W.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Icon-DLB1f88W.js","names":[],"sources":["../../src/utils/iconConfig.ts","../../src/hooks/useIconConfig.ts","../../src/components/icon/Icon.tsx"],"sourcesContent":["import { ComponentType, createContext, ReactElement } from 'react'\n\n/**\n * The icons this library's own components draw, by purpose rather than by icon name — so a\n * consumer can map each one onto any icon set (see `IconProvider`'s `icons`).\n */\nexport type IconKey =\n | 'check'\n | 'previous'\n | 'next'\n | 'menu'\n | 'more'\n | 'play'\n | 'pause'\n | 'increment'\n | 'decrement'\n | 'search'\n | 'clear'\n | 'expand'\n\n/**\n * An icon given to `IconProvider`'s `icons` or to a component's icon prop: a string is an icon\n * name, rendered by `IconProvider`'s `component` (or the built-in `Icon`); an element is rendered\n * as-is, with the component's own class names merged onto it.\n */\nexport type IconValue = string | ReactElement\n\n/**\n * Props `IconProvider`'s `component` receives for every icon name it's asked to render.\n */\nexport interface IconComponentProps {\n /**\n * The icon name — an `IconValue` string, or `IconProvider`'s default for that icon.\n */\n name: string\n /**\n * The class names the rendering component needs on the icon (e.g. `menu-item-check`,\n * `directional-icon`) for chassis-css to position and flip it.\n */\n className?: string\n [prop: string]: unknown\n}\n\nexport interface IconConfig {\n /**\n * Class names added to every `Icon`, alongside its own `icon` class.\n */\n className?: string\n /**\n * Replaces the built-in `Icon` for every icon this library's components render by name — the\n * strings in `icons` and their defaults, and a string `icon` on `Toast`/`Notification`. A\n * component reference can't be passed from a React Server Component, so set this in a\n * `'use client'` module.\n */\n component?: ComponentType<IconComponentProps>\n /**\n * Render `Icon` as an icon-font glyph instead of an SVG sprite reference, unless an `Icon` sets\n * `font` itself. Needs the icon font's stylesheet loaded.\n */\n font?: boolean\n /**\n * Class-name prefix of the icon font's glyphs: an icon named `check-solid` renders as\n * `{fontPrefix}check-solid`.\n *\n * @default 'cx-'\n */\n fontPrefix?: string\n /**\n * The icon to render for each of the library's own icons, by purpose. Unset ones keep their\n * defaults (`check-solid`, `chevron-left-outline`, `chevron-right-outline`, `bars-outline`,\n * `ellipsis-h-solid`, `play-solid`, `pause-solid`, `chevron-up-outline`, `chevron-down-outline`,\n * `search-outline`, `xmark-outline`, `chevron-right-outline`).\n */\n icons?: Partial<Record<IconKey, IconValue>>\n /**\n * URL of the SVG sprite `Icon` references, e.g. `/static/icons/chassis-icons.svg`. Leave empty\n * (the default) when the sprite is embedded in the page, so icons render as `href=\"#name\"`.\n * Browsers don't load an external sprite from another origin.\n *\n * @default ''\n */\n sprite?: string\n}\n\n// The chassis-icons names this library used before its icons became configurable. Both\n// previous/next consumers (Pagination, Carousel) now share the outline chevrons — Pagination used\n// the solid ones.\nexport const DEFAULT_ICONS: Record<IconKey, string> = {\n check: 'check-solid',\n previous: 'chevron-left-outline',\n next: 'chevron-right-outline',\n menu: 'bars-outline',\n more: 'ellipsis-h-solid',\n play: 'play-solid',\n pause: 'pause-solid',\n increment: 'chevron-up-outline',\n decrement: 'chevron-down-outline',\n search: 'search-outline',\n clear: 'xmark-outline',\n expand: 'chevron-right-outline'\n}\n\nexport const DEFAULT_FONT_PREFIX = 'cx-'\n\n// Lives in `utils/` rather than `components/icon/` because it's read outside that folder too —\n// by `IconSlot` (`./iconSlot.tsx`), which every icon-drawing component renders through.\nexport const IconContext = createContext<IconConfig>({})\n","import { useContext } from 'react'\n\nimport { IconConfig, IconContext } from '../utils/iconConfig'\n\n// The nearest `IconProvider`'s settings, merged with every provider above it; empty outside one.\nexport const useIconConfig = (): IconConfig => useContext(IconContext)\n","import React, { CSSProperties, forwardRef, HTMLAttributes, SVGAttributes } from 'react'\nimport classNames from 'classnames'\n\nimport { useIconConfig } from '../../hooks/useIconConfig'\nimport { DEFAULT_FONT_PREFIX } from '../../utils/iconConfig'\n\ninterface IconOwnProps {\n /**\n * Icon name, e.g. `folder-tree`. Matches an id in the SVG sprite, or a `cx-{name}` font glyph\n * class in `font` mode (see `IconProvider`'s `fontPrefix`).\n */\n name: string\n /**\n * A string of all className you want applied to the component.\n */\n className?: string\n /**\n * Icon size: a number of pixels, or any CSS length (`'1.25rem'`, `'1em'`). Sets chassis-css's\n * `--cx-icon-size` on the icon, so it applies in `font` mode too. Leave unset to keep the size\n * chassis-css gives icons in context (inside a button, an input, a navbar toggler, ...).\n */\n size?: number | string\n /**\n * Accessible name. When set, the icon is exposed to assistive tech instead of hidden.\n */\n title?: string\n /**\n * URL of the SVG sprite file. Defaults to `IconProvider`'s `sprite`, or to none — a sprite\n * embedded in the page, referenced as `#name`. Ignored in `font` mode.\n */\n sprite?: string\n}\n\nexport type IconProps =\n | (IconOwnProps & { font: true } & Omit<HTMLAttributes<HTMLSpanElement>, keyof IconOwnProps>)\n | (IconOwnProps & { font?: false } & Omit<SVGAttributes<SVGSVGElement>, keyof IconOwnProps>)\n\n// An SVG's `width`/`height` attributes lose to chassis-css's `.icon { width: var(--cx-icon-size) }`\n// — `size` used to set only those, so `size={48}` rendered at the stylesheet's 24px whenever\n// chassis-css was loaded. The custom property is what actually sizes an icon; the attributes stay\n// as the fallback for a page without chassis-css, where an unsized `<svg>` would render 300×150.\nconst FALLBACK_SIZE = 24\n\nexport const Icon = forwardRef<HTMLSpanElement | SVGSVGElement, IconProps>((props, ref) => {\n const config = useIconConfig()\n const {\n name,\n className,\n font = config.font ?? false,\n size,\n sprite = config.sprite ?? '',\n style,\n title,\n ...rest\n } = props as IconOwnProps & { font?: boolean; style?: CSSProperties }\n\n const sizeStyle =\n size == null\n ? style\n : ({\n '--cx-icon-size': typeof size === 'number' ? `${size}px` : size,\n ...style\n } as CSSProperties)\n const _className = classNames(\n 'icon',\n { [`${config.fontPrefix ?? DEFAULT_FONT_PREFIX}${name}`]: font },\n config.className,\n className\n )\n\n if (font) {\n return (\n <span\n className={_className}\n // A plain `<span>`'s implicit \"generic\" role doesn't support naming, so `aria-label`\n // alone is dropped by browsers/assistive tech - `role=\"img\"` (matching the SVG path's\n // own implicit role) is what actually makes the accessible name stick.\n role={title ? 'img' : undefined}\n aria-hidden={title ? undefined : true}\n aria-label={title}\n style={sizeStyle}\n ref={ref as React.Ref<HTMLSpanElement>}\n {...(rest as HTMLAttributes<HTMLSpanElement>)}\n />\n )\n }\n\n return (\n <svg\n className={_className}\n width={size ?? FALLBACK_SIZE}\n height={size ?? FALLBACK_SIZE}\n role={title ? 'img' : undefined}\n aria-hidden={title ? undefined : true}\n style={sizeStyle}\n ref={ref as React.Ref<SVGSVGElement>}\n {...(rest as SVGAttributes<SVGSVGElement>)}\n >\n {title && <title>{title}</title>}\n <use href={`${sprite}#${name}`} />\n </svg>\n )\n})\n\nIcon.displayName = 'Icon'\n"],"mappings":"mGAuFA,MAAa,EAAyC,CACpD,MAAO,cACP,SAAU,uBACV,KAAM,wBACN,KAAM,eACN,KAAM,mBACN,KAAM,aACN,MAAO,cACP,UAAW,qBACX,UAAW,uBACX,OAAQ,iBACR,MAAO,gBACP,OAAQ,uBACV,EAMa,EAAc,EAA0B,CAAC,CAAC,ECrG1C,MAAkC,EAAW,CAAW,ECsCxD,EAAO,GAAwD,EAAO,IAAQ,CACzF,IAAM,EAAS,EAAc,EACvB,CACJ,OACA,YACA,OAAO,EAAO,MAAQ,GACtB,OACA,SAAS,EAAO,QAAU,GAC1B,QACA,QACA,GAAG,GACD,EAEE,EACJ,GAAQ,KACJ,EACC,CACC,iBAAkB,OAAO,GAAS,SAAW,GAAG,EAAK,IAAM,EAC3D,GAAG,CACL,EACA,EAAa,EACjB,OACA,EAAG,GAAG,EAAO,YAAA,QAAoC,KAAS,CAAK,EAC/D,EAAO,UACP,CACF,EAmBA,OAjBI,EAEA,EAAA,cAAC,OAAD,CACE,UAAW,EAIX,KAAM,EAAQ,MAAQ,IAAA,GACtB,cAAa,IAAQ,IAAA,GACrB,aAAY,EACZ,MAAO,EACF,MACL,GAAK,CACN,CAAA,EAKH,EAAA,cAAC,MAAD,CACE,UAAW,EACX,MAAO,GAAQ,GACf,OAAQ,GAAQ,GAChB,KAAM,EAAQ,MAAQ,IAAA,GACtB,cAAa,IAAQ,IAAA,GACrB,MAAO,EACF,MACL,GAAK,CAIF,EAFF,GAAS,EAAA,cAAC,QAAA,KAAO,CAAa,EAC/B,EAAA,cAAC,MAAD,CAAK,KAAM,GAAG,EAAO,GAAG,GAAS,CAAA,CAC9B,CAET,CAAC,EAED,EAAK,YAAc"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{d as e,f as t,g as n,p as r}from"./slot-CNhFZdHF.js";import{t as i}from"./useForkedRef-DVEfT-KI.js";import{t as a}from"./polymorphic-BhGNZQja.js";import{t as o}from"./useButtonSemantics-CILM_lhi.js";import{t as s}from"./useDisabledAnchorGuard-Cz58UCXy.js";import{n as c}from"./scrollspy-D_lPjb92.js";import l from"react";import u from"classnames";import{mergeProps as d}from"react-aria";function f({children:a,active:f,className:p,color:m,component:h,disabled:g,href:_,iconLink:v,onClick:y,reset:b,stretched:x,type:S=`button`,...C},w){let T=r(h,_,`a`),E=n(T,_,C),D=t(E),O=E===`component`,k=c(g),A=k.onClick,j=s(E===`anchor`,g,A?e=>{y?.(e),A(e)}:y),M=!D&&!O&&!!y,{buttonProps:N,forkedRef:P}=o(w,{disabled:g,onClick:y}),F=M?P:w,I=i(F,k.ref),L=f||!!k.mark,R=f?`page`:k.mark===`current`?`true`:void 0,z=u(m&&`link-${m}`,{"icon-link":v,"fg-reset":b,"stretched-link":x},{active:L,disabled:g},p);return l.createElement(T,{...d(C,M?N:{}),className:z,...e(E,_,`Link`),...R&&{"aria-current":R},...E===`anchor`&&g&&{"aria-disabled":!0,tabIndex:-1},...!M&&{onClick:j},...E===`button`&&{disabled:g,type:S},ref:k.ref?I:F},a)}const p=a(f,`Link`);export{p as t};
|
|
2
|
+
//# sourceMappingURL=Link-CZsWCnQb.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Link-CZsWCnQb.js","names":[],"sources":["../../src/components/link/Link.tsx"],"sourcesContent":["import React, {\n ElementType,\n ForwardRefRenderFunction,\n MouseEventHandler,\n ReactElement,\n Ref\n} from 'react'\nimport classNames from 'classnames'\nimport { mergeProps } from 'react-aria'\n\nimport { ContextColor } from '../../types'\nimport { useButtonSemantics, useDisabledAnchorGuard, useForkedRef } from '../../hooks'\nimport { hrefProps, isInteractiveKind, linkElement, resolveLinkKind } from '../../utils/elementKind'\nimport {\n createPolymorphicComponent,\n PolymorphicComponentProps,\n PolymorphicRef\n} from '../../utils/polymorphic'\nimport { useScrollspyLink } from '../../utils/scrollspy'\n\ntype LinkOwnProps<C extends ElementType> = {\n /**\n * Toggle the active state for the component.\n */\n active?: boolean\n /**\n * A string of all className you want applied to the component.\n */\n className?: string\n /**\n * Sets the link color to one of Chassis context colors, including its interactive\n * (`:hover`/`:focus`/`:active`/`:visited`) states.\n */\n color?: ContextColor\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 * Toggle the disabled state for the component.\n */\n disabled?: boolean\n /**\n * The href attribute specifies the URL of the page the link goes to. Reaches an `<a>` or a\n * component reference (a router link); dropped, with a warning in development, when\n * `component` is another element. Declared explicitly here — rather than left to flow through\n * generically from whatever `C` is — so consumers that wrap `Link` (`MenuItem`, `ListItem`,\n * `NavLink`) can read it with a concrete type regardless of `component`.\n */\n href?: string\n /**\n * Fires on click.\n */\n onClick?: MouseEventHandler<HTMLElement>\n /**\n * Aligns a leading or trailing icon with the link text using flexbox, with a gap between\n * them and an offset underline. Icons need to be passed as `children` alongside the text.\n * Named `iconLink` rather than `icon` to avoid colliding with components (e.g. `MenuItem`)\n * that already have their own, differently-typed `icon` prop for the icon content itself.\n */\n iconLink?: boolean\n /**\n * Removes the foreground color override, so the link inherits its color from the nearest\n * ancestor instead of the default link color.\n */\n reset?: boolean\n /**\n * Expands the link's click target to fill its positioned ancestor (the nearest ancestor with\n * a `position` other than `static`).\n */\n stretched?: boolean\n /**\n * Specifies the type of button. Only applies when `component=\"button\"`. Different browsers may\n * use different default types for the `<button>` element, so always specify it explicitly.\n */\n type?: 'button' | 'submit' | 'reset'\n}\n\nexport type LinkProps<C extends ElementType = 'a'> = PolymorphicComponentProps<C, LinkOwnProps<C>>\n\ntype LinkComponent = (<C extends ElementType = 'a'>(\n props: LinkProps<C> & { ref?: PolymorphicRef<C> }\n) => ReactElement | null) & { displayName?: string }\n\nfunction LinkRender<C extends ElementType = 'a'>(\n {\n children,\n active,\n className,\n color,\n component,\n disabled,\n href,\n iconLink,\n onClick,\n reset,\n stretched,\n type = 'button',\n ...rest\n }: LinkProps<C>,\n ref: PolymorphicRef<C>\n) {\n const Component = linkElement(component, href, 'a')\n // The kind rather than the tag, counting a router link with `href` or `to` as an anchor: under `asChild`, `Component` is a `Slot` standing in for the\n // caller's element, and a slotted `<a>` needs what `component=\"a\"` gets.\n const kind = resolveLinkKind(Component, href, rest)\n\n const isInteractive = isInteractiveKind(kind)\n // A component reference without a link target (a router link with `href` or `to` is an anchor,\n // see `resolveLinkKind`) has its own visual identity and is trusted to\n // handle its own keyboard/role semantics, same as `CloseButton`'s `isComponentReference` escape\n // hatch — synthesizing `role=\"button\"` and Enter/Space handling on top of it would stamp the\n // wrong ARIA role onto whatever it actually renders (e.g. an `<a>`) and can double-fire a click\n // (native anchor Enter→click, plus the synthesized keydown→click).\n const isComponentReference = kind === 'component'\n // Inside a `Scrollspy`, the link registers its element, is marked when its section is the one\n // being read, and scrolls to it smoothly when the `Scrollspy` is set to (`src/utils/scrollspy.ts`).\n const spy = useScrollspyLink(disabled)\n const spyClick = spy.onClick\n const clickHandler: MouseEventHandler<HTMLElement> | undefined = spyClick\n ? (event) => {\n onClick?.(event)\n spyClick(event)\n }\n : onClick\n // `<a>` has no real `disabled` attribute, so a disabled anchor link still fires click (and\n // still navigates) unless it's blocked here, same guard `Button`/`CloseButton` apply. A real\n // `<button>` already stops clicks on its own once the `disabled` attribute below is set.\n const handleClick = useDisabledAnchorGuard<HTMLElement>(kind === 'anchor', disabled, clickHandler)\n\n // A `component` that isn't a native interactive element gets a raw onClick with no\n // keyboard semantics otherwise — mouse-only, unlike `Button`/`CloseButton`, which\n // synthesize this via `useButtonSemantics` for exactly this \"arbitrary component\" case. A\n // component reference is excluded (see `isComponentReference` above).\n const needsButtonSemantics = !isInteractive && !isComponentReference && !!onClick\n const { buttonProps, forkedRef } = useButtonSemantics<HTMLElement>(ref as Ref<HTMLElement>, {\n disabled,\n onClick\n })\n const ownRef = needsButtonSemantics ? forkedRef : ref\n const spyRef = useForkedRef(ownRef as Ref<HTMLElement>, spy.ref)\n // A link to the section being read is `active` and `aria-current=\"true\"`: the current place in\n // the page, not the current page. A link it belongs under, such as its menu's toggle, only\n // looks active. An `active` given as a prop wins.\n const isActive = active || !!spy.mark\n const ariaCurrent = active ? 'page' : spy.mark === 'current' ? 'true' : undefined\n\n const _className = classNames(\n color && `link-${color}`,\n { 'icon-link': iconLink, 'fg-reset': reset, 'stretched-link': stretched },\n { active: isActive, disabled },\n className\n )\n\n return (\n <Component\n {...(mergeProps(rest, needsButtonSemantics ? buttonProps : {}) as Record<string, unknown>)}\n className={_className}\n {...hrefProps(kind, href, 'Link')}\n {...(ariaCurrent && { 'aria-current': ariaCurrent })}\n {...(kind === 'anchor' && disabled && { 'aria-disabled': true, tabIndex: -1 })}\n {...(!needsButtonSemantics && { onClick: handleClick })}\n {...(kind === 'button' && { disabled, type })}\n ref={spy.ref ? spyRef : ownRef}\n >\n {children}\n </Component>\n )\n}\n\nexport const Link = createPolymorphicComponent<LinkComponent>(\n LinkRender as ForwardRefRenderFunction<Element, LinkProps<ElementType>>,\n 'Link'\n)\n"],"mappings":"0YAoFA,SAAS,EACP,CACE,WACA,SACA,YACA,QACA,YACA,WACA,OACA,WACA,UACA,QACA,YACA,OAAO,SACP,GAAG,GAEL,EACA,CACA,IAAM,EAAY,EAAY,EAAW,EAAM,GAAG,EAG5C,EAAO,EAAgB,EAAW,EAAM,CAAI,EAE5C,EAAgB,EAAkB,CAAI,EAOtC,EAAuB,IAAS,YAGhC,EAAM,EAAiB,CAAQ,EAC/B,EAAW,EAAI,QAUf,EAAc,EAAoC,IAAS,SAAU,EATV,EAC5D,GAAU,CACT,IAAU,CAAK,EACf,EAAS,CAAK,CAChB,EACA,CAI6F,EAM3F,EAAuB,CAAC,GAAiB,CAAC,GAAwB,CAAC,CAAC,EACpE,CAAE,cAAa,aAAc,EAAgC,EAAyB,CAC1F,WACA,SACF,CAAC,EACK,EAAS,EAAuB,EAAY,EAC5C,EAAS,EAAa,EAA4B,EAAI,GAAG,EAIzD,EAAW,GAAU,CAAC,CAAC,EAAI,KAC3B,EAAc,EAAS,OAAS,EAAI,OAAS,UAAY,OAAS,IAAA,GAElE,EAAa,EACjB,GAAS,QAAQ,IACjB,CAAE,YAAa,EAAU,WAAY,EAAO,iBAAkB,CAAU,EACxE,CAAE,OAAQ,EAAU,UAAS,EAC7B,CACF,EAEA,OACE,EAAA,cAAC,EAAD,CACE,GAAK,EAAW,EAAM,EAAuB,EAAc,CAAC,CAAC,EAC7D,UAAW,EACX,GAAI,EAAU,EAAM,EAAM,MAAM,EAChC,GAAK,GAAe,CAAE,eAAgB,CAAY,EAClD,GAAK,IAAS,UAAY,GAAY,CAAE,gBAAiB,GAAM,SAAU,EAAG,EAC5E,GAAK,CAAC,GAAwB,CAAE,QAAS,CAAY,EACrD,GAAK,IAAS,UAAY,CAAE,WAAU,MAAK,EAC3C,IAAK,EAAI,IAAM,EAAS,CAGf,EADR,CACQ,CAEf,CAEA,MAAa,EAAO,EAClB,EACA,MACF"}
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import { n as PolymorphicRef, t as PolymorphicComponentProps } from "./polymorphic-CVHbTHSN.js";
|
|
2
|
+
import { n as ContextColor } from "./types-CS_40Txv.js";
|
|
3
|
+
import { ElementType, MouseEventHandler, ReactElement } from "react";
|
|
4
|
+
//#region src/components/link/Link.d.ts
|
|
5
|
+
type LinkOwnProps<C extends ElementType> = {
|
|
6
|
+
/**
|
|
7
|
+
* Toggle the active state for the component.
|
|
8
|
+
*/
|
|
9
|
+
active?: boolean;
|
|
10
|
+
/**
|
|
11
|
+
* A string of all className you want applied to the component.
|
|
12
|
+
*/
|
|
13
|
+
className?: string;
|
|
14
|
+
/**
|
|
15
|
+
* Sets the link color to one of Chassis context colors, including its interactive
|
|
16
|
+
* (`:hover`/`:focus`/`:active`/`:visited`) states.
|
|
17
|
+
*/
|
|
18
|
+
color?: ContextColor;
|
|
19
|
+
/**
|
|
20
|
+
* Component used for the root node. Either a string to use a HTML element or a component.
|
|
21
|
+
*/
|
|
22
|
+
component?: C;
|
|
23
|
+
/**
|
|
24
|
+
* Toggle the disabled state for the component.
|
|
25
|
+
*/
|
|
26
|
+
disabled?: boolean;
|
|
27
|
+
/**
|
|
28
|
+
* The href attribute specifies the URL of the page the link goes to. Reaches an `<a>` or a
|
|
29
|
+
* component reference (a router link); dropped, with a warning in development, when
|
|
30
|
+
* `component` is another element. Declared explicitly here — rather than left to flow through
|
|
31
|
+
* generically from whatever `C` is — so consumers that wrap `Link` (`MenuItem`, `ListItem`,
|
|
32
|
+
* `NavLink`) can read it with a concrete type regardless of `component`.
|
|
33
|
+
*/
|
|
34
|
+
href?: string;
|
|
35
|
+
/**
|
|
36
|
+
* Fires on click.
|
|
37
|
+
*/
|
|
38
|
+
onClick?: MouseEventHandler<HTMLElement>;
|
|
39
|
+
/**
|
|
40
|
+
* Aligns a leading or trailing icon with the link text using flexbox, with a gap between
|
|
41
|
+
* them and an offset underline. Icons need to be passed as `children` alongside the text.
|
|
42
|
+
* Named `iconLink` rather than `icon` to avoid colliding with components (e.g. `MenuItem`)
|
|
43
|
+
* that already have their own, differently-typed `icon` prop for the icon content itself.
|
|
44
|
+
*/
|
|
45
|
+
iconLink?: boolean;
|
|
46
|
+
/**
|
|
47
|
+
* Removes the foreground color override, so the link inherits its color from the nearest
|
|
48
|
+
* ancestor instead of the default link color.
|
|
49
|
+
*/
|
|
50
|
+
reset?: boolean;
|
|
51
|
+
/**
|
|
52
|
+
* Expands the link's click target to fill its positioned ancestor (the nearest ancestor with
|
|
53
|
+
* a `position` other than `static`).
|
|
54
|
+
*/
|
|
55
|
+
stretched?: boolean;
|
|
56
|
+
/**
|
|
57
|
+
* Specifies the type of button. Only applies when `component="button"`. Different browsers may
|
|
58
|
+
* use different default types for the `<button>` element, so always specify it explicitly.
|
|
59
|
+
*/
|
|
60
|
+
type?: 'button' | 'submit' | 'reset';
|
|
61
|
+
};
|
|
62
|
+
type LinkProps<C extends ElementType = 'a'> = PolymorphicComponentProps<C, LinkOwnProps<C>>;
|
|
63
|
+
type LinkComponent = (<C extends ElementType = 'a'>(props: LinkProps<C> & {
|
|
64
|
+
ref?: PolymorphicRef<C>;
|
|
65
|
+
}) => ReactElement | null) & {
|
|
66
|
+
displayName?: string;
|
|
67
|
+
};
|
|
68
|
+
declare const Link: LinkComponent;
|
|
69
|
+
//#endregion
|
|
70
|
+
export { LinkProps as n, Link as t };
|
|
71
|
+
//# sourceMappingURL=Link-nrd0JWlO.d.ts.map
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{t as e}from"./useForkedRef-DVEfT-KI.js";import{t}from"./polymorphic-BhGNZQja.js";import{t as n}from"./useIsomorphicLayoutEffect-BbqRwuqn.js";import{t as r}from"./dialogTransition-i9vw0i2Z.js";import{t as i}from"./useOpenStateProps-DykUbnPJ.js";import{i as a,r as o}from"./overlayPlacement-BtS90IVf.js";import{t as ee}from"./navOverflow-B5krZe6D.js";import s,{Fragment as c,createContext as l,useEffect as u,useMemo as te,useRef as d}from"react";import f from"classnames";import{useMenuTrigger as p,useOverlayPosition as m}from"react-aria";import{useMenuTriggerState as h}from"react-stately";const g=()=>void 0,_=l({autoClose:!0,close:g,focusStrategy:null,hide:g,menuId:``,menuStyle:{},menuTriggerProps:{},overlayRef:{current:null},placementAttr:`bottom-start`,reference:`toggle`,registerOverlay:g,show:g,targetRef:{current:null},toggle:g,toggleNodeRef:{current:null},triggerId:``,visible:!1});function v({children:t,autoClose:l=!0,className:g,component:v,container:y,defaultVisible:b,offset:x=[0,2],onHide:S,onHidden:C,onShow:w,onShown:T,onVisibleChange:E,placement:D=`bottom-start`,reference:O=`toggle`,visible:k,...A},j){let M=v??c,N=d(null),ne=e(j,N),P=d(null),F=d(null),I=d(null),L=d(new Map),R=(e,t)=>{t?L.current.set(e,t):L.current.delete(e)},z=h(i({defaultVisible:b,onVisibleChange:E,visible:k},`Menu`)),{menuTriggerProps:B,menuProps:V}=p({},z,P);n(()=>{O===`parent`&&(F.current=N.current)},[O]);let H=d(!1);u(()=>{let e=I.current,t=!H.current;if(H.current=!0,!t){if(z.isOpen){if(w?.(),!e){T?.();return}return r(e,()=>T?.(),!0)}if(S?.(),!e){C?.();return}return r(e,()=>C?.(),!0)}},[z.isOpen]);let{overlayProps:U,placement:W}=m({targetRef:F,overlayRef:I,placement:a(D),offset:x[1],crossOffset:x[0],containerPadding:8,isOpen:z.isOpen,onClose:null}),{menuStyle:G,placementAttr:K}=o(U.style,D,W),q=d(!0);q.current=k===void 0||!!E;let J=d(!1);J.current=k!==void 0;let Y=d(!1),X=e=>z.open(e),Z=()=>{Y.current=!1,z.close()},re=e=>z.toggle(e),Q=()=>{z.close(),J.current?Y.current=q.current:P.current?.focus()};u(()=>{!z.isOpen&&Y.current&&P.current?.focus(),Y.current=!1},[z.isOpen]),u(()=>{if(!z.isOpen||l===!1)return;let e=e=>{if(e instanceof KeyboardEvent&&e.key!==`Tab`)return;let t=e.target,n=P.current,r=I.current;if(n?.contains(t))return;let i=!!r?.contains(t)||Array.from(L.current.values()).some(e=>e.contains(t));(l!==`inside`||i)&&(l===`outside`&&i||i&&(e instanceof KeyboardEvent&&e.key===`Tab`||/input|select|option|textarea|form/i.test(t.tagName??``))||Z())},t=window.setTimeout(()=>{window.addEventListener(`click`,e),window.addEventListener(`keyup`,e)});return()=>{window.clearTimeout(t),window.removeEventListener(`click`,e),window.removeEventListener(`keyup`,e)}},[z.isOpen,l]),u(()=>{if(!z.isOpen)return;let e=e=>{e.key===`Escape`&&Q()};return window.addEventListener(`keydown`,e),()=>{window.removeEventListener(`keydown`,e)}},[z.isOpen]);let ie=te(()=>({autoClose:l,close:Q,container:y,focusStrategy:z.focusStrategy,hide:Z,menuId:V.id??``,menuStyle:G,menuTriggerProps:B,overlayRef:I,placementAttr:K,reference:O,registerOverlay:R,show:X,targetRef:F,toggle:re,toggleNodeRef:P,triggerId:B.id??``,visible:z.isOpen}),[l,y,z.focusStrategy,V.id,G,B,K,O,z.isOpen]),$=s.createElement(ee,null,t);return s.createElement(_.Provider,{value:ie},M===c?$:s.createElement(M,{className:f(g,{show:z.isOpen}),...A,ref:ne},$))}const y=t(v,`Menu`);export{_ as n,y as t};
|
|
2
|
+
//# sourceMappingURL=Menu-CSBg2Zmc.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Menu-CSBg2Zmc.js","names":[],"sources":["../../src/components/menu/Menu.tsx"],"sourcesContent":["import React, {\n createContext,\n ElementType,\n ForwardRefRenderFunction,\n Fragment,\n ReactElement,\n useEffect,\n useMemo,\n useRef\n} from 'react'\nimport classNames from 'classnames'\nimport { AriaButtonProps, useMenuTrigger, useOverlayPosition } from 'react-aria'\nimport { useMenuTriggerState } from 'react-stately'\n\nimport { useForkedRef, useIsomorphicLayoutEffect, useOpenStateProps } from '../../hooks'\nimport { executeAfterTransition } from '../../utils/dialogTransition'\nimport {\n Placement,\n resolveMenuOverlayPositioning,\n toAriaPlacement\n} from '../../utils/overlayPlacement'\nimport { NavOverflowBoundary } from '../../utils/navOverflow'\nimport {\n createPolymorphicComponent,\n PolymorphicComponentProps,\n PolymorphicRef\n} from '../../utils/polymorphic'\n\nexport type { Placement }\nexport type MenuFocusStrategy = 'first' | 'last'\n\nexport type MenuAutoClose = boolean | 'inside' | 'outside'\n\ntype MenuOwnProps<C extends ElementType> = {\n /**\n * Controls which clicks close the menu. `true` closes on any click inside or outside.\n * `false` leaves closing to the toggle, the Escape key and `visible`. `'inside'` closes only\n * on click inside the menu. `'outside'` closes only on click outside the menu.\n */\n autoClose?: MenuAutoClose\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 * Defaults to `Fragment` — `MenuToggle`/`MenuList` render with no wrapping element, so\n * they land as direct children of whatever contains the `Menu`. This matters inside\n * `ButtonGroup`/`InputGroup`, whose CSS expects the toggle button and menu panel as direct\n * children rather than nested inside an intermediate node.\n *\n * Pass an actual element (e.g. `\"div\"`, or `\"li\"` for a navbar item) to opt back into a\n * wrapper — needed if you want to apply `className`/`style`/other rest props to a container\n * around the whole menu, for semantic wrapping like a nav `<li>`, or for `reference=\"parent\"`,\n * which positions off this wrapper and has nothing to measure against without one.\n */\n component?: C\n /**\n * Teleports the menu panel to a container element on open. Accepts an element reference, or\n * `true` to append to `document.body`.\n */\n container?: boolean | Element\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.\n */\n defaultVisible?: boolean\n /**\n * Distance between the menu and its reference element, as `[skidding, distance]` in pixels.\n */\n offset?: [number, number]\n /**\n * Callback fired when the menu starts to hide.\n */\n onHide?: () => void\n /**\n * Callback fired after the menu finishes hiding.\n */\n onHidden?: () => void\n /**\n * Callback fired when the menu starts to show.\n */\n onShow?: () => void\n /**\n * Callback fired after the menu finishes showing.\n */\n onShown?: () => void\n /**\n * Callback fired when the menu asks to show or hide: the toggle, a click that `autoClose`\n * counts, or the Escape or Tab key. Receives the state it asks for. With `visible` set, the\n * menu changes only when `visible` does.\n */\n onVisibleChange?: (visible: boolean) => void\n /**\n * Initial placement. Chassis will flip it to keep the menu in view.\n *\n * @type 'top' | 'top-start' | 'top-end' | 'bottom' | 'bottom-start' | 'bottom-end' | 'left' | 'left-start' | 'left-end' | 'right' | 'right-start' | 'right-end'\n */\n placement?: Placement\n /**\n * Reference element used for positioning. `'toggle'` uses the trigger. `'parent'` uses this\n * component's own rendered element, useful for split buttons and button groups.\n */\n reference?: 'toggle' | 'parent'\n /**\n * Whether the menu is open. Setting it makes the menu controlled: it opens and closes only\n * when this changes, so pair it with `onVisibleChange`. Leave it unset, or use\n * `defaultVisible`, for a menu that opens and closes itself.\n */\n visible?: boolean\n}\n\nexport type MenuProps<C extends ElementType = typeof Fragment> = PolymorphicComponentProps<\n C,\n MenuOwnProps<C>\n>\n\ntype MenuComponent = (<C extends ElementType = typeof Fragment>(\n props: MenuProps<C> & { ref?: PolymorphicRef<C> }\n) => ReactElement | null) & { displayName?: string }\n\nexport interface MenuContextProps {\n autoClose: MenuAutoClose\n close: () => void\n container?: boolean | Element\n focusStrategy: MenuFocusStrategy | null\n hide: () => void\n menuId: string\n menuStyle: React.CSSProperties\n menuTriggerProps: AriaButtonProps\n overlayRef: React.MutableRefObject<HTMLElement | null>\n placementAttr: string\n reference: 'toggle' | 'parent'\n /**\n * Registers (or, passing `null`, unregisters) a nested `MenuSubmenu`'s own portaled panel\n * element, so this `Menu`'s outside/inside click-dismiss logic recognizes clicks landing in it\n * as \"inside\" the menu — see `MenuSubmenu`'s own use for why this is necessary: its panel\n * portals straight to `document.body`, structurally detached from this menu's own DOM subtree.\n */\n registerOverlay: (id: string, node: HTMLElement | null) => void\n show: (focusStrategy?: MenuFocusStrategy | null) => void\n targetRef: React.MutableRefObject<HTMLElement | null>\n toggle: (focusStrategy?: MenuFocusStrategy | null) => void\n toggleNodeRef: React.MutableRefObject<HTMLElement | null>\n triggerId: string\n visible: boolean\n}\n\n// A fully-shaped no-op default so a `MenuToggle`/`MenuList`/`MenuSubmenu` rendered without a\n// `Menu` ancestor (or in an environment where context can't cross a component boundary, e.g.\n// some static-site prerenderers) degrades to an inert, always-closed menu instead of throwing.\nconst noop = () => undefined\n\nconst defaultMenuContext: MenuContextProps = {\n autoClose: true,\n close: noop,\n focusStrategy: null,\n hide: noop,\n menuId: '',\n menuStyle: {},\n menuTriggerProps: {},\n overlayRef: { current: null },\n placementAttr: 'bottom-start',\n reference: 'toggle',\n registerOverlay: noop,\n show: noop,\n targetRef: { current: null },\n toggle: noop,\n toggleNodeRef: { current: null },\n triggerId: '',\n visible: false\n}\n\nexport const MenuContext = createContext(defaultMenuContext)\n\nfunction MenuRender<C extends ElementType = typeof Fragment>(\n {\n children,\n autoClose = true,\n className,\n component,\n container,\n defaultVisible,\n offset: offsetProp = [0, 2],\n onHide,\n onHidden,\n onShow,\n onShown,\n onVisibleChange,\n placement = 'bottom-start',\n reference = 'toggle',\n visible,\n ...rest\n }: MenuProps<C>,\n ref: PolymorphicRef<C>\n) {\n const Component = component ?? (Fragment as ElementType)\n const wrapperRef = useRef<HTMLElement>(null)\n const forkedRef = useForkedRef(ref, wrapperRef)\n const toggleNodeRef = useRef<HTMLElement | null>(null)\n const targetRef = useRef<HTMLElement | null>(null)\n const overlayRef = useRef<HTMLElement | null>(null)\n // Portaled `MenuSubmenu` panels register themselves here (see `registerOverlay` below and\n // `MenuSubmenu`'s own ref callback) so `handleDismiss` can recognize clicks inside them as\n // \"inside\" this menu despite living outside `overlayRef.current`'s own DOM subtree.\n const submenuOverlaysRef = useRef<Map<string, HTMLElement>>(new Map())\n const registerOverlay = (id: string, node: HTMLElement | null) => {\n if (node) submenuOverlaysRef.current.set(id, node)\n else submenuOverlaysRef.current.delete(id)\n }\n\n // Controlled by `visible` when it is set: `show`/`hide`/`toggle` (from `MenuToggle`, autoClose\n // dismissal, an item) then only report to `onVisibleChange`.\n const state = useMenuTriggerState(\n useOpenStateProps({ defaultVisible, onVisibleChange, visible }, 'Menu')\n )\n const { menuTriggerProps, menuProps } = useMenuTrigger<unknown>({}, state, toggleNodeRef)\n\n useIsomorphicLayoutEffect(() => {\n if (reference === 'parent') {\n targetRef.current = wrapperRef.current\n }\n }, [reference])\n\n // `onShown`/`onHidden` wait for chassis-css's own opacity/transform transition on `.menu`\n // (see `_menu.scss`) to actually finish, matching `Modal`'s identically-worded \"requests to\n // be shown\" vs \"finishes showing\" contract (`Modal.tsx`'s own `executeAfterTransition` use).\n // `overlayRef.current` is `MenuList`'s root element — already in the DOM and already\n // reflecting the new `.show` class by the time this effect runs, since React commits the\n // render before passive effects execute. Falls back to firing synchronously when no\n // `MenuList` is mounted to measure (nothing to transition, so nothing to wait for).\n //\n // All four report *transitions*, so none fires for the initial commit — mounting closed is not\n // a hide. Without this guard, mounting fired `onHide` (and scheduled `onHidden`) for every menu\n // on the page before `onShow` had ever fired once, which `Menu.spec.tsx` used to have to\n // `mockClear()` past.\n const mountedRef = useRef(false)\n\n useEffect(() => {\n const overlay = overlayRef.current\n const isInitialCommit = !mountedRef.current\n mountedRef.current = true\n if (isInitialCommit) return undefined\n\n if (state.isOpen) {\n onShow?.()\n if (!overlay) {\n onShown?.()\n return undefined\n }\n return executeAfterTransition(overlay, () => onShown?.(), true)\n }\n\n onHide?.()\n if (!overlay) {\n onHidden?.()\n return undefined\n }\n return executeAfterTransition(overlay, () => onHidden?.(), true)\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [state.isOpen])\n\n const { overlayProps, placement: resolvedPlacement } = useOverlayPosition({\n targetRef,\n overlayRef,\n placement: toAriaPlacement(placement),\n offset: offsetProp[1],\n crossOffset: offsetProp[0],\n containerPadding: 8,\n isOpen: state.isOpen,\n // `useOverlayPosition` closes on any window scroll via a backward-compat `WeakMap` that\n // `useMenuTrigger` populates for `targetRef.current` (see `MenuToggle`'s `setRefs`).\n // Passing `null` opts out so the menu repositions with its trigger instead of vanishing —\n // matching `Autocomplete`/`Combobox`, neither of which is wired into that map.\n onClose: null\n })\n\n const { menuStyle, placementAttr } = resolveMenuOverlayPositioning(\n overlayProps.style,\n placement,\n resolvedPlacement\n )\n\n // Escape closes the menu and returns focus to the toggle. Controlled, the close is a request:\n // focus returns when `visible` follows it, in the effect below, and stays where it is when\n // nothing can follow it or the caller declines. Read through a ref because the context value\n // these functions travel in is memoized.\n const followsRequestsRef = useRef(true)\n followsRequestsRef.current = visible === undefined || !!onVisibleChange\n const isControlledRef = useRef(false)\n isControlledRef.current = visible !== undefined\n const focusReturnOwedRef = useRef(false)\n\n const show = (focusStrategy?: MenuFocusStrategy | null) => state.open(focusStrategy)\n const hide = () => {\n focusReturnOwedRef.current = false\n state.close()\n }\n const toggleVisible = (focusStrategy?: MenuFocusStrategy | null) => state.toggle(focusStrategy)\n const close = () => {\n state.close()\n if (!isControlledRef.current) toggleNodeRef.current?.focus()\n else focusReturnOwedRef.current = followsRequestsRef.current\n }\n\n useEffect(() => {\n if (!state.isOpen && focusReturnOwedRef.current) toggleNodeRef.current?.focus()\n focusReturnOwedRef.current = false\n }, [state.isOpen])\n\n // Deferred so the click that opened the menu doesn't immediately close it, and scoped\n // to match menu.js's `clearMenus`: skip the toggle itself, honor `inside`/`outside`\n // modes, and let Tab or clicks on form controls inside the menu pass through untouched.\n useEffect(() => {\n if (!state.isOpen || autoClose === false) return undefined\n\n const handleDismiss = (event: MouseEvent | KeyboardEvent) => {\n if (event instanceof KeyboardEvent && event.key !== 'Tab') return\n\n const target = event.target as Node\n const toggleNode = toggleNodeRef.current\n const menuNode = overlayRef.current\n\n if (toggleNode?.contains(target)) return\n\n const isMenuTarget =\n !!menuNode?.contains(target) ||\n Array.from(submenuOverlaysRef.current.values()).some((node) => node.contains(target))\n\n if (autoClose === 'inside' && !isMenuTarget) return\n if (autoClose === 'outside' && isMenuTarget) return\n\n if (\n isMenuTarget &&\n ((event instanceof KeyboardEvent && event.key === 'Tab') ||\n /input|select|option|textarea|form/i.test((target as HTMLElement).tagName ?? ''))\n ) {\n return\n }\n\n hide()\n }\n\n const id = window.setTimeout(() => {\n window.addEventListener('click', handleDismiss)\n window.addEventListener('keyup', handleDismiss)\n })\n\n return () => {\n window.clearTimeout(id)\n window.removeEventListener('click', handleDismiss)\n window.removeEventListener('keyup', handleDismiss)\n }\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [state.isOpen, autoClose])\n\n // Escape should always close the menu, independent of `autoClose`'s inside/outside/false\n // modes. `MenuList`'s own `onKeyDown` handling only fires when focus is already inside the\n // panel (e.g. opened via ArrowDown) — a mouse-press open via `useMenuTrigger` leaves focus on\n // the trigger button, where that handler is unreachable. Listening on `window` catches Escape\n // regardless of where focus currently is.\n useEffect(() => {\n if (!state.isOpen) return undefined\n\n const handleEscape = (event: KeyboardEvent) => {\n if (event.key !== 'Escape') return\n close()\n }\n\n window.addEventListener('keydown', handleEscape)\n\n return () => {\n window.removeEventListener('keydown', handleEscape)\n }\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [state.isOpen])\n\n const contextValue: MenuContextProps = useMemo(\n () => ({\n autoClose,\n close,\n container,\n focusStrategy: state.focusStrategy as MenuFocusStrategy | null,\n hide,\n menuId: menuProps.id ?? '',\n menuStyle,\n menuTriggerProps,\n overlayRef,\n placementAttr,\n reference,\n registerOverlay,\n show,\n targetRef,\n toggle: toggleVisible,\n toggleNodeRef,\n triggerId: menuTriggerProps.id ?? '',\n visible: state.isOpen\n }),\n // eslint-disable-next-line react-hooks/exhaustive-deps\n [\n autoClose,\n container,\n state.focusStrategy,\n menuProps.id,\n menuStyle,\n menuTriggerProps,\n placementAttr,\n reference,\n state.isOpen\n ]\n )\n\n // Inside a `NavOverflow`, a menu in a nav item is that item's content, not its link: a toggle\n // rendered as a `NavLink` has nothing to show in the overflow menu.\n const content = <NavOverflowBoundary>{children}</NavOverflowBoundary>\n\n return (\n <MenuContext.Provider value={contextValue}>\n {Component === Fragment ? (\n content\n ) : (\n // `show` mirrors vanilla menu.js's `this._parent.classList.add('show')` — needed for\n // e.g. `.nav-item.show .nav-link` to put a `NavLink`-rooted `MenuToggle` into its\n // pressed look while open, since a bare `.nav-link.show` has no styling of its own.\n <Component\n className={classNames(className, { show: state.isOpen })}\n {...rest}\n ref={forkedRef}\n >\n {content}\n </Component>\n )}\n </MenuContext.Provider>\n )\n}\n\nexport const Menu = createPolymorphicComponent<MenuComponent>(\n MenuRender as ForwardRefRenderFunction<Element, MenuProps<ElementType>>,\n 'Menu'\n)\n"],"mappings":"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"}
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
import { n as PolymorphicRef, t as PolymorphicComponentProps } from "./polymorphic-CVHbTHSN.js";
|
|
2
|
+
import { t as Placement } from "./overlayPlacement-CIsLpycT.js";
|
|
3
|
+
import React, { ElementType, Fragment, ReactElement } from "react";
|
|
4
|
+
import "react-aria";
|
|
5
|
+
//#region src/components/menu/Menu.d.ts
|
|
6
|
+
type MenuFocusStrategy = 'first' | 'last';
|
|
7
|
+
type MenuAutoClose = boolean | 'inside' | 'outside';
|
|
8
|
+
type MenuOwnProps<C extends ElementType> = {
|
|
9
|
+
/**
|
|
10
|
+
* Controls which clicks close the menu. `true` closes on any click inside or outside.
|
|
11
|
+
* `false` leaves closing to the toggle, the Escape key and `visible`. `'inside'` closes only
|
|
12
|
+
* on click inside the menu. `'outside'` closes only on click outside the menu.
|
|
13
|
+
*/
|
|
14
|
+
autoClose?: MenuAutoClose;
|
|
15
|
+
/**
|
|
16
|
+
* A string of all className you want applied to the base component.
|
|
17
|
+
*/
|
|
18
|
+
className?: string;
|
|
19
|
+
/**
|
|
20
|
+
* Component used for the root node. Either a string to use a HTML element or a component.
|
|
21
|
+
* Defaults to `Fragment` — `MenuToggle`/`MenuList` render with no wrapping element, so
|
|
22
|
+
* they land as direct children of whatever contains the `Menu`. This matters inside
|
|
23
|
+
* `ButtonGroup`/`InputGroup`, whose CSS expects the toggle button and menu panel as direct
|
|
24
|
+
* children rather than nested inside an intermediate node.
|
|
25
|
+
*
|
|
26
|
+
* Pass an actual element (e.g. `"div"`, or `"li"` for a navbar item) to opt back into a
|
|
27
|
+
* wrapper — needed if you want to apply `className`/`style`/other rest props to a container
|
|
28
|
+
* around the whole menu, for semantic wrapping like a nav `<li>`, or for `reference="parent"`,
|
|
29
|
+
* which positions off this wrapper and has nothing to measure against without one.
|
|
30
|
+
*/
|
|
31
|
+
component?: C;
|
|
32
|
+
/**
|
|
33
|
+
* Teleports the menu panel to a container element on open. Accepts an element reference, or
|
|
34
|
+
* `true` to append to `document.body`.
|
|
35
|
+
*/
|
|
36
|
+
container?: boolean | Element;
|
|
37
|
+
/**
|
|
38
|
+
* Whether the menu is open when it first renders. Use it instead of `visible` when nothing
|
|
39
|
+
* outside needs to control the menu.
|
|
40
|
+
*/
|
|
41
|
+
defaultVisible?: boolean;
|
|
42
|
+
/**
|
|
43
|
+
* Distance between the menu and its reference element, as `[skidding, distance]` in pixels.
|
|
44
|
+
*/
|
|
45
|
+
offset?: [number, number];
|
|
46
|
+
/**
|
|
47
|
+
* Callback fired when the menu starts to hide.
|
|
48
|
+
*/
|
|
49
|
+
onHide?: () => void;
|
|
50
|
+
/**
|
|
51
|
+
* Callback fired after the menu finishes hiding.
|
|
52
|
+
*/
|
|
53
|
+
onHidden?: () => void;
|
|
54
|
+
/**
|
|
55
|
+
* Callback fired when the menu starts to show.
|
|
56
|
+
*/
|
|
57
|
+
onShow?: () => void;
|
|
58
|
+
/**
|
|
59
|
+
* Callback fired after the menu finishes showing.
|
|
60
|
+
*/
|
|
61
|
+
onShown?: () => void;
|
|
62
|
+
/**
|
|
63
|
+
* Callback fired when the menu asks to show or hide: the toggle, a click that `autoClose`
|
|
64
|
+
* counts, or the Escape or Tab key. Receives the state it asks for. With `visible` set, the
|
|
65
|
+
* menu changes only when `visible` does.
|
|
66
|
+
*/
|
|
67
|
+
onVisibleChange?: (visible: boolean) => void;
|
|
68
|
+
/**
|
|
69
|
+
* Initial placement. Chassis will flip it to keep the menu in view.
|
|
70
|
+
*
|
|
71
|
+
* @type 'top' | 'top-start' | 'top-end' | 'bottom' | 'bottom-start' | 'bottom-end' | 'left' | 'left-start' | 'left-end' | 'right' | 'right-start' | 'right-end'
|
|
72
|
+
*/
|
|
73
|
+
placement?: Placement;
|
|
74
|
+
/**
|
|
75
|
+
* Reference element used for positioning. `'toggle'` uses the trigger. `'parent'` uses this
|
|
76
|
+
* component's own rendered element, useful for split buttons and button groups.
|
|
77
|
+
*/
|
|
78
|
+
reference?: 'toggle' | 'parent';
|
|
79
|
+
/**
|
|
80
|
+
* Whether the menu is open. Setting it makes the menu controlled: it opens and closes only
|
|
81
|
+
* when this changes, so pair it with `onVisibleChange`. Leave it unset, or use
|
|
82
|
+
* `defaultVisible`, for a menu that opens and closes itself.
|
|
83
|
+
*/
|
|
84
|
+
visible?: boolean;
|
|
85
|
+
};
|
|
86
|
+
type MenuProps<C extends ElementType = typeof Fragment> = PolymorphicComponentProps<C, MenuOwnProps<C>>;
|
|
87
|
+
type MenuComponent = (<C extends ElementType = typeof Fragment>(props: MenuProps<C> & {
|
|
88
|
+
ref?: PolymorphicRef<C>;
|
|
89
|
+
}) => ReactElement | null) & {
|
|
90
|
+
displayName?: string;
|
|
91
|
+
};
|
|
92
|
+
declare const Menu: MenuComponent;
|
|
93
|
+
//#endregion
|
|
94
|
+
export { MenuProps as i, MenuAutoClose as n, MenuFocusStrategy as r, Menu as t };
|
|
95
|
+
//# sourceMappingURL=Menu-QeYOzrUL.d.ts.map
|
|
@@ -1,77 +1,74 @@
|
|
|
1
|
-
import { ReactNode } from
|
|
2
|
-
import { Key } from
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
import { ReactNode } from "react";
|
|
2
|
+
import { Key as Key$1 } from "react-stately";
|
|
3
|
+
//#region src/components/menu/MenuItemDef.d.ts
|
|
4
|
+
interface MenuItemDef {
|
|
5
5
|
/**
|
|
6
6
|
* Discriminates this entry from `MenuHeaderDef`/`MenuDividerDef` in a `MenuItemsDef`
|
|
7
7
|
* array. Omit for a normal item — it's the default.
|
|
8
8
|
*/
|
|
9
|
-
type?: 'item'
|
|
9
|
+
type?: 'item';
|
|
10
10
|
/**
|
|
11
11
|
* React key for this item.
|
|
12
12
|
*/
|
|
13
|
-
id: Key
|
|
13
|
+
id: Key$1;
|
|
14
14
|
/**
|
|
15
15
|
* Label content for the item.
|
|
16
16
|
*/
|
|
17
|
-
label: ReactNode
|
|
17
|
+
label: ReactNode;
|
|
18
18
|
/**
|
|
19
19
|
* Text used for filtering/typeahead. Required when `label` isn't a plain string — components
|
|
20
20
|
* that filter (e.g. `Combobox`, `Autocomplete`) can't derive it from rich content.
|
|
21
21
|
*/
|
|
22
|
-
textValue?: string
|
|
22
|
+
textValue?: string;
|
|
23
23
|
/**
|
|
24
24
|
* URL for the item, when it acts as a link.
|
|
25
25
|
*/
|
|
26
|
-
href?: string
|
|
26
|
+
href?: string;
|
|
27
27
|
/**
|
|
28
28
|
* Callback fired when the item is activated.
|
|
29
29
|
*/
|
|
30
|
-
onClick?: () => void
|
|
30
|
+
onClick?: () => void;
|
|
31
31
|
/**
|
|
32
32
|
* Marks the item as disabled — it can't be clicked or reached via the keyboard.
|
|
33
33
|
*/
|
|
34
|
-
disabled?: boolean
|
|
34
|
+
disabled?: boolean;
|
|
35
35
|
/**
|
|
36
36
|
* Marks the item as the current selection in a choice list.
|
|
37
37
|
*/
|
|
38
|
-
selected?: boolean
|
|
38
|
+
selected?: boolean;
|
|
39
39
|
/**
|
|
40
40
|
* Icon rendered at the item's leading edge (`.menu-item-icon`).
|
|
41
41
|
*/
|
|
42
|
-
icon?: ReactNode
|
|
42
|
+
icon?: ReactNode;
|
|
43
43
|
/**
|
|
44
44
|
* Secondary line of text rendered below the label (`.menu-item-description`).
|
|
45
45
|
*/
|
|
46
|
-
description?: ReactNode
|
|
46
|
+
description?: ReactNode;
|
|
47
47
|
}
|
|
48
|
-
|
|
49
|
-
export interface MenuHeaderDef {
|
|
48
|
+
interface MenuHeaderDef {
|
|
50
49
|
/**
|
|
51
50
|
* Discriminates this entry as a non-interactive group header.
|
|
52
51
|
*/
|
|
53
|
-
type: 'header'
|
|
52
|
+
type: 'header';
|
|
54
53
|
/**
|
|
55
54
|
* React key for this entry.
|
|
56
55
|
*/
|
|
57
|
-
id: Key
|
|
56
|
+
id: Key$1;
|
|
58
57
|
/**
|
|
59
58
|
* Header content.
|
|
60
59
|
*/
|
|
61
|
-
label: ReactNode
|
|
60
|
+
label: ReactNode;
|
|
62
61
|
}
|
|
63
|
-
|
|
64
|
-
export interface MenuDividerDef {
|
|
62
|
+
interface MenuDividerDef {
|
|
65
63
|
/**
|
|
66
64
|
* Discriminates this entry as a divider.
|
|
67
65
|
*/
|
|
68
|
-
type: 'divider'
|
|
66
|
+
type: 'divider';
|
|
69
67
|
/**
|
|
70
68
|
* React key for this entry.
|
|
71
69
|
*/
|
|
72
|
-
id: Key
|
|
70
|
+
id: Key$1;
|
|
73
71
|
}
|
|
74
|
-
|
|
75
72
|
/**
|
|
76
73
|
* A flat array of item/header/divider definitions for data-driven rendering — headers and
|
|
77
74
|
* dividers are interleaved with items in authoring order, matching how chassis-css itself
|
|
@@ -80,4 +77,7 @@ export interface MenuDividerDef {
|
|
|
80
77
|
* Covers flat items, headers, and dividers only — nested/recursive submenus aren't
|
|
81
78
|
* representable here. Compose with `children`/`MenuSubmenu` directly for those.
|
|
82
79
|
*/
|
|
83
|
-
|
|
80
|
+
type MenuItemsDef = (MenuItemDef | MenuHeaderDef | MenuDividerDef)[];
|
|
81
|
+
//#endregion
|
|
82
|
+
export { MenuItemsDef as i, MenuHeaderDef as n, MenuItemDef as r, MenuDividerDef as t };
|
|
83
|
+
//# sourceMappingURL=MenuItemDef-D0VDtYIQ.d.ts.map
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{d as e,g as t,p as n,u as r}from"./slot-CNhFZdHF.js";import{t as i}from"./useForkedRef-DVEfT-KI.js";import{t as a}from"./polymorphic-BhGNZQja.js";import{n as o,t as s}from"./Portal-CgeR1WXV.js";import{t as c}from"./renderMenuItemContent-DUezZrpj.js";import{t as l}from"./Link-CZsWCnQb.js";import{t as u}from"./Button-BoymWE-L.js";import{n as d}from"./Menu-CSBg2Zmc.js";import f,{createContext as p,forwardRef as m,useContext as h,useEffect as g,useRef as _}from"react";import v from"classnames";import{mergeProps as y,useButton as b}from"react-aria";const x=m(({className:e,...t},n)=>{let r=v(`menu-divider`,e);return f.createElement(`hr`,{className:r,...t,ref:n})});x.displayName=`MenuDivider`;function S({children:e,className:t,component:n,role:r=`presentation`,...i},a){let o=n??`h4`,s=v(`menu-header`,t);return f.createElement(o,{className:s,role:r,...i,ref:a},e)}const C=a(S,`MenuHeader`);function w({children:e,className:t,component:r,description:i,href:a,icon:o,onClick:s,selected:u,...d},p){let m=v(`menu-item`,{selected:u},t);return f.createElement(l,{role:`menuitem`,component:n(r,a,`button`),href:a,onClick:e=>{a===`#`&&e.preventDefault(),s?.(e)},...d,className:m,ref:p},c({icon:o,label:e,description:i}))}const T=a(w,`MenuItem`),E=`:is(.menu-item, .submenu-back):not(.disabled):not(:disabled)`,D=e=>!!(e.offsetWidth||e.offsetHeight||e.getClientRects().length),O=e=>{if(!e)return[];let t=[];for(let n of Array.from(e.children))if(n.matches(E))t.push(n);else if(n.classList.contains(`submenu`)){let e=Array.from(n.children).find(e=>e.matches(E));e&&t.push(e)}return t.filter(D)},k=(e,t)=>{e.length&&(t===`first`?e[0]:e[e.length-1]).focus()},A=(e,{onArrowLeft:t,onArrowRight:n,onEscape:r})=>{let i=e.currentTarget,a=e.target;switch(e.key){case`ArrowDown`:case`ArrowUp`:{e.preventDefault(),e.stopPropagation();let t=O(i);if(!t.length)return;let n=t.indexOf(a);t[n===-1?e.key===`ArrowDown`?0:t.length-1:(n+(e.key===`ArrowDown`?1:-1)+t.length)%t.length].focus();return}case`Home`:case`End`:e.preventDefault(),e.stopPropagation(),k(O(i),e.key===`Home`?`first`:`last`);return;case`Escape`:if(!r)return;e.preventDefault(),e.stopPropagation(),r();return;case`ArrowLeft`:if(!t)return;e.preventDefault(),e.stopPropagation(),t();return;case`ArrowRight`:if(!n)return;e.preventDefault(),e.stopPropagation(),n();return}},j=p(null),M=()=>{let e=_(null);if(!e.current){let t=new Map;e.current={register:(e,n)=>(t.set(e,n),()=>{t.delete(e)}),notifyOpen:e=>{t.forEach((t,n)=>{n!==e&&t()})}}}return e.current},N=p(null),P=e=>e.type===`header`?f.createElement(C,{key:e.id},e.label):e.type===`divider`?f.createElement(x,{key:e.id}):f.createElement(T,{key:e.id,href:e.href,disabled:e.disabled,selected:e.selected,onClick:e.onClick},c({icon:e.icon,label:e.label,description:e.description,selected:e.selected}));function F({children:e,className:t,component:n,items:r,onKeyDown:a,...c},l){let u=n??`div`,{close:p,container:m,focusStrategy:_,menuId:y,menuStyle:b,overlayRef:x,placementAttr:S,triggerId:C,visible:w}=h(d),T=i(l,x),E=M(),D=o(),N=w&&D;g(()=>{w&&_&&k(O(x.current),_===`last`?`last`:`first`)},[w,_]);let F=e=>{A(e,{onEscape:p}),a?.(e)},I=c[`aria-label`]?void 0:C||void 0,L=f.createElement(u,{role:`menu`,id:y,"aria-labelledby":I,className:v(`menu`,{show:N},t),style:b,"data-cx-placement":S,...c,onKeyDown:F,ref:T},f.createElement(j.Provider,{value:E},r?r.map(P):e));return m?f.createElement(s,{container:m===!0?void 0:m},L):L}const I=a(F,`MenuList`);function L({children:n,caret:a=!0,className:o,component:s,href:c,onClick:l,onKeyDown:p,tabIndex:m,...g},x){let{hide:S,menuTriggerProps:C,reference:w,targetRef:T,toggleNodeRef:E,visible:D}=h(d),O=s??u,k=_(null),A=O===u?r(c)?`anchor`:`button`:t(O,c,g),j=A===`button`,M=O===u?{href:c}:e(A,c,`MenuToggle`),{buttonProps:N}=b({...C,elementType:j?`button`:`a`},k),P=_(!1),F=i(x,e=>{k.current=e,E.current=e,w!==`parent`&&(T.current=e)}),I=e=>{P.current=e.pointerType!==`touch`&&D},L=e=>{e.preventDefault(),e.stopPropagation(),P.current&&(P.current=!1,S()),l?.(e)};return f.createElement(O,{...j?{type:`button`}:{},className:v({caret:a,show:D},o),...y({onPointerDown:I},g,N,{onClick:L,onKeyDown:p,...m!==void 0&&{tabIndex:m}}),...M,ref:F},n)}const R=a(L,`MenuToggle`);export{M as a,A as c,x as d,j as i,T as l,I as n,k as o,N as r,O as s,R as t,C as u};
|
|
2
|
+
//# sourceMappingURL=MenuToggle-BdQtF7FV.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"MenuToggle-BdQtF7FV.js","names":[],"sources":["../../src/components/menu/MenuDivider.tsx","../../src/components/menu/MenuHeader.tsx","../../src/components/menu/MenuItem.tsx","../../src/components/menu/menuNavigation.ts","../../src/components/menu/submenuGroup.ts","../../src/components/menu/MenuList.tsx","../../src/components/menu/MenuToggle.tsx"],"sourcesContent":["import React, { forwardRef, HTMLAttributes } from 'react'\nimport classNames from 'classnames'\n\nexport interface MenuDividerProps extends HTMLAttributes<HTMLHRElement> {\n /**\n * A string of all className you want applied to the component.\n */\n className?: string\n}\n\nexport const MenuDivider = forwardRef<HTMLHRElement, MenuDividerProps>(\n ({ className, ...rest }, ref) => {\n const _className = classNames('menu-divider', className)\n\n return <hr className={_className} {...rest} ref={ref} />\n }\n)\n\nMenuDivider.displayName = 'MenuDivider'\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 MenuHeaderOwnProps<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 * ARIA role applied to the root node. Defaults to `'presentation'` — see the render function\n * for why.\n */\n role?: React.AriaRole\n}\n\nexport type MenuHeaderProps<C extends ElementType = 'h4'> = PolymorphicComponentProps<\n C,\n MenuHeaderOwnProps<C>\n>\n\ntype MenuHeaderComponent = (<C extends ElementType = 'h4'>(\n props: MenuHeaderProps<C> & { ref?: PolymorphicRef<C> }\n) => ReactElement | null) & { displayName?: string }\n\nfunction MenuHeaderRender<C extends ElementType = 'h4'>(\n { children, className, component, role = 'presentation', ...rest }: MenuHeaderProps<C>,\n ref: PolymorphicRef<C>\n) {\n const Component = component ?? 'h4'\n const _className = classNames('menu-header', className)\n\n // Always rendered as a direct child of `role=\"menu\"` (see MenuList) — ARIA's menu role only\n // permits menuitem/group/separator children, so a bare heading fails aria-required-children.\n // `role=\"presentation\"` opts the element itself out without hiding its text content.\n return (\n <Component className={_className} role={role} {...rest} ref={ref}>\n {children}\n </Component>\n )\n}\n\nexport const MenuHeader = createPolymorphicComponent<MenuHeaderComponent>(\n MenuHeaderRender as ForwardRefRenderFunction<Element, MenuHeaderProps<ElementType>>,\n 'MenuHeader'\n)\n","import React, {\n ElementType,\n ForwardRefRenderFunction,\n MouseEvent,\n ReactElement,\n ReactNode\n} from 'react'\nimport classNames from 'classnames'\n\nimport { linkElement } from '../../utils/elementKind'\nimport {\n createPolymorphicComponent,\n PolymorphicRef,\n PolymorphicRefWithFallback\n} from '../../utils/polymorphic'\nimport { renderMenuItemContent } from '../../utils/renderMenuItemContent'\nimport { LinkProps, Link } from '../link/Link'\n\ntype MenuItemOwnProps = {\n /**\n * A string of all className you want applied to the component.\n */\n className?: string\n /**\n * Secondary line of text rendered below `children` (`.menu-item-description`).\n */\n description?: ReactNode\n /**\n * Icon rendered at the item's leading edge (`.menu-item-icon`).\n */\n icon?: ReactNode\n /**\n * Marks the item as the current selection in a choice list. Renders in a heavier font weight.\n * Combine with a manually-composed `.menu-item-check` icon (in `children`, or via `icon` on a\n * plain, non-selection item) to also show a checkmark — this prop alone doesn't add one, so\n * existing font-weight-only usage keeps rendering unchanged.\n */\n selected?: boolean\n}\n\nexport type MenuItemProps<C extends ElementType = 'a'> = LinkProps<C> & MenuItemOwnProps\n\ntype MenuItemComponent = (<C extends ElementType = 'a'>(\n props: MenuItemProps<C> & {\n ref?: PolymorphicRefWithFallback<C, HTMLAnchorElement | HTMLButtonElement>\n }\n) => ReactElement | null) & { displayName?: string }\n\nfunction MenuItemRender<C extends ElementType = 'a'>(\n {\n children,\n className,\n component,\n description,\n href,\n icon,\n onClick,\n selected,\n ...rest\n }: MenuItemProps<C>,\n ref: PolymorphicRef<C>\n) {\n const _className = classNames('menu-item', { selected }, className)\n\n // `href=\"#\"` is a common placeholder for menu items that act via `onClick` rather than\n // real navigation. Left alone, a plain anchor click still navigates to the empty fragment,\n // which scrolls the page to the top — so we suppress that default for the placeholder case\n // only, leaving real same-page anchors (`href=\"#some-id\"`) free to navigate as expected.\n const handleClick = (event: MouseEvent<HTMLAnchorElement | HTMLButtonElement>) => {\n if (href === '#') event.preventDefault()\n onClick?.(event)\n }\n\n // An item with `href` is an `<a>`, one without is a `<button type=\"button\">`, unless `component`\n // or `asChild` chose the element (see `linkElement`). chassis-css styles both as `.menu-item`.\n // An item without `href` used to be an `<a>` with no `href`, which isn't focusable, so keyboard\n // users couldn't reach it outside the menu's own arrow-key handling.\n return (\n <Link\n role=\"menuitem\"\n component={linkElement(component as ElementType | undefined, href, 'button')}\n href={href}\n onClick={handleClick}\n {...(rest as Record<string, unknown>)}\n className={_className}\n ref={ref as PolymorphicRef<ElementType>}\n >\n {renderMenuItemContent({ icon, label: children, description })}\n </Link>\n )\n}\n\nexport const MenuItem = createPolymorphicComponent<MenuItemComponent>(\n MenuItemRender as ForwardRefRenderFunction<Element, MenuItemProps<ElementType>>,\n 'MenuItem'\n)\n","import React from 'react'\n\n// Mirrors Chassis CSS's menu.js SELECTOR_VISIBLE_ITEMS / SELECTOR_KB_NAV_ITEMS: direct-child\n// menu items and submenu-back buttons, plus submenu trigger items nested one level inside a\n// `.submenu` wrapper (which aren't direct children of the `.menu`).\n//\n// Walks `children` directly rather than a `:scope`-based `querySelectorAll` — jsdom's selector\n// engine (nwsapi) mis-parses `:scope` queries against an element whose `id` contains a colon,\n// which is exactly the shape of React 18's default `useId()` output now that `MenuList`/\n// `MenuSubmenu` set a real `id` for `aria-controls`/`aria-labelledby` linking. Real browsers don't\n// have this bug, but walking children is just as correct and sidesteps it either way.\nconst VISIBLE_ITEMS_SELECTOR = ':is(.menu-item, .submenu-back):not(.disabled):not(:disabled)'\n\nconst isVisible = (element: HTMLElement) =>\n Boolean(element.offsetWidth || element.offsetHeight || element.getClientRects().length)\n\nexport const getMenuItems = (menu: HTMLElement | null): HTMLElement[] => {\n if (!menu) return []\n const items: HTMLElement[] = []\n for (const child of Array.from(menu.children)) {\n if (child.matches(VISIBLE_ITEMS_SELECTOR)) {\n items.push(child as HTMLElement)\n } else if (child.classList.contains('submenu')) {\n const trigger = Array.from(child.children).find((grandchild) =>\n grandchild.matches(VISIBLE_ITEMS_SELECTOR)\n )\n if (trigger) items.push(trigger as HTMLElement)\n }\n }\n return items.filter(isVisible)\n}\n\nexport const focusMenuItem = (items: HTMLElement[], target: 'first' | 'last') => {\n if (!items.length) return\n ;(target === 'first' ? items[0]! : items[items.length - 1]!).focus()\n}\n\nexport interface MenuKeyDownOptions {\n onArrowLeft?: () => void\n onArrowRight?: () => void\n onEscape?: () => void\n}\n\n// Scoped to `event.currentTarget` (the `.menu` element the handler is bound to), so the same\n// function drives keyboard navigation for both the top-level menu and any nested submenu list.\n// `onArrowLeft`/`onArrowRight` are both optional and independent (rather than a single\n// direction-agnostic \"close\" callback) so a caller under an RTL locale can wire the one that\n// actually points back toward the trigger — see `MenuSubmenu`, the only current consumer of\n// either.\nexport const handleMenuKeyDown = (\n event: React.KeyboardEvent<HTMLElement>,\n { onArrowLeft, onArrowRight, onEscape }: MenuKeyDownOptions\n): void => {\n const menu = event.currentTarget\n const target = event.target as HTMLElement\n\n switch (event.key) {\n case 'ArrowDown':\n case 'ArrowUp': {\n event.preventDefault()\n event.stopPropagation()\n const items = getMenuItems(menu)\n if (!items.length) return\n const currentIndex = items.indexOf(target)\n const nextIndex =\n currentIndex === -1\n ? event.key === 'ArrowDown'\n ? 0\n : items.length - 1\n : (currentIndex + (event.key === 'ArrowDown' ? 1 : -1) + items.length) % items.length\n // `nextIndex` is always a valid index into `items` here (0, items.length - 1, or a modulo\n // result — the `if (!items.length) return` above already ruled out the empty-array case).\n items[nextIndex]!.focus()\n return\n }\n case 'Home':\n case 'End': {\n event.preventDefault()\n event.stopPropagation()\n focusMenuItem(getMenuItems(menu), event.key === 'Home' ? 'first' : 'last')\n return\n }\n case 'Escape': {\n if (!onEscape) return\n event.preventDefault()\n event.stopPropagation()\n onEscape()\n return\n }\n case 'ArrowLeft': {\n if (!onArrowLeft) return\n event.preventDefault()\n event.stopPropagation()\n onArrowLeft()\n return\n }\n case 'ArrowRight': {\n if (!onArrowRight) return\n event.preventDefault()\n event.stopPropagation()\n onArrowRight()\n return\n }\n default:\n }\n}\n","import { createContext, useRef } from 'react'\n\n// Lets sibling `.submenu` flyouts at the same menu level close one another when a new one\n// opens, mirroring menu.js's `_closeSiblingSubmenus`. One provider instance is created per\n// menu level (the top-level `.menu` and each `.submenu`'s own nested list) and lives for the\n// lifetime of that level, so registration doesn't churn on every render.\nexport interface SubmenuGroupContextValue {\n register: (id: string, close: () => void) => () => void\n notifyOpen: (id: string) => void\n}\n\nexport const SubmenuGroupContext = createContext<SubmenuGroupContextValue | null>(null)\n\nexport const useSubmenuGroupProvider = (): SubmenuGroupContextValue => {\n const ref = useRef<SubmenuGroupContextValue | null>(null)\n\n if (!ref.current) {\n const closers = new Map<string, () => void>()\n ref.current = {\n register: (id, close) => {\n closers.set(id, close)\n return () => {\n closers.delete(id)\n }\n },\n notifyOpen: (id) => {\n closers.forEach((close, key) => {\n if (key !== id) close()\n })\n }\n }\n }\n\n return ref.current\n}\n\n// Exposes the current `.submenu`'s own close-and-refocus action to a nested `MenuSubmenuBack`\n// button, without threading it through the sibling-group registry above.\nexport interface SubmenuActionsContextValue {\n close: () => void\n}\n\nexport const SubmenuActionsContext = createContext<SubmenuActionsContextValue | null>(null)\n","import React, {\n ElementType,\n ForwardRefRenderFunction,\n ReactElement,\n ReactNode,\n useContext,\n useEffect\n} from 'react'\nimport classNames from 'classnames'\n\nimport { useForkedRef } from '../../hooks'\nimport { renderMenuItemContent } from '../../utils/renderMenuItemContent'\nimport {\n createPolymorphicComponent,\n PolymorphicComponentProps,\n PolymorphicRef\n} from '../../utils/polymorphic'\nimport { Portal, useHydrated } from '../portal/Portal'\nimport { MenuContext } from './Menu'\nimport { MenuDivider } from './MenuDivider'\nimport { MenuHeader } from './MenuHeader'\nimport { MenuItem } from './MenuItem'\nimport { MenuItemsDef } from './MenuItemDef'\nimport { focusMenuItem, getMenuItems, handleMenuKeyDown } from './menuNavigation'\nimport { SubmenuGroupContext, useSubmenuGroupProvider } from './submenuGroup'\n\ntype MenuListOwnProps<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 * Array of item/header/divider definitions for data-driven rendering. When provided, children\n * are ignored. Covers flat items, headers, and dividers only — for nested submenus, compose\n * with `children` and `MenuSubmenu` instead.\n */\n items?: MenuItemsDef\n}\n\nexport type MenuListProps<C extends ElementType = 'div'> = PolymorphicComponentProps<\n C,\n MenuListOwnProps<C>\n>\n\ntype MenuListComponent = (<C extends ElementType = 'div'>(\n props: MenuListProps<C> & { ref?: PolymorphicRef<C> }\n) => ReactElement | null) & { displayName?: string }\n\nconst renderMenuItemDef = (def: MenuItemsDef[number]): ReactNode => {\n if (def.type === 'header') {\n return <MenuHeader key={def.id}>{def.label}</MenuHeader>\n }\n if (def.type === 'divider') {\n return <MenuDivider key={def.id} />\n }\n return (\n <MenuItem\n key={def.id}\n href={def.href}\n disabled={def.disabled}\n selected={def.selected}\n onClick={def.onClick}\n >\n {renderMenuItemContent({\n icon: def.icon,\n label: def.label,\n description: def.description,\n selected: def.selected\n })}\n </MenuItem>\n )\n}\n\nfunction MenuListRender<C extends ElementType = 'div'>(\n { children, className, component, items, onKeyDown, ...rest }: MenuListProps<C>,\n ref: PolymorphicRef<C>\n) {\n const Component = component ?? 'div'\n const {\n close,\n container,\n focusStrategy,\n menuId,\n menuStyle,\n overlayRef,\n placementAttr,\n triggerId,\n visible\n } = useContext(MenuContext)\n const forkedRef = useForkedRef(ref, overlayRef)\n const submenuGroup = useSubmenuGroupProvider()\n // The list is positioned in a layout effect, which the server never runs: a menu open on its\n // first render was painted at the top left of the page until the JavaScript had loaded. It is\n // shown once hydration has finished, where that effect has placed it.\n const hydrated = useHydrated()\n const shown = visible && hydrated\n\n // ArrowDown/ArrowUp on the trigger opens the menu with a focus strategy (see `Menu`'s\n // `useMenuTrigger` wiring) — this is where that intent actually lands, since we're not\n // adopting `useMenu`'s own collection-aware auto-focus.\n useEffect(() => {\n if (!visible || !focusStrategy) return\n focusMenuItem(getMenuItems(overlayRef.current), focusStrategy === 'last' ? 'last' : 'first')\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [visible, focusStrategy])\n\n const handleKeyDown = (event: React.KeyboardEvent<HTMLElement>) => {\n handleMenuKeyDown(event, { onEscape: close })\n onKeyDown?.(event as React.KeyboardEvent<HTMLDivElement>)\n }\n\n // Labelled by the trigger, unless the caller names the list itself: `aria-labelledby` would\n // outrank that `aria-label`. Left out when there is no trigger to point at (a `ContextMenu`'s\n // region with no id of its own has one; a list rendered with no `Menu` around it has none).\n const ariaLabel = (rest as { 'aria-label'?: string })['aria-label']\n const labelledBy = ariaLabel ? undefined : triggerId || undefined\n\n const content = (\n <Component\n role=\"menu\"\n id={menuId}\n aria-labelledby={labelledBy}\n className={classNames('menu', { show: shown }, className)}\n style={menuStyle}\n data-cx-placement={placementAttr}\n {...rest}\n onKeyDown={handleKeyDown}\n ref={forkedRef}\n >\n <SubmenuGroupContext.Provider value={submenuGroup}>\n {items ? items.map(renderMenuItemDef) : children}\n </SubmenuGroupContext.Provider>\n </Component>\n )\n\n if (container) {\n return <Portal container={container === true ? undefined : container}>{content}</Portal>\n }\n\n return content\n}\n\nexport const MenuList = createPolymorphicComponent<MenuListComponent>(\n MenuListRender as ForwardRefRenderFunction<Element, MenuListProps<ElementType>>,\n 'MenuList'\n)\n","import React, {\n ElementType,\n ForwardRefRenderFunction,\n ReactElement,\n useContext,\n useRef\n} from 'react'\nimport classNames from 'classnames'\nimport { mergeProps, useButton } from 'react-aria'\n\nimport { Button, ButtonProps } from '../button/Button'\nimport { MenuContext } from './Menu'\nimport { ContextColor, Shapes } from '../../types'\nimport {\n createPolymorphicComponent,\n PolymorphicComponentProps,\n PolymorphicRef\n} from '../../utils/polymorphic'\nimport { useForkedRef } from '../../hooks'\nimport { hasHref, hrefProps, resolveLinkKind } from '../../utils/elementKind'\n\ntype MenuToggleOwnProps<C extends ElementType> = {\n /**\n * Toggle the active state for the component.\n */\n active?: boolean\n /**\n * Draws the caret after the toggle's content. Set it to `false` for a toggle that shows what it\n * is another way, such as an icon-only \"more\" button.\n *\n * @default true\n */\n caret?: boolean\n /**\n * A string of all className you want applied to the base component.\n */\n className?: string\n /**\n * Sets the color of the component to one of Chassis context colors. Only applies to the\n * default `Button` root.\n */\n color?: ContextColor\n /**\n * Component used for the root node — the trigger element the menu opens from. Defaults to\n * `Button`; swap for e.g. `NavLink` to render a nav-item-style trigger (`.nav-link.caret`)\n * instead of a `.button.caret`. Its own props are type-checked at the call site once passed\n * here.\n */\n component?: C\n /**\n * Toggle the disabled state for the component.\n */\n disabled?: boolean\n /**\n * The href attribute specifies the URL of the page the link goes to.\n */\n href?: string\n /**\n * Select the shape of the component. Only applies to the default `Button` root.\n */\n shape?: Shapes\n /**\n * Size the component sm or lg. Only applies to the default `Button` root.\n */\n size?: 'sm' | 'lg'\n /**\n * Sets the style variant of the component, as `Button`'s own `variant` does. Only applies to\n * the default `Button` root.\n */\n variant?: ButtonProps['variant']\n}\n\nexport type MenuToggleProps<C extends ElementType = typeof Button> = PolymorphicComponentProps<\n C,\n MenuToggleOwnProps<C>\n>\n\ntype MenuToggleComponent = (<C extends ElementType = typeof Button>(\n props: MenuToggleProps<C> & { ref?: PolymorphicRef<C> }\n) => ReactElement | null) & { displayName?: string }\n\nfunction MenuToggleRender<C extends ElementType = typeof Button>(\n {\n children,\n caret = true,\n className,\n component,\n href,\n onClick,\n onKeyDown,\n tabIndex,\n ...rest\n }: MenuToggleProps<C>,\n ref: PolymorphicRef<C>\n) {\n const { hide, menuTriggerProps, reference, targetRef, toggleNodeRef, visible } =\n useContext(MenuContext)\n const Component = component ?? Button\n const buttonRef = useRef<HTMLButtonElement | null>(null)\n // What the root renders. The default `Button` renders a `<button>`, or an `<a>` given `href`.\n // Anything else is asked, like every polymorphic component asks: `NavLink` is a component\n // reference, and `component=\"button\"` a real `<button>`.\n const kind =\n Component === Button\n ? hasHref(href)\n ? 'anchor'\n : 'button'\n : resolveLinkKind(Component, href, rest)\n const rendersButton = kind === 'button'\n // `Button` applies the `href` rule itself; anything else gets `href` only if it can take one.\n const linkProps = Component === Button ? { href } : hrefProps(kind, href, 'MenuToggle')\n // `elementType` tells react-aria whether the rendered root already has native button\n // semantics or needs them emulated (`role=\"button\"`, keyboard activation).\n const { buttonProps } = useButton(\n { ...menuTriggerProps, elementType: rendersButton ? 'button' : 'a' },\n buttonRef\n )\n const wasOpenRef = useRef(false)\n\n const setRefs = (node: HTMLButtonElement | null) => {\n buttonRef.current = node\n toggleNodeRef.current = node\n if (reference !== 'parent') {\n targetRef.current = node\n }\n }\n\n const forkedRef = useForkedRef(ref, setRefs)\n\n // react-aria's `useMenuTrigger` opens (rather than toggles) on mouse/pen press start, so\n // re-clicking an already-open trigger would otherwise re-open it right back instead of\n // closing it. Capture whether it was open before that happens — ours has to run ahead of\n // `buttonProps`' own `onPointerDown` in the `mergeProps` chain below — then close it back\n // down on click. Touch is exempt: react-aria's `onPress` already toggles it correctly there.\n const handlePointerDown = (event: React.PointerEvent<HTMLButtonElement>) => {\n wasOpenRef.current = event.pointerType !== 'touch' && visible\n }\n\n const handleClick = (event: React.MouseEvent<HTMLButtonElement>) => {\n event.preventDefault()\n event.stopPropagation()\n if (wasOpenRef.current) {\n wasOpenRef.current = false\n hide()\n }\n onClick?.(event)\n }\n\n return (\n <Component\n // A `<button>` root needs an explicit `type` to avoid an implicit form submit; other roots\n // (e.g. `NavLink`) don't render a `<button>` at all.\n {...(rendersButton ? { type: 'button' } : {})}\n // The `.caret` utility (rather than styling off `[data-cx-toggle=\"menu\"]`, as the vanilla\n // CSS docs show) keeps this element from also matching Chassis CSS's own vanilla menu.js\n // selectors on a page that happens to load both — this component reimplements all of that\n // behavior itself, so there's nothing for the vanilla plugin to usefully do with it anyway.\n // `show` mirrors `MenuList`'s own `{ show: visible }` and vanilla menu.js's\n // `this._element.classList.add('show')` — it's what puts the trigger itself into a\n // pressed look while its menu is open (`.button.show`/`.nav-item.show .nav-link`).\n className={classNames({ caret, show: visible }, className)}\n {...(mergeProps({ onPointerDown: handlePointerDown }, rest, buttonProps, {\n onClick: handleClick,\n onKeyDown,\n // The caller's, when it gives one: react-aria's own `tabIndex` would replace it.\n ...(tabIndex !== undefined && { tabIndex })\n }) as Record<string, unknown>)}\n // After `buttonProps`: for an `<a>`, react-aria returns an `href` of its own, the one it was\n // given, which is none.\n {...linkProps}\n ref={forkedRef}\n >\n {children}\n </Component>\n )\n}\n\nexport const MenuToggle = createPolymorphicComponent<MenuToggleComponent>(\n MenuToggleRender as ForwardRefRenderFunction<Element, MenuToggleProps<ElementType>>,\n 'MenuToggle'\n)\n"],"mappings":"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"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import e,{useSyncExternalStore as t}from"react";import{createPortal as n}from"react-dom";const r=()=>()=>{};function i(){return t(r,()=>!0,()=>!1)}function a({children:t,container:r,fallback:a}){return i()?n(t,r??document.body):e.createElement(e.Fragment,null,a)}a.displayName=`Portal`;export{i as n,a as t};
|
|
2
|
+
//# sourceMappingURL=Portal-CgeR1WXV.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Portal-CgeR1WXV.js","names":[],"sources":["../../src/components/portal/Portal.tsx"],"sourcesContent":["import React, { ReactElement, ReactNode, useSyncExternalStore } from 'react'\nimport { createPortal } from 'react-dom'\n\n// Nothing to subscribe to: the value only differs between the server snapshot and the client one.\nconst subscribe = () => () => {}\n\n/**\n * `false` on the server and during hydration, `true` afterwards and in a client-only render. React\n * hydrates against the server snapshot, then re-renders with the client one once hydration has\n * finished, so a component can render something that only exists in the browser without\n * mismatching the server's HTML.\n */\nexport function useHydrated(): boolean {\n return useSyncExternalStore(\n subscribe,\n () => true,\n () => false\n )\n}\n\nexport interface PortalProps {\n /**\n * The content to render in the portal.\n */\n children: ReactNode\n /**\n * Where the children are portaled. Defaults to `document.body`.\n */\n container?: Element | DocumentFragment | null\n /**\n * Rendered in place until the portal exists: on the server and during hydration. Nothing by\n * default.\n */\n fallback?: ReactNode\n}\n\n// A portal has no server equivalent. `typeof window !== 'undefined' && createPortal(...)` renders\n// nothing on the server and the portal's content on the client's first render, so hydration walks\n// into content the server never sent and reports a mismatch. `Portal` renders `fallback` until\n// hydration has finished, then portals `children`; a client-only render portals immediately.\n/**\n * Renders its children into `container` (`document.body` by default), and renders `fallback` on the\n * server and during hydration, so server-rendered pages hydrate without a mismatch.\n */\nexport function Portal({ children, container, fallback }: PortalProps): ReactElement {\n const hydrated = useHydrated()\n if (!hydrated) return <>{fallback}</>\n return createPortal(children, container ?? document.body)\n}\n\nPortal.displayName = 'Portal'\n"],"mappings":"yFAIA,MAAM,UAAwB,CAAC,EAQ/B,SAAgB,GAAuB,CACrC,OAAO,EACL,MACM,OACA,EACR,CACF,CA0BA,SAAgB,EAAO,CAAE,WAAU,YAAW,YAAuC,CAGnF,OAFiB,EACL,EACL,EAAa,EAAU,GAAa,SAAS,IAAI,EADlC,EAAA,cAAA,EAAA,SAAA,KAAG,CAAW,CAEtC,CAEA,EAAO,YAAc"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{t as e}from"./focus-ring-SR_LwaN7.js";import{t}from"./useForkedRef-DVEfT-KI.js";import{n}from"./Portal-CgeR1WXV.js";import{t as r}from"./VisuallyHidden-C2dM7HhC.js";import i,{createContext as a,forwardRef as o,useContext as s,useEffect as c,useMemo as l,useRef as u,useState as d}from"react";import f from"classnames";import{mergeProps as p,useButton as m,useCalendar as h,useCalendarCell as g,useCalendarGrid as _,useDateFormatter as v,useLocale as y,useLocalizedStringFormatter as b,useRangeCalendar as x}from"react-aria";import{useCalendarState as S,useRangeCalendarState as C}from"react-stately";import{flushSync as w}from"react-dom";import{createCalendar as T,getLocalTimeZone as E,isSameDay as D,isSameMonth as O,isToday as k,isWeekend as A,startOfMonth as j,toCalendar as M,toCalendarDate as N,today as ee}from"@internationalized/date";const P=(e,t,n)=>!!(e.isDisabled||e.maxValue&&t.compare(N(e.maxValue))>0||e.minValue&&n.compare(N(e.minValue))<0),F={previousYears:`Previous years`,nextYears:`Next years`,selectYear:`Select year`,selectMonth:`Select month`,month:`Month`,year:`Year`,calendar:`Calendar`,clear:`Clear`},I=a(F),L=()=>s(I),R=({children:e,labels:t})=>{let n=s(I),r=l(()=>t?{...n,...t}:n,[n,t]);return i.createElement(I.Provider,{value:r},e)},z=({announce:e=!0,monthStart:t,onBack:n,onSelect:a,state:o})=>{let s=L(),c=v({calendar:t.calendar.identifier,month:`short`,timeZone:o.timeZone}),l=v({calendar:t.calendar.identifier,timeZone:o.timeZone,year:`numeric`}),u=t.calendar.getMonthsInYear(t),d=[...Array(u).keys()].map(e=>{let n=t.set({day:1,month:e+1});return{date:n,formatted:c.format(n.toDate(o.timeZone))}});return i.createElement(i.Fragment,null,i.createElement(`div`,{className:`datepicker-header`},i.createElement(`div`,{className:`datepicker-header-content`},i.createElement(`button`,{className:`datepicker-month`,onClick:n,type:`button`},l.format(t.toDate(o.timeZone))))),e&&i.createElement(r,{role:`status`},`${s.selectMonth}, ${l.format(t.toDate(o.timeZone))}`),i.createElement(`div`,{className:`datepicker-content`},i.createElement(`div`,{"aria-label":l.format(t.toDate(o.timeZone)),className:`datepicker-months`,role:`group`},d.map(e=>{let n=e.date.month===t.month,r=P(o,e.date,e.date.add({months:1}).subtract({days:1}));return i.createElement(`button`,{"aria-current":n?`true`:void 0,className:f(`datepicker-months-month`,{selected:n}),disabled:r,key:e.date.month,onClick:()=>a(e.date),type:`button`},e.formatted)}))))},B=({announce:e=!0,monthStart:t,onBack:n,onSelect:a,state:o})=>{let s=L(),c=v({calendar:t.calendar.identifier,timeZone:o.timeZone,year:`numeric`}),[l,u]=d(0),p=[...Array(15).keys()].map(e=>{let n=l+e,r=t.add({years:n}),i=r.set({day:1,month:1}),a=i.add({years:1}).subtract({days:1});return{date:r,formatted:c.format(r.toDate(o.timeZone)),offset:n,yearEnd:a,yearStart:i}}),m=p[0],h=p[p.length-1],g=m.yearStart,_=h.yearEnd,y=`${m.formatted} – ${h.formatted}`,b=o.isDisabled||o.minValue!=null&&g.subtract({days:1}).compare(N(o.minValue))<0,x=o.isDisabled||o.maxValue!=null&&_.add({days:1}).compare(N(o.maxValue))>0;return i.createElement(i.Fragment,null,i.createElement(`div`,{className:`datepicker-header`},i.createElement(`button`,{"aria-label":s.previousYears,className:`datepicker-arrow datepicker-arrow-prev`,disabled:b,onClick:()=>u(e=>e-15),type:`button`}),i.createElement(`div`,{className:`datepicker-header-content`},i.createElement(`button`,{className:`datepicker-year`,onClick:n,type:`button`},y)),i.createElement(`button`,{"aria-label":s.nextYears,className:`datepicker-arrow datepicker-arrow-next`,disabled:x,onClick:()=>u(e=>e+15),type:`button`})),e&&i.createElement(r,{role:`status`},`${s.selectYear}, ${y}`),i.createElement(`div`,{className:`datepicker-content`},i.createElement(`div`,{"aria-label":y,className:`datepicker-years`,role:`group`},p.map(e=>{let t=e.offset===0,n=P(o,e.yearStart,e.yearEnd);return i.createElement(`button`,{"aria-current":t?`true`:void 0,className:f(`datepicker-years-year`,{selected:t}),disabled:n,key:e.offset,onClick:()=>a(e.date),type:`button`},e.formatted)}))))},V=(e,t)=>{let{start:n,end:r}=e.visibleRange;if(t.compare(n)===0)return;let i=e.visibleDuration.months||1,a=t.compare(n)>0;if(a?t.compare(r)>0:t.add({months:i-1}).compare(n)<0){e.setFocusedDate(H(t,a,i));return}let o=a?t.add({months:i}):t.subtract({months:i});w(()=>{e.setFocusedDate(H(o,a,i))}),e.setFocusedDate(H(t,!a,i))},H=(e,t,n)=>t?e:e.add({months:n-1}),U=({children:e,monthIndex:t=0,monthStart:n,nextArrow:a,onViewChange:o,prevArrow:s,state:l})=>{let f=L(),[p,m]=d(`days`),h=u(null),g=u(p),_=e=>{m(e),o?.(e)},y=u(o);y.current=o,c(()=>()=>y.current?.(`days`),[]),c(()=>{let e=g.current;if(e===p)return;g.current=p;let t=h.current;t&&(p===`days`?t.querySelector(`.datepicker-date-btn[tabindex="0"]`)??t.querySelector(e===`years`?`.datepicker-year`:`.datepicker-month`):t.querySelector(`.datepicker-months-month.selected, .datepicker-years-year.selected`)??t.querySelector(`.datepicker-months-month, .datepicker-years-year`))?.focus()},[p]);let b=v({calendar:n.calendar.identifier,month:`long`,timeZone:l.timeZone}),x=v({calendar:n.calendar.identifier,timeZone:l.timeZone,year:`numeric`}),S=e=>{V(l,e.subtract({months:t})),_(`days`)};return i.createElement(`div`,{className:`datepicker-column`,ref:h},p===`months`&&i.createElement(z,{announce:t===0,monthStart:n,onBack:()=>_(`days`),onSelect:S,state:l}),p===`years`&&i.createElement(B,{announce:t===0,monthStart:n,onBack:()=>_(`days`),onSelect:S,state:l}),p===`days`&&i.createElement(i.Fragment,null,i.createElement(`div`,{className:`datepicker-header`},s,i.createElement(`div`,{className:`datepicker-header-content`},i.createElement(`button`,{"aria-label":`${f.month}: ${b.format(n.toDate(l.timeZone))}`,className:`datepicker-month`,disabled:l.isDisabled,onClick:()=>_(`months`),type:`button`},b.format(n.toDate(l.timeZone))),i.createElement(`button`,{"aria-label":`${f.year}: ${x.format(n.toDate(l.timeZone))}`,className:`datepicker-year`,disabled:l.isDisabled,onClick:()=>_(`years`),type:`button`},x.format(n.toDate(l.timeZone)))),a),t===0&&i.createElement(r,{role:`status`},`${b.format(n.toDate(l.timeZone))} ${x.format(n.toDate(l.timeZone))}`),e))},W=({firstDayOfWeek:e,renderCell:t,startDate:n,state:r})=>{let{gridProps:a,headerProps:o,weekDays:s,weeksInMonth:c}=_({firstDayOfWeek:e,startDate:n},r),l=n??r.visibleRange.start;return i.createElement(`div`,{...a,className:`datepicker-content`},i.createElement(`div`,{...o,className:`datepicker-week`,role:`row`},s.map((e,t)=>i.createElement(`span`,{className:`datepicker-week-day`,key:t,role:`columnheader`},e))),i.createElement(`div`,{className:`datepicker-dates`},[...Array(c).keys()].map(e=>{let a=r.getDatesInWeek(e,n);return i.createElement(`div`,{className:`datepicker-dates-row`,key:e,role:`row`},a.map((e,n)=>e?i.createElement(i.Fragment,{key:e.toString()},t(e,n,a,!O(e,l))):i.createElement(`div`,{className:`datepicker-date`,key:n,role:`gridcell`})))})))},te=({arrows:e,firstDayOfWeek:t,monthIndex:n,onViewChange:r,renderCell:a,state:o})=>{let s=o.visibleRange.start.add({months:n});return i.createElement(i.Fragment,null,i.createElement(U,{monthIndex:n,monthStart:s,nextArrow:e?.next,onViewChange:r,prevArrow:e?.prev,state:o},i.createElement(W,{firstDayOfWeek:t,renderCell:a,startDate:s,state:o})))},G=({buttonProps:e,direction:t})=>{let n=u(null),{buttonProps:r}=m(e,n);return i.createElement(`button`,{...r,className:`datepicker-arrow datepicker-arrow-${t}`,ref:n,type:`button`})},K=(e,t)=>{if(!e?.length&&!t)return;let n=e?.length?new Set(e):null;return e=>!!n?.has(N(e).toString())||!!t?.(e)},q={"ar-AE":{todayDate:e=>`اليوم، ${e?.date}`,todayDateSelected:e=>`اليوم، ${e?.date} محدد`,dateSelected:e=>`${e?.date} المحدد`,minimumDate:`أول تاريخ متاح`,maximumDate:`آخر تاريخ متاح`},"bg-BG":{todayDate:e=>`Днес, ${e?.date}`,todayDateSelected:e=>`Днес, ${e?.date} са избрани`,dateSelected:e=>`Избрано е ${e?.date}`,minimumDate:`Първа налична дата`,maximumDate:`Последна налична дата`},"cs-CZ":{todayDate:e=>`Dnes, ${e?.date}`,todayDateSelected:e=>`Dnes, vybráno ${e?.date}`,dateSelected:e=>`Vybráno ${e?.date}`,minimumDate:`První dostupné datum`,maximumDate:`Poslední dostupné datum`},"da-DK":{todayDate:e=>`I dag, ${e?.date}`,todayDateSelected:e=>`I dag, ${e?.date} valgt`,dateSelected:e=>`${e?.date} valgt`,minimumDate:`Første ledige dato`,maximumDate:`Sidste ledige dato`},"de-DE":{todayDate:e=>`Heute, ${e?.date}`,todayDateSelected:e=>`Heute, ${e?.date} ausgewählt`,dateSelected:e=>`${e?.date} ausgewählt`,minimumDate:`Erstes verfügbares Datum`,maximumDate:`Letztes verfügbares Datum`},"el-GR":{todayDate:e=>`Σήμερα, ${e?.date}`,todayDateSelected:e=>`Σήμερα, επιλέχτηκε ${e?.date}`,dateSelected:e=>`Επιλέχθηκε ${e?.date}`,minimumDate:`Πρώτη διαθέσιμη ημερομηνία`,maximumDate:`Τελευταία διαθέσιμη ημερομηνία`},"en-US":{todayDate:e=>`Today, ${e?.date}`,todayDateSelected:e=>`Today, ${e?.date} selected`,dateSelected:e=>`${e?.date} selected`,minimumDate:`First available date`,maximumDate:`Last available date`},"es-ES":{todayDate:e=>`Hoy, ${e?.date}`,todayDateSelected:e=>`Hoy, ${e?.date} seleccionado`,dateSelected:e=>`${e?.date} seleccionado`,minimumDate:`Primera fecha disponible`,maximumDate:`Última fecha disponible`},"et-EE":{todayDate:e=>`Täna, ${e?.date}`,todayDateSelected:e=>`Täna, ${e?.date} valitud`,dateSelected:e=>`${e?.date} valitud`,minimumDate:`Esimene saadaolev kuupäev`,maximumDate:`Viimane saadaolev kuupäev`},"fi-FI":{todayDate:e=>`Tänään, ${e?.date}`,todayDateSelected:e=>`Tänään, ${e?.date} valittu`,dateSelected:e=>`${e?.date} valittu`,minimumDate:`Ensimmäinen varattavissa oleva päivämäärä`,maximumDate:`Viimeinen varattavissa oleva päivämäärä`},"fr-FR":{todayDate:e=>`Aujourd'hui, ${e?.date}`,todayDateSelected:e=>`Aujourd’hui, ${e?.date} sélectionné`,dateSelected:e=>`${e?.date} sélectionné`,minimumDate:`Première date disponible`,maximumDate:`Dernière date disponible`},"he-IL":{todayDate:e=>`היום, ${e?.date}`,todayDateSelected:e=>`היום, ${e?.date} נבחר`,dateSelected:e=>`${e?.date} נבחר`,minimumDate:`תאריך פנוי ראשון`,maximumDate:`תאריך פנוי אחרון`},"hr-HR":{todayDate:e=>`Danas, ${e?.date}`,todayDateSelected:e=>`Danas, odabran ${e?.date}`,dateSelected:e=>`${e?.date} odabran`,minimumDate:`Prvi raspoloživi datum`,maximumDate:`Posljednji raspoloživi datum`},"hu-HU":{todayDate:e=>`Ma, ${e?.date}`,todayDateSelected:e=>`Ma, ${e?.date} kijelölve`,dateSelected:e=>`${e?.date} kiválasztva`,minimumDate:`Az első elérhető dátum`,maximumDate:`Utolsó elérhető dátum`},"it-IT":{todayDate:e=>`Oggi, ${e?.date}`,todayDateSelected:e=>`Oggi, ${e?.date} selezionata`,dateSelected:e=>`${e?.date} selezionata`,minimumDate:`Prima data disponibile`,maximumDate:`Ultima data disponibile`},"ja-JP":{todayDate:e=>`本日、${e?.date}`,todayDateSelected:e=>`本日、${e?.date} を選択`,dateSelected:e=>`${e?.date} を選択`,minimumDate:`最初の利用可能日`,maximumDate:`最終利用可能日`},"ko-KR":{todayDate:e=>`오늘, ${e?.date}`,todayDateSelected:e=>`오늘, ${e?.date} 선택됨`,dateSelected:e=>`${e?.date} 선택됨`,minimumDate:`처음으로 사용 가능한 일자`,maximumDate:`마지막으로 사용 가능한 일자`},"lt-LT":{todayDate:e=>`Šiandien, ${e?.date}`,todayDateSelected:e=>`Šiandien, pasirinkta ${e?.date}`,dateSelected:e=>`Pasirinkta ${e?.date}`,minimumDate:`Pirmoji galima data`,maximumDate:`Paskutinė galima data`},"lv-LV":{todayDate:e=>`Šodien, ${e?.date}`,todayDateSelected:e=>`Atlasīta šodiena, ${e?.date}`,dateSelected:e=>`Atlasīts: ${e?.date}`,minimumDate:`Pirmais pieejamais datums`,maximumDate:`Pēdējais pieejamais datums`},"nb-NO":{todayDate:e=>`I dag, ${e?.date}`,todayDateSelected:e=>`I dag, ${e?.date} valgt`,dateSelected:e=>`${e?.date} valgt`,minimumDate:`Første tilgjengelige dato`,maximumDate:`Siste tilgjengelige dato`},"nl-NL":{todayDate:e=>`Vandaag, ${e?.date}`,todayDateSelected:e=>`Vandaag, ${e?.date} geselecteerd`,dateSelected:e=>`${e?.date} geselecteerd`,minimumDate:`Eerste beschikbare datum`,maximumDate:`Laatste beschikbare datum`},"pl-PL":{todayDate:e=>`Dzisiaj, ${e?.date}`,todayDateSelected:e=>`Dzisiaj wybrano ${e?.date}`,dateSelected:e=>`Wybrano ${e?.date}`,minimumDate:`Pierwsza dostępna data`,maximumDate:`Ostatnia dostępna data`},"pt-BR":{todayDate:e=>`Hoje, ${e?.date}`,todayDateSelected:e=>`Hoje, ${e?.date} selecionado`,dateSelected:e=>`${e?.date} selecionado`,minimumDate:`Primeira data disponível`,maximumDate:`Última data disponível`},"pt-PT":{todayDate:e=>`Hoje, ${e?.date}`,todayDateSelected:e=>`Hoje, ${e?.date} selecionado`,dateSelected:e=>`${e?.date} selecionado`,minimumDate:`Primeira data disponível`,maximumDate:`Última data disponível`},"ro-RO":{todayDate:e=>`Astăzi, ${e?.date}`,todayDateSelected:e=>`Azi, ${e?.date} selectată`,dateSelected:e=>`${e?.date} selectată`,minimumDate:`Prima dată disponibilă`,maximumDate:`Ultima dată disponibilă`},"ru-RU":{todayDate:e=>`Сегодня, ${e?.date}`,todayDateSelected:e=>`Сегодня, выбрано ${e?.date}`,dateSelected:e=>`Выбрано ${e?.date}`,minimumDate:`Первая доступная дата`,maximumDate:`Последняя доступная дата`},"sk-SK":{todayDate:e=>`Dnes ${e?.date}`,todayDateSelected:e=>`Vybratý dnešný dátum ${e?.date}`,dateSelected:e=>`Vybratý dátum ${e?.date}`,minimumDate:`Prvý dostupný dátum`,maximumDate:`Posledný dostupný dátum`},"sl-SI":{todayDate:e=>`Danes, ${e?.date}`,todayDateSelected:e=>`Danes, ${e?.date} izbrano`,dateSelected:e=>`${e?.date} izbrano`,minimumDate:`Prvi razpoložljivi datum`,maximumDate:`Zadnji razpoložljivi datum`},"sr-SP":{todayDate:e=>`Danas, ${e?.date}`,todayDateSelected:e=>`Danas, izabran ${e?.date}`,dateSelected:e=>`${e?.date} izabran`,minimumDate:`Prvi raspoloživi datum`,maximumDate:`Zadnji raspoloživi datum`},"sv-SE":{todayDate:e=>`Idag, ${e?.date}`,todayDateSelected:e=>`Idag, ${e?.date} har valts`,dateSelected:e=>`${e?.date} har valts`,minimumDate:`Första tillgängliga datum`,maximumDate:`Sista tillgängliga datum`},"tr-TR":{todayDate:e=>`Bugün, ${e?.date}`,todayDateSelected:e=>`Bugün, ${e?.date} seçildi`,dateSelected:e=>`${e?.date} seçildi`,minimumDate:`İlk müsait tarih`,maximumDate:`Son müsait tarih`},"uk-UA":{todayDate:e=>`Сьогодні, ${e?.date}`,todayDateSelected:e=>`Сьогодні, вибрано ${e?.date}`,dateSelected:e=>`Вибрано ${e?.date}`,minimumDate:`Перша доступна дата`,maximumDate:`Остання доступна дата`},"zh-CN":{todayDate:e=>`今天,即 ${e?.date}`,todayDateSelected:e=>`已选择今天,即 ${e?.date}`,dateSelected:e=>`已选择 ${e?.date}`,minimumDate:`第一个可用日期`,maximumDate:`最后一个可用日期`},"zh-TW":{todayDate:e=>`今天,${e?.date}`,todayDateSelected:e=>`已選取今天,${e?.date}`,dateSelected:e=>`已選取 ${e?.date}`,minimumDate:`第一個可用日期`,maximumDate:`最後一個可用日期`}};function J(e,t,r,i){let a=n(),o=b(q,`@react-aria/calendar`),s=k(e,t.timeZone);if(a||!s||!i)return{isCurrentDate:a&&s,label:i};let[c=``,l=``]=o.format(r?`todayDateSelected`:`todayDate`,{date:`\0`}).split(`\0`),u=``;t.minValue&&D(e,t.minValue)?u=`, ${o.format(`minimumDate`)}`:t.maxValue&&D(e,t.maxValue)&&(u=`, ${o.format(`maximumDate`)}`);let d=i.length-l.length-u.length;if(!i.startsWith(c)||!i.endsWith(l+u)||d<c.length)return{isCurrentDate:!1,label:i};let f=i.slice(c.length,d);return{isCurrentDate:!1,label:(r?o.format(`dateSelected`,{date:f}):f)+u}}const Y=o((e,n)=>{let{autoFocus:r,className:a,defaultFocusedValue:o,defaultValue:s,disabled:c,firstDayOfWeek:m=`mon`,isDateUnavailable:g,labels:_,maxValue:v,minValue:b,onChange:x,selectionMode:C=`single`,unavailableDates:w,value:D,visibleMonths:O=1,...k}=e,{locale:A}=y(),j=u(null),M=t(j,n),N=l(()=>K(w,g),[w,g]),[P,F]=d({}),I=Object.values(P).some(e=>e!==`days`),L=e=>{x?.(e)},z=D,B=s,V=z===void 0?B:z,H=o??(C===`multiple`&&Array.isArray(V)&&V.length===0?ee(E()):void 0),q=S({autoFocus:r,createCalendar:T,defaultFocusedValue:H,defaultValue:B,firstDayOfWeek:m,isDateUnavailable:N,isDisabled:c,locale:A,maxValue:v,minValue:b,onChange:L,pageBehavior:`single`,selectionMode:C,value:z,visibleDuration:{months:O}}),J={"aria-label":k[`aria-label`],"aria-labelledby":k[`aria-labelledby`],autoFocus:r,defaultFocusedValue:H,defaultValue:B,isDateUnavailable:N,isDisabled:c,maxValue:v,minValue:b,onChange:L,selectionMode:C,value:z},{calendarProps:Y,prevButtonProps:Z,nextButtonProps:ne}=h(J,q),Q=i.createElement(G,{buttonProps:Z,direction:`prev`}),$=i.createElement(G,{buttonProps:ne,direction:`next`});return i.createElement(R,{labels:_},i.createElement(`div`,{...p(Y,k),className:f(`datepicker`,a),"data-cx-inline":`true`,ref:M},O===1?i.createElement(U,{monthStart:q.visibleRange.start,nextArrow:$,prevArrow:Q,state:q},i.createElement(W,{firstDayOfWeek:m,renderCell:(e,t,n,r)=>i.createElement(X,{date:e,isOutsideMonth:r,locale:A,state:q}),state:q})):i.createElement(i.Fragment,null,!I&&i.createElement(`div`,{className:`datepicker-controls`},Q,$),i.createElement(`div`,{className:`datepicker-grid`},[...Array(O).keys()].map(e=>i.createElement(te,{firstDayOfWeek:m,key:e,monthIndex:e,onViewChange:t=>F(n=>({...n,[e]:t})),renderCell:(e,t,n,r)=>i.createElement(X,{date:e,isOutsideMonth:r,locale:A,state:q}),state:q}))))))});Y.displayName=`Calendar`;const X=({date:e,isOutsideMonth:t,locale:n,state:r})=>{let a=u(null),{cellProps:o,buttonProps:s,isSelected:c,isOutsideVisibleRange:l,isDisabled:d,isUnavailable:p,formattedDate:m}=g({date:e,isOutsideMonth:t},r,a),{isCurrentDate:h,label:_}=J(e,r,c,s[`aria-label`]);return i.createElement(`div`,{...o,"aria-current":h?`date`:void 0,className:f(`datepicker-date`,{"datepicker-date-selected":c,"datepicker-date-today":h,"datepicker-date-outside":l||t,"datepicker-date-disabled":d,"datepicker-date-unavailable":p,"datepicker-date-weekend":A(e,n)})},i.createElement(`button`,{...s,"aria-label":_,type:`button`,className:`datepicker-date-btn`,ref:a,tabIndex:s.tabIndex??-1},m))},Z=o(({autoFocus:e,className:n,defaultFocusedValue:r,defaultValue:a,disabled:o,firstDayOfWeek:s=`mon`,isDateUnavailable:c,labels:m,maxValue:h,minValue:g,onChange:_,presets:v,unavailableDates:b,value:S,visibleMonths:w=1,...E},D)=>{let{locale:k}=y(),A=u(null),ee=t(A,D),P=l(()=>K(b,c),[b,c]),F=v&&v.length>0?v:null,[I,L]=d({}),z=Object.values(I).some(e=>e!==`days`),B=C({autoFocus:e,createCalendar:T,defaultFocusedValue:r,defaultValue:a,firstDayOfWeek:s,isDateUnavailable:P,isDisabled:o,locale:k,maxValue:h,minValue:g,onChange:_,pageBehavior:`single`,value:S,visibleDuration:{months:w}}),H={"aria-label":E[`aria-label`],"aria-labelledby":E[`aria-labelledby`],autoFocus:e,defaultFocusedValue:r,defaultValue:a,isDateUnavailable:P,isDisabled:o,maxValue:h,minValue:g,onChange:_,value:S},{calendarProps:U,prevButtonProps:W,nextButtonProps:q}=x(H,B,A),J=i.createElement(G,{buttonProps:W,direction:`prev`}),Y=i.createElement(G,{buttonProps:q,direction:`next`}),X=w===1?{next:Y,prev:J}:null,Z=e=>{let t=M(N(e.start),B.focusedDate.calendar),{end:n,start:r}=B.visibleRange;(t.compare(r)<0||t.compare(n)>0)&&V(B,j(t)),B.setAnchorDate(null),B.setValue(e)},Q=(e,t)=>!!(e&&O(e,t)&&B.isSelected(e));return i.createElement(R,{labels:m},i.createElement(`div`,{...p(U,E),className:f(`datepicker`,n),"data-cx-inline":`true`,ref:ee},i.createElement(`div`,{className:`datepicker-grid`},F&&i.createElement($,{disabled:B.isDisabled,onSelect:Z,presets:F,value:B.value}),i.createElement(`div`,{className:`datepicker-body`},w>1&&!z&&i.createElement(`div`,{className:`datepicker-controls`},J,Y),i.createElement(`div`,{className:`datepicker-grid`},[...Array(w).keys()].map(e=>{let t=B.visibleRange.start.add({months:e});return i.createElement(te,{arrows:e===0?X:null,firstDayOfWeek:s,key:e,monthIndex:e,onViewChange:t=>L(n=>({...n,[e]:t})),renderCell:(e,n,r,a)=>i.createElement(ne,{date:e,isBandEnd:!Q(r[n+1],t),isBandStart:!Q(r[n-1],t),isOutsideMonth:a,locale:k,state:B}),state:B})}))))))});Z.displayName=`RangeCalendar`;const ne=({date:t,isBandEnd:n,isBandStart:r,isOutsideMonth:a,locale:o,state:s})=>{let c=u(null),{cellProps:l,buttonProps:d,isSelected:m,isOutsideVisibleRange:h,isDisabled:_,isUnavailable:v,formattedDate:y}=g({date:t,isOutsideMonth:a},s,c),{highlightedRange:b}=s,x=!!(b&&D(t,b.start)),S=!!(b&&D(t,b.end)),{isCurrentDate:C,label:w}=J(t,s,m,d[`aria-label`]);return i.createElement(`div`,{...l,"aria-current":C?`date`:void 0,className:f(`datepicker-date`,{"datepicker-date-today":C,"datepicker-date-in-range":m,"datepicker-date-range-start":m&&(x||r),"datepicker-date-range-end":m&&(S||n),"datepicker-date-outside":h||a,"datepicker-date-disabled":_,"datepicker-date-unavailable":v,"datepicker-date-weekend":A(t,o)})},i.createElement(`button`,{...p(d,{"aria-label":w,onPointerEnter:()=>{s.anchorDate&&c.current&&e(c.current)},tabIndex:d.tabIndex??-1}),type:`button`,className:f(`datepicker-date-btn`,{"datepicker-date-range-start":m&&x,"datepicker-date-range-end":m&&S}),ref:c},y))},Q=(e,t)=>D(e.start,t.start)&&D(e.end,t.end),$=({disabled:e,onSelect:t,presets:n,value:r})=>i.createElement(`ul`,{className:`datepicker-presets`},n.map(n=>{let a=!!(r&&Q(r,n.range));return i.createElement(`li`,{key:n.label},i.createElement(`button`,{"aria-current":a?`true`:void 0,className:f(`datepicker-preset`,{selected:a}),disabled:e,onClick:()=>t(n.range),type:`button`},n.label))}));export{F as a,R as i,Y as n,L as o,K as r,Z as t};
|
|
2
|
+
//# sourceMappingURL=RangeCalendar-BJl-j4W2.js.map
|