@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,103 @@
|
|
|
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 element_exports = {};
|
|
20
|
+
__export(element_exports, {
|
|
21
|
+
activeElement: () => activeElement,
|
|
22
|
+
contains: () => import_contains.contains,
|
|
23
|
+
getFloatingFocusElement: () => getFloatingFocusElement,
|
|
24
|
+
getTarget: () => import_list_utils.getTarget,
|
|
25
|
+
isEventTargetWithin: () => isEventTargetWithin,
|
|
26
|
+
isInteractiveElement: () => isInteractiveElement,
|
|
27
|
+
isRootElement: () => isRootElement,
|
|
28
|
+
isTargetInsideEnabledTrigger: () => isTargetInsideEnabledTrigger,
|
|
29
|
+
isTypeableCombobox: () => isTypeableCombobox,
|
|
30
|
+
isTypeableElement: () => isTypeableElement
|
|
31
|
+
});
|
|
32
|
+
module.exports = __toCommonJS(element_exports);
|
|
33
|
+
var import_dom = require("../dom.cjs");
|
|
34
|
+
var import_constants = require("./constants.cjs");
|
|
35
|
+
var import_contains = require("../contains.cjs");
|
|
36
|
+
var import_list_utils = require("../composite/list-utils.cjs");
|
|
37
|
+
function isTargetInsideEnabledTrigger(target, triggerElements) {
|
|
38
|
+
if (!(0, import_dom.isElement)(target)) {
|
|
39
|
+
return false;
|
|
40
|
+
}
|
|
41
|
+
const targetElement = target;
|
|
42
|
+
if (triggerElements.hasElement(targetElement)) {
|
|
43
|
+
return !targetElement.hasAttribute("data-trigger-disabled");
|
|
44
|
+
}
|
|
45
|
+
for (const [, trigger] of triggerElements.entries()) {
|
|
46
|
+
if ((0, import_contains.contains)(trigger, targetElement)) {
|
|
47
|
+
return !trigger.hasAttribute("data-trigger-disabled");
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
return false;
|
|
51
|
+
}
|
|
52
|
+
function isInteractiveElement(element) {
|
|
53
|
+
return element?.closest(
|
|
54
|
+
`button,a[href],[role="button"],select,[tabindex]:not([tabindex="-1"]),${import_constants.TYPEABLE_SELECTOR}`
|
|
55
|
+
) != null;
|
|
56
|
+
}
|
|
57
|
+
function activeElement(doc) {
|
|
58
|
+
let element = doc.activeElement;
|
|
59
|
+
while (element?.shadowRoot?.activeElement != null) {
|
|
60
|
+
element = element.shadowRoot.activeElement;
|
|
61
|
+
}
|
|
62
|
+
return element;
|
|
63
|
+
}
|
|
64
|
+
function isTypeableElement(element) {
|
|
65
|
+
return (0, import_dom.isHTMLElement)(element) && element.matches(import_constants.TYPEABLE_SELECTOR);
|
|
66
|
+
}
|
|
67
|
+
function isTypeableCombobox(element) {
|
|
68
|
+
if (!element) {
|
|
69
|
+
return false;
|
|
70
|
+
}
|
|
71
|
+
return element.getAttribute("role") === "combobox" && isTypeableElement(element);
|
|
72
|
+
}
|
|
73
|
+
function getFloatingFocusElement(floatingElement) {
|
|
74
|
+
if (!floatingElement) {
|
|
75
|
+
return null;
|
|
76
|
+
}
|
|
77
|
+
return floatingElement.hasAttribute(import_constants.FOCUSABLE_ATTRIBUTE) ? floatingElement : floatingElement.querySelector(`[${import_constants.FOCUSABLE_ATTRIBUTE}]`) ?? floatingElement;
|
|
78
|
+
}
|
|
79
|
+
function isEventTargetWithin(event, node) {
|
|
80
|
+
if (node == null) {
|
|
81
|
+
return false;
|
|
82
|
+
}
|
|
83
|
+
if ("composedPath" in event) {
|
|
84
|
+
return event.composedPath().includes(node);
|
|
85
|
+
}
|
|
86
|
+
return event.target != null && node.contains(event.target);
|
|
87
|
+
}
|
|
88
|
+
function isRootElement(element) {
|
|
89
|
+
return element.matches("html,body");
|
|
90
|
+
}
|
|
91
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
92
|
+
0 && (module.exports = {
|
|
93
|
+
activeElement,
|
|
94
|
+
contains,
|
|
95
|
+
getFloatingFocusElement,
|
|
96
|
+
getTarget,
|
|
97
|
+
isEventTargetWithin,
|
|
98
|
+
isInteractiveElement,
|
|
99
|
+
isRootElement,
|
|
100
|
+
isTargetInsideEnabledTrigger,
|
|
101
|
+
isTypeableCombobox,
|
|
102
|
+
isTypeableElement
|
|
103
|
+
});
|
|
@@ -0,0 +1,51 @@
|
|
|
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 enqueueFocus_exports = {};
|
|
20
|
+
__export(enqueueFocus_exports, {
|
|
21
|
+
enqueueFocus: () => enqueueFocus
|
|
22
|
+
});
|
|
23
|
+
module.exports = __toCommonJS(enqueueFocus_exports);
|
|
24
|
+
var import_empty = require("../empty.cjs");
|
|
25
|
+
let rafId = 0;
|
|
26
|
+
function enqueueFocus(el, options = {}) {
|
|
27
|
+
const { preventScroll = false, sync = false, shouldFocus } = options;
|
|
28
|
+
cancelAnimationFrame(rafId);
|
|
29
|
+
function exec() {
|
|
30
|
+
if (shouldFocus && !shouldFocus()) {
|
|
31
|
+
return;
|
|
32
|
+
}
|
|
33
|
+
el?.focus({ preventScroll });
|
|
34
|
+
}
|
|
35
|
+
if (sync) {
|
|
36
|
+
exec();
|
|
37
|
+
return import_empty.NOOP;
|
|
38
|
+
}
|
|
39
|
+
const currentRafId = requestAnimationFrame(exec);
|
|
40
|
+
rafId = currentRafId;
|
|
41
|
+
return () => {
|
|
42
|
+
if (rafId === currentRafId) {
|
|
43
|
+
cancelAnimationFrame(currentRafId);
|
|
44
|
+
rafId = 0;
|
|
45
|
+
}
|
|
46
|
+
};
|
|
47
|
+
}
|
|
48
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
49
|
+
0 && (module.exports = {
|
|
50
|
+
enqueueFocus
|
|
51
|
+
});
|
|
@@ -0,0 +1,65 @@
|
|
|
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 event_exports = {};
|
|
20
|
+
__export(event_exports, {
|
|
21
|
+
isClickLikeEvent: () => isClickLikeEvent,
|
|
22
|
+
isMouseLikePointerType: () => isMouseLikePointerType,
|
|
23
|
+
isReactEvent: () => isReactEvent,
|
|
24
|
+
isVirtualClick: () => isVirtualClick,
|
|
25
|
+
isVirtualPointerEvent: () => isVirtualPointerEvent
|
|
26
|
+
});
|
|
27
|
+
module.exports = __toCommonJS(event_exports);
|
|
28
|
+
var import_platform = require("../platform.cjs");
|
|
29
|
+
function isClickLikeEvent(event) {
|
|
30
|
+
const type = event.type;
|
|
31
|
+
return type === "click" || type === "mousedown" || type === "keydown" || type === "keyup";
|
|
32
|
+
}
|
|
33
|
+
function isMouseLikePointerType(pointerType, strict) {
|
|
34
|
+
const values = ["mouse", "pen"];
|
|
35
|
+
if (!strict) {
|
|
36
|
+
values.push("", void 0);
|
|
37
|
+
}
|
|
38
|
+
return values.includes(pointerType);
|
|
39
|
+
}
|
|
40
|
+
function isReactEvent(event) {
|
|
41
|
+
return event != null && "nativeEvent" in event;
|
|
42
|
+
}
|
|
43
|
+
function isVirtualClick(event) {
|
|
44
|
+
if (event.pointerType === "" && event.isTrusted) {
|
|
45
|
+
return true;
|
|
46
|
+
}
|
|
47
|
+
if (import_platform.platform.os.android && event.pointerType) {
|
|
48
|
+
return event.type === "click" && event.buttons === 1;
|
|
49
|
+
}
|
|
50
|
+
return event.detail === 0 && !event.pointerType;
|
|
51
|
+
}
|
|
52
|
+
function isVirtualPointerEvent(event) {
|
|
53
|
+
if (import_platform.platform.env.jsdom) {
|
|
54
|
+
return false;
|
|
55
|
+
}
|
|
56
|
+
return !import_platform.platform.os.android && event.width === 0 && event.height === 0 || import_platform.platform.os.android && event.width === 1 && event.height === 1 && event.pressure === 0 && event.detail === 0 && event.pointerType === "mouse" || event.width < 1 && event.height < 1 && event.pressure === 0 && event.detail === 0 && event.pointerType === "touch";
|
|
57
|
+
}
|
|
58
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
59
|
+
0 && (module.exports = {
|
|
60
|
+
isClickLikeEvent,
|
|
61
|
+
isMouseLikePointerType,
|
|
62
|
+
isReactEvent,
|
|
63
|
+
isVirtualClick,
|
|
64
|
+
isVirtualPointerEvent
|
|
65
|
+
});
|
|
@@ -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 getEmptyRootContext_exports = {};
|
|
20
|
+
__export(getEmptyRootContext_exports, {
|
|
21
|
+
getEmptyRootContext: () => getEmptyRootContext
|
|
22
|
+
});
|
|
23
|
+
module.exports = __toCommonJS(getEmptyRootContext_exports);
|
|
24
|
+
var import_popupTriggerMap = require("../popups/popupTriggerMap.cjs");
|
|
25
|
+
var import_FloatingRootStore = require("./FloatingRootStore.cjs");
|
|
26
|
+
function getEmptyRootContext() {
|
|
27
|
+
return new import_FloatingRootStore.FloatingRootStore({
|
|
28
|
+
open: false,
|
|
29
|
+
transitionStatus: void 0,
|
|
30
|
+
floatingElement: null,
|
|
31
|
+
referenceElement: null,
|
|
32
|
+
triggerElements: new import_popupTriggerMap.PopupTriggerMap(),
|
|
33
|
+
floatingId: void 0,
|
|
34
|
+
syncOnly: false,
|
|
35
|
+
nested: false,
|
|
36
|
+
onOpenChange: void 0
|
|
37
|
+
});
|
|
38
|
+
}
|
|
39
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
40
|
+
0 && (module.exports = {
|
|
41
|
+
getEmptyRootContext
|
|
42
|
+
});
|
|
@@ -0,0 +1,45 @@
|
|
|
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 gridNavigation_exports = {};
|
|
20
|
+
__export(gridNavigation_exports, {
|
|
21
|
+
gridNavigation: () => gridNavigation
|
|
22
|
+
});
|
|
23
|
+
module.exports = __toCommonJS(gridNavigation_exports);
|
|
24
|
+
var import_grid_utils = require("../composite/grid-utils.cjs");
|
|
25
|
+
var import_list_utils = require("../composite/list-utils.cjs");
|
|
26
|
+
function gridNavigation(event, prevIndex, listRef, orientation, loopFocus, rtl, disabledIndices, minIndex, maxIndex, cols = 2) {
|
|
27
|
+
const nextIndex = (0, import_grid_utils.getGridNavigatedIndex)(listRef.current, {
|
|
28
|
+
event,
|
|
29
|
+
orientation,
|
|
30
|
+
loopFocus,
|
|
31
|
+
rtl,
|
|
32
|
+
cols,
|
|
33
|
+
disabledIndices,
|
|
34
|
+
minIndex,
|
|
35
|
+
maxIndex,
|
|
36
|
+
// An out-of-range previous index falls back to the first enabled item.
|
|
37
|
+
prevIndex: prevIndex > maxIndex ? minIndex : prevIndex,
|
|
38
|
+
stopEvent: true
|
|
39
|
+
});
|
|
40
|
+
return (0, import_list_utils.isIndexOutOfListBounds)(listRef.current, nextIndex) ? void 0 : nextIndex;
|
|
41
|
+
}
|
|
42
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
43
|
+
0 && (module.exports = {
|
|
44
|
+
gridNavigation
|
|
45
|
+
});
|
|
@@ -0,0 +1,181 @@
|
|
|
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 markOthers_exports = {};
|
|
20
|
+
__export(markOthers_exports, {
|
|
21
|
+
markOthers: () => markOthers
|
|
22
|
+
});
|
|
23
|
+
module.exports = __toCommonJS(markOthers_exports);
|
|
24
|
+
var import_dom = require("@floating-ui/utils/dom");
|
|
25
|
+
var import_owner = require("../owner.cjs");
|
|
26
|
+
const counters = {
|
|
27
|
+
inert: /* @__PURE__ */ new WeakMap(),
|
|
28
|
+
"aria-hidden": /* @__PURE__ */ new WeakMap()
|
|
29
|
+
};
|
|
30
|
+
const markerName = "data-base-ui-inert";
|
|
31
|
+
const uncontrolledElementsSets = {
|
|
32
|
+
inert: /* @__PURE__ */ new WeakSet(),
|
|
33
|
+
"aria-hidden": /* @__PURE__ */ new WeakSet()
|
|
34
|
+
};
|
|
35
|
+
let markerCounterMap = /* @__PURE__ */ new WeakMap();
|
|
36
|
+
let lockCount = 0;
|
|
37
|
+
function getUncontrolledElementsSet(controlAttribute) {
|
|
38
|
+
return uncontrolledElementsSets[controlAttribute];
|
|
39
|
+
}
|
|
40
|
+
function unwrapHost(node) {
|
|
41
|
+
if (!node) {
|
|
42
|
+
return null;
|
|
43
|
+
}
|
|
44
|
+
return (0, import_dom.isShadowRoot)(node) ? node.host : unwrapHost(node.parentNode);
|
|
45
|
+
}
|
|
46
|
+
const correctElements = (parent, targets) => targets.map((target) => {
|
|
47
|
+
if (parent.contains(target)) {
|
|
48
|
+
return target;
|
|
49
|
+
}
|
|
50
|
+
const correctedTarget = unwrapHost(target);
|
|
51
|
+
if (correctedTarget && parent.contains(correctedTarget)) {
|
|
52
|
+
return correctedTarget;
|
|
53
|
+
}
|
|
54
|
+
return null;
|
|
55
|
+
}).filter((x) => x != null);
|
|
56
|
+
const buildKeepSet = (targets) => {
|
|
57
|
+
const keep = /* @__PURE__ */ new Set();
|
|
58
|
+
targets.forEach((target) => {
|
|
59
|
+
let node = target;
|
|
60
|
+
while (node && !keep.has(node)) {
|
|
61
|
+
keep.add(node);
|
|
62
|
+
node = node.parentNode;
|
|
63
|
+
}
|
|
64
|
+
});
|
|
65
|
+
return keep;
|
|
66
|
+
};
|
|
67
|
+
const collectOutsideElements = (root, keepElements, stopElements) => {
|
|
68
|
+
const outside = [];
|
|
69
|
+
const walk = (parent) => {
|
|
70
|
+
if (!parent || stopElements.has(parent)) {
|
|
71
|
+
return;
|
|
72
|
+
}
|
|
73
|
+
Array.from(parent.children).forEach((node) => {
|
|
74
|
+
if ((0, import_dom.getNodeName)(node) === "script") {
|
|
75
|
+
return;
|
|
76
|
+
}
|
|
77
|
+
if (keepElements.has(node)) {
|
|
78
|
+
walk(node);
|
|
79
|
+
} else {
|
|
80
|
+
outside.push(node);
|
|
81
|
+
}
|
|
82
|
+
});
|
|
83
|
+
};
|
|
84
|
+
walk(root);
|
|
85
|
+
return outside;
|
|
86
|
+
};
|
|
87
|
+
function applyAttributeToOthers(uncorrectedAvoidElements, body, ariaHidden, inert, { mark = true }) {
|
|
88
|
+
let controlAttribute = null;
|
|
89
|
+
if (inert) {
|
|
90
|
+
controlAttribute = "inert";
|
|
91
|
+
} else if (ariaHidden) {
|
|
92
|
+
controlAttribute = "aria-hidden";
|
|
93
|
+
}
|
|
94
|
+
let counterMap = null;
|
|
95
|
+
let uncontrolledElementsSet = null;
|
|
96
|
+
const avoidElements = correctElements(body, uncorrectedAvoidElements);
|
|
97
|
+
const markerTargets = mark ? collectOutsideElements(body, buildKeepSet(avoidElements), new Set(avoidElements)) : [];
|
|
98
|
+
const hiddenElements = [];
|
|
99
|
+
const markedElements = [];
|
|
100
|
+
if (controlAttribute) {
|
|
101
|
+
const map = counters[controlAttribute];
|
|
102
|
+
const currentUncontrolledElementsSet = getUncontrolledElementsSet(controlAttribute);
|
|
103
|
+
uncontrolledElementsSet = currentUncontrolledElementsSet;
|
|
104
|
+
counterMap = map;
|
|
105
|
+
const ariaLiveElements = correctElements(
|
|
106
|
+
body,
|
|
107
|
+
Array.from(body.querySelectorAll("[aria-live]"))
|
|
108
|
+
);
|
|
109
|
+
const controlElements = avoidElements.concat(ariaLiveElements);
|
|
110
|
+
const controlTargets = collectOutsideElements(
|
|
111
|
+
body,
|
|
112
|
+
buildKeepSet(controlElements),
|
|
113
|
+
new Set(controlElements)
|
|
114
|
+
);
|
|
115
|
+
controlTargets.forEach((node) => {
|
|
116
|
+
const attribute = node.getAttribute(controlAttribute);
|
|
117
|
+
const alreadyHidden = attribute !== null && attribute !== "false";
|
|
118
|
+
const counterValue = (map.get(node) || 0) + 1;
|
|
119
|
+
map.set(node, counterValue);
|
|
120
|
+
hiddenElements.push(node);
|
|
121
|
+
if (counterValue === 1 && alreadyHidden) {
|
|
122
|
+
currentUncontrolledElementsSet.add(node);
|
|
123
|
+
}
|
|
124
|
+
if (!alreadyHidden) {
|
|
125
|
+
node.setAttribute(controlAttribute, controlAttribute === "inert" ? "" : "true");
|
|
126
|
+
}
|
|
127
|
+
});
|
|
128
|
+
}
|
|
129
|
+
if (mark) {
|
|
130
|
+
markerTargets.forEach((node) => {
|
|
131
|
+
const markerValue = (markerCounterMap.get(node) || 0) + 1;
|
|
132
|
+
markerCounterMap.set(node, markerValue);
|
|
133
|
+
markedElements.push(node);
|
|
134
|
+
if (markerValue === 1) {
|
|
135
|
+
node.setAttribute(markerName, "");
|
|
136
|
+
}
|
|
137
|
+
});
|
|
138
|
+
}
|
|
139
|
+
lockCount += 1;
|
|
140
|
+
return () => {
|
|
141
|
+
if (counterMap) {
|
|
142
|
+
hiddenElements.forEach((element) => {
|
|
143
|
+
const currentCounterValue = counterMap.get(element) || 0;
|
|
144
|
+
const counterValue = currentCounterValue - 1;
|
|
145
|
+
counterMap.set(element, counterValue);
|
|
146
|
+
if (!counterValue) {
|
|
147
|
+
if (!uncontrolledElementsSet?.has(element) && controlAttribute) {
|
|
148
|
+
element.removeAttribute(controlAttribute);
|
|
149
|
+
}
|
|
150
|
+
uncontrolledElementsSet?.delete(element);
|
|
151
|
+
}
|
|
152
|
+
});
|
|
153
|
+
}
|
|
154
|
+
if (mark) {
|
|
155
|
+
markedElements.forEach((element) => {
|
|
156
|
+
const markerValue = (markerCounterMap.get(element) || 0) - 1;
|
|
157
|
+
markerCounterMap.set(element, markerValue);
|
|
158
|
+
if (!markerValue) {
|
|
159
|
+
element.removeAttribute(markerName);
|
|
160
|
+
}
|
|
161
|
+
});
|
|
162
|
+
}
|
|
163
|
+
lockCount -= 1;
|
|
164
|
+
if (!lockCount) {
|
|
165
|
+
counters.inert = /* @__PURE__ */ new WeakMap();
|
|
166
|
+
counters["aria-hidden"] = /* @__PURE__ */ new WeakMap();
|
|
167
|
+
uncontrolledElementsSets.inert = /* @__PURE__ */ new WeakSet();
|
|
168
|
+
uncontrolledElementsSets["aria-hidden"] = /* @__PURE__ */ new WeakSet();
|
|
169
|
+
markerCounterMap = /* @__PURE__ */ new WeakMap();
|
|
170
|
+
}
|
|
171
|
+
};
|
|
172
|
+
}
|
|
173
|
+
function markOthers(avoidElements, options = {}) {
|
|
174
|
+
const { ariaHidden = false, inert = false, mark = true } = options;
|
|
175
|
+
const body = (0, import_owner.ownerDocument)(avoidElements[0]).body;
|
|
176
|
+
return applyAttributeToOthers(avoidElements, body, ariaHidden, inert, { mark });
|
|
177
|
+
}
|
|
178
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
179
|
+
0 && (module.exports = {
|
|
180
|
+
markOthers
|
|
181
|
+
});
|
|
@@ -0,0 +1,48 @@
|
|
|
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 nodes_exports = {};
|
|
20
|
+
__export(nodes_exports, {
|
|
21
|
+
getNodeAncestors: () => getNodeAncestors,
|
|
22
|
+
getNodeChildren: () => getNodeChildren
|
|
23
|
+
});
|
|
24
|
+
module.exports = __toCommonJS(nodes_exports);
|
|
25
|
+
function getNodeChildren(nodes, id, onlyOpenChildren = true) {
|
|
26
|
+
const directChildren = nodes.filter((node) => node.parentId === id);
|
|
27
|
+
return directChildren.flatMap((child) => [
|
|
28
|
+
...!onlyOpenChildren || child.context?.open ? [child] : [],
|
|
29
|
+
...getNodeChildren(nodes, child.id, onlyOpenChildren)
|
|
30
|
+
]);
|
|
31
|
+
}
|
|
32
|
+
function getNodeAncestors(nodes, id) {
|
|
33
|
+
let allAncestors = [];
|
|
34
|
+
let currentParentId = nodes.find((node) => node.id === id)?.parentId;
|
|
35
|
+
while (currentParentId) {
|
|
36
|
+
const currentNode = nodes.find((node) => node.id === currentParentId);
|
|
37
|
+
currentParentId = currentNode?.parentId;
|
|
38
|
+
if (currentNode) {
|
|
39
|
+
allAncestors = allAncestors.concat(currentNode);
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
return allAncestors;
|
|
43
|
+
}
|
|
44
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
45
|
+
0 && (module.exports = {
|
|
46
|
+
getNodeAncestors,
|
|
47
|
+
getNodeChildren
|
|
48
|
+
});
|