@overmap-ai/blocks 1.0.31-tailwind-components.23 → 1.0.31-tailwind-components.25
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/Menu/PageContent/PageContent.d.ts +2 -2
- package/dist/Menu/Pages/Pages.d.ts +2 -2
- package/dist/Menu/SelectedIndicator/SelectedIndicator.d.ts +4 -2
- package/dist/Menu/Sub/Sub.d.ts +2 -2
- package/dist/Menu/index.d.ts +6 -6
- package/dist/Menu/root/Root.d.ts +2 -2
- package/dist/Menu/typings.d.ts +4 -4
- package/dist/blocks.js +29 -648
- package/dist/blocks.js.map +1 -1
- package/dist/blocks.umd.cjs +32 -650
- package/dist/blocks.umd.cjs.map +1 -1
- package/package.json +11 -27
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-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.
|
|
3
|
-
})(this, function(exports2, RadixAlertDialog, jsxRuntime, classVarianceAuthority, React, RadixAvatar, RadixCheckbox, RadixPrimitiveCollapsible, reactResponsive, RadixDialog, hi, RadixHoverCard, reactSlot, reResizable, reactTransitionGroup, ReactDOM, RadixSeparator, reactErrorBoundary, RiIcons, RadixPopover, RadixRadioGroup,
|
|
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-group"), 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-toggle"), 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-group", "@radix-ui/react-dismissable-layer", "@radix-ui/react-switch", "@radix-ui/react-tabs", "@radix-ui/react-toast", "@radix-ui/react-toggle", "@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.RadixToggleGroup, global.reactDismissableLayer, global.RadixSwitch, global.RadixTabs, global.RadixToast, global.Toggle, 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, RadixToggleGroup, reactDismissableLayer, RadixSwitch, RadixTabs, RadixToast, Toggle, RadixTooltip) {
|
|
4
4
|
"use strict";
|
|
5
5
|
function _interopNamespaceDefault(e) {
|
|
6
6
|
const n = Object.create(null, { [Symbol.toStringTag]: { value: "Module" } });
|
|
@@ -30,10 +30,11 @@
|
|
|
30
30
|
const RiIcons__namespace = /* @__PURE__ */ _interopNamespaceDefault(RiIcons);
|
|
31
31
|
const RadixPopover__namespace = /* @__PURE__ */ _interopNamespaceDefault(RadixPopover);
|
|
32
32
|
const RadixRadioGroup__namespace = /* @__PURE__ */ _interopNamespaceDefault(RadixRadioGroup);
|
|
33
|
-
const
|
|
33
|
+
const RadixToggleGroup__namespace = /* @__PURE__ */ _interopNamespaceDefault(RadixToggleGroup);
|
|
34
34
|
const RadixSwitch__namespace = /* @__PURE__ */ _interopNamespaceDefault(RadixSwitch);
|
|
35
35
|
const RadixTabs__namespace = /* @__PURE__ */ _interopNamespaceDefault(RadixTabs);
|
|
36
36
|
const RadixToast__namespace = /* @__PURE__ */ _interopNamespaceDefault(RadixToast);
|
|
37
|
+
const Toggle__namespace = /* @__PURE__ */ _interopNamespaceDefault(Toggle);
|
|
37
38
|
const RadixTooltip__namespace = /* @__PURE__ */ _interopNamespaceDefault(RadixTooltip);
|
|
38
39
|
const floating = classVarianceAuthority.cva(
|
|
39
40
|
[
|
|
@@ -1196,7 +1197,7 @@
|
|
|
1196
1197
|
Root: RadixHoverCard__namespace.Root,
|
|
1197
1198
|
Trigger: RadixHoverCard__namespace.Trigger
|
|
1198
1199
|
};
|
|
1199
|
-
const HoverUtility = React.memo(function
|
|
1200
|
+
const HoverUtility = React.memo(function Root2({ children, forceHover }) {
|
|
1200
1201
|
const [isHovered, setIsHovered] = React.useState(false);
|
|
1201
1202
|
const handlePointerEnter = React.useCallback(() => {
|
|
1202
1203
|
setIsHovered(true);
|
|
@@ -1335,7 +1336,7 @@
|
|
|
1335
1336
|
return !hideLayout && /* @__PURE__ */ jsxRuntime.jsx("div", { className: classVarianceAuthority.cx(className, "flex grow h-full"), ref, ...rest, children });
|
|
1336
1337
|
})
|
|
1337
1338
|
);
|
|
1338
|
-
const Root
|
|
1339
|
+
const Root = React.memo((props) => {
|
|
1339
1340
|
const { children, small = false, hideLayout = false } = props;
|
|
1340
1341
|
const [showLeftSlideOut, setShowLeftSlideOut] = React.useState(false);
|
|
1341
1342
|
const [showRightSlideOut, setShowRightSlideOut] = React.useState(false);
|
|
@@ -1352,9 +1353,9 @@
|
|
|
1352
1353
|
);
|
|
1353
1354
|
return /* @__PURE__ */ jsxRuntime.jsx(LayoutContext.Provider, { value: contextValue, children });
|
|
1354
1355
|
});
|
|
1355
|
-
Root
|
|
1356
|
+
Root.displayName = "Layout.Root";
|
|
1356
1357
|
function usePointerDownOutside(onPointerDownOutside, ownerElement = globalThis == null ? void 0 : globalThis.document.body) {
|
|
1357
|
-
const handlePointerDownOutside = useCallbackRef
|
|
1358
|
+
const handlePointerDownOutside = useCallbackRef(onPointerDownOutside);
|
|
1358
1359
|
const isPointerInsideReactTreeRef = React.useRef(false);
|
|
1359
1360
|
const handleClickRef = React.useRef(() => {
|
|
1360
1361
|
});
|
|
@@ -1406,7 +1407,7 @@
|
|
|
1406
1407
|
target.dispatchEvent(event);
|
|
1407
1408
|
}
|
|
1408
1409
|
}
|
|
1409
|
-
function useCallbackRef
|
|
1410
|
+
function useCallbackRef(callback) {
|
|
1410
1411
|
const callbackRef = React.useRef(callback);
|
|
1411
1412
|
React.useEffect(() => {
|
|
1412
1413
|
callbackRef.current = callback;
|
|
@@ -1690,7 +1691,7 @@
|
|
|
1690
1691
|
})
|
|
1691
1692
|
);
|
|
1692
1693
|
const Layout = {
|
|
1693
|
-
Root
|
|
1694
|
+
Root,
|
|
1694
1695
|
Container,
|
|
1695
1696
|
SlideOutOverlay,
|
|
1696
1697
|
LeftSlideOut,
|
|
@@ -4208,11 +4209,11 @@
|
|
|
4208
4209
|
return _extends.apply(this, arguments);
|
|
4209
4210
|
}
|
|
4210
4211
|
let serverHandoffComplete = false;
|
|
4211
|
-
let count
|
|
4212
|
+
let count = 0;
|
|
4212
4213
|
const genId = () => (
|
|
4213
4214
|
// Ensure the id is unique with multiple independent versions of Floating UI
|
|
4214
4215
|
// on <React 18
|
|
4215
|
-
"floating-ui-" + Math.random().toString(36).slice(2, 6) + count
|
|
4216
|
+
"floating-ui-" + Math.random().toString(36).slice(2, 6) + count++
|
|
4216
4217
|
);
|
|
4217
4218
|
function useFloatingId() {
|
|
4218
4219
|
const [id, setId] = React__namespace.useState(() => serverHandoffComplete ? genId() : void 0);
|
|
@@ -4226,8 +4227,8 @@
|
|
|
4226
4227
|
}, []);
|
|
4227
4228
|
return id;
|
|
4228
4229
|
}
|
|
4229
|
-
const useReactId
|
|
4230
|
-
const useId
|
|
4230
|
+
const useReactId = SafeReact.useId;
|
|
4231
|
+
const useId = useReactId || useFloatingId;
|
|
4231
4232
|
let devMessageSet;
|
|
4232
4233
|
if (process.env.NODE_ENV !== "production") {
|
|
4233
4234
|
devMessageSet = /* @__PURE__ */ new Set();
|
|
@@ -4280,7 +4281,7 @@
|
|
|
4280
4281
|
};
|
|
4281
4282
|
const useFloatingTree = () => React__namespace.useContext(FloatingTreeContext);
|
|
4282
4283
|
function useFloatingNodeId(customParentId) {
|
|
4283
|
-
const id = useId
|
|
4284
|
+
const id = useId();
|
|
4284
4285
|
const tree = useFloatingTree();
|
|
4285
4286
|
const reactParentId = useFloatingParentNodeId();
|
|
4286
4287
|
const parentId = reactParentId;
|
|
@@ -4869,7 +4870,7 @@
|
|
|
4869
4870
|
id,
|
|
4870
4871
|
root
|
|
4871
4872
|
} = props;
|
|
4872
|
-
const uniqueId = useId
|
|
4873
|
+
const uniqueId = useId();
|
|
4873
4874
|
const portalContext = usePortalContext();
|
|
4874
4875
|
const [portalNode, setPortalNode] = React__namespace.useState(null);
|
|
4875
4876
|
const portalNodeRef = React__namespace.useRef(null);
|
|
@@ -5330,7 +5331,7 @@
|
|
|
5330
5331
|
lockScroll = false,
|
|
5331
5332
|
...rest
|
|
5332
5333
|
} = props;
|
|
5333
|
-
const lockId = useId
|
|
5334
|
+
const lockId = useId();
|
|
5334
5335
|
index(() => {
|
|
5335
5336
|
if (!lockScroll) return;
|
|
5336
5337
|
activeLocks.add(lockId);
|
|
@@ -5734,7 +5735,7 @@
|
|
|
5734
5735
|
onOpenChange: onOpenChangeProp,
|
|
5735
5736
|
elements: elementsProp
|
|
5736
5737
|
} = options;
|
|
5737
|
-
const floatingId = useId
|
|
5738
|
+
const floatingId = useId();
|
|
5738
5739
|
const dataRef = React__namespace.useRef({});
|
|
5739
5740
|
const [events] = React__namespace.useState(() => createPubSub());
|
|
5740
5741
|
const nested = useFloatingParentNodeId() != null;
|
|
@@ -6473,7 +6474,7 @@
|
|
|
6473
6474
|
role = "dialog"
|
|
6474
6475
|
} = props;
|
|
6475
6476
|
const ariaRole = (_componentRoleToAriaR = componentRoleToAriaRoleMap.get(role)) != null ? _componentRoleToAriaR : role;
|
|
6476
|
-
const referenceId = useId
|
|
6477
|
+
const referenceId = useId();
|
|
6477
6478
|
const parentId = useFloatingParentNodeId();
|
|
6478
6479
|
const isNested = parentId != null;
|
|
6479
6480
|
return React__namespace.useMemo(() => {
|
|
@@ -6741,7 +6742,7 @@
|
|
|
6741
6742
|
const MENU_CONTENT_PADDING = 8;
|
|
6742
6743
|
const MENU_MINIMUM_MAX_HEIGHT = 250;
|
|
6743
6744
|
const DEFAULT_OFFSET = 5;
|
|
6744
|
-
const MenuRoot =
|
|
6745
|
+
const MenuRoot = (props) => {
|
|
6745
6746
|
const {
|
|
6746
6747
|
children,
|
|
6747
6748
|
side = "bottom",
|
|
@@ -6831,7 +6832,7 @@
|
|
|
6831
6832
|
children
|
|
6832
6833
|
}
|
|
6833
6834
|
) });
|
|
6834
|
-
}
|
|
6835
|
+
};
|
|
6835
6836
|
MenuRoot.displayName = "Root";
|
|
6836
6837
|
const MenuClickTrigger = React.memo(
|
|
6837
6838
|
React.forwardRef((props, forwardedRef) => {
|
|
@@ -7185,7 +7186,7 @@
|
|
|
7185
7186
|
}
|
|
7186
7187
|
return { mainAxis: MENU_CONTENT_PADDING + 1, crossAxis: 0 };
|
|
7187
7188
|
};
|
|
7188
|
-
const MenuSub =
|
|
7189
|
+
const MenuSub = (props) => {
|
|
7189
7190
|
const {
|
|
7190
7191
|
children,
|
|
7191
7192
|
disabled = false,
|
|
@@ -7285,7 +7286,7 @@
|
|
|
7285
7286
|
children
|
|
7286
7287
|
}
|
|
7287
7288
|
);
|
|
7288
|
-
}
|
|
7289
|
+
};
|
|
7289
7290
|
MenuSub.displayName = "SubMenu";
|
|
7290
7291
|
const TRIGGER_SELECT_KEYS = ["Enter", " "];
|
|
7291
7292
|
const MenuItem = React.memo(
|
|
@@ -7400,11 +7401,11 @@
|
|
|
7400
7401
|
);
|
|
7401
7402
|
const SelectedIndicatorContext = React.createContext({});
|
|
7402
7403
|
const useSelectedIndicatorContext = () => React.useContext(SelectedIndicatorContext);
|
|
7403
|
-
const MenuSelectedIndicator = React.
|
|
7404
|
+
const MenuSelectedIndicator = React.forwardRef((props, ref) => {
|
|
7404
7405
|
const { children } = props;
|
|
7405
7406
|
const { selected } = useSelectedIndicatorContext();
|
|
7406
7407
|
const { size: size2 } = useMenuContentContext();
|
|
7407
|
-
return /* @__PURE__ */ jsxRuntime.jsx("div", { className: menuSelectedIndicator({ size: size2 }), children: selected ? children : null });
|
|
7408
|
+
return /* @__PURE__ */ jsxRuntime.jsx("div", { ref, className: menuSelectedIndicator({ size: size2 }), children: selected ? children : null });
|
|
7408
7409
|
});
|
|
7409
7410
|
MenuSelectedIndicator.displayName = "SelectedIndicator";
|
|
7410
7411
|
const MenuMultiSelectItem = React.memo(
|
|
@@ -7439,7 +7440,7 @@
|
|
|
7439
7440
|
);
|
|
7440
7441
|
const PagesContext = React.createContext({});
|
|
7441
7442
|
const usePagesContext = () => React.useContext(PagesContext);
|
|
7442
|
-
const MenuPages =
|
|
7443
|
+
const MenuPages = (props) => {
|
|
7443
7444
|
const { children, defaultPage, page, onPageChange } = props;
|
|
7444
7445
|
const [activePage, setActivePage] = useControlledState({
|
|
7445
7446
|
state: page,
|
|
@@ -7447,13 +7448,12 @@
|
|
|
7447
7448
|
setState: onPageChange
|
|
7448
7449
|
});
|
|
7449
7450
|
return /* @__PURE__ */ jsxRuntime.jsx(PagesContext.Provider, { value: { activePage, setActivePage }, children });
|
|
7450
|
-
}
|
|
7451
|
-
|
|
7452
|
-
const MenuPageContent = React.memo((props) => {
|
|
7451
|
+
};
|
|
7452
|
+
const MenuPageContent = (props) => {
|
|
7453
7453
|
const { page, children } = props;
|
|
7454
7454
|
const { activePage } = usePagesContext();
|
|
7455
|
-
return
|
|
7456
|
-
}
|
|
7455
|
+
return activePage === page ? children : null;
|
|
7456
|
+
};
|
|
7457
7457
|
MenuPageContent.displayName = "PageContent";
|
|
7458
7458
|
const MenuPageTrigger = React.memo(
|
|
7459
7459
|
React.forwardRef((props, ref) => {
|
|
@@ -7864,624 +7864,6 @@
|
|
|
7864
7864
|
Item: RadioGroupItem,
|
|
7865
7865
|
Root: RadioGroupRoot
|
|
7866
7866
|
};
|
|
7867
|
-
function createContextScope(scopeName, createContextScopeDeps = []) {
|
|
7868
|
-
let defaultContexts = [];
|
|
7869
|
-
function createContext3(rootComponentName, defaultContext) {
|
|
7870
|
-
const BaseContext = React__namespace.createContext(defaultContext);
|
|
7871
|
-
const index2 = defaultContexts.length;
|
|
7872
|
-
defaultContexts = [...defaultContexts, defaultContext];
|
|
7873
|
-
const Provider2 = (props) => {
|
|
7874
|
-
var _a;
|
|
7875
|
-
const { scope, children, ...context } = props;
|
|
7876
|
-
const Context = ((_a = scope == null ? void 0 : scope[scopeName]) == null ? void 0 : _a[index2]) || BaseContext;
|
|
7877
|
-
const value = React__namespace.useMemo(() => context, Object.values(context));
|
|
7878
|
-
return /* @__PURE__ */ jsxRuntime.jsx(Context.Provider, { value, children });
|
|
7879
|
-
};
|
|
7880
|
-
Provider2.displayName = rootComponentName + "Provider";
|
|
7881
|
-
function useContext2(consumerName, scope) {
|
|
7882
|
-
var _a;
|
|
7883
|
-
const Context = ((_a = scope == null ? void 0 : scope[scopeName]) == null ? void 0 : _a[index2]) || BaseContext;
|
|
7884
|
-
const context = React__namespace.useContext(Context);
|
|
7885
|
-
if (context) return context;
|
|
7886
|
-
if (defaultContext !== void 0) return defaultContext;
|
|
7887
|
-
throw new Error(`\`${consumerName}\` must be used within \`${rootComponentName}\``);
|
|
7888
|
-
}
|
|
7889
|
-
return [Provider2, useContext2];
|
|
7890
|
-
}
|
|
7891
|
-
const createScope = () => {
|
|
7892
|
-
const scopeContexts = defaultContexts.map((defaultContext) => {
|
|
7893
|
-
return React__namespace.createContext(defaultContext);
|
|
7894
|
-
});
|
|
7895
|
-
return function useScope(scope) {
|
|
7896
|
-
const contexts = (scope == null ? void 0 : scope[scopeName]) || scopeContexts;
|
|
7897
|
-
return React__namespace.useMemo(
|
|
7898
|
-
() => ({ [`__scope${scopeName}`]: { ...scope, [scopeName]: contexts } }),
|
|
7899
|
-
[scope, contexts]
|
|
7900
|
-
);
|
|
7901
|
-
};
|
|
7902
|
-
};
|
|
7903
|
-
createScope.scopeName = scopeName;
|
|
7904
|
-
return [createContext3, composeContextScopes(createScope, ...createContextScopeDeps)];
|
|
7905
|
-
}
|
|
7906
|
-
function composeContextScopes(...scopes) {
|
|
7907
|
-
const baseScope = scopes[0];
|
|
7908
|
-
if (scopes.length === 1) return baseScope;
|
|
7909
|
-
const createScope = () => {
|
|
7910
|
-
const scopeHooks = scopes.map((createScope2) => ({
|
|
7911
|
-
useScope: createScope2(),
|
|
7912
|
-
scopeName: createScope2.scopeName
|
|
7913
|
-
}));
|
|
7914
|
-
return function useComposedScopes(overrideScopes) {
|
|
7915
|
-
const nextScopes = scopeHooks.reduce((nextScopes2, { useScope, scopeName }) => {
|
|
7916
|
-
const scopeProps = useScope(overrideScopes);
|
|
7917
|
-
const currentScope = scopeProps[`__scope${scopeName}`];
|
|
7918
|
-
return { ...nextScopes2, ...currentScope };
|
|
7919
|
-
}, {});
|
|
7920
|
-
return React__namespace.useMemo(() => ({ [`__scope${baseScope.scopeName}`]: nextScopes }), [nextScopes]);
|
|
7921
|
-
};
|
|
7922
|
-
};
|
|
7923
|
-
createScope.scopeName = baseScope.scopeName;
|
|
7924
|
-
return createScope;
|
|
7925
|
-
}
|
|
7926
|
-
var NODES = [
|
|
7927
|
-
"a",
|
|
7928
|
-
"button",
|
|
7929
|
-
"div",
|
|
7930
|
-
"form",
|
|
7931
|
-
"h2",
|
|
7932
|
-
"h3",
|
|
7933
|
-
"img",
|
|
7934
|
-
"input",
|
|
7935
|
-
"label",
|
|
7936
|
-
"li",
|
|
7937
|
-
"nav",
|
|
7938
|
-
"ol",
|
|
7939
|
-
"p",
|
|
7940
|
-
"span",
|
|
7941
|
-
"svg",
|
|
7942
|
-
"ul"
|
|
7943
|
-
];
|
|
7944
|
-
var Primitive = NODES.reduce((primitive, node) => {
|
|
7945
|
-
const Node2 = React__namespace.forwardRef((props, forwardedRef) => {
|
|
7946
|
-
const { asChild, ...primitiveProps } = props;
|
|
7947
|
-
const Comp = asChild ? reactSlot.Slot : node;
|
|
7948
|
-
if (typeof window !== "undefined") {
|
|
7949
|
-
window[Symbol.for("radix-ui")] = true;
|
|
7950
|
-
}
|
|
7951
|
-
return /* @__PURE__ */ jsxRuntime.jsx(Comp, { ...primitiveProps, ref: forwardedRef });
|
|
7952
|
-
});
|
|
7953
|
-
Node2.displayName = `Primitive.${node}`;
|
|
7954
|
-
return { ...primitive, [node]: Node2 };
|
|
7955
|
-
}, {});
|
|
7956
|
-
function composeEventHandlers(originalEventHandler, ourEventHandler, { checkForDefaultPrevented = true } = {}) {
|
|
7957
|
-
return function handleEvent(event) {
|
|
7958
|
-
originalEventHandler == null ? void 0 : originalEventHandler(event);
|
|
7959
|
-
if (checkForDefaultPrevented === false || !event.defaultPrevented) {
|
|
7960
|
-
return ourEventHandler == null ? void 0 : ourEventHandler(event);
|
|
7961
|
-
}
|
|
7962
|
-
};
|
|
7963
|
-
}
|
|
7964
|
-
function setRef(ref, value) {
|
|
7965
|
-
if (typeof ref === "function") {
|
|
7966
|
-
return ref(value);
|
|
7967
|
-
} else if (ref !== null && ref !== void 0) {
|
|
7968
|
-
ref.current = value;
|
|
7969
|
-
}
|
|
7970
|
-
}
|
|
7971
|
-
function composeRefs(...refs) {
|
|
7972
|
-
return (node) => {
|
|
7973
|
-
let hasCleanup = false;
|
|
7974
|
-
const cleanups = refs.map((ref) => {
|
|
7975
|
-
const cleanup = setRef(ref, node);
|
|
7976
|
-
if (!hasCleanup && typeof cleanup == "function") {
|
|
7977
|
-
hasCleanup = true;
|
|
7978
|
-
}
|
|
7979
|
-
return cleanup;
|
|
7980
|
-
});
|
|
7981
|
-
if (hasCleanup) {
|
|
7982
|
-
return () => {
|
|
7983
|
-
for (let i = 0; i < cleanups.length; i++) {
|
|
7984
|
-
const cleanup = cleanups[i];
|
|
7985
|
-
if (typeof cleanup == "function") {
|
|
7986
|
-
cleanup();
|
|
7987
|
-
} else {
|
|
7988
|
-
setRef(refs[i], null);
|
|
7989
|
-
}
|
|
7990
|
-
}
|
|
7991
|
-
};
|
|
7992
|
-
}
|
|
7993
|
-
};
|
|
7994
|
-
}
|
|
7995
|
-
function useComposedRefs(...refs) {
|
|
7996
|
-
return React__namespace.useCallback(composeRefs(...refs), refs);
|
|
7997
|
-
}
|
|
7998
|
-
function createCollection(name) {
|
|
7999
|
-
const PROVIDER_NAME = name + "CollectionProvider";
|
|
8000
|
-
const [createCollectionContext, createCollectionScope2] = createContextScope(PROVIDER_NAME);
|
|
8001
|
-
const [CollectionProviderImpl, useCollectionContext] = createCollectionContext(
|
|
8002
|
-
PROVIDER_NAME,
|
|
8003
|
-
{ collectionRef: { current: null }, itemMap: /* @__PURE__ */ new Map() }
|
|
8004
|
-
);
|
|
8005
|
-
const CollectionProvider = (props) => {
|
|
8006
|
-
const { scope, children } = props;
|
|
8007
|
-
const ref = React.useRef(null);
|
|
8008
|
-
const itemMap = React.useRef(/* @__PURE__ */ new Map()).current;
|
|
8009
|
-
return /* @__PURE__ */ jsxRuntime.jsx(CollectionProviderImpl, { scope, itemMap, collectionRef: ref, children });
|
|
8010
|
-
};
|
|
8011
|
-
CollectionProvider.displayName = PROVIDER_NAME;
|
|
8012
|
-
const COLLECTION_SLOT_NAME = name + "CollectionSlot";
|
|
8013
|
-
const CollectionSlot = React.forwardRef(
|
|
8014
|
-
(props, forwardedRef) => {
|
|
8015
|
-
const { scope, children } = props;
|
|
8016
|
-
const context = useCollectionContext(COLLECTION_SLOT_NAME, scope);
|
|
8017
|
-
const composedRefs = useComposedRefs(forwardedRef, context.collectionRef);
|
|
8018
|
-
return /* @__PURE__ */ jsxRuntime.jsx(reactSlot.Slot, { ref: composedRefs, children });
|
|
8019
|
-
}
|
|
8020
|
-
);
|
|
8021
|
-
CollectionSlot.displayName = COLLECTION_SLOT_NAME;
|
|
8022
|
-
const ITEM_SLOT_NAME = name + "CollectionItemSlot";
|
|
8023
|
-
const ITEM_DATA_ATTR = "data-radix-collection-item";
|
|
8024
|
-
const CollectionItemSlot = React.forwardRef(
|
|
8025
|
-
(props, forwardedRef) => {
|
|
8026
|
-
const { scope, children, ...itemData } = props;
|
|
8027
|
-
const ref = React.useRef(null);
|
|
8028
|
-
const composedRefs = useComposedRefs(forwardedRef, ref);
|
|
8029
|
-
const context = useCollectionContext(ITEM_SLOT_NAME, scope);
|
|
8030
|
-
React.useEffect(() => {
|
|
8031
|
-
context.itemMap.set(ref, { ref, ...itemData });
|
|
8032
|
-
return () => void context.itemMap.delete(ref);
|
|
8033
|
-
});
|
|
8034
|
-
return /* @__PURE__ */ jsxRuntime.jsx(reactSlot.Slot, { ...{ [ITEM_DATA_ATTR]: "" }, ref: composedRefs, children });
|
|
8035
|
-
}
|
|
8036
|
-
);
|
|
8037
|
-
CollectionItemSlot.displayName = ITEM_SLOT_NAME;
|
|
8038
|
-
function useCollection2(scope) {
|
|
8039
|
-
const context = useCollectionContext(name + "CollectionConsumer", scope);
|
|
8040
|
-
const getItems = React.useCallback(() => {
|
|
8041
|
-
const collectionNode = context.collectionRef.current;
|
|
8042
|
-
if (!collectionNode) return [];
|
|
8043
|
-
const orderedNodes = Array.from(collectionNode.querySelectorAll(`[${ITEM_DATA_ATTR}]`));
|
|
8044
|
-
const items = Array.from(context.itemMap.values());
|
|
8045
|
-
const orderedItems = items.sort(
|
|
8046
|
-
(a, b) => orderedNodes.indexOf(a.ref.current) - orderedNodes.indexOf(b.ref.current)
|
|
8047
|
-
);
|
|
8048
|
-
return orderedItems;
|
|
8049
|
-
}, [context.collectionRef, context.itemMap]);
|
|
8050
|
-
return getItems;
|
|
8051
|
-
}
|
|
8052
|
-
return [
|
|
8053
|
-
{ Provider: CollectionProvider, Slot: CollectionSlot, ItemSlot: CollectionItemSlot },
|
|
8054
|
-
useCollection2,
|
|
8055
|
-
createCollectionScope2
|
|
8056
|
-
];
|
|
8057
|
-
}
|
|
8058
|
-
var useLayoutEffect2 = Boolean(globalThis == null ? void 0 : globalThis.document) ? React__namespace.useLayoutEffect : () => {
|
|
8059
|
-
};
|
|
8060
|
-
var useReactId = React__namespace["useId".toString()] || (() => void 0);
|
|
8061
|
-
var count = 0;
|
|
8062
|
-
function useId(deterministicId) {
|
|
8063
|
-
const [id, setId] = React__namespace.useState(useReactId());
|
|
8064
|
-
useLayoutEffect2(() => {
|
|
8065
|
-
setId((reactId) => reactId ?? String(count++));
|
|
8066
|
-
}, [deterministicId]);
|
|
8067
|
-
return id ? `radix-${id}` : "";
|
|
8068
|
-
}
|
|
8069
|
-
function useCallbackRef(callback) {
|
|
8070
|
-
const callbackRef = React__namespace.useRef(callback);
|
|
8071
|
-
React__namespace.useEffect(() => {
|
|
8072
|
-
callbackRef.current = callback;
|
|
8073
|
-
});
|
|
8074
|
-
return React__namespace.useMemo(() => (...args) => {
|
|
8075
|
-
var _a;
|
|
8076
|
-
return (_a = callbackRef.current) == null ? void 0 : _a.call(callbackRef, ...args);
|
|
8077
|
-
}, []);
|
|
8078
|
-
}
|
|
8079
|
-
function useControllableState({
|
|
8080
|
-
prop,
|
|
8081
|
-
defaultProp,
|
|
8082
|
-
onChange = () => {
|
|
8083
|
-
}
|
|
8084
|
-
}) {
|
|
8085
|
-
const [uncontrolledProp, setUncontrolledProp] = useUncontrolledState({ defaultProp, onChange });
|
|
8086
|
-
const isControlled = prop !== void 0;
|
|
8087
|
-
const value = isControlled ? prop : uncontrolledProp;
|
|
8088
|
-
const handleChange = useCallbackRef(onChange);
|
|
8089
|
-
const setValue = React__namespace.useCallback(
|
|
8090
|
-
(nextValue) => {
|
|
8091
|
-
if (isControlled) {
|
|
8092
|
-
const setter = nextValue;
|
|
8093
|
-
const value2 = typeof nextValue === "function" ? setter(prop) : nextValue;
|
|
8094
|
-
if (value2 !== prop) handleChange(value2);
|
|
8095
|
-
} else {
|
|
8096
|
-
setUncontrolledProp(nextValue);
|
|
8097
|
-
}
|
|
8098
|
-
},
|
|
8099
|
-
[isControlled, prop, setUncontrolledProp, handleChange]
|
|
8100
|
-
);
|
|
8101
|
-
return [value, setValue];
|
|
8102
|
-
}
|
|
8103
|
-
function useUncontrolledState({
|
|
8104
|
-
defaultProp,
|
|
8105
|
-
onChange
|
|
8106
|
-
}) {
|
|
8107
|
-
const uncontrolledState = React__namespace.useState(defaultProp);
|
|
8108
|
-
const [value] = uncontrolledState;
|
|
8109
|
-
const prevValueRef = React__namespace.useRef(value);
|
|
8110
|
-
const handleChange = useCallbackRef(onChange);
|
|
8111
|
-
React__namespace.useEffect(() => {
|
|
8112
|
-
if (prevValueRef.current !== value) {
|
|
8113
|
-
handleChange(value);
|
|
8114
|
-
prevValueRef.current = value;
|
|
8115
|
-
}
|
|
8116
|
-
}, [value, prevValueRef, handleChange]);
|
|
8117
|
-
return uncontrolledState;
|
|
8118
|
-
}
|
|
8119
|
-
var DirectionContext = React__namespace.createContext(void 0);
|
|
8120
|
-
function useDirection(localDir) {
|
|
8121
|
-
const globalDir = React__namespace.useContext(DirectionContext);
|
|
8122
|
-
return localDir || globalDir || "ltr";
|
|
8123
|
-
}
|
|
8124
|
-
var ENTRY_FOCUS = "rovingFocusGroup.onEntryFocus";
|
|
8125
|
-
var EVENT_OPTIONS = { bubbles: false, cancelable: true };
|
|
8126
|
-
var GROUP_NAME = "RovingFocusGroup";
|
|
8127
|
-
var [Collection, useCollection, createCollectionScope] = createCollection(GROUP_NAME);
|
|
8128
|
-
var [createRovingFocusGroupContext, createRovingFocusGroupScope] = createContextScope(
|
|
8129
|
-
GROUP_NAME,
|
|
8130
|
-
[createCollectionScope]
|
|
8131
|
-
);
|
|
8132
|
-
var [RovingFocusProvider, useRovingFocusContext] = createRovingFocusGroupContext(GROUP_NAME);
|
|
8133
|
-
var RovingFocusGroup = React__namespace.forwardRef(
|
|
8134
|
-
(props, forwardedRef) => {
|
|
8135
|
-
return /* @__PURE__ */ jsxRuntime.jsx(Collection.Provider, { scope: props.__scopeRovingFocusGroup, children: /* @__PURE__ */ jsxRuntime.jsx(Collection.Slot, { scope: props.__scopeRovingFocusGroup, children: /* @__PURE__ */ jsxRuntime.jsx(RovingFocusGroupImpl, { ...props, ref: forwardedRef }) }) });
|
|
8136
|
-
}
|
|
8137
|
-
);
|
|
8138
|
-
RovingFocusGroup.displayName = GROUP_NAME;
|
|
8139
|
-
var RovingFocusGroupImpl = React__namespace.forwardRef((props, forwardedRef) => {
|
|
8140
|
-
const {
|
|
8141
|
-
__scopeRovingFocusGroup,
|
|
8142
|
-
orientation,
|
|
8143
|
-
loop = false,
|
|
8144
|
-
dir,
|
|
8145
|
-
currentTabStopId: currentTabStopIdProp,
|
|
8146
|
-
defaultCurrentTabStopId,
|
|
8147
|
-
onCurrentTabStopIdChange,
|
|
8148
|
-
onEntryFocus,
|
|
8149
|
-
preventScrollOnEntryFocus = false,
|
|
8150
|
-
...groupProps
|
|
8151
|
-
} = props;
|
|
8152
|
-
const ref = React__namespace.useRef(null);
|
|
8153
|
-
const composedRefs = useComposedRefs(forwardedRef, ref);
|
|
8154
|
-
const direction = useDirection(dir);
|
|
8155
|
-
const [currentTabStopId = null, setCurrentTabStopId] = useControllableState({
|
|
8156
|
-
prop: currentTabStopIdProp,
|
|
8157
|
-
defaultProp: defaultCurrentTabStopId,
|
|
8158
|
-
onChange: onCurrentTabStopIdChange
|
|
8159
|
-
});
|
|
8160
|
-
const [isTabbingBackOut, setIsTabbingBackOut] = React__namespace.useState(false);
|
|
8161
|
-
const handleEntryFocus = useCallbackRef(onEntryFocus);
|
|
8162
|
-
const getItems = useCollection(__scopeRovingFocusGroup);
|
|
8163
|
-
const isClickFocusRef = React__namespace.useRef(false);
|
|
8164
|
-
const [focusableItemsCount, setFocusableItemsCount] = React__namespace.useState(0);
|
|
8165
|
-
React__namespace.useEffect(() => {
|
|
8166
|
-
const node = ref.current;
|
|
8167
|
-
if (node) {
|
|
8168
|
-
node.addEventListener(ENTRY_FOCUS, handleEntryFocus);
|
|
8169
|
-
return () => node.removeEventListener(ENTRY_FOCUS, handleEntryFocus);
|
|
8170
|
-
}
|
|
8171
|
-
}, [handleEntryFocus]);
|
|
8172
|
-
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
8173
|
-
RovingFocusProvider,
|
|
8174
|
-
{
|
|
8175
|
-
scope: __scopeRovingFocusGroup,
|
|
8176
|
-
orientation,
|
|
8177
|
-
dir: direction,
|
|
8178
|
-
loop,
|
|
8179
|
-
currentTabStopId,
|
|
8180
|
-
onItemFocus: React__namespace.useCallback(
|
|
8181
|
-
(tabStopId) => setCurrentTabStopId(tabStopId),
|
|
8182
|
-
[setCurrentTabStopId]
|
|
8183
|
-
),
|
|
8184
|
-
onItemShiftTab: React__namespace.useCallback(() => setIsTabbingBackOut(true), []),
|
|
8185
|
-
onFocusableItemAdd: React__namespace.useCallback(
|
|
8186
|
-
() => setFocusableItemsCount((prevCount) => prevCount + 1),
|
|
8187
|
-
[]
|
|
8188
|
-
),
|
|
8189
|
-
onFocusableItemRemove: React__namespace.useCallback(
|
|
8190
|
-
() => setFocusableItemsCount((prevCount) => prevCount - 1),
|
|
8191
|
-
[]
|
|
8192
|
-
),
|
|
8193
|
-
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
8194
|
-
Primitive.div,
|
|
8195
|
-
{
|
|
8196
|
-
tabIndex: isTabbingBackOut || focusableItemsCount === 0 ? -1 : 0,
|
|
8197
|
-
"data-orientation": orientation,
|
|
8198
|
-
...groupProps,
|
|
8199
|
-
ref: composedRefs,
|
|
8200
|
-
style: { outline: "none", ...props.style },
|
|
8201
|
-
onMouseDown: composeEventHandlers(props.onMouseDown, () => {
|
|
8202
|
-
isClickFocusRef.current = true;
|
|
8203
|
-
}),
|
|
8204
|
-
onFocus: composeEventHandlers(props.onFocus, (event) => {
|
|
8205
|
-
const isKeyboardFocus = !isClickFocusRef.current;
|
|
8206
|
-
if (event.target === event.currentTarget && isKeyboardFocus && !isTabbingBackOut) {
|
|
8207
|
-
const entryFocusEvent = new CustomEvent(ENTRY_FOCUS, EVENT_OPTIONS);
|
|
8208
|
-
event.currentTarget.dispatchEvent(entryFocusEvent);
|
|
8209
|
-
if (!entryFocusEvent.defaultPrevented) {
|
|
8210
|
-
const items = getItems().filter((item) => item.focusable);
|
|
8211
|
-
const activeItem = items.find((item) => item.active);
|
|
8212
|
-
const currentItem = items.find((item) => item.id === currentTabStopId);
|
|
8213
|
-
const candidateItems = [activeItem, currentItem, ...items].filter(
|
|
8214
|
-
Boolean
|
|
8215
|
-
);
|
|
8216
|
-
const candidateNodes = candidateItems.map((item) => item.ref.current);
|
|
8217
|
-
focusFirst(candidateNodes, preventScrollOnEntryFocus);
|
|
8218
|
-
}
|
|
8219
|
-
}
|
|
8220
|
-
isClickFocusRef.current = false;
|
|
8221
|
-
}),
|
|
8222
|
-
onBlur: composeEventHandlers(props.onBlur, () => setIsTabbingBackOut(false))
|
|
8223
|
-
}
|
|
8224
|
-
)
|
|
8225
|
-
}
|
|
8226
|
-
);
|
|
8227
|
-
});
|
|
8228
|
-
var ITEM_NAME$1 = "RovingFocusGroupItem";
|
|
8229
|
-
var RovingFocusGroupItem = React__namespace.forwardRef(
|
|
8230
|
-
(props, forwardedRef) => {
|
|
8231
|
-
const {
|
|
8232
|
-
__scopeRovingFocusGroup,
|
|
8233
|
-
focusable = true,
|
|
8234
|
-
active = false,
|
|
8235
|
-
tabStopId,
|
|
8236
|
-
...itemProps
|
|
8237
|
-
} = props;
|
|
8238
|
-
const autoId = useId();
|
|
8239
|
-
const id = tabStopId || autoId;
|
|
8240
|
-
const context = useRovingFocusContext(ITEM_NAME$1, __scopeRovingFocusGroup);
|
|
8241
|
-
const isCurrentTabStop = context.currentTabStopId === id;
|
|
8242
|
-
const getItems = useCollection(__scopeRovingFocusGroup);
|
|
8243
|
-
const { onFocusableItemAdd, onFocusableItemRemove } = context;
|
|
8244
|
-
React__namespace.useEffect(() => {
|
|
8245
|
-
if (focusable) {
|
|
8246
|
-
onFocusableItemAdd();
|
|
8247
|
-
return () => onFocusableItemRemove();
|
|
8248
|
-
}
|
|
8249
|
-
}, [focusable, onFocusableItemAdd, onFocusableItemRemove]);
|
|
8250
|
-
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
8251
|
-
Collection.ItemSlot,
|
|
8252
|
-
{
|
|
8253
|
-
scope: __scopeRovingFocusGroup,
|
|
8254
|
-
id,
|
|
8255
|
-
focusable,
|
|
8256
|
-
active,
|
|
8257
|
-
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
8258
|
-
Primitive.span,
|
|
8259
|
-
{
|
|
8260
|
-
tabIndex: isCurrentTabStop ? 0 : -1,
|
|
8261
|
-
"data-orientation": context.orientation,
|
|
8262
|
-
...itemProps,
|
|
8263
|
-
ref: forwardedRef,
|
|
8264
|
-
onMouseDown: composeEventHandlers(props.onMouseDown, (event) => {
|
|
8265
|
-
if (!focusable) event.preventDefault();
|
|
8266
|
-
else context.onItemFocus(id);
|
|
8267
|
-
}),
|
|
8268
|
-
onFocus: composeEventHandlers(props.onFocus, () => context.onItemFocus(id)),
|
|
8269
|
-
onKeyDown: composeEventHandlers(props.onKeyDown, (event) => {
|
|
8270
|
-
if (event.key === "Tab" && event.shiftKey) {
|
|
8271
|
-
context.onItemShiftTab();
|
|
8272
|
-
return;
|
|
8273
|
-
}
|
|
8274
|
-
if (event.target !== event.currentTarget) return;
|
|
8275
|
-
const focusIntent = getFocusIntent(event, context.orientation, context.dir);
|
|
8276
|
-
if (focusIntent !== void 0) {
|
|
8277
|
-
if (event.metaKey || event.ctrlKey || event.altKey || event.shiftKey) return;
|
|
8278
|
-
event.preventDefault();
|
|
8279
|
-
const items = getItems().filter((item) => item.focusable);
|
|
8280
|
-
let candidateNodes = items.map((item) => item.ref.current);
|
|
8281
|
-
if (focusIntent === "last") candidateNodes.reverse();
|
|
8282
|
-
else if (focusIntent === "prev" || focusIntent === "next") {
|
|
8283
|
-
if (focusIntent === "prev") candidateNodes.reverse();
|
|
8284
|
-
const currentIndex = candidateNodes.indexOf(event.currentTarget);
|
|
8285
|
-
candidateNodes = context.loop ? wrapArray(candidateNodes, currentIndex + 1) : candidateNodes.slice(currentIndex + 1);
|
|
8286
|
-
}
|
|
8287
|
-
setTimeout(() => focusFirst(candidateNodes));
|
|
8288
|
-
}
|
|
8289
|
-
})
|
|
8290
|
-
}
|
|
8291
|
-
)
|
|
8292
|
-
}
|
|
8293
|
-
);
|
|
8294
|
-
}
|
|
8295
|
-
);
|
|
8296
|
-
RovingFocusGroupItem.displayName = ITEM_NAME$1;
|
|
8297
|
-
var MAP_KEY_TO_FOCUS_INTENT = {
|
|
8298
|
-
ArrowLeft: "prev",
|
|
8299
|
-
ArrowUp: "prev",
|
|
8300
|
-
ArrowRight: "next",
|
|
8301
|
-
ArrowDown: "next",
|
|
8302
|
-
PageUp: "first",
|
|
8303
|
-
Home: "first",
|
|
8304
|
-
PageDown: "last",
|
|
8305
|
-
End: "last"
|
|
8306
|
-
};
|
|
8307
|
-
function getDirectionAwareKey(key, dir) {
|
|
8308
|
-
if (dir !== "rtl") return key;
|
|
8309
|
-
return key === "ArrowLeft" ? "ArrowRight" : key === "ArrowRight" ? "ArrowLeft" : key;
|
|
8310
|
-
}
|
|
8311
|
-
function getFocusIntent(event, orientation, dir) {
|
|
8312
|
-
const key = getDirectionAwareKey(event.key, dir);
|
|
8313
|
-
if (orientation === "vertical" && ["ArrowLeft", "ArrowRight"].includes(key)) return void 0;
|
|
8314
|
-
if (orientation === "horizontal" && ["ArrowUp", "ArrowDown"].includes(key)) return void 0;
|
|
8315
|
-
return MAP_KEY_TO_FOCUS_INTENT[key];
|
|
8316
|
-
}
|
|
8317
|
-
function focusFirst(candidates, preventScroll = false) {
|
|
8318
|
-
const PREVIOUSLY_FOCUSED_ELEMENT = document.activeElement;
|
|
8319
|
-
for (const candidate of candidates) {
|
|
8320
|
-
if (candidate === PREVIOUSLY_FOCUSED_ELEMENT) return;
|
|
8321
|
-
candidate.focus({ preventScroll });
|
|
8322
|
-
if (document.activeElement !== PREVIOUSLY_FOCUSED_ELEMENT) return;
|
|
8323
|
-
}
|
|
8324
|
-
}
|
|
8325
|
-
function wrapArray(array, startIndex) {
|
|
8326
|
-
return array.map((_, index2) => array[(startIndex + index2) % array.length]);
|
|
8327
|
-
}
|
|
8328
|
-
var Root = RovingFocusGroup;
|
|
8329
|
-
var Item = RovingFocusGroupItem;
|
|
8330
|
-
var TOGGLE_GROUP_NAME = "ToggleGroup";
|
|
8331
|
-
var [createToggleGroupContext, createToggleGroupScope] = createContextScope(TOGGLE_GROUP_NAME, [
|
|
8332
|
-
createRovingFocusGroupScope
|
|
8333
|
-
]);
|
|
8334
|
-
var useRovingFocusGroupScope = createRovingFocusGroupScope();
|
|
8335
|
-
var ToggleGroup = React.forwardRef((props, forwardedRef) => {
|
|
8336
|
-
const { type, ...toggleGroupProps } = props;
|
|
8337
|
-
if (type === "single") {
|
|
8338
|
-
const singleProps = toggleGroupProps;
|
|
8339
|
-
return /* @__PURE__ */ jsxRuntime.jsx(ToggleGroupImplSingle, { ...singleProps, ref: forwardedRef });
|
|
8340
|
-
}
|
|
8341
|
-
if (type === "multiple") {
|
|
8342
|
-
const multipleProps = toggleGroupProps;
|
|
8343
|
-
return /* @__PURE__ */ jsxRuntime.jsx(ToggleGroupImplMultiple, { ...multipleProps, ref: forwardedRef });
|
|
8344
|
-
}
|
|
8345
|
-
throw new Error(`Missing prop \`type\` expected on \`${TOGGLE_GROUP_NAME}\``);
|
|
8346
|
-
});
|
|
8347
|
-
ToggleGroup.displayName = TOGGLE_GROUP_NAME;
|
|
8348
|
-
var [ToggleGroupValueProvider, useToggleGroupValueContext] = createToggleGroupContext(TOGGLE_GROUP_NAME);
|
|
8349
|
-
var ToggleGroupImplSingle = React.forwardRef((props, forwardedRef) => {
|
|
8350
|
-
const {
|
|
8351
|
-
value: valueProp,
|
|
8352
|
-
defaultValue,
|
|
8353
|
-
onValueChange = () => {
|
|
8354
|
-
},
|
|
8355
|
-
...toggleGroupSingleProps
|
|
8356
|
-
} = props;
|
|
8357
|
-
const [value, setValue] = useControllableState({
|
|
8358
|
-
prop: valueProp,
|
|
8359
|
-
defaultProp: defaultValue,
|
|
8360
|
-
onChange: onValueChange
|
|
8361
|
-
});
|
|
8362
|
-
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
8363
|
-
ToggleGroupValueProvider,
|
|
8364
|
-
{
|
|
8365
|
-
scope: props.__scopeToggleGroup,
|
|
8366
|
-
type: "single",
|
|
8367
|
-
value: value ? [value] : [],
|
|
8368
|
-
onItemActivate: setValue,
|
|
8369
|
-
onItemDeactivate: React.useCallback(() => setValue(""), [setValue]),
|
|
8370
|
-
children: /* @__PURE__ */ jsxRuntime.jsx(ToggleGroupImpl, { ...toggleGroupSingleProps, ref: forwardedRef })
|
|
8371
|
-
}
|
|
8372
|
-
);
|
|
8373
|
-
});
|
|
8374
|
-
var ToggleGroupImplMultiple = React.forwardRef((props, forwardedRef) => {
|
|
8375
|
-
const {
|
|
8376
|
-
value: valueProp,
|
|
8377
|
-
defaultValue,
|
|
8378
|
-
onValueChange = () => {
|
|
8379
|
-
},
|
|
8380
|
-
...toggleGroupMultipleProps
|
|
8381
|
-
} = props;
|
|
8382
|
-
const [value = [], setValue] = useControllableState({
|
|
8383
|
-
prop: valueProp,
|
|
8384
|
-
defaultProp: defaultValue,
|
|
8385
|
-
onChange: onValueChange
|
|
8386
|
-
});
|
|
8387
|
-
const handleButtonActivate = React.useCallback(
|
|
8388
|
-
(itemValue) => setValue((prevValue = []) => [...prevValue, itemValue]),
|
|
8389
|
-
[setValue]
|
|
8390
|
-
);
|
|
8391
|
-
const handleButtonDeactivate = React.useCallback(
|
|
8392
|
-
(itemValue) => setValue((prevValue = []) => prevValue.filter((value2) => value2 !== itemValue)),
|
|
8393
|
-
[setValue]
|
|
8394
|
-
);
|
|
8395
|
-
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
8396
|
-
ToggleGroupValueProvider,
|
|
8397
|
-
{
|
|
8398
|
-
scope: props.__scopeToggleGroup,
|
|
8399
|
-
type: "multiple",
|
|
8400
|
-
value,
|
|
8401
|
-
onItemActivate: handleButtonActivate,
|
|
8402
|
-
onItemDeactivate: handleButtonDeactivate,
|
|
8403
|
-
children: /* @__PURE__ */ jsxRuntime.jsx(ToggleGroupImpl, { ...toggleGroupMultipleProps, ref: forwardedRef })
|
|
8404
|
-
}
|
|
8405
|
-
);
|
|
8406
|
-
});
|
|
8407
|
-
ToggleGroup.displayName = TOGGLE_GROUP_NAME;
|
|
8408
|
-
var [ToggleGroupContext, useToggleGroupContext] = createToggleGroupContext(TOGGLE_GROUP_NAME);
|
|
8409
|
-
var ToggleGroupImpl = React.forwardRef(
|
|
8410
|
-
(props, forwardedRef) => {
|
|
8411
|
-
const {
|
|
8412
|
-
__scopeToggleGroup,
|
|
8413
|
-
disabled = false,
|
|
8414
|
-
rovingFocus = true,
|
|
8415
|
-
orientation,
|
|
8416
|
-
dir,
|
|
8417
|
-
loop = true,
|
|
8418
|
-
...toggleGroupProps
|
|
8419
|
-
} = props;
|
|
8420
|
-
const rovingFocusGroupScope = useRovingFocusGroupScope(__scopeToggleGroup);
|
|
8421
|
-
const direction = useDirection(dir);
|
|
8422
|
-
const commonProps = { role: "group", dir: direction, ...toggleGroupProps };
|
|
8423
|
-
return /* @__PURE__ */ jsxRuntime.jsx(ToggleGroupContext, { scope: __scopeToggleGroup, rovingFocus, disabled, children: rovingFocus ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
8424
|
-
Root,
|
|
8425
|
-
{
|
|
8426
|
-
asChild: true,
|
|
8427
|
-
...rovingFocusGroupScope,
|
|
8428
|
-
orientation,
|
|
8429
|
-
dir: direction,
|
|
8430
|
-
loop,
|
|
8431
|
-
children: /* @__PURE__ */ jsxRuntime.jsx(Primitive.div, { ...commonProps, ref: forwardedRef })
|
|
8432
|
-
}
|
|
8433
|
-
) : /* @__PURE__ */ jsxRuntime.jsx(Primitive.div, { ...commonProps, ref: forwardedRef }) });
|
|
8434
|
-
}
|
|
8435
|
-
);
|
|
8436
|
-
var ITEM_NAME = "ToggleGroupItem";
|
|
8437
|
-
var ToggleGroupItem = React.forwardRef(
|
|
8438
|
-
(props, forwardedRef) => {
|
|
8439
|
-
const valueContext = useToggleGroupValueContext(ITEM_NAME, props.__scopeToggleGroup);
|
|
8440
|
-
const context = useToggleGroupContext(ITEM_NAME, props.__scopeToggleGroup);
|
|
8441
|
-
const rovingFocusGroupScope = useRovingFocusGroupScope(props.__scopeToggleGroup);
|
|
8442
|
-
const pressed = valueContext.value.includes(props.value);
|
|
8443
|
-
const disabled = context.disabled || props.disabled;
|
|
8444
|
-
const commonProps = { ...props, pressed, disabled };
|
|
8445
|
-
const ref = React.useRef(null);
|
|
8446
|
-
return context.rovingFocus ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
8447
|
-
Item,
|
|
8448
|
-
{
|
|
8449
|
-
asChild: true,
|
|
8450
|
-
...rovingFocusGroupScope,
|
|
8451
|
-
focusable: !disabled,
|
|
8452
|
-
active: pressed,
|
|
8453
|
-
ref,
|
|
8454
|
-
children: /* @__PURE__ */ jsxRuntime.jsx(ToggleGroupItemImpl, { ...commonProps, ref: forwardedRef })
|
|
8455
|
-
}
|
|
8456
|
-
) : /* @__PURE__ */ jsxRuntime.jsx(ToggleGroupItemImpl, { ...commonProps, ref: forwardedRef });
|
|
8457
|
-
}
|
|
8458
|
-
);
|
|
8459
|
-
ToggleGroupItem.displayName = ITEM_NAME;
|
|
8460
|
-
var ToggleGroupItemImpl = React.forwardRef(
|
|
8461
|
-
(props, forwardedRef) => {
|
|
8462
|
-
const { __scopeToggleGroup, value, ...itemProps } = props;
|
|
8463
|
-
const valueContext = useToggleGroupValueContext(ITEM_NAME, __scopeToggleGroup);
|
|
8464
|
-
const singleProps = { role: "radio", "aria-checked": props.pressed, "aria-pressed": void 0 };
|
|
8465
|
-
const typeProps = valueContext.type === "single" ? singleProps : void 0;
|
|
8466
|
-
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
8467
|
-
Toggle.Toggle,
|
|
8468
|
-
{
|
|
8469
|
-
...typeProps,
|
|
8470
|
-
...itemProps,
|
|
8471
|
-
ref: forwardedRef,
|
|
8472
|
-
onPressedChange: (pressed) => {
|
|
8473
|
-
if (pressed) {
|
|
8474
|
-
valueContext.onItemActivate(value);
|
|
8475
|
-
} else {
|
|
8476
|
-
valueContext.onItemDeactivate(value);
|
|
8477
|
-
}
|
|
8478
|
-
}
|
|
8479
|
-
}
|
|
8480
|
-
);
|
|
8481
|
-
}
|
|
8482
|
-
);
|
|
8483
|
-
var Root2 = ToggleGroup;
|
|
8484
|
-
var Item2 = ToggleGroupItem;
|
|
8485
7867
|
const segmentedControlRootCva = classVarianceAuthority.cva(["shrink-0", "transition-colors", "flex"], {
|
|
8486
7868
|
variants: {
|
|
8487
7869
|
variant: {
|
|
@@ -8619,7 +8001,7 @@
|
|
|
8619
8001
|
const { className, ...rest } = props;
|
|
8620
8002
|
const { size: size2, radius, variant, icon } = useSegmentedControl();
|
|
8621
8003
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
8622
|
-
|
|
8004
|
+
RadixToggleGroup__namespace.Item,
|
|
8623
8005
|
{
|
|
8624
8006
|
ref,
|
|
8625
8007
|
className: classVarianceAuthority.cx(
|
|
@@ -8645,7 +8027,7 @@
|
|
|
8645
8027
|
...rest
|
|
8646
8028
|
} = props;
|
|
8647
8029
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
8648
|
-
|
|
8030
|
+
RadixToggleGroup__namespace.Root,
|
|
8649
8031
|
{
|
|
8650
8032
|
ref,
|
|
8651
8033
|
className: classVarianceAuthority.cx(
|