@banzamel/mineralui 2.3.0 → 2.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -2
- package/dist/{MAvatar-bUWENcq-.cjs → MAvatar-xI5aZ-bP.cjs} +2 -2
- package/dist/{MAvatar-bUWENcq-.cjs.map → MAvatar-xI5aZ-bP.cjs.map} +1 -1
- package/dist/{MButton-R08y1HCT.cjs → MButton-CMbmWmMI.cjs} +2 -2
- package/dist/{MButton-R08y1HCT.cjs.map → MButton-CMbmWmMI.cjs.map} +1 -1
- package/dist/{MButtonGroup-C-LiXWRC.cjs → MButtonGroup-agnKWUPy.cjs} +2 -2
- package/dist/{MButtonGroup-C-LiXWRC.cjs.map → MButtonGroup-agnKWUPy.cjs.map} +1 -1
- package/dist/{MCard-1OVOl4Ql.cjs → MCard-CADu7UUA.cjs} +2 -2
- package/dist/{MCard-1OVOl4Ql.cjs.map → MCard-CADu7UUA.cjs.map} +1 -1
- package/dist/{MCheckbox-CM5HJQWW.cjs → MCheckbox-stBujis6.cjs} +2 -2
- package/dist/{MCheckbox-CM5HJQWW.cjs.map → MCheckbox-stBujis6.cjs.map} +1 -1
- package/dist/{MConflictIllustration-B2AtfpYO.cjs → MConflictIllustration-CWWnskbi.cjs} +2 -2
- package/dist/{MConflictIllustration-B2AtfpYO.cjs.map → MConflictIllustration-CWWnskbi.cjs.map} +1 -1
- package/dist/{MDetailList-DTLU7HQZ.cjs → MDetailList-CQ2sJ7Jl.cjs} +2 -2
- package/dist/{MDetailList-DTLU7HQZ.cjs.map → MDetailList-CQ2sJ7Jl.cjs.map} +1 -1
- package/dist/MDropdownMenu-B7RR8d8x.js +172 -0
- package/dist/MDropdownMenu-B7RR8d8x.js.map +1 -0
- package/dist/MDropdownMenu-DAzieAOs.cjs +2 -0
- package/dist/MDropdownMenu-DAzieAOs.cjs.map +1 -0
- package/dist/{MGrid-B_0kFUws.cjs → MGrid-LHi7TY5J.cjs} +2 -2
- package/dist/{MGrid-B_0kFUws.cjs.map → MGrid-LHi7TY5J.cjs.map} +1 -1
- package/dist/{MHeading-BLnb3dNv.cjs → MHeading-7yt1C6oS.cjs} +2 -2
- package/dist/{MHeading-BLnb3dNv.cjs.map → MHeading-7yt1C6oS.cjs.map} +1 -1
- package/dist/{MI18nProvider-Cg-vxV6j.cjs → MI18nProvider-Cx4ZaFtv.cjs} +2 -2
- package/dist/{MI18nProvider-Cg-vxV6j.cjs.map → MI18nProvider-Cx4ZaFtv.cjs.map} +1 -1
- package/dist/{MInput-BpTlP8GE.cjs → MInput-BSeWCsPi.cjs} +2 -2
- package/dist/{MInput-BpTlP8GE.cjs.map → MInput-BSeWCsPi.cjs.map} +1 -1
- package/dist/{MInputCVC-B4V0QI5h.js → MInputCVC-CtHPCx_r.js} +2 -2
- package/dist/{MInputCVC-B4V0QI5h.js.map → MInputCVC-CtHPCx_r.js.map} +1 -1
- package/dist/{MInputCVC-BlY5OrVn.cjs → MInputCVC-rNs8w4gH.cjs} +2 -2
- package/dist/{MInputCVC-BlY5OrVn.cjs.map → MInputCVC-rNs8w4gH.cjs.map} +1 -1
- package/dist/{MInputSearch-9wcXlY8-.cjs → MInputSearch-BfPPgEGZ.cjs} +2 -2
- package/dist/{MInputSearch-9wcXlY8-.cjs.map → MInputSearch-BfPPgEGZ.cjs.map} +1 -1
- package/dist/{MKbd-n4fhKIxb.cjs → MKbd-C6XHWlmE.cjs} +2 -2
- package/dist/{MKbd-n4fhKIxb.cjs.map → MKbd-C6XHWlmE.cjs.map} +1 -1
- package/dist/{MLink-Biipj7xz.cjs → MLink-CbaDlP5I.cjs} +2 -2
- package/dist/{MLink-Biipj7xz.cjs.map → MLink-CbaDlP5I.cjs.map} +1 -1
- package/dist/{MLoader-XcpKlLrd.cjs → MLoader-DELAIhz5.cjs} +2 -2
- package/dist/{MLoader-XcpKlLrd.cjs.map → MLoader-DELAIhz5.cjs.map} +1 -1
- package/dist/{MPagination-C6QQdEj_.cjs → MPagination-C2lpvPqC.cjs} +2 -2
- package/dist/{MPagination-C6QQdEj_.cjs.map → MPagination-C2lpvPqC.cjs.map} +1 -1
- package/dist/MPopover-DI_7niwe.cjs +2 -0
- package/dist/MPopover-DI_7niwe.cjs.map +1 -0
- package/dist/{MPopover-C5aaGhma.js → MPopover-Dd-GIBU6.js} +10 -5
- package/dist/MPopover-Dd-GIBU6.js.map +1 -0
- package/dist/{MPortal-BciZHNDC.cjs → MPortal-C9Ucq8Um.cjs} +2 -2
- package/dist/{MPortal-BciZHNDC.cjs.map → MPortal-C9Ucq8Um.cjs.map} +1 -1
- package/dist/{MSimpleGrid-BwNfaxQP.cjs → MSimpleGrid-K-8Qg9em.cjs} +2 -2
- package/dist/{MSimpleGrid-BwNfaxQP.cjs.map → MSimpleGrid-K-8Qg9em.cjs.map} +1 -1
- package/dist/{MSkeleton-CLSU5pL6.cjs → MSkeleton-DgU8aktI.cjs} +2 -2
- package/dist/{MSkeleton-CLSU5pL6.cjs.map → MSkeleton-DgU8aktI.cjs.map} +1 -1
- package/dist/{MSlider-DZnMB49q.cjs → MSlider-0ApojrDC.cjs} +2 -2
- package/dist/{MSlider-DZnMB49q.cjs.map → MSlider-0ApojrDC.cjs.map} +1 -1
- package/dist/{MStack-BP_BUeCc.cjs → MStack-BOOciEts.cjs} +2 -2
- package/dist/{MStack-BP_BUeCc.cjs.map → MStack-BOOciEts.cjs.map} +1 -1
- package/dist/{MSubText-VHsgFsv2.cjs → MSubText-WixraICV.cjs} +2 -2
- package/dist/{MSubText-VHsgFsv2.cjs.map → MSubText-WixraICV.cjs.map} +1 -1
- package/dist/{MSurface-CYeVFOw_.cjs → MSurface-CF8BFFn4.cjs} +2 -2
- package/dist/{MSurface-CYeVFOw_.cjs.map → MSurface-CF8BFFn4.cjs.map} +1 -1
- package/dist/{MTag-BzTp1crT.cjs → MTag-CgXh2PQC.cjs} +2 -2
- package/dist/{MTag-BzTp1crT.cjs.map → MTag-CgXh2PQC.cjs.map} +1 -1
- package/dist/{MText-j6Zbbj5Y.cjs → MText-CDDEGjBx.cjs} +2 -2
- package/dist/{MText-j6Zbbj5Y.cjs.map → MText-CDDEGjBx.cjs.map} +1 -1
- package/dist/{MTooltip-BEfO9jTe.cjs → MTooltip-BWqyv6QU.cjs} +2 -2
- package/dist/{MTooltip-BEfO9jTe.cjs.map → MTooltip-BWqyv6QU.cjs.map} +1 -1
- package/dist/{MTreeView-DuQkm0ZV.cjs → MTreeView-BcVw0Bgz.cjs} +2 -2
- package/dist/{MTreeView-DuQkm0ZV.cjs.map → MTreeView-BcVw0Bgz.cjs.map} +1 -1
- package/dist/{arduino-UeOrXakL.js → arduino-BHobW-W2.js} +1 -1
- package/dist/{arduino-UeOrXakL.js.map → arduino-BHobW-W2.js.map} +1 -1
- package/dist/{arduino-DdDHMIWB.cjs → arduino-Bedph8hQ.cjs} +1 -1
- package/dist/{arduino-DdDHMIWB.cjs.map → arduino-Bedph8hQ.cjs.map} +1 -1
- package/dist/{bash-B17_F5Sw.cjs → bash-CK4DSkpy.cjs} +1 -1
- package/dist/{bash-B17_F5Sw.cjs.map → bash-CK4DSkpy.cjs.map} +1 -1
- package/dist/{bash-CrHemXky.js → bash-oKnFbgn1.js} +1 -1
- package/dist/{bash-CrHemXky.js.map → bash-oKnFbgn1.js.map} +1 -1
- package/dist/{c-ODLxeMV_.cjs → c-9Uw9QchT.cjs} +1 -1
- package/dist/{c-ODLxeMV_.cjs.map → c-9Uw9QchT.cjs.map} +1 -1
- package/dist/{c-D9302r2r.js → c-Bjn-r6WZ.js} +1 -1
- package/dist/{c-D9302r2r.js.map → c-Bjn-r6WZ.js.map} +1 -1
- package/dist/calendar-BFfeWRa0.cjs +2 -0
- package/dist/calendar-BFfeWRa0.cjs.map +1 -0
- package/dist/calendar-DhRP5_mS.js +192 -0
- package/dist/calendar-DhRP5_mS.js.map +1 -0
- package/dist/calendar.cjs +3 -0
- package/dist/calendar.d.ts +1 -0
- package/dist/calendar.js +4 -0
- package/dist/{cards-CQSYgH9U.cjs → cards-Bwos44EP.cjs} +2 -2
- package/dist/{cards-CQSYgH9U.cjs.map → cards-Bwos44EP.cjs.map} +1 -1
- package/dist/{cards-Cpr9B8Mu.js → cards-Dus8TmSD.js} +4 -4
- package/dist/{cards-Cpr9B8Mu.js.map → cards-Dus8TmSD.js.map} +1 -1
- package/dist/cards.cjs +1 -1
- package/dist/cards.js +1 -1
- package/dist/components/calendar/MMiniCalendar/MMiniCalendar.d.ts +6 -0
- package/dist/components/calendar/MMiniCalendar/MMiniCalendar.types.d.ts +35 -0
- package/dist/components/calendar/MMiniCalendar/index.d.ts +2 -0
- package/dist/components/calendar/index.d.ts +2 -0
- package/dist/components/dropdowns/MSelect/MSelect.d.ts +1 -1
- package/dist/components/dropdowns/MSelect/MSelect.types.d.ts +2 -0
- package/dist/components/overlays/MDropdownMenu/MDropdownMenu.d.ts +1 -1
- package/dist/components/overlays/MDropdownMenu/MDropdownMenu.types.d.ts +7 -0
- package/dist/components/overlays/MDropdownMenu/index.d.ts +1 -1
- package/dist/components/overlays/index.d.ts +1 -1
- package/dist/{controls-CT_0lIPr.cjs → controls-CeHdKaQv.cjs} +2 -2
- package/dist/{controls-CT_0lIPr.cjs.map → controls-CeHdKaQv.cjs.map} +1 -1
- package/dist/controls.cjs +1 -1
- package/dist/{core-DBpQf3uY.cjs → core-CLRD6sG4.cjs} +1 -1
- package/dist/{core-DBpQf3uY.cjs.map → core-CLRD6sG4.cjs.map} +1 -1
- package/dist/{core-yRqh2XLu.js → core-CMHNXulE.js} +1 -1
- package/dist/{core-yRqh2XLu.js.map → core-CMHNXulE.js.map} +1 -1
- package/dist/{cpp-DuTgLZC1.cjs → cpp-BWqMcMeX.cjs} +1 -1
- package/dist/{cpp-DuTgLZC1.cjs.map → cpp-BWqMcMeX.cjs.map} +1 -1
- package/dist/{cpp-CLYSpJBB.js → cpp-b3FmFTKl.js} +1 -1
- package/dist/{cpp-CLYSpJBB.js.map → cpp-b3FmFTKl.js.map} +1 -1
- package/dist/{css-BgGh0eG1.js → css-8EzLAJKV.js} +1 -1
- package/dist/{css-BgGh0eG1.js.map → css-8EzLAJKV.js.map} +1 -1
- package/dist/{css-D0f-qByc.cjs → css-B4MkxW0b.cjs} +1 -1
- package/dist/{css-D0f-qByc.cjs.map → css-B4MkxW0b.cjs.map} +1 -1
- package/dist/{data-C-6DP7iY.js → data-Dh3C_VTi.js} +2 -2
- package/dist/{data-C-6DP7iY.js.map → data-Dh3C_VTi.js.map} +1 -1
- package/dist/{data-BZ92hzXx.cjs → data-Dl6U8Uct.cjs} +2 -2
- package/dist/{data-BZ92hzXx.cjs.map → data-Dl6U8Uct.cjs.map} +1 -1
- package/dist/data.cjs +1 -1
- package/dist/data.js +1 -1
- package/dist/{display-BF4jASt9.js → display-CYC1AImx.js} +12 -12
- package/dist/{display-BF4jASt9.js.map → display-CYC1AImx.js.map} +1 -1
- package/dist/{display-DMix8BmD.cjs → display-DU9E_18w.cjs} +2 -2
- package/dist/{display-DMix8BmD.cjs.map → display-DU9E_18w.cjs.map} +1 -1
- package/dist/display.cjs +1 -1
- package/dist/display.js +1 -1
- package/dist/dropdowns-ByDu8Wbt.js +1697 -0
- package/dist/dropdowns-ByDu8Wbt.js.map +1 -0
- package/dist/dropdowns-vaj6vhl6.cjs +2 -0
- package/dist/dropdowns-vaj6vhl6.cjs.map +1 -0
- package/dist/dropdowns.cjs +1 -1
- package/dist/dropdowns.js +1 -1
- package/dist/{feedback-BeJpXoKd.cjs → feedback-CUGuh4QZ.cjs} +2 -2
- package/dist/{feedback-BeJpXoKd.cjs.map → feedback-CUGuh4QZ.cjs.map} +1 -1
- package/dist/feedback.cjs +1 -1
- package/dist/{form-BWGLrCPi.cjs → form-DICGXS6_.cjs} +2 -2
- package/dist/{form-BWGLrCPi.cjs.map → form-DICGXS6_.cjs.map} +1 -1
- package/dist/{form-CgH1hioG.js → form-Dri4AzY9.js} +1 -1
- package/dist/{form-CgH1hioG.js.map → form-Dri4AzY9.js.map} +1 -1
- package/dist/form.cjs +1 -1
- package/dist/form.js +1 -1
- package/dist/frameworkTexts-C1yvIVm4.js +109 -0
- package/dist/frameworkTexts-C1yvIVm4.js.map +1 -0
- package/dist/frameworkTexts-D3wbwWCu.cjs +2 -0
- package/dist/frameworkTexts-D3wbwWCu.cjs.map +1 -0
- package/dist/i18n/frameworkTexts.d.ts +83 -0
- package/dist/i18n.cjs +1 -1
- package/dist/{icons-D675Im0B.cjs → icons-BxurYyW-.cjs} +2 -2
- package/dist/{icons-D675Im0B.cjs.map → icons-BxurYyW-.cjs.map} +1 -1
- package/dist/icons.cjs +1 -1
- package/dist/illustrations.cjs +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.js +12 -11
- package/dist/{inputs-x6vjAGCq.cjs → inputs-GCUfD923.cjs} +2 -2
- package/dist/{inputs-x6vjAGCq.cjs.map → inputs-GCUfD923.cjs.map} +1 -1
- package/dist/inputs.cjs +1 -1
- package/dist/inputs.js +1 -1
- package/dist/{javascript-CGjvHPZ1.cjs → javascript-BGrveJJw.cjs} +1 -1
- package/dist/{javascript-CGjvHPZ1.cjs.map → javascript-BGrveJJw.cjs.map} +1 -1
- package/dist/{javascript-CX3JhsYu.js → javascript-CH9YvIk2.js} +1 -1
- package/dist/{javascript-CX3JhsYu.js.map → javascript-CH9YvIk2.js.map} +1 -1
- package/dist/{json-BPIcVdlp.js → json-CPWARxtL.js} +1 -1
- package/dist/{json-BPIcVdlp.js.map → json-CPWARxtL.js.map} +1 -1
- package/dist/{json-B8svQsK0.cjs → json-D6oa0Lra.cjs} +1 -1
- package/dist/{json-B8svQsK0.cjs.map → json-D6oa0Lra.cjs.map} +1 -1
- package/dist/{layout-CdSpVJuK.js → layout-CS_dHOLM.js} +2 -2
- package/dist/{layout-CdSpVJuK.js.map → layout-CS_dHOLM.js.map} +1 -1
- package/dist/{layout-Ddo7HUPu.cjs → layout-Gr99WWTA.cjs} +2 -2
- package/dist/{layout-Ddo7HUPu.cjs.map → layout-Gr99WWTA.cjs.map} +1 -1
- package/dist/layout.cjs +1 -1
- package/dist/layout.js +1 -1
- package/dist/{licensing-DysMClel.cjs → licensing-DXCHcZd1.cjs} +2 -2
- package/dist/licensing-DXCHcZd1.cjs.map +1 -0
- package/dist/licensing-f5KYVz7D.js.map +1 -1
- package/dist/{locale-CbnstsMH.cjs → locale-BGLDTJSi.cjs} +2 -2
- package/dist/{locale-CbnstsMH.cjs.map → locale-BGLDTJSi.cjs.map} +1 -1
- package/dist/{media-DRz3JZfr.cjs → media-CE59IEdY.cjs} +2 -2
- package/dist/{media-DRz3JZfr.cjs.map → media-CE59IEdY.cjs.map} +1 -1
- package/dist/media.cjs +1 -1
- package/dist/{overlays-BUZEaZaJ.cjs → overlays--Pe-H5TW.cjs} +2 -2
- package/dist/{overlays-BUZEaZaJ.cjs.map → overlays--Pe-H5TW.cjs.map} +1 -1
- package/dist/{overlays-C1vO_A2I.js → overlays-DCXP_KsX.js} +2 -2
- package/dist/{overlays-C1vO_A2I.js.map → overlays-DCXP_KsX.js.map} +1 -1
- package/dist/overlays.cjs +1 -1
- package/dist/overlays.js +2 -2
- package/dist/{php-CKyelegh.cjs → php-DJ1nTQpr.cjs} +1 -1
- package/dist/{php-CKyelegh.cjs.map → php-DJ1nTQpr.cjs.map} +1 -1
- package/dist/{php-CBRzjinf.js → php-DeBdikHj.js} +1 -1
- package/dist/{php-CBRzjinf.js.map → php-DeBdikHj.js.map} +1 -1
- package/dist/primitives.cjs +1 -1
- package/dist/primitives.js +1 -1
- package/dist/style-runtime.cjs +1 -1
- package/dist/style-runtime.js +1 -1
- package/dist/styles.css +1 -1
- package/dist/{theme-BfNZicWk.cjs → theme-Bjs11y3s.cjs} +2 -2
- package/dist/{theme-BfNZicWk.cjs.map → theme-Bjs11y3s.cjs.map} +1 -1
- package/dist/theme.cjs +1 -1
- package/dist/{typescript-Xt3Sotw5.js → typescript-B5GRzMtL.js} +1 -1
- package/dist/{typescript-Xt3Sotw5.js.map → typescript-B5GRzMtL.js.map} +1 -1
- package/dist/{typescript-D6PDzwkM.cjs → typescript-qNh_eaB0.cjs} +1 -1
- package/dist/{typescript-D6PDzwkM.cjs.map → typescript-qNh_eaB0.cjs.map} +1 -1
- package/dist/{typography-Dk9kIORI.cjs → typography-D4PUdtMV.cjs} +2 -2
- package/dist/{typography-Dk9kIORI.cjs.map → typography-D4PUdtMV.cjs.map} +1 -1
- package/dist/typography.cjs +1 -1
- package/dist/{useGhostText-Dmkw3Am8.cjs → useGhostText-BTPneo4u.cjs} +2 -2
- package/dist/{useGhostText-Dmkw3Am8.cjs.map → useGhostText-BTPneo4u.cjs.map} +1 -1
- package/dist/{useInteractionEffect-DFTdcWHl.cjs → useInteractionEffect-q_9csNj7.cjs} +2 -2
- package/dist/{useInteractionEffect-DFTdcWHl.cjs.map → useInteractionEffect-q_9csNj7.cjs.map} +1 -1
- package/dist/{useKeyboardNav-HVG9JFD2.cjs → useKeyboardNav-D_OwIEZp.cjs} +2 -2
- package/dist/{useKeyboardNav-HVG9JFD2.cjs.map → useKeyboardNav-D_OwIEZp.cjs.map} +1 -1
- package/dist/utils/calendarDates.d.ts +51 -0
- package/dist/utils/licensing.d.ts +1 -1
- package/dist/utils/useControllableState.d.ts +5 -0
- package/dist/utils/useElementWidth.d.ts +10 -0
- package/dist/utils.cjs +1 -1
- package/dist/{xml-CrpWqcDk.js → xml-BTZ6XeQ9.js} +1 -1
- package/dist/{xml-CrpWqcDk.js.map → xml-BTZ6XeQ9.js.map} +1 -1
- package/dist/{xml-4YlaGgjP.cjs → xml-_Z3NZw2H.cjs} +1 -1
- package/dist/{xml-4YlaGgjP.cjs.map → xml-_Z3NZw2H.cjs.map} +1 -1
- package/package.json +16 -3
- package/dist/MDropdownMenu-BvN5grK5.cjs +0 -2
- package/dist/MDropdownMenu-BvN5grK5.cjs.map +0 -1
- package/dist/MDropdownMenu-CFoKJ7V6.js +0 -157
- package/dist/MDropdownMenu-CFoKJ7V6.js.map +0 -1
- package/dist/MPopover-C5aaGhma.js.map +0 -1
- package/dist/MPopover-CV-9MArH.cjs +0 -2
- package/dist/MPopover-CV-9MArH.cjs.map +0 -1
- package/dist/dropdowns-BwAVoncd.js +0 -1752
- package/dist/dropdowns-BwAVoncd.js.map +0 -1
- package/dist/dropdowns-D5IF0TK7.cjs +0 -2
- package/dist/dropdowns-D5IF0TK7.cjs.map +0 -1
- package/dist/licensing-DysMClel.cjs.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useKeyboardNav-
|
|
1
|
+
{"version":3,"file":"useKeyboardNav-D_OwIEZp.cjs","names":[],"sources":["../src/utils/useKeyboardNav.ts"],"sourcesContent":["import {useState, useCallback, type KeyboardEvent} from 'react'\n\nexport interface UseKeyboardNavOptions {\n itemCount: number\n onSelect: (index: number) => void\n onClose: () => void\n isOpen: boolean\n loop?: boolean\n}\n\n// Provide arrow-key navigation and selection state for list-like widgets.\nexport function useKeyboardNav({itemCount, onSelect, onClose, isOpen, loop = true}: UseKeyboardNavOptions) {\n const [activeIndex, setActiveIndex] = useState(-1)\n\n // Reset highlight state when the owning widget closes or clears results.\n const resetIndex = useCallback(() => setActiveIndex(-1), [])\n\n const onKeyDown = useCallback(\n (e: KeyboardEvent) => {\n if (!isOpen || itemCount === 0) return\n\n switch (e.key) {\n case 'ArrowDown': {\n e.preventDefault()\n setActiveIndex((prev) => {\n if (prev >= itemCount - 1) return loop ? 0 : prev\n return prev + 1\n })\n break\n }\n case 'ArrowUp': {\n e.preventDefault()\n setActiveIndex((prev) => {\n if (prev <= 0) return loop ? itemCount - 1 : 0\n return prev - 1\n })\n break\n }\n case 'Enter': {\n e.preventDefault()\n if (activeIndex >= 0 && activeIndex < itemCount) {\n onSelect(activeIndex)\n }\n break\n }\n case 'Escape': {\n e.preventDefault()\n onClose()\n break\n }\n case 'Home': {\n e.preventDefault()\n setActiveIndex(0)\n break\n }\n case 'End': {\n e.preventDefault()\n setActiveIndex(itemCount - 1)\n break\n }\n }\n },\n [isOpen, itemCount, activeIndex, onSelect, onClose, loop]\n )\n\n return {activeIndex, setActiveIndex, resetIndex, onKeyDown}\n}\n"],"mappings":"sDAWA,SAAgB,EAAe,CAAC,YAAW,WAAU,UAAS,SAAQ,OAAO,IAA8B,CACvG,GAAM,CAAC,EAAa,IAAA,EAAA,EAAA,UAA2B,GAAG,CAqDlD,MAAO,CAAC,cAAa,iBAAgB,YAAA,EAAA,EAAA,iBAlDA,EAAe,GAAG,CAAE,EAAE,CAAC,CAkDX,WAAA,EAAA,EAAA,aA/C5C,GAAqB,CACd,MAAC,GAAU,IAAc,GAE7B,OAAQ,EAAE,IAAV,CACI,IAAK,YACD,EAAE,gBAAgB,CAClB,EAAgB,GACR,GAAQ,EAAY,EAAU,EAAO,EAAI,EACtC,EAAO,EAChB,CACF,MAEJ,IAAK,UACD,EAAE,gBAAgB,CAClB,EAAgB,GACR,GAAQ,EAAU,EAAO,EAAY,EAAI,EACtC,EAAO,EAChB,CACF,MAEJ,IAAK,QACD,EAAE,gBAAgB,CACd,GAAe,GAAK,EAAc,GAClC,EAAS,EAAY,CAEzB,MAEJ,IAAK,SACD,EAAE,gBAAgB,CAClB,GAAS,CACT,MAEJ,IAAK,OACD,EAAE,gBAAgB,CAClB,EAAe,EAAE,CACjB,MAEJ,IAAK,MACD,EAAE,gBAAgB,CAClB,EAAe,EAAY,EAAE,CAC7B,QAIZ,CAAC,EAAQ,EAAW,EAAa,EAAU,EAAS,EAAK,CAC5D,CAE0D"}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Internal date helpers shared by the calendar family (MCalendarBoard, MTimelineBoard,
|
|
3
|
+
* MMiniCalendar, MScheduler) and MDatePicker. Basic-safe: no Pro imports, not re-exported
|
|
4
|
+
* from the package root. Every helper works in the browser's local time zone.
|
|
5
|
+
*/
|
|
6
|
+
export declare const MS_PER_MINUTE = 60000;
|
|
7
|
+
export declare const MS_PER_HOUR = 3600000;
|
|
8
|
+
export declare const MS_PER_DAY: number;
|
|
9
|
+
export type CalendarWeekStart = 0 | 1;
|
|
10
|
+
export declare function toDate(value: Date | string): Date;
|
|
11
|
+
export declare function isValidDate(value: Date): boolean;
|
|
12
|
+
export declare function parseHmToMinutes(value?: string): number | null;
|
|
13
|
+
export declare function startOfDay(date: Date): Date;
|
|
14
|
+
export declare function stripTime(date: Date): Date;
|
|
15
|
+
export declare function normalizeDate(value?: Date | string | null): Date | null;
|
|
16
|
+
/** Adds calendar days (DST-safe, keeps the wall-clock time). */
|
|
17
|
+
export declare function addDays(date: Date, amount: number): Date;
|
|
18
|
+
export declare function addMinutes(date: Date, amount: number): Date;
|
|
19
|
+
export declare function startOfMonth(date: Date): Date;
|
|
20
|
+
/** First day of the month `amount` months away from `date`. */
|
|
21
|
+
export declare function addMonthsToMonth(date: Date, amount: number): Date;
|
|
22
|
+
/** Same day of month `amount` months away, clamped to the target month length. */
|
|
23
|
+
export declare function addMonthsClamped(date: Date, amount: number): Date;
|
|
24
|
+
export declare function isSameDay(a: Date, b: Date): boolean;
|
|
25
|
+
export declare function isSameMonth(a: Date, b: Date): boolean;
|
|
26
|
+
export declare function clamp(value: number, min: number, max: number): number;
|
|
27
|
+
export declare function startOfWeek(date: Date, weekStartsOn?: CalendarWeekStart): Date;
|
|
28
|
+
export declare function getDateKey(date: Date): string;
|
|
29
|
+
export declare function isWeekend(date: Date): boolean;
|
|
30
|
+
/** Minutes elapsed since local midnight. */
|
|
31
|
+
export declare function minutesOfDay(date: Date): number;
|
|
32
|
+
/** Whole calendar days between two dates (b - a), ignoring the time of day. */
|
|
33
|
+
export declare function diffCalendarDays(a: Date, b: Date): number;
|
|
34
|
+
/** The 6 x 7 month grid starting on `weekStartsOn`, outside days included. */
|
|
35
|
+
export declare function getMonthMatrix(month: Date, weekStartsOn?: CalendarWeekStart): Date[];
|
|
36
|
+
/** Localised short weekday names, ordered from `weekStartsOn`. */
|
|
37
|
+
export declare function getWeekdayLabels(locale: string, weekStartsOn?: CalendarWeekStart, format?: 'narrow' | 'short' | 'long'): string[];
|
|
38
|
+
export declare function formatHourLabel(date: Date, locale: string): string;
|
|
39
|
+
export declare function formatDayLabel(date: Date, locale: string): string;
|
|
40
|
+
export declare function formatShortWeekday(date: Date, locale: string): string;
|
|
41
|
+
export declare function formatRangeLabel(start: Date, end: Date, locale: string): string;
|
|
42
|
+
export declare function formatFullDate(date: Date, locale: string): string;
|
|
43
|
+
export declare function formatMonthTitle(date: Date, locale: string, withYear?: boolean): string;
|
|
44
|
+
/** "21 – 27 September 2026", "28 September – 4 October 2026", with a plain fallback. */
|
|
45
|
+
export declare function formatDateRange(start: Date, endInclusive: Date, locale: string): string;
|
|
46
|
+
export type CalendarPeriodView = 'week' | 'day' | 'timeline' | 'month' | 'agenda';
|
|
47
|
+
/**
|
|
48
|
+
* Toolbar title for a period. `end` is exclusive. Month uses the month that holds the
|
|
49
|
+
* middle of the range, so a 6-week grid still reads "September 2026".
|
|
50
|
+
*/
|
|
51
|
+
export declare function formatPeriodTitle(view: CalendarPeriodView, start: Date, end: Date, locale: string): string;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export type MineralPlan = 'free' | 'pro';
|
|
2
2
|
export interface MineralComponentLicense {
|
|
3
|
-
group: 'cards' | 'charts' | 'data' | 'display' | 'media' | 'icons' | 'layout' | 'feedback';
|
|
3
|
+
group: 'cards' | 'charts' | 'calendar' | 'data' | 'display' | 'media' | 'icons' | 'layout' | 'feedback';
|
|
4
4
|
plan: MineralPlan;
|
|
5
5
|
}
|
|
6
6
|
export declare const mineralComponentLicenses: {};
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Generic controlled/uncontrolled state. The value is controlled when `value !== undefined`
|
|
3
|
+
* (React convention). `onChange` fires for every requested change, controlled or not.
|
|
4
|
+
*/
|
|
5
|
+
export declare function useControllableState<T>(value: T | undefined, defaultValue: T | (() => T), onChange?: (next: T) => void): [T, (next: T) => void];
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { RefObject } from 'react';
|
|
2
|
+
/**
|
|
3
|
+
* Tracks the rendered width of an element (ResizeObserver). SSR-safe: returns `initialWidth`
|
|
4
|
+
* until the element is measured, then corrects it before paint. Zero-width reads (hidden or
|
|
5
|
+
* detached nodes) are ignored so a collapsed tab does not flip a component to its narrow layout.
|
|
6
|
+
*/
|
|
7
|
+
export declare function useElementWidth(ref: RefObject<HTMLElement | null>, initialWidth?: number): number;
|
|
8
|
+
export type MContainerSize = 'sm' | 'md' | 'lg';
|
|
9
|
+
/** `sm` < 640 <= `md` < 1024 <= `lg` (MBreakpoints.sm / MBreakpoints.lg). Unknown width = `lg`. */
|
|
10
|
+
export declare function getContainerSize(width: number): MContainerSize;
|
package/dist/utils.cjs
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
const {ensureStyles}=require('./style-runtime.cjs')
|
|
2
2
|
ensureStyles()
|
|
3
|
-
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require(`./cn-CU5TNITO.cjs`),t=require(`./validators-B6yWdsu2.cjs`),n=require(`./creditCards-D_HwRUBz.cjs`),r=require(`./formatters-CNjg_h7-.cjs`),i=require(`./dateUtils-Dq1vaA-D.cjs`),a=require(`./relativeTime-DgYBUaVm.cjs`),o=require(`./useGhostText-
|
|
3
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require(`./cn-CU5TNITO.cjs`),t=require(`./validators-B6yWdsu2.cjs`),n=require(`./creditCards-D_HwRUBz.cjs`),r=require(`./formatters-CNjg_h7-.cjs`),i=require(`./dateUtils-Dq1vaA-D.cjs`),a=require(`./relativeTime-DgYBUaVm.cjs`),o=require(`./useGhostText-BTPneo4u.cjs`),s=require(`./licensing-DXCHcZd1.cjs`),c=require(`./useKeyboardNav-D_OwIEZp.cjs`),l=require(`./useInteractionEffect-q_9csNj7.cjs`);exports.addMonths=i.t,exports.addYears=i.n,exports.adjustCursorAfterFormat=r.t,exports.capitalizeWords=r.n,exports.cn=e.t,exports.composeValidators=t.t,exports.creditCardBrands=n.t,exports.daysInMonth=i.i,exports.detectCardBrand=n.n,exports.firstDayOfMonth=i.a,exports.formatAbsoluteTime=a.t,exports.formatCardNumber=n.r,exports.formatCurrency=r.r,exports.formatDate=i.o,exports.formatIBAN=r.a,exports.formatNIP=r.o,exports.formatPhone=r.s,exports.formatPostCode=t.v,exports.formatRelativeTime=a.n,exports.formatTime=i.c,exports.getAutoUpdateInterval=a.r,exports.getDayNames=i.u,exports.getMineralComponentLicense=s.t,exports.getMineralComponentPlan=s.n,exports.getMonthNames=i.d,exports.getPostCodeRule=t.y,exports.getRelativeTimeValue=a.i,exports.isDateInRange=i.f,exports.isMineralProComponent=s.r,exports.isSameDay=i.p,exports.mineralComponentLicenses=s.i,exports.mineralProComponents=s.a,exports.parseCurrencyToNumber=r.c,exports.parseDate=i.m,exports.parseRelativeThreshold=a.a,exports.parseTime=i.h,exports.postCodeCountries=t.b,exports.postCodeRules=t.x,exports.stripCardNumber=n.i,exports.stripNonAlphanumeric=r.l,exports.stripNonDigits=r.u,exports.stripTime=i._,exports.toDate=a.o,exports.unformatIBAN=r.d,exports.useClickOutside=s.o,exports.useDebounce=o.n,exports.useDebouncedCallback=o.r,exports.useGhostText=o.t,exports.useInteractionEffect=l.t,exports.useKeyboardNav=c.t,exports.validateCardNumber=n.a,exports.validateEmail=t.o,exports.validateIBAN=t.s,exports.validateMaxLength=t.c,exports.validateMinLength=t.l,exports.validateNIP=t.u,exports.validatePESEL=t.d,exports.validatePattern=t.f,exports.validatePhone=t.p,exports.validatePostCode=t.S,exports.validateREGON=t.m,exports.validateRange=t.h,exports.validateRequired=t.g;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"xml-
|
|
1
|
+
{"version":3,"file":"xml-BTZ6XeQ9.js","names":[],"sources":["../../../node_modules/highlight.js/es/languages/xml.js"],"sourcesContent":["/*\nLanguage: HTML, XML\nWebsite: https://www.w3.org/XML/\nCategory: common, web\nAudit: 2020\n*/\n\n/** @type LanguageFn */\nfunction xml(hljs) {\n const regex = hljs.regex;\n // XML names can have the following additional letters: https://www.w3.org/TR/xml/#NT-NameChar\n // OTHER_NAME_CHARS = /[:\\-.0-9\\u00B7\\u0300-\\u036F\\u203F-\\u2040]/;\n // Element names start with NAME_START_CHAR followed by optional other Unicode letters, ASCII digits, hyphens, underscores, and periods\n // const TAG_NAME_RE = regex.concat(/[A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD]/, regex.optional(/[A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD\\-.0-9\\u00B7\\u0300-\\u036F\\u203F-\\u2040]*:/), /[A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD\\-.0-9\\u00B7\\u0300-\\u036F\\u203F-\\u2040]*/);;\n // const XML_IDENT_RE = /[A-Z_a-z:\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD\\-.0-9\\u00B7\\u0300-\\u036F\\u203F-\\u2040]+/;\n // const TAG_NAME_RE = regex.concat(/[A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD]/, regex.optional(/[A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD\\-.0-9\\u00B7\\u0300-\\u036F\\u203F-\\u2040]*:/), /[A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD\\-.0-9\\u00B7\\u0300-\\u036F\\u203F-\\u2040]*/);\n // however, to cater for performance and more Unicode support rely simply on the Unicode letter class\n const TAG_NAME_RE = regex.concat(/[\\p{L}_]/u, regex.optional(/[\\p{L}0-9_.-]*:/u), /[\\p{L}0-9_.-]*/u);\n const XML_IDENT_RE = /[\\p{L}0-9._:-]+/u;\n const XML_ENTITIES = {\n className: 'symbol',\n begin: /&[a-z]+;|&#[0-9]+;|&#x[a-f0-9]+;/\n };\n const XML_META_KEYWORDS = {\n begin: /\\s/,\n contains: [\n {\n className: 'keyword',\n begin: /#?[a-z_][a-z1-9_-]+/,\n illegal: /\\n/\n }\n ]\n };\n const XML_META_PAR_KEYWORDS = hljs.inherit(XML_META_KEYWORDS, {\n begin: /\\(/,\n end: /\\)/\n });\n const APOS_META_STRING_MODE = hljs.inherit(hljs.APOS_STRING_MODE, { className: 'string' });\n const QUOTE_META_STRING_MODE = hljs.inherit(hljs.QUOTE_STRING_MODE, { className: 'string' });\n const TAG_INTERNALS = {\n endsWithParent: true,\n illegal: /</,\n relevance: 0,\n contains: [\n {\n className: 'attr',\n begin: XML_IDENT_RE,\n relevance: 0\n },\n {\n begin: /=\\s*/,\n relevance: 0,\n contains: [\n {\n className: 'string',\n endsParent: true,\n variants: [\n {\n begin: /\"/,\n end: /\"/,\n contains: [ XML_ENTITIES ]\n },\n {\n begin: /'/,\n end: /'/,\n contains: [ XML_ENTITIES ]\n },\n { begin: /[^\\s\"'=<>`]+/ }\n ]\n }\n ]\n }\n ]\n };\n return {\n name: 'HTML, XML',\n aliases: [\n 'html',\n 'xhtml',\n 'rss',\n 'atom',\n 'xjb',\n 'xsd',\n 'xsl',\n 'plist',\n 'wsf',\n 'svg'\n ],\n case_insensitive: true,\n unicodeRegex: true,\n contains: [\n {\n className: 'meta',\n begin: /<![a-z]/,\n end: />/,\n relevance: 10,\n contains: [\n XML_META_KEYWORDS,\n QUOTE_META_STRING_MODE,\n APOS_META_STRING_MODE,\n XML_META_PAR_KEYWORDS,\n {\n begin: /\\[/,\n end: /\\]/,\n contains: [\n {\n className: 'meta',\n begin: /<![a-z]/,\n end: />/,\n contains: [\n XML_META_KEYWORDS,\n XML_META_PAR_KEYWORDS,\n QUOTE_META_STRING_MODE,\n APOS_META_STRING_MODE\n ]\n }\n ]\n }\n ]\n },\n hljs.COMMENT(\n /<!--/,\n /-->/,\n { relevance: 10 }\n ),\n {\n begin: /<!\\[CDATA\\[/,\n end: /\\]\\]>/,\n relevance: 10\n },\n XML_ENTITIES,\n // xml processing instructions\n {\n className: 'meta',\n end: /\\?>/,\n variants: [\n {\n begin: /<\\?xml/,\n relevance: 10,\n contains: [\n QUOTE_META_STRING_MODE\n ]\n },\n {\n begin: /<\\?[a-z][a-z0-9]+/,\n }\n ]\n\n },\n {\n className: 'tag',\n /*\n The lookahead pattern (?=...) ensures that 'begin' only matches\n '<style' as a single word, followed by a whitespace or an\n ending bracket.\n */\n begin: /<style(?=\\s|>)/,\n end: />/,\n keywords: { name: 'style' },\n contains: [ TAG_INTERNALS ],\n starts: {\n end: /<\\/style>/,\n returnEnd: true,\n subLanguage: [\n 'css',\n 'xml'\n ]\n }\n },\n {\n className: 'tag',\n // See the comment in the <style tag about the lookahead pattern\n begin: /<script(?=\\s|>)/,\n end: />/,\n keywords: { name: 'script' },\n contains: [ TAG_INTERNALS ],\n starts: {\n end: /<\\/script>/,\n returnEnd: true,\n subLanguage: [\n 'javascript',\n 'handlebars',\n 'xml'\n ]\n }\n },\n // we need this for now for jSX\n {\n className: 'tag',\n begin: /<>|<\\/>/\n },\n // open tag\n {\n className: 'tag',\n begin: regex.concat(\n /</,\n regex.lookahead(regex.concat(\n TAG_NAME_RE,\n // <tag/>\n // <tag>\n // <tag ...\n regex.either(/\\/>/, />/, /\\s/)\n ))\n ),\n end: /\\/?>/,\n contains: [\n {\n className: 'name',\n begin: TAG_NAME_RE,\n relevance: 0,\n starts: TAG_INTERNALS\n }\n ]\n },\n // close tag\n {\n className: 'tag',\n begin: regex.concat(\n /<\\//,\n regex.lookahead(regex.concat(\n TAG_NAME_RE, />/\n ))\n ),\n contains: [\n {\n className: 'name',\n begin: TAG_NAME_RE,\n relevance: 0\n },\n {\n begin: />/,\n relevance: 0,\n endsParent: true\n }\n ]\n }\n ]\n };\n}\n\nexport { xml as default };\n"],"x_google_ignoreList":[0],"mappings":";AAQA,SAAS,EAAI,GAAM;CACjB,IAAM,IAAQ,EAAK,OAQb,IAAc,EAAM,OAAO,aAAa,EAAM,SAAS,mBAAmB,EAAE,kBAAkB,EAC9F,IAAe,oBACf,IAAe;EACnB,WAAW;EACX,OAAO;EACR,EACK,IAAoB;EACxB,OAAO;EACP,UAAU,CACR;GACE,WAAW;GACX,OAAO;GACP,SAAS;GACV,CACF;EACF,EACK,IAAwB,EAAK,QAAQ,GAAmB;EAC5D,OAAO;EACP,KAAK;EACN,CAAC,EACI,IAAwB,EAAK,QAAQ,EAAK,kBAAkB,EAAE,WAAW,UAAU,CAAC,EACpF,IAAyB,EAAK,QAAQ,EAAK,mBAAmB,EAAE,WAAW,UAAU,CAAC,EACtF,IAAgB;EACpB,gBAAgB;EAChB,SAAS;EACT,WAAW;EACX,UAAU,CACR;GACE,WAAW;GACX,OAAO;GACP,WAAW;GACZ,EACD;GACE,OAAO;GACP,WAAW;GACX,UAAU,CACR;IACE,WAAW;IACX,YAAY;IACZ,UAAU;KACR;MACE,OAAO;MACP,KAAK;MACL,UAAU,CAAE,EAAc;MAC3B;KACD;MACE,OAAO;MACP,KAAK;MACL,UAAU,CAAE,EAAc;MAC3B;KACD,EAAE,OAAO,gBAAgB;KAC1B;IACF,CACF;GACF,CACF;EACF;AACD,QAAO;EACL,MAAM;EACN,SAAS;GACP;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACD;EACD,kBAAkB;EAClB,cAAc;EACd,UAAU;GACR;IACE,WAAW;IACX,OAAO;IACP,KAAK;IACL,WAAW;IACX,UAAU;KACR;KACA;KACA;KACA;KACA;MACE,OAAO;MACP,KAAK;MACL,UAAU,CACR;OACE,WAAW;OACX,OAAO;OACP,KAAK;OACL,UAAU;QACR;QACA;QACA;QACA;QACD;OACF,CACF;MACF;KACF;IACF;GACD,EAAK,QACH,QACA,OACA,EAAE,WAAW,IAAI,CAClB;GACD;IACE,OAAO;IACP,KAAK;IACL,WAAW;IACZ;GACD;GAEA;IACE,WAAW;IACX,KAAK;IACL,UAAU,CACR;KACE,OAAO;KACP,WAAW;KACX,UAAU,CACR,EACD;KACF,EACD,EACE,OAAO,qBACR,CACF;IAEF;GACD;IACE,WAAW;IAMX,OAAO;IACP,KAAK;IACL,UAAU,EAAE,MAAM,SAAS;IAC3B,UAAU,CAAE,EAAe;IAC3B,QAAQ;KACN,KAAK;KACL,WAAW;KACX,aAAa,CACX,OACA,MACD;KACF;IACF;GACD;IACE,WAAW;IAEX,OAAO;IACP,KAAK;IACL,UAAU,EAAE,MAAM,UAAU;IAC5B,UAAU,CAAE,EAAe;IAC3B,QAAQ;KACN,KAAK;KACL,WAAW;KACX,aAAa;MACX;MACA;MACA;MACD;KACF;IACF;GAED;IACE,WAAW;IACX,OAAO;IACR;GAED;IACE,WAAW;IACX,OAAO,EAAM,OACX,KACA,EAAM,UAAU,EAAM,OACpB,GAIA,EAAM,OAAO,OAAO,KAAK,KAAK,CAC/B,CAAC,CACH;IACD,KAAK;IACL,UAAU,CACR;KACE,WAAW;KACX,OAAO;KACP,WAAW;KACX,QAAQ;KACT,CACF;IACF;GAED;IACE,WAAW;IACX,OAAO,EAAM,OACX,OACA,EAAM,UAAU,EAAM,OACpB,GAAa,IACd,CAAC,CACH;IACD,UAAU,CACR;KACE,WAAW;KACX,OAAO;KACP,WAAW;KACZ,EACD;KACE,OAAO;KACP,WAAW;KACX,YAAY;KACb,CACF;IACF;GACF;EACF"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
function e(e){let t=e.regex,n=t.concat(/[\p{L}_]/u,t.optional(/[\p{L}0-9_.-]*:/u),/[\p{L}0-9_.-]*/u),r=/[\p{L}0-9._:-]+/u,i={className:`symbol`,begin:/&[a-z]+;|&#[0-9]+;|&#x[a-f0-9]+;/},a={begin:/\s/,contains:[{className:`keyword`,begin:/#?[a-z_][a-z1-9_-]+/,illegal:/\n/}]},o=e.inherit(a,{begin:/\(/,end:/\)/}),s=e.inherit(e.APOS_STRING_MODE,{className:`string`}),c=e.inherit(e.QUOTE_STRING_MODE,{className:`string`}),l={endsWithParent:!0,illegal:/</,relevance:0,contains:[{className:`attr`,begin:r,relevance:0},{begin:/=\s*/,relevance:0,contains:[{className:`string`,endsParent:!0,variants:[{begin:/"/,end:/"/,contains:[i]},{begin:/'/,end:/'/,contains:[i]},{begin:/[^\s"'=<>`]+/}]}]}]};return{name:`HTML, XML`,aliases:[`html`,`xhtml`,`rss`,`atom`,`xjb`,`xsd`,`xsl`,`plist`,`wsf`,`svg`],case_insensitive:!0,unicodeRegex:!0,contains:[{className:`meta`,begin:/<![a-z]/,end:/>/,relevance:10,contains:[a,c,s,o,{begin:/\[/,end:/\]/,contains:[{className:`meta`,begin:/<![a-z]/,end:/>/,contains:[a,o,c,s]}]}]},e.COMMENT(/<!--/,/-->/,{relevance:10}),{begin:/<!\[CDATA\[/,end:/\]\]>/,relevance:10},i,{className:`meta`,end:/\?>/,variants:[{begin:/<\?xml/,relevance:10,contains:[c]},{begin:/<\?[a-z][a-z0-9]+/}]},{className:`tag`,begin:/<style(?=\s|>)/,end:/>/,keywords:{name:`style`},contains:[l],starts:{end:/<\/style>/,returnEnd:!0,subLanguage:[`css`,`xml`]}},{className:`tag`,begin:/<script(?=\s|>)/,end:/>/,keywords:{name:`script`},contains:[l],starts:{end:/<\/script>/,returnEnd:!0,subLanguage:[`javascript`,`handlebars`,`xml`]}},{className:`tag`,begin:/<>|<\/>/},{className:`tag`,begin:t.concat(/</,t.lookahead(t.concat(n,t.either(/\/>/,/>/,/\s/)))),end:/\/?>/,contains:[{className:`name`,begin:n,relevance:0,starts:l}]},{className:`tag`,begin:t.concat(/<\//,t.lookahead(t.concat(n,/>/))),contains:[{className:`name`,begin:n,relevance:0},{begin:/>/,relevance:0,endsParent:!0}]}]}}exports.default=e;
|
|
2
|
-
//# sourceMappingURL=xml-
|
|
2
|
+
//# sourceMappingURL=xml-_Z3NZw2H.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"xml-
|
|
1
|
+
{"version":3,"file":"xml-_Z3NZw2H.cjs","names":[],"sources":["../../../node_modules/highlight.js/es/languages/xml.js"],"sourcesContent":["/*\nLanguage: HTML, XML\nWebsite: https://www.w3.org/XML/\nCategory: common, web\nAudit: 2020\n*/\n\n/** @type LanguageFn */\nfunction xml(hljs) {\n const regex = hljs.regex;\n // XML names can have the following additional letters: https://www.w3.org/TR/xml/#NT-NameChar\n // OTHER_NAME_CHARS = /[:\\-.0-9\\u00B7\\u0300-\\u036F\\u203F-\\u2040]/;\n // Element names start with NAME_START_CHAR followed by optional other Unicode letters, ASCII digits, hyphens, underscores, and periods\n // const TAG_NAME_RE = regex.concat(/[A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD]/, regex.optional(/[A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD\\-.0-9\\u00B7\\u0300-\\u036F\\u203F-\\u2040]*:/), /[A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD\\-.0-9\\u00B7\\u0300-\\u036F\\u203F-\\u2040]*/);;\n // const XML_IDENT_RE = /[A-Z_a-z:\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD\\-.0-9\\u00B7\\u0300-\\u036F\\u203F-\\u2040]+/;\n // const TAG_NAME_RE = regex.concat(/[A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD]/, regex.optional(/[A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD\\-.0-9\\u00B7\\u0300-\\u036F\\u203F-\\u2040]*:/), /[A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD\\-.0-9\\u00B7\\u0300-\\u036F\\u203F-\\u2040]*/);\n // however, to cater for performance and more Unicode support rely simply on the Unicode letter class\n const TAG_NAME_RE = regex.concat(/[\\p{L}_]/u, regex.optional(/[\\p{L}0-9_.-]*:/u), /[\\p{L}0-9_.-]*/u);\n const XML_IDENT_RE = /[\\p{L}0-9._:-]+/u;\n const XML_ENTITIES = {\n className: 'symbol',\n begin: /&[a-z]+;|&#[0-9]+;|&#x[a-f0-9]+;/\n };\n const XML_META_KEYWORDS = {\n begin: /\\s/,\n contains: [\n {\n className: 'keyword',\n begin: /#?[a-z_][a-z1-9_-]+/,\n illegal: /\\n/\n }\n ]\n };\n const XML_META_PAR_KEYWORDS = hljs.inherit(XML_META_KEYWORDS, {\n begin: /\\(/,\n end: /\\)/\n });\n const APOS_META_STRING_MODE = hljs.inherit(hljs.APOS_STRING_MODE, { className: 'string' });\n const QUOTE_META_STRING_MODE = hljs.inherit(hljs.QUOTE_STRING_MODE, { className: 'string' });\n const TAG_INTERNALS = {\n endsWithParent: true,\n illegal: /</,\n relevance: 0,\n contains: [\n {\n className: 'attr',\n begin: XML_IDENT_RE,\n relevance: 0\n },\n {\n begin: /=\\s*/,\n relevance: 0,\n contains: [\n {\n className: 'string',\n endsParent: true,\n variants: [\n {\n begin: /\"/,\n end: /\"/,\n contains: [ XML_ENTITIES ]\n },\n {\n begin: /'/,\n end: /'/,\n contains: [ XML_ENTITIES ]\n },\n { begin: /[^\\s\"'=<>`]+/ }\n ]\n }\n ]\n }\n ]\n };\n return {\n name: 'HTML, XML',\n aliases: [\n 'html',\n 'xhtml',\n 'rss',\n 'atom',\n 'xjb',\n 'xsd',\n 'xsl',\n 'plist',\n 'wsf',\n 'svg'\n ],\n case_insensitive: true,\n unicodeRegex: true,\n contains: [\n {\n className: 'meta',\n begin: /<![a-z]/,\n end: />/,\n relevance: 10,\n contains: [\n XML_META_KEYWORDS,\n QUOTE_META_STRING_MODE,\n APOS_META_STRING_MODE,\n XML_META_PAR_KEYWORDS,\n {\n begin: /\\[/,\n end: /\\]/,\n contains: [\n {\n className: 'meta',\n begin: /<![a-z]/,\n end: />/,\n contains: [\n XML_META_KEYWORDS,\n XML_META_PAR_KEYWORDS,\n QUOTE_META_STRING_MODE,\n APOS_META_STRING_MODE\n ]\n }\n ]\n }\n ]\n },\n hljs.COMMENT(\n /<!--/,\n /-->/,\n { relevance: 10 }\n ),\n {\n begin: /<!\\[CDATA\\[/,\n end: /\\]\\]>/,\n relevance: 10\n },\n XML_ENTITIES,\n // xml processing instructions\n {\n className: 'meta',\n end: /\\?>/,\n variants: [\n {\n begin: /<\\?xml/,\n relevance: 10,\n contains: [\n QUOTE_META_STRING_MODE\n ]\n },\n {\n begin: /<\\?[a-z][a-z0-9]+/,\n }\n ]\n\n },\n {\n className: 'tag',\n /*\n The lookahead pattern (?=...) ensures that 'begin' only matches\n '<style' as a single word, followed by a whitespace or an\n ending bracket.\n */\n begin: /<style(?=\\s|>)/,\n end: />/,\n keywords: { name: 'style' },\n contains: [ TAG_INTERNALS ],\n starts: {\n end: /<\\/style>/,\n returnEnd: true,\n subLanguage: [\n 'css',\n 'xml'\n ]\n }\n },\n {\n className: 'tag',\n // See the comment in the <style tag about the lookahead pattern\n begin: /<script(?=\\s|>)/,\n end: />/,\n keywords: { name: 'script' },\n contains: [ TAG_INTERNALS ],\n starts: {\n end: /<\\/script>/,\n returnEnd: true,\n subLanguage: [\n 'javascript',\n 'handlebars',\n 'xml'\n ]\n }\n },\n // we need this for now for jSX\n {\n className: 'tag',\n begin: /<>|<\\/>/\n },\n // open tag\n {\n className: 'tag',\n begin: regex.concat(\n /</,\n regex.lookahead(regex.concat(\n TAG_NAME_RE,\n // <tag/>\n // <tag>\n // <tag ...\n regex.either(/\\/>/, />/, /\\s/)\n ))\n ),\n end: /\\/?>/,\n contains: [\n {\n className: 'name',\n begin: TAG_NAME_RE,\n relevance: 0,\n starts: TAG_INTERNALS\n }\n ]\n },\n // close tag\n {\n className: 'tag',\n begin: regex.concat(\n /<\\//,\n regex.lookahead(regex.concat(\n TAG_NAME_RE, />/\n ))\n ),\n contains: [\n {\n className: 'name',\n begin: TAG_NAME_RE,\n relevance: 0\n },\n {\n begin: />/,\n relevance: 0,\n endsParent: true\n }\n ]\n }\n ]\n };\n}\n\nexport { xml as default };\n"],"x_google_ignoreList":[0],"mappings":"AAQA,SAAS,EAAI,EAAM,CACjB,IAAM,EAAQ,EAAK,MAQb,EAAc,EAAM,OAAO,YAAa,EAAM,SAAS,mBAAmB,CAAE,kBAAkB,CAC9F,EAAe,mBACf,EAAe,CACnB,UAAW,SACX,MAAO,mCACR,CACK,EAAoB,CACxB,MAAO,KACP,SAAU,CACR,CACE,UAAW,UACX,MAAO,sBACP,QAAS,KACV,CACF,CACF,CACK,EAAwB,EAAK,QAAQ,EAAmB,CAC5D,MAAO,KACP,IAAK,KACN,CAAC,CACI,EAAwB,EAAK,QAAQ,EAAK,iBAAkB,CAAE,UAAW,SAAU,CAAC,CACpF,EAAyB,EAAK,QAAQ,EAAK,kBAAmB,CAAE,UAAW,SAAU,CAAC,CACtF,EAAgB,CACpB,eAAgB,GAChB,QAAS,IACT,UAAW,EACX,SAAU,CACR,CACE,UAAW,OACX,MAAO,EACP,UAAW,EACZ,CACD,CACE,MAAO,OACP,UAAW,EACX,SAAU,CACR,CACE,UAAW,SACX,WAAY,GACZ,SAAU,CACR,CACE,MAAO,IACP,IAAK,IACL,SAAU,CAAE,EAAc,CAC3B,CACD,CACE,MAAO,IACP,IAAK,IACL,SAAU,CAAE,EAAc,CAC3B,CACD,CAAE,MAAO,eAAgB,CAC1B,CACF,CACF,CACF,CACF,CACF,CACD,MAAO,CACL,KAAM,YACN,QAAS,CACP,OACA,QACA,MACA,OACA,MACA,MACA,MACA,QACA,MACA,MACD,CACD,iBAAkB,GAClB,aAAc,GACd,SAAU,CACR,CACE,UAAW,OACX,MAAO,UACP,IAAK,IACL,UAAW,GACX,SAAU,CACR,EACA,EACA,EACA,EACA,CACE,MAAO,KACP,IAAK,KACL,SAAU,CACR,CACE,UAAW,OACX,MAAO,UACP,IAAK,IACL,SAAU,CACR,EACA,EACA,EACA,EACD,CACF,CACF,CACF,CACF,CACF,CACD,EAAK,QACH,OACA,MACA,CAAE,UAAW,GAAI,CAClB,CACD,CACE,MAAO,cACP,IAAK,QACL,UAAW,GACZ,CACD,EAEA,CACE,UAAW,OACX,IAAK,MACL,SAAU,CACR,CACE,MAAO,SACP,UAAW,GACX,SAAU,CACR,EACD,CACF,CACD,CACE,MAAO,oBACR,CACF,CAEF,CACD,CACE,UAAW,MAMX,MAAO,iBACP,IAAK,IACL,SAAU,CAAE,KAAM,QAAS,CAC3B,SAAU,CAAE,EAAe,CAC3B,OAAQ,CACN,IAAK,YACL,UAAW,GACX,YAAa,CACX,MACA,MACD,CACF,CACF,CACD,CACE,UAAW,MAEX,MAAO,kBACP,IAAK,IACL,SAAU,CAAE,KAAM,SAAU,CAC5B,SAAU,CAAE,EAAe,CAC3B,OAAQ,CACN,IAAK,aACL,UAAW,GACX,YAAa,CACX,aACA,aACA,MACD,CACF,CACF,CAED,CACE,UAAW,MACX,MAAO,UACR,CAED,CACE,UAAW,MACX,MAAO,EAAM,OACX,IACA,EAAM,UAAU,EAAM,OACpB,EAIA,EAAM,OAAO,MAAO,IAAK,KAAK,CAC/B,CAAC,CACH,CACD,IAAK,OACL,SAAU,CACR,CACE,UAAW,OACX,MAAO,EACP,UAAW,EACX,OAAQ,EACT,CACF,CACF,CAED,CACE,UAAW,MACX,MAAO,EAAM,OACX,MACA,EAAM,UAAU,EAAM,OACpB,EAAa,IACd,CAAC,CACH,CACD,SAAU,CACR,CACE,UAAW,OACX,MAAO,EACP,UAAW,EACZ,CACD,CACE,MAAO,IACP,UAAW,EACX,WAAY,GACb,CACF,CACF,CACF,CACF"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@banzamel/mineralui",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.4.0",
|
|
4
4
|
"description": "Modern React UI component framework with mineral dark aesthetic",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.cjs",
|
|
@@ -23,6 +23,9 @@
|
|
|
23
23
|
"data": [
|
|
24
24
|
"dist/data.d.ts"
|
|
25
25
|
],
|
|
26
|
+
"calendar": [
|
|
27
|
+
"dist/calendar.d.ts"
|
|
28
|
+
],
|
|
26
29
|
"display": [
|
|
27
30
|
"dist/display.d.ts"
|
|
28
31
|
],
|
|
@@ -125,6 +128,16 @@
|
|
|
125
128
|
"default": "./dist/data.cjs"
|
|
126
129
|
}
|
|
127
130
|
},
|
|
131
|
+
"./calendar": {
|
|
132
|
+
"import": {
|
|
133
|
+
"types": "./dist/calendar.d.ts",
|
|
134
|
+
"default": "./dist/calendar.js"
|
|
135
|
+
},
|
|
136
|
+
"require": {
|
|
137
|
+
"types": "./dist/calendar.d.ts",
|
|
138
|
+
"default": "./dist/calendar.cjs"
|
|
139
|
+
}
|
|
140
|
+
},
|
|
128
141
|
"./display": {
|
|
129
142
|
"import": {
|
|
130
143
|
"types": "./dist/display.d.ts",
|
|
@@ -309,12 +322,12 @@
|
|
|
309
322
|
"license": "MIT",
|
|
310
323
|
"repository": {
|
|
311
324
|
"type": "git",
|
|
312
|
-
"url": "git+https://github.com/Banzamel/mineralui.git"
|
|
325
|
+
"url": "git+https://github.com/Banzamel/mineralui-react.git"
|
|
313
326
|
},
|
|
314
327
|
"author": "Rafal Polak",
|
|
315
328
|
"homepage": "https://mineralui.io",
|
|
316
329
|
"bugs": {
|
|
317
|
-
"url": "https://github.com/Banzamel/mineralui/issues"
|
|
330
|
+
"url": "https://github.com/Banzamel/mineralui-react/issues"
|
|
318
331
|
},
|
|
319
332
|
"dependencies": {
|
|
320
333
|
"highlight.js": "^11.11.1"
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
const e=require(`./cn-CU5TNITO.cjs`),t=require(`./useKeyboardNav-HVG9JFD2.cjs`),n=require(`./MPopover-CV-9MArH.cjs`);require(`./core-DBpQf3uY.cjs`);let r=require(`react`),i=require(`react/jsx-runtime`);function a(e){return e.props}function o(e){return!!e.type.__dropdownItem}function s(e){return!!e.type.__dropdownGroup}function c(e){let t=[];return r.Children.forEach(e,e=>{(0,r.isValidElement)(e)&&(o(e)?t.push(e):s(e)&&r.Children.forEach(a(e).children,e=>{(0,r.isValidElement)(e)&&o(e)&&t.push(e)}))}),t}function l({trigger:l,placement:u=`bottom-start`,closeOnSelect:d=!0,openOn:f=`click`,onOpenChange:p,isolateClick:m=!1,className:h,style:g,popoverClassName:_,popoverStyle:v,children:y}){let[b,x]=(0,r.useState)(!1),S=(0,r.useRef)(null),C=(0,r.useRef)(null),w=c(y),T=w.filter(e=>!a(e).disabled).length,E=(0,r.useCallback)(e=>{x(t=>{let n=typeof e==`function`?e(t):e;return p?.(n),n})},[p]),{activeIndex:D,setActiveIndex:O,onKeyDown:k}=t.t({itemCount:T,onSelect:(0,r.useCallback)(e=>{let t=0;for(let n of w){let r=a(n);if(!r.disabled){if(t===e){r.onClick?.();break}t++}}d&&E(!1)},[w,d,E]),onClose:()=>x(!1),isOpen:b}),A=e=>{m&&(e.stopPropagation(),e.preventDefault()),E(e=>!e)},j=e=>{(e.key===`ArrowDown`||e.key===`Enter`||e.key===` `)&&(e.preventDefault(),m&&e.stopPropagation(),E(!0)),b&&k(e)},M=0,N=e=>{if(!(0,r.isValidElement)(e))return e;if(o(e)){let t=a(e).disabled,n=t?-1:M++;return(0,r.cloneElement)(e,{_active:n===D,_onHover:t?void 0:()=>O(n),_onClick:()=>{t||d&&E(!1)}})}return s(e)?(0,r.cloneElement)(e,{children:r.Children.map(a(e).children,N)}):e},P=f===`hover`?{onMouseEnter:()=>{C.current&&clearTimeout(C.current),E(!0)},onMouseLeave:()=>{C.current=setTimeout(()=>E(!1),150)}}:{},F=m?e=>{e.stopPropagation(),e.preventDefault()}:void 0;return(0,i.jsxs)(`div`,{className:e.t(`dropdown menu anchor`,h),style:g,onClick:F,...P,children:[(0,i.jsx)(`div`,{ref:S,onClick:f===`click`?A:void 0,onKeyDown:j,role:`button`,tabIndex:0,className:`dropdown menu trigger`,children:l}),(0,i.jsx)(n.t,{open:b,anchorRef:S,onClose:()=>E(!1),placement:u,className:e.t(`dropdown menu popover`,_),style:v,children:(0,i.jsx)(`div`,{className:`dropdown menu list`,role:`menu`,...P,children:r.Children.map(y,N)})})]})}function u({icon:t,label:n,href:r,to:a,onClick:o,color:s,disabled:c=!1,active:l=!1,component:u,className:d,_active:f,_onHover:p,_onClick:m}){let h=f??l,g=(0,i.jsxs)(i.Fragment,{children:[t&&(0,i.jsx)(`span`,{className:`dropdown menu icon`,children:t}),(0,i.jsx)(`span`,{className:`dropdown menu label`,children:n})]}),_=e.t(`dropdown menu item`,h&&`active`,c&&`disabled`,s,d),v=e=>{if(c){e.preventDefault();return}o?.(),m?.()},y=u??(r||a?`a`:`button`),b=u?{...r?{href:r}:{},...a?{to:a}:{}}:r?{href:r}:a?{href:a}:{};return(0,i.jsx)(y,{className:_,role:`menuitem`,tabIndex:-1,onClick:v,onMouseEnter:p,"aria-disabled":c||void 0,...b,children:g})}u.__dropdownItem=!0;function d({label:e,children:t}){return(0,i.jsxs)(`div`,{className:`dropdown menu group`,role:`group`,children:[(0,i.jsx)(`div`,{className:`dropdown menu group-label`,children:e}),t]})}d.__dropdownGroup=!0;function f({className:t}){return(0,i.jsx)(`div`,{className:e.t(`dropdown menu divider`,t),role:`separator`})}Object.defineProperty(exports,`i`,{enumerable:!0,get:function(){return l}}),Object.defineProperty(exports,`n`,{enumerable:!0,get:function(){return d}}),Object.defineProperty(exports,`r`,{enumerable:!0,get:function(){return u}}),Object.defineProperty(exports,`t`,{enumerable:!0,get:function(){return f}});
|
|
2
|
-
//# sourceMappingURL=MDropdownMenu-BvN5grK5.cjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"MDropdownMenu-BvN5grK5.cjs","names":[],"sources":["../src/components/overlays/MDropdownMenu/MDropdownMenu.tsx"],"sourcesContent":["import {useState, useRef, useCallback, Children, isValidElement, cloneElement} from 'react'\nimport type * as React from 'react'\nimport {MPopover} from '../../primitives'\nimport {useKeyboardNav} from '../../../utils/useKeyboardNav'\nimport {cn} from '../../../utils/cn'\nimport type {\n MDropdownMenuProps,\n MDropdownItemProps,\n MDropdownGroupProps,\n MDropdownDividerProps,\n} from './MDropdownMenu.types'\nimport './MDropdownMenu.css'\n\ntype AnyProps = Record<string, any>\n\nfunction getProps(el: React.ReactElement): AnyProps {\n return el.props as AnyProps\n}\n\nfunction isItem(child: React.ReactElement): boolean {\n return !!(child.type as any).__dropdownItem\n}\n\nfunction isGroup(child: React.ReactElement): boolean {\n return !!(child.type as any).__dropdownGroup\n}\n\n// Collect all MDropdownItem elements from children (including inside groups).\nfunction collectItems(children: React.ReactNode): React.ReactElement[] {\n const items: React.ReactElement[] = []\n Children.forEach(children, (child) => {\n if (!isValidElement(child)) return\n if (isItem(child)) {\n items.push(child)\n } else if (isGroup(child)) {\n Children.forEach(getProps(child).children, (gc: React.ReactNode) => {\n if (isValidElement(gc) && isItem(gc)) {\n items.push(gc)\n }\n })\n }\n })\n return items\n}\n\nexport function MDropdownMenu({\n trigger,\n placement = 'bottom-start',\n closeOnSelect = true,\n openOn = 'click',\n onOpenChange,\n isolateClick = false,\n className,\n style,\n popoverClassName,\n popoverStyle,\n children,\n}: MDropdownMenuProps) {\n const [open, setOpen] = useState(false)\n const anchorRef = useRef<HTMLDivElement>(null)\n const hoverTimeout = useRef<ReturnType<typeof setTimeout>>(null)\n\n const items = collectItems(children)\n const enabledCount = items.filter((i) => !getProps(i).disabled).length\n\n const setMenuOpen = useCallback(\n (next: boolean | ((prev: boolean) => boolean)) => {\n setOpen((prev) => {\n const resolved = typeof next === 'function' ? next(prev) : next\n onOpenChange?.(resolved)\n return resolved\n })\n },\n [onOpenChange]\n )\n\n const handleSelect = useCallback(\n (index: number) => {\n let enabledIdx = 0\n for (const item of items) {\n const p = getProps(item)\n if (p.disabled) continue\n if (enabledIdx === index) {\n p.onClick?.()\n break\n }\n enabledIdx++\n }\n if (closeOnSelect) setMenuOpen(false)\n },\n [items, closeOnSelect, setMenuOpen]\n )\n\n const {activeIndex, setActiveIndex, onKeyDown} = useKeyboardNav({\n itemCount: enabledCount,\n onSelect: handleSelect,\n onClose: () => setOpen(false),\n isOpen: open,\n })\n\n const handleTriggerClick = (e: React.MouseEvent) => {\n if (isolateClick) {\n e.stopPropagation()\n e.preventDefault()\n }\n setMenuOpen((o) => !o)\n }\n\n const handleTriggerKeyDown = (e: React.KeyboardEvent) => {\n if (e.key === 'ArrowDown' || e.key === 'Enter' || e.key === ' ') {\n e.preventDefault()\n if (isolateClick) e.stopPropagation()\n setMenuOpen(true)\n }\n if (open) onKeyDown(e as any)\n }\n\n // Map active index back to flat child rendering with enabled-only tracking.\n let enabledIdx = 0\n const renderChild = (child: React.ReactNode): React.ReactNode => {\n if (!isValidElement(child)) return child\n\n if (isItem(child)) {\n const p = getProps(child)\n const isDisabled = p.disabled\n const idx = isDisabled ? -1 : enabledIdx++\n return cloneElement(child, {\n _active: idx === activeIndex,\n _onHover: isDisabled ? undefined : () => setActiveIndex(idx),\n _onClick: () => {\n if (isDisabled) return\n if (closeOnSelect) setMenuOpen(false)\n },\n } as AnyProps)\n }\n\n if (isGroup(child)) {\n return cloneElement(child, {\n children: Children.map(getProps(child).children, renderChild),\n } as AnyProps)\n }\n\n return child\n }\n\n const hoverHandlers =\n openOn === 'hover'\n ? {\n onMouseEnter: () => {\n if (hoverTimeout.current) clearTimeout(hoverTimeout.current)\n setMenuOpen(true)\n },\n onMouseLeave: () => {\n hoverTimeout.current = setTimeout(() => setMenuOpen(false), 150)\n },\n }\n : {}\n\n /**\n * When `isolateClick` is set, every click bubbling out of the menu\n * (trigger AND items) must be stopped — otherwise selecting an action\n * also fires the click handler on a clickable parent (Link, MCard with\n * onClick, MDataTable row link). Trigger click itself is handled by\n * `handleTriggerClick`; this wrapper catches the bubbled item clicks\n * before they leave the anchor. `preventDefault` is needed too — when the\n * dropdown is rendered inside an `<a href>` (MCard component={Link}),\n * stopping propagation alone does not block native link navigation.\n *\n * Caveat: MDropdownItem with `href` will not navigate while inside an\n * `isolateClick` menu — use programmatic navigation (onClick + navigate)\n * in those contexts instead.\n */\n const isolateAnchorClick = isolateClick\n ? (e: React.MouseEvent) => {\n e.stopPropagation()\n e.preventDefault()\n }\n : undefined\n\n return (\n <div\n className={cn('dropdown menu anchor', className)}\n style={style}\n onClick={isolateAnchorClick}\n {...hoverHandlers}\n >\n <div\n ref={anchorRef}\n onClick={openOn === 'click' ? handleTriggerClick : undefined}\n onKeyDown={handleTriggerKeyDown}\n role=\"button\"\n tabIndex={0}\n className=\"dropdown menu trigger\"\n >\n {trigger}\n </div>\n <MPopover\n open={open}\n anchorRef={anchorRef}\n onClose={() => setMenuOpen(false)}\n placement={placement}\n className={cn('dropdown menu popover', popoverClassName)}\n style={popoverStyle}\n >\n <div className=\"dropdown menu list\" role=\"menu\" {...hoverHandlers}>\n {Children.map(children, renderChild)}\n </div>\n </MPopover>\n </div>\n )\n}\n\nexport function MDropdownItem({\n icon,\n label,\n href,\n to,\n onClick,\n color,\n disabled = false,\n active = false,\n component,\n className,\n _active,\n _onHover,\n _onClick,\n}: MDropdownItemProps & {_active?: boolean; _onHover?: () => void; _onClick?: () => void}) {\n const isHighlighted = _active ?? active\n\n const content = (\n <>\n {icon && <span className=\"dropdown menu icon\">{icon}</span>}\n <span className=\"dropdown menu label\">{label}</span>\n </>\n )\n\n const cls = cn('dropdown menu item', isHighlighted && 'active', disabled && 'disabled', color, className)\n\n const handleClick = (e: React.MouseEvent) => {\n if (disabled) {\n e.preventDefault()\n return\n }\n onClick?.()\n _onClick?.()\n }\n\n const Tag = component ?? (href || to ? 'a' : 'button')\n const linkProps = component ? {...(href ? {href} : {}), ...(to ? {to} : {})} : href ? {href} : to ? {href: to} : {}\n\n return (\n <Tag\n className={cls}\n role=\"menuitem\"\n tabIndex={-1}\n onClick={handleClick}\n onMouseEnter={_onHover}\n aria-disabled={disabled || undefined}\n {...linkProps}\n >\n {content}\n </Tag>\n )\n}\n;(MDropdownItem as any).__dropdownItem = true\n\nexport function MDropdownGroup({label, children}: MDropdownGroupProps) {\n return (\n <div className=\"dropdown menu group\" role=\"group\">\n <div className=\"dropdown menu group-label\">{label}</div>\n {children}\n </div>\n )\n}\n;(MDropdownGroup as any).__dropdownGroup = true\n\nexport function MDropdownDivider({className}: MDropdownDividerProps) {\n return <div className={cn('dropdown menu divider', className)} role=\"separator\" />\n}\n"],"mappings":"0MAeA,SAAS,EAAS,EAAkC,CAChD,OAAO,EAAG,MAGd,SAAS,EAAO,EAAoC,CAChD,MAAO,CAAC,CAAE,EAAM,KAAa,eAGjC,SAAS,EAAQ,EAAoC,CACjD,MAAO,CAAC,CAAE,EAAM,KAAa,gBAIjC,SAAS,EAAa,EAAiD,CACnE,IAAM,EAA8B,EAAE,CAatC,OAZA,EAAA,SAAS,QAAQ,EAAW,GAAU,EAC9B,EAAA,EAAA,gBAAgB,EAAM,GACtB,EAAO,EAAM,CACb,EAAM,KAAK,EAAM,CACV,EAAQ,EAAM,EACrB,EAAA,SAAS,QAAQ,EAAS,EAAM,CAAC,SAAW,GAAwB,EAChE,EAAA,EAAA,gBAAmB,EAAG,EAAI,EAAO,EAAG,EAChC,EAAM,KAAK,EAAG,EAEpB,GAER,CACK,EAGX,SAAgB,EAAc,CAC1B,UACA,YAAY,eACZ,gBAAgB,GAChB,SAAS,QACT,eACA,eAAe,GACf,YACA,QAC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,OAAD,CAAM,UAAU,8BAAsB,EAAY,CAAA,EAC3D,EAAA,EAAA,KAAC,OAAD,CAAM,UAAU,+BAAuB,EAAa,CAAA,CACrD,CAAA,CAAA,CAGD,EAAM,EAAA,EAAG,qBAAsB,GAAiB,SAAU,GAAY,WAAY,EAAO,EAAU,CAEnG,EAAe,GAAwB,CACzC,GAAI,EAAU,CACV,EAAE,gBAAgB,CAClB,OAEJ,KAAW,CACX,KAAY,EAGV,EAAM,IAAc,GAAQ,EAAK,IAAM,UACvC,EAAY,EAAY,CAAC,GAAI,EAAO,CAAC,OAAK,CAAG,EAAE,CAAG,GAAI,EAAK,CAAC,KAAG,CAAG,EAAE,CAAE,CAAG,EAAO,CAAC,OAAK,CAAG,EAAK,CAAC,KAAM,EAAG,CAAG,EAAE,CAEnH,OACI,EAAA,EAAA,KAAC,EAAD,CACI,UAAW,EACX,KAAK,WACL,SAAU,GACV,QAAS,EACT,aAAc,EACd,gBAAe,GAAY,IAAA,GAC3B,GAAI,WAEH,EACC,CAAA,CAGb,EAAuB,eAAiB,GAEzC,SAAgB,EAAe,CAAC,QAAO,YAAgC,CACnE,OACI,EAAA,EAAA,MAAC,MAAD,CAAK,UAAU,sBAAsB,KAAK,iBAA1C,EACI,EAAA,EAAA,KAAC,MAAD,CAAK,UAAU,qCAA6B,EAAY,CAAA,CACvD,EACC,GAGb,EAAwB,gBAAkB,GAE3C,SAAgB,EAAiB,CAAC,aAAmC,CACjE,OAAO,EAAA,EAAA,KAAC,MAAD,CAAK,UAAW,EAAA,EAAG,wBAAyB,EAAU,CAAE,KAAK,YAAc,CAAA"}
|
|
@@ -1,157 +0,0 @@
|
|
|
1
|
-
import { t as e } from "./cn-YER3QsV1.js";
|
|
2
|
-
import { t } from "./useKeyboardNav-iEXOdEMB.js";
|
|
3
|
-
import { t as n } from "./MPopover-C5aaGhma.js";
|
|
4
|
-
import { Children as r, cloneElement as i, isValidElement as a, useCallback as o, useRef as s, useState as c } from "react";
|
|
5
|
-
import { Fragment as l, jsx as u, jsxs as d } from "react/jsx-runtime";
|
|
6
|
-
//#region src/components/overlays/MDropdownMenu/MDropdownMenu.tsx
|
|
7
|
-
function f(e) {
|
|
8
|
-
return e.props;
|
|
9
|
-
}
|
|
10
|
-
function p(e) {
|
|
11
|
-
return !!e.type.__dropdownItem;
|
|
12
|
-
}
|
|
13
|
-
function m(e) {
|
|
14
|
-
return !!e.type.__dropdownGroup;
|
|
15
|
-
}
|
|
16
|
-
function h(e) {
|
|
17
|
-
let t = [];
|
|
18
|
-
return r.forEach(e, (e) => {
|
|
19
|
-
a(e) && (p(e) ? t.push(e) : m(e) && r.forEach(f(e).children, (e) => {
|
|
20
|
-
a(e) && p(e) && t.push(e);
|
|
21
|
-
}));
|
|
22
|
-
}), t;
|
|
23
|
-
}
|
|
24
|
-
function g({ trigger: l, placement: g = "bottom-start", closeOnSelect: _ = !0, openOn: v = "click", onOpenChange: y, isolateClick: b = !1, className: x, style: S, popoverClassName: C, popoverStyle: w, children: T }) {
|
|
25
|
-
let [E, D] = c(!1), O = s(null), k = s(null), A = h(T), j = A.filter((e) => !f(e).disabled).length, M = o((e) => {
|
|
26
|
-
D((t) => {
|
|
27
|
-
let n = typeof e == "function" ? e(t) : e;
|
|
28
|
-
return y?.(n), n;
|
|
29
|
-
});
|
|
30
|
-
}, [y]), { activeIndex: N, setActiveIndex: P, onKeyDown: F } = t({
|
|
31
|
-
itemCount: j,
|
|
32
|
-
onSelect: o((e) => {
|
|
33
|
-
let t = 0;
|
|
34
|
-
for (let n of A) {
|
|
35
|
-
let r = f(n);
|
|
36
|
-
if (!r.disabled) {
|
|
37
|
-
if (t === e) {
|
|
38
|
-
r.onClick?.();
|
|
39
|
-
break;
|
|
40
|
-
}
|
|
41
|
-
t++;
|
|
42
|
-
}
|
|
43
|
-
}
|
|
44
|
-
_ && M(!1);
|
|
45
|
-
}, [
|
|
46
|
-
A,
|
|
47
|
-
_,
|
|
48
|
-
M
|
|
49
|
-
]),
|
|
50
|
-
onClose: () => D(!1),
|
|
51
|
-
isOpen: E
|
|
52
|
-
}), I = (e) => {
|
|
53
|
-
b && (e.stopPropagation(), e.preventDefault()), M((e) => !e);
|
|
54
|
-
}, L = (e) => {
|
|
55
|
-
(e.key === "ArrowDown" || e.key === "Enter" || e.key === " ") && (e.preventDefault(), b && e.stopPropagation(), M(!0)), E && F(e);
|
|
56
|
-
}, R = 0, z = (e) => {
|
|
57
|
-
if (!a(e)) return e;
|
|
58
|
-
if (p(e)) {
|
|
59
|
-
let t = f(e).disabled, n = t ? -1 : R++;
|
|
60
|
-
return i(e, {
|
|
61
|
-
_active: n === N,
|
|
62
|
-
_onHover: t ? void 0 : () => P(n),
|
|
63
|
-
_onClick: () => {
|
|
64
|
-
t || _ && M(!1);
|
|
65
|
-
}
|
|
66
|
-
});
|
|
67
|
-
}
|
|
68
|
-
return m(e) ? i(e, { children: r.map(f(e).children, z) }) : e;
|
|
69
|
-
}, B = v === "hover" ? {
|
|
70
|
-
onMouseEnter: () => {
|
|
71
|
-
k.current && clearTimeout(k.current), M(!0);
|
|
72
|
-
},
|
|
73
|
-
onMouseLeave: () => {
|
|
74
|
-
k.current = setTimeout(() => M(!1), 150);
|
|
75
|
-
}
|
|
76
|
-
} : {}, V = b ? (e) => {
|
|
77
|
-
e.stopPropagation(), e.preventDefault();
|
|
78
|
-
} : void 0;
|
|
79
|
-
return /* @__PURE__ */ d("div", {
|
|
80
|
-
className: e("dropdown menu anchor", x),
|
|
81
|
-
style: S,
|
|
82
|
-
onClick: V,
|
|
83
|
-
...B,
|
|
84
|
-
children: [/* @__PURE__ */ u("div", {
|
|
85
|
-
ref: O,
|
|
86
|
-
onClick: v === "click" ? I : void 0,
|
|
87
|
-
onKeyDown: L,
|
|
88
|
-
role: "button",
|
|
89
|
-
tabIndex: 0,
|
|
90
|
-
className: "dropdown menu trigger",
|
|
91
|
-
children: l
|
|
92
|
-
}), /* @__PURE__ */ u(n, {
|
|
93
|
-
open: E,
|
|
94
|
-
anchorRef: O,
|
|
95
|
-
onClose: () => M(!1),
|
|
96
|
-
placement: g,
|
|
97
|
-
className: e("dropdown menu popover", C),
|
|
98
|
-
style: w,
|
|
99
|
-
children: /* @__PURE__ */ u("div", {
|
|
100
|
-
className: "dropdown menu list",
|
|
101
|
-
role: "menu",
|
|
102
|
-
...B,
|
|
103
|
-
children: r.map(T, z)
|
|
104
|
-
})
|
|
105
|
-
})]
|
|
106
|
-
});
|
|
107
|
-
}
|
|
108
|
-
function _({ icon: t, label: n, href: r, to: i, onClick: a, color: o, disabled: s = !1, active: c = !1, component: f, className: p, _active: m, _onHover: h, _onClick: g }) {
|
|
109
|
-
let _ = m ?? c, v = /* @__PURE__ */ d(l, { children: [t && /* @__PURE__ */ u("span", {
|
|
110
|
-
className: "dropdown menu icon",
|
|
111
|
-
children: t
|
|
112
|
-
}), /* @__PURE__ */ u("span", {
|
|
113
|
-
className: "dropdown menu label",
|
|
114
|
-
children: n
|
|
115
|
-
})] }), y = e("dropdown menu item", _ && "active", s && "disabled", o, p), b = (e) => {
|
|
116
|
-
if (s) {
|
|
117
|
-
e.preventDefault();
|
|
118
|
-
return;
|
|
119
|
-
}
|
|
120
|
-
a?.(), g?.();
|
|
121
|
-
}, x = f ?? (r || i ? "a" : "button"), S = f ? {
|
|
122
|
-
...r ? { href: r } : {},
|
|
123
|
-
...i ? { to: i } : {}
|
|
124
|
-
} : r ? { href: r } : i ? { href: i } : {};
|
|
125
|
-
return /* @__PURE__ */ u(x, {
|
|
126
|
-
className: y,
|
|
127
|
-
role: "menuitem",
|
|
128
|
-
tabIndex: -1,
|
|
129
|
-
onClick: b,
|
|
130
|
-
onMouseEnter: h,
|
|
131
|
-
"aria-disabled": s || void 0,
|
|
132
|
-
...S,
|
|
133
|
-
children: v
|
|
134
|
-
});
|
|
135
|
-
}
|
|
136
|
-
_.__dropdownItem = !0;
|
|
137
|
-
function v({ label: e, children: t }) {
|
|
138
|
-
return /* @__PURE__ */ d("div", {
|
|
139
|
-
className: "dropdown menu group",
|
|
140
|
-
role: "group",
|
|
141
|
-
children: [/* @__PURE__ */ u("div", {
|
|
142
|
-
className: "dropdown menu group-label",
|
|
143
|
-
children: e
|
|
144
|
-
}), t]
|
|
145
|
-
});
|
|
146
|
-
}
|
|
147
|
-
v.__dropdownGroup = !0;
|
|
148
|
-
function y({ className: t }) {
|
|
149
|
-
return /* @__PURE__ */ u("div", {
|
|
150
|
-
className: e("dropdown menu divider", t),
|
|
151
|
-
role: "separator"
|
|
152
|
-
});
|
|
153
|
-
}
|
|
154
|
-
//#endregion
|
|
155
|
-
export { g as i, v as n, _ as r, y as t };
|
|
156
|
-
|
|
157
|
-
//# sourceMappingURL=MDropdownMenu-CFoKJ7V6.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"MDropdownMenu-CFoKJ7V6.js","names":[],"sources":["../src/components/overlays/MDropdownMenu/MDropdownMenu.tsx"],"sourcesContent":["import {useState, useRef, useCallback, Children, isValidElement, cloneElement} from 'react'\nimport type * as React from 'react'\nimport {MPopover} from '../../primitives'\nimport {useKeyboardNav} from '../../../utils/useKeyboardNav'\nimport {cn} from '../../../utils/cn'\nimport type {\n MDropdownMenuProps,\n MDropdownItemProps,\n MDropdownGroupProps,\n MDropdownDividerProps,\n} from './MDropdownMenu.types'\nimport './MDropdownMenu.css'\n\ntype AnyProps = Record<string, any>\n\nfunction getProps(el: React.ReactElement): AnyProps {\n return el.props as AnyProps\n}\n\nfunction isItem(child: React.ReactElement): boolean {\n return !!(child.type as any).__dropdownItem\n}\n\nfunction isGroup(child: React.ReactElement): boolean {\n return !!(child.type as any).__dropdownGroup\n}\n\n// Collect all MDropdownItem elements from children (including inside groups).\nfunction collectItems(children: React.ReactNode): React.ReactElement[] {\n const items: React.ReactElement[] = []\n Children.forEach(children, (child) => {\n if (!isValidElement(child)) return\n if (isItem(child)) {\n items.push(child)\n } else if (isGroup(child)) {\n Children.forEach(getProps(child).children, (gc: React.ReactNode) => {\n if (isValidElement(gc) && isItem(gc)) {\n items.push(gc)\n }\n })\n }\n })\n return items\n}\n\nexport function MDropdownMenu({\n trigger,\n placement = 'bottom-start',\n closeOnSelect = true,\n openOn = 'click',\n onOpenChange,\n isolateClick = false,\n className,\n style,\n popoverClassName,\n popoverStyle,\n children,\n}: MDropdownMenuProps) {\n const [open, setOpen] = useState(false)\n const anchorRef = useRef<HTMLDivElement>(null)\n const hoverTimeout = useRef<ReturnType<typeof setTimeout>>(null)\n\n const items = collectItems(children)\n const enabledCount = items.filter((i) => !getProps(i).disabled).length\n\n const setMenuOpen = useCallback(\n (next: boolean | ((prev: boolean) => boolean)) => {\n setOpen((prev) => {\n const resolved = typeof next === 'function' ? next(prev) : next\n onOpenChange?.(resolved)\n return resolved\n })\n },\n [onOpenChange]\n )\n\n const handleSelect = useCallback(\n (index: number) => {\n let enabledIdx = 0\n for (const item of items) {\n const p = getProps(item)\n if (p.disabled) continue\n if (enabledIdx === index) {\n p.onClick?.()\n break\n }\n enabledIdx++\n }\n if (closeOnSelect) setMenuOpen(false)\n },\n [items, closeOnSelect, setMenuOpen]\n )\n\n const {activeIndex, setActiveIndex, onKeyDown} = useKeyboardNav({\n itemCount: enabledCount,\n onSelect: handleSelect,\n onClose: () => setOpen(false),\n isOpen: open,\n })\n\n const handleTriggerClick = (e: React.MouseEvent) => {\n if (isolateClick) {\n e.stopPropagation()\n e.preventDefault()\n }\n setMenuOpen((o) => !o)\n }\n\n const handleTriggerKeyDown = (e: React.KeyboardEvent) => {\n if (e.key === 'ArrowDown' || e.key === 'Enter' || e.key === ' ') {\n e.preventDefault()\n if (isolateClick) e.stopPropagation()\n setMenuOpen(true)\n }\n if (open) onKeyDown(e as any)\n }\n\n // Map active index back to flat child rendering with enabled-only tracking.\n let enabledIdx = 0\n const renderChild = (child: React.ReactNode): React.ReactNode => {\n if (!isValidElement(child)) return child\n\n if (isItem(child)) {\n const p = getProps(child)\n const isDisabled = p.disabled\n const idx = isDisabled ? -1 : enabledIdx++\n return cloneElement(child, {\n _active: idx === activeIndex,\n _onHover: isDisabled ? undefined : () => setActiveIndex(idx),\n _onClick: () => {\n if (isDisabled) return\n if (closeOnSelect) setMenuOpen(false)\n },\n } as AnyProps)\n }\n\n if (isGroup(child)) {\n return cloneElement(child, {\n children: Children.map(getProps(child).children, renderChild),\n } as AnyProps)\n }\n\n return child\n }\n\n const hoverHandlers =\n openOn === 'hover'\n ? {\n onMouseEnter: () => {\n if (hoverTimeout.current) clearTimeout(hoverTimeout.current)\n setMenuOpen(true)\n },\n onMouseLeave: () => {\n hoverTimeout.current = setTimeout(() => setMenuOpen(false), 150)\n },\n }\n : {}\n\n /**\n * When `isolateClick` is set, every click bubbling out of the menu\n * (trigger AND items) must be stopped — otherwise selecting an action\n * also fires the click handler on a clickable parent (Link, MCard with\n * onClick, MDataTable row link). Trigger click itself is handled by\n * `handleTriggerClick`; this wrapper catches the bubbled item clicks\n * before they leave the anchor. `preventDefault` is needed too — when the\n * dropdown is rendered inside an `<a href>` (MCard component={Link}),\n * stopping propagation alone does not block native link navigation.\n *\n * Caveat: MDropdownItem with `href` will not navigate while inside an\n * `isolateClick` menu — use programmatic navigation (onClick + navigate)\n * in those contexts instead.\n */\n const isolateAnchorClick = isolateClick\n ? (e: React.MouseEvent) => {\n e.stopPropagation()\n e.preventDefault()\n }\n : undefined\n\n return (\n <div\n className={cn('dropdown menu anchor', className)}\n style={style}\n onClick={isolateAnchorClick}\n {...hoverHandlers}\n >\n <div\n ref={anchorRef}\n onClick={openOn === 'click' ? handleTriggerClick : undefined}\n onKeyDown={handleTriggerKeyDown}\n role=\"button\"\n tabIndex={0}\n className=\"dropdown menu trigger\"\n >\n {trigger}\n </div>\n <MPopover\n open={open}\n anchorRef={anchorRef}\n onClose={() => setMenuOpen(false)}\n placement={placement}\n className={cn('dropdown menu popover', popoverClassName)}\n style={popoverStyle}\n >\n <div className=\"dropdown menu list\" role=\"menu\" {...hoverHandlers}>\n {Children.map(children, renderChild)}\n </div>\n </MPopover>\n </div>\n )\n}\n\nexport function MDropdownItem({\n icon,\n label,\n href,\n to,\n onClick,\n color,\n disabled = false,\n active = false,\n component,\n className,\n _active,\n _onHover,\n _onClick,\n}: MDropdownItemProps & {_active?: boolean; _onHover?: () => void; _onClick?: () => void}) {\n const isHighlighted = _active ?? active\n\n const content = (\n <>\n {icon && <span className=\"dropdown menu icon\">{icon}</span>}\n <span className=\"dropdown menu label\">{label}</span>\n </>\n )\n\n const cls = cn('dropdown menu item', isHighlighted && 'active', disabled && 'disabled', color, className)\n\n const handleClick = (e: React.MouseEvent) => {\n if (disabled) {\n e.preventDefault()\n return\n }\n onClick?.()\n _onClick?.()\n }\n\n const Tag = component ?? (href || to ? 'a' : 'button')\n const linkProps = component ? {...(href ? {href} : {}), ...(to ? {to} : {})} : href ? {href} : to ? {href: to} : {}\n\n return (\n <Tag\n className={cls}\n role=\"menuitem\"\n tabIndex={-1}\n onClick={handleClick}\n onMouseEnter={_onHover}\n aria-disabled={disabled || undefined}\n {...linkProps}\n >\n {content}\n </Tag>\n )\n}\n;(MDropdownItem as any).__dropdownItem = true\n\nexport function MDropdownGroup({label, children}: MDropdownGroupProps) {\n return (\n <div className=\"dropdown menu group\" role=\"group\">\n <div className=\"dropdown menu group-label\">{label}</div>\n {children}\n </div>\n )\n}\n;(MDropdownGroup as any).__dropdownGroup = true\n\nexport function MDropdownDivider({className}: MDropdownDividerProps) {\n return <div className={cn('dropdown menu divider', className)} role=\"separator\" />\n}\n"],"mappings":";;;;;;AAeA,SAAS,EAAS,GAAkC;AAChD,QAAO,EAAG;;AAGd,SAAS,EAAO,GAAoC;AAChD,QAAO,CAAC,CAAE,EAAM,KAAa;;AAGjC,SAAS,EAAQ,GAAoC;AACjD,QAAO,CAAC,CAAE,EAAM,KAAa;;AAIjC,SAAS,EAAa,GAAiD;CACnE,IAAM,IAA8B,EAAE;AAatC,QAZA,EAAS,QAAQ,IAAW,MAAU;AAC7B,IAAe,EAAM,KACtB,EAAO,EAAM,GACb,EAAM,KAAK,E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A,eACuF;CACvF,IAAM,IAAgB,KAAW,GAE3B,IACF,kBAAA,GAAA,EAAA,UAAA,CACK,KAAQ,kBAAC,QAAD;EAAM,WAAU;YAAsB;EAAY,CAAA,EAC3D,kBAAC,QAAD;EAAM,WAAU;YAAuB;EAAa,CAAA,CACrD,EAAA,CAAA,EAGD,IAAM,EAAG,sBAAsB,KAAiB,UAAU,KAAY,YAAY,GAAO,EAAU,EAEnG,KAAe,MAAwB;AACzC,MAAI,GAAU;AACV,KAAE,gBAAgB;AAClB;;AAGJ,EADA,KAAW,EACX,KAAY;IAGV,IAAM,MAAc,KAAQ,IAAK,MAAM,WACvC,IAAY,IAAY;EAAC,GAAI,IAAO,EAAC,SAAK,GAAG,EAAE;EAAG,GAAI,IAAK,EAAC,OAAG,GAAG,EAAE;EAAE,GAAG,IAAO,EAAC,SAAK,GAAG,IAAK,EAAC,MAAM,GAAG,GAAG,EAAE;AAEnH,QACI,kBAAC,GAAD;EACI,WAAW;EACX,MAAK;EACL,UAAU;EACV,SAAS;EACT,cAAc;EACd,iBAAe,KAAY,KAAA;EAC3B,GAAI;YAEH;EACC,CAAA;;AAGb,EAAuB,iBAAiB;AAEzC,SAAgB,EAAe,EAAC,UAAO,eAAgC;AACnE,QACI,kBAAC,OAAD;EAAK,WAAU;EAAsB,MAAK;YAA1C,CACI,kBAAC,OAAD;GAAK,WAAU;aAA6B;GAAY,CAAA,EACvD,EACC;;;AAGb,EAAwB,kBAAkB;AAE3C,SAAgB,EAAiB,EAAC,gBAAmC;AACjE,QAAO,kBAAC,OAAD;EAAK,WAAW,EAAG,yBAAyB,EAAU;EAAE,MAAK;EAAc,CAAA"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"MPopover-C5aaGhma.js","names":[],"sources":["../src/components/primitives/MPopover/popoverStack.ts","../src/components/primitives/MPopover/MPopover.tsx"],"sourcesContent":["/**\n * Registry of currently-open MPopover instances.\n *\n * Every popover portals its content to `document.body`, so a popover opened\n * from inside another popover is NOT a DOM descendant of its parent. That\n * breaks the naive outside-click test (`parent.contains(target)`): pressing a\n * nested dropdown item looks like an outside click to the parent, the parent\n * closes, React unmounts the nested menu mid-gesture, and the browser never\n * gets to fire `click` because mousedown and mouseup landed on different\n * elements. The action silently does nothing.\n *\n * This registry restores the nesting relation the DOM lost. Nesting is derived\n * from where each popover's ANCHOR lives, not from open order: a popover whose\n * anchor sits inside another popover's element is that popover's child. Open\n * order would misclassify two independent popovers that happen to be open at\n * the same time — clicking the newer one must still close the older one.\n */\n\nexport interface PopoverRegistration {\n id: number\n getPopoverEl: () => HTMLElement | null\n getAnchorEl: () => HTMLElement | null\n}\n\nconst registrations: PopoverRegistration[] = []\nlet nextId = 1\n\nexport function nextPopoverId(): number {\n return nextId++\n}\n\nexport function registerPopover(registration: PopoverRegistration): () => void {\n registrations.push(registration)\n return () => {\n const index = registrations.indexOf(registration)\n if (index !== -1) registrations.splice(index, 1)\n }\n}\n\n/** The registered popover whose element contains `entry`'s anchor, if any. */\nfunction parentIdOf(entry: PopoverRegistration): number | null {\n const anchor = entry.getAnchorEl()\n if (!anchor) return null\n\n for (const other of registrations) {\n if (other.id === entry.id) continue\n const element = other.getPopoverEl()\n if (element && element.contains(anchor)) return other.id\n }\n\n return null\n}\n\n/**\n * True when `target` lies inside a popover that is nested (at any depth) within\n * the popover identified by `id`. Callers use it to keep a parent open while\n * the interaction belongs to one of its descendants.\n */\nexport function isInsideDescendantPopover(id: number, target: Node | null): boolean {\n if (!target) return false\n\n for (const entry of registrations) {\n if (entry.id === id) continue\n\n const element = entry.getPopoverEl()\n if (!element || !element.contains(target)) continue\n\n // Walk the ancestor chain of the popover that was actually hit.\n // `seen` guards against a cycle if a malformed tree ever produces one.\n const seen = new Set<number>()\n let cursor = parentIdOf(entry)\n\n while (cursor !== null && !seen.has(cursor)) {\n if (cursor === id) return true\n seen.add(cursor)\n const parent = registrations.find((candidate) => candidate.id === cursor)\n cursor = parent ? parentIdOf(parent) : null\n }\n }\n\n return false\n}\n\n/** Test-only helper — the registry is module state that outlives a render. */\nexport function __resetPopoverStack(): void {\n registrations.length = 0\n nextId = 1\n}\n","import {useState, useEffect, useRef, useCallback} from 'react'\nimport {MPortal} from '../MPortal'\nimport {cn} from '../../../utils/cn'\nimport {isInsideDescendantPopover, nextPopoverId, registerPopover} from './popoverStack'\nimport type {MPopoverProps} from './MPopover.types'\nimport './MPopover.css'\n\n// Position floating content relative to an anchor with viewport-aware flipping.\nexport function MPopover({\n open,\n anchorRef,\n onClose,\n placement = 'bottom-start',\n matchWidth = false,\n offset = 4,\n zIndex,\n children,\n className,\n style,\n}: MPopoverProps) {\n const popoverRef = useRef<HTMLDivElement>(null)\n const popoverIdRef = useRef<number>(null)\n if (popoverIdRef.current === null) popoverIdRef.current = nextPopoverId()\n const popoverId = popoverIdRef.current\n const [position, setPosition] = useState<{top: number; left: number; width?: number} | null>(null)\n const [flipped, setFlipped] = useState(false)\n const [layerZ, setLayerZ] = useState<number | string | null>(null)\n\n // Lift popovers above drawers, modals and mobile sidebars when the anchor sits inside them.\n const updateLayer = useCallback(() => {\n if (zIndex !== undefined) {\n setLayerZ(zIndex)\n return\n }\n\n const anchor = anchorRef.current\n if (!anchor || typeof window === 'undefined') {\n setLayerZ(null)\n return\n }\n\n const layerHost = anchor.closest(\n '.drawer-backdrop, .modal-backdrop, .sheet-backdrop, .sidebar.mobile-open, .popover'\n )\n if (!layerHost) {\n setLayerZ(null)\n return\n }\n\n const computedZ = window.getComputedStyle(layerHost).zIndex\n const parsedZ = Number.parseInt(computedZ, 10)\n setLayerZ(Number.isFinite(parsedZ) ? parsedZ + 1 : null)\n }, [anchorRef, zIndex])\n\n // Recalculate popover position whenever layout or viewport constraints change.\n const updatePosition = useCallback(() => {\n if (!anchorRef.current || !popoverRef.current) return\n\n const anchor = anchorRef.current.getBoundingClientRect()\n const popover = popoverRef.current.getBoundingClientRect()\n const viewport = {\n width: window.innerWidth,\n height: window.innerHeight,\n }\n\n const isTop = placement.startsWith('top')\n const isRight = placement.startsWith('right')\n const isLeft = placement.startsWith('left')\n const isHorizontal = isRight || isLeft\n const isEnd = placement.endsWith('end')\n\n let top: number\n let left: number\n\n if (isHorizontal) {\n // Horizontal placement: position to the right or left of the anchor\n const spaceRight = viewport.width - anchor.right - offset\n const spaceLeft = anchor.left - offset\n const shouldFlip = isRight\n ? spaceRight < popover.width && spaceLeft > spaceRight\n : spaceLeft < popover.width && spaceRight > spaceLeft\n\n setFlipped(shouldFlip)\n\n const showOnRight = isRight ? !shouldFlip : shouldFlip\n\n if (showOnRight) {\n left = anchor.right + offset + window.scrollX\n } else {\n left = anchor.left - popover.width - offset + window.scrollX\n }\n\n if (isEnd) {\n top = anchor.bottom - popover.height + window.scrollY\n } else {\n top = anchor.top + window.scrollY\n }\n } else {\n // Vertical placement: position above or below the anchor\n const spaceBelow = viewport.height - anchor.bottom - offset\n const spaceAbove = anchor.top - offset\n const shouldFlip = isTop\n ? spaceAbove < popover.height && spaceBelow > spaceAbove\n : spaceBelow < popover.height && spaceAbove > spaceBelow\n\n setFlipped(shouldFlip)\n\n const showOnTop = isTop ? !shouldFlip : shouldFlip\n\n if (showOnTop) {\n top = anchor.top - popover.height - offset + window.scrollY\n } else {\n top = anchor.bottom + offset + window.scrollY\n }\n\n if (isEnd) {\n left = anchor.right - popover.width + window.scrollX\n } else {\n left = anchor.left + window.scrollX\n }\n }\n\n // Clamp to viewport\n left = Math.max(8, Math.min(left, viewport.width - popover.width - 8))\n top = Math.max(8 + window.scrollY, top)\n\n setPosition({\n top,\n left,\n width: matchWidth ? anchor.width : undefined,\n })\n }, [anchorRef, placement, offset, matchWidth])\n\n useEffect(() => {\n if (!open) {\n setPosition(null)\n setLayerZ(null)\n return\n }\n\n updateLayer()\n // Wait one frame so the rendered popover can be measured accurately.\n requestAnimationFrame(updatePosition)\n\n // `scroll` does not bubble, so a window listener only ever sees the\n // document scrolling. Anchors living inside a scrollable ancestor — an\n // app shell with a scrolling main region, MStickyPanel, an overflowing\n // card — would leave the popover stranded at its opening coordinates\n // while the anchor moved away underneath it. Scroll events do capture,\n // so a capture-phase listener on the document catches scrolling from\n // ANY container, including the document itself.\n document.addEventListener('scroll', updatePosition, {capture: true, passive: true})\n window.addEventListener('resize', updatePosition, {passive: true})\n return () => {\n document.removeEventListener('scroll', updatePosition, {capture: true})\n window.removeEventListener('resize', updatePosition)\n }\n }, [open, updateLayer, updatePosition])\n\n // Close the popover with the standard Escape key interaction.\n useEffect(() => {\n if (!open) return\n const handleKey = (e: KeyboardEvent) => {\n if (e.key === 'Escape') onClose()\n }\n document.addEventListener('keydown', handleKey)\n return () => document.removeEventListener('keydown', handleKey)\n }, [open, onClose])\n\n // Publish this instance while it is open so nested popovers can be related\n // back to it — see popoverStack.ts for why the DOM alone cannot answer this.\n useEffect(() => {\n if (!open) return\n return registerPopover({\n id: popoverId,\n getPopoverEl: () => popoverRef.current,\n getAnchorEl: () => anchorRef.current,\n })\n }, [open, popoverId, anchorRef])\n\n // Close when the user interacts outside both the popover and its anchor.\n useEffect(() => {\n if (!open) return\n const handleClick = (e: MouseEvent) => {\n const target = e.target as Node\n\n if (popoverRef.current?.contains(target) || anchorRef.current?.contains(target)) {\n return\n }\n\n // A popover nested inside this one is portaled to `document.body`,\n // so it fails the `contains` checks above even though the click\n // belongs to this popover's own subtree. Closing here would unmount\n // that child between mousedown and mouseup and swallow its click.\n if (isInsideDescendantPopover(popoverId, target)) {\n return\n }\n\n onClose()\n }\n document.addEventListener('mousedown', handleClick)\n return () => document.removeEventListener('mousedown', handleClick)\n }, [open, onClose, anchorRef, popoverId])\n\n if (!open) return null\n\n return (\n <MPortal>\n <div\n ref={popoverRef}\n className={cn('popover', flipped ? 'flipped' : 'normal', className)}\n style={{\n position: 'absolute',\n top: position?.top ?? 0,\n left: position?.left ?? 0,\n width: position?.width,\n zIndex: layerZ ?? undefined,\n visibility: position ? 'visible' : 'hidden',\n ...style,\n }}\n role=\"listbox\"\n >\n {children}\n </div>\n </MPortal>\n )\n}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AAC,GAAM,EAAQ,CAAC,EAInB,QAAgB;AACP,QACL,QAAO,EAAgB;GACnB,IAAI;GACJ,oBAAoB,EAAW;GAC/B,mBAAmB,EAAU;GAChC,CAAC;IACH;EAAC;EAAM;EAAW;EAAU,CAAC,EAGhC,QAAgB;AACZ,MAAI,CAAC,EAAM;EACX,IAAM,KAAe,MAAkB;GACnC,IAAM,IAAS,EAAE;AAEb,KAAW,SAAS,SAAS,EAAO,IAAI,EAAU,SAAS,SAAS,EAAO,IAQ3E,EAA0B,GAAW,EAAO,IAIhD,GAAS;;AAGb,SADA,SAAS,iBAAiB,aAAa,EAAY,QACtC,SAAS,oBAAoB,aAAa,EAAY;IACpE;EAAC;EAAM;EAAS;EAAW;EAAU,CAAC,EAEpC,IAGD,kBAAC,GAAD,EAAA,UACI,kBAAC,OAAD;EACI,KAAK;EACL,WAAW,EAAG,WAAW,IAAU,YAAY,UAAU,EAAU;EACnE,OAAO;GACH,UAAU;GACV,KAAK,GAAU,OAAO;GACtB,MAAM,GAAU,QAAQ;GACxB,OAAO,GAAU;GACjB,QAAQ,KAAU,KAAA;GAClB,YAAY,IAAW,YAAY;GACnC,GAAG;GACN;EACD,MAAK;EAEJ;EACC,CAAA,EACA,CAAA,GApBI"}
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
const e=require(`./cn-CU5TNITO.cjs`),t=require(`./MPortal-BciZHNDC.cjs`);require(`./core-DBpQf3uY.cjs`);let n=require(`react`),r=require(`react/jsx-runtime`);var i=[],a=1;function o(){return a++}function s(e){return i.push(e),()=>{let t=i.indexOf(e);t!==-1&&i.splice(t,1)}}function c(e){let t=e.getAnchorEl();if(!t)return null;for(let n of i){if(n.id===e.id)continue;let r=n.getPopoverEl();if(r&&r.contains(t))return n.id}return null}function l(e,t){if(!t)return!1;for(let n of i){if(n.id===e)continue;let r=n.getPopoverEl();if(!r||!r.contains(t))continue;let a=new Set,o=c(n);for(;o!==null&&!a.has(o);){if(o===e)return!0;a.add(o);let t=i.find(e=>e.id===o);o=t?c(t):null}}return!1}function u({open:i,anchorRef:a,onClose:c,placement:u=`bottom-start`,matchWidth:d=!1,offset:f=4,zIndex:p,children:m,className:h,style:g}){let _=(0,n.useRef)(null),v=(0,n.useRef)(null);v.current===null&&(v.current=o());let y=v.current,[b,x]=(0,n.useState)(null),[S,C]=(0,n.useState)(!1),[w,T]=(0,n.useState)(null),E=(0,n.useCallback)(()=>{if(p!==void 0){T(p);return}let e=a.current;if(!e||typeof window>`u`){T(null);return}let t=e.closest(`.drawer-backdrop, .modal-backdrop, .sheet-backdrop, .sidebar.mobile-open, .popover`);if(!t){T(null);return}let n=window.getComputedStyle(t).zIndex,r=Number.parseInt(n,10);T(Number.isFinite(r)?r+1:null)},[a,p]),D=(0,n.useCallback)(()=>{if(!a.current||!_.current)return;let e=a.current.getBoundingClientRect(),t=_.current.getBoundingClientRect(),n={width:window.innerWidth,height:window.innerHeight},r=u.startsWith(`top`),i=u.startsWith(`right`),o=u.startsWith(`left`),s=i||o,c=u.endsWith(`end`),l,p;if(s){let r=n.width-e.right-f,a=e.left-f,o=i?r<t.width&&a>r:a<t.width&&r>a;C(o),p=(i?!o:o)?e.right+f+window.scrollX:e.left-t.width-f+window.scrollX,l=c?e.bottom-t.height+window.scrollY:e.top+window.scrollY}else{let i=n.height-e.bottom-f,a=e.top-f,o=r?a<t.height&&i>a:i<t.height&&a>i;C(o),l=(r?!o:o)?e.top-t.height-f+window.scrollY:e.bottom+f+window.scrollY,p=c?e.right-t.width+window.scrollX:e.left+window.scrollX}p=Math.max(8,Math.min(p,n.width-t.width-8)),l=Math.max(8+window.scrollY,l),x({top:l,left:p,width:d?e.width:void 0})},[a,u,f,d]);return(0,n.useEffect)(()=>{if(!i){x(null),T(null);return}return E(),requestAnimationFrame(D),document.addEventListener(`scroll`,D,{capture:!0,passive:!0}),window.addEventListener(`resize`,D,{passive:!0}),()=>{document.removeEventListener(`scroll`,D,{capture:!0}),window.removeEventListener(`resize`,D)}},[i,E,D]),(0,n.useEffect)(()=>{if(!i)return;let e=e=>{e.key===`Escape`&&c()};return document.addEventListener(`keydown`,e),()=>document.removeEventListener(`keydown`,e)},[i,c]),(0,n.useEffect)(()=>{if(i)return s({id:y,getPopoverEl:()=>_.current,getAnchorEl:()=>a.current})},[i,y,a]),(0,n.useEffect)(()=>{if(!i)return;let e=e=>{let t=e.target;_.current?.contains(t)||a.current?.contains(t)||l(y,t)||c()};return document.addEventListener(`mousedown`,e),()=>document.removeEventListener(`mousedown`,e)},[i,c,a,y]),i?(0,r.jsx)(t.t,{children:(0,r.jsx)(`div`,{ref:_,className:e.t(`popover`,S?`flipped`:`normal`,h),style:{position:`absolute`,top:b?.top??0,left:b?.left??0,width:b?.width,zIndex:w??void 0,visibility:b?`visible`:`hidden`,...g},role:`listbox`,children:m})}):null}Object.defineProperty(exports,`t`,{enumerable:!0,get:function(){return u}});
|
|
2
|
-
//# sourceMappingURL=MPopover-CV-9MArH.cjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"MPopover-CV-9MArH.cjs","names":[],"sources":["../src/components/primitives/MPopover/popoverStack.ts","../src/components/primitives/MPopover/MPopover.tsx"],"sourcesContent":["/**\n * Registry of currently-open MPopover instances.\n *\n * Every popover portals its content to `document.body`, so a popover opened\n * from inside another popover is NOT a DOM descendant of its parent. That\n * breaks the naive outside-click test (`parent.contains(target)`): pressing a\n * nested dropdown item looks like an outside click to the parent, the parent\n * closes, React unmounts the nested menu mid-gesture, and the browser never\n * gets to fire `click` because mousedown and mouseup landed on different\n * elements. The action silently does nothing.\n *\n * This registry restores the nesting relation the DOM lost. Nesting is derived\n * from where each popover's ANCHOR lives, not from open order: a popover whose\n * anchor sits inside another popover's element is that popover's child. Open\n * order would misclassify two independent popovers that happen to be open at\n * the same time — clicking the newer one must still close the older one.\n */\n\nexport interface PopoverRegistration {\n id: number\n getPopoverEl: () => HTMLElement | null\n getAnchorEl: () => HTMLElement | null\n}\n\nconst registrations: PopoverRegistration[] = []\nlet nextId = 1\n\nexport function nextPopoverId(): number {\n return nextId++\n}\n\nexport function registerPopover(registration: PopoverRegistration): () => void {\n registrations.push(registration)\n return () => {\n const index = registrations.indexOf(registration)\n if (index !== -1) registrations.splice(index, 1)\n }\n}\n\n/** The registered popover whose element contains `entry`'s anchor, if any. */\nfunction parentIdOf(entry: PopoverRegistration): number | null {\n const anchor = entry.getAnchorEl()\n if (!anchor) return null\n\n for (const other of registrations) {\n if (other.id === entry.id) continue\n const element = other.getPopoverEl()\n if (element && element.contains(anchor)) return other.id\n }\n\n return null\n}\n\n/**\n * True when `target` lies inside a popover that is nested (at any depth) within\n * the popover identified by `id`. Callers use it to keep a parent open while\n * the interaction belongs to one of its descendants.\n */\nexport function isInsideDescendantPopover(id: number, target: Node | null): boolean {\n if (!target) return false\n\n for (const entry of registrations) {\n if (entry.id === id) continue\n\n const element = entry.getPopoverEl()\n if (!element || !element.contains(target)) continue\n\n // Walk the ancestor chain of the popover that was actually hit.\n // `seen` guards against a cycle if a malformed tree ever produces one.\n const seen = new Set<number>()\n let cursor = parentIdOf(entry)\n\n while (cursor !== null && !seen.has(cursor)) {\n if (cursor === id) return true\n seen.add(cursor)\n const parent = registrations.find((candidate) => candidate.id === cursor)\n cursor = parent ? parentIdOf(parent) : null\n }\n }\n\n return false\n}\n\n/** Test-only helper — the registry is module state that outlives a render. */\nexport function __resetPopoverStack(): void {\n registrations.length = 0\n nextId = 1\n}\n","import {useState, useEffect, useRef, useCallback} from 'react'\nimport {MPortal} from '../MPortal'\nimport {cn} from '../../../utils/cn'\nimport {isInsideDescendantPopover, nextPopoverId, registerPopover} from './popoverStack'\nimport type {MPopoverProps} from './MPopover.types'\nimport './MPopover.css'\n\n// Position floating content relative to an anchor with viewport-aware flipping.\nexport function MPopover({\n open,\n anchorRef,\n onClose,\n placement = 'bottom-start',\n matchWidth = false,\n offset = 4,\n zIndex,\n children,\n className,\n style,\n}: MPopoverProps) {\n const popoverRef = useRef<HTMLDivElement>(null)\n const popoverIdRef = useRef<number>(null)\n if (popoverIdRef.current === null) popoverIdRef.current = nextPopoverId()\n const popoverId = popoverIdRef.current\n const [position, setPosition] = useState<{top: number; left: number; width?: number} | null>(null)\n const [flipped, setFlipped] = useState(false)\n const [layerZ, setLayerZ] = useState<number | string | null>(null)\n\n // Lift popovers above drawers, modals and mobile sidebars when the anchor sits inside them.\n const updateLayer = useCallback(() => {\n if (zIndex !== undefined) {\n setLayerZ(zIndex)\n return\n }\n\n const anchor = anchorRef.current\n if (!anchor || typeof window === 'undefined') {\n setLayerZ(null)\n return\n }\n\n const layerHost = anchor.closest(\n '.drawer-backdrop, .modal-backdrop, .sheet-backdrop, .sidebar.mobile-open, .popover'\n )\n if (!layerHost) {\n setLayerZ(null)\n return\n }\n\n const computedZ = window.getComputedStyle(layerHost).zIndex\n const parsedZ = Number.parseInt(computedZ, 10)\n setLayerZ(Number.isFinite(parsedZ) ? parsedZ + 1 : null)\n }, [anchorRef, zIndex])\n\n // Recalculate popover position whenever layout or viewport constraints change.\n const updatePosition = useCallback(() => {\n if (!anchorRef.current || !popoverRef.current) return\n\n const anchor = anchorRef.current.getBoundingClientRect()\n const popover = popoverRef.current.getBoundingClientRect()\n const viewport = {\n width: window.innerWidth,\n height: window.innerHeight,\n }\n\n const isTop = placement.startsWith('top')\n const isRight = placement.startsWith('right')\n const isLeft = placement.startsWith('left')\n const isHorizontal = isRight || isLeft\n const isEnd = placement.endsWith('end')\n\n let top: number\n let left: number\n\n if (isHorizontal) {\n // Horizontal placement: position to the right or left of the anchor\n const spaceRight = viewport.width - anchor.right - offset\n const spaceLeft = anchor.left - offset\n const shouldFlip = isRight\n ? spaceRight < popover.width && spaceLeft > spaceRight\n : spaceLeft < popover.width && spaceRight > spaceLeft\n\n setFlipped(shouldFlip)\n\n const showOnRight = isRight ? !shouldFlip : shouldFlip\n\n if (showOnRight) {\n left = anchor.right + offset + window.scrollX\n } else {\n left = anchor.left - popover.width - offset + window.scrollX\n }\n\n if (isEnd) {\n top = anchor.bottom - popover.height + window.scrollY\n } else {\n top = anchor.top + window.scrollY\n }\n } else {\n // Vertical placement: position above or below the anchor\n const spaceBelow = viewport.height - anchor.bottom - offset\n const spaceAbove = anchor.top - offset\n const shouldFlip = isTop\n ? spaceAbove < popover.height && spaceBelow > spaceAbove\n : spaceBelow < popover.height && spaceAbove > spaceBelow\n\n setFlipped(shouldFlip)\n\n const showOnTop = isTop ? !shouldFlip : shouldFlip\n\n if (showOnTop) {\n top = anchor.top - popover.height - offset + window.scrollY\n } else {\n top = anchor.bottom + offset + window.scrollY\n }\n\n if (isEnd) {\n left = anchor.right - popover.width + window.scrollX\n } else {\n left = anchor.left + window.scrollX\n }\n }\n\n // Clamp to viewport\n left = Math.max(8, Math.min(left, viewport.width - popover.width - 8))\n top = Math.max(8 + window.scrollY, top)\n\n setPosition({\n top,\n left,\n width: matchWidth ? anchor.width : undefined,\n })\n }, [anchorRef, placement, offset, matchWidth])\n\n useEffect(() => {\n if (!open) {\n setPosition(null)\n setLayerZ(null)\n return\n }\n\n updateLayer()\n // Wait one frame so the rendered popover can be measured accurately.\n requestAnimationFrame(updatePosition)\n\n // `scroll` does not bubble, so a window listener only ever sees the\n // document scrolling. Anchors living inside a scrollable ancestor — an\n // app shell with a scrolling main region, MStickyPanel, an overflowing\n // card — would leave the popover stranded at its opening coordinates\n // while the anchor moved away underneath it. Scroll events do capture,\n // so a capture-phase listener on the document catches scrolling from\n // ANY container, including the document itself.\n document.addEventListener('scroll', updatePosition, {capture: true, passive: true})\n window.addEventListener('resize', updatePosition, {passive: true})\n return () => {\n document.removeEventListener('scroll', updatePosition, {capture: true})\n window.removeEventListener('resize', updatePosition)\n }\n }, [open, updateLayer, updatePosition])\n\n // Close the popover with the standard Escape key interaction.\n useEffect(() => {\n if (!open) return\n const handleKey = (e: KeyboardEvent) => {\n if (e.key === 'Escape') onClose()\n }\n document.addEventListener('keydown', handleKey)\n return () => document.removeEventListener('keydown', handleKey)\n }, [open, onClose])\n\n // Publish this instance while it is open so nested popovers can be related\n // back to it — see popoverStack.ts for why the DOM alone cannot answer this.\n useEffect(() => {\n if (!open) return\n return registerPopover({\n id: popoverId,\n getPopoverEl: () => popoverRef.current,\n getAnchorEl: () => anchorRef.current,\n })\n }, [open, popoverId, anchorRef])\n\n // Close when the user interacts outside both the popover and its anchor.\n useEffect(() => {\n if (!open) return\n const handleClick = (e: MouseEvent) => {\n const target = e.target as Node\n\n if (popoverRef.current?.contains(target) || anchorRef.current?.contains(target)) {\n return\n }\n\n // A popover nested inside this one is portaled to `document.body`,\n // so it fails the `contains` checks above even though the click\n // belongs to this popover's own subtree. Closing here would unmount\n // that child between mousedown and mouseup and swallow its click.\n if (isInsideDescendantPopover(popoverId, target)) {\n return\n }\n\n onClose()\n }\n document.addEventListener('mousedown', handleClick)\n return () => document.removeEventListener('mousedown', handleClick)\n }, [open, onClose, anchorRef, popoverId])\n\n if (!open) return null\n\n return (\n <MPortal>\n <div\n ref={popoverRef}\n className={cn('popover', flipped ? 'flipped' : 'normal', className)}\n style={{\n position: 'absolute',\n top: position?.top ?? 0,\n left: position?.left ?? 0,\n width: position?.width,\n zIndex: layerZ ?? undefined,\n visibility: position ? 'visible' : 'hidden',\n ...style,\n }}\n role=\"listbox\"\n >\n {children}\n </div>\n </MPortal>\n )\n}\n"],"mappings":"8JAwBA,IAAM,EAAuC,EAAE,CAC3C,EAAS,EAEb,SAAgB,GAAwB,CACpC,MAAO,KAGX,SAAgB,EAAgB,EAA+C,CAE3E,OADA,EAAc,KAAK,EAAa,KACnB,CACT,IAAM,EAAQ,EAAc,QAAQ,EAAa,CAC7C,IAAU,IAAI,EAAc,OAAO,EAAO,EAAE,EAKxD,SAAS,EAAW,EAA2C,CAC3D,IAAM,EAAS,EAAM,aAAa,CAClC,GAAI,CAAC,EAAQ,OAAO,KAEpB,IAAK,IAAM,KAAS,EAAe,CAC/B,GAAI,EAAM,KAAO,EAAM,GAAI,SAC3B,IAAM,EAAU,EAAM,cAAc,CACpC,GAAI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