@octanejs/base-ui 0.1.30 → 0.1.32
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/cjs/accordion.cjs +497 -0
- package/dist/cjs/alert-dialog.cjs +65 -0
- package/dist/cjs/avatar.cjs +234 -0
- package/dist/cjs/button.cjs +54 -0
- package/dist/cjs/checkbox-group.cjs +165 -0
- package/dist/cjs/checkbox.cjs +475 -0
- package/dist/cjs/collapsible.cjs +700 -0
- package/dist/cjs/context-menu.cjs +257 -0
- package/dist/cjs/csp-provider.cjs +40 -0
- package/dist/cjs/dialog.cjs +741 -0
- package/dist/cjs/direction-provider.cjs +35 -0
- package/dist/cjs/field.cjs +559 -0
- package/dist/cjs/fieldset.cjs +101 -0
- package/dist/cjs/form.cjs +177 -0
- package/dist/cjs/index.cjs +133 -0
- package/dist/cjs/input.cjs +32 -0
- package/dist/cjs/internal.cjs +51 -0
- package/dist/cjs/menu.cjs +2420 -0
- package/dist/cjs/menubar.cjs +132 -0
- package/dist/cjs/merge-props.cjs +34 -0
- package/dist/cjs/meter.cjs +169 -0
- package/dist/cjs/number-field.cjs +812 -0
- package/dist/cjs/popover.cjs +966 -0
- package/dist/cjs/preview-card.cjs +632 -0
- package/dist/cjs/progress.cjs +206 -0
- package/dist/cjs/radio-group.cjs +264 -0
- package/dist/cjs/radio.cjs +327 -0
- package/dist/cjs/separator.cjs +44 -0
- package/dist/cjs/slider.cjs +1384 -0
- package/dist/cjs/switch.cjs +306 -0
- package/dist/cjs/tabs.cjs +727 -0
- package/dist/cjs/toast.cjs +1766 -0
- package/dist/cjs/toggle-group.cjs +118 -0
- package/dist/cjs/toggle.cjs +121 -0
- package/dist/cjs/tooltip.cjs +835 -0
- package/dist/cjs/unstable-use-media-query.cjs +79 -0
- package/dist/cjs/use-render.cjs +40 -0
- package/dist/cjs/utils/CSPContext.cjs +38 -0
- package/dist/cjs/utils/CheckboxGroupContext.cjs +40 -0
- package/dist/cjs/utils/CompositeRootContext.cjs +40 -0
- package/dist/cjs/utils/ContextMenuRootContext.cjs +42 -0
- package/dist/cjs/utils/DirectionContext.cjs +34 -0
- package/dist/cjs/utils/FloatingPortalLite.cjs +47 -0
- package/dist/cjs/utils/InternalBackdrop.cjs +49 -0
- package/dist/cjs/utils/MenubarContext.cjs +40 -0
- package/dist/cjs/utils/RadioGroupContext.cjs +34 -0
- package/dist/cjs/utils/RequestQueue.cjs +111 -0
- package/dist/cjs/utils/TimeoutManager.cjs +50 -0
- package/dist/cjs/utils/ToggleGroupContext.cjs +40 -0
- package/dist/cjs/utils/adaptiveOriginMiddleware.cjs +94 -0
- package/dist/cjs/utils/addEventListener.cjs +33 -0
- package/dist/cjs/utils/areArraysEqual.cjs +30 -0
- package/dist/cjs/utils/clamp.cjs +30 -0
- package/dist/cjs/utils/closePart.cjs +70 -0
- package/dist/cjs/utils/collapsibleOpenStateMapping.cjs +42 -0
- package/dist/cjs/utils/composeRefs.cjs +68 -0
- package/dist/cjs/utils/composite/CompositeItem.cjs +59 -0
- package/dist/cjs/utils/composite/CompositeList.cjs +177 -0
- package/dist/cjs/utils/composite/CompositeListContext.cjs +43 -0
- package/dist/cjs/utils/composite/CompositeRoot.cjs +118 -0
- package/dist/cjs/utils/composite/grid-utils.cjs +343 -0
- package/dist/cjs/utils/composite/gridNavigation.cjs +92 -0
- package/dist/cjs/utils/composite/keys.cjs +174 -0
- package/dist/cjs/utils/composite/list-utils.cjs +90 -0
- package/dist/cjs/utils/composite/useCompositeItem.cjs +63 -0
- package/dist/cjs/utils/composite/useCompositeListItem.cjs +104 -0
- package/dist/cjs/utils/composite/useCompositeRoot.cjs +263 -0
- package/dist/cjs/utils/constants.cjs +56 -0
- package/dist/cjs/utils/contains.cjs +46 -0
- package/dist/cjs/utils/createChangeEventDetails.cjs +92 -0
- package/dist/cjs/utils/dom.cjs +35 -0
- package/dist/cjs/utils/empty.cjs +34 -0
- package/dist/cjs/utils/field/FieldItemContext.cjs +34 -0
- package/dist/cjs/utils/field/FieldRootContext.cjs +80 -0
- package/dist/cjs/utils/field/FormContext.cjs +41 -0
- package/dist/cjs/utils/field/LabelableContext.cjs +43 -0
- package/dist/cjs/utils/field/LabelableProvider.cjs +115 -0
- package/dist/cjs/utils/field/constants.cjs +68 -0
- package/dist/cjs/utils/field/getCombinedFieldValidityData.cjs +36 -0
- package/dist/cjs/utils/field/useAriaLabelledBy.cjs +87 -0
- package/dist/cjs/utils/field/useFieldControlRegistration.cjs +165 -0
- package/dist/cjs/utils/field/useFieldValidation.cjs +285 -0
- package/dist/cjs/utils/field/useLabel.cjs +99 -0
- package/dist/cjs/utils/field/useLabelableId.cjs +105 -0
- package/dist/cjs/utils/field/useRegisterFieldControl.cjs +60 -0
- package/dist/cjs/utils/findRootOwnerId.cjs +37 -0
- package/dist/cjs/utils/floating/FloatingDelayGroup.cjs +219 -0
- package/dist/cjs/utils/floating/FloatingFocusManager.cjs +685 -0
- package/dist/cjs/utils/floating/FloatingPortal.cjs +230 -0
- package/dist/cjs/utils/floating/FloatingRootStore.cjs +87 -0
- package/dist/cjs/utils/floating/FloatingTree.cjs +86 -0
- package/dist/cjs/utils/floating/FloatingTreeStore.cjs +41 -0
- package/dist/cjs/utils/floating/FocusGuard.cjs +54 -0
- package/dist/cjs/utils/floating/composite.cjs +42 -0
- package/dist/cjs/utils/floating/constants.cjs +34 -0
- package/dist/cjs/utils/floating/createAttribute.cjs +30 -0
- package/dist/cjs/utils/floating/createEventEmitter.cjs +44 -0
- package/dist/cjs/utils/floating/element.cjs +103 -0
- package/dist/cjs/utils/floating/enqueueFocus.cjs +51 -0
- package/dist/cjs/utils/floating/event.cjs +65 -0
- package/dist/cjs/utils/floating/getEmptyRootContext.cjs +42 -0
- package/dist/cjs/utils/floating/gridNavigation.cjs +45 -0
- package/dist/cjs/utils/floating/markOthers.cjs +181 -0
- package/dist/cjs/utils/floating/nodes.cjs +48 -0
- package/dist/cjs/utils/floating/safePolygon.cjs +301 -0
- package/dist/cjs/utils/floating/tabbable.cjs +242 -0
- package/dist/cjs/utils/floating/types.cjs +16 -0
- package/dist/cjs/utils/floating/useClick.cjs +153 -0
- package/dist/cjs/utils/floating/useClientPoint.cjs +225 -0
- package/dist/cjs/utils/floating/useDismiss.cjs +506 -0
- package/dist/cjs/utils/floating/useFloating.cjs +186 -0
- package/dist/cjs/utils/floating/useFloatingRootContext.cjs +75 -0
- package/dist/cjs/utils/floating/useFocus.cjs +184 -0
- package/dist/cjs/utils/floating/useHoverFloatingInteraction.cjs +231 -0
- package/dist/cjs/utils/floating/useHoverInteractionSharedState.cjs +113 -0
- package/dist/cjs/utils/floating/useHoverReferenceInteraction.cjs +380 -0
- package/dist/cjs/utils/floating/useHoverShared.cjs +65 -0
- package/dist/cjs/utils/floating/useListNavigation.cjs +665 -0
- package/dist/cjs/utils/floating/useSyncedFloatingRootContext.cjs +91 -0
- package/dist/cjs/utils/floating/useTypeahead.cjs +187 -0
- package/dist/cjs/utils/formatNumber.cjs +60 -0
- package/dist/cjs/utils/generateId.cjs +32 -0
- package/dist/cjs/utils/getCssDimensions.cjs +42 -0
- package/dist/cjs/utils/getDefaultFormSubmitter.cjs +42 -0
- package/dist/cjs/utils/getDisabledMountTransitionStyles.cjs +32 -0
- package/dist/cjs/utils/getElementRef.cjs +35 -0
- package/dist/cjs/utils/getPseudoElementBounds.cjs +56 -0
- package/dist/cjs/utils/getStateAttributesProps.cjs +46 -0
- package/dist/cjs/utils/hideMiddleware.cjs +42 -0
- package/dist/cjs/utils/inertValue.cjs +30 -0
- package/dist/cjs/utils/matchesFocusVisible.cjs +38 -0
- package/dist/cjs/utils/mergeCleanups.cjs +37 -0
- package/dist/cjs/utils/mergeObjects.cjs +39 -0
- package/dist/cjs/utils/mergeProps.cjs +182 -0
- package/dist/cjs/utils/noop.cjs +29 -0
- package/dist/cjs/utils/number/constants.cjs +34 -0
- package/dist/cjs/utils/number/parse.cjs +258 -0
- package/dist/cjs/utils/number/types.cjs +16 -0
- package/dist/cjs/utils/number/validate.cjs +104 -0
- package/dist/cjs/utils/owner.cjs +35 -0
- package/dist/cjs/utils/platform.cjs +83 -0
- package/dist/cjs/utils/popupStateMapping.cjs +74 -0
- package/dist/cjs/utils/popups/index.cjs +39 -0
- package/dist/cjs/utils/popups/inlineRect.cjs +218 -0
- package/dist/cjs/utils/popups/popupStoreUtils.cjs +379 -0
- package/dist/cjs/utils/popups/popupTriggerMap.cjs +76 -0
- package/dist/cjs/utils/popups/store.cjs +118 -0
- package/dist/cjs/utils/popups/useTriggerFocusGuards.cjs +72 -0
- package/dist/cjs/utils/resolveAriaLabelledBy.cjs +35 -0
- package/dist/cjs/utils/resolveClassName.cjs +30 -0
- package/dist/cjs/utils/resolveRef.cjs +33 -0
- package/dist/cjs/utils/resolveStyle.cjs +30 -0
- package/dist/cjs/utils/serializeValue.cjs +40 -0
- package/dist/cjs/utils/slider/asc.cjs +30 -0
- package/dist/cjs/utils/slider/getMidpoint.cjs +34 -0
- package/dist/cjs/utils/slider/getPushedThumbValues.cjs +73 -0
- package/dist/cjs/utils/slider/getSliderValue.cjs +42 -0
- package/dist/cjs/utils/slider/replaceArrayItemAtIndex.cjs +33 -0
- package/dist/cjs/utils/slider/resolveThumbCollision.cjs +155 -0
- package/dist/cjs/utils/slider/roundValueToStep.cjs +45 -0
- package/dist/cjs/utils/slider/validateMinimumDistance.cjs +40 -0
- package/dist/cjs/utils/slider/valueArrayToPercentages.cjs +36 -0
- package/dist/cjs/utils/store/ReactStore.cjs +135 -0
- package/dist/cjs/utils/store/Store.cjs +83 -0
- package/dist/cjs/utils/store/createSelector.cjs +74 -0
- package/dist/cjs/utils/store/useStore.cjs +51 -0
- package/dist/cjs/utils/stringifyLocale.cjs +36 -0
- package/dist/cjs/utils/useAnchorPositioning.cjs +421 -0
- package/dist/cjs/utils/useAnchoredPopupScrollLock.cjs +59 -0
- package/dist/cjs/utils/useAnimationFrame.cjs +93 -0
- package/dist/cjs/utils/useAnimationsFinished.cjs +98 -0
- package/dist/cjs/utils/useBaseUiId.cjs +36 -0
- package/dist/cjs/utils/useButton.cjs +177 -0
- package/dist/cjs/utils/useCheckboxGroupParent.cjs +114 -0
- package/dist/cjs/utils/useControlled.cjs +47 -0
- package/dist/cjs/utils/useEnhancedClickHandler.cjs +60 -0
- package/dist/cjs/utils/useFocusableWhenDisabled.cjs +77 -0
- package/dist/cjs/utils/useForcedRerendering.cjs +35 -0
- package/dist/cjs/utils/useIsHydrating.cjs +44 -0
- package/dist/cjs/utils/useMixedToggleClickHandler.cjs +66 -0
- package/dist/cjs/utils/useOnFirstRender.cjs +35 -0
- package/dist/cjs/utils/useOnMount.cjs +36 -0
- package/dist/cjs/utils/useOpenChangeComplete.cjs +57 -0
- package/dist/cjs/utils/useOpenInteractionType.cjs +69 -0
- package/dist/cjs/utils/usePopupAutoResize.cjs +191 -0
- package/dist/cjs/utils/usePopupViewport.cjs +283 -0
- package/dist/cjs/utils/usePositioner.cjs +53 -0
- package/dist/cjs/utils/usePressAndHold.cjs +51 -0
- package/dist/cjs/utils/usePreviousValue.cjs +47 -0
- package/dist/cjs/utils/useRefWithInit.cjs +41 -0
- package/dist/cjs/utils/useRegisteredLabelId.cjs +48 -0
- package/dist/cjs/utils/useRenderElement.cjs +106 -0
- package/dist/cjs/utils/useScrollLock.cjs +232 -0
- package/dist/cjs/utils/useStableCallback.cjs +41 -0
- package/dist/cjs/utils/useTimeout.cjs +66 -0
- package/dist/cjs/utils/useTransitionStatus.cjs +116 -0
- package/dist/cjs/utils/useValueAsRef.cjs +43 -0
- package/dist/cjs/utils/useValueChanged.cjs +55 -0
- package/dist/cjs/utils/valueToPercent.cjs +30 -0
- package/dist/cjs/utils/visuallyHidden.cjs +49 -0
- package/package.json +20 -8
|
@@ -0,0 +1,230 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
var FloatingPortal_exports = {};
|
|
20
|
+
__export(FloatingPortal_exports, {
|
|
21
|
+
FloatingPortal: () => FloatingPortal,
|
|
22
|
+
useFloatingPortalNode: () => useFloatingPortalNode,
|
|
23
|
+
usePortalContext: () => usePortalContext
|
|
24
|
+
});
|
|
25
|
+
module.exports = __toCommonJS(FloatingPortal_exports);
|
|
26
|
+
var import_octane = require("octane");
|
|
27
|
+
var import_dom = require("@floating-ui/utils/dom");
|
|
28
|
+
var import_internal = require("../../internal.cjs");
|
|
29
|
+
var import_useStableCallback = require("../useStableCallback.cjs");
|
|
30
|
+
var import_addEventListener = require("../addEventListener.cjs");
|
|
31
|
+
var import_mergeCleanups = require("../mergeCleanups.cjs");
|
|
32
|
+
var import_empty = require("../empty.cjs");
|
|
33
|
+
var import_useRenderElement = require("../useRenderElement.cjs");
|
|
34
|
+
var import_createAttribute = require("./createAttribute.cjs");
|
|
35
|
+
var import_FocusGuard = require("./FocusGuard.cjs");
|
|
36
|
+
var import_tabbable = require("./tabbable.cjs");
|
|
37
|
+
var import_createChangeEventDetails = require("../createChangeEventDetails.cjs");
|
|
38
|
+
const ownerVisuallyHidden = {
|
|
39
|
+
clipPath: "inset(50%)",
|
|
40
|
+
position: "fixed",
|
|
41
|
+
top: 0,
|
|
42
|
+
left: 0
|
|
43
|
+
};
|
|
44
|
+
const PortalContext = (0, import_octane.createContext)(null);
|
|
45
|
+
const usePortalContext = () => (0, import_octane.useContext)(PortalContext);
|
|
46
|
+
const attr = (0, import_createAttribute.createAttribute)("portal");
|
|
47
|
+
function useFloatingPortalNode(userProps, slot) {
|
|
48
|
+
const { ref, container: containerProp, componentProps = import_empty.EMPTY_OBJECT, elementProps } = userProps;
|
|
49
|
+
const uniqueId = (0, import_octane.useId)((0, import_internal.subSlot)(slot, "id"));
|
|
50
|
+
const portalContext = usePortalContext();
|
|
51
|
+
const parentPortalNode = portalContext?.portalNode;
|
|
52
|
+
const [containerElement, setContainerElement] = (0, import_octane.useState)(
|
|
53
|
+
null,
|
|
54
|
+
(0, import_internal.subSlot)(slot, "cel")
|
|
55
|
+
);
|
|
56
|
+
const [portalNode, setPortalNode] = (0, import_octane.useState)(null, (0, import_internal.subSlot)(slot, "pn"));
|
|
57
|
+
const setPortalNodeRef = (0, import_useStableCallback.useStableCallback)(
|
|
58
|
+
(node) => {
|
|
59
|
+
if (node !== null) {
|
|
60
|
+
setPortalNode(node);
|
|
61
|
+
}
|
|
62
|
+
},
|
|
63
|
+
(0, import_internal.subSlot)(slot, "pnr")
|
|
64
|
+
);
|
|
65
|
+
const containerRef = (0, import_octane.useRef)(null, (0, import_internal.subSlot)(slot, "cref"));
|
|
66
|
+
(0, import_octane.useLayoutEffect)(
|
|
67
|
+
() => {
|
|
68
|
+
if (containerProp === null) {
|
|
69
|
+
if (containerRef.current) {
|
|
70
|
+
containerRef.current = null;
|
|
71
|
+
setPortalNode(null);
|
|
72
|
+
setContainerElement(null);
|
|
73
|
+
}
|
|
74
|
+
return;
|
|
75
|
+
}
|
|
76
|
+
if (uniqueId == null) {
|
|
77
|
+
return;
|
|
78
|
+
}
|
|
79
|
+
const resolvedContainer = (containerProp && ((0, import_dom.isNode)(containerProp) ? containerProp : containerProp.current)) ?? parentPortalNode ?? document.body;
|
|
80
|
+
if (resolvedContainer == null) {
|
|
81
|
+
if (containerRef.current) {
|
|
82
|
+
containerRef.current = null;
|
|
83
|
+
setPortalNode(null);
|
|
84
|
+
setContainerElement(null);
|
|
85
|
+
}
|
|
86
|
+
return;
|
|
87
|
+
}
|
|
88
|
+
if (containerRef.current !== resolvedContainer) {
|
|
89
|
+
containerRef.current = resolvedContainer;
|
|
90
|
+
setPortalNode(null);
|
|
91
|
+
setContainerElement(resolvedContainer);
|
|
92
|
+
}
|
|
93
|
+
},
|
|
94
|
+
[containerProp, parentPortalNode, uniqueId],
|
|
95
|
+
(0, import_internal.subSlot)(slot, "e:container")
|
|
96
|
+
);
|
|
97
|
+
const portalElement = (0, import_useRenderElement.useRenderElement)(
|
|
98
|
+
"div",
|
|
99
|
+
componentProps,
|
|
100
|
+
{
|
|
101
|
+
ref: [ref, setPortalNodeRef],
|
|
102
|
+
props: [{ id: uniqueId, [attr]: "" }, elementProps]
|
|
103
|
+
},
|
|
104
|
+
(0, import_internal.subSlot)(slot, "re")
|
|
105
|
+
);
|
|
106
|
+
const portalSubtree = containerElement && portalElement ? (0, import_octane.createPortal)(portalElement, containerElement) : null;
|
|
107
|
+
return { portalNode, portalSubtree };
|
|
108
|
+
}
|
|
109
|
+
function FloatingPortal(componentProps) {
|
|
110
|
+
const slot = (0, import_internal.S)("FloatingPortal");
|
|
111
|
+
const { render, className, style, children, container, renderGuards, ref, ...elementProps } = componentProps;
|
|
112
|
+
const { portalNode, portalSubtree } = useFloatingPortalNode(
|
|
113
|
+
{ container, ref, componentProps: { render, className, style }, elementProps },
|
|
114
|
+
(0, import_internal.subSlot)(slot, "node")
|
|
115
|
+
);
|
|
116
|
+
const beforeOutsideRef = (0, import_octane.useRef)(null, (0, import_internal.subSlot)(slot, "bo"));
|
|
117
|
+
const afterOutsideRef = (0, import_octane.useRef)(null, (0, import_internal.subSlot)(slot, "ao"));
|
|
118
|
+
const beforeInsideRef = (0, import_octane.useRef)(null, (0, import_internal.subSlot)(slot, "bi"));
|
|
119
|
+
const afterInsideRef = (0, import_octane.useRef)(null, (0, import_internal.subSlot)(slot, "ai"));
|
|
120
|
+
const [focusManagerState, setFocusManagerState] = (0, import_octane.useState)(
|
|
121
|
+
null,
|
|
122
|
+
(0, import_internal.subSlot)(slot, "fms")
|
|
123
|
+
);
|
|
124
|
+
const focusInsideDisabledRef = (0, import_octane.useRef)(false, (0, import_internal.subSlot)(slot, "fid"));
|
|
125
|
+
const modal = focusManagerState?.modal;
|
|
126
|
+
const open = focusManagerState?.open;
|
|
127
|
+
const shouldRenderGuards = typeof renderGuards === "boolean" ? renderGuards : !!focusManagerState && !focusManagerState.modal && focusManagerState.open && !!portalNode;
|
|
128
|
+
(0, import_octane.useEffect)(
|
|
129
|
+
() => {
|
|
130
|
+
if (!portalNode || modal) {
|
|
131
|
+
return void 0;
|
|
132
|
+
}
|
|
133
|
+
function onFocus(event) {
|
|
134
|
+
if (portalNode && event.relatedTarget && (0, import_tabbable.isOutsideEvent)(event)) {
|
|
135
|
+
if (event.type === "focusin") {
|
|
136
|
+
if (focusInsideDisabledRef.current) {
|
|
137
|
+
(0, import_tabbable.enableFocusInside)(portalNode);
|
|
138
|
+
focusInsideDisabledRef.current = false;
|
|
139
|
+
}
|
|
140
|
+
} else {
|
|
141
|
+
(0, import_tabbable.disableFocusInside)(portalNode);
|
|
142
|
+
focusInsideDisabledRef.current = true;
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
return (0, import_mergeCleanups.mergeCleanups)(
|
|
147
|
+
(0, import_addEventListener.addEventListener)(portalNode, "focusin", onFocus, true),
|
|
148
|
+
(0, import_addEventListener.addEventListener)(portalNode, "focusout", onFocus, true)
|
|
149
|
+
);
|
|
150
|
+
},
|
|
151
|
+
[portalNode, modal],
|
|
152
|
+
(0, import_internal.subSlot)(slot, "e:tab")
|
|
153
|
+
);
|
|
154
|
+
(0, import_octane.useLayoutEffect)(
|
|
155
|
+
() => {
|
|
156
|
+
if (!portalNode || open !== true || !focusInsideDisabledRef.current) {
|
|
157
|
+
return;
|
|
158
|
+
}
|
|
159
|
+
(0, import_tabbable.enableFocusInside)(portalNode);
|
|
160
|
+
focusInsideDisabledRef.current = false;
|
|
161
|
+
},
|
|
162
|
+
[open, portalNode],
|
|
163
|
+
(0, import_internal.subSlot)(slot, "e:enable")
|
|
164
|
+
);
|
|
165
|
+
const portalContextValue = (0, import_octane.useMemo)(
|
|
166
|
+
() => ({
|
|
167
|
+
beforeOutsideRef,
|
|
168
|
+
afterOutsideRef,
|
|
169
|
+
beforeInsideRef,
|
|
170
|
+
afterInsideRef,
|
|
171
|
+
portalNode,
|
|
172
|
+
setFocusManagerState
|
|
173
|
+
}),
|
|
174
|
+
[portalNode],
|
|
175
|
+
(0, import_internal.subSlot)(slot, "ctx")
|
|
176
|
+
);
|
|
177
|
+
return [
|
|
178
|
+
(0, import_octane.createElement)(import_octane.Fragment, { key: "portal-subtree", children: portalSubtree }),
|
|
179
|
+
(0, import_octane.createElement)(PortalContext.Provider, {
|
|
180
|
+
key: "portal-context",
|
|
181
|
+
value: portalContextValue,
|
|
182
|
+
children: [
|
|
183
|
+
shouldRenderGuards && portalNode ? (0, import_octane.createElement)(import_FocusGuard.FocusGuard, {
|
|
184
|
+
key: "guard-before",
|
|
185
|
+
"data-type": "outside",
|
|
186
|
+
ref: beforeOutsideRef,
|
|
187
|
+
onFocus(event) {
|
|
188
|
+
if ((0, import_tabbable.isOutsideEvent)(event, portalNode)) {
|
|
189
|
+
beforeInsideRef.current?.focus();
|
|
190
|
+
} else {
|
|
191
|
+
const domReference = focusManagerState ? focusManagerState.domReference : null;
|
|
192
|
+
(0, import_tabbable.getPreviousTabbable)(domReference)?.focus();
|
|
193
|
+
}
|
|
194
|
+
}
|
|
195
|
+
}) : null,
|
|
196
|
+
shouldRenderGuards && portalNode ? (0, import_octane.createElement)("span", {
|
|
197
|
+
key: "aria-owns",
|
|
198
|
+
"aria-owns": portalNode.id,
|
|
199
|
+
style: ownerVisuallyHidden
|
|
200
|
+
}) : null,
|
|
201
|
+
portalNode ? (0, import_octane.createElement)(import_octane.Fragment, { key: "portal", children: (0, import_octane.createPortal)(children, portalNode) }) : null,
|
|
202
|
+
shouldRenderGuards && portalNode ? (0, import_octane.createElement)(import_FocusGuard.FocusGuard, {
|
|
203
|
+
key: "guard-after",
|
|
204
|
+
"data-type": "outside",
|
|
205
|
+
ref: afterOutsideRef,
|
|
206
|
+
onFocus(event) {
|
|
207
|
+
if ((0, import_tabbable.isOutsideEvent)(event, portalNode)) {
|
|
208
|
+
afterInsideRef.current?.focus();
|
|
209
|
+
} else {
|
|
210
|
+
const domReference = focusManagerState ? focusManagerState.domReference : null;
|
|
211
|
+
(0, import_tabbable.getNextTabbable)(domReference)?.focus();
|
|
212
|
+
if (focusManagerState?.closeOnFocusOut) {
|
|
213
|
+
focusManagerState?.onOpenChange(
|
|
214
|
+
false,
|
|
215
|
+
(0, import_createChangeEventDetails.createChangeEventDetails)(import_createChangeEventDetails.REASONS.focusOut, event)
|
|
216
|
+
);
|
|
217
|
+
}
|
|
218
|
+
}
|
|
219
|
+
}
|
|
220
|
+
}) : null
|
|
221
|
+
]
|
|
222
|
+
})
|
|
223
|
+
];
|
|
224
|
+
}
|
|
225
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
226
|
+
0 && (module.exports = {
|
|
227
|
+
FloatingPortal,
|
|
228
|
+
useFloatingPortalNode,
|
|
229
|
+
usePortalContext
|
|
230
|
+
});
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
var FloatingRootStore_exports = {};
|
|
20
|
+
__export(FloatingRootStore_exports, {
|
|
21
|
+
FloatingRootStore: () => FloatingRootStore
|
|
22
|
+
});
|
|
23
|
+
module.exports = __toCommonJS(FloatingRootStore_exports);
|
|
24
|
+
var import_createSelector = require("../store/createSelector.cjs");
|
|
25
|
+
var import_ReactStore = require("../store/ReactStore.cjs");
|
|
26
|
+
var import_createEventEmitter = require("./createEventEmitter.cjs");
|
|
27
|
+
var import_event = require("./event.cjs");
|
|
28
|
+
const selectors = {
|
|
29
|
+
open: (0, import_createSelector.createSelector)((state) => state.open),
|
|
30
|
+
transitionStatus: (0, import_createSelector.createSelector)((state) => state.transitionStatus),
|
|
31
|
+
domReferenceElement: (0, import_createSelector.createSelector)((state) => state.domReferenceElement),
|
|
32
|
+
referenceElement: (0, import_createSelector.createSelector)(
|
|
33
|
+
(state) => state.positionReference ?? state.referenceElement
|
|
34
|
+
),
|
|
35
|
+
floatingElement: (0, import_createSelector.createSelector)((state) => state.floatingElement),
|
|
36
|
+
floatingId: (0, import_createSelector.createSelector)((state) => state.floatingId)
|
|
37
|
+
};
|
|
38
|
+
class FloatingRootStore extends import_ReactStore.ReactStore {
|
|
39
|
+
syncOnly;
|
|
40
|
+
constructor(options) {
|
|
41
|
+
const { syncOnly, nested, onOpenChange, triggerElements, ...initialState } = options;
|
|
42
|
+
super(
|
|
43
|
+
{
|
|
44
|
+
...initialState,
|
|
45
|
+
positionReference: initialState.referenceElement,
|
|
46
|
+
domReferenceElement: initialState.referenceElement
|
|
47
|
+
},
|
|
48
|
+
{
|
|
49
|
+
onOpenChange,
|
|
50
|
+
dataRef: { current: {} },
|
|
51
|
+
events: (0, import_createEventEmitter.createEventEmitter)(),
|
|
52
|
+
nested,
|
|
53
|
+
triggerElements
|
|
54
|
+
},
|
|
55
|
+
selectors
|
|
56
|
+
);
|
|
57
|
+
this.syncOnly = syncOnly;
|
|
58
|
+
}
|
|
59
|
+
syncOpenEvent = (newOpen, event) => {
|
|
60
|
+
if (!newOpen || !this.state.open || event != null && (0, import_event.isClickLikeEvent)(event)) {
|
|
61
|
+
this.context.dataRef.current.openEvent = newOpen ? event : void 0;
|
|
62
|
+
}
|
|
63
|
+
};
|
|
64
|
+
dispatchOpenChange = (newOpen, eventDetails) => {
|
|
65
|
+
this.syncOpenEvent(newOpen, eventDetails.event);
|
|
66
|
+
const details = {
|
|
67
|
+
open: newOpen,
|
|
68
|
+
reason: eventDetails.reason,
|
|
69
|
+
nativeEvent: eventDetails.event,
|
|
70
|
+
nested: this.context.nested,
|
|
71
|
+
triggerElement: eventDetails.trigger
|
|
72
|
+
};
|
|
73
|
+
this.context.events.emit("openchange", details);
|
|
74
|
+
};
|
|
75
|
+
setOpen = (newOpen, eventDetails) => {
|
|
76
|
+
if (this.syncOnly) {
|
|
77
|
+
this.context.onOpenChange?.(newOpen, eventDetails);
|
|
78
|
+
return;
|
|
79
|
+
}
|
|
80
|
+
this.dispatchOpenChange(newOpen, eventDetails);
|
|
81
|
+
this.context.onOpenChange?.(newOpen, eventDetails);
|
|
82
|
+
};
|
|
83
|
+
}
|
|
84
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
85
|
+
0 && (module.exports = {
|
|
86
|
+
FloatingRootStore
|
|
87
|
+
});
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
var FloatingTree_exports = {};
|
|
20
|
+
__export(FloatingTree_exports, {
|
|
21
|
+
FloatingNode: () => FloatingNode,
|
|
22
|
+
FloatingTree: () => FloatingTree,
|
|
23
|
+
FloatingTreeStore: () => import_FloatingTreeStore.FloatingTreeStore,
|
|
24
|
+
useFloatingNodeId: () => useFloatingNodeId,
|
|
25
|
+
useFloatingParentNodeId: () => useFloatingParentNodeId,
|
|
26
|
+
useFloatingTree: () => useFloatingTree
|
|
27
|
+
});
|
|
28
|
+
module.exports = __toCommonJS(FloatingTree_exports);
|
|
29
|
+
var import_octane = require("octane");
|
|
30
|
+
var import_internal = require("../../internal.cjs");
|
|
31
|
+
var import_useBaseUiId = require("../useBaseUiId.cjs");
|
|
32
|
+
var import_useRefWithInit = require("../useRefWithInit.cjs");
|
|
33
|
+
var import_octane2 = require("octane");
|
|
34
|
+
var import_FloatingTreeStore = require("./FloatingTreeStore.cjs");
|
|
35
|
+
const FloatingNodeContext = (0, import_octane.createContext)(null);
|
|
36
|
+
const FloatingTreeContext = (0, import_octane.createContext)(null);
|
|
37
|
+
const useFloatingParentNodeId = () => (0, import_octane.useContext)(FloatingNodeContext)?.id || null;
|
|
38
|
+
const useFloatingTree = (externalTree) => {
|
|
39
|
+
const contextTree = (0, import_octane.useContext)(FloatingTreeContext);
|
|
40
|
+
return externalTree ?? contextTree;
|
|
41
|
+
};
|
|
42
|
+
function useFloatingNodeId(externalTree, slot) {
|
|
43
|
+
const id = (0, import_useBaseUiId.useBaseUiId)(void 0, (0, import_internal.subSlot)(slot, "id"));
|
|
44
|
+
const tree = useFloatingTree(externalTree);
|
|
45
|
+
const parentId = useFloatingParentNodeId();
|
|
46
|
+
(0, import_octane2.useLayoutEffect)(
|
|
47
|
+
() => {
|
|
48
|
+
if (!id) {
|
|
49
|
+
return void 0;
|
|
50
|
+
}
|
|
51
|
+
const node = { id, parentId };
|
|
52
|
+
tree?.addNode(node);
|
|
53
|
+
return () => {
|
|
54
|
+
tree?.removeNode(node);
|
|
55
|
+
};
|
|
56
|
+
},
|
|
57
|
+
[tree, id, parentId],
|
|
58
|
+
(0, import_internal.subSlot)(slot, "e")
|
|
59
|
+
);
|
|
60
|
+
return id;
|
|
61
|
+
}
|
|
62
|
+
function FloatingNode(props) {
|
|
63
|
+
const slot = (0, import_internal.S)("FloatingNode");
|
|
64
|
+
const { children, id } = props;
|
|
65
|
+
const parentId = useFloatingParentNodeId();
|
|
66
|
+
const value = (0, import_octane.useMemo)(() => ({ id, parentId }), [id, parentId], (0, import_internal.subSlot)(slot, "v"));
|
|
67
|
+
return (0, import_octane.createElement)(FloatingNodeContext.Provider, { value, children });
|
|
68
|
+
}
|
|
69
|
+
function FloatingTree(props) {
|
|
70
|
+
const slot = (0, import_internal.S)("FloatingTree");
|
|
71
|
+
const { children, externalTree } = props;
|
|
72
|
+
const tree = (0, import_useRefWithInit.useRefWithInit)(
|
|
73
|
+
() => externalTree ?? new import_FloatingTreeStore.FloatingTreeStore(),
|
|
74
|
+
(0, import_internal.subSlot)(slot, "tree")
|
|
75
|
+
).current;
|
|
76
|
+
return (0, import_octane.createElement)(FloatingTreeContext.Provider, { value: tree, children });
|
|
77
|
+
}
|
|
78
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
79
|
+
0 && (module.exports = {
|
|
80
|
+
FloatingNode,
|
|
81
|
+
FloatingTree,
|
|
82
|
+
FloatingTreeStore,
|
|
83
|
+
useFloatingNodeId,
|
|
84
|
+
useFloatingParentNodeId,
|
|
85
|
+
useFloatingTree
|
|
86
|
+
});
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
var FloatingTreeStore_exports = {};
|
|
20
|
+
__export(FloatingTreeStore_exports, {
|
|
21
|
+
FloatingTreeStore: () => FloatingTreeStore
|
|
22
|
+
});
|
|
23
|
+
module.exports = __toCommonJS(FloatingTreeStore_exports);
|
|
24
|
+
var import_createEventEmitter = require("./createEventEmitter.cjs");
|
|
25
|
+
class FloatingTreeStore {
|
|
26
|
+
nodesRef = { current: [] };
|
|
27
|
+
events = (0, import_createEventEmitter.createEventEmitter)();
|
|
28
|
+
addNode(node) {
|
|
29
|
+
this.nodesRef.current.push(node);
|
|
30
|
+
}
|
|
31
|
+
removeNode(node) {
|
|
32
|
+
const index = this.nodesRef.current.findIndex((n) => n === node);
|
|
33
|
+
if (index !== -1) {
|
|
34
|
+
this.nodesRef.current.splice(index, 1);
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
39
|
+
0 && (module.exports = {
|
|
40
|
+
FloatingTreeStore
|
|
41
|
+
});
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
var FocusGuard_exports = {};
|
|
20
|
+
__export(FocusGuard_exports, {
|
|
21
|
+
FocusGuard: () => FocusGuard
|
|
22
|
+
});
|
|
23
|
+
module.exports = __toCommonJS(FocusGuard_exports);
|
|
24
|
+
var import_octane = require("octane");
|
|
25
|
+
var import_internal = require("../../internal.cjs");
|
|
26
|
+
var import_platform = require("../platform.cjs");
|
|
27
|
+
var import_visuallyHidden = require("../visuallyHidden.cjs");
|
|
28
|
+
function FocusGuard(props) {
|
|
29
|
+
const slot = (0, import_internal.S)("FocusGuard");
|
|
30
|
+
const { ref, ...rest } = props;
|
|
31
|
+
const [role, setRole] = (0, import_octane.useState)(void 0, (0, import_internal.subSlot)(slot, "role"));
|
|
32
|
+
(0, import_octane.useLayoutEffect)(
|
|
33
|
+
() => {
|
|
34
|
+
if (import_platform.platform.screenReader.voiceOver && import_platform.platform.engine.webkit) {
|
|
35
|
+
setRole("button");
|
|
36
|
+
}
|
|
37
|
+
},
|
|
38
|
+
[],
|
|
39
|
+
(0, import_internal.subSlot)(slot, "e")
|
|
40
|
+
);
|
|
41
|
+
return (0, import_octane.createElement)("span", {
|
|
42
|
+
...rest,
|
|
43
|
+
ref,
|
|
44
|
+
style: import_visuallyHidden.visuallyHidden,
|
|
45
|
+
"aria-hidden": role ? void 0 : true,
|
|
46
|
+
tabIndex: 0,
|
|
47
|
+
role,
|
|
48
|
+
["data-base-ui-focus-guard"]: ""
|
|
49
|
+
});
|
|
50
|
+
}
|
|
51
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
52
|
+
0 && (module.exports = {
|
|
53
|
+
FocusGuard
|
|
54
|
+
});
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
var composite_exports = {};
|
|
20
|
+
__export(composite_exports, {
|
|
21
|
+
isElementVisible: () => isElementVisible,
|
|
22
|
+
isHiddenByStyles: () => isHiddenByStyles
|
|
23
|
+
});
|
|
24
|
+
module.exports = __toCommonJS(composite_exports);
|
|
25
|
+
var import_dom = require("@floating-ui/utils/dom");
|
|
26
|
+
function isHiddenByStyles(styles) {
|
|
27
|
+
return styles.visibility === "hidden" || styles.visibility === "collapse";
|
|
28
|
+
}
|
|
29
|
+
function isElementVisible(element, styles = element ? (0, import_dom.getComputedStyle)(element) : null) {
|
|
30
|
+
if (!element || !element.isConnected || !styles || isHiddenByStyles(styles)) {
|
|
31
|
+
return false;
|
|
32
|
+
}
|
|
33
|
+
if (typeof element.checkVisibility === "function") {
|
|
34
|
+
return element.checkVisibility();
|
|
35
|
+
}
|
|
36
|
+
return styles.display !== "none" && styles.display !== "contents";
|
|
37
|
+
}
|
|
38
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
39
|
+
0 && (module.exports = {
|
|
40
|
+
isElementVisible,
|
|
41
|
+
isHiddenByStyles
|
|
42
|
+
});
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
var constants_exports = {};
|
|
20
|
+
__export(constants_exports, {
|
|
21
|
+
CLICK_TRIGGER_IDENTIFIER: () => CLICK_TRIGGER_IDENTIFIER,
|
|
22
|
+
FOCUSABLE_ATTRIBUTE: () => FOCUSABLE_ATTRIBUTE,
|
|
23
|
+
TYPEABLE_SELECTOR: () => TYPEABLE_SELECTOR
|
|
24
|
+
});
|
|
25
|
+
module.exports = __toCommonJS(constants_exports);
|
|
26
|
+
const FOCUSABLE_ATTRIBUTE = "data-base-ui-focusable";
|
|
27
|
+
const CLICK_TRIGGER_IDENTIFIER = "data-base-ui-click-trigger";
|
|
28
|
+
const TYPEABLE_SELECTOR = "input:not([type='hidden']):not([disabled]),[contenteditable]:not([contenteditable='false']),textarea:not([disabled])";
|
|
29
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
30
|
+
0 && (module.exports = {
|
|
31
|
+
CLICK_TRIGGER_IDENTIFIER,
|
|
32
|
+
FOCUSABLE_ATTRIBUTE,
|
|
33
|
+
TYPEABLE_SELECTOR
|
|
34
|
+
});
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
var createAttribute_exports = {};
|
|
20
|
+
__export(createAttribute_exports, {
|
|
21
|
+
createAttribute: () => createAttribute
|
|
22
|
+
});
|
|
23
|
+
module.exports = __toCommonJS(createAttribute_exports);
|
|
24
|
+
function createAttribute(name) {
|
|
25
|
+
return `data-base-ui-${name}`;
|
|
26
|
+
}
|
|
27
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
28
|
+
0 && (module.exports = {
|
|
29
|
+
createAttribute
|
|
30
|
+
});
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
var createEventEmitter_exports = {};
|
|
20
|
+
__export(createEventEmitter_exports, {
|
|
21
|
+
createEventEmitter: () => createEventEmitter
|
|
22
|
+
});
|
|
23
|
+
module.exports = __toCommonJS(createEventEmitter_exports);
|
|
24
|
+
function createEventEmitter() {
|
|
25
|
+
const map = /* @__PURE__ */ new Map();
|
|
26
|
+
return {
|
|
27
|
+
emit(event, data) {
|
|
28
|
+
map.get(event)?.forEach((listener) => listener(data));
|
|
29
|
+
},
|
|
30
|
+
on(event, listener) {
|
|
31
|
+
if (!map.has(event)) {
|
|
32
|
+
map.set(event, /* @__PURE__ */ new Set());
|
|
33
|
+
}
|
|
34
|
+
map.get(event).add(listener);
|
|
35
|
+
},
|
|
36
|
+
off(event, listener) {
|
|
37
|
+
map.get(event)?.delete(listener);
|
|
38
|
+
}
|
|
39
|
+
};
|
|
40
|
+
}
|
|
41
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
42
|
+
0 && (module.exports = {
|
|
43
|
+
createEventEmitter
|
|
44
|
+
});
|