@oomol-lab/open-flow 0.1.0-beta.59 → 0.1.0-beta.60
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/dist/browser/{createResourceDialog-C23SBjYd.js → createResourceDialog-B7ThMSeA.js} +2 -2
- package/dist/browser/{flowChanges-DL0Njlg6.js → flowChanges-Cbl6Izr-.js} +4430 -2509
- package/dist/browser/{flowWorkspace-Cp5CcEGu.js → flowWorkspace-BdbsnUDs.js} +280 -2012
- package/dist/browser/{icons-6oQ8Q9Wm.js → icons-D70mz3qW.js} +1 -1
- package/dist/browser/preview.css +15 -23
- package/dist/browser/preview.js +1951 -1768
- package/dist/browser/theme.css +4 -0
- package/dist/browser/ui.css +14 -22
- package/dist/browser/ui.js +10 -2
- package/dist/browser/workbench.css +122 -73
- package/dist/browser/workbench.d.ts +4 -1
- package/dist/browser/workbench.js +210 -148
- package/dist/browser/{workbenchSelect-DpLbIr29.js → workbenchSelect-gB45mZY7.js} +1 -1
- package/package.json +1 -1
|
@@ -1,28 +1,16 @@
|
|
|
1
1
|
import { i as __require, o as __toESM, r as __exportAll, t as __commonJSMin } from "./rolldown-runtime-CEgmsyvS.js";
|
|
2
|
-
import { A as datePickerValue, At as followWorkbenchLink, Bt as
|
|
2
|
+
import { $t as DropdownMenuContent, A as datePickerValue, An as zh_TW_default$1, At as followWorkbenchLink, Bn as errorNotice, Bt as VirtualScrollArea, C as valueForEditor, Cn as Badge, D as calendarChange, Dn as createI18n$1, E as typeOfSchema, En as SourceSelect, F as feishuResourceKind, Fn as fr_default$1, Ft as PopoverPanelContent, G as semanticNodeIcon, Gt as Empty, H as resourceData, Ht as InputGroup, I as supportsFeishuChatFilter, In as en_default$1, It as PopoverTitle, J as providerIcon, Jt as EmptyHeader, K as triggerNodeIcon, Kn as resolutionOutputPorts, Kt as EmptyContent, Ln as I18n, Lt as PopoverTrigger, Mn as ru_default$1, Mt as PopoverContent, Nn as ko_default$1, Nt as PopoverDescription, O as calendarDate, On as uiLocales, P as indexAddNodeOptions, Pn as ja_default$1, Pt as PopoverHeader, Q as useIconifyData, Qn as triggerConfigValues, Qt as DropdownMenuCheckboxItem, R as mapSource, Rn as FeishuEventPicker, Rt as NativeScrollArea, S as schemaForEditor, Sn as useMenuRootContext, T as isUnconstrainedSchema, Tn as SourceForm, U as resourceValue, Ut as InputGroupAddon, V as observeResource, Vt as Z$2, W as designerGraph, Wn as decodeResultList, Wt as InputGroupInput, X as IconifyProvider, Xn as isJsonObject, Xt as EmptyTitle, Y as ContentIcon, Yn as triggerOutputDefinitions, Yt as EmptyMedia, Z as useIconifyCollectionLoader, Zn as triggerConfigValue, Zt as DropdownMenu, _n as MenuItem, _r as Checkbox, an as DropdownMenuSeparator, ar as openApiTask, b as editorComponent, bn as useContextMenuRootContext, cn as DropdownMenuSubTrigger, cr as serverAddress, ct as diagnosticNodeId, dn as findRootOwnerId, dt as connectionCatalog, en as DropdownMenuGroup, et as canCancelRun, fn as useCompositeItem, gn as MenuPopup, gr as controlErrorCode, hn as MenuPortal, in as DropdownMenuRadioItem, ir as openApiFieldIssues, j as isDateFormat, jn as zh_CN_default$1, jt as Popover, k as datePickerChange, kn as waitBranchDescription, kt as IdTooltip, ln as DropdownMenuTrigger, lr as servers, lt as schemaMismatchMessage, mn as MenuPositioner, n as agentTool, nn as DropdownMenuLabel, nr as listOperations, nt as revisionView, on as DropdownMenuSub, or as securityOptions, pn as MenuRoot, q as actionSummary, qn as sourceOutputLabel, qt as EmptyDescription, rn as DropdownMenuRadioGroup, rr as object, sn as DropdownMenuSubContent, sr as selectOperation, st as diagnosticMessage, tn as DropdownMenuItem, tt as hasRunFilter, un as isElementDisabled, ur as inputValue, vn as MenuGroup, vr as useAriaLabelledBy, w as getDefaultValue, x as editorGroups, xn as MenuRootContext, y as defaultValueEditorSchema, yn as ContextMenuRootContext, yr as IconThemeContext, zn as EventSourceSetup, zt as ScrollArea } from "./flowChanges-Cbl6Izr-.js";
|
|
3
3
|
import { a as derive, c as strictEqual, i as compute, l as val, n as attachSetter, r as combine, s as readonlyVal } from "./dist-bO8nvHFH.js";
|
|
4
4
|
import { c as useLang, i as isString, l as useTranslate, n as isBoolean, o as I18nProvider, r as isPlainObject, s as useI18n, t as isArray$1, u as useVal } from "./dist-BFmpkX4P.js";
|
|
5
|
-
import { $ as operandHandle, $
|
|
5
|
+
import { $ as operandHandle, $r as itemPress, $t as useDirection, A as webhookSupportsBody, Ai as CompositeRootContext, Ar as ownerDocument, At as useCompositeListItem, B as variableInputCompatible, Bt as HORIZONTAL_KEYS_WITH_EXTRA_KEYS, C as FieldDescription, Ci as useRenderElement, Cr as isInteractiveElement, Ct as SelectGroup, Dr as isAndroid, Dt as SelectValue, E as FieldLabel, Ei as NOOP, En as useFloatingRootContext, Er as getTarget, Et as SelectTrigger, F as defaultDecisionQuestion, Fn as useClick, Fr as useTransitionStatus, Ft as ARROW_RIGHT, G as nodeNameIssue, Gn as DROPDOWN_COLLISION_AVOIDANCE, Gr as clearPress, Gt as scrollIntoViewIfNeeded, Hr as createChangeEventDetails, Ht as VERTICAL_KEYS, I as limitDecisionQuestions, Ii as useStableCallback, In as FloatingFocusManager, Ir as useOpenChangeComplete, It as ARROW_UP, Jn as addEventListener, Jt as usePositioner, Kr as closePress, Li as useRefWithInit, Mi as formatErrorMessage, Mr as ChevronDown, Mt as ARROW_DOWN, N as decisionQuestionIssues, Ni as mergeProps, Nt as ARROW_KEYS, O as decodeRevisionContent, Oi as useMergedRefs, Or as isFirefox, P as decisionTask, Pi as useIsoLayoutEffect, Pn as useDismiss, Pr as createLucideIcon, Pt as ARROW_LEFT, Q as nodeInputMappings, Qr as inputPress, R as matchesSchema, Rr as TransitionStatusDataAttributes, S as Field, Si as clsx, Sr as stopEvent$1, St as SelectContent, T as FieldGroup, Ti as EMPTY_OBJECT, Tr as contains, Tt as SelectSeparator, Un as FloatingPortal, Ur as createGenericEventDetails, Ut as VERTICAL_KEYS_WITH_EXTRA_KEYS, Vr as useValueChanged, Vt as MODIFIER_KEYS, Wr as cancelOpen, Wt as isNativeInput, Xn as Store, Xr as inputChange, Xt as InternalBackdrop, Y as comparisonIssue, Yt as getDisabledMountTransitionStyles, Zn as useStore$1, Zr as inputClear, Zt as useAnchorPositioning, _ as TooltipPositioner, _i as useControlled, _r as getGridNavigatedIndex, a as DialogDescription, an as triggerOpenStateMapping, ar as Label, at as dequal, b as TooltipRoot, bi as cn$1, bn as useListNavigation, br as isIndexOutOfListBounds, bt as Select$1, c as DialogTitle, ci as useFormContext, cn as hasNullItemLabel, cr as useTimeout, d as TooltipContent, di as useBaseUiId, dn as stringifyAsValue, ei as listNavigation, en as CompositeList, er as require_with_selector, et as operatorsForType, f as TooltipProvider, fi as useId$1, fn as compareItemEquality, g as TooltipPopup, gi as visuallyHiddenInput, gn as selectedValueIncludes, gr as getGridCellIndices, h as TooltipArrow, hi as visuallyHidden, hn as removeItem, hr as getGridCellIndexOfCorner, i as DialogContent, in as pressableTriggerOpenStateMapping, ir as useOnFirstRender, j as decisionLimits, jr as useLabelableId, jt as ALL_KEYS, k as webhookMethods, ki as useButton, kt as IndexGuessBehavior, l as DialogTrigger, li as useRegisterFieldControl, ln as isGroupedItems, m as createTooltipHandle, mi as fieldValidityMapping, mn as findItemIndex, mr as findNonDisabledListIndex, n as Dialog, nn as getPseudoElementBounds, nr as createSelector, nt as unaryOperator, oi as triggerPress, on as resolveAriaLabelledBy, or as Input$1, p as TooltipTrigger, pi as DEFAULT_FIELD_STATE_ATTRIBUTES, pn as defaultItemEquality, pr as createGridCellMap, qr as escapeKey, qt as useAnchoredPopupScrollLock, rn as popupStateMapping, rr as useValueAsRef, rt as valueType, si as useLabelableContext, sn as useOpenInteractionType, t as Icon, ti as none$1, tn as inertValue, tr as require_builtin_esm_external_require_react, u as Tooltip, ui as useFieldRootContext, un as stringifyAsLabel, v as TooltipPortal, vi as Button$1, vn as useTypeahead, vr as getMaxListIndex, vt as string, w as FieldError, wi as EMPTY_ARRAY$1, wr as activeElement, wt as SelectItem, x as Spinner, xi as cva, xn as useInteractions, xr as isListIndexDisabled, xt as SelectChevron, y as TooltipTrigger$1, yi as buttonVariants, yr as getMinListIndex, z as schemaObject, zi as isElement, zr as transitionStatusMapping, zt as HORIZONTAL_KEYS } from "./icons-D70mz3qW.js";
|
|
6
6
|
import { a as renameObjectField, i as objectValue, l as resolveUiLanguage, n as isJsonValue, o as setObjectField, r as jsonDataTypes, s as valueType$1, t as initialValue } from "./value-DL_poNiC.js";
|
|
7
7
|
import { n as compile, r as validate } from "./flowRunInputEditorStore-Dsxyfwae.js";
|
|
8
|
-
import { t as WorkbenchSelect } from "./workbenchSelect-
|
|
8
|
+
import { t as WorkbenchSelect } from "./workbenchSelect-gB45mZY7.js";
|
|
9
9
|
import * as React from "react";
|
|
10
10
|
import reactExports, { Children, Fragment, Suspense, createContext, forwardRef, isValidElement, lazy, memo, useCallback, useContext, useEffect, useId, useImperativeHandle, useLayoutEffect, useMemo, useRef, useState } from "react";
|
|
11
11
|
import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
|
|
12
12
|
import * as ReactDOM from "react-dom";
|
|
13
13
|
import { createPortal, flushSync } from "react-dom";
|
|
14
|
-
//#region ../../node_modules/.bun/lucide-react@0.468.0+f4eacebf2041cd4f/node_modules/lucide-react/dist/esm/icons/chevron-right.js
|
|
15
|
-
/**
|
|
16
|
-
* @license lucide-react v0.468.0 - ISC
|
|
17
|
-
*
|
|
18
|
-
* This source code is licensed under the ISC license.
|
|
19
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
20
|
-
*/
|
|
21
|
-
var ChevronRight = createLucideIcon("ChevronRight", [["path", {
|
|
22
|
-
d: "m9 18 6-6-6-6",
|
|
23
|
-
key: "mthhwq"
|
|
24
|
-
}]]);
|
|
25
|
-
//#endregion
|
|
26
14
|
//#region ../../node_modules/.bun/lucide-react@0.468.0+f4eacebf2041cd4f/node_modules/lucide-react/dist/esm/icons/zap.js
|
|
27
15
|
/**
|
|
28
16
|
* @license lucide-react v0.468.0 - ISC
|
|
@@ -710,36 +698,6 @@ function computeActivationDirection(oldValue, newValue, orientation, tabMap) {
|
|
|
710
698
|
//#region ../../node_modules/.bun/@base-ui+react@1.4.1+fa6c2f29eeb10566/node_modules/@base-ui/react/esm/internals/composite/constants.js
|
|
711
699
|
var ACTIVE_COMPOSITE_ITEM = "data-composite-item-active";
|
|
712
700
|
//#endregion
|
|
713
|
-
//#region ../../node_modules/.bun/@base-ui+react@1.4.1+fa6c2f29eeb10566/node_modules/@base-ui/react/esm/internals/composite/item/useCompositeItem.js
|
|
714
|
-
function useCompositeItem(params = {}) {
|
|
715
|
-
const { highlightItemOnHover, highlightedIndex, onHighlightedIndexChange } = useCompositeRootContext();
|
|
716
|
-
const { ref, index } = useCompositeListItem(params);
|
|
717
|
-
const isHighlighted = highlightedIndex === index;
|
|
718
|
-
const itemRef = React.useRef(null);
|
|
719
|
-
const mergedRef = useMergedRefs(ref, itemRef);
|
|
720
|
-
return {
|
|
721
|
-
compositeProps: React.useMemo(() => ({
|
|
722
|
-
tabIndex: isHighlighted ? 0 : -1,
|
|
723
|
-
onFocus() {
|
|
724
|
-
onHighlightedIndexChange(index);
|
|
725
|
-
},
|
|
726
|
-
onMouseMove() {
|
|
727
|
-
const item = itemRef.current;
|
|
728
|
-
if (!highlightItemOnHover || !item) return;
|
|
729
|
-
const disabled = item.hasAttribute("disabled") || item.ariaDisabled === "true";
|
|
730
|
-
if (!isHighlighted && !disabled) item.focus();
|
|
731
|
-
}
|
|
732
|
-
}), [
|
|
733
|
-
isHighlighted,
|
|
734
|
-
onHighlightedIndexChange,
|
|
735
|
-
index,
|
|
736
|
-
highlightItemOnHover
|
|
737
|
-
]),
|
|
738
|
-
compositeRef: mergedRef,
|
|
739
|
-
index
|
|
740
|
-
};
|
|
741
|
-
}
|
|
742
|
-
//#endregion
|
|
743
701
|
//#region ../../node_modules/.bun/@base-ui+react@1.4.1+fa6c2f29eeb10566/node_modules/@base-ui/react/esm/tabs/list/TabsListContext.js
|
|
744
702
|
var TabsListContext = /*#__PURE__*/ React.createContext(void 0);
|
|
745
703
|
if (process.env.NODE_ENV !== "production") TabsListContext.displayName = "TabsListContext";
|
|
@@ -761,7 +719,7 @@ var TabsTab = /*#__PURE__*/ React.forwardRef(function TabsTab(componentProps, fo
|
|
|
761
719
|
const { value: activeTabValue, getTabPanelIdByValue, orientation } = useTabsRootContext();
|
|
762
720
|
const { activateOnFocus, highlightedTabIndex, onTabActivation, registerTabResizeObserverElement, setHighlightedTabIndex, tabsListElement } = useTabsListContext();
|
|
763
721
|
const id = useBaseUiId(idProp);
|
|
764
|
-
const
|
|
722
|
+
const tabMetadata = React.useMemo(() => ({
|
|
765
723
|
disabled,
|
|
766
724
|
id,
|
|
767
725
|
value
|
|
@@ -769,7 +727,8 @@ var TabsTab = /*#__PURE__*/ React.forwardRef(function TabsTab(componentProps, fo
|
|
|
769
727
|
disabled,
|
|
770
728
|
id,
|
|
771
729
|
value
|
|
772
|
-
])
|
|
730
|
+
]);
|
|
731
|
+
const { compositeProps, compositeRef, index } = useCompositeItem({ metadata: tabMetadata });
|
|
773
732
|
const active = value === activeTabValue;
|
|
774
733
|
const isNavigatingRef = React.useRef(false);
|
|
775
734
|
const tabElementRef = React.useRef(null);
|
|
@@ -969,11 +928,6 @@ var TabsPanel = /*#__PURE__*/ React.forwardRef(function TabPanel(componentProps,
|
|
|
969
928
|
});
|
|
970
929
|
if (process.env.NODE_ENV !== "production") TabsPanel.displayName = "TabsPanel";
|
|
971
930
|
//#endregion
|
|
972
|
-
//#region ../../node_modules/.bun/@base-ui+utils@0.2.8+b87d06724be9db7a/node_modules/@base-ui/utils/esm/isElementDisabled.js
|
|
973
|
-
function isElementDisabled(element) {
|
|
974
|
-
return element == null || element.hasAttribute("disabled") || element.getAttribute("aria-disabled") === "true";
|
|
975
|
-
}
|
|
976
|
-
//#endregion
|
|
977
931
|
//#region ../../node_modules/.bun/@base-ui+react@1.4.1+fa6c2f29eeb10566/node_modules/@base-ui/react/esm/internals/composite/root/useCompositeRoot.js
|
|
978
932
|
var EMPTY_ARRAY = [];
|
|
979
933
|
function useCompositeRoot(params) {
|
|
@@ -1493,1930 +1447,6 @@ function CanvasTooltip({ className, children, getPopupContainer, open, placement
|
|
|
1493
1447
|
});
|
|
1494
1448
|
}
|
|
1495
1449
|
//#endregion
|
|
1496
|
-
//#region ../../node_modules/.bun/@base-ui+react@1.4.1+fa6c2f29eeb10566/node_modules/@base-ui/react/esm/menu/positioner/MenuPositionerContext.js
|
|
1497
|
-
var MenuPositionerContext = /*#__PURE__*/ React.createContext(void 0);
|
|
1498
|
-
if (process.env.NODE_ENV !== "production") MenuPositionerContext.displayName = "MenuPositionerContext";
|
|
1499
|
-
function useMenuPositionerContext(optional) {
|
|
1500
|
-
const context = React.useContext(MenuPositionerContext);
|
|
1501
|
-
if (context === void 0 && !optional) throw new Error(process.env.NODE_ENV !== "production" ? "Base UI: MenuPositionerContext is missing. MenuPositioner parts must be placed within <Menu.Positioner>." : formatErrorMessage(33));
|
|
1502
|
-
return context;
|
|
1503
|
-
}
|
|
1504
|
-
//#endregion
|
|
1505
|
-
//#region ../../node_modules/.bun/@base-ui+react@1.4.1+fa6c2f29eeb10566/node_modules/@base-ui/react/esm/menu/root/MenuRootContext.js
|
|
1506
|
-
var MenuRootContext = /*#__PURE__*/ React.createContext(void 0);
|
|
1507
|
-
if (process.env.NODE_ENV !== "production") MenuRootContext.displayName = "MenuRootContext";
|
|
1508
|
-
function useMenuRootContext(optional) {
|
|
1509
|
-
const context = React.useContext(MenuRootContext);
|
|
1510
|
-
if (context === void 0 && !optional) throw new Error(process.env.NODE_ENV !== "production" ? "Base UI: MenuRootContext is missing. Menu parts must be placed within <Menu.Root>." : formatErrorMessage(36));
|
|
1511
|
-
return context;
|
|
1512
|
-
}
|
|
1513
|
-
//#endregion
|
|
1514
|
-
//#region ../../node_modules/.bun/@base-ui+react@1.4.1+fa6c2f29eeb10566/node_modules/@base-ui/react/esm/context-menu/root/ContextMenuRootContext.js
|
|
1515
|
-
var ContextMenuRootContext = /*#__PURE__*/ React.createContext(void 0);
|
|
1516
|
-
if (process.env.NODE_ENV !== "production") ContextMenuRootContext.displayName = "ContextMenuRootContext";
|
|
1517
|
-
function useContextMenuRootContext(optional = true) {
|
|
1518
|
-
const context = React.useContext(ContextMenuRootContext);
|
|
1519
|
-
if (context === void 0 && !optional) throw new Error(process.env.NODE_ENV !== "production" ? "Base UI: ContextMenuRootContext is missing. ContextMenu parts must be placed within <ContextMenu.Root>." : formatErrorMessage(25));
|
|
1520
|
-
return context;
|
|
1521
|
-
}
|
|
1522
|
-
//#endregion
|
|
1523
|
-
//#region ../../node_modules/.bun/@base-ui+react@1.4.1+fa6c2f29eeb10566/node_modules/@base-ui/react/esm/menu/checkbox-item/MenuCheckboxItemContext.js
|
|
1524
|
-
var MenuCheckboxItemContext = /*#__PURE__*/ React.createContext(void 0);
|
|
1525
|
-
if (process.env.NODE_ENV !== "production") MenuCheckboxItemContext.displayName = "MenuCheckboxItemContext";
|
|
1526
|
-
function useMenuCheckboxItemContext() {
|
|
1527
|
-
const context = React.useContext(MenuCheckboxItemContext);
|
|
1528
|
-
if (context === void 0) throw new Error(process.env.NODE_ENV !== "production" ? "Base UI: MenuCheckboxItemContext is missing. MenuCheckboxItem parts must be placed within <Menu.CheckboxItem>." : formatErrorMessage(30));
|
|
1529
|
-
return context;
|
|
1530
|
-
}
|
|
1531
|
-
//#endregion
|
|
1532
|
-
//#region ../../node_modules/.bun/@base-ui+react@1.4.1+fa6c2f29eeb10566/node_modules/@base-ui/react/esm/menu/item/useMenuItemCommonProps.js
|
|
1533
|
-
/**
|
|
1534
|
-
* Returns common props shared by all menu item types.
|
|
1535
|
-
* This hook extracts the shared logic for id, role, tabIndex, onKeyDown,
|
|
1536
|
-
* onMouseMove, onClick, and onMouseUp handlers.
|
|
1537
|
-
*/
|
|
1538
|
-
function useMenuItemCommonProps(params) {
|
|
1539
|
-
const { closeOnClick, highlighted, id, nodeId, store, typingRef, itemRef, itemMetadata } = params;
|
|
1540
|
-
const { events: menuEvents } = store.useState("floatingTreeRoot");
|
|
1541
|
-
const contextMenuContext = useContextMenuRootContext(true);
|
|
1542
|
-
const isContextMenu = contextMenuContext !== void 0;
|
|
1543
|
-
return React.useMemo(() => ({
|
|
1544
|
-
id,
|
|
1545
|
-
role: "menuitem",
|
|
1546
|
-
tabIndex: highlighted ? 0 : -1,
|
|
1547
|
-
onKeyDown(event) {
|
|
1548
|
-
if (event.key === " " && typingRef?.current) event.preventDefault();
|
|
1549
|
-
},
|
|
1550
|
-
onMouseMove(event) {
|
|
1551
|
-
if (!nodeId) return;
|
|
1552
|
-
menuEvents.emit("itemhover", {
|
|
1553
|
-
nodeId,
|
|
1554
|
-
target: event.currentTarget
|
|
1555
|
-
});
|
|
1556
|
-
},
|
|
1557
|
-
onClick(event) {
|
|
1558
|
-
if (closeOnClick) menuEvents.emit("close", {
|
|
1559
|
-
domEvent: event,
|
|
1560
|
-
reason: itemPress
|
|
1561
|
-
});
|
|
1562
|
-
},
|
|
1563
|
-
onMouseUp(event) {
|
|
1564
|
-
if (contextMenuContext) {
|
|
1565
|
-
const initialCursorPoint = contextMenuContext.initialCursorPointRef.current;
|
|
1566
|
-
contextMenuContext.initialCursorPointRef.current = null;
|
|
1567
|
-
if (isContextMenu && initialCursorPoint && Math.abs(event.clientX - initialCursorPoint.x) <= 1 && Math.abs(event.clientY - initialCursorPoint.y) <= 1) return;
|
|
1568
|
-
if (isContextMenu && !isMac$1 && event.button === 2) return;
|
|
1569
|
-
}
|
|
1570
|
-
if (itemRef.current && store.context.allowMouseUpTriggerRef.current && (!isContextMenu || event.button === 2)) {
|
|
1571
|
-
if (!itemMetadata || itemMetadata.type === "regular-item") itemRef.current.click();
|
|
1572
|
-
}
|
|
1573
|
-
}
|
|
1574
|
-
}), [
|
|
1575
|
-
closeOnClick,
|
|
1576
|
-
highlighted,
|
|
1577
|
-
id,
|
|
1578
|
-
menuEvents,
|
|
1579
|
-
nodeId,
|
|
1580
|
-
store,
|
|
1581
|
-
typingRef,
|
|
1582
|
-
itemRef,
|
|
1583
|
-
contextMenuContext,
|
|
1584
|
-
isContextMenu,
|
|
1585
|
-
itemMetadata
|
|
1586
|
-
]);
|
|
1587
|
-
}
|
|
1588
|
-
//#endregion
|
|
1589
|
-
//#region ../../node_modules/.bun/@base-ui+react@1.4.1+fa6c2f29eeb10566/node_modules/@base-ui/react/esm/menu/item/useMenuItem.js
|
|
1590
|
-
var REGULAR_ITEM = { type: "regular-item" };
|
|
1591
|
-
function useMenuItem(params) {
|
|
1592
|
-
const { closeOnClick, disabled = false, highlighted, id, store, typingRef = store.context.typingRef, nativeButton, itemMetadata, nodeId } = params;
|
|
1593
|
-
const itemRef = React.useRef(null);
|
|
1594
|
-
const { getButtonProps, buttonRef } = useButton({
|
|
1595
|
-
disabled,
|
|
1596
|
-
focusableWhenDisabled: true,
|
|
1597
|
-
native: nativeButton,
|
|
1598
|
-
composite: true
|
|
1599
|
-
});
|
|
1600
|
-
const commonProps = useMenuItemCommonProps({
|
|
1601
|
-
closeOnClick,
|
|
1602
|
-
highlighted,
|
|
1603
|
-
id,
|
|
1604
|
-
nodeId,
|
|
1605
|
-
store,
|
|
1606
|
-
typingRef,
|
|
1607
|
-
itemRef,
|
|
1608
|
-
itemMetadata
|
|
1609
|
-
});
|
|
1610
|
-
const getItemProps = React.useCallback((externalProps) => {
|
|
1611
|
-
return mergeProps(commonProps, { onMouseEnter() {
|
|
1612
|
-
if (itemMetadata.type !== "submenu-trigger") return;
|
|
1613
|
-
itemMetadata.setActive();
|
|
1614
|
-
} }, externalProps, getButtonProps);
|
|
1615
|
-
}, [
|
|
1616
|
-
commonProps,
|
|
1617
|
-
getButtonProps,
|
|
1618
|
-
itemMetadata
|
|
1619
|
-
]);
|
|
1620
|
-
const mergedRef = useMergedRefs(itemRef, buttonRef);
|
|
1621
|
-
return React.useMemo(() => ({
|
|
1622
|
-
getItemProps,
|
|
1623
|
-
itemRef: mergedRef
|
|
1624
|
-
}), [getItemProps, mergedRef]);
|
|
1625
|
-
}
|
|
1626
|
-
//#endregion
|
|
1627
|
-
//#region ../../node_modules/.bun/@base-ui+react@1.4.1+fa6c2f29eeb10566/node_modules/@base-ui/react/esm/menu/checkbox-item/MenuCheckboxItemDataAttributes.js
|
|
1628
|
-
var MenuCheckboxItemDataAttributes = /*#__PURE__*/ function(MenuCheckboxItemDataAttributes) {
|
|
1629
|
-
/**
|
|
1630
|
-
* Present when the menu checkbox item is checked.
|
|
1631
|
-
*/
|
|
1632
|
-
MenuCheckboxItemDataAttributes["checked"] = "data-checked";
|
|
1633
|
-
/**
|
|
1634
|
-
* Present when the menu checkbox item is not checked.
|
|
1635
|
-
*/
|
|
1636
|
-
MenuCheckboxItemDataAttributes["unchecked"] = "data-unchecked";
|
|
1637
|
-
/**
|
|
1638
|
-
* Present when the menu checkbox item is disabled.
|
|
1639
|
-
*/
|
|
1640
|
-
MenuCheckboxItemDataAttributes["disabled"] = "data-disabled";
|
|
1641
|
-
/**
|
|
1642
|
-
* Present when the menu checkbox item is highlighted.
|
|
1643
|
-
*/
|
|
1644
|
-
MenuCheckboxItemDataAttributes["highlighted"] = "data-highlighted";
|
|
1645
|
-
return MenuCheckboxItemDataAttributes;
|
|
1646
|
-
}({});
|
|
1647
|
-
//#endregion
|
|
1648
|
-
//#region ../../node_modules/.bun/@base-ui+react@1.4.1+fa6c2f29eeb10566/node_modules/@base-ui/react/esm/menu/utils/stateAttributesMapping.js
|
|
1649
|
-
var itemMapping = {
|
|
1650
|
-
checked(value) {
|
|
1651
|
-
if (value) return { [MenuCheckboxItemDataAttributes.checked]: "" };
|
|
1652
|
-
return { [MenuCheckboxItemDataAttributes.unchecked]: "" };
|
|
1653
|
-
},
|
|
1654
|
-
...transitionStatusMapping
|
|
1655
|
-
};
|
|
1656
|
-
//#endregion
|
|
1657
|
-
//#region ../../node_modules/.bun/@base-ui+react@1.4.1+fa6c2f29eeb10566/node_modules/@base-ui/react/esm/menu/checkbox-item/MenuCheckboxItem.js
|
|
1658
|
-
/**
|
|
1659
|
-
* A menu item that toggles a setting on or off.
|
|
1660
|
-
* Renders a `<div>` element.
|
|
1661
|
-
*
|
|
1662
|
-
* Documentation: [Base UI Menu](https://base-ui.com/react/components/menu)
|
|
1663
|
-
*/
|
|
1664
|
-
var MenuCheckboxItem = /*#__PURE__*/ React.forwardRef(function MenuCheckboxItem(componentProps, forwardedRef) {
|
|
1665
|
-
const { render, className, id: idProp, label, nativeButton = false, disabled = false, closeOnClick = false, checked: checkedProp, defaultChecked, onCheckedChange, style, ...elementProps } = componentProps;
|
|
1666
|
-
const listItem = useCompositeListItem({ label });
|
|
1667
|
-
const menuPositionerContext = useMenuPositionerContext(true);
|
|
1668
|
-
const id = useBaseUiId(idProp);
|
|
1669
|
-
const { store } = useMenuRootContext();
|
|
1670
|
-
const highlighted = store.useState("isActive", listItem.index);
|
|
1671
|
-
const itemProps = store.useState("itemProps");
|
|
1672
|
-
const [checked, setChecked] = useControlled({
|
|
1673
|
-
controlled: checkedProp,
|
|
1674
|
-
default: defaultChecked ?? false,
|
|
1675
|
-
name: "MenuCheckboxItem",
|
|
1676
|
-
state: "checked"
|
|
1677
|
-
});
|
|
1678
|
-
const { getItemProps, itemRef } = useMenuItem({
|
|
1679
|
-
closeOnClick,
|
|
1680
|
-
disabled,
|
|
1681
|
-
highlighted,
|
|
1682
|
-
id,
|
|
1683
|
-
store,
|
|
1684
|
-
nativeButton,
|
|
1685
|
-
nodeId: menuPositionerContext?.context.nodeId,
|
|
1686
|
-
itemMetadata: REGULAR_ITEM
|
|
1687
|
-
});
|
|
1688
|
-
const state = React.useMemo(() => ({
|
|
1689
|
-
disabled,
|
|
1690
|
-
highlighted,
|
|
1691
|
-
checked
|
|
1692
|
-
}), [
|
|
1693
|
-
disabled,
|
|
1694
|
-
highlighted,
|
|
1695
|
-
checked
|
|
1696
|
-
]);
|
|
1697
|
-
const handleClick = useStableCallback((event) => {
|
|
1698
|
-
const details = {
|
|
1699
|
-
...createChangeEventDetails(itemPress, event.nativeEvent),
|
|
1700
|
-
preventUnmountOnClose: () => {}
|
|
1701
|
-
};
|
|
1702
|
-
onCheckedChange?.(!checked, details);
|
|
1703
|
-
if (details.isCanceled) return;
|
|
1704
|
-
setChecked((currentlyChecked) => !currentlyChecked);
|
|
1705
|
-
});
|
|
1706
|
-
const element = useRenderElement("div", componentProps, {
|
|
1707
|
-
state,
|
|
1708
|
-
stateAttributesMapping: itemMapping,
|
|
1709
|
-
props: [
|
|
1710
|
-
itemProps,
|
|
1711
|
-
{
|
|
1712
|
-
role: "menuitemcheckbox",
|
|
1713
|
-
"aria-checked": checked,
|
|
1714
|
-
onClick: handleClick
|
|
1715
|
-
},
|
|
1716
|
-
elementProps,
|
|
1717
|
-
getItemProps
|
|
1718
|
-
],
|
|
1719
|
-
ref: [
|
|
1720
|
-
itemRef,
|
|
1721
|
-
forwardedRef,
|
|
1722
|
-
listItem.ref
|
|
1723
|
-
]
|
|
1724
|
-
});
|
|
1725
|
-
return /*#__PURE__*/ jsx(MenuCheckboxItemContext.Provider, {
|
|
1726
|
-
value: state,
|
|
1727
|
-
children: element
|
|
1728
|
-
});
|
|
1729
|
-
});
|
|
1730
|
-
if (process.env.NODE_ENV !== "production") MenuCheckboxItem.displayName = "MenuCheckboxItem";
|
|
1731
|
-
//#endregion
|
|
1732
|
-
//#region ../../node_modules/.bun/@base-ui+react@1.4.1+fa6c2f29eeb10566/node_modules/@base-ui/react/esm/menu/checkbox-item-indicator/MenuCheckboxItemIndicator.js
|
|
1733
|
-
/**
|
|
1734
|
-
* Indicates whether the checkbox item is ticked.
|
|
1735
|
-
* Renders a `<span>` element.
|
|
1736
|
-
*
|
|
1737
|
-
* Documentation: [Base UI Menu](https://base-ui.com/react/components/menu)
|
|
1738
|
-
*/
|
|
1739
|
-
var MenuCheckboxItemIndicator = /*#__PURE__*/ React.forwardRef(function MenuCheckboxItemIndicator(componentProps, forwardedRef) {
|
|
1740
|
-
const { render, className, style, keepMounted = false, ...elementProps } = componentProps;
|
|
1741
|
-
const item = useMenuCheckboxItemContext();
|
|
1742
|
-
const indicatorRef = React.useRef(null);
|
|
1743
|
-
const { transitionStatus, setMounted } = useTransitionStatus(item.checked);
|
|
1744
|
-
useOpenChangeComplete({
|
|
1745
|
-
open: item.checked,
|
|
1746
|
-
ref: indicatorRef,
|
|
1747
|
-
onComplete() {
|
|
1748
|
-
if (!item.checked) setMounted(false);
|
|
1749
|
-
}
|
|
1750
|
-
});
|
|
1751
|
-
const state = {
|
|
1752
|
-
checked: item.checked,
|
|
1753
|
-
disabled: item.disabled,
|
|
1754
|
-
highlighted: item.highlighted,
|
|
1755
|
-
transitionStatus
|
|
1756
|
-
};
|
|
1757
|
-
return useRenderElement("span", componentProps, {
|
|
1758
|
-
state,
|
|
1759
|
-
ref: [forwardedRef, indicatorRef],
|
|
1760
|
-
stateAttributesMapping: itemMapping,
|
|
1761
|
-
props: {
|
|
1762
|
-
"aria-hidden": true,
|
|
1763
|
-
...elementProps
|
|
1764
|
-
},
|
|
1765
|
-
enabled: keepMounted || item.checked
|
|
1766
|
-
});
|
|
1767
|
-
});
|
|
1768
|
-
if (process.env.NODE_ENV !== "production") MenuCheckboxItemIndicator.displayName = "MenuCheckboxItemIndicator";
|
|
1769
|
-
//#endregion
|
|
1770
|
-
//#region ../../node_modules/.bun/@base-ui+react@1.4.1+fa6c2f29eeb10566/node_modules/@base-ui/react/esm/menu/group/MenuGroupContext.js
|
|
1771
|
-
var MenuGroupContext = /*#__PURE__*/ React.createContext(void 0);
|
|
1772
|
-
if (process.env.NODE_ENV !== "production") MenuGroupContext.displayName = "MenuGroupContext";
|
|
1773
|
-
function useMenuGroupRootContext() {
|
|
1774
|
-
const context = React.useContext(MenuGroupContext);
|
|
1775
|
-
if (context === void 0) throw new Error(process.env.NODE_ENV !== "production" ? "Base UI: MenuGroupRootContext is missing. Menu group parts must be used within <Menu.Group>." : formatErrorMessage(31));
|
|
1776
|
-
return context;
|
|
1777
|
-
}
|
|
1778
|
-
//#endregion
|
|
1779
|
-
//#region ../../node_modules/.bun/@base-ui+react@1.4.1+fa6c2f29eeb10566/node_modules/@base-ui/react/esm/menu/group/MenuGroup.js
|
|
1780
|
-
/**
|
|
1781
|
-
* Groups related menu items with the corresponding label.
|
|
1782
|
-
* Renders a `<div>` element.
|
|
1783
|
-
*
|
|
1784
|
-
* Documentation: [Base UI Menu](https://base-ui.com/react/components/menu)
|
|
1785
|
-
*/
|
|
1786
|
-
var MenuGroup = /*#__PURE__*/ React.forwardRef(function MenuGroup(componentProps, forwardedRef) {
|
|
1787
|
-
const { render, className, style, ...elementProps } = componentProps;
|
|
1788
|
-
const [labelId, setLabelId] = React.useState(void 0);
|
|
1789
|
-
const context = React.useMemo(() => ({ setLabelId }), [setLabelId]);
|
|
1790
|
-
const element = useRenderElement("div", componentProps, {
|
|
1791
|
-
ref: forwardedRef,
|
|
1792
|
-
props: {
|
|
1793
|
-
role: "group",
|
|
1794
|
-
"aria-labelledby": labelId,
|
|
1795
|
-
...elementProps
|
|
1796
|
-
}
|
|
1797
|
-
});
|
|
1798
|
-
return /*#__PURE__*/ jsx(MenuGroupContext.Provider, {
|
|
1799
|
-
value: context,
|
|
1800
|
-
children: element
|
|
1801
|
-
});
|
|
1802
|
-
});
|
|
1803
|
-
if (process.env.NODE_ENV !== "production") MenuGroup.displayName = "MenuGroup";
|
|
1804
|
-
//#endregion
|
|
1805
|
-
//#region ../../node_modules/.bun/@base-ui+react@1.4.1+fa6c2f29eeb10566/node_modules/@base-ui/react/esm/menu/group-label/MenuGroupLabel.js
|
|
1806
|
-
/**
|
|
1807
|
-
* An accessible label that is automatically associated with its parent group.
|
|
1808
|
-
* Renders a `<div>` element.
|
|
1809
|
-
*
|
|
1810
|
-
* Documentation: [Base UI Menu](https://base-ui.com/react/components/menu)
|
|
1811
|
-
*/
|
|
1812
|
-
var MenuGroupLabel = /*#__PURE__*/ React.forwardRef(function MenuGroupLabelComponent(componentProps, forwardedRef) {
|
|
1813
|
-
const { className, render, id: idProp, style, ...elementProps } = componentProps;
|
|
1814
|
-
const id = useBaseUiId(idProp);
|
|
1815
|
-
const { setLabelId } = useMenuGroupRootContext();
|
|
1816
|
-
useIsoLayoutEffect(() => {
|
|
1817
|
-
setLabelId(id);
|
|
1818
|
-
return () => {
|
|
1819
|
-
setLabelId(void 0);
|
|
1820
|
-
};
|
|
1821
|
-
}, [setLabelId, id]);
|
|
1822
|
-
return useRenderElement("div", componentProps, {
|
|
1823
|
-
ref: forwardedRef,
|
|
1824
|
-
props: {
|
|
1825
|
-
id,
|
|
1826
|
-
role: "presentation",
|
|
1827
|
-
...elementProps
|
|
1828
|
-
}
|
|
1829
|
-
});
|
|
1830
|
-
});
|
|
1831
|
-
if (process.env.NODE_ENV !== "production") MenuGroupLabel.displayName = "MenuGroupLabel";
|
|
1832
|
-
//#endregion
|
|
1833
|
-
//#region ../../node_modules/.bun/@base-ui+react@1.4.1+fa6c2f29eeb10566/node_modules/@base-ui/react/esm/menu/item/MenuItem.js
|
|
1834
|
-
/**
|
|
1835
|
-
* An individual interactive item in the menu.
|
|
1836
|
-
* Renders a `<div>` element.
|
|
1837
|
-
*
|
|
1838
|
-
* Documentation: [Base UI Menu](https://base-ui.com/react/components/menu)
|
|
1839
|
-
*/
|
|
1840
|
-
var MenuItem = /*#__PURE__*/ React.forwardRef(function MenuItem(componentProps, forwardedRef) {
|
|
1841
|
-
const { render, className, id: idProp, label, nativeButton = false, disabled = false, closeOnClick = true, style, ...elementProps } = componentProps;
|
|
1842
|
-
const listItem = useCompositeListItem({ label });
|
|
1843
|
-
const menuPositionerContext = useMenuPositionerContext(true);
|
|
1844
|
-
const id = useBaseUiId(idProp);
|
|
1845
|
-
const { store } = useMenuRootContext();
|
|
1846
|
-
const highlighted = store.useState("isActive", listItem.index);
|
|
1847
|
-
const itemProps = store.useState("itemProps");
|
|
1848
|
-
const { getItemProps, itemRef } = useMenuItem({
|
|
1849
|
-
closeOnClick,
|
|
1850
|
-
disabled,
|
|
1851
|
-
highlighted,
|
|
1852
|
-
id,
|
|
1853
|
-
store,
|
|
1854
|
-
nativeButton,
|
|
1855
|
-
nodeId: menuPositionerContext?.context.nodeId,
|
|
1856
|
-
itemMetadata: REGULAR_ITEM
|
|
1857
|
-
});
|
|
1858
|
-
return useRenderElement("div", componentProps, {
|
|
1859
|
-
state: {
|
|
1860
|
-
disabled,
|
|
1861
|
-
highlighted
|
|
1862
|
-
},
|
|
1863
|
-
props: [
|
|
1864
|
-
itemProps,
|
|
1865
|
-
elementProps,
|
|
1866
|
-
getItemProps
|
|
1867
|
-
],
|
|
1868
|
-
ref: [
|
|
1869
|
-
itemRef,
|
|
1870
|
-
forwardedRef,
|
|
1871
|
-
listItem.ref
|
|
1872
|
-
]
|
|
1873
|
-
});
|
|
1874
|
-
});
|
|
1875
|
-
if (process.env.NODE_ENV !== "production") MenuItem.displayName = "MenuItem";
|
|
1876
|
-
//#endregion
|
|
1877
|
-
//#region ../../node_modules/.bun/@base-ui+react@1.4.1+fa6c2f29eeb10566/node_modules/@base-ui/react/esm/menu/popup/MenuPopup.js
|
|
1878
|
-
var stateAttributesMapping$2 = {
|
|
1879
|
-
...popupStateMapping,
|
|
1880
|
-
...transitionStatusMapping
|
|
1881
|
-
};
|
|
1882
|
-
/**
|
|
1883
|
-
* A container for the menu items.
|
|
1884
|
-
* Renders a `<div>` element.
|
|
1885
|
-
*
|
|
1886
|
-
* Documentation: [Base UI Menu](https://base-ui.com/react/components/menu)
|
|
1887
|
-
*/
|
|
1888
|
-
var MenuPopup = /*#__PURE__*/ React.forwardRef(function MenuPopup(componentProps, forwardedRef) {
|
|
1889
|
-
const { render, className, style, finalFocus, ...elementProps } = componentProps;
|
|
1890
|
-
const { store } = useMenuRootContext();
|
|
1891
|
-
const { side, align } = useMenuPositionerContext();
|
|
1892
|
-
const insideToolbar = useToolbarRootContext(true) != null;
|
|
1893
|
-
const open = store.useState("open");
|
|
1894
|
-
const transitionStatus = store.useState("transitionStatus");
|
|
1895
|
-
const popupProps = store.useState("popupProps");
|
|
1896
|
-
const mounted = store.useState("mounted");
|
|
1897
|
-
const instantType = store.useState("instantType");
|
|
1898
|
-
const triggerElement = store.useState("activeTriggerElement");
|
|
1899
|
-
const parent = store.useState("parent");
|
|
1900
|
-
const lastOpenChangeReason = store.useState("lastOpenChangeReason");
|
|
1901
|
-
const rootId = store.useState("rootId");
|
|
1902
|
-
const floatingContext = store.useState("floatingRootContext");
|
|
1903
|
-
const floatingTreeRoot = store.useState("floatingTreeRoot");
|
|
1904
|
-
const closeDelay = store.useState("closeDelay");
|
|
1905
|
-
const activeTriggerElement = store.useState("activeTriggerElement");
|
|
1906
|
-
const isContextMenu = parent.type === "context-menu";
|
|
1907
|
-
useOpenChangeComplete({
|
|
1908
|
-
open,
|
|
1909
|
-
ref: store.context.popupRef,
|
|
1910
|
-
onComplete() {
|
|
1911
|
-
if (open) store.context.onOpenChangeComplete?.(true);
|
|
1912
|
-
}
|
|
1913
|
-
});
|
|
1914
|
-
React.useEffect(() => {
|
|
1915
|
-
function handleClose(event) {
|
|
1916
|
-
store.setOpen(false, createChangeEventDetails(event.reason, event.domEvent));
|
|
1917
|
-
}
|
|
1918
|
-
floatingTreeRoot.events.on("close", handleClose);
|
|
1919
|
-
return () => {
|
|
1920
|
-
floatingTreeRoot.events.off("close", handleClose);
|
|
1921
|
-
};
|
|
1922
|
-
}, [floatingTreeRoot.events, store]);
|
|
1923
|
-
const hoverEnabled = store.useState("hoverEnabled");
|
|
1924
|
-
const disabled = store.useState("disabled");
|
|
1925
|
-
useHoverFloatingInteraction(floatingContext, {
|
|
1926
|
-
enabled: hoverEnabled && !disabled && !isContextMenu && parent.type !== "menubar",
|
|
1927
|
-
closeDelay
|
|
1928
|
-
});
|
|
1929
|
-
const state = {
|
|
1930
|
-
transitionStatus,
|
|
1931
|
-
side,
|
|
1932
|
-
align,
|
|
1933
|
-
open,
|
|
1934
|
-
nested: parent.type === "menu",
|
|
1935
|
-
instant: instantType
|
|
1936
|
-
};
|
|
1937
|
-
const setPopupElement = React.useCallback((element) => {
|
|
1938
|
-
store.set("popupElement", element);
|
|
1939
|
-
}, [store]);
|
|
1940
|
-
const element = useRenderElement("div", componentProps, {
|
|
1941
|
-
state,
|
|
1942
|
-
ref: [
|
|
1943
|
-
forwardedRef,
|
|
1944
|
-
store.context.popupRef,
|
|
1945
|
-
setPopupElement
|
|
1946
|
-
],
|
|
1947
|
-
stateAttributesMapping: stateAttributesMapping$2,
|
|
1948
|
-
props: [
|
|
1949
|
-
popupProps,
|
|
1950
|
-
{ onKeyDown(event) {
|
|
1951
|
-
if (insideToolbar && COMPOSITE_KEYS.has(event.key)) event.stopPropagation();
|
|
1952
|
-
} },
|
|
1953
|
-
getDisabledMountTransitionStyles(transitionStatus),
|
|
1954
|
-
elementProps,
|
|
1955
|
-
{ "data-rootownerid": rootId }
|
|
1956
|
-
]
|
|
1957
|
-
});
|
|
1958
|
-
let returnFocus = parent.type === void 0 || isContextMenu;
|
|
1959
|
-
if (triggerElement || parent.type === "menubar" && lastOpenChangeReason !== "outside-press") returnFocus = true;
|
|
1960
|
-
return /*#__PURE__*/ jsx(FloatingFocusManager, {
|
|
1961
|
-
context: floatingContext,
|
|
1962
|
-
modal: isContextMenu,
|
|
1963
|
-
disabled: !mounted,
|
|
1964
|
-
returnFocus: finalFocus === void 0 ? returnFocus : finalFocus,
|
|
1965
|
-
initialFocus: parent.type !== "menu",
|
|
1966
|
-
restoreFocus: true,
|
|
1967
|
-
externalTree: parent.type !== "menubar" ? floatingTreeRoot : void 0,
|
|
1968
|
-
previousFocusableElement: activeTriggerElement,
|
|
1969
|
-
nextFocusableElement: parent.type === void 0 ? store.context.triggerFocusTargetRef : void 0,
|
|
1970
|
-
beforeContentFocusGuardRef: parent.type === void 0 ? store.context.beforeContentFocusGuardRef : void 0,
|
|
1971
|
-
children: element
|
|
1972
|
-
});
|
|
1973
|
-
});
|
|
1974
|
-
if (process.env.NODE_ENV !== "production") MenuPopup.displayName = "MenuPopup";
|
|
1975
|
-
//#endregion
|
|
1976
|
-
//#region ../../node_modules/.bun/@base-ui+react@1.4.1+fa6c2f29eeb10566/node_modules/@base-ui/react/esm/menu/portal/MenuPortalContext.js
|
|
1977
|
-
var MenuPortalContext = /*#__PURE__*/ React.createContext(void 0);
|
|
1978
|
-
if (process.env.NODE_ENV !== "production") MenuPortalContext.displayName = "MenuPortalContext";
|
|
1979
|
-
function useMenuPortalContext() {
|
|
1980
|
-
const value = React.useContext(MenuPortalContext);
|
|
1981
|
-
if (value === void 0) throw new Error(process.env.NODE_ENV !== "production" ? "Base UI: <Menu.Portal> is missing." : formatErrorMessage(32));
|
|
1982
|
-
return value;
|
|
1983
|
-
}
|
|
1984
|
-
//#endregion
|
|
1985
|
-
//#region ../../node_modules/.bun/@base-ui+react@1.4.1+fa6c2f29eeb10566/node_modules/@base-ui/react/esm/menu/portal/MenuPortal.js
|
|
1986
|
-
/**
|
|
1987
|
-
* A portal element that moves the popup to a different part of the DOM.
|
|
1988
|
-
* By default, the portal element is appended to `<body>`.
|
|
1989
|
-
* Renders a `<div>` element.
|
|
1990
|
-
*
|
|
1991
|
-
* Documentation: [Base UI Menu](https://base-ui.com/react/components/menu)
|
|
1992
|
-
*/
|
|
1993
|
-
var MenuPortal = /*#__PURE__*/ React.forwardRef(function MenuPortal(props, forwardedRef) {
|
|
1994
|
-
const { keepMounted = false, ...portalProps } = props;
|
|
1995
|
-
const { store } = useMenuRootContext();
|
|
1996
|
-
if (!(store.useState("mounted") || keepMounted)) return null;
|
|
1997
|
-
return /*#__PURE__*/ jsx(MenuPortalContext.Provider, {
|
|
1998
|
-
value: keepMounted,
|
|
1999
|
-
children: /*#__PURE__*/ jsx(FloatingPortal, {
|
|
2000
|
-
ref: forwardedRef,
|
|
2001
|
-
...portalProps
|
|
2002
|
-
})
|
|
2003
|
-
});
|
|
2004
|
-
});
|
|
2005
|
-
if (process.env.NODE_ENV !== "production") MenuPortal.displayName = "MenuPortal";
|
|
2006
|
-
//#endregion
|
|
2007
|
-
//#region ../../node_modules/.bun/@base-ui+react@1.4.1+fa6c2f29eeb10566/node_modules/@base-ui/react/esm/menu/positioner/MenuPositioner.js
|
|
2008
|
-
/**
|
|
2009
|
-
* Positions the menu popup against the trigger.
|
|
2010
|
-
* Renders a `<div>` element.
|
|
2011
|
-
*
|
|
2012
|
-
* Documentation: [Base UI Menu](https://base-ui.com/react/components/menu)
|
|
2013
|
-
*/
|
|
2014
|
-
var MenuPositioner = /*#__PURE__*/ React.forwardRef(function MenuPositioner(componentProps, forwardedRef) {
|
|
2015
|
-
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;
|
|
2016
|
-
const { store } = useMenuRootContext();
|
|
2017
|
-
const keepMounted = useMenuPortalContext();
|
|
2018
|
-
const contextMenuContext = useContextMenuRootContext(true);
|
|
2019
|
-
const parent = store.useState("parent");
|
|
2020
|
-
const floatingRootContext = store.useState("floatingRootContext");
|
|
2021
|
-
const floatingTreeRoot = store.useState("floatingTreeRoot");
|
|
2022
|
-
const mounted = store.useState("mounted");
|
|
2023
|
-
const open = store.useState("open");
|
|
2024
|
-
const modal = store.useState("modal");
|
|
2025
|
-
const openMethod = store.useState("openMethod");
|
|
2026
|
-
const triggerElement = store.useState("activeTriggerElement");
|
|
2027
|
-
const transitionStatus = store.useState("transitionStatus");
|
|
2028
|
-
const positionerElement = store.useState("positionerElement");
|
|
2029
|
-
const instantType = store.useState("instantType");
|
|
2030
|
-
const hasViewport = store.useState("hasViewport");
|
|
2031
|
-
const lastOpenChangeReason = store.useState("lastOpenChangeReason");
|
|
2032
|
-
const floatingNodeId = store.useState("floatingNodeId");
|
|
2033
|
-
const floatingParentNodeId = store.useState("floatingParentNodeId");
|
|
2034
|
-
const domReference = floatingRootContext.useState("domReferenceElement");
|
|
2035
|
-
const previousTriggerRef = React.useRef(null);
|
|
2036
|
-
const runOnceAnimationsFinish = useAnimationsFinished(positionerElement, false, false);
|
|
2037
|
-
let anchor = anchorProp;
|
|
2038
|
-
let sideOffset = sideOffsetProp;
|
|
2039
|
-
let alignOffset = alignOffsetProp;
|
|
2040
|
-
let align = alignProp;
|
|
2041
|
-
let collisionAvoidance = collisionAvoidanceProp;
|
|
2042
|
-
if (parent.type === "context-menu") {
|
|
2043
|
-
anchor = anchorProp ?? parent.context?.anchor;
|
|
2044
|
-
align = align ?? "start";
|
|
2045
|
-
if (!side && align !== "center") {
|
|
2046
|
-
alignOffset = componentProps.alignOffset ?? 2;
|
|
2047
|
-
sideOffset = componentProps.sideOffset ?? -5;
|
|
2048
|
-
}
|
|
2049
|
-
}
|
|
2050
|
-
let computedSide = side;
|
|
2051
|
-
let computedAlign = align;
|
|
2052
|
-
if (parent.type === "menu") {
|
|
2053
|
-
computedSide = computedSide ?? "inline-end";
|
|
2054
|
-
computedAlign = computedAlign ?? "start";
|
|
2055
|
-
collisionAvoidance = componentProps.collisionAvoidance ?? POPUP_COLLISION_AVOIDANCE;
|
|
2056
|
-
} else if (parent.type === "menubar") {
|
|
2057
|
-
computedSide = computedSide ?? "bottom";
|
|
2058
|
-
computedAlign = computedAlign ?? "start";
|
|
2059
|
-
}
|
|
2060
|
-
const contextMenu = parent.type === "context-menu";
|
|
2061
|
-
const positioner = useAnchorPositioning({
|
|
2062
|
-
anchor,
|
|
2063
|
-
floatingRootContext,
|
|
2064
|
-
positionMethod: contextMenuContext ? "fixed" : positionMethodProp,
|
|
2065
|
-
mounted,
|
|
2066
|
-
side: computedSide,
|
|
2067
|
-
sideOffset,
|
|
2068
|
-
align: computedAlign,
|
|
2069
|
-
alignOffset,
|
|
2070
|
-
arrowPadding: contextMenu ? 0 : arrowPadding,
|
|
2071
|
-
collisionBoundary,
|
|
2072
|
-
collisionPadding,
|
|
2073
|
-
sticky,
|
|
2074
|
-
nodeId: floatingNodeId,
|
|
2075
|
-
keepMounted,
|
|
2076
|
-
disableAnchorTracking,
|
|
2077
|
-
collisionAvoidance,
|
|
2078
|
-
shiftCrossAxis: contextMenu && !("side" in collisionAvoidance && collisionAvoidance.side === "flip"),
|
|
2079
|
-
externalTree: floatingTreeRoot,
|
|
2080
|
-
adaptiveOrigin: hasViewport ? adaptiveOrigin : void 0
|
|
2081
|
-
});
|
|
2082
|
-
React.useEffect(() => {
|
|
2083
|
-
function onMenuOpenChange(details) {
|
|
2084
|
-
if (details.open) {
|
|
2085
|
-
if (details.parentNodeId === floatingNodeId) store.set("hoverEnabled", false);
|
|
2086
|
-
if (details.nodeId !== floatingNodeId && details.parentNodeId === store.select("floatingParentNodeId")) store.setOpen(false, createChangeEventDetails(siblingOpen));
|
|
2087
|
-
}
|
|
2088
|
-
}
|
|
2089
|
-
floatingTreeRoot.events.on("menuopenchange", onMenuOpenChange);
|
|
2090
|
-
return () => {
|
|
2091
|
-
floatingTreeRoot.events.off("menuopenchange", onMenuOpenChange);
|
|
2092
|
-
};
|
|
2093
|
-
}, [
|
|
2094
|
-
store,
|
|
2095
|
-
floatingTreeRoot.events,
|
|
2096
|
-
floatingNodeId
|
|
2097
|
-
]);
|
|
2098
|
-
React.useEffect(() => {
|
|
2099
|
-
if (store.select("floatingParentNodeId") == null) return;
|
|
2100
|
-
function onParentClose(details) {
|
|
2101
|
-
if (details.open || details.nodeId !== store.select("floatingParentNodeId")) return;
|
|
2102
|
-
const reason = details.reason ?? "sibling-open";
|
|
2103
|
-
store.setOpen(false, createChangeEventDetails(reason));
|
|
2104
|
-
}
|
|
2105
|
-
floatingTreeRoot.events.on("menuopenchange", onParentClose);
|
|
2106
|
-
return () => {
|
|
2107
|
-
floatingTreeRoot.events.off("menuopenchange", onParentClose);
|
|
2108
|
-
};
|
|
2109
|
-
}, [floatingTreeRoot.events, store]);
|
|
2110
|
-
const closeTimeout = useTimeout();
|
|
2111
|
-
React.useEffect(() => {
|
|
2112
|
-
if (!open) closeTimeout.clear();
|
|
2113
|
-
}, [open, closeTimeout]);
|
|
2114
|
-
React.useEffect(() => {
|
|
2115
|
-
function onItemHover(event) {
|
|
2116
|
-
if (!open || event.nodeId !== store.select("floatingParentNodeId")) return;
|
|
2117
|
-
if (event.target && triggerElement && triggerElement !== event.target) {
|
|
2118
|
-
const delay = store.select("closeDelay");
|
|
2119
|
-
if (delay > 0) {
|
|
2120
|
-
if (!closeTimeout.isStarted()) closeTimeout.start(delay, () => {
|
|
2121
|
-
store.setOpen(false, createChangeEventDetails(siblingOpen));
|
|
2122
|
-
});
|
|
2123
|
-
} else store.setOpen(false, createChangeEventDetails(siblingOpen));
|
|
2124
|
-
} else closeTimeout.clear();
|
|
2125
|
-
}
|
|
2126
|
-
floatingTreeRoot.events.on("itemhover", onItemHover);
|
|
2127
|
-
return () => {
|
|
2128
|
-
floatingTreeRoot.events.off("itemhover", onItemHover);
|
|
2129
|
-
};
|
|
2130
|
-
}, [
|
|
2131
|
-
floatingTreeRoot.events,
|
|
2132
|
-
open,
|
|
2133
|
-
triggerElement,
|
|
2134
|
-
store,
|
|
2135
|
-
closeTimeout
|
|
2136
|
-
]);
|
|
2137
|
-
React.useEffect(() => {
|
|
2138
|
-
const eventDetails = {
|
|
2139
|
-
open,
|
|
2140
|
-
nodeId: floatingNodeId,
|
|
2141
|
-
parentNodeId: floatingParentNodeId,
|
|
2142
|
-
reason: store.select("lastOpenChangeReason")
|
|
2143
|
-
};
|
|
2144
|
-
floatingTreeRoot.events.emit("menuopenchange", eventDetails);
|
|
2145
|
-
}, [
|
|
2146
|
-
floatingTreeRoot.events,
|
|
2147
|
-
open,
|
|
2148
|
-
store,
|
|
2149
|
-
floatingNodeId,
|
|
2150
|
-
floatingParentNodeId
|
|
2151
|
-
]);
|
|
2152
|
-
useIsoLayoutEffect(() => {
|
|
2153
|
-
const currentTrigger = domReference;
|
|
2154
|
-
const previousTrigger = previousTriggerRef.current;
|
|
2155
|
-
if (currentTrigger) previousTriggerRef.current = currentTrigger;
|
|
2156
|
-
if (previousTrigger && currentTrigger && currentTrigger !== previousTrigger) {
|
|
2157
|
-
store.set("instantType", void 0);
|
|
2158
|
-
const abortController = new AbortController();
|
|
2159
|
-
runOnceAnimationsFinish(() => {
|
|
2160
|
-
store.set("instantType", "trigger-change");
|
|
2161
|
-
}, abortController.signal);
|
|
2162
|
-
return () => {
|
|
2163
|
-
abortController.abort();
|
|
2164
|
-
};
|
|
2165
|
-
}
|
|
2166
|
-
}, [
|
|
2167
|
-
domReference,
|
|
2168
|
-
runOnceAnimationsFinish,
|
|
2169
|
-
store
|
|
2170
|
-
]);
|
|
2171
|
-
const state = {
|
|
2172
|
-
open,
|
|
2173
|
-
side: positioner.side,
|
|
2174
|
-
align: positioner.align,
|
|
2175
|
-
anchorHidden: positioner.anchorHidden,
|
|
2176
|
-
nested: parent.type === "menu",
|
|
2177
|
-
instant: instantType
|
|
2178
|
-
};
|
|
2179
|
-
const menubarModal = parent.type === "menubar" && parent.context.modal;
|
|
2180
|
-
useAnchoredPopupScrollLock(open && (menubarModal || modal && lastOpenChangeReason !== "trigger-hover"), openMethod === "touch", positionerElement, triggerElement);
|
|
2181
|
-
const element = usePositioner(componentProps, state, {
|
|
2182
|
-
styles: positioner.positionerStyles,
|
|
2183
|
-
transitionStatus,
|
|
2184
|
-
props: elementProps,
|
|
2185
|
-
refs: [forwardedRef, store.useStateSetter("positionerElement")],
|
|
2186
|
-
hidden: !mounted,
|
|
2187
|
-
inert: !open
|
|
2188
|
-
});
|
|
2189
|
-
const shouldRenderBackdrop = mounted && parent.type !== "menu" && (parent.type !== "menubar" && modal && lastOpenChangeReason !== "trigger-hover" || parent.type === "menubar" && parent.context.modal);
|
|
2190
|
-
let backdropCutout = null;
|
|
2191
|
-
if (parent.type === "menubar") backdropCutout = parent.context.contentElement;
|
|
2192
|
-
else if (parent.type === void 0) backdropCutout = triggerElement;
|
|
2193
|
-
return /*#__PURE__*/ jsxs(MenuPositionerContext.Provider, {
|
|
2194
|
-
value: positioner,
|
|
2195
|
-
children: [shouldRenderBackdrop && /*#__PURE__*/ jsx(InternalBackdrop, {
|
|
2196
|
-
ref: parent.type === "context-menu" || parent.type === "nested-context-menu" ? parent.context.internalBackdropRef : null,
|
|
2197
|
-
inert: inertValue(!open),
|
|
2198
|
-
cutout: backdropCutout
|
|
2199
|
-
}), /*#__PURE__*/ jsx(FloatingNode, {
|
|
2200
|
-
id: floatingNodeId,
|
|
2201
|
-
children: /*#__PURE__*/ jsx(CompositeList, {
|
|
2202
|
-
elementsRef: store.context.itemDomElements,
|
|
2203
|
-
labelsRef: store.context.itemLabels,
|
|
2204
|
-
children: element
|
|
2205
|
-
})
|
|
2206
|
-
})]
|
|
2207
|
-
});
|
|
2208
|
-
});
|
|
2209
|
-
if (process.env.NODE_ENV !== "production") MenuPositioner.displayName = "MenuPositioner";
|
|
2210
|
-
//#endregion
|
|
2211
|
-
//#region ../../node_modules/.bun/@base-ui+react@1.4.1+fa6c2f29eeb10566/node_modules/@base-ui/react/esm/menu/radio-group/MenuRadioGroupContext.js
|
|
2212
|
-
var MenuRadioGroupContext = /*#__PURE__*/ React.createContext(void 0);
|
|
2213
|
-
if (process.env.NODE_ENV !== "production") MenuRadioGroupContext.displayName = "MenuRadioGroupContext";
|
|
2214
|
-
function useMenuRadioGroupContext() {
|
|
2215
|
-
const context = React.useContext(MenuRadioGroupContext);
|
|
2216
|
-
if (context === void 0) throw new Error(process.env.NODE_ENV !== "production" ? "Base UI: MenuRadioGroupContext is missing. MenuRadioGroup parts must be placed within <Menu.RadioGroup>." : formatErrorMessage(34));
|
|
2217
|
-
return context;
|
|
2218
|
-
}
|
|
2219
|
-
//#endregion
|
|
2220
|
-
//#region ../../node_modules/.bun/@base-ui+react@1.4.1+fa6c2f29eeb10566/node_modules/@base-ui/react/esm/menu/radio-group/MenuRadioGroup.js
|
|
2221
|
-
/**
|
|
2222
|
-
* Groups related radio items.
|
|
2223
|
-
* Renders a `<div>` element.
|
|
2224
|
-
*
|
|
2225
|
-
* Documentation: [Base UI Menu](https://base-ui.com/react/components/menu)
|
|
2226
|
-
*/
|
|
2227
|
-
var MenuRadioGroup = /*#__PURE__*/ React.memo(/*#__PURE__*/ React.forwardRef(function MenuRadioGroup(componentProps, forwardedRef) {
|
|
2228
|
-
const { render, className, value: valueProp, defaultValue, onValueChange: onValueChangeProp, disabled = false, style, ...elementProps } = componentProps;
|
|
2229
|
-
const [value, setValueUnwrapped] = useControlled({
|
|
2230
|
-
controlled: valueProp,
|
|
2231
|
-
default: defaultValue,
|
|
2232
|
-
name: "MenuRadioGroup"
|
|
2233
|
-
});
|
|
2234
|
-
const onValueChange = useStableCallback(onValueChangeProp);
|
|
2235
|
-
const setValue = useStableCallback((newValue, eventDetails) => {
|
|
2236
|
-
onValueChange?.(newValue, eventDetails);
|
|
2237
|
-
if (eventDetails.isCanceled) return;
|
|
2238
|
-
setValueUnwrapped(newValue);
|
|
2239
|
-
});
|
|
2240
|
-
const element = useRenderElement("div", componentProps, {
|
|
2241
|
-
state: { disabled },
|
|
2242
|
-
ref: forwardedRef,
|
|
2243
|
-
props: {
|
|
2244
|
-
role: "group",
|
|
2245
|
-
"aria-disabled": disabled || void 0,
|
|
2246
|
-
...elementProps
|
|
2247
|
-
}
|
|
2248
|
-
});
|
|
2249
|
-
const context = React.useMemo(() => ({
|
|
2250
|
-
value,
|
|
2251
|
-
setValue,
|
|
2252
|
-
disabled
|
|
2253
|
-
}), [
|
|
2254
|
-
value,
|
|
2255
|
-
setValue,
|
|
2256
|
-
disabled
|
|
2257
|
-
]);
|
|
2258
|
-
return /*#__PURE__*/ jsx(MenuRadioGroupContext.Provider, {
|
|
2259
|
-
value: context,
|
|
2260
|
-
children: element
|
|
2261
|
-
});
|
|
2262
|
-
}));
|
|
2263
|
-
if (process.env.NODE_ENV !== "production") MenuRadioGroup.displayName = "MenuRadioGroup";
|
|
2264
|
-
//#endregion
|
|
2265
|
-
//#region ../../node_modules/.bun/@base-ui+react@1.4.1+fa6c2f29eeb10566/node_modules/@base-ui/react/esm/menu/radio-item/MenuRadioItemContext.js
|
|
2266
|
-
var MenuRadioItemContext = /*#__PURE__*/ React.createContext(void 0);
|
|
2267
|
-
if (process.env.NODE_ENV !== "production") MenuRadioItemContext.displayName = "MenuRadioItemContext";
|
|
2268
|
-
function useMenuRadioItemContext() {
|
|
2269
|
-
const context = React.useContext(MenuRadioItemContext);
|
|
2270
|
-
if (context === void 0) throw new Error(process.env.NODE_ENV !== "production" ? "Base UI: MenuRadioItemContext is missing. MenuRadioItem parts must be placed within <Menu.RadioItem>." : formatErrorMessage(35));
|
|
2271
|
-
return context;
|
|
2272
|
-
}
|
|
2273
|
-
//#endregion
|
|
2274
|
-
//#region ../../node_modules/.bun/@base-ui+react@1.4.1+fa6c2f29eeb10566/node_modules/@base-ui/react/esm/menu/radio-item/MenuRadioItem.js
|
|
2275
|
-
/**
|
|
2276
|
-
* A menu item that works like a radio button in a given group.
|
|
2277
|
-
* Renders a `<div>` element.
|
|
2278
|
-
*
|
|
2279
|
-
* Documentation: [Base UI Menu](https://base-ui.com/react/components/menu)
|
|
2280
|
-
*/
|
|
2281
|
-
var MenuRadioItem = /*#__PURE__*/ React.forwardRef(function MenuRadioItem(componentProps, forwardedRef) {
|
|
2282
|
-
const { render, className, id: idProp, label, nativeButton = false, disabled: disabledProp = false, closeOnClick = false, value, style, ...elementProps } = componentProps;
|
|
2283
|
-
const listItem = useCompositeListItem({ label });
|
|
2284
|
-
const menuPositionerContext = useMenuPositionerContext(true);
|
|
2285
|
-
const id = useBaseUiId(idProp);
|
|
2286
|
-
const { store } = useMenuRootContext();
|
|
2287
|
-
const highlighted = store.useState("isActive", listItem.index);
|
|
2288
|
-
const itemProps = store.useState("itemProps");
|
|
2289
|
-
const { value: selectedValue, setValue: setSelectedValue, disabled: groupDisabled } = useMenuRadioGroupContext();
|
|
2290
|
-
const disabled = groupDisabled || disabledProp;
|
|
2291
|
-
const checked = selectedValue === value;
|
|
2292
|
-
const { getItemProps, itemRef } = useMenuItem({
|
|
2293
|
-
closeOnClick,
|
|
2294
|
-
disabled,
|
|
2295
|
-
highlighted,
|
|
2296
|
-
id,
|
|
2297
|
-
store,
|
|
2298
|
-
nativeButton,
|
|
2299
|
-
nodeId: menuPositionerContext?.context.nodeId,
|
|
2300
|
-
itemMetadata: REGULAR_ITEM
|
|
2301
|
-
});
|
|
2302
|
-
const state = React.useMemo(() => ({
|
|
2303
|
-
disabled,
|
|
2304
|
-
highlighted,
|
|
2305
|
-
checked
|
|
2306
|
-
}), [
|
|
2307
|
-
disabled,
|
|
2308
|
-
highlighted,
|
|
2309
|
-
checked
|
|
2310
|
-
]);
|
|
2311
|
-
const handleClick = useStableCallback((event) => {
|
|
2312
|
-
const details = {
|
|
2313
|
-
...createChangeEventDetails(itemPress, event.nativeEvent),
|
|
2314
|
-
preventUnmountOnClose: () => {}
|
|
2315
|
-
};
|
|
2316
|
-
setSelectedValue(value, details);
|
|
2317
|
-
});
|
|
2318
|
-
const element = useRenderElement("div", componentProps, {
|
|
2319
|
-
state,
|
|
2320
|
-
stateAttributesMapping: itemMapping,
|
|
2321
|
-
props: [
|
|
2322
|
-
itemProps,
|
|
2323
|
-
{
|
|
2324
|
-
role: "menuitemradio",
|
|
2325
|
-
"aria-checked": checked,
|
|
2326
|
-
onClick: handleClick
|
|
2327
|
-
},
|
|
2328
|
-
elementProps,
|
|
2329
|
-
getItemProps
|
|
2330
|
-
],
|
|
2331
|
-
ref: [
|
|
2332
|
-
itemRef,
|
|
2333
|
-
forwardedRef,
|
|
2334
|
-
listItem.ref
|
|
2335
|
-
]
|
|
2336
|
-
});
|
|
2337
|
-
return /*#__PURE__*/ jsx(MenuRadioItemContext.Provider, {
|
|
2338
|
-
value: state,
|
|
2339
|
-
children: element
|
|
2340
|
-
});
|
|
2341
|
-
});
|
|
2342
|
-
if (process.env.NODE_ENV !== "production") MenuRadioItem.displayName = "MenuRadioItem";
|
|
2343
|
-
//#endregion
|
|
2344
|
-
//#region ../../node_modules/.bun/@base-ui+react@1.4.1+fa6c2f29eeb10566/node_modules/@base-ui/react/esm/menu/radio-item-indicator/MenuRadioItemIndicator.js
|
|
2345
|
-
/**
|
|
2346
|
-
* Indicates whether the radio item is selected.
|
|
2347
|
-
* Renders a `<span>` element.
|
|
2348
|
-
*
|
|
2349
|
-
* Documentation: [Base UI Menu](https://base-ui.com/react/components/menu)
|
|
2350
|
-
*/
|
|
2351
|
-
var MenuRadioItemIndicator = /*#__PURE__*/ React.forwardRef(function MenuRadioItemIndicator(componentProps, forwardedRef) {
|
|
2352
|
-
const { render, className, style, keepMounted = false, ...elementProps } = componentProps;
|
|
2353
|
-
const item = useMenuRadioItemContext();
|
|
2354
|
-
const indicatorRef = React.useRef(null);
|
|
2355
|
-
const { transitionStatus, setMounted } = useTransitionStatus(item.checked);
|
|
2356
|
-
useOpenChangeComplete({
|
|
2357
|
-
open: item.checked,
|
|
2358
|
-
ref: indicatorRef,
|
|
2359
|
-
onComplete() {
|
|
2360
|
-
if (!item.checked) setMounted(false);
|
|
2361
|
-
}
|
|
2362
|
-
});
|
|
2363
|
-
const state = {
|
|
2364
|
-
checked: item.checked,
|
|
2365
|
-
disabled: item.disabled,
|
|
2366
|
-
highlighted: item.highlighted,
|
|
2367
|
-
transitionStatus
|
|
2368
|
-
};
|
|
2369
|
-
return useRenderElement("span", componentProps, {
|
|
2370
|
-
state,
|
|
2371
|
-
stateAttributesMapping: itemMapping,
|
|
2372
|
-
ref: [forwardedRef, indicatorRef],
|
|
2373
|
-
props: {
|
|
2374
|
-
"aria-hidden": true,
|
|
2375
|
-
...elementProps
|
|
2376
|
-
},
|
|
2377
|
-
enabled: keepMounted || item.checked
|
|
2378
|
-
});
|
|
2379
|
-
});
|
|
2380
|
-
if (process.env.NODE_ENV !== "production") MenuRadioItemIndicator.displayName = "MenuRadioItemIndicator";
|
|
2381
|
-
//#endregion
|
|
2382
|
-
//#region ../../node_modules/.bun/@base-ui+react@1.4.1+fa6c2f29eeb10566/node_modules/@base-ui/react/esm/menubar/MenubarContext.js
|
|
2383
|
-
var MenubarContext = /*#__PURE__*/ React.createContext(null);
|
|
2384
|
-
if (process.env.NODE_ENV !== "production") MenubarContext.displayName = "MenubarContext";
|
|
2385
|
-
function useMenubarContext(optional) {
|
|
2386
|
-
const context = React.useContext(MenubarContext);
|
|
2387
|
-
if (context === null && !optional) throw new Error(process.env.NODE_ENV !== "production" ? "Base UI: MenubarContext is missing. Menubar parts must be placed within <Menubar>." : formatErrorMessage(5));
|
|
2388
|
-
return context;
|
|
2389
|
-
}
|
|
2390
|
-
//#endregion
|
|
2391
|
-
//#region ../../node_modules/.bun/@base-ui+react@1.4.1+fa6c2f29eeb10566/node_modules/@base-ui/react/esm/menu/store/MenuStore.js
|
|
2392
|
-
var selectors$1 = {
|
|
2393
|
-
...popupStoreSelectors,
|
|
2394
|
-
disabled: createSelector((state) => state.parent.type === "menubar" ? state.parent.context.disabled || state.disabled : state.disabled),
|
|
2395
|
-
modal: createSelector((state) => (state.parent.type === void 0 || state.parent.type === "context-menu") && (state.modal ?? true)),
|
|
2396
|
-
openMethod: createSelector((state) => state.openMethod),
|
|
2397
|
-
allowMouseEnter: createSelector((state) => state.allowMouseEnter),
|
|
2398
|
-
stickIfOpen: createSelector((state) => state.stickIfOpen),
|
|
2399
|
-
parent: createSelector((state) => state.parent),
|
|
2400
|
-
rootId: createSelector((state) => {
|
|
2401
|
-
if (state.parent.type === "menu") return state.parent.store.select("rootId");
|
|
2402
|
-
return state.parent.type !== void 0 ? state.parent.context.rootId : state.rootId;
|
|
2403
|
-
}),
|
|
2404
|
-
activeIndex: createSelector((state) => state.activeIndex),
|
|
2405
|
-
isActive: createSelector((state, itemIndex) => state.activeIndex === itemIndex),
|
|
2406
|
-
hoverEnabled: createSelector((state) => state.hoverEnabled),
|
|
2407
|
-
instantType: createSelector((state) => state.instantType),
|
|
2408
|
-
lastOpenChangeReason: createSelector((state) => state.openChangeReason),
|
|
2409
|
-
floatingTreeRoot: createSelector((state) => {
|
|
2410
|
-
if (state.parent.type === "menu") return state.parent.store.select("floatingTreeRoot");
|
|
2411
|
-
return state.floatingTreeRoot;
|
|
2412
|
-
}),
|
|
2413
|
-
floatingNodeId: createSelector((state) => state.floatingNodeId),
|
|
2414
|
-
floatingParentNodeId: createSelector((state) => state.floatingParentNodeId),
|
|
2415
|
-
itemProps: createSelector((state) => state.itemProps),
|
|
2416
|
-
closeDelay: createSelector((state) => state.closeDelay),
|
|
2417
|
-
hasViewport: createSelector((state) => state.hasViewport),
|
|
2418
|
-
keyboardEventRelay: createSelector((state) => {
|
|
2419
|
-
if (state.keyboardEventRelay) return state.keyboardEventRelay;
|
|
2420
|
-
if (state.parent.type === "menu") return state.parent.store.select("keyboardEventRelay");
|
|
2421
|
-
})
|
|
2422
|
-
};
|
|
2423
|
-
var MenuStore = class MenuStore extends ReactStore {
|
|
2424
|
-
constructor(initialState) {
|
|
2425
|
-
super({
|
|
2426
|
-
...createInitialState(),
|
|
2427
|
-
...initialState
|
|
2428
|
-
}, {
|
|
2429
|
-
positionerRef: /*#__PURE__*/ React.createRef(),
|
|
2430
|
-
popupRef: /*#__PURE__*/ React.createRef(),
|
|
2431
|
-
typingRef: { current: false },
|
|
2432
|
-
itemDomElements: { current: [] },
|
|
2433
|
-
itemLabels: { current: [] },
|
|
2434
|
-
allowMouseUpTriggerRef: { current: false },
|
|
2435
|
-
triggerFocusTargetRef: /*#__PURE__*/ React.createRef(),
|
|
2436
|
-
beforeContentFocusGuardRef: /*#__PURE__*/ React.createRef(),
|
|
2437
|
-
onOpenChangeComplete: void 0,
|
|
2438
|
-
triggerElements: new PopupTriggerMap()
|
|
2439
|
-
}, selectors$1);
|
|
2440
|
-
this.unsubscribeParentListener = this.observe("parent", (parent) => {
|
|
2441
|
-
this.unsubscribeParentListener?.();
|
|
2442
|
-
if (parent.type === "menu") {
|
|
2443
|
-
let rootId = parent.store.select("rootId");
|
|
2444
|
-
let floatingTreeRoot = parent.store.select("floatingTreeRoot");
|
|
2445
|
-
let keyboardEventRelay = parent.store.select("keyboardEventRelay");
|
|
2446
|
-
this.unsubscribeParentListener = parent.store.subscribe(() => {
|
|
2447
|
-
const nextRootId = parent.store.select("rootId");
|
|
2448
|
-
const nextFloatingTreeRoot = parent.store.select("floatingTreeRoot");
|
|
2449
|
-
const nextKeyboardEventRelay = parent.store.select("keyboardEventRelay");
|
|
2450
|
-
if (rootId === nextRootId && floatingTreeRoot === nextFloatingTreeRoot && keyboardEventRelay === nextKeyboardEventRelay) return;
|
|
2451
|
-
rootId = nextRootId;
|
|
2452
|
-
floatingTreeRoot = nextFloatingTreeRoot;
|
|
2453
|
-
keyboardEventRelay = nextKeyboardEventRelay;
|
|
2454
|
-
this.notifyAll();
|
|
2455
|
-
});
|
|
2456
|
-
this.context.allowMouseUpTriggerRef = parent.store.context.allowMouseUpTriggerRef;
|
|
2457
|
-
return;
|
|
2458
|
-
}
|
|
2459
|
-
if (parent.type !== void 0) this.context.allowMouseUpTriggerRef = parent.context.allowMouseUpTriggerRef;
|
|
2460
|
-
this.unsubscribeParentListener = null;
|
|
2461
|
-
});
|
|
2462
|
-
}
|
|
2463
|
-
setOpen(open, eventDetails) {
|
|
2464
|
-
this.state.floatingRootContext.context.events.emit("setOpen", {
|
|
2465
|
-
open,
|
|
2466
|
-
eventDetails
|
|
2467
|
-
});
|
|
2468
|
-
}
|
|
2469
|
-
static useStore(externalStore, initialState) {
|
|
2470
|
-
const internalStore = useRefWithInit(() => {
|
|
2471
|
-
return new MenuStore(initialState);
|
|
2472
|
-
}).current;
|
|
2473
|
-
return externalStore ?? internalStore;
|
|
2474
|
-
}
|
|
2475
|
-
unsubscribeParentListener = null;
|
|
2476
|
-
};
|
|
2477
|
-
function createInitialState() {
|
|
2478
|
-
return {
|
|
2479
|
-
...createInitialPopupStoreState(),
|
|
2480
|
-
disabled: false,
|
|
2481
|
-
modal: true,
|
|
2482
|
-
openMethod: null,
|
|
2483
|
-
allowMouseEnter: false,
|
|
2484
|
-
stickIfOpen: true,
|
|
2485
|
-
parent: { type: void 0 },
|
|
2486
|
-
rootId: void 0,
|
|
2487
|
-
activeIndex: null,
|
|
2488
|
-
hoverEnabled: true,
|
|
2489
|
-
instantType: void 0,
|
|
2490
|
-
openChangeReason: null,
|
|
2491
|
-
floatingTreeRoot: new FloatingTreeStore(),
|
|
2492
|
-
floatingNodeId: void 0,
|
|
2493
|
-
floatingParentNodeId: null,
|
|
2494
|
-
itemProps: EMPTY_OBJECT,
|
|
2495
|
-
keyboardEventRelay: void 0,
|
|
2496
|
-
closeDelay: 0,
|
|
2497
|
-
hasViewport: false
|
|
2498
|
-
};
|
|
2499
|
-
}
|
|
2500
|
-
//#endregion
|
|
2501
|
-
//#region ../../node_modules/.bun/@base-ui+react@1.4.1+fa6c2f29eeb10566/node_modules/@base-ui/react/esm/menu/submenu-root/MenuSubmenuRootContext.js
|
|
2502
|
-
var MenuSubmenuRootContext = /*#__PURE__*/ React.createContext(void 0);
|
|
2503
|
-
if (process.env.NODE_ENV !== "production") MenuSubmenuRootContext.displayName = "MenuSubmenuRootContext";
|
|
2504
|
-
function useMenuSubmenuRootContext() {
|
|
2505
|
-
return React.useContext(MenuSubmenuRootContext);
|
|
2506
|
-
}
|
|
2507
|
-
//#endregion
|
|
2508
|
-
//#region ../../node_modules/.bun/@base-ui+react@1.4.1+fa6c2f29eeb10566/node_modules/@base-ui/react/esm/menu/root/MenuRoot.js
|
|
2509
|
-
/**
|
|
2510
|
-
* Groups all parts of the menu.
|
|
2511
|
-
* Doesn't render its own HTML element.
|
|
2512
|
-
*
|
|
2513
|
-
* Documentation: [Base UI Menu](https://base-ui.com/react/components/menu)
|
|
2514
|
-
*/
|
|
2515
|
-
var MenuRoot = fastComponent(function MenuRoot(props) {
|
|
2516
|
-
const { children, open: openProp, onOpenChange, onOpenChangeComplete, defaultOpen = false, disabled: disabledProp = false, modal: modalProp, loopFocus = true, orientation = "vertical", actionsRef, closeParentOnEsc = false, handle, triggerId: triggerIdProp, defaultTriggerId: defaultTriggerIdProp = null, highlightItemOnHover = true } = props;
|
|
2517
|
-
const contextMenuContext = useContextMenuRootContext(true);
|
|
2518
|
-
const parentMenuRootContext = useMenuRootContext(true);
|
|
2519
|
-
const menubarContext = useMenubarContext(true);
|
|
2520
|
-
const isSubmenu = useMenuSubmenuRootContext();
|
|
2521
|
-
const parentFromContext = React.useMemo(() => {
|
|
2522
|
-
if (isSubmenu && parentMenuRootContext) return {
|
|
2523
|
-
type: "menu",
|
|
2524
|
-
store: parentMenuRootContext.store
|
|
2525
|
-
};
|
|
2526
|
-
if (menubarContext) return {
|
|
2527
|
-
type: "menubar",
|
|
2528
|
-
context: menubarContext
|
|
2529
|
-
};
|
|
2530
|
-
if (contextMenuContext && !parentMenuRootContext) return {
|
|
2531
|
-
type: "context-menu",
|
|
2532
|
-
context: contextMenuContext
|
|
2533
|
-
};
|
|
2534
|
-
return { type: void 0 };
|
|
2535
|
-
}, [
|
|
2536
|
-
contextMenuContext,
|
|
2537
|
-
parentMenuRootContext,
|
|
2538
|
-
menubarContext,
|
|
2539
|
-
isSubmenu
|
|
2540
|
-
]);
|
|
2541
|
-
const store = MenuStore.useStore(handle?.store, {
|
|
2542
|
-
open: defaultOpen,
|
|
2543
|
-
openProp,
|
|
2544
|
-
activeTriggerId: defaultTriggerIdProp,
|
|
2545
|
-
triggerIdProp,
|
|
2546
|
-
parent: parentFromContext
|
|
2547
|
-
});
|
|
2548
|
-
useOnFirstRender(() => {
|
|
2549
|
-
if (openProp === void 0 && store.state.open === false && defaultOpen === true) store.update({
|
|
2550
|
-
open: true,
|
|
2551
|
-
activeTriggerId: defaultTriggerIdProp
|
|
2552
|
-
});
|
|
2553
|
-
});
|
|
2554
|
-
store.useControlledProp("openProp", openProp);
|
|
2555
|
-
store.useControlledProp("triggerIdProp", triggerIdProp);
|
|
2556
|
-
store.useContextCallback("onOpenChangeComplete", onOpenChangeComplete);
|
|
2557
|
-
const floatingTreeRoot = store.useState("floatingTreeRoot");
|
|
2558
|
-
const floatingNodeIdFromContext = useFloatingNodeId(floatingTreeRoot);
|
|
2559
|
-
const floatingParentNodeIdFromContext = useFloatingParentNodeId();
|
|
2560
|
-
useIsoLayoutEffect(() => {
|
|
2561
|
-
if (contextMenuContext && !parentMenuRootContext) store.update({
|
|
2562
|
-
parent: {
|
|
2563
|
-
type: "context-menu",
|
|
2564
|
-
context: contextMenuContext
|
|
2565
|
-
},
|
|
2566
|
-
floatingNodeId: floatingNodeIdFromContext,
|
|
2567
|
-
floatingParentNodeId: floatingParentNodeIdFromContext
|
|
2568
|
-
});
|
|
2569
|
-
else if (parentMenuRootContext) store.update({
|
|
2570
|
-
floatingNodeId: floatingNodeIdFromContext,
|
|
2571
|
-
floatingParentNodeId: floatingParentNodeIdFromContext
|
|
2572
|
-
});
|
|
2573
|
-
}, [
|
|
2574
|
-
contextMenuContext,
|
|
2575
|
-
parentMenuRootContext,
|
|
2576
|
-
floatingNodeIdFromContext,
|
|
2577
|
-
floatingParentNodeIdFromContext,
|
|
2578
|
-
store
|
|
2579
|
-
]);
|
|
2580
|
-
const open = store.useState("open");
|
|
2581
|
-
const activeTriggerElement = store.useState("activeTriggerElement");
|
|
2582
|
-
const positionerElement = store.useState("positionerElement");
|
|
2583
|
-
const hoverEnabled = store.useState("hoverEnabled");
|
|
2584
|
-
const disabled = store.useState("disabled");
|
|
2585
|
-
const lastOpenChangeReason = store.useState("lastOpenChangeReason");
|
|
2586
|
-
const parent = store.useState("parent");
|
|
2587
|
-
const activeIndex = store.useState("activeIndex");
|
|
2588
|
-
const payload = store.useState("payload");
|
|
2589
|
-
const floatingParentNodeId = store.useState("floatingParentNodeId");
|
|
2590
|
-
const openEventRef = React.useRef(null);
|
|
2591
|
-
const nested = floatingParentNodeId != null;
|
|
2592
|
-
if (process.env.NODE_ENV !== "production") {
|
|
2593
|
-
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.");
|
|
2594
|
-
}
|
|
2595
|
-
const { openMethod, triggerProps: interactionTypeProps } = useOpenInteractionType(open);
|
|
2596
|
-
store.useSyncedValues({
|
|
2597
|
-
disabled: disabledProp,
|
|
2598
|
-
modal: parent.type === void 0 ? modalProp : void 0,
|
|
2599
|
-
openMethod,
|
|
2600
|
-
rootId: useId$1()
|
|
2601
|
-
});
|
|
2602
|
-
useImplicitActiveTrigger(store);
|
|
2603
|
-
const { forceUnmount } = useOpenStateTransitions(open, store, () => {
|
|
2604
|
-
store.update({
|
|
2605
|
-
allowMouseEnter: false,
|
|
2606
|
-
stickIfOpen: true
|
|
2607
|
-
});
|
|
2608
|
-
});
|
|
2609
|
-
const allowOutsidePressDismissalRef = React.useRef(parent.type !== "context-menu");
|
|
2610
|
-
const allowOutsidePressDismissalTimeout = useTimeout();
|
|
2611
|
-
React.useEffect(() => {
|
|
2612
|
-
if (!open) openEventRef.current = null;
|
|
2613
|
-
if (parent.type !== "context-menu") return;
|
|
2614
|
-
if (!open) {
|
|
2615
|
-
allowOutsidePressDismissalTimeout.clear();
|
|
2616
|
-
allowOutsidePressDismissalRef.current = false;
|
|
2617
|
-
return;
|
|
2618
|
-
}
|
|
2619
|
-
allowOutsidePressDismissalTimeout.start(500, () => {
|
|
2620
|
-
allowOutsidePressDismissalRef.current = true;
|
|
2621
|
-
});
|
|
2622
|
-
}, [
|
|
2623
|
-
allowOutsidePressDismissalTimeout,
|
|
2624
|
-
open,
|
|
2625
|
-
parent.type
|
|
2626
|
-
]);
|
|
2627
|
-
useIsoLayoutEffect(() => {
|
|
2628
|
-
if (!open && !hoverEnabled) store.set("hoverEnabled", true);
|
|
2629
|
-
}, [
|
|
2630
|
-
open,
|
|
2631
|
-
hoverEnabled,
|
|
2632
|
-
store
|
|
2633
|
-
]);
|
|
2634
|
-
const allowTouchToCloseRef = React.useRef(true);
|
|
2635
|
-
const allowTouchToCloseTimeout = useTimeout();
|
|
2636
|
-
const setOpen = useStableCallback((nextOpen, eventDetails) => {
|
|
2637
|
-
const reason = eventDetails.reason;
|
|
2638
|
-
if (open === nextOpen && eventDetails.trigger === activeTriggerElement && lastOpenChangeReason === reason) return;
|
|
2639
|
-
eventDetails.preventUnmountOnClose = () => {
|
|
2640
|
-
store.set("preventUnmountingOnClose", true);
|
|
2641
|
-
};
|
|
2642
|
-
if (!nextOpen && eventDetails.trigger == null) eventDetails.trigger = activeTriggerElement ?? void 0;
|
|
2643
|
-
onOpenChange?.(nextOpen, eventDetails);
|
|
2644
|
-
if (eventDetails.isCanceled) return;
|
|
2645
|
-
store.state.floatingRootContext.dispatchOpenChange(nextOpen, eventDetails);
|
|
2646
|
-
const nativeEvent = eventDetails.event;
|
|
2647
|
-
if (nextOpen === false && nativeEvent?.type === "click" && nativeEvent.pointerType === "touch" && !allowTouchToCloseRef.current) return;
|
|
2648
|
-
if (!nextOpen && activeIndex !== null) {
|
|
2649
|
-
const activeOption = store.context.itemDomElements.current[activeIndex];
|
|
2650
|
-
queueMicrotask(() => {
|
|
2651
|
-
activeOption?.setAttribute("tabindex", "-1");
|
|
2652
|
-
});
|
|
2653
|
-
}
|
|
2654
|
-
if (nextOpen && reason === "trigger-focus") {
|
|
2655
|
-
allowTouchToCloseRef.current = false;
|
|
2656
|
-
allowTouchToCloseTimeout.start(300, () => {
|
|
2657
|
-
allowTouchToCloseRef.current = true;
|
|
2658
|
-
});
|
|
2659
|
-
} else {
|
|
2660
|
-
allowTouchToCloseRef.current = true;
|
|
2661
|
-
allowTouchToCloseTimeout.clear();
|
|
2662
|
-
}
|
|
2663
|
-
const isKeyboardClick = (reason === "trigger-press" || reason === "item-press") && nativeEvent.detail === 0 && nativeEvent?.isTrusted;
|
|
2664
|
-
const isDismissClose = !nextOpen && (reason === "escape-key" || reason == null);
|
|
2665
|
-
const updatedState = {
|
|
2666
|
-
open: nextOpen,
|
|
2667
|
-
openChangeReason: reason
|
|
2668
|
-
};
|
|
2669
|
-
openEventRef.current = eventDetails.event ?? null;
|
|
2670
|
-
const newTriggerId = eventDetails.trigger?.id ?? null;
|
|
2671
|
-
if (newTriggerId || nextOpen) {
|
|
2672
|
-
updatedState.activeTriggerId = newTriggerId;
|
|
2673
|
-
updatedState.activeTriggerElement = eventDetails.trigger ?? null;
|
|
2674
|
-
}
|
|
2675
|
-
store.update(updatedState);
|
|
2676
|
-
if (parent.type === "menubar" && (reason === "trigger-focus" || reason === "focus-out" || reason === "trigger-hover" || reason === "list-navigation" || reason === "sibling-open")) store.set("instantType", "group");
|
|
2677
|
-
else if (isKeyboardClick || isDismissClose) store.set("instantType", isKeyboardClick ? "click" : "dismiss");
|
|
2678
|
-
else store.set("instantType", void 0);
|
|
2679
|
-
});
|
|
2680
|
-
const handleImperativeClose = React.useCallback(() => {
|
|
2681
|
-
store.setOpen(false, createChangeEventDetails(imperativeAction));
|
|
2682
|
-
}, [store]);
|
|
2683
|
-
React.useImperativeHandle(actionsRef, () => ({
|
|
2684
|
-
unmount: forceUnmount,
|
|
2685
|
-
close: handleImperativeClose
|
|
2686
|
-
}), [forceUnmount, handleImperativeClose]);
|
|
2687
|
-
let ctx;
|
|
2688
|
-
if (parent.type === "context-menu") ctx = parent.context;
|
|
2689
|
-
React.useImperativeHandle(ctx?.positionerRef, () => positionerElement, [positionerElement]);
|
|
2690
|
-
React.useImperativeHandle(ctx?.actionsRef, () => ({ setOpen }), [setOpen]);
|
|
2691
|
-
const floatingRootContext = useSyncedFloatingRootContext({
|
|
2692
|
-
popupStore: store,
|
|
2693
|
-
onOpenChange: setOpen
|
|
2694
|
-
});
|
|
2695
|
-
const floatingEvents = floatingRootContext.context.events;
|
|
2696
|
-
React.useEffect(() => {
|
|
2697
|
-
const handleSetOpenEvent = ({ open: nextOpen, eventDetails }) => setOpen(nextOpen, eventDetails);
|
|
2698
|
-
floatingEvents.on("setOpen", handleSetOpenEvent);
|
|
2699
|
-
return () => {
|
|
2700
|
-
floatingEvents?.off("setOpen", handleSetOpenEvent);
|
|
2701
|
-
};
|
|
2702
|
-
}, [floatingEvents, setOpen]);
|
|
2703
|
-
const dismiss = useDismiss(floatingRootContext, {
|
|
2704
|
-
enabled: !disabled,
|
|
2705
|
-
bubbles: { escapeKey: closeParentOnEsc && parent.type === "menu" },
|
|
2706
|
-
outsidePress() {
|
|
2707
|
-
if (parent.type !== "context-menu" || openEventRef.current?.type === "contextmenu") return true;
|
|
2708
|
-
return allowOutsidePressDismissalRef.current;
|
|
2709
|
-
},
|
|
2710
|
-
externalTree: nested ? floatingTreeRoot : void 0
|
|
2711
|
-
});
|
|
2712
|
-
const role = useRole(floatingRootContext, { role: "menu" });
|
|
2713
|
-
const direction = useDirection();
|
|
2714
|
-
const setActiveIndex = React.useCallback((index) => {
|
|
2715
|
-
if (store.select("activeIndex") === index) return;
|
|
2716
|
-
store.set("activeIndex", index);
|
|
2717
|
-
}, [store]);
|
|
2718
|
-
const listNavigation$1 = useListNavigation(floatingRootContext, {
|
|
2719
|
-
enabled: !disabled,
|
|
2720
|
-
listRef: store.context.itemDomElements,
|
|
2721
|
-
activeIndex,
|
|
2722
|
-
nested: parent.type !== void 0,
|
|
2723
|
-
loopFocus,
|
|
2724
|
-
orientation,
|
|
2725
|
-
parentOrientation: parent.type === "menubar" ? parent.context.orientation : void 0,
|
|
2726
|
-
rtl: direction === "rtl",
|
|
2727
|
-
disabledIndices: EMPTY_ARRAY$1,
|
|
2728
|
-
onNavigate: setActiveIndex,
|
|
2729
|
-
openOnArrowKeyDown: parent.type !== "context-menu",
|
|
2730
|
-
externalTree: nested ? floatingTreeRoot : void 0,
|
|
2731
|
-
focusItemOnHover: highlightItemOnHover
|
|
2732
|
-
});
|
|
2733
|
-
const onTypingChange = React.useCallback((nextTyping) => {
|
|
2734
|
-
store.context.typingRef.current = nextTyping;
|
|
2735
|
-
}, [store]);
|
|
2736
|
-
const typeahead = useTypeahead(floatingRootContext, {
|
|
2737
|
-
listRef: store.context.itemLabels,
|
|
2738
|
-
elementsRef: store.context.itemDomElements,
|
|
2739
|
-
activeIndex,
|
|
2740
|
-
resetMs: 500,
|
|
2741
|
-
onMatch: (index) => {
|
|
2742
|
-
if (open && index !== activeIndex) store.set("activeIndex", index);
|
|
2743
|
-
},
|
|
2744
|
-
onTypingChange
|
|
2745
|
-
});
|
|
2746
|
-
const { getReferenceProps, getFloatingProps, getItemProps, getTriggerProps } = useInteractions([
|
|
2747
|
-
dismiss,
|
|
2748
|
-
role,
|
|
2749
|
-
listNavigation$1,
|
|
2750
|
-
typeahead
|
|
2751
|
-
]);
|
|
2752
|
-
const activeTriggerProps = React.useMemo(() => {
|
|
2753
|
-
const mergedProps = mergeProps(getReferenceProps(), { onMouseMove() {
|
|
2754
|
-
store.set("allowMouseEnter", true);
|
|
2755
|
-
} }, interactionTypeProps);
|
|
2756
|
-
delete mergedProps.role;
|
|
2757
|
-
return mergedProps;
|
|
2758
|
-
}, [
|
|
2759
|
-
getReferenceProps,
|
|
2760
|
-
store,
|
|
2761
|
-
interactionTypeProps
|
|
2762
|
-
]);
|
|
2763
|
-
const inactiveTriggerProps = React.useMemo(() => {
|
|
2764
|
-
const triggerProps = getTriggerProps();
|
|
2765
|
-
if (!triggerProps) return triggerProps;
|
|
2766
|
-
const mergedProps = mergeProps(triggerProps, interactionTypeProps);
|
|
2767
|
-
delete mergedProps.role;
|
|
2768
|
-
delete mergedProps["aria-controls"];
|
|
2769
|
-
return mergedProps;
|
|
2770
|
-
}, [getTriggerProps, interactionTypeProps]);
|
|
2771
|
-
const popupProps = React.useMemo(() => getFloatingProps({
|
|
2772
|
-
onMouseMove() {
|
|
2773
|
-
store.set("allowMouseEnter", true);
|
|
2774
|
-
if (parent.type === "menu") store.set("hoverEnabled", false);
|
|
2775
|
-
},
|
|
2776
|
-
onClick() {
|
|
2777
|
-
if (store.select("hoverEnabled")) store.set("hoverEnabled", false);
|
|
2778
|
-
},
|
|
2779
|
-
onKeyDown(event) {
|
|
2780
|
-
const relay = store.select("keyboardEventRelay");
|
|
2781
|
-
if (relay && !event.isPropagationStopped()) relay(event);
|
|
2782
|
-
}
|
|
2783
|
-
}), [
|
|
2784
|
-
getFloatingProps,
|
|
2785
|
-
parent.type,
|
|
2786
|
-
store
|
|
2787
|
-
]);
|
|
2788
|
-
const itemProps = React.useMemo(() => getItemProps(), [getItemProps]);
|
|
2789
|
-
store.useSyncedValues({
|
|
2790
|
-
floatingRootContext,
|
|
2791
|
-
activeTriggerProps,
|
|
2792
|
-
inactiveTriggerProps,
|
|
2793
|
-
popupProps,
|
|
2794
|
-
itemProps
|
|
2795
|
-
});
|
|
2796
|
-
const context = React.useMemo(() => ({
|
|
2797
|
-
store,
|
|
2798
|
-
parent: parentFromContext
|
|
2799
|
-
}), [store, parentFromContext]);
|
|
2800
|
-
const content = /*#__PURE__*/ jsx(MenuRootContext.Provider, {
|
|
2801
|
-
value: context,
|
|
2802
|
-
children: typeof children === "function" ? children({ payload }) : children
|
|
2803
|
-
});
|
|
2804
|
-
if (parent.type === void 0 || parent.type === "context-menu") return /*#__PURE__*/ jsx(FloatingTree, {
|
|
2805
|
-
externalTree: floatingTreeRoot,
|
|
2806
|
-
children: content
|
|
2807
|
-
});
|
|
2808
|
-
return content;
|
|
2809
|
-
});
|
|
2810
|
-
if (process.env.NODE_ENV !== "production") MenuRoot.displayName = "MenuRoot";
|
|
2811
|
-
//#endregion
|
|
2812
|
-
//#region ../../node_modules/.bun/@base-ui+react@1.4.1+fa6c2f29eeb10566/node_modules/@base-ui/react/esm/menu/submenu-root/MenuSubmenuRoot.js
|
|
2813
|
-
/**
|
|
2814
|
-
* Groups all parts of a submenu.
|
|
2815
|
-
* Doesn't render its own HTML element.
|
|
2816
|
-
*
|
|
2817
|
-
* Documentation: [Base UI Menu](https://base-ui.com/react/components/menu)
|
|
2818
|
-
*/
|
|
2819
|
-
function MenuSubmenuRoot(props) {
|
|
2820
|
-
const parentMenu = useMenuRootContext().store;
|
|
2821
|
-
const contextValue = React.useMemo(() => ({ parentMenu }), [parentMenu]);
|
|
2822
|
-
return /*#__PURE__*/ jsx(MenuSubmenuRootContext.Provider, {
|
|
2823
|
-
value: contextValue,
|
|
2824
|
-
children: /*#__PURE__*/ jsx(MenuRoot, { ...props })
|
|
2825
|
-
});
|
|
2826
|
-
}
|
|
2827
|
-
//#endregion
|
|
2828
|
-
//#region ../../node_modules/.bun/@base-ui+react@1.4.1+fa6c2f29eeb10566/node_modules/@base-ui/react/esm/internals/composite/item/CompositeItem.js
|
|
2829
|
-
/**
|
|
2830
|
-
* @internal
|
|
2831
|
-
*/
|
|
2832
|
-
function CompositeItem(componentProps) {
|
|
2833
|
-
const { render, className, style, state = EMPTY_OBJECT, props = EMPTY_ARRAY$1, refs = EMPTY_ARRAY$1, metadata, stateAttributesMapping, tag = "div", ...elementProps } = componentProps;
|
|
2834
|
-
const { compositeProps, compositeRef } = useCompositeItem({ metadata });
|
|
2835
|
-
return useRenderElement(tag, componentProps, {
|
|
2836
|
-
state,
|
|
2837
|
-
ref: [...refs, compositeRef],
|
|
2838
|
-
props: [
|
|
2839
|
-
compositeProps,
|
|
2840
|
-
...props,
|
|
2841
|
-
elementProps
|
|
2842
|
-
],
|
|
2843
|
-
stateAttributesMapping
|
|
2844
|
-
});
|
|
2845
|
-
}
|
|
2846
|
-
//#endregion
|
|
2847
|
-
//#region ../../node_modules/.bun/@base-ui+react@1.4.1+fa6c2f29eeb10566/node_modules/@base-ui/react/esm/menu/utils/findRootOwnerId.js
|
|
2848
|
-
function findRootOwnerId(node) {
|
|
2849
|
-
if (isHTMLElement(node) && node.hasAttribute("data-rootownerid")) return node.getAttribute("data-rootownerid") ?? void 0;
|
|
2850
|
-
if (isLastTraversableNode(node)) return;
|
|
2851
|
-
return findRootOwnerId(getParentNode(node));
|
|
2852
|
-
}
|
|
2853
|
-
//#endregion
|
|
2854
|
-
//#region ../../node_modules/.bun/@base-ui+react@1.4.1+fa6c2f29eeb10566/node_modules/@base-ui/react/esm/utils/useMixedToggleClickHandler.js
|
|
2855
|
-
/**
|
|
2856
|
-
* Returns `click` and `mousedown` handlers that fix the behavior of triggers of popups that are toggled by different events.
|
|
2857
|
-
* For example, a button that opens a popup on mousedown and closes it on click.
|
|
2858
|
-
* This hook prevents the popup from closing immediately after the mouse button is released.
|
|
2859
|
-
*/
|
|
2860
|
-
function useMixedToggleClickHandler(params) {
|
|
2861
|
-
const { enabled = true, mouseDownAction, open } = params;
|
|
2862
|
-
const ignoreClickRef = React.useRef(false);
|
|
2863
|
-
return React.useMemo(() => {
|
|
2864
|
-
if (!enabled) return EMPTY_OBJECT;
|
|
2865
|
-
return {
|
|
2866
|
-
onMouseDown: (event) => {
|
|
2867
|
-
if (mouseDownAction === "open" && !open || mouseDownAction === "close" && open) {
|
|
2868
|
-
ignoreClickRef.current = true;
|
|
2869
|
-
ownerDocument(event.currentTarget).addEventListener("click", () => {
|
|
2870
|
-
ignoreClickRef.current = false;
|
|
2871
|
-
}, { once: true });
|
|
2872
|
-
}
|
|
2873
|
-
},
|
|
2874
|
-
onClick: (event) => {
|
|
2875
|
-
if (ignoreClickRef.current) {
|
|
2876
|
-
ignoreClickRef.current = false;
|
|
2877
|
-
event.preventBaseUIHandler();
|
|
2878
|
-
}
|
|
2879
|
-
}
|
|
2880
|
-
};
|
|
2881
|
-
}, [
|
|
2882
|
-
enabled,
|
|
2883
|
-
mouseDownAction,
|
|
2884
|
-
open
|
|
2885
|
-
]);
|
|
2886
|
-
}
|
|
2887
|
-
//#endregion
|
|
2888
|
-
//#region ../../node_modules/.bun/@base-ui+react@1.4.1+fa6c2f29eeb10566/node_modules/@base-ui/react/esm/menu/trigger/MenuTrigger.js
|
|
2889
|
-
var BOUNDARY_OFFSET$1 = 2;
|
|
2890
|
-
/**
|
|
2891
|
-
* A button that opens the menu.
|
|
2892
|
-
* Renders a `<button>` element.
|
|
2893
|
-
*
|
|
2894
|
-
* Documentation: [Base UI Menu](https://base-ui.com/react/components/menu)
|
|
2895
|
-
*/
|
|
2896
|
-
var MenuTrigger = fastComponentRef(function MenuTrigger(componentProps, forwardedRef) {
|
|
2897
|
-
const { render, className, disabled: disabledProp = false, nativeButton = true, id: idProp, openOnHover: openOnHoverProp, delay = 100, closeDelay = 0, handle, payload, style, ...elementProps } = componentProps;
|
|
2898
|
-
const rootContext = useMenuRootContext(true);
|
|
2899
|
-
const store = handle?.store ?? rootContext?.store;
|
|
2900
|
-
if (!store) throw new Error(process.env.NODE_ENV !== "production" ? "Base UI: <Menu.Trigger> must be either used within a <Menu.Root> component or provided with a handle." : formatErrorMessage(85));
|
|
2901
|
-
const thisTriggerId = useBaseUiId(idProp);
|
|
2902
|
-
const isTriggerActive = store.useState("isTriggerActive", thisTriggerId);
|
|
2903
|
-
const floatingRootContext = store.useState("floatingRootContext");
|
|
2904
|
-
const isOpenedByThisTrigger = store.useState("isOpenedByTrigger", thisTriggerId);
|
|
2905
|
-
const triggerElementRef = React.useRef(null);
|
|
2906
|
-
const parent = useMenuParent();
|
|
2907
|
-
const compositeRootContext = useCompositeRootContext(true);
|
|
2908
|
-
const floatingTreeRootFromContext = useFloatingTree();
|
|
2909
|
-
const floatingTreeRoot = React.useMemo(() => {
|
|
2910
|
-
return floatingTreeRootFromContext ?? new FloatingTreeStore();
|
|
2911
|
-
}, [floatingTreeRootFromContext]);
|
|
2912
|
-
const floatingNodeId = useFloatingNodeId(floatingTreeRoot);
|
|
2913
|
-
const floatingParentNodeId = useFloatingParentNodeId();
|
|
2914
|
-
const { registerTrigger, isMountedByThisTrigger } = useTriggerDataForwarding(thisTriggerId, triggerElementRef, store, {
|
|
2915
|
-
payload,
|
|
2916
|
-
closeDelay,
|
|
2917
|
-
parent,
|
|
2918
|
-
floatingTreeRoot,
|
|
2919
|
-
floatingNodeId,
|
|
2920
|
-
floatingParentNodeId,
|
|
2921
|
-
keyboardEventRelay: compositeRootContext?.relayKeyboardEvent
|
|
2922
|
-
});
|
|
2923
|
-
const isInMenubar = parent.type === "menubar";
|
|
2924
|
-
const rootDisabled = store.useState("disabled");
|
|
2925
|
-
const disabled = disabledProp || rootDisabled || isInMenubar && parent.context.disabled;
|
|
2926
|
-
const { getButtonProps, buttonRef } = useButton({
|
|
2927
|
-
disabled,
|
|
2928
|
-
native: nativeButton
|
|
2929
|
-
});
|
|
2930
|
-
React.useEffect(() => {
|
|
2931
|
-
if (!isOpenedByThisTrigger && parent.type === void 0) store.context.allowMouseUpTriggerRef.current = false;
|
|
2932
|
-
}, [
|
|
2933
|
-
store,
|
|
2934
|
-
isOpenedByThisTrigger,
|
|
2935
|
-
parent.type
|
|
2936
|
-
]);
|
|
2937
|
-
const triggerRef = React.useRef(null);
|
|
2938
|
-
const allowMouseUpTriggerTimeout = useTimeout();
|
|
2939
|
-
const handleDocumentMouseUp = useStableCallback((mouseEvent) => {
|
|
2940
|
-
if (!triggerRef.current) return;
|
|
2941
|
-
allowMouseUpTriggerTimeout.clear();
|
|
2942
|
-
store.context.allowMouseUpTriggerRef.current = false;
|
|
2943
|
-
const mouseUpTarget = mouseEvent.target;
|
|
2944
|
-
if (contains(triggerRef.current, mouseUpTarget) || contains(store.select("positionerElement"), mouseUpTarget) || mouseUpTarget === triggerRef.current) return;
|
|
2945
|
-
if (mouseUpTarget != null && findRootOwnerId(mouseUpTarget) === store.select("rootId")) return;
|
|
2946
|
-
const bounds = getPseudoElementBounds(triggerRef.current);
|
|
2947
|
-
if (mouseEvent.clientX >= bounds.left - BOUNDARY_OFFSET$1 && mouseEvent.clientX <= bounds.right + BOUNDARY_OFFSET$1 && mouseEvent.clientY >= bounds.top - BOUNDARY_OFFSET$1 && mouseEvent.clientY <= bounds.bottom + BOUNDARY_OFFSET$1) return;
|
|
2948
|
-
floatingTreeRoot.events.emit("close", {
|
|
2949
|
-
domEvent: mouseEvent,
|
|
2950
|
-
reason: cancelOpen
|
|
2951
|
-
});
|
|
2952
|
-
});
|
|
2953
|
-
React.useEffect(() => {
|
|
2954
|
-
if (isOpenedByThisTrigger && store.select("lastOpenChangeReason") === "trigger-hover") ownerDocument(triggerRef.current).addEventListener("mouseup", handleDocumentMouseUp, { once: true });
|
|
2955
|
-
}, [
|
|
2956
|
-
isOpenedByThisTrigger,
|
|
2957
|
-
handleDocumentMouseUp,
|
|
2958
|
-
store
|
|
2959
|
-
]);
|
|
2960
|
-
const parentMenubarHasSubmenuOpen = isInMenubar && parent.context.hasSubmenuOpen;
|
|
2961
|
-
const hoverProps = useHoverReferenceInteraction(floatingRootContext, {
|
|
2962
|
-
enabled: (openOnHoverProp ?? parentMenubarHasSubmenuOpen) && !disabled && parent.type !== "context-menu" && (!isInMenubar || parentMenubarHasSubmenuOpen && !isMountedByThisTrigger),
|
|
2963
|
-
handleClose: safePolygon({ blockPointerEvents: !isInMenubar }),
|
|
2964
|
-
mouseOnly: true,
|
|
2965
|
-
move: false,
|
|
2966
|
-
restMs: parent.type === void 0 ? delay : void 0,
|
|
2967
|
-
delay: { close: closeDelay },
|
|
2968
|
-
triggerElementRef,
|
|
2969
|
-
externalTree: floatingTreeRoot,
|
|
2970
|
-
isActiveTrigger: isTriggerActive,
|
|
2971
|
-
isClosing: () => store.select("transitionStatus") === "ending"
|
|
2972
|
-
});
|
|
2973
|
-
const stickIfOpen = useStickIfOpen(isOpenedByThisTrigger, store.select("lastOpenChangeReason"));
|
|
2974
|
-
const click = useClick(floatingRootContext, {
|
|
2975
|
-
enabled: !disabled && parent.type !== "context-menu",
|
|
2976
|
-
event: isOpenedByThisTrigger && isInMenubar ? "click" : "mousedown",
|
|
2977
|
-
toggle: true,
|
|
2978
|
-
ignoreMouse: false,
|
|
2979
|
-
stickIfOpen: parent.type === void 0 ? stickIfOpen : false
|
|
2980
|
-
});
|
|
2981
|
-
const focus = useFocus$1(floatingRootContext, { enabled: !disabled && parentMenubarHasSubmenuOpen });
|
|
2982
|
-
const mixedToggleHandlers = useMixedToggleClickHandler({
|
|
2983
|
-
open: isOpenedByThisTrigger,
|
|
2984
|
-
enabled: isInMenubar,
|
|
2985
|
-
mouseDownAction: "open"
|
|
2986
|
-
});
|
|
2987
|
-
const localInteractionProps = useInteractions([click, focus]);
|
|
2988
|
-
const state = {
|
|
2989
|
-
disabled,
|
|
2990
|
-
open: isOpenedByThisTrigger
|
|
2991
|
-
};
|
|
2992
|
-
const rootTriggerProps = store.useState("triggerProps", isMountedByThisTrigger);
|
|
2993
|
-
const ref = [
|
|
2994
|
-
triggerRef,
|
|
2995
|
-
forwardedRef,
|
|
2996
|
-
buttonRef,
|
|
2997
|
-
registerTrigger,
|
|
2998
|
-
triggerElementRef
|
|
2999
|
-
];
|
|
3000
|
-
const props = [
|
|
3001
|
-
localInteractionProps.getReferenceProps(),
|
|
3002
|
-
hoverProps ?? EMPTY_OBJECT,
|
|
3003
|
-
rootTriggerProps,
|
|
3004
|
-
{
|
|
3005
|
-
"aria-haspopup": "menu",
|
|
3006
|
-
id: thisTriggerId,
|
|
3007
|
-
onMouseDown: (event) => {
|
|
3008
|
-
if (store.select("open")) return;
|
|
3009
|
-
allowMouseUpTriggerTimeout.start(200, () => {
|
|
3010
|
-
store.context.allowMouseUpTriggerRef.current = true;
|
|
3011
|
-
});
|
|
3012
|
-
ownerDocument(event.currentTarget).addEventListener("mouseup", handleDocumentMouseUp, { once: true });
|
|
3013
|
-
}
|
|
3014
|
-
},
|
|
3015
|
-
isInMenubar ? { role: "menuitem" } : {},
|
|
3016
|
-
mixedToggleHandlers,
|
|
3017
|
-
elementProps,
|
|
3018
|
-
getButtonProps
|
|
3019
|
-
];
|
|
3020
|
-
const { preFocusGuardRef, handlePreFocusGuardFocus, handleFocusTargetFocus } = useTriggerFocusGuards(store, triggerElementRef);
|
|
3021
|
-
const element = useRenderElement("button", componentProps, {
|
|
3022
|
-
enabled: !isInMenubar,
|
|
3023
|
-
stateAttributesMapping: pressableTriggerOpenStateMapping,
|
|
3024
|
-
state,
|
|
3025
|
-
ref,
|
|
3026
|
-
props
|
|
3027
|
-
});
|
|
3028
|
-
if (isInMenubar) return /*#__PURE__*/ jsx(CompositeItem, {
|
|
3029
|
-
tag: "button",
|
|
3030
|
-
render,
|
|
3031
|
-
className,
|
|
3032
|
-
style,
|
|
3033
|
-
state,
|
|
3034
|
-
refs: ref,
|
|
3035
|
-
props,
|
|
3036
|
-
stateAttributesMapping: pressableTriggerOpenStateMapping
|
|
3037
|
-
});
|
|
3038
|
-
if (isOpenedByThisTrigger) return /*#__PURE__*/ jsxs(React.Fragment, { children: [
|
|
3039
|
-
/*#__PURE__*/ jsx(FocusGuard, {
|
|
3040
|
-
ref: preFocusGuardRef,
|
|
3041
|
-
onFocus: handlePreFocusGuardFocus
|
|
3042
|
-
}, `${thisTriggerId}-pre-focus-guard`),
|
|
3043
|
-
/*#__PURE__*/ jsx(React.Fragment, { children: element }, thisTriggerId),
|
|
3044
|
-
/*#__PURE__*/ jsx(FocusGuard, {
|
|
3045
|
-
ref: store.context.triggerFocusTargetRef,
|
|
3046
|
-
onFocus: handleFocusTargetFocus
|
|
3047
|
-
}, `${thisTriggerId}-post-focus-guard`)
|
|
3048
|
-
] });
|
|
3049
|
-
return /*#__PURE__*/ jsx(React.Fragment, { children: element }, thisTriggerId);
|
|
3050
|
-
});
|
|
3051
|
-
if (process.env.NODE_ENV !== "production") MenuTrigger.displayName = "MenuTrigger";
|
|
3052
|
-
/**
|
|
3053
|
-
* Determines whether to ignore clicks after a hover-open.
|
|
3054
|
-
*/
|
|
3055
|
-
function useStickIfOpen(open, openReason) {
|
|
3056
|
-
const stickIfOpenTimeout = useTimeout();
|
|
3057
|
-
const [stickIfOpen, setStickIfOpen] = React.useState(false);
|
|
3058
|
-
useIsoLayoutEffect(() => {
|
|
3059
|
-
if (open && openReason === "trigger-hover") {
|
|
3060
|
-
setStickIfOpen(true);
|
|
3061
|
-
stickIfOpenTimeout.start(500, () => {
|
|
3062
|
-
setStickIfOpen(false);
|
|
3063
|
-
});
|
|
3064
|
-
} else if (!open) {
|
|
3065
|
-
stickIfOpenTimeout.clear();
|
|
3066
|
-
setStickIfOpen(false);
|
|
3067
|
-
}
|
|
3068
|
-
}, [
|
|
3069
|
-
open,
|
|
3070
|
-
openReason,
|
|
3071
|
-
stickIfOpenTimeout
|
|
3072
|
-
]);
|
|
3073
|
-
return stickIfOpen;
|
|
3074
|
-
}
|
|
3075
|
-
function useMenuParent() {
|
|
3076
|
-
const contextMenuContext = useContextMenuRootContext(true);
|
|
3077
|
-
const parentContext = useMenuRootContext(true);
|
|
3078
|
-
const menubarContext = useMenubarContext(true);
|
|
3079
|
-
return React.useMemo(() => {
|
|
3080
|
-
if (menubarContext) return {
|
|
3081
|
-
type: "menubar",
|
|
3082
|
-
context: menubarContext
|
|
3083
|
-
};
|
|
3084
|
-
if (contextMenuContext && !parentContext) return {
|
|
3085
|
-
type: "context-menu",
|
|
3086
|
-
context: contextMenuContext
|
|
3087
|
-
};
|
|
3088
|
-
return { type: void 0 };
|
|
3089
|
-
}, [
|
|
3090
|
-
contextMenuContext,
|
|
3091
|
-
parentContext,
|
|
3092
|
-
menubarContext
|
|
3093
|
-
]);
|
|
3094
|
-
}
|
|
3095
|
-
//#endregion
|
|
3096
|
-
//#region ../../node_modules/.bun/@base-ui+react@1.4.1+fa6c2f29eeb10566/node_modules/@base-ui/react/esm/menu/submenu-trigger/MenuSubmenuTrigger.js
|
|
3097
|
-
/**
|
|
3098
|
-
* A menu item that opens a submenu.
|
|
3099
|
-
* Renders a `<div>` element.
|
|
3100
|
-
*
|
|
3101
|
-
* Documentation: [Base UI Menu](https://base-ui.com/react/components/menu)
|
|
3102
|
-
*/
|
|
3103
|
-
var MenuSubmenuTrigger = /*#__PURE__*/ React.forwardRef(function SubmenuTriggerComponent(componentProps, forwardedRef) {
|
|
3104
|
-
const { render, className, label, id: idProp, nativeButton = false, openOnHover = true, delay = 100, closeDelay = 0, disabled: disabledProp = false, style, ...elementProps } = componentProps;
|
|
3105
|
-
const listItem = useCompositeListItem();
|
|
3106
|
-
const menuPositionerContext = useMenuPositionerContext();
|
|
3107
|
-
const { store } = useMenuRootContext();
|
|
3108
|
-
const thisTriggerId = useBaseUiId(idProp);
|
|
3109
|
-
const open = store.useState("open");
|
|
3110
|
-
const floatingRootContext = store.useState("floatingRootContext");
|
|
3111
|
-
const floatingTreeRoot = store.useState("floatingTreeRoot");
|
|
3112
|
-
const baseRegisterTrigger = useTriggerRegistration(thisTriggerId, store);
|
|
3113
|
-
const registerTrigger = React.useCallback((element) => {
|
|
3114
|
-
const cleanup = baseRegisterTrigger(element);
|
|
3115
|
-
if (element !== null && store.select("open") && store.select("activeTriggerId") == null) store.update({
|
|
3116
|
-
activeTriggerId: thisTriggerId,
|
|
3117
|
-
activeTriggerElement: element,
|
|
3118
|
-
closeDelay
|
|
3119
|
-
});
|
|
3120
|
-
return cleanup;
|
|
3121
|
-
}, [
|
|
3122
|
-
baseRegisterTrigger,
|
|
3123
|
-
closeDelay,
|
|
3124
|
-
store,
|
|
3125
|
-
thisTriggerId
|
|
3126
|
-
]);
|
|
3127
|
-
const triggerElementRef = React.useRef(null);
|
|
3128
|
-
const handleTriggerElementRef = React.useCallback((el) => {
|
|
3129
|
-
triggerElementRef.current = el;
|
|
3130
|
-
store.set("activeTriggerElement", el);
|
|
3131
|
-
}, [store]);
|
|
3132
|
-
if (process.env.NODE_ENV !== "production") useIsoLayoutEffect(() => {
|
|
3133
|
-
const element = triggerElementRef.current;
|
|
3134
|
-
if (element && isElementDisabled(element) && !disabledProp) {
|
|
3135
|
-
const ownerStackMessage = SafeReact.captureOwnerStack?.() || "";
|
|
3136
|
-
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}`);
|
|
3137
|
-
}
|
|
3138
|
-
});
|
|
3139
|
-
const submenuRootContext = useMenuSubmenuRootContext();
|
|
3140
|
-
if (!submenuRootContext?.parentMenu) throw new Error(process.env.NODE_ENV !== "production" ? "Base UI: <Menu.SubmenuTrigger> must be placed in <Menu.SubmenuRoot>." : formatErrorMessage(37));
|
|
3141
|
-
store.useSyncedValue("closeDelay", closeDelay);
|
|
3142
|
-
const parentMenuStore = submenuRootContext.parentMenu;
|
|
3143
|
-
const itemProps = parentMenuStore.useState("itemProps");
|
|
3144
|
-
const highlighted = parentMenuStore.useState("isActive", listItem.index);
|
|
3145
|
-
const itemMetadata = React.useMemo(() => ({
|
|
3146
|
-
type: "submenu-trigger",
|
|
3147
|
-
setActive() {
|
|
3148
|
-
parentMenuStore.set("activeIndex", listItem.index);
|
|
3149
|
-
}
|
|
3150
|
-
}), [parentMenuStore, listItem.index]);
|
|
3151
|
-
const rootDisabled = store.useState("disabled");
|
|
3152
|
-
const disabled = disabledProp || rootDisabled;
|
|
3153
|
-
const { getItemProps, itemRef } = useMenuItem({
|
|
3154
|
-
closeOnClick: false,
|
|
3155
|
-
disabled,
|
|
3156
|
-
highlighted,
|
|
3157
|
-
id: thisTriggerId,
|
|
3158
|
-
store,
|
|
3159
|
-
typingRef: parentMenuStore.context.typingRef,
|
|
3160
|
-
nativeButton,
|
|
3161
|
-
itemMetadata,
|
|
3162
|
-
nodeId: menuPositionerContext?.context.nodeId
|
|
3163
|
-
});
|
|
3164
|
-
const hoverEnabled = store.useState("hoverEnabled");
|
|
3165
|
-
const allowMouseEnter = parentMenuStore.useState("allowMouseEnter");
|
|
3166
|
-
const hoverProps = useHoverReferenceInteraction(floatingRootContext, {
|
|
3167
|
-
enabled: hoverEnabled && openOnHover && !disabled,
|
|
3168
|
-
handleClose: safePolygon({ blockPointerEvents: true }),
|
|
3169
|
-
mouseOnly: true,
|
|
3170
|
-
move: true,
|
|
3171
|
-
restMs: delay,
|
|
3172
|
-
delay: allowMouseEnter ? {
|
|
3173
|
-
open: delay,
|
|
3174
|
-
close: closeDelay
|
|
3175
|
-
} : 0,
|
|
3176
|
-
triggerElementRef,
|
|
3177
|
-
externalTree: floatingTreeRoot,
|
|
3178
|
-
isClosing: () => store.select("transitionStatus") === "ending"
|
|
3179
|
-
});
|
|
3180
|
-
const click = useClick(floatingRootContext, {
|
|
3181
|
-
enabled: !disabled,
|
|
3182
|
-
event: "mousedown",
|
|
3183
|
-
toggle: !openOnHover,
|
|
3184
|
-
ignoreMouse: openOnHover,
|
|
3185
|
-
stickIfOpen: false
|
|
3186
|
-
});
|
|
3187
|
-
const localInteractionProps = useInteractions([click]);
|
|
3188
|
-
const rootTriggerProps = store.useState("triggerProps", true);
|
|
3189
|
-
delete rootTriggerProps.id;
|
|
3190
|
-
return useRenderElement("div", componentProps, {
|
|
3191
|
-
state: {
|
|
3192
|
-
disabled,
|
|
3193
|
-
highlighted,
|
|
3194
|
-
open
|
|
3195
|
-
},
|
|
3196
|
-
stateAttributesMapping: triggerOpenStateMapping,
|
|
3197
|
-
props: [
|
|
3198
|
-
localInteractionProps.getReferenceProps(),
|
|
3199
|
-
hoverProps,
|
|
3200
|
-
rootTriggerProps,
|
|
3201
|
-
itemProps,
|
|
3202
|
-
{
|
|
3203
|
-
tabIndex: open || highlighted ? 0 : -1,
|
|
3204
|
-
onBlur() {
|
|
3205
|
-
if (highlighted) parentMenuStore.set("activeIndex", null);
|
|
3206
|
-
}
|
|
3207
|
-
},
|
|
3208
|
-
elementProps,
|
|
3209
|
-
getItemProps
|
|
3210
|
-
],
|
|
3211
|
-
ref: [
|
|
3212
|
-
forwardedRef,
|
|
3213
|
-
listItem.ref,
|
|
3214
|
-
itemRef,
|
|
3215
|
-
registerTrigger,
|
|
3216
|
-
handleTriggerElementRef
|
|
3217
|
-
]
|
|
3218
|
-
});
|
|
3219
|
-
});
|
|
3220
|
-
if (process.env.NODE_ENV !== "production") MenuSubmenuTrigger.displayName = "MenuSubmenuTrigger";
|
|
3221
|
-
//#endregion
|
|
3222
|
-
//#region ../../node_modules/.bun/@base-ui+react@1.4.1+fa6c2f29eeb10566/node_modules/@base-ui/react/esm/menu/store/MenuHandle.js
|
|
3223
|
-
var MenuHandle = class {
|
|
3224
|
-
/**
|
|
3225
|
-
* Internal store holding the menu's state.
|
|
3226
|
-
* @internal
|
|
3227
|
-
*/
|
|
3228
|
-
constructor() {
|
|
3229
|
-
this.store = new MenuStore();
|
|
3230
|
-
}
|
|
3231
|
-
/**
|
|
3232
|
-
* Opens the menu and associates it with the trigger with the given id.
|
|
3233
|
-
* The trigger must be a Menu.Trigger component with this handle passed as a prop.
|
|
3234
|
-
*
|
|
3235
|
-
* @param triggerId ID of the trigger to associate with the menu.
|
|
3236
|
-
*/
|
|
3237
|
-
open(triggerId) {
|
|
3238
|
-
const triggerElement = triggerId ? this.store.context.triggerElements.getById(triggerId) : void 0;
|
|
3239
|
-
if (triggerId && !triggerElement) throw new Error(process.env.NODE_ENV !== "production" ? `Base UI: MenuHandle.open: No trigger found with id "${triggerId}".` : formatErrorMessage(83, triggerId));
|
|
3240
|
-
this.store.setOpen(true, createChangeEventDetails("imperative-action", void 0, triggerElement));
|
|
3241
|
-
}
|
|
3242
|
-
/**
|
|
3243
|
-
* Closes the menu.
|
|
3244
|
-
*/
|
|
3245
|
-
close() {
|
|
3246
|
-
this.store.setOpen(false, createChangeEventDetails("imperative-action", void 0, void 0));
|
|
3247
|
-
}
|
|
3248
|
-
/**
|
|
3249
|
-
* Indicates whether the menu is currently open.
|
|
3250
|
-
*/
|
|
3251
|
-
get isOpen() {
|
|
3252
|
-
return this.store.state.open;
|
|
3253
|
-
}
|
|
3254
|
-
};
|
|
3255
|
-
/**
|
|
3256
|
-
* Creates a new handle to connect a Menu.Root with detached Menu.Trigger components.
|
|
3257
|
-
*/
|
|
3258
|
-
function createMenuHandle() {
|
|
3259
|
-
return new MenuHandle();
|
|
3260
|
-
}
|
|
3261
|
-
//#endregion
|
|
3262
|
-
//#region src/ui/browser/dropdown-menu.tsx
|
|
3263
|
-
var DropdownMenuHandle = React.createContext(null);
|
|
3264
|
-
function DropdownMenu({ handle: providedHandle, onOpenChange, ...props }) {
|
|
3265
|
-
const [handle] = React.useState(() => providedHandle ?? createMenuHandle());
|
|
3266
|
-
return /* @__PURE__ */ jsx(DropdownMenuHandle.Provider, {
|
|
3267
|
-
value: handle,
|
|
3268
|
-
children: /* @__PURE__ */ jsx(MenuRoot, {
|
|
3269
|
-
"data-slot": "dropdown-menu",
|
|
3270
|
-
handle,
|
|
3271
|
-
onOpenChange: (open, eventDetails) => {
|
|
3272
|
-
if (!open && eventDetails.reason == "trigger-hover") {
|
|
3273
|
-
eventDetails.cancel();
|
|
3274
|
-
return;
|
|
3275
|
-
}
|
|
3276
|
-
onOpenChange?.(open, eventDetails);
|
|
3277
|
-
},
|
|
3278
|
-
...props
|
|
3279
|
-
})
|
|
3280
|
-
});
|
|
3281
|
-
}
|
|
3282
|
-
var DropdownMenuTrigger = React.forwardRef(function DropdownMenuTrigger({ handle: providedHandle, id: providedId, onClick, onMouseDown, ...props }, ref) {
|
|
3283
|
-
const rootHandle = React.useContext(DropdownMenuHandle);
|
|
3284
|
-
const generatedId = React.useId();
|
|
3285
|
-
const handle = providedHandle ?? rootHandle;
|
|
3286
|
-
const id = providedId ?? generatedId;
|
|
3287
|
-
return /* @__PURE__ */ jsx(MenuTrigger, {
|
|
3288
|
-
ref,
|
|
3289
|
-
"data-slot": "dropdown-menu-trigger",
|
|
3290
|
-
handle: handle ?? void 0,
|
|
3291
|
-
id,
|
|
3292
|
-
onClick: (event) => {
|
|
3293
|
-
onClick?.(event);
|
|
3294
|
-
if (event.detail == 0 || event.defaultPrevented || event.baseUIHandlerPrevented || handle == null) return;
|
|
3295
|
-
if (handle.isOpen) handle.close();
|
|
3296
|
-
else handle.open(id);
|
|
3297
|
-
},
|
|
3298
|
-
onMouseDown: (event) => {
|
|
3299
|
-
onMouseDown?.(event);
|
|
3300
|
-
event.preventBaseUIHandler();
|
|
3301
|
-
},
|
|
3302
|
-
...props
|
|
3303
|
-
});
|
|
3304
|
-
});
|
|
3305
|
-
function DropdownMenuContent({ align = "start", alignOffset = 0, container, side = "bottom", sideOffset = 4, className, ...props }) {
|
|
3306
|
-
return /* @__PURE__ */ jsx(MenuPortal, {
|
|
3307
|
-
container,
|
|
3308
|
-
className: "contents",
|
|
3309
|
-
children: /* @__PURE__ */ jsx(MenuPositioner, {
|
|
3310
|
-
className: "isolate z-50 outline-none",
|
|
3311
|
-
align,
|
|
3312
|
-
alignOffset,
|
|
3313
|
-
side,
|
|
3314
|
-
sideOffset,
|
|
3315
|
-
children: /* @__PURE__ */ jsx(MenuPopup, {
|
|
3316
|
-
"data-slot": "dropdown-menu-content",
|
|
3317
|
-
className: cn$1("z-50 max-h-(--available-height) w-(--anchor-width) min-w-32 origin-(--transform-origin) overflow-x-hidden overflow-y-auto overscroll-contain rounded-[var(--ui-control-radius,8px)] bg-popover p-1 text-popover-foreground shadow-md ring-1 ring-foreground/10 duration-100 outline-none data-[side=bottom]:slide-in-from-top-2 data-[side=inline-end]:slide-in-from-left-2 data-[side=inline-start]:slide-in-from-right-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:overflow-hidden data-closed:fade-out-0 data-closed:zoom-out-95 motion-reduce:animate-none motion-reduce:transition-none", className),
|
|
3318
|
-
...props
|
|
3319
|
-
})
|
|
3320
|
-
})
|
|
3321
|
-
});
|
|
3322
|
-
}
|
|
3323
|
-
function DropdownMenuGroup({ ...props }) {
|
|
3324
|
-
return /* @__PURE__ */ jsx(MenuGroup, {
|
|
3325
|
-
"data-slot": "dropdown-menu-group",
|
|
3326
|
-
...props
|
|
3327
|
-
});
|
|
3328
|
-
}
|
|
3329
|
-
function DropdownMenuLabel({ className, inset, ...props }) {
|
|
3330
|
-
return /* @__PURE__ */ jsx(MenuGroupLabel, {
|
|
3331
|
-
"data-slot": "dropdown-menu-label",
|
|
3332
|
-
"data-inset": inset,
|
|
3333
|
-
className: cn$1("px-1.5 py-1 text-xs font-medium text-muted-foreground data-inset:pl-7", className),
|
|
3334
|
-
...props
|
|
3335
|
-
});
|
|
3336
|
-
}
|
|
3337
|
-
function DropdownMenuItem({ className, inset, variant = "default", ...props }) {
|
|
3338
|
-
return /* @__PURE__ */ jsx(MenuItem, {
|
|
3339
|
-
"data-slot": "dropdown-menu-item",
|
|
3340
|
-
"data-inset": inset,
|
|
3341
|
-
"data-variant": variant,
|
|
3342
|
-
className: cn$1("group/dropdown-menu-item relative flex cursor-default items-center gap-1.5 rounded-[calc(var(--ui-control-radius,calc(var(--radius-md)_+_2px))_-_2px)] px-1.5 py-1 text-sm outline-hidden select-none focus:bg-accent focus:text-accent-foreground not-data-[variant=destructive]:focus:**:text-accent-foreground data-inset:pl-7 data-[variant=destructive]:text-destructive data-[variant=destructive]:focus:bg-destructive/10 data-[variant=destructive]:focus:text-destructive dark:data-[variant=destructive]:focus:bg-destructive/20 data-disabled:pointer-events-none data-disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 data-[variant=destructive]:*:[svg]:text-destructive", className),
|
|
3343
|
-
...props
|
|
3344
|
-
});
|
|
3345
|
-
}
|
|
3346
|
-
function DropdownMenuSub({ ...props }) {
|
|
3347
|
-
return /* @__PURE__ */ jsx(MenuSubmenuRoot, {
|
|
3348
|
-
"data-slot": "dropdown-menu-sub",
|
|
3349
|
-
...props
|
|
3350
|
-
});
|
|
3351
|
-
}
|
|
3352
|
-
function DropdownMenuSubTrigger({ className, inset, children, ...props }) {
|
|
3353
|
-
return /* @__PURE__ */ jsxs(MenuSubmenuTrigger, {
|
|
3354
|
-
"data-slot": "dropdown-menu-sub-trigger",
|
|
3355
|
-
"data-inset": inset,
|
|
3356
|
-
className: cn$1("flex cursor-default items-center gap-1.5 rounded-[calc(var(--ui-control-radius,calc(var(--radius-md)_+_2px))_-_2px)] px-1.5 py-1 text-sm outline-hidden select-none focus:bg-accent focus:text-accent-foreground not-data-[variant=destructive]:focus:**:text-accent-foreground data-inset:pl-7 data-popup-open:bg-accent data-popup-open:text-accent-foreground data-open:bg-accent data-open:text-accent-foreground [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4", className),
|
|
3357
|
-
...props,
|
|
3358
|
-
children: [children, /* @__PURE__ */ jsx(ChevronRight, { className: "ml-auto" })]
|
|
3359
|
-
});
|
|
3360
|
-
}
|
|
3361
|
-
function DropdownMenuSubContent({ align = "start", alignOffset = -3, side = "right", sideOffset = 0, className, ...props }) {
|
|
3362
|
-
return /* @__PURE__ */ jsx(DropdownMenuContent, {
|
|
3363
|
-
"data-slot": "dropdown-menu-sub-content",
|
|
3364
|
-
className: cn$1("w-auto min-w-[96px] rounded-lg bg-popover p-1 text-popover-foreground shadow-lg ring-1 ring-foreground/10 duration-100 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95 motion-reduce:animate-none motion-reduce:transition-none", className),
|
|
3365
|
-
align,
|
|
3366
|
-
alignOffset,
|
|
3367
|
-
side,
|
|
3368
|
-
sideOffset,
|
|
3369
|
-
...props
|
|
3370
|
-
});
|
|
3371
|
-
}
|
|
3372
|
-
function DropdownMenuCheckboxItem({ className, children, checked, inset, ...props }) {
|
|
3373
|
-
return /* @__PURE__ */ jsxs(MenuCheckboxItem, {
|
|
3374
|
-
"data-slot": "dropdown-menu-checkbox-item",
|
|
3375
|
-
"data-inset": inset,
|
|
3376
|
-
className: cn$1("relative flex cursor-default items-center gap-1.5 rounded-[calc(var(--ui-control-radius,calc(var(--radius-md)_+_2px))_-_2px)] py-1 pr-8 pl-1.5 text-sm outline-hidden select-none focus:bg-accent focus:text-accent-foreground focus:**:text-accent-foreground data-inset:pl-7 data-disabled:pointer-events-none data-disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4", className),
|
|
3377
|
-
checked,
|
|
3378
|
-
...props,
|
|
3379
|
-
children: [/* @__PURE__ */ jsx("span", {
|
|
3380
|
-
className: "pointer-events-none absolute inset-y-0 right-2 flex items-center justify-center",
|
|
3381
|
-
"data-slot": "dropdown-menu-checkbox-item-indicator",
|
|
3382
|
-
children: /* @__PURE__ */ jsx(MenuCheckboxItemIndicator, {
|
|
3383
|
-
className: "flex items-center justify-center",
|
|
3384
|
-
children: /* @__PURE__ */ jsx(Check, {})
|
|
3385
|
-
})
|
|
3386
|
-
}), children]
|
|
3387
|
-
});
|
|
3388
|
-
}
|
|
3389
|
-
function DropdownMenuRadioGroup({ ...props }) {
|
|
3390
|
-
return /* @__PURE__ */ jsx(MenuRadioGroup, {
|
|
3391
|
-
"data-slot": "dropdown-menu-radio-group",
|
|
3392
|
-
...props
|
|
3393
|
-
});
|
|
3394
|
-
}
|
|
3395
|
-
var DropdownMenuRadioItem = React.forwardRef(function DropdownMenuRadioItem({ className, children, inset, ...props }, ref) {
|
|
3396
|
-
return /* @__PURE__ */ jsxs(MenuRadioItem, {
|
|
3397
|
-
ref,
|
|
3398
|
-
"data-slot": "dropdown-menu-radio-item",
|
|
3399
|
-
"data-inset": inset,
|
|
3400
|
-
className: cn$1("relative flex cursor-default items-center gap-1.5 rounded-[calc(var(--ui-control-radius,calc(var(--radius-md)_+_2px))_-_2px)] py-1 pr-8 pl-1.5 text-sm outline-hidden select-none focus:bg-accent focus:text-accent-foreground focus:**:text-accent-foreground data-inset:pl-7 data-disabled:pointer-events-none data-disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4", className),
|
|
3401
|
-
...props,
|
|
3402
|
-
children: [/* @__PURE__ */ jsx("span", {
|
|
3403
|
-
className: "pointer-events-none absolute inset-y-0 right-2 flex items-center justify-center",
|
|
3404
|
-
"data-slot": "dropdown-menu-radio-item-indicator",
|
|
3405
|
-
children: /* @__PURE__ */ jsx(MenuRadioItemIndicator, {
|
|
3406
|
-
className: "flex items-center justify-center",
|
|
3407
|
-
children: /* @__PURE__ */ jsx(Check, {})
|
|
3408
|
-
})
|
|
3409
|
-
}), children]
|
|
3410
|
-
});
|
|
3411
|
-
});
|
|
3412
|
-
function DropdownMenuSeparator({ className, ...props }) {
|
|
3413
|
-
return /* @__PURE__ */ jsx(Separator, {
|
|
3414
|
-
"data-slot": "dropdown-menu-separator",
|
|
3415
|
-
className: cn$1("-mx-1 my-1 h-px bg-border", className),
|
|
3416
|
-
...props
|
|
3417
|
-
});
|
|
3418
|
-
}
|
|
3419
|
-
//#endregion
|
|
3420
1450
|
//#region src/workbench/browser/runtime/editor/accountName.tsx
|
|
3421
1451
|
function accountDisplayName(connection, fallback, builtInName) {
|
|
3422
1452
|
return connection?.builtInAccount ? builtInName : fallback;
|
|
@@ -7233,6 +5263,278 @@ function ValueControl({ addon, children }) {
|
|
|
7233
5263
|
});
|
|
7234
5264
|
}
|
|
7235
5265
|
//#endregion
|
|
5266
|
+
//#region ../../node_modules/.bun/@base-ui+react@1.4.1+fa6c2f29eeb10566/node_modules/@base-ui/react/esm/switch/root/SwitchRootContext.js
|
|
5267
|
+
var SwitchRootContext = /*#__PURE__*/ React.createContext(void 0);
|
|
5268
|
+
if (process.env.NODE_ENV !== "production") SwitchRootContext.displayName = "SwitchRootContext";
|
|
5269
|
+
function useSwitchRootContext() {
|
|
5270
|
+
const context = React.useContext(SwitchRootContext);
|
|
5271
|
+
if (context === void 0) throw new Error(process.env.NODE_ENV !== "production" ? "Base UI: SwitchRootContext is missing. Switch parts must be placed within <Switch.Root>." : formatErrorMessage(63));
|
|
5272
|
+
return context;
|
|
5273
|
+
}
|
|
5274
|
+
//#endregion
|
|
5275
|
+
//#region ../../node_modules/.bun/@base-ui+react@1.4.1+fa6c2f29eeb10566/node_modules/@base-ui/react/esm/switch/root/SwitchRootDataAttributes.js
|
|
5276
|
+
var SwitchRootDataAttributes = /*#__PURE__*/ function(SwitchRootDataAttributes) {
|
|
5277
|
+
/**
|
|
5278
|
+
* Present when the switch is checked.
|
|
5279
|
+
*/
|
|
5280
|
+
SwitchRootDataAttributes["checked"] = "data-checked";
|
|
5281
|
+
/**
|
|
5282
|
+
* Present when the switch is not checked.
|
|
5283
|
+
*/
|
|
5284
|
+
SwitchRootDataAttributes["unchecked"] = "data-unchecked";
|
|
5285
|
+
/**
|
|
5286
|
+
* Present when the switch is disabled.
|
|
5287
|
+
*/
|
|
5288
|
+
SwitchRootDataAttributes["disabled"] = "data-disabled";
|
|
5289
|
+
/**
|
|
5290
|
+
* Present when the switch is readonly.
|
|
5291
|
+
*/
|
|
5292
|
+
SwitchRootDataAttributes["readonly"] = "data-readonly";
|
|
5293
|
+
/**
|
|
5294
|
+
* Present when the switch is required.
|
|
5295
|
+
*/
|
|
5296
|
+
SwitchRootDataAttributes["required"] = "data-required";
|
|
5297
|
+
/**
|
|
5298
|
+
* Present when the switch is in a valid state (when wrapped in Field.Root).
|
|
5299
|
+
*/
|
|
5300
|
+
SwitchRootDataAttributes["valid"] = "data-valid";
|
|
5301
|
+
/**
|
|
5302
|
+
* Present when the switch is in an invalid state (when wrapped in Field.Root).
|
|
5303
|
+
*/
|
|
5304
|
+
SwitchRootDataAttributes["invalid"] = "data-invalid";
|
|
5305
|
+
/**
|
|
5306
|
+
* Present when the switch has been touched (when wrapped in Field.Root).
|
|
5307
|
+
*/
|
|
5308
|
+
SwitchRootDataAttributes["touched"] = "data-touched";
|
|
5309
|
+
/**
|
|
5310
|
+
* Present when the switch's value has changed (when wrapped in Field.Root).
|
|
5311
|
+
*/
|
|
5312
|
+
SwitchRootDataAttributes["dirty"] = "data-dirty";
|
|
5313
|
+
/**
|
|
5314
|
+
* Present when the switch is active (when wrapped in Field.Root).
|
|
5315
|
+
*/
|
|
5316
|
+
SwitchRootDataAttributes["filled"] = "data-filled";
|
|
5317
|
+
/**
|
|
5318
|
+
* Present when the switch is focused (when wrapped in Field.Root).
|
|
5319
|
+
*/
|
|
5320
|
+
SwitchRootDataAttributes["focused"] = "data-focused";
|
|
5321
|
+
return SwitchRootDataAttributes;
|
|
5322
|
+
}({});
|
|
5323
|
+
//#endregion
|
|
5324
|
+
//#region ../../node_modules/.bun/@base-ui+react@1.4.1+fa6c2f29eeb10566/node_modules/@base-ui/react/esm/switch/stateAttributesMapping.js
|
|
5325
|
+
var stateAttributesMapping$2 = {
|
|
5326
|
+
...fieldValidityMapping,
|
|
5327
|
+
checked(value) {
|
|
5328
|
+
if (value) return { [SwitchRootDataAttributes.checked]: "" };
|
|
5329
|
+
return { [SwitchRootDataAttributes.unchecked]: "" };
|
|
5330
|
+
}
|
|
5331
|
+
};
|
|
5332
|
+
//#endregion
|
|
5333
|
+
//#region ../../node_modules/.bun/@base-ui+react@1.4.1+fa6c2f29eeb10566/node_modules/@base-ui/react/esm/switch/root/SwitchRoot.js
|
|
5334
|
+
/**
|
|
5335
|
+
* Represents the switch itself.
|
|
5336
|
+
* Renders a `<span>` element and a hidden `<input>` beside.
|
|
5337
|
+
*
|
|
5338
|
+
* Documentation: [Base UI Switch](https://base-ui.com/react/components/switch)
|
|
5339
|
+
*/
|
|
5340
|
+
var SwitchRoot = /*#__PURE__*/ React.forwardRef(function SwitchRoot(componentProps, forwardedRef) {
|
|
5341
|
+
const { checked: checkedProp, className, defaultChecked, "aria-labelledby": ariaLabelledByProp, form, id: idProp, inputRef: externalInputRef, name: nameProp, nativeButton = false, onCheckedChange: onCheckedChangeProp, readOnly = false, required = false, disabled: disabledProp = false, render, uncheckedValue, value, style, ...elementProps } = componentProps;
|
|
5342
|
+
const { clearErrors } = useFormContext();
|
|
5343
|
+
const { state: fieldState, setTouched, setDirty, validityData, setFilled, setFocused, shouldValidateOnChange, validationMode, disabled: fieldDisabled, name: fieldName, validation } = useFieldRootContext();
|
|
5344
|
+
const { labelId } = useLabelableContext();
|
|
5345
|
+
const disabled = fieldDisabled || disabledProp;
|
|
5346
|
+
const name = fieldName ?? nameProp;
|
|
5347
|
+
const onCheckedChange = useStableCallback(onCheckedChangeProp);
|
|
5348
|
+
const inputRef = React.useRef(null);
|
|
5349
|
+
const handleInputRef = useMergedRefs(inputRef, externalInputRef, validation.inputRef);
|
|
5350
|
+
const switchRef = React.useRef(null);
|
|
5351
|
+
const id = useBaseUiId();
|
|
5352
|
+
const controlId = useLabelableId({
|
|
5353
|
+
id: idProp,
|
|
5354
|
+
implicit: false,
|
|
5355
|
+
controlRef: switchRef
|
|
5356
|
+
});
|
|
5357
|
+
const hiddenInputId = nativeButton ? void 0 : controlId;
|
|
5358
|
+
const [checked, setCheckedState] = useControlled({
|
|
5359
|
+
controlled: checkedProp,
|
|
5360
|
+
default: Boolean(defaultChecked),
|
|
5361
|
+
name: "Switch",
|
|
5362
|
+
state: "checked"
|
|
5363
|
+
});
|
|
5364
|
+
useRegisterFieldControl(switchRef, {
|
|
5365
|
+
id,
|
|
5366
|
+
value: checked
|
|
5367
|
+
});
|
|
5368
|
+
useIsoLayoutEffect(() => {
|
|
5369
|
+
if (inputRef.current) setFilled(inputRef.current.checked);
|
|
5370
|
+
}, [inputRef, setFilled]);
|
|
5371
|
+
useValueChanged(checked, () => {
|
|
5372
|
+
clearErrors(name);
|
|
5373
|
+
setDirty(checked !== validityData.initialValue);
|
|
5374
|
+
setFilled(checked);
|
|
5375
|
+
if (shouldValidateOnChange()) validation.commit(checked);
|
|
5376
|
+
else validation.commit(checked, true);
|
|
5377
|
+
});
|
|
5378
|
+
const { getButtonProps, buttonRef } = useButton({
|
|
5379
|
+
disabled,
|
|
5380
|
+
native: nativeButton
|
|
5381
|
+
});
|
|
5382
|
+
const ariaLabelledBy = useAriaLabelledBy(ariaLabelledByProp, labelId, inputRef, !nativeButton, hiddenInputId);
|
|
5383
|
+
const rootProps = {
|
|
5384
|
+
id: nativeButton ? controlId : id,
|
|
5385
|
+
role: "switch",
|
|
5386
|
+
"aria-checked": checked,
|
|
5387
|
+
"aria-readonly": readOnly || void 0,
|
|
5388
|
+
"aria-required": required || void 0,
|
|
5389
|
+
"aria-labelledby": ariaLabelledBy,
|
|
5390
|
+
onFocus() {
|
|
5391
|
+
if (!disabled) setFocused(true);
|
|
5392
|
+
},
|
|
5393
|
+
onBlur() {
|
|
5394
|
+
const element = inputRef.current;
|
|
5395
|
+
if (!element || disabled) return;
|
|
5396
|
+
setTouched(true);
|
|
5397
|
+
setFocused(false);
|
|
5398
|
+
if (validationMode === "onBlur") validation.commit(element.checked);
|
|
5399
|
+
},
|
|
5400
|
+
onClick(event) {
|
|
5401
|
+
if (readOnly || disabled) return;
|
|
5402
|
+
event.preventDefault();
|
|
5403
|
+
inputRef.current?.dispatchEvent(new PointerEvent("click", {
|
|
5404
|
+
bubbles: true,
|
|
5405
|
+
shiftKey: event.shiftKey,
|
|
5406
|
+
ctrlKey: event.ctrlKey,
|
|
5407
|
+
altKey: event.altKey,
|
|
5408
|
+
metaKey: event.metaKey
|
|
5409
|
+
}));
|
|
5410
|
+
}
|
|
5411
|
+
};
|
|
5412
|
+
const inputProps = React.useMemo(() => mergeProps({
|
|
5413
|
+
checked,
|
|
5414
|
+
disabled,
|
|
5415
|
+
form,
|
|
5416
|
+
id: hiddenInputId,
|
|
5417
|
+
name,
|
|
5418
|
+
required,
|
|
5419
|
+
style: name ? visuallyHiddenInput : visuallyHidden,
|
|
5420
|
+
tabIndex: -1,
|
|
5421
|
+
type: "checkbox",
|
|
5422
|
+
"aria-hidden": true,
|
|
5423
|
+
ref: handleInputRef,
|
|
5424
|
+
onChange(event) {
|
|
5425
|
+
if (event.nativeEvent.defaultPrevented) return;
|
|
5426
|
+
if (readOnly) {
|
|
5427
|
+
event.preventDefault();
|
|
5428
|
+
return;
|
|
5429
|
+
}
|
|
5430
|
+
const nextChecked = event.currentTarget.checked;
|
|
5431
|
+
const eventDetails = createChangeEventDetails(none$1, event.nativeEvent);
|
|
5432
|
+
onCheckedChange?.(nextChecked, eventDetails);
|
|
5433
|
+
if (eventDetails.isCanceled) return;
|
|
5434
|
+
setCheckedState(nextChecked);
|
|
5435
|
+
},
|
|
5436
|
+
onFocus() {
|
|
5437
|
+
switchRef.current?.focus();
|
|
5438
|
+
}
|
|
5439
|
+
}, validation.getInputValidationProps, value !== void 0 ? { value } : EMPTY_OBJECT), [
|
|
5440
|
+
checked,
|
|
5441
|
+
disabled,
|
|
5442
|
+
form,
|
|
5443
|
+
handleInputRef,
|
|
5444
|
+
hiddenInputId,
|
|
5445
|
+
name,
|
|
5446
|
+
onCheckedChange,
|
|
5447
|
+
readOnly,
|
|
5448
|
+
required,
|
|
5449
|
+
setCheckedState,
|
|
5450
|
+
validation,
|
|
5451
|
+
value
|
|
5452
|
+
]);
|
|
5453
|
+
const state = React.useMemo(() => ({
|
|
5454
|
+
...fieldState,
|
|
5455
|
+
checked,
|
|
5456
|
+
disabled,
|
|
5457
|
+
readOnly,
|
|
5458
|
+
required
|
|
5459
|
+
}), [
|
|
5460
|
+
fieldState,
|
|
5461
|
+
checked,
|
|
5462
|
+
disabled,
|
|
5463
|
+
readOnly,
|
|
5464
|
+
required
|
|
5465
|
+
]);
|
|
5466
|
+
const element = useRenderElement("span", componentProps, {
|
|
5467
|
+
state,
|
|
5468
|
+
ref: [
|
|
5469
|
+
forwardedRef,
|
|
5470
|
+
switchRef,
|
|
5471
|
+
buttonRef
|
|
5472
|
+
],
|
|
5473
|
+
props: [
|
|
5474
|
+
rootProps,
|
|
5475
|
+
validation.getValidationProps,
|
|
5476
|
+
elementProps,
|
|
5477
|
+
getButtonProps
|
|
5478
|
+
],
|
|
5479
|
+
stateAttributesMapping: stateAttributesMapping$2
|
|
5480
|
+
});
|
|
5481
|
+
return /*#__PURE__*/ jsxs(SwitchRootContext.Provider, {
|
|
5482
|
+
value: state,
|
|
5483
|
+
children: [
|
|
5484
|
+
element,
|
|
5485
|
+
!checked && name && uncheckedValue !== void 0 && /*#__PURE__*/ jsx("input", {
|
|
5486
|
+
type: "hidden",
|
|
5487
|
+
form,
|
|
5488
|
+
name,
|
|
5489
|
+
value: uncheckedValue
|
|
5490
|
+
}),
|
|
5491
|
+
/*#__PURE__*/ jsx("input", {
|
|
5492
|
+
...inputProps,
|
|
5493
|
+
suppressHydrationWarning: true
|
|
5494
|
+
})
|
|
5495
|
+
]
|
|
5496
|
+
});
|
|
5497
|
+
});
|
|
5498
|
+
if (process.env.NODE_ENV !== "production") SwitchRoot.displayName = "SwitchRoot";
|
|
5499
|
+
//#endregion
|
|
5500
|
+
//#region ../../node_modules/.bun/@base-ui+react@1.4.1+fa6c2f29eeb10566/node_modules/@base-ui/react/esm/switch/thumb/SwitchThumb.js
|
|
5501
|
+
/**
|
|
5502
|
+
* The movable part of the switch that indicates whether the switch is on or off.
|
|
5503
|
+
* Renders a `<span>`.
|
|
5504
|
+
*
|
|
5505
|
+
* Documentation: [Base UI Switch](https://base-ui.com/react/components/switch)
|
|
5506
|
+
*/
|
|
5507
|
+
var SwitchThumb = /*#__PURE__*/ React.forwardRef(function SwitchThumb(componentProps, forwardedRef) {
|
|
5508
|
+
const { render, className, style, ...elementProps } = componentProps;
|
|
5509
|
+
const { state: fieldState } = useFieldRootContext();
|
|
5510
|
+
const state = useSwitchRootContext();
|
|
5511
|
+
const extendedState = {
|
|
5512
|
+
...fieldState,
|
|
5513
|
+
...state
|
|
5514
|
+
};
|
|
5515
|
+
return useRenderElement("span", componentProps, {
|
|
5516
|
+
state: extendedState,
|
|
5517
|
+
ref: forwardedRef,
|
|
5518
|
+
stateAttributesMapping: stateAttributesMapping$2,
|
|
5519
|
+
props: elementProps
|
|
5520
|
+
});
|
|
5521
|
+
});
|
|
5522
|
+
if (process.env.NODE_ENV !== "production") SwitchThumb.displayName = "SwitchThumb";
|
|
5523
|
+
//#endregion
|
|
5524
|
+
//#region src/ui/browser/switch.tsx
|
|
5525
|
+
function Switch({ className, size = "default", ...props }) {
|
|
5526
|
+
return /* @__PURE__ */ jsx(SwitchRoot, {
|
|
5527
|
+
"data-slot": "switch",
|
|
5528
|
+
"data-size": size,
|
|
5529
|
+
className: cn$1("peer group/switch relative inline-flex shrink-0 items-center rounded-full border border-transparent transition-[color,background-color,border-color,box-shadow,opacity] outline-none group-has-[:focus-visible]/field-label:border-transparent group-has-[:focus-visible]/field-label:outline-none after:absolute after:-inset-x-3 after:-inset-y-2 focus-visible:outline-2 focus-visible:outline-solid focus-visible:ring-0 focus-visible:aria-invalid:ring-0 focus-visible:outline-offset-1 focus-visible:outline-ring focus-visible:aria-invalid:outline-destructive aria-invalid:border-destructive data-[size=default]:h-[18.4px] data-[size=default]:w-[32px] data-[size=sm]:h-[14px] data-[size=sm]:w-[24px] data-checked:bg-primary data-unchecked:bg-input dark:data-unchecked:bg-input/80 data-disabled:cursor-not-allowed data-disabled:opacity-50", className),
|
|
5530
|
+
...props,
|
|
5531
|
+
children: /* @__PURE__ */ jsx(SwitchThumb, {
|
|
5532
|
+
"data-slot": "switch-thumb",
|
|
5533
|
+
className: "pointer-events-none block rounded-full bg-background ring-0 transition-transform group-data-[size=default]/switch:size-4 group-data-[size=sm]/switch:size-3 group-data-[size=default]/switch:data-checked:translate-x-[calc(100%-2px)] group-data-[size=sm]/switch:data-checked:translate-x-[calc(100%-2px)] dark:data-checked:bg-primary-foreground group-data-[size=default]/switch:data-unchecked:translate-x-0 group-data-[size=sm]/switch:data-unchecked:translate-x-0 dark:data-unchecked:bg-foreground"
|
|
5534
|
+
})
|
|
5535
|
+
});
|
|
5536
|
+
}
|
|
5537
|
+
//#endregion
|
|
7236
5538
|
//#region src/workbench/browser/runtime/editor/agentChanges.ts
|
|
7237
5539
|
function agentFixedValuesValid(config, notificationInputs = []) {
|
|
7238
5540
|
if (config.kind !== "agent") return true;
|
|
@@ -55260,40 +53562,6 @@ function WorkbenchCanvasActions({ addNodeControl, history, pickerOpen, disabled,
|
|
|
55260
53562
|
});
|
|
55261
53563
|
}
|
|
55262
53564
|
//#endregion
|
|
55263
|
-
//#region ../../node_modules/.bun/@base-ui+react@1.4.1+fa6c2f29eeb10566/node_modules/@base-ui/react/esm/use-render/useRender.js
|
|
55264
|
-
/**
|
|
55265
|
-
* Renders a Base UI element.
|
|
55266
|
-
*
|
|
55267
|
-
* @public
|
|
55268
|
-
*/
|
|
55269
|
-
function useRender(params) {
|
|
55270
|
-
return useRenderElement(params.defaultTagName ?? "div", params, params);
|
|
55271
|
-
}
|
|
55272
|
-
//#endregion
|
|
55273
|
-
//#region src/ui/browser/badge.tsx
|
|
55274
|
-
var badgeVariants = cva("group/badge inline-flex h-5 w-fit shrink-0 items-center justify-center gap-1 overflow-hidden rounded-4xl border border-transparent px-2 py-0.5 text-xs font-medium whitespace-nowrap transition-[color,background-color,border-color,box-shadow,opacity] focus-visible:border-border focus-visible:outline-2 focus-visible:outline-solid focus-visible:ring-0 focus-visible:aria-invalid:ring-0 focus-visible:outline-offset-1 focus-visible:outline-ring has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5 aria-invalid:border-destructive [&>svg]:pointer-events-none [&>svg]:size-3!", {
|
|
55275
|
-
variants: { variant: {
|
|
55276
|
-
default: "bg-primary text-primary-foreground [a]:hover:bg-primary/80",
|
|
55277
|
-
secondary: "bg-secondary text-secondary-foreground [a]:hover:bg-secondary/80",
|
|
55278
|
-
destructive: "bg-destructive/10 text-destructive dark:bg-destructive/20 [a]:hover:bg-destructive/20",
|
|
55279
|
-
outline: "border-border text-foreground [a]:hover:bg-muted [a]:hover:text-muted-foreground",
|
|
55280
|
-
ghost: "hover:bg-muted hover:text-muted-foreground dark:hover:bg-muted/50",
|
|
55281
|
-
link: "text-primary underline-offset-4 hover:underline"
|
|
55282
|
-
} },
|
|
55283
|
-
defaultVariants: { variant: "default" }
|
|
55284
|
-
});
|
|
55285
|
-
function Badge({ className, variant = "default", render, ...props }) {
|
|
55286
|
-
return useRender({
|
|
55287
|
-
defaultTagName: "span",
|
|
55288
|
-
props: mergeProps({ className: cn$1(badgeVariants({ variant }), className) }, props),
|
|
55289
|
-
render,
|
|
55290
|
-
state: {
|
|
55291
|
-
slot: "badge",
|
|
55292
|
-
variant
|
|
55293
|
-
}
|
|
55294
|
-
});
|
|
55295
|
-
}
|
|
55296
|
-
//#endregion
|
|
55297
53565
|
//#region src/workbench/browser/runtime/publications/liveTriggers.tsx
|
|
55298
53566
|
function triggerLabel(binding, t) {
|
|
55299
53567
|
if (binding.currentPublicationId == null) return t("publication.retired");
|
|
@@ -55901,7 +54169,7 @@ function PublicationsView({ store, onClose, theme = "light" }) {
|
|
|
55901
54169
|
label: compactId(value),
|
|
55902
54170
|
trigger: /* @__PURE__ */ jsx("span", {
|
|
55903
54171
|
tabIndex: 0,
|
|
55904
|
-
className: "font-mono
|
|
54172
|
+
className: "font-mono"
|
|
55905
54173
|
}),
|
|
55906
54174
|
container: root.current
|
|
55907
54175
|
}, value);
|
|
@@ -58658,7 +56926,7 @@ function RunsView({ flowName, onClose, onConfigureConnector, onLocateEvent, onLo
|
|
|
58658
56926
|
value: run.runId,
|
|
58659
56927
|
label: t("run.runId", { id: shortRunId(run.runId) }),
|
|
58660
56928
|
trigger: /* @__PURE__ */ jsx("span", {
|
|
58661
|
-
className: "
|
|
56929
|
+
className: "text-xs",
|
|
58662
56930
|
tabIndex: 0
|
|
58663
56931
|
}),
|
|
58664
56932
|
container: root.current,
|