@monimesl/dot-renderer-react 0.1.0-alpha.7 → 0.1.0-alpha.9
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/README.md +39 -1
- package/dist/LICENSE-PHOSPHOR +21 -21
- package/dist/_virtual/_rolldown/runtime.js +14 -0
- package/dist/_virtual/builtin_esm-external-require-react.js +9 -0
- package/dist/color.js +105 -0
- package/dist/components/amount-input.d.ts +6 -0
- package/dist/components/amount-input.js +106 -0
- package/dist/components/button.d.ts +6 -0
- package/dist/components/button.js +42 -0
- package/dist/components/carousel.d.ts +6 -0
- package/dist/components/carousel.js +254 -0
- package/dist/components/chip.d.ts +6 -0
- package/dist/components/chip.js +41 -0
- package/dist/components/code-input.d.ts +6 -0
- package/dist/components/code-input.js +97 -0
- package/dist/components/detail-row.d.ts +6 -0
- package/dist/components/detail-row.js +40 -0
- package/dist/components/divider.d.ts +6 -0
- package/dist/components/divider.js +18 -0
- package/dist/components/empty-state.d.ts +6 -0
- package/dist/components/empty-state.js +66 -0
- package/dist/components/feedback.d.ts +8 -0
- package/dist/components/feedback.js +85 -0
- package/dist/components/field-box.js +44 -0
- package/dist/components/field.js +43 -0
- package/dist/components/footer.d.ts +6 -0
- package/dist/components/footer.js +24 -0
- package/dist/components/grid.d.ts +7 -0
- package/dist/components/grid.js +98 -0
- package/dist/components/icon-artwork.js +74 -0
- package/dist/components/icon.d.ts +6 -0
- package/dist/components/icon.js +40 -0
- package/dist/components/image.d.ts +6 -0
- package/dist/components/image.js +40 -0
- package/dist/components/index.d.ts +30 -0
- package/dist/components/index.js +72 -0
- package/dist/components/input.d.ts +6 -0
- package/dist/components/input.js +86 -0
- package/dist/components/link.d.ts +6 -0
- package/dist/components/link.js +39 -0
- package/dist/components/list.d.ts +7 -0
- package/dist/components/list.js +143 -0
- package/dist/components/option-place.js +9 -0
- package/dist/components/option.d.ts +6 -0
- package/dist/components/option.js +43 -0
- package/dist/components/padding.d.ts +2 -0
- package/dist/components/padding.js +27 -0
- package/dist/components/pressable.js +17 -0
- package/dist/components/qr-code.d.ts +6 -0
- package/dist/components/qr-code.js +58 -0
- package/dist/components/scroll.d.ts +6 -0
- package/dist/components/scroll.js +55 -0
- package/dist/components/select.d.ts +6 -0
- package/dist/components/select.js +92 -0
- package/dist/components/sheet.d.ts +8 -0
- package/dist/components/sheet.js +105 -0
- package/dist/components/skeleton.d.ts +6 -0
- package/dist/components/skeleton.js +55 -0
- package/dist/components/spinner.d.ts +6 -0
- package/dist/components/spinner.js +48 -0
- package/dist/components/tabs.d.ts +7 -0
- package/dist/components/tabs.js +91 -0
- package/dist/components/text-area.d.ts +6 -0
- package/dist/components/text-area.js +42 -0
- package/dist/components/text.d.ts +6 -0
- package/dist/components/text.js +46 -0
- package/dist/components/toast.d.ts +6 -0
- package/dist/components/toast.js +56 -0
- package/dist/components/toggles.d.ts +9 -0
- package/dist/components/toggles.js +149 -0
- package/dist/components/tokens.js +37 -0
- package/dist/components/tones.js +24 -0
- package/dist/components/typed-text.js +28 -0
- package/dist/components/view.d.ts +6 -0
- package/dist/components/view.js +51 -0
- package/dist/index.d.ts +35 -64
- package/dist/index.js +32 -22636
- package/dist/page-root.d.ts +2 -0
- package/dist/page-root.js +20 -0
- package/dist/portal.js +8 -0
- package/dist/renderer.d.ts +17 -0
- package/dist/renderer.js +33 -0
- package/dist/root.d.ts +10 -0
- package/dist/root.js +51 -0
- package/dist/styles.css +95 -1
- package/dist/theme.d.ts +25 -0
- package/dist/theme.js +84 -0
- package/dist/types.d.ts +7 -0
- package/dist/vendor/@base-ui/react/checkbox/indicator/CheckboxIndicator.js +51 -0
- package/dist/vendor/@base-ui/react/checkbox/root/CheckboxRoot.js +265 -0
- package/dist/vendor/@base-ui/react/checkbox/root/CheckboxRootContext.js +13 -0
- package/dist/vendor/@base-ui/react/checkbox/root/CheckboxRootDataAttributes.js +11 -0
- package/dist/vendor/@base-ui/react/checkbox/utils/getCheckboxStateAttributesMapping.js +15 -0
- package/dist/vendor/@base-ui/react/checkbox-group/CheckboxGroupContext.js +10 -0
- package/dist/vendor/@base-ui/react/dialog/backdrop/DialogBackdrop.js +40 -0
- package/dist/vendor/@base-ui/react/dialog/close/DialogClose.js +39 -0
- package/dist/vendor/@base-ui/react/dialog/popup/DialogPopup.js +92 -0
- package/dist/vendor/@base-ui/react/dialog/popup/DialogPopupCssVars.js +8 -0
- package/dist/vendor/@base-ui/react/dialog/popup/DialogPopupDataAttributes.js +7 -0
- package/dist/vendor/@base-ui/react/dialog/portal/DialogPortal.js +38 -0
- package/dist/vendor/@base-ui/react/dialog/portal/DialogPortalContext.js +13 -0
- package/dist/vendor/@base-ui/react/dialog/root/DialogRoot.js +16 -0
- package/dist/vendor/@base-ui/react/dialog/root/DialogRootContext.js +13 -0
- package/dist/vendor/@base-ui/react/dialog/root/useDialogRoot.js +77 -0
- package/dist/vendor/@base-ui/react/dialog/root/useRenderDialogRoot.js +65 -0
- package/dist/vendor/@base-ui/react/dialog/store/DialogStore.js +70 -0
- package/dist/vendor/@base-ui/react/dialog/title/DialogTitle.js +25 -0
- package/dist/vendor/@base-ui/react/dialog/utils/stateAttributesMapping.js +17 -0
- package/dist/vendor/@base-ui/react/field/control/FieldControlDataAttributes.js +11 -0
- package/dist/vendor/@base-ui/react/field/item/FieldItemContext.js +10 -0
- package/dist/vendor/@base-ui/react/field/root/useFieldValidation.js +18 -0
- package/dist/vendor/@base-ui/react/fieldset/root/FieldsetRootContext.js +13 -0
- package/dist/vendor/@base-ui/react/floating-ui-react/components/FloatingFocusManager.js +477 -0
- package/dist/vendor/@base-ui/react/floating-ui-react/components/FloatingPortal.js +165 -0
- package/dist/vendor/@base-ui/react/floating-ui-react/components/FloatingRootStore.js +65 -0
- package/dist/vendor/@base-ui/react/floating-ui-react/components/FloatingTree.js +22 -0
- package/dist/vendor/@base-ui/react/floating-ui-react/hooks/useDismiss.js +373 -0
- package/dist/vendor/@base-ui/react/floating-ui-react/hooks/useSyncedFloatingRootContext.js +58 -0
- package/dist/vendor/@base-ui/react/floating-ui-react/utils/composite.js +40 -0
- package/dist/vendor/@base-ui/react/floating-ui-react/utils/constants.js +5 -0
- package/dist/vendor/@base-ui/react/floating-ui-react/utils/createAttribute.js +6 -0
- package/dist/vendor/@base-ui/react/floating-ui-react/utils/createEventEmitter.js +18 -0
- package/dist/vendor/@base-ui/react/floating-ui-react/utils/element.js +26 -0
- package/dist/vendor/@base-ui/react/floating-ui-react/utils/enqueueFocus.js +25 -0
- package/dist/vendor/@base-ui/react/floating-ui-react/utils/event.js +25 -0
- package/dist/vendor/@base-ui/react/floating-ui-react/utils/markOthers.js +116 -0
- package/dist/vendor/@base-ui/react/floating-ui-react/utils/nodes.js +16 -0
- package/dist/vendor/@base-ui/react/floating-ui-react/utils/tabbable.js +135 -0
- package/dist/vendor/@base-ui/react/internals/TransitionStatusDataAttributes.js +11 -0
- package/dist/vendor/@base-ui/react/internals/composite/composite.js +89 -0
- package/dist/vendor/@base-ui/react/internals/composite/constants.js +4 -0
- package/dist/vendor/@base-ui/react/internals/composite/item/CompositeItem.js +21 -0
- package/dist/vendor/@base-ui/react/internals/composite/item/useCompositeItem.js +31 -0
- package/dist/vendor/@base-ui/react/internals/composite/list/CompositeList.js +180 -0
- package/dist/vendor/@base-ui/react/internals/composite/list/CompositeListContext.js +15 -0
- package/dist/vendor/@base-ui/react/internals/composite/list/useCompositeListItem.js +54 -0
- package/dist/vendor/@base-ui/react/internals/composite/root/CompositeRoot.js +62 -0
- package/dist/vendor/@base-ui/react/internals/composite/root/CompositeRootContext.js +13 -0
- package/dist/vendor/@base-ui/react/internals/composite/root/useCompositeRoot.js +170 -0
- package/dist/vendor/@base-ui/react/internals/constants.js +18 -0
- package/dist/vendor/@base-ui/react/internals/createBaseUIEventDetails.js +40 -0
- package/dist/vendor/@base-ui/react/internals/direction-context/DirectionContext.js +10 -0
- package/dist/vendor/@base-ui/react/internals/field-constants/constants.js +33 -0
- package/dist/vendor/@base-ui/react/internals/field-register-control/useRegisterFieldControl.js +40 -0
- package/dist/vendor/@base-ui/react/internals/field-root-context/FieldRootContext.js +45 -0
- package/dist/vendor/@base-ui/react/internals/form-context/FormContext.js +18 -0
- package/dist/vendor/@base-ui/react/internals/getStateAttributesProps.js +17 -0
- package/dist/vendor/@base-ui/react/internals/labelable-provider/LabelableContext.js +24 -0
- package/dist/vendor/@base-ui/react/internals/labelable-provider/useAriaLabelledBy.js +35 -0
- package/dist/vendor/@base-ui/react/internals/labelable-provider/useLabelableId.js +57 -0
- package/dist/vendor/@base-ui/react/internals/reason-parts.js +14 -0
- package/dist/vendor/@base-ui/react/internals/serializeValue.js +12 -0
- package/dist/vendor/@base-ui/react/internals/stateAttributesMapping.js +11 -0
- package/dist/vendor/@base-ui/react/internals/use-button/useButton.js +137 -0
- package/dist/vendor/@base-ui/react/internals/useAnimationsFinished.js +94 -0
- package/dist/vendor/@base-ui/react/internals/useBaseUiId.js +13 -0
- package/dist/vendor/@base-ui/react/internals/useOpenChangeComplete.js +28 -0
- package/dist/vendor/@base-ui/react/internals/useRenderElement.js +109 -0
- package/dist/vendor/@base-ui/react/internals/useTransitionStatus.js +70 -0
- package/dist/vendor/@base-ui/react/internals/useValueChanged.js +15 -0
- package/dist/vendor/@base-ui/react/merge-props/mergeProps.js +153 -0
- package/dist/vendor/@base-ui/react/radio/indicator/RadioIndicator.js +46 -0
- package/dist/vendor/@base-ui/react/radio/root/RadioRoot.js +179 -0
- package/dist/vendor/@base-ui/react/radio/root/RadioRootContext.js +13 -0
- package/dist/vendor/@base-ui/react/radio/root/RadioRootDataAttributes.js +11 -0
- package/dist/vendor/@base-ui/react/radio/utils/stateAttributesMapping.js +14 -0
- package/dist/vendor/@base-ui/react/radio-group/RadioGroup.js +170 -0
- package/dist/vendor/@base-ui/react/radio-group/RadioGroupContext.js +10 -0
- package/dist/vendor/@base-ui/react/switch/root/SwitchRoot.js +170 -0
- package/dist/vendor/@base-ui/react/switch/root/SwitchRootContext.js +13 -0
- package/dist/vendor/@base-ui/react/switch/root/SwitchRootDataAttributes.js +11 -0
- package/dist/vendor/@base-ui/react/switch/stateAttributesMapping.js +12 -0
- package/dist/vendor/@base-ui/react/switch/thumb/SwitchThumb.js +25 -0
- package/dist/vendor/@base-ui/react/tabs/list/TabsList.js +98 -0
- package/dist/vendor/@base-ui/react/tabs/list/TabsListContext.js +13 -0
- package/dist/vendor/@base-ui/react/tabs/root/TabsRoot.js +213 -0
- package/dist/vendor/@base-ui/react/tabs/root/TabsRootContext.js +16 -0
- package/dist/vendor/@base-ui/react/tabs/root/TabsRootDataAttributes.js +8 -0
- package/dist/vendor/@base-ui/react/tabs/root/stateAttributesMapping.js +5 -0
- package/dist/vendor/@base-ui/react/tabs/tab/TabsTab.js +137 -0
- package/dist/vendor/@base-ui/react/utils/CommonPopupDataAttributes.js +24 -0
- package/dist/vendor/@base-ui/react/utils/CommonTriggerDataAttributes.js +11 -0
- package/dist/vendor/@base-ui/react/utils/FocusGuard.js +32 -0
- package/dist/vendor/@base-ui/react/utils/InternalBackdrop.js +30 -0
- package/dist/vendor/@base-ui/react/utils/dispatchClickWithModifiers.js +25 -0
- package/dist/vendor/@base-ui/react/utils/popupStateMapping.js +22 -0
- package/dist/vendor/@base-ui/react/utils/popups/popupStoreUtils.js +247 -0
- package/dist/vendor/@base-ui/react/utils/popups/popupTriggerMap.js +96 -0
- package/dist/vendor/@base-ui/react/utils/popups/store.js +94 -0
- package/dist/vendor/@base-ui/react/utils/resolveClassName.js +13 -0
- package/dist/vendor/@base-ui/react/utils/resolveRef.js +11 -0
- package/dist/vendor/@base-ui/react/utils/resolveStyle.js +13 -0
- package/dist/vendor/@base-ui/react/utils/useFocusableWhenDisabled.js +30 -0
- package/dist/vendor/@base-ui/utils/addEventListener.js +12 -0
- package/dist/vendor/@base-ui/utils/createLogOnce.js +20 -0
- package/dist/vendor/@base-ui/utils/empty.js +6 -0
- package/dist/vendor/@base-ui/utils/error.js +5 -0
- package/dist/vendor/@base-ui/utils/fastHooks.js +68 -0
- package/dist/vendor/@base-ui/utils/formatErrorMessage.js +27 -0
- package/dist/vendor/@base-ui/utils/getDefaultFormSubmitter.js +25 -0
- package/dist/vendor/@base-ui/utils/getReactElementRef.js +14 -0
- package/dist/vendor/@base-ui/utils/inertValue.js +8 -0
- package/dist/vendor/@base-ui/utils/isElementDisabled.js +6 -0
- package/dist/vendor/@base-ui/utils/mergeCleanups.js +14 -0
- package/dist/vendor/@base-ui/utils/mergeObjects.js +11 -0
- package/dist/vendor/@base-ui/utils/owner.js +7 -0
- package/dist/vendor/@base-ui/utils/platform/engine.js +8 -0
- package/dist/vendor/@base-ui/utils/platform/env.js +6 -0
- package/dist/vendor/@base-ui/utils/platform/os.js +15 -0
- package/dist/vendor/@base-ui/utils/platform/screen-reader.js +9 -0
- package/dist/vendor/@base-ui/utils/platform/shared.js +36 -0
- package/dist/vendor/@base-ui/utils/reactVersion.js +8 -0
- package/dist/vendor/@base-ui/utils/safeReact.js +13 -0
- package/dist/vendor/@base-ui/utils/shadowDom.js +26 -0
- package/dist/vendor/@base-ui/utils/store/ReactStore.js +181 -0
- package/dist/vendor/@base-ui/utils/store/Store.js +102 -0
- package/dist/vendor/@base-ui/utils/store/useStore.js +97 -0
- package/dist/vendor/@base-ui/utils/useAnimationFrame.js +87 -0
- package/dist/vendor/@base-ui/utils/useControlled.js +52 -0
- package/dist/vendor/@base-ui/utils/useId.js +32 -0
- package/dist/vendor/@base-ui/utils/useIsoLayoutEffect.js +7 -0
- package/dist/vendor/@base-ui/utils/useMergedRefs.js +87 -0
- package/dist/vendor/@base-ui/utils/useOnMount.js +12 -0
- package/dist/vendor/@base-ui/utils/useRefWithInit.js +18 -0
- package/dist/vendor/@base-ui/utils/useScrollLock.js +206 -0
- package/dist/vendor/@base-ui/utils/useStableCallback.js +38 -0
- package/dist/vendor/@base-ui/utils/useTimeout.js +43 -0
- package/dist/vendor/@base-ui/utils/useValueAsRef.js +27 -0
- package/dist/vendor/@base-ui/utils/visuallyHidden.js +23 -0
- package/dist/vendor/@base-ui/utils/warn.js +5 -0
- package/dist/vendor/@floating-ui/utils/dist/floating-ui.utils.dom.js +49 -0
- package/dist/vendor/uqr/dist/index.js +858 -0
- package/dist/vendor/use-sync-external-store/cjs/use-sync-external-store-shim/with-selector.development.js +74 -0
- package/dist/vendor/use-sync-external-store/cjs/use-sync-external-store-shim/with-selector.production.js +77 -0
- package/dist/vendor/use-sync-external-store/cjs/use-sync-external-store-shim.development.js +69 -0
- package/dist/vendor/use-sync-external-store/cjs/use-sync-external-store-shim.production.js +64 -0
- package/dist/vendor/use-sync-external-store/shim/index.js +11 -0
- package/dist/vendor/use-sync-external-store/shim/with-selector.js +11 -0
- package/package.json +8 -14
- package/dist/garra-versions.json +0 -7
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { useRefWithInit } from "./useRefWithInit.js";
|
|
3
|
+
import { useOnMount } from "./useOnMount.js";
|
|
4
|
+
//#region ../../../node_modules/.pnpm/@base-ui+utils@0.4.0_@types+react@19.3.0_react-dom@19.3.0_react@19.3.0__react@19.3.0/node_modules/@base-ui/utils/useAnimationFrame.mjs
|
|
5
|
+
/** Unlike `setTimeout`, rAF doesn't guarantee a positive integer return value, so we can't have
|
|
6
|
+
* a monomorphic `uint` type with `0` meaning empty.
|
|
7
|
+
* See warning note at:
|
|
8
|
+
* https://developer.mozilla.org/en-US/docs/Web/API/Window/requestAnimationFrame#return_value */
|
|
9
|
+
const EMPTY = null;
|
|
10
|
+
let LAST_RAF = globalThis.requestAnimationFrame;
|
|
11
|
+
var Scheduler = class {
|
|
12
|
+
callbacks = [];
|
|
13
|
+
callbacksCount = 0;
|
|
14
|
+
nextId = 1;
|
|
15
|
+
startId = 1;
|
|
16
|
+
isScheduled = false;
|
|
17
|
+
tick = (timestamp) => {
|
|
18
|
+
this.isScheduled = false;
|
|
19
|
+
const currentCallbacks = this.callbacks;
|
|
20
|
+
const currentCallbacksCount = this.callbacksCount;
|
|
21
|
+
this.callbacks = [];
|
|
22
|
+
this.callbacksCount = 0;
|
|
23
|
+
this.startId = this.nextId;
|
|
24
|
+
if (currentCallbacksCount > 0) for (let i = 0; i < currentCallbacks.length; i += 1) currentCallbacks[i]?.(timestamp);
|
|
25
|
+
};
|
|
26
|
+
request(fn) {
|
|
27
|
+
const id = this.nextId;
|
|
28
|
+
this.nextId += 1;
|
|
29
|
+
this.callbacks.push(fn);
|
|
30
|
+
this.callbacksCount += 1;
|
|
31
|
+
const didRAFChange = process.env.NODE_ENV !== "production" && LAST_RAF !== requestAnimationFrame && (LAST_RAF = requestAnimationFrame, true);
|
|
32
|
+
if (!this.isScheduled || didRAFChange) {
|
|
33
|
+
requestAnimationFrame(this.tick);
|
|
34
|
+
this.isScheduled = true;
|
|
35
|
+
}
|
|
36
|
+
return id;
|
|
37
|
+
}
|
|
38
|
+
cancel(id) {
|
|
39
|
+
const index = id - this.startId;
|
|
40
|
+
if (index < 0 || index >= this.callbacks.length) return;
|
|
41
|
+
if (this.callbacks[index] === null) return;
|
|
42
|
+
this.callbacks[index] = null;
|
|
43
|
+
this.callbacksCount -= 1;
|
|
44
|
+
}
|
|
45
|
+
};
|
|
46
|
+
let scheduler = new Scheduler();
|
|
47
|
+
var AnimationFrame = class AnimationFrame {
|
|
48
|
+
static create() {
|
|
49
|
+
return new AnimationFrame();
|
|
50
|
+
}
|
|
51
|
+
static request(fn) {
|
|
52
|
+
return scheduler.request(fn);
|
|
53
|
+
}
|
|
54
|
+
static cancel(id) {
|
|
55
|
+
return scheduler.cancel(id);
|
|
56
|
+
}
|
|
57
|
+
currentId = EMPTY;
|
|
58
|
+
/**
|
|
59
|
+
* Executes `fn` after `delay`, clearing any previously scheduled call.
|
|
60
|
+
*/
|
|
61
|
+
request(fn) {
|
|
62
|
+
this.cancel();
|
|
63
|
+
this.currentId = scheduler.request(() => {
|
|
64
|
+
this.currentId = EMPTY;
|
|
65
|
+
fn();
|
|
66
|
+
});
|
|
67
|
+
}
|
|
68
|
+
cancel = () => {
|
|
69
|
+
if (this.currentId !== EMPTY) {
|
|
70
|
+
scheduler.cancel(this.currentId);
|
|
71
|
+
this.currentId = EMPTY;
|
|
72
|
+
}
|
|
73
|
+
};
|
|
74
|
+
disposeEffect = () => {
|
|
75
|
+
return this.cancel;
|
|
76
|
+
};
|
|
77
|
+
};
|
|
78
|
+
/**
|
|
79
|
+
* A `requestAnimationFrame` with automatic cleanup and guard.
|
|
80
|
+
*/
|
|
81
|
+
function useAnimationFrame() {
|
|
82
|
+
const timeout = useRefWithInit(AnimationFrame.create).current;
|
|
83
|
+
useOnMount(timeout.disposeEffect);
|
|
84
|
+
return timeout;
|
|
85
|
+
}
|
|
86
|
+
//#endregion
|
|
87
|
+
export { AnimationFrame, useAnimationFrame };
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { error } from "./error.js";
|
|
3
|
+
import * as React from "react";
|
|
4
|
+
//#region ../../../node_modules/.pnpm/@base-ui+utils@0.4.0_@types+react@19.3.0_react-dom@19.3.0_react@19.3.0__react@19.3.0/node_modules/@base-ui/utils/useControlled.mjs
|
|
5
|
+
function useControlled({ controlled, default: defaultProp, name, state = "value" }) {
|
|
6
|
+
const { current: isControlled } = React.useRef(controlled !== void 0);
|
|
7
|
+
const [valueState, setValue] = React.useState(defaultProp);
|
|
8
|
+
const value = isControlled && controlled !== void 0 ? controlled : valueState;
|
|
9
|
+
if (process.env.NODE_ENV !== "production") {
|
|
10
|
+
React.useEffect(() => {
|
|
11
|
+
if (isControlled !== (controlled !== void 0)) error([
|
|
12
|
+
`A component is changing the ${isControlled ? "" : "un"}controlled ${state} state of ${name} to be ${isControlled ? "un" : ""}controlled.`,
|
|
13
|
+
"Elements should not switch from uncontrolled to controlled (or vice versa).",
|
|
14
|
+
`Decide between using a controlled or uncontrolled ${name} element for the lifetime of the component.`,
|
|
15
|
+
"The nature of the state is determined during the first render. It's considered controlled if the value is not `undefined`.",
|
|
16
|
+
"More info: https://fb.me/react-controlled-components"
|
|
17
|
+
].join("\n"));
|
|
18
|
+
}, [
|
|
19
|
+
state,
|
|
20
|
+
name,
|
|
21
|
+
controlled
|
|
22
|
+
]);
|
|
23
|
+
const { current: defaultValue } = React.useRef(defaultProp);
|
|
24
|
+
React.useEffect(() => {
|
|
25
|
+
if (!isControlled && serializeToDevModeString(defaultValue) !== serializeToDevModeString(defaultProp)) error([`A component is changing the default ${state} state of an uncontrolled ${name} after being initialized. To suppress this warning opt to use a controlled ${name}.`].join("\n"));
|
|
26
|
+
}, [defaultProp]);
|
|
27
|
+
}
|
|
28
|
+
return [value, React.useCallback((newValue) => {
|
|
29
|
+
if (!isControlled) setValue(newValue);
|
|
30
|
+
}, [])];
|
|
31
|
+
}
|
|
32
|
+
function serializeToDevModeString(input) {
|
|
33
|
+
let nextId = 0;
|
|
34
|
+
const seen = /* @__PURE__ */ new WeakMap();
|
|
35
|
+
try {
|
|
36
|
+
return JSON.stringify(input, function replacer(key, value) {
|
|
37
|
+
if (key === "_owner" && this != null && typeof this === "object" && "$$typeof" in this) return;
|
|
38
|
+
if (typeof value === "bigint") return `__bigint__:${value}`;
|
|
39
|
+
if (value !== null && typeof value === "object") {
|
|
40
|
+
const id = seen.get(value);
|
|
41
|
+
if (id !== void 0) return `__object__:${id}`;
|
|
42
|
+
seen.set(value, nextId);
|
|
43
|
+
nextId += 1;
|
|
44
|
+
}
|
|
45
|
+
return value;
|
|
46
|
+
}) ?? `__top__:${typeof input}`;
|
|
47
|
+
} catch {
|
|
48
|
+
return "__unserializable__";
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
//#endregion
|
|
52
|
+
export { useControlled };
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { SafeReact } from "./safeReact.js";
|
|
3
|
+
import * as React from "react";
|
|
4
|
+
//#region ../../../node_modules/.pnpm/@base-ui+utils@0.4.0_@types+react@19.3.0_react-dom@19.3.0_react@19.3.0__react@19.3.0/node_modules/@base-ui/utils/useId.mjs
|
|
5
|
+
let globalId = 0;
|
|
6
|
+
function useGlobalId(idOverride, prefix = "mui") {
|
|
7
|
+
const [defaultId, setDefaultId] = React.useState(idOverride);
|
|
8
|
+
const id = idOverride || defaultId;
|
|
9
|
+
React.useEffect(() => {
|
|
10
|
+
if (defaultId == null) {
|
|
11
|
+
globalId += 1;
|
|
12
|
+
setDefaultId(`${prefix}-${globalId}`);
|
|
13
|
+
}
|
|
14
|
+
}, [defaultId, prefix]);
|
|
15
|
+
return id;
|
|
16
|
+
}
|
|
17
|
+
const maybeReactUseId = SafeReact.useId;
|
|
18
|
+
/**
|
|
19
|
+
*
|
|
20
|
+
* @example <div id={useId()} />
|
|
21
|
+
* @param idOverride
|
|
22
|
+
* @returns {string}
|
|
23
|
+
*/
|
|
24
|
+
function useId$1(idOverride, prefix) {
|
|
25
|
+
if (maybeReactUseId !== void 0) {
|
|
26
|
+
const reactId = maybeReactUseId();
|
|
27
|
+
return idOverride ?? (prefix ? `${prefix}-${reactId}` : reactId);
|
|
28
|
+
}
|
|
29
|
+
return useGlobalId(idOverride, prefix);
|
|
30
|
+
}
|
|
31
|
+
//#endregion
|
|
32
|
+
export { useId$1 as useId };
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import * as React from "react";
|
|
3
|
+
//#region ../../../node_modules/.pnpm/@base-ui+utils@0.4.0_@types+react@19.3.0_react-dom@19.3.0_react@19.3.0__react@19.3.0/node_modules/@base-ui/utils/useIsoLayoutEffect.mjs
|
|
4
|
+
const noop = () => {};
|
|
5
|
+
const useIsoLayoutEffect = typeof document !== "undefined" ? React.useLayoutEffect : noop;
|
|
6
|
+
//#endregion
|
|
7
|
+
export { useIsoLayoutEffect };
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
import { useRefWithInit } from "./useRefWithInit.js";
|
|
2
|
+
//#region ../../../node_modules/.pnpm/@base-ui+utils@0.4.0_@types+react@19.3.0_react-dom@19.3.0_react@19.3.0__react@19.3.0/node_modules/@base-ui/utils/useMergedRefs.mjs
|
|
3
|
+
/**
|
|
4
|
+
* Merges refs into a single memoized callback ref or `null`.
|
|
5
|
+
* This makes sure multiple refs are updated together and have the same value.
|
|
6
|
+
*
|
|
7
|
+
* This function accepts up to four refs. If you need to merge more, or have an unspecified number of refs to merge,
|
|
8
|
+
* use `useMergedRefsN` instead.
|
|
9
|
+
*/
|
|
10
|
+
function useMergedRefs(a, b, c, d) {
|
|
11
|
+
const forkRef = useRefWithInit(createForkRef).current;
|
|
12
|
+
if (didChange(forkRef, a, b, c, d)) update(forkRef, [
|
|
13
|
+
a,
|
|
14
|
+
b,
|
|
15
|
+
c,
|
|
16
|
+
d
|
|
17
|
+
]);
|
|
18
|
+
return forkRef.callback;
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Merges an array of refs into a single memoized callback ref or `null`.
|
|
22
|
+
*
|
|
23
|
+
* If you need to merge a fixed number (up to four) of refs, use `useMergedRefs` instead for better performance.
|
|
24
|
+
*/
|
|
25
|
+
function useMergedRefsN(refs) {
|
|
26
|
+
const forkRef = useRefWithInit(createForkRef).current;
|
|
27
|
+
if (didChangeN(forkRef, refs)) update(forkRef, refs);
|
|
28
|
+
return forkRef.callback;
|
|
29
|
+
}
|
|
30
|
+
function createForkRef() {
|
|
31
|
+
return {
|
|
32
|
+
callback: null,
|
|
33
|
+
cleanup: null,
|
|
34
|
+
refs: []
|
|
35
|
+
};
|
|
36
|
+
}
|
|
37
|
+
function didChange(forkRef, a, b, c, d) {
|
|
38
|
+
return forkRef.refs[0] !== a || forkRef.refs[1] !== b || forkRef.refs[2] !== c || forkRef.refs[3] !== d;
|
|
39
|
+
}
|
|
40
|
+
function didChangeN(forkRef, newRefs) {
|
|
41
|
+
return forkRef.refs.length !== newRefs.length || forkRef.refs.some((ref, index) => ref !== newRefs[index]);
|
|
42
|
+
}
|
|
43
|
+
function update(forkRef, refs) {
|
|
44
|
+
forkRef.refs = refs;
|
|
45
|
+
if (refs.every((ref) => ref == null)) {
|
|
46
|
+
forkRef.callback = null;
|
|
47
|
+
return;
|
|
48
|
+
}
|
|
49
|
+
forkRef.callback = (instance) => {
|
|
50
|
+
if (forkRef.cleanup) {
|
|
51
|
+
forkRef.cleanup();
|
|
52
|
+
forkRef.cleanup = null;
|
|
53
|
+
}
|
|
54
|
+
if (instance != null) {
|
|
55
|
+
const cleanupCallbacks = Array(refs.length).fill(null);
|
|
56
|
+
for (let i = 0; i < refs.length; i += 1) {
|
|
57
|
+
const ref = refs[i];
|
|
58
|
+
if (ref == null) continue;
|
|
59
|
+
switch (typeof ref) {
|
|
60
|
+
case "function": {
|
|
61
|
+
const refCleanup = ref(instance);
|
|
62
|
+
if (typeof refCleanup === "function") cleanupCallbacks[i] = refCleanup;
|
|
63
|
+
break;
|
|
64
|
+
}
|
|
65
|
+
case "object": ref.current = instance;
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
forkRef.cleanup = () => {
|
|
69
|
+
for (let i = 0; i < refs.length; i += 1) {
|
|
70
|
+
const ref = refs[i];
|
|
71
|
+
if (ref == null) continue;
|
|
72
|
+
switch (typeof ref) {
|
|
73
|
+
case "function": {
|
|
74
|
+
const cleanupCallback = cleanupCallbacks[i];
|
|
75
|
+
if (typeof cleanupCallback === "function") cleanupCallback();
|
|
76
|
+
else ref(null);
|
|
77
|
+
break;
|
|
78
|
+
}
|
|
79
|
+
case "object": ref.current = null;
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
};
|
|
83
|
+
}
|
|
84
|
+
};
|
|
85
|
+
}
|
|
86
|
+
//#endregion
|
|
87
|
+
export { useMergedRefs, useMergedRefsN };
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { EMPTY_ARRAY } from "./empty.js";
|
|
3
|
+
import * as React from "react";
|
|
4
|
+
//#region ../../../node_modules/.pnpm/@base-ui+utils@0.4.0_@types+react@19.3.0_react-dom@19.3.0_react@19.3.0__react@19.3.0/node_modules/@base-ui/utils/useOnMount.mjs
|
|
5
|
+
/**
|
|
6
|
+
* A React.useEffect equivalent that runs once, when the component is mounted.
|
|
7
|
+
*/
|
|
8
|
+
function useOnMount(fn) {
|
|
9
|
+
React.useEffect(fn, EMPTY_ARRAY);
|
|
10
|
+
}
|
|
11
|
+
//#endregion
|
|
12
|
+
export { useOnMount };
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import * as React from "react";
|
|
3
|
+
//#region ../../../node_modules/.pnpm/@base-ui+utils@0.4.0_@types+react@19.3.0_react-dom@19.3.0_react@19.3.0__react@19.3.0/node_modules/@base-ui/utils/useRefWithInit.mjs
|
|
4
|
+
const UNINITIALIZED = {};
|
|
5
|
+
/**
|
|
6
|
+
* A React.useRef() that is initialized with a function. Note that it accepts an optional
|
|
7
|
+
* initialization argument, so the initialization function doesn't need to be an inline closure.
|
|
8
|
+
*
|
|
9
|
+
* @usage
|
|
10
|
+
* const ref = useRefWithInit(sortColumns, columns)
|
|
11
|
+
*/
|
|
12
|
+
function useRefWithInit(init, initArg) {
|
|
13
|
+
const ref = React.useRef(UNINITIALIZED);
|
|
14
|
+
if (ref.current === UNINITIALIZED) ref.current = init(initArg);
|
|
15
|
+
return ref;
|
|
16
|
+
}
|
|
17
|
+
//#endregion
|
|
18
|
+
export { useRefWithInit };
|
|
@@ -0,0 +1,206 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { getWindow, isOverflowElement } from "../../@floating-ui/utils/dist/floating-ui.utils.dom.js";
|
|
3
|
+
import { useIsoLayoutEffect } from "./useIsoLayoutEffect.js";
|
|
4
|
+
import { ownerDocument } from "./owner.js";
|
|
5
|
+
import { Timeout } from "./useTimeout.js";
|
|
6
|
+
import { ios } from "./platform/os.js";
|
|
7
|
+
import { webkit } from "./platform/engine.js";
|
|
8
|
+
import { addEventListener } from "./addEventListener.js";
|
|
9
|
+
import { AnimationFrame } from "./useAnimationFrame.js";
|
|
10
|
+
//#region ../../../node_modules/.pnpm/@base-ui+utils@0.4.0_@types+react@19.3.0_react-dom@19.3.0_react@19.3.0__react@19.3.0/node_modules/@base-ui/utils/useScrollLock.mjs
|
|
11
|
+
let originalHtmlStyles = {};
|
|
12
|
+
let originalBodyStyles = {};
|
|
13
|
+
let originalHtmlScrollBehavior = "";
|
|
14
|
+
function getViewportScroller(html, body) {
|
|
15
|
+
return isOverflowElement(html) ? html : body;
|
|
16
|
+
}
|
|
17
|
+
function isPageScrollLocked(win, html, body) {
|
|
18
|
+
return /hidden|clip/.test(win.getComputedStyle(getViewportScroller(html, body)).overflowY);
|
|
19
|
+
}
|
|
20
|
+
function hasInsetScrollbars(referenceElement) {
|
|
21
|
+
if (typeof document === "undefined") return false;
|
|
22
|
+
const doc = ownerDocument(referenceElement);
|
|
23
|
+
return getWindow(doc).innerWidth - doc.documentElement.clientWidth > 0;
|
|
24
|
+
}
|
|
25
|
+
function supportsStableScrollbarGutter(referenceElement) {
|
|
26
|
+
if (!(typeof CSS !== "undefined" && CSS.supports && CSS.supports("scrollbar-gutter", "stable")) || typeof document === "undefined") return false;
|
|
27
|
+
const doc = ownerDocument(referenceElement);
|
|
28
|
+
const html = doc.documentElement;
|
|
29
|
+
const body = doc.body;
|
|
30
|
+
const scrollContainer = getViewportScroller(html, body);
|
|
31
|
+
const originalScrollContainerOverflowY = scrollContainer.style.overflowY;
|
|
32
|
+
const originalHtmlStyleGutter = html.style.scrollbarGutter;
|
|
33
|
+
html.style.scrollbarGutter = "stable";
|
|
34
|
+
scrollContainer.style.overflowY = "scroll";
|
|
35
|
+
const before = scrollContainer.offsetWidth;
|
|
36
|
+
scrollContainer.style.overflowY = "hidden";
|
|
37
|
+
const after = scrollContainer.offsetWidth;
|
|
38
|
+
scrollContainer.style.overflowY = originalScrollContainerOverflowY;
|
|
39
|
+
html.style.scrollbarGutter = originalHtmlStyleGutter;
|
|
40
|
+
return before === after;
|
|
41
|
+
}
|
|
42
|
+
function preventScrollOverlayScrollbars(referenceElement) {
|
|
43
|
+
const doc = ownerDocument(referenceElement);
|
|
44
|
+
const html = doc.documentElement;
|
|
45
|
+
const body = doc.body;
|
|
46
|
+
const elementToLock = getViewportScroller(html, body);
|
|
47
|
+
const originalElementToLockStyles = {
|
|
48
|
+
overflowY: elementToLock.style.overflowY,
|
|
49
|
+
overflowX: elementToLock.style.overflowX
|
|
50
|
+
};
|
|
51
|
+
Object.assign(elementToLock.style, {
|
|
52
|
+
overflowY: "hidden",
|
|
53
|
+
overflowX: "hidden"
|
|
54
|
+
});
|
|
55
|
+
return () => {
|
|
56
|
+
Object.assign(elementToLock.style, originalElementToLockStyles);
|
|
57
|
+
};
|
|
58
|
+
}
|
|
59
|
+
function preventScrollInsetScrollbars(referenceElement) {
|
|
60
|
+
const doc = ownerDocument(referenceElement);
|
|
61
|
+
const html = doc.documentElement;
|
|
62
|
+
const body = doc.body;
|
|
63
|
+
const win = getWindow(html);
|
|
64
|
+
let scrollTop = 0;
|
|
65
|
+
let scrollLeft = 0;
|
|
66
|
+
let updateGutterOnly = false;
|
|
67
|
+
const resizeFrame = AnimationFrame.create();
|
|
68
|
+
if (webkit && (win.visualViewport?.scale ?? 1) !== 1) return () => {};
|
|
69
|
+
function lockScroll() {
|
|
70
|
+
const htmlStyles = win.getComputedStyle(html);
|
|
71
|
+
const bodyStyles = win.getComputedStyle(body);
|
|
72
|
+
const scrollbarGutterValue = (htmlStyles.scrollbarGutter || "").includes("both-edges") ? "stable both-edges" : "stable";
|
|
73
|
+
scrollTop = html.scrollTop;
|
|
74
|
+
scrollLeft = html.scrollLeft;
|
|
75
|
+
originalHtmlStyles = {
|
|
76
|
+
scrollbarGutter: html.style.scrollbarGutter,
|
|
77
|
+
overflowY: html.style.overflowY,
|
|
78
|
+
overflowX: html.style.overflowX
|
|
79
|
+
};
|
|
80
|
+
originalHtmlScrollBehavior = html.style.scrollBehavior;
|
|
81
|
+
originalBodyStyles = {
|
|
82
|
+
position: body.style.position,
|
|
83
|
+
height: body.style.height,
|
|
84
|
+
width: body.style.width,
|
|
85
|
+
boxSizing: body.style.boxSizing,
|
|
86
|
+
overflowY: body.style.overflowY,
|
|
87
|
+
overflowX: body.style.overflowX,
|
|
88
|
+
scrollBehavior: body.style.scrollBehavior
|
|
89
|
+
};
|
|
90
|
+
const isScrollableY = html.scrollHeight > html.clientHeight;
|
|
91
|
+
const isScrollableX = html.scrollWidth > html.clientWidth;
|
|
92
|
+
const hasConstantOverflowY = htmlStyles.overflowY === "scroll" || bodyStyles.overflowY === "scroll";
|
|
93
|
+
const hasConstantOverflowX = htmlStyles.overflowX === "scroll" || bodyStyles.overflowX === "scroll";
|
|
94
|
+
const scrollbarWidth = Math.max(0, win.innerWidth - body.clientWidth);
|
|
95
|
+
const scrollbarHeight = Math.max(0, win.innerHeight - body.clientHeight);
|
|
96
|
+
const marginY = parseFloat(bodyStyles.marginTop) + parseFloat(bodyStyles.marginBottom);
|
|
97
|
+
const marginX = parseFloat(bodyStyles.marginLeft) + parseFloat(bodyStyles.marginRight);
|
|
98
|
+
const elementToLock = getViewportScroller(html, body);
|
|
99
|
+
updateGutterOnly = supportsStableScrollbarGutter(referenceElement);
|
|
100
|
+
if (updateGutterOnly) {
|
|
101
|
+
html.style.scrollbarGutter = scrollbarGutterValue;
|
|
102
|
+
elementToLock.style.overflowY = "hidden";
|
|
103
|
+
elementToLock.style.overflowX = "hidden";
|
|
104
|
+
return;
|
|
105
|
+
}
|
|
106
|
+
Object.assign(html.style, {
|
|
107
|
+
scrollbarGutter: scrollbarGutterValue,
|
|
108
|
+
overflowY: "hidden",
|
|
109
|
+
overflowX: "hidden"
|
|
110
|
+
});
|
|
111
|
+
if (isScrollableY || hasConstantOverflowY) html.style.overflowY = "scroll";
|
|
112
|
+
if (isScrollableX || hasConstantOverflowX) html.style.overflowX = "scroll";
|
|
113
|
+
Object.assign(body.style, {
|
|
114
|
+
position: "relative",
|
|
115
|
+
height: marginY || scrollbarHeight ? `calc(100dvh - ${marginY + scrollbarHeight}px)` : "100dvh",
|
|
116
|
+
width: marginX || scrollbarWidth ? `calc(100vw - ${marginX + scrollbarWidth}px)` : "100vw",
|
|
117
|
+
boxSizing: "border-box",
|
|
118
|
+
overflowY: "hidden",
|
|
119
|
+
overflowX: "hidden",
|
|
120
|
+
scrollBehavior: "unset"
|
|
121
|
+
});
|
|
122
|
+
body.scrollTop = scrollTop;
|
|
123
|
+
body.scrollLeft = scrollLeft;
|
|
124
|
+
html.setAttribute("data-base-ui-scroll-locked", "");
|
|
125
|
+
html.style.scrollBehavior = "unset";
|
|
126
|
+
}
|
|
127
|
+
function cleanup() {
|
|
128
|
+
Object.assign(html.style, originalHtmlStyles);
|
|
129
|
+
Object.assign(body.style, originalBodyStyles);
|
|
130
|
+
if (!updateGutterOnly) {
|
|
131
|
+
html.scrollTop = scrollTop;
|
|
132
|
+
html.scrollLeft = scrollLeft;
|
|
133
|
+
html.removeAttribute("data-base-ui-scroll-locked");
|
|
134
|
+
html.style.scrollBehavior = originalHtmlScrollBehavior;
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
function handleResize() {
|
|
138
|
+
cleanup();
|
|
139
|
+
resizeFrame.request(lockScroll);
|
|
140
|
+
}
|
|
141
|
+
lockScroll();
|
|
142
|
+
const unsubscribeResize = addEventListener(win, "resize", handleResize);
|
|
143
|
+
return () => {
|
|
144
|
+
resizeFrame.cancel();
|
|
145
|
+
cleanup();
|
|
146
|
+
if (typeof win.removeEventListener === "function") unsubscribeResize();
|
|
147
|
+
};
|
|
148
|
+
}
|
|
149
|
+
var ScrollLocker = class {
|
|
150
|
+
lockCount = 0;
|
|
151
|
+
restore = null;
|
|
152
|
+
timeoutLock = Timeout.create();
|
|
153
|
+
timeoutUnlock = Timeout.create();
|
|
154
|
+
acquire(referenceElement) {
|
|
155
|
+
this.lockCount += 1;
|
|
156
|
+
if (this.lockCount === 1 && this.restore === null) this.timeoutLock.start(0, () => this.lock(referenceElement));
|
|
157
|
+
return this.release;
|
|
158
|
+
}
|
|
159
|
+
release = () => {
|
|
160
|
+
this.lockCount -= 1;
|
|
161
|
+
if (this.lockCount === 0 && this.restore) this.timeoutUnlock.start(0, this.unlock);
|
|
162
|
+
};
|
|
163
|
+
unlock = () => {
|
|
164
|
+
if (this.lockCount === 0 && this.restore) {
|
|
165
|
+
this.restore?.();
|
|
166
|
+
this.restore = null;
|
|
167
|
+
}
|
|
168
|
+
};
|
|
169
|
+
lock(referenceElement) {
|
|
170
|
+
if (this.lockCount === 0 || this.restore !== null) return;
|
|
171
|
+
const doc = ownerDocument(referenceElement);
|
|
172
|
+
const html = doc.documentElement;
|
|
173
|
+
const body = doc.body;
|
|
174
|
+
const win = getWindow(html);
|
|
175
|
+
if (isPageScrollLocked(win, html, body)) {
|
|
176
|
+
const observer = new win.MutationObserver(() => {
|
|
177
|
+
if (isPageScrollLocked(win, html, body)) return;
|
|
178
|
+
observer.disconnect();
|
|
179
|
+
this.restore = null;
|
|
180
|
+
this.lock(referenceElement);
|
|
181
|
+
});
|
|
182
|
+
const options = { attributes: true };
|
|
183
|
+
observer.observe(html, options);
|
|
184
|
+
observer.observe(body, options);
|
|
185
|
+
this.restore = () => observer.disconnect();
|
|
186
|
+
return;
|
|
187
|
+
}
|
|
188
|
+
const hasOverlayScrollbars = ios || !hasInsetScrollbars(referenceElement);
|
|
189
|
+
this.restore = hasOverlayScrollbars ? preventScrollOverlayScrollbars(referenceElement) : preventScrollInsetScrollbars(referenceElement);
|
|
190
|
+
}
|
|
191
|
+
};
|
|
192
|
+
const SCROLL_LOCKER = new ScrollLocker();
|
|
193
|
+
/**
|
|
194
|
+
* Locks the scroll of the document when enabled.
|
|
195
|
+
*
|
|
196
|
+
* @param enabled - Whether to enable the scroll lock.
|
|
197
|
+
* @param referenceElement - Element to use as a reference for lock calculations.
|
|
198
|
+
*/
|
|
199
|
+
function useScrollLock(enabled = true, referenceElement = null) {
|
|
200
|
+
useIsoLayoutEffect(() => {
|
|
201
|
+
if (!enabled) return;
|
|
202
|
+
return SCROLL_LOCKER.acquire(referenceElement);
|
|
203
|
+
}, [enabled, referenceElement]);
|
|
204
|
+
}
|
|
205
|
+
//#endregion
|
|
206
|
+
export { useScrollLock };
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { useRefWithInit } from "./useRefWithInit.js";
|
|
3
|
+
import { SafeReact } from "./safeReact.js";
|
|
4
|
+
//#region ../../../node_modules/.pnpm/@base-ui+utils@0.4.0_@types+react@19.3.0_react-dom@19.3.0_react@19.3.0__react@19.3.0/node_modules/@base-ui/utils/useStableCallback.mjs
|
|
5
|
+
const useInsertionEffect = SafeReact.useInsertionEffect;
|
|
6
|
+
const useSafeInsertionEffect = useInsertionEffect && useInsertionEffect !== SafeReact.useLayoutEffect ? useInsertionEffect : (fn) => fn();
|
|
7
|
+
/**
|
|
8
|
+
* Stabilizes the function passed so it's always the same between renders.
|
|
9
|
+
*
|
|
10
|
+
* The function becomes non-reactive to any values it captures.
|
|
11
|
+
* It can safely be passed as a dependency of `React.useMemo` and `React.useEffect` without re-triggering them if its captured values change.
|
|
12
|
+
*
|
|
13
|
+
* The function must only be called inside effects and event handlers, never during render (which throws an error).
|
|
14
|
+
*
|
|
15
|
+
* This hook is a more permissive version of React 19.2's `React.useEffectEvent` in that it can be passed through contexts and called in event handler props, not just effects.
|
|
16
|
+
*/
|
|
17
|
+
function useStableCallback(callback) {
|
|
18
|
+
const stable = useRefWithInit(createStableCallback).current;
|
|
19
|
+
stable.next = callback;
|
|
20
|
+
useSafeInsertionEffect(stable.effect);
|
|
21
|
+
return stable.trampoline;
|
|
22
|
+
}
|
|
23
|
+
function createStableCallback() {
|
|
24
|
+
const stable = {
|
|
25
|
+
next: void 0,
|
|
26
|
+
callback: assertNotCalled,
|
|
27
|
+
trampoline: (...args) => stable.callback?.(...args),
|
|
28
|
+
effect: () => {
|
|
29
|
+
stable.callback = stable.next;
|
|
30
|
+
}
|
|
31
|
+
};
|
|
32
|
+
return stable;
|
|
33
|
+
}
|
|
34
|
+
function assertNotCalled() {
|
|
35
|
+
if (process.env.NODE_ENV !== "production") throw new Error("Base UI: Cannot call an event handler while rendering.");
|
|
36
|
+
}
|
|
37
|
+
//#endregion
|
|
38
|
+
export { useStableCallback };
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { useRefWithInit } from "./useRefWithInit.js";
|
|
3
|
+
import { useOnMount } from "./useOnMount.js";
|
|
4
|
+
//#region ../../../node_modules/.pnpm/@base-ui+utils@0.4.0_@types+react@19.3.0_react-dom@19.3.0_react@19.3.0__react@19.3.0/node_modules/@base-ui/utils/useTimeout.mjs
|
|
5
|
+
const EMPTY = 0;
|
|
6
|
+
var Timeout = class Timeout {
|
|
7
|
+
static create() {
|
|
8
|
+
return new Timeout();
|
|
9
|
+
}
|
|
10
|
+
currentId = EMPTY;
|
|
11
|
+
/**
|
|
12
|
+
* Executes `fn` after `delay`, clearing any previously scheduled call.
|
|
13
|
+
*/
|
|
14
|
+
start(delay, fn) {
|
|
15
|
+
this.clear();
|
|
16
|
+
this.currentId = setTimeout(() => {
|
|
17
|
+
this.currentId = EMPTY;
|
|
18
|
+
fn();
|
|
19
|
+
}, delay);
|
|
20
|
+
}
|
|
21
|
+
isStarted() {
|
|
22
|
+
return this.currentId !== EMPTY;
|
|
23
|
+
}
|
|
24
|
+
clear = () => {
|
|
25
|
+
if (this.currentId !== EMPTY) {
|
|
26
|
+
clearTimeout(this.currentId);
|
|
27
|
+
this.currentId = EMPTY;
|
|
28
|
+
}
|
|
29
|
+
};
|
|
30
|
+
disposeEffect = () => {
|
|
31
|
+
return this.clear;
|
|
32
|
+
};
|
|
33
|
+
};
|
|
34
|
+
/**
|
|
35
|
+
* A `setTimeout` with automatic cleanup and guard.
|
|
36
|
+
*/
|
|
37
|
+
function useTimeout() {
|
|
38
|
+
const timeout = useRefWithInit(Timeout.create).current;
|
|
39
|
+
useOnMount(timeout.disposeEffect);
|
|
40
|
+
return timeout;
|
|
41
|
+
}
|
|
42
|
+
//#endregion
|
|
43
|
+
export { Timeout, useTimeout };
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { useRefWithInit } from "./useRefWithInit.js";
|
|
3
|
+
import { useIsoLayoutEffect } from "./useIsoLayoutEffect.js";
|
|
4
|
+
//#region ../../../node_modules/.pnpm/@base-ui+utils@0.4.0_@types+react@19.3.0_react-dom@19.3.0_react@19.3.0__react@19.3.0/node_modules/@base-ui/utils/useValueAsRef.mjs
|
|
5
|
+
/**
|
|
6
|
+
* Untracks the provided value by turning it into a ref to remove its reactivity.
|
|
7
|
+
*
|
|
8
|
+
* Used to access the passed value inside `React.useEffect` without causing the effect to re-run when the value changes.
|
|
9
|
+
*/
|
|
10
|
+
function useValueAsRef(value) {
|
|
11
|
+
const latest = useRefWithInit(createLatestRef, value).current;
|
|
12
|
+
latest.next = value;
|
|
13
|
+
useIsoLayoutEffect(latest.effect);
|
|
14
|
+
return latest;
|
|
15
|
+
}
|
|
16
|
+
function createLatestRef(value) {
|
|
17
|
+
const latest = {
|
|
18
|
+
current: value,
|
|
19
|
+
next: value,
|
|
20
|
+
effect: () => {
|
|
21
|
+
latest.current = latest.next;
|
|
22
|
+
}
|
|
23
|
+
};
|
|
24
|
+
return latest;
|
|
25
|
+
}
|
|
26
|
+
//#endregion
|
|
27
|
+
export { useValueAsRef };
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
//#region ../../../node_modules/.pnpm/@base-ui+utils@0.4.0_@types+react@19.3.0_react-dom@19.3.0_react@19.3.0__react@19.3.0/node_modules/@base-ui/utils/visuallyHidden.mjs
|
|
2
|
+
const visuallyHiddenBase = {
|
|
3
|
+
clipPath: "inset(50%)",
|
|
4
|
+
overflow: "hidden",
|
|
5
|
+
whiteSpace: "nowrap",
|
|
6
|
+
border: 0,
|
|
7
|
+
padding: 0,
|
|
8
|
+
width: 1,
|
|
9
|
+
height: 1,
|
|
10
|
+
margin: -1
|
|
11
|
+
};
|
|
12
|
+
const visuallyHidden = {
|
|
13
|
+
...visuallyHiddenBase,
|
|
14
|
+
position: "fixed",
|
|
15
|
+
top: 0,
|
|
16
|
+
left: 0
|
|
17
|
+
};
|
|
18
|
+
const visuallyHiddenInput = {
|
|
19
|
+
...visuallyHiddenBase,
|
|
20
|
+
position: "absolute"
|
|
21
|
+
};
|
|
22
|
+
//#endregion
|
|
23
|
+
export { visuallyHidden, visuallyHiddenInput };
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { createLogOnce } from "./createLogOnce.js";
|
|
2
|
+
//#region ../../../node_modules/.pnpm/@base-ui+utils@0.4.0_@types+react@19.3.0_react-dom@19.3.0_react@19.3.0__react@19.3.0/node_modules/@base-ui/utils/warn.mjs
|
|
3
|
+
const warn = createLogOnce("warn", "Base UI");
|
|
4
|
+
//#endregion
|
|
5
|
+
export { warn };
|