@octanejs/base-ui 0.1.31 → 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,105 @@
|
|
|
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 useLabelableId_exports = {};
|
|
20
|
+
__export(useLabelableId_exports, {
|
|
21
|
+
useLabelableId: () => useLabelableId
|
|
22
|
+
});
|
|
23
|
+
module.exports = __toCommonJS(useLabelableId_exports);
|
|
24
|
+
var import_octane = require("octane");
|
|
25
|
+
var import_internal = require("../../internal.cjs");
|
|
26
|
+
var import_noop = require("../noop.cjs");
|
|
27
|
+
var import_useBaseUiId = require("../useBaseUiId.cjs");
|
|
28
|
+
var import_useRefWithInit = require("../useRefWithInit.cjs");
|
|
29
|
+
var import_useStableCallback = require("../useStableCallback.cjs");
|
|
30
|
+
var import_LabelableContext = require("./LabelableContext.cjs");
|
|
31
|
+
function isElement(el) {
|
|
32
|
+
return el != null && el instanceof Element;
|
|
33
|
+
}
|
|
34
|
+
function useLabelableId(...args) {
|
|
35
|
+
const [user, slotArg] = (0, import_internal.splitSlot)(args);
|
|
36
|
+
const slot = slotArg ?? (0, import_internal.S)("useLabelableId");
|
|
37
|
+
const { id, implicit = false, controlRef } = user[0] ?? {};
|
|
38
|
+
const { controlId, registerControlId } = (0, import_LabelableContext.useLabelableContext)();
|
|
39
|
+
const defaultId = (0, import_useBaseUiId.useBaseUiId)(id, (0, import_internal.subSlot)(slot, "def"));
|
|
40
|
+
const controlIdForEffect = implicit ? controlId : void 0;
|
|
41
|
+
const controlSourceRef = (0, import_useRefWithInit.useRefWithInit)(
|
|
42
|
+
() => /* @__PURE__ */ Symbol("labelable-control"),
|
|
43
|
+
(0, import_internal.subSlot)(slot, "src")
|
|
44
|
+
);
|
|
45
|
+
const hasRegisteredRef = (0, import_octane.useRef)(false, (0, import_internal.subSlot)(slot, "has"));
|
|
46
|
+
const hadExplicitIdRef = (0, import_octane.useRef)(id != null, (0, import_internal.subSlot)(slot, "had"));
|
|
47
|
+
const unregisterControlId = (0, import_useStableCallback.useStableCallback)(
|
|
48
|
+
() => {
|
|
49
|
+
if (!hasRegisteredRef.current || registerControlId === import_noop.NOOP) {
|
|
50
|
+
return;
|
|
51
|
+
}
|
|
52
|
+
hasRegisteredRef.current = false;
|
|
53
|
+
registerControlId(controlSourceRef.current, void 0);
|
|
54
|
+
},
|
|
55
|
+
(0, import_internal.subSlot)(slot, "unreg")
|
|
56
|
+
);
|
|
57
|
+
(0, import_octane.useLayoutEffect)(
|
|
58
|
+
() => {
|
|
59
|
+
if (registerControlId === import_noop.NOOP) {
|
|
60
|
+
return void 0;
|
|
61
|
+
}
|
|
62
|
+
let nextId;
|
|
63
|
+
if (implicit) {
|
|
64
|
+
const elem = controlRef?.current;
|
|
65
|
+
if (isElement(elem) && elem.closest("label") != null) {
|
|
66
|
+
nextId = id ?? null;
|
|
67
|
+
} else {
|
|
68
|
+
nextId = controlIdForEffect ?? defaultId;
|
|
69
|
+
}
|
|
70
|
+
} else if (id != null) {
|
|
71
|
+
hadExplicitIdRef.current = true;
|
|
72
|
+
nextId = id;
|
|
73
|
+
} else if (hadExplicitIdRef.current) {
|
|
74
|
+
nextId = defaultId;
|
|
75
|
+
} else {
|
|
76
|
+
unregisterControlId();
|
|
77
|
+
return void 0;
|
|
78
|
+
}
|
|
79
|
+
if (nextId === void 0) {
|
|
80
|
+
unregisterControlId();
|
|
81
|
+
return void 0;
|
|
82
|
+
}
|
|
83
|
+
hasRegisteredRef.current = true;
|
|
84
|
+
registerControlId(controlSourceRef.current, nextId);
|
|
85
|
+
return void 0;
|
|
86
|
+
},
|
|
87
|
+
[
|
|
88
|
+
id,
|
|
89
|
+
controlRef,
|
|
90
|
+
controlIdForEffect,
|
|
91
|
+
registerControlId,
|
|
92
|
+
implicit,
|
|
93
|
+
defaultId,
|
|
94
|
+
controlSourceRef,
|
|
95
|
+
unregisterControlId
|
|
96
|
+
],
|
|
97
|
+
(0, import_internal.subSlot)(slot, "e:reg")
|
|
98
|
+
);
|
|
99
|
+
(0, import_octane.useEffect)(() => unregisterControlId, [unregisterControlId], (0, import_internal.subSlot)(slot, "e:cleanup"));
|
|
100
|
+
return controlId ?? defaultId;
|
|
101
|
+
}
|
|
102
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
103
|
+
0 && (module.exports = {
|
|
104
|
+
useLabelableId
|
|
105
|
+
});
|
|
@@ -0,0 +1,60 @@
|
|
|
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 useRegisterFieldControl_exports = {};
|
|
20
|
+
__export(useRegisterFieldControl_exports, {
|
|
21
|
+
useRegisterFieldControl: () => useRegisterFieldControl
|
|
22
|
+
});
|
|
23
|
+
module.exports = __toCommonJS(useRegisterFieldControl_exports);
|
|
24
|
+
var import_octane = require("octane");
|
|
25
|
+
var import_internal = require("../../internal.cjs");
|
|
26
|
+
var import_FieldRootContext = require("./FieldRootContext.cjs");
|
|
27
|
+
function useRegisterFieldControl(...args) {
|
|
28
|
+
const [user, slotArg] = (0, import_internal.splitSlot)(args);
|
|
29
|
+
const slot = slotArg ?? (0, import_internal.S)("useRegisterFieldControl");
|
|
30
|
+
const controlRef = user[0];
|
|
31
|
+
const id = user[1];
|
|
32
|
+
const value = user[2];
|
|
33
|
+
const getFormValueOverride = user[3];
|
|
34
|
+
const enabled = user[4] ?? true;
|
|
35
|
+
const name = user[5];
|
|
36
|
+
const { registerFieldControl } = (0, import_FieldRootContext.useFieldRootContext)();
|
|
37
|
+
const sourceRef = (0, import_octane.useRef)(null, (0, import_internal.subSlot)(slot, "src"));
|
|
38
|
+
if (!sourceRef.current) {
|
|
39
|
+
sourceRef.current = /* @__PURE__ */ Symbol();
|
|
40
|
+
}
|
|
41
|
+
(0, import_octane.useLayoutEffect)(
|
|
42
|
+
() => {
|
|
43
|
+
const source = sourceRef.current;
|
|
44
|
+
if (!source || !enabled) {
|
|
45
|
+
return void 0;
|
|
46
|
+
}
|
|
47
|
+
const registration = { controlRef, getValue: getFormValueOverride, id, name, value };
|
|
48
|
+
registerFieldControl(source, registration);
|
|
49
|
+
return () => {
|
|
50
|
+
registerFieldControl(source, void 0);
|
|
51
|
+
};
|
|
52
|
+
},
|
|
53
|
+
[controlRef, enabled, getFormValueOverride, id, name, registerFieldControl, value],
|
|
54
|
+
(0, import_internal.subSlot)(slot, "e:reg")
|
|
55
|
+
);
|
|
56
|
+
}
|
|
57
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
58
|
+
0 && (module.exports = {
|
|
59
|
+
useRegisterFieldControl
|
|
60
|
+
});
|
|
@@ -0,0 +1,37 @@
|
|
|
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 findRootOwnerId_exports = {};
|
|
20
|
+
__export(findRootOwnerId_exports, {
|
|
21
|
+
findRootOwnerId: () => findRootOwnerId
|
|
22
|
+
});
|
|
23
|
+
module.exports = __toCommonJS(findRootOwnerId_exports);
|
|
24
|
+
var import_dom = require("@floating-ui/utils/dom");
|
|
25
|
+
function findRootOwnerId(node) {
|
|
26
|
+
if ((0, import_dom.isHTMLElement)(node) && node.hasAttribute("data-rootownerid")) {
|
|
27
|
+
return node.getAttribute("data-rootownerid") ?? void 0;
|
|
28
|
+
}
|
|
29
|
+
if ((0, import_dom.isLastTraversableNode)(node)) {
|
|
30
|
+
return void 0;
|
|
31
|
+
}
|
|
32
|
+
return findRootOwnerId((0, import_dom.getParentNode)(node));
|
|
33
|
+
}
|
|
34
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
35
|
+
0 && (module.exports = {
|
|
36
|
+
findRootOwnerId
|
|
37
|
+
});
|
|
@@ -0,0 +1,219 @@
|
|
|
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 FloatingDelayGroup_exports = {};
|
|
20
|
+
__export(FloatingDelayGroup_exports, {
|
|
21
|
+
FloatingDelayGroup: () => FloatingDelayGroup,
|
|
22
|
+
useDelayGroup: () => useDelayGroup
|
|
23
|
+
});
|
|
24
|
+
module.exports = __toCommonJS(FloatingDelayGroup_exports);
|
|
25
|
+
var import_octane = require("octane");
|
|
26
|
+
var import_internal = require("../../internal.cjs");
|
|
27
|
+
var import_useTimeout = require("../useTimeout.cjs");
|
|
28
|
+
var import_createChangeEventDetails = require("../createChangeEventDetails.cjs");
|
|
29
|
+
var import_useHoverShared = require("./useHoverShared.cjs");
|
|
30
|
+
const DEFAULT_CONTEXT = {
|
|
31
|
+
hasProvider: false,
|
|
32
|
+
timeoutMs: 0,
|
|
33
|
+
delayRef: { current: 0 },
|
|
34
|
+
initialDelayRef: { current: 0 },
|
|
35
|
+
timeout: new import_useTimeout.Timeout(),
|
|
36
|
+
currentIdRef: { current: null },
|
|
37
|
+
currentContextRef: { current: null }
|
|
38
|
+
};
|
|
39
|
+
const FloatingDelayGroupContext = (0, import_octane.createContext)(DEFAULT_CONTEXT);
|
|
40
|
+
function resetDelayRef(delayRef, initialDelayRef) {
|
|
41
|
+
delayRef.current = initialDelayRef.current;
|
|
42
|
+
}
|
|
43
|
+
function FloatingDelayGroup(props) {
|
|
44
|
+
const slot = (0, import_internal.S)("FloatingDelayGroup");
|
|
45
|
+
const { children, delay, timeoutMs = 0 } = props;
|
|
46
|
+
const delayRef = (0, import_octane.useRef)(delay, (0, import_internal.subSlot)(slot, "delay"));
|
|
47
|
+
const initialDelayRef = (0, import_octane.useRef)(delay, (0, import_internal.subSlot)(slot, "initial"));
|
|
48
|
+
const currentIdRef = (0, import_octane.useRef)(null, (0, import_internal.subSlot)(slot, "id"));
|
|
49
|
+
const currentContextRef = (0, import_octane.useRef)(null, (0, import_internal.subSlot)(slot, "ctxRef"));
|
|
50
|
+
const timeout = (0, import_useTimeout.useTimeout)((0, import_internal.subSlot)(slot, "to"));
|
|
51
|
+
(0, import_octane.useLayoutEffect)(
|
|
52
|
+
() => {
|
|
53
|
+
initialDelayRef.current = delay;
|
|
54
|
+
if (!currentIdRef.current) {
|
|
55
|
+
delayRef.current = delay;
|
|
56
|
+
return;
|
|
57
|
+
}
|
|
58
|
+
delayRef.current = {
|
|
59
|
+
open: (0, import_useHoverShared.getDelay)(delayRef.current, "open"),
|
|
60
|
+
close: (0, import_useHoverShared.getDelay)(delay, "close")
|
|
61
|
+
};
|
|
62
|
+
},
|
|
63
|
+
[delay, currentIdRef, delayRef, initialDelayRef],
|
|
64
|
+
(0, import_internal.subSlot)(slot, "l:delay")
|
|
65
|
+
);
|
|
66
|
+
const contextValue = (0, import_octane.useMemo)(
|
|
67
|
+
() => ({
|
|
68
|
+
hasProvider: true,
|
|
69
|
+
delayRef,
|
|
70
|
+
initialDelayRef,
|
|
71
|
+
currentIdRef,
|
|
72
|
+
timeoutMs,
|
|
73
|
+
currentContextRef,
|
|
74
|
+
timeout
|
|
75
|
+
}),
|
|
76
|
+
[timeoutMs, timeout],
|
|
77
|
+
(0, import_internal.subSlot)(slot, "ctx")
|
|
78
|
+
);
|
|
79
|
+
return (0, import_octane.createElement)(FloatingDelayGroupContext.Provider, { value: contextValue, children });
|
|
80
|
+
}
|
|
81
|
+
function useDelayGroup(...args) {
|
|
82
|
+
const [user, slotArg] = (0, import_internal.splitSlot)(args);
|
|
83
|
+
const slot = slotArg ?? (0, import_internal.S)("useDelayGroup");
|
|
84
|
+
const context = user[0];
|
|
85
|
+
const options = user[1] ?? { open: false };
|
|
86
|
+
const { open } = options;
|
|
87
|
+
const store = context != null && "rootStore" in context ? context.rootStore : context;
|
|
88
|
+
const floatingId = store.useState("floatingId", (0, import_internal.subSlot)(slot, "s:id"));
|
|
89
|
+
const groupContext = (0, import_octane.useContext)(FloatingDelayGroupContext);
|
|
90
|
+
const {
|
|
91
|
+
currentIdRef,
|
|
92
|
+
delayRef,
|
|
93
|
+
timeoutMs,
|
|
94
|
+
initialDelayRef,
|
|
95
|
+
currentContextRef,
|
|
96
|
+
hasProvider,
|
|
97
|
+
timeout
|
|
98
|
+
} = groupContext;
|
|
99
|
+
const [isInstantPhase, setIsInstantPhase] = (0, import_octane.useState)(false, (0, import_internal.subSlot)(slot, "instant"));
|
|
100
|
+
const openRef = (0, import_octane.useRef)(open, (0, import_internal.subSlot)(slot, "open"));
|
|
101
|
+
const isUnmountedRef = (0, import_octane.useRef)(false, (0, import_internal.subSlot)(slot, "unmounted"));
|
|
102
|
+
(0, import_octane.useLayoutEffect)(
|
|
103
|
+
() => {
|
|
104
|
+
openRef.current = open;
|
|
105
|
+
},
|
|
106
|
+
[open],
|
|
107
|
+
(0, import_internal.subSlot)(slot, "l:openRef")
|
|
108
|
+
);
|
|
109
|
+
(0, import_octane.useLayoutEffect)(
|
|
110
|
+
() => {
|
|
111
|
+
return () => {
|
|
112
|
+
isUnmountedRef.current = true;
|
|
113
|
+
};
|
|
114
|
+
},
|
|
115
|
+
[],
|
|
116
|
+
(0, import_internal.subSlot)(slot, "l:unmount")
|
|
117
|
+
);
|
|
118
|
+
(0, import_octane.useLayoutEffect)(
|
|
119
|
+
() => {
|
|
120
|
+
function unset() {
|
|
121
|
+
if (!isUnmountedRef.current) {
|
|
122
|
+
setIsInstantPhase(false);
|
|
123
|
+
}
|
|
124
|
+
currentContextRef.current?.setIsInstantPhase(false);
|
|
125
|
+
currentIdRef.current = null;
|
|
126
|
+
currentContextRef.current = null;
|
|
127
|
+
delayRef.current = initialDelayRef.current;
|
|
128
|
+
timeout.clear();
|
|
129
|
+
}
|
|
130
|
+
if (!currentIdRef.current) {
|
|
131
|
+
return void 0;
|
|
132
|
+
}
|
|
133
|
+
if (!open && currentIdRef.current === floatingId) {
|
|
134
|
+
setIsInstantPhase(false);
|
|
135
|
+
if (timeoutMs) {
|
|
136
|
+
const closingId = floatingId;
|
|
137
|
+
timeout.start(timeoutMs, () => {
|
|
138
|
+
if (store.select("open") || currentIdRef.current && currentIdRef.current !== closingId) {
|
|
139
|
+
return;
|
|
140
|
+
}
|
|
141
|
+
unset();
|
|
142
|
+
});
|
|
143
|
+
return () => {
|
|
144
|
+
if (openRef.current || currentIdRef.current !== closingId) {
|
|
145
|
+
timeout.clear();
|
|
146
|
+
}
|
|
147
|
+
};
|
|
148
|
+
}
|
|
149
|
+
unset();
|
|
150
|
+
}
|
|
151
|
+
return void 0;
|
|
152
|
+
},
|
|
153
|
+
[
|
|
154
|
+
open,
|
|
155
|
+
floatingId,
|
|
156
|
+
currentIdRef,
|
|
157
|
+
delayRef,
|
|
158
|
+
timeoutMs,
|
|
159
|
+
initialDelayRef,
|
|
160
|
+
currentContextRef,
|
|
161
|
+
timeout,
|
|
162
|
+
store
|
|
163
|
+
],
|
|
164
|
+
(0, import_internal.subSlot)(slot, "l:close")
|
|
165
|
+
);
|
|
166
|
+
(0, import_octane.useLayoutEffect)(
|
|
167
|
+
() => {
|
|
168
|
+
if (!open) {
|
|
169
|
+
return;
|
|
170
|
+
}
|
|
171
|
+
const prevContext = currentContextRef.current;
|
|
172
|
+
const prevId = currentIdRef.current;
|
|
173
|
+
timeout.clear();
|
|
174
|
+
currentContextRef.current = { onOpenChange: store.setOpen, setIsInstantPhase };
|
|
175
|
+
currentIdRef.current = floatingId;
|
|
176
|
+
delayRef.current = {
|
|
177
|
+
open: 0,
|
|
178
|
+
close: (0, import_useHoverShared.getDelay)(initialDelayRef.current, "close")
|
|
179
|
+
};
|
|
180
|
+
if (prevId !== null && prevId !== floatingId) {
|
|
181
|
+
setIsInstantPhase(true);
|
|
182
|
+
prevContext?.setIsInstantPhase(true);
|
|
183
|
+
prevContext?.onOpenChange(false, (0, import_createChangeEventDetails.createChangeEventDetails)(import_createChangeEventDetails.REASONS.none));
|
|
184
|
+
} else {
|
|
185
|
+
setIsInstantPhase(false);
|
|
186
|
+
prevContext?.setIsInstantPhase(false);
|
|
187
|
+
}
|
|
188
|
+
},
|
|
189
|
+
[open, floatingId, store, currentIdRef, delayRef, initialDelayRef, currentContextRef, timeout],
|
|
190
|
+
(0, import_internal.subSlot)(slot, "l:open")
|
|
191
|
+
);
|
|
192
|
+
(0, import_octane.useLayoutEffect)(
|
|
193
|
+
() => {
|
|
194
|
+
return () => {
|
|
195
|
+
if (currentIdRef.current === floatingId) {
|
|
196
|
+
currentContextRef.current = null;
|
|
197
|
+
if (!openRef.current) {
|
|
198
|
+
return;
|
|
199
|
+
}
|
|
200
|
+
currentIdRef.current = null;
|
|
201
|
+
resetDelayRef(delayRef, initialDelayRef);
|
|
202
|
+
timeout.clear();
|
|
203
|
+
}
|
|
204
|
+
};
|
|
205
|
+
},
|
|
206
|
+
[currentContextRef, currentIdRef, delayRef, floatingId, initialDelayRef, timeout],
|
|
207
|
+
(0, import_internal.subSlot)(slot, "l:teardown")
|
|
208
|
+
);
|
|
209
|
+
return (0, import_octane.useMemo)(
|
|
210
|
+
() => ({ hasProvider, delayRef, isInstantPhase }),
|
|
211
|
+
[hasProvider, delayRef, isInstantPhase],
|
|
212
|
+
(0, import_internal.subSlot)(slot, "out")
|
|
213
|
+
);
|
|
214
|
+
}
|
|
215
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
216
|
+
0 && (module.exports = {
|
|
217
|
+
FloatingDelayGroup,
|
|
218
|
+
useDelayGroup
|
|
219
|
+
});
|