@overmap-ai/blocks 1.0.31-tailwind-components.21 → 1.0.31-tailwind-components.23
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/AlertDialog/typings.d.ts +2 -2
- package/dist/Avatar/Root.d.ts +2 -2
- package/dist/Avatar/context.d.ts +1 -1
- package/dist/Avatar/typings.d.ts +1 -1
- package/dist/Badge/Badge.d.ts +2 -2
- package/dist/Badge/typings.d.ts +1 -1
- package/dist/ButtonGroup/ButtonGroup.d.ts +2 -2
- package/dist/Buttons/Button.d.ts +2 -2
- package/dist/Buttons/IconButton.d.ts +2 -2
- package/dist/Card/Card.d.ts +2 -2
- package/dist/Card/typings.d.ts +1 -1
- package/dist/Checkbox/Root.d.ts +2 -2
- package/dist/Checkbox/typings.d.ts +1 -1
- package/dist/Dialog/Content.d.ts +2 -2
- package/dist/Dialog/Root.d.ts +1 -1
- package/dist/Dialog/context.d.ts +1 -1
- package/dist/Heading/Heading.d.ts +2 -2
- package/dist/Heading/constants.d.ts +1 -1
- package/dist/Heading/typings.d.ts +1 -1
- package/dist/HoverCard/Content.d.ts +2 -2
- package/dist/HoverCard/typings.d.ts +1 -1
- package/dist/Input/Root.d.ts +2 -2
- package/dist/Input/typings.d.ts +1 -1
- package/dist/Link/Link.d.ts +2 -2
- package/dist/Link/typings.d.ts +1 -1
- package/dist/Menu/ClickTrigger/ClickTrigger.d.ts +1 -1
- package/dist/Menu/Content/Content.d.ts +1 -1
- package/dist/Menu/Content/context.d.ts +2 -2
- package/dist/Menu/ContextTrigger/ContextTrigger.d.ts +1 -1
- package/dist/Menu/Group/Group.d.ts +1 -1
- package/dist/Menu/Input/Field.d.ts +1 -1
- package/dist/Menu/Input/Root.d.ts +1 -1
- package/dist/Menu/Input/Slot.d.ts +1 -1
- package/dist/Menu/Item/Item.d.ts +1 -1
- package/dist/Menu/MultiSelectGroup/MultiSelectGroup.d.ts +1 -1
- package/dist/Menu/PageContent/PageContent.d.ts +1 -1
- package/dist/Menu/PageTrigger/PageTrigger.d.ts +1 -1
- package/dist/Menu/Pages/Pages.d.ts +1 -1
- package/dist/Menu/SelectAll/SelectAllIndicator.d.ts +1 -1
- package/dist/Menu/SelectAll/SelectAllItem.d.ts +1 -1
- package/dist/Menu/SelectGroup/SelectGroup.d.ts +1 -1
- package/dist/Menu/SelectItem/SelectItem.d.ts +1 -1
- package/dist/Menu/Separator/Separator.d.ts +1 -1
- package/dist/Menu/Sub/Sub.d.ts +1 -1
- package/dist/Menu/Sub/context.d.ts +1 -1
- package/dist/Menu/SubContent/SubContent.d.ts +1 -1
- package/dist/Menu/SubTrigger/SubTrigger.d.ts +1 -1
- package/dist/Menu/VirtualTrigger/VirtualTrigger.d.ts +1 -1
- package/dist/Menu/root/Root.d.ts +1 -1
- package/dist/Menu/root/context.d.ts +1 -1
- package/dist/Popover/Content.d.ts +2 -2
- package/dist/Popover/typings.d.ts +1 -1
- package/dist/Provider/Provider.d.ts +1 -1
- package/dist/Provider/context.d.ts +1 -1
- package/dist/RadioGroup/Item.d.ts +1 -1
- package/dist/RadioGroup/Root.d.ts +2 -2
- package/dist/RadioGroup/context.d.ts +1 -1
- package/dist/RadioGroup/typings.d.ts +1 -1
- package/dist/SegmentedControl/Root.d.ts +2 -2
- package/dist/SegmentedControl/context.d.ts +1 -1
- package/dist/SegmentedControl/typings.d.ts +2 -2
- package/dist/Separator/Separator.d.ts +1 -1
- package/dist/Switch/Root.d.ts +2 -2
- package/dist/Switch/context.d.ts +1 -1
- package/dist/Switch/typings.d.ts +1 -1
- package/dist/Table/Root.d.ts +2 -2
- package/dist/Table/typings.d.ts +1 -1
- package/dist/Tabs/List.d.ts +2 -2
- package/dist/Tabs/context.d.ts +1 -1
- package/dist/Tabs/typings.d.ts +1 -1
- package/dist/Text/Text.d.ts +2 -2
- package/dist/Text/typings.d.ts +1 -1
- package/dist/TextArea/TextArea.d.ts +2 -2
- package/dist/TextArea/typings.d.ts +1 -1
- package/dist/Toast/Toast.d.ts +1 -1
- package/dist/Toast/ToastProvider.d.ts +1 -1
- package/dist/Toast/typings.d.ts +2 -2
- package/dist/ToggleButton/BaseToggleButton.d.ts +1 -1
- package/dist/ToggleButton/IconToggleButton.d.ts +1 -1
- package/dist/ToggleButton/ToggleButton.d.ts +1 -1
- package/dist/Tooltip/Content.d.ts +2 -2
- package/dist/Tooltip/typings.d.ts +1 -1
- package/dist/blocks.js +54 -405
- package/dist/blocks.js.map +1 -1
- package/dist/blocks.umd.cjs +54 -405
- package/dist/blocks.umd.cjs.map +1 -1
- package/package.json +2 -1
package/dist/blocks.umd.cjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
(function(global, factory) {
|
|
2
|
-
typeof exports === "object" && typeof module !== "undefined" ? factory(exports, require("@radix-ui/react-alert-dialog"), require("react/jsx-runtime"), require("class-variance-authority"), require("react"), require("@radix-ui/react-avatar"), require("@radix-ui/react-checkbox"), require("@radix-ui/react-collapsible"), require("react-responsive"), require("@radix-ui/react-dialog"), require("react-icons/hi"), require("@radix-ui/react-hover-card"), require("@radix-ui/react-slot"), require("re-resizable"), require("react-transition-group"), require("react-dom"), require("@radix-ui/react-separator"), require("react-error-boundary"), require("react-icons/ri"), require("@radix-ui/react-popover"), require("@radix-ui/react-radio-group"), require("@radix-ui/react-toggle"), require("@radix-ui/react-dismissable-layer"), require("@radix-ui/react-tabs"), require("@radix-ui/react-toast"), require("@radix-ui/react-tooltip")) : typeof define === "function" && define.amd ? define(["exports", "@radix-ui/react-alert-dialog", "react/jsx-runtime", "class-variance-authority", "react", "@radix-ui/react-avatar", "@radix-ui/react-checkbox", "@radix-ui/react-collapsible", "react-responsive", "@radix-ui/react-dialog", "react-icons/hi", "@radix-ui/react-hover-card", "@radix-ui/react-slot", "re-resizable", "react-transition-group", "react-dom", "@radix-ui/react-separator", "react-error-boundary", "react-icons/ri", "@radix-ui/react-popover", "@radix-ui/react-radio-group", "@radix-ui/react-toggle", "@radix-ui/react-dismissable-layer", "@radix-ui/react-tabs", "@radix-ui/react-toast", "@radix-ui/react-tooltip"], factory) : (global = typeof globalThis !== "undefined" ? globalThis : global || self, factory(global.blocks = {}, global.RadixAlertDialog, global.jsxRuntime, global.classVarianceAuthority, global.React, global.RadixAvatar, global.RadixCheckbox, global.RadixPrimitiveCollapsible, global.reactResponsive, global.RadixDialog, global.hi, global.RadixHoverCard, global.reactSlot, global.reResizable, global.reactTransitionGroup, global.ReactDOM, global.RadixSeparator, global.reactErrorBoundary, global.RiIcons, global.RadixPopover, global.RadixRadioGroup, global.Toggle, global.reactDismissableLayer, global.RadixTabs, global.RadixToast, global.RadixTooltip));
|
|
3
|
-
})(this, function(exports2, RadixAlertDialog, jsxRuntime, classVarianceAuthority, React, RadixAvatar, RadixCheckbox, RadixPrimitiveCollapsible, reactResponsive, RadixDialog, hi, RadixHoverCard, reactSlot, reResizable, reactTransitionGroup, ReactDOM, RadixSeparator, reactErrorBoundary, RiIcons, RadixPopover, RadixRadioGroup, Toggle, reactDismissableLayer, RadixTabs, RadixToast, RadixTooltip) {
|
|
2
|
+
typeof exports === "object" && typeof module !== "undefined" ? factory(exports, require("@radix-ui/react-alert-dialog"), require("react/jsx-runtime"), require("class-variance-authority"), require("react"), require("@radix-ui/react-avatar"), require("@radix-ui/react-checkbox"), require("@radix-ui/react-collapsible"), require("react-responsive"), require("@radix-ui/react-dialog"), require("react-icons/hi"), require("@radix-ui/react-hover-card"), require("@radix-ui/react-slot"), require("re-resizable"), require("react-transition-group"), require("react-dom"), require("@radix-ui/react-separator"), require("react-error-boundary"), require("react-icons/ri"), require("@radix-ui/react-popover"), require("@radix-ui/react-radio-group"), require("@radix-ui/react-toggle"), require("@radix-ui/react-dismissable-layer"), require("@radix-ui/react-switch"), require("@radix-ui/react-tabs"), require("@radix-ui/react-toast"), require("@radix-ui/react-tooltip")) : typeof define === "function" && define.amd ? define(["exports", "@radix-ui/react-alert-dialog", "react/jsx-runtime", "class-variance-authority", "react", "@radix-ui/react-avatar", "@radix-ui/react-checkbox", "@radix-ui/react-collapsible", "react-responsive", "@radix-ui/react-dialog", "react-icons/hi", "@radix-ui/react-hover-card", "@radix-ui/react-slot", "re-resizable", "react-transition-group", "react-dom", "@radix-ui/react-separator", "react-error-boundary", "react-icons/ri", "@radix-ui/react-popover", "@radix-ui/react-radio-group", "@radix-ui/react-toggle", "@radix-ui/react-dismissable-layer", "@radix-ui/react-switch", "@radix-ui/react-tabs", "@radix-ui/react-toast", "@radix-ui/react-tooltip"], factory) : (global = typeof globalThis !== "undefined" ? globalThis : global || self, factory(global.blocks = {}, global.RadixAlertDialog, global.jsxRuntime, global.classVarianceAuthority, global.React, global.RadixAvatar, global.RadixCheckbox, global.RadixPrimitiveCollapsible, global.reactResponsive, global.RadixDialog, global.hi, global.RadixHoverCard, global.reactSlot, global.reResizable, global.reactTransitionGroup, global.ReactDOM, global.RadixSeparator, global.reactErrorBoundary, global.RiIcons, global.RadixPopover, global.RadixRadioGroup, global.Toggle, global.reactDismissableLayer, global.RadixSwitch, global.RadixTabs, global.RadixToast, global.RadixTooltip));
|
|
3
|
+
})(this, function(exports2, RadixAlertDialog, jsxRuntime, classVarianceAuthority, React, RadixAvatar, RadixCheckbox, RadixPrimitiveCollapsible, reactResponsive, RadixDialog, hi, RadixHoverCard, reactSlot, reResizable, reactTransitionGroup, ReactDOM, RadixSeparator, reactErrorBoundary, RiIcons, RadixPopover, RadixRadioGroup, Toggle, reactDismissableLayer, RadixSwitch, RadixTabs, RadixToast, RadixTooltip) {
|
|
4
4
|
"use strict";
|
|
5
5
|
function _interopNamespaceDefault(e) {
|
|
6
6
|
const n = Object.create(null, { [Symbol.toStringTag]: { value: "Module" } });
|
|
@@ -31,6 +31,7 @@
|
|
|
31
31
|
const RadixPopover__namespace = /* @__PURE__ */ _interopNamespaceDefault(RadixPopover);
|
|
32
32
|
const RadixRadioGroup__namespace = /* @__PURE__ */ _interopNamespaceDefault(RadixRadioGroup);
|
|
33
33
|
const Toggle__namespace = /* @__PURE__ */ _interopNamespaceDefault(Toggle);
|
|
34
|
+
const RadixSwitch__namespace = /* @__PURE__ */ _interopNamespaceDefault(RadixSwitch);
|
|
34
35
|
const RadixTabs__namespace = /* @__PURE__ */ _interopNamespaceDefault(RadixTabs);
|
|
35
36
|
const RadixToast__namespace = /* @__PURE__ */ _interopNamespaceDefault(RadixToast);
|
|
36
37
|
const RadixTooltip__namespace = /* @__PURE__ */ _interopNamespaceDefault(RadixTooltip);
|
|
@@ -863,7 +864,7 @@
|
|
|
863
864
|
}, [filterFunction, filterValue, values]);
|
|
864
865
|
return [filteredOptions, filterValue, setFilterValue];
|
|
865
866
|
}
|
|
866
|
-
const useSize
|
|
867
|
+
const useSize = (target) => {
|
|
867
868
|
const [size2, setSize] = React.useState();
|
|
868
869
|
React.useLayoutEffect(() => {
|
|
869
870
|
var _a;
|
|
@@ -1334,7 +1335,7 @@
|
|
|
1334
1335
|
return !hideLayout && /* @__PURE__ */ jsxRuntime.jsx("div", { className: classVarianceAuthority.cx(className, "flex grow h-full"), ref, ...rest, children });
|
|
1335
1336
|
})
|
|
1336
1337
|
);
|
|
1337
|
-
const Root$
|
|
1338
|
+
const Root$1 = React.memo((props) => {
|
|
1338
1339
|
const { children, small = false, hideLayout = false } = props;
|
|
1339
1340
|
const [showLeftSlideOut, setShowLeftSlideOut] = React.useState(false);
|
|
1340
1341
|
const [showRightSlideOut, setShowRightSlideOut] = React.useState(false);
|
|
@@ -1351,9 +1352,9 @@
|
|
|
1351
1352
|
);
|
|
1352
1353
|
return /* @__PURE__ */ jsxRuntime.jsx(LayoutContext.Provider, { value: contextValue, children });
|
|
1353
1354
|
});
|
|
1354
|
-
Root$
|
|
1355
|
+
Root$1.displayName = "Layout.Root";
|
|
1355
1356
|
function usePointerDownOutside(onPointerDownOutside, ownerElement = globalThis == null ? void 0 : globalThis.document.body) {
|
|
1356
|
-
const handlePointerDownOutside = useCallbackRef$
|
|
1357
|
+
const handlePointerDownOutside = useCallbackRef$1(onPointerDownOutside);
|
|
1357
1358
|
const isPointerInsideReactTreeRef = React.useRef(false);
|
|
1358
1359
|
const handleClickRef = React.useRef(() => {
|
|
1359
1360
|
});
|
|
@@ -1405,7 +1406,7 @@
|
|
|
1405
1406
|
target.dispatchEvent(event);
|
|
1406
1407
|
}
|
|
1407
1408
|
}
|
|
1408
|
-
function useCallbackRef$
|
|
1409
|
+
function useCallbackRef$1(callback) {
|
|
1409
1410
|
const callbackRef = React.useRef(callback);
|
|
1410
1411
|
React.useEffect(() => {
|
|
1411
1412
|
callbackRef.current = callback;
|
|
@@ -1689,7 +1690,7 @@
|
|
|
1689
1690
|
})
|
|
1690
1691
|
);
|
|
1691
1692
|
const Layout = {
|
|
1692
|
-
Root: Root$
|
|
1693
|
+
Root: Root$1,
|
|
1693
1694
|
Container,
|
|
1694
1695
|
SlideOutOverlay,
|
|
1695
1696
|
LeftSlideOut,
|
|
@@ -7863,7 +7864,7 @@
|
|
|
7863
7864
|
Item: RadioGroupItem,
|
|
7864
7865
|
Root: RadioGroupRoot
|
|
7865
7866
|
};
|
|
7866
|
-
function createContextScope
|
|
7867
|
+
function createContextScope(scopeName, createContextScopeDeps = []) {
|
|
7867
7868
|
let defaultContexts = [];
|
|
7868
7869
|
function createContext3(rootComponentName, defaultContext) {
|
|
7869
7870
|
const BaseContext = React__namespace.createContext(defaultContext);
|
|
@@ -7900,9 +7901,9 @@
|
|
|
7900
7901
|
};
|
|
7901
7902
|
};
|
|
7902
7903
|
createScope.scopeName = scopeName;
|
|
7903
|
-
return [createContext3, composeContextScopes
|
|
7904
|
+
return [createContext3, composeContextScopes(createScope, ...createContextScopeDeps)];
|
|
7904
7905
|
}
|
|
7905
|
-
function composeContextScopes
|
|
7906
|
+
function composeContextScopes(...scopes) {
|
|
7906
7907
|
const baseScope = scopes[0];
|
|
7907
7908
|
if (scopes.length === 1) return baseScope;
|
|
7908
7909
|
const createScope = () => {
|
|
@@ -7922,7 +7923,7 @@
|
|
|
7922
7923
|
createScope.scopeName = baseScope.scopeName;
|
|
7923
7924
|
return createScope;
|
|
7924
7925
|
}
|
|
7925
|
-
var NODES
|
|
7926
|
+
var NODES = [
|
|
7926
7927
|
"a",
|
|
7927
7928
|
"button",
|
|
7928
7929
|
"div",
|
|
@@ -7940,7 +7941,7 @@
|
|
|
7940
7941
|
"svg",
|
|
7941
7942
|
"ul"
|
|
7942
7943
|
];
|
|
7943
|
-
var Primitive
|
|
7944
|
+
var Primitive = NODES.reduce((primitive, node) => {
|
|
7944
7945
|
const Node2 = React__namespace.forwardRef((props, forwardedRef) => {
|
|
7945
7946
|
const { asChild, ...primitiveProps } = props;
|
|
7946
7947
|
const Comp = asChild ? reactSlot.Slot : node;
|
|
@@ -7952,7 +7953,7 @@
|
|
|
7952
7953
|
Node2.displayName = `Primitive.${node}`;
|
|
7953
7954
|
return { ...primitive, [node]: Node2 };
|
|
7954
7955
|
}, {});
|
|
7955
|
-
function composeEventHandlers
|
|
7956
|
+
function composeEventHandlers(originalEventHandler, ourEventHandler, { checkForDefaultPrevented = true } = {}) {
|
|
7956
7957
|
return function handleEvent(event) {
|
|
7957
7958
|
originalEventHandler == null ? void 0 : originalEventHandler(event);
|
|
7958
7959
|
if (checkForDefaultPrevented === false || !event.defaultPrevented) {
|
|
@@ -7960,18 +7961,18 @@
|
|
|
7960
7961
|
}
|
|
7961
7962
|
};
|
|
7962
7963
|
}
|
|
7963
|
-
function setRef
|
|
7964
|
+
function setRef(ref, value) {
|
|
7964
7965
|
if (typeof ref === "function") {
|
|
7965
7966
|
return ref(value);
|
|
7966
7967
|
} else if (ref !== null && ref !== void 0) {
|
|
7967
7968
|
ref.current = value;
|
|
7968
7969
|
}
|
|
7969
7970
|
}
|
|
7970
|
-
function composeRefs
|
|
7971
|
+
function composeRefs(...refs) {
|
|
7971
7972
|
return (node) => {
|
|
7972
7973
|
let hasCleanup = false;
|
|
7973
7974
|
const cleanups = refs.map((ref) => {
|
|
7974
|
-
const cleanup = setRef
|
|
7975
|
+
const cleanup = setRef(ref, node);
|
|
7975
7976
|
if (!hasCleanup && typeof cleanup == "function") {
|
|
7976
7977
|
hasCleanup = true;
|
|
7977
7978
|
}
|
|
@@ -7984,19 +7985,19 @@
|
|
|
7984
7985
|
if (typeof cleanup == "function") {
|
|
7985
7986
|
cleanup();
|
|
7986
7987
|
} else {
|
|
7987
|
-
setRef
|
|
7988
|
+
setRef(refs[i], null);
|
|
7988
7989
|
}
|
|
7989
7990
|
}
|
|
7990
7991
|
};
|
|
7991
7992
|
}
|
|
7992
7993
|
};
|
|
7993
7994
|
}
|
|
7994
|
-
function useComposedRefs
|
|
7995
|
-
return React__namespace.useCallback(composeRefs
|
|
7995
|
+
function useComposedRefs(...refs) {
|
|
7996
|
+
return React__namespace.useCallback(composeRefs(...refs), refs);
|
|
7996
7997
|
}
|
|
7997
7998
|
function createCollection(name) {
|
|
7998
7999
|
const PROVIDER_NAME = name + "CollectionProvider";
|
|
7999
|
-
const [createCollectionContext, createCollectionScope2] = createContextScope
|
|
8000
|
+
const [createCollectionContext, createCollectionScope2] = createContextScope(PROVIDER_NAME);
|
|
8000
8001
|
const [CollectionProviderImpl, useCollectionContext] = createCollectionContext(
|
|
8001
8002
|
PROVIDER_NAME,
|
|
8002
8003
|
{ collectionRef: { current: null }, itemMap: /* @__PURE__ */ new Map() }
|
|
@@ -8013,7 +8014,7 @@
|
|
|
8013
8014
|
(props, forwardedRef) => {
|
|
8014
8015
|
const { scope, children } = props;
|
|
8015
8016
|
const context = useCollectionContext(COLLECTION_SLOT_NAME, scope);
|
|
8016
|
-
const composedRefs = useComposedRefs
|
|
8017
|
+
const composedRefs = useComposedRefs(forwardedRef, context.collectionRef);
|
|
8017
8018
|
return /* @__PURE__ */ jsxRuntime.jsx(reactSlot.Slot, { ref: composedRefs, children });
|
|
8018
8019
|
}
|
|
8019
8020
|
);
|
|
@@ -8024,7 +8025,7 @@
|
|
|
8024
8025
|
(props, forwardedRef) => {
|
|
8025
8026
|
const { scope, children, ...itemData } = props;
|
|
8026
8027
|
const ref = React.useRef(null);
|
|
8027
|
-
const composedRefs = useComposedRefs
|
|
8028
|
+
const composedRefs = useComposedRefs(forwardedRef, ref);
|
|
8028
8029
|
const context = useCollectionContext(ITEM_SLOT_NAME, scope);
|
|
8029
8030
|
React.useEffect(() => {
|
|
8030
8031
|
context.itemMap.set(ref, { ref, ...itemData });
|
|
@@ -8054,18 +8055,18 @@
|
|
|
8054
8055
|
createCollectionScope2
|
|
8055
8056
|
];
|
|
8056
8057
|
}
|
|
8057
|
-
var useLayoutEffect2
|
|
8058
|
+
var useLayoutEffect2 = Boolean(globalThis == null ? void 0 : globalThis.document) ? React__namespace.useLayoutEffect : () => {
|
|
8058
8059
|
};
|
|
8059
8060
|
var useReactId = React__namespace["useId".toString()] || (() => void 0);
|
|
8060
8061
|
var count = 0;
|
|
8061
8062
|
function useId(deterministicId) {
|
|
8062
8063
|
const [id, setId] = React__namespace.useState(useReactId());
|
|
8063
|
-
useLayoutEffect2
|
|
8064
|
+
useLayoutEffect2(() => {
|
|
8064
8065
|
setId((reactId) => reactId ?? String(count++));
|
|
8065
8066
|
}, [deterministicId]);
|
|
8066
8067
|
return id ? `radix-${id}` : "";
|
|
8067
8068
|
}
|
|
8068
|
-
function useCallbackRef
|
|
8069
|
+
function useCallbackRef(callback) {
|
|
8069
8070
|
const callbackRef = React__namespace.useRef(callback);
|
|
8070
8071
|
React__namespace.useEffect(() => {
|
|
8071
8072
|
callbackRef.current = callback;
|
|
@@ -8075,16 +8076,16 @@
|
|
|
8075
8076
|
return (_a = callbackRef.current) == null ? void 0 : _a.call(callbackRef, ...args);
|
|
8076
8077
|
}, []);
|
|
8077
8078
|
}
|
|
8078
|
-
function useControllableState
|
|
8079
|
+
function useControllableState({
|
|
8079
8080
|
prop,
|
|
8080
8081
|
defaultProp,
|
|
8081
8082
|
onChange = () => {
|
|
8082
8083
|
}
|
|
8083
8084
|
}) {
|
|
8084
|
-
const [uncontrolledProp, setUncontrolledProp] = useUncontrolledState
|
|
8085
|
+
const [uncontrolledProp, setUncontrolledProp] = useUncontrolledState({ defaultProp, onChange });
|
|
8085
8086
|
const isControlled = prop !== void 0;
|
|
8086
8087
|
const value = isControlled ? prop : uncontrolledProp;
|
|
8087
|
-
const handleChange = useCallbackRef
|
|
8088
|
+
const handleChange = useCallbackRef(onChange);
|
|
8088
8089
|
const setValue = React__namespace.useCallback(
|
|
8089
8090
|
(nextValue) => {
|
|
8090
8091
|
if (isControlled) {
|
|
@@ -8099,14 +8100,14 @@
|
|
|
8099
8100
|
);
|
|
8100
8101
|
return [value, setValue];
|
|
8101
8102
|
}
|
|
8102
|
-
function useUncontrolledState
|
|
8103
|
+
function useUncontrolledState({
|
|
8103
8104
|
defaultProp,
|
|
8104
8105
|
onChange
|
|
8105
8106
|
}) {
|
|
8106
8107
|
const uncontrolledState = React__namespace.useState(defaultProp);
|
|
8107
8108
|
const [value] = uncontrolledState;
|
|
8108
8109
|
const prevValueRef = React__namespace.useRef(value);
|
|
8109
|
-
const handleChange = useCallbackRef
|
|
8110
|
+
const handleChange = useCallbackRef(onChange);
|
|
8110
8111
|
React__namespace.useEffect(() => {
|
|
8111
8112
|
if (prevValueRef.current !== value) {
|
|
8112
8113
|
handleChange(value);
|
|
@@ -8124,7 +8125,7 @@
|
|
|
8124
8125
|
var EVENT_OPTIONS = { bubbles: false, cancelable: true };
|
|
8125
8126
|
var GROUP_NAME = "RovingFocusGroup";
|
|
8126
8127
|
var [Collection, useCollection, createCollectionScope] = createCollection(GROUP_NAME);
|
|
8127
|
-
var [createRovingFocusGroupContext, createRovingFocusGroupScope] = createContextScope
|
|
8128
|
+
var [createRovingFocusGroupContext, createRovingFocusGroupScope] = createContextScope(
|
|
8128
8129
|
GROUP_NAME,
|
|
8129
8130
|
[createCollectionScope]
|
|
8130
8131
|
);
|
|
@@ -8149,15 +8150,15 @@
|
|
|
8149
8150
|
...groupProps
|
|
8150
8151
|
} = props;
|
|
8151
8152
|
const ref = React__namespace.useRef(null);
|
|
8152
|
-
const composedRefs = useComposedRefs
|
|
8153
|
+
const composedRefs = useComposedRefs(forwardedRef, ref);
|
|
8153
8154
|
const direction = useDirection(dir);
|
|
8154
|
-
const [currentTabStopId = null, setCurrentTabStopId] = useControllableState
|
|
8155
|
+
const [currentTabStopId = null, setCurrentTabStopId] = useControllableState({
|
|
8155
8156
|
prop: currentTabStopIdProp,
|
|
8156
8157
|
defaultProp: defaultCurrentTabStopId,
|
|
8157
8158
|
onChange: onCurrentTabStopIdChange
|
|
8158
8159
|
});
|
|
8159
8160
|
const [isTabbingBackOut, setIsTabbingBackOut] = React__namespace.useState(false);
|
|
8160
|
-
const handleEntryFocus = useCallbackRef
|
|
8161
|
+
const handleEntryFocus = useCallbackRef(onEntryFocus);
|
|
8161
8162
|
const getItems = useCollection(__scopeRovingFocusGroup);
|
|
8162
8163
|
const isClickFocusRef = React__namespace.useRef(false);
|
|
8163
8164
|
const [focusableItemsCount, setFocusableItemsCount] = React__namespace.useState(0);
|
|
@@ -8190,17 +8191,17 @@
|
|
|
8190
8191
|
[]
|
|
8191
8192
|
),
|
|
8192
8193
|
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
8193
|
-
Primitive
|
|
8194
|
+
Primitive.div,
|
|
8194
8195
|
{
|
|
8195
8196
|
tabIndex: isTabbingBackOut || focusableItemsCount === 0 ? -1 : 0,
|
|
8196
8197
|
"data-orientation": orientation,
|
|
8197
8198
|
...groupProps,
|
|
8198
8199
|
ref: composedRefs,
|
|
8199
8200
|
style: { outline: "none", ...props.style },
|
|
8200
|
-
onMouseDown: composeEventHandlers
|
|
8201
|
+
onMouseDown: composeEventHandlers(props.onMouseDown, () => {
|
|
8201
8202
|
isClickFocusRef.current = true;
|
|
8202
8203
|
}),
|
|
8203
|
-
onFocus: composeEventHandlers
|
|
8204
|
+
onFocus: composeEventHandlers(props.onFocus, (event) => {
|
|
8204
8205
|
const isKeyboardFocus = !isClickFocusRef.current;
|
|
8205
8206
|
if (event.target === event.currentTarget && isKeyboardFocus && !isTabbingBackOut) {
|
|
8206
8207
|
const entryFocusEvent = new CustomEvent(ENTRY_FOCUS, EVENT_OPTIONS);
|
|
@@ -8218,7 +8219,7 @@
|
|
|
8218
8219
|
}
|
|
8219
8220
|
isClickFocusRef.current = false;
|
|
8220
8221
|
}),
|
|
8221
|
-
onBlur: composeEventHandlers
|
|
8222
|
+
onBlur: composeEventHandlers(props.onBlur, () => setIsTabbingBackOut(false))
|
|
8222
8223
|
}
|
|
8223
8224
|
)
|
|
8224
8225
|
}
|
|
@@ -8254,18 +8255,18 @@
|
|
|
8254
8255
|
focusable,
|
|
8255
8256
|
active,
|
|
8256
8257
|
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
8257
|
-
Primitive
|
|
8258
|
+
Primitive.span,
|
|
8258
8259
|
{
|
|
8259
8260
|
tabIndex: isCurrentTabStop ? 0 : -1,
|
|
8260
8261
|
"data-orientation": context.orientation,
|
|
8261
8262
|
...itemProps,
|
|
8262
8263
|
ref: forwardedRef,
|
|
8263
|
-
onMouseDown: composeEventHandlers
|
|
8264
|
+
onMouseDown: composeEventHandlers(props.onMouseDown, (event) => {
|
|
8264
8265
|
if (!focusable) event.preventDefault();
|
|
8265
8266
|
else context.onItemFocus(id);
|
|
8266
8267
|
}),
|
|
8267
|
-
onFocus: composeEventHandlers
|
|
8268
|
-
onKeyDown: composeEventHandlers
|
|
8268
|
+
onFocus: composeEventHandlers(props.onFocus, () => context.onItemFocus(id)),
|
|
8269
|
+
onKeyDown: composeEventHandlers(props.onKeyDown, (event) => {
|
|
8269
8270
|
if (event.key === "Tab" && event.shiftKey) {
|
|
8270
8271
|
context.onItemShiftTab();
|
|
8271
8272
|
return;
|
|
@@ -8324,10 +8325,10 @@
|
|
|
8324
8325
|
function wrapArray(array, startIndex) {
|
|
8325
8326
|
return array.map((_, index2) => array[(startIndex + index2) % array.length]);
|
|
8326
8327
|
}
|
|
8327
|
-
var Root
|
|
8328
|
+
var Root = RovingFocusGroup;
|
|
8328
8329
|
var Item = RovingFocusGroupItem;
|
|
8329
8330
|
var TOGGLE_GROUP_NAME = "ToggleGroup";
|
|
8330
|
-
var [createToggleGroupContext, createToggleGroupScope] = createContextScope
|
|
8331
|
+
var [createToggleGroupContext, createToggleGroupScope] = createContextScope(TOGGLE_GROUP_NAME, [
|
|
8331
8332
|
createRovingFocusGroupScope
|
|
8332
8333
|
]);
|
|
8333
8334
|
var useRovingFocusGroupScope = createRovingFocusGroupScope();
|
|
@@ -8353,7 +8354,7 @@
|
|
|
8353
8354
|
},
|
|
8354
8355
|
...toggleGroupSingleProps
|
|
8355
8356
|
} = props;
|
|
8356
|
-
const [value, setValue] = useControllableState
|
|
8357
|
+
const [value, setValue] = useControllableState({
|
|
8357
8358
|
prop: valueProp,
|
|
8358
8359
|
defaultProp: defaultValue,
|
|
8359
8360
|
onChange: onValueChange
|
|
@@ -8378,7 +8379,7 @@
|
|
|
8378
8379
|
},
|
|
8379
8380
|
...toggleGroupMultipleProps
|
|
8380
8381
|
} = props;
|
|
8381
|
-
const [value = [], setValue] = useControllableState
|
|
8382
|
+
const [value = [], setValue] = useControllableState({
|
|
8382
8383
|
prop: valueProp,
|
|
8383
8384
|
defaultProp: defaultValue,
|
|
8384
8385
|
onChange: onValueChange
|
|
@@ -8420,16 +8421,16 @@
|
|
|
8420
8421
|
const direction = useDirection(dir);
|
|
8421
8422
|
const commonProps = { role: "group", dir: direction, ...toggleGroupProps };
|
|
8422
8423
|
return /* @__PURE__ */ jsxRuntime.jsx(ToggleGroupContext, { scope: __scopeToggleGroup, rovingFocus, disabled, children: rovingFocus ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
8423
|
-
Root
|
|
8424
|
+
Root,
|
|
8424
8425
|
{
|
|
8425
8426
|
asChild: true,
|
|
8426
8427
|
...rovingFocusGroupScope,
|
|
8427
8428
|
orientation,
|
|
8428
8429
|
dir: direction,
|
|
8429
8430
|
loop,
|
|
8430
|
-
children: /* @__PURE__ */ jsxRuntime.jsx(Primitive
|
|
8431
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(Primitive.div, { ...commonProps, ref: forwardedRef })
|
|
8431
8432
|
}
|
|
8432
|
-
) : /* @__PURE__ */ jsxRuntime.jsx(Primitive
|
|
8433
|
+
) : /* @__PURE__ */ jsxRuntime.jsx(Primitive.div, { ...commonProps, ref: forwardedRef }) });
|
|
8433
8434
|
}
|
|
8434
8435
|
);
|
|
8435
8436
|
var ITEM_NAME = "ToggleGroupItem";
|
|
@@ -8886,358 +8887,6 @@
|
|
|
8886
8887
|
return /* @__PURE__ */ jsxRuntime.jsx("div", { className: "size-5 rounded-full border border-2 border-(--base-a12) border-b-transparent animate-spin" });
|
|
8887
8888
|
});
|
|
8888
8889
|
Spinner.displayName = "Spinner";
|
|
8889
|
-
function composeEventHandlers(originalEventHandler, ourEventHandler, { checkForDefaultPrevented = true } = {}) {
|
|
8890
|
-
return function handleEvent(event) {
|
|
8891
|
-
originalEventHandler == null ? void 0 : originalEventHandler(event);
|
|
8892
|
-
if (checkForDefaultPrevented === false || !event.defaultPrevented) {
|
|
8893
|
-
return ourEventHandler == null ? void 0 : ourEventHandler(event);
|
|
8894
|
-
}
|
|
8895
|
-
};
|
|
8896
|
-
}
|
|
8897
|
-
function setRef(ref, value) {
|
|
8898
|
-
if (typeof ref === "function") {
|
|
8899
|
-
return ref(value);
|
|
8900
|
-
} else if (ref !== null && ref !== void 0) {
|
|
8901
|
-
ref.current = value;
|
|
8902
|
-
}
|
|
8903
|
-
}
|
|
8904
|
-
function composeRefs(...refs) {
|
|
8905
|
-
return (node) => {
|
|
8906
|
-
let hasCleanup = false;
|
|
8907
|
-
const cleanups = refs.map((ref) => {
|
|
8908
|
-
const cleanup = setRef(ref, node);
|
|
8909
|
-
if (!hasCleanup && typeof cleanup == "function") {
|
|
8910
|
-
hasCleanup = true;
|
|
8911
|
-
}
|
|
8912
|
-
return cleanup;
|
|
8913
|
-
});
|
|
8914
|
-
if (hasCleanup) {
|
|
8915
|
-
return () => {
|
|
8916
|
-
for (let i = 0; i < cleanups.length; i++) {
|
|
8917
|
-
const cleanup = cleanups[i];
|
|
8918
|
-
if (typeof cleanup == "function") {
|
|
8919
|
-
cleanup();
|
|
8920
|
-
} else {
|
|
8921
|
-
setRef(refs[i], null);
|
|
8922
|
-
}
|
|
8923
|
-
}
|
|
8924
|
-
};
|
|
8925
|
-
}
|
|
8926
|
-
};
|
|
8927
|
-
}
|
|
8928
|
-
function useComposedRefs(...refs) {
|
|
8929
|
-
return React__namespace.useCallback(composeRefs(...refs), refs);
|
|
8930
|
-
}
|
|
8931
|
-
function createContextScope(scopeName, createContextScopeDeps = []) {
|
|
8932
|
-
let defaultContexts = [];
|
|
8933
|
-
function createContext3(rootComponentName, defaultContext) {
|
|
8934
|
-
const BaseContext = React__namespace.createContext(defaultContext);
|
|
8935
|
-
const index2 = defaultContexts.length;
|
|
8936
|
-
defaultContexts = [...defaultContexts, defaultContext];
|
|
8937
|
-
const Provider2 = (props) => {
|
|
8938
|
-
var _a;
|
|
8939
|
-
const { scope, children, ...context } = props;
|
|
8940
|
-
const Context = ((_a = scope == null ? void 0 : scope[scopeName]) == null ? void 0 : _a[index2]) || BaseContext;
|
|
8941
|
-
const value = React__namespace.useMemo(() => context, Object.values(context));
|
|
8942
|
-
return /* @__PURE__ */ jsxRuntime.jsx(Context.Provider, { value, children });
|
|
8943
|
-
};
|
|
8944
|
-
Provider2.displayName = rootComponentName + "Provider";
|
|
8945
|
-
function useContext2(consumerName, scope) {
|
|
8946
|
-
var _a;
|
|
8947
|
-
const Context = ((_a = scope == null ? void 0 : scope[scopeName]) == null ? void 0 : _a[index2]) || BaseContext;
|
|
8948
|
-
const context = React__namespace.useContext(Context);
|
|
8949
|
-
if (context) return context;
|
|
8950
|
-
if (defaultContext !== void 0) return defaultContext;
|
|
8951
|
-
throw new Error(`\`${consumerName}\` must be used within \`${rootComponentName}\``);
|
|
8952
|
-
}
|
|
8953
|
-
return [Provider2, useContext2];
|
|
8954
|
-
}
|
|
8955
|
-
const createScope = () => {
|
|
8956
|
-
const scopeContexts = defaultContexts.map((defaultContext) => {
|
|
8957
|
-
return React__namespace.createContext(defaultContext);
|
|
8958
|
-
});
|
|
8959
|
-
return function useScope(scope) {
|
|
8960
|
-
const contexts = (scope == null ? void 0 : scope[scopeName]) || scopeContexts;
|
|
8961
|
-
return React__namespace.useMemo(
|
|
8962
|
-
() => ({ [`__scope${scopeName}`]: { ...scope, [scopeName]: contexts } }),
|
|
8963
|
-
[scope, contexts]
|
|
8964
|
-
);
|
|
8965
|
-
};
|
|
8966
|
-
};
|
|
8967
|
-
createScope.scopeName = scopeName;
|
|
8968
|
-
return [createContext3, composeContextScopes(createScope, ...createContextScopeDeps)];
|
|
8969
|
-
}
|
|
8970
|
-
function composeContextScopes(...scopes) {
|
|
8971
|
-
const baseScope = scopes[0];
|
|
8972
|
-
if (scopes.length === 1) return baseScope;
|
|
8973
|
-
const createScope = () => {
|
|
8974
|
-
const scopeHooks = scopes.map((createScope2) => ({
|
|
8975
|
-
useScope: createScope2(),
|
|
8976
|
-
scopeName: createScope2.scopeName
|
|
8977
|
-
}));
|
|
8978
|
-
return function useComposedScopes(overrideScopes) {
|
|
8979
|
-
const nextScopes = scopeHooks.reduce((nextScopes2, { useScope, scopeName }) => {
|
|
8980
|
-
const scopeProps = useScope(overrideScopes);
|
|
8981
|
-
const currentScope = scopeProps[`__scope${scopeName}`];
|
|
8982
|
-
return { ...nextScopes2, ...currentScope };
|
|
8983
|
-
}, {});
|
|
8984
|
-
return React__namespace.useMemo(() => ({ [`__scope${baseScope.scopeName}`]: nextScopes }), [nextScopes]);
|
|
8985
|
-
};
|
|
8986
|
-
};
|
|
8987
|
-
createScope.scopeName = baseScope.scopeName;
|
|
8988
|
-
return createScope;
|
|
8989
|
-
}
|
|
8990
|
-
function useCallbackRef(callback) {
|
|
8991
|
-
const callbackRef = React__namespace.useRef(callback);
|
|
8992
|
-
React__namespace.useEffect(() => {
|
|
8993
|
-
callbackRef.current = callback;
|
|
8994
|
-
});
|
|
8995
|
-
return React__namespace.useMemo(() => (...args) => {
|
|
8996
|
-
var _a;
|
|
8997
|
-
return (_a = callbackRef.current) == null ? void 0 : _a.call(callbackRef, ...args);
|
|
8998
|
-
}, []);
|
|
8999
|
-
}
|
|
9000
|
-
function useControllableState({
|
|
9001
|
-
prop,
|
|
9002
|
-
defaultProp,
|
|
9003
|
-
onChange = () => {
|
|
9004
|
-
}
|
|
9005
|
-
}) {
|
|
9006
|
-
const [uncontrolledProp, setUncontrolledProp] = useUncontrolledState({ defaultProp, onChange });
|
|
9007
|
-
const isControlled = prop !== void 0;
|
|
9008
|
-
const value = isControlled ? prop : uncontrolledProp;
|
|
9009
|
-
const handleChange = useCallbackRef(onChange);
|
|
9010
|
-
const setValue = React__namespace.useCallback(
|
|
9011
|
-
(nextValue) => {
|
|
9012
|
-
if (isControlled) {
|
|
9013
|
-
const setter = nextValue;
|
|
9014
|
-
const value2 = typeof nextValue === "function" ? setter(prop) : nextValue;
|
|
9015
|
-
if (value2 !== prop) handleChange(value2);
|
|
9016
|
-
} else {
|
|
9017
|
-
setUncontrolledProp(nextValue);
|
|
9018
|
-
}
|
|
9019
|
-
},
|
|
9020
|
-
[isControlled, prop, setUncontrolledProp, handleChange]
|
|
9021
|
-
);
|
|
9022
|
-
return [value, setValue];
|
|
9023
|
-
}
|
|
9024
|
-
function useUncontrolledState({
|
|
9025
|
-
defaultProp,
|
|
9026
|
-
onChange
|
|
9027
|
-
}) {
|
|
9028
|
-
const uncontrolledState = React__namespace.useState(defaultProp);
|
|
9029
|
-
const [value] = uncontrolledState;
|
|
9030
|
-
const prevValueRef = React__namespace.useRef(value);
|
|
9031
|
-
const handleChange = useCallbackRef(onChange);
|
|
9032
|
-
React__namespace.useEffect(() => {
|
|
9033
|
-
if (prevValueRef.current !== value) {
|
|
9034
|
-
handleChange(value);
|
|
9035
|
-
prevValueRef.current = value;
|
|
9036
|
-
}
|
|
9037
|
-
}, [value, prevValueRef, handleChange]);
|
|
9038
|
-
return uncontrolledState;
|
|
9039
|
-
}
|
|
9040
|
-
function usePrevious(value) {
|
|
9041
|
-
const ref = React__namespace.useRef({ value, previous: value });
|
|
9042
|
-
return React__namespace.useMemo(() => {
|
|
9043
|
-
if (ref.current.value !== value) {
|
|
9044
|
-
ref.current.previous = ref.current.value;
|
|
9045
|
-
ref.current.value = value;
|
|
9046
|
-
}
|
|
9047
|
-
return ref.current.previous;
|
|
9048
|
-
}, [value]);
|
|
9049
|
-
}
|
|
9050
|
-
var useLayoutEffect2 = Boolean(globalThis == null ? void 0 : globalThis.document) ? React__namespace.useLayoutEffect : () => {
|
|
9051
|
-
};
|
|
9052
|
-
function useSize(element) {
|
|
9053
|
-
const [size2, setSize] = React__namespace.useState(void 0);
|
|
9054
|
-
useLayoutEffect2(() => {
|
|
9055
|
-
if (element) {
|
|
9056
|
-
setSize({ width: element.offsetWidth, height: element.offsetHeight });
|
|
9057
|
-
const resizeObserver = new ResizeObserver((entries) => {
|
|
9058
|
-
if (!Array.isArray(entries)) {
|
|
9059
|
-
return;
|
|
9060
|
-
}
|
|
9061
|
-
if (!entries.length) {
|
|
9062
|
-
return;
|
|
9063
|
-
}
|
|
9064
|
-
const entry = entries[0];
|
|
9065
|
-
let width;
|
|
9066
|
-
let height;
|
|
9067
|
-
if ("borderBoxSize" in entry) {
|
|
9068
|
-
const borderSizeEntry = entry["borderBoxSize"];
|
|
9069
|
-
const borderSize = Array.isArray(borderSizeEntry) ? borderSizeEntry[0] : borderSizeEntry;
|
|
9070
|
-
width = borderSize["inlineSize"];
|
|
9071
|
-
height = borderSize["blockSize"];
|
|
9072
|
-
} else {
|
|
9073
|
-
width = element.offsetWidth;
|
|
9074
|
-
height = element.offsetHeight;
|
|
9075
|
-
}
|
|
9076
|
-
setSize({ width, height });
|
|
9077
|
-
});
|
|
9078
|
-
resizeObserver.observe(element, { box: "border-box" });
|
|
9079
|
-
return () => resizeObserver.unobserve(element);
|
|
9080
|
-
} else {
|
|
9081
|
-
setSize(void 0);
|
|
9082
|
-
}
|
|
9083
|
-
}, [element]);
|
|
9084
|
-
return size2;
|
|
9085
|
-
}
|
|
9086
|
-
var NODES = [
|
|
9087
|
-
"a",
|
|
9088
|
-
"button",
|
|
9089
|
-
"div",
|
|
9090
|
-
"form",
|
|
9091
|
-
"h2",
|
|
9092
|
-
"h3",
|
|
9093
|
-
"img",
|
|
9094
|
-
"input",
|
|
9095
|
-
"label",
|
|
9096
|
-
"li",
|
|
9097
|
-
"nav",
|
|
9098
|
-
"ol",
|
|
9099
|
-
"p",
|
|
9100
|
-
"span",
|
|
9101
|
-
"svg",
|
|
9102
|
-
"ul"
|
|
9103
|
-
];
|
|
9104
|
-
var Primitive = NODES.reduce((primitive, node) => {
|
|
9105
|
-
const Node2 = React__namespace.forwardRef((props, forwardedRef) => {
|
|
9106
|
-
const { asChild, ...primitiveProps } = props;
|
|
9107
|
-
const Comp = asChild ? reactSlot.Slot : node;
|
|
9108
|
-
if (typeof window !== "undefined") {
|
|
9109
|
-
window[Symbol.for("radix-ui")] = true;
|
|
9110
|
-
}
|
|
9111
|
-
return /* @__PURE__ */ jsxRuntime.jsx(Comp, { ...primitiveProps, ref: forwardedRef });
|
|
9112
|
-
});
|
|
9113
|
-
Node2.displayName = `Primitive.${node}`;
|
|
9114
|
-
return { ...primitive, [node]: Node2 };
|
|
9115
|
-
}, {});
|
|
9116
|
-
var SWITCH_NAME = "Switch";
|
|
9117
|
-
var [createSwitchContext, createSwitchScope] = createContextScope(SWITCH_NAME);
|
|
9118
|
-
var [SwitchProvider, useSwitchContext] = createSwitchContext(SWITCH_NAME);
|
|
9119
|
-
var Switch$1 = React__namespace.forwardRef(
|
|
9120
|
-
(props, forwardedRef) => {
|
|
9121
|
-
const {
|
|
9122
|
-
__scopeSwitch,
|
|
9123
|
-
name,
|
|
9124
|
-
checked: checkedProp,
|
|
9125
|
-
defaultChecked,
|
|
9126
|
-
required,
|
|
9127
|
-
disabled,
|
|
9128
|
-
value = "on",
|
|
9129
|
-
onCheckedChange,
|
|
9130
|
-
form,
|
|
9131
|
-
...switchProps
|
|
9132
|
-
} = props;
|
|
9133
|
-
const [button, setButton] = React__namespace.useState(null);
|
|
9134
|
-
const composedRefs = useComposedRefs(forwardedRef, (node) => setButton(node));
|
|
9135
|
-
const hasConsumerStoppedPropagationRef = React__namespace.useRef(false);
|
|
9136
|
-
const isFormControl = button ? form || !!button.closest("form") : true;
|
|
9137
|
-
const [checked = false, setChecked] = useControllableState({
|
|
9138
|
-
prop: checkedProp,
|
|
9139
|
-
defaultProp: defaultChecked,
|
|
9140
|
-
onChange: onCheckedChange
|
|
9141
|
-
});
|
|
9142
|
-
return /* @__PURE__ */ jsxRuntime.jsxs(SwitchProvider, { scope: __scopeSwitch, checked, disabled, children: [
|
|
9143
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
9144
|
-
Primitive.button,
|
|
9145
|
-
{
|
|
9146
|
-
type: "button",
|
|
9147
|
-
role: "switch",
|
|
9148
|
-
"aria-checked": checked,
|
|
9149
|
-
"aria-required": required,
|
|
9150
|
-
"data-state": getState(checked),
|
|
9151
|
-
"data-disabled": disabled ? "" : void 0,
|
|
9152
|
-
disabled,
|
|
9153
|
-
value,
|
|
9154
|
-
...switchProps,
|
|
9155
|
-
ref: composedRefs,
|
|
9156
|
-
onClick: composeEventHandlers(props.onClick, (event) => {
|
|
9157
|
-
setChecked((prevChecked) => !prevChecked);
|
|
9158
|
-
if (isFormControl) {
|
|
9159
|
-
hasConsumerStoppedPropagationRef.current = event.isPropagationStopped();
|
|
9160
|
-
if (!hasConsumerStoppedPropagationRef.current) event.stopPropagation();
|
|
9161
|
-
}
|
|
9162
|
-
})
|
|
9163
|
-
}
|
|
9164
|
-
),
|
|
9165
|
-
isFormControl && /* @__PURE__ */ jsxRuntime.jsx(
|
|
9166
|
-
BubbleInput,
|
|
9167
|
-
{
|
|
9168
|
-
control: button,
|
|
9169
|
-
bubbles: !hasConsumerStoppedPropagationRef.current,
|
|
9170
|
-
name,
|
|
9171
|
-
value,
|
|
9172
|
-
checked,
|
|
9173
|
-
required,
|
|
9174
|
-
disabled,
|
|
9175
|
-
form,
|
|
9176
|
-
style: { transform: "translateX(-100%)" }
|
|
9177
|
-
}
|
|
9178
|
-
)
|
|
9179
|
-
] });
|
|
9180
|
-
}
|
|
9181
|
-
);
|
|
9182
|
-
Switch$1.displayName = SWITCH_NAME;
|
|
9183
|
-
var THUMB_NAME = "SwitchThumb";
|
|
9184
|
-
var SwitchThumb$1 = React__namespace.forwardRef(
|
|
9185
|
-
(props, forwardedRef) => {
|
|
9186
|
-
const { __scopeSwitch, ...thumbProps } = props;
|
|
9187
|
-
const context = useSwitchContext(THUMB_NAME, __scopeSwitch);
|
|
9188
|
-
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
9189
|
-
Primitive.span,
|
|
9190
|
-
{
|
|
9191
|
-
"data-state": getState(context.checked),
|
|
9192
|
-
"data-disabled": context.disabled ? "" : void 0,
|
|
9193
|
-
...thumbProps,
|
|
9194
|
-
ref: forwardedRef
|
|
9195
|
-
}
|
|
9196
|
-
);
|
|
9197
|
-
}
|
|
9198
|
-
);
|
|
9199
|
-
SwitchThumb$1.displayName = THUMB_NAME;
|
|
9200
|
-
var BubbleInput = (props) => {
|
|
9201
|
-
const { control, checked, bubbles = true, ...inputProps } = props;
|
|
9202
|
-
const ref = React__namespace.useRef(null);
|
|
9203
|
-
const prevChecked = usePrevious(checked);
|
|
9204
|
-
const controlSize = useSize(control);
|
|
9205
|
-
React__namespace.useEffect(() => {
|
|
9206
|
-
const input = ref.current;
|
|
9207
|
-
const inputProto = window.HTMLInputElement.prototype;
|
|
9208
|
-
const descriptor = Object.getOwnPropertyDescriptor(inputProto, "checked");
|
|
9209
|
-
const setChecked = descriptor.set;
|
|
9210
|
-
if (prevChecked !== checked && setChecked) {
|
|
9211
|
-
const event = new Event("click", { bubbles });
|
|
9212
|
-
setChecked.call(input, checked);
|
|
9213
|
-
input.dispatchEvent(event);
|
|
9214
|
-
}
|
|
9215
|
-
}, [prevChecked, checked, bubbles]);
|
|
9216
|
-
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
9217
|
-
"input",
|
|
9218
|
-
{
|
|
9219
|
-
type: "checkbox",
|
|
9220
|
-
"aria-hidden": true,
|
|
9221
|
-
defaultChecked: checked,
|
|
9222
|
-
...inputProps,
|
|
9223
|
-
tabIndex: -1,
|
|
9224
|
-
ref,
|
|
9225
|
-
style: {
|
|
9226
|
-
...props.style,
|
|
9227
|
-
...controlSize,
|
|
9228
|
-
position: "absolute",
|
|
9229
|
-
pointerEvents: "none",
|
|
9230
|
-
opacity: 0,
|
|
9231
|
-
margin: 0
|
|
9232
|
-
}
|
|
9233
|
-
}
|
|
9234
|
-
);
|
|
9235
|
-
};
|
|
9236
|
-
function getState(checked) {
|
|
9237
|
-
return checked ? "checked" : "unchecked";
|
|
9238
|
-
}
|
|
9239
|
-
var Root = Switch$1;
|
|
9240
|
-
var Thumb = SwitchThumb$1;
|
|
9241
8890
|
const SwitchContext = React.createContext({});
|
|
9242
8891
|
const switchRoot = classVarianceAuthority.cva(
|
|
9243
8892
|
[
|
|
@@ -9299,7 +8948,7 @@
|
|
|
9299
8948
|
const providerContext = useProvider();
|
|
9300
8949
|
const { className, size: size2 = "md", children, accentColor = providerContext.accentColor, ...rest } = props;
|
|
9301
8950
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
9302
|
-
Root,
|
|
8951
|
+
RadixSwitch__namespace.Root,
|
|
9303
8952
|
{
|
|
9304
8953
|
className: classVarianceAuthority.cx(className, switchRoot({ size: size2 })),
|
|
9305
8954
|
ref,
|
|
@@ -9314,7 +8963,7 @@
|
|
|
9314
8963
|
React.forwardRef((props, ref) => {
|
|
9315
8964
|
const { className, ...rest } = props;
|
|
9316
8965
|
const { size: size2 } = React.useContext(SwitchContext);
|
|
9317
|
-
return /* @__PURE__ */ jsxRuntime.jsx(Thumb, { className: classVarianceAuthority.cx(className, switchThumb({ size: size2 })), ref, ...rest });
|
|
8966
|
+
return /* @__PURE__ */ jsxRuntime.jsx(RadixSwitch__namespace.Thumb, { className: classVarianceAuthority.cx(className, switchThumb({ size: size2 })), ref, ...rest });
|
|
9318
8967
|
})
|
|
9319
8968
|
);
|
|
9320
8969
|
const Switch = {
|
|
@@ -10133,7 +9782,7 @@
|
|
|
10133
9782
|
exports2.usePagesContext = usePagesContext;
|
|
10134
9783
|
exports2.useProvider = useProvider;
|
|
10135
9784
|
exports2.useSelectedIndicatorContext = useSelectedIndicatorContext;
|
|
10136
|
-
exports2.useSize = useSize
|
|
9785
|
+
exports2.useSize = useSize;
|
|
10137
9786
|
exports2.useStopEventPropagation = useStopEventPropagation;
|
|
10138
9787
|
exports2.useSubContext = useSubContext;
|
|
10139
9788
|
exports2.useTextFilter = useTextFilter;
|