@overmap-ai/blocks 1.0.40-alpha.3 → 1.0.40-overlay.1
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/Overlay/Close.d.ts +5 -0
- package/dist/Overlay/Content.d.ts +6 -0
- package/dist/Overlay/Description.d.ts +5 -0
- package/dist/Overlay/Root.d.ts +5 -0
- package/dist/Overlay/Title.d.ts +5 -0
- package/dist/Overlay/Trigger.d.ts +5 -0
- package/dist/Overlay/cva.d.ts +1 -0
- package/dist/Overlay/index.d.ts +15 -0
- package/dist/SlideOut/SlideOut.d.ts +2 -1
- package/dist/Text/cva.d.ts +1 -1
- package/dist/blocks.js +918 -1181
- package/dist/blocks.js.map +1 -1
- package/dist/blocks.umd.cjs +1083 -1346
- 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 -19
- 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,39 +3048,330 @@
|
|
|
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
|
-
|
|
2853
|
-
|
|
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;
|
|
3367
|
+
onClick == null ? void 0 : onClick(e);
|
|
2854
3368
|
onSelect == null ? void 0 : onSelect();
|
|
2855
3369
|
if (closeOnSelect) setOpen(false);
|
|
2856
3370
|
if (closeRoot) rootMenuContext.setOpen(false);
|
|
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(
|
|
@@ -2891,10 +3405,10 @@
|
|
|
2891
3405
|
}
|
|
2892
3406
|
);
|
|
2893
3407
|
});
|
|
2894
|
-
MenuItem
|
|
2895
|
-
const MenuCheckboxItem
|
|
3408
|
+
MenuItem.displayName = "MenuItem";
|
|
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:
|
|
@@ -2906,19 +3420,19 @@
|
|
|
2906
3420
|
break;
|
|
2907
3421
|
}
|
|
2908
3422
|
}, [checked, onCheckedChange, onSelect]);
|
|
2909
|
-
return /* @__PURE__ */ jsxRuntime.jsx(CheckedIndicatorContext.Provider, { value: checked, children: /* @__PURE__ */ jsxRuntime.jsx(MenuItem
|
|
3423
|
+
return /* @__PURE__ */ jsxRuntime.jsx(CheckedIndicatorContext.Provider, { value: checked, children: /* @__PURE__ */ jsxRuntime.jsx(MenuItem, { ref, onSelect: handleSelect, ...rest }) });
|
|
2910
3424
|
});
|
|
2911
|
-
MenuCheckboxItem
|
|
2912
|
-
const MenuCheckboxItemIndicator =
|
|
3425
|
+
MenuCheckboxItem.displayName = "MenuCheckboxItem";
|
|
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
|
-
MenuGroup
|
|
3089
|
-
const MenuInputField =
|
|
3502
|
+
MenuGroup.displayName = "MenuGroup";
|
|
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,43 +3533,66 @@
|
|
|
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";
|
|
3139
|
-
const MenuMultiSelectGroup
|
|
3553
|
+
const MenuMultiSelectGroup = genericMemo(function MenuMultiSelectGroup2(props) {
|
|
3140
3554
|
const { ref, children, defaultValues, values, onValuesChange, ...rest } = props;
|
|
3141
|
-
return /* @__PURE__ */ jsxRuntime.jsx(MenuGroup
|
|
3555
|
+
return /* @__PURE__ */ jsxRuntime.jsx(MenuGroup, { ref, ...rest, children: /* @__PURE__ */ jsxRuntime.jsx(MultiSelectProvider, { defaultValues, values, onValuesChange, children }) });
|
|
3142
3556
|
});
|
|
3143
|
-
const
|
|
3144
|
-
|
|
3145
|
-
|
|
3146
|
-
|
|
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";
|
|
3580
|
+
const MenuMultiSelectItem = genericMemo(function(props) {
|
|
3581
|
+
const { ref, onSelect, children, closeOnSelect = false, value, ...rest } = props;
|
|
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(
|
|
3158
|
-
MenuItem
|
|
3595
|
+
MenuItem,
|
|
3159
3596
|
{
|
|
3160
3597
|
ref,
|
|
3161
3598
|
role: "menuitemcheckbox",
|
|
@@ -3167,129 +3604,36 @@
|
|
|
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$1 = 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
|
-
MenuPages
|
|
3184
|
-
const
|
|
3615
|
+
MenuPages.displayName = "MenuPages";
|
|
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);
|
|
3192
3630
|
(_a = refs.floating.current) == null ? void 0 : _a.focus();
|
|
3193
3631
|
setActiveIndex(null);
|
|
3194
3632
|
}, [onSelect, page, refs.floating, setActiveIndex, setActivePage]);
|
|
3195
|
-
return /* @__PURE__ */ jsxRuntime.jsx(MenuItem
|
|
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$1 = 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$1.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",
|
|
@@ -3304,19 +3648,19 @@
|
|
|
3304
3648
|
);
|
|
3305
3649
|
});
|
|
3306
3650
|
MenuScroll.displayName = "MenuScroll";
|
|
3307
|
-
const MenuSelectAllItem
|
|
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(
|
|
3319
|
-
MenuItem
|
|
3663
|
+
MenuItem,
|
|
3320
3664
|
{
|
|
3321
3665
|
onSelect: handleSelect,
|
|
3322
3666
|
ref,
|
|
@@ -3327,14 +3671,9 @@
|
|
|
3327
3671
|
}
|
|
3328
3672
|
) });
|
|
3329
3673
|
});
|
|
3330
|
-
const
|
|
3331
|
-
const { ref, children, ...rest } = props;
|
|
3332
|
-
return /* @__PURE__ */ jsxRuntime.jsx(SelectedIndicator, { ref, ...rest, children });
|
|
3333
|
-
});
|
|
3334
|
-
MenuSelectedIndicator$1.displayName = "MenuSelectedIndicator";
|
|
3335
|
-
const MenuSelectGroup$1 = genericMemo(function MenuSelectGroup2(props) {
|
|
3674
|
+
const MenuSelectGroup = genericMemo(function MenuSelectGroup2(props) {
|
|
3336
3675
|
const { ref, children, required, defaultValue, value, onValueChange, ...rest } = props;
|
|
3337
|
-
return /* @__PURE__ */ jsxRuntime.jsx(MenuGroup
|
|
3676
|
+
return /* @__PURE__ */ jsxRuntime.jsx(MenuGroup, { ref, ...rest, children: required ? /* @__PURE__ */ jsxRuntime.jsx(SingleSelectRequiredProvider, { defaultValue, value, onValueChange, children }) : /* @__PURE__ */ jsxRuntime.jsx(
|
|
3338
3677
|
SingleSelectNotRequiredProvider,
|
|
3339
3678
|
{
|
|
3340
3679
|
defaultValue,
|
|
@@ -3344,19 +3683,19 @@
|
|
|
3344
3683
|
}
|
|
3345
3684
|
) });
|
|
3346
3685
|
});
|
|
3347
|
-
const MenuSelectItem
|
|
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(
|
|
3359
|
-
MenuItem
|
|
3698
|
+
MenuItem,
|
|
3360
3699
|
{
|
|
3361
3700
|
ref,
|
|
3362
3701
|
role: "menuitemcheckbox",
|
|
@@ -3368,134 +3707,17 @@
|
|
|
3368
3707
|
}
|
|
3369
3708
|
) });
|
|
3370
3709
|
});
|
|
3371
|
-
const MenuSeparator
|
|
3710
|
+
const MenuSeparator = React.memo((props) => {
|
|
3372
3711
|
const { ref, className, ...rest } = props;
|
|
3373
|
-
const { size } =
|
|
3712
|
+
const { size } = useMenuContentContext();
|
|
3374
3713
|
return /* @__PURE__ */ jsxRuntime.jsx(RadixSeparator__namespace.Root, { className: classVarianceAuthority.cx(menuSeparator({ size }), className), ref, ...rest });
|
|
3375
3714
|
});
|
|
3376
|
-
MenuSeparator
|
|
3377
|
-
const
|
|
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
|
-
);
|
|
3492
|
-
});
|
|
3493
|
-
MenuSub.displayName = "SubMenu";
|
|
3494
|
-
const MenuSubContent = react.memo((props) => {
|
|
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,12 +3788,12 @@
|
|
|
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
|
-
MenuItem
|
|
3796
|
+
MenuItem,
|
|
3575
3797
|
{
|
|
3576
3798
|
ref: mergedRefs,
|
|
3577
3799
|
closeOnSelect: false,
|
|
@@ -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);
|
|
@@ -3603,14 +3825,14 @@
|
|
|
3603
3825
|
});
|
|
3604
3826
|
MenuVirtualTrigger.displayName = "VirtualTrigger";
|
|
3605
3827
|
const Menu = {
|
|
3606
|
-
Root: MenuRoot
|
|
3828
|
+
Root: MenuRoot,
|
|
3607
3829
|
Content: MenuContent,
|
|
3608
3830
|
// sub
|
|
3609
3831
|
Sub: MenuSub,
|
|
3610
3832
|
SubContent: MenuSubContent,
|
|
3611
3833
|
SubTrigger: MenuSubTrigger,
|
|
3612
3834
|
// pages
|
|
3613
|
-
Pages: MenuPages
|
|
3835
|
+
Pages: MenuPages,
|
|
3614
3836
|
PageContent: MenuPageContent,
|
|
3615
3837
|
PageTrigger: MenuPageTrigger,
|
|
3616
3838
|
// triggers
|
|
@@ -3618,17 +3840,17 @@
|
|
|
3618
3840
|
ContextTrigger: MenuContextTrigger,
|
|
3619
3841
|
VirtualTrigger: MenuVirtualTrigger,
|
|
3620
3842
|
// groups
|
|
3621
|
-
Group: MenuGroup
|
|
3622
|
-
SelectGroup: MenuSelectGroup
|
|
3623
|
-
MultiSelectGroup: MenuMultiSelectGroup
|
|
3843
|
+
Group: MenuGroup,
|
|
3844
|
+
SelectGroup: MenuSelectGroup,
|
|
3845
|
+
MultiSelectGroup: MenuMultiSelectGroup,
|
|
3624
3846
|
// items
|
|
3625
|
-
Item: MenuItem
|
|
3626
|
-
SelectItem: MenuSelectItem
|
|
3627
|
-
MultiSelectItem: MenuMultiSelectItem
|
|
3628
|
-
SelectAllItem: MenuSelectAllItem
|
|
3629
|
-
CheckboxItem: MenuCheckboxItem
|
|
3847
|
+
Item: MenuItem,
|
|
3848
|
+
SelectItem: MenuSelectItem,
|
|
3849
|
+
MultiSelectItem: MenuMultiSelectItem,
|
|
3850
|
+
SelectAllItem: MenuSelectAllItem,
|
|
3851
|
+
CheckboxItem: MenuCheckboxItem,
|
|
3630
3852
|
// indicators
|
|
3631
|
-
SelectedIndicator: MenuSelectedIndicator
|
|
3853
|
+
SelectedIndicator: MenuSelectedIndicator,
|
|
3632
3854
|
CheckboxItemIndicator: MenuCheckboxItemIndicator,
|
|
3633
3855
|
// input
|
|
3634
3856
|
InputRoot: MenuInputRoot,
|
|
@@ -3636,563 +3858,14 @@
|
|
|
3636
3858
|
InputSlot: MenuInputSlot,
|
|
3637
3859
|
// others
|
|
3638
3860
|
Label: MenuLabel,
|
|
3639
|
-
Separator: MenuSeparator$1,
|
|
3640
|
-
Scroll: MenuScroll
|
|
3641
|
-
};
|
|
3642
|
-
const KEY_MAPPING = {
|
|
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 MenuItem = 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
|
-
MenuItem.displayName = "MenuItem";
|
|
3814
|
-
const MenuCheckboxItem = 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(MenuItem, { ref, onSelect: handleSelect, ...rest }) });
|
|
3835
|
-
});
|
|
3836
|
-
MenuCheckboxItem.displayName = "MenuCheckboxItem";
|
|
3837
|
-
const MenuCheckedIndicator = react.memo((props) => {
|
|
3838
|
-
const { ref, children, ...rest } = props;
|
|
3839
|
-
return /* @__PURE__ */ jsxRuntime.jsx(CheckedIndicator, { ref, ...rest, children });
|
|
3840
|
-
});
|
|
3841
|
-
MenuCheckedIndicator.displayName = "MenuCheckboxItemIndicator";
|
|
3842
|
-
const MenuGroup = 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
|
-
MenuGroup.displayName = "MenuGroup";
|
|
3856
|
-
const MenuGroupLabel = 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
|
-
MenuGroupLabel.displayName = "MenuGroupLabel";
|
|
3867
|
-
const MenuSelectAllItem = 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(MenuItem, { onSelect: handleSelect, ref, "data-state": getCheckedState(selectedState), ...rest, children: /* @__PURE__ */ jsxRuntime.jsx(CheckedIndicatorContext, { value: selectedState, children }) });
|
|
3880
|
-
});
|
|
3881
|
-
const MenuMultiSelectGroup = genericMemo(function MenuMultiSelectGroup2(props) {
|
|
3882
|
-
const { ref, children, defaultValues, values, onValuesChange, ...rest } = props;
|
|
3883
|
-
return /* @__PURE__ */ jsxRuntime.jsx(MenuGroup, { ref, ...rest, children: /* @__PURE__ */ jsxRuntime.jsx(MultiSelectProvider, { defaultValues, values, onValuesChange, children }) });
|
|
3884
|
-
});
|
|
3885
|
-
const MenuMultiSelectItem = 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
|
-
MenuItem,
|
|
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 MenuPage = 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
|
-
MenuPage.displayName = "MenuPage";
|
|
3919
|
-
const MenuPages = 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
|
-
MenuPages.displayName = "MenuPages";
|
|
3932
|
-
const MenuPageTriggerItem = 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(MenuItem, { ref, onSelect: handleSelect, "data-state": getActiveState(isActive), ...rest, children: /* @__PURE__ */ jsxRuntime.jsx(SelectedIndicatorContext, { value: isActive, children }) });
|
|
3945
|
-
});
|
|
3946
|
-
MenuPageTriggerItem.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 MenuRoot = 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
|
-
const firstItem = getFirstItem(internalRef.current);
|
|
4095
|
-
if (!firstItem) return;
|
|
4096
|
-
setActiveItemId(firstItem.getAttribute(ITEM_SELECTOR));
|
|
4097
|
-
}, [getFirstItem]);
|
|
4098
|
-
const contextValue = react.useMemo(
|
|
4099
|
-
() => ({
|
|
4100
|
-
activeItemId,
|
|
4101
|
-
setActiveItemId,
|
|
4102
|
-
// style props
|
|
4103
|
-
accentColor,
|
|
4104
|
-
radius,
|
|
4105
|
-
variant,
|
|
4106
|
-
size
|
|
4107
|
-
}),
|
|
4108
|
-
[accentColor, activeItemId, radius, size, variant]
|
|
4109
|
-
);
|
|
4110
|
-
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
4111
|
-
"div",
|
|
4112
|
-
{
|
|
4113
|
-
ref: mergeRefs([ref, internalRef]),
|
|
4114
|
-
className: classVarianceAuthority.cx(menuRootCva({ size }), radiusCva({ radius, maxLarge: true }), className),
|
|
4115
|
-
role: "menu",
|
|
4116
|
-
onKeyDown: handleKeyDown,
|
|
4117
|
-
tabIndex: 0,
|
|
4118
|
-
"aria-activedescendant": activeItemId ?? void 0,
|
|
4119
|
-
"data-accent-color": accentColor,
|
|
4120
|
-
...rest,
|
|
4121
|
-
children: /* @__PURE__ */ jsxRuntime.jsx(MenuRootContext, { value: contextValue, children })
|
|
4122
|
-
}
|
|
4123
|
-
);
|
|
4124
|
-
});
|
|
4125
|
-
MenuRoot.displayName = "MenuRoot";
|
|
4126
|
-
const MenuSelectedIndicator = react.memo((props) => {
|
|
4127
|
-
const { ref, children, ...rest } = props;
|
|
4128
|
-
return /* @__PURE__ */ jsxRuntime.jsx(SelectedIndicator, { ref, ...rest, children });
|
|
4129
|
-
});
|
|
4130
|
-
MenuSelectedIndicator.displayName = "MenuCheckboxItemIndicator";
|
|
4131
|
-
const MenuSelectGroup = genericMemo(function MenuSelectGroup2(props) {
|
|
4132
|
-
const { ref, children, required, defaultValue, value, onValueChange, ...rest } = props;
|
|
4133
|
-
return /* @__PURE__ */ jsxRuntime.jsx(MenuGroup, { ref, ...rest, children: required ? /* @__PURE__ */ jsxRuntime.jsx(SingleSelectRequiredProvider, { defaultValue, value, onValueChange, children }) : /* @__PURE__ */ jsxRuntime.jsx(
|
|
4134
|
-
SingleSelectNotRequiredProvider,
|
|
4135
|
-
{
|
|
4136
|
-
defaultValue,
|
|
4137
|
-
value,
|
|
4138
|
-
onValueChange,
|
|
4139
|
-
children
|
|
4140
|
-
}
|
|
4141
|
-
) });
|
|
4142
|
-
});
|
|
4143
|
-
const MenuSelectItem = genericMemo(function(props) {
|
|
4144
|
-
const { ref, value, onSelect, children, ...rest } = props;
|
|
4145
|
-
const { selected, selectValue } = react.use(SelectContext);
|
|
4146
|
-
const isSelected = selected(value);
|
|
4147
|
-
const handleSelect = react.useCallback(
|
|
4148
|
-
(e) => {
|
|
4149
|
-
onSelect == null ? void 0 : onSelect(e);
|
|
4150
|
-
if (e.defaultPrevented) return;
|
|
4151
|
-
selectValue(value);
|
|
4152
|
-
},
|
|
4153
|
-
[onSelect, selectValue, value]
|
|
4154
|
-
);
|
|
4155
|
-
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
4156
|
-
MenuItem,
|
|
4157
|
-
{
|
|
4158
|
-
ref,
|
|
4159
|
-
role: "menuitemcheckbox",
|
|
4160
|
-
onSelect: handleSelect,
|
|
4161
|
-
"data-state": getSelectedState(isSelected),
|
|
4162
|
-
...rest,
|
|
4163
|
-
children: /* @__PURE__ */ jsxRuntime.jsx(SelectedIndicatorContext, { value: isSelected, children })
|
|
4164
|
-
}
|
|
4165
|
-
);
|
|
4166
|
-
});
|
|
4167
|
-
const MenuSeparator = react.memo((props) => {
|
|
4168
|
-
const { ref, className, ...rest } = props;
|
|
4169
|
-
const { size } = react.use(MenuRootContext);
|
|
4170
|
-
return /* @__PURE__ */ jsxRuntime.jsx(RadixSeparator__namespace.Root, { className: classVarianceAuthority.cx(menuSeparatorCva({ size }), className), ref, ...rest });
|
|
4171
|
-
});
|
|
4172
|
-
MenuSeparator.displayName = "MenuSeparator";
|
|
4173
|
-
const MenuV2 = {
|
|
4174
|
-
Root: MenuRoot,
|
|
4175
|
-
Group: MenuGroup,
|
|
4176
|
-
GroupLabel: MenuGroupLabel,
|
|
4177
|
-
Item: MenuItem,
|
|
4178
3861
|
Separator: MenuSeparator,
|
|
4179
|
-
|
|
4180
|
-
SelectItem: MenuSelectItem,
|
|
4181
|
-
MultiSelectGroup: MenuMultiSelectGroup,
|
|
4182
|
-
MultiSelectItem: MenuMultiSelectItem,
|
|
4183
|
-
SelectAllItem: MenuSelectAllItem,
|
|
4184
|
-
SelectedIndicator: MenuSelectedIndicator,
|
|
4185
|
-
CheckboxItem: MenuCheckboxItem,
|
|
4186
|
-
CheckedIndicator: MenuCheckedIndicator,
|
|
4187
|
-
Pages: MenuPages,
|
|
4188
|
-
Page: MenuPage,
|
|
4189
|
-
PageTriggerItem: MenuPageTriggerItem
|
|
3862
|
+
Scroll: MenuScroll
|
|
4190
3863
|
};
|
|
4191
|
-
const OneTimePasswordFieldHiddenInput =
|
|
3864
|
+
const OneTimePasswordFieldHiddenInput = React.memo((props) => {
|
|
4192
3865
|
return /* @__PURE__ */ jsxRuntime.jsx(RadixOneTimePasswordField__namespace.HiddenInput, { ...props });
|
|
4193
3866
|
});
|
|
4194
3867
|
OneTimePasswordFieldHiddenInput.displayName = "OneTimePasswordFieldHiddenInput";
|
|
4195
|
-
const OneTimePasswordFieldContext =
|
|
3868
|
+
const OneTimePasswordFieldContext = React.createContext({});
|
|
4196
3869
|
const onetimePasswordFieldInput = classVarianceAuthority.cva(
|
|
4197
3870
|
[
|
|
4198
3871
|
"flex",
|
|
@@ -4249,9 +3922,9 @@
|
|
|
4249
3922
|
}
|
|
4250
3923
|
}
|
|
4251
3924
|
);
|
|
4252
|
-
const OneTimePasswordFieldInput =
|
|
3925
|
+
const OneTimePasswordFieldInput = React.memo((props) => {
|
|
4253
3926
|
const { ref, className, ...rest } = props;
|
|
4254
|
-
const { variant, size, radius, accentColor } =
|
|
3927
|
+
const { variant, size, radius, accentColor } = React.use(OneTimePasswordFieldContext);
|
|
4255
3928
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
4256
3929
|
RadixOneTimePasswordField__namespace.Input,
|
|
4257
3930
|
{
|
|
@@ -4267,7 +3940,7 @@
|
|
|
4267
3940
|
);
|
|
4268
3941
|
});
|
|
4269
3942
|
OneTimePasswordFieldInput.displayName = "OneTimePasswordFieldInput";
|
|
4270
|
-
const OneTimePasswordFieldRoot =
|
|
3943
|
+
const OneTimePasswordFieldRoot = React.memo((props) => {
|
|
4271
3944
|
const providerContext = useProvider();
|
|
4272
3945
|
const {
|
|
4273
3946
|
ref,
|
|
@@ -4278,7 +3951,7 @@
|
|
|
4278
3951
|
accentColor = providerContext.accentColor,
|
|
4279
3952
|
...rest
|
|
4280
3953
|
} = props;
|
|
4281
|
-
const contextValue =
|
|
3954
|
+
const contextValue = React.useMemo(() => ({ variant, size, radius, accentColor }), [accentColor, radius, size, variant]);
|
|
4282
3955
|
return /* @__PURE__ */ jsxRuntime.jsx(RadixOneTimePasswordField__namespace.Root, { ref, "data-accent-color": accentColor, ...rest, children: /* @__PURE__ */ jsxRuntime.jsx(OneTimePasswordFieldContext, { value: contextValue, children }) });
|
|
4283
3956
|
});
|
|
4284
3957
|
OneTimePasswordFieldRoot.displayName = "OneTimePasswordFieldRoot";
|
|
@@ -4287,13 +3960,69 @@
|
|
|
4287
3960
|
Input: OneTimePasswordFieldInput,
|
|
4288
3961
|
Root: OneTimePasswordFieldRoot
|
|
4289
3962
|
};
|
|
3963
|
+
const OverlayClose = React.memo((props) => {
|
|
3964
|
+
const { ref, ...rest } = props;
|
|
3965
|
+
return /* @__PURE__ */ jsxRuntime.jsx(RadixDialog__namespace.Close, { ref, ...rest });
|
|
3966
|
+
});
|
|
3967
|
+
OverlayClose.displayName = "OverlayClose";
|
|
3968
|
+
const overlayContentCva = classVarianceAuthority.cva([
|
|
3969
|
+
"fixed",
|
|
3970
|
+
"inset-0",
|
|
3971
|
+
"bg-(--color-background)",
|
|
3972
|
+
"data-[state='closed']:animate-out",
|
|
3973
|
+
"data-[state='closed']:fade-out-0",
|
|
3974
|
+
"data-[state='closed']:zoom-out-95",
|
|
3975
|
+
"data-[state='open']:animate-in",
|
|
3976
|
+
"data-[state='open']:fade-in-0",
|
|
3977
|
+
"data-[state='open']:zoom-in-95"
|
|
3978
|
+
]);
|
|
3979
|
+
const OverlayContent = React.memo((props) => {
|
|
3980
|
+
const { ref, container, className, ...rest } = props;
|
|
3981
|
+
return /* @__PURE__ */ jsxRuntime.jsx(RadixDialog__namespace.Portal, { container, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
3982
|
+
RadixDialog__namespace.Content,
|
|
3983
|
+
{
|
|
3984
|
+
className: classVarianceAuthority.cx(overlayContentCva(), className),
|
|
3985
|
+
ref,
|
|
3986
|
+
"data-floating-content": "",
|
|
3987
|
+
...rest
|
|
3988
|
+
}
|
|
3989
|
+
) });
|
|
3990
|
+
});
|
|
3991
|
+
OverlayContent.displayName = "OverlayContent";
|
|
3992
|
+
const OverlayDescription = React.memo((props) => {
|
|
3993
|
+
const { ref, ...rest } = props;
|
|
3994
|
+
return /* @__PURE__ */ jsxRuntime.jsx(RadixDialog__namespace.Description, { ref, ...rest });
|
|
3995
|
+
});
|
|
3996
|
+
OverlayDescription.displayName = "OverlayDescription";
|
|
3997
|
+
const OverlayRoot = React.memo((props) => {
|
|
3998
|
+
return /* @__PURE__ */ jsxRuntime.jsx(RadixDialog__namespace.Root, { ...props });
|
|
3999
|
+
});
|
|
4000
|
+
OverlayRoot.displayName = "OverlayRoot";
|
|
4001
|
+
const OverlayTitle = React.memo((props) => {
|
|
4002
|
+
const { ref, ...rest } = props;
|
|
4003
|
+
return /* @__PURE__ */ jsxRuntime.jsx(RadixDialog__namespace.Title, { ref, ...rest });
|
|
4004
|
+
});
|
|
4005
|
+
OverlayTitle.displayName = "OverlayTitle";
|
|
4006
|
+
const OverlayTrigger = React.memo((props) => {
|
|
4007
|
+
const { ref, ...rest } = props;
|
|
4008
|
+
return /* @__PURE__ */ jsxRuntime.jsx(RadixDialog__namespace.Trigger, { ref, ...rest });
|
|
4009
|
+
});
|
|
4010
|
+
OverlayTrigger.displayName = "OverlayTrigger";
|
|
4011
|
+
const Overlay = {
|
|
4012
|
+
Root: OverlayRoot,
|
|
4013
|
+
Content: OverlayContent,
|
|
4014
|
+
Title: OverlayTitle,
|
|
4015
|
+
Description: OverlayDescription,
|
|
4016
|
+
Trigger: OverlayTrigger,
|
|
4017
|
+
Close: OverlayClose
|
|
4018
|
+
};
|
|
4290
4019
|
const centerStyles = { placeSelf: "center" };
|
|
4291
|
-
const ErrorFallback =
|
|
4020
|
+
const ErrorFallback = React.memo((props) => {
|
|
4292
4021
|
const { absoluteCentering, message = "Something went wrong", onRetry } = props;
|
|
4293
4022
|
const { resetBoundary } = reactErrorBoundary.useErrorBoundary();
|
|
4294
4023
|
const height = "20px";
|
|
4295
4024
|
const outerFlexStyles = absoluteCentering ? { position: "absolute", top: "50%", transform: "translateY(-50%)" } : void 0;
|
|
4296
|
-
const handleRetry =
|
|
4025
|
+
const handleRetry = React.useCallback(() => {
|
|
4297
4026
|
resetBoundary();
|
|
4298
4027
|
onRetry();
|
|
4299
4028
|
}, [onRetry, resetBoundary]);
|
|
@@ -4306,14 +4035,14 @@
|
|
|
4306
4035
|
] });
|
|
4307
4036
|
});
|
|
4308
4037
|
ErrorFallback.displayName = "ErrorFallback";
|
|
4309
|
-
const OvermapErrorBoundary =
|
|
4038
|
+
const OvermapErrorBoundary = React.memo((props) => {
|
|
4310
4039
|
const { absoluteCentering, message } = props;
|
|
4311
|
-
const [attempt, setAttempt] =
|
|
4312
|
-
const logError =
|
|
4040
|
+
const [attempt, setAttempt] = React.useState(0);
|
|
4041
|
+
const logError = React.useCallback((error, info) => {
|
|
4313
4042
|
console.error("Error in OvermapErrorBoundary:", error, info);
|
|
4314
4043
|
setAttempt((prev) => prev + 1);
|
|
4315
4044
|
}, []);
|
|
4316
|
-
const handleRetry =
|
|
4045
|
+
const handleRetry = React.useCallback(() => {
|
|
4317
4046
|
setAttempt((prev) => prev + 1);
|
|
4318
4047
|
}, []);
|
|
4319
4048
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
@@ -4327,7 +4056,7 @@
|
|
|
4327
4056
|
);
|
|
4328
4057
|
});
|
|
4329
4058
|
OvermapErrorBoundary.displayName = "OvermapErrorBoundary";
|
|
4330
|
-
const PopoverArrow =
|
|
4059
|
+
const PopoverArrow = React.memo((props) => {
|
|
4331
4060
|
const { ref, children, className, ...rest } = props;
|
|
4332
4061
|
return /* @__PURE__ */ jsxRuntime.jsx(RadixPopover__namespace.Arrow, { className: classVarianceAuthority.cx("fill-(--base-6)", className), ref, ...rest, children });
|
|
4333
4062
|
});
|
|
@@ -4346,7 +4075,7 @@
|
|
|
4346
4075
|
size: "md"
|
|
4347
4076
|
}
|
|
4348
4077
|
});
|
|
4349
|
-
const PopoverContent =
|
|
4078
|
+
const PopoverContent = React.memo((props) => {
|
|
4350
4079
|
const providerContext = useProvider();
|
|
4351
4080
|
const {
|
|
4352
4081
|
ref,
|
|
@@ -4421,7 +4150,7 @@
|
|
|
4421
4150
|
}
|
|
4422
4151
|
}
|
|
4423
4152
|
);
|
|
4424
|
-
const Progress =
|
|
4153
|
+
const Progress = React.memo((props) => {
|
|
4425
4154
|
const providerContext = useProvider();
|
|
4426
4155
|
const {
|
|
4427
4156
|
ref,
|
|
@@ -4433,7 +4162,7 @@
|
|
|
4433
4162
|
accentColor = providerContext.accentColor,
|
|
4434
4163
|
...rest
|
|
4435
4164
|
} = props;
|
|
4436
|
-
const computedStyle =
|
|
4165
|
+
const computedStyle = React.useMemo(
|
|
4437
4166
|
() => ({
|
|
4438
4167
|
...style,
|
|
4439
4168
|
"--progress-value": rest.value ?? 0,
|
|
@@ -4454,7 +4183,7 @@
|
|
|
4454
4183
|
);
|
|
4455
4184
|
});
|
|
4456
4185
|
Progress.displayName = "Progress";
|
|
4457
|
-
const RadioCardsContext =
|
|
4186
|
+
const RadioCardsContext = React.createContext({});
|
|
4458
4187
|
const radioCardsRootCva = classVarianceAuthority.cva([], {
|
|
4459
4188
|
variants: {
|
|
4460
4189
|
size: {
|
|
@@ -4514,8 +4243,8 @@
|
|
|
4514
4243
|
}
|
|
4515
4244
|
}
|
|
4516
4245
|
);
|
|
4517
|
-
const RadioCardsItem =
|
|
4518
|
-
const { variant, size, radius } =
|
|
4246
|
+
const RadioCardsItem = React.memo((props) => {
|
|
4247
|
+
const { variant, size, radius } = React.use(RadioCardsContext);
|
|
4519
4248
|
const { className, accentColor, ...rest } = props;
|
|
4520
4249
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
4521
4250
|
RadixRadioGroup__namespace.Item,
|
|
@@ -4527,7 +4256,7 @@
|
|
|
4527
4256
|
);
|
|
4528
4257
|
});
|
|
4529
4258
|
RadioCardsItem.displayName = "RadioCardsItem";
|
|
4530
|
-
const RadioCardsRoot =
|
|
4259
|
+
const RadioCardsRoot = React.memo((props) => {
|
|
4531
4260
|
const providerContext = useProvider();
|
|
4532
4261
|
const {
|
|
4533
4262
|
className,
|
|
@@ -4538,7 +4267,7 @@
|
|
|
4538
4267
|
accentColor = providerContext.accentColor,
|
|
4539
4268
|
...rest
|
|
4540
4269
|
} = props;
|
|
4541
|
-
const contextValue =
|
|
4270
|
+
const contextValue = React.useMemo(
|
|
4542
4271
|
() => ({
|
|
4543
4272
|
variant,
|
|
4544
4273
|
size,
|
|
@@ -4561,7 +4290,7 @@
|
|
|
4561
4290
|
Root: RadioCardsRoot,
|
|
4562
4291
|
Item: RadioCardsItem
|
|
4563
4292
|
};
|
|
4564
|
-
const RadioGroupIndicator =
|
|
4293
|
+
const RadioGroupIndicator = React.memo((props) => {
|
|
4565
4294
|
const { ref, children, className, ...rest } = props;
|
|
4566
4295
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
4567
4296
|
RadixRadioGroup__namespace.Indicator,
|
|
@@ -4574,7 +4303,7 @@
|
|
|
4574
4303
|
);
|
|
4575
4304
|
});
|
|
4576
4305
|
RadioGroupIndicator.displayName = "RadioGroupIndicator";
|
|
4577
|
-
const RadioGroupContext =
|
|
4306
|
+
const RadioGroupContext = React.createContext({});
|
|
4578
4307
|
const radioGroupItem = classVarianceAuthority.cva(
|
|
4579
4308
|
[
|
|
4580
4309
|
"inline-flex",
|
|
@@ -4618,8 +4347,8 @@
|
|
|
4618
4347
|
}
|
|
4619
4348
|
}
|
|
4620
4349
|
);
|
|
4621
|
-
const RadioGroupItem =
|
|
4622
|
-
const radioGroupContext =
|
|
4350
|
+
const RadioGroupItem = React.memo((props) => {
|
|
4351
|
+
const radioGroupContext = React.useContext(RadioGroupContext);
|
|
4623
4352
|
const {
|
|
4624
4353
|
ref,
|
|
4625
4354
|
children,
|
|
@@ -4631,7 +4360,7 @@
|
|
|
4631
4360
|
return /* @__PURE__ */ jsxRuntime.jsx(RadixRadioGroup__namespace.Item, { className: classVarianceAuthority.cx(radioGroupItem({ size, variant }), className), ref, ...rest, children });
|
|
4632
4361
|
});
|
|
4633
4362
|
RadioGroupItem.displayName = "RadioGroupItem";
|
|
4634
|
-
const RadioGroupRoot =
|
|
4363
|
+
const RadioGroupRoot = React.memo((props) => {
|
|
4635
4364
|
const providerContext = useProvider();
|
|
4636
4365
|
const {
|
|
4637
4366
|
ref,
|
|
@@ -4793,15 +4522,15 @@
|
|
|
4793
4522
|
}
|
|
4794
4523
|
}
|
|
4795
4524
|
);
|
|
4796
|
-
const SegmentedControlContext =
|
|
4525
|
+
const SegmentedControlContext = React.createContext({});
|
|
4797
4526
|
const useSegmentedControl = () => {
|
|
4798
|
-
const segmentedControlContext =
|
|
4527
|
+
const segmentedControlContext = React.useContext(SegmentedControlContext);
|
|
4799
4528
|
if (!segmentedControlContext) {
|
|
4800
4529
|
throw new Error("useSegmentedControl must be used within a SegmentedControlProvider");
|
|
4801
4530
|
}
|
|
4802
4531
|
return segmentedControlContext;
|
|
4803
4532
|
};
|
|
4804
|
-
const SegmentedControlItem =
|
|
4533
|
+
const SegmentedControlItem = React.memo((props) => {
|
|
4805
4534
|
const { ref, className, ...rest } = props;
|
|
4806
4535
|
const { size, radius, variant, icon } = useSegmentedControl();
|
|
4807
4536
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
@@ -4814,7 +4543,7 @@
|
|
|
4814
4543
|
);
|
|
4815
4544
|
});
|
|
4816
4545
|
SegmentedControlItem.displayName = "SegmentedControlItem";
|
|
4817
|
-
const SegmentedControlRoot =
|
|
4546
|
+
const SegmentedControlRoot = React.memo((props) => {
|
|
4818
4547
|
const providerContext = useProvider();
|
|
4819
4548
|
const {
|
|
4820
4549
|
ref,
|
|
@@ -4848,7 +4577,7 @@
|
|
|
4848
4577
|
Item: SegmentedControlItem,
|
|
4849
4578
|
Root: SegmentedControlRoot
|
|
4850
4579
|
};
|
|
4851
|
-
const SegmentedTabsListContext =
|
|
4580
|
+
const SegmentedTabsListContext = React.createContext({});
|
|
4852
4581
|
const segmentedTabsListCva = classVarianceAuthority.cva(
|
|
4853
4582
|
["shrink-0", "transition-colors", "inline-flex", "box-border", "min-w-max", "text-center"],
|
|
4854
4583
|
{
|
|
@@ -4996,7 +4725,7 @@
|
|
|
4996
4725
|
}
|
|
4997
4726
|
}
|
|
4998
4727
|
);
|
|
4999
|
-
const SegmentedTabsList =
|
|
4728
|
+
const SegmentedTabsList = React.memo((props) => {
|
|
5000
4729
|
const providerContext = useProvider();
|
|
5001
4730
|
const {
|
|
5002
4731
|
ref,
|
|
@@ -5008,7 +4737,7 @@
|
|
|
5008
4737
|
accentColor = providerContext.accentColor,
|
|
5009
4738
|
...rest
|
|
5010
4739
|
} = props;
|
|
5011
|
-
const contextValue =
|
|
4740
|
+
const contextValue = React.useMemo(
|
|
5012
4741
|
() => ({
|
|
5013
4742
|
size,
|
|
5014
4743
|
variant,
|
|
@@ -5028,14 +4757,14 @@
|
|
|
5028
4757
|
);
|
|
5029
4758
|
});
|
|
5030
4759
|
SegmentedTabsList.displayName = "TabsList";
|
|
5031
|
-
const SegmentedTabsRoot =
|
|
4760
|
+
const SegmentedTabsRoot = React.memo((props) => {
|
|
5032
4761
|
const { ref, className, ...rest } = props;
|
|
5033
4762
|
return /* @__PURE__ */ jsxRuntime.jsx(RadixTabs__namespace.Root, { ref, className: classVarianceAuthority.cx("flex flex-col", className), ...rest });
|
|
5034
4763
|
});
|
|
5035
4764
|
SegmentedTabsRoot.displayName = "TabsRoot";
|
|
5036
|
-
const SegmentedTabsTrigger =
|
|
4765
|
+
const SegmentedTabsTrigger = React.memo((props) => {
|
|
5037
4766
|
const { ref, children, className, ...rest } = props;
|
|
5038
|
-
const { size, radius, variant } =
|
|
4767
|
+
const { size, radius, variant } = React.use(SegmentedTabsListContext);
|
|
5039
4768
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
5040
4769
|
RadixTabs__namespace.Trigger,
|
|
5041
4770
|
{
|
|
@@ -5135,7 +4864,7 @@
|
|
|
5135
4864
|
orientation: "horizontal"
|
|
5136
4865
|
}
|
|
5137
4866
|
});
|
|
5138
|
-
const Separator =
|
|
4867
|
+
const Separator = React.memo((props) => {
|
|
5139
4868
|
const { ref, className, accentColor = "base", orientation, size, ...rest } = props;
|
|
5140
4869
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
5141
4870
|
RadixSeparator__namespace.Root,
|
|
@@ -5357,7 +5086,7 @@
|
|
|
5357
5086
|
}
|
|
5358
5087
|
}
|
|
5359
5088
|
);
|
|
5360
|
-
const Slider =
|
|
5089
|
+
const Slider = React.memo((props) => {
|
|
5361
5090
|
const providerContext = useProvider();
|
|
5362
5091
|
const {
|
|
5363
5092
|
className,
|
|
@@ -5395,11 +5124,11 @@
|
|
|
5395
5124
|
);
|
|
5396
5125
|
});
|
|
5397
5126
|
Slider.displayName = "Slider";
|
|
5398
|
-
const Spinner =
|
|
5127
|
+
const Spinner = React.memo(() => {
|
|
5399
5128
|
return /* @__PURE__ */ jsxRuntime.jsx("div", { className: "size-6 animate-spin rounded-full border-2 border-(--base-a12) border-b-transparent" });
|
|
5400
5129
|
});
|
|
5401
5130
|
Spinner.displayName = "Spinner";
|
|
5402
|
-
const SwitchContext =
|
|
5131
|
+
const SwitchContext = React.createContext({});
|
|
5403
5132
|
const switchRoot = classVarianceAuthority.cva(
|
|
5404
5133
|
[
|
|
5405
5134
|
"shrink-0",
|
|
@@ -5459,7 +5188,7 @@
|
|
|
5459
5188
|
}
|
|
5460
5189
|
}
|
|
5461
5190
|
);
|
|
5462
|
-
const SwitchRoot =
|
|
5191
|
+
const SwitchRoot = React.memo((props) => {
|
|
5463
5192
|
const providerContext = useProvider();
|
|
5464
5193
|
const {
|
|
5465
5194
|
ref,
|
|
@@ -5482,9 +5211,9 @@
|
|
|
5482
5211
|
);
|
|
5483
5212
|
});
|
|
5484
5213
|
SwitchRoot.displayName = "SwitchRoot";
|
|
5485
|
-
const SwitchThumb =
|
|
5214
|
+
const SwitchThumb = React.memo((props) => {
|
|
5486
5215
|
const { ref, className, ...rest } = props;
|
|
5487
|
-
const { size, radius } =
|
|
5216
|
+
const { size, radius } = React.useContext(SwitchContext);
|
|
5488
5217
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
5489
5218
|
RadixSwitch__namespace.Thumb,
|
|
5490
5219
|
{
|
|
@@ -5499,12 +5228,12 @@
|
|
|
5499
5228
|
Root: SwitchRoot,
|
|
5500
5229
|
Thumb: SwitchThumb
|
|
5501
5230
|
};
|
|
5502
|
-
const TableBody =
|
|
5231
|
+
const TableBody = React.memo((props) => {
|
|
5503
5232
|
const { ref, className, ...rest } = props;
|
|
5504
5233
|
return /* @__PURE__ */ jsxRuntime.jsx("tbody", { ref, className: classVarianceAuthority.cx(className), ...rest });
|
|
5505
5234
|
});
|
|
5506
5235
|
TableBody.displayName = "TableBody";
|
|
5507
|
-
const TableContext =
|
|
5236
|
+
const TableContext = React.createContext({});
|
|
5508
5237
|
const tableRootCva = classVarianceAuthority.cva(["border-collapse text-left"], {
|
|
5509
5238
|
variants: {
|
|
5510
5239
|
variant: {
|
|
@@ -5545,29 +5274,29 @@
|
|
|
5545
5274
|
}
|
|
5546
5275
|
}
|
|
5547
5276
|
});
|
|
5548
|
-
const TableCell =
|
|
5277
|
+
const TableCell = React.memo((props) => {
|
|
5549
5278
|
const { ref, className, ...rest } = props;
|
|
5550
|
-
const { size, border, variant } =
|
|
5279
|
+
const { size, border, variant } = React.useContext(TableContext);
|
|
5551
5280
|
return /* @__PURE__ */ jsxRuntime.jsx("td", { ref, className: classVarianceAuthority.cx(tableCellCva({ size, border, cell: true, variant }), className), ...rest });
|
|
5552
5281
|
});
|
|
5553
5282
|
TableCell.displayName = "TableCell";
|
|
5554
|
-
const TableColumnHeaderCell =
|
|
5283
|
+
const TableColumnHeaderCell = React.memo((props) => {
|
|
5555
5284
|
const { ref, className, ...rest } = props;
|
|
5556
|
-
const { size, border, variant } =
|
|
5285
|
+
const { size, border, variant } = React.useContext(TableContext);
|
|
5557
5286
|
return /* @__PURE__ */ jsxRuntime.jsx("th", { ref, className: classVarianceAuthority.cx(tableCellCva({ size, border, cell: false, variant }), className), ...rest });
|
|
5558
5287
|
});
|
|
5559
5288
|
TableColumnHeaderCell.displayName = "TableColumnHeaderCell";
|
|
5560
|
-
const TableFooter =
|
|
5289
|
+
const TableFooter = React.memo((props) => {
|
|
5561
5290
|
const { ref, className, ...rest } = props;
|
|
5562
5291
|
return /* @__PURE__ */ jsxRuntime.jsx("tfoot", { ref, className: classVarianceAuthority.cx(className), ...rest });
|
|
5563
5292
|
});
|
|
5564
5293
|
TableFooter.displayName = "TableFooter";
|
|
5565
|
-
const TableHeader =
|
|
5294
|
+
const TableHeader = React.memo((props) => {
|
|
5566
5295
|
const { ref, className, ...rest } = props;
|
|
5567
5296
|
return /* @__PURE__ */ jsxRuntime.jsx("thead", { ref, className: classVarianceAuthority.cx(className), ...rest });
|
|
5568
5297
|
});
|
|
5569
5298
|
TableHeader.displayName = "TableHeader";
|
|
5570
|
-
const TableRoot =
|
|
5299
|
+
const TableRoot = React.memo((props) => {
|
|
5571
5300
|
const providerContext = useProvider();
|
|
5572
5301
|
const {
|
|
5573
5302
|
ref,
|
|
@@ -5595,14 +5324,14 @@
|
|
|
5595
5324
|
);
|
|
5596
5325
|
});
|
|
5597
5326
|
TableRoot.displayName = "TableRoot";
|
|
5598
|
-
const TableRow =
|
|
5327
|
+
const TableRow = React.memo((props) => {
|
|
5599
5328
|
const { ref, className, ...rest } = props;
|
|
5600
5329
|
return /* @__PURE__ */ jsxRuntime.jsx("tr", { ref, className: classVarianceAuthority.cx(className), ...rest });
|
|
5601
5330
|
});
|
|
5602
5331
|
TableRow.displayName = "TableRow";
|
|
5603
|
-
const TableRowHeaderCell =
|
|
5332
|
+
const TableRowHeaderCell = React.memo((props) => {
|
|
5604
5333
|
const { ref, className, ...rest } = props;
|
|
5605
|
-
const { size, border, variant } =
|
|
5334
|
+
const { size, border, variant } = React.useContext(TableContext);
|
|
5606
5335
|
return /* @__PURE__ */ jsxRuntime.jsx("th", { ref, className: classVarianceAuthority.cx(tableCellCva({ size, border, cell: true, variant }), className), ...rest });
|
|
5607
5336
|
});
|
|
5608
5337
|
TableRowHeaderCell.displayName = "TableRow";
|
|
@@ -5616,7 +5345,7 @@
|
|
|
5616
5345
|
RowHeaderCell: TableRowHeaderCell,
|
|
5617
5346
|
ColumnHeaderCell: TableColumnHeaderCell
|
|
5618
5347
|
};
|
|
5619
|
-
const TabsListContext =
|
|
5348
|
+
const TabsListContext = React.createContext({});
|
|
5620
5349
|
const tabsListCva = classVarianceAuthority.cva(["flex", "border-box", "inset-shadow-[0_-1px_0_0_var(--base-a6)]"], {
|
|
5621
5350
|
variants: {
|
|
5622
5351
|
size: {
|
|
@@ -5666,7 +5395,7 @@
|
|
|
5666
5395
|
}
|
|
5667
5396
|
}
|
|
5668
5397
|
);
|
|
5669
|
-
const TabsList =
|
|
5398
|
+
const TabsList = React.memo((props) => {
|
|
5670
5399
|
const providerContext = useProvider();
|
|
5671
5400
|
const { ref, children, className, size = "md", accentColor = providerContext.accentColor, ...rest } = props;
|
|
5672
5401
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
@@ -5681,19 +5410,19 @@
|
|
|
5681
5410
|
);
|
|
5682
5411
|
});
|
|
5683
5412
|
TabsList.displayName = "TabsList";
|
|
5684
|
-
const TabsRoot =
|
|
5413
|
+
const TabsRoot = React.memo((props) => {
|
|
5685
5414
|
const { ref, className, ...rest } = props;
|
|
5686
5415
|
return /* @__PURE__ */ jsxRuntime.jsx(RadixTabs__namespace.Root, { ref, className: classVarianceAuthority.cx("flex flex-col", className), ...rest });
|
|
5687
5416
|
});
|
|
5688
5417
|
TabsRoot.displayName = "TabsRoot";
|
|
5689
5418
|
const useTabsList = () => {
|
|
5690
|
-
const tabsListContext =
|
|
5419
|
+
const tabsListContext = React.useContext(TabsListContext);
|
|
5691
5420
|
if (!tabsListContext) {
|
|
5692
5421
|
throw new Error("useTabsList must be used within a TabsList component");
|
|
5693
5422
|
}
|
|
5694
5423
|
return tabsListContext;
|
|
5695
5424
|
};
|
|
5696
|
-
const TabsTrigger =
|
|
5425
|
+
const TabsTrigger = React.memo((props) => {
|
|
5697
5426
|
const { ref, children, className, ...rest } = props;
|
|
5698
5427
|
const { size } = useTabsList();
|
|
5699
5428
|
return /* @__PURE__ */ jsxRuntime.jsx(RadixTabs__namespace.Trigger, { ref, className: classVarianceAuthority.cx(tabsTriggerCva({ size }), className), ...rest, children });
|
|
@@ -5735,7 +5464,7 @@
|
|
|
5735
5464
|
}
|
|
5736
5465
|
}
|
|
5737
5466
|
});
|
|
5738
|
-
const Text =
|
|
5467
|
+
const Text = React.memo((props) => {
|
|
5739
5468
|
const { ref, className, size, weight, align, accentColor, highContrast = false, ...rest } = props;
|
|
5740
5469
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
5741
5470
|
"span",
|
|
@@ -5816,7 +5545,7 @@
|
|
|
5816
5545
|
}
|
|
5817
5546
|
}
|
|
5818
5547
|
);
|
|
5819
|
-
const TextArea =
|
|
5548
|
+
const TextArea = React.memo((props) => {
|
|
5820
5549
|
const providerContext = useProvider();
|
|
5821
5550
|
const {
|
|
5822
5551
|
ref,
|
|
@@ -5884,8 +5613,8 @@
|
|
|
5884
5613
|
action,
|
|
5885
5614
|
...rest
|
|
5886
5615
|
} = props;
|
|
5887
|
-
const [open, setOpen] =
|
|
5888
|
-
const handleOpenChange =
|
|
5616
|
+
const [open, setOpen] = React.useState(true);
|
|
5617
|
+
const handleOpenChange = React.useCallback(
|
|
5889
5618
|
(open2) => {
|
|
5890
5619
|
if (!open2 && onClose) onClose();
|
|
5891
5620
|
setOpen(open2);
|
|
@@ -5923,11 +5652,11 @@
|
|
|
5923
5652
|
}
|
|
5924
5653
|
);
|
|
5925
5654
|
};
|
|
5926
|
-
const Toast =
|
|
5655
|
+
const Toast = React.memo(_Toast);
|
|
5927
5656
|
Toast.displayName = "Toast";
|
|
5928
|
-
const ToastContext =
|
|
5657
|
+
const ToastContext = React.createContext({});
|
|
5929
5658
|
const useToast = () => {
|
|
5930
|
-
const context =
|
|
5659
|
+
const context = React.useContext(ToastContext);
|
|
5931
5660
|
if (!context) {
|
|
5932
5661
|
throw new Error("useToast must be used within a ToastProvider");
|
|
5933
5662
|
}
|
|
@@ -5941,15 +5670,15 @@
|
|
|
5941
5670
|
return MIN_DURATION + words / WORDS_PER_SECOND;
|
|
5942
5671
|
};
|
|
5943
5672
|
exports2.unsafeShowToast = void 0;
|
|
5944
|
-
const ToastProvider =
|
|
5673
|
+
const ToastProvider = React.memo(function ToastContextProvider({
|
|
5945
5674
|
children,
|
|
5946
5675
|
// Use this class to change where the viewport for the toasts should be
|
|
5947
5676
|
className,
|
|
5948
5677
|
hotkey,
|
|
5949
5678
|
...rest
|
|
5950
5679
|
}) {
|
|
5951
|
-
const [toasts, setToasts] =
|
|
5952
|
-
const handleCloseToast =
|
|
5680
|
+
const [toasts, setToasts] = React.useState([]);
|
|
5681
|
+
const handleCloseToast = React.useCallback((id, reason, callback) => {
|
|
5953
5682
|
setToasts((prevToasts) => {
|
|
5954
5683
|
const toast = prevToasts.find((toast2) => toast2.id === id);
|
|
5955
5684
|
if (toast && reason === 0) clearTimeout(toast.timeout);
|
|
@@ -5957,7 +5686,7 @@
|
|
|
5957
5686
|
});
|
|
5958
5687
|
if (callback) callback();
|
|
5959
5688
|
}, []);
|
|
5960
|
-
const toastContextValue =
|
|
5689
|
+
const toastContextValue = React.useMemo(() => {
|
|
5961
5690
|
let counter = 0;
|
|
5962
5691
|
const showToast = (toastProps) => {
|
|
5963
5692
|
const duration = calculatedDuration(toastProps);
|
|
@@ -5981,7 +5710,7 @@
|
|
|
5981
5710
|
showWarning
|
|
5982
5711
|
};
|
|
5983
5712
|
}, [handleCloseToast]);
|
|
5984
|
-
|
|
5713
|
+
React.useEffect(() => {
|
|
5985
5714
|
return () => {
|
|
5986
5715
|
for (const { timeout } of toasts) clearTimeout(timeout);
|
|
5987
5716
|
};
|
|
@@ -6122,7 +5851,7 @@
|
|
|
6122
5851
|
}
|
|
6123
5852
|
}
|
|
6124
5853
|
);
|
|
6125
|
-
const BaseToggleButton =
|
|
5854
|
+
const BaseToggleButton = React.memo((props) => {
|
|
6126
5855
|
const providerContext = useProvider();
|
|
6127
5856
|
const {
|
|
6128
5857
|
ref,
|
|
@@ -6145,15 +5874,15 @@
|
|
|
6145
5874
|
);
|
|
6146
5875
|
});
|
|
6147
5876
|
BaseToggleButton.displayName = "BaseToggleButton";
|
|
6148
|
-
const IconToggleButton =
|
|
5877
|
+
const IconToggleButton = React.memo((props) => {
|
|
6149
5878
|
return /* @__PURE__ */ jsxRuntime.jsx(BaseToggleButton, { icon: true, ...props });
|
|
6150
5879
|
});
|
|
6151
5880
|
IconToggleButton.displayName = "IconToggleButton";
|
|
6152
|
-
const ToggleButton =
|
|
5881
|
+
const ToggleButton = React.memo((props) => {
|
|
6153
5882
|
return /* @__PURE__ */ jsxRuntime.jsx(BaseToggleButton, { icon: false, ...props });
|
|
6154
5883
|
});
|
|
6155
5884
|
ToggleButton.displayName = "ToggleButton";
|
|
6156
|
-
const ToggleGroupContext =
|
|
5885
|
+
const ToggleGroupContext = React.createContext({});
|
|
6157
5886
|
const toggleGroupItemCva = classVarianceAuthority.cva(
|
|
6158
5887
|
[
|
|
6159
5888
|
"flex",
|
|
@@ -6269,8 +5998,8 @@
|
|
|
6269
5998
|
]
|
|
6270
5999
|
}
|
|
6271
6000
|
);
|
|
6272
|
-
const ToggleGroupBaseItem =
|
|
6273
|
-
const toggleGroupContext =
|
|
6001
|
+
const ToggleGroupBaseItem = React.memo((props) => {
|
|
6002
|
+
const toggleGroupContext = React.use(ToggleGroupContext);
|
|
6274
6003
|
const {
|
|
6275
6004
|
ref,
|
|
6276
6005
|
className,
|
|
@@ -6296,15 +6025,15 @@
|
|
|
6296
6025
|
);
|
|
6297
6026
|
});
|
|
6298
6027
|
ToggleGroupBaseItem.displayName = "ToggleGroupBaseItem";
|
|
6299
|
-
const ToggleGroupIconItem =
|
|
6028
|
+
const ToggleGroupIconItem = React.memo((props) => {
|
|
6300
6029
|
return /* @__PURE__ */ jsxRuntime.jsx(ToggleGroupBaseItem, { icon: true, ...props });
|
|
6301
6030
|
});
|
|
6302
6031
|
ToggleGroupIconItem.displayName = "ToggleGroupIconItem";
|
|
6303
|
-
const ToggleGroupItem =
|
|
6032
|
+
const ToggleGroupItem = React.memo((props) => {
|
|
6304
6033
|
return /* @__PURE__ */ jsxRuntime.jsx(ToggleGroupBaseItem, { icon: false, ...props });
|
|
6305
6034
|
});
|
|
6306
6035
|
ToggleGroupItem.displayName = "ToggleGroupItem";
|
|
6307
|
-
const ToggleGroupRoot =
|
|
6036
|
+
const ToggleGroupRoot = React.memo((props) => {
|
|
6308
6037
|
const providerContext = useProvider();
|
|
6309
6038
|
const {
|
|
6310
6039
|
ref,
|
|
@@ -6315,7 +6044,7 @@
|
|
|
6315
6044
|
size = "md",
|
|
6316
6045
|
...rest
|
|
6317
6046
|
} = props;
|
|
6318
|
-
const contextValue =
|
|
6047
|
+
const contextValue = React.useMemo(
|
|
6319
6048
|
() => ({
|
|
6320
6049
|
variant,
|
|
6321
6050
|
size,
|
|
@@ -6332,7 +6061,7 @@
|
|
|
6332
6061
|
Item: ToggleGroupItem,
|
|
6333
6062
|
IconItem: ToggleGroupIconItem
|
|
6334
6063
|
};
|
|
6335
|
-
const TooltipArrow =
|
|
6064
|
+
const TooltipArrow = React.memo((props) => {
|
|
6336
6065
|
const { ref, className, ...rest } = props;
|
|
6337
6066
|
return /* @__PURE__ */ jsxRuntime.jsx(RadixTooltip__namespace.Arrow, { className: classVarianceAuthority.cx("fill-(--base-6)", className), ref, ...rest });
|
|
6338
6067
|
});
|
|
@@ -6374,7 +6103,7 @@
|
|
|
6374
6103
|
}
|
|
6375
6104
|
}
|
|
6376
6105
|
);
|
|
6377
|
-
const TooltipContent =
|
|
6106
|
+
const TooltipContent = React.memo((props) => {
|
|
6378
6107
|
const providerContext = useProvider();
|
|
6379
6108
|
const {
|
|
6380
6109
|
ref,
|
|
@@ -6426,6 +6155,7 @@
|
|
|
6426
6155
|
exports2.CheckboxGroupSelectAllItem = CheckboxGroupSelectAllItem;
|
|
6427
6156
|
exports2.CheckboxIndicator = CheckboxIndicator;
|
|
6428
6157
|
exports2.CheckboxRoot = CheckboxRoot;
|
|
6158
|
+
exports2.CollapsibleTree = CollapsibleTree;
|
|
6429
6159
|
exports2.CommandMenu = CommandMenu;
|
|
6430
6160
|
exports2.CommandMenuCheckboxIndicator = CommandMenuCheckboxIndicator;
|
|
6431
6161
|
exports2.CommandMenuCheckboxItem = CommandMenuCheckboxItem;
|
|
@@ -6474,38 +6204,44 @@
|
|
|
6474
6204
|
exports2.Link = Link;
|
|
6475
6205
|
exports2.LuIcon = LuIcon;
|
|
6476
6206
|
exports2.Menu = Menu;
|
|
6477
|
-
exports2.MenuCheckboxItem = MenuCheckboxItem
|
|
6207
|
+
exports2.MenuCheckboxItem = MenuCheckboxItem;
|
|
6478
6208
|
exports2.MenuCheckboxItemIndicator = MenuCheckboxItemIndicator;
|
|
6479
6209
|
exports2.MenuClickTrigger = MenuClickTrigger;
|
|
6480
6210
|
exports2.MenuContent = MenuContent;
|
|
6481
6211
|
exports2.MenuContextTrigger = MenuContextTrigger;
|
|
6482
|
-
exports2.MenuGroup = MenuGroup
|
|
6212
|
+
exports2.MenuGroup = MenuGroup;
|
|
6483
6213
|
exports2.MenuInputField = MenuInputField;
|
|
6484
6214
|
exports2.MenuInputRoot = MenuInputRoot;
|
|
6485
6215
|
exports2.MenuInputSlot = MenuInputSlot;
|
|
6486
|
-
exports2.MenuItem = MenuItem
|
|
6216
|
+
exports2.MenuItem = MenuItem;
|
|
6487
6217
|
exports2.MenuLabel = MenuLabel;
|
|
6488
|
-
exports2.MenuMultiSelectGroup = MenuMultiSelectGroup
|
|
6489
|
-
exports2.MenuMultiSelectItem = MenuMultiSelectItem
|
|
6218
|
+
exports2.MenuMultiSelectGroup = MenuMultiSelectGroup;
|
|
6219
|
+
exports2.MenuMultiSelectItem = MenuMultiSelectItem;
|
|
6490
6220
|
exports2.MenuPageContent = MenuPageContent;
|
|
6491
6221
|
exports2.MenuPageTrigger = MenuPageTrigger;
|
|
6492
|
-
exports2.MenuPages = MenuPages
|
|
6493
|
-
exports2.MenuRoot = MenuRoot
|
|
6222
|
+
exports2.MenuPages = MenuPages;
|
|
6223
|
+
exports2.MenuRoot = MenuRoot;
|
|
6494
6224
|
exports2.MenuScroll = MenuScroll;
|
|
6495
|
-
exports2.MenuSelectAllItem = MenuSelectAllItem
|
|
6496
|
-
exports2.MenuSelectGroup = MenuSelectGroup
|
|
6497
|
-
exports2.MenuSelectItem = MenuSelectItem
|
|
6498
|
-
exports2.MenuSelectedIndicator = MenuSelectedIndicator
|
|
6499
|
-
exports2.MenuSeparator = MenuSeparator
|
|
6225
|
+
exports2.MenuSelectAllItem = MenuSelectAllItem;
|
|
6226
|
+
exports2.MenuSelectGroup = MenuSelectGroup;
|
|
6227
|
+
exports2.MenuSelectItem = MenuSelectItem;
|
|
6228
|
+
exports2.MenuSelectedIndicator = MenuSelectedIndicator;
|
|
6229
|
+
exports2.MenuSeparator = MenuSeparator;
|
|
6500
6230
|
exports2.MenuSub = MenuSub;
|
|
6501
6231
|
exports2.MenuSubContent = MenuSubContent;
|
|
6502
6232
|
exports2.MenuSubTrigger = MenuSubTrigger;
|
|
6503
|
-
exports2.MenuV2 = MenuV2;
|
|
6504
6233
|
exports2.MenuVirtualTrigger = MenuVirtualTrigger;
|
|
6505
6234
|
exports2.OneTimePasswordField = OneTimePasswordField;
|
|
6506
6235
|
exports2.OneTimePasswordFieldHiddenInput = OneTimePasswordFieldHiddenInput;
|
|
6507
6236
|
exports2.OneTimePasswordFieldInput = OneTimePasswordFieldInput;
|
|
6508
6237
|
exports2.OneTimePasswordFieldRoot = OneTimePasswordFieldRoot;
|
|
6238
|
+
exports2.Overlay = Overlay;
|
|
6239
|
+
exports2.OverlayClose = OverlayClose;
|
|
6240
|
+
exports2.OverlayContent = OverlayContent;
|
|
6241
|
+
exports2.OverlayDescription = OverlayDescription;
|
|
6242
|
+
exports2.OverlayRoot = OverlayRoot;
|
|
6243
|
+
exports2.OverlayTitle = OverlayTitle;
|
|
6244
|
+
exports2.OverlayTrigger = OverlayTrigger;
|
|
6509
6245
|
exports2.OvermapErrorBoundary = OvermapErrorBoundary;
|
|
6510
6246
|
exports2.Popover = Popover;
|
|
6511
6247
|
exports2.PopoverArrow = PopoverArrow;
|
|
@@ -6526,6 +6262,7 @@
|
|
|
6526
6262
|
exports2.SegmentedTabsList = SegmentedTabsList;
|
|
6527
6263
|
exports2.SegmentedTabsRoot = SegmentedTabsRoot;
|
|
6528
6264
|
exports2.SegmentedTabsTrigger = SegmentedTabsTrigger;
|
|
6265
|
+
exports2.SelectedIndicatorContext = SelectedIndicatorContext;
|
|
6529
6266
|
exports2.Separator = Separator;
|
|
6530
6267
|
exports2.SlideOut = SlideOut;
|
|
6531
6268
|
exports2.Slider = Slider;
|
|
@@ -6562,21 +6299,21 @@
|
|
|
6562
6299
|
exports2.badge = badge;
|
|
6563
6300
|
exports2.buttonCva = buttonCva;
|
|
6564
6301
|
exports2.floating = floating;
|
|
6565
|
-
exports2.genericMemo = genericMemo;
|
|
6566
|
-
exports2.getActiveState = getActiveState;
|
|
6567
|
-
exports2.getBooleanState = getBooleanState;
|
|
6568
|
-
exports2.getCheckedState = getCheckedState;
|
|
6569
|
-
exports2.getOpenState = getOpenState;
|
|
6570
|
-
exports2.getSelectedState = getSelectedState;
|
|
6571
6302
|
exports2.mergeRefs = mergeRefs;
|
|
6572
6303
|
exports2.radiusCva = radiusCva;
|
|
6573
6304
|
exports2.stopPropagation = stopPropagation;
|
|
6574
6305
|
exports2.useAlertDialog = useAlertDialog;
|
|
6575
6306
|
exports2.useButtonGroup = useButtonGroup;
|
|
6576
6307
|
exports2.useControlledState = useControlledState;
|
|
6577
|
-
exports2.useFallbackId = useFallbackId;
|
|
6578
6308
|
exports2.useLayoutContext = useLayoutContext;
|
|
6309
|
+
exports2.useMenuContentContext = useMenuContentContext;
|
|
6310
|
+
exports2.useMenuContext = useMenuContext;
|
|
6311
|
+
exports2.usePagesContext = usePagesContext;
|
|
6579
6312
|
exports2.useProvider = useProvider;
|
|
6313
|
+
exports2.useSelectedIndicatorContext = useSelectedIndicatorContext;
|
|
6314
|
+
exports2.useSize = useSize;
|
|
6315
|
+
exports2.useStopEventPropagation = useStopEventPropagation;
|
|
6316
|
+
exports2.useSubContext = useSubContext;
|
|
6580
6317
|
exports2.useTextFilter = useTextFilter;
|
|
6581
6318
|
exports2.useToast = useToast;
|
|
6582
6319
|
exports2.useViewportSize = useViewportSize;
|