@ledgerhq/lumen-ui-react 0.1.14 → 0.1.15
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/_virtual/index.js +5 -0
- package/dist/_virtual/index2.js +4 -0
- package/dist/_virtual/use-sync-external-store-shim.development.js +4 -0
- package/dist/_virtual/use-sync-external-store-shim.production.js +4 -0
- package/dist/_virtual/with-selector.development.js +4 -0
- package/dist/_virtual/with-selector.js +5 -0
- package/dist/_virtual/with-selector.production.js +4 -0
- package/dist/_virtual/with-selector2.js +4 -0
- package/dist/index.js +113 -108
- package/dist/lib/Components/Avatar/Avatar.js +5 -5
- package/dist/lib/Components/BaseInput/BaseInput.js +20 -20
- package/dist/lib/Components/MediaBanner/MediaBanner.d.ts.map +1 -1
- package/dist/lib/Components/MediaBanner/MediaBanner.js +30 -28
- package/dist/lib/Components/Popover/Popover.d.ts +57 -0
- package/dist/lib/Components/Popover/Popover.d.ts.map +1 -0
- package/dist/lib/Components/Popover/Popover.js +126 -0
- package/dist/lib/Components/Popover/index.d.ts +3 -0
- package/dist/lib/Components/Popover/index.d.ts.map +1 -0
- package/dist/lib/Components/Popover/types.d.ts +129 -0
- package/dist/lib/Components/Popover/types.d.ts.map +1 -0
- package/dist/lib/Components/Tag/Tag.js +5 -5
- package/dist/lib/Components/Tooltip/Tooltip.js +1 -1
- package/dist/lib/Components/index.d.ts +1 -0
- package/dist/lib/Components/index.d.ts.map +1 -1
- package/dist/lib/Symbols/Icons/Csv.js +5 -5
- package/dist/lib/Symbols/Icons/TriangleDown.d.ts +29 -0
- package/dist/lib/Symbols/Icons/TriangleDown.d.ts.map +1 -0
- package/dist/lib/Symbols/Icons/TriangleDown.js +25 -0
- package/dist/lib/Symbols/Icons/TriangleUp.d.ts +29 -0
- package/dist/lib/Symbols/Icons/TriangleUp.d.ts.map +1 -0
- package/dist/lib/Symbols/Icons/TriangleUp.js +25 -0
- package/dist/lib/Symbols/index.d.ts +2 -0
- package/dist/lib/Symbols/index.d.ts.map +1 -1
- package/dist/lib/Symbols/index.js +104 -100
- package/dist/node_modules/@base-ui/react/esm/composite/composite.js +10 -0
- package/dist/node_modules/@base-ui/react/esm/composite/root/CompositeRootContext.js +14 -0
- package/dist/node_modules/@base-ui/react/esm/direction-provider/DirectionContext.js +10 -0
- package/dist/node_modules/@base-ui/react/esm/floating-ui-react/components/FloatingFocusManager.js +284 -0
- package/dist/node_modules/@base-ui/react/esm/floating-ui-react/components/FloatingPortal.js +128 -0
- package/dist/node_modules/@base-ui/react/esm/floating-ui-react/components/FloatingRootStore.js +60 -0
- package/dist/node_modules/@base-ui/react/esm/floating-ui-react/components/FloatingTree.js +58 -0
- package/dist/node_modules/@base-ui/react/esm/floating-ui-react/components/FloatingTreeStore.js +17 -0
- package/dist/node_modules/@base-ui/react/esm/floating-ui-react/hooks/useClick.js +67 -0
- package/dist/node_modules/@base-ui/react/esm/floating-ui-react/hooks/useDismiss.js +275 -0
- package/dist/node_modules/@base-ui/react/esm/floating-ui-react/hooks/useFloating.js +78 -0
- package/dist/node_modules/@base-ui/react/esm/floating-ui-react/hooks/useFloatingRootContext.js +38 -0
- package/dist/node_modules/@base-ui/react/esm/floating-ui-react/hooks/useHoverFloatingInteraction.js +87 -0
- package/dist/node_modules/@base-ui/react/esm/floating-ui-react/hooks/useHoverInteractionSharedState.js +42 -0
- package/dist/node_modules/@base-ui/react/esm/floating-ui-react/hooks/useHoverReferenceInteraction.js +145 -0
- package/dist/node_modules/@base-ui/react/esm/floating-ui-react/hooks/useHoverShared.js +19 -0
- package/dist/node_modules/@base-ui/react/esm/floating-ui-react/hooks/useInteractions.js +48 -0
- package/dist/node_modules/@base-ui/react/esm/floating-ui-react/hooks/useRole.js +76 -0
- package/dist/node_modules/@base-ui/react/esm/floating-ui-react/hooks/useSyncedFloatingRootContext.js +35 -0
- package/dist/node_modules/@base-ui/react/esm/floating-ui-react/middleware/arrow.js +47 -0
- package/dist/node_modules/@base-ui/react/esm/floating-ui-react/safePolygon.js +131 -0
- package/dist/node_modules/@base-ui/react/esm/floating-ui-react/utils/composite.js +7 -0
- package/dist/node_modules/@base-ui/react/esm/floating-ui-react/utils/constants.js +7 -0
- package/dist/node_modules/@base-ui/react/esm/floating-ui-react/utils/createAttribute.js +6 -0
- package/dist/node_modules/@base-ui/react/esm/floating-ui-react/utils/createEventEmitter.js +17 -0
- package/dist/node_modules/@base-ui/react/esm/floating-ui-react/utils/element.js +69 -0
- package/dist/node_modules/@base-ui/react/esm/floating-ui-react/utils/enqueueFocus.js +16 -0
- package/dist/node_modules/@base-ui/react/esm/floating-ui-react/utils/event.js +30 -0
- package/dist/node_modules/@base-ui/react/esm/floating-ui-react/utils/getEmptyRootContext.js +17 -0
- package/dist/node_modules/@base-ui/react/esm/floating-ui-react/utils/markOthers.js +80 -0
- package/dist/node_modules/@base-ui/react/esm/floating-ui-react/utils/nodes.js +15 -0
- package/dist/node_modules/@base-ui/react/esm/floating-ui-react/utils/tabbable.js +68 -0
- package/dist/node_modules/@base-ui/react/esm/merge-props/mergeProps.js +82 -0
- package/dist/node_modules/@base-ui/react/esm/popover/backdrop/PopoverBackdrop.js +39 -0
- package/dist/node_modules/@base-ui/react/esm/popover/popup/PopoverPopup.js +88 -0
- package/dist/node_modules/@base-ui/react/esm/popover/portal/PopoverPortal.js +24 -0
- package/dist/node_modules/@base-ui/react/esm/popover/portal/PopoverPortalContext.js +14 -0
- package/dist/node_modules/@base-ui/react/esm/popover/positioner/PopoverPositioner.js +110 -0
- package/dist/node_modules/@base-ui/react/esm/popover/positioner/PopoverPositionerContext.js +14 -0
- package/dist/node_modules/@base-ui/react/esm/popover/root/PopoverRoot.js +117 -0
- package/dist/node_modules/@base-ui/react/esm/popover/root/PopoverRootContext.js +14 -0
- package/dist/node_modules/@base-ui/react/esm/popover/store/PopoverHandle.js +44 -0
- package/dist/node_modules/@base-ui/react/esm/popover/store/PopoverStore.js +94 -0
- package/dist/node_modules/@base-ui/react/esm/popover/trigger/PopoverTrigger.js +120 -0
- package/dist/node_modules/@base-ui/react/esm/popover/utils/constants.js +4 -0
- package/dist/node_modules/@base-ui/react/esm/toolbar/root/ToolbarRootContext.js +10 -0
- package/dist/node_modules/@base-ui/react/esm/use-button/useButton.js +113 -0
- package/dist/node_modules/@base-ui/react/esm/utils/FocusGuard.js +26 -0
- package/dist/node_modules/@base-ui/react/esm/utils/InternalBackdrop.js +41 -0
- package/dist/node_modules/@base-ui/react/esm/utils/adaptiveOriginMiddleware.js +63 -0
- package/dist/node_modules/@base-ui/react/esm/utils/closePart.js +30 -0
- package/dist/node_modules/@base-ui/react/esm/utils/constants.js +19 -0
- package/dist/node_modules/@base-ui/react/esm/utils/createBaseUIEventDetails.js +26 -0
- package/dist/node_modules/@base-ui/react/esm/utils/getDisabledMountTransitionStyles.js +8 -0
- package/dist/node_modules/@base-ui/react/esm/utils/getStateAttributesProps.js +16 -0
- package/dist/node_modules/@base-ui/react/esm/utils/hideMiddleware.js +20 -0
- package/dist/node_modules/@base-ui/react/esm/utils/popupStateMapping.js +40 -0
- package/dist/node_modules/@base-ui/react/esm/utils/popups/popupStoreUtils.js +95 -0
- package/dist/node_modules/@base-ui/react/esm/utils/popups/popupTriggerMap.js +64 -0
- package/dist/node_modules/@base-ui/react/esm/utils/popups/store.js +52 -0
- package/dist/node_modules/@base-ui/react/esm/utils/reason-parts.js +9 -0
- package/dist/node_modules/@base-ui/react/esm/utils/resolveClassName.js +6 -0
- package/dist/node_modules/@base-ui/react/esm/utils/resolveRef.js +6 -0
- package/dist/node_modules/@base-ui/react/esm/utils/resolveStyle.js +6 -0
- package/dist/node_modules/@base-ui/react/esm/utils/stateAttributesMapping.js +16 -0
- package/dist/node_modules/@base-ui/react/esm/utils/useAnchorPositioning.js +267 -0
- package/dist/node_modules/@base-ui/react/esm/utils/useAnimationsFinished.js +57 -0
- package/dist/node_modules/@base-ui/react/esm/utils/useBaseUiId.js +7 -0
- package/dist/node_modules/@base-ui/react/esm/utils/useFocusableWhenDisabled.js +24 -0
- package/dist/node_modules/@base-ui/react/esm/utils/useOpenChangeComplete.js +22 -0
- package/dist/node_modules/@base-ui/react/esm/utils/useOpenInteractionType.js +30 -0
- package/dist/node_modules/@base-ui/react/esm/utils/useRenderElement.js +71 -0
- package/dist/node_modules/@base-ui/react/esm/utils/useTransitionStatus.js +42 -0
- package/dist/node_modules/@base-ui/react/esm/utils/useValueChanged.js +14 -0
- package/dist/node_modules/@base-ui/utils/esm/detectBrowser.js +43 -0
- package/dist/node_modules/@base-ui/utils/esm/empty.js +7 -0
- package/dist/node_modules/@base-ui/utils/esm/error.js +11 -0
- package/dist/node_modules/@base-ui/utils/esm/formatErrorMessage.js +11 -0
- package/dist/node_modules/@base-ui/utils/esm/getReactElementRef.js +11 -0
- package/dist/node_modules/@base-ui/utils/esm/inertValue.js +7 -0
- package/dist/node_modules/@base-ui/utils/esm/mergeObjects.js +14 -0
- package/dist/node_modules/@base-ui/utils/esm/owner.js +6 -0
- package/dist/node_modules/@base-ui/utils/esm/reactVersion.js +8 -0
- package/dist/node_modules/@base-ui/utils/esm/safeReact.js +7 -0
- package/dist/node_modules/@base-ui/utils/esm/store/ReactStore.js +145 -0
- package/dist/node_modules/@base-ui/utils/esm/store/Store.js +86 -0
- package/dist/node_modules/@base-ui/utils/esm/store/createSelector.js +25 -0
- package/dist/node_modules/@base-ui/utils/esm/store/useStore.js +21 -0
- package/dist/node_modules/@base-ui/utils/esm/useAnimationFrame.js +68 -0
- package/dist/node_modules/@base-ui/utils/esm/useEnhancedClickHandler.js +19 -0
- package/dist/node_modules/@base-ui/utils/esm/useId.js +20 -0
- package/dist/node_modules/@base-ui/utils/esm/useIsoLayoutEffect.js +6 -0
- package/dist/node_modules/@base-ui/utils/esm/useMergedRefs.js +69 -0
- package/dist/node_modules/@base-ui/utils/esm/useOnFirstRender.js +8 -0
- package/dist/node_modules/@base-ui/utils/esm/useOnMount.js +8 -0
- package/dist/node_modules/@base-ui/utils/esm/useRefWithInit.js +9 -0
- package/dist/node_modules/@base-ui/utils/esm/useScrollLock.js +122 -0
- package/dist/node_modules/@base-ui/utils/esm/useStableCallback.js +32 -0
- package/dist/node_modules/@base-ui/utils/esm/useTimeout.js +32 -0
- package/dist/node_modules/@base-ui/utils/esm/useValueAsRef.js +19 -0
- package/dist/node_modules/@base-ui/utils/esm/visuallyHidden.js +18 -0
- package/dist/node_modules/@base-ui/utils/esm/warn.js +11 -0
- package/dist/node_modules/@floating-ui/core/dist/floating-ui.core.js +494 -0
- package/dist/node_modules/@floating-ui/dom/dist/floating-ui.dom.js +402 -0
- package/dist/node_modules/@floating-ui/react-dom/dist/floating-ui.react-dom.js +203 -0
- package/dist/node_modules/@floating-ui/utils/dist/floating-ui.utils.dom.js +136 -0
- package/dist/node_modules/@floating-ui/utils/dist/floating-ui.utils.js +128 -0
- package/dist/node_modules/reselect/dist/reselect.js +324 -0
- package/dist/node_modules/tabbable/dist/index.esm.js +210 -0
- package/dist/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim/with-selector.development.js +58 -0
- package/dist/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim/with-selector.production.js +57 -0
- package/dist/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim.development.js +58 -0
- package/dist/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim.production.js +46 -0
- package/dist/node_modules/use-sync-external-store/shim/index.js +10 -0
- package/dist/node_modules/use-sync-external-store/shim/with-selector.js +10 -0
- package/dist/package.json +2 -1
- package/package.json +2 -1
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import b from "../../../utils/esm/formatErrorMessage.js";
|
|
2
|
+
import * as c from "react";
|
|
3
|
+
import { createElement as p } from "react";
|
|
4
|
+
import { useMergedRefs as y, useMergedRefsN as g } from "../../../utils/esm/useMergedRefs.js";
|
|
5
|
+
import { getReactElementRef as h } from "../../../utils/esm/getReactElementRef.js";
|
|
6
|
+
import { mergeObjects as E } from "../../../utils/esm/mergeObjects.js";
|
|
7
|
+
import { warn as P } from "../../../utils/esm/warn.js";
|
|
8
|
+
import { getStateAttributesProps as w } from "./getStateAttributesProps.js";
|
|
9
|
+
import { resolveClassName as v } from "./resolveClassName.js";
|
|
10
|
+
import { resolveStyle as C } from "./resolveStyle.js";
|
|
11
|
+
import { EMPTY_OBJECT as a } from "../../../utils/esm/empty.js";
|
|
12
|
+
import { mergePropsN as A, mergeClassNames as k, mergeProps as T } from "../merge-props/mergeProps.js";
|
|
13
|
+
function J(r, e, t = {}) {
|
|
14
|
+
const l = e.render, s = _(e, t);
|
|
15
|
+
if (t.enabled === !1)
|
|
16
|
+
return null;
|
|
17
|
+
const n = t.state ?? a;
|
|
18
|
+
return M(r, l, s, n);
|
|
19
|
+
}
|
|
20
|
+
function _(r, e = {}) {
|
|
21
|
+
const {
|
|
22
|
+
className: t,
|
|
23
|
+
style: l,
|
|
24
|
+
render: s
|
|
25
|
+
} = r, {
|
|
26
|
+
state: n = a,
|
|
27
|
+
ref: f,
|
|
28
|
+
props: m,
|
|
29
|
+
stateAttributesMapping: N,
|
|
30
|
+
enabled: i = !0
|
|
31
|
+
} = e, d = i ? v(t, n) : void 0, u = i ? C(l, n) : void 0, R = i ? w(n, N) : a, o = i ? E(R, Array.isArray(m) ? A(m) : m) ?? a : a;
|
|
32
|
+
return typeof document < "u" && (i ? Array.isArray(f) ? o.ref = g([o.ref, h(s), ...f]) : o.ref = y(o.ref, h(s), f) : y(null, null)), i ? (d !== void 0 && (o.className = k(o.className, d)), u !== void 0 && (o.style = E(o.style, u)), o) : a;
|
|
33
|
+
}
|
|
34
|
+
const I = /* @__PURE__ */ Symbol.for("react.lazy");
|
|
35
|
+
function M(r, e, t, l) {
|
|
36
|
+
if (e) {
|
|
37
|
+
if (typeof e == "function")
|
|
38
|
+
return process.env.NODE_ENV !== "production" && O(e), e(t, l);
|
|
39
|
+
const s = T(t, e.props);
|
|
40
|
+
s.ref = t.ref;
|
|
41
|
+
let n = e;
|
|
42
|
+
if (n?.$$typeof === I && (n = c.Children.toArray(e)[0]), process.env.NODE_ENV !== "production" && !/* @__PURE__ */ c.isValidElement(n))
|
|
43
|
+
throw new Error(["Base UI: The `render` prop was provided an invalid React element as `React.isValidElement(render)` is `false`.", "A valid React element must be provided to the `render` prop because it is cloned with props to replace the default element.", "https://base-ui.com/r/invalid-render-prop"].join(`
|
|
44
|
+
`));
|
|
45
|
+
return /* @__PURE__ */ c.cloneElement(n, s);
|
|
46
|
+
}
|
|
47
|
+
if (r && typeof r == "string")
|
|
48
|
+
return V(r, t);
|
|
49
|
+
throw new Error(process.env.NODE_ENV !== "production" ? "Base UI: Render element or function are not defined." : b(8));
|
|
50
|
+
}
|
|
51
|
+
function O(r) {
|
|
52
|
+
const e = r.name;
|
|
53
|
+
if (e.length === 0)
|
|
54
|
+
return;
|
|
55
|
+
const t = e.charCodeAt(0);
|
|
56
|
+
t < 65 || t > 90 || P(`The \`render\` prop received a function named \`${e}\` that starts with an uppercase letter.`, "This usually means a React component was passed directly as `render={Component}`.", "Base UI calls `render` as a plain function, which can break the Rules of Hooks during reconciliation.", "If this is an intentional render callback, rename it to start with a lowercase letter.", "Use `render={<Component />}` or `render={(props) => <Component {...props} />}` instead.", "https://base-ui.com/r/invalid-render-prop");
|
|
57
|
+
}
|
|
58
|
+
function V(r, e) {
|
|
59
|
+
return r === "button" ? /* @__PURE__ */ p("button", {
|
|
60
|
+
type: "button",
|
|
61
|
+
...e,
|
|
62
|
+
key: e.key
|
|
63
|
+
}) : r === "img" ? /* @__PURE__ */ p("img", {
|
|
64
|
+
alt: "",
|
|
65
|
+
...e,
|
|
66
|
+
key: e.key
|
|
67
|
+
}) : /* @__PURE__ */ c.createElement(r, e);
|
|
68
|
+
}
|
|
69
|
+
export {
|
|
70
|
+
J as useRenderElement
|
|
71
|
+
};
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import * as c from "react";
|
|
2
|
+
import { useIsoLayoutEffect as d } from "../../../utils/esm/useIsoLayoutEffect.js";
|
|
3
|
+
import { AnimationFrame as u } from "../../../utils/esm/useAnimationFrame.js";
|
|
4
|
+
function g(t, s = !1, f = !1) {
|
|
5
|
+
const [n, r] = c.useState(t && s ? "idle" : void 0), [i, a] = c.useState(t);
|
|
6
|
+
return t && !i && (a(!0), r("starting")), !t && i && n !== "ending" && !f && r("ending"), !t && !i && n === "ending" && r(void 0), d(() => {
|
|
7
|
+
if (!t && i && n !== "ending" && f) {
|
|
8
|
+
const e = u.request(() => {
|
|
9
|
+
r("ending");
|
|
10
|
+
});
|
|
11
|
+
return () => {
|
|
12
|
+
u.cancel(e);
|
|
13
|
+
};
|
|
14
|
+
}
|
|
15
|
+
}, [t, i, n, f]), d(() => {
|
|
16
|
+
if (!t || s)
|
|
17
|
+
return;
|
|
18
|
+
const e = u.request(() => {
|
|
19
|
+
r(void 0);
|
|
20
|
+
});
|
|
21
|
+
return () => {
|
|
22
|
+
u.cancel(e);
|
|
23
|
+
};
|
|
24
|
+
}, [s, t]), d(() => {
|
|
25
|
+
if (!t || !s)
|
|
26
|
+
return;
|
|
27
|
+
t && i && n !== "idle" && r("starting");
|
|
28
|
+
const e = u.request(() => {
|
|
29
|
+
r("idle");
|
|
30
|
+
});
|
|
31
|
+
return () => {
|
|
32
|
+
u.cancel(e);
|
|
33
|
+
};
|
|
34
|
+
}, [s, t, i, r, n]), c.useMemo(() => ({
|
|
35
|
+
mounted: i,
|
|
36
|
+
setMounted: a,
|
|
37
|
+
transitionStatus: n
|
|
38
|
+
}), [i, n]);
|
|
39
|
+
}
|
|
40
|
+
export {
|
|
41
|
+
g as useTransitionStatus
|
|
42
|
+
};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import * as c from "react";
|
|
2
|
+
import { useIsoLayoutEffect as o } from "../../../utils/esm/useIsoLayoutEffect.js";
|
|
3
|
+
import { useStableCallback as f } from "../../../utils/esm/useStableCallback.js";
|
|
4
|
+
function u(r, n) {
|
|
5
|
+
const t = c.useRef(r), e = f(n);
|
|
6
|
+
o(() => {
|
|
7
|
+
t.current !== r && e(t.current);
|
|
8
|
+
}, [r, e]), o(() => {
|
|
9
|
+
t.current = r;
|
|
10
|
+
}, [r]);
|
|
11
|
+
}
|
|
12
|
+
export {
|
|
13
|
+
u as useValueChanged
|
|
14
|
+
};
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
const a = typeof navigator < "u", o = s(), r = f(), n = u(), c = typeof CSS > "u" || !CSS.supports ? !1 : CSS.supports("-webkit-backdrop-filter:none"), m = (
|
|
2
|
+
// iPads can claim to be MacIntel
|
|
3
|
+
o.platform === "MacIntel" && o.maxTouchPoints > 1 ? !0 : /iP(hone|ad|od)|iOS/.test(o.platform)
|
|
4
|
+
), p = a && /apple/i.test(navigator.vendor), g = a && /android/i.test(r) || /android/i.test(n);
|
|
5
|
+
a && r.toLowerCase().startsWith("mac") && navigator.maxTouchPoints;
|
|
6
|
+
const d = n.includes("jsdom/");
|
|
7
|
+
function s() {
|
|
8
|
+
if (!a)
|
|
9
|
+
return {
|
|
10
|
+
platform: "",
|
|
11
|
+
maxTouchPoints: -1
|
|
12
|
+
};
|
|
13
|
+
const t = navigator.userAgentData;
|
|
14
|
+
return t?.platform ? {
|
|
15
|
+
platform: t.platform,
|
|
16
|
+
maxTouchPoints: navigator.maxTouchPoints
|
|
17
|
+
} : {
|
|
18
|
+
platform: navigator.platform ?? "",
|
|
19
|
+
maxTouchPoints: navigator.maxTouchPoints ?? -1
|
|
20
|
+
};
|
|
21
|
+
}
|
|
22
|
+
function u() {
|
|
23
|
+
if (!a)
|
|
24
|
+
return "";
|
|
25
|
+
const t = navigator.userAgentData;
|
|
26
|
+
return t && Array.isArray(t.brands) ? t.brands.map(({
|
|
27
|
+
brand: i,
|
|
28
|
+
version: e
|
|
29
|
+
}) => `${i}/${e}`).join(" ") : navigator.userAgent;
|
|
30
|
+
}
|
|
31
|
+
function f() {
|
|
32
|
+
if (!a)
|
|
33
|
+
return "";
|
|
34
|
+
const t = navigator.userAgentData;
|
|
35
|
+
return t?.platform ? t.platform : navigator.platform ?? "";
|
|
36
|
+
}
|
|
37
|
+
export {
|
|
38
|
+
g as isAndroid,
|
|
39
|
+
m as isIOS,
|
|
40
|
+
d as isJSDOM,
|
|
41
|
+
p as isSafari,
|
|
42
|
+
c as isWebKit
|
|
43
|
+
};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
let o;
|
|
2
|
+
process.env.NODE_ENV !== "production" && (o = /* @__PURE__ */ new Set());
|
|
3
|
+
function s(...r) {
|
|
4
|
+
if (process.env.NODE_ENV !== "production") {
|
|
5
|
+
const e = r.join(" ");
|
|
6
|
+
o.has(e) || (o.add(e), console.error(`Base UI: ${e}`));
|
|
7
|
+
}
|
|
8
|
+
}
|
|
9
|
+
export {
|
|
10
|
+
s as error
|
|
11
|
+
};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
function n(a, s) {
|
|
2
|
+
return function(e, ...t) {
|
|
3
|
+
const r = new URL(a);
|
|
4
|
+
return r.searchParams.set("code", e.toString()), t.forEach((o) => r.searchParams.append("args[]", o)), `${s} error #${e}; visit ${r} for the full message.`;
|
|
5
|
+
};
|
|
6
|
+
}
|
|
7
|
+
const u = n("https://base-ui.com/production-error", "Base UI");
|
|
8
|
+
export {
|
|
9
|
+
n as createFormatErrorMessage,
|
|
10
|
+
u as default
|
|
11
|
+
};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import * as n from "react";
|
|
2
|
+
import { isReactVersionAtLeast as o } from "./reactVersion.js";
|
|
3
|
+
function s(t) {
|
|
4
|
+
if (!/* @__PURE__ */ n.isValidElement(t))
|
|
5
|
+
return null;
|
|
6
|
+
const e = t, r = e.props;
|
|
7
|
+
return (o(19) ? r?.ref : e.ref) ?? null;
|
|
8
|
+
}
|
|
9
|
+
export {
|
|
10
|
+
s as getReactElementRef
|
|
11
|
+
};
|
|
@@ -0,0 +1,145 @@
|
|
|
1
|
+
import * as u from "react";
|
|
2
|
+
import { Store as l } from "./Store.js";
|
|
3
|
+
import { useStore as a } from "./useStore.js";
|
|
4
|
+
import { useStableCallback as f } from "../useStableCallback.js";
|
|
5
|
+
import { useIsoLayoutEffect as c } from "../useIsoLayoutEffect.js";
|
|
6
|
+
import { NOOP as h } from "../empty.js";
|
|
7
|
+
class g extends l {
|
|
8
|
+
/**
|
|
9
|
+
* Creates a new ReactStore instance.
|
|
10
|
+
*
|
|
11
|
+
* @param state Initial state of the store.
|
|
12
|
+
* @param context Non-reactive context values.
|
|
13
|
+
* @param selectors Optional selectors for use with `useState`.
|
|
14
|
+
*/
|
|
15
|
+
constructor(e, t = {}, s) {
|
|
16
|
+
super(e), this.context = t, this.selectors = s;
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Non-reactive values such as refs, callbacks, etc.
|
|
20
|
+
*/
|
|
21
|
+
/**
|
|
22
|
+
* Synchronizes a single external value into the store.
|
|
23
|
+
*
|
|
24
|
+
* Note that the while the value in `state` is updated immediately, the value returned
|
|
25
|
+
* by `useState` is updated before the next render (similarly to React's `useState`).
|
|
26
|
+
*/
|
|
27
|
+
useSyncedValue(e, t) {
|
|
28
|
+
u.useDebugValue(e), c(() => {
|
|
29
|
+
this.state[e] !== t && this.set(e, t);
|
|
30
|
+
}, [e, t]);
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* Synchronizes a single external value into the store and
|
|
34
|
+
* cleans it up (sets to `undefined`) on unmount.
|
|
35
|
+
*
|
|
36
|
+
* Note that the while the value in `state` is updated immediately, the value returned
|
|
37
|
+
* by `useState` is updated before the next render (similarly to React's `useState`).
|
|
38
|
+
*/
|
|
39
|
+
useSyncedValueWithCleanup(e, t) {
|
|
40
|
+
const s = this;
|
|
41
|
+
c(() => (s.state[e] !== t && s.set(e, t), () => {
|
|
42
|
+
s.set(e, void 0);
|
|
43
|
+
}), [s, e, t]);
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* Synchronizes multiple external values into the store.
|
|
47
|
+
*
|
|
48
|
+
* Note that the while the values in `state` are updated immediately, the values returned
|
|
49
|
+
* by `useState` are updated before the next render (similarly to React's `useState`).
|
|
50
|
+
*/
|
|
51
|
+
useSyncedValues(e) {
|
|
52
|
+
const t = this;
|
|
53
|
+
if (process.env.NODE_ENV !== "production") {
|
|
54
|
+
u.useDebugValue(e, (r) => Object.keys(r));
|
|
55
|
+
const o = u.useRef(Object.keys(e)).current, n = Object.keys(e);
|
|
56
|
+
(o.length !== n.length || o.some((r, i) => r !== n[i])) && console.error("ReactStore.useSyncedValues expects the same prop keys on every render. Keys should be stable.");
|
|
57
|
+
}
|
|
58
|
+
const s = Object.values(e);
|
|
59
|
+
c(() => {
|
|
60
|
+
t.update(e);
|
|
61
|
+
}, [t, ...s]);
|
|
62
|
+
}
|
|
63
|
+
/**
|
|
64
|
+
* Registers a controllable prop pair (`controlled`, `defaultValue`) for a specific key. If `controlled`
|
|
65
|
+
* is non-undefined, the store's state at `key` is updated to match `controlled`.
|
|
66
|
+
*/
|
|
67
|
+
useControlledProp(e, t) {
|
|
68
|
+
u.useDebugValue(e);
|
|
69
|
+
const s = t !== void 0;
|
|
70
|
+
if (c(() => {
|
|
71
|
+
s && !Object.is(this.state[e], t) && super.setState({
|
|
72
|
+
...this.state,
|
|
73
|
+
[e]: t
|
|
74
|
+
});
|
|
75
|
+
}, [e, t, s]), process.env.NODE_ENV !== "production") {
|
|
76
|
+
const o = this.controlledValues ??= /* @__PURE__ */ new Map();
|
|
77
|
+
o.has(e) || o.set(e, s);
|
|
78
|
+
const n = o.get(e);
|
|
79
|
+
n !== void 0 && n !== s && console.error(`A component is changing the ${s ? "" : "un"}controlled state of ${e.toString()} to be ${s ? "un" : ""}controlled. Elements should not switch from uncontrolled to controlled (or vice versa).`);
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
/** Gets the current value from the store using a selector with the provided key.
|
|
83
|
+
*
|
|
84
|
+
* @param key Key of the selector to use.
|
|
85
|
+
*/
|
|
86
|
+
select(e, t, s, o) {
|
|
87
|
+
const n = this.selectors[e];
|
|
88
|
+
return n(this.state, t, s, o);
|
|
89
|
+
}
|
|
90
|
+
/**
|
|
91
|
+
* Returns a value from the store's state using a selector function.
|
|
92
|
+
* Used to subscribe to specific parts of the state.
|
|
93
|
+
* This methods causes a rerender whenever the selected state changes.
|
|
94
|
+
*
|
|
95
|
+
* @param key Key of the selector to use.
|
|
96
|
+
*/
|
|
97
|
+
useState(e, t, s, o) {
|
|
98
|
+
return u.useDebugValue(e), a(this, this.selectors[e], t, s, o);
|
|
99
|
+
}
|
|
100
|
+
/**
|
|
101
|
+
* Wraps a function with `useStableCallback` to ensure it has a stable reference
|
|
102
|
+
* and assigns it to the context.
|
|
103
|
+
*
|
|
104
|
+
* @param key Key of the event callback. Must be a function in the context.
|
|
105
|
+
* @param fn Function to assign.
|
|
106
|
+
*/
|
|
107
|
+
useContextCallback(e, t) {
|
|
108
|
+
u.useDebugValue(e);
|
|
109
|
+
const s = f(t ?? h);
|
|
110
|
+
this.context[e] = s;
|
|
111
|
+
}
|
|
112
|
+
/**
|
|
113
|
+
* Returns a stable setter function for a specific key in the store's state.
|
|
114
|
+
* It's commonly used to pass as a ref callback to React elements.
|
|
115
|
+
*
|
|
116
|
+
* @param key Key of the state to set.
|
|
117
|
+
*/
|
|
118
|
+
useStateSetter(e) {
|
|
119
|
+
const t = u.useRef(void 0);
|
|
120
|
+
return t.current === void 0 && (t.current = (s) => {
|
|
121
|
+
this.set(e, s);
|
|
122
|
+
}), t.current;
|
|
123
|
+
}
|
|
124
|
+
/**
|
|
125
|
+
* Observes changes derived from the store's selectors and calls the listener when the selected value changes.
|
|
126
|
+
*
|
|
127
|
+
* @param key Key of the selector to observe.
|
|
128
|
+
* @param listener Listener function called when the selector result changes.
|
|
129
|
+
*/
|
|
130
|
+
observe(e, t) {
|
|
131
|
+
let s;
|
|
132
|
+
typeof e == "function" ? s = e : s = this.selectors[e];
|
|
133
|
+
let o = s(this.state);
|
|
134
|
+
return t(o, o, this), this.subscribe((n) => {
|
|
135
|
+
const r = s(n);
|
|
136
|
+
if (!Object.is(o, r)) {
|
|
137
|
+
const i = o;
|
|
138
|
+
o = r, t(r, i, this);
|
|
139
|
+
}
|
|
140
|
+
});
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
export {
|
|
144
|
+
g as ReactStore
|
|
145
|
+
};
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
import { useStore as r } from "./useStore.js";
|
|
2
|
+
class n {
|
|
3
|
+
/**
|
|
4
|
+
* The current state of the store.
|
|
5
|
+
* This property is updated immediately when the state changes as a result of calling {@link setState}, {@link update}, or {@link set}.
|
|
6
|
+
* To subscribe to state changes, use the {@link useState} method. The value returned by {@link useState} is updated after the component renders (similarly to React's useState).
|
|
7
|
+
* The values can be used directly (to avoid subscribing to the store) in effects or event handlers.
|
|
8
|
+
*
|
|
9
|
+
* Do not modify properties in state directly. Instead, use the provided methods to ensure proper state management and listener notification.
|
|
10
|
+
*/
|
|
11
|
+
// Internal state to handle recursive `setState()` calls
|
|
12
|
+
constructor(t) {
|
|
13
|
+
this.state = t, this.listeners = /* @__PURE__ */ new Set(), this.updateTick = 0;
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* Registers a listener that will be called whenever the store's state changes.
|
|
17
|
+
*
|
|
18
|
+
* @param fn The listener function to be called on state changes.
|
|
19
|
+
* @returns A function to unsubscribe the listener.
|
|
20
|
+
*/
|
|
21
|
+
subscribe = (t) => (this.listeners.add(t), () => {
|
|
22
|
+
this.listeners.delete(t);
|
|
23
|
+
});
|
|
24
|
+
/**
|
|
25
|
+
* Returns the current state of the store.
|
|
26
|
+
*/
|
|
27
|
+
getSnapshot = () => this.state;
|
|
28
|
+
/**
|
|
29
|
+
* Updates the entire store's state and notifies all registered listeners.
|
|
30
|
+
*
|
|
31
|
+
* @param newState The new state to set for the store.
|
|
32
|
+
*/
|
|
33
|
+
setState(t) {
|
|
34
|
+
if (this.state === t)
|
|
35
|
+
return;
|
|
36
|
+
this.state = t, this.updateTick += 1;
|
|
37
|
+
const s = this.updateTick;
|
|
38
|
+
for (const e of this.listeners) {
|
|
39
|
+
if (s !== this.updateTick)
|
|
40
|
+
return;
|
|
41
|
+
e(t);
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* Merges the provided changes into the current state and notifies listeners if there are changes.
|
|
46
|
+
*
|
|
47
|
+
* @param changes An object containing the changes to apply to the current state.
|
|
48
|
+
*/
|
|
49
|
+
update(t) {
|
|
50
|
+
for (const s in t)
|
|
51
|
+
if (!Object.is(this.state[s], t[s])) {
|
|
52
|
+
this.setState({
|
|
53
|
+
...this.state,
|
|
54
|
+
...t
|
|
55
|
+
});
|
|
56
|
+
return;
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
/**
|
|
60
|
+
* Sets a specific key in the store's state to a new value and notifies listeners if the value has changed.
|
|
61
|
+
*
|
|
62
|
+
* @param key The key in the store's state to update.
|
|
63
|
+
* @param value The new value to set for the specified key.
|
|
64
|
+
*/
|
|
65
|
+
set(t, s) {
|
|
66
|
+
Object.is(this.state[t], s) || this.setState({
|
|
67
|
+
...this.state,
|
|
68
|
+
[t]: s
|
|
69
|
+
});
|
|
70
|
+
}
|
|
71
|
+
/**
|
|
72
|
+
* Gives the state a new reference and updates all registered listeners.
|
|
73
|
+
*/
|
|
74
|
+
notifyAll() {
|
|
75
|
+
const t = {
|
|
76
|
+
...this.state
|
|
77
|
+
};
|
|
78
|
+
this.setState(t);
|
|
79
|
+
}
|
|
80
|
+
use(t, s, e, i) {
|
|
81
|
+
return r(this, t, s, e, i);
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
export {
|
|
85
|
+
n as Store
|
|
86
|
+
};
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import t from "../formatErrorMessage.js";
|
|
2
|
+
import { createSelectorCreator as s, lruMemoize as i } from "../../../../reselect/dist/reselect.js";
|
|
3
|
+
s({
|
|
4
|
+
memoize: i,
|
|
5
|
+
memoizeOptions: {
|
|
6
|
+
maxSize: 1,
|
|
7
|
+
equalityCheck: Object.is
|
|
8
|
+
}
|
|
9
|
+
});
|
|
10
|
+
const u = (e, m, c, n, l, p, ...o) => {
|
|
11
|
+
if (o.length > 0)
|
|
12
|
+
throw new Error(process.env.NODE_ENV !== "production" ? "Unsupported number of selectors" : t(1));
|
|
13
|
+
let r;
|
|
14
|
+
if (e)
|
|
15
|
+
r = e;
|
|
16
|
+
else
|
|
17
|
+
throw (
|
|
18
|
+
/* minify-error-disabled */
|
|
19
|
+
new Error("Missing arguments")
|
|
20
|
+
);
|
|
21
|
+
return r;
|
|
22
|
+
};
|
|
23
|
+
export {
|
|
24
|
+
u as createSelector
|
|
25
|
+
};
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import * as c from "react";
|
|
2
|
+
import { s as u } from "../../../../../_virtual/index.js";
|
|
3
|
+
import { w as i } from "../../../../../_virtual/with-selector.js";
|
|
4
|
+
import { isReactVersionAtLeast as S } from "../reactVersion.js";
|
|
5
|
+
const a = S(19), m = a ? f : l;
|
|
6
|
+
function g(t, e, r, n, o) {
|
|
7
|
+
return m(t, e, r, n, o);
|
|
8
|
+
}
|
|
9
|
+
function p(t, e, r, n, o) {
|
|
10
|
+
const s = c.useCallback(() => e(t.getSnapshot(), r, n, o), [t, e, r, n, o]);
|
|
11
|
+
return u.useSyncExternalStore(t.subscribe, s, s);
|
|
12
|
+
}
|
|
13
|
+
function f(t, e, r, n, o) {
|
|
14
|
+
return p(t, e, r, n, o);
|
|
15
|
+
}
|
|
16
|
+
function l(t, e, r, n, o) {
|
|
17
|
+
return i.useSyncExternalStoreWithSelector(t.subscribe, t.getSnapshot, t.getSnapshot, (s) => e(s, r, n, o));
|
|
18
|
+
}
|
|
19
|
+
export {
|
|
20
|
+
g as useStore
|
|
21
|
+
};
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import { useRefWithInit as u } from "./useRefWithInit.js";
|
|
2
|
+
import { useOnMount as h } from "./useOnMount.js";
|
|
3
|
+
const s = null;
|
|
4
|
+
let l = globalThis.requestAnimationFrame;
|
|
5
|
+
class o {
|
|
6
|
+
/* This implementation uses an array as a backing data-structure for frame callbacks.
|
|
7
|
+
* It allows `O(1)` callback cancelling by inserting a `null` in the array, though it
|
|
8
|
+
* never calls the native `cancelAnimationFrame` if there are no frames left. This can
|
|
9
|
+
* be much more efficient if there is a call pattern that alterns as
|
|
10
|
+
* "request-cancel-request-cancel-…".
|
|
11
|
+
* But in the case of "request-request-…-cancel-cancel-…", it leaves the final animation
|
|
12
|
+
* frame to run anyway. We turn that frame into a `O(1)` no-op via `callbacksCount`. */
|
|
13
|
+
callbacks = [];
|
|
14
|
+
callbacksCount = 0;
|
|
15
|
+
nextId = 1;
|
|
16
|
+
startId = 1;
|
|
17
|
+
isScheduled = !1;
|
|
18
|
+
tick = (t) => {
|
|
19
|
+
this.isScheduled = !1;
|
|
20
|
+
const e = this.callbacks, r = this.callbacksCount;
|
|
21
|
+
if (this.callbacks = [], this.callbacksCount = 0, this.startId = this.nextId, r > 0)
|
|
22
|
+
for (let i = 0; i < e.length; i += 1)
|
|
23
|
+
e[i]?.(t);
|
|
24
|
+
};
|
|
25
|
+
request(t) {
|
|
26
|
+
const e = this.nextId;
|
|
27
|
+
this.nextId += 1, this.callbacks.push(t), this.callbacksCount += 1;
|
|
28
|
+
const r = process.env.NODE_ENV !== "production" && l !== requestAnimationFrame && (l = requestAnimationFrame, !0);
|
|
29
|
+
return (!this.isScheduled || r) && (requestAnimationFrame(this.tick), this.isScheduled = !0), e;
|
|
30
|
+
}
|
|
31
|
+
cancel(t) {
|
|
32
|
+
const e = t - this.startId;
|
|
33
|
+
e < 0 || e >= this.callbacks.length || (this.callbacks[e] = null, this.callbacksCount -= 1);
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
const c = new o();
|
|
37
|
+
class a {
|
|
38
|
+
static create() {
|
|
39
|
+
return new a();
|
|
40
|
+
}
|
|
41
|
+
static request(t) {
|
|
42
|
+
return c.request(t);
|
|
43
|
+
}
|
|
44
|
+
static cancel(t) {
|
|
45
|
+
return c.cancel(t);
|
|
46
|
+
}
|
|
47
|
+
currentId = s;
|
|
48
|
+
/**
|
|
49
|
+
* Executes `fn` after `delay`, clearing any previously scheduled call.
|
|
50
|
+
*/
|
|
51
|
+
request(t) {
|
|
52
|
+
this.cancel(), this.currentId = c.request(() => {
|
|
53
|
+
this.currentId = s, t();
|
|
54
|
+
});
|
|
55
|
+
}
|
|
56
|
+
cancel = () => {
|
|
57
|
+
this.currentId !== s && (c.cancel(this.currentId), this.currentId = s);
|
|
58
|
+
};
|
|
59
|
+
disposeEffect = () => this.cancel;
|
|
60
|
+
}
|
|
61
|
+
function k() {
|
|
62
|
+
const n = u(a.create).current;
|
|
63
|
+
return h(n.disposeEffect), n;
|
|
64
|
+
}
|
|
65
|
+
export {
|
|
66
|
+
a as AnimationFrame,
|
|
67
|
+
k as useAnimationFrame
|
|
68
|
+
};
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import * as e from "react";
|
|
2
|
+
function t(i) {
|
|
3
|
+
const o = e.useRef(""), n = e.useCallback((r) => {
|
|
4
|
+
r.defaultPrevented || (o.current = r.pointerType, i(r, r.pointerType));
|
|
5
|
+
}, [i]);
|
|
6
|
+
return {
|
|
7
|
+
onClick: e.useCallback((r) => {
|
|
8
|
+
if (r.detail === 0) {
|
|
9
|
+
i(r, "keyboard");
|
|
10
|
+
return;
|
|
11
|
+
}
|
|
12
|
+
"pointerType" in r ? i(r, r.pointerType) : i(r, o.current), o.current = "";
|
|
13
|
+
}, [i]),
|
|
14
|
+
onPointerDown: n
|
|
15
|
+
};
|
|
16
|
+
}
|
|
17
|
+
export {
|
|
18
|
+
t as useEnhancedClickHandler
|
|
19
|
+
};
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import * as n from "react";
|
|
2
|
+
import { SafeReact as f } from "./safeReact.js";
|
|
3
|
+
let o = 0;
|
|
4
|
+
function l(u, t = "mui") {
|
|
5
|
+
const [e, s] = n.useState(u), c = u || e;
|
|
6
|
+
return n.useEffect(() => {
|
|
7
|
+
e == null && (o += 1, s(`${t}-${o}`));
|
|
8
|
+
}, [e, t]), c;
|
|
9
|
+
}
|
|
10
|
+
const a = f.useId;
|
|
11
|
+
function I(u, t) {
|
|
12
|
+
if (a !== void 0) {
|
|
13
|
+
const e = a();
|
|
14
|
+
return u ?? (t ? `${t}-${e}` : e);
|
|
15
|
+
}
|
|
16
|
+
return l(u, t);
|
|
17
|
+
}
|
|
18
|
+
export {
|
|
19
|
+
I as useId
|
|
20
|
+
};
|