@overmap-ai/blocks 1.0.40-improvements.1 → 1.0.40
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/ButtonGroup/ButtonGroup.d.ts +2 -1
- package/dist/ButtonGroup/context.d.ts +7 -2
- package/dist/CheckboxGroup/context.d.ts +6 -2
- package/dist/CheckboxGroup/utils.d.ts +1 -0
- package/dist/CheckedIndicator/CheckedIndicator.d.ts +3 -4
- package/dist/CollapsibleTree/CollapsibleTree.d.ts +5 -0
- package/dist/CollapsibleTree/context.d.ts +11 -0
- package/dist/CollapsibleTree/index.d.ts +2 -0
- package/dist/CollapsibleTree/typings.d.ts +58 -0
- package/dist/CommandMenu/CheckboxIndicator.d.ts +4 -2
- package/dist/CommandMenu/SelectedIndicator.d.ts +3 -2
- package/dist/CommandMenu/context.d.ts +3 -2
- package/dist/CommandMenu/utils.d.ts +4 -0
- package/dist/Heading/cva.d.ts +1 -1
- package/dist/HoverUtility/HoverUtility.d.ts +2 -2
- package/dist/Link/cva.d.ts +1 -1
- package/dist/Menu/{CheckboxItem.d.ts → CheckboxItem/CheckboxItem.d.ts} +1 -1
- package/dist/Menu/{CheckboxItemIndicator.d.ts → CheckboxItemIndicator/CheckboxItemIndicator.d.ts} +1 -1
- package/dist/Menu/{ClickTrigger.d.ts → ClickTrigger/ClickTrigger.d.ts} +1 -1
- package/dist/Menu/ClickTrigger/index.d.ts +1 -0
- package/dist/Menu/{Content.d.ts → Content/Content.d.ts} +1 -1
- package/dist/Menu/{menuContentContext.d.ts → Content/context.d.ts} +2 -2
- package/dist/Menu/Content/index.d.ts +2 -0
- package/dist/Menu/{ContextTrigger.d.ts → ContextTrigger/ContextTrigger.d.ts} +1 -1
- package/dist/Menu/ContextTrigger/index.d.ts +1 -0
- package/dist/Menu/{Group.d.ts → Group/Group.d.ts} +1 -1
- package/dist/Menu/Group/index.d.ts +1 -0
- package/dist/Menu/{InputField.d.ts → Input/Field.d.ts} +1 -1
- package/dist/Menu/{InputRoot.d.ts → Input/Root.d.ts} +1 -1
- package/dist/Menu/{InputSlot.d.ts → Input/Slot.d.ts} +1 -1
- package/dist/Menu/Input/index.d.ts +3 -0
- package/dist/Menu/{Item.d.ts → Item/Item.d.ts} +1 -1
- package/dist/Menu/Item/index.d.ts +1 -0
- package/dist/Menu/Label/index.d.ts +1 -0
- package/dist/Menu/{MultiSelectGroup.d.ts → MultiSelectGroup/MultiSelectGroup.d.ts} +1 -1
- package/dist/Menu/MultiSelectGroup/index.d.ts +1 -0
- package/dist/Menu/{MultiSelectItem.d.ts → MultiSelectItem/MultiSelectItem.d.ts} +1 -1
- package/dist/Menu/MultiSelectItem/index.d.ts +1 -0
- package/dist/Menu/PageContent/PageContent.d.ts +3 -0
- package/dist/Menu/PageContent/index.d.ts +1 -0
- package/dist/Menu/{PageTrigger.d.ts → PageTrigger/PageTrigger.d.ts} +1 -1
- package/dist/Menu/PageTrigger/index.d.ts +1 -0
- package/dist/Menu/{Pages.d.ts → Pages/Pages.d.ts} +1 -1
- package/dist/Menu/Pages/index.d.ts +2 -0
- package/dist/Menu/{Scroll.d.ts → Scroll/Scroll.d.ts} +1 -1
- package/dist/Menu/{SelectAllItem.d.ts → SelectAll/SelectAllItem.d.ts} +1 -1
- package/dist/Menu/SelectAll/index.d.ts +1 -0
- package/dist/Menu/{SelectGroup.d.ts → SelectGroup/SelectGroup.d.ts} +1 -1
- package/dist/Menu/SelectGroup/index.d.ts +1 -0
- package/dist/Menu/{SelectItem.d.ts → SelectItem/SelectItem.d.ts} +1 -1
- package/dist/Menu/SelectItem/index.d.ts +1 -0
- package/dist/Menu/SelectedIndicator/SelectedIndicator.d.ts +4 -0
- package/dist/{SelectedIndicator → Menu/SelectedIndicator}/context.d.ts +1 -0
- package/dist/Menu/SelectedIndicator/index.d.ts +2 -0
- package/dist/Menu/{Separator.d.ts → Separator/Separator.d.ts} +1 -1
- package/dist/Menu/Separator/index.d.ts +1 -0
- package/dist/Menu/{Sub.d.ts → Sub/Sub.d.ts} +1 -1
- package/dist/Menu/{subContentContext.d.ts → Sub/context.d.ts} +1 -1
- package/dist/Menu/Sub/index.d.ts +2 -0
- package/dist/Menu/{SubContent.d.ts → SubContent/SubContent.d.ts} +1 -1
- package/dist/Menu/SubContent/index.d.ts +1 -0
- package/dist/Menu/{SubTrigger.d.ts → SubTrigger/SubTrigger.d.ts} +1 -1
- package/dist/Menu/SubTrigger/index.d.ts +1 -0
- package/dist/Menu/{VirtualTrigger.d.ts → VirtualTrigger/VirtualTrigger.d.ts} +1 -1
- package/dist/Menu/VirtualTrigger/index.d.ts +1 -0
- package/dist/Menu/index.d.ts +7 -9
- package/dist/Menu/{Root.d.ts → root/Root.d.ts} +1 -1
- package/dist/Menu/{rootContext.d.ts → root/context.d.ts} +1 -1
- package/dist/Menu/root/index.d.ts +2 -0
- package/dist/Menu/utils.d.ts +6 -0
- package/dist/Rating/Item.d.ts +6 -0
- package/dist/Rating/ItemIndicator.d.ts +5 -0
- package/dist/Rating/Root.d.ts +8 -0
- package/dist/Rating/context.d.ts +9 -0
- package/dist/Rating/index.d.ts +9 -0
- package/dist/SlideOut/SlideOut.d.ts +2 -1
- package/dist/Text/cva.d.ts +1 -1
- package/dist/blocks.js +981 -1262
- package/dist/blocks.js.map +1 -1
- package/dist/blocks.umd.cjs +1050 -1331
- package/dist/blocks.umd.cjs.map +1 -1
- package/dist/index.d.ts +3 -3
- package/dist/typings.d.ts +5 -0
- package/dist/utils.d.ts +30 -7
- package/package.json +1 -1
- package/dist/Menu/PageContent.d.ts +0 -2
- package/dist/Menu/SelectedIndicator.d.ts +0 -4
- package/dist/MenuV2/CheckboxItem.d.ts +0 -6
- package/dist/MenuV2/CheckboxItemIndicator.d.ts +0 -3
- package/dist/MenuV2/Group.d.ts +0 -4
- package/dist/MenuV2/GroupLabel.d.ts +0 -4
- package/dist/MenuV2/Item.d.ts +0 -6
- package/dist/MenuV2/MultiSelectAllItem.d.ts +0 -4
- package/dist/MenuV2/MultiSelectGroup.d.ts +0 -5
- package/dist/MenuV2/MultiSelectItem.d.ts +0 -5
- package/dist/MenuV2/Page.d.ts +0 -5
- package/dist/MenuV2/PageTriggerItem.d.ts +0 -5
- package/dist/MenuV2/Pages.d.ts +0 -7
- package/dist/MenuV2/Root.d.ts +0 -6
- package/dist/MenuV2/SelectGroup.d.ts +0 -4
- package/dist/MenuV2/SelectItem.d.ts +0 -5
- package/dist/MenuV2/SelectedIndicator.d.ts +0 -3
- package/dist/MenuV2/Separator.d.ts +0 -5
- package/dist/MenuV2/constants.d.ts +0 -9
- package/dist/MenuV2/context.d.ts +0 -17
- package/dist/MenuV2/cva.d.ts +0 -14
- package/dist/MenuV2/index.d.ts +0 -36
- package/dist/MenuV2/typings.d.ts +0 -9
- package/dist/MenuV2/utils.d.ts +0 -1
- package/dist/SelectedIndicator/SelectedIndicator.d.ts +0 -5
- package/dist/SelectedIndicator/index.d.ts +0 -2
- package/dist/hooks.d.ts +0 -20
- /package/dist/Menu/{Label.d.ts → Label/Label.d.ts} +0 -0
- /package/dist/Menu/{menuPagesContext.d.ts → Pages/context.d.ts} +0 -0
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("react-responsive"), require("cmdk"), require("@radix-ui/react-dialog"), require("react-day-picker"), require("lucide-react/dynamic"), require("@radix-ui/react-hover-card"), require("react-transition-group"), require("react-dom"), require("@radix-ui/react-slot"), require("@floating-ui/react"), require("@radix-ui/react-separator"), require("@radix-ui/react-one-time-password-field"), require("react-error-boundary"), require("@radix-ui/react-popover"), require("@radix-ui/react-progress"), require("@radix-ui/react-radio-group"), require("@radix-ui/react-toggle-group"), require("@radix-ui/react-tabs"), require("@radix-ui/react-slider"), require("@radix-ui/react-switch"), 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", "react-responsive", "cmdk", "@radix-ui/react-dialog", "react-day-picker", "lucide-react/dynamic", "@radix-ui/react-hover-card", "react-transition-group", "react-dom", "@radix-ui/react-slot", "@floating-ui/react", "@radix-ui/react-separator", "@radix-ui/react-one-time-password-field", "react-error-boundary", "@radix-ui/react-popover", "@radix-ui/react-progress", "@radix-ui/react-radio-group", "@radix-ui/react-toggle-group", "@radix-ui/react-tabs", "@radix-ui/react-slider", "@radix-ui/react-switch", "@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.
|
|
3
|
-
})(this, function(exports2, RadixAlertDialog, jsxRuntime, classVarianceAuthority,
|
|
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("react-responsive"), require("@radix-ui/react-collapsible"), require("cmdk"), require("@radix-ui/react-dialog"), require("react-day-picker"), require("lucide-react/dynamic"), require("@radix-ui/react-hover-card"), require("react-transition-group"), require("react-dom"), require("@radix-ui/react-slot"), require("@floating-ui/react"), require("@radix-ui/react-separator"), require("@radix-ui/react-one-time-password-field"), require("react-error-boundary"), require("@radix-ui/react-popover"), require("@radix-ui/react-progress"), require("@radix-ui/react-radio-group"), require("@radix-ui/react-toggle-group"), require("@radix-ui/react-tabs"), require("@radix-ui/react-slider"), require("@radix-ui/react-switch"), 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", "react-responsive", "@radix-ui/react-collapsible", "cmdk", "@radix-ui/react-dialog", "react-day-picker", "lucide-react/dynamic", "@radix-ui/react-hover-card", "react-transition-group", "react-dom", "@radix-ui/react-slot", "@floating-ui/react", "@radix-ui/react-separator", "@radix-ui/react-one-time-password-field", "react-error-boundary", "@radix-ui/react-popover", "@radix-ui/react-progress", "@radix-ui/react-radio-group", "@radix-ui/react-toggle-group", "@radix-ui/react-tabs", "@radix-ui/react-slider", "@radix-ui/react-switch", "@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.reactResponsive, global.RadixPrimitiveCollapsible, global.cmdk, global.RadixDialog, global.reactDayPicker, global.dynamic, global.RadixHoverCard, global.reactTransitionGroup, global.ReactDOM, global.reactSlot, global.react, global.RadixSeparator, global.RadixOneTimePasswordField, global.reactErrorBoundary, global.RadixPopover, global.RadixProgress, global.RadixRadioGroup, global.RadixToggleGroup, global.RadixTabs, global.RadixSlider, global.RadixSwitch, global.RadixToast, global.Toggle, global.RadixTooltip));
|
|
3
|
+
})(this, function(exports2, RadixAlertDialog, jsxRuntime, classVarianceAuthority, React, RadixAvatar, RadixCheckbox, reactResponsive, RadixPrimitiveCollapsible, cmdk, RadixDialog, reactDayPicker, dynamic, RadixHoverCard, reactTransitionGroup, ReactDOM, reactSlot, react, RadixSeparator, RadixOneTimePasswordField, reactErrorBoundary, RadixPopover, RadixProgress, RadixRadioGroup, RadixToggleGroup, RadixTabs, RadixSlider, RadixSwitch, RadixToast, Toggle, RadixTooltip) {
|
|
4
4
|
"use strict";
|
|
5
5
|
function _interopNamespaceDefault(e) {
|
|
6
6
|
const n = Object.create(null, { [Symbol.toStringTag]: { value: "Module" } });
|
|
@@ -19,8 +19,10 @@
|
|
|
19
19
|
return Object.freeze(n);
|
|
20
20
|
}
|
|
21
21
|
const RadixAlertDialog__namespace = /* @__PURE__ */ _interopNamespaceDefault(RadixAlertDialog);
|
|
22
|
+
const React__namespace = /* @__PURE__ */ _interopNamespaceDefault(React);
|
|
22
23
|
const RadixAvatar__namespace = /* @__PURE__ */ _interopNamespaceDefault(RadixAvatar);
|
|
23
24
|
const RadixCheckbox__namespace = /* @__PURE__ */ _interopNamespaceDefault(RadixCheckbox);
|
|
25
|
+
const RadixPrimitiveCollapsible__namespace = /* @__PURE__ */ _interopNamespaceDefault(RadixPrimitiveCollapsible);
|
|
24
26
|
const RadixDialog__namespace = /* @__PURE__ */ _interopNamespaceDefault(RadixDialog);
|
|
25
27
|
const RadixHoverCard__namespace = /* @__PURE__ */ _interopNamespaceDefault(RadixHoverCard);
|
|
26
28
|
const RadixSeparator__namespace = /* @__PURE__ */ _interopNamespaceDefault(RadixSeparator);
|
|
@@ -101,17 +103,17 @@
|
|
|
101
103
|
}
|
|
102
104
|
]
|
|
103
105
|
});
|
|
104
|
-
const ProviderContext =
|
|
106
|
+
const ProviderContext = React.createContext({});
|
|
105
107
|
const useProvider = () => {
|
|
106
|
-
const context =
|
|
108
|
+
const context = React.useContext(ProviderContext);
|
|
107
109
|
if (!context) {
|
|
108
110
|
throw new Error("useProvider must be used within a Provider");
|
|
109
111
|
}
|
|
110
112
|
return context;
|
|
111
113
|
};
|
|
112
|
-
const Provider =
|
|
114
|
+
const Provider = React.memo((props) => {
|
|
113
115
|
const { accentColor, radius = "md", children } = props;
|
|
114
|
-
const contextValue =
|
|
116
|
+
const contextValue = React.useMemo(
|
|
115
117
|
() => ({
|
|
116
118
|
accentColor,
|
|
117
119
|
radius
|
|
@@ -178,7 +180,7 @@
|
|
|
178
180
|
}
|
|
179
181
|
}
|
|
180
182
|
);
|
|
181
|
-
const AlertDialogContent =
|
|
183
|
+
const AlertDialogContent = React.memo((props) => {
|
|
182
184
|
const { radius } = useProvider();
|
|
183
185
|
const { ref, children, className, size, container, ...rest } = props;
|
|
184
186
|
return /* @__PURE__ */ jsxRuntime.jsxs(RadixAlertDialog__namespace.Portal, { container, children: [
|
|
@@ -196,18 +198,18 @@
|
|
|
196
198
|
] });
|
|
197
199
|
});
|
|
198
200
|
AlertDialogContent.displayName = "AlertDialogContent";
|
|
199
|
-
const AlertDialogContext =
|
|
201
|
+
const AlertDialogContext = React.createContext(() => {
|
|
200
202
|
throw new Error("No AlertDialogProvider found");
|
|
201
203
|
});
|
|
202
204
|
const useAlertDialog = () => {
|
|
203
|
-
const alertDialogContext =
|
|
205
|
+
const alertDialogContext = React.useContext(AlertDialogContext);
|
|
204
206
|
if (!alertDialogContext) {
|
|
205
207
|
throw new Error("No AlertDialogProvider found");
|
|
206
208
|
}
|
|
207
209
|
return alertDialogContext;
|
|
208
210
|
};
|
|
209
|
-
const ButtonGroupContext =
|
|
210
|
-
const ButtonGroup =
|
|
211
|
+
const ButtonGroupContext = React.createContext({});
|
|
212
|
+
const ButtonGroup = React.memo((props) => {
|
|
211
213
|
const providerContext = useProvider();
|
|
212
214
|
const {
|
|
213
215
|
children,
|
|
@@ -217,7 +219,7 @@
|
|
|
217
219
|
accentColor = providerContext.accentColor,
|
|
218
220
|
...rest
|
|
219
221
|
} = props;
|
|
220
|
-
const value =
|
|
222
|
+
const value = React.useMemo(
|
|
221
223
|
() => ({
|
|
222
224
|
variant,
|
|
223
225
|
size,
|
|
@@ -229,7 +231,7 @@
|
|
|
229
231
|
return /* @__PURE__ */ jsxRuntime.jsx("div", { ...rest, children: /* @__PURE__ */ jsxRuntime.jsx(ButtonGroupContext.Provider, { value, children }) });
|
|
230
232
|
});
|
|
231
233
|
ButtonGroup.displayName = "Buttons";
|
|
232
|
-
const useButtonGroup = () =>
|
|
234
|
+
const useButtonGroup = () => React.useContext(ButtonGroupContext);
|
|
233
235
|
const buttonCva = classVarianceAuthority.cva(
|
|
234
236
|
[
|
|
235
237
|
"inline-flex",
|
|
@@ -383,7 +385,7 @@
|
|
|
383
385
|
}
|
|
384
386
|
}
|
|
385
387
|
);
|
|
386
|
-
const Button =
|
|
388
|
+
const Button = React.memo((props) => {
|
|
387
389
|
const providerContext = useProvider();
|
|
388
390
|
const buttonsContext = useButtonGroup();
|
|
389
391
|
const {
|
|
@@ -408,7 +410,7 @@
|
|
|
408
410
|
);
|
|
409
411
|
});
|
|
410
412
|
Button.displayName = "Button";
|
|
411
|
-
const IconButton =
|
|
413
|
+
const IconButton = React.memo((props) => {
|
|
412
414
|
const providerContext = useProvider();
|
|
413
415
|
const buttonsContext = useButtonGroup();
|
|
414
416
|
const {
|
|
@@ -433,11 +435,11 @@
|
|
|
433
435
|
);
|
|
434
436
|
});
|
|
435
437
|
IconButton.displayName = "IconButton";
|
|
436
|
-
const AlertDialogProvider =
|
|
438
|
+
const AlertDialogProvider = React.memo((props) => {
|
|
437
439
|
const { children } = props;
|
|
438
|
-
const [open, setOpen] =
|
|
439
|
-
const [options, setOptions] =
|
|
440
|
-
const handleOpenChange =
|
|
440
|
+
const [open, setOpen] = React.useState(false);
|
|
441
|
+
const [options, setOptions] = React.useState(null);
|
|
442
|
+
const handleOpenChange = React.useCallback(
|
|
441
443
|
(open2) => {
|
|
442
444
|
var _a;
|
|
443
445
|
setOpen(open2);
|
|
@@ -446,7 +448,7 @@
|
|
|
446
448
|
},
|
|
447
449
|
[options]
|
|
448
450
|
);
|
|
449
|
-
const openAlertDialog =
|
|
451
|
+
const openAlertDialog = React.useCallback(
|
|
450
452
|
(config) => {
|
|
451
453
|
if (open) throw new Error("AlertDialog is already open");
|
|
452
454
|
setOpen(true);
|
|
@@ -483,7 +485,7 @@
|
|
|
483
485
|
Action: RadixAlertDialog__namespace.Action,
|
|
484
486
|
Cancel: RadixAlertDialog__namespace.Cancel
|
|
485
487
|
};
|
|
486
|
-
const AvatarContext =
|
|
488
|
+
const AvatarContext = React.createContext({});
|
|
487
489
|
const avatar = classVarianceAuthority.cva(["shrink-0", "select-none", "inline-block", "align-middle"], {
|
|
488
490
|
variants: {
|
|
489
491
|
size: {
|
|
@@ -511,13 +513,13 @@
|
|
|
511
513
|
variant: "solid"
|
|
512
514
|
}
|
|
513
515
|
});
|
|
514
|
-
const AvatarFallback =
|
|
516
|
+
const AvatarFallback = React.memo((props) => {
|
|
515
517
|
const { ref, children, className, ...rest } = props;
|
|
516
|
-
const { variant } =
|
|
518
|
+
const { variant } = React.useContext(AvatarContext);
|
|
517
519
|
return /* @__PURE__ */ jsxRuntime.jsx(RadixAvatar__namespace.AvatarFallback, { className: classVarianceAuthority.cx(avatarFallback({ variant }), className), ref, ...rest, children });
|
|
518
520
|
});
|
|
519
521
|
AvatarFallback.displayName = "AvatarFallback";
|
|
520
|
-
const AvatarImage =
|
|
522
|
+
const AvatarImage = React.memo((props) => {
|
|
521
523
|
const { ref, className, ...rest } = props;
|
|
522
524
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
523
525
|
RadixAvatar__namespace.Image,
|
|
@@ -529,7 +531,7 @@
|
|
|
529
531
|
);
|
|
530
532
|
});
|
|
531
533
|
AvatarImage.displayName = "AvatarImage";
|
|
532
|
-
const AvatarRoot =
|
|
534
|
+
const AvatarRoot = React.memo((props) => {
|
|
533
535
|
const providerContext = useProvider();
|
|
534
536
|
const {
|
|
535
537
|
ref,
|
|
@@ -637,7 +639,7 @@
|
|
|
637
639
|
icon: false
|
|
638
640
|
}
|
|
639
641
|
});
|
|
640
|
-
const Badge =
|
|
642
|
+
const Badge = React.memo((props) => {
|
|
641
643
|
const providerContext = useProvider();
|
|
642
644
|
const {
|
|
643
645
|
ref,
|
|
@@ -682,7 +684,7 @@
|
|
|
682
684
|
variant: "surface"
|
|
683
685
|
}
|
|
684
686
|
});
|
|
685
|
-
const Card =
|
|
687
|
+
const Card = React.memo((props) => {
|
|
686
688
|
const providerContext = useProvider();
|
|
687
689
|
const {
|
|
688
690
|
ref,
|
|
@@ -706,7 +708,7 @@
|
|
|
706
708
|
);
|
|
707
709
|
});
|
|
708
710
|
Card.displayName = "Card";
|
|
709
|
-
const CheckboxIndicator =
|
|
711
|
+
const CheckboxIndicator = React.memo((props) => {
|
|
710
712
|
const { ref, children, className, ...rest } = props;
|
|
711
713
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
712
714
|
RadixCheckbox__namespace.CheckboxIndicator,
|
|
@@ -762,7 +764,7 @@
|
|
|
762
764
|
}
|
|
763
765
|
}
|
|
764
766
|
);
|
|
765
|
-
const CheckboxRoot =
|
|
767
|
+
const CheckboxRoot = React.memo((props) => {
|
|
766
768
|
const providerContext = useProvider();
|
|
767
769
|
const {
|
|
768
770
|
ref,
|
|
@@ -790,18 +792,94 @@
|
|
|
790
792
|
Root: CheckboxRoot,
|
|
791
793
|
Indicator: CheckboxIndicator
|
|
792
794
|
};
|
|
793
|
-
const SelectContext =
|
|
794
|
-
const MultiSelectContext =
|
|
795
|
+
const SelectContext = React.createContext({});
|
|
796
|
+
const MultiSelectContext = React.createContext({});
|
|
797
|
+
const usePassiveLayoutEffect = React[typeof document !== "undefined" && document.createElement !== void 0 ? "useLayoutEffect" : "useEffect"];
|
|
798
|
+
const useLatest = (current) => {
|
|
799
|
+
const storedValue = React__namespace.useRef(current);
|
|
800
|
+
React__namespace.useEffect(() => {
|
|
801
|
+
storedValue.current = current;
|
|
802
|
+
});
|
|
803
|
+
return storedValue;
|
|
804
|
+
};
|
|
805
|
+
function _ref() {
|
|
806
|
+
}
|
|
807
|
+
function useResizeObserver(target, callback, options = {}) {
|
|
808
|
+
const resizeObserver = getResizeObserver(options.polyfill);
|
|
809
|
+
const storedCallback = useLatest(callback);
|
|
810
|
+
usePassiveLayoutEffect(() => {
|
|
811
|
+
let didUnsubscribe = false;
|
|
812
|
+
const targetEl = target && "current" in target ? target.current : target;
|
|
813
|
+
if (!targetEl) return _ref;
|
|
814
|
+
function cb(entry, observer) {
|
|
815
|
+
if (didUnsubscribe) return;
|
|
816
|
+
storedCallback.current(entry, observer);
|
|
817
|
+
}
|
|
818
|
+
resizeObserver.subscribe(targetEl, cb);
|
|
819
|
+
return () => {
|
|
820
|
+
didUnsubscribe = true;
|
|
821
|
+
resizeObserver.unsubscribe(targetEl, cb);
|
|
822
|
+
};
|
|
823
|
+
}, [target, resizeObserver, storedCallback]);
|
|
824
|
+
return resizeObserver.observer;
|
|
825
|
+
}
|
|
826
|
+
function createResizeObserver(polyfill) {
|
|
827
|
+
let ticking = false;
|
|
828
|
+
let allEntries = [];
|
|
829
|
+
const callbacks = /* @__PURE__ */ new Map();
|
|
830
|
+
const observer = new (polyfill || window.ResizeObserver)((entries, obs) => {
|
|
831
|
+
allEntries = allEntries.concat(entries);
|
|
832
|
+
function _ref2() {
|
|
833
|
+
const triggered = /* @__PURE__ */ new Set();
|
|
834
|
+
for (let i = 0; i < allEntries.length; i++) {
|
|
835
|
+
if (triggered.has(allEntries[i].target)) continue;
|
|
836
|
+
triggered.add(allEntries[i].target);
|
|
837
|
+
const cbs = callbacks.get(allEntries[i].target);
|
|
838
|
+
cbs === null || cbs === void 0 ? void 0 : cbs.forEach((cb) => cb(allEntries[i], obs));
|
|
839
|
+
}
|
|
840
|
+
allEntries = [];
|
|
841
|
+
ticking = false;
|
|
842
|
+
}
|
|
843
|
+
if (!ticking) {
|
|
844
|
+
window.requestAnimationFrame(_ref2);
|
|
845
|
+
}
|
|
846
|
+
ticking = true;
|
|
847
|
+
});
|
|
848
|
+
return {
|
|
849
|
+
observer,
|
|
850
|
+
subscribe(target, callback) {
|
|
851
|
+
var _callbacks$get;
|
|
852
|
+
observer.observe(target);
|
|
853
|
+
const cbs = (_callbacks$get = callbacks.get(target)) !== null && _callbacks$get !== void 0 ? _callbacks$get : [];
|
|
854
|
+
cbs.push(callback);
|
|
855
|
+
callbacks.set(target, cbs);
|
|
856
|
+
},
|
|
857
|
+
unsubscribe(target, callback) {
|
|
858
|
+
var _callbacks$get2;
|
|
859
|
+
const cbs = (_callbacks$get2 = callbacks.get(target)) !== null && _callbacks$get2 !== void 0 ? _callbacks$get2 : [];
|
|
860
|
+
if (cbs.length === 1) {
|
|
861
|
+
observer.unobserve(target);
|
|
862
|
+
callbacks.delete(target);
|
|
863
|
+
return;
|
|
864
|
+
}
|
|
865
|
+
const cbIndex = cbs.indexOf(callback);
|
|
866
|
+
if (cbIndex !== -1) cbs.splice(cbIndex, 1);
|
|
867
|
+
callbacks.set(target, cbs);
|
|
868
|
+
}
|
|
869
|
+
};
|
|
870
|
+
}
|
|
871
|
+
let _resizeObserver;
|
|
872
|
+
const getResizeObserver = (polyfill) => !_resizeObserver ? _resizeObserver = createResizeObserver(polyfill) : _resizeObserver;
|
|
795
873
|
const useViewportSize = (props) => {
|
|
796
874
|
const { xs: xsProps, sm: smProps, md: mdProps, lg: lgProps, xl: xlProps } = props;
|
|
797
|
-
const [prevSize, setPrevSize] =
|
|
798
|
-
const [size, setSize] =
|
|
875
|
+
const [prevSize, setPrevSize] = React.useState("initial");
|
|
876
|
+
const [size, setSize] = React.useState("initial");
|
|
799
877
|
const xs = reactResponsive.useMediaQuery({ minWidth: xsProps });
|
|
800
878
|
const sm = reactResponsive.useMediaQuery({ minWidth: smProps });
|
|
801
879
|
const md = reactResponsive.useMediaQuery({ minWidth: mdProps });
|
|
802
880
|
const lg = reactResponsive.useMediaQuery({ minWidth: lgProps });
|
|
803
881
|
const xl = reactResponsive.useMediaQuery({ minWidth: xlProps });
|
|
804
|
-
|
|
882
|
+
React.useLayoutEffect(() => {
|
|
805
883
|
setSize((prev) => {
|
|
806
884
|
setPrevSize(prev);
|
|
807
885
|
return xl ? "xl" : lg ? "lg" : md ? "md" : sm ? "sm" : xs ? "xs" : "initial";
|
|
@@ -809,58 +887,69 @@
|
|
|
809
887
|
}, [lg, md, sm, xl, xs]);
|
|
810
888
|
return { size, prevSize, xs, sm, md, lg, xl };
|
|
811
889
|
};
|
|
812
|
-
|
|
813
|
-
|
|
814
|
-
|
|
815
|
-
|
|
816
|
-
|
|
817
|
-
|
|
890
|
+
const useStopEventPropagation = () => {
|
|
891
|
+
return React.useCallback((event) => {
|
|
892
|
+
event.stopPropagation();
|
|
893
|
+
}, []);
|
|
894
|
+
};
|
|
895
|
+
function useTextFilter(values, filterFunction) {
|
|
896
|
+
const [filteredOptions, setFilteredOptions] = React.useState([]);
|
|
897
|
+
const [filterValue, setFilterValue] = React.useState("");
|
|
898
|
+
React.useEffect(() => {
|
|
899
|
+
setFilteredOptions(values.filter((value) => filterFunction(value, filterValue)));
|
|
900
|
+
}, [filterFunction, filterValue, values]);
|
|
818
901
|
return [filteredOptions, filterValue, setFilterValue];
|
|
819
902
|
}
|
|
903
|
+
const useSize = (target) => {
|
|
904
|
+
const [size, setSize] = React.useState();
|
|
905
|
+
React.useLayoutEffect(() => {
|
|
906
|
+
var _a;
|
|
907
|
+
setSize((_a = target.current) == null ? void 0 : _a.getBoundingClientRect());
|
|
908
|
+
}, [target]);
|
|
909
|
+
const handleResize = React.useCallback((entry) => {
|
|
910
|
+
const rect = entry.contentRect;
|
|
911
|
+
setSize(rect);
|
|
912
|
+
}, []);
|
|
913
|
+
useResizeObserver(target, handleResize);
|
|
914
|
+
return size;
|
|
915
|
+
};
|
|
916
|
+
const genericMemo = React.memo;
|
|
820
917
|
function useControlledState(initialState, state, setState) {
|
|
821
|
-
const [uncontrolledState, setUncontrolledState] =
|
|
822
|
-
const handleStateChange =
|
|
918
|
+
const [uncontrolledState, setUncontrolledState] = React.useState(initialState);
|
|
919
|
+
const handleStateChange = React.useCallback(
|
|
823
920
|
(state2) => {
|
|
824
921
|
setUncontrolledState(state2);
|
|
825
922
|
setState == null ? void 0 : setState(state2);
|
|
826
923
|
},
|
|
827
924
|
[setState]
|
|
828
925
|
);
|
|
829
|
-
|
|
926
|
+
React.useEffect(() => {
|
|
830
927
|
if (state !== void 0) {
|
|
831
928
|
setUncontrolledState(state);
|
|
832
929
|
}
|
|
833
930
|
}, [state]);
|
|
834
931
|
return [state ?? uncontrolledState, handleStateChange];
|
|
835
932
|
}
|
|
836
|
-
function useFallbackId(id) {
|
|
837
|
-
const fallbackId = react.useId();
|
|
838
|
-
return id ?? fallbackId;
|
|
839
|
-
}
|
|
840
|
-
const genericMemo = react.memo;
|
|
841
933
|
function mergeRefs(refs) {
|
|
842
934
|
return (value) => {
|
|
843
|
-
const cleanups = refs.reduce(
|
|
844
|
-
(
|
|
845
|
-
|
|
846
|
-
|
|
847
|
-
|
|
848
|
-
|
|
849
|
-
} else {
|
|
850
|
-
cleanups2.push(() => {
|
|
851
|
-
ref(null);
|
|
852
|
-
});
|
|
853
|
-
}
|
|
854
|
-
} else if (ref != null) {
|
|
855
|
-
ref.current = value;
|
|
935
|
+
const cleanups = refs.reduce((cleanups2, ref) => {
|
|
936
|
+
if (typeof ref === "function") {
|
|
937
|
+
const cleanup = ref(value);
|
|
938
|
+
if (typeof cleanup === "function") {
|
|
939
|
+
cleanups2.push(cleanup);
|
|
940
|
+
} else {
|
|
856
941
|
cleanups2.push(() => {
|
|
857
|
-
ref
|
|
942
|
+
ref(null);
|
|
858
943
|
});
|
|
859
944
|
}
|
|
860
|
-
|
|
861
|
-
|
|
862
|
-
|
|
863
|
-
|
|
945
|
+
} else if (ref != null) {
|
|
946
|
+
ref.current = value;
|
|
947
|
+
cleanups2.push(() => {
|
|
948
|
+
ref.current = null;
|
|
949
|
+
});
|
|
950
|
+
}
|
|
951
|
+
return cleanups2;
|
|
952
|
+
}, []);
|
|
864
953
|
return () => {
|
|
865
954
|
cleanups.forEach((cleanup) => {
|
|
866
955
|
cleanup();
|
|
@@ -871,26 +960,11 @@
|
|
|
871
960
|
const stopPropagation = (e) => {
|
|
872
961
|
e.stopPropagation();
|
|
873
962
|
};
|
|
874
|
-
function getSelectedState(selected) {
|
|
875
|
-
return selected ? "selected" : "unselected";
|
|
876
|
-
}
|
|
877
|
-
function getCheckedState(checked) {
|
|
878
|
-
return checked === true ? "checked" : checked === false ? "unchecked" : "indeterminate";
|
|
879
|
-
}
|
|
880
|
-
function getActiveState(active) {
|
|
881
|
-
return active ? "active" : "inactive";
|
|
882
|
-
}
|
|
883
|
-
function getBooleanState(value) {
|
|
884
|
-
return value ? "true" : "false";
|
|
885
|
-
}
|
|
886
|
-
function getOpenState(open) {
|
|
887
|
-
return open ? "open" : "closed";
|
|
888
|
-
}
|
|
889
963
|
const MultiSelectProvider = genericMemo(function MultiSelectProvider2(props) {
|
|
890
964
|
const { children, defaultValues, values: controlledValues, onValuesChange } = props;
|
|
891
|
-
const [itemValueMapping, setItemValueMapping] =
|
|
965
|
+
const [itemValueMapping, setItemValueMapping] = React.useState(/* @__PURE__ */ new Set());
|
|
892
966
|
const [values, setValues] = useControlledState(defaultValues ?? [], controlledValues, onValuesChange);
|
|
893
|
-
const registerValue =
|
|
967
|
+
const registerValue = React.useCallback((value) => {
|
|
894
968
|
setItemValueMapping((prev) => {
|
|
895
969
|
const newSet = new Set(prev);
|
|
896
970
|
newSet.add(value);
|
|
@@ -904,8 +978,8 @@
|
|
|
904
978
|
});
|
|
905
979
|
};
|
|
906
980
|
}, []);
|
|
907
|
-
const selected =
|
|
908
|
-
const selectValue =
|
|
981
|
+
const selected = React.useCallback((value) => values.includes(value), [values]);
|
|
982
|
+
const selectValue = React.useCallback(
|
|
909
983
|
(value) => {
|
|
910
984
|
if (selected(value)) {
|
|
911
985
|
setValues(values.filter((v) => v !== value));
|
|
@@ -915,20 +989,20 @@
|
|
|
915
989
|
},
|
|
916
990
|
[selected, setValues, values]
|
|
917
991
|
);
|
|
918
|
-
const allSelected =
|
|
992
|
+
const allSelected = React.useMemo(() => {
|
|
919
993
|
return Array.from(itemValueMapping.values()).every((value) => values.includes(value));
|
|
920
994
|
}, [itemValueMapping, values]);
|
|
921
|
-
const someSelected =
|
|
995
|
+
const someSelected = React.useMemo(() => {
|
|
922
996
|
return Array.from(itemValueMapping.values()).some((value) => values.includes(value));
|
|
923
997
|
}, [itemValueMapping, values]);
|
|
924
|
-
const toggleSelectAll =
|
|
998
|
+
const toggleSelectAll = React.useCallback(() => {
|
|
925
999
|
if (allSelected) {
|
|
926
1000
|
setValues([]);
|
|
927
1001
|
} else {
|
|
928
1002
|
setValues(Array.from(itemValueMapping.values()));
|
|
929
1003
|
}
|
|
930
1004
|
}, [allSelected, itemValueMapping, setValues]);
|
|
931
|
-
const contextValue =
|
|
1005
|
+
const contextValue = React.useMemo(
|
|
932
1006
|
() => ({ selected, selectValue, allSelected, someSelected, toggleSelectAll, registerValue }),
|
|
933
1007
|
[allSelected, registerValue, selectValue, selected, someSelected, toggleSelectAll]
|
|
934
1008
|
);
|
|
@@ -937,51 +1011,51 @@
|
|
|
937
1011
|
const SingleSelectRequiredProvider = genericMemo(function SingleSelectRequiredProvider2(props) {
|
|
938
1012
|
const { children, defaultValue, value, onValueChange } = props;
|
|
939
1013
|
const [controlledValue, setControlledValue] = useControlledState(defaultValue, value, onValueChange);
|
|
940
|
-
const selected =
|
|
941
|
-
const selectValue =
|
|
1014
|
+
const selected = React.useCallback((v) => v === controlledValue, [controlledValue]);
|
|
1015
|
+
const selectValue = React.useCallback(
|
|
942
1016
|
(v) => {
|
|
943
1017
|
if (selected(v)) return;
|
|
944
1018
|
setControlledValue(v);
|
|
945
1019
|
},
|
|
946
1020
|
[selected, setControlledValue]
|
|
947
1021
|
);
|
|
948
|
-
const contextValue =
|
|
1022
|
+
const contextValue = React.useMemo(() => ({ selected, selectValue }), [selectValue, selected]);
|
|
949
1023
|
return /* @__PURE__ */ jsxRuntime.jsx(SelectContext, { value: contextValue, children });
|
|
950
1024
|
});
|
|
951
1025
|
const SingleSelectNotRequiredProvider = genericMemo(function SingleSelectNotRequiredProvider2(props) {
|
|
952
1026
|
const { children, defaultValue = void 0, value: controlledValue, onValueChange } = props;
|
|
953
1027
|
const [value, setValue] = useControlledState(defaultValue, controlledValue, onValueChange);
|
|
954
|
-
const selected =
|
|
955
|
-
const selectValue =
|
|
1028
|
+
const selected = React.useCallback((v) => v === value, [value]);
|
|
1029
|
+
const selectValue = React.useCallback(
|
|
956
1030
|
(v) => {
|
|
957
1031
|
setValue(selected(v) ? void 0 : v);
|
|
958
1032
|
},
|
|
959
1033
|
[selected, setValue]
|
|
960
1034
|
);
|
|
961
|
-
const contextValue =
|
|
1035
|
+
const contextValue = React.useMemo(() => ({ selected, selectValue }), [selected, selectValue]);
|
|
962
1036
|
return /* @__PURE__ */ jsxRuntime.jsx(SelectContext, { value: contextValue, children });
|
|
963
1037
|
});
|
|
964
|
-
const CheckboxGroupContext =
|
|
965
|
-
const CheckboxGroupItem =
|
|
966
|
-
const groupContext =
|
|
1038
|
+
const CheckboxGroupContext = React.createContext({});
|
|
1039
|
+
const CheckboxGroupItem = React.memo((props) => {
|
|
1040
|
+
const groupContext = React.use(CheckboxGroupContext);
|
|
967
1041
|
const {
|
|
968
1042
|
ref,
|
|
969
1043
|
className,
|
|
970
1044
|
value,
|
|
1045
|
+
accentColor,
|
|
971
1046
|
disabled,
|
|
972
|
-
accentColor = groupContext.accentColor,
|
|
973
1047
|
variant = groupContext.variant,
|
|
974
1048
|
size = groupContext.size,
|
|
975
1049
|
radius = groupContext.radius,
|
|
976
1050
|
...rest
|
|
977
1051
|
} = props;
|
|
978
|
-
const { selected, selectValue, registerValue } =
|
|
979
|
-
|
|
1052
|
+
const { selected, selectValue, registerValue } = React.use(MultiSelectContext);
|
|
1053
|
+
React.useLayoutEffect(() => {
|
|
980
1054
|
return registerValue(value);
|
|
981
1055
|
}, [registerValue, value]);
|
|
982
1056
|
const isChecked = selected(value);
|
|
983
1057
|
const isDisabled = groupContext.disabled || disabled;
|
|
984
|
-
const handleCheckedChange =
|
|
1058
|
+
const handleCheckedChange = React.useCallback(() => {
|
|
985
1059
|
selectValue(value);
|
|
986
1060
|
}, [selectValue, value]);
|
|
987
1061
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
@@ -1001,12 +1075,15 @@
|
|
|
1001
1075
|
);
|
|
1002
1076
|
});
|
|
1003
1077
|
CheckboxGroupItem.displayName = "CheckboxGroupItem";
|
|
1004
|
-
const CheckboxGroupItemIndicator =
|
|
1078
|
+
const CheckboxGroupItemIndicator = React.memo((props) => {
|
|
1005
1079
|
const { ref, className, ...rest } = props;
|
|
1006
1080
|
return /* @__PURE__ */ jsxRuntime.jsx(RadixCheckbox__namespace.Indicator, { className: classVarianceAuthority.cx("flex items-center justify-center", className), ref, ...rest });
|
|
1007
1081
|
});
|
|
1008
1082
|
CheckboxGroupItemIndicator.displayName = "CheckboxGroupItemIndicator";
|
|
1009
|
-
|
|
1083
|
+
function getBooleanState$1(value) {
|
|
1084
|
+
return value ? "true" : "false";
|
|
1085
|
+
}
|
|
1086
|
+
const CheckboxGroupRoot = React.memo((props) => {
|
|
1010
1087
|
const providerContext = useProvider();
|
|
1011
1088
|
const {
|
|
1012
1089
|
ref,
|
|
@@ -1023,27 +1100,25 @@
|
|
|
1023
1100
|
size = "md",
|
|
1024
1101
|
...rest
|
|
1025
1102
|
} = props;
|
|
1026
|
-
const contextValue =
|
|
1103
|
+
const contextValue = React.useMemo(
|
|
1027
1104
|
() => ({
|
|
1028
1105
|
name,
|
|
1029
1106
|
required,
|
|
1030
1107
|
disabled,
|
|
1031
|
-
// style props
|
|
1032
|
-
accentColor,
|
|
1033
1108
|
size,
|
|
1034
1109
|
variant,
|
|
1035
1110
|
radius
|
|
1036
1111
|
}),
|
|
1037
|
-
[
|
|
1112
|
+
[disabled, name, radius, required, size, variant]
|
|
1038
1113
|
);
|
|
1039
1114
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
1040
1115
|
"div",
|
|
1041
1116
|
{
|
|
1042
1117
|
ref,
|
|
1043
1118
|
role: "group",
|
|
1044
|
-
"data-disabled": getBooleanState(!!disabled),
|
|
1119
|
+
"data-disabled": getBooleanState$1(!!disabled),
|
|
1045
1120
|
"data-accent-color": accentColor,
|
|
1046
|
-
"aria-disabled": getBooleanState(!!disabled),
|
|
1121
|
+
"aria-disabled": getBooleanState$1(!!disabled),
|
|
1047
1122
|
...rest,
|
|
1048
1123
|
children: /* @__PURE__ */ jsxRuntime.jsx(CheckboxGroupContext.Provider, { value: contextValue, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
1049
1124
|
MultiSelectProvider,
|
|
@@ -1058,19 +1133,19 @@
|
|
|
1058
1133
|
);
|
|
1059
1134
|
});
|
|
1060
1135
|
CheckboxGroupRoot.displayName = "CheckboxGroupRoot";
|
|
1061
|
-
const CheckboxGroupSelectAllItem =
|
|
1062
|
-
const groupContext =
|
|
1136
|
+
const CheckboxGroupSelectAllItem = React.memo((props) => {
|
|
1137
|
+
const groupContext = React.use(CheckboxGroupContext);
|
|
1063
1138
|
const {
|
|
1064
1139
|
ref,
|
|
1065
1140
|
className,
|
|
1141
|
+
accentColor,
|
|
1066
1142
|
disabled,
|
|
1067
|
-
accentColor = groupContext.accentColor,
|
|
1068
1143
|
variant = groupContext.variant,
|
|
1069
1144
|
size = groupContext.size,
|
|
1070
1145
|
radius = groupContext.radius,
|
|
1071
1146
|
...rest
|
|
1072
1147
|
} = props;
|
|
1073
|
-
const { allSelected, someSelected, toggleSelectAll } =
|
|
1148
|
+
const { allSelected, someSelected, toggleSelectAll } = React.use(MultiSelectContext);
|
|
1074
1149
|
const checked = allSelected ? true : someSelected ? "indeterminate" : false;
|
|
1075
1150
|
const isDisabled = groupContext.disabled || disabled;
|
|
1076
1151
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
@@ -1095,39 +1170,137 @@
|
|
|
1095
1170
|
SelectAllItem: CheckboxGroupSelectAllItem,
|
|
1096
1171
|
ItemIndicator: CheckboxGroupItemIndicator
|
|
1097
1172
|
};
|
|
1098
|
-
const
|
|
1099
|
-
|
|
1100
|
-
|
|
1101
|
-
|
|
1102
|
-
|
|
1173
|
+
const CollapsibleTreeContext = React.createContext(
|
|
1174
|
+
{}
|
|
1175
|
+
);
|
|
1176
|
+
function useCollapsibleTreeContext() {
|
|
1177
|
+
return React.useContext(CollapsibleTreeContext);
|
|
1178
|
+
}
|
|
1179
|
+
const CollapsibleNode = genericMemo(function(props) {
|
|
1180
|
+
const { meta, nodes, level = 0, disabled } = props;
|
|
1181
|
+
const [controlledOpenState, setControlledOpenState] = React.useState(false);
|
|
1182
|
+
const {
|
|
1183
|
+
nodeRenderer,
|
|
1184
|
+
disabled: disabledFromContext,
|
|
1185
|
+
onNodeOpen,
|
|
1186
|
+
onNodeClose,
|
|
1187
|
+
onNodeClick,
|
|
1188
|
+
nodeStyles,
|
|
1189
|
+
nodeClassName
|
|
1190
|
+
} = useCollapsibleTreeContext();
|
|
1191
|
+
const isDisabled = disabled ?? disabledFromContext;
|
|
1192
|
+
const handleClick = React.useCallback(() => {
|
|
1193
|
+
if (onNodeClick) onNodeClick(meta);
|
|
1194
|
+
}, [meta, onNodeClick]);
|
|
1195
|
+
const toggleOpenState = React.useCallback(() => {
|
|
1196
|
+
setControlledOpenState(!controlledOpenState);
|
|
1197
|
+
if (!controlledOpenState && onNodeOpen) onNodeOpen(meta);
|
|
1198
|
+
if (controlledOpenState && onNodeClose) onNodeClose(meta);
|
|
1199
|
+
}, [meta, onNodeClose, onNodeOpen, controlledOpenState]);
|
|
1200
|
+
const { children, style, className } = React.useMemo(() => {
|
|
1201
|
+
return nodeRenderer({
|
|
1202
|
+
meta,
|
|
1203
|
+
toggleOpen: toggleOpenState,
|
|
1204
|
+
open: controlledOpenState,
|
|
1205
|
+
disabled: isDisabled
|
|
1206
|
+
});
|
|
1207
|
+
}, [isDisabled, meta, nodeRenderer, toggleOpenState, controlledOpenState]);
|
|
1208
|
+
const combinedStyles = React.useMemo(
|
|
1209
|
+
() => ({
|
|
1210
|
+
// want node specific styles to overwrite and global node styles
|
|
1211
|
+
...nodeStyles,
|
|
1212
|
+
...style
|
|
1213
|
+
}),
|
|
1214
|
+
[nodeStyles, style]
|
|
1215
|
+
);
|
|
1216
|
+
return /* @__PURE__ */ jsxRuntime.jsx(RadixPrimitiveCollapsible__namespace.Root, { asChild: true, open: controlledOpenState, disabled: isDisabled, children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex w-full flex-col", children: [
|
|
1217
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1218
|
+
"div",
|
|
1219
|
+
{
|
|
1220
|
+
onClick: handleClick,
|
|
1221
|
+
className: classVarianceAuthority.cx(nodeClassName, "flex w-full shrink-0 items-center", className),
|
|
1222
|
+
style: combinedStyles,
|
|
1223
|
+
"data-state": controlledOpenState ? "open" : "closed",
|
|
1224
|
+
"data-disabled": isDisabled,
|
|
1225
|
+
children
|
|
1226
|
+
}
|
|
1227
|
+
),
|
|
1228
|
+
nodes && nodes.length > 0 && /* @__PURE__ */ jsxRuntime.jsx(RadixPrimitiveCollapsible__namespace.Content, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex h-max w-full flex-col pl-2", children: nodes.map((treeNodeProps, index) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
1229
|
+
CollapsibleNode,
|
|
1230
|
+
{
|
|
1231
|
+
level: level + 1,
|
|
1232
|
+
...treeNodeProps
|
|
1233
|
+
},
|
|
1234
|
+
`${level},${index}`
|
|
1235
|
+
)) }) })
|
|
1236
|
+
] }) });
|
|
1237
|
+
});
|
|
1238
|
+
const CollapsibleTree = genericMemo(function(props) {
|
|
1239
|
+
const {
|
|
1240
|
+
nodes,
|
|
1241
|
+
disabled = false,
|
|
1242
|
+
nodeClassName,
|
|
1243
|
+
nodeStyles,
|
|
1244
|
+
onNodeClick,
|
|
1245
|
+
onNodeClose,
|
|
1246
|
+
onNodeOpen,
|
|
1247
|
+
nodeRenderer,
|
|
1248
|
+
...rest
|
|
1249
|
+
} = props;
|
|
1250
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
1251
|
+
CollapsibleTreeContext.Provider,
|
|
1252
|
+
{
|
|
1253
|
+
value: {
|
|
1254
|
+
nodeRenderer,
|
|
1255
|
+
nodeClassName,
|
|
1256
|
+
nodeStyles,
|
|
1257
|
+
disabled,
|
|
1258
|
+
onNodeClick,
|
|
1259
|
+
onNodeClose,
|
|
1260
|
+
onNodeOpen
|
|
1261
|
+
},
|
|
1262
|
+
children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex h-max w-full flex-col", ...rest, children: nodes.map((treeNodeProps, index) => /* @__PURE__ */ jsxRuntime.jsx(CollapsibleNode, { ...treeNodeProps }, `${0},${index}`)) })
|
|
1263
|
+
}
|
|
1264
|
+
);
|
|
1265
|
+
});
|
|
1266
|
+
const CommandMenuContext = React.createContext({});
|
|
1267
|
+
const SelectedIndicatorContext$1 = React.createContext(false);
|
|
1268
|
+
const CheckboxIndicatorContext = React.createContext(false);
|
|
1269
|
+
const CommandMenuPageContext = React.createContext({});
|
|
1270
|
+
const CommandMenuDialogContext = React.createContext({});
|
|
1271
|
+
function getSelectedState$1(selected) {
|
|
1272
|
+
return selected ? "selected" : "unselected";
|
|
1273
|
+
}
|
|
1274
|
+
function getCheckedState$1(checked) {
|
|
1275
|
+
return checked === true ? "checked" : checked === false ? "unchecked" : "indeterminate";
|
|
1276
|
+
}
|
|
1277
|
+
function getActiveState(active) {
|
|
1278
|
+
return active ? "active" : "inactive";
|
|
1279
|
+
}
|
|
1280
|
+
const CommandMenuCheckboxIndicator = React.memo((props) => {
|
|
1281
|
+
const { ref, className, children, ...rest } = props;
|
|
1282
|
+
const checkedState = React.use(CheckboxIndicatorContext);
|
|
1283
|
+
const computedChildren = React.useMemo(() => {
|
|
1284
|
+
return typeof children === "function" ? children(checkedState) : children;
|
|
1285
|
+
}, [checkedState, children]);
|
|
1103
1286
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
1104
1287
|
"span",
|
|
1105
1288
|
{
|
|
1106
1289
|
ref,
|
|
1290
|
+
"data-state": getCheckedState$1(checkedState),
|
|
1107
1291
|
className: classVarianceAuthority.cx(
|
|
1108
|
-
"
|
|
1292
|
+
"inline-block size-max",
|
|
1109
1293
|
{
|
|
1110
|
-
invisible:
|
|
1294
|
+
invisible: checkedState === false
|
|
1111
1295
|
},
|
|
1112
1296
|
className
|
|
1113
1297
|
),
|
|
1114
|
-
"data-state": getCheckedState(checked),
|
|
1115
1298
|
...rest,
|
|
1116
1299
|
children: computedChildren
|
|
1117
1300
|
}
|
|
1118
1301
|
);
|
|
1119
1302
|
});
|
|
1120
|
-
CheckedIndicator.displayName = "CheckedIndicator";
|
|
1121
|
-
const CommandMenuCheckboxIndicator = react.memo((props) => {
|
|
1122
|
-
const { ref, children, ...rest } = props;
|
|
1123
|
-
return /* @__PURE__ */ jsxRuntime.jsx(CheckedIndicator, { ref, ...rest, children });
|
|
1124
|
-
});
|
|
1125
1303
|
CommandMenuCheckboxIndicator.displayName = "CommandMenuCheckboxIndicator";
|
|
1126
|
-
const CommandMenuContext = react.createContext({});
|
|
1127
|
-
const SelectedIndicatorContext$1 = react.createContext(false);
|
|
1128
|
-
const CheckboxIndicatorContext = react.createContext(false);
|
|
1129
|
-
const CommandMenuPageContext = react.createContext({});
|
|
1130
|
-
const CommandMenuDialogContext = react.createContext({});
|
|
1131
1304
|
const commandMenuContentCva = classVarianceAuthority.cva(
|
|
1132
1305
|
[
|
|
1133
1306
|
"ring",
|
|
@@ -1336,11 +1509,11 @@
|
|
|
1336
1509
|
}
|
|
1337
1510
|
}
|
|
1338
1511
|
);
|
|
1339
|
-
const CommandMenuItem =
|
|
1512
|
+
const CommandMenuItem = React.memo((props) => {
|
|
1340
1513
|
const { className, ref, closeOnSelect = true, onSelect, filterValue, ...rest } = props;
|
|
1341
|
-
const { size, variant, radius } =
|
|
1342
|
-
const { setOpen } =
|
|
1343
|
-
const handleSelect =
|
|
1514
|
+
const { size, variant, radius } = React.use(CommandMenuContext);
|
|
1515
|
+
const { setOpen } = React.use(CommandMenuDialogContext);
|
|
1516
|
+
const handleSelect = React.useCallback(() => {
|
|
1344
1517
|
onSelect == null ? void 0 : onSelect();
|
|
1345
1518
|
if (closeOnSelect) {
|
|
1346
1519
|
setOpen(false);
|
|
@@ -1358,16 +1531,16 @@
|
|
|
1358
1531
|
);
|
|
1359
1532
|
});
|
|
1360
1533
|
CommandMenuItem.displayName = "CommandMenuItem";
|
|
1361
|
-
const CommandMenuCheckboxItem =
|
|
1534
|
+
const CommandMenuCheckboxItem = React.memo((props) => {
|
|
1362
1535
|
const { children, ref, checked, onCheckedChange, onSelect, ...rest } = props;
|
|
1363
|
-
const handleSelect =
|
|
1536
|
+
const handleSelect = React.useCallback(() => {
|
|
1364
1537
|
onSelect == null ? void 0 : onSelect();
|
|
1365
1538
|
onCheckedChange(checked !== true);
|
|
1366
1539
|
}, [checked, onCheckedChange, onSelect]);
|
|
1367
|
-
return /* @__PURE__ */ jsxRuntime.jsx(CheckboxIndicatorContext, { value: checked, children: /* @__PURE__ */ jsxRuntime.jsx(CommandMenuItem, { ref, onSelect: handleSelect, "data-state": getCheckedState(checked), ...rest, children }) });
|
|
1540
|
+
return /* @__PURE__ */ jsxRuntime.jsx(CheckboxIndicatorContext, { value: checked, children: /* @__PURE__ */ jsxRuntime.jsx(CommandMenuItem, { ref, onSelect: handleSelect, "data-state": getCheckedState$1(checked), ...rest, children }) });
|
|
1368
1541
|
});
|
|
1369
1542
|
CommandMenuCheckboxItem.displayName = "CommandMenuCheckboxItem";
|
|
1370
|
-
const CommandMenuContent =
|
|
1543
|
+
const CommandMenuContent = React.memo((props) => {
|
|
1371
1544
|
const providerContext = useProvider();
|
|
1372
1545
|
const {
|
|
1373
1546
|
children,
|
|
@@ -1387,14 +1560,13 @@
|
|
|
1387
1560
|
radius = providerContext.radius,
|
|
1388
1561
|
...rest
|
|
1389
1562
|
} = props;
|
|
1390
|
-
const contextValue =
|
|
1563
|
+
const contextValue = React.useMemo(() => {
|
|
1391
1564
|
return {
|
|
1392
1565
|
variant,
|
|
1393
1566
|
size,
|
|
1394
|
-
radius
|
|
1395
|
-
accentColor
|
|
1567
|
+
radius
|
|
1396
1568
|
};
|
|
1397
|
-
}, [
|
|
1569
|
+
}, [radius, size, variant]);
|
|
1398
1570
|
return /* @__PURE__ */ jsxRuntime.jsx(RadixDialog.DialogPortal, { children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
1399
1571
|
RadixDialog.DialogContent,
|
|
1400
1572
|
{
|
|
@@ -1424,27 +1596,27 @@
|
|
|
1424
1596
|
) });
|
|
1425
1597
|
});
|
|
1426
1598
|
CommandMenuContent.displayName = "CommandMenuContent";
|
|
1427
|
-
const CommandMenuEmpty =
|
|
1599
|
+
const CommandMenuEmpty = React.memo((props) => {
|
|
1428
1600
|
const { className, ref, ...rest } = props;
|
|
1429
|
-
const { size } =
|
|
1601
|
+
const { size } = React.use(CommandMenuContext);
|
|
1430
1602
|
return /* @__PURE__ */ jsxRuntime.jsx(cmdk.CommandEmpty, { className: classVarianceAuthority.cx(commandMenuEmptyCva({ size }), className), ref, ...rest });
|
|
1431
1603
|
});
|
|
1432
1604
|
CommandMenuEmpty.displayName = "CommandMenuEmpty";
|
|
1433
|
-
const CommandMenuGroup =
|
|
1605
|
+
const CommandMenuGroup = React.memo((props) => {
|
|
1434
1606
|
const { className, ref, ...rest } = props;
|
|
1435
|
-
const { size } =
|
|
1607
|
+
const { size } = React.use(CommandMenuContext);
|
|
1436
1608
|
return /* @__PURE__ */ jsxRuntime.jsx(cmdk.CommandGroup, { className: classVarianceAuthority.cx(commandMenuGroupCva({ size }), className), ref, ...rest });
|
|
1437
1609
|
});
|
|
1438
1610
|
CommandMenuGroup.displayName = "CommandMenuGroup";
|
|
1439
|
-
const CommandMenuInput =
|
|
1611
|
+
const CommandMenuInput = React.memo((props) => {
|
|
1440
1612
|
const { className, ref, ...rest } = props;
|
|
1441
|
-
const { size } =
|
|
1613
|
+
const { size } = React.use(CommandMenuContext);
|
|
1442
1614
|
return /* @__PURE__ */ jsxRuntime.jsx(cmdk.CommandInput, { className: classVarianceAuthority.cx(commandMenuInputCva({ size }), className), ref, ...rest });
|
|
1443
1615
|
});
|
|
1444
1616
|
CommandMenuInput.displayName = "CommandMenuInput";
|
|
1445
|
-
const CommandMenuList =
|
|
1617
|
+
const CommandMenuList = React.memo((props) => {
|
|
1446
1618
|
const { className, ref, ...rest } = props;
|
|
1447
|
-
const { size } =
|
|
1619
|
+
const { size } = React.use(CommandMenuContext);
|
|
1448
1620
|
const filterCount = cmdk.useCommandState((state) => state.filtered.count);
|
|
1449
1621
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
1450
1622
|
cmdk.CommandList,
|
|
@@ -1467,11 +1639,11 @@
|
|
|
1467
1639
|
selected,
|
|
1468
1640
|
selectValue: handleSelectValue,
|
|
1469
1641
|
registerValue
|
|
1470
|
-
} =
|
|
1471
|
-
|
|
1642
|
+
} = React.use(MultiSelectContext);
|
|
1643
|
+
React.useLayoutEffect(() => {
|
|
1472
1644
|
return registerValue(value);
|
|
1473
1645
|
}, [registerValue, value]);
|
|
1474
|
-
const handleSelect =
|
|
1646
|
+
const handleSelect = React.useCallback(() => {
|
|
1475
1647
|
onSelect == null ? void 0 : onSelect();
|
|
1476
1648
|
handleSelectValue(value);
|
|
1477
1649
|
}, [handleSelectValue, onSelect, value]);
|
|
@@ -1481,7 +1653,7 @@
|
|
|
1481
1653
|
{
|
|
1482
1654
|
ref,
|
|
1483
1655
|
onSelect: handleSelect,
|
|
1484
|
-
"data-state": getSelectedState(isSelected),
|
|
1656
|
+
"data-state": getSelectedState$1(isSelected),
|
|
1485
1657
|
"aria-selected": isSelected,
|
|
1486
1658
|
closeOnSelect,
|
|
1487
1659
|
...rest,
|
|
@@ -1489,29 +1661,29 @@
|
|
|
1489
1661
|
}
|
|
1490
1662
|
) });
|
|
1491
1663
|
});
|
|
1492
|
-
const CommandMenuOverlay =
|
|
1664
|
+
const CommandMenuOverlay = React.memo((props) => {
|
|
1493
1665
|
const { container, className, ...rest } = props;
|
|
1494
1666
|
return /* @__PURE__ */ jsxRuntime.jsx(RadixDialog.DialogPortal, { container, children: /* @__PURE__ */ jsxRuntime.jsx(RadixDialog.DialogOverlay, { className: classVarianceAuthority.cx(commandMenuOverlayCva(), className), "data-floating-content": "", ...rest }) });
|
|
1495
1667
|
});
|
|
1496
1668
|
CommandMenuOverlay.displayName = "CommandMenuOverlay";
|
|
1497
|
-
const CommandMenuPage =
|
|
1669
|
+
const CommandMenuPage = React.memo((props) => {
|
|
1498
1670
|
const { children, ref, page, ...rest } = props;
|
|
1499
|
-
const { page: activePage } =
|
|
1500
|
-
const isActive =
|
|
1671
|
+
const { page: activePage } = React.use(CommandMenuPageContext);
|
|
1672
|
+
const isActive = React.useMemo(() => page === activePage, [page, activePage]);
|
|
1501
1673
|
return /* @__PURE__ */ jsxRuntime.jsx("div", { ref, "data-active": getActiveState(isActive), hidden: !isActive, ...rest, children: isActive ? children : null });
|
|
1502
1674
|
});
|
|
1503
1675
|
CommandMenuPage.displayName = "CommandMenuPage";
|
|
1504
|
-
const CommandMenuPages =
|
|
1676
|
+
const CommandMenuPages = React.memo((props) => {
|
|
1505
1677
|
const { children, defaultPage = "", page: controlledPage, onPageChange } = props;
|
|
1506
1678
|
const [page, setPage] = useControlledState(defaultPage, controlledPage, onPageChange);
|
|
1507
1679
|
return /* @__PURE__ */ jsxRuntime.jsx(CommandMenuPageContext, { value: { page, setPage }, children });
|
|
1508
1680
|
});
|
|
1509
1681
|
CommandMenuPages.displayName = "CommandMenuPages";
|
|
1510
|
-
const CommandMenuPageTriggerItem =
|
|
1682
|
+
const CommandMenuPageTriggerItem = React.memo((props) => {
|
|
1511
1683
|
const { ref, page, onSelect, closeOnSelect = false, ...rest } = props;
|
|
1512
|
-
const { page: activePage, setPage } =
|
|
1513
|
-
const isActive =
|
|
1514
|
-
const handleSelect =
|
|
1684
|
+
const { page: activePage, setPage } = React.use(CommandMenuPageContext);
|
|
1685
|
+
const isActive = React.useMemo(() => page === activePage, [page, activePage]);
|
|
1686
|
+
const handleSelect = React.useCallback(() => {
|
|
1515
1687
|
onSelect == null ? void 0 : onSelect();
|
|
1516
1688
|
setPage(page);
|
|
1517
1689
|
}, [onSelect, page, setPage]);
|
|
@@ -1549,18 +1721,18 @@
|
|
|
1549
1721
|
});
|
|
1550
1722
|
const CommandMenuRadioItem = genericMemo(function(props) {
|
|
1551
1723
|
const { children, ref, value, onSelect, ...rest } = props;
|
|
1552
|
-
const { selected, selectValue } =
|
|
1553
|
-
const handleSelect =
|
|
1724
|
+
const { selected, selectValue } = React.use(SelectContext);
|
|
1725
|
+
const handleSelect = React.useCallback(() => {
|
|
1554
1726
|
onSelect == null ? void 0 : onSelect();
|
|
1555
1727
|
selectValue(value);
|
|
1556
1728
|
}, [onSelect, selectValue, value]);
|
|
1557
1729
|
const isSelected = selected(value);
|
|
1558
|
-
return /* @__PURE__ */ jsxRuntime.jsx(SelectedIndicatorContext$1, { value: isSelected, children: /* @__PURE__ */ jsxRuntime.jsx(CommandMenuItem, { ref, onSelect: handleSelect, "data-state": getSelectedState(isSelected), ...rest, children }) });
|
|
1730
|
+
return /* @__PURE__ */ jsxRuntime.jsx(SelectedIndicatorContext$1, { value: isSelected, children: /* @__PURE__ */ jsxRuntime.jsx(CommandMenuItem, { ref, onSelect: handleSelect, "data-state": getSelectedState$1(isSelected), ...rest, children }) });
|
|
1559
1731
|
});
|
|
1560
|
-
const CommandMenuRoot =
|
|
1732
|
+
const CommandMenuRoot = React.memo((props) => {
|
|
1561
1733
|
const { children, defaultOpen, open: controlledOpen, onOpenChange, modal } = props;
|
|
1562
1734
|
const [open, setOpen] = useControlledState(defaultOpen ?? false, controlledOpen, onOpenChange);
|
|
1563
|
-
const contextValue =
|
|
1735
|
+
const contextValue = React.useMemo(() => {
|
|
1564
1736
|
return {
|
|
1565
1737
|
open,
|
|
1566
1738
|
setOpen
|
|
@@ -1571,8 +1743,8 @@
|
|
|
1571
1743
|
CommandMenuRoot.displayName = "CommandMenuRoot";
|
|
1572
1744
|
const CommandMenuSelectAllItem = genericMemo(function(props) {
|
|
1573
1745
|
const { ref, onSelect, closeOnSelect = false, ...rest } = props;
|
|
1574
|
-
const { allSelected, someSelected, toggleSelectAll } =
|
|
1575
|
-
const handleSelect =
|
|
1746
|
+
const { allSelected, someSelected, toggleSelectAll } = React.use(MultiSelectContext);
|
|
1747
|
+
const handleSelect = React.useCallback(() => {
|
|
1576
1748
|
onSelect == null ? void 0 : onSelect();
|
|
1577
1749
|
toggleSelectAll();
|
|
1578
1750
|
}, [onSelect, toggleSelectAll]);
|
|
@@ -1583,47 +1755,43 @@
|
|
|
1583
1755
|
ref,
|
|
1584
1756
|
role: "menuitemcheckbox",
|
|
1585
1757
|
onSelect: handleSelect,
|
|
1586
|
-
"data-state": getCheckedState(selectedState),
|
|
1758
|
+
"data-state": getCheckedState$1(selectedState),
|
|
1587
1759
|
closeOnSelect,
|
|
1588
1760
|
...rest
|
|
1589
1761
|
}
|
|
1590
1762
|
) });
|
|
1591
1763
|
});
|
|
1592
|
-
const
|
|
1593
|
-
|
|
1594
|
-
const
|
|
1595
|
-
const
|
|
1596
|
-
|
|
1764
|
+
const CommandMenuSelectedIndicator = React.memo((props) => {
|
|
1765
|
+
const { ref, className, children, ...rest } = props;
|
|
1766
|
+
const isSelected = React.use(SelectedIndicatorContext$1);
|
|
1767
|
+
const computedChildren = React.useMemo(() => {
|
|
1768
|
+
return typeof children === "function" ? children(isSelected) : children;
|
|
1769
|
+
}, [isSelected, children]);
|
|
1597
1770
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
1598
1771
|
"span",
|
|
1599
1772
|
{
|
|
1600
1773
|
ref,
|
|
1774
|
+
"data-state": getSelectedState$1(isSelected),
|
|
1601
1775
|
className: classVarianceAuthority.cx(
|
|
1602
|
-
"
|
|
1776
|
+
"inline-block size-max",
|
|
1603
1777
|
{
|
|
1604
1778
|
invisible: !isSelected
|
|
1605
1779
|
},
|
|
1606
1780
|
className
|
|
1607
1781
|
),
|
|
1608
|
-
"data-state": getSelectedState(isSelected),
|
|
1609
1782
|
...rest,
|
|
1610
1783
|
children: computedChildren
|
|
1611
1784
|
}
|
|
1612
1785
|
);
|
|
1613
1786
|
});
|
|
1614
|
-
SelectedIndicator.displayName = "SelectedIndicator";
|
|
1615
|
-
const CommandMenuSelectedIndicator = react.memo((props) => {
|
|
1616
|
-
const { ref, children, ...rest } = props;
|
|
1617
|
-
return /* @__PURE__ */ jsxRuntime.jsx(SelectedIndicator, { ref, ...rest, children });
|
|
1618
|
-
});
|
|
1619
1787
|
CommandMenuSelectedIndicator.displayName = "CommandMenuSelectedIndicator";
|
|
1620
|
-
const CommandMenuSeparator =
|
|
1788
|
+
const CommandMenuSeparator = React.memo((props) => {
|
|
1621
1789
|
const { className, ref, spacing = false, ...rest } = props;
|
|
1622
|
-
const { size } =
|
|
1790
|
+
const { size } = React.use(CommandMenuContext);
|
|
1623
1791
|
return /* @__PURE__ */ jsxRuntime.jsx(cmdk.CommandSeparator, { ref, className: classVarianceAuthority.cx(commandMenuSeparatorCva({ size, spacing }), className), ...rest });
|
|
1624
1792
|
});
|
|
1625
1793
|
CommandMenuSeparator.displayName = "CommandMenuSeparator";
|
|
1626
|
-
const CommandMenuTrigger =
|
|
1794
|
+
const CommandMenuTrigger = React.memo((props) => {
|
|
1627
1795
|
return /* @__PURE__ */ jsxRuntime.jsx(RadixDialog.DialogTrigger, { ...props });
|
|
1628
1796
|
});
|
|
1629
1797
|
CommandMenuTrigger.displayName = "CommandMenuTrigger";
|
|
@@ -1654,7 +1822,7 @@
|
|
|
1654
1822
|
Page: CommandMenuPage,
|
|
1655
1823
|
PageTriggerItem: CommandMenuPageTriggerItem
|
|
1656
1824
|
};
|
|
1657
|
-
const LuIcon =
|
|
1825
|
+
const LuIcon = React.memo((props) => {
|
|
1658
1826
|
const { ref, icon, className, size = "1em", ...rest } = props;
|
|
1659
1827
|
return /* @__PURE__ */ jsxRuntime.jsx(dynamic.DynamicIcon, { ref, className: classVarianceAuthority.cx("shrink-0", className), size, name: icon, ...rest });
|
|
1660
1828
|
});
|
|
@@ -1810,7 +1978,7 @@
|
|
|
1810
1978
|
}
|
|
1811
1979
|
}
|
|
1812
1980
|
});
|
|
1813
|
-
const DayPicker =
|
|
1981
|
+
const DayPicker = React.memo((props) => {
|
|
1814
1982
|
const providerContext = useProvider();
|
|
1815
1983
|
const {
|
|
1816
1984
|
components,
|
|
@@ -1822,7 +1990,7 @@
|
|
|
1822
1990
|
showOutsideDays = true,
|
|
1823
1991
|
...rest
|
|
1824
1992
|
} = props;
|
|
1825
|
-
const computedClassNames =
|
|
1993
|
+
const computedClassNames = React.useMemo(() => {
|
|
1826
1994
|
return {
|
|
1827
1995
|
...classNames,
|
|
1828
1996
|
root: classVarianceAuthority.cx(classNames == null ? void 0 : classNames.root, rootCva({ size })),
|
|
@@ -1852,7 +2020,7 @@
|
|
|
1852
2020
|
range_end: classVarianceAuthority.cx(classNames == null ? void 0 : classNames.range_end, "rdp-range-end")
|
|
1853
2021
|
};
|
|
1854
2022
|
}, [classNames, radius, size, variant]);
|
|
1855
|
-
const computedComponents =
|
|
2023
|
+
const computedComponents = React.useMemo(() => {
|
|
1856
2024
|
return {
|
|
1857
2025
|
...components,
|
|
1858
2026
|
Chevron
|
|
@@ -1870,19 +2038,19 @@
|
|
|
1870
2038
|
);
|
|
1871
2039
|
});
|
|
1872
2040
|
DayPicker.displayName = "DayPicker";
|
|
1873
|
-
const CloseDialogContext =
|
|
2041
|
+
const CloseDialogContext = React.createContext({});
|
|
1874
2042
|
const useCloseDialog = () => {
|
|
1875
|
-
const dialogContext =
|
|
2043
|
+
const dialogContext = React.useContext(CloseDialogContext);
|
|
1876
2044
|
if (!dialogContext) {
|
|
1877
2045
|
throw new Error("useDialog must be used within a DialogRoot");
|
|
1878
2046
|
}
|
|
1879
2047
|
return dialogContext;
|
|
1880
2048
|
};
|
|
1881
|
-
const DialogContent =
|
|
2049
|
+
const DialogContent = React.memo((props) => {
|
|
1882
2050
|
const { radius } = useProvider();
|
|
1883
2051
|
const close = useCloseDialog();
|
|
1884
2052
|
const { ref, children, container, className, size, ...rest } = props;
|
|
1885
|
-
const computedChildren =
|
|
2053
|
+
const computedChildren = React.useMemo(() => {
|
|
1886
2054
|
return typeof children === "function" ? children(close) : children;
|
|
1887
2055
|
}, [children, close]);
|
|
1888
2056
|
return /* @__PURE__ */ jsxRuntime.jsx(RadixDialog__namespace.Portal, { container, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
@@ -1897,7 +2065,7 @@
|
|
|
1897
2065
|
) });
|
|
1898
2066
|
});
|
|
1899
2067
|
DialogContent.displayName = "DialogContent";
|
|
1900
|
-
const DialogOverlay =
|
|
2068
|
+
const DialogOverlay = React.memo((props) => {
|
|
1901
2069
|
const { ref, children, className, container, ...rest } = props;
|
|
1902
2070
|
return /* @__PURE__ */ jsxRuntime.jsx(RadixDialog__namespace.Portal, { container, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
1903
2071
|
RadixDialog__namespace.Overlay,
|
|
@@ -1911,7 +2079,7 @@
|
|
|
1911
2079
|
) });
|
|
1912
2080
|
});
|
|
1913
2081
|
DialogOverlay.displayName = "DialogOverlay";
|
|
1914
|
-
const DialogRoot =
|
|
2082
|
+
const DialogRoot = React.memo((props) => {
|
|
1915
2083
|
const {
|
|
1916
2084
|
children,
|
|
1917
2085
|
onOpen,
|
|
@@ -1921,9 +2089,9 @@
|
|
|
1921
2089
|
open: externalOpen,
|
|
1922
2090
|
onOpenChange: externalOpenChange
|
|
1923
2091
|
} = props;
|
|
1924
|
-
const [innerOpen, setInnerOpen] =
|
|
2092
|
+
const [innerOpen, setInnerOpen] = React.useState(defaultOpen ?? false);
|
|
1925
2093
|
const open = externalOpen ?? innerOpen;
|
|
1926
|
-
const handleOpenChange =
|
|
2094
|
+
const handleOpenChange = React.useCallback(
|
|
1927
2095
|
(next) => {
|
|
1928
2096
|
if (externalOpenChange) return externalOpenChange(next);
|
|
1929
2097
|
if (next && onOpen) {
|
|
@@ -1941,7 +2109,7 @@
|
|
|
1941
2109
|
},
|
|
1942
2110
|
[externalOpenChange, onOpen, onClose, onCloseInterrupt]
|
|
1943
2111
|
);
|
|
1944
|
-
const closeDialog =
|
|
2112
|
+
const closeDialog = React.useCallback(
|
|
1945
2113
|
(options) => {
|
|
1946
2114
|
if (options == null ? void 0 : options.force) {
|
|
1947
2115
|
return setInnerOpen(false);
|
|
@@ -2000,7 +2168,7 @@
|
|
|
2000
2168
|
}
|
|
2001
2169
|
}
|
|
2002
2170
|
});
|
|
2003
|
-
const Heading =
|
|
2171
|
+
const Heading = React.memo((props) => {
|
|
2004
2172
|
const {
|
|
2005
2173
|
ref,
|
|
2006
2174
|
children,
|
|
@@ -2033,7 +2201,7 @@
|
|
|
2033
2201
|
);
|
|
2034
2202
|
});
|
|
2035
2203
|
Heading.displayName = "Heading";
|
|
2036
|
-
const HoverCardArrow =
|
|
2204
|
+
const HoverCardArrow = React.memo((props) => {
|
|
2037
2205
|
const { ref, children, className, ...rest } = props;
|
|
2038
2206
|
return /* @__PURE__ */ jsxRuntime.jsx(RadixHoverCard__namespace.Arrow, { className: classVarianceAuthority.cx("fill-(--base-6)", className), ref, ...rest, children });
|
|
2039
2207
|
});
|
|
@@ -2052,7 +2220,7 @@
|
|
|
2052
2220
|
size: "md"
|
|
2053
2221
|
}
|
|
2054
2222
|
});
|
|
2055
|
-
const HoverCardContent =
|
|
2223
|
+
const HoverCardContent = React.memo((props) => {
|
|
2056
2224
|
const providerContext = useProvider();
|
|
2057
2225
|
const {
|
|
2058
2226
|
ref,
|
|
@@ -2092,12 +2260,12 @@
|
|
|
2092
2260
|
Root: RadixHoverCard__namespace.Root,
|
|
2093
2261
|
Trigger: RadixHoverCard__namespace.Trigger
|
|
2094
2262
|
};
|
|
2095
|
-
const HoverUtility =
|
|
2096
|
-
const [isHovered, setIsHovered] =
|
|
2097
|
-
const handlePointerEnter =
|
|
2263
|
+
const HoverUtility = React.memo(function Root({ children, forceHover }) {
|
|
2264
|
+
const [isHovered, setIsHovered] = React.useState(false);
|
|
2265
|
+
const handlePointerEnter = React.useCallback(() => {
|
|
2098
2266
|
setIsHovered(true);
|
|
2099
2267
|
}, []);
|
|
2100
|
-
const handlePointerLeave =
|
|
2268
|
+
const handlePointerLeave = React.useCallback(() => {
|
|
2101
2269
|
setIsHovered(false);
|
|
2102
2270
|
}, []);
|
|
2103
2271
|
return children({
|
|
@@ -2106,8 +2274,7 @@
|
|
|
2106
2274
|
onPointerLeave: handlePointerLeave
|
|
2107
2275
|
});
|
|
2108
2276
|
});
|
|
2109
|
-
|
|
2110
|
-
const InputContext = react.createContext({});
|
|
2277
|
+
const InputContext = React.createContext({});
|
|
2111
2278
|
const inputRoot$1 = classVarianceAuthority.cva(
|
|
2112
2279
|
[
|
|
2113
2280
|
"flex",
|
|
@@ -2182,9 +2349,9 @@
|
|
|
2182
2349
|
size: "md"
|
|
2183
2350
|
}
|
|
2184
2351
|
});
|
|
2185
|
-
const InputField =
|
|
2352
|
+
const InputField = React.memo((props) => {
|
|
2186
2353
|
const { ref, children, className, ...rest } = props;
|
|
2187
|
-
const { size, variant } =
|
|
2354
|
+
const { size, variant } = React.useContext(InputContext);
|
|
2188
2355
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
2189
2356
|
"input",
|
|
2190
2357
|
{
|
|
@@ -2196,7 +2363,7 @@
|
|
|
2196
2363
|
);
|
|
2197
2364
|
});
|
|
2198
2365
|
InputField.displayName = "InputField";
|
|
2199
|
-
const InputRoot =
|
|
2366
|
+
const InputRoot = React.memo((props) => {
|
|
2200
2367
|
const providerContext = useProvider();
|
|
2201
2368
|
const {
|
|
2202
2369
|
ref,
|
|
@@ -2220,9 +2387,9 @@
|
|
|
2220
2387
|
) });
|
|
2221
2388
|
});
|
|
2222
2389
|
InputRoot.displayName = "InputRoot";
|
|
2223
|
-
const InputSlot =
|
|
2390
|
+
const InputSlot = React.memo((props) => {
|
|
2224
2391
|
const { ref, children, className, ...rest } = props;
|
|
2225
|
-
const { size, variant } =
|
|
2392
|
+
const { size, variant } = React.useContext(InputContext);
|
|
2226
2393
|
return /* @__PURE__ */ jsxRuntime.jsx("div", { className: classVarianceAuthority.cx(inputSlot({ size, variant }), "flex items-center", className), ref, ...rest, children });
|
|
2227
2394
|
});
|
|
2228
2395
|
InputSlot.displayName = "InputSlot";
|
|
@@ -2231,27 +2398,27 @@
|
|
|
2231
2398
|
Root: InputRoot,
|
|
2232
2399
|
Slot: InputSlot
|
|
2233
2400
|
};
|
|
2234
|
-
const LayoutContext =
|
|
2235
|
-
const useLayoutContext = () =>
|
|
2236
|
-
const LayoutContainer =
|
|
2401
|
+
const LayoutContext = React.createContext({});
|
|
2402
|
+
const useLayoutContext = () => React.useContext(LayoutContext);
|
|
2403
|
+
const LayoutContainer = React.memo((props) => {
|
|
2237
2404
|
const { ref, children, className, ...rest } = props;
|
|
2238
2405
|
const { hideLayout = false } = useLayoutContext();
|
|
2239
2406
|
return !hideLayout && /* @__PURE__ */ jsxRuntime.jsx("div", { className: classVarianceAuthority.cx("flex h-full grow", className), ref, ...rest, children });
|
|
2240
2407
|
});
|
|
2241
2408
|
LayoutContainer.displayName = "LayoutContainer";
|
|
2242
|
-
const LayoutRoot =
|
|
2409
|
+
const LayoutRoot = React.memo((props) => {
|
|
2243
2410
|
const { children, small = false, hideLayout = false } = props;
|
|
2244
|
-
const [openMapping, setOpenMapping] =
|
|
2245
|
-
const isOpen =
|
|
2411
|
+
const [openMapping, setOpenMapping] = React.useState({});
|
|
2412
|
+
const isOpen = React.useCallback(
|
|
2246
2413
|
(id) => {
|
|
2247
2414
|
return openMapping[id] ?? false;
|
|
2248
2415
|
},
|
|
2249
2416
|
[openMapping]
|
|
2250
2417
|
);
|
|
2251
|
-
const setOpen =
|
|
2418
|
+
const setOpen = React.useCallback((id, open) => {
|
|
2252
2419
|
setOpenMapping((prev) => ({ ...prev, [id]: open }));
|
|
2253
2420
|
}, []);
|
|
2254
|
-
const contextValue =
|
|
2421
|
+
const contextValue = React.useMemo(
|
|
2255
2422
|
() => ({
|
|
2256
2423
|
small,
|
|
2257
2424
|
hideLayout,
|
|
@@ -2265,10 +2432,10 @@
|
|
|
2265
2432
|
LayoutRoot.displayName = "LayoutRoot";
|
|
2266
2433
|
function usePointerDownOutside(onPointerDownOutside, ownerElement = globalThis == null ? void 0 : globalThis.document.body) {
|
|
2267
2434
|
const handlePointerDownOutside = useCallbackRef(onPointerDownOutside);
|
|
2268
|
-
const isPointerInsideReactTreeRef =
|
|
2269
|
-
const handleClickRef =
|
|
2435
|
+
const isPointerInsideReactTreeRef = React.useRef(false);
|
|
2436
|
+
const handleClickRef = React.useRef(() => {
|
|
2270
2437
|
});
|
|
2271
|
-
|
|
2438
|
+
React.useEffect(() => {
|
|
2272
2439
|
const handlePointerDown = (event) => {
|
|
2273
2440
|
if (event.target && !isPointerInsideReactTreeRef.current) {
|
|
2274
2441
|
const eventDetail = { originalEvent: event };
|
|
@@ -2315,17 +2482,17 @@
|
|
|
2315
2482
|
}
|
|
2316
2483
|
}
|
|
2317
2484
|
function useCallbackRef(callback) {
|
|
2318
|
-
const callbackRef =
|
|
2319
|
-
|
|
2485
|
+
const callbackRef = React.useRef(callback);
|
|
2486
|
+
React.useEffect(() => {
|
|
2320
2487
|
callbackRef.current = callback;
|
|
2321
2488
|
});
|
|
2322
|
-
return
|
|
2489
|
+
return React.useMemo(() => (...args) => {
|
|
2323
2490
|
var _a;
|
|
2324
2491
|
return (_a = callbackRef.current) == null ? void 0 : _a.call(callbackRef, ...args);
|
|
2325
2492
|
}, []);
|
|
2326
2493
|
}
|
|
2327
2494
|
const TIMEOUT_DURATION = 200;
|
|
2328
|
-
const SlideOut =
|
|
2495
|
+
const SlideOut = React.memo((props) => {
|
|
2329
2496
|
const {
|
|
2330
2497
|
ref,
|
|
2331
2498
|
children,
|
|
@@ -2348,25 +2515,25 @@
|
|
|
2348
2515
|
...otherProps
|
|
2349
2516
|
} = props;
|
|
2350
2517
|
const isLeft = side === "left";
|
|
2351
|
-
const [parentContainer, setParentContainer] =
|
|
2352
|
-
const childrenContainerRef =
|
|
2353
|
-
const localRef =
|
|
2354
|
-
const nodeRef =
|
|
2518
|
+
const [parentContainer, setParentContainer] = React.useState(document.body);
|
|
2519
|
+
const childrenContainerRef = React.useRef(null);
|
|
2520
|
+
const localRef = React.useRef(null);
|
|
2521
|
+
const nodeRef = React.useRef(null);
|
|
2355
2522
|
const mergedRefs = mergeRefs([ref, localRef, nodeRef]);
|
|
2356
|
-
const [isResizing, setIsResizing] =
|
|
2357
|
-
const [computedWidth, setComputedWidth] =
|
|
2358
|
-
const prevClientX =
|
|
2359
|
-
const handleDismiss =
|
|
2523
|
+
const [isResizing, setIsResizing] = React.useState(false);
|
|
2524
|
+
const [computedWidth, setComputedWidth] = React.useState(null);
|
|
2525
|
+
const prevClientX = React.useRef(null);
|
|
2526
|
+
const handleDismiss = React.useCallback(() => {
|
|
2360
2527
|
if (modal && onDismiss) {
|
|
2361
2528
|
onDismiss();
|
|
2362
2529
|
}
|
|
2363
2530
|
}, [modal, onDismiss]);
|
|
2364
|
-
const handleAssignParentContainer =
|
|
2531
|
+
const handleAssignParentContainer = React.useCallback((element) => {
|
|
2365
2532
|
if (element) {
|
|
2366
2533
|
setParentContainer(element);
|
|
2367
2534
|
}
|
|
2368
2535
|
}, []);
|
|
2369
|
-
|
|
2536
|
+
React.useEffect(() => {
|
|
2370
2537
|
if (!childrenContainerRef.current) return;
|
|
2371
2538
|
const originalParentPointerEvents = childrenContainerRef.current.style.pointerEvents;
|
|
2372
2539
|
if (open && modal) {
|
|
@@ -2379,7 +2546,7 @@
|
|
|
2379
2546
|
};
|
|
2380
2547
|
}, [modal, open, parentContainer.style]);
|
|
2381
2548
|
const { onPointerDownCapture: handlePointerDownCapture } = usePointerDownOutside(handleDismiss, parentContainer);
|
|
2382
|
-
const CSSTransitionClassNames =
|
|
2549
|
+
const CSSTransitionClassNames = React.useMemo(
|
|
2383
2550
|
() => ({
|
|
2384
2551
|
enter: isLeft ? "-ml-(--slide-out-width)" : "-mr-(--slide-out-width)",
|
|
2385
2552
|
enterActive: isLeft ? "ease-linear duration-200 transition-[margin-left] ml-0" : "ease-linear duration-200 transition-[margin-right] mr-0",
|
|
@@ -2389,12 +2556,12 @@
|
|
|
2389
2556
|
}),
|
|
2390
2557
|
[isLeft]
|
|
2391
2558
|
);
|
|
2392
|
-
const handleMouseDown =
|
|
2559
|
+
const handleMouseDown = React.useCallback((e) => {
|
|
2393
2560
|
const { clientX } = e;
|
|
2394
2561
|
prevClientX.current = clientX;
|
|
2395
2562
|
setIsResizing(true);
|
|
2396
2563
|
}, []);
|
|
2397
|
-
const handleMouseMove =
|
|
2564
|
+
const handleMouseMove = React.useCallback(
|
|
2398
2565
|
(e) => {
|
|
2399
2566
|
if (!isResizing) return;
|
|
2400
2567
|
const { clientX } = e;
|
|
@@ -2404,12 +2571,12 @@
|
|
|
2404
2571
|
},
|
|
2405
2572
|
[isLeft, isResizing]
|
|
2406
2573
|
);
|
|
2407
|
-
const handleMouseUp =
|
|
2574
|
+
const handleMouseUp = React.useCallback(() => {
|
|
2408
2575
|
if (!isResizing) return;
|
|
2409
2576
|
prevClientX.current = null;
|
|
2410
2577
|
setIsResizing(false);
|
|
2411
2578
|
}, [isResizing]);
|
|
2412
|
-
|
|
2579
|
+
React.useEffect(() => {
|
|
2413
2580
|
window.addEventListener("mousemove", handleMouseMove);
|
|
2414
2581
|
window.addEventListener("mouseup", handleMouseUp);
|
|
2415
2582
|
return () => {
|
|
@@ -2417,11 +2584,11 @@
|
|
|
2417
2584
|
window.removeEventListener("mouseup", handleMouseUp);
|
|
2418
2585
|
};
|
|
2419
2586
|
}, [handleMouseMove, handleMouseUp]);
|
|
2420
|
-
|
|
2587
|
+
React.useLayoutEffect(() => {
|
|
2421
2588
|
if (!open) return;
|
|
2422
2589
|
setComputedWidth(localRef.current.offsetWidth);
|
|
2423
2590
|
}, [open]);
|
|
2424
|
-
const resizableStyle =
|
|
2591
|
+
const resizableStyle = React.useMemo(
|
|
2425
2592
|
() => ({
|
|
2426
2593
|
...style,
|
|
2427
2594
|
width: computedWidth ?? initialWidth,
|
|
@@ -2432,11 +2599,11 @@
|
|
|
2432
2599
|
}),
|
|
2433
2600
|
[computedWidth, initialWidth, maxWidth, minWidth, position, style]
|
|
2434
2601
|
);
|
|
2435
|
-
const resizableEnable =
|
|
2602
|
+
const resizableEnable = React.useMemo(
|
|
2436
2603
|
() => ({ left: resizeable && !isLeft, right: resizeable && isLeft }),
|
|
2437
2604
|
[isLeft, resizeable]
|
|
2438
2605
|
);
|
|
2439
|
-
const SlideOut2 =
|
|
2606
|
+
const SlideOut2 = React.useMemo(
|
|
2440
2607
|
() => (
|
|
2441
2608
|
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
2442
2609
|
// @ts-ignore
|
|
@@ -2531,7 +2698,7 @@
|
|
|
2531
2698
|
});
|
|
2532
2699
|
SlideOut.displayName = "SlideOut";
|
|
2533
2700
|
const DEFAULT_INITIAL_WIDTH = "30%";
|
|
2534
|
-
const LayoutSlideOut =
|
|
2701
|
+
const LayoutSlideOut = React.memo((props) => {
|
|
2535
2702
|
const { small, hideLayout, isOpen, setOpen } = useLayoutContext();
|
|
2536
2703
|
const {
|
|
2537
2704
|
ref,
|
|
@@ -2545,14 +2712,14 @@
|
|
|
2545
2712
|
...rest
|
|
2546
2713
|
} = props;
|
|
2547
2714
|
const open = isOpen(id);
|
|
2548
|
-
|
|
2715
|
+
React.useEffect(() => {
|
|
2549
2716
|
if (small && (defaultOpen == null ? void 0 : defaultOpen.small) !== void 0) {
|
|
2550
2717
|
setOpen(id, defaultOpen == null ? void 0 : defaultOpen.small);
|
|
2551
2718
|
} else if (!small && (defaultOpen == null ? void 0 : defaultOpen.large) !== void 0) {
|
|
2552
2719
|
setOpen(id, defaultOpen == null ? void 0 : defaultOpen.large);
|
|
2553
2720
|
}
|
|
2554
2721
|
}, [defaultOpen, id, setOpen, small]);
|
|
2555
|
-
const handleDismiss =
|
|
2722
|
+
const handleDismiss = React.useCallback(() => {
|
|
2556
2723
|
setOpen(id, false);
|
|
2557
2724
|
onDismiss == null ? void 0 : onDismiss();
|
|
2558
2725
|
}, [id, onDismiss, setOpen]);
|
|
@@ -2573,10 +2740,10 @@
|
|
|
2573
2740
|
);
|
|
2574
2741
|
});
|
|
2575
2742
|
LayoutSlideOut.displayName = "LayoutSlideOut";
|
|
2576
|
-
const LayoutSlideOutOverlay =
|
|
2743
|
+
const LayoutSlideOutOverlay = React.memo((props) => {
|
|
2577
2744
|
const { ref, children, className, active, slideOutId, smallModeOnly = false, ...rest } = props;
|
|
2578
2745
|
const { small, hideLayout, isOpen } = useLayoutContext();
|
|
2579
|
-
const showOverlay =
|
|
2746
|
+
const showOverlay = React.useMemo(() => {
|
|
2580
2747
|
if (active !== void 0) return active;
|
|
2581
2748
|
if (hideLayout) return false;
|
|
2582
2749
|
if (smallModeOnly && !small) return false;
|
|
@@ -2585,6 +2752,40 @@
|
|
|
2585
2752
|
return showOverlay && /* @__PURE__ */ jsxRuntime.jsx("div", { className: classVarianceAuthority.cx("overmap-layout-overlay", "fixed inset-0", className), ref, ...rest, children });
|
|
2586
2753
|
});
|
|
2587
2754
|
LayoutSlideOutOverlay.displayName = "SlideOutOverlay";
|
|
2755
|
+
const MENU_OVERFLOW_PADDING = 20;
|
|
2756
|
+
const MENU_CONTENT_PADDING = 8;
|
|
2757
|
+
const MENU_MINIMUM_MAX_HEIGHT = 250;
|
|
2758
|
+
const computeOffsets = (side, alignment) => {
|
|
2759
|
+
switch (side) {
|
|
2760
|
+
case "right":
|
|
2761
|
+
if (alignment === "start") {
|
|
2762
|
+
return { mainAxis: MENU_CONTENT_PADDING + 1, crossAxis: -MENU_CONTENT_PADDING };
|
|
2763
|
+
} else if (alignment === "end") {
|
|
2764
|
+
return { mainAxis: MENU_CONTENT_PADDING + 1, crossAxis: MENU_CONTENT_PADDING };
|
|
2765
|
+
}
|
|
2766
|
+
break;
|
|
2767
|
+
case "left":
|
|
2768
|
+
if (alignment === "start") {
|
|
2769
|
+
return { mainAxis: MENU_CONTENT_PADDING + 1, crossAxis: -MENU_CONTENT_PADDING };
|
|
2770
|
+
} else if (alignment === "end") {
|
|
2771
|
+
return { mainAxis: MENU_CONTENT_PADDING + 1, crossAxis: MENU_CONTENT_PADDING };
|
|
2772
|
+
}
|
|
2773
|
+
break;
|
|
2774
|
+
}
|
|
2775
|
+
return { mainAxis: MENU_CONTENT_PADDING + 1, crossAxis: 0 };
|
|
2776
|
+
};
|
|
2777
|
+
function getSelectedState(selected) {
|
|
2778
|
+
return selected ? "selected" : "unselected";
|
|
2779
|
+
}
|
|
2780
|
+
function getCheckedState(checked) {
|
|
2781
|
+
return checked === true ? "checked" : checked === false ? "unchecked" : "indeterminate";
|
|
2782
|
+
}
|
|
2783
|
+
function getBooleanState(value) {
|
|
2784
|
+
return value ? "true" : "false";
|
|
2785
|
+
}
|
|
2786
|
+
function getOpenState(open) {
|
|
2787
|
+
return open ? "open" : "closed";
|
|
2788
|
+
}
|
|
2588
2789
|
function nextStateBasedOnType(open, type) {
|
|
2589
2790
|
switch (type) {
|
|
2590
2791
|
case "toggle":
|
|
@@ -2595,11 +2796,11 @@
|
|
|
2595
2796
|
return false;
|
|
2596
2797
|
}
|
|
2597
2798
|
}
|
|
2598
|
-
const LayoutSlideOutTrigger =
|
|
2799
|
+
const LayoutSlideOutTrigger = React.memo((props) => {
|
|
2599
2800
|
const { ref, slideOutId, type = "toggle", children, ...rest } = props;
|
|
2600
2801
|
const { isOpen, setOpen } = useLayoutContext();
|
|
2601
2802
|
const open = isOpen(slideOutId);
|
|
2602
|
-
const handleClick =
|
|
2803
|
+
const handleClick = React.useCallback(() => {
|
|
2603
2804
|
setOpen(slideOutId, nextStateBasedOnType(open, type));
|
|
2604
2805
|
}, [open, setOpen, slideOutId, type]);
|
|
2605
2806
|
return /* @__PURE__ */ jsxRuntime.jsx(reactSlot.Slot, { "data-state": getOpenState(open), ref, onClick: handleClick, ...rest, children });
|
|
@@ -2648,7 +2849,7 @@
|
|
|
2648
2849
|
align: "left"
|
|
2649
2850
|
}
|
|
2650
2851
|
});
|
|
2651
|
-
const Link =
|
|
2852
|
+
const Link = React.memo((props) => {
|
|
2652
2853
|
const providerContext = useProvider();
|
|
2653
2854
|
const {
|
|
2654
2855
|
ref,
|
|
@@ -2680,6 +2881,28 @@
|
|
|
2680
2881
|
);
|
|
2681
2882
|
});
|
|
2682
2883
|
Link.displayName = "Link";
|
|
2884
|
+
const CheckedIndicatorContext = React.createContext({});
|
|
2885
|
+
const CheckedIndicator = (props) => {
|
|
2886
|
+
const { children, ref, className, ...rest } = props;
|
|
2887
|
+
const checked = React.useContext(CheckedIndicatorContext);
|
|
2888
|
+
const computedChildren = typeof children === "function" ? children(checked === "indeterminate") : children;
|
|
2889
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
2890
|
+
"span",
|
|
2891
|
+
{
|
|
2892
|
+
ref,
|
|
2893
|
+
className: classVarianceAuthority.cx(
|
|
2894
|
+
"flex size-max items-center",
|
|
2895
|
+
{
|
|
2896
|
+
invisible: checked === false
|
|
2897
|
+
},
|
|
2898
|
+
className
|
|
2899
|
+
),
|
|
2900
|
+
"data-state": getCheckedState$1(checked),
|
|
2901
|
+
...rest,
|
|
2902
|
+
children: computedChildren
|
|
2903
|
+
}
|
|
2904
|
+
);
|
|
2905
|
+
};
|
|
2683
2906
|
const menuItem = classVarianceAuthority.cva(
|
|
2684
2907
|
[
|
|
2685
2908
|
"select-none",
|
|
@@ -2825,31 +3048,322 @@
|
|
|
2825
3048
|
}
|
|
2826
3049
|
}
|
|
2827
3050
|
);
|
|
2828
|
-
const
|
|
2829
|
-
const
|
|
2830
|
-
const
|
|
2831
|
-
const
|
|
2832
|
-
|
|
2833
|
-
|
|
2834
|
-
|
|
2835
|
-
|
|
3051
|
+
const MenuContext = React.createContext({});
|
|
3052
|
+
const useMenuContext = () => React.useContext(MenuContext);
|
|
3053
|
+
const DEFAULT_OFFSET = 5;
|
|
3054
|
+
const MenuRoot = React.memo((props) => {
|
|
3055
|
+
const {
|
|
3056
|
+
children,
|
|
3057
|
+
side = "bottom",
|
|
3058
|
+
align = "center",
|
|
3059
|
+
offset,
|
|
3060
|
+
loop = false,
|
|
3061
|
+
modal = false,
|
|
3062
|
+
// open state related props
|
|
3063
|
+
open: controlledOpen,
|
|
3064
|
+
onOpenChange,
|
|
3065
|
+
defaultOpen
|
|
3066
|
+
} = props;
|
|
3067
|
+
const [open, setOpen] = useControlledState(defaultOpen ?? false, controlledOpen, onOpenChange);
|
|
3068
|
+
const [activeIndex, setActiveIndex] = React.useState(null);
|
|
3069
|
+
const [triggerType, setTriggerType] = React.useState(null);
|
|
3070
|
+
const elementsRef = React.useRef([]);
|
|
3071
|
+
const nodeId = react.useFloatingNodeId();
|
|
3072
|
+
const { refs, floatingStyles, context, middlewareData } = react.useFloating({
|
|
3073
|
+
nodeId,
|
|
3074
|
+
strategy: "fixed",
|
|
3075
|
+
placement: side + (align !== "center" ? "-" + align : ""),
|
|
3076
|
+
whileElementsMounted: react.autoUpdate,
|
|
3077
|
+
open,
|
|
3078
|
+
onOpenChange: setOpen,
|
|
3079
|
+
middleware: [
|
|
3080
|
+
react.offset({ mainAxis: offset ?? DEFAULT_OFFSET }),
|
|
3081
|
+
react.size({
|
|
3082
|
+
apply({ availableHeight, elements }) {
|
|
3083
|
+
elements.floating.style.setProperty(
|
|
3084
|
+
"--overmap-menu-available-height",
|
|
3085
|
+
`${Math.max(availableHeight, MENU_MINIMUM_MAX_HEIGHT)}px`
|
|
3086
|
+
);
|
|
3087
|
+
},
|
|
3088
|
+
padding: MENU_OVERFLOW_PADDING
|
|
3089
|
+
}),
|
|
3090
|
+
react.flip({ fallbackStrategy: "initialPlacement" }),
|
|
3091
|
+
react.shift({ padding: MENU_OVERFLOW_PADDING }),
|
|
3092
|
+
react.hide()
|
|
3093
|
+
]
|
|
3094
|
+
});
|
|
3095
|
+
const role = react.useRole(context, {
|
|
3096
|
+
role: "menu"
|
|
3097
|
+
});
|
|
3098
|
+
const dismiss = react.useDismiss(context, {
|
|
3099
|
+
capture: true,
|
|
3100
|
+
ancestorScroll: triggerType === "context" || triggerType === "virtual"
|
|
3101
|
+
});
|
|
3102
|
+
const click = react.useClick(context, {
|
|
3103
|
+
enabled: triggerType === "click"
|
|
3104
|
+
});
|
|
3105
|
+
const listNavigation = react.useListNavigation(context, {
|
|
3106
|
+
listRef: elementsRef,
|
|
3107
|
+
activeIndex,
|
|
3108
|
+
onNavigate: setActiveIndex,
|
|
3109
|
+
loop
|
|
3110
|
+
});
|
|
3111
|
+
const { getFloatingProps, getItemProps, getReferenceProps } = react.useInteractions([
|
|
3112
|
+
dismiss,
|
|
3113
|
+
listNavigation,
|
|
3114
|
+
click,
|
|
3115
|
+
role
|
|
3116
|
+
]);
|
|
3117
|
+
return /* @__PURE__ */ jsxRuntime.jsx(react.FloatingTree, { children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
3118
|
+
MenuContext.Provider,
|
|
3119
|
+
{
|
|
3120
|
+
value: {
|
|
3121
|
+
open,
|
|
3122
|
+
setOpen,
|
|
3123
|
+
refs,
|
|
3124
|
+
context,
|
|
3125
|
+
floatingStyles,
|
|
3126
|
+
elementsRef,
|
|
3127
|
+
getFloatingProps,
|
|
3128
|
+
getItemProps,
|
|
3129
|
+
getReferenceProps,
|
|
3130
|
+
nodeId,
|
|
3131
|
+
activeIndex,
|
|
3132
|
+
setActiveIndex,
|
|
3133
|
+
middlewareData,
|
|
3134
|
+
side,
|
|
3135
|
+
modal,
|
|
3136
|
+
setTriggerType
|
|
3137
|
+
},
|
|
3138
|
+
children
|
|
3139
|
+
}
|
|
3140
|
+
) });
|
|
3141
|
+
});
|
|
3142
|
+
MenuRoot.displayName = "Root";
|
|
3143
|
+
const MenuContentContext = React.createContext({});
|
|
3144
|
+
const useMenuContentContext = () => React.useContext(MenuContentContext);
|
|
3145
|
+
const MenuContent = React.memo((props) => {
|
|
3146
|
+
var _a;
|
|
3147
|
+
const providerContext = useProvider();
|
|
2836
3148
|
const {
|
|
2837
3149
|
ref: forwardedRef,
|
|
2838
3150
|
className,
|
|
2839
3151
|
children,
|
|
2840
|
-
|
|
2841
|
-
|
|
2842
|
-
|
|
2843
|
-
|
|
2844
|
-
disabled = false,
|
|
3152
|
+
size = "md",
|
|
3153
|
+
variant = "soft",
|
|
3154
|
+
radius = providerContext.radius,
|
|
3155
|
+
accentColor = "base",
|
|
2845
3156
|
...rest
|
|
2846
3157
|
} = props;
|
|
2847
|
-
const {
|
|
2848
|
-
|
|
2849
|
-
|
|
3158
|
+
const {
|
|
3159
|
+
refs,
|
|
3160
|
+
getFloatingProps,
|
|
3161
|
+
middlewareData,
|
|
3162
|
+
elementsRef,
|
|
3163
|
+
activeIndex,
|
|
3164
|
+
setActiveIndex,
|
|
3165
|
+
getItemProps,
|
|
3166
|
+
open,
|
|
3167
|
+
setOpen,
|
|
3168
|
+
nodeId,
|
|
3169
|
+
context,
|
|
3170
|
+
floatingStyles,
|
|
3171
|
+
modal,
|
|
3172
|
+
side
|
|
3173
|
+
} = useMenuContext();
|
|
3174
|
+
const computedFloatingStyles = React.useMemo(() => {
|
|
3175
|
+
var _a2;
|
|
3176
|
+
return {
|
|
3177
|
+
...floatingStyles,
|
|
3178
|
+
visibility: ((_a2 = middlewareData.hide) == null ? void 0 : _a2.referenceHidden) ? "hidden" : "visible"
|
|
3179
|
+
};
|
|
3180
|
+
}, [floatingStyles, (_a = middlewareData.hide) == null ? void 0 : _a.referenceHidden]);
|
|
3181
|
+
const handleOverlayPointerDown = React.useCallback(
|
|
2850
3182
|
(e) => {
|
|
2851
|
-
|
|
2852
|
-
|
|
3183
|
+
if (modal) stopPropagation(e);
|
|
3184
|
+
},
|
|
3185
|
+
[modal]
|
|
3186
|
+
);
|
|
3187
|
+
return /* @__PURE__ */ jsxRuntime.jsx(react.FloatingNode, { id: nodeId, children: open && /* @__PURE__ */ jsxRuntime.jsx(react.FloatingPortal, { children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
3188
|
+
react.FloatingOverlay,
|
|
3189
|
+
{
|
|
3190
|
+
className: menuOverlay({ modal }),
|
|
3191
|
+
onClick: handleOverlayPointerDown,
|
|
3192
|
+
lockScroll: true,
|
|
3193
|
+
"data-floating-content": "",
|
|
3194
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(react.FloatingFocusManager, { context, children: /* @__PURE__ */ jsxRuntime.jsx(react.FloatingList, { elementsRef, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
3195
|
+
MenuContentContext.Provider,
|
|
3196
|
+
{
|
|
3197
|
+
value: {
|
|
3198
|
+
getItemProps,
|
|
3199
|
+
activeIndex,
|
|
3200
|
+
elementsRef,
|
|
3201
|
+
open,
|
|
3202
|
+
setOpen,
|
|
3203
|
+
refs,
|
|
3204
|
+
setActiveIndex,
|
|
3205
|
+
size,
|
|
3206
|
+
variant,
|
|
3207
|
+
accentColor,
|
|
3208
|
+
radius
|
|
3209
|
+
},
|
|
3210
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
3211
|
+
"div",
|
|
3212
|
+
{
|
|
3213
|
+
className: "border-box w-max outline-none",
|
|
3214
|
+
ref: refs.setFloating,
|
|
3215
|
+
tabIndex: -1,
|
|
3216
|
+
style: computedFloatingStyles,
|
|
3217
|
+
"data-floating-content": "",
|
|
3218
|
+
...getFloatingProps(),
|
|
3219
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
3220
|
+
"ul",
|
|
3221
|
+
{
|
|
3222
|
+
className: classVarianceAuthority.cx(
|
|
3223
|
+
menuContent({ size }),
|
|
3224
|
+
floating({ side, shadow: "3" }),
|
|
3225
|
+
radiusCva({ radius, maxLarge: true }),
|
|
3226
|
+
"max-h-(--overmap-menu-available-height)",
|
|
3227
|
+
className
|
|
3228
|
+
),
|
|
3229
|
+
ref: forwardedRef,
|
|
3230
|
+
"data-state": getOpenState(open),
|
|
3231
|
+
"data-side": side,
|
|
3232
|
+
"data-accent-color": accentColor,
|
|
3233
|
+
...rest,
|
|
3234
|
+
children
|
|
3235
|
+
}
|
|
3236
|
+
)
|
|
3237
|
+
}
|
|
3238
|
+
)
|
|
3239
|
+
}
|
|
3240
|
+
) }) })
|
|
3241
|
+
}
|
|
3242
|
+
) }) });
|
|
3243
|
+
});
|
|
3244
|
+
MenuContent.displayName = "Menu.Content";
|
|
3245
|
+
const SubContext = React.createContext({});
|
|
3246
|
+
const useSubContext = () => React.useContext(SubContext);
|
|
3247
|
+
const MenuSub = React.memo((props) => {
|
|
3248
|
+
const {
|
|
3249
|
+
children,
|
|
3250
|
+
disabled = false,
|
|
3251
|
+
side = "right",
|
|
3252
|
+
align = "start",
|
|
3253
|
+
closeRoot = false,
|
|
3254
|
+
loop = false,
|
|
3255
|
+
modal = false,
|
|
3256
|
+
// open state related props
|
|
3257
|
+
open: controlledOpen,
|
|
3258
|
+
onOpenChange,
|
|
3259
|
+
defaultOpen
|
|
3260
|
+
} = props;
|
|
3261
|
+
const [open, setOpen] = useControlledState(defaultOpen ?? false, controlledOpen, onOpenChange);
|
|
3262
|
+
const nodeId = react.useFloatingNodeId();
|
|
3263
|
+
const { refs, floatingStyles, context } = react.useFloating({
|
|
3264
|
+
nodeId,
|
|
3265
|
+
strategy: "fixed",
|
|
3266
|
+
whileElementsMounted: react.autoUpdate,
|
|
3267
|
+
open,
|
|
3268
|
+
onOpenChange: (open2, _event, reason) => {
|
|
3269
|
+
if (reason) setOpen(open2);
|
|
3270
|
+
},
|
|
3271
|
+
placement: side + (align !== "center" ? "-" + align : ""),
|
|
3272
|
+
middleware: [
|
|
3273
|
+
react.offset({ ...computeOffsets(side, align) }),
|
|
3274
|
+
react.size({
|
|
3275
|
+
padding: MENU_OVERFLOW_PADDING,
|
|
3276
|
+
apply({ availableHeight, elements }) {
|
|
3277
|
+
elements.floating.style.setProperty(
|
|
3278
|
+
"--overmap-menu-available-height",
|
|
3279
|
+
`${Math.max(availableHeight, MENU_MINIMUM_MAX_HEIGHT)}px`
|
|
3280
|
+
);
|
|
3281
|
+
}
|
|
3282
|
+
}),
|
|
3283
|
+
react.flip(),
|
|
3284
|
+
react.shift({ padding: MENU_OVERFLOW_PADDING }),
|
|
3285
|
+
react.hide()
|
|
3286
|
+
]
|
|
3287
|
+
});
|
|
3288
|
+
const dismiss = react.useDismiss(context, {
|
|
3289
|
+
bubbles: closeRoot,
|
|
3290
|
+
outsidePress: closeRoot
|
|
3291
|
+
});
|
|
3292
|
+
const hover = react.useHover(context, {
|
|
3293
|
+
restMs: 50,
|
|
3294
|
+
handleClose: react.safePolygon({
|
|
3295
|
+
blockPointerEvents: true,
|
|
3296
|
+
requireIntent: false
|
|
3297
|
+
}),
|
|
3298
|
+
enabled: !disabled
|
|
3299
|
+
});
|
|
3300
|
+
const click = react.useClick(context, {
|
|
3301
|
+
enabled: !disabled
|
|
3302
|
+
});
|
|
3303
|
+
const elementsRef = React.useRef([]);
|
|
3304
|
+
const [activeIndex, setActiveIndex] = React.useState(null);
|
|
3305
|
+
const listNavigation = react.useListNavigation(context, {
|
|
3306
|
+
listRef: elementsRef,
|
|
3307
|
+
nested: true,
|
|
3308
|
+
activeIndex,
|
|
3309
|
+
onNavigate: setActiveIndex,
|
|
3310
|
+
loop,
|
|
3311
|
+
rtl: side === "left"
|
|
3312
|
+
});
|
|
3313
|
+
const { getFloatingProps, getItemProps, getReferenceProps } = react.useInteractions([
|
|
3314
|
+
listNavigation,
|
|
3315
|
+
dismiss,
|
|
3316
|
+
hover,
|
|
3317
|
+
click
|
|
3318
|
+
]);
|
|
3319
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
3320
|
+
SubContext.Provider,
|
|
3321
|
+
{
|
|
3322
|
+
value: {
|
|
3323
|
+
open,
|
|
3324
|
+
setOpen,
|
|
3325
|
+
nodeId,
|
|
3326
|
+
refs,
|
|
3327
|
+
floatingStyles,
|
|
3328
|
+
context,
|
|
3329
|
+
elementsRef,
|
|
3330
|
+
activeIndex,
|
|
3331
|
+
setActiveIndex,
|
|
3332
|
+
getFloatingProps,
|
|
3333
|
+
getItemProps,
|
|
3334
|
+
getReferenceProps,
|
|
3335
|
+
disabled,
|
|
3336
|
+
side,
|
|
3337
|
+
closeRoot,
|
|
3338
|
+
modal
|
|
3339
|
+
},
|
|
3340
|
+
children
|
|
3341
|
+
}
|
|
3342
|
+
);
|
|
3343
|
+
});
|
|
3344
|
+
MenuSub.displayName = "SubMenu";
|
|
3345
|
+
const TRIGGER_SELECT_KEYS = ["Enter", " "];
|
|
3346
|
+
const MenuItem = React.memo((props) => {
|
|
3347
|
+
const rootMenuContext = useMenuContext();
|
|
3348
|
+
const { getItemProps, activeIndex, setOpen, size, variant, radius } = useMenuContentContext();
|
|
3349
|
+
const { closeRoot } = useSubContext();
|
|
3350
|
+
const {
|
|
3351
|
+
ref: forwardedRef,
|
|
3352
|
+
className,
|
|
3353
|
+
children,
|
|
3354
|
+
onSelect,
|
|
3355
|
+
onClick,
|
|
3356
|
+
onKeyDown,
|
|
3357
|
+
closeOnSelect = true,
|
|
3358
|
+
disabled = false,
|
|
3359
|
+
...rest
|
|
3360
|
+
} = props;
|
|
3361
|
+
const { ref, index } = react.useListItem();
|
|
3362
|
+
const mergeRefs2 = react.useMergeRefs([ref, forwardedRef]);
|
|
3363
|
+
const handleClick = React.useCallback(
|
|
3364
|
+
(e) => {
|
|
3365
|
+
e.stopPropagation();
|
|
3366
|
+
if (disabled) return;
|
|
2853
3367
|
onClick == null ? void 0 : onClick(e);
|
|
2854
3368
|
onSelect == null ? void 0 : onSelect();
|
|
2855
3369
|
if (closeOnSelect) setOpen(false);
|
|
@@ -2857,7 +3371,7 @@
|
|
|
2857
3371
|
},
|
|
2858
3372
|
[closeOnSelect, closeRoot, disabled, rootMenuContext, onClick, onSelect, setOpen]
|
|
2859
3373
|
);
|
|
2860
|
-
const handleKeyDown =
|
|
3374
|
+
const handleKeyDown = React.useCallback(
|
|
2861
3375
|
(e) => {
|
|
2862
3376
|
if (disabled) return;
|
|
2863
3377
|
onKeyDown == null ? void 0 : onKeyDown(e);
|
|
@@ -2868,8 +3382,8 @@
|
|
|
2868
3382
|
},
|
|
2869
3383
|
[closeOnSelect, disabled, onKeyDown, onSelect, setOpen]
|
|
2870
3384
|
);
|
|
2871
|
-
const isActive =
|
|
2872
|
-
const computedChildren =
|
|
3385
|
+
const isActive = React.useMemo(() => index === activeIndex, [activeIndex, index]);
|
|
3386
|
+
const computedChildren = React.useMemo(() => {
|
|
2873
3387
|
return typeof children === "function" ? children({ active: isActive, selected: false }) : children;
|
|
2874
3388
|
}, [children, isActive]);
|
|
2875
3389
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
@@ -2892,9 +3406,9 @@
|
|
|
2892
3406
|
);
|
|
2893
3407
|
});
|
|
2894
3408
|
MenuItem.displayName = "MenuItem";
|
|
2895
|
-
const MenuCheckboxItem =
|
|
3409
|
+
const MenuCheckboxItem = React.memo((props) => {
|
|
2896
3410
|
const { ref, checked, onCheckedChange, onSelect, ...rest } = props;
|
|
2897
|
-
const handleSelect =
|
|
3411
|
+
const handleSelect = React.useCallback(() => {
|
|
2898
3412
|
onSelect == null ? void 0 : onSelect();
|
|
2899
3413
|
switch (checked) {
|
|
2900
3414
|
case true:
|
|
@@ -2909,16 +3423,16 @@
|
|
|
2909
3423
|
return /* @__PURE__ */ jsxRuntime.jsx(CheckedIndicatorContext.Provider, { value: checked, children: /* @__PURE__ */ jsxRuntime.jsx(MenuItem, { ref, onSelect: handleSelect, ...rest }) });
|
|
2910
3424
|
});
|
|
2911
3425
|
MenuCheckboxItem.displayName = "MenuCheckboxItem";
|
|
2912
|
-
const MenuCheckboxItemIndicator =
|
|
3426
|
+
const MenuCheckboxItemIndicator = React.memo((props) => {
|
|
2913
3427
|
const { ref, children, ...rest } = props;
|
|
2914
3428
|
return /* @__PURE__ */ jsxRuntime.jsx(CheckedIndicator, { ref, ...rest, children });
|
|
2915
3429
|
});
|
|
2916
3430
|
MenuCheckboxItemIndicator.displayName = "MenuCheckboxItemIndicator";
|
|
2917
|
-
const MenuClickTrigger =
|
|
3431
|
+
const MenuClickTrigger = React.memo((props) => {
|
|
2918
3432
|
const { ref: forwardedRef, children, disabled = false } = props;
|
|
2919
|
-
const { getReferenceProps, refs, setTriggerType, open } =
|
|
2920
|
-
const mergedRefs = react
|
|
2921
|
-
|
|
3433
|
+
const { getReferenceProps, refs, setTriggerType, open } = useMenuContext();
|
|
3434
|
+
const mergedRefs = react.useMergeRefs([refs.setReference, forwardedRef]);
|
|
3435
|
+
React.useEffect(() => {
|
|
2922
3436
|
setTriggerType("click");
|
|
2923
3437
|
}, [setTriggerType]);
|
|
2924
3438
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
@@ -2934,115 +3448,15 @@
|
|
|
2934
3448
|
);
|
|
2935
3449
|
});
|
|
2936
3450
|
MenuClickTrigger.displayName = "MenuClickTrigger";
|
|
2937
|
-
const
|
|
2938
|
-
var _a;
|
|
2939
|
-
const providerContext = useProvider();
|
|
2940
|
-
const {
|
|
2941
|
-
ref: forwardedRef,
|
|
2942
|
-
className,
|
|
2943
|
-
children,
|
|
2944
|
-
size = "md",
|
|
2945
|
-
variant = "soft",
|
|
2946
|
-
radius = providerContext.radius,
|
|
2947
|
-
accentColor = "base",
|
|
2948
|
-
...rest
|
|
2949
|
-
} = props;
|
|
2950
|
-
const {
|
|
2951
|
-
refs,
|
|
2952
|
-
getFloatingProps,
|
|
2953
|
-
middlewareData,
|
|
2954
|
-
elementsRef,
|
|
2955
|
-
activeIndex,
|
|
2956
|
-
setActiveIndex,
|
|
2957
|
-
getItemProps,
|
|
2958
|
-
open,
|
|
2959
|
-
setOpen,
|
|
2960
|
-
nodeId,
|
|
2961
|
-
context,
|
|
2962
|
-
floatingStyles,
|
|
2963
|
-
modal,
|
|
2964
|
-
side
|
|
2965
|
-
} = react.use(MenuContext);
|
|
2966
|
-
const computedFloatingStyles = react.useMemo(() => {
|
|
2967
|
-
var _a2;
|
|
2968
|
-
return {
|
|
2969
|
-
...floatingStyles,
|
|
2970
|
-
visibility: ((_a2 = middlewareData.hide) == null ? void 0 : _a2.referenceHidden) ? "hidden" : "visible"
|
|
2971
|
-
};
|
|
2972
|
-
}, [floatingStyles, (_a = middlewareData.hide) == null ? void 0 : _a.referenceHidden]);
|
|
2973
|
-
const handleOverlayPointerDown = react.useCallback(
|
|
2974
|
-
(e) => {
|
|
2975
|
-
if (modal) stopPropagation(e);
|
|
2976
|
-
},
|
|
2977
|
-
[modal]
|
|
2978
|
-
);
|
|
2979
|
-
return /* @__PURE__ */ jsxRuntime.jsx(react$1.FloatingNode, { id: nodeId, children: open && /* @__PURE__ */ jsxRuntime.jsx(react$1.FloatingPortal, { children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
2980
|
-
react$1.FloatingOverlay,
|
|
2981
|
-
{
|
|
2982
|
-
className: menuOverlay({ modal }),
|
|
2983
|
-
onClick: handleOverlayPointerDown,
|
|
2984
|
-
lockScroll: true,
|
|
2985
|
-
"data-floating-content": "",
|
|
2986
|
-
children: /* @__PURE__ */ jsxRuntime.jsx(react$1.FloatingFocusManager, { context, children: /* @__PURE__ */ jsxRuntime.jsx(react$1.FloatingList, { elementsRef, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
2987
|
-
MenuContentContext.Provider,
|
|
2988
|
-
{
|
|
2989
|
-
value: {
|
|
2990
|
-
getItemProps,
|
|
2991
|
-
activeIndex,
|
|
2992
|
-
elementsRef,
|
|
2993
|
-
open,
|
|
2994
|
-
setOpen,
|
|
2995
|
-
refs,
|
|
2996
|
-
setActiveIndex,
|
|
2997
|
-
size,
|
|
2998
|
-
variant,
|
|
2999
|
-
accentColor,
|
|
3000
|
-
radius
|
|
3001
|
-
},
|
|
3002
|
-
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
3003
|
-
"div",
|
|
3004
|
-
{
|
|
3005
|
-
className: "border-box w-max outline-none",
|
|
3006
|
-
ref: refs.setFloating,
|
|
3007
|
-
tabIndex: -1,
|
|
3008
|
-
style: computedFloatingStyles,
|
|
3009
|
-
"data-floating-content": "",
|
|
3010
|
-
...getFloatingProps(),
|
|
3011
|
-
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
3012
|
-
"ul",
|
|
3013
|
-
{
|
|
3014
|
-
className: classVarianceAuthority.cx(
|
|
3015
|
-
menuContent({ size }),
|
|
3016
|
-
floating({ side, shadow: "3" }),
|
|
3017
|
-
radiusCva({ radius, maxLarge: true }),
|
|
3018
|
-
"max-h-(--overmap-menu-available-height)",
|
|
3019
|
-
className
|
|
3020
|
-
),
|
|
3021
|
-
ref: forwardedRef,
|
|
3022
|
-
"data-state": getOpenState(open),
|
|
3023
|
-
"data-side": side,
|
|
3024
|
-
"data-accent-color": accentColor,
|
|
3025
|
-
...rest,
|
|
3026
|
-
children
|
|
3027
|
-
}
|
|
3028
|
-
)
|
|
3029
|
-
}
|
|
3030
|
-
)
|
|
3031
|
-
}
|
|
3032
|
-
) }) })
|
|
3033
|
-
}
|
|
3034
|
-
) }) });
|
|
3035
|
-
});
|
|
3036
|
-
MenuContent.displayName = "Menu.Content";
|
|
3037
|
-
const MenuContextTrigger = react.memo((props) => {
|
|
3451
|
+
const MenuContextTrigger = React.memo((props) => {
|
|
3038
3452
|
const { ref: forwardedRef, children, disabled = false } = props;
|
|
3039
|
-
const ref =
|
|
3040
|
-
const { setOpen, refs, setTriggerType, open } =
|
|
3041
|
-
const mergedRefs = react
|
|
3042
|
-
|
|
3453
|
+
const ref = React.useRef(null);
|
|
3454
|
+
const { setOpen, refs, setTriggerType, open } = useMenuContext();
|
|
3455
|
+
const mergedRefs = react.useMergeRefs([forwardedRef, ref]);
|
|
3456
|
+
React.useEffect(() => {
|
|
3043
3457
|
setTriggerType("context");
|
|
3044
3458
|
}, [setTriggerType]);
|
|
3045
|
-
const handleContextMenu =
|
|
3459
|
+
const handleContextMenu = React.useCallback(
|
|
3046
3460
|
(e) => {
|
|
3047
3461
|
const { clientY, clientX } = e;
|
|
3048
3462
|
if (!disabled && ref.current) {
|
|
@@ -3081,24 +3495,24 @@
|
|
|
3081
3495
|
);
|
|
3082
3496
|
});
|
|
3083
3497
|
MenuContextTrigger.displayName = "MenuContextTrigger";
|
|
3084
|
-
const MenuGroup =
|
|
3498
|
+
const MenuGroup = React.memo((props) => {
|
|
3085
3499
|
const { ref, children, ...rest } = props;
|
|
3086
3500
|
return /* @__PURE__ */ jsxRuntime.jsx("div", { ref, role: "group", ...rest, children });
|
|
3087
3501
|
});
|
|
3088
3502
|
MenuGroup.displayName = "MenuGroup";
|
|
3089
|
-
const MenuInputField =
|
|
3503
|
+
const MenuInputField = React.memo((props) => {
|
|
3090
3504
|
const { ref: forwardedRef, className, onValueChange, onChange, disabled = false, ...rest } = props;
|
|
3091
|
-
const { activeIndex, getItemProps } =
|
|
3092
|
-
const { index, ref } = react
|
|
3093
|
-
const mergedRefs = react
|
|
3094
|
-
const handleChange =
|
|
3505
|
+
const { activeIndex, getItemProps } = useMenuContentContext();
|
|
3506
|
+
const { index, ref } = react.useListItem();
|
|
3507
|
+
const mergedRefs = react.useMergeRefs([ref, forwardedRef]);
|
|
3508
|
+
const handleChange = React.useCallback(
|
|
3095
3509
|
(e) => {
|
|
3096
3510
|
onChange == null ? void 0 : onChange(e);
|
|
3097
3511
|
onValueChange == null ? void 0 : onValueChange(e.target.value);
|
|
3098
3512
|
},
|
|
3099
3513
|
[onChange, onValueChange]
|
|
3100
3514
|
);
|
|
3101
|
-
|
|
3515
|
+
React.useEffect(() => {
|
|
3102
3516
|
return () => {
|
|
3103
3517
|
onValueChange == null ? void 0 : onValueChange("");
|
|
3104
3518
|
};
|
|
@@ -3119,20 +3533,20 @@
|
|
|
3119
3533
|
);
|
|
3120
3534
|
});
|
|
3121
3535
|
MenuInputField.displayName = "MenuInputField";
|
|
3122
|
-
const MenuInputRoot =
|
|
3536
|
+
const MenuInputRoot = React.memo((props) => {
|
|
3123
3537
|
const { ref, className, ...rest } = props;
|
|
3124
|
-
const { size } =
|
|
3538
|
+
const { size } = useMenuContentContext();
|
|
3125
3539
|
return /* @__PURE__ */ jsxRuntime.jsx("div", { className: classVarianceAuthority.cx(inputRoot({ size }), className), ref, ...rest });
|
|
3126
3540
|
});
|
|
3127
3541
|
MenuInputRoot.displayName = "MenuInputRoot";
|
|
3128
|
-
const MenuInputSlot =
|
|
3542
|
+
const MenuInputSlot = React.memo((props) => {
|
|
3129
3543
|
const { ref, className, ...rest } = props;
|
|
3130
3544
|
return /* @__PURE__ */ jsxRuntime.jsx("div", { className: classVarianceAuthority.cx("flex", "items-center", "text-(--base-a11)", className), ref, ...rest });
|
|
3131
3545
|
});
|
|
3132
3546
|
MenuInputSlot.displayName = "MenuInputSlot";
|
|
3133
|
-
const MenuLabel =
|
|
3547
|
+
const MenuLabel = React.memo((props) => {
|
|
3134
3548
|
const { ref, className, ...rest } = props;
|
|
3135
|
-
const { size } =
|
|
3549
|
+
const { size } = useMenuContentContext();
|
|
3136
3550
|
return /* @__PURE__ */ jsxRuntime.jsx("div", { ref, className: classVarianceAuthority.cx(menuLabelCva({ size }), className), ...rest });
|
|
3137
3551
|
});
|
|
3138
3552
|
MenuLabel.displayName = "MenuLabel";
|
|
@@ -3140,18 +3554,41 @@
|
|
|
3140
3554
|
const { ref, children, defaultValues, values, onValuesChange, ...rest } = props;
|
|
3141
3555
|
return /* @__PURE__ */ jsxRuntime.jsx(MenuGroup, { ref, ...rest, children: /* @__PURE__ */ jsxRuntime.jsx(MultiSelectProvider, { defaultValues, values, onValuesChange, children }) });
|
|
3142
3556
|
});
|
|
3557
|
+
const SelectedIndicatorContext = React.createContext(false);
|
|
3558
|
+
const useSelectedIndicatorContext = () => React.useContext(SelectedIndicatorContext);
|
|
3559
|
+
const MenuSelectedIndicator = React.memo((props) => {
|
|
3560
|
+
const { ref, children, className, ...rest } = props;
|
|
3561
|
+
const isSelected = useSelectedIndicatorContext();
|
|
3562
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
3563
|
+
"span",
|
|
3564
|
+
{
|
|
3565
|
+
ref,
|
|
3566
|
+
className: classVarianceAuthority.cx(
|
|
3567
|
+
"flex size-max items-center",
|
|
3568
|
+
{
|
|
3569
|
+
invisible: !isSelected
|
|
3570
|
+
},
|
|
3571
|
+
className
|
|
3572
|
+
),
|
|
3573
|
+
"data-state": getSelectedState(isSelected),
|
|
3574
|
+
...rest,
|
|
3575
|
+
children
|
|
3576
|
+
}
|
|
3577
|
+
);
|
|
3578
|
+
});
|
|
3579
|
+
MenuSelectedIndicator.displayName = "SelectedIndicator";
|
|
3143
3580
|
const MenuMultiSelectItem = genericMemo(function(props) {
|
|
3144
3581
|
const { ref, onSelect, children, closeOnSelect = false, value, ...rest } = props;
|
|
3145
|
-
const { selected, selectValue, registerValue } =
|
|
3146
|
-
|
|
3582
|
+
const { selected, selectValue, registerValue } = React.use(MultiSelectContext);
|
|
3583
|
+
React.useLayoutEffect(() => {
|
|
3147
3584
|
return registerValue(value);
|
|
3148
3585
|
}, [registerValue, value]);
|
|
3149
3586
|
const isSelected = selected(value);
|
|
3150
|
-
const handleSelect =
|
|
3587
|
+
const handleSelect = React.useCallback(() => {
|
|
3151
3588
|
onSelect == null ? void 0 : onSelect();
|
|
3152
3589
|
selectValue(value);
|
|
3153
3590
|
}, [onSelect, selectValue, value]);
|
|
3154
|
-
const computedChildren =
|
|
3591
|
+
const computedChildren = React.useMemo(() => {
|
|
3155
3592
|
return typeof children === "function" ? ({ active }) => children({ selected: isSelected, active }) : children;
|
|
3156
3593
|
}, [children, isSelected]);
|
|
3157
3594
|
return /* @__PURE__ */ jsxRuntime.jsx(SelectedIndicatorContext.Provider, { value: isSelected, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
@@ -3167,25 +3604,26 @@
|
|
|
3167
3604
|
}
|
|
3168
3605
|
) });
|
|
3169
3606
|
});
|
|
3170
|
-
const PagesContext =
|
|
3171
|
-
const
|
|
3172
|
-
|
|
3173
|
-
const { activePage } = react.use(PagesContext);
|
|
3174
|
-
return activePage === page ? children : null;
|
|
3175
|
-
});
|
|
3176
|
-
MenuPageContent.displayName = "PageContent";
|
|
3177
|
-
const MenuPages = react.memo((props) => {
|
|
3607
|
+
const PagesContext = React.createContext({});
|
|
3608
|
+
const usePagesContext = () => React.useContext(PagesContext);
|
|
3609
|
+
const MenuPages = React.memo((props) => {
|
|
3178
3610
|
const { children, defaultPage, page, onPageChange } = props;
|
|
3179
3611
|
const [activePage, setActivePage] = useControlledState(defaultPage ?? "", page, onPageChange);
|
|
3180
|
-
const contextValue =
|
|
3612
|
+
const contextValue = React.useMemo(() => ({ activePage, setActivePage }), [activePage, setActivePage]);
|
|
3181
3613
|
return /* @__PURE__ */ jsxRuntime.jsx(PagesContext.Provider, { value: contextValue, children });
|
|
3182
3614
|
});
|
|
3183
3615
|
MenuPages.displayName = "MenuPages";
|
|
3184
|
-
const
|
|
3616
|
+
const MenuPageContent = (props) => {
|
|
3617
|
+
const { page, children } = props;
|
|
3618
|
+
const { activePage } = usePagesContext();
|
|
3619
|
+
return activePage === page ? children : null;
|
|
3620
|
+
};
|
|
3621
|
+
MenuPageContent.displayName = "PageContent";
|
|
3622
|
+
const MenuPageTrigger = React.memo((props) => {
|
|
3185
3623
|
const { ref, onSelect, page, ...rest } = props;
|
|
3186
|
-
const { refs, setActiveIndex } =
|
|
3187
|
-
const { setActivePage } =
|
|
3188
|
-
const handleSelect =
|
|
3624
|
+
const { refs, setActiveIndex } = useMenuContentContext();
|
|
3625
|
+
const { setActivePage } = usePagesContext();
|
|
3626
|
+
const handleSelect = React.useCallback(() => {
|
|
3189
3627
|
var _a;
|
|
3190
3628
|
onSelect == null ? void 0 : onSelect();
|
|
3191
3629
|
setActivePage(page);
|
|
@@ -3195,101 +3633,7 @@
|
|
|
3195
3633
|
return /* @__PURE__ */ jsxRuntime.jsx(MenuItem, { ref, onSelect: handleSelect, closeOnSelect: false, ...rest });
|
|
3196
3634
|
});
|
|
3197
3635
|
MenuPageTrigger.displayName = "MenuPageTrigger";
|
|
3198
|
-
const
|
|
3199
|
-
const MENU_CONTENT_PADDING = 8;
|
|
3200
|
-
const MENU_MINIMUM_MAX_HEIGHT = 250;
|
|
3201
|
-
const DEFAULT_OFFSET = 5;
|
|
3202
|
-
const MenuRoot = react.memo((props) => {
|
|
3203
|
-
const {
|
|
3204
|
-
children,
|
|
3205
|
-
side = "bottom",
|
|
3206
|
-
align = "center",
|
|
3207
|
-
offset,
|
|
3208
|
-
loop = false,
|
|
3209
|
-
modal = false,
|
|
3210
|
-
// open state related props
|
|
3211
|
-
open: controlledOpen,
|
|
3212
|
-
onOpenChange,
|
|
3213
|
-
defaultOpen
|
|
3214
|
-
} = props;
|
|
3215
|
-
const [open, setOpen] = useControlledState(defaultOpen ?? false, controlledOpen, onOpenChange);
|
|
3216
|
-
const [activeIndex, setActiveIndex] = react.useState(null);
|
|
3217
|
-
const [triggerType, setTriggerType] = react.useState(null);
|
|
3218
|
-
const elementsRef = react.useRef([]);
|
|
3219
|
-
const nodeId = react$1.useFloatingNodeId();
|
|
3220
|
-
const { refs, floatingStyles, context, middlewareData } = react$1.useFloating({
|
|
3221
|
-
nodeId,
|
|
3222
|
-
strategy: "fixed",
|
|
3223
|
-
// TODO: probably some way with template string types to not need the "as Placement"
|
|
3224
|
-
placement: side + (align !== "center" ? "-" + align : ""),
|
|
3225
|
-
whileElementsMounted: react$1.autoUpdate,
|
|
3226
|
-
open,
|
|
3227
|
-
onOpenChange: setOpen,
|
|
3228
|
-
middleware: [
|
|
3229
|
-
react$1.offset({ mainAxis: offset ?? DEFAULT_OFFSET }),
|
|
3230
|
-
react$1.size({
|
|
3231
|
-
apply({ availableHeight, elements }) {
|
|
3232
|
-
elements.floating.style.setProperty(
|
|
3233
|
-
"--overmap-menu-available-height",
|
|
3234
|
-
`${Math.max(availableHeight, MENU_MINIMUM_MAX_HEIGHT)}px`
|
|
3235
|
-
);
|
|
3236
|
-
},
|
|
3237
|
-
padding: MENU_OVERFLOW_PADDING
|
|
3238
|
-
}),
|
|
3239
|
-
react$1.flip({ fallbackStrategy: "initialPlacement" }),
|
|
3240
|
-
react$1.shift({ padding: MENU_OVERFLOW_PADDING }),
|
|
3241
|
-
react$1.hide()
|
|
3242
|
-
]
|
|
3243
|
-
});
|
|
3244
|
-
const role = react$1.useRole(context, {
|
|
3245
|
-
role: "menu"
|
|
3246
|
-
});
|
|
3247
|
-
const dismiss = react$1.useDismiss(context, {
|
|
3248
|
-
capture: true,
|
|
3249
|
-
ancestorScroll: triggerType === "context" || triggerType === "virtual"
|
|
3250
|
-
});
|
|
3251
|
-
const click = react$1.useClick(context, {
|
|
3252
|
-
enabled: triggerType === "click"
|
|
3253
|
-
});
|
|
3254
|
-
const listNavigation = react$1.useListNavigation(context, {
|
|
3255
|
-
listRef: elementsRef,
|
|
3256
|
-
activeIndex,
|
|
3257
|
-
onNavigate: setActiveIndex,
|
|
3258
|
-
loop
|
|
3259
|
-
});
|
|
3260
|
-
const { getFloatingProps, getItemProps, getReferenceProps } = react$1.useInteractions([
|
|
3261
|
-
dismiss,
|
|
3262
|
-
listNavigation,
|
|
3263
|
-
click,
|
|
3264
|
-
role
|
|
3265
|
-
]);
|
|
3266
|
-
return /* @__PURE__ */ jsxRuntime.jsx(react$1.FloatingTree, { children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
3267
|
-
MenuContext.Provider,
|
|
3268
|
-
{
|
|
3269
|
-
value: {
|
|
3270
|
-
open,
|
|
3271
|
-
setOpen,
|
|
3272
|
-
refs,
|
|
3273
|
-
context,
|
|
3274
|
-
floatingStyles,
|
|
3275
|
-
elementsRef,
|
|
3276
|
-
getFloatingProps,
|
|
3277
|
-
getItemProps,
|
|
3278
|
-
getReferenceProps,
|
|
3279
|
-
nodeId,
|
|
3280
|
-
activeIndex,
|
|
3281
|
-
setActiveIndex,
|
|
3282
|
-
middlewareData,
|
|
3283
|
-
side,
|
|
3284
|
-
modal,
|
|
3285
|
-
setTriggerType
|
|
3286
|
-
},
|
|
3287
|
-
children
|
|
3288
|
-
}
|
|
3289
|
-
) });
|
|
3290
|
-
});
|
|
3291
|
-
MenuRoot.displayName = "Root";
|
|
3292
|
-
const MenuScroll = react.memo((props) => {
|
|
3636
|
+
const MenuScroll = React.memo((props) => {
|
|
3293
3637
|
const { ref, className, ...rest } = props;
|
|
3294
3638
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
3295
3639
|
"div",
|
|
@@ -3306,13 +3650,13 @@
|
|
|
3306
3650
|
MenuScroll.displayName = "MenuScroll";
|
|
3307
3651
|
const MenuSelectAllItem = genericMemo((props) => {
|
|
3308
3652
|
const { ref, children, onSelect, closeOnSelect = false, ...rest } = props;
|
|
3309
|
-
const { allSelected, someSelected, toggleSelectAll } =
|
|
3653
|
+
const { allSelected, someSelected, toggleSelectAll } = React.use(MultiSelectContext);
|
|
3310
3654
|
const selectedState = allSelected ? true : someSelected ? "indeterminate" : false;
|
|
3311
|
-
const handleSelect =
|
|
3655
|
+
const handleSelect = React.useCallback(() => {
|
|
3312
3656
|
onSelect == null ? void 0 : onSelect();
|
|
3313
3657
|
toggleSelectAll();
|
|
3314
3658
|
}, [onSelect, toggleSelectAll]);
|
|
3315
|
-
const computedChildren =
|
|
3659
|
+
const computedChildren = React.useMemo(() => {
|
|
3316
3660
|
return typeof children === "function" ? ({ active }) => children({ selected: selectedState, active }) : children;
|
|
3317
3661
|
}, [children, selectedState]);
|
|
3318
3662
|
return /* @__PURE__ */ jsxRuntime.jsx(CheckedIndicatorContext, { value: selectedState, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
@@ -3327,11 +3671,6 @@
|
|
|
3327
3671
|
}
|
|
3328
3672
|
) });
|
|
3329
3673
|
});
|
|
3330
|
-
const MenuSelectedIndicator = react.memo((props) => {
|
|
3331
|
-
const { ref, children, ...rest } = props;
|
|
3332
|
-
return /* @__PURE__ */ jsxRuntime.jsx(SelectedIndicator, { ref, ...rest, children });
|
|
3333
|
-
});
|
|
3334
|
-
MenuSelectedIndicator.displayName = "MenuSelectedIndicator";
|
|
3335
3674
|
const MenuSelectGroup = genericMemo(function MenuSelectGroup2(props) {
|
|
3336
3675
|
const { ref, children, required, defaultValue, value, onValueChange, ...rest } = props;
|
|
3337
3676
|
return /* @__PURE__ */ jsxRuntime.jsx(MenuGroup, { ref, ...rest, children: required ? /* @__PURE__ */ jsxRuntime.jsx(SingleSelectRequiredProvider, { defaultValue, value, onValueChange, children }) : /* @__PURE__ */ jsxRuntime.jsx(
|
|
@@ -3346,13 +3685,13 @@
|
|
|
3346
3685
|
});
|
|
3347
3686
|
const MenuSelectItem = genericMemo(function(props) {
|
|
3348
3687
|
const { ref, value, onSelect, children, closeOnSelect = true, ...rest } = props;
|
|
3349
|
-
const { selected, selectValue } =
|
|
3350
|
-
const isSelected = selected(value);
|
|
3351
|
-
const handleSelect =
|
|
3688
|
+
const { selected, selectValue } = React.use(SelectContext);
|
|
3689
|
+
const isSelected = React.useMemo(() => selected(value), [selected, value]);
|
|
3690
|
+
const handleSelect = React.useCallback(() => {
|
|
3352
3691
|
onSelect == null ? void 0 : onSelect();
|
|
3353
3692
|
selectValue(value);
|
|
3354
3693
|
}, [onSelect, selectValue, value]);
|
|
3355
|
-
const computedChildren =
|
|
3694
|
+
const computedChildren = React.useMemo(() => {
|
|
3356
3695
|
return typeof children === "function" ? ({ active }) => children({ selected: isSelected, active }) : children;
|
|
3357
3696
|
}, [children, isSelected]);
|
|
3358
3697
|
return /* @__PURE__ */ jsxRuntime.jsx(SelectedIndicatorContext.Provider, { value: isSelected, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
@@ -3366,136 +3705,19 @@
|
|
|
3366
3705
|
...rest,
|
|
3367
3706
|
children: computedChildren
|
|
3368
3707
|
}
|
|
3369
|
-
) });
|
|
3370
|
-
});
|
|
3371
|
-
const MenuSeparator = react.memo((props) => {
|
|
3372
|
-
const { ref, className, ...rest } = props;
|
|
3373
|
-
const { size } = react.use(MenuContentContext);
|
|
3374
|
-
return /* @__PURE__ */ jsxRuntime.jsx(RadixSeparator__namespace.Root, { className: classVarianceAuthority.cx(menuSeparator({ size }), className), ref, ...rest });
|
|
3375
|
-
});
|
|
3376
|
-
MenuSeparator.displayName = "MenuSeparator";
|
|
3377
|
-
const computeOffsets = (side, alignment) => {
|
|
3378
|
-
switch (side) {
|
|
3379
|
-
case "right":
|
|
3380
|
-
if (alignment === "start") {
|
|
3381
|
-
return { mainAxis: MENU_CONTENT_PADDING + 1, crossAxis: -MENU_CONTENT_PADDING };
|
|
3382
|
-
} else if (alignment === "end") {
|
|
3383
|
-
return { mainAxis: MENU_CONTENT_PADDING + 1, crossAxis: MENU_CONTENT_PADDING };
|
|
3384
|
-
}
|
|
3385
|
-
break;
|
|
3386
|
-
case "left":
|
|
3387
|
-
if (alignment === "start") {
|
|
3388
|
-
return { mainAxis: MENU_CONTENT_PADDING + 1, crossAxis: -MENU_CONTENT_PADDING };
|
|
3389
|
-
} else if (alignment === "end") {
|
|
3390
|
-
return { mainAxis: MENU_CONTENT_PADDING + 1, crossAxis: MENU_CONTENT_PADDING };
|
|
3391
|
-
}
|
|
3392
|
-
break;
|
|
3393
|
-
}
|
|
3394
|
-
return { mainAxis: MENU_CONTENT_PADDING + 1, crossAxis: 0 };
|
|
3395
|
-
};
|
|
3396
|
-
const MenuSub = react.memo((props) => {
|
|
3397
|
-
const {
|
|
3398
|
-
children,
|
|
3399
|
-
disabled = false,
|
|
3400
|
-
side = "right",
|
|
3401
|
-
align = "start",
|
|
3402
|
-
closeRoot = false,
|
|
3403
|
-
loop = false,
|
|
3404
|
-
modal = false,
|
|
3405
|
-
// open state related props
|
|
3406
|
-
open: controlledOpen,
|
|
3407
|
-
onOpenChange,
|
|
3408
|
-
defaultOpen
|
|
3409
|
-
} = props;
|
|
3410
|
-
const [open, setOpen] = useControlledState(defaultOpen ?? false, controlledOpen, onOpenChange);
|
|
3411
|
-
const nodeId = react$1.useFloatingNodeId();
|
|
3412
|
-
const { refs, floatingStyles, context } = react$1.useFloating({
|
|
3413
|
-
nodeId,
|
|
3414
|
-
strategy: "fixed",
|
|
3415
|
-
whileElementsMounted: react$1.autoUpdate,
|
|
3416
|
-
open,
|
|
3417
|
-
onOpenChange: (open2, _event, reason) => {
|
|
3418
|
-
if (reason) setOpen(open2);
|
|
3419
|
-
},
|
|
3420
|
-
placement: side + (align !== "center" ? "-" + align : ""),
|
|
3421
|
-
middleware: [
|
|
3422
|
-
react$1.offset({ ...computeOffsets(side, align) }),
|
|
3423
|
-
react$1.size({
|
|
3424
|
-
padding: MENU_OVERFLOW_PADDING,
|
|
3425
|
-
apply({ availableHeight, elements }) {
|
|
3426
|
-
elements.floating.style.setProperty(
|
|
3427
|
-
"--overmap-menu-available-height",
|
|
3428
|
-
`${Math.max(availableHeight, MENU_MINIMUM_MAX_HEIGHT)}px`
|
|
3429
|
-
);
|
|
3430
|
-
}
|
|
3431
|
-
}),
|
|
3432
|
-
react$1.flip(),
|
|
3433
|
-
react$1.shift({ padding: MENU_OVERFLOW_PADDING }),
|
|
3434
|
-
react$1.hide()
|
|
3435
|
-
]
|
|
3436
|
-
});
|
|
3437
|
-
const dismiss = react$1.useDismiss(context, {
|
|
3438
|
-
bubbles: closeRoot,
|
|
3439
|
-
outsidePress: closeRoot
|
|
3440
|
-
});
|
|
3441
|
-
const hover = react$1.useHover(context, {
|
|
3442
|
-
restMs: 50,
|
|
3443
|
-
handleClose: react$1.safePolygon({
|
|
3444
|
-
blockPointerEvents: true,
|
|
3445
|
-
requireIntent: false
|
|
3446
|
-
}),
|
|
3447
|
-
enabled: !disabled
|
|
3448
|
-
});
|
|
3449
|
-
const click = react$1.useClick(context, {
|
|
3450
|
-
enabled: !disabled
|
|
3451
|
-
});
|
|
3452
|
-
const elementsRef = react.useRef([]);
|
|
3453
|
-
const [activeIndex, setActiveIndex] = react.useState(null);
|
|
3454
|
-
const listNavigation = react$1.useListNavigation(context, {
|
|
3455
|
-
listRef: elementsRef,
|
|
3456
|
-
nested: true,
|
|
3457
|
-
activeIndex,
|
|
3458
|
-
onNavigate: setActiveIndex,
|
|
3459
|
-
loop,
|
|
3460
|
-
rtl: side === "left"
|
|
3461
|
-
});
|
|
3462
|
-
const { getFloatingProps, getItemProps, getReferenceProps } = react$1.useInteractions([
|
|
3463
|
-
listNavigation,
|
|
3464
|
-
dismiss,
|
|
3465
|
-
hover,
|
|
3466
|
-
click
|
|
3467
|
-
]);
|
|
3468
|
-
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
3469
|
-
SubContext.Provider,
|
|
3470
|
-
{
|
|
3471
|
-
value: {
|
|
3472
|
-
open,
|
|
3473
|
-
setOpen,
|
|
3474
|
-
nodeId,
|
|
3475
|
-
refs,
|
|
3476
|
-
floatingStyles,
|
|
3477
|
-
context,
|
|
3478
|
-
elementsRef,
|
|
3479
|
-
activeIndex,
|
|
3480
|
-
setActiveIndex,
|
|
3481
|
-
getFloatingProps,
|
|
3482
|
-
getItemProps,
|
|
3483
|
-
getReferenceProps,
|
|
3484
|
-
disabled,
|
|
3485
|
-
side,
|
|
3486
|
-
closeRoot,
|
|
3487
|
-
modal
|
|
3488
|
-
},
|
|
3489
|
-
children
|
|
3490
|
-
}
|
|
3491
|
-
);
|
|
3708
|
+
) });
|
|
3492
3709
|
});
|
|
3493
|
-
|
|
3494
|
-
|
|
3710
|
+
const MenuSeparator = React.memo((props) => {
|
|
3711
|
+
const { ref, className, ...rest } = props;
|
|
3712
|
+
const { size } = useMenuContentContext();
|
|
3713
|
+
return /* @__PURE__ */ jsxRuntime.jsx(RadixSeparator__namespace.Root, { className: classVarianceAuthority.cx(menuSeparator({ size }), className), ref, ...rest });
|
|
3714
|
+
});
|
|
3715
|
+
MenuSeparator.displayName = "MenuSeparator";
|
|
3716
|
+
const MenuSubContent = React.memo((props) => {
|
|
3495
3717
|
var _a;
|
|
3496
3718
|
const { ref: forwardedRef, children, ...rest } = props;
|
|
3497
|
-
const { middlewareData } =
|
|
3498
|
-
const { accentColor, radius, variant, size } =
|
|
3719
|
+
const { middlewareData } = useMenuContext();
|
|
3720
|
+
const { accentColor, radius, variant, size } = useMenuContentContext();
|
|
3499
3721
|
const {
|
|
3500
3722
|
open,
|
|
3501
3723
|
nodeId,
|
|
@@ -3509,17 +3731,17 @@
|
|
|
3509
3731
|
floatingStyles,
|
|
3510
3732
|
setOpen,
|
|
3511
3733
|
side
|
|
3512
|
-
} =
|
|
3513
|
-
const wrapperRef =
|
|
3514
|
-
const mergeRefs2 = react
|
|
3515
|
-
const computedFloatingStyles =
|
|
3734
|
+
} = useSubContext();
|
|
3735
|
+
const wrapperRef = React.useRef(null);
|
|
3736
|
+
const mergeRefs2 = react.useMergeRefs([refs.setFloating, wrapperRef]);
|
|
3737
|
+
const computedFloatingStyles = React.useMemo(() => {
|
|
3516
3738
|
var _a2;
|
|
3517
3739
|
return {
|
|
3518
3740
|
...floatingStyles,
|
|
3519
3741
|
visibility: ((_a2 = middlewareData.hide) == null ? void 0 : _a2.referenceHidden) ? "hidden" : "visible"
|
|
3520
3742
|
};
|
|
3521
3743
|
}, [floatingStyles, (_a = middlewareData.hide) == null ? void 0 : _a.referenceHidden]);
|
|
3522
|
-
return /* @__PURE__ */ jsxRuntime.jsx(react
|
|
3744
|
+
return /* @__PURE__ */ jsxRuntime.jsx(react.FloatingNode, { id: nodeId, children: open && /* @__PURE__ */ jsxRuntime.jsx(react.FloatingPortal, { children: /* @__PURE__ */ jsxRuntime.jsx(react.FloatingFocusManager, { context, initialFocus: wrapperRef, children: /* @__PURE__ */ jsxRuntime.jsx(react.FloatingList, { elementsRef, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
3523
3745
|
MenuContentContext.Provider,
|
|
3524
3746
|
{
|
|
3525
3747
|
value: {
|
|
@@ -3566,10 +3788,10 @@
|
|
|
3566
3788
|
) }) }) }) });
|
|
3567
3789
|
});
|
|
3568
3790
|
MenuSubContent.displayName = "MenuSubContent";
|
|
3569
|
-
const MenuSubTrigger =
|
|
3791
|
+
const MenuSubTrigger = React.memo((props) => {
|
|
3570
3792
|
const { ref: forwardedRef, children, ...rest } = props;
|
|
3571
|
-
const { refs, getReferenceProps, open, disabled } =
|
|
3572
|
-
const mergedRefs = react
|
|
3793
|
+
const { refs, getReferenceProps, open, disabled } = useSubContext();
|
|
3794
|
+
const mergedRefs = react.useMergeRefs([forwardedRef, refs.setReference]);
|
|
3573
3795
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
3574
3796
|
MenuItem,
|
|
3575
3797
|
{
|
|
@@ -3584,13 +3806,13 @@
|
|
|
3584
3806
|
);
|
|
3585
3807
|
});
|
|
3586
3808
|
MenuSubTrigger.displayName = "MenuSubTrigger";
|
|
3587
|
-
const MenuVirtualTrigger =
|
|
3809
|
+
const MenuVirtualTrigger = React.memo((props) => {
|
|
3588
3810
|
const { virtualElement, disabled } = props;
|
|
3589
|
-
const { refs, setTriggerType, setOpen } =
|
|
3590
|
-
|
|
3811
|
+
const { refs, setTriggerType, setOpen } = useMenuContext();
|
|
3812
|
+
React.useEffect(() => {
|
|
3591
3813
|
setTriggerType("virtual");
|
|
3592
3814
|
}, [setTriggerType]);
|
|
3593
|
-
|
|
3815
|
+
React.useEffect(() => {
|
|
3594
3816
|
if (!disabled && virtualElement) {
|
|
3595
3817
|
refs.setPositionReference(virtualElement);
|
|
3596
3818
|
setOpen(true);
|
|
@@ -3639,562 +3861,11 @@
|
|
|
3639
3861
|
Separator: MenuSeparator,
|
|
3640
3862
|
Scroll: MenuScroll
|
|
3641
3863
|
};
|
|
3642
|
-
const
|
|
3643
|
-
next: "ArrowDown",
|
|
3644
|
-
prev: "ArrowUp",
|
|
3645
|
-
first: "PageUp",
|
|
3646
|
-
last: "PageDown",
|
|
3647
|
-
selectItem: "Enter"
|
|
3648
|
-
};
|
|
3649
|
-
const ITEM_SELECTOR = "menu-item";
|
|
3650
|
-
const GROUP_SELECTOR = "menu-group";
|
|
3651
|
-
const MenuRootContext = react.createContext({});
|
|
3652
|
-
const MenuGroupContext = react.createContext({});
|
|
3653
|
-
const MenuPageContext = react.createContext({});
|
|
3654
|
-
const menuRootCva = classVarianceAuthority.cva(["w-full", "outline-none"], {
|
|
3655
|
-
variants: {
|
|
3656
|
-
size: {
|
|
3657
|
-
xs: ["p-0.5", "text-xs", "min-w-30"],
|
|
3658
|
-
sm: ["p-0.75", "text-sm", "min-w-35"],
|
|
3659
|
-
md: ["p-1", "text-md", "min-w-40"],
|
|
3660
|
-
lg: ["p-1.25", "text-lg", "min-w-45"],
|
|
3661
|
-
xl: ["p-1.5", "text-xl", "min-w-50"]
|
|
3662
|
-
},
|
|
3663
|
-
radius: {
|
|
3664
|
-
none: ["rounded-none"],
|
|
3665
|
-
xs: ["rounded-xs"],
|
|
3666
|
-
sm: ["rounded-sm"],
|
|
3667
|
-
md: ["rounded-md"],
|
|
3668
|
-
lg: ["rounded-lg"],
|
|
3669
|
-
xl: ["rounded-lg"],
|
|
3670
|
-
full: ["rounded-lg"]
|
|
3671
|
-
}
|
|
3672
|
-
}
|
|
3673
|
-
});
|
|
3674
|
-
const menuItemCva = classVarianceAuthority.cva(
|
|
3675
|
-
[
|
|
3676
|
-
"select-none",
|
|
3677
|
-
"relative",
|
|
3678
|
-
"flex",
|
|
3679
|
-
"items-center",
|
|
3680
|
-
"outline-none",
|
|
3681
|
-
"data-[disabled=true]:text-(--base-a8)",
|
|
3682
|
-
"data-[disabled=true]:pointer-events-none",
|
|
3683
|
-
"shrink-0",
|
|
3684
|
-
"py-1",
|
|
3685
|
-
"text-(--base-12)"
|
|
3686
|
-
],
|
|
3687
|
-
{
|
|
3688
|
-
variants: {
|
|
3689
|
-
size: {
|
|
3690
|
-
xs: ["gap-1.5", "px-3"],
|
|
3691
|
-
sm: ["gap-1.75", "px-3.5"],
|
|
3692
|
-
md: ["gap-2", "px-4"],
|
|
3693
|
-
lg: ["gap-2.25", "px-4.5"],
|
|
3694
|
-
xl: ["gap-2.5", "px-5"]
|
|
3695
|
-
},
|
|
3696
|
-
variant: {
|
|
3697
|
-
solid: [
|
|
3698
|
-
"data-[active=true]:not-[data-[disabled=true]]:text-(--accent-contrast)",
|
|
3699
|
-
"data-[active=true]:not-[data-[disabled=true]]:bg-(--accent-a9)",
|
|
3700
|
-
"data-[active=true]:not-[data-[disabled=true]]:active:brightness-110"
|
|
3701
|
-
],
|
|
3702
|
-
soft: [
|
|
3703
|
-
"data-[active=true]:not-[data-[disabled=true]]:bg-(--accent-a3)",
|
|
3704
|
-
"data-[active=true]:not-[data-[disabled=true]]:active:bg-(--accent-a4)"
|
|
3705
|
-
]
|
|
3706
|
-
}
|
|
3707
|
-
}
|
|
3708
|
-
}
|
|
3709
|
-
);
|
|
3710
|
-
const menuGroupLabelCva = classVarianceAuthority.cva(["text-(--base-a11)", "flex", "items-center", "select-none", "py-1"], {
|
|
3711
|
-
variants: {
|
|
3712
|
-
size: {
|
|
3713
|
-
xs: ["gap-1.5", "px-3", "text-xs"],
|
|
3714
|
-
sm: ["gap-1.75", "px-3.5", "text-xs"],
|
|
3715
|
-
md: ["gap-2", "px-4", "text-sm"],
|
|
3716
|
-
lg: ["gap-2.25", "px-4.5", "text-base"],
|
|
3717
|
-
xl: ["gap-2.5", "px-5", "text-lg"]
|
|
3718
|
-
}
|
|
3719
|
-
}
|
|
3720
|
-
});
|
|
3721
|
-
const menuSeparatorCva = classVarianceAuthority.cva(["h-px", "bg-(--base-a6)", "w-auto", "shrink-0"], {
|
|
3722
|
-
variants: {
|
|
3723
|
-
size: {
|
|
3724
|
-
xs: ["-mx-0.5", "my-0.5"],
|
|
3725
|
-
sm: ["-mx-0.75", "my-0.75"],
|
|
3726
|
-
md: ["-mx-1", "my-1"],
|
|
3727
|
-
lg: ["-mx-1.25", "my-1.25"],
|
|
3728
|
-
xl: ["-mx-1.5", "my-1.5"]
|
|
3729
|
-
}
|
|
3730
|
-
}
|
|
3731
|
-
});
|
|
3732
|
-
const MenuV2Item = react.memo((props) => {
|
|
3733
|
-
const {
|
|
3734
|
-
ref,
|
|
3735
|
-
children,
|
|
3736
|
-
className,
|
|
3737
|
-
disabled = false,
|
|
3738
|
-
onClick,
|
|
3739
|
-
onSelect,
|
|
3740
|
-
onPointerEnter,
|
|
3741
|
-
onPointerLeave,
|
|
3742
|
-
onPointerMove,
|
|
3743
|
-
...rest
|
|
3744
|
-
} = props;
|
|
3745
|
-
const internalRef = react.useRef(null);
|
|
3746
|
-
const itemId = react.useId();
|
|
3747
|
-
const { activeItemId, setActiveItemId, size, variant, radius } = react.use(MenuRootContext);
|
|
3748
|
-
const isActive = itemId === activeItemId;
|
|
3749
|
-
const handleSelect = react.useCallback(
|
|
3750
|
-
(e) => {
|
|
3751
|
-
onSelect == null ? void 0 : onSelect(e);
|
|
3752
|
-
},
|
|
3753
|
-
[onSelect]
|
|
3754
|
-
);
|
|
3755
|
-
const handleClick = react.useCallback(
|
|
3756
|
-
(e) => {
|
|
3757
|
-
onClick == null ? void 0 : onClick(e);
|
|
3758
|
-
handleSelect(new Event("menu-select"));
|
|
3759
|
-
},
|
|
3760
|
-
[handleSelect, onClick]
|
|
3761
|
-
);
|
|
3762
|
-
const handlePointerEnter = react.useCallback(
|
|
3763
|
-
(e) => {
|
|
3764
|
-
onPointerEnter == null ? void 0 : onPointerEnter(e);
|
|
3765
|
-
if (e.defaultPrevented) return;
|
|
3766
|
-
setActiveItemId(itemId);
|
|
3767
|
-
},
|
|
3768
|
-
[onPointerEnter, setActiveItemId, itemId]
|
|
3769
|
-
);
|
|
3770
|
-
const handlePointerLeave = react.useCallback(
|
|
3771
|
-
(e) => {
|
|
3772
|
-
onPointerLeave == null ? void 0 : onPointerLeave(e);
|
|
3773
|
-
if (e.defaultPrevented) return;
|
|
3774
|
-
setActiveItemId(null);
|
|
3775
|
-
},
|
|
3776
|
-
[onPointerLeave, setActiveItemId]
|
|
3777
|
-
);
|
|
3778
|
-
const handlePointerMove = react.useCallback(
|
|
3779
|
-
(e) => {
|
|
3780
|
-
onPointerMove == null ? void 0 : onPointerMove(e);
|
|
3781
|
-
if (e.defaultPrevented) return;
|
|
3782
|
-
setActiveItemId(itemId);
|
|
3783
|
-
},
|
|
3784
|
-
[onPointerMove, itemId, setActiveItemId]
|
|
3785
|
-
);
|
|
3786
|
-
react.useEffect(() => {
|
|
3787
|
-
if (!internalRef.current) return;
|
|
3788
|
-
const element = internalRef.current;
|
|
3789
|
-
element.addEventListener("menu-select", handleSelect);
|
|
3790
|
-
return () => {
|
|
3791
|
-
element.removeEventListener("menu-select", handleSelect);
|
|
3792
|
-
};
|
|
3793
|
-
}, [handleSelect]);
|
|
3794
|
-
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
3795
|
-
"div",
|
|
3796
|
-
{
|
|
3797
|
-
ref: mergeRefs([ref, internalRef]),
|
|
3798
|
-
className: classVarianceAuthority.cx(menuItemCva({ size, variant }), radiusCva({ radius, maxLarge: true }), className),
|
|
3799
|
-
role: "menuitem",
|
|
3800
|
-
onClick: handleClick,
|
|
3801
|
-
onPointerEnter: handlePointerEnter,
|
|
3802
|
-
onPointerLeave: handlePointerLeave,
|
|
3803
|
-
onPointerMove: handlePointerMove,
|
|
3804
|
-
...{ [ITEM_SELECTOR]: itemId },
|
|
3805
|
-
"data-active": getBooleanState(isActive),
|
|
3806
|
-
"data-disabled": getBooleanState(disabled),
|
|
3807
|
-
"aria-disabled": getBooleanState(disabled),
|
|
3808
|
-
...rest,
|
|
3809
|
-
children
|
|
3810
|
-
}
|
|
3811
|
-
);
|
|
3812
|
-
});
|
|
3813
|
-
MenuV2Item.displayName = "MenuItem";
|
|
3814
|
-
const MenuV2CheckboxItem = react.memo((props) => {
|
|
3815
|
-
const { ref, checked, onCheckedChange, onSelect, ...rest } = props;
|
|
3816
|
-
const handleSelect = react.useCallback(
|
|
3817
|
-
(e) => {
|
|
3818
|
-
onSelect == null ? void 0 : onSelect(e);
|
|
3819
|
-
if (e.defaultPrevented) return;
|
|
3820
|
-
switch (checked) {
|
|
3821
|
-
case true:
|
|
3822
|
-
onCheckedChange(false);
|
|
3823
|
-
break;
|
|
3824
|
-
case "indeterminate":
|
|
3825
|
-
onCheckedChange(true);
|
|
3826
|
-
break;
|
|
3827
|
-
case false:
|
|
3828
|
-
onCheckedChange(true);
|
|
3829
|
-
break;
|
|
3830
|
-
}
|
|
3831
|
-
},
|
|
3832
|
-
[checked, onCheckedChange, onSelect]
|
|
3833
|
-
);
|
|
3834
|
-
return /* @__PURE__ */ jsxRuntime.jsx(CheckedIndicatorContext.Provider, { value: checked, children: /* @__PURE__ */ jsxRuntime.jsx(MenuV2Item, { ref, onSelect: handleSelect, ...rest }) });
|
|
3835
|
-
});
|
|
3836
|
-
MenuV2CheckboxItem.displayName = "MenuCheckboxItem";
|
|
3837
|
-
const MenuV2CheckedIndicator = react.memo((props) => {
|
|
3838
|
-
const { ref, children, ...rest } = props;
|
|
3839
|
-
return /* @__PURE__ */ jsxRuntime.jsx(CheckedIndicator, { ref, ...rest, children });
|
|
3840
|
-
});
|
|
3841
|
-
MenuV2CheckedIndicator.displayName = "MenuCheckboxItemIndicator";
|
|
3842
|
-
const MenuV2Group = react.memo((props) => {
|
|
3843
|
-
const { ref, children, ...rest } = props;
|
|
3844
|
-
const groupId = react.useId();
|
|
3845
|
-
const [labelId, setLabelId] = react.useState(null);
|
|
3846
|
-
const contextValue = react.useMemo(
|
|
3847
|
-
() => ({
|
|
3848
|
-
labelId,
|
|
3849
|
-
setLabelId
|
|
3850
|
-
}),
|
|
3851
|
-
[labelId]
|
|
3852
|
-
);
|
|
3853
|
-
return /* @__PURE__ */ jsxRuntime.jsx("div", { ref, role: "group", ...{ [GROUP_SELECTOR]: groupId }, "aria-labelledby": labelId ?? void 0, ...rest, children: /* @__PURE__ */ jsxRuntime.jsx(MenuGroupContext, { value: contextValue, children }) });
|
|
3854
|
-
});
|
|
3855
|
-
MenuV2Group.displayName = "MenuGroup";
|
|
3856
|
-
const MenuV2GroupLabel = react.memo((props) => {
|
|
3857
|
-
const { ref, children, id, className, ...rest } = props;
|
|
3858
|
-
const labelId = useFallbackId(id);
|
|
3859
|
-
const { size } = react.use(MenuRootContext);
|
|
3860
|
-
const { setLabelId } = react.use(MenuGroupContext);
|
|
3861
|
-
react.useEffect(() => {
|
|
3862
|
-
setLabelId(labelId);
|
|
3863
|
-
}, [labelId, setLabelId]);
|
|
3864
|
-
return /* @__PURE__ */ jsxRuntime.jsx("div", { ref, id: labelId, className: classVarianceAuthority.cx(menuGroupLabelCva({ size }), className), ...rest, children });
|
|
3865
|
-
});
|
|
3866
|
-
MenuV2GroupLabel.displayName = "MenuGroupLabel";
|
|
3867
|
-
const MenuV2SelectAllItem = genericMemo((props) => {
|
|
3868
|
-
const { ref, children, onSelect, ...rest } = props;
|
|
3869
|
-
const { allSelected, someSelected, toggleSelectAll } = react.use(MultiSelectContext);
|
|
3870
|
-
const selectedState = allSelected ? true : someSelected ? "indeterminate" : false;
|
|
3871
|
-
const handleSelect = react.useCallback(
|
|
3872
|
-
(e) => {
|
|
3873
|
-
onSelect == null ? void 0 : onSelect(e);
|
|
3874
|
-
if (e.defaultPrevented) return;
|
|
3875
|
-
toggleSelectAll();
|
|
3876
|
-
},
|
|
3877
|
-
[onSelect, toggleSelectAll]
|
|
3878
|
-
);
|
|
3879
|
-
return /* @__PURE__ */ jsxRuntime.jsx(MenuV2Item, { onSelect: handleSelect, ref, "data-state": getCheckedState(selectedState), ...rest, children: /* @__PURE__ */ jsxRuntime.jsx(CheckedIndicatorContext, { value: selectedState, children }) });
|
|
3880
|
-
});
|
|
3881
|
-
const MenuV2MultiSelectGroup = genericMemo(function MenuMultiSelectGroup2(props) {
|
|
3882
|
-
const { ref, children, defaultValues, values, onValuesChange, ...rest } = props;
|
|
3883
|
-
return /* @__PURE__ */ jsxRuntime.jsx(MenuV2Group, { ref, ...rest, children: /* @__PURE__ */ jsxRuntime.jsx(MultiSelectProvider, { defaultValues, values, onValuesChange, children }) });
|
|
3884
|
-
});
|
|
3885
|
-
const MenuV2MultiSelectItem = genericMemo(function(props) {
|
|
3886
|
-
const { ref, onSelect, children, value, ...rest } = props;
|
|
3887
|
-
const { selected, selectValue, registerValue } = react.use(MultiSelectContext);
|
|
3888
|
-
react.useLayoutEffect(() => {
|
|
3889
|
-
return registerValue(value);
|
|
3890
|
-
}, [registerValue, value]);
|
|
3891
|
-
const isSelected = selected(value);
|
|
3892
|
-
const handleSelect = react.useCallback(
|
|
3893
|
-
(e) => {
|
|
3894
|
-
onSelect == null ? void 0 : onSelect(e);
|
|
3895
|
-
if (e.defaultPrevented) return;
|
|
3896
|
-
selectValue(value);
|
|
3897
|
-
},
|
|
3898
|
-
[onSelect, selectValue, value]
|
|
3899
|
-
);
|
|
3900
|
-
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
3901
|
-
MenuV2Item,
|
|
3902
|
-
{
|
|
3903
|
-
ref,
|
|
3904
|
-
role: "menuitemcheckbox",
|
|
3905
|
-
onSelect: handleSelect,
|
|
3906
|
-
"data-state": getSelectedState(isSelected),
|
|
3907
|
-
...rest,
|
|
3908
|
-
children: /* @__PURE__ */ jsxRuntime.jsx(SelectedIndicatorContext, { value: isSelected, children })
|
|
3909
|
-
}
|
|
3910
|
-
);
|
|
3911
|
-
});
|
|
3912
|
-
const MenuV2Page = react.memo((props) => {
|
|
3913
|
-
const { children, ref, page, ...rest } = props;
|
|
3914
|
-
const { page: activePage } = react.use(MenuPageContext);
|
|
3915
|
-
const isActive = page === activePage;
|
|
3916
|
-
return /* @__PURE__ */ jsxRuntime.jsx("div", { ref, "data-active": getActiveState(isActive), hidden: !isActive, ...rest, children: isActive ? children : null });
|
|
3917
|
-
});
|
|
3918
|
-
MenuV2Page.displayName = "MenuPage";
|
|
3919
|
-
const MenuV2Pages = react.memo((props) => {
|
|
3920
|
-
const { children, defaultPage = "", page: controlledPage, onPageChange } = props;
|
|
3921
|
-
const [page, setPage] = useControlledState(defaultPage, controlledPage, onPageChange);
|
|
3922
|
-
const contextValue = react.useMemo(
|
|
3923
|
-
() => ({
|
|
3924
|
-
page,
|
|
3925
|
-
setPage
|
|
3926
|
-
}),
|
|
3927
|
-
[page, setPage]
|
|
3928
|
-
);
|
|
3929
|
-
return /* @__PURE__ */ jsxRuntime.jsx(MenuPageContext, { value: contextValue, children });
|
|
3930
|
-
});
|
|
3931
|
-
MenuV2Pages.displayName = "MenuPages";
|
|
3932
|
-
const MenuV2PageTriggerItem = react.memo((props) => {
|
|
3933
|
-
const { ref, children, page, onSelect, ...rest } = props;
|
|
3934
|
-
const { page: activePage, setPage } = react.use(MenuPageContext);
|
|
3935
|
-
const isActive = page === activePage;
|
|
3936
|
-
const handleSelect = react.useCallback(
|
|
3937
|
-
(e) => {
|
|
3938
|
-
onSelect == null ? void 0 : onSelect(e);
|
|
3939
|
-
if (e.defaultPrevented) return;
|
|
3940
|
-
setPage(page);
|
|
3941
|
-
},
|
|
3942
|
-
[onSelect, page, setPage]
|
|
3943
|
-
);
|
|
3944
|
-
return /* @__PURE__ */ jsxRuntime.jsx(MenuV2Item, { ref, onSelect: handleSelect, "data-state": getActiveState(isActive), ...rest, children: /* @__PURE__ */ jsxRuntime.jsx(SelectedIndicatorContext, { value: isActive, children }) });
|
|
3945
|
-
});
|
|
3946
|
-
MenuV2PageTriggerItem.displayName = "CommandMenuPageTriggerItem";
|
|
3947
|
-
const computeNextIndex = (index, length, direction, loop) => {
|
|
3948
|
-
switch (direction) {
|
|
3949
|
-
case "next":
|
|
3950
|
-
return index === length - 1 ? loop ? 0 : index : index + 1;
|
|
3951
|
-
case "prev":
|
|
3952
|
-
return index === 0 ? loop ? length - 1 : index : index - 1;
|
|
3953
|
-
}
|
|
3954
|
-
};
|
|
3955
|
-
const MenuV2Root = react.memo((props) => {
|
|
3956
|
-
const providerContext = useProvider();
|
|
3957
|
-
const {
|
|
3958
|
-
ref,
|
|
3959
|
-
children,
|
|
3960
|
-
className,
|
|
3961
|
-
onKeyDown,
|
|
3962
|
-
loop = false,
|
|
3963
|
-
// style props
|
|
3964
|
-
radius = providerContext.radius,
|
|
3965
|
-
accentColor = "base",
|
|
3966
|
-
size = "md",
|
|
3967
|
-
variant = "soft",
|
|
3968
|
-
...rest
|
|
3969
|
-
} = props;
|
|
3970
|
-
const internalRef = react.useRef(null);
|
|
3971
|
-
const [activeItemId, setActiveItemId] = react.useState(null);
|
|
3972
|
-
const getItems = react.useCallback((element) => {
|
|
3973
|
-
return Array.from(element.querySelectorAll(`[${ITEM_SELECTOR}]:not([data-disabled=true]`));
|
|
3974
|
-
}, []);
|
|
3975
|
-
const getFirstItem = react.useCallback(
|
|
3976
|
-
(element) => {
|
|
3977
|
-
return getItems(element).at(0);
|
|
3978
|
-
},
|
|
3979
|
-
[getItems]
|
|
3980
|
-
);
|
|
3981
|
-
const getLastItem = react.useCallback(
|
|
3982
|
-
(element) => {
|
|
3983
|
-
return getItems(element).at(-1);
|
|
3984
|
-
},
|
|
3985
|
-
[getItems]
|
|
3986
|
-
);
|
|
3987
|
-
const getActiveItem = react.useCallback(
|
|
3988
|
-
(element) => {
|
|
3989
|
-
return getItems(element).find((itemEle) => itemEle.getAttribute(ITEM_SELECTOR) === activeItemId);
|
|
3990
|
-
},
|
|
3991
|
-
[activeItemId, getItems]
|
|
3992
|
-
);
|
|
3993
|
-
const getNextItem = react.useCallback(
|
|
3994
|
-
(element, direction) => {
|
|
3995
|
-
const items = getItems(element);
|
|
3996
|
-
const activeItem = getActiveItem(element);
|
|
3997
|
-
const activeItemIndex = items.findIndex((itemEle) => itemEle === activeItem);
|
|
3998
|
-
const nextItemIndex = computeNextIndex(activeItemIndex, items.length, direction, loop);
|
|
3999
|
-
return items[nextItemIndex];
|
|
4000
|
-
},
|
|
4001
|
-
[getActiveItem, getItems, loop]
|
|
4002
|
-
);
|
|
4003
|
-
const getGroups = react.useCallback(() => {
|
|
4004
|
-
if (!internalRef.current) return [];
|
|
4005
|
-
return Array.from(internalRef.current.querySelectorAll(`[${GROUP_SELECTOR}]`));
|
|
4006
|
-
}, []);
|
|
4007
|
-
const getActiveGroup = react.useCallback(() => {
|
|
4008
|
-
var _a;
|
|
4009
|
-
return ((_a = getActiveItem(internalRef.current)) == null ? void 0 : _a.closest(`[${GROUP_SELECTOR}]`)) ?? void 0;
|
|
4010
|
-
}, [getActiveItem]);
|
|
4011
|
-
const getNextGroup = react.useCallback(
|
|
4012
|
-
(direction) => {
|
|
4013
|
-
const groups = getGroups();
|
|
4014
|
-
const activeGroup = getActiveGroup();
|
|
4015
|
-
const activeGroupIndex = groups.findIndex((groupEle) => groupEle === activeGroup);
|
|
4016
|
-
const nextGroupIndex = computeNextIndex(activeGroupIndex, groups.length, direction, loop);
|
|
4017
|
-
return groups[nextGroupIndex];
|
|
4018
|
-
},
|
|
4019
|
-
[getActiveGroup, getGroups, loop]
|
|
4020
|
-
);
|
|
4021
|
-
const getFirstGroup = react.useCallback(() => {
|
|
4022
|
-
return getGroups().at(0);
|
|
4023
|
-
}, [getGroups]);
|
|
4024
|
-
const getLastGroup = react.useCallback(() => {
|
|
4025
|
-
return getGroups().at(-1);
|
|
4026
|
-
}, [getGroups]);
|
|
4027
|
-
const handleKeyDown = react.useCallback(
|
|
4028
|
-
(e) => {
|
|
4029
|
-
onKeyDown == null ? void 0 : onKeyDown(e);
|
|
4030
|
-
if (e.defaultPrevented) return;
|
|
4031
|
-
switch (e.code) {
|
|
4032
|
-
case KEY_MAPPING.selectItem: {
|
|
4033
|
-
const activeItem = getActiveItem(internalRef.current);
|
|
4034
|
-
if (activeItem) activeItem.dispatchEvent(new Event("menu-select"));
|
|
4035
|
-
break;
|
|
4036
|
-
}
|
|
4037
|
-
case KEY_MAPPING.next: {
|
|
4038
|
-
let nextItem;
|
|
4039
|
-
if (e.shiftKey) {
|
|
4040
|
-
const nextGroup = getNextGroup("next");
|
|
4041
|
-
if (!nextGroup) return;
|
|
4042
|
-
nextItem = getFirstItem(nextGroup);
|
|
4043
|
-
} else {
|
|
4044
|
-
nextItem = getNextItem(internalRef.current, "next");
|
|
4045
|
-
}
|
|
4046
|
-
if (!nextItem) return;
|
|
4047
|
-
setActiveItemId(nextItem.getAttribute(ITEM_SELECTOR));
|
|
4048
|
-
break;
|
|
4049
|
-
}
|
|
4050
|
-
case KEY_MAPPING.prev: {
|
|
4051
|
-
let prevItem;
|
|
4052
|
-
if (e.shiftKey) {
|
|
4053
|
-
const prevGroup = getNextGroup("prev");
|
|
4054
|
-
if (!prevGroup) return;
|
|
4055
|
-
prevItem = getFirstItem(prevGroup);
|
|
4056
|
-
} else {
|
|
4057
|
-
prevItem = getNextItem(internalRef.current, "prev");
|
|
4058
|
-
}
|
|
4059
|
-
if (!prevItem) return;
|
|
4060
|
-
setActiveItemId(prevItem.getAttribute(ITEM_SELECTOR));
|
|
4061
|
-
break;
|
|
4062
|
-
}
|
|
4063
|
-
case KEY_MAPPING.first: {
|
|
4064
|
-
let firstItem;
|
|
4065
|
-
if (e.shiftKey) {
|
|
4066
|
-
const firstGroup = getFirstGroup();
|
|
4067
|
-
if (!firstGroup) return;
|
|
4068
|
-
firstItem = getFirstItem(firstGroup);
|
|
4069
|
-
} else {
|
|
4070
|
-
firstItem = getFirstItem(internalRef.current);
|
|
4071
|
-
}
|
|
4072
|
-
if (!firstItem) return;
|
|
4073
|
-
setActiveItemId(firstItem.getAttribute(ITEM_SELECTOR));
|
|
4074
|
-
break;
|
|
4075
|
-
}
|
|
4076
|
-
case KEY_MAPPING.last: {
|
|
4077
|
-
let lastItem;
|
|
4078
|
-
if (e.shiftKey) {
|
|
4079
|
-
const lastGroup = getLastGroup();
|
|
4080
|
-
if (!lastGroup) return;
|
|
4081
|
-
lastItem = getFirstItem(lastGroup);
|
|
4082
|
-
} else {
|
|
4083
|
-
lastItem = getLastItem(internalRef.current);
|
|
4084
|
-
}
|
|
4085
|
-
if (!lastItem) return;
|
|
4086
|
-
setActiveItemId(lastItem.getAttribute(ITEM_SELECTOR));
|
|
4087
|
-
break;
|
|
4088
|
-
}
|
|
4089
|
-
}
|
|
4090
|
-
},
|
|
4091
|
-
[getActiveItem, getFirstGroup, getFirstItem, getLastGroup, getLastItem, getNextGroup, getNextItem, onKeyDown]
|
|
4092
|
-
);
|
|
4093
|
-
react.useEffect(() => {
|
|
4094
|
-
var _a;
|
|
4095
|
-
const firstItem = getFirstItem(internalRef.current);
|
|
4096
|
-
if (!firstItem) return;
|
|
4097
|
-
(_a = internalRef.current) == null ? void 0 : _a.focus();
|
|
4098
|
-
setActiveItemId(firstItem.getAttribute(ITEM_SELECTOR));
|
|
4099
|
-
}, [getFirstItem]);
|
|
4100
|
-
const contextValue = react.useMemo(
|
|
4101
|
-
() => ({
|
|
4102
|
-
activeItemId,
|
|
4103
|
-
setActiveItemId,
|
|
4104
|
-
// style props
|
|
4105
|
-
accentColor,
|
|
4106
|
-
radius,
|
|
4107
|
-
variant,
|
|
4108
|
-
size
|
|
4109
|
-
}),
|
|
4110
|
-
[accentColor, activeItemId, radius, size, variant]
|
|
4111
|
-
);
|
|
4112
|
-
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
4113
|
-
"div",
|
|
4114
|
-
{
|
|
4115
|
-
ref: mergeRefs([ref, internalRef]),
|
|
4116
|
-
className: classVarianceAuthority.cx(menuRootCva({ size }), radiusCva({ radius, maxLarge: true }), className),
|
|
4117
|
-
role: "menu",
|
|
4118
|
-
onKeyDown: handleKeyDown,
|
|
4119
|
-
tabIndex: 0,
|
|
4120
|
-
"aria-activedescendant": activeItemId ?? void 0,
|
|
4121
|
-
"data-accent-color": accentColor,
|
|
4122
|
-
...rest,
|
|
4123
|
-
children: /* @__PURE__ */ jsxRuntime.jsx(MenuRootContext, { value: contextValue, children })
|
|
4124
|
-
}
|
|
4125
|
-
);
|
|
4126
|
-
});
|
|
4127
|
-
MenuV2Root.displayName = "MenuRoot";
|
|
4128
|
-
const MenuV2SelectedIndicator = react.memo((props) => {
|
|
4129
|
-
const { ref, children, ...rest } = props;
|
|
4130
|
-
return /* @__PURE__ */ jsxRuntime.jsx(SelectedIndicator, { ref, ...rest, children });
|
|
4131
|
-
});
|
|
4132
|
-
MenuV2SelectedIndicator.displayName = "MenuCheckboxItemIndicator";
|
|
4133
|
-
const MenuV2SelectGroup = genericMemo(function MenuSelectGroup2(props) {
|
|
4134
|
-
const { ref, children, required, defaultValue, value, onValueChange, ...rest } = props;
|
|
4135
|
-
return /* @__PURE__ */ jsxRuntime.jsx(MenuV2Group, { ref, ...rest, children: required ? /* @__PURE__ */ jsxRuntime.jsx(SingleSelectRequiredProvider, { defaultValue, value, onValueChange, children }) : /* @__PURE__ */ jsxRuntime.jsx(
|
|
4136
|
-
SingleSelectNotRequiredProvider,
|
|
4137
|
-
{
|
|
4138
|
-
defaultValue,
|
|
4139
|
-
value,
|
|
4140
|
-
onValueChange,
|
|
4141
|
-
children
|
|
4142
|
-
}
|
|
4143
|
-
) });
|
|
4144
|
-
});
|
|
4145
|
-
const MenuV2SelectItem = genericMemo(function(props) {
|
|
4146
|
-
const { ref, value, onSelect, children, ...rest } = props;
|
|
4147
|
-
const { selected, selectValue } = react.use(SelectContext);
|
|
4148
|
-
const isSelected = selected(value);
|
|
4149
|
-
const handleSelect = react.useCallback(
|
|
4150
|
-
(e) => {
|
|
4151
|
-
onSelect == null ? void 0 : onSelect(e);
|
|
4152
|
-
if (e.defaultPrevented) return;
|
|
4153
|
-
selectValue(value);
|
|
4154
|
-
},
|
|
4155
|
-
[onSelect, selectValue, value]
|
|
4156
|
-
);
|
|
4157
|
-
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
4158
|
-
MenuV2Item,
|
|
4159
|
-
{
|
|
4160
|
-
ref,
|
|
4161
|
-
role: "menuitemcheckbox",
|
|
4162
|
-
onSelect: handleSelect,
|
|
4163
|
-
"data-state": getSelectedState(isSelected),
|
|
4164
|
-
...rest,
|
|
4165
|
-
children: /* @__PURE__ */ jsxRuntime.jsx(SelectedIndicatorContext, { value: isSelected, children })
|
|
4166
|
-
}
|
|
4167
|
-
);
|
|
4168
|
-
});
|
|
4169
|
-
const MenuV2Separator = react.memo((props) => {
|
|
4170
|
-
const { ref, className, ...rest } = props;
|
|
4171
|
-
const { size } = react.use(MenuRootContext);
|
|
4172
|
-
return /* @__PURE__ */ jsxRuntime.jsx(RadixSeparator__namespace.Root, { className: classVarianceAuthority.cx(menuSeparatorCva({ size }), className), ref, ...rest });
|
|
4173
|
-
});
|
|
4174
|
-
MenuV2Separator.displayName = "MenuSeparator";
|
|
4175
|
-
const MenuV2 = {
|
|
4176
|
-
Root: MenuV2Root,
|
|
4177
|
-
Group: MenuV2Group,
|
|
4178
|
-
GroupLabel: MenuV2GroupLabel,
|
|
4179
|
-
Item: MenuV2Item,
|
|
4180
|
-
Separator: MenuV2Separator,
|
|
4181
|
-
SelectGroup: MenuV2SelectGroup,
|
|
4182
|
-
SelectItem: MenuV2SelectItem,
|
|
4183
|
-
MultiSelectGroup: MenuV2MultiSelectGroup,
|
|
4184
|
-
MultiSelectItem: MenuV2MultiSelectItem,
|
|
4185
|
-
SelectAllItem: MenuV2SelectAllItem,
|
|
4186
|
-
SelectedIndicator: MenuV2SelectedIndicator,
|
|
4187
|
-
CheckboxItem: MenuV2CheckboxItem,
|
|
4188
|
-
CheckedIndicator: MenuV2CheckedIndicator,
|
|
4189
|
-
Pages: MenuV2Pages,
|
|
4190
|
-
Page: MenuV2Page,
|
|
4191
|
-
PageTriggerItem: MenuV2PageTriggerItem
|
|
4192
|
-
};
|
|
4193
|
-
const OneTimePasswordFieldHiddenInput = react.memo((props) => {
|
|
3864
|
+
const OneTimePasswordFieldHiddenInput = React.memo((props) => {
|
|
4194
3865
|
return /* @__PURE__ */ jsxRuntime.jsx(RadixOneTimePasswordField__namespace.HiddenInput, { ...props });
|
|
4195
3866
|
});
|
|
4196
3867
|
OneTimePasswordFieldHiddenInput.displayName = "OneTimePasswordFieldHiddenInput";
|
|
4197
|
-
const OneTimePasswordFieldContext =
|
|
3868
|
+
const OneTimePasswordFieldContext = React.createContext({});
|
|
4198
3869
|
const onetimePasswordFieldInput = classVarianceAuthority.cva(
|
|
4199
3870
|
[
|
|
4200
3871
|
"flex",
|
|
@@ -4251,9 +3922,9 @@
|
|
|
4251
3922
|
}
|
|
4252
3923
|
}
|
|
4253
3924
|
);
|
|
4254
|
-
const OneTimePasswordFieldInput =
|
|
3925
|
+
const OneTimePasswordFieldInput = React.memo((props) => {
|
|
4255
3926
|
const { ref, className, ...rest } = props;
|
|
4256
|
-
const { variant, size, radius, accentColor } =
|
|
3927
|
+
const { variant, size, radius, accentColor } = React.use(OneTimePasswordFieldContext);
|
|
4257
3928
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
4258
3929
|
RadixOneTimePasswordField__namespace.Input,
|
|
4259
3930
|
{
|
|
@@ -4269,7 +3940,7 @@
|
|
|
4269
3940
|
);
|
|
4270
3941
|
});
|
|
4271
3942
|
OneTimePasswordFieldInput.displayName = "OneTimePasswordFieldInput";
|
|
4272
|
-
const OneTimePasswordFieldRoot =
|
|
3943
|
+
const OneTimePasswordFieldRoot = React.memo((props) => {
|
|
4273
3944
|
const providerContext = useProvider();
|
|
4274
3945
|
const {
|
|
4275
3946
|
ref,
|
|
@@ -4280,7 +3951,7 @@
|
|
|
4280
3951
|
accentColor = providerContext.accentColor,
|
|
4281
3952
|
...rest
|
|
4282
3953
|
} = props;
|
|
4283
|
-
const contextValue =
|
|
3954
|
+
const contextValue = React.useMemo(() => ({ variant, size, radius, accentColor }), [accentColor, radius, size, variant]);
|
|
4284
3955
|
return /* @__PURE__ */ jsxRuntime.jsx(RadixOneTimePasswordField__namespace.Root, { ref, "data-accent-color": accentColor, ...rest, children: /* @__PURE__ */ jsxRuntime.jsx(OneTimePasswordFieldContext, { value: contextValue, children }) });
|
|
4285
3956
|
});
|
|
4286
3957
|
OneTimePasswordFieldRoot.displayName = "OneTimePasswordFieldRoot";
|
|
@@ -4289,7 +3960,7 @@
|
|
|
4289
3960
|
Input: OneTimePasswordFieldInput,
|
|
4290
3961
|
Root: OneTimePasswordFieldRoot
|
|
4291
3962
|
};
|
|
4292
|
-
const OverlayClose =
|
|
3963
|
+
const OverlayClose = React.memo((props) => {
|
|
4293
3964
|
const { ref, ...rest } = props;
|
|
4294
3965
|
return /* @__PURE__ */ jsxRuntime.jsx(RadixDialog__namespace.Close, { ref, ...rest });
|
|
4295
3966
|
});
|
|
@@ -4305,7 +3976,7 @@
|
|
|
4305
3976
|
"data-[state='open']:fade-in-0",
|
|
4306
3977
|
"data-[state='open']:zoom-in-95"
|
|
4307
3978
|
]);
|
|
4308
|
-
const OverlayContent =
|
|
3979
|
+
const OverlayContent = React.memo((props) => {
|
|
4309
3980
|
const { ref, container, className, ...rest } = props;
|
|
4310
3981
|
return /* @__PURE__ */ jsxRuntime.jsx(RadixDialog__namespace.Portal, { container, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
4311
3982
|
RadixDialog__namespace.Content,
|
|
@@ -4318,21 +3989,21 @@
|
|
|
4318
3989
|
) });
|
|
4319
3990
|
});
|
|
4320
3991
|
OverlayContent.displayName = "OverlayContent";
|
|
4321
|
-
const OverlayDescription =
|
|
3992
|
+
const OverlayDescription = React.memo((props) => {
|
|
4322
3993
|
const { ref, ...rest } = props;
|
|
4323
3994
|
return /* @__PURE__ */ jsxRuntime.jsx(RadixDialog__namespace.Description, { ref, ...rest });
|
|
4324
3995
|
});
|
|
4325
3996
|
OverlayDescription.displayName = "OverlayDescription";
|
|
4326
|
-
const OverlayRoot =
|
|
3997
|
+
const OverlayRoot = React.memo((props) => {
|
|
4327
3998
|
return /* @__PURE__ */ jsxRuntime.jsx(RadixDialog__namespace.Root, { ...props });
|
|
4328
3999
|
});
|
|
4329
4000
|
OverlayRoot.displayName = "OverlayRoot";
|
|
4330
|
-
const OverlayTitle =
|
|
4001
|
+
const OverlayTitle = React.memo((props) => {
|
|
4331
4002
|
const { ref, ...rest } = props;
|
|
4332
4003
|
return /* @__PURE__ */ jsxRuntime.jsx(RadixDialog__namespace.Title, { ref, ...rest });
|
|
4333
4004
|
});
|
|
4334
4005
|
OverlayTitle.displayName = "OverlayTitle";
|
|
4335
|
-
const OverlayTrigger =
|
|
4006
|
+
const OverlayTrigger = React.memo((props) => {
|
|
4336
4007
|
const { ref, ...rest } = props;
|
|
4337
4008
|
return /* @__PURE__ */ jsxRuntime.jsx(RadixDialog__namespace.Trigger, { ref, ...rest });
|
|
4338
4009
|
});
|
|
@@ -4346,12 +4017,12 @@
|
|
|
4346
4017
|
Close: OverlayClose
|
|
4347
4018
|
};
|
|
4348
4019
|
const centerStyles = { placeSelf: "center" };
|
|
4349
|
-
const ErrorFallback =
|
|
4020
|
+
const ErrorFallback = React.memo((props) => {
|
|
4350
4021
|
const { absoluteCentering, message = "Something went wrong", onRetry } = props;
|
|
4351
4022
|
const { resetBoundary } = reactErrorBoundary.useErrorBoundary();
|
|
4352
4023
|
const height = "20px";
|
|
4353
4024
|
const outerFlexStyles = absoluteCentering ? { position: "absolute", top: "50%", transform: "translateY(-50%)" } : void 0;
|
|
4354
|
-
const handleRetry =
|
|
4025
|
+
const handleRetry = React.useCallback(() => {
|
|
4355
4026
|
resetBoundary();
|
|
4356
4027
|
onRetry();
|
|
4357
4028
|
}, [onRetry, resetBoundary]);
|
|
@@ -4364,14 +4035,14 @@
|
|
|
4364
4035
|
] });
|
|
4365
4036
|
});
|
|
4366
4037
|
ErrorFallback.displayName = "ErrorFallback";
|
|
4367
|
-
const OvermapErrorBoundary =
|
|
4038
|
+
const OvermapErrorBoundary = React.memo((props) => {
|
|
4368
4039
|
const { absoluteCentering, message } = props;
|
|
4369
|
-
const [attempt, setAttempt] =
|
|
4370
|
-
const logError =
|
|
4040
|
+
const [attempt, setAttempt] = React.useState(0);
|
|
4041
|
+
const logError = React.useCallback((error, info) => {
|
|
4371
4042
|
console.error("Error in OvermapErrorBoundary:", error, info);
|
|
4372
4043
|
setAttempt((prev) => prev + 1);
|
|
4373
4044
|
}, []);
|
|
4374
|
-
const handleRetry =
|
|
4045
|
+
const handleRetry = React.useCallback(() => {
|
|
4375
4046
|
setAttempt((prev) => prev + 1);
|
|
4376
4047
|
}, []);
|
|
4377
4048
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
@@ -4385,7 +4056,7 @@
|
|
|
4385
4056
|
);
|
|
4386
4057
|
});
|
|
4387
4058
|
OvermapErrorBoundary.displayName = "OvermapErrorBoundary";
|
|
4388
|
-
const PopoverArrow =
|
|
4059
|
+
const PopoverArrow = React.memo((props) => {
|
|
4389
4060
|
const { ref, children, className, ...rest } = props;
|
|
4390
4061
|
return /* @__PURE__ */ jsxRuntime.jsx(RadixPopover__namespace.Arrow, { className: classVarianceAuthority.cx("fill-(--base-6)", className), ref, ...rest, children });
|
|
4391
4062
|
});
|
|
@@ -4404,7 +4075,7 @@
|
|
|
4404
4075
|
size: "md"
|
|
4405
4076
|
}
|
|
4406
4077
|
});
|
|
4407
|
-
const PopoverContent =
|
|
4078
|
+
const PopoverContent = React.memo((props) => {
|
|
4408
4079
|
const providerContext = useProvider();
|
|
4409
4080
|
const {
|
|
4410
4081
|
ref,
|
|
@@ -4479,7 +4150,7 @@
|
|
|
4479
4150
|
}
|
|
4480
4151
|
}
|
|
4481
4152
|
);
|
|
4482
|
-
const Progress =
|
|
4153
|
+
const Progress = React.memo((props) => {
|
|
4483
4154
|
const providerContext = useProvider();
|
|
4484
4155
|
const {
|
|
4485
4156
|
ref,
|
|
@@ -4491,7 +4162,7 @@
|
|
|
4491
4162
|
accentColor = providerContext.accentColor,
|
|
4492
4163
|
...rest
|
|
4493
4164
|
} = props;
|
|
4494
|
-
const computedStyle =
|
|
4165
|
+
const computedStyle = React.useMemo(
|
|
4495
4166
|
() => ({
|
|
4496
4167
|
...style,
|
|
4497
4168
|
"--progress-value": rest.value ?? 0,
|
|
@@ -4512,7 +4183,7 @@
|
|
|
4512
4183
|
);
|
|
4513
4184
|
});
|
|
4514
4185
|
Progress.displayName = "Progress";
|
|
4515
|
-
const RadioCardsContext =
|
|
4186
|
+
const RadioCardsContext = React.createContext({});
|
|
4516
4187
|
const radioCardsRootCva = classVarianceAuthority.cva([], {
|
|
4517
4188
|
variants: {
|
|
4518
4189
|
size: {
|
|
@@ -4572,8 +4243,8 @@
|
|
|
4572
4243
|
}
|
|
4573
4244
|
}
|
|
4574
4245
|
);
|
|
4575
|
-
const RadioCardsItem =
|
|
4576
|
-
const { variant, size, radius } =
|
|
4246
|
+
const RadioCardsItem = React.memo((props) => {
|
|
4247
|
+
const { variant, size, radius } = React.use(RadioCardsContext);
|
|
4577
4248
|
const { className, accentColor, ...rest } = props;
|
|
4578
4249
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
4579
4250
|
RadixRadioGroup__namespace.Item,
|
|
@@ -4585,7 +4256,7 @@
|
|
|
4585
4256
|
);
|
|
4586
4257
|
});
|
|
4587
4258
|
RadioCardsItem.displayName = "RadioCardsItem";
|
|
4588
|
-
const RadioCardsRoot =
|
|
4259
|
+
const RadioCardsRoot = React.memo((props) => {
|
|
4589
4260
|
const providerContext = useProvider();
|
|
4590
4261
|
const {
|
|
4591
4262
|
className,
|
|
@@ -4596,7 +4267,7 @@
|
|
|
4596
4267
|
accentColor = providerContext.accentColor,
|
|
4597
4268
|
...rest
|
|
4598
4269
|
} = props;
|
|
4599
|
-
const contextValue =
|
|
4270
|
+
const contextValue = React.useMemo(
|
|
4600
4271
|
() => ({
|
|
4601
4272
|
variant,
|
|
4602
4273
|
size,
|
|
@@ -4619,7 +4290,7 @@
|
|
|
4619
4290
|
Root: RadioCardsRoot,
|
|
4620
4291
|
Item: RadioCardsItem
|
|
4621
4292
|
};
|
|
4622
|
-
const RadioGroupIndicator =
|
|
4293
|
+
const RadioGroupIndicator = React.memo((props) => {
|
|
4623
4294
|
const { ref, children, className, ...rest } = props;
|
|
4624
4295
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
4625
4296
|
RadixRadioGroup__namespace.Indicator,
|
|
@@ -4632,7 +4303,7 @@
|
|
|
4632
4303
|
);
|
|
4633
4304
|
});
|
|
4634
4305
|
RadioGroupIndicator.displayName = "RadioGroupIndicator";
|
|
4635
|
-
const RadioGroupContext =
|
|
4306
|
+
const RadioGroupContext = React.createContext({});
|
|
4636
4307
|
const radioGroupItem = classVarianceAuthority.cva(
|
|
4637
4308
|
[
|
|
4638
4309
|
"inline-flex",
|
|
@@ -4676,8 +4347,8 @@
|
|
|
4676
4347
|
}
|
|
4677
4348
|
}
|
|
4678
4349
|
);
|
|
4679
|
-
const RadioGroupItem =
|
|
4680
|
-
const radioGroupContext =
|
|
4350
|
+
const RadioGroupItem = React.memo((props) => {
|
|
4351
|
+
const radioGroupContext = React.useContext(RadioGroupContext);
|
|
4681
4352
|
const {
|
|
4682
4353
|
ref,
|
|
4683
4354
|
children,
|
|
@@ -4689,7 +4360,7 @@
|
|
|
4689
4360
|
return /* @__PURE__ */ jsxRuntime.jsx(RadixRadioGroup__namespace.Item, { className: classVarianceAuthority.cx(radioGroupItem({ size, variant }), className), ref, ...rest, children });
|
|
4690
4361
|
});
|
|
4691
4362
|
RadioGroupItem.displayName = "RadioGroupItem";
|
|
4692
|
-
const RadioGroupRoot =
|
|
4363
|
+
const RadioGroupRoot = React.memo((props) => {
|
|
4693
4364
|
const providerContext = useProvider();
|
|
4694
4365
|
const {
|
|
4695
4366
|
ref,
|
|
@@ -4708,6 +4379,65 @@
|
|
|
4708
4379
|
Item: RadioGroupItem,
|
|
4709
4380
|
Root: RadioGroupRoot
|
|
4710
4381
|
};
|
|
4382
|
+
const RatingRootContext = React.createContext({});
|
|
4383
|
+
const RatingItemContext = React.createContext({});
|
|
4384
|
+
const RatingItem = React.memo((props) => {
|
|
4385
|
+
const { ref, children, value, ...rest } = props;
|
|
4386
|
+
const { value: activeValue } = React.use(RatingRootContext);
|
|
4387
|
+
const active = !!activeValue && value <= activeValue;
|
|
4388
|
+
const contextValue = React.useMemo(() => ({ value }), [value]);
|
|
4389
|
+
return /* @__PURE__ */ jsxRuntime.jsx(RadixRadioGroup__namespace.Item, { ref, value: value.toString(), "data-active": active, ...rest, children: /* @__PURE__ */ jsxRuntime.jsx(RatingItemContext, { value: contextValue, children }) });
|
|
4390
|
+
});
|
|
4391
|
+
RatingItem.displayName = "RatingItem";
|
|
4392
|
+
const RatingItemIndicator = React.memo((props) => {
|
|
4393
|
+
const { ref, children, forceMount, ...rest } = props;
|
|
4394
|
+
const { value: activeValue } = React.use(RatingRootContext);
|
|
4395
|
+
const { value } = React.use(RatingItemContext);
|
|
4396
|
+
const active = !!activeValue && value <= activeValue;
|
|
4397
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
4398
|
+
RadixRadioGroup__namespace.Indicator,
|
|
4399
|
+
{
|
|
4400
|
+
ref,
|
|
4401
|
+
forceMount: forceMount ?? (active || void 0),
|
|
4402
|
+
"data-active": active,
|
|
4403
|
+
...rest,
|
|
4404
|
+
children
|
|
4405
|
+
}
|
|
4406
|
+
);
|
|
4407
|
+
});
|
|
4408
|
+
RatingItemIndicator.displayName = "RatingItemIndicator";
|
|
4409
|
+
const RatingRoot = React.memo((props) => {
|
|
4410
|
+
const { ref, children, defaultValue, value: controlledValue, onValueChange, ...rest } = props;
|
|
4411
|
+
const [value, setValue] = useControlledState(defaultValue ?? null, controlledValue, onValueChange);
|
|
4412
|
+
const handleValueChange = React.useCallback(
|
|
4413
|
+
(value2) => {
|
|
4414
|
+
setValue(parseInt(value2));
|
|
4415
|
+
},
|
|
4416
|
+
[setValue]
|
|
4417
|
+
);
|
|
4418
|
+
const contextValue = React.useMemo(
|
|
4419
|
+
() => ({
|
|
4420
|
+
value
|
|
4421
|
+
}),
|
|
4422
|
+
[value]
|
|
4423
|
+
);
|
|
4424
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
4425
|
+
RadixRadioGroup__namespace.Root,
|
|
4426
|
+
{
|
|
4427
|
+
ref,
|
|
4428
|
+
value: value ? value.toString() : null,
|
|
4429
|
+
onValueChange: handleValueChange,
|
|
4430
|
+
...rest,
|
|
4431
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(RatingRootContext, { value: contextValue, children })
|
|
4432
|
+
}
|
|
4433
|
+
);
|
|
4434
|
+
});
|
|
4435
|
+
RatingRoot.displayName = "RatingRoot";
|
|
4436
|
+
const Rating = {
|
|
4437
|
+
Item: RatingItem,
|
|
4438
|
+
ItemIndicator: RatingItemIndicator,
|
|
4439
|
+
Root: RatingRoot
|
|
4440
|
+
};
|
|
4711
4441
|
const segmentedControlRootCva = classVarianceAuthority.cva(
|
|
4712
4442
|
["shrink-0", "transition-colors", "inline-flex", "box-border", "min-w-max", "text-center"],
|
|
4713
4443
|
{
|
|
@@ -4851,15 +4581,15 @@
|
|
|
4851
4581
|
}
|
|
4852
4582
|
}
|
|
4853
4583
|
);
|
|
4854
|
-
const SegmentedControlContext =
|
|
4584
|
+
const SegmentedControlContext = React.createContext({});
|
|
4855
4585
|
const useSegmentedControl = () => {
|
|
4856
|
-
const segmentedControlContext =
|
|
4586
|
+
const segmentedControlContext = React.useContext(SegmentedControlContext);
|
|
4857
4587
|
if (!segmentedControlContext) {
|
|
4858
4588
|
throw new Error("useSegmentedControl must be used within a SegmentedControlProvider");
|
|
4859
4589
|
}
|
|
4860
4590
|
return segmentedControlContext;
|
|
4861
4591
|
};
|
|
4862
|
-
const SegmentedControlItem =
|
|
4592
|
+
const SegmentedControlItem = React.memo((props) => {
|
|
4863
4593
|
const { ref, className, ...rest } = props;
|
|
4864
4594
|
const { size, radius, variant, icon } = useSegmentedControl();
|
|
4865
4595
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
@@ -4872,7 +4602,7 @@
|
|
|
4872
4602
|
);
|
|
4873
4603
|
});
|
|
4874
4604
|
SegmentedControlItem.displayName = "SegmentedControlItem";
|
|
4875
|
-
const SegmentedControlRoot =
|
|
4605
|
+
const SegmentedControlRoot = React.memo((props) => {
|
|
4876
4606
|
const providerContext = useProvider();
|
|
4877
4607
|
const {
|
|
4878
4608
|
ref,
|
|
@@ -4906,7 +4636,7 @@
|
|
|
4906
4636
|
Item: SegmentedControlItem,
|
|
4907
4637
|
Root: SegmentedControlRoot
|
|
4908
4638
|
};
|
|
4909
|
-
const SegmentedTabsListContext =
|
|
4639
|
+
const SegmentedTabsListContext = React.createContext({});
|
|
4910
4640
|
const segmentedTabsListCva = classVarianceAuthority.cva(
|
|
4911
4641
|
["shrink-0", "transition-colors", "inline-flex", "box-border", "min-w-max", "text-center"],
|
|
4912
4642
|
{
|
|
@@ -5054,7 +4784,7 @@
|
|
|
5054
4784
|
}
|
|
5055
4785
|
}
|
|
5056
4786
|
);
|
|
5057
|
-
const SegmentedTabsList =
|
|
4787
|
+
const SegmentedTabsList = React.memo((props) => {
|
|
5058
4788
|
const providerContext = useProvider();
|
|
5059
4789
|
const {
|
|
5060
4790
|
ref,
|
|
@@ -5066,7 +4796,7 @@
|
|
|
5066
4796
|
accentColor = providerContext.accentColor,
|
|
5067
4797
|
...rest
|
|
5068
4798
|
} = props;
|
|
5069
|
-
const contextValue =
|
|
4799
|
+
const contextValue = React.useMemo(
|
|
5070
4800
|
() => ({
|
|
5071
4801
|
size,
|
|
5072
4802
|
variant,
|
|
@@ -5086,14 +4816,14 @@
|
|
|
5086
4816
|
);
|
|
5087
4817
|
});
|
|
5088
4818
|
SegmentedTabsList.displayName = "TabsList";
|
|
5089
|
-
const SegmentedTabsRoot =
|
|
4819
|
+
const SegmentedTabsRoot = React.memo((props) => {
|
|
5090
4820
|
const { ref, className, ...rest } = props;
|
|
5091
4821
|
return /* @__PURE__ */ jsxRuntime.jsx(RadixTabs__namespace.Root, { ref, className: classVarianceAuthority.cx("flex flex-col", className), ...rest });
|
|
5092
4822
|
});
|
|
5093
4823
|
SegmentedTabsRoot.displayName = "TabsRoot";
|
|
5094
|
-
const SegmentedTabsTrigger =
|
|
4824
|
+
const SegmentedTabsTrigger = React.memo((props) => {
|
|
5095
4825
|
const { ref, children, className, ...rest } = props;
|
|
5096
|
-
const { size, radius, variant } =
|
|
4826
|
+
const { size, radius, variant } = React.use(SegmentedTabsListContext);
|
|
5097
4827
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
5098
4828
|
RadixTabs__namespace.Trigger,
|
|
5099
4829
|
{
|
|
@@ -5193,7 +4923,7 @@
|
|
|
5193
4923
|
orientation: "horizontal"
|
|
5194
4924
|
}
|
|
5195
4925
|
});
|
|
5196
|
-
const Separator =
|
|
4926
|
+
const Separator = React.memo((props) => {
|
|
5197
4927
|
const { ref, className, accentColor = "base", orientation, size, ...rest } = props;
|
|
5198
4928
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
5199
4929
|
RadixSeparator__namespace.Root,
|
|
@@ -5415,7 +5145,7 @@
|
|
|
5415
5145
|
}
|
|
5416
5146
|
}
|
|
5417
5147
|
);
|
|
5418
|
-
const Slider =
|
|
5148
|
+
const Slider = React.memo((props) => {
|
|
5419
5149
|
const providerContext = useProvider();
|
|
5420
5150
|
const {
|
|
5421
5151
|
className,
|
|
@@ -5453,11 +5183,11 @@
|
|
|
5453
5183
|
);
|
|
5454
5184
|
});
|
|
5455
5185
|
Slider.displayName = "Slider";
|
|
5456
|
-
const Spinner =
|
|
5186
|
+
const Spinner = React.memo(() => {
|
|
5457
5187
|
return /* @__PURE__ */ jsxRuntime.jsx("div", { className: "size-6 animate-spin rounded-full border-2 border-(--base-a12) border-b-transparent" });
|
|
5458
5188
|
});
|
|
5459
5189
|
Spinner.displayName = "Spinner";
|
|
5460
|
-
const SwitchContext =
|
|
5190
|
+
const SwitchContext = React.createContext({});
|
|
5461
5191
|
const switchRoot = classVarianceAuthority.cva(
|
|
5462
5192
|
[
|
|
5463
5193
|
"shrink-0",
|
|
@@ -5517,7 +5247,7 @@
|
|
|
5517
5247
|
}
|
|
5518
5248
|
}
|
|
5519
5249
|
);
|
|
5520
|
-
const SwitchRoot =
|
|
5250
|
+
const SwitchRoot = React.memo((props) => {
|
|
5521
5251
|
const providerContext = useProvider();
|
|
5522
5252
|
const {
|
|
5523
5253
|
ref,
|
|
@@ -5540,9 +5270,9 @@
|
|
|
5540
5270
|
);
|
|
5541
5271
|
});
|
|
5542
5272
|
SwitchRoot.displayName = "SwitchRoot";
|
|
5543
|
-
const SwitchThumb =
|
|
5273
|
+
const SwitchThumb = React.memo((props) => {
|
|
5544
5274
|
const { ref, className, ...rest } = props;
|
|
5545
|
-
const { size, radius } =
|
|
5275
|
+
const { size, radius } = React.useContext(SwitchContext);
|
|
5546
5276
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
5547
5277
|
RadixSwitch__namespace.Thumb,
|
|
5548
5278
|
{
|
|
@@ -5557,12 +5287,12 @@
|
|
|
5557
5287
|
Root: SwitchRoot,
|
|
5558
5288
|
Thumb: SwitchThumb
|
|
5559
5289
|
};
|
|
5560
|
-
const TableBody =
|
|
5290
|
+
const TableBody = React.memo((props) => {
|
|
5561
5291
|
const { ref, className, ...rest } = props;
|
|
5562
5292
|
return /* @__PURE__ */ jsxRuntime.jsx("tbody", { ref, className: classVarianceAuthority.cx(className), ...rest });
|
|
5563
5293
|
});
|
|
5564
5294
|
TableBody.displayName = "TableBody";
|
|
5565
|
-
const TableContext =
|
|
5295
|
+
const TableContext = React.createContext({});
|
|
5566
5296
|
const tableRootCva = classVarianceAuthority.cva(["border-collapse text-left"], {
|
|
5567
5297
|
variants: {
|
|
5568
5298
|
variant: {
|
|
@@ -5603,29 +5333,29 @@
|
|
|
5603
5333
|
}
|
|
5604
5334
|
}
|
|
5605
5335
|
});
|
|
5606
|
-
const TableCell =
|
|
5336
|
+
const TableCell = React.memo((props) => {
|
|
5607
5337
|
const { ref, className, ...rest } = props;
|
|
5608
|
-
const { size, border, variant } =
|
|
5338
|
+
const { size, border, variant } = React.useContext(TableContext);
|
|
5609
5339
|
return /* @__PURE__ */ jsxRuntime.jsx("td", { ref, className: classVarianceAuthority.cx(tableCellCva({ size, border, cell: true, variant }), className), ...rest });
|
|
5610
5340
|
});
|
|
5611
5341
|
TableCell.displayName = "TableCell";
|
|
5612
|
-
const TableColumnHeaderCell =
|
|
5342
|
+
const TableColumnHeaderCell = React.memo((props) => {
|
|
5613
5343
|
const { ref, className, ...rest } = props;
|
|
5614
|
-
const { size, border, variant } =
|
|
5344
|
+
const { size, border, variant } = React.useContext(TableContext);
|
|
5615
5345
|
return /* @__PURE__ */ jsxRuntime.jsx("th", { ref, className: classVarianceAuthority.cx(tableCellCva({ size, border, cell: false, variant }), className), ...rest });
|
|
5616
5346
|
});
|
|
5617
5347
|
TableColumnHeaderCell.displayName = "TableColumnHeaderCell";
|
|
5618
|
-
const TableFooter =
|
|
5348
|
+
const TableFooter = React.memo((props) => {
|
|
5619
5349
|
const { ref, className, ...rest } = props;
|
|
5620
5350
|
return /* @__PURE__ */ jsxRuntime.jsx("tfoot", { ref, className: classVarianceAuthority.cx(className), ...rest });
|
|
5621
5351
|
});
|
|
5622
5352
|
TableFooter.displayName = "TableFooter";
|
|
5623
|
-
const TableHeader =
|
|
5353
|
+
const TableHeader = React.memo((props) => {
|
|
5624
5354
|
const { ref, className, ...rest } = props;
|
|
5625
5355
|
return /* @__PURE__ */ jsxRuntime.jsx("thead", { ref, className: classVarianceAuthority.cx(className), ...rest });
|
|
5626
5356
|
});
|
|
5627
5357
|
TableHeader.displayName = "TableHeader";
|
|
5628
|
-
const TableRoot =
|
|
5358
|
+
const TableRoot = React.memo((props) => {
|
|
5629
5359
|
const providerContext = useProvider();
|
|
5630
5360
|
const {
|
|
5631
5361
|
ref,
|
|
@@ -5653,14 +5383,14 @@
|
|
|
5653
5383
|
);
|
|
5654
5384
|
});
|
|
5655
5385
|
TableRoot.displayName = "TableRoot";
|
|
5656
|
-
const TableRow =
|
|
5386
|
+
const TableRow = React.memo((props) => {
|
|
5657
5387
|
const { ref, className, ...rest } = props;
|
|
5658
5388
|
return /* @__PURE__ */ jsxRuntime.jsx("tr", { ref, className: classVarianceAuthority.cx(className), ...rest });
|
|
5659
5389
|
});
|
|
5660
5390
|
TableRow.displayName = "TableRow";
|
|
5661
|
-
const TableRowHeaderCell =
|
|
5391
|
+
const TableRowHeaderCell = React.memo((props) => {
|
|
5662
5392
|
const { ref, className, ...rest } = props;
|
|
5663
|
-
const { size, border, variant } =
|
|
5393
|
+
const { size, border, variant } = React.useContext(TableContext);
|
|
5664
5394
|
return /* @__PURE__ */ jsxRuntime.jsx("th", { ref, className: classVarianceAuthority.cx(tableCellCva({ size, border, cell: true, variant }), className), ...rest });
|
|
5665
5395
|
});
|
|
5666
5396
|
TableRowHeaderCell.displayName = "TableRow";
|
|
@@ -5674,7 +5404,7 @@
|
|
|
5674
5404
|
RowHeaderCell: TableRowHeaderCell,
|
|
5675
5405
|
ColumnHeaderCell: TableColumnHeaderCell
|
|
5676
5406
|
};
|
|
5677
|
-
const TabsListContext =
|
|
5407
|
+
const TabsListContext = React.createContext({});
|
|
5678
5408
|
const tabsListCva = classVarianceAuthority.cva(["flex", "border-box", "inset-shadow-[0_-1px_0_0_var(--base-a6)]"], {
|
|
5679
5409
|
variants: {
|
|
5680
5410
|
size: {
|
|
@@ -5724,7 +5454,7 @@
|
|
|
5724
5454
|
}
|
|
5725
5455
|
}
|
|
5726
5456
|
);
|
|
5727
|
-
const TabsList =
|
|
5457
|
+
const TabsList = React.memo((props) => {
|
|
5728
5458
|
const providerContext = useProvider();
|
|
5729
5459
|
const { ref, children, className, size = "md", accentColor = providerContext.accentColor, ...rest } = props;
|
|
5730
5460
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
@@ -5739,19 +5469,19 @@
|
|
|
5739
5469
|
);
|
|
5740
5470
|
});
|
|
5741
5471
|
TabsList.displayName = "TabsList";
|
|
5742
|
-
const TabsRoot =
|
|
5472
|
+
const TabsRoot = React.memo((props) => {
|
|
5743
5473
|
const { ref, className, ...rest } = props;
|
|
5744
5474
|
return /* @__PURE__ */ jsxRuntime.jsx(RadixTabs__namespace.Root, { ref, className: classVarianceAuthority.cx("flex flex-col", className), ...rest });
|
|
5745
5475
|
});
|
|
5746
5476
|
TabsRoot.displayName = "TabsRoot";
|
|
5747
5477
|
const useTabsList = () => {
|
|
5748
|
-
const tabsListContext =
|
|
5478
|
+
const tabsListContext = React.useContext(TabsListContext);
|
|
5749
5479
|
if (!tabsListContext) {
|
|
5750
5480
|
throw new Error("useTabsList must be used within a TabsList component");
|
|
5751
5481
|
}
|
|
5752
5482
|
return tabsListContext;
|
|
5753
5483
|
};
|
|
5754
|
-
const TabsTrigger =
|
|
5484
|
+
const TabsTrigger = React.memo((props) => {
|
|
5755
5485
|
const { ref, children, className, ...rest } = props;
|
|
5756
5486
|
const { size } = useTabsList();
|
|
5757
5487
|
return /* @__PURE__ */ jsxRuntime.jsx(RadixTabs__namespace.Trigger, { ref, className: classVarianceAuthority.cx(tabsTriggerCva({ size }), className), ...rest, children });
|
|
@@ -5793,7 +5523,7 @@
|
|
|
5793
5523
|
}
|
|
5794
5524
|
}
|
|
5795
5525
|
});
|
|
5796
|
-
const Text =
|
|
5526
|
+
const Text = React.memo((props) => {
|
|
5797
5527
|
const { ref, className, size, weight, align, accentColor, highContrast = false, ...rest } = props;
|
|
5798
5528
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
5799
5529
|
"span",
|
|
@@ -5874,7 +5604,7 @@
|
|
|
5874
5604
|
}
|
|
5875
5605
|
}
|
|
5876
5606
|
);
|
|
5877
|
-
const TextArea =
|
|
5607
|
+
const TextArea = React.memo((props) => {
|
|
5878
5608
|
const providerContext = useProvider();
|
|
5879
5609
|
const {
|
|
5880
5610
|
ref,
|
|
@@ -5942,8 +5672,8 @@
|
|
|
5942
5672
|
action,
|
|
5943
5673
|
...rest
|
|
5944
5674
|
} = props;
|
|
5945
|
-
const [open, setOpen] =
|
|
5946
|
-
const handleOpenChange =
|
|
5675
|
+
const [open, setOpen] = React.useState(true);
|
|
5676
|
+
const handleOpenChange = React.useCallback(
|
|
5947
5677
|
(open2) => {
|
|
5948
5678
|
if (!open2 && onClose) onClose();
|
|
5949
5679
|
setOpen(open2);
|
|
@@ -5981,11 +5711,11 @@
|
|
|
5981
5711
|
}
|
|
5982
5712
|
);
|
|
5983
5713
|
};
|
|
5984
|
-
const Toast =
|
|
5714
|
+
const Toast = React.memo(_Toast);
|
|
5985
5715
|
Toast.displayName = "Toast";
|
|
5986
|
-
const ToastContext =
|
|
5716
|
+
const ToastContext = React.createContext({});
|
|
5987
5717
|
const useToast = () => {
|
|
5988
|
-
const context =
|
|
5718
|
+
const context = React.useContext(ToastContext);
|
|
5989
5719
|
if (!context) {
|
|
5990
5720
|
throw new Error("useToast must be used within a ToastProvider");
|
|
5991
5721
|
}
|
|
@@ -5999,15 +5729,15 @@
|
|
|
5999
5729
|
return MIN_DURATION + words / WORDS_PER_SECOND;
|
|
6000
5730
|
};
|
|
6001
5731
|
exports2.unsafeShowToast = void 0;
|
|
6002
|
-
const ToastProvider =
|
|
5732
|
+
const ToastProvider = React.memo(function ToastContextProvider({
|
|
6003
5733
|
children,
|
|
6004
5734
|
// Use this class to change where the viewport for the toasts should be
|
|
6005
5735
|
className,
|
|
6006
5736
|
hotkey,
|
|
6007
5737
|
...rest
|
|
6008
5738
|
}) {
|
|
6009
|
-
const [toasts, setToasts] =
|
|
6010
|
-
const handleCloseToast =
|
|
5739
|
+
const [toasts, setToasts] = React.useState([]);
|
|
5740
|
+
const handleCloseToast = React.useCallback((id, reason, callback) => {
|
|
6011
5741
|
setToasts((prevToasts) => {
|
|
6012
5742
|
const toast = prevToasts.find((toast2) => toast2.id === id);
|
|
6013
5743
|
if (toast && reason === 0) clearTimeout(toast.timeout);
|
|
@@ -6015,7 +5745,7 @@
|
|
|
6015
5745
|
});
|
|
6016
5746
|
if (callback) callback();
|
|
6017
5747
|
}, []);
|
|
6018
|
-
const toastContextValue =
|
|
5748
|
+
const toastContextValue = React.useMemo(() => {
|
|
6019
5749
|
let counter = 0;
|
|
6020
5750
|
const showToast = (toastProps) => {
|
|
6021
5751
|
const duration = calculatedDuration(toastProps);
|
|
@@ -6039,7 +5769,7 @@
|
|
|
6039
5769
|
showWarning
|
|
6040
5770
|
};
|
|
6041
5771
|
}, [handleCloseToast]);
|
|
6042
|
-
|
|
5772
|
+
React.useEffect(() => {
|
|
6043
5773
|
return () => {
|
|
6044
5774
|
for (const { timeout } of toasts) clearTimeout(timeout);
|
|
6045
5775
|
};
|
|
@@ -6180,7 +5910,7 @@
|
|
|
6180
5910
|
}
|
|
6181
5911
|
}
|
|
6182
5912
|
);
|
|
6183
|
-
const BaseToggleButton =
|
|
5913
|
+
const BaseToggleButton = React.memo((props) => {
|
|
6184
5914
|
const providerContext = useProvider();
|
|
6185
5915
|
const {
|
|
6186
5916
|
ref,
|
|
@@ -6203,15 +5933,15 @@
|
|
|
6203
5933
|
);
|
|
6204
5934
|
});
|
|
6205
5935
|
BaseToggleButton.displayName = "BaseToggleButton";
|
|
6206
|
-
const IconToggleButton =
|
|
5936
|
+
const IconToggleButton = React.memo((props) => {
|
|
6207
5937
|
return /* @__PURE__ */ jsxRuntime.jsx(BaseToggleButton, { icon: true, ...props });
|
|
6208
5938
|
});
|
|
6209
5939
|
IconToggleButton.displayName = "IconToggleButton";
|
|
6210
|
-
const ToggleButton =
|
|
5940
|
+
const ToggleButton = React.memo((props) => {
|
|
6211
5941
|
return /* @__PURE__ */ jsxRuntime.jsx(BaseToggleButton, { icon: false, ...props });
|
|
6212
5942
|
});
|
|
6213
5943
|
ToggleButton.displayName = "ToggleButton";
|
|
6214
|
-
const ToggleGroupContext =
|
|
5944
|
+
const ToggleGroupContext = React.createContext({});
|
|
6215
5945
|
const toggleGroupItemCva = classVarianceAuthority.cva(
|
|
6216
5946
|
[
|
|
6217
5947
|
"flex",
|
|
@@ -6327,8 +6057,8 @@
|
|
|
6327
6057
|
]
|
|
6328
6058
|
}
|
|
6329
6059
|
);
|
|
6330
|
-
const ToggleGroupBaseItem =
|
|
6331
|
-
const toggleGroupContext =
|
|
6060
|
+
const ToggleGroupBaseItem = React.memo((props) => {
|
|
6061
|
+
const toggleGroupContext = React.use(ToggleGroupContext);
|
|
6332
6062
|
const {
|
|
6333
6063
|
ref,
|
|
6334
6064
|
className,
|
|
@@ -6354,15 +6084,15 @@
|
|
|
6354
6084
|
);
|
|
6355
6085
|
});
|
|
6356
6086
|
ToggleGroupBaseItem.displayName = "ToggleGroupBaseItem";
|
|
6357
|
-
const ToggleGroupIconItem =
|
|
6087
|
+
const ToggleGroupIconItem = React.memo((props) => {
|
|
6358
6088
|
return /* @__PURE__ */ jsxRuntime.jsx(ToggleGroupBaseItem, { icon: true, ...props });
|
|
6359
6089
|
});
|
|
6360
6090
|
ToggleGroupIconItem.displayName = "ToggleGroupIconItem";
|
|
6361
|
-
const ToggleGroupItem =
|
|
6091
|
+
const ToggleGroupItem = React.memo((props) => {
|
|
6362
6092
|
return /* @__PURE__ */ jsxRuntime.jsx(ToggleGroupBaseItem, { icon: false, ...props });
|
|
6363
6093
|
});
|
|
6364
6094
|
ToggleGroupItem.displayName = "ToggleGroupItem";
|
|
6365
|
-
const ToggleGroupRoot =
|
|
6095
|
+
const ToggleGroupRoot = React.memo((props) => {
|
|
6366
6096
|
const providerContext = useProvider();
|
|
6367
6097
|
const {
|
|
6368
6098
|
ref,
|
|
@@ -6373,7 +6103,7 @@
|
|
|
6373
6103
|
size = "md",
|
|
6374
6104
|
...rest
|
|
6375
6105
|
} = props;
|
|
6376
|
-
const contextValue =
|
|
6106
|
+
const contextValue = React.useMemo(
|
|
6377
6107
|
() => ({
|
|
6378
6108
|
variant,
|
|
6379
6109
|
size,
|
|
@@ -6390,7 +6120,7 @@
|
|
|
6390
6120
|
Item: ToggleGroupItem,
|
|
6391
6121
|
IconItem: ToggleGroupIconItem
|
|
6392
6122
|
};
|
|
6393
|
-
const TooltipArrow =
|
|
6123
|
+
const TooltipArrow = React.memo((props) => {
|
|
6394
6124
|
const { ref, className, ...rest } = props;
|
|
6395
6125
|
return /* @__PURE__ */ jsxRuntime.jsx(RadixTooltip__namespace.Arrow, { className: classVarianceAuthority.cx("fill-(--base-6)", className), ref, ...rest });
|
|
6396
6126
|
});
|
|
@@ -6432,7 +6162,7 @@
|
|
|
6432
6162
|
}
|
|
6433
6163
|
}
|
|
6434
6164
|
);
|
|
6435
|
-
const TooltipContent =
|
|
6165
|
+
const TooltipContent = React.memo((props) => {
|
|
6436
6166
|
const providerContext = useProvider();
|
|
6437
6167
|
const {
|
|
6438
6168
|
ref,
|
|
@@ -6484,6 +6214,7 @@
|
|
|
6484
6214
|
exports2.CheckboxGroupSelectAllItem = CheckboxGroupSelectAllItem;
|
|
6485
6215
|
exports2.CheckboxIndicator = CheckboxIndicator;
|
|
6486
6216
|
exports2.CheckboxRoot = CheckboxRoot;
|
|
6217
|
+
exports2.CollapsibleTree = CollapsibleTree;
|
|
6487
6218
|
exports2.CommandMenu = CommandMenu;
|
|
6488
6219
|
exports2.CommandMenuCheckboxIndicator = CommandMenuCheckboxIndicator;
|
|
6489
6220
|
exports2.CommandMenuCheckboxItem = CommandMenuCheckboxItem;
|
|
@@ -6558,23 +6289,6 @@
|
|
|
6558
6289
|
exports2.MenuSub = MenuSub;
|
|
6559
6290
|
exports2.MenuSubContent = MenuSubContent;
|
|
6560
6291
|
exports2.MenuSubTrigger = MenuSubTrigger;
|
|
6561
|
-
exports2.MenuV2 = MenuV2;
|
|
6562
|
-
exports2.MenuV2CheckboxItem = MenuV2CheckboxItem;
|
|
6563
|
-
exports2.MenuV2CheckedIndicator = MenuV2CheckedIndicator;
|
|
6564
|
-
exports2.MenuV2Group = MenuV2Group;
|
|
6565
|
-
exports2.MenuV2GroupLabel = MenuV2GroupLabel;
|
|
6566
|
-
exports2.MenuV2Item = MenuV2Item;
|
|
6567
|
-
exports2.MenuV2MultiSelectGroup = MenuV2MultiSelectGroup;
|
|
6568
|
-
exports2.MenuV2MultiSelectItem = MenuV2MultiSelectItem;
|
|
6569
|
-
exports2.MenuV2Page = MenuV2Page;
|
|
6570
|
-
exports2.MenuV2PageTriggerItem = MenuV2PageTriggerItem;
|
|
6571
|
-
exports2.MenuV2Pages = MenuV2Pages;
|
|
6572
|
-
exports2.MenuV2Root = MenuV2Root;
|
|
6573
|
-
exports2.MenuV2SelectAllItem = MenuV2SelectAllItem;
|
|
6574
|
-
exports2.MenuV2SelectGroup = MenuV2SelectGroup;
|
|
6575
|
-
exports2.MenuV2SelectItem = MenuV2SelectItem;
|
|
6576
|
-
exports2.MenuV2SelectedIndicator = MenuV2SelectedIndicator;
|
|
6577
|
-
exports2.MenuV2Separator = MenuV2Separator;
|
|
6578
6292
|
exports2.MenuVirtualTrigger = MenuVirtualTrigger;
|
|
6579
6293
|
exports2.OneTimePasswordField = OneTimePasswordField;
|
|
6580
6294
|
exports2.OneTimePasswordFieldHiddenInput = OneTimePasswordFieldHiddenInput;
|
|
@@ -6600,6 +6314,10 @@
|
|
|
6600
6314
|
exports2.RadioGroupIndicator = RadioGroupIndicator;
|
|
6601
6315
|
exports2.RadioGroupItem = RadioGroupItem;
|
|
6602
6316
|
exports2.RadioGroupRoot = RadioGroupRoot;
|
|
6317
|
+
exports2.Rating = Rating;
|
|
6318
|
+
exports2.RatingItem = RatingItem;
|
|
6319
|
+
exports2.RatingItemIndicator = RatingItemIndicator;
|
|
6320
|
+
exports2.RatingRoot = RatingRoot;
|
|
6603
6321
|
exports2.SegmentedControl = SegmentedControl;
|
|
6604
6322
|
exports2.SegmentedControlItem = SegmentedControlItem;
|
|
6605
6323
|
exports2.SegmentedControlRoot = SegmentedControlRoot;
|
|
@@ -6607,6 +6325,7 @@
|
|
|
6607
6325
|
exports2.SegmentedTabsList = SegmentedTabsList;
|
|
6608
6326
|
exports2.SegmentedTabsRoot = SegmentedTabsRoot;
|
|
6609
6327
|
exports2.SegmentedTabsTrigger = SegmentedTabsTrigger;
|
|
6328
|
+
exports2.SelectedIndicatorContext = SelectedIndicatorContext;
|
|
6610
6329
|
exports2.Separator = Separator;
|
|
6611
6330
|
exports2.SlideOut = SlideOut;
|
|
6612
6331
|
exports2.Slider = Slider;
|
|
@@ -6643,21 +6362,21 @@
|
|
|
6643
6362
|
exports2.badge = badge;
|
|
6644
6363
|
exports2.buttonCva = buttonCva;
|
|
6645
6364
|
exports2.floating = floating;
|
|
6646
|
-
exports2.genericMemo = genericMemo;
|
|
6647
|
-
exports2.getActiveState = getActiveState;
|
|
6648
|
-
exports2.getBooleanState = getBooleanState;
|
|
6649
|
-
exports2.getCheckedState = getCheckedState;
|
|
6650
|
-
exports2.getOpenState = getOpenState;
|
|
6651
|
-
exports2.getSelectedState = getSelectedState;
|
|
6652
6365
|
exports2.mergeRefs = mergeRefs;
|
|
6653
6366
|
exports2.radiusCva = radiusCva;
|
|
6654
6367
|
exports2.stopPropagation = stopPropagation;
|
|
6655
6368
|
exports2.useAlertDialog = useAlertDialog;
|
|
6656
6369
|
exports2.useButtonGroup = useButtonGroup;
|
|
6657
6370
|
exports2.useControlledState = useControlledState;
|
|
6658
|
-
exports2.useFallbackId = useFallbackId;
|
|
6659
6371
|
exports2.useLayoutContext = useLayoutContext;
|
|
6372
|
+
exports2.useMenuContentContext = useMenuContentContext;
|
|
6373
|
+
exports2.useMenuContext = useMenuContext;
|
|
6374
|
+
exports2.usePagesContext = usePagesContext;
|
|
6660
6375
|
exports2.useProvider = useProvider;
|
|
6376
|
+
exports2.useSelectedIndicatorContext = useSelectedIndicatorContext;
|
|
6377
|
+
exports2.useSize = useSize;
|
|
6378
|
+
exports2.useStopEventPropagation = useStopEventPropagation;
|
|
6379
|
+
exports2.useSubContext = useSubContext;
|
|
6661
6380
|
exports2.useTextFilter = useTextFilter;
|
|
6662
6381
|
exports2.useToast = useToast;
|
|
6663
6382
|
exports2.useViewportSize = useViewportSize;
|