@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
|
@@ -1,142 +0,0 @@
|
|
|
1
|
-
import React, {
|
|
2
|
-
ElementType,
|
|
3
|
-
ForwardRefRenderFunction,
|
|
4
|
-
ReactElement,
|
|
5
|
-
ReactNode,
|
|
6
|
-
useContext,
|
|
7
|
-
useEffect
|
|
8
|
-
} from 'react'
|
|
9
|
-
import { createPortal } from 'react-dom'
|
|
10
|
-
import classNames from 'classnames'
|
|
11
|
-
|
|
12
|
-
import { useForkedRef } from '../../hooks'
|
|
13
|
-
import { renderMenuItemContent } from '../../utils/renderMenuItemContent'
|
|
14
|
-
import {
|
|
15
|
-
createPolymorphicComponent,
|
|
16
|
-
PolymorphicComponentProps,
|
|
17
|
-
PolymorphicRef
|
|
18
|
-
} from '../../utils/polymorphic'
|
|
19
|
-
import { MenuContext } from './Menu'
|
|
20
|
-
import { MenuDivider } from './MenuDivider'
|
|
21
|
-
import { MenuHeader } from './MenuHeader'
|
|
22
|
-
import { MenuItem } from './MenuItem'
|
|
23
|
-
import { MenuItemsDef } from './MenuItemDef'
|
|
24
|
-
import { focusMenuItem, getMenuItems, handleMenuKeyDown } from './menuNavigation'
|
|
25
|
-
import { SubmenuGroupContext, useSubmenuGroupProvider } from './submenuGroup'
|
|
26
|
-
|
|
27
|
-
type MenuListOwnProps<C extends ElementType> = {
|
|
28
|
-
/**
|
|
29
|
-
* A string of all className you want applied to the base component.
|
|
30
|
-
*/
|
|
31
|
-
className?: string
|
|
32
|
-
/**
|
|
33
|
-
* Component used for the root node. Either a string to use a HTML element or a component.
|
|
34
|
-
*/
|
|
35
|
-
component?: C
|
|
36
|
-
/**
|
|
37
|
-
* Array of item/header/divider definitions for data-driven rendering. When provided, children
|
|
38
|
-
* are ignored. Covers flat items, headers, and dividers only — for nested submenus, compose
|
|
39
|
-
* with `children` and `MenuSubmenu` instead.
|
|
40
|
-
*/
|
|
41
|
-
items?: MenuItemsDef
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
export type MenuListProps<C extends ElementType = 'div'> = PolymorphicComponentProps<
|
|
45
|
-
C,
|
|
46
|
-
MenuListOwnProps<C>
|
|
47
|
-
>
|
|
48
|
-
|
|
49
|
-
type MenuListComponent = (<C extends ElementType = 'div'>(
|
|
50
|
-
props: MenuListProps<C> & { ref?: PolymorphicRef<C> }
|
|
51
|
-
) => ReactElement | null) & { displayName?: string }
|
|
52
|
-
|
|
53
|
-
const renderMenuItemDef = (def: MenuItemsDef[number]): ReactNode => {
|
|
54
|
-
if (def.type === 'header') {
|
|
55
|
-
return <MenuHeader key={def.id}>{def.label}</MenuHeader>
|
|
56
|
-
}
|
|
57
|
-
if (def.type === 'divider') {
|
|
58
|
-
return <MenuDivider key={def.id} />
|
|
59
|
-
}
|
|
60
|
-
return (
|
|
61
|
-
<MenuItem
|
|
62
|
-
key={def.id}
|
|
63
|
-
component={def.href ? 'a' : 'button'}
|
|
64
|
-
href={def.href}
|
|
65
|
-
disabled={def.disabled}
|
|
66
|
-
selected={def.selected}
|
|
67
|
-
onClick={def.onClick}
|
|
68
|
-
>
|
|
69
|
-
{renderMenuItemContent({
|
|
70
|
-
icon: def.icon,
|
|
71
|
-
label: def.label,
|
|
72
|
-
description: def.description,
|
|
73
|
-
selected: def.selected
|
|
74
|
-
})}
|
|
75
|
-
</MenuItem>
|
|
76
|
-
)
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
function MenuListRender<C extends ElementType = 'div'>(
|
|
80
|
-
{ children, className, component, items, onKeyDown, ...rest }: MenuListProps<C>,
|
|
81
|
-
ref: PolymorphicRef<C>
|
|
82
|
-
) {
|
|
83
|
-
const Component = component ?? 'div'
|
|
84
|
-
const {
|
|
85
|
-
close,
|
|
86
|
-
container,
|
|
87
|
-
focusStrategy,
|
|
88
|
-
menuId,
|
|
89
|
-
menuStyle,
|
|
90
|
-
overlayRef,
|
|
91
|
-
placementAttr,
|
|
92
|
-
triggerId,
|
|
93
|
-
visible
|
|
94
|
-
} = useContext(MenuContext)
|
|
95
|
-
const forkedRef = useForkedRef(ref, overlayRef)
|
|
96
|
-
const submenuGroup = useSubmenuGroupProvider()
|
|
97
|
-
|
|
98
|
-
// ArrowDown/ArrowUp on the trigger opens the menu with a focus strategy (see `Menu`'s
|
|
99
|
-
// `useMenuTrigger` wiring) — this is where that intent actually lands, since we're not
|
|
100
|
-
// adopting `useMenu`'s own collection-aware auto-focus.
|
|
101
|
-
useEffect(() => {
|
|
102
|
-
if (!visible || !focusStrategy) return
|
|
103
|
-
focusMenuItem(getMenuItems(overlayRef.current), focusStrategy === 'last' ? 'last' : 'first')
|
|
104
|
-
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
105
|
-
}, [visible, focusStrategy])
|
|
106
|
-
|
|
107
|
-
const handleKeyDown = (event: React.KeyboardEvent<HTMLElement>) => {
|
|
108
|
-
handleMenuKeyDown(event, { onEscape: close })
|
|
109
|
-
onKeyDown?.(event as React.KeyboardEvent<HTMLDivElement>)
|
|
110
|
-
}
|
|
111
|
-
|
|
112
|
-
const content = (
|
|
113
|
-
<Component
|
|
114
|
-
role="menu"
|
|
115
|
-
id={menuId}
|
|
116
|
-
aria-labelledby={triggerId}
|
|
117
|
-
className={classNames('menu', { show: visible }, className)}
|
|
118
|
-
style={menuStyle}
|
|
119
|
-
data-cx-placement={placementAttr}
|
|
120
|
-
aria-hidden={!visible}
|
|
121
|
-
{...rest}
|
|
122
|
-
onKeyDown={handleKeyDown}
|
|
123
|
-
ref={forkedRef}
|
|
124
|
-
>
|
|
125
|
-
<SubmenuGroupContext.Provider value={submenuGroup}>
|
|
126
|
-
{items ? items.map(renderMenuItemDef) : children}
|
|
127
|
-
</SubmenuGroupContext.Provider>
|
|
128
|
-
</Component>
|
|
129
|
-
)
|
|
130
|
-
|
|
131
|
-
if (container) {
|
|
132
|
-
if (typeof window === 'undefined') return null
|
|
133
|
-
return createPortal(content, container === true ? document.body : container)
|
|
134
|
-
}
|
|
135
|
-
|
|
136
|
-
return content
|
|
137
|
-
}
|
|
138
|
-
|
|
139
|
-
export const MenuList = createPolymorphicComponent<MenuListComponent>(
|
|
140
|
-
MenuListRender as ForwardRefRenderFunction<Element, MenuListProps<ElementType>>,
|
|
141
|
-
'MenuList'
|
|
142
|
-
)
|
|
@@ -1,284 +0,0 @@
|
|
|
1
|
-
import React, {
|
|
2
|
-
forwardRef,
|
|
3
|
-
HTMLAttributes,
|
|
4
|
-
ReactNode,
|
|
5
|
-
useCallback,
|
|
6
|
-
useContext,
|
|
7
|
-
useEffect,
|
|
8
|
-
useId,
|
|
9
|
-
useRef,
|
|
10
|
-
useState
|
|
11
|
-
} from 'react'
|
|
12
|
-
import { createPortal } from 'react-dom'
|
|
13
|
-
import classNames from 'classnames'
|
|
14
|
-
import { useLocale, useOverlayPosition } from 'react-aria'
|
|
15
|
-
|
|
16
|
-
import { MenuContext } from './Menu'
|
|
17
|
-
import {
|
|
18
|
-
Placement,
|
|
19
|
-
resolveMenuOverlayPositioning,
|
|
20
|
-
toAriaPlacement
|
|
21
|
-
} from '../../utils/overlayPlacement'
|
|
22
|
-
import { focusMenuItem, getMenuItems, handleMenuKeyDown } from './menuNavigation'
|
|
23
|
-
import { SubmenuActionsContext, SubmenuGroupContext, useSubmenuGroupProvider } from './submenuGroup'
|
|
24
|
-
|
|
25
|
-
export interface MenuSubmenuProps extends Omit<HTMLAttributes<HTMLDivElement>, 'onSelect'> {
|
|
26
|
-
/**
|
|
27
|
-
* MenuSubmenu activation mode on hover-capable devices. `'click'` activates on click only.
|
|
28
|
-
* `'hover'` activates on hover only. `'both'` (the default) activates on both. Touch
|
|
29
|
-
* devices always use tap regardless of this setting.
|
|
30
|
-
*/
|
|
31
|
-
activation?: 'click' | 'hover' | 'both'
|
|
32
|
-
/**
|
|
33
|
-
* A string of all className you want applied to the base component.
|
|
34
|
-
*/
|
|
35
|
-
className?: string
|
|
36
|
-
/**
|
|
37
|
-
* Prevents the submenu from opening.
|
|
38
|
-
*/
|
|
39
|
-
disabled?: boolean
|
|
40
|
-
/**
|
|
41
|
-
* Distance between the nested menu and the trigger, as `[skidding, distance]` in pixels.
|
|
42
|
-
*/
|
|
43
|
-
offset?: [number, number]
|
|
44
|
-
/**
|
|
45
|
-
* Placement of the nested menu relative to the trigger. Defaults to cascading in the reading
|
|
46
|
-
* direction — `'right-start'` under LTR locales, `'left-start'` under RTL ones (see
|
|
47
|
-
* `useLocale`) — matching native OS/browser submenu behavior. An explicit value always wins
|
|
48
|
-
* over that locale-based default.
|
|
49
|
-
*/
|
|
50
|
-
placement?: Placement
|
|
51
|
-
/**
|
|
52
|
-
* Switches to a view-replacement pattern below the `sm` breakpoint. Pair with a
|
|
53
|
-
* `MenuSubmenuBack` as the first item of the nested menu.
|
|
54
|
-
*/
|
|
55
|
-
stacked?: boolean
|
|
56
|
-
/**
|
|
57
|
-
* Milliseconds before closing the submenu when the pointer leaves it.
|
|
58
|
-
*/
|
|
59
|
-
submenuDelay?: number
|
|
60
|
-
/**
|
|
61
|
-
* Content of the `.menu-item` trigger that opens the submenu.
|
|
62
|
-
*/
|
|
63
|
-
trigger: ReactNode
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
export const MenuSubmenu = forwardRef<HTMLDivElement, MenuSubmenuProps>(
|
|
67
|
-
(
|
|
68
|
-
{
|
|
69
|
-
children,
|
|
70
|
-
activation = 'both',
|
|
71
|
-
className,
|
|
72
|
-
disabled,
|
|
73
|
-
offset: offsetProp = [-4, 0],
|
|
74
|
-
placement,
|
|
75
|
-
stacked,
|
|
76
|
-
submenuDelay = 100,
|
|
77
|
-
trigger,
|
|
78
|
-
...rest
|
|
79
|
-
},
|
|
80
|
-
ref
|
|
81
|
-
) => {
|
|
82
|
-
const id = useId()
|
|
83
|
-
const triggerId = `${id}-trigger`
|
|
84
|
-
const menuId = `${id}-menu`
|
|
85
|
-
const [visible, setVisible] = useState(false)
|
|
86
|
-
// Portaling is only safe once mounted on the client: during SSR (and the initial client
|
|
87
|
-
// hydration pass, which must match the server-rendered markup) the panel renders inline next
|
|
88
|
-
// to its trigger, then moves to `document.body` on the next render once this flips to true.
|
|
89
|
-
const [mounted, setMounted] = useState(false)
|
|
90
|
-
const closeTimeoutRef = useRef<number | undefined>(undefined)
|
|
91
|
-
const focusFirstRafRef = useRef<number | undefined>(undefined)
|
|
92
|
-
const triggerRef = useRef<HTMLButtonElement | null>(null)
|
|
93
|
-
const overlayRef = useRef<HTMLElement | null>(null)
|
|
94
|
-
const parentGroup = useContext(SubmenuGroupContext)
|
|
95
|
-
const ownGroup = useSubmenuGroupProvider()
|
|
96
|
-
const { registerOverlay, visible: parentMenuVisible } = useContext(MenuContext)
|
|
97
|
-
const { direction } = useLocale()
|
|
98
|
-
const isRtl = direction === 'rtl'
|
|
99
|
-
const effectivePlacement = placement ?? (isRtl ? 'left-start' : 'right-start')
|
|
100
|
-
|
|
101
|
-
const { overlayProps, placement: resolvedPlacement } = useOverlayPosition({
|
|
102
|
-
targetRef: triggerRef,
|
|
103
|
-
overlayRef,
|
|
104
|
-
// Viewport-relative (matching the portal below): the trigger lives inside the parent
|
|
105
|
-
// menu's own floated panel, and `useOverlayPosition` measures against the overlay's real
|
|
106
|
-
// containing block — since the panel portals straight to `document.body`, that resolves
|
|
107
|
-
// the same way a `fixed`-strategy engine would.
|
|
108
|
-
placement: toAriaPlacement(effectivePlacement),
|
|
109
|
-
offset: offsetProp[1],
|
|
110
|
-
crossOffset: offsetProp[0],
|
|
111
|
-
containerPadding: 8,
|
|
112
|
-
isOpen: visible,
|
|
113
|
-
// See `useOverlayPlacement`'s comment for why this needs to be explicit `null`, not left
|
|
114
|
-
// unset — matches the same fix already applied to `Autocomplete`/`Combobox`/`Menu`/`Popover`.
|
|
115
|
-
onClose: null
|
|
116
|
-
})
|
|
117
|
-
|
|
118
|
-
const { menuStyle, placementAttr } = resolveMenuOverlayPositioning(
|
|
119
|
-
overlayProps.style,
|
|
120
|
-
effectivePlacement,
|
|
121
|
-
resolvedPlacement
|
|
122
|
-
)
|
|
123
|
-
|
|
124
|
-
const clearCloseTimeout = useCallback(() => {
|
|
125
|
-
if (closeTimeoutRef.current !== undefined) {
|
|
126
|
-
window.clearTimeout(closeTimeoutRef.current)
|
|
127
|
-
closeTimeoutRef.current = undefined
|
|
128
|
-
}
|
|
129
|
-
}, [])
|
|
130
|
-
|
|
131
|
-
const cancelFocusFirstRaf = useCallback(() => {
|
|
132
|
-
if (focusFirstRafRef.current !== undefined) {
|
|
133
|
-
cancelAnimationFrame(focusFirstRafRef.current)
|
|
134
|
-
focusFirstRafRef.current = undefined
|
|
135
|
-
}
|
|
136
|
-
}, [])
|
|
137
|
-
|
|
138
|
-
const close = useCallback(() => {
|
|
139
|
-
clearCloseTimeout()
|
|
140
|
-
cancelFocusFirstRaf()
|
|
141
|
-
setVisible(false)
|
|
142
|
-
}, [clearCloseTimeout, cancelFocusFirstRaf])
|
|
143
|
-
|
|
144
|
-
const open = () => {
|
|
145
|
-
if (disabled || visible) return
|
|
146
|
-
clearCloseTimeout()
|
|
147
|
-
parentGroup?.notifyOpen(id)
|
|
148
|
-
setVisible(true)
|
|
149
|
-
}
|
|
150
|
-
|
|
151
|
-
const scheduleClose = () => {
|
|
152
|
-
clearCloseTimeout()
|
|
153
|
-
closeTimeoutRef.current = window.setTimeout(close, submenuDelay)
|
|
154
|
-
}
|
|
155
|
-
|
|
156
|
-
useEffect(() => parentGroup?.register(id, close), [parentGroup, id, close])
|
|
157
|
-
useEffect(() => clearCloseTimeout, [clearCloseTimeout])
|
|
158
|
-
useEffect(() => cancelFocusFirstRaf, [cancelFocusFirstRaf])
|
|
159
|
-
useEffect(() => setMounted(true), [])
|
|
160
|
-
|
|
161
|
-
// The submenu's own open state is local and doesn't otherwise hear about its ancestor
|
|
162
|
-
// `Menu` closing (via Escape, outside click, etc.) — without this it's left open and
|
|
163
|
-
// fully visible (it's portaled to `document.body`, so nothing hides it for free) even
|
|
164
|
-
// after the menu it belongs to has disappeared.
|
|
165
|
-
useEffect(() => {
|
|
166
|
-
if (!parentMenuVisible) close()
|
|
167
|
-
}, [parentMenuVisible, close])
|
|
168
|
-
|
|
169
|
-
const supportsHover =
|
|
170
|
-
typeof window !== 'undefined' &&
|
|
171
|
-
!!window.matchMedia &&
|
|
172
|
-
window.matchMedia('(hover: hover)').matches
|
|
173
|
-
const hoverEnabled = supportsHover && (activation === 'hover' || activation === 'both')
|
|
174
|
-
const clickEnabled = activation === 'click' || activation === 'both'
|
|
175
|
-
|
|
176
|
-
const openAndFocusFirst = () => {
|
|
177
|
-
open()
|
|
178
|
-
cancelFocusFirstRaf()
|
|
179
|
-
focusFirstRafRef.current = requestAnimationFrame(() => {
|
|
180
|
-
focusFirstRafRef.current = undefined
|
|
181
|
-
focusMenuItem(getMenuItems(overlayRef.current), 'first')
|
|
182
|
-
})
|
|
183
|
-
}
|
|
184
|
-
|
|
185
|
-
const closeAndRefocusTrigger = () => {
|
|
186
|
-
close()
|
|
187
|
-
triggerRef.current?.focus()
|
|
188
|
-
}
|
|
189
|
-
|
|
190
|
-
const handleTriggerClick = (event: React.MouseEvent<HTMLButtonElement>) => {
|
|
191
|
-
if (!clickEnabled || disabled) return
|
|
192
|
-
event.preventDefault()
|
|
193
|
-
event.stopPropagation()
|
|
194
|
-
visible ? close() : openAndFocusFirst()
|
|
195
|
-
}
|
|
196
|
-
|
|
197
|
-
// A submenu cascades toward the reading direction, so the arrow key that opens it (and the
|
|
198
|
-
// one its own item list closes on, below) mirror too: ArrowRight/ArrowLeft under LTR,
|
|
199
|
-
// ArrowLeft/ArrowRight under RTL.
|
|
200
|
-
const openKey = isRtl ? 'ArrowLeft' : 'ArrowRight'
|
|
201
|
-
|
|
202
|
-
const handleTriggerKeyDown = (event: React.KeyboardEvent<HTMLButtonElement>) => {
|
|
203
|
-
if (disabled) return
|
|
204
|
-
if (event.key === 'Enter' || event.key === ' ' || event.key === openKey) {
|
|
205
|
-
event.preventDefault()
|
|
206
|
-
event.stopPropagation()
|
|
207
|
-
openAndFocusFirst()
|
|
208
|
-
}
|
|
209
|
-
}
|
|
210
|
-
|
|
211
|
-
const actionsValue = { close: closeAndRefocusTrigger }
|
|
212
|
-
|
|
213
|
-
return (
|
|
214
|
-
<div className={classNames('submenu', { show: visible }, className)} {...rest} ref={ref}>
|
|
215
|
-
<button
|
|
216
|
-
type="button"
|
|
217
|
-
id={triggerId}
|
|
218
|
-
role="menuitem"
|
|
219
|
-
className="menu-item"
|
|
220
|
-
aria-expanded={visible}
|
|
221
|
-
aria-haspopup="true"
|
|
222
|
-
aria-controls={visible ? menuId : undefined}
|
|
223
|
-
disabled={disabled}
|
|
224
|
-
onClick={handleTriggerClick}
|
|
225
|
-
onKeyDown={handleTriggerKeyDown}
|
|
226
|
-
onMouseEnter={hoverEnabled ? open : undefined}
|
|
227
|
-
onMouseLeave={hoverEnabled ? scheduleClose : undefined}
|
|
228
|
-
ref={(node) => {
|
|
229
|
-
triggerRef.current = node
|
|
230
|
-
}}
|
|
231
|
-
>
|
|
232
|
-
{trigger}
|
|
233
|
-
</button>
|
|
234
|
-
{(() => {
|
|
235
|
-
const panel = (
|
|
236
|
-
<div
|
|
237
|
-
role="menu"
|
|
238
|
-
id={menuId}
|
|
239
|
-
aria-labelledby={triggerId}
|
|
240
|
-
className={classNames('menu', { show: visible, 'submenu-stacked': stacked })}
|
|
241
|
-
style={menuStyle}
|
|
242
|
-
data-cx-placement={placementAttr}
|
|
243
|
-
aria-hidden={!visible}
|
|
244
|
-
onKeyDown={(event) =>
|
|
245
|
-
handleMenuKeyDown(event, {
|
|
246
|
-
onEscape: closeAndRefocusTrigger,
|
|
247
|
-
...(isRtl
|
|
248
|
-
? { onArrowRight: closeAndRefocusTrigger }
|
|
249
|
-
: { onArrowLeft: closeAndRefocusTrigger })
|
|
250
|
-
})
|
|
251
|
-
}
|
|
252
|
-
onMouseEnter={hoverEnabled ? clearCloseTimeout : undefined}
|
|
253
|
-
onMouseLeave={hoverEnabled ? scheduleClose : undefined}
|
|
254
|
-
// Registers this panel with the ancestor `Menu` (see `MenuContext.registerOverlay`)
|
|
255
|
-
// so its own click-dismiss logic recognizes clicks here as "inside" the menu — the
|
|
256
|
-
// panel portals straight to `document.body` when not `stacked`, so plain DOM
|
|
257
|
-
// containment against the top-level menu's own element wouldn't otherwise see it.
|
|
258
|
-
ref={(node) => {
|
|
259
|
-
overlayRef.current = node
|
|
260
|
-
registerOverlay(menuId, node)
|
|
261
|
-
}}
|
|
262
|
-
>
|
|
263
|
-
<SubmenuActionsContext.Provider value={actionsValue}>
|
|
264
|
-
<SubmenuGroupContext.Provider value={ownGroup}>
|
|
265
|
-
{children}
|
|
266
|
-
</SubmenuGroupContext.Provider>
|
|
267
|
-
</SubmenuActionsContext.Provider>
|
|
268
|
-
</div>
|
|
269
|
-
)
|
|
270
|
-
|
|
271
|
-
// `stacked`'s sm-breakpoint CSS (`.menu:has(.submenu-stacked.show) ...`) needs the
|
|
272
|
-
// panel to be a real DOM descendant of `.menu`/`.submenu` to match — portaling would
|
|
273
|
-
// break that ancestor relationship, so it renders inline instead. Trade-off: above the
|
|
274
|
-
// `sm` breakpoint a `stacked` submenu no longer escapes ancestor overflow/stacking-
|
|
275
|
-
// context clipping the way a portaled one does; accepted since `stacked` targets mobile
|
|
276
|
-
// nav/drawer usage, not floating dropdowns.
|
|
277
|
-
return mounted && !stacked ? createPortal(panel, document.body) : panel
|
|
278
|
-
})()}
|
|
279
|
-
</div>
|
|
280
|
-
)
|
|
281
|
-
}
|
|
282
|
-
)
|
|
283
|
-
|
|
284
|
-
MenuSubmenu.displayName = 'MenuSubmenu'
|
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
import React, { ButtonHTMLAttributes, forwardRef, useContext } from 'react'
|
|
2
|
-
import classNames from 'classnames'
|
|
3
|
-
|
|
4
|
-
import { SubmenuActionsContext } from './submenuGroup'
|
|
5
|
-
|
|
6
|
-
export interface MenuSubmenuBackProps extends ButtonHTMLAttributes<HTMLButtonElement> {
|
|
7
|
-
/**
|
|
8
|
-
* A string of all className you want applied to the component.
|
|
9
|
-
*/
|
|
10
|
-
className?: string
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
// First item of a stacked submenu's nested menu (see `MenuSubmenu`'s `stacked` prop). Closes
|
|
14
|
-
// the submenu and returns focus to its trigger — visible only below the `sm` breakpoint.
|
|
15
|
-
export const MenuSubmenuBack = forwardRef<HTMLButtonElement, MenuSubmenuBackProps>(
|
|
16
|
-
({ children, className, onClick, type = 'button', ...rest }, ref) => {
|
|
17
|
-
const actions = useContext(SubmenuActionsContext)
|
|
18
|
-
|
|
19
|
-
const handleClick = (event: React.MouseEvent<HTMLButtonElement>) => {
|
|
20
|
-
onClick?.(event)
|
|
21
|
-
actions?.close()
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
return (
|
|
25
|
-
<button
|
|
26
|
-
type={type}
|
|
27
|
-
role="menuitem"
|
|
28
|
-
className={classNames('submenu-back', 'menu-item', className)}
|
|
29
|
-
{...rest}
|
|
30
|
-
onClick={handleClick}
|
|
31
|
-
ref={ref}
|
|
32
|
-
>
|
|
33
|
-
{children}
|
|
34
|
-
</button>
|
|
35
|
-
)
|
|
36
|
-
}
|
|
37
|
-
)
|
|
38
|
-
|
|
39
|
-
MenuSubmenuBack.displayName = 'MenuSubmenuBack'
|
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
import React, { ElementType, ForwardRefRenderFunction, ReactElement } from 'react'
|
|
2
|
-
import classNames from 'classnames'
|
|
3
|
-
|
|
4
|
-
import {
|
|
5
|
-
createPolymorphicComponent,
|
|
6
|
-
PolymorphicComponentProps,
|
|
7
|
-
PolymorphicRef
|
|
8
|
-
} from '../../utils/polymorphic'
|
|
9
|
-
|
|
10
|
-
type MenuTextOwnProps<C extends ElementType> = {
|
|
11
|
-
/**
|
|
12
|
-
* A string of all className you want applied to the component.
|
|
13
|
-
*/
|
|
14
|
-
className?: string
|
|
15
|
-
/**
|
|
16
|
-
* Component used for the root node. Either a string to use a HTML element or a component.
|
|
17
|
-
*/
|
|
18
|
-
component?: C
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
export type MenuTextProps<C extends ElementType = 'span'> = PolymorphicComponentProps<
|
|
22
|
-
C,
|
|
23
|
-
MenuTextOwnProps<C>
|
|
24
|
-
>
|
|
25
|
-
|
|
26
|
-
type MenuTextComponent = (<C extends ElementType = 'span'>(
|
|
27
|
-
props: MenuTextProps<C> & { ref?: PolymorphicRef<C> }
|
|
28
|
-
) => ReactElement | null) & { displayName?: string }
|
|
29
|
-
|
|
30
|
-
function MenuTextRender<C extends ElementType = 'span'>(
|
|
31
|
-
{ children, className, component, ...rest }: MenuTextProps<C>,
|
|
32
|
-
ref: PolymorphicRef<C>
|
|
33
|
-
) {
|
|
34
|
-
const Component = component ?? 'span'
|
|
35
|
-
const _className = classNames('menu-text', className)
|
|
36
|
-
|
|
37
|
-
return (
|
|
38
|
-
<Component className={_className} {...rest} ref={ref}>
|
|
39
|
-
{children}
|
|
40
|
-
</Component>
|
|
41
|
-
)
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
export const MenuText = createPolymorphicComponent<MenuTextComponent>(
|
|
45
|
-
MenuTextRender as ForwardRefRenderFunction<Element, MenuTextProps<ElementType>>,
|
|
46
|
-
'MenuText'
|
|
47
|
-
)
|
|
@@ -1,148 +0,0 @@
|
|
|
1
|
-
import React, {
|
|
2
|
-
ElementType,
|
|
3
|
-
ForwardRefRenderFunction,
|
|
4
|
-
ReactElement,
|
|
5
|
-
useContext,
|
|
6
|
-
useRef
|
|
7
|
-
} from 'react'
|
|
8
|
-
import classNames from 'classnames'
|
|
9
|
-
import { mergeProps, useButton } from 'react-aria'
|
|
10
|
-
|
|
11
|
-
import { Button } from '../button/Button'
|
|
12
|
-
import { MenuContext } from './Menu'
|
|
13
|
-
import { ContextColor, ContextStyle, Shapes } from '../../types'
|
|
14
|
-
import {
|
|
15
|
-
createPolymorphicComponent,
|
|
16
|
-
PolymorphicComponentProps,
|
|
17
|
-
PolymorphicRef
|
|
18
|
-
} from '../../utils/polymorphic'
|
|
19
|
-
import { useForkedRef } from '../../hooks'
|
|
20
|
-
|
|
21
|
-
type MenuToggleOwnProps<C extends ElementType> = {
|
|
22
|
-
/**
|
|
23
|
-
* Toggle the active state for the component.
|
|
24
|
-
*/
|
|
25
|
-
active?: boolean
|
|
26
|
-
/**
|
|
27
|
-
* A string of all className you want applied to the base component.
|
|
28
|
-
*/
|
|
29
|
-
className?: string
|
|
30
|
-
/**
|
|
31
|
-
* Sets the color of the component to one of Chassis context colors. Only applies to the
|
|
32
|
-
* default `Button` root.
|
|
33
|
-
*/
|
|
34
|
-
color?: ContextColor
|
|
35
|
-
/**
|
|
36
|
-
* Component used for the root node — the trigger element the menu opens from. Defaults to
|
|
37
|
-
* `Button`; swap for e.g. `NavLink` to render a nav-item-style trigger (`.nav-link.caret`)
|
|
38
|
-
* instead of a `.button.caret`. Its own props are type-checked at the call site once passed
|
|
39
|
-
* here.
|
|
40
|
-
*/
|
|
41
|
-
component?: C
|
|
42
|
-
/**
|
|
43
|
-
* Toggle the disabled state for the component.
|
|
44
|
-
*/
|
|
45
|
-
disabled?: boolean
|
|
46
|
-
/**
|
|
47
|
-
* The href attribute specifies the URL of the page the link goes to.
|
|
48
|
-
*/
|
|
49
|
-
href?: string
|
|
50
|
-
/**
|
|
51
|
-
* Select the shape of the component. Only applies to the default `Button` root.
|
|
52
|
-
*/
|
|
53
|
-
shape?: Shapes
|
|
54
|
-
/**
|
|
55
|
-
* Size the component sm or lg. Only applies to the default `Button` root.
|
|
56
|
-
*/
|
|
57
|
-
size?: 'sm' | 'lg'
|
|
58
|
-
/**
|
|
59
|
-
* Sets the context style of the component. Only applies to the default `Button` root.
|
|
60
|
-
*/
|
|
61
|
-
variant?: ContextStyle
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
export type MenuToggleProps<C extends ElementType = typeof Button> = PolymorphicComponentProps<
|
|
65
|
-
C,
|
|
66
|
-
MenuToggleOwnProps<C>
|
|
67
|
-
>
|
|
68
|
-
|
|
69
|
-
type MenuToggleComponent = (<C extends ElementType = typeof Button>(
|
|
70
|
-
props: MenuToggleProps<C> & { ref?: PolymorphicRef<C> }
|
|
71
|
-
) => ReactElement | null) & { displayName?: string }
|
|
72
|
-
|
|
73
|
-
function MenuToggleRender<C extends ElementType = typeof Button>(
|
|
74
|
-
{ children, className, component, onClick, onKeyDown, ...rest }: MenuToggleProps<C>,
|
|
75
|
-
ref: PolymorphicRef<C>
|
|
76
|
-
) {
|
|
77
|
-
const { hide, menuTriggerProps, reference, targetRef, toggleNodeRef, visible } =
|
|
78
|
-
useContext(MenuContext)
|
|
79
|
-
const Component = component ?? Button
|
|
80
|
-
const buttonRef = useRef<HTMLButtonElement | null>(null)
|
|
81
|
-
// `elementType` tells react-aria whether the rendered root already has native button
|
|
82
|
-
// semantics (`Button`, defaulting to `<button>`) or needs them emulated (`role="button"`,
|
|
83
|
-
// keyboard activation) — anything else swapped in via `component` (e.g. `NavLink`, which
|
|
84
|
-
// defaults to `<a>`) falls into the latter case.
|
|
85
|
-
const { buttonProps } = useButton(
|
|
86
|
-
{ ...menuTriggerProps, elementType: Component === Button ? 'button' : 'a' },
|
|
87
|
-
buttonRef
|
|
88
|
-
)
|
|
89
|
-
const wasOpenRef = useRef(false)
|
|
90
|
-
|
|
91
|
-
const setRefs = (node: HTMLButtonElement | null) => {
|
|
92
|
-
buttonRef.current = node
|
|
93
|
-
toggleNodeRef.current = node
|
|
94
|
-
if (reference !== 'parent') {
|
|
95
|
-
targetRef.current = node
|
|
96
|
-
}
|
|
97
|
-
}
|
|
98
|
-
|
|
99
|
-
const forkedRef = useForkedRef(ref, setRefs)
|
|
100
|
-
|
|
101
|
-
// react-aria's `useMenuTrigger` opens (rather than toggles) on mouse/pen press start, so
|
|
102
|
-
// re-clicking an already-open trigger would otherwise re-open it right back instead of
|
|
103
|
-
// closing it. Capture whether it was open before that happens — ours has to run ahead of
|
|
104
|
-
// `buttonProps`' own `onPointerDown` in the `mergeProps` chain below — then close it back
|
|
105
|
-
// down on click. Touch is exempt: react-aria's `onPress` already toggles it correctly there.
|
|
106
|
-
const handlePointerDown = (event: React.PointerEvent<HTMLButtonElement>) => {
|
|
107
|
-
wasOpenRef.current = event.pointerType !== 'touch' && visible
|
|
108
|
-
}
|
|
109
|
-
|
|
110
|
-
const handleClick = (event: React.MouseEvent<HTMLButtonElement>) => {
|
|
111
|
-
event.preventDefault()
|
|
112
|
-
event.stopPropagation()
|
|
113
|
-
if (wasOpenRef.current) {
|
|
114
|
-
wasOpenRef.current = false
|
|
115
|
-
hide()
|
|
116
|
-
}
|
|
117
|
-
onClick?.(event)
|
|
118
|
-
}
|
|
119
|
-
|
|
120
|
-
return (
|
|
121
|
-
<Component
|
|
122
|
-
// Only the default `Button` root needs an explicit `type` to avoid an implicit form
|
|
123
|
-
// submit — other roots (e.g. `NavLink`, a raw `'button'` string) either don't render a
|
|
124
|
-
// `<button>` at all or already accept `type` as one of their own passthrough props.
|
|
125
|
-
{...(Component === Button ? { type: 'button' } : {})}
|
|
126
|
-
// The `.caret` utility (rather than styling off `[data-cx-toggle="menu"]`, as the vanilla
|
|
127
|
-
// CSS docs show) keeps this element from also matching Chassis CSS's own vanilla menu.js
|
|
128
|
-
// selectors on a page that happens to load both — this component reimplements all of that
|
|
129
|
-
// behavior itself, so there's nothing for the vanilla plugin to usefully do with it anyway.
|
|
130
|
-
// `show` mirrors `MenuList`'s own `{ show: visible }` and vanilla menu.js's
|
|
131
|
-
// `this._element.classList.add('show')` — it's what puts the trigger itself into a
|
|
132
|
-
// pressed look while its menu is open (`.button.show`/`.nav-item.show .nav-link`).
|
|
133
|
-
className={classNames('caret', { show: visible }, className)}
|
|
134
|
-
{...(mergeProps({ onPointerDown: handlePointerDown }, rest, buttonProps, {
|
|
135
|
-
onClick: handleClick,
|
|
136
|
-
onKeyDown
|
|
137
|
-
}) as Record<string, unknown>)}
|
|
138
|
-
ref={forkedRef}
|
|
139
|
-
>
|
|
140
|
-
{children}
|
|
141
|
-
</Component>
|
|
142
|
-
)
|
|
143
|
-
}
|
|
144
|
-
|
|
145
|
-
export const MenuToggle = createPolymorphicComponent<MenuToggleComponent>(
|
|
146
|
-
MenuToggleRender as ForwardRefRenderFunction<Element, MenuToggleProps<ElementType>>,
|
|
147
|
-
'MenuToggle'
|
|
148
|
-
)
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
export { Menu } from './Menu'
|
|
2
|
-
export type { MenuProps, MenuFocusStrategy, MenuAutoClose } from './Menu'
|
|
3
|
-
export { MenuDivider } from './MenuDivider'
|
|
4
|
-
export type { MenuDividerProps } from './MenuDivider'
|
|
5
|
-
export { MenuHeader } from './MenuHeader'
|
|
6
|
-
export type { MenuHeaderProps } from './MenuHeader'
|
|
7
|
-
export { MenuItem } from './MenuItem'
|
|
8
|
-
export type { MenuItemProps } from './MenuItem'
|
|
9
|
-
export { MenuList } from './MenuList'
|
|
10
|
-
export type { MenuListProps } from './MenuList'
|
|
11
|
-
export { MenuText } from './MenuText'
|
|
12
|
-
export type { MenuTextProps } from './MenuText'
|
|
13
|
-
export { MenuToggle } from './MenuToggle'
|
|
14
|
-
export type { MenuToggleProps } from './MenuToggle'
|
|
15
|
-
export { MenuSubmenu } from './MenuSubmenu'
|
|
16
|
-
export type { MenuSubmenuProps } from './MenuSubmenu'
|
|
17
|
-
export { MenuSubmenuBack } from './MenuSubmenuBack'
|
|
18
|
-
export type { MenuSubmenuBackProps } from './MenuSubmenuBack'
|
|
19
|
-
export type { MenuItemDef, MenuHeaderDef, MenuDividerDef, MenuItemsDef } from './MenuItemDef'
|