@fldr/ui 0.0.0-stage → 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +2366 -0
- package/LICENSE +21 -0
- package/README.md +488 -2
- package/ai/USAGE.md +216 -0
- package/ai/component-registry.json +8694 -0
- package/ai/component-registry.md +11933 -0
- package/ai/schemas.ts +1239 -0
- package/bin/kumo.js +36 -0
- package/dist/.build-complete +1 -0
- package/dist/ai/schemas.d.ts +3229 -0
- package/dist/ai/schemas.js +5963 -0
- package/dist/blocks-source/delete-resource/delete-resource.test.tsx +21 -0
- package/dist/blocks-source/delete-resource/delete-resource.tsx +219 -0
- package/dist/blocks-source/page-header/page-header.tsx +99 -0
- package/dist/blocks-source/resource-list/resource-list.test.tsx +28 -0
- package/dist/blocks-source/resource-list/resource-list.tsx +66 -0
- package/dist/button-DzavLWXm.d.ts +227 -0
- package/dist/catalog.d.ts +380 -0
- package/dist/catalog.js +387 -0
- package/dist/chunks/AccordionPanelDataAttributes-mmrmkky28u1010l5.js +457 -0
- package/dist/chunks/AlertDialogTrigger-l1r1gbxcky1xq889.js +24 -0
- package/dist/chunks/AlertDialogTriggerDataAttributes-go49qon601catpgn.js +56 -0
- package/dist/chunks/AutocompleteItem-36ysm5nwbsd0snr6.js +70 -0
- package/dist/chunks/AutocompleteItemDataAttributes-n5rigpf0s9ylnwi3.js +232 -0
- package/dist/chunks/AutocompleteSeparator-bnqeqh7i983d92gx.js +12 -0
- package/dist/chunks/AvatarImageDataAttributes-jw70u384c83lhqfp.js +247 -0
- package/dist/chunks/ButtonDataAttributes-nceand1fi7lvnmkb.js +35 -0
- package/dist/chunks/CSPContext-iv67i0qqhihg8mur.js +11 -0
- package/dist/chunks/CSPProvider-finau3a8hnc9o2td.js +24 -0
- package/dist/chunks/CheckboxGroup-581mfftu99wvjb3a.js +190 -0
- package/dist/chunks/CheckboxGroupContext-jf1bt3znvqlhrql6.js +10 -0
- package/dist/chunks/CheckboxGroupDataAttributes-nskqcxts64symbvf.js +10 -0
- package/dist/chunks/CheckboxIndicator-i13dmhacfgqo328c.js +414 -0
- package/dist/chunks/CheckboxIndicatorDataAttributes-3p29ju7nkczz1l2y.js +85 -0
- package/dist/chunks/CollapsiblePanel-md5suzmtnsyz1kab.js +178 -0
- package/dist/chunks/CollapsibleRootDataAttributes-bynmgxmt4jikaoha.js +36 -0
- package/dist/chunks/ComboboxClear-ioejwvtnmqanph88.js +294 -0
- package/dist/chunks/ComboboxClearDataAttributes-lo0enstdmrqpywsy.js +402 -0
- package/dist/chunks/ComboboxEmpty-gkt1y5b81a4983v7.js +1950 -0
- package/dist/chunks/ComboboxItemIndicatorDataAttributes-iku7l9ig0ve09an4.js +259 -0
- package/dist/chunks/ComboboxPopup-n8cbgys9st446j1i.js +205 -0
- package/dist/chunks/CompositeItem-kepwg8jtvgap06o6.js +20 -0
- package/dist/chunks/CompositeList-gwuaf6d14s4da0j0.js +182 -0
- package/dist/chunks/CompositeListContext-bejvmlu39hsfjzgu.js +15 -0
- package/dist/chunks/CompositeRoot-dnlkb27uw4g5aocf.js +223 -0
- package/dist/chunks/CompositeRootContext-obm54j7y6s86qwhq.js +12 -0
- package/dist/chunks/ContextMenuTriggerDataAttributes-xwozccynxv6pk5s0.js +237 -0
- package/dist/chunks/DialogBackdropDataAttributes-jwqxd6jla03xh8ke.js +28 -0
- package/dist/chunks/DialogCloseDataAttributes-12m7gwh3i6fd7d05.js +76 -0
- package/dist/chunks/DialogPopup-n6w7b389e7bs0472.js +133 -0
- package/dist/chunks/DialogRoot-hkkqj7vcjpkx8qk8.js +16 -0
- package/dist/chunks/DialogTrigger-kpugfkbfswqrus4u.js +142 -0
- package/dist/chunks/DialogTriggerDataAttributes-bp9bu13cvwuddh5b.js +18 -0
- package/dist/chunks/DialogViewportDataAttributes-mma9emv1edsc1vuy.js +78 -0
- package/dist/chunks/DirectionContext-kpby968j030psajn.js +10 -0
- package/dist/chunks/DirectionProvider-cg0pwzgdyg6r73r6.js +21 -0
- package/dist/chunks/DrawerViewport-mzqpwvqtylnad8ib.js +1532 -0
- package/dist/chunks/DrawerViewportDataAttributes-dd9593zm9fl9vcsm.js +1072 -0
- package/dist/chunks/FieldControl-hjj2tcqruozadgdi.js +122 -0
- package/dist/chunks/FieldDescription-orix2gepowrp5ni4.js +122 -0
- package/dist/chunks/FieldItemContext-ohsf45im6xhpay40.js +10 -0
- package/dist/chunks/FieldItemDataAttributes-m52srx69pispz49i.js +283 -0
- package/dist/chunks/FieldLabel-fjc7tdis7rcbq8o4.js +353 -0
- package/dist/chunks/FieldsetLegend-gl9z9eezr0xg9zr7.js +61 -0
- package/dist/chunks/FieldsetLegendDataAttributes-fn20251jxjqkpkxm.js +17 -0
- package/dist/chunks/FieldsetRootContext-fphwizvcm55ydg94.js +12 -0
- package/dist/chunks/FloatingPortalLite-j7dsy7gokbxdoe1i.js +25 -0
- package/dist/chunks/FloatingRootStore-men6ufp3a2b296fh.js +840 -0
- package/dist/chunks/FloatingTree-kiyzavvaum442o1s.js +115 -0
- package/dist/chunks/Form-oz425k7r4abea8o4.js +113 -0
- package/dist/chunks/FormContext-jv19engyccpf6xcl.js +18 -0
- package/dist/chunks/Input-ozudotydd679ly63.js +20 -0
- package/dist/chunks/InputDataAttributes-oy8t6q5y5t8ik02j.js +42 -0
- package/dist/chunks/ItemIndicator-cvf8cw5fv5l3cd8j.js +37 -0
- package/dist/chunks/LabelableContext-dz4wz3lu3lgqusu7.js +135 -0
- package/dist/chunks/ListboxSeparator-skazx18vzzj7i9zp.js +21 -0
- package/dist/chunks/MenuClearDataAttributes-fo0pekd36n56mdxu.js +1645 -0
- package/dist/chunks/MenuSubmenuTrigger-hm5xbgik6aq95x35.js +1976 -0
- package/dist/chunks/MenuSubmenuTriggerDataAttributes-gdfxdjymgmnaxdds.js +372 -0
- package/dist/chunks/MenuTrigger-dlfvicsaggss0o9m.js +265 -0
- package/dist/chunks/Menubar-ja5int05ihjj0ra4.js +116 -0
- package/dist/chunks/MenubarContext-ooz0h08i55c8oip5.js +12 -0
- package/dist/chunks/MeterLabel-cykbkvqys5263z05.js +148 -0
- package/dist/chunks/NavigationMenuIconDataAttributes-l82pkpm61d0meqxf.js +1654 -0
- package/dist/chunks/NullStore-my62xo2vfcfkerri.js +110 -0
- package/dist/chunks/NumberFieldScrubAreaCursorDataAttributes-k2lsbk35svshnwf5.js +1493 -0
- package/dist/chunks/OTPFieldInputDataAttributes-gvgtu2gg85kgjzwr.js +683 -0
- package/dist/chunks/PopoverViewport-peh28i8q4hqfjy97.js +713 -0
- package/dist/chunks/PopoverViewportDataAttributes-gplhq9d7ffp9q8u3.js +329 -0
- package/dist/chunks/PrehydrationScript-hs2je3mndbxuts7w.js +78 -0
- package/dist/chunks/PreviewCardViewportDataAttributes-bgfwmyshey7fx6nr.js +914 -0
- package/dist/chunks/ProgressLabelDataAttributes-j8mutcz11ei0ohvj.js +287 -0
- package/dist/chunks/RadioGroup-kioqngmmuo7a1lfa.js +163 -0
- package/dist/chunks/RadioGroupContext-dr6uihsj7oky0eol.js +10 -0
- package/dist/chunks/RadioGroupDataAttributes-dpdr6xe4ve204qwb.js +10 -0
- package/dist/chunks/RadioIndicator-bhxqih8wzv7hyrec.js +299 -0
- package/dist/chunks/RadioIndicatorDataAttributes-n5yupp5psifu0d4f.js +80 -0
- package/dist/chunks/ScrollAreaThumb-hxig41yn4lrurd3o.js +928 -0
- package/dist/chunks/ScrollAreaThumbDataAttributes-gup5wfxvqye6jj27.js +137 -0
- package/dist/chunks/SelectScrollUpArrowDataAttributes-fce5i1afjkb0necr.js +473 -0
- package/dist/chunks/SelectSeparator-nnak70azojox8b2b.js +1632 -0
- package/dist/chunks/Separator-fhwve0tfny3tht3a.js +24 -0
- package/dist/chunks/SeparatorDataAttributes-ch6e63bas7zflw00.js +11 -0
- package/dist/chunks/SliderIndicator-h1o3qbrvr8x0t4t2.js +1171 -0
- package/dist/chunks/SliderIndicatorDataAttributes-ff2f1cjealif5nvo.js +240 -0
- package/dist/chunks/SwitchRoot-m4t2tq5zn5wibyxk.js +244 -0
- package/dist/chunks/SwitchThumbDataAttributes-f95ld864on9y6ptk.js +90 -0
- package/dist/chunks/TabsList-n5n93rxr4sy704u8.js +664 -0
- package/dist/chunks/TabsListDataAttributes-e03a7kbubuf02z1l.js +183 -0
- package/dist/chunks/ToastArrowDataAttributes-jbnvz3kp6a35slgj.js +136 -0
- package/dist/chunks/ToggleDataAttributes-jl9ojyvwgrvefke6.js +103 -0
- package/dist/chunks/ToggleGroupContext-hg8zbkgqpscqhz83.js +10 -0
- package/dist/chunks/ToggleGroupDataAttributes-n1dwona1alvabstl.js +102 -0
- package/dist/chunks/ToolbarGroupContext-eawva8xkxb4osbxb.js +10 -0
- package/dist/chunks/ToolbarInput-kyxl1be0p3cyuayp.js +174 -0
- package/dist/chunks/ToolbarInputDataAttributes-n4a18a4km735du04.js +150 -0
- package/dist/chunks/ToolbarRootContext-difqbj720teyt8lu.js +12 -0
- package/dist/chunks/TooltipPopup-furysmeyb68uycbz.js +839 -0
- package/dist/chunks/TooltipProvider-hyans0ens4axh1y8.js +61 -0
- package/dist/chunks/TooltipViewportDataAttributes-gkwbezdq40ssuevg.js +312 -0
- package/dist/chunks/adaptiveOriginMiddleware-m9tqzw58wya9sdds.js +51 -0
- package/dist/chunks/addEventListener-ku3x23446prmd1kz.js +13 -0
- package/dist/chunks/areArraysEqual-nnpg93s9g7aqcaoh.js +15 -0
- package/dist/chunks/autocomplete-gdd9aruremdgdvx7.js +152 -0
- package/dist/chunks/badge-gca8xfu79ne55d5k.js +165 -0
- package/dist/chunks/banner-mo1xl9ww734kgsqh.js +269 -0
- package/dist/chunks/breadcrumbs-z1jo40oxlw8e4eh4.js +159 -0
- package/dist/chunks/button-group-biv43ksvaipc3p5n.js +59 -0
- package/dist/chunks/button-hzvowfkbathmx8yg.js +274 -0
- package/dist/chunks/chart-dgh98nbzo2sux2bs.js +3985 -0
- package/dist/chunks/checkbox-eifiwbw34xwsikvf.js +211 -0
- package/dist/chunks/clamp-rcpupxvhqrn8uuyf.js +7 -0
- package/dist/chunks/clipboard-text-oukrnke1s3kebk3y.js +209 -0
- package/dist/chunks/cloudflare-logo-d8mid9xr190h78cu.js +186 -0
- package/dist/chunks/code-hp2x28uiufmk3elz.js +94 -0
- package/dist/chunks/collapsible-ic6813hc4yv5s5hv.js +185 -0
- package/dist/chunks/combobox-mzvobpvalz2gnpli.js +321 -0
- package/dist/chunks/command-palette-d45ueqbuxygu87ir.js +507 -0
- package/dist/chunks/composite-c11t1ok72s3cggjc.js +90 -0
- package/dist/chunks/constants-l10cgj6pyqg27jod.js +5 -0
- package/dist/chunks/createBaseUIEventDetails-nvee6bghv2reeqdb.js +50 -0
- package/dist/chunks/createItems-n07tfwx89cdoar18.js +323 -0
- package/dist/chunks/createToastManager-cxjmn4jx3ejh85fs.js +1225 -0
- package/dist/chunks/date-picker-ija2bz17ai6ypnao.js +6865 -0
- package/dist/chunks/date-range-picker-oivlshld01jbel29.js +336 -0
- package/dist/chunks/dialog-g7wavhkdv2gplwq9.js +173 -0
- package/dist/chunks/dropdown-m5a8nwer5hpvnkfk.js +384 -0
- package/dist/chunks/empty-e0onzpyokyl6h9bp.js +96 -0
- package/dist/chunks/engine-hzmefiqm63hu0c7i.js +10 -0
- package/dist/chunks/error-lbnic2b20qr3mukp.js +6 -0
- package/dist/chunks/field-fowmq5smvp17pnqe.js +75 -0
- package/dist/chunks/flow-fak0fyldoaozd32s.js +10290 -0
- package/dist/chunks/formatNumber-b4kjdsebslm2b3t0.js +21 -0
- package/dist/chunks/getCssDimensions-gckwdrp86f73cv51.js +21 -0
- package/dist/chunks/getElementTransform-cz3jyftv0x5io95f.js +38 -0
- package/dist/chunks/getFiniteAnimations-jwd833ybtz81j5f0.js +13 -0
- package/dist/chunks/getHighlightReason-fhc53kq6qakcct9s.js +15 -0
- package/dist/chunks/getPseudoElementBounds-csuw8kwsoeyxd5tv.js +37 -0
- package/dist/chunks/grid-nwiczrab3r4w0zr2.js +118 -0
- package/dist/chunks/highlighter-mouttug0tu8xg1i8.js +1364 -0
- package/dist/chunks/index.parts-db9pzsm9rrs9tp0t.js +200 -0
- package/dist/chunks/index.parts-ggacwr0yakuemead.js +24 -0
- package/dist/chunks/index.parts-pcg3pmf3yyro841t.js +13 -0
- package/dist/chunks/inertValue-n09gkjvwwa1kddov.js +9 -0
- package/dist/chunks/inline-copy-text-izxpvnrtebcqlquf.js +104 -0
- package/dist/chunks/input-group-h9fepskc84e1h11n.js +457 -0
- package/dist/chunks/input-kfi46426y22ocoo4.js +85 -0
- package/dist/chunks/input-m2tfec2viezoz9hh.js +146 -0
- package/dist/chunks/isElementDisabled-dyqutxpzdfppbohx.js +7 -0
- package/dist/chunks/itemEquality-ki3x4tzdhjlqjey6.js +56 -0
- package/dist/chunks/label-f18fnpbv85jddo4q.js +76 -0
- package/dist/chunks/layer-card-lsmeuqic9i1isv2b.js +74 -0
- package/dist/chunks/layer-dialog-ejtz9s7bbfhjk1md.js +414 -0
- package/dist/chunks/link-h84bkh8eem39p529.js +112 -0
- package/dist/chunks/link-provider-kbwllpbo24fvgioj.js +60 -0
- package/dist/chunks/loader-kv5nk8j8tsuesxqo.js +87 -0
- package/dist/chunks/locale-provider-j4ii538ntyok36r6.js +50 -0
- package/dist/chunks/menubar-gzlyhmmc4i24prn1.js +106 -0
- package/dist/chunks/mergeCleanups-nw73c6jfwl5tyhw4.js +15 -0
- package/dist/chunks/meter-poh8jpe0qtq6mvee.js +35 -0
- package/dist/chunks/pagination-lmogkvvtu19mnr7f.js +296 -0
- package/dist/chunks/popover-nqrt3ykqv6sic8pz.js +206 -0
- package/dist/chunks/popupHandle-dk3ixgc8flr7v971.js +177 -0
- package/dist/chunks/popupStoreUtils-czfnxn051xakask5.js +868 -0
- package/dist/chunks/portal-provider-eveknxf26oudn7pp.js +63 -0
- package/dist/chunks/radio-nf717i5ypsga9zdh.js +204 -0
- package/dist/chunks/reason-parts-hssx64rmlxyn6gw5.js +40 -0
- package/dist/chunks/resolve-variant-l6x5ksfrjtu4m66l.js +35 -0
- package/dist/chunks/resolveAriaLabelledBy-knaucrjrjwnk7tvs.js +10 -0
- package/dist/chunks/resolveValueLabel-ntacnb58mhka5gg0.js +70 -0
- package/dist/chunks/rolldown-runtime-hi7ti5xiuxsegr96.js +18 -0
- package/dist/chunks/safePolygon-ep4133qogeu5vjf3.js +661 -0
- package/dist/chunks/safeReact-ek77ilng4ekk7mgz.js +18 -0
- package/dist/chunks/scrollable-k784b35i80aolmvg.js +29 -0
- package/dist/chunks/select-lnekz415wm4v6d6m.js +279 -0
- package/dist/chunks/sensitive-input-dvwlnntm7rdudwp0.js +252 -0
- package/dist/chunks/serializeValue-d1otz2i7h5tygrwf.js +13 -0
- package/dist/chunks/sidebar-mhlgvpawixxoey2k.js +1466 -0
- package/dist/chunks/skeleton-line-kmhnp0lx3rxhioxa.js +74 -0
- package/dist/chunks/slider-e395gihi5cjd62ss.js +87 -0
- package/dist/chunks/stringifyLocale-gbxouqj7ol627jxh.js +9 -0
- package/dist/chunks/styles-eb8bvypmayf578jf.js +35 -0
- package/dist/chunks/surface-jr8x5hy0gucjk5ig.js +30 -0
- package/dist/chunks/switch-nc8thi7ogd51m3gi.js +202 -0
- package/dist/chunks/table-ngl1b5yc8mcur662.js +238 -0
- package/dist/chunks/table-of-contents-gkjv9ck8etbz64ej.js +234 -0
- package/dist/chunks/tabs-o59bv7348nh2gppm.js +280 -0
- package/dist/chunks/tag-input-lbx9yzt33d4wu07o.js +156 -0
- package/dist/chunks/text-nqum95flcp07ac9s.js +126 -0
- package/dist/chunks/toast-ljpenshot856xqq4.js +341 -0
- package/dist/chunks/toolbar-kh6pc12ii7b6dv1x.js +141 -0
- package/dist/chunks/tooltip-bcymn9bfyz29fvji.js +92 -0
- package/dist/chunks/unwrap-lazy-element-hzbdkmujhd7iksau.js +45 -0
- package/dist/chunks/use-copy-feedback-gl55ghst0csvpv4j.js +55 -0
- package/dist/chunks/useAnchoredPopupScrollLock-msm8tzkewysnunut.js +31 -0
- package/dist/chunks/useAnimationFrame-k9lqdj9quln3sd85.js +87 -0
- package/dist/chunks/useAriaLabelledBy-j3j9jqlr9ukyk08s.js +36 -0
- package/dist/chunks/useBaseUiId-nk4k7nj9h1cy76ny.js +13 -0
- package/dist/chunks/useButton-lklvdzuhvj22bx07.js +186 -0
- package/dist/chunks/useClick-pcbkcc7r620v1smu.js +87 -0
- package/dist/chunks/useCollapsiblePanel-lrfsgx21ds36cwlp.js +415 -0
- package/dist/chunks/useCompositeItem-2juex3zh9gyrs8e9.js +31 -0
- package/dist/chunks/useCompositeListItem-ekwo2j2rjkggg7xj.js +54 -0
- package/dist/chunks/useControlled-i3srnkxy598s0au9.js +52 -0
- package/dist/chunks/useFieldValidation-oe16jiigp971yrzr.js +224 -0
- package/dist/chunks/useFloatingRootContext-k676b6m7f80bdapd.js +51 -0
- package/dist/chunks/useFocus-mn7a9t9v6fnlb4mf.js +124 -0
- package/dist/chunks/useId-82z8yqlmc1hy1c5t.js +50 -0
- package/dist/chunks/useInitialLiveRegionTextMutation-nl2hus7zx1h7ggno.js +86 -0
- package/dist/chunks/useLabel-me6zzfvkypo458pi.js +58 -0
- package/dist/chunks/useLabelableId-bjeh6q3pgrqjb7er.js +56 -0
- package/dist/chunks/useListNavigation-hpddbd0cc9pvt461.js +441 -0
- package/dist/chunks/useOnMount-gxggz1m0n869s6r0.js +12 -0
- package/dist/chunks/useOpenChangeComplete-edtabjwqmechsyv6.js +129 -0
- package/dist/chunks/usePopupHandleStore-gawjmfjf1xdgiph3.js +27 -0
- package/dist/chunks/usePopupViewport-l6w01iohvzloghy8.js +367 -0
- package/dist/chunks/usePositioner-mzvgnazldqvy44z2.js +580 -0
- package/dist/chunks/usePressAndHold-k9ynk78pgf677kpx.js +179 -0
- package/dist/chunks/usePreviousValue-o6swt5tb7xhpdu4e.js +21 -0
- package/dist/chunks/useRegisterFieldControl-m1stc9l9y4cndf0k.js +40 -0
- package/dist/chunks/useRegisteredLabelId-b7u9ygya03448zzn.js +16 -0
- package/dist/chunks/useRender-h9ktka9xt4obdv6y.js +13 -0
- package/dist/chunks/useRenderDialogRoot-bsqrqpc1ddau7xg4.js +312 -0
- package/dist/chunks/useRenderElement-nkklxbq1rp7h2kw0.js +436 -0
- package/dist/chunks/useScrollLock-le7ajwlt7oh6fzxi.js +877 -0
- package/dist/chunks/useSetFieldFocused-fbvj7gcv67dqfkp0.js +35 -0
- package/dist/chunks/useStableCallback-le5qgj6p9l04729n.js +38 -0
- package/dist/chunks/useSwipeDismiss-e8tfxzlp05p86mgb.js +697 -0
- package/dist/chunks/useTimeout-f0ayn2l2l9aop4l8.js +43 -0
- package/dist/chunks/useTransitionStatus-disysoblzgk34w14.js +74 -0
- package/dist/chunks/useTriggerFocusGuards-dyd3hb1m8en8ct50.js +40 -0
- package/dist/chunks/useTriggerSwitchTransition-hk5j36hd5dq2ok6w.js +62 -0
- package/dist/chunks/useTypeahead-kfdsw1ksl5bgvvzl.js +111 -0
- package/dist/chunks/useValueAsRef-dv0tmfr1xlpzdlru.js +27 -0
- package/dist/chunks/useValueChanged-fjssa2v6d4w8y332.js +15 -0
- package/dist/chunks/utils-o44zfmzz9z7uyj1v.js +18 -0
- package/dist/chunks/valueToPercent-djk2mqnihth2uvf6.js +7 -0
- package/dist/chunks/vendor-floating-ui-fqblx3wa0r71mjoo.js +1458 -0
- package/dist/chunks/vendor-styling-gs32v7xt5znc8kg0.js +1167 -0
- package/dist/chunks/vendor-utils-io8z5lsfxq8m2dcc.js +660 -0
- package/dist/chunks/visuallyHidden-kzzs9hbe93is3rci.js +25 -0
- package/dist/code/server.d.ts +11 -0
- package/dist/code/server.js +18 -0
- package/dist/code.d.ts +65 -0
- package/dist/code.js +232 -0
- package/dist/command-line/cli.js +1705 -0
- package/dist/command-line/commands/add.js +282 -0
- package/dist/command-line/commands/ai.js +22 -0
- package/dist/command-line/commands/blocks.js +61 -0
- package/dist/command-line/commands/doc.js +167 -0
- package/dist/command-line/commands/init.js +95 -0
- package/dist/command-line/commands/ls.js +53 -0
- package/dist/command-line/commands/theme.js +850 -0
- package/dist/components/autocomplete.d.ts +2 -0
- package/dist/components/autocomplete.js +3 -0
- package/dist/components/badge.d.ts +2 -0
- package/dist/components/badge.js +3 -0
- package/dist/components/banner.d.ts +2 -0
- package/dist/components/banner.js +3 -0
- package/dist/components/breadcrumbs.d.ts +2 -0
- package/dist/components/breadcrumbs.js +3 -0
- package/dist/components/button-group.d.ts +2 -0
- package/dist/components/button-group.js +3 -0
- package/dist/components/button.d.ts +3 -0
- package/dist/components/button.js +3 -0
- package/dist/components/chart.d.ts +2 -0
- package/dist/components/chart.js +3 -0
- package/dist/components/checkbox.d.ts +2 -0
- package/dist/components/checkbox.js +3 -0
- package/dist/components/clipboard-text.d.ts +2 -0
- package/dist/components/clipboard-text.js +3 -0
- package/dist/components/cloudflare-logo.d.ts +2 -0
- package/dist/components/cloudflare-logo.js +3 -0
- package/dist/components/code.d.ts +2 -0
- package/dist/components/code.js +3 -0
- package/dist/components/collapsible.d.ts +2 -0
- package/dist/components/collapsible.js +3 -0
- package/dist/components/combobox.d.ts +2 -0
- package/dist/components/combobox.js +3 -0
- package/dist/components/command-palette.d.ts +2 -0
- package/dist/components/command-palette.js +3 -0
- package/dist/components/date-picker.d.ts +2 -0
- package/dist/components/date-picker.js +3 -0
- package/dist/components/date-range-picker.d.ts +2 -0
- package/dist/components/date-range-picker.js +3 -0
- package/dist/components/dialog.d.ts +2 -0
- package/dist/components/dialog.js +3 -0
- package/dist/components/dropdown.d.ts +2 -0
- package/dist/components/dropdown.js +3 -0
- package/dist/components/empty.d.ts +2 -0
- package/dist/components/empty.js +3 -0
- package/dist/components/field.d.ts +2 -0
- package/dist/components/field.js +3 -0
- package/dist/components/flow.d.ts +2 -0
- package/dist/components/flow.js +3 -0
- package/dist/components/grid.d.ts +2 -0
- package/dist/components/grid.js +3 -0
- package/dist/components/inline-copy-text.d.ts +2 -0
- package/dist/components/inline-copy-text.js +3 -0
- package/dist/components/input-group.d.ts +2 -0
- package/dist/components/input-group.js +3 -0
- package/dist/components/input.d.ts +4 -0
- package/dist/components/input.js +5 -0
- package/dist/components/label.d.ts +2 -0
- package/dist/components/label.js +3 -0
- package/dist/components/layer-card.d.ts +2 -0
- package/dist/components/layer-card.js +3 -0
- package/dist/components/layer-dialog.d.ts +2 -0
- package/dist/components/layer-dialog.js +3 -0
- package/dist/components/link.d.ts +67 -0
- package/dist/components/link.js +3 -0
- package/dist/components/loader.d.ts +2 -0
- package/dist/components/loader.js +4 -0
- package/dist/components/menubar.d.ts +2 -0
- package/dist/components/menubar.js +3 -0
- package/dist/components/meter.d.ts +2 -0
- package/dist/components/meter.js +3 -0
- package/dist/components/pagination.d.ts +2 -0
- package/dist/components/pagination.js +3 -0
- package/dist/components/popover.d.ts +2 -0
- package/dist/components/popover.js +3 -0
- package/dist/components/radio.d.ts +2 -0
- package/dist/components/radio.js +3 -0
- package/dist/components/select.d.ts +2 -0
- package/dist/components/select.js +3 -0
- package/dist/components/sensitive-input.d.ts +2 -0
- package/dist/components/sensitive-input.js +3 -0
- package/dist/components/sidebar.d.ts +2 -0
- package/dist/components/sidebar.js +3 -0
- package/dist/components/slider.d.ts +2 -0
- package/dist/components/slider.js +3 -0
- package/dist/components/surface.d.ts +2 -0
- package/dist/components/surface.js +3 -0
- package/dist/components/switch.d.ts +2 -0
- package/dist/components/switch.js +3 -0
- package/dist/components/table-of-contents.d.ts +2 -0
- package/dist/components/table-of-contents.js +3 -0
- package/dist/components/table.d.ts +2 -0
- package/dist/components/table.js +3 -0
- package/dist/components/tabs.d.ts +2 -0
- package/dist/components/tabs.js +3 -0
- package/dist/components/tag-input.d.ts +2 -0
- package/dist/components/tag-input.js +3 -0
- package/dist/components/text.d.ts +2 -0
- package/dist/components/text.js +3 -0
- package/dist/components/toast.d.ts +2 -0
- package/dist/components/toast.js +4 -0
- package/dist/components/toolbar.d.ts +2 -0
- package/dist/components/toolbar.js +3 -0
- package/dist/components/tooltip.d.ts +2 -0
- package/dist/components/tooltip.js +3 -0
- package/dist/config-BKj6nyHa.d.ts +620 -0
- package/dist/field-DIjlHM8W.d.ts +91 -0
- package/dist/highlighter-BT3TakhJ.d.ts +13 -0
- package/dist/index-2jvVmJ8P.d.ts +46 -0
- package/dist/index-5PpauI_2.d.ts +85 -0
- package/dist/index-AMEc1MEg.d.ts +180 -0
- package/dist/index-AUC5xRcO.d.ts +236 -0
- package/dist/index-B7epkoHc.d.ts +72 -0
- package/dist/index-B9-RdY6D.d.ts +75 -0
- package/dist/index-BD-gTiEv.d.ts +71 -0
- package/dist/index-BK1tZgmP.d.ts +426 -0
- package/dist/index-BVgXnR1V.d.ts +137 -0
- package/dist/index-BW1HVU7T.d.ts +119 -0
- package/dist/index-BWe6haHU.d.ts +64 -0
- package/dist/index-BkTAB4wj.d.ts +673 -0
- package/dist/index-Bwhwpw_j.d.ts +189 -0
- package/dist/index-BzE0aNpx.d.ts +143 -0
- package/dist/index-C7RoG_CH.d.ts +57 -0
- package/dist/index-CE09bLNb.d.ts +72 -0
- package/dist/index-CJRe-8P-.d.ts +174 -0
- package/dist/index-CNL6VDYZ.d.ts +138 -0
- package/dist/index-CReGk3Dc.d.ts +91 -0
- package/dist/index-CU_lnxg7.d.ts +287 -0
- package/dist/index-CYoiniZ4.d.ts +135 -0
- package/dist/index-ClS-eFxE.d.ts +104 -0
- package/dist/index-CzIWigmH.d.ts +62 -0
- package/dist/index-CzTgKPh-.d.ts +105 -0
- package/dist/index-D2Gvly0i.d.ts +96 -0
- package/dist/index-DIV3riUd.d.ts +148 -0
- package/dist/index-DL1-uSuH.d.ts +1 -0
- package/dist/index-DYYiDxZs.d.ts +243 -0
- package/dist/index-DjSGDESy.d.ts +222 -0
- package/dist/index-Dmbgjww7.d.ts +157 -0
- package/dist/index-DwNMa4LN.d.ts +166 -0
- package/dist/index-Dx7hOWUc.d.ts +93 -0
- package/dist/index-DxOyYZaJ.d.ts +251 -0
- package/dist/index-NnHba-T1.d.ts +136 -0
- package/dist/index-RP_rt8vB.d.ts +140 -0
- package/dist/index-T1sSoiWG.d.ts +184 -0
- package/dist/index-aahL-0Zw.d.ts +60 -0
- package/dist/index-bBPKMepR.d.ts +73 -0
- package/dist/index-g-eFm1Bq.d.ts +877 -0
- package/dist/index-gYC6cQVO.d.ts +105 -0
- package/dist/index-lOWfpkxK.d.ts +118 -0
- package/dist/index-pjdgauIH.d.ts +170 -0
- package/dist/index-yK3Hayg_.d.ts +40 -0
- package/dist/index.d.ts +108 -0
- package/dist/index.js +207 -0
- package/dist/input-BeWEb-jD.d.ts +122 -0
- package/dist/input-group-8gEtPiKw.d.ts +100 -0
- package/dist/layer-card-BNIn9pqy.d.ts +56 -0
- package/dist/link-provider-tz-NJp9x.d.ts +67 -0
- package/dist/locale-provider-CHMCQ0-J.d.ts +40 -0
- package/dist/panda.d.ts +25 -0
- package/dist/panda.js +32 -0
- package/dist/portal-provider-BAqPpq_a.d.ts +55 -0
- package/dist/primitives/accordion.d.ts +1 -0
- package/dist/primitives/accordion.js +3 -0
- package/dist/primitives/alert-dialog.d.ts +1 -0
- package/dist/primitives/alert-dialog.js +8 -0
- package/dist/primitives/autocomplete.d.ts +1 -0
- package/dist/primitives/autocomplete.js +6 -0
- package/dist/primitives/avatar.d.ts +1 -0
- package/dist/primitives/avatar.js +3 -0
- package/dist/primitives/button.d.ts +1 -0
- package/dist/primitives/button.js +3 -0
- package/dist/primitives/checkbox-group.d.ts +1 -0
- package/dist/primitives/checkbox-group.js +4 -0
- package/dist/primitives/checkbox.d.ts +1 -0
- package/dist/primitives/checkbox.js +4 -0
- package/dist/primitives/collapsible.d.ts +1 -0
- package/dist/primitives/collapsible.js +5 -0
- package/dist/primitives/combobox.d.ts +1 -0
- package/dist/primitives/combobox.js +6 -0
- package/dist/primitives/context-menu.d.ts +1 -0
- package/dist/primitives/context-menu.js +6 -0
- package/dist/primitives/csp-provider.d.ts +1 -0
- package/dist/primitives/csp-provider.js +3 -0
- package/dist/primitives/dialog.d.ts +1 -0
- package/dist/primitives/dialog.js +9 -0
- package/dist/primitives/direction-provider.d.ts +1 -0
- package/dist/primitives/direction-provider.js +4 -0
- package/dist/primitives/drawer.d.ts +1 -0
- package/dist/primitives/drawer.js +6 -0
- package/dist/primitives/field.d.ts +1 -0
- package/dist/primitives/field.js +4 -0
- package/dist/primitives/fieldset.d.ts +1 -0
- package/dist/primitives/fieldset.js +3 -0
- package/dist/primitives/form.d.ts +1 -0
- package/dist/primitives/form.js +3 -0
- package/dist/primitives/input.d.ts +1 -0
- package/dist/primitives/input.js +4 -0
- package/dist/primitives/menu.d.ts +1 -0
- package/dist/primitives/menu.js +6 -0
- package/dist/primitives/menubar.d.ts +1 -0
- package/dist/primitives/menubar.js +3 -0
- package/dist/primitives/meter.d.ts +1 -0
- package/dist/primitives/meter.js +3 -0
- package/dist/primitives/navigation-menu.d.ts +1 -0
- package/dist/primitives/navigation-menu.js +3 -0
- package/dist/primitives/number-field.d.ts +1 -0
- package/dist/primitives/number-field.js +3 -0
- package/dist/primitives/otp-field.d.ts +3 -0
- package/dist/primitives/otp-field.js +4 -0
- package/dist/primitives/popover.d.ts +1 -0
- package/dist/primitives/popover.js +3 -0
- package/dist/primitives/preview-card.d.ts +1 -0
- package/dist/primitives/preview-card.js +3 -0
- package/dist/primitives/progress.d.ts +1 -0
- package/dist/primitives/progress.js +3 -0
- package/dist/primitives/radio-group.d.ts +1 -0
- package/dist/primitives/radio-group.js +4 -0
- package/dist/primitives/radio.d.ts +1 -0
- package/dist/primitives/radio.js +4 -0
- package/dist/primitives/scroll-area.d.ts +1 -0
- package/dist/primitives/scroll-area.js +4 -0
- package/dist/primitives/select.d.ts +1 -0
- package/dist/primitives/select.js +5 -0
- package/dist/primitives/separator.d.ts +1 -0
- package/dist/primitives/separator.js +4 -0
- package/dist/primitives/slider.d.ts +1 -0
- package/dist/primitives/slider.js +4 -0
- package/dist/primitives/switch.d.ts +1 -0
- package/dist/primitives/switch.js +4 -0
- package/dist/primitives/tabs.d.ts +1 -0
- package/dist/primitives/tabs.js +4 -0
- package/dist/primitives/toast.d.ts +1 -0
- package/dist/primitives/toast.js +5 -0
- package/dist/primitives/toggle-group.d.ts +1 -0
- package/dist/primitives/toggle-group.js +3 -0
- package/dist/primitives/toggle.d.ts +1 -0
- package/dist/primitives/toggle.js +3 -0
- package/dist/primitives/toolbar.d.ts +1 -0
- package/dist/primitives/toolbar.js +3 -0
- package/dist/primitives/tooltip.d.ts +1 -0
- package/dist/primitives/tooltip.js +4 -0
- package/dist/primitives.d.ts +42 -0
- package/dist/primitives.js +71 -0
- package/dist/registry.d.ts +2 -0
- package/dist/registry.js +1 -0
- package/dist/scripts/theme-generator/config.d.ts +2 -0
- package/dist/scripts/theme-generator/config.js +487 -0
- package/dist/scripts/theme-generator/types.d.ts +2 -0
- package/dist/scripts/theme-generator/types.js +1 -0
- package/dist/styles/kumo-binding.css +491 -0
- package/dist/styles/kumo-standalone.css +2 -0
- package/dist/styles/kumo.css +135 -0
- package/dist/styles/theme-code.css +142 -0
- package/dist/styles/theme-fedramp.css +31 -0
- package/dist/styles/theme-fldr.css +481 -0
- package/dist/styles/theme-kumo.css +464 -0
- package/dist/text-CRRU2g-u.d.ts +183 -0
- package/dist/theming.d.ts +224 -0
- package/dist/theming.js +386 -0
- package/dist/tooltip-D_vhi1PN.d.ts +105 -0
- package/dist/types-CdzJnnIl.d.ts +193 -0
- package/dist/types-Cl4HuOrB.d.ts +84 -0
- package/dist/utils.d.ts +4 -0
- package/dist/utils.js +7 -0
- package/package.json +481 -3
- package/scripts/component-registry/cache.ts +123 -0
- package/scripts/component-registry/discovery.ts +560 -0
- package/scripts/component-registry/example-cleanup.ts +168 -0
- package/scripts/component-registry/index.test.ts +1075 -0
- package/scripts/component-registry/index.ts +1065 -0
- package/scripts/component-registry/markdown-generator.ts +222 -0
- package/scripts/component-registry/metadata.ts +1030 -0
- package/scripts/component-registry/props-filter.ts +312 -0
- package/scripts/component-registry/schema-generator.ts +333 -0
- package/scripts/component-registry/sub-components.ts +393 -0
- package/scripts/component-registry/types.ts +158 -0
- package/scripts/component-registry/utils.ts +280 -0
- package/scripts/component-registry/variant-parser.ts +262 -0
- package/scripts/css-build.ts +107 -0
- package/scripts/format-generated.ts +12 -0
- package/scripts/generate-globe-land-mask.mjs +80 -0
- package/scripts/generate-primitives.ts +196 -0
- package/scripts/publish-fldr.ts +120 -0
- package/scripts/theme-generator/config.ts +666 -0
- package/scripts/theme-generator/generate-css.test.ts +30 -0
- package/scripts/theme-generator/generate-css.ts +352 -0
- package/scripts/theme-generator/index.ts +175 -0
- package/scripts/theme-generator/migrate.ts +560 -0
- package/scripts/theme-generator/types.ts +92 -0
|
@@ -0,0 +1,1976 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { t as __exportAll } from "./rolldown-runtime-hi7ti5xiuxsegr96.js";
|
|
3
|
+
import { c as NOOP, f as useMergedRefs, i as mergeProps, l as warn, n as useRenderElement, o as EMPTY_ARRAY, p as useRefWithInit, s as EMPTY_OBJECT, t as unwrapLazyRenderProp } from "./useRenderElement-nkklxbq1rp7h2kw0.js";
|
|
4
|
+
import { a as FloatingPortal, f as DROPDOWN_COLLISION_AVOIDANCE, i as PopupTriggerMap, m as POPUP_COLLISION_AVOIDANCE, n as ReactStore, v as voiceOver, y as fastComponent } from "./FloatingRootStore-men6ufp3a2b296fh.js";
|
|
5
|
+
import { n as useIsoLayoutEffect, t as SafeReact } from "./safeReact-ek77ilng4ekk7mgz.js";
|
|
6
|
+
import { n as useTimeout } from "./useTimeout-f0ayn2l2l9aop4l8.js";
|
|
7
|
+
import { $ as getTarget, A as popupTransitionStateMapping, H as transitionStatusMapping, M as triggerOpenStateMapping, ut as mac } from "./vendor-utils-io8z5lsfxq8m2dcc.js";
|
|
8
|
+
import { n as webkit } from "./engine-hzmefiqm63hu0c7i.js";
|
|
9
|
+
import { C as getParentNode, D as isLastTraversableNode, E as isHTMLElement } from "./vendor-floating-ui-fqblx3wa0r71mjoo.js";
|
|
10
|
+
import { n as useHoverReferenceInteraction, r as useHoverFloatingInteraction, t as safePolygon } from "./safePolygon-ep4133qogeu5vjf3.js";
|
|
11
|
+
import { n as createGenericEventDetails, t as createChangeEventDetails } from "./createBaseUIEventDetails-nvee6bghv2reeqdb.js";
|
|
12
|
+
import { E as pointer, b as keyboard, d as imperativeAction, k as siblingOpen, u as focusOut, w as none, y as itemPress } from "./reason-parts-hssx64rmlxyn6gw5.js";
|
|
13
|
+
import { t as useStableCallback } from "./useStableCallback-le5qgj6p9l04729n.js";
|
|
14
|
+
import { c as useOpenStateTransitions, g as useDismiss, h as useSyncedFloatingRootContext, i as attachPreventUnmountOnClose, l as usePopupInteractionProps, n as PopupHandleAttachment, o as createPopupOpenState, p as useTriggerRegistration, s as useImplicitActiveTrigger, t as FOCUSABLE_POPUP_PROPS } from "./popupStoreUtils-czfnxn051xakask5.js";
|
|
15
|
+
import { n as InternalBackdrop, o as FloatingFocusManager, r as useOpenInteractionType } from "./useScrollLock-le7ajwlt7oh6fzxi.js";
|
|
16
|
+
import { i as useFloatingParentNodeId, n as FloatingTree, o as FloatingTreeStore, r as useFloatingNodeId, t as FloatingNode } from "./FloatingTree-kiyzavvaum442o1s.js";
|
|
17
|
+
import { n as useAnimationsFinished, t as useOpenChangeComplete } from "./useOpenChangeComplete-edtabjwqmechsyv6.js";
|
|
18
|
+
import { t as useClick } from "./useClick-pcbkcc7r620v1smu.js";
|
|
19
|
+
import { t as useTransitionStatus } from "./useTransitionStatus-disysoblzgk34w14.js";
|
|
20
|
+
import { n as createInitialPopupStoreState, r as popupStoreSelectors, t as NullStore } from "./NullStore-my62xo2vfcfkerri.js";
|
|
21
|
+
import { a as useListNavigation } from "./useListNavigation-hpddbd0cc9pvt461.js";
|
|
22
|
+
import { t as useTypeahead } from "./useTypeahead-kfdsw1ksl5bgvvzl.js";
|
|
23
|
+
import { t as useBaseUiId } from "./useBaseUiId-nk4k7nj9h1cy76ny.js";
|
|
24
|
+
import { n as getDisabledMountTransitionStyles, r as useAnchorPositioning, t as usePositioner } from "./usePositioner-mzvgnazldqvy44z2.js";
|
|
25
|
+
import { n as useDirection } from "./DirectionContext-kpby968j030psajn.js";
|
|
26
|
+
import { t as inertValue } from "./inertValue-n09gkjvwwa1kddov.js";
|
|
27
|
+
import { t as useControlled } from "./useControlled-i3srnkxy598s0au9.js";
|
|
28
|
+
import { r as dispatchClickWithModifiers, t as useButton } from "./useButton-lklvdzuhvj22bx07.js";
|
|
29
|
+
import { t as getHighlightReason } from "./getHighlightReason-fhc53kq6qakcct9s.js";
|
|
30
|
+
import { t as CompositeList } from "./CompositeList-gwuaf6d14s4da0j0.js";
|
|
31
|
+
import { t as useAnchoredPopupScrollLock } from "./useAnchoredPopupScrollLock-msm8tzkewysnunut.js";
|
|
32
|
+
import { t as useCompositeListItem } from "./useCompositeListItem-ekwo2j2rjkggg7xj.js";
|
|
33
|
+
import { n as useToolbarRootContext } from "./ToolbarRootContext-difqbj720teyt8lu.js";
|
|
34
|
+
import { t as isElementDisabled } from "./isElementDisabled-dyqutxpzdfppbohx.js";
|
|
35
|
+
import { a as COMPOSITE_KEYS } from "./composite-c11t1ok72s3cggjc.js";
|
|
36
|
+
import { t as useTriggerSwitchTransition } from "./useTriggerSwitchTransition-hk5j36hd5dq2ok6w.js";
|
|
37
|
+
import { n as useMenubarContext } from "./MenubarContext-ooz0h08i55c8oip5.js";
|
|
38
|
+
import * as React$1 from "react";
|
|
39
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
40
|
+
//#region ../../node_modules/.pnpm/@base-ui+react@1.9.0_@date-fns+tz@1.4.1_@types+react@19.2.4_date-fns@4.1.0_react-dom@19.2.0_react@19.2.0__react@19.2.0/node_modules/@base-ui/react/menu/positioner/MenuPositionerContext.mjs
|
|
41
|
+
const MenuPositionerContext = /*#__PURE__*/ React$1.createContext(void 0);
|
|
42
|
+
MenuPositionerContext.displayName = "MenuPositionerContext";
|
|
43
|
+
function useMenuPositionerContext(optional) {
|
|
44
|
+
const context = React$1.useContext(MenuPositionerContext);
|
|
45
|
+
if (context === void 0 && !optional) throw new Error("Base UI: MenuPositionerContext is missing. MenuPositioner parts must be placed within <Menu.Positioner>.");
|
|
46
|
+
return context;
|
|
47
|
+
}
|
|
48
|
+
//#endregion
|
|
49
|
+
//#region ../../node_modules/.pnpm/@base-ui+react@1.9.0_@date-fns+tz@1.4.1_@types+react@19.2.4_date-fns@4.1.0_react-dom@19.2.0_react@19.2.0__react@19.2.0/node_modules/@base-ui/react/menu/root/MenuRootContext.mjs
|
|
50
|
+
const MenuRootContext = /*#__PURE__*/ React$1.createContext(void 0);
|
|
51
|
+
MenuRootContext.displayName = "MenuRootContext";
|
|
52
|
+
function useMenuRootContext(optional) {
|
|
53
|
+
const context = React$1.useContext(MenuRootContext);
|
|
54
|
+
if (context === void 0 && !optional) throw new Error("Base UI: MenuRootContext is missing. Menu parts must be placed within <Menu.Root>.");
|
|
55
|
+
return context;
|
|
56
|
+
}
|
|
57
|
+
//#endregion
|
|
58
|
+
//#region ../../node_modules/.pnpm/@base-ui+react@1.9.0_@date-fns+tz@1.4.1_@types+react@19.2.4_date-fns@4.1.0_react-dom@19.2.0_react@19.2.0__react@19.2.0/node_modules/@base-ui/react/context-menu/root/ContextMenuRootContext.mjs
|
|
59
|
+
const ContextMenuRootContext = /*#__PURE__*/ React$1.createContext(void 0);
|
|
60
|
+
ContextMenuRootContext.displayName = "ContextMenuRootContext";
|
|
61
|
+
function useContextMenuRootContext(optional = true) {
|
|
62
|
+
const context = React$1.useContext(ContextMenuRootContext);
|
|
63
|
+
if (context === void 0 && !optional) throw new Error("Base UI: ContextMenuRootContext is missing. ContextMenu parts must be placed within <ContextMenu.Root>.");
|
|
64
|
+
return context;
|
|
65
|
+
}
|
|
66
|
+
//#endregion
|
|
67
|
+
//#region ../../node_modules/.pnpm/@base-ui+react@1.9.0_@date-fns+tz@1.4.1_@types+react@19.2.4_date-fns@4.1.0_react-dom@19.2.0_react@19.2.0__react@19.2.0/node_modules/@base-ui/react/menu/filter-root/MenuFilterContext.mjs
|
|
68
|
+
/**
|
|
69
|
+
* The filter implementation that a filterable root hands to the parts below it. Only the roots
|
|
70
|
+
* `Menu.FilterProvider` renders import it, so a plain menu never bundles it. Parts whose whole
|
|
71
|
+
* structure differs are swapped as components; parts that only register with the filter call an
|
|
72
|
+
* injected hook, so a menu that never renders them doesn't bundle a second implementation.
|
|
73
|
+
*/
|
|
74
|
+
/** Static below a filter root: the implementation never changes, so subscribers never re-render. */
|
|
75
|
+
const MenuFilterImplContext = /*#__PURE__*/ React$1.createContext(null);
|
|
76
|
+
MenuFilterImplContext.displayName = "MenuFilterImplContext";
|
|
77
|
+
/**
|
|
78
|
+
* The filter implementation when the menu this part belongs to is filterable, otherwise `null`.
|
|
79
|
+
* `virtualFocus` marks a filter root; a plain `Menu.Root` never sets it. The result is fixed for
|
|
80
|
+
* a mounted part: a filter root can't appear above it without remounting it.
|
|
81
|
+
*/
|
|
82
|
+
function useMenuFilterImpl(scope = "root") {
|
|
83
|
+
const impl = React$1.useContext(MenuFilterImplContext);
|
|
84
|
+
const root = React$1.useContext(MenuRootContext);
|
|
85
|
+
if (impl === null || root === void 0) return null;
|
|
86
|
+
return (scope === "submenu-trigger" ? root.virtualFocus || root.parentVirtualFocus : root.virtualFocus) ? impl : null;
|
|
87
|
+
}
|
|
88
|
+
/**
|
|
89
|
+
* Throws unless the menu this part renders in is filterable, naming the part and the provider.
|
|
90
|
+
*/
|
|
91
|
+
function useMenuFilterPart(part) {
|
|
92
|
+
if (useMenuFilterImpl() === null) throw new Error(`Base UI: <Menu.${part}> must be placed in a menu wrapped in <Menu.FilterProvider>. It reads the filter query and the matching items from the provider, which a plain menu does not have. Wrap the <Menu.Root> or <Menu.SubmenuRoot> it belongs to in <Menu.FilterProvider>. See https://base-ui.com/react/components/menu#filtering`);
|
|
93
|
+
}
|
|
94
|
+
const UNFILTERED = {
|
|
95
|
+
visible: true,
|
|
96
|
+
ref: null
|
|
97
|
+
};
|
|
98
|
+
function useUnfilteredItem() {
|
|
99
|
+
return UNFILTERED;
|
|
100
|
+
}
|
|
101
|
+
/**
|
|
102
|
+
* Registers an item part with the filter of the menu it belongs to. A plain menu's items are
|
|
103
|
+
* always visible.
|
|
104
|
+
*/
|
|
105
|
+
function useMenuFilterItem(props, forwardedRef, scope = "root") {
|
|
106
|
+
const impl = useMenuFilterImpl(scope);
|
|
107
|
+
const item = ((scope === "submenu-trigger" ? impl?.useSubmenuTrigger : impl?.useItem) ?? useUnfilteredItem)({
|
|
108
|
+
label: props.label,
|
|
109
|
+
children: props.children,
|
|
110
|
+
render: props.render
|
|
111
|
+
});
|
|
112
|
+
const ref = useMergedRefs(forwardedRef, item.ref);
|
|
113
|
+
return {
|
|
114
|
+
visible: item.visible,
|
|
115
|
+
ref,
|
|
116
|
+
props: item.props
|
|
117
|
+
};
|
|
118
|
+
}
|
|
119
|
+
//#endregion
|
|
120
|
+
//#region ../../node_modules/.pnpm/@base-ui+react@1.9.0_@date-fns+tz@1.4.1_@types+react@19.2.4_date-fns@4.1.0_react-dom@19.2.0_react@19.2.0__react@19.2.0/node_modules/@base-ui/react/menu/checkbox-item/MenuCheckboxItemContext.mjs
|
|
121
|
+
const MenuCheckboxItemContext = /*#__PURE__*/ React$1.createContext(void 0);
|
|
122
|
+
MenuCheckboxItemContext.displayName = "MenuCheckboxItemContext";
|
|
123
|
+
function useMenuCheckboxItemContext() {
|
|
124
|
+
const context = React$1.useContext(MenuCheckboxItemContext);
|
|
125
|
+
if (context === void 0) throw new Error("Base UI: MenuCheckboxItemContext is missing. MenuCheckboxItem parts must be placed within <Menu.CheckboxItem>.");
|
|
126
|
+
return context;
|
|
127
|
+
}
|
|
128
|
+
//#endregion
|
|
129
|
+
//#region ../../node_modules/.pnpm/@base-ui+react@1.9.0_@date-fns+tz@1.4.1_@types+react@19.2.4_date-fns@4.1.0_react-dom@19.2.0_react@19.2.0__react@19.2.0/node_modules/@base-ui/react/menu/item/useMenuItemCommonProps.mjs
|
|
130
|
+
function preventMouseDownDefault(event) {
|
|
131
|
+
event.preventDefault();
|
|
132
|
+
}
|
|
133
|
+
/**
|
|
134
|
+
* Returns common props shared by all menu item types.
|
|
135
|
+
* This hook extracts the shared logic for id, role, tabIndex, and interaction handlers.
|
|
136
|
+
*/
|
|
137
|
+
function useMenuItemCommonProps(params) {
|
|
138
|
+
const { closeOnClick, highlighted, id, nodeId, store, typingRef, itemRef, itemMetadata } = params;
|
|
139
|
+
const rootContext = useMenuRootContext();
|
|
140
|
+
const contextMenuContext = useContextMenuRootContext(true);
|
|
141
|
+
const isSubmenuTrigger = itemMetadata.type === "submenu-trigger";
|
|
142
|
+
const virtualFocus = isSubmenuTrigger ? rootContext.parentVirtualFocus : rootContext.virtualFocus;
|
|
143
|
+
const ariaSelected = (isSubmenuTrigger && rootContext.parent.type === "menu" ? rootContext.parent.store : rootContext.store).useState("webkitAriaSelected", highlighted);
|
|
144
|
+
const { events: menuEvents } = store.useState("floatingTreeRoot");
|
|
145
|
+
const open = store.useState("open");
|
|
146
|
+
const isContextMenu = contextMenuContext !== void 0;
|
|
147
|
+
const tabIndex = !virtualFocus && open && highlighted ? 0 : -1;
|
|
148
|
+
return React$1.useMemo(() => ({
|
|
149
|
+
id,
|
|
150
|
+
role: "menuitem",
|
|
151
|
+
tabIndex,
|
|
152
|
+
"aria-selected": ariaSelected,
|
|
153
|
+
onMouseDown: virtualFocus ? preventMouseDownDefault : void 0,
|
|
154
|
+
onKeyDown(event) {
|
|
155
|
+
if (event.key === " " && typingRef?.current) event.preventDefault();
|
|
156
|
+
},
|
|
157
|
+
onMouseMove(event) {
|
|
158
|
+
if (!nodeId) return;
|
|
159
|
+
menuEvents.emit("itemhover", {
|
|
160
|
+
nodeId,
|
|
161
|
+
target: event.currentTarget
|
|
162
|
+
});
|
|
163
|
+
},
|
|
164
|
+
onClick(event) {
|
|
165
|
+
if (closeOnClick) menuEvents.emit("close", {
|
|
166
|
+
domEvent: event.nativeEvent,
|
|
167
|
+
reason: itemPress
|
|
168
|
+
});
|
|
169
|
+
},
|
|
170
|
+
onMouseUp(event) {
|
|
171
|
+
if (contextMenuContext) {
|
|
172
|
+
const initialCursorPoint = contextMenuContext.initialCursorPointRef.current;
|
|
173
|
+
contextMenuContext.initialCursorPointRef.current = null;
|
|
174
|
+
if (isContextMenu && initialCursorPoint && Math.abs(event.clientX - initialCursorPoint.x) <= 1 && Math.abs(event.clientY - initialCursorPoint.y) <= 1) return;
|
|
175
|
+
if (isContextMenu && !mac && event.button === 2) return;
|
|
176
|
+
}
|
|
177
|
+
if (itemRef.current && store.context.allowMouseUpTriggerRef.current && (!isContextMenu || event.button === 2)) {
|
|
178
|
+
if (itemMetadata.type === "regular-item") dispatchClickWithModifiers(itemRef.current, event, {
|
|
179
|
+
detail: 1,
|
|
180
|
+
pointerType: "mouse"
|
|
181
|
+
});
|
|
182
|
+
}
|
|
183
|
+
}
|
|
184
|
+
}), [
|
|
185
|
+
closeOnClick,
|
|
186
|
+
tabIndex,
|
|
187
|
+
id,
|
|
188
|
+
menuEvents,
|
|
189
|
+
nodeId,
|
|
190
|
+
store.context.allowMouseUpTriggerRef,
|
|
191
|
+
typingRef,
|
|
192
|
+
itemRef,
|
|
193
|
+
contextMenuContext,
|
|
194
|
+
isContextMenu,
|
|
195
|
+
itemMetadata.type,
|
|
196
|
+
ariaSelected,
|
|
197
|
+
virtualFocus
|
|
198
|
+
]);
|
|
199
|
+
}
|
|
200
|
+
//#endregion
|
|
201
|
+
//#region ../../node_modules/.pnpm/@base-ui+react@1.9.0_@date-fns+tz@1.4.1_@types+react@19.2.4_date-fns@4.1.0_react-dom@19.2.0_react@19.2.0__react@19.2.0/node_modules/@base-ui/react/menu/item/useMenuItem.mjs
|
|
202
|
+
const REGULAR_ITEM = { type: "regular-item" };
|
|
203
|
+
function useMenuItem(params) {
|
|
204
|
+
const { closeOnClick, disabled, highlighted, id, store, typingRef = store.context.typingRef, nativeButton, itemMetadata, nodeId } = params;
|
|
205
|
+
const itemRef = React$1.useRef(null);
|
|
206
|
+
const { getButtonProps, buttonRef } = useButton({
|
|
207
|
+
disabled,
|
|
208
|
+
focusableWhenDisabled: true,
|
|
209
|
+
native: nativeButton,
|
|
210
|
+
composite: true
|
|
211
|
+
});
|
|
212
|
+
const commonProps = useMenuItemCommonProps({
|
|
213
|
+
closeOnClick,
|
|
214
|
+
highlighted,
|
|
215
|
+
id,
|
|
216
|
+
nodeId,
|
|
217
|
+
store,
|
|
218
|
+
typingRef,
|
|
219
|
+
itemRef,
|
|
220
|
+
itemMetadata
|
|
221
|
+
});
|
|
222
|
+
const getItemProps = React$1.useCallback((externalProps) => {
|
|
223
|
+
return mergeProps(commonProps, { onMouseEnter(event) {
|
|
224
|
+
if (itemMetadata.type !== "submenu-trigger") return;
|
|
225
|
+
itemMetadata.setActive(event.nativeEvent);
|
|
226
|
+
} }, externalProps, getButtonProps);
|
|
227
|
+
}, [
|
|
228
|
+
commonProps,
|
|
229
|
+
getButtonProps,
|
|
230
|
+
itemMetadata
|
|
231
|
+
]);
|
|
232
|
+
const mergedRef = useMergedRefs(itemRef, buttonRef);
|
|
233
|
+
return React$1.useMemo(() => ({
|
|
234
|
+
getItemProps,
|
|
235
|
+
itemRef: mergedRef
|
|
236
|
+
}), [getItemProps, mergedRef]);
|
|
237
|
+
}
|
|
238
|
+
//#endregion
|
|
239
|
+
//#region ../../node_modules/.pnpm/@base-ui+react@1.9.0_@date-fns+tz@1.4.1_@types+react@19.2.4_date-fns@4.1.0_react-dom@19.2.0_react@19.2.0__react@19.2.0/node_modules/@base-ui/react/menu/checkbox-item/MenuCheckboxItemDataAttributes.mjs
|
|
240
|
+
var MenuCheckboxItemDataAttributes_exports = /* @__PURE__ */ __exportAll({
|
|
241
|
+
checked: () => checked,
|
|
242
|
+
disabled: () => disabled,
|
|
243
|
+
highlighted: () => highlighted,
|
|
244
|
+
unchecked: () => unchecked
|
|
245
|
+
});
|
|
246
|
+
/**
|
|
247
|
+
* Present when the menu checkbox item is checked.
|
|
248
|
+
*/
|
|
249
|
+
const checked = "data-checked";
|
|
250
|
+
/**
|
|
251
|
+
* Present when the menu checkbox item is not checked.
|
|
252
|
+
*/
|
|
253
|
+
const unchecked = "data-unchecked";
|
|
254
|
+
/**
|
|
255
|
+
* Present when the menu checkbox item is disabled.
|
|
256
|
+
*/
|
|
257
|
+
const disabled = "data-disabled";
|
|
258
|
+
/**
|
|
259
|
+
* Present when the menu checkbox item is highlighted.
|
|
260
|
+
*/
|
|
261
|
+
const highlighted = "data-highlighted";
|
|
262
|
+
//#endregion
|
|
263
|
+
//#region ../../node_modules/.pnpm/@base-ui+react@1.9.0_@date-fns+tz@1.4.1_@types+react@19.2.4_date-fns@4.1.0_react-dom@19.2.0_react@19.2.0__react@19.2.0/node_modules/@base-ui/react/menu/utils/stateAttributesMapping.mjs
|
|
264
|
+
const itemMapping = {
|
|
265
|
+
checked(value) {
|
|
266
|
+
if (value) return { [checked]: "" };
|
|
267
|
+
return { [unchecked]: "" };
|
|
268
|
+
},
|
|
269
|
+
...transitionStatusMapping
|
|
270
|
+
};
|
|
271
|
+
//#endregion
|
|
272
|
+
//#region ../../node_modules/.pnpm/@base-ui+react@1.9.0_@date-fns+tz@1.4.1_@types+react@19.2.4_date-fns@4.1.0_react-dom@19.2.0_react@19.2.0__react@19.2.0/node_modules/@base-ui/react/menu/checkbox-item/MenuCheckboxItem.mjs
|
|
273
|
+
const MenuCheckboxItemPlain = /*#__PURE__*/ React$1.forwardRef(function MenuCheckboxItemPlain(componentProps, forwardedRef) {
|
|
274
|
+
const { render, className, id: idProp, label, nativeButton = false, disabled: disabledProp = false, closeOnClick = false, checked = false, onCheckedChange, style, ...elementProps } = componentProps;
|
|
275
|
+
const { store } = useMenuRootContext();
|
|
276
|
+
const listItem = useCompositeListItem({
|
|
277
|
+
guess: true,
|
|
278
|
+
label
|
|
279
|
+
});
|
|
280
|
+
const id = useBaseUiId(idProp);
|
|
281
|
+
const rootDisabled = store.useState("disabled");
|
|
282
|
+
const highlighted = store.useState("isActive", listItem.index);
|
|
283
|
+
const nodeId = store.useState("floatingNodeId");
|
|
284
|
+
const itemProps = store.useState("itemProps");
|
|
285
|
+
const disabled = disabledProp || rootDisabled;
|
|
286
|
+
const { getItemProps, itemRef } = useMenuItem({
|
|
287
|
+
closeOnClick,
|
|
288
|
+
disabled,
|
|
289
|
+
highlighted,
|
|
290
|
+
id,
|
|
291
|
+
store,
|
|
292
|
+
nativeButton,
|
|
293
|
+
nodeId,
|
|
294
|
+
itemMetadata: REGULAR_ITEM
|
|
295
|
+
});
|
|
296
|
+
const state = React$1.useMemo(() => ({
|
|
297
|
+
disabled,
|
|
298
|
+
highlighted,
|
|
299
|
+
checked
|
|
300
|
+
}), [
|
|
301
|
+
disabled,
|
|
302
|
+
highlighted,
|
|
303
|
+
checked
|
|
304
|
+
]);
|
|
305
|
+
function handleClick(event) {
|
|
306
|
+
const details = createChangeEventDetails(itemPress, event.nativeEvent, void 0, { preventUnmountOnClose: NOOP });
|
|
307
|
+
onCheckedChange?.(!checked, details);
|
|
308
|
+
}
|
|
309
|
+
const element = useRenderElement("div", componentProps, {
|
|
310
|
+
state,
|
|
311
|
+
stateAttributesMapping: itemMapping,
|
|
312
|
+
props: [
|
|
313
|
+
itemProps,
|
|
314
|
+
{
|
|
315
|
+
role: "menuitemcheckbox",
|
|
316
|
+
"aria-checked": checked,
|
|
317
|
+
onClick: handleClick
|
|
318
|
+
},
|
|
319
|
+
elementProps,
|
|
320
|
+
getItemProps
|
|
321
|
+
],
|
|
322
|
+
ref: [
|
|
323
|
+
itemRef,
|
|
324
|
+
forwardedRef,
|
|
325
|
+
listItem.ref
|
|
326
|
+
]
|
|
327
|
+
});
|
|
328
|
+
return /*#__PURE__*/ jsx(MenuCheckboxItemContext.Provider, {
|
|
329
|
+
value: state,
|
|
330
|
+
children: element
|
|
331
|
+
});
|
|
332
|
+
});
|
|
333
|
+
MenuCheckboxItemPlain.displayName = "MenuCheckboxItemPlain";
|
|
334
|
+
const MenuCheckboxItem = /*#__PURE__*/ React$1.forwardRef(function MenuCheckboxItem(props, forwardedRef) {
|
|
335
|
+
const { checked: checkedProp, defaultChecked, onCheckedChange, ...plainProps } = props;
|
|
336
|
+
const [checked, setChecked] = useControlled({
|
|
337
|
+
controlled: checkedProp,
|
|
338
|
+
default: defaultChecked ?? false,
|
|
339
|
+
name: "MenuCheckboxItem",
|
|
340
|
+
state: "checked"
|
|
341
|
+
});
|
|
342
|
+
const filterItem = useMenuFilterItem(props, forwardedRef);
|
|
343
|
+
function handleCheckedChange(nextChecked, eventDetails) {
|
|
344
|
+
onCheckedChange?.(nextChecked, eventDetails);
|
|
345
|
+
if (!eventDetails.isCanceled) setChecked(nextChecked);
|
|
346
|
+
}
|
|
347
|
+
if (!filterItem.visible) return null;
|
|
348
|
+
return /*#__PURE__*/ jsx(MenuCheckboxItemPlain, {
|
|
349
|
+
...plainProps,
|
|
350
|
+
checked,
|
|
351
|
+
onCheckedChange: handleCheckedChange,
|
|
352
|
+
ref: filterItem.ref
|
|
353
|
+
});
|
|
354
|
+
});
|
|
355
|
+
MenuCheckboxItem.displayName = "MenuCheckboxItem";
|
|
356
|
+
//#endregion
|
|
357
|
+
//#region ../../node_modules/.pnpm/@base-ui+react@1.9.0_@date-fns+tz@1.4.1_@types+react@19.2.4_date-fns@4.1.0_react-dom@19.2.0_react@19.2.0__react@19.2.0/node_modules/@base-ui/react/menu/checkbox-item-indicator/MenuCheckboxItemIndicator.mjs
|
|
358
|
+
/**
|
|
359
|
+
* Indicates whether the checkbox item is ticked.
|
|
360
|
+
* Renders a `<span>` element.
|
|
361
|
+
*
|
|
362
|
+
* Documentation: [Base UI Menu](https://base-ui.com/react/components/menu)
|
|
363
|
+
*/
|
|
364
|
+
const MenuCheckboxItemIndicator = /*#__PURE__*/ React$1.forwardRef(function MenuCheckboxItemIndicator(componentProps, forwardedRef) {
|
|
365
|
+
const { render, className, style, keepMounted = false, ...elementProps } = componentProps;
|
|
366
|
+
const item = useMenuCheckboxItemContext();
|
|
367
|
+
const indicatorRef = React$1.useRef(null);
|
|
368
|
+
const { transitionStatus, mounted, setMounted } = useTransitionStatus(item.checked);
|
|
369
|
+
useOpenChangeComplete({
|
|
370
|
+
batch: true,
|
|
371
|
+
enabled: !item.checked,
|
|
372
|
+
open: item.checked,
|
|
373
|
+
ref: indicatorRef,
|
|
374
|
+
onComplete() {
|
|
375
|
+
if (!item.checked) setMounted(false);
|
|
376
|
+
}
|
|
377
|
+
});
|
|
378
|
+
const state = {
|
|
379
|
+
checked: item.checked,
|
|
380
|
+
disabled: item.disabled,
|
|
381
|
+
highlighted: item.highlighted,
|
|
382
|
+
transitionStatus
|
|
383
|
+
};
|
|
384
|
+
return useRenderElement("span", componentProps, {
|
|
385
|
+
state,
|
|
386
|
+
ref: [forwardedRef, indicatorRef],
|
|
387
|
+
stateAttributesMapping: itemMapping,
|
|
388
|
+
props: {
|
|
389
|
+
"aria-hidden": true,
|
|
390
|
+
...elementProps
|
|
391
|
+
},
|
|
392
|
+
enabled: keepMounted || mounted
|
|
393
|
+
});
|
|
394
|
+
});
|
|
395
|
+
MenuCheckboxItemIndicator.displayName = "MenuCheckboxItemIndicator";
|
|
396
|
+
//#endregion
|
|
397
|
+
//#region ../../node_modules/.pnpm/@base-ui+react@1.9.0_@date-fns+tz@1.4.1_@types+react@19.2.4_date-fns@4.1.0_react-dom@19.2.0_react@19.2.0__react@19.2.0/node_modules/@base-ui/react/menu/group/MenuGroupContext.mjs
|
|
398
|
+
const MenuGroupContext = /*#__PURE__*/ React$1.createContext(void 0);
|
|
399
|
+
MenuGroupContext.displayName = "MenuGroupContext";
|
|
400
|
+
function useMenuGroupRootContext() {
|
|
401
|
+
const context = React$1.useContext(MenuGroupContext);
|
|
402
|
+
if (context === void 0) throw new Error("Base UI: MenuGroupContext is missing. Menu group parts must be used within <Menu.Group> or <Menu.RadioGroup>.");
|
|
403
|
+
return context;
|
|
404
|
+
}
|
|
405
|
+
//#endregion
|
|
406
|
+
//#region ../../node_modules/.pnpm/@base-ui+react@1.9.0_@date-fns+tz@1.4.1_@types+react@19.2.4_date-fns@4.1.0_react-dom@19.2.0_react@19.2.0__react@19.2.0/node_modules/@base-ui/react/menu/group/MenuGroup.mjs
|
|
407
|
+
/**
|
|
408
|
+
* @internal
|
|
409
|
+
*/
|
|
410
|
+
const MenuGroupPlain = /*#__PURE__*/ React$1.forwardRef(function MenuGroupPlain(componentProps, forwardedRef) {
|
|
411
|
+
const { render, className, style, ...elementProps } = componentProps;
|
|
412
|
+
const [labelId, setLabelId] = React$1.useState(void 0);
|
|
413
|
+
const element = useRenderElement("div", componentProps, {
|
|
414
|
+
ref: forwardedRef,
|
|
415
|
+
props: {
|
|
416
|
+
role: "group",
|
|
417
|
+
"aria-labelledby": labelId,
|
|
418
|
+
...elementProps
|
|
419
|
+
}
|
|
420
|
+
});
|
|
421
|
+
return /*#__PURE__*/ jsx(MenuGroupContext.Provider, {
|
|
422
|
+
value: setLabelId,
|
|
423
|
+
children: element
|
|
424
|
+
});
|
|
425
|
+
});
|
|
426
|
+
MenuGroupPlain.displayName = "MenuGroupPlain";
|
|
427
|
+
const MenuGroup = /*#__PURE__*/ React$1.forwardRef(function MenuGroup(props, forwardedRef) {
|
|
428
|
+
const Group = useMenuFilterImpl()?.Group ?? MenuGroupPlain;
|
|
429
|
+
return /*#__PURE__*/ jsx(Group, {
|
|
430
|
+
...props,
|
|
431
|
+
ref: forwardedRef
|
|
432
|
+
});
|
|
433
|
+
});
|
|
434
|
+
MenuGroup.displayName = "MenuGroup";
|
|
435
|
+
//#endregion
|
|
436
|
+
//#region ../../node_modules/.pnpm/@base-ui+react@1.9.0_@date-fns+tz@1.4.1_@types+react@19.2.4_date-fns@4.1.0_react-dom@19.2.0_react@19.2.0__react@19.2.0/node_modules/@base-ui/react/menu/group-label/MenuGroupLabel.mjs
|
|
437
|
+
/**
|
|
438
|
+
* An accessible label that is automatically associated with its parent group.
|
|
439
|
+
* Renders a `<div>` element.
|
|
440
|
+
*
|
|
441
|
+
* Documentation: [Base UI Menu](https://base-ui.com/react/components/menu)
|
|
442
|
+
*/
|
|
443
|
+
const MenuGroupLabel = /*#__PURE__*/ React$1.forwardRef(function MenuGroupLabel(componentProps, forwardedRef) {
|
|
444
|
+
const { render, className, style, id: idProp, ...elementProps } = componentProps;
|
|
445
|
+
const id = useBaseUiId(idProp);
|
|
446
|
+
const setLabelId = useMenuGroupRootContext();
|
|
447
|
+
useIsoLayoutEffect(() => {
|
|
448
|
+
setLabelId(id);
|
|
449
|
+
return () => {
|
|
450
|
+
setLabelId((currentId) => currentId === id ? void 0 : currentId);
|
|
451
|
+
};
|
|
452
|
+
}, [setLabelId, id]);
|
|
453
|
+
return useRenderElement("div", componentProps, {
|
|
454
|
+
ref: forwardedRef,
|
|
455
|
+
props: {
|
|
456
|
+
id,
|
|
457
|
+
"aria-hidden": true,
|
|
458
|
+
...elementProps
|
|
459
|
+
}
|
|
460
|
+
});
|
|
461
|
+
});
|
|
462
|
+
MenuGroupLabel.displayName = "MenuGroupLabel";
|
|
463
|
+
//#endregion
|
|
464
|
+
//#region ../../node_modules/.pnpm/@base-ui+react@1.9.0_@date-fns+tz@1.4.1_@types+react@19.2.4_date-fns@4.1.0_react-dom@19.2.0_react@19.2.0__react@19.2.0/node_modules/@base-ui/react/menu/item/MenuItem.mjs
|
|
465
|
+
const MenuItemPlain = /*#__PURE__*/ React$1.forwardRef(function MenuItemPlain(componentProps, forwardedRef) {
|
|
466
|
+
const { render, className, id: idProp, label, nativeButton = false, disabled: disabledProp = false, closeOnClick = true, style, ...elementProps } = componentProps;
|
|
467
|
+
const { store } = useMenuRootContext();
|
|
468
|
+
const listItem = useCompositeListItem({
|
|
469
|
+
guess: true,
|
|
470
|
+
label
|
|
471
|
+
});
|
|
472
|
+
const id = useBaseUiId(idProp);
|
|
473
|
+
const rootDisabled = store.useState("disabled");
|
|
474
|
+
const highlighted = store.useState("isActive", listItem.index);
|
|
475
|
+
const nodeId = store.useState("floatingNodeId");
|
|
476
|
+
const itemProps = store.useState("itemProps");
|
|
477
|
+
const disabled = disabledProp || rootDisabled;
|
|
478
|
+
const { getItemProps, itemRef } = useMenuItem({
|
|
479
|
+
closeOnClick,
|
|
480
|
+
disabled,
|
|
481
|
+
highlighted,
|
|
482
|
+
id,
|
|
483
|
+
store,
|
|
484
|
+
nativeButton,
|
|
485
|
+
nodeId,
|
|
486
|
+
itemMetadata: REGULAR_ITEM
|
|
487
|
+
});
|
|
488
|
+
return useRenderElement("div", componentProps, {
|
|
489
|
+
state: {
|
|
490
|
+
disabled,
|
|
491
|
+
highlighted
|
|
492
|
+
},
|
|
493
|
+
props: [
|
|
494
|
+
itemProps,
|
|
495
|
+
elementProps,
|
|
496
|
+
getItemProps
|
|
497
|
+
],
|
|
498
|
+
ref: [
|
|
499
|
+
itemRef,
|
|
500
|
+
forwardedRef,
|
|
501
|
+
listItem.ref
|
|
502
|
+
]
|
|
503
|
+
});
|
|
504
|
+
});
|
|
505
|
+
MenuItemPlain.displayName = "MenuItemPlain";
|
|
506
|
+
const MenuItem = /*#__PURE__*/ React$1.forwardRef(function MenuItem(props, forwardedRef) {
|
|
507
|
+
const filterItem = useMenuFilterItem(props, forwardedRef);
|
|
508
|
+
if (!filterItem.visible) return null;
|
|
509
|
+
return /*#__PURE__*/ jsx(MenuItemPlain, {
|
|
510
|
+
...props,
|
|
511
|
+
ref: filterItem.ref
|
|
512
|
+
});
|
|
513
|
+
});
|
|
514
|
+
MenuItem.displayName = "MenuItem";
|
|
515
|
+
//#endregion
|
|
516
|
+
//#region ../../node_modules/.pnpm/@base-ui+react@1.9.0_@date-fns+tz@1.4.1_@types+react@19.2.4_date-fns@4.1.0_react-dom@19.2.0_react@19.2.0__react@19.2.0/node_modules/@base-ui/react/menu/link-item/MenuLinkItem.mjs
|
|
517
|
+
const MenuLinkItemPlain = /*#__PURE__*/ React$1.forwardRef(function MenuLinkItemPlain(componentProps, forwardedRef) {
|
|
518
|
+
const { render, className, id: idProp, label, closeOnClick = false, style, ...elementProps } = componentProps;
|
|
519
|
+
const { store } = useMenuRootContext();
|
|
520
|
+
const linkRef = React$1.useRef(null);
|
|
521
|
+
const listItem = useCompositeListItem({
|
|
522
|
+
guess: true,
|
|
523
|
+
label
|
|
524
|
+
});
|
|
525
|
+
const id = useBaseUiId(idProp);
|
|
526
|
+
const highlighted = store.useState("isActive", listItem.index);
|
|
527
|
+
const nodeId = store.useState("floatingNodeId");
|
|
528
|
+
const itemProps = store.useState("itemProps");
|
|
529
|
+
const typingRef = store.context.typingRef;
|
|
530
|
+
const { getButtonProps, buttonRef } = useButton({
|
|
531
|
+
native: false,
|
|
532
|
+
composite: true
|
|
533
|
+
});
|
|
534
|
+
const commonProps = useMenuItemCommonProps({
|
|
535
|
+
closeOnClick,
|
|
536
|
+
highlighted,
|
|
537
|
+
id,
|
|
538
|
+
nodeId,
|
|
539
|
+
store,
|
|
540
|
+
typingRef,
|
|
541
|
+
itemRef: linkRef,
|
|
542
|
+
itemMetadata: REGULAR_ITEM
|
|
543
|
+
});
|
|
544
|
+
function getItemProps(externalProps) {
|
|
545
|
+
return mergeProps(commonProps, externalProps, getButtonProps);
|
|
546
|
+
}
|
|
547
|
+
return useRenderElement("a", componentProps, {
|
|
548
|
+
state: { highlighted },
|
|
549
|
+
props: [
|
|
550
|
+
itemProps,
|
|
551
|
+
elementProps,
|
|
552
|
+
getItemProps
|
|
553
|
+
],
|
|
554
|
+
ref: [
|
|
555
|
+
linkRef,
|
|
556
|
+
buttonRef,
|
|
557
|
+
forwardedRef,
|
|
558
|
+
listItem.ref
|
|
559
|
+
]
|
|
560
|
+
});
|
|
561
|
+
});
|
|
562
|
+
MenuLinkItemPlain.displayName = "MenuLinkItemPlain";
|
|
563
|
+
const MenuLinkItem = /*#__PURE__*/ React$1.forwardRef(function MenuLinkItem(props, forwardedRef) {
|
|
564
|
+
const filterItem = useMenuFilterItem(props, forwardedRef);
|
|
565
|
+
if (!filterItem.visible) return null;
|
|
566
|
+
return /*#__PURE__*/ jsx(MenuLinkItemPlain, {
|
|
567
|
+
...props,
|
|
568
|
+
ref: filterItem.ref
|
|
569
|
+
});
|
|
570
|
+
});
|
|
571
|
+
MenuLinkItem.displayName = "MenuLinkItem";
|
|
572
|
+
//#endregion
|
|
573
|
+
//#region ../../node_modules/.pnpm/@base-ui+react@1.9.0_@date-fns+tz@1.4.1_@types+react@19.2.4_date-fns@4.1.0_react-dom@19.2.0_react@19.2.0__react@19.2.0/node_modules/@base-ui/react/menu/submenu-root/MenuSubmenuRootContext.mjs
|
|
574
|
+
const MenuSubmenuRootContext = /*#__PURE__*/ React$1.createContext(void 0);
|
|
575
|
+
MenuSubmenuRootContext.displayName = "MenuSubmenuRootContext";
|
|
576
|
+
function useMenuSubmenuRootContext() {
|
|
577
|
+
return React$1.useContext(MenuSubmenuRootContext);
|
|
578
|
+
}
|
|
579
|
+
//#endregion
|
|
580
|
+
//#region ../../node_modules/.pnpm/@base-ui+react@1.9.0_@date-fns+tz@1.4.1_@types+react@19.2.4_date-fns@4.1.0_react-dom@19.2.0_react@19.2.0__react@19.2.0/node_modules/@base-ui/react/internals/resolveRenderedId.mjs
|
|
581
|
+
/**
|
|
582
|
+
* Resolves an element's id using the same precedence as `useRenderElement`.
|
|
583
|
+
* Returns `''` when the element renders with an explicitly empty id, which consumers must treat
|
|
584
|
+
* as "no id" rather than falling back to the generated one, so ARIA relationships never reference
|
|
585
|
+
* an id no element carries. Render callbacks are opaque and are expected to use the id passed to
|
|
586
|
+
* them.
|
|
587
|
+
*
|
|
588
|
+
* @internal
|
|
589
|
+
*/
|
|
590
|
+
function resolveRenderedId(props, fallbackId) {
|
|
591
|
+
const render = unwrapLazyRenderProp(props.render);
|
|
592
|
+
if (/*#__PURE__*/ React$1.isValidElement(render)) {
|
|
593
|
+
const renderProps = render.props;
|
|
594
|
+
if (Object.hasOwn(renderProps, "id")) return renderProps.id ?? "";
|
|
595
|
+
}
|
|
596
|
+
return props.id ?? fallbackId;
|
|
597
|
+
}
|
|
598
|
+
/**
|
|
599
|
+
* Resolves the element's id and returns a ref that publishes it to the owner while mounted.
|
|
600
|
+
* A generated fallback is never published as an override, so removing an explicit id lets the
|
|
601
|
+
* element return to the generated one.
|
|
602
|
+
*
|
|
603
|
+
* @internal
|
|
604
|
+
*/
|
|
605
|
+
function useRenderedId(props, defaultId, setId) {
|
|
606
|
+
const id = resolveRenderedId(props, defaultId);
|
|
607
|
+
const registeredId = id === defaultId ? void 0 : id;
|
|
608
|
+
return [id, React$1.useCallback((element) => setId?.(element ? registeredId : void 0), [registeredId, setId])];
|
|
609
|
+
}
|
|
610
|
+
//#endregion
|
|
611
|
+
//#region ../../node_modules/.pnpm/@base-ui+react@1.9.0_@date-fns+tz@1.4.1_@types+react@19.2.4_date-fns@4.1.0_react-dom@19.2.0_react@19.2.0__react@19.2.0/node_modules/@base-ui/react/internals/resolvePopupLabel.mjs
|
|
612
|
+
function resolvePopupLabel(props, activeTriggerElement, activeTriggerId) {
|
|
613
|
+
const render = unwrapLazyRenderProp(props.render);
|
|
614
|
+
const renderedElementProps = /*#__PURE__*/ React$1.isValidElement(render) ? render.props : void 0;
|
|
615
|
+
const ariaLabel = props["aria-label"] ?? renderedElementProps?.["aria-label"];
|
|
616
|
+
let ariaLabelledBy = props["aria-labelledby"] ?? renderedElementProps?.["aria-labelledby"];
|
|
617
|
+
if (ariaLabelledBy == null && !ariaLabel) ariaLabelledBy = activeTriggerElement ? activeTriggerElement.id || void 0 : activeTriggerId || void 0;
|
|
618
|
+
return ariaLabelledBy;
|
|
619
|
+
}
|
|
620
|
+
//#endregion
|
|
621
|
+
//#region ../../node_modules/.pnpm/@base-ui+react@1.9.0_@date-fns+tz@1.4.1_@types+react@19.2.4_date-fns@4.1.0_react-dom@19.2.0_react@19.2.0__react@19.2.0/node_modules/@base-ui/react/menu/popup/MenuPopup.mjs
|
|
622
|
+
/**
|
|
623
|
+
* @internal
|
|
624
|
+
*/
|
|
625
|
+
const MenuPopupPlain = /*#__PURE__*/ React$1.forwardRef(function MenuPopupPlain(componentProps, forwardedRef) {
|
|
626
|
+
const { render, className, style, finalFocus, id: idProp, initialFocus: initialFocusProp, ...elementProps } = componentProps;
|
|
627
|
+
const { store, defaultFloatingId, setRenderedFloatingId, virtualFocus, orientation } = useMenuRootContext();
|
|
628
|
+
const inheritedSubmenuRootContext = useMenuSubmenuRootContext();
|
|
629
|
+
const { side, align } = useMenuPositionerContext();
|
|
630
|
+
const insideToolbar = useToolbarRootContext(true) != null;
|
|
631
|
+
const open = store.useState("open");
|
|
632
|
+
const transitionStatus = store.useState("transitionStatus");
|
|
633
|
+
const popupProps = store.useState("popupProps");
|
|
634
|
+
const mounted = store.useState("mounted");
|
|
635
|
+
const instantType = store.useState("instantType");
|
|
636
|
+
const activeTriggerElement = store.useState("activeTriggerElement");
|
|
637
|
+
const parent = store.useState("parent");
|
|
638
|
+
const lastOpenChangeReason = store.useState("lastOpenChangeReason");
|
|
639
|
+
const rootId = store.useState("rootId");
|
|
640
|
+
const floatingContext = store.useState("floatingRootContext");
|
|
641
|
+
const floatingTreeRoot = store.useState("floatingTreeRoot");
|
|
642
|
+
const closeDelay = store.useState("closeDelay");
|
|
643
|
+
const hoverEnabled = store.useState("hoverEnabled");
|
|
644
|
+
const disabled = store.useState("disabled");
|
|
645
|
+
const openMethod = store.useState("openMethod");
|
|
646
|
+
const activeTriggerId = store.useState("activeTriggerId");
|
|
647
|
+
const listElement = store.useState("listElement");
|
|
648
|
+
const [id, registerIdRef] = useRenderedId(componentProps, defaultFloatingId, setRenderedFloatingId);
|
|
649
|
+
const ariaLabelledBy = resolvePopupLabel(componentProps, activeTriggerElement, activeTriggerId);
|
|
650
|
+
const submenuRootContext = parent.type === "menu" ? inheritedSubmenuRootContext : void 0;
|
|
651
|
+
const isContextMenu = parent.type === "context-menu";
|
|
652
|
+
let initialFocus = initialFocusProp ?? parent.type !== "menu";
|
|
653
|
+
if (initialFocusProp === void 0 && listElement && parent.type !== "menu") initialFocus = () => {
|
|
654
|
+
if (store.state.activeIndex !== null) return false;
|
|
655
|
+
return listElement;
|
|
656
|
+
};
|
|
657
|
+
useOpenChangeComplete({
|
|
658
|
+
open,
|
|
659
|
+
ref: store.context.popupRef,
|
|
660
|
+
onComplete() {
|
|
661
|
+
if (open) store.context.onOpenChangeComplete?.(true);
|
|
662
|
+
}
|
|
663
|
+
});
|
|
664
|
+
React$1.useEffect(() => {
|
|
665
|
+
function handleClose(event) {
|
|
666
|
+
store.setOpen(false, createChangeEventDetails(event.reason, event.domEvent));
|
|
667
|
+
}
|
|
668
|
+
floatingTreeRoot.events.on("close", handleClose);
|
|
669
|
+
return () => {
|
|
670
|
+
floatingTreeRoot.events.off("close", handleClose);
|
|
671
|
+
};
|
|
672
|
+
}, [floatingTreeRoot.events, store]);
|
|
673
|
+
useHoverFloatingInteraction(floatingContext, {
|
|
674
|
+
enabled: hoverEnabled && !disabled && !isContextMenu && parent.type !== "menubar",
|
|
675
|
+
closeDelay
|
|
676
|
+
});
|
|
677
|
+
const setPopupElement = store.useStateSetter("popupElement");
|
|
678
|
+
const { parentVirtualFocusRef, handleFocus } = (React$1.useContext(MenuFilterImplContext)?.useParentHandoff ?? useNoParentHandoff)(store, parent, open, virtualFocus);
|
|
679
|
+
const state = {
|
|
680
|
+
transitionStatus,
|
|
681
|
+
side,
|
|
682
|
+
align,
|
|
683
|
+
open,
|
|
684
|
+
nested: parent.type === "menu",
|
|
685
|
+
instant: instantType
|
|
686
|
+
};
|
|
687
|
+
const element = useRenderElement("div", componentProps, {
|
|
688
|
+
state,
|
|
689
|
+
ref: [
|
|
690
|
+
forwardedRef,
|
|
691
|
+
store.context.popupRef,
|
|
692
|
+
setPopupElement,
|
|
693
|
+
registerIdRef
|
|
694
|
+
],
|
|
695
|
+
stateAttributesMapping: popupTransitionStateMapping,
|
|
696
|
+
props: [
|
|
697
|
+
popupProps,
|
|
698
|
+
{
|
|
699
|
+
id,
|
|
700
|
+
...listElement ? { role: "presentation" } : {
|
|
701
|
+
role: "menu",
|
|
702
|
+
"aria-orientation": orientation === "horizontal" ? "horizontal" : void 0,
|
|
703
|
+
"aria-labelledby": ariaLabelledBy
|
|
704
|
+
},
|
|
705
|
+
onKeyDown(event) {
|
|
706
|
+
submenuRootContext?.onPopupKeyDown?.(event);
|
|
707
|
+
if (insideToolbar && COMPOSITE_KEYS.has(event.key)) event.stopPropagation();
|
|
708
|
+
},
|
|
709
|
+
onFocus: handleFocus
|
|
710
|
+
},
|
|
711
|
+
getDisabledMountTransitionStyles(transitionStatus),
|
|
712
|
+
elementProps,
|
|
713
|
+
{ "data-rootownerid": rootId }
|
|
714
|
+
]
|
|
715
|
+
});
|
|
716
|
+
let returnFocus = parent.type === void 0 || isContextMenu;
|
|
717
|
+
if (activeTriggerElement || parent.type === "menubar" && lastOpenChangeReason !== "outside-press") returnFocus = true;
|
|
718
|
+
const dynamicReturnFocus = submenuRootContext?.getReturnElement ?? parentVirtualFocusRef;
|
|
719
|
+
return /*#__PURE__*/ jsx(FloatingFocusManager, {
|
|
720
|
+
context: floatingContext,
|
|
721
|
+
openInteractionType: openMethod,
|
|
722
|
+
modal: isContextMenu,
|
|
723
|
+
disabled: !mounted,
|
|
724
|
+
returnFocus: finalFocus ?? dynamicReturnFocus ?? returnFocus,
|
|
725
|
+
explicitReturnFocus: finalFocus === void 0 && dynamicReturnFocus ? false : void 0,
|
|
726
|
+
initialFocus,
|
|
727
|
+
restoreFocus: true,
|
|
728
|
+
getInsideElements: parent.type === void 0 ? () => [store.context.beforeTriggerFocusGuardRef.current] : void 0,
|
|
729
|
+
externalTree: parent.type !== "menubar" ? floatingTreeRoot : void 0,
|
|
730
|
+
previousFocusableElement: activeTriggerElement,
|
|
731
|
+
nextFocusableElement: parent.type === void 0 ? store.context.triggerFocusTargetRef : void 0,
|
|
732
|
+
beforeContentFocusGuardRef: store.context.beforeContentFocusGuardRef,
|
|
733
|
+
children: element
|
|
734
|
+
});
|
|
735
|
+
});
|
|
736
|
+
MenuPopupPlain.displayName = "MenuPopupPlain";
|
|
737
|
+
const NO_PARENT_HANDOFF = {
|
|
738
|
+
parentVirtualFocusRef: void 0,
|
|
739
|
+
handleFocus: void 0
|
|
740
|
+
};
|
|
741
|
+
function useNoParentHandoff() {
|
|
742
|
+
return NO_PARENT_HANDOFF;
|
|
743
|
+
}
|
|
744
|
+
/**
|
|
745
|
+
* A container for the menu items.
|
|
746
|
+
* Renders a `<div>` element.
|
|
747
|
+
*
|
|
748
|
+
* Documentation: [Base UI Menu](https://base-ui.com/react/components/menu)
|
|
749
|
+
*/
|
|
750
|
+
const MenuPopup = /*#__PURE__*/ React$1.forwardRef(function MenuPopup(props, forwardedRef) {
|
|
751
|
+
const Popup = useMenuFilterImpl()?.Popup ?? MenuPopupPlain;
|
|
752
|
+
return /*#__PURE__*/ jsx(Popup, {
|
|
753
|
+
...props,
|
|
754
|
+
ref: forwardedRef
|
|
755
|
+
});
|
|
756
|
+
});
|
|
757
|
+
MenuPopup.displayName = "MenuPopup";
|
|
758
|
+
//#endregion
|
|
759
|
+
//#region ../../node_modules/.pnpm/@base-ui+react@1.9.0_@date-fns+tz@1.4.1_@types+react@19.2.4_date-fns@4.1.0_react-dom@19.2.0_react@19.2.0__react@19.2.0/node_modules/@base-ui/react/menu/portal/MenuPortalContext.mjs
|
|
760
|
+
const MenuPortalContext = /*#__PURE__*/ React$1.createContext(void 0);
|
|
761
|
+
MenuPortalContext.displayName = "MenuPortalContext";
|
|
762
|
+
function useMenuPortalContext() {
|
|
763
|
+
const value = React$1.useContext(MenuPortalContext);
|
|
764
|
+
if (value === void 0) throw new Error("Base UI: <Menu.Portal> is missing.");
|
|
765
|
+
return value;
|
|
766
|
+
}
|
|
767
|
+
//#endregion
|
|
768
|
+
//#region ../../node_modules/.pnpm/@base-ui+react@1.9.0_@date-fns+tz@1.4.1_@types+react@19.2.4_date-fns@4.1.0_react-dom@19.2.0_react@19.2.0__react@19.2.0/node_modules/@base-ui/react/menu/portal/MenuPortal.mjs
|
|
769
|
+
/**
|
|
770
|
+
* A portal element that moves the popup to a different part of the DOM.
|
|
771
|
+
* By default, the portal element is appended to `<body>`.
|
|
772
|
+
* Renders a `<div>` element.
|
|
773
|
+
*
|
|
774
|
+
* Documentation: [Base UI Menu](https://base-ui.com/react/components/menu)
|
|
775
|
+
*/
|
|
776
|
+
const MenuPortal = /*#__PURE__*/ React$1.forwardRef(function MenuPortal(props, forwardedRef) {
|
|
777
|
+
const { keepMounted = false, ...portalProps } = props;
|
|
778
|
+
const { store, parent } = useMenuRootContext();
|
|
779
|
+
if (!(store.useState("mounted") || keepMounted)) return null;
|
|
780
|
+
const portalOwnerRole = parent.type === "menu" || parent.type === "menubar" ? "group" : void 0;
|
|
781
|
+
return /*#__PURE__*/ jsx(MenuPortalContext.Provider, {
|
|
782
|
+
value: keepMounted,
|
|
783
|
+
children: /*#__PURE__*/ jsx(FloatingPortal, {
|
|
784
|
+
ref: forwardedRef,
|
|
785
|
+
...portalProps,
|
|
786
|
+
portalOwnerRole
|
|
787
|
+
})
|
|
788
|
+
});
|
|
789
|
+
});
|
|
790
|
+
MenuPortal.displayName = "MenuPortal";
|
|
791
|
+
//#endregion
|
|
792
|
+
//#region ../../node_modules/.pnpm/@base-ui+react@1.9.0_@date-fns+tz@1.4.1_@types+react@19.2.4_date-fns@4.1.0_react-dom@19.2.0_react@19.2.0__react@19.2.0/node_modules/@base-ui/react/menu/positioner/MenuPositioner.mjs
|
|
793
|
+
/**
|
|
794
|
+
* Positions the menu popup against the trigger.
|
|
795
|
+
* Renders a `<div>` element.
|
|
796
|
+
*
|
|
797
|
+
* Documentation: [Base UI Menu](https://base-ui.com/react/components/menu)
|
|
798
|
+
*/
|
|
799
|
+
const MenuPositioner = /*#__PURE__*/ React$1.forwardRef(function MenuPositioner(componentProps, forwardedRef) {
|
|
800
|
+
const { anchor: anchorProp, positionMethod: positionMethodProp = "absolute", className, render, side, align: alignProp, sideOffset: sideOffsetProp = 0, alignOffset: alignOffsetProp = 0, collisionBoundary = "clipping-ancestors", collisionPadding = 5, arrowPadding = 5, sticky = false, disableAnchorTracking = false, collisionAvoidance: collisionAvoidanceProp = DROPDOWN_COLLISION_AVOIDANCE, style, ...elementProps } = componentProps;
|
|
801
|
+
const { store, virtualFocus, syncHighlightedItem } = useMenuRootContext();
|
|
802
|
+
const keepMounted = useMenuPortalContext();
|
|
803
|
+
const contextMenuContext = useContextMenuRootContext(true);
|
|
804
|
+
const parent = store.useState("parent");
|
|
805
|
+
const floatingRootContext = store.useState("floatingRootContext");
|
|
806
|
+
const floatingTreeRoot = store.useState("floatingTreeRoot");
|
|
807
|
+
const mounted = store.useState("mounted");
|
|
808
|
+
const open = store.useState("open");
|
|
809
|
+
const modal = store.useState("modal");
|
|
810
|
+
const openMethod = store.useState("openMethod");
|
|
811
|
+
const triggerElement = store.useState("activeTriggerElement");
|
|
812
|
+
const transitionStatus = store.useState("transitionStatus");
|
|
813
|
+
const positionerElement = store.useState("positionerElement");
|
|
814
|
+
const instantType = store.useState("instantType");
|
|
815
|
+
const adaptiveOrigin = store.useState("adaptiveOrigin");
|
|
816
|
+
const lastOpenChangeReason = store.useState("lastOpenChangeReason");
|
|
817
|
+
const floatingNodeId = store.useState("floatingNodeId");
|
|
818
|
+
const floatingParentNodeId = store.useState("floatingParentNodeId");
|
|
819
|
+
const domReference = floatingRootContext.useState("domReferenceElement");
|
|
820
|
+
let anchor = anchorProp;
|
|
821
|
+
let sideOffset = sideOffsetProp;
|
|
822
|
+
let alignOffset = alignOffsetProp;
|
|
823
|
+
let align = alignProp;
|
|
824
|
+
let collisionAvoidance = collisionAvoidanceProp;
|
|
825
|
+
if (parent.type === "context-menu") {
|
|
826
|
+
anchor = anchorProp ?? parent.context?.anchor;
|
|
827
|
+
align = align ?? "start";
|
|
828
|
+
if (!side && align !== "center") {
|
|
829
|
+
alignOffset = componentProps.alignOffset ?? 2;
|
|
830
|
+
sideOffset = componentProps.sideOffset ?? -5;
|
|
831
|
+
}
|
|
832
|
+
}
|
|
833
|
+
let computedSide = side;
|
|
834
|
+
let computedAlign = align;
|
|
835
|
+
if (parent.type === "menu") {
|
|
836
|
+
computedSide = computedSide ?? "inline-end";
|
|
837
|
+
computedAlign = computedAlign ?? "start";
|
|
838
|
+
collisionAvoidance = componentProps.collisionAvoidance ?? POPUP_COLLISION_AVOIDANCE;
|
|
839
|
+
} else if (parent.type === "menubar") {
|
|
840
|
+
computedSide = computedSide ?? (parent.context.orientation === "vertical" ? "inline-end" : "bottom");
|
|
841
|
+
computedAlign = computedAlign ?? "start";
|
|
842
|
+
}
|
|
843
|
+
const contextMenu = parent.type === "context-menu";
|
|
844
|
+
const positioner = useAnchorPositioning({
|
|
845
|
+
anchor,
|
|
846
|
+
floatingRootContext,
|
|
847
|
+
positionMethod: contextMenuContext ? "fixed" : positionMethodProp,
|
|
848
|
+
mounted,
|
|
849
|
+
side: computedSide,
|
|
850
|
+
sideOffset,
|
|
851
|
+
align: computedAlign,
|
|
852
|
+
alignOffset,
|
|
853
|
+
arrowPadding: contextMenu ? 0 : arrowPadding,
|
|
854
|
+
collisionBoundary,
|
|
855
|
+
collisionPadding,
|
|
856
|
+
sticky,
|
|
857
|
+
nodeId: floatingNodeId,
|
|
858
|
+
keepMounted,
|
|
859
|
+
disableAnchorTracking,
|
|
860
|
+
collisionAvoidance,
|
|
861
|
+
shift: contextMenu ? {
|
|
862
|
+
crossAxis: !("side" in collisionAvoidance && collisionAvoidance.side === "flip"),
|
|
863
|
+
rootBoundary: "layoutViewport"
|
|
864
|
+
} : void 0,
|
|
865
|
+
externalTree: floatingTreeRoot,
|
|
866
|
+
adaptiveOrigin,
|
|
867
|
+
lazyFlip: virtualFocus ? "placement" : false
|
|
868
|
+
});
|
|
869
|
+
React$1.useEffect(() => {
|
|
870
|
+
function onMenuOpenChange(details) {
|
|
871
|
+
if (details.open) {
|
|
872
|
+
if (details.parentNodeId === floatingNodeId) store.set("hoverEnabled", false);
|
|
873
|
+
if (details.nodeId !== floatingNodeId && details.parentNodeId === store.select("floatingParentNodeId")) store.setOpen(false, createChangeEventDetails(siblingOpen));
|
|
874
|
+
}
|
|
875
|
+
}
|
|
876
|
+
floatingTreeRoot.events.on("menuopenchange", onMenuOpenChange);
|
|
877
|
+
return () => {
|
|
878
|
+
floatingTreeRoot.events.off("menuopenchange", onMenuOpenChange);
|
|
879
|
+
};
|
|
880
|
+
}, [
|
|
881
|
+
store,
|
|
882
|
+
floatingTreeRoot.events,
|
|
883
|
+
floatingNodeId
|
|
884
|
+
]);
|
|
885
|
+
React$1.useEffect(() => {
|
|
886
|
+
if (store.select("floatingParentNodeId") == null) return;
|
|
887
|
+
function onParentClose(details) {
|
|
888
|
+
if (details.open || details.nodeId !== store.select("floatingParentNodeId")) return;
|
|
889
|
+
const reason = details.reason ?? "sibling-open";
|
|
890
|
+
store.setOpen(false, createChangeEventDetails(reason));
|
|
891
|
+
}
|
|
892
|
+
floatingTreeRoot.events.on("menuopenchange", onParentClose);
|
|
893
|
+
return () => {
|
|
894
|
+
floatingTreeRoot.events.off("menuopenchange", onParentClose);
|
|
895
|
+
};
|
|
896
|
+
}, [floatingTreeRoot.events, store]);
|
|
897
|
+
const closeTimeout = useTimeout();
|
|
898
|
+
React$1.useEffect(() => {
|
|
899
|
+
if (!open) closeTimeout.clear();
|
|
900
|
+
}, [open, closeTimeout]);
|
|
901
|
+
React$1.useEffect(() => {
|
|
902
|
+
function onItemHover(event) {
|
|
903
|
+
if (!open || event.nodeId !== store.select("floatingParentNodeId")) return;
|
|
904
|
+
if (event.target && triggerElement && triggerElement !== event.target) {
|
|
905
|
+
const delay = store.select("closeDelay");
|
|
906
|
+
if (delay > 0) {
|
|
907
|
+
if (!closeTimeout.isStarted()) closeTimeout.start(delay, () => {
|
|
908
|
+
store.setOpen(false, createChangeEventDetails(siblingOpen));
|
|
909
|
+
});
|
|
910
|
+
} else store.setOpen(false, createChangeEventDetails(siblingOpen));
|
|
911
|
+
} else closeTimeout.clear();
|
|
912
|
+
}
|
|
913
|
+
floatingTreeRoot.events.on("itemhover", onItemHover);
|
|
914
|
+
return () => {
|
|
915
|
+
floatingTreeRoot.events.off("itemhover", onItemHover);
|
|
916
|
+
};
|
|
917
|
+
}, [
|
|
918
|
+
floatingTreeRoot.events,
|
|
919
|
+
open,
|
|
920
|
+
triggerElement,
|
|
921
|
+
store,
|
|
922
|
+
closeTimeout
|
|
923
|
+
]);
|
|
924
|
+
React$1.useEffect(() => {
|
|
925
|
+
const eventDetails = {
|
|
926
|
+
open,
|
|
927
|
+
nodeId: floatingNodeId,
|
|
928
|
+
parentNodeId: floatingParentNodeId,
|
|
929
|
+
reason: store.select("lastOpenChangeReason")
|
|
930
|
+
};
|
|
931
|
+
floatingTreeRoot.events.emit("menuopenchange", eventDetails);
|
|
932
|
+
}, [
|
|
933
|
+
floatingTreeRoot.events,
|
|
934
|
+
open,
|
|
935
|
+
store,
|
|
936
|
+
floatingNodeId,
|
|
937
|
+
floatingParentNodeId
|
|
938
|
+
]);
|
|
939
|
+
useTriggerSwitchTransition({
|
|
940
|
+
store,
|
|
941
|
+
domReference,
|
|
942
|
+
positionerElement,
|
|
943
|
+
open
|
|
944
|
+
});
|
|
945
|
+
const state = {
|
|
946
|
+
open,
|
|
947
|
+
side: positioner.side,
|
|
948
|
+
align: positioner.align,
|
|
949
|
+
anchorHidden: positioner.anchorHidden,
|
|
950
|
+
nested: parent.type === "menu",
|
|
951
|
+
instant: instantType
|
|
952
|
+
};
|
|
953
|
+
const menubarModal = parent.type === "menubar" && parent.context.modal;
|
|
954
|
+
useAnchoredPopupScrollLock(open && (menubarModal || modal && lastOpenChangeReason !== "trigger-hover"), openMethod === "touch", positionerElement, triggerElement);
|
|
955
|
+
const element = usePositioner(componentProps, state, {
|
|
956
|
+
styles: positioner.positionerStyles,
|
|
957
|
+
transitionStatus,
|
|
958
|
+
props: elementProps,
|
|
959
|
+
refs: [forwardedRef, store.useStateSetter("positionerElement")],
|
|
960
|
+
hidden: !mounted,
|
|
961
|
+
inert: !open
|
|
962
|
+
});
|
|
963
|
+
const shouldRenderBackdrop = mounted && parent.type !== "menu" && (parent.type !== "menubar" && modal && lastOpenChangeReason !== "trigger-hover" || parent.type === "menubar" && parent.context.modal);
|
|
964
|
+
let backdropCutout = null;
|
|
965
|
+
if (parent.type === "menubar") backdropCutout = parent.context.contentElement;
|
|
966
|
+
else if (parent.type === void 0) backdropCutout = triggerElement;
|
|
967
|
+
return /*#__PURE__*/ jsxs(MenuPositionerContext.Provider, {
|
|
968
|
+
value: positioner,
|
|
969
|
+
children: [shouldRenderBackdrop && /*#__PURE__*/ jsx(InternalBackdrop, {
|
|
970
|
+
ref: parent.type === "context-menu" || parent.type === "nested-context-menu" ? parent.context.internalBackdropRef : null,
|
|
971
|
+
inert: inertValue(!open),
|
|
972
|
+
cutout: backdropCutout
|
|
973
|
+
}), /*#__PURE__*/ jsx(FloatingNode, {
|
|
974
|
+
id: floatingNodeId,
|
|
975
|
+
children: /*#__PURE__*/ jsx(CompositeList, {
|
|
976
|
+
elementsRef: store.context.itemDomElements,
|
|
977
|
+
labelsRef: store.context.itemLabels,
|
|
978
|
+
onMapChange: syncHighlightedItem,
|
|
979
|
+
children: element
|
|
980
|
+
})
|
|
981
|
+
})]
|
|
982
|
+
});
|
|
983
|
+
});
|
|
984
|
+
MenuPositioner.displayName = "MenuPositioner";
|
|
985
|
+
//#endregion
|
|
986
|
+
//#region ../../node_modules/.pnpm/@base-ui+react@1.9.0_@date-fns+tz@1.4.1_@types+react@19.2.4_date-fns@4.1.0_react-dom@19.2.0_react@19.2.0__react@19.2.0/node_modules/@base-ui/react/menu/radio-group/MenuRadioGroupContext.mjs
|
|
987
|
+
const MenuRadioGroupContext = /*#__PURE__*/ React$1.createContext(void 0);
|
|
988
|
+
MenuRadioGroupContext.displayName = "MenuRadioGroupContext";
|
|
989
|
+
function useMenuRadioGroupContext() {
|
|
990
|
+
const context = React$1.useContext(MenuRadioGroupContext);
|
|
991
|
+
if (context === void 0) throw new Error("Base UI: MenuRadioGroupContext is missing. MenuRadioGroup parts must be placed within <Menu.RadioGroup>.");
|
|
992
|
+
return context;
|
|
993
|
+
}
|
|
994
|
+
//#endregion
|
|
995
|
+
//#region ../../node_modules/.pnpm/@base-ui+react@1.9.0_@date-fns+tz@1.4.1_@types+react@19.2.4_date-fns@4.1.0_react-dom@19.2.0_react@19.2.0__react@19.2.0/node_modules/@base-ui/react/menu/radio-group/MenuRadioGroup.mjs
|
|
996
|
+
/**
|
|
997
|
+
* @internal
|
|
998
|
+
*/
|
|
999
|
+
const MenuRadioGroupPlain = /*#__PURE__*/ React$1.forwardRef(function MenuRadioGroupPlain(componentProps, forwardedRef) {
|
|
1000
|
+
const { render, className, value: valueProp, defaultValue, onValueChange: onValueChangeProp, disabled = false, style, "aria-labelledby": ariaLabelledByProp, ...elementProps } = componentProps;
|
|
1001
|
+
const [labelId, setLabelId] = React$1.useState(void 0);
|
|
1002
|
+
const [value, setValueUnwrapped] = useControlled({
|
|
1003
|
+
controlled: valueProp,
|
|
1004
|
+
default: defaultValue,
|
|
1005
|
+
name: "MenuRadioGroup"
|
|
1006
|
+
});
|
|
1007
|
+
const setValue = useStableCallback((newValue, eventDetails) => {
|
|
1008
|
+
onValueChangeProp?.(newValue, eventDetails);
|
|
1009
|
+
if (eventDetails.isCanceled) return;
|
|
1010
|
+
setValueUnwrapped(newValue);
|
|
1011
|
+
});
|
|
1012
|
+
const element = useRenderElement("div", componentProps, {
|
|
1013
|
+
state: { disabled },
|
|
1014
|
+
ref: forwardedRef,
|
|
1015
|
+
props: {
|
|
1016
|
+
role: "group",
|
|
1017
|
+
"aria-labelledby": ariaLabelledByProp ?? labelId,
|
|
1018
|
+
"aria-disabled": disabled || void 0,
|
|
1019
|
+
...elementProps
|
|
1020
|
+
}
|
|
1021
|
+
});
|
|
1022
|
+
const context = React$1.useMemo(() => ({
|
|
1023
|
+
value,
|
|
1024
|
+
setValue,
|
|
1025
|
+
disabled
|
|
1026
|
+
}), [
|
|
1027
|
+
value,
|
|
1028
|
+
setValue,
|
|
1029
|
+
disabled
|
|
1030
|
+
]);
|
|
1031
|
+
return /*#__PURE__*/ jsx(MenuGroupContext.Provider, {
|
|
1032
|
+
value: setLabelId,
|
|
1033
|
+
children: /*#__PURE__*/ jsx(MenuRadioGroupContext.Provider, {
|
|
1034
|
+
value: context,
|
|
1035
|
+
children: element
|
|
1036
|
+
})
|
|
1037
|
+
});
|
|
1038
|
+
});
|
|
1039
|
+
MenuRadioGroupPlain.displayName = "MenuRadioGroupPlain";
|
|
1040
|
+
const MenuRadioGroup = /*#__PURE__*/ React$1.memo(/*#__PURE__*/ React$1.forwardRef(function MenuRadioGroup(props, forwardedRef) {
|
|
1041
|
+
const RadioGroup = useMenuFilterImpl()?.RadioGroup ?? MenuRadioGroupPlain;
|
|
1042
|
+
return /*#__PURE__*/ jsx(RadioGroup, {
|
|
1043
|
+
...props,
|
|
1044
|
+
ref: forwardedRef
|
|
1045
|
+
});
|
|
1046
|
+
}));
|
|
1047
|
+
MenuRadioGroup.displayName = "MenuRadioGroup";
|
|
1048
|
+
//#endregion
|
|
1049
|
+
//#region ../../node_modules/.pnpm/@base-ui+react@1.9.0_@date-fns+tz@1.4.1_@types+react@19.2.4_date-fns@4.1.0_react-dom@19.2.0_react@19.2.0__react@19.2.0/node_modules/@base-ui/react/menu/radio-item/MenuRadioItemContext.mjs
|
|
1050
|
+
const MenuRadioItemContext = /*#__PURE__*/ React$1.createContext(void 0);
|
|
1051
|
+
MenuRadioItemContext.displayName = "MenuRadioItemContext";
|
|
1052
|
+
function useMenuRadioItemContext() {
|
|
1053
|
+
const context = React$1.useContext(MenuRadioItemContext);
|
|
1054
|
+
if (context === void 0) throw new Error("Base UI: MenuRadioItemContext is missing. MenuRadioItem parts must be placed within <Menu.RadioItem>.");
|
|
1055
|
+
return context;
|
|
1056
|
+
}
|
|
1057
|
+
//#endregion
|
|
1058
|
+
//#region ../../node_modules/.pnpm/@base-ui+react@1.9.0_@date-fns+tz@1.4.1_@types+react@19.2.4_date-fns@4.1.0_react-dom@19.2.0_react@19.2.0__react@19.2.0/node_modules/@base-ui/react/menu/radio-item/MenuRadioItem.mjs
|
|
1059
|
+
const MenuRadioItemPlain = /*#__PURE__*/ React$1.forwardRef(function MenuRadioItemPlain(componentProps, forwardedRef) {
|
|
1060
|
+
const { render, className, id: idProp, label, nativeButton = false, disabled: disabledProp = false, closeOnClick = false, value, style, ...elementProps } = componentProps;
|
|
1061
|
+
const { store } = useMenuRootContext();
|
|
1062
|
+
const { value: selectedValue, setValue: setSelectedValue, disabled: groupDisabled } = useMenuRadioGroupContext();
|
|
1063
|
+
const listItem = useCompositeListItem({
|
|
1064
|
+
guess: true,
|
|
1065
|
+
label
|
|
1066
|
+
});
|
|
1067
|
+
const id = useBaseUiId(idProp);
|
|
1068
|
+
const highlighted = store.useState("isActive", listItem.index);
|
|
1069
|
+
const nodeId = store.useState("floatingNodeId");
|
|
1070
|
+
const itemProps = store.useState("itemProps");
|
|
1071
|
+
const rootDisabled = store.useState("disabled");
|
|
1072
|
+
const disabled = disabledProp || groupDisabled || rootDisabled;
|
|
1073
|
+
const checked = selectedValue === value;
|
|
1074
|
+
const { getItemProps, itemRef } = useMenuItem({
|
|
1075
|
+
closeOnClick,
|
|
1076
|
+
disabled,
|
|
1077
|
+
highlighted,
|
|
1078
|
+
id,
|
|
1079
|
+
store,
|
|
1080
|
+
nativeButton,
|
|
1081
|
+
nodeId,
|
|
1082
|
+
itemMetadata: REGULAR_ITEM
|
|
1083
|
+
});
|
|
1084
|
+
const state = React$1.useMemo(() => ({
|
|
1085
|
+
disabled,
|
|
1086
|
+
highlighted,
|
|
1087
|
+
checked
|
|
1088
|
+
}), [
|
|
1089
|
+
disabled,
|
|
1090
|
+
highlighted,
|
|
1091
|
+
checked
|
|
1092
|
+
]);
|
|
1093
|
+
function handleClick(event) {
|
|
1094
|
+
const details = createChangeEventDetails(itemPress, event.nativeEvent, void 0, { preventUnmountOnClose: NOOP });
|
|
1095
|
+
setSelectedValue(value, details);
|
|
1096
|
+
}
|
|
1097
|
+
const element = useRenderElement("div", componentProps, {
|
|
1098
|
+
state,
|
|
1099
|
+
stateAttributesMapping: itemMapping,
|
|
1100
|
+
props: [
|
|
1101
|
+
itemProps,
|
|
1102
|
+
{
|
|
1103
|
+
role: "menuitemradio",
|
|
1104
|
+
"aria-checked": checked,
|
|
1105
|
+
onClick: handleClick
|
|
1106
|
+
},
|
|
1107
|
+
elementProps,
|
|
1108
|
+
getItemProps
|
|
1109
|
+
],
|
|
1110
|
+
ref: [
|
|
1111
|
+
itemRef,
|
|
1112
|
+
forwardedRef,
|
|
1113
|
+
listItem.ref
|
|
1114
|
+
]
|
|
1115
|
+
});
|
|
1116
|
+
return /*#__PURE__*/ jsx(MenuRadioItemContext.Provider, {
|
|
1117
|
+
value: state,
|
|
1118
|
+
children: element
|
|
1119
|
+
});
|
|
1120
|
+
});
|
|
1121
|
+
MenuRadioItemPlain.displayName = "MenuRadioItemPlain";
|
|
1122
|
+
const MenuRadioItem = /*#__PURE__*/ React$1.forwardRef(function MenuRadioItem(props, forwardedRef) {
|
|
1123
|
+
const filterItem = useMenuFilterItem(props, forwardedRef);
|
|
1124
|
+
if (!filterItem.visible) return null;
|
|
1125
|
+
return /*#__PURE__*/ jsx(MenuRadioItemPlain, {
|
|
1126
|
+
...props,
|
|
1127
|
+
ref: filterItem.ref
|
|
1128
|
+
});
|
|
1129
|
+
});
|
|
1130
|
+
MenuRadioItem.displayName = "MenuRadioItem";
|
|
1131
|
+
//#endregion
|
|
1132
|
+
//#region ../../node_modules/.pnpm/@base-ui+react@1.9.0_@date-fns+tz@1.4.1_@types+react@19.2.4_date-fns@4.1.0_react-dom@19.2.0_react@19.2.0__react@19.2.0/node_modules/@base-ui/react/menu/radio-item-indicator/MenuRadioItemIndicator.mjs
|
|
1133
|
+
/**
|
|
1134
|
+
* Indicates whether the radio item is selected.
|
|
1135
|
+
* Renders a `<span>` element.
|
|
1136
|
+
*
|
|
1137
|
+
* Documentation: [Base UI Menu](https://base-ui.com/react/components/menu)
|
|
1138
|
+
*/
|
|
1139
|
+
const MenuRadioItemIndicator = /*#__PURE__*/ React$1.forwardRef(function MenuRadioItemIndicator(componentProps, forwardedRef) {
|
|
1140
|
+
const { render, className, style, keepMounted = false, ...elementProps } = componentProps;
|
|
1141
|
+
const item = useMenuRadioItemContext();
|
|
1142
|
+
const indicatorRef = React$1.useRef(null);
|
|
1143
|
+
const { transitionStatus, mounted, setMounted } = useTransitionStatus(item.checked);
|
|
1144
|
+
useOpenChangeComplete({
|
|
1145
|
+
batch: true,
|
|
1146
|
+
enabled: !item.checked,
|
|
1147
|
+
open: item.checked,
|
|
1148
|
+
ref: indicatorRef,
|
|
1149
|
+
onComplete() {
|
|
1150
|
+
if (!item.checked) setMounted(false);
|
|
1151
|
+
}
|
|
1152
|
+
});
|
|
1153
|
+
const state = {
|
|
1154
|
+
checked: item.checked,
|
|
1155
|
+
disabled: item.disabled,
|
|
1156
|
+
highlighted: item.highlighted,
|
|
1157
|
+
transitionStatus
|
|
1158
|
+
};
|
|
1159
|
+
return useRenderElement("span", componentProps, {
|
|
1160
|
+
state,
|
|
1161
|
+
stateAttributesMapping: itemMapping,
|
|
1162
|
+
ref: [forwardedRef, indicatorRef],
|
|
1163
|
+
props: {
|
|
1164
|
+
"aria-hidden": true,
|
|
1165
|
+
...elementProps
|
|
1166
|
+
},
|
|
1167
|
+
enabled: keepMounted || mounted
|
|
1168
|
+
});
|
|
1169
|
+
});
|
|
1170
|
+
MenuRadioItemIndicator.displayName = "MenuRadioItemIndicator";
|
|
1171
|
+
//#endregion
|
|
1172
|
+
//#region ../../node_modules/.pnpm/@base-ui+react@1.9.0_@date-fns+tz@1.4.1_@types+react@19.2.4_date-fns@4.1.0_react-dom@19.2.0_react@19.2.0__react@19.2.0/node_modules/@base-ui/react/menu/store/MenuStore.mjs
|
|
1173
|
+
const selectors = {
|
|
1174
|
+
...popupStoreSelectors,
|
|
1175
|
+
disabled: (state) => state.parent.type === "menubar" ? state.parent.context.disabled || state.disabled : state.disabled,
|
|
1176
|
+
modal: (state) => (state.parent.type === void 0 || state.parent.type === "context-menu") && (state.modal ?? true),
|
|
1177
|
+
openMethod: (state) => state.openMethod,
|
|
1178
|
+
keyboardOpen: (state) => state.keyboardOpen,
|
|
1179
|
+
allowMouseEnter: (state) => state.allowMouseEnter,
|
|
1180
|
+
highlightItemOnHover: (state) => state.highlightItemOnHover,
|
|
1181
|
+
parent: (state) => state.parent,
|
|
1182
|
+
rootId: (state) => {
|
|
1183
|
+
if (state.parent.type === "menu") return state.parent.store.select("rootId");
|
|
1184
|
+
return state.parent.type !== void 0 ? state.parent.context.rootId : state.rootId;
|
|
1185
|
+
},
|
|
1186
|
+
activeIndex: (state) => state.activeIndex,
|
|
1187
|
+
listElement: (state) => state.listElement,
|
|
1188
|
+
/** The trigger's `aria-controls`: the list when one holds the `menu` role, else the popup. */
|
|
1189
|
+
triggerControlsId: (state, triggerId) => {
|
|
1190
|
+
const popupId = popupStoreSelectors.triggerPopupId(state, triggerId);
|
|
1191
|
+
return popupId ? state.listElement?.id || popupId : void 0;
|
|
1192
|
+
},
|
|
1193
|
+
filterTriggerProps: (state) => state.filterTriggerProps,
|
|
1194
|
+
inputProps: (state) => state.inputProps,
|
|
1195
|
+
webkitAriaSelected: (state, highlighted) => webkit && state.inputFocused && highlighted ? true : void 0,
|
|
1196
|
+
highlightedItemId: (state) => state.highlightedItem?.id || void 0,
|
|
1197
|
+
isActive: (state, itemIndex) => state.activeIndex === itemIndex,
|
|
1198
|
+
hoverEnabled: (state) => state.hoverEnabled,
|
|
1199
|
+
instantType: (state) => state.instantType === "trigger-change" && !popupStoreSelectors.open(state) ? void 0 : state.instantType,
|
|
1200
|
+
lastOpenChangeReason: (state) => state.openChangeReason,
|
|
1201
|
+
floatingTreeRoot: (state) => {
|
|
1202
|
+
if (state.parent.type === "menu") return state.parent.store.select("floatingTreeRoot");
|
|
1203
|
+
return state.floatingTreeRoot;
|
|
1204
|
+
},
|
|
1205
|
+
floatingNodeId: (state) => state.floatingNodeId,
|
|
1206
|
+
floatingParentNodeId: (state) => state.floatingParentNodeId,
|
|
1207
|
+
itemProps: (state) => state.itemProps,
|
|
1208
|
+
closeDelay: (state) => state.closeDelay,
|
|
1209
|
+
adaptiveOrigin: (state) => state.adaptiveOrigin,
|
|
1210
|
+
keyboardEventRelay: (state) => {
|
|
1211
|
+
if (state.keyboardEventRelay) return state.keyboardEventRelay;
|
|
1212
|
+
if (state.parent.type === "menu") return state.parent.store.select("keyboardEventRelay");
|
|
1213
|
+
}
|
|
1214
|
+
};
|
|
1215
|
+
/**
|
|
1216
|
+
* The store view that detached handle-backed triggers read from. Both the real `MenuStore` and the
|
|
1217
|
+
* inert fallback store satisfy it, so a trigger can read from whichever store the handle currently
|
|
1218
|
+
* exposes. Narrowed to the members a trigger actually uses — the trigger-data members plus `setOpen`
|
|
1219
|
+
* (called by the focus guards) — so the exposed surface can't bypass the open-change pipeline; on
|
|
1220
|
+
* the detached fallback store every one of these mutations is a no-op.
|
|
1221
|
+
*/
|
|
1222
|
+
var MenuStore = class extends ReactStore {
|
|
1223
|
+
constructor(initialState, floatingId, nested = false) {
|
|
1224
|
+
const triggerElements = new PopupTriggerMap();
|
|
1225
|
+
const state = createInitialState(triggerElements, floatingId, nested, initialState);
|
|
1226
|
+
super(state, createInitialContext(triggerElements), selectors);
|
|
1227
|
+
this.observe("parent", (parent) => {
|
|
1228
|
+
if (parent.type === "menu") this.context.allowMouseUpTriggerRef = parent.store.context.allowMouseUpTriggerRef;
|
|
1229
|
+
else if (parent.type !== void 0) this.context.allowMouseUpTriggerRef = parent.context.allowMouseUpTriggerRef;
|
|
1230
|
+
});
|
|
1231
|
+
}
|
|
1232
|
+
/**
|
|
1233
|
+
* Propagates changes of the parent menu's shared tree state to this store's subscribers.
|
|
1234
|
+
* The owning `Menu.Root` calls it from an effect so the parent store subscription is released
|
|
1235
|
+
* when the submenu unmounts.
|
|
1236
|
+
* @returns A function that removes the parent store subscription.
|
|
1237
|
+
*/
|
|
1238
|
+
subscribeToParentMenu() {
|
|
1239
|
+
const parent = this.state.parent;
|
|
1240
|
+
if (parent.type !== "menu") return;
|
|
1241
|
+
let rootId = parent.store.select("rootId");
|
|
1242
|
+
let floatingTreeRoot = parent.store.select("floatingTreeRoot");
|
|
1243
|
+
let keyboardEventRelay = parent.store.select("keyboardEventRelay");
|
|
1244
|
+
return parent.store.subscribe(() => {
|
|
1245
|
+
const nextRootId = parent.store.select("rootId");
|
|
1246
|
+
const nextFloatingTreeRoot = parent.store.select("floatingTreeRoot");
|
|
1247
|
+
const nextKeyboardEventRelay = parent.store.select("keyboardEventRelay");
|
|
1248
|
+
if (rootId === nextRootId && floatingTreeRoot === nextFloatingTreeRoot && keyboardEventRelay === nextKeyboardEventRelay) return;
|
|
1249
|
+
rootId = nextRootId;
|
|
1250
|
+
floatingTreeRoot = nextFloatingTreeRoot;
|
|
1251
|
+
keyboardEventRelay = nextKeyboardEventRelay;
|
|
1252
|
+
this.notifyAll();
|
|
1253
|
+
});
|
|
1254
|
+
}
|
|
1255
|
+
setOpen(open, eventDetails) {
|
|
1256
|
+
this.state.floatingRootContext.context.events.emit("setOpen", {
|
|
1257
|
+
open,
|
|
1258
|
+
eventDetails
|
|
1259
|
+
});
|
|
1260
|
+
}
|
|
1261
|
+
setActiveIndex(activeIndex, reason, event) {
|
|
1262
|
+
if (this.state.activeIndex !== activeIndex) {
|
|
1263
|
+
const isWriteBack = (activeIndex === null ? void 0 : this.context.itemDomElements.current[activeIndex]) === this.context.reportedItem;
|
|
1264
|
+
this.context.highlightReason = isWriteBack ? "none" : reason;
|
|
1265
|
+
this.context.highlightEvent = isWriteBack ? void 0 : event;
|
|
1266
|
+
}
|
|
1267
|
+
this.set("activeIndex", activeIndex);
|
|
1268
|
+
}
|
|
1269
|
+
highlightItem(element, reason, event) {
|
|
1270
|
+
const index = this.context.itemDomElements.current.indexOf(element);
|
|
1271
|
+
if (index > -1) this.setActiveIndex(index, reason, event);
|
|
1272
|
+
}
|
|
1273
|
+
};
|
|
1274
|
+
/**
|
|
1275
|
+
* Creates the inert fallback store used by detached handle-backed triggers while no `Menu.Root` is
|
|
1276
|
+
* attached. It preserves a menu-specific trigger registry in context so detached triggers can
|
|
1277
|
+
* register before migrating to the live root store. `setOpen` is a no-op (matching the inert
|
|
1278
|
+
* reads/writes of `NullStore`), so a trigger can hand the store to focus-guard helpers that expect
|
|
1279
|
+
* `setOpen` without it ever taking effect while detached.
|
|
1280
|
+
*/
|
|
1281
|
+
function createNullMenuStore() {
|
|
1282
|
+
const triggerElements = new PopupTriggerMap();
|
|
1283
|
+
const store = new NullStore(Object.freeze(createInitialState(triggerElements)), Object.freeze(createInitialContext(triggerElements)), selectors);
|
|
1284
|
+
return Object.assign(store, { setOpen: NOOP });
|
|
1285
|
+
}
|
|
1286
|
+
function createInitialContext(triggerElements) {
|
|
1287
|
+
return {
|
|
1288
|
+
positionerRef: /*#__PURE__*/ React$1.createRef(),
|
|
1289
|
+
popupRef: /*#__PURE__*/ React$1.createRef(),
|
|
1290
|
+
typingRef: { current: false },
|
|
1291
|
+
itemDomElements: { current: [] },
|
|
1292
|
+
itemLabels: { current: [] },
|
|
1293
|
+
highlightReason: "none",
|
|
1294
|
+
highlightEvent: void 0,
|
|
1295
|
+
reportedItem: void 0,
|
|
1296
|
+
allowMouseUpTriggerRef: { current: false },
|
|
1297
|
+
virtualFocusRef: void 0,
|
|
1298
|
+
triggerFocusTargetRef: /*#__PURE__*/ React$1.createRef(),
|
|
1299
|
+
beforeTriggerFocusGuardRef: /*#__PURE__*/ React$1.createRef(),
|
|
1300
|
+
beforeContentFocusGuardRef: /*#__PURE__*/ React$1.createRef(),
|
|
1301
|
+
onOpenChangeComplete: void 0,
|
|
1302
|
+
triggerElements
|
|
1303
|
+
};
|
|
1304
|
+
}
|
|
1305
|
+
function createInitialState(triggerElements, floatingId, nested = false, initialState) {
|
|
1306
|
+
return {
|
|
1307
|
+
...createInitialPopupStoreState(triggerElements, floatingId, nested),
|
|
1308
|
+
disabled: false,
|
|
1309
|
+
modal: true,
|
|
1310
|
+
openMethod: null,
|
|
1311
|
+
keyboardOpen: false,
|
|
1312
|
+
allowMouseEnter: false,
|
|
1313
|
+
highlightItemOnHover: true,
|
|
1314
|
+
parent: { type: void 0 },
|
|
1315
|
+
rootId: void 0,
|
|
1316
|
+
activeIndex: null,
|
|
1317
|
+
listElement: null,
|
|
1318
|
+
filterTriggerProps: EMPTY_OBJECT,
|
|
1319
|
+
inputProps: EMPTY_OBJECT,
|
|
1320
|
+
inputFocused: false,
|
|
1321
|
+
highlightedItem: void 0,
|
|
1322
|
+
hoverEnabled: true,
|
|
1323
|
+
instantType: void 0,
|
|
1324
|
+
openChangeReason: null,
|
|
1325
|
+
floatingTreeRoot: new FloatingTreeStore(),
|
|
1326
|
+
floatingNodeId: void 0,
|
|
1327
|
+
floatingParentNodeId: null,
|
|
1328
|
+
itemProps: EMPTY_OBJECT,
|
|
1329
|
+
keyboardEventRelay: void 0,
|
|
1330
|
+
closeDelay: 0,
|
|
1331
|
+
adaptiveOrigin: void 0,
|
|
1332
|
+
...initialState
|
|
1333
|
+
};
|
|
1334
|
+
}
|
|
1335
|
+
//#endregion
|
|
1336
|
+
//#region ../../node_modules/.pnpm/@base-ui+react@1.9.0_@date-fns+tz@1.4.1_@types+react@19.2.4_date-fns@4.1.0_react-dom@19.2.0_react@19.2.0__react@19.2.0/node_modules/@base-ui/react/menu/filter-provider/MenuFilterProviderContext.mjs
|
|
1337
|
+
/**
|
|
1338
|
+
* What `Menu.FilterProvider` hands to the root directly inside it: the filterable root
|
|
1339
|
+
* implementations (the provider is their only importer) and the filter props.
|
|
1340
|
+
*/
|
|
1341
|
+
/**
|
|
1342
|
+
* Non-null only directly below a provider. The root that consumes it resets it, so a plain
|
|
1343
|
+
* `Menu.SubmenuRoot` inside a filterable menu stays plain.
|
|
1344
|
+
*/
|
|
1345
|
+
const MenuFilterProviderContext = /*#__PURE__*/ React$1.createContext(null);
|
|
1346
|
+
MenuFilterProviderContext.displayName = "MenuFilterProviderContext";
|
|
1347
|
+
//#endregion
|
|
1348
|
+
//#region ../../node_modules/.pnpm/@base-ui+react@1.9.0_@date-fns+tz@1.4.1_@types+react@19.2.4_date-fns@4.1.0_react-dom@19.2.0_react@19.2.0__react@19.2.0/node_modules/@base-ui/react/menu/utils/isKeyboardOpen.mjs
|
|
1349
|
+
/**
|
|
1350
|
+
* Keyboard and assistive-technology activations produce `detail === 0` clicks; mouse-gesture
|
|
1351
|
+
* clicks (including the synthesized drag-release click from `useMenuItemCommonProps`) carry
|
|
1352
|
+
* `detail >= 1`.
|
|
1353
|
+
*/
|
|
1354
|
+
function isKeyboardClick(reason, event) {
|
|
1355
|
+
return (reason === "trigger-press" || reason === "item-press") && event?.detail === 0;
|
|
1356
|
+
}
|
|
1357
|
+
/**
|
|
1358
|
+
* Whether a menu opens from the keyboard, which lands focus in the popup. Arrow keys report
|
|
1359
|
+
* `list-navigation`; Enter and Space dispatch a click carrying no pointer detail.
|
|
1360
|
+
*/
|
|
1361
|
+
function isKeyboardOpen(reason, event) {
|
|
1362
|
+
return reason === "list-navigation" || isKeyboardClick(reason, event);
|
|
1363
|
+
}
|
|
1364
|
+
//#endregion
|
|
1365
|
+
//#region ../../node_modules/.pnpm/@base-ui+react@1.9.0_@date-fns+tz@1.4.1_@types+react@19.2.4_date-fns@4.1.0_react-dom@19.2.0_react@19.2.0__react@19.2.0/node_modules/@base-ui/react/menu/root/MenuRoot.mjs
|
|
1366
|
+
/**
|
|
1367
|
+
* @internal
|
|
1368
|
+
*/
|
|
1369
|
+
const MenuRootInternal = fastComponent(function MenuRootInternal(props) {
|
|
1370
|
+
const { children, open: openProp, onOpenChange, onOpenChangeComplete, onItemHighlighted: onItemHighlightedProp, defaultOpen = false, disabled: disabledProp = false, modal: modalProp, loopFocus = true, orientation = "vertical", actionsRef, closeParentOnEsc = false, handle, triggerId: triggerIdProp, defaultTriggerId: defaultTriggerIdProp = null, highlightItemOnHover = true, isSubmenu = false, virtualFocus = false, virtualFocusRef, allowEscape = true, resetOnPointerLeave = true } = props;
|
|
1371
|
+
const contextMenuContext = useContextMenuRootContext(true);
|
|
1372
|
+
const parentMenuRootContext = useMenuRootContext(true);
|
|
1373
|
+
const menubarContext = useMenubarContext(true);
|
|
1374
|
+
const enclosingMenuStore = parentMenuRootContext?.store;
|
|
1375
|
+
const parentVirtualFocus = parentMenuRootContext?.virtualFocus ?? false;
|
|
1376
|
+
const parentFromContext = React$1.useMemo(() => {
|
|
1377
|
+
if (isSubmenu && enclosingMenuStore) return {
|
|
1378
|
+
type: "menu",
|
|
1379
|
+
store: enclosingMenuStore
|
|
1380
|
+
};
|
|
1381
|
+
if (menubarContext) return {
|
|
1382
|
+
type: "menubar",
|
|
1383
|
+
context: menubarContext
|
|
1384
|
+
};
|
|
1385
|
+
if (contextMenuContext && !enclosingMenuStore) return {
|
|
1386
|
+
type: "context-menu",
|
|
1387
|
+
context: contextMenuContext
|
|
1388
|
+
};
|
|
1389
|
+
return { type: void 0 };
|
|
1390
|
+
}, [
|
|
1391
|
+
contextMenuContext,
|
|
1392
|
+
enclosingMenuStore,
|
|
1393
|
+
menubarContext,
|
|
1394
|
+
isSubmenu
|
|
1395
|
+
]);
|
|
1396
|
+
const rootId = useBaseUiId();
|
|
1397
|
+
const defaultFloatingId = useBaseUiId();
|
|
1398
|
+
const [renderedFloatingId, setRenderedFloatingId] = React$1.useState(void 0);
|
|
1399
|
+
const floatingId = (renderedFloatingId ?? defaultFloatingId) || void 0;
|
|
1400
|
+
const floatingParentNodeIdFromContext = useFloatingParentNodeId();
|
|
1401
|
+
const parentMenuStore = parentFromContext.type === "menu" ? parentFromContext.store : void 0;
|
|
1402
|
+
const animateInitialOpen = (openProp ?? defaultOpen) && parentMenuStore?.state.transitionStatus === "starting";
|
|
1403
|
+
const seededInstantType = useRefWithInit(() => animateInitialOpen ? parentMenuStore?.state.instantType : void 0).current;
|
|
1404
|
+
const store = useRefWithInit(() => {
|
|
1405
|
+
const menuStore = new MenuStore({
|
|
1406
|
+
open: defaultOpen,
|
|
1407
|
+
openProp,
|
|
1408
|
+
activeTriggerId: defaultTriggerIdProp,
|
|
1409
|
+
triggerIdProp,
|
|
1410
|
+
parent: parentFromContext,
|
|
1411
|
+
disabled: disabledProp,
|
|
1412
|
+
highlightItemOnHover,
|
|
1413
|
+
modal: parentFromContext.type === void 0 ? modalProp : void 0,
|
|
1414
|
+
rootId,
|
|
1415
|
+
instantType: seededInstantType
|
|
1416
|
+
}, floatingId, floatingParentNodeIdFromContext != null);
|
|
1417
|
+
menuStore.context.virtualFocusRef = virtualFocusRef;
|
|
1418
|
+
return menuStore;
|
|
1419
|
+
}).current;
|
|
1420
|
+
store.useControlledProp("openProp", openProp);
|
|
1421
|
+
store.useControlledProp("triggerIdProp", triggerIdProp);
|
|
1422
|
+
store.useContextCallback("onOpenChangeComplete", onOpenChangeComplete);
|
|
1423
|
+
const floatingTreeRoot = store.useState("floatingTreeRoot");
|
|
1424
|
+
const floatingNodeIdFromContext = useFloatingNodeId(floatingTreeRoot);
|
|
1425
|
+
const open = store.useState("open");
|
|
1426
|
+
const activeTriggerElement = store.useState("activeTriggerElement");
|
|
1427
|
+
const positionerElement = store.useState("positionerElement");
|
|
1428
|
+
const hoverEnabled = store.useState("hoverEnabled");
|
|
1429
|
+
const disabled = store.useState("disabled");
|
|
1430
|
+
const lastOpenChangeReason = store.useState("lastOpenChangeReason");
|
|
1431
|
+
const parent = store.useState("parent");
|
|
1432
|
+
const activeIndex = store.useState("activeIndex");
|
|
1433
|
+
const keyboardOpen = store.useState("keyboardOpen");
|
|
1434
|
+
const payload = store.useState("payload");
|
|
1435
|
+
const floatingParentNodeId = store.useState("floatingParentNodeId");
|
|
1436
|
+
const openEventRef = React$1.useRef(null);
|
|
1437
|
+
const allowOutsidePressDismissalRef = React$1.useRef(parent.type !== "context-menu");
|
|
1438
|
+
const allowOutsidePressDismissalTimeout = useTimeout();
|
|
1439
|
+
const allowTouchToCloseRef = React$1.useRef(true);
|
|
1440
|
+
const allowTouchToCloseTimeout = useTimeout();
|
|
1441
|
+
const nested = floatingParentNodeId != null;
|
|
1442
|
+
if (parent.type !== void 0 && modalProp !== void 0) console.warn("Base UI: The `modal` prop is not supported on nested menus. It will be ignored.");
|
|
1443
|
+
const { openMethod, triggerProps: interactionTypeProps } = useOpenInteractionType(open);
|
|
1444
|
+
store.useSyncedValues({
|
|
1445
|
+
disabled: disabledProp,
|
|
1446
|
+
highlightItemOnHover,
|
|
1447
|
+
modal: parent.type === void 0 ? modalProp : void 0,
|
|
1448
|
+
openMethod,
|
|
1449
|
+
rootId
|
|
1450
|
+
});
|
|
1451
|
+
useImplicitActiveTrigger(store);
|
|
1452
|
+
const { forceUnmount, transitionStatus } = useOpenStateTransitions(open, store, () => {
|
|
1453
|
+
store.set("allowMouseEnter", false);
|
|
1454
|
+
}, animateInitialOpen);
|
|
1455
|
+
const runOnceAnimationsFinish = useAnimationsFinished(store.context.popupRef);
|
|
1456
|
+
React$1.useEffect(() => {
|
|
1457
|
+
if (seededInstantType === void 0) return;
|
|
1458
|
+
const clearSeededInstantType = () => {
|
|
1459
|
+
if (store.state.instantType === seededInstantType) store.set("instantType", void 0);
|
|
1460
|
+
};
|
|
1461
|
+
if (!open) {
|
|
1462
|
+
clearSeededInstantType();
|
|
1463
|
+
return;
|
|
1464
|
+
}
|
|
1465
|
+
if (transitionStatus !== void 0) return;
|
|
1466
|
+
if (store.context.popupRef.current == null) {
|
|
1467
|
+
clearSeededInstantType();
|
|
1468
|
+
return;
|
|
1469
|
+
}
|
|
1470
|
+
const abortController = new AbortController();
|
|
1471
|
+
runOnceAnimationsFinish(clearSeededInstantType, abortController.signal);
|
|
1472
|
+
return () => {
|
|
1473
|
+
abortController.abort();
|
|
1474
|
+
};
|
|
1475
|
+
}, [
|
|
1476
|
+
seededInstantType,
|
|
1477
|
+
open,
|
|
1478
|
+
transitionStatus,
|
|
1479
|
+
runOnceAnimationsFinish,
|
|
1480
|
+
store
|
|
1481
|
+
]);
|
|
1482
|
+
useIsoLayoutEffect(() => {
|
|
1483
|
+
if (contextMenuContext && !parentMenuRootContext) store.update({
|
|
1484
|
+
parent: {
|
|
1485
|
+
type: "context-menu",
|
|
1486
|
+
context: contextMenuContext
|
|
1487
|
+
},
|
|
1488
|
+
floatingNodeId: floatingNodeIdFromContext,
|
|
1489
|
+
floatingParentNodeId: floatingParentNodeIdFromContext
|
|
1490
|
+
});
|
|
1491
|
+
else if (parentMenuRootContext || !store.select("activeTriggerElement")) store.update({
|
|
1492
|
+
floatingNodeId: floatingNodeIdFromContext,
|
|
1493
|
+
floatingParentNodeId: floatingParentNodeIdFromContext
|
|
1494
|
+
});
|
|
1495
|
+
}, [
|
|
1496
|
+
contextMenuContext,
|
|
1497
|
+
parentMenuRootContext,
|
|
1498
|
+
floatingNodeIdFromContext,
|
|
1499
|
+
floatingParentNodeIdFromContext,
|
|
1500
|
+
activeTriggerElement,
|
|
1501
|
+
store
|
|
1502
|
+
]);
|
|
1503
|
+
React$1.useEffect(() => {
|
|
1504
|
+
if (!open) openEventRef.current = null;
|
|
1505
|
+
if (parent.type !== "context-menu") return;
|
|
1506
|
+
if (!open) {
|
|
1507
|
+
allowOutsidePressDismissalTimeout.clear();
|
|
1508
|
+
allowOutsidePressDismissalRef.current = false;
|
|
1509
|
+
return;
|
|
1510
|
+
}
|
|
1511
|
+
allowOutsidePressDismissalTimeout.start(500, () => {
|
|
1512
|
+
allowOutsidePressDismissalRef.current = true;
|
|
1513
|
+
});
|
|
1514
|
+
}, [
|
|
1515
|
+
allowOutsidePressDismissalTimeout,
|
|
1516
|
+
open,
|
|
1517
|
+
parent.type
|
|
1518
|
+
]);
|
|
1519
|
+
useIsoLayoutEffect(() => {
|
|
1520
|
+
if (!open && !hoverEnabled) store.set("hoverEnabled", true);
|
|
1521
|
+
}, [
|
|
1522
|
+
open,
|
|
1523
|
+
hoverEnabled,
|
|
1524
|
+
store
|
|
1525
|
+
]);
|
|
1526
|
+
const setOpen = useStableCallback((nextOpen, eventDetails) => {
|
|
1527
|
+
const reason = eventDetails.reason;
|
|
1528
|
+
if (!nextOpen && !store.select("open")) return;
|
|
1529
|
+
if (open === nextOpen && eventDetails.trigger === activeTriggerElement && lastOpenChangeReason === reason) return;
|
|
1530
|
+
const shouldPreventUnmountOnClose = attachPreventUnmountOnClose(eventDetails);
|
|
1531
|
+
if (!nextOpen && eventDetails.trigger == null) eventDetails.trigger = activeTriggerElement ?? void 0;
|
|
1532
|
+
onOpenChange?.(nextOpen, eventDetails);
|
|
1533
|
+
if (eventDetails.isCanceled) return;
|
|
1534
|
+
store.state.floatingRootContext.dispatchOpenChange(nextOpen, eventDetails);
|
|
1535
|
+
const nativeEvent = eventDetails.event;
|
|
1536
|
+
if (nextOpen === false && reason !== "item-press" && nativeEvent?.type === "click" && nativeEvent.pointerType === "touch" && !allowTouchToCloseRef.current) return;
|
|
1537
|
+
if (nextOpen && reason === "trigger-focus") {
|
|
1538
|
+
allowTouchToCloseRef.current = false;
|
|
1539
|
+
allowTouchToCloseTimeout.start(300, () => {
|
|
1540
|
+
allowTouchToCloseRef.current = true;
|
|
1541
|
+
});
|
|
1542
|
+
} else {
|
|
1543
|
+
allowTouchToCloseRef.current = true;
|
|
1544
|
+
allowTouchToCloseTimeout.clear();
|
|
1545
|
+
}
|
|
1546
|
+
const isDismissClose = !nextOpen && (reason === "escape-key" || reason == null);
|
|
1547
|
+
openEventRef.current = eventDetails.event;
|
|
1548
|
+
const popupOpenState = createPopupOpenState(store.state, nextOpen, eventDetails.trigger, shouldPreventUnmountOnClose());
|
|
1549
|
+
popupOpenState.openChangeReason = reason;
|
|
1550
|
+
popupOpenState.keyboardOpen = nextOpen && isKeyboardOpen(reason, nativeEvent);
|
|
1551
|
+
if (parent.type === "menubar" && (reason === "trigger-focus" || reason === "focus-out" || reason === "trigger-hover" || reason === "list-navigation" || reason === "sibling-open")) popupOpenState.instantType = "group";
|
|
1552
|
+
else if (isKeyboardClick(reason, nativeEvent)) popupOpenState.instantType = "click";
|
|
1553
|
+
else if (isDismissClose) popupOpenState.instantType = "dismiss";
|
|
1554
|
+
else popupOpenState.instantType = void 0;
|
|
1555
|
+
store.update(popupOpenState);
|
|
1556
|
+
});
|
|
1557
|
+
const floatingRootContext = useSyncedFloatingRootContext({
|
|
1558
|
+
popupStore: store,
|
|
1559
|
+
floatingRootContext: store.state.floatingRootContext,
|
|
1560
|
+
floatingId,
|
|
1561
|
+
nested: floatingParentNodeIdFromContext != null,
|
|
1562
|
+
onOpenChange: setOpen
|
|
1563
|
+
});
|
|
1564
|
+
const floatingEvents = floatingRootContext.context.events;
|
|
1565
|
+
useIsoLayoutEffect(() => {
|
|
1566
|
+
const handleSetOpenEvent = ({ open: nextOpen, eventDetails }) => setOpen(nextOpen, eventDetails);
|
|
1567
|
+
floatingEvents.on("setOpen", handleSetOpenEvent);
|
|
1568
|
+
return () => {
|
|
1569
|
+
floatingEvents?.off("setOpen", handleSetOpenEvent);
|
|
1570
|
+
};
|
|
1571
|
+
}, [floatingEvents, setOpen]);
|
|
1572
|
+
useIsoLayoutEffect(() => store.subscribeToParentMenu(), [store]);
|
|
1573
|
+
const handleImperativeClose = React$1.useCallback(() => {
|
|
1574
|
+
store.setOpen(false, createChangeEventDetails(imperativeAction));
|
|
1575
|
+
}, [store]);
|
|
1576
|
+
React$1.useImperativeHandle(actionsRef, () => ({
|
|
1577
|
+
unmount: forceUnmount,
|
|
1578
|
+
close: handleImperativeClose
|
|
1579
|
+
}), [forceUnmount, handleImperativeClose]);
|
|
1580
|
+
let ctx;
|
|
1581
|
+
if (parent.type === "context-menu") ctx = parent.context;
|
|
1582
|
+
React$1.useImperativeHandle(ctx?.positionerRef, () => positionerElement, [positionerElement]);
|
|
1583
|
+
React$1.useImperativeHandle(ctx?.actionsRef, () => ({ setOpen }), [setOpen]);
|
|
1584
|
+
const dismiss = useDismiss(floatingRootContext, {
|
|
1585
|
+
enabled: !disabled,
|
|
1586
|
+
bubbles: { escapeKey: closeParentOnEsc && parent.type === "menu" },
|
|
1587
|
+
outsidePress() {
|
|
1588
|
+
if (parent.type !== "context-menu" || openEventRef.current?.type === "contextmenu") return true;
|
|
1589
|
+
return allowOutsidePressDismissalRef.current;
|
|
1590
|
+
},
|
|
1591
|
+
externalTree: nested ? floatingTreeRoot : void 0
|
|
1592
|
+
});
|
|
1593
|
+
const direction = useDirection();
|
|
1594
|
+
const listNavigation$1 = useListNavigation(floatingRootContext, {
|
|
1595
|
+
enabled: !disabled,
|
|
1596
|
+
listRef: store.context.itemDomElements,
|
|
1597
|
+
activeIndex,
|
|
1598
|
+
virtual: virtualFocus,
|
|
1599
|
+
nested: parent.type === "menubar" || !virtualFocus && parent.type !== void 0,
|
|
1600
|
+
parentOrientation: parent.type === "menubar" ? parent.context.orientation : void 0,
|
|
1601
|
+
loopFocus,
|
|
1602
|
+
focusItemOnOpen: virtualFocus ? keyboardOpen : void 0,
|
|
1603
|
+
allowEscape: virtualFocus && loopFocus && allowEscape,
|
|
1604
|
+
orientation,
|
|
1605
|
+
triggerOrientation: virtualFocus ? "vertical" : orientation,
|
|
1606
|
+
rtl: direction === "rtl",
|
|
1607
|
+
disabledIndices: EMPTY_ARRAY,
|
|
1608
|
+
onNavigate(nextActiveIndex, event) {
|
|
1609
|
+
store.setActiveIndex(nextActiveIndex, getHighlightReason(event), event?.nativeEvent);
|
|
1610
|
+
},
|
|
1611
|
+
openOnArrowKeyDown: parent.type !== "context-menu" && !(virtualFocus && isSubmenu),
|
|
1612
|
+
externalTree: !virtualFocus && nested ? floatingTreeRoot : void 0,
|
|
1613
|
+
nestedReturnFocusRef: parentMenuStore?.context.virtualFocusRef,
|
|
1614
|
+
focusItemOnHover: highlightItemOnHover,
|
|
1615
|
+
resetOnPointerLeave
|
|
1616
|
+
});
|
|
1617
|
+
const onTyping = React$1.useCallback((nextTyping) => {
|
|
1618
|
+
store.context.typingRef.current = nextTyping;
|
|
1619
|
+
}, [store]);
|
|
1620
|
+
const typeahead = useTypeahead(floatingRootContext, {
|
|
1621
|
+
enabled: !disabled && !virtualFocus,
|
|
1622
|
+
listRef: store.context.itemLabels,
|
|
1623
|
+
elementsRef: store.context.itemDomElements,
|
|
1624
|
+
activeIndex,
|
|
1625
|
+
resetMs: 500,
|
|
1626
|
+
onMatch: (index, event) => {
|
|
1627
|
+
if (open && index !== activeIndex) store.setActiveIndex(index, keyboard, event.nativeEvent);
|
|
1628
|
+
},
|
|
1629
|
+
onTyping
|
|
1630
|
+
});
|
|
1631
|
+
const onItemHighlighted = useStableCallback(onItemHighlightedProp);
|
|
1632
|
+
const lastHighlightIndexRef = React$1.useRef(-1);
|
|
1633
|
+
const syncHighlightedItem = useStableCallback(() => {
|
|
1634
|
+
const index = store.state.activeIndex;
|
|
1635
|
+
const item = index === null ? void 0 : store.context.itemDomElements.current[index] ?? void 0;
|
|
1636
|
+
if (item?.isConnected === false) return;
|
|
1637
|
+
const itemIndex = item === void 0 ? -1 : index;
|
|
1638
|
+
if (lastHighlightIndexRef.current === itemIndex && store.context.reportedItem === item) return;
|
|
1639
|
+
lastHighlightIndexRef.current = itemIndex;
|
|
1640
|
+
store.context.reportedItem = item;
|
|
1641
|
+
if (virtualFocus) store.set("highlightedItem", item);
|
|
1642
|
+
const { highlightReason, highlightEvent } = store.context;
|
|
1643
|
+
store.context.highlightReason = none;
|
|
1644
|
+
store.context.highlightEvent = void 0;
|
|
1645
|
+
if (!onItemHighlightedProp) return;
|
|
1646
|
+
onItemHighlighted(item, createGenericEventDetails(highlightReason, highlightEvent, { label: item === void 0 ? void 0 : store.context.itemLabels.current[itemIndex] ?? void 0 }));
|
|
1647
|
+
});
|
|
1648
|
+
useIsoLayoutEffect(() => {
|
|
1649
|
+
syncHighlightedItem();
|
|
1650
|
+
}, [activeIndex, syncHighlightedItem]);
|
|
1651
|
+
const openTriggerProps = React$1.useMemo(() => {
|
|
1652
|
+
if (!virtualFocus) return listNavigation$1.reference;
|
|
1653
|
+
if (!listNavigation$1.trigger) return EMPTY_OBJECT;
|
|
1654
|
+
const { onFocus, ...rest } = listNavigation$1.trigger;
|
|
1655
|
+
return rest;
|
|
1656
|
+
}, [
|
|
1657
|
+
virtualFocus,
|
|
1658
|
+
listNavigation$1.reference,
|
|
1659
|
+
listNavigation$1.trigger
|
|
1660
|
+
]);
|
|
1661
|
+
store.useSyncedValue("inputProps", virtualFocus ? listNavigation$1.reference ?? EMPTY_OBJECT : EMPTY_OBJECT);
|
|
1662
|
+
const activeTriggerProps = React$1.useMemo(() => {
|
|
1663
|
+
const mergedProps = mergeProps(typeahead.reference, openTriggerProps, dismiss.reference, { onMouseMove() {
|
|
1664
|
+
store.set("allowMouseEnter", true);
|
|
1665
|
+
} }, interactionTypeProps);
|
|
1666
|
+
mergedProps["aria-haspopup"] = "menu";
|
|
1667
|
+
mergedProps["aria-expanded"] = open;
|
|
1668
|
+
return mergedProps;
|
|
1669
|
+
}, [
|
|
1670
|
+
store,
|
|
1671
|
+
typeahead.reference,
|
|
1672
|
+
openTriggerProps,
|
|
1673
|
+
dismiss.reference,
|
|
1674
|
+
interactionTypeProps,
|
|
1675
|
+
open
|
|
1676
|
+
]);
|
|
1677
|
+
const inactiveTriggerProps = React$1.useMemo(() => {
|
|
1678
|
+
const mergedProps = mergeProps(listNavigation$1.trigger, dismiss.trigger, interactionTypeProps);
|
|
1679
|
+
mergedProps["aria-haspopup"] = "menu";
|
|
1680
|
+
mergedProps["aria-expanded"] = false;
|
|
1681
|
+
return mergedProps;
|
|
1682
|
+
}, [
|
|
1683
|
+
listNavigation$1.trigger,
|
|
1684
|
+
dismiss.trigger,
|
|
1685
|
+
interactionTypeProps
|
|
1686
|
+
]);
|
|
1687
|
+
useRefWithInit(() => {
|
|
1688
|
+
store.update({ inactiveTriggerProps });
|
|
1689
|
+
return null;
|
|
1690
|
+
});
|
|
1691
|
+
const popupProps = React$1.useMemo(() => mergeProps(FOCUSABLE_POPUP_PROPS, {
|
|
1692
|
+
onMouseMove() {
|
|
1693
|
+
store.set("allowMouseEnter", true);
|
|
1694
|
+
if (parent.type === "menu") store.set("hoverEnabled", false);
|
|
1695
|
+
},
|
|
1696
|
+
onClick() {
|
|
1697
|
+
if (store.select("hoverEnabled")) store.set("hoverEnabled", false);
|
|
1698
|
+
},
|
|
1699
|
+
onKeyDown(event) {
|
|
1700
|
+
const relay = store.select("keyboardEventRelay");
|
|
1701
|
+
if (relay && !event.isPropagationStopped()) relay(event);
|
|
1702
|
+
}
|
|
1703
|
+
}, typeahead.floating, listNavigation$1.floating, dismiss.floating), [
|
|
1704
|
+
parent.type,
|
|
1705
|
+
store,
|
|
1706
|
+
typeahead.floating,
|
|
1707
|
+
listNavigation$1.floating,
|
|
1708
|
+
dismiss.floating
|
|
1709
|
+
]);
|
|
1710
|
+
const itemProps = listNavigation$1.item ?? EMPTY_OBJECT;
|
|
1711
|
+
usePopupInteractionProps(store, {
|
|
1712
|
+
floatingRootContext,
|
|
1713
|
+
activeTriggerProps,
|
|
1714
|
+
inactiveTriggerProps,
|
|
1715
|
+
popupProps,
|
|
1716
|
+
itemProps
|
|
1717
|
+
});
|
|
1718
|
+
const context = React$1.useMemo(() => ({
|
|
1719
|
+
store,
|
|
1720
|
+
parent: parentFromContext,
|
|
1721
|
+
orientation,
|
|
1722
|
+
loopFocus,
|
|
1723
|
+
allowEscape,
|
|
1724
|
+
defaultFloatingId,
|
|
1725
|
+
setRenderedFloatingId,
|
|
1726
|
+
virtualFocus,
|
|
1727
|
+
parentVirtualFocus,
|
|
1728
|
+
syncHighlightedItem
|
|
1729
|
+
}), [
|
|
1730
|
+
store,
|
|
1731
|
+
parentFromContext,
|
|
1732
|
+
orientation,
|
|
1733
|
+
loopFocus,
|
|
1734
|
+
allowEscape,
|
|
1735
|
+
defaultFloatingId,
|
|
1736
|
+
virtualFocus,
|
|
1737
|
+
parentVirtualFocus,
|
|
1738
|
+
syncHighlightedItem
|
|
1739
|
+
]);
|
|
1740
|
+
const renderedChildren = typeof children === "function" ? children({ payload }) : children;
|
|
1741
|
+
let content = /*#__PURE__*/ jsxs(MenuRootContext.Provider, {
|
|
1742
|
+
value: context,
|
|
1743
|
+
children: [handle && /*#__PURE__*/ jsx(PopupHandleAttachment, {
|
|
1744
|
+
handle,
|
|
1745
|
+
store
|
|
1746
|
+
}), renderedChildren]
|
|
1747
|
+
});
|
|
1748
|
+
if (parent.type === void 0 || parent.type === "context-menu") content = /*#__PURE__*/ jsx(FloatingTree, {
|
|
1749
|
+
externalTree: floatingTreeRoot,
|
|
1750
|
+
children: content
|
|
1751
|
+
});
|
|
1752
|
+
return content;
|
|
1753
|
+
});
|
|
1754
|
+
MenuRootInternal.displayName = "MenuRootInternal";
|
|
1755
|
+
function MenuRoot(props) {
|
|
1756
|
+
const filterProvider = React$1.useContext(MenuFilterProviderContext);
|
|
1757
|
+
if (filterProvider === null) return /*#__PURE__*/ jsx(MenuRootInternal, { ...props });
|
|
1758
|
+
const FilterRoot = filterProvider.Root;
|
|
1759
|
+
return /*#__PURE__*/ jsx(MenuFilterProviderContext.Provider, {
|
|
1760
|
+
value: null,
|
|
1761
|
+
children: /*#__PURE__*/ jsx(FilterRoot, {
|
|
1762
|
+
...filterProvider.options,
|
|
1763
|
+
...props
|
|
1764
|
+
})
|
|
1765
|
+
});
|
|
1766
|
+
}
|
|
1767
|
+
//#endregion
|
|
1768
|
+
//#region ../../node_modules/.pnpm/@base-ui+react@1.9.0_@date-fns+tz@1.4.1_@types+react@19.2.4_date-fns@4.1.0_react-dom@19.2.0_react@19.2.0__react@19.2.0/node_modules/@base-ui/react/menu/submenu-root/MenuSubmenuRoot.mjs
|
|
1769
|
+
const EMPTY_SUBMENU_ROOT_CONTEXT = {};
|
|
1770
|
+
/**
|
|
1771
|
+
* Groups all parts of a submenu.
|
|
1772
|
+
* Doesn't render its own HTML element.
|
|
1773
|
+
*
|
|
1774
|
+
* Documentation: [Base UI Menu](https://base-ui.com/react/components/menu)
|
|
1775
|
+
*/
|
|
1776
|
+
function MenuSubmenuRoot(props) {
|
|
1777
|
+
useMenuRootContext();
|
|
1778
|
+
const filterProvider = React$1.useContext(MenuFilterProviderContext);
|
|
1779
|
+
if (filterProvider !== null) {
|
|
1780
|
+
const FilterSubmenuRoot = filterProvider.SubmenuRoot;
|
|
1781
|
+
return /*#__PURE__*/ jsx(MenuFilterProviderContext.Provider, {
|
|
1782
|
+
value: null,
|
|
1783
|
+
children: /*#__PURE__*/ jsx(FilterSubmenuRoot, {
|
|
1784
|
+
...filterProvider.options,
|
|
1785
|
+
...props
|
|
1786
|
+
})
|
|
1787
|
+
});
|
|
1788
|
+
}
|
|
1789
|
+
return /*#__PURE__*/ jsx(MenuSubmenuRootContext.Provider, {
|
|
1790
|
+
value: EMPTY_SUBMENU_ROOT_CONTEXT,
|
|
1791
|
+
children: /*#__PURE__*/ jsx(MenuRootInternal, {
|
|
1792
|
+
...props,
|
|
1793
|
+
isSubmenu: true
|
|
1794
|
+
})
|
|
1795
|
+
});
|
|
1796
|
+
}
|
|
1797
|
+
//#endregion
|
|
1798
|
+
//#region ../../node_modules/.pnpm/@base-ui+react@1.9.0_@date-fns+tz@1.4.1_@types+react@19.2.4_date-fns@4.1.0_react-dom@19.2.0_react@19.2.0__react@19.2.0/node_modules/@base-ui/react/menu/utils/findRootOwnerId.mjs
|
|
1799
|
+
function findRootOwnerId(node) {
|
|
1800
|
+
if (isHTMLElement(node) && node.hasAttribute("data-rootownerid")) return node.getAttribute("data-rootownerid");
|
|
1801
|
+
if (isLastTraversableNode(node)) return;
|
|
1802
|
+
return findRootOwnerId(getParentNode(node));
|
|
1803
|
+
}
|
|
1804
|
+
//#endregion
|
|
1805
|
+
//#region ../../node_modules/.pnpm/@base-ui+react@1.9.0_@date-fns+tz@1.4.1_@types+react@19.2.4_date-fns@4.1.0_react-dom@19.2.0_react@19.2.0__react@19.2.0/node_modules/@base-ui/react/menu/submenu-trigger/MenuSubmenuTrigger.mjs
|
|
1806
|
+
const VOICE_OVER_EXPANDED_PROPS = { "aria-expanded": void 0 };
|
|
1807
|
+
const MenuSubmenuTriggerPlain = /*#__PURE__*/ React$1.forwardRef(function MenuSubmenuTriggerPlain(componentProps, forwardedRef) {
|
|
1808
|
+
const { render, className, style, label, id: idProp, nativeButton = false, openOnHover = true, delay = 100, closeDelay = 0, disabled: disabledProp = false, ...elementProps } = componentProps;
|
|
1809
|
+
const context = useMenuRootContext(true);
|
|
1810
|
+
if (context?.parent.type !== "menu") throw new Error("Base UI: <Menu.SubmenuTrigger> must be placed in <Menu.SubmenuRoot>.");
|
|
1811
|
+
const menuPositionerContext = useMenuPositionerContext();
|
|
1812
|
+
const submenuRootContext = useMenuSubmenuRootContext();
|
|
1813
|
+
const { store, parentVirtualFocus } = context;
|
|
1814
|
+
const parentMenuStore = context.parent.store;
|
|
1815
|
+
const listItem = useCompositeListItem({
|
|
1816
|
+
guess: true,
|
|
1817
|
+
label
|
|
1818
|
+
});
|
|
1819
|
+
const thisTriggerId = useBaseUiId(idProp);
|
|
1820
|
+
const open = store.useState("open");
|
|
1821
|
+
const focusReturnedThroughGuardRef = React$1.useRef(false);
|
|
1822
|
+
const positionerElement = store.useState("positionerElement");
|
|
1823
|
+
const floatingRootContext = store.useState("floatingRootContext");
|
|
1824
|
+
const floatingTreeRoot = store.useState("floatingTreeRoot");
|
|
1825
|
+
const popupId = store.useState("triggerPopupId", thisTriggerId);
|
|
1826
|
+
const baseRegisterTrigger = useTriggerRegistration(thisTriggerId, store);
|
|
1827
|
+
const registerTrigger = useStableCallback((element) => {
|
|
1828
|
+
baseRegisterTrigger(element);
|
|
1829
|
+
const activeTriggerElement = store.select("activeTriggerElement");
|
|
1830
|
+
if (element !== null && store.select("open") && (activeTriggerElement === element || store.select("activeTriggerId") == null)) store.update({
|
|
1831
|
+
activeTriggerId: thisTriggerId ?? null,
|
|
1832
|
+
activeTriggerElement: element,
|
|
1833
|
+
closeDelay
|
|
1834
|
+
});
|
|
1835
|
+
});
|
|
1836
|
+
const triggerElementRef = React$1.useRef(null);
|
|
1837
|
+
const handleTriggerElementRef = React$1.useCallback((el) => {
|
|
1838
|
+
triggerElementRef.current = el;
|
|
1839
|
+
store.set("activeTriggerElement", el);
|
|
1840
|
+
}, [store]);
|
|
1841
|
+
useIsoLayoutEffect(() => {
|
|
1842
|
+
registerTrigger(triggerElementRef.current);
|
|
1843
|
+
return () => registerTrigger(null);
|
|
1844
|
+
}, [
|
|
1845
|
+
registerTrigger,
|
|
1846
|
+
thisTriggerId,
|
|
1847
|
+
store
|
|
1848
|
+
]);
|
|
1849
|
+
useIsoLayoutEffect(() => {
|
|
1850
|
+
if (!open || !positionerElement) return;
|
|
1851
|
+
function handleGuardFocusOut(event) {
|
|
1852
|
+
if (getTarget(event) === store.context.beforeContentFocusGuardRef.current) focusReturnedThroughGuardRef.current = event.relatedTarget === triggerElementRef.current;
|
|
1853
|
+
}
|
|
1854
|
+
positionerElement.addEventListener("focusout", handleGuardFocusOut, true);
|
|
1855
|
+
return () => {
|
|
1856
|
+
focusReturnedThroughGuardRef.current = false;
|
|
1857
|
+
positionerElement.removeEventListener("focusout", handleGuardFocusOut, true);
|
|
1858
|
+
};
|
|
1859
|
+
}, [
|
|
1860
|
+
open,
|
|
1861
|
+
positionerElement,
|
|
1862
|
+
store
|
|
1863
|
+
]);
|
|
1864
|
+
store.useSyncedValue("closeDelay", closeDelay);
|
|
1865
|
+
const rootDisabled = store.useState("disabled");
|
|
1866
|
+
const parentDisabled = parentMenuStore.useState("disabled");
|
|
1867
|
+
const disabled = disabledProp || rootDisabled || parentDisabled;
|
|
1868
|
+
React$1.useEffect(() => {
|
|
1869
|
+
const element = triggerElementRef.current;
|
|
1870
|
+
if (element && isElementDisabled(element) && !disabled) {
|
|
1871
|
+
const ownerStackMessage = SafeReact.captureOwnerStack?.() || "";
|
|
1872
|
+
warn(`A disabled element was detected on <Menu.SubmenuTrigger>. To properly disable the trigger, use the \`disabled\` prop on the component instead of setting it on the rendered element.${ownerStackMessage}`);
|
|
1873
|
+
}
|
|
1874
|
+
});
|
|
1875
|
+
const itemProps = parentMenuStore.useState("itemProps");
|
|
1876
|
+
const highlighted = parentMenuStore.useState("isActive", listItem.index);
|
|
1877
|
+
const itemMetadata = React$1.useMemo(() => ({
|
|
1878
|
+
type: "submenu-trigger",
|
|
1879
|
+
setActive(event) {
|
|
1880
|
+
if (parentMenuStore.select("highlightItemOnHover")) parentMenuStore.setActiveIndex(listItem.index, pointer, event);
|
|
1881
|
+
}
|
|
1882
|
+
}), [parentMenuStore, listItem.index]);
|
|
1883
|
+
const { getItemProps, itemRef } = useMenuItem({
|
|
1884
|
+
closeOnClick: false,
|
|
1885
|
+
disabled,
|
|
1886
|
+
highlighted,
|
|
1887
|
+
id: thisTriggerId,
|
|
1888
|
+
store,
|
|
1889
|
+
typingRef: parentMenuStore.context.typingRef,
|
|
1890
|
+
nativeButton,
|
|
1891
|
+
itemMetadata,
|
|
1892
|
+
nodeId: menuPositionerContext?.context.nodeId
|
|
1893
|
+
});
|
|
1894
|
+
const hoverEnabled = store.useState("hoverEnabled");
|
|
1895
|
+
const hoverProps = useHoverReferenceInteraction(floatingRootContext, {
|
|
1896
|
+
enabled: hoverEnabled && openOnHover && !disabled,
|
|
1897
|
+
handleClose: safePolygon({ blockPointerEvents: true }),
|
|
1898
|
+
mouseOnly: true,
|
|
1899
|
+
move: true,
|
|
1900
|
+
restMs: delay,
|
|
1901
|
+
delay: {
|
|
1902
|
+
open: delay,
|
|
1903
|
+
close: closeDelay
|
|
1904
|
+
},
|
|
1905
|
+
shouldOpen: delay > 0 ? () => parentMenuStore.select("allowMouseEnter") : void 0,
|
|
1906
|
+
triggerElementRef,
|
|
1907
|
+
externalTree: floatingTreeRoot,
|
|
1908
|
+
isClosing: () => store.select("transitionStatus") === "ending",
|
|
1909
|
+
guardStaleOpen: true
|
|
1910
|
+
});
|
|
1911
|
+
const localInteractionProps = useClick(floatingRootContext, {
|
|
1912
|
+
enabled: !disabled,
|
|
1913
|
+
event: "mousedown",
|
|
1914
|
+
toggle: true,
|
|
1915
|
+
ignoreMouse: openOnHover,
|
|
1916
|
+
stickIfOpen: openOnHover
|
|
1917
|
+
}).reference ?? EMPTY_OBJECT;
|
|
1918
|
+
const rootTriggerProps = store.useState("triggerProps", true);
|
|
1919
|
+
delete rootTriggerProps.id;
|
|
1920
|
+
const state = {
|
|
1921
|
+
disabled,
|
|
1922
|
+
highlighted,
|
|
1923
|
+
open
|
|
1924
|
+
};
|
|
1925
|
+
const openMethod = store.useState("openMethod");
|
|
1926
|
+
const openedByKeyboard = store.useState("lastOpenChangeReason") === "list-navigation" || openMethod === "keyboard";
|
|
1927
|
+
const shouldOmitExpanded = open && openedByKeyboard && voiceOver;
|
|
1928
|
+
const submenuKeyDownProps = submenuRootContext?.onTriggerKeyDown ? { onKeyDown: submenuRootContext.onTriggerKeyDown } : void 0;
|
|
1929
|
+
return useRenderElement("div", componentProps, {
|
|
1930
|
+
state,
|
|
1931
|
+
stateAttributesMapping: triggerOpenStateMapping,
|
|
1932
|
+
props: [
|
|
1933
|
+
localInteractionProps,
|
|
1934
|
+
hoverProps,
|
|
1935
|
+
rootTriggerProps,
|
|
1936
|
+
submenuKeyDownProps,
|
|
1937
|
+
itemProps,
|
|
1938
|
+
shouldOmitExpanded ? VOICE_OVER_EXPANDED_PROPS : void 0,
|
|
1939
|
+
{
|
|
1940
|
+
"aria-controls": popupId,
|
|
1941
|
+
tabIndex: parentVirtualFocus || !(open || highlighted) ? -1 : 0,
|
|
1942
|
+
onFocus(event) {
|
|
1943
|
+
if (store.select("open") && focusReturnedThroughGuardRef.current) {
|
|
1944
|
+
focusReturnedThroughGuardRef.current = false;
|
|
1945
|
+
store.setOpen(false, createChangeEventDetails(focusOut, event.nativeEvent));
|
|
1946
|
+
}
|
|
1947
|
+
},
|
|
1948
|
+
onBlur() {
|
|
1949
|
+
if (highlighted) parentMenuStore.setActiveIndex(null, none);
|
|
1950
|
+
}
|
|
1951
|
+
},
|
|
1952
|
+
elementProps,
|
|
1953
|
+
getItemProps
|
|
1954
|
+
],
|
|
1955
|
+
ref: [
|
|
1956
|
+
forwardedRef,
|
|
1957
|
+
listItem.ref,
|
|
1958
|
+
itemRef,
|
|
1959
|
+
registerTrigger,
|
|
1960
|
+
handleTriggerElementRef
|
|
1961
|
+
]
|
|
1962
|
+
});
|
|
1963
|
+
});
|
|
1964
|
+
MenuSubmenuTriggerPlain.displayName = "MenuSubmenuTriggerPlain";
|
|
1965
|
+
const MenuSubmenuTrigger = /*#__PURE__*/ React$1.forwardRef(function MenuSubmenuTrigger(props, forwardedRef) {
|
|
1966
|
+
const filterItem = useMenuFilterItem(props, forwardedRef, "submenu-trigger");
|
|
1967
|
+
if (!filterItem.visible) return null;
|
|
1968
|
+
const mergedProps = filterItem.props ? mergeProps(filterItem.props, props) : props;
|
|
1969
|
+
return /*#__PURE__*/ jsx(MenuSubmenuTriggerPlain, {
|
|
1970
|
+
...mergedProps,
|
|
1971
|
+
ref: filterItem.ref
|
|
1972
|
+
});
|
|
1973
|
+
});
|
|
1974
|
+
MenuSubmenuTrigger.displayName = "MenuSubmenuTrigger";
|
|
1975
|
+
//#endregion
|
|
1976
|
+
export { useMenuFilterImpl as A, MenuGroupLabel as C, MenuCheckboxItem as D, MenuCheckboxItemIndicator as E, useMenuRootContext as F, useMenuPositionerContext as I, ContextMenuRootContext as M, useContextMenuRootContext as N, MenuCheckboxItemDataAttributes_exports as O, MenuRootContext as P, MenuItem as S, MenuGroupPlain as T, resolvePopupLabel as _, MenuRootInternal as a, useMenuSubmenuRootContext as b, createNullMenuStore as c, MenuRadioGroup as d, MenuRadioGroupPlain as f, MenuPopupPlain as g, MenuPopup as h, MenuRoot as i, useMenuFilterPart as j, MenuFilterImplContext as k, MenuRadioItemIndicator as l, MenuPortal as m, findRootOwnerId as n, isKeyboardOpen as o, MenuPositioner as p, MenuSubmenuRoot as r, MenuFilterProviderContext as s, MenuSubmenuTrigger as t, MenuRadioItem as u, useRenderedId as v, MenuGroup as w, MenuLinkItem as x, MenuSubmenuRootContext as y };
|