@overmap-ai/blocks 1.0.40-overlay.1 → 1.0.40-slide-out-resize-handle.0
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 +1 -2
- package/dist/ButtonGroup/context.d.ts +2 -7
- package/dist/CheckboxGroup/context.d.ts +2 -6
- package/dist/CheckedIndicator/CheckedIndicator.d.ts +4 -3
- package/dist/CommandMenu/CheckboxIndicator.d.ts +2 -4
- package/dist/CommandMenu/SelectedIndicator.d.ts +2 -3
- package/dist/CommandMenu/context.d.ts +2 -3
- package/dist/Heading/cva.d.ts +1 -1
- package/dist/HoverUtility/HoverUtility.d.ts +2 -2
- package/dist/Layout/SlideOutClose.d.ts +5 -0
- package/dist/Layout/SlideOutContent.d.ts +6 -0
- package/dist/Layout/SlideOutHandle.d.ts +5 -0
- package/dist/Layout/SlideOutOverlay.d.ts +2 -5
- package/dist/Layout/SlideOutRoot.d.ts +10 -0
- package/dist/Layout/SlideOutTrigger.d.ts +2 -6
- package/dist/Layout/SlideOutViewport.d.ts +5 -0
- package/dist/Layout/context.d.ts +0 -1
- package/dist/Layout/index.d.ts +11 -3
- package/dist/Layout/typings.d.ts +3 -0
- package/dist/Link/cva.d.ts +1 -1
- package/dist/LuIcon/LuIcon.d.ts +4 -6
- package/dist/LuIcon/index.d.ts +1 -1
- package/dist/LuIcon/typings.d.ts +2 -2
- package/dist/Menu/{CheckboxItem/CheckboxItem.d.ts → CheckboxItem.d.ts} +1 -1
- package/dist/Menu/{CheckboxItemIndicator/CheckboxItemIndicator.d.ts → CheckboxItemIndicator.d.ts} +1 -1
- package/dist/Menu/{ClickTrigger/ClickTrigger.d.ts → ClickTrigger.d.ts} +1 -1
- package/dist/Menu/{Content/Content.d.ts → Content.d.ts} +1 -1
- package/dist/Menu/{ContextTrigger/ContextTrigger.d.ts → ContextTrigger.d.ts} +1 -1
- package/dist/Menu/{Group/Group.d.ts → Group.d.ts} +1 -1
- package/dist/Menu/{Input/Field.d.ts → InputField.d.ts} +1 -1
- package/dist/Menu/{Input/Root.d.ts → InputRoot.d.ts} +1 -1
- package/dist/Menu/{Input/Slot.d.ts → InputSlot.d.ts} +1 -1
- package/dist/Menu/{Item/Item.d.ts → Item.d.ts} +1 -1
- package/dist/Menu/{MultiSelectGroup/MultiSelectGroup.d.ts → MultiSelectGroup.d.ts} +1 -1
- package/dist/Menu/{MultiSelectItem/MultiSelectItem.d.ts → MultiSelectItem.d.ts} +1 -1
- package/dist/Menu/PageContent.d.ts +2 -0
- package/dist/Menu/{PageTrigger/PageTrigger.d.ts → PageTrigger.d.ts} +1 -1
- package/dist/Menu/{Pages/Pages.d.ts → Pages.d.ts} +1 -1
- package/dist/Menu/{root/Root.d.ts → Root.d.ts} +1 -1
- package/dist/Menu/{Scroll/Scroll.d.ts → Scroll.d.ts} +1 -1
- package/dist/Menu/{SelectAll/SelectAllItem.d.ts → SelectAllItem.d.ts} +1 -1
- package/dist/Menu/{SelectGroup/SelectGroup.d.ts → SelectGroup.d.ts} +1 -1
- package/dist/Menu/{SelectItem/SelectItem.d.ts → SelectItem.d.ts} +1 -1
- package/dist/Menu/SelectedIndicator.d.ts +4 -0
- package/dist/Menu/{Separator/Separator.d.ts → Separator.d.ts} +1 -1
- package/dist/Menu/{Sub/Sub.d.ts → Sub.d.ts} +1 -1
- package/dist/Menu/{SubContent/SubContent.d.ts → SubContent.d.ts} +1 -1
- package/dist/Menu/{SubTrigger/SubTrigger.d.ts → SubTrigger.d.ts} +1 -1
- package/dist/Menu/{VirtualTrigger/VirtualTrigger.d.ts → VirtualTrigger.d.ts} +1 -1
- package/dist/Menu/index.d.ts +9 -7
- package/dist/Menu/{Content/context.d.ts → menuContentContext.d.ts} +2 -2
- package/dist/Menu/{root/context.d.ts → rootContext.d.ts} +1 -1
- package/dist/Menu/{Sub/context.d.ts → subContentContext.d.ts} +1 -1
- package/dist/Menu/utils.d.ts +0 -6
- package/dist/MenuV2/CheckboxItem.d.ts +6 -0
- package/dist/MenuV2/CheckboxItemIndicator.d.ts +3 -0
- package/dist/MenuV2/Group.d.ts +4 -0
- package/dist/MenuV2/GroupLabel.d.ts +4 -0
- package/dist/MenuV2/Item.d.ts +6 -0
- package/dist/MenuV2/MultiSelectAllItem.d.ts +4 -0
- package/dist/MenuV2/MultiSelectGroup.d.ts +5 -0
- package/dist/MenuV2/MultiSelectItem.d.ts +5 -0
- package/dist/MenuV2/Page.d.ts +5 -0
- package/dist/MenuV2/PageTriggerItem.d.ts +5 -0
- package/dist/MenuV2/Pages.d.ts +7 -0
- package/dist/MenuV2/Root.d.ts +6 -0
- package/dist/MenuV2/SelectGroup.d.ts +4 -0
- package/dist/MenuV2/SelectItem.d.ts +5 -0
- package/dist/MenuV2/SelectedIndicator.d.ts +3 -0
- package/dist/MenuV2/Separator.d.ts +5 -0
- package/dist/MenuV2/constants.d.ts +9 -0
- package/dist/MenuV2/context.d.ts +17 -0
- package/dist/MenuV2/cva.d.ts +14 -0
- package/dist/MenuV2/index.d.ts +36 -0
- package/dist/MenuV2/typings.d.ts +9 -0
- package/dist/MenuV2/utils.d.ts +1 -0
- package/dist/Rating/Item.d.ts +6 -0
- package/dist/Rating/ItemIndicator.d.ts +5 -0
- package/dist/Rating/Root.d.ts +8 -0
- package/dist/Rating/context.d.ts +9 -0
- package/dist/Rating/index.d.ts +9 -0
- package/dist/SelectedIndicator/SelectedIndicator.d.ts +5 -0
- package/dist/{Menu/SelectedIndicator → SelectedIndicator}/context.d.ts +0 -1
- package/dist/SelectedIndicator/index.d.ts +2 -0
- package/dist/SlideOut/Close.d.ts +4 -0
- package/dist/SlideOut/Content.d.ts +12 -0
- package/dist/SlideOut/Handle.d.ts +5 -0
- package/dist/SlideOut/Overlay.d.ts +4 -0
- package/dist/SlideOut/Root.d.ts +8 -0
- package/dist/SlideOut/Trigger.d.ts +4 -0
- package/dist/SlideOut/Viewport.d.ts +4 -0
- package/dist/SlideOut/constants.d.ts +1 -0
- package/dist/SlideOut/context.d.ts +16 -0
- package/dist/SlideOut/index.d.ts +18 -1
- package/dist/SlideOut/typings.d.ts +2 -0
- package/dist/Text/cva.d.ts +1 -1
- package/dist/blocks.js +1637 -1124
- package/dist/blocks.js.map +1 -1
- package/dist/blocks.umd.cjs +1748 -1236
- package/dist/blocks.umd.cjs.map +1 -1
- package/dist/hooks.d.ts +20 -0
- package/dist/index.d.ts +4 -2
- package/dist/typings.d.ts +0 -5
- package/dist/utils.d.ts +7 -30
- package/package.json +1 -1
- package/dist/CheckboxGroup/utils.d.ts +0 -1
- package/dist/CollapsibleTree/CollapsibleTree.d.ts +0 -5
- package/dist/CollapsibleTree/context.d.ts +0 -11
- package/dist/CollapsibleTree/index.d.ts +0 -2
- package/dist/CollapsibleTree/typings.d.ts +0 -58
- package/dist/CommandMenu/utils.d.ts +0 -4
- package/dist/Layout/SlideOut.d.ts +0 -20
- package/dist/Menu/ClickTrigger/index.d.ts +0 -1
- package/dist/Menu/Content/index.d.ts +0 -2
- package/dist/Menu/ContextTrigger/index.d.ts +0 -1
- package/dist/Menu/Group/index.d.ts +0 -1
- package/dist/Menu/Input/index.d.ts +0 -3
- package/dist/Menu/Item/index.d.ts +0 -1
- package/dist/Menu/Label/index.d.ts +0 -1
- package/dist/Menu/MultiSelectGroup/index.d.ts +0 -1
- package/dist/Menu/MultiSelectItem/index.d.ts +0 -1
- package/dist/Menu/PageContent/PageContent.d.ts +0 -3
- package/dist/Menu/PageContent/index.d.ts +0 -1
- package/dist/Menu/PageTrigger/index.d.ts +0 -1
- package/dist/Menu/Pages/index.d.ts +0 -2
- package/dist/Menu/SelectAll/index.d.ts +0 -1
- package/dist/Menu/SelectGroup/index.d.ts +0 -1
- package/dist/Menu/SelectItem/index.d.ts +0 -1
- package/dist/Menu/SelectedIndicator/SelectedIndicator.d.ts +0 -4
- package/dist/Menu/SelectedIndicator/index.d.ts +0 -2
- package/dist/Menu/Separator/index.d.ts +0 -1
- package/dist/Menu/Sub/index.d.ts +0 -2
- package/dist/Menu/SubContent/index.d.ts +0 -1
- package/dist/Menu/SubTrigger/index.d.ts +0 -1
- package/dist/Menu/VirtualTrigger/index.d.ts +0 -1
- package/dist/Menu/root/index.d.ts +0 -2
- package/dist/SlideOut/SlideOut.d.ts +0 -50
- /package/dist/Menu/{Label/Label.d.ts → Label.d.ts} +0 -0
- /package/dist/Menu/{Pages/context.d.ts → menuPagesContext.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("
|
|
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("cmdk"), require("@radix-ui/react-dialog"), require("react-day-picker"), require("lucide-react"), require("@radix-ui/react-hover-card"), require("@radix-ui/react-slot"), require("react-transition-group"), require("react-transition-group/CSSTransition"), require("react-dom"), 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", "@radix-ui/react-hover-card", "@radix-ui/react-slot", "react-transition-group", "react-transition-group/CSSTransition", "react-dom", "@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.cmdk, global.RadixDialog, global.reactDayPicker, global.lucideReact, global.RadixHoverCard, global.reactSlot, global.reactTransitionGroup, null, global.ReactDOM, global.react$1, 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, cmdk, RadixDialog, reactDayPicker, lucideReact, RadixHoverCard, reactSlot, reactTransitionGroup, CSSTransition, ReactDOM, react$1, 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,10 +19,8 @@
|
|
|
19
19
|
return Object.freeze(n);
|
|
20
20
|
}
|
|
21
21
|
const RadixAlertDialog__namespace = /* @__PURE__ */ _interopNamespaceDefault(RadixAlertDialog);
|
|
22
|
-
const React__namespace = /* @__PURE__ */ _interopNamespaceDefault(React);
|
|
23
22
|
const RadixAvatar__namespace = /* @__PURE__ */ _interopNamespaceDefault(RadixAvatar);
|
|
24
23
|
const RadixCheckbox__namespace = /* @__PURE__ */ _interopNamespaceDefault(RadixCheckbox);
|
|
25
|
-
const RadixPrimitiveCollapsible__namespace = /* @__PURE__ */ _interopNamespaceDefault(RadixPrimitiveCollapsible);
|
|
26
24
|
const RadixDialog__namespace = /* @__PURE__ */ _interopNamespaceDefault(RadixDialog);
|
|
27
25
|
const RadixHoverCard__namespace = /* @__PURE__ */ _interopNamespaceDefault(RadixHoverCard);
|
|
28
26
|
const RadixSeparator__namespace = /* @__PURE__ */ _interopNamespaceDefault(RadixSeparator);
|
|
@@ -103,17 +101,17 @@
|
|
|
103
101
|
}
|
|
104
102
|
]
|
|
105
103
|
});
|
|
106
|
-
const ProviderContext =
|
|
104
|
+
const ProviderContext = react.createContext({});
|
|
107
105
|
const useProvider = () => {
|
|
108
|
-
const context =
|
|
106
|
+
const context = react.useContext(ProviderContext);
|
|
109
107
|
if (!context) {
|
|
110
108
|
throw new Error("useProvider must be used within a Provider");
|
|
111
109
|
}
|
|
112
110
|
return context;
|
|
113
111
|
};
|
|
114
|
-
const Provider =
|
|
112
|
+
const Provider = react.memo((props) => {
|
|
115
113
|
const { accentColor, radius = "md", children } = props;
|
|
116
|
-
const contextValue =
|
|
114
|
+
const contextValue = react.useMemo(
|
|
117
115
|
() => ({
|
|
118
116
|
accentColor,
|
|
119
117
|
radius
|
|
@@ -180,7 +178,7 @@
|
|
|
180
178
|
}
|
|
181
179
|
}
|
|
182
180
|
);
|
|
183
|
-
const AlertDialogContent =
|
|
181
|
+
const AlertDialogContent = react.memo((props) => {
|
|
184
182
|
const { radius } = useProvider();
|
|
185
183
|
const { ref, children, className, size, container, ...rest } = props;
|
|
186
184
|
return /* @__PURE__ */ jsxRuntime.jsxs(RadixAlertDialog__namespace.Portal, { container, children: [
|
|
@@ -198,18 +196,18 @@
|
|
|
198
196
|
] });
|
|
199
197
|
});
|
|
200
198
|
AlertDialogContent.displayName = "AlertDialogContent";
|
|
201
|
-
const AlertDialogContext =
|
|
199
|
+
const AlertDialogContext = react.createContext(() => {
|
|
202
200
|
throw new Error("No AlertDialogProvider found");
|
|
203
201
|
});
|
|
204
202
|
const useAlertDialog = () => {
|
|
205
|
-
const alertDialogContext =
|
|
203
|
+
const alertDialogContext = react.useContext(AlertDialogContext);
|
|
206
204
|
if (!alertDialogContext) {
|
|
207
205
|
throw new Error("No AlertDialogProvider found");
|
|
208
206
|
}
|
|
209
207
|
return alertDialogContext;
|
|
210
208
|
};
|
|
211
|
-
const ButtonGroupContext =
|
|
212
|
-
const ButtonGroup =
|
|
209
|
+
const ButtonGroupContext = react.createContext({});
|
|
210
|
+
const ButtonGroup = react.memo((props) => {
|
|
213
211
|
const providerContext = useProvider();
|
|
214
212
|
const {
|
|
215
213
|
children,
|
|
@@ -219,7 +217,7 @@
|
|
|
219
217
|
accentColor = providerContext.accentColor,
|
|
220
218
|
...rest
|
|
221
219
|
} = props;
|
|
222
|
-
const value =
|
|
220
|
+
const value = react.useMemo(
|
|
223
221
|
() => ({
|
|
224
222
|
variant,
|
|
225
223
|
size,
|
|
@@ -231,7 +229,7 @@
|
|
|
231
229
|
return /* @__PURE__ */ jsxRuntime.jsx("div", { ...rest, children: /* @__PURE__ */ jsxRuntime.jsx(ButtonGroupContext.Provider, { value, children }) });
|
|
232
230
|
});
|
|
233
231
|
ButtonGroup.displayName = "Buttons";
|
|
234
|
-
const useButtonGroup = () =>
|
|
232
|
+
const useButtonGroup = () => react.useContext(ButtonGroupContext);
|
|
235
233
|
const buttonCva = classVarianceAuthority.cva(
|
|
236
234
|
[
|
|
237
235
|
"inline-flex",
|
|
@@ -385,7 +383,7 @@
|
|
|
385
383
|
}
|
|
386
384
|
}
|
|
387
385
|
);
|
|
388
|
-
const Button =
|
|
386
|
+
const Button = react.memo((props) => {
|
|
389
387
|
const providerContext = useProvider();
|
|
390
388
|
const buttonsContext = useButtonGroup();
|
|
391
389
|
const {
|
|
@@ -410,7 +408,7 @@
|
|
|
410
408
|
);
|
|
411
409
|
});
|
|
412
410
|
Button.displayName = "Button";
|
|
413
|
-
const IconButton =
|
|
411
|
+
const IconButton = react.memo((props) => {
|
|
414
412
|
const providerContext = useProvider();
|
|
415
413
|
const buttonsContext = useButtonGroup();
|
|
416
414
|
const {
|
|
@@ -435,11 +433,11 @@
|
|
|
435
433
|
);
|
|
436
434
|
});
|
|
437
435
|
IconButton.displayName = "IconButton";
|
|
438
|
-
const AlertDialogProvider =
|
|
436
|
+
const AlertDialogProvider = react.memo((props) => {
|
|
439
437
|
const { children } = props;
|
|
440
|
-
const [open, setOpen] =
|
|
441
|
-
const [options, setOptions] =
|
|
442
|
-
const handleOpenChange =
|
|
438
|
+
const [open, setOpen] = react.useState(false);
|
|
439
|
+
const [options, setOptions] = react.useState(null);
|
|
440
|
+
const handleOpenChange = react.useCallback(
|
|
443
441
|
(open2) => {
|
|
444
442
|
var _a;
|
|
445
443
|
setOpen(open2);
|
|
@@ -448,7 +446,7 @@
|
|
|
448
446
|
},
|
|
449
447
|
[options]
|
|
450
448
|
);
|
|
451
|
-
const openAlertDialog =
|
|
449
|
+
const openAlertDialog = react.useCallback(
|
|
452
450
|
(config) => {
|
|
453
451
|
if (open) throw new Error("AlertDialog is already open");
|
|
454
452
|
setOpen(true);
|
|
@@ -485,7 +483,7 @@
|
|
|
485
483
|
Action: RadixAlertDialog__namespace.Action,
|
|
486
484
|
Cancel: RadixAlertDialog__namespace.Cancel
|
|
487
485
|
};
|
|
488
|
-
const AvatarContext =
|
|
486
|
+
const AvatarContext = react.createContext({});
|
|
489
487
|
const avatar = classVarianceAuthority.cva(["shrink-0", "select-none", "inline-block", "align-middle"], {
|
|
490
488
|
variants: {
|
|
491
489
|
size: {
|
|
@@ -513,13 +511,13 @@
|
|
|
513
511
|
variant: "solid"
|
|
514
512
|
}
|
|
515
513
|
});
|
|
516
|
-
const AvatarFallback =
|
|
514
|
+
const AvatarFallback = react.memo((props) => {
|
|
517
515
|
const { ref, children, className, ...rest } = props;
|
|
518
|
-
const { variant } =
|
|
516
|
+
const { variant } = react.useContext(AvatarContext);
|
|
519
517
|
return /* @__PURE__ */ jsxRuntime.jsx(RadixAvatar__namespace.AvatarFallback, { className: classVarianceAuthority.cx(avatarFallback({ variant }), className), ref, ...rest, children });
|
|
520
518
|
});
|
|
521
519
|
AvatarFallback.displayName = "AvatarFallback";
|
|
522
|
-
const AvatarImage =
|
|
520
|
+
const AvatarImage = react.memo((props) => {
|
|
523
521
|
const { ref, className, ...rest } = props;
|
|
524
522
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
525
523
|
RadixAvatar__namespace.Image,
|
|
@@ -531,7 +529,7 @@
|
|
|
531
529
|
);
|
|
532
530
|
});
|
|
533
531
|
AvatarImage.displayName = "AvatarImage";
|
|
534
|
-
const AvatarRoot =
|
|
532
|
+
const AvatarRoot = react.memo((props) => {
|
|
535
533
|
const providerContext = useProvider();
|
|
536
534
|
const {
|
|
537
535
|
ref,
|
|
@@ -639,7 +637,7 @@
|
|
|
639
637
|
icon: false
|
|
640
638
|
}
|
|
641
639
|
});
|
|
642
|
-
const Badge =
|
|
640
|
+
const Badge = react.memo((props) => {
|
|
643
641
|
const providerContext = useProvider();
|
|
644
642
|
const {
|
|
645
643
|
ref,
|
|
@@ -684,7 +682,7 @@
|
|
|
684
682
|
variant: "surface"
|
|
685
683
|
}
|
|
686
684
|
});
|
|
687
|
-
const Card =
|
|
685
|
+
const Card = react.memo((props) => {
|
|
688
686
|
const providerContext = useProvider();
|
|
689
687
|
const {
|
|
690
688
|
ref,
|
|
@@ -708,7 +706,7 @@
|
|
|
708
706
|
);
|
|
709
707
|
});
|
|
710
708
|
Card.displayName = "Card";
|
|
711
|
-
const CheckboxIndicator =
|
|
709
|
+
const CheckboxIndicator = react.memo((props) => {
|
|
712
710
|
const { ref, children, className, ...rest } = props;
|
|
713
711
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
714
712
|
RadixCheckbox__namespace.CheckboxIndicator,
|
|
@@ -764,7 +762,7 @@
|
|
|
764
762
|
}
|
|
765
763
|
}
|
|
766
764
|
);
|
|
767
|
-
const CheckboxRoot =
|
|
765
|
+
const CheckboxRoot = react.memo((props) => {
|
|
768
766
|
const providerContext = useProvider();
|
|
769
767
|
const {
|
|
770
768
|
ref,
|
|
@@ -792,94 +790,18 @@
|
|
|
792
790
|
Root: CheckboxRoot,
|
|
793
791
|
Indicator: CheckboxIndicator
|
|
794
792
|
};
|
|
795
|
-
const SelectContext =
|
|
796
|
-
const MultiSelectContext =
|
|
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;
|
|
793
|
+
const SelectContext = react.createContext({});
|
|
794
|
+
const MultiSelectContext = react.createContext({});
|
|
873
795
|
const useViewportSize = (props) => {
|
|
874
796
|
const { xs: xsProps, sm: smProps, md: mdProps, lg: lgProps, xl: xlProps } = props;
|
|
875
|
-
const [prevSize, setPrevSize] =
|
|
876
|
-
const [size, setSize] =
|
|
797
|
+
const [prevSize, setPrevSize] = react.useState("initial");
|
|
798
|
+
const [size, setSize] = react.useState("initial");
|
|
877
799
|
const xs = reactResponsive.useMediaQuery({ minWidth: xsProps });
|
|
878
800
|
const sm = reactResponsive.useMediaQuery({ minWidth: smProps });
|
|
879
801
|
const md = reactResponsive.useMediaQuery({ minWidth: mdProps });
|
|
880
802
|
const lg = reactResponsive.useMediaQuery({ minWidth: lgProps });
|
|
881
803
|
const xl = reactResponsive.useMediaQuery({ minWidth: xlProps });
|
|
882
|
-
|
|
804
|
+
react.useLayoutEffect(() => {
|
|
883
805
|
setSize((prev) => {
|
|
884
806
|
setPrevSize(prev);
|
|
885
807
|
return xl ? "xl" : lg ? "lg" : md ? "md" : sm ? "sm" : xs ? "xs" : "initial";
|
|
@@ -887,69 +809,58 @@
|
|
|
887
809
|
}, [lg, md, sm, xl, xs]);
|
|
888
810
|
return { size, prevSize, xs, sm, md, lg, xl };
|
|
889
811
|
};
|
|
890
|
-
|
|
891
|
-
|
|
892
|
-
|
|
893
|
-
|
|
894
|
-
|
|
895
|
-
|
|
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]);
|
|
812
|
+
function useTextFilter(items, filterFunction) {
|
|
813
|
+
const [filteredOptions, setFilteredOptions] = react.useState([]);
|
|
814
|
+
const [filterValue, setFilterValue] = react.useState("");
|
|
815
|
+
react.useEffect(() => {
|
|
816
|
+
setFilteredOptions(items.filter((value) => filterFunction(value, filterValue)));
|
|
817
|
+
}, [filterFunction, filterValue, items]);
|
|
901
818
|
return [filteredOptions, filterValue, setFilterValue];
|
|
902
819
|
}
|
|
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;
|
|
917
820
|
function useControlledState(initialState, state, setState) {
|
|
918
|
-
const [uncontrolledState, setUncontrolledState] =
|
|
919
|
-
const handleStateChange =
|
|
821
|
+
const [uncontrolledState, setUncontrolledState] = react.useState(initialState);
|
|
822
|
+
const handleStateChange = react.useCallback(
|
|
920
823
|
(state2) => {
|
|
921
824
|
setUncontrolledState(state2);
|
|
922
825
|
setState == null ? void 0 : setState(state2);
|
|
923
826
|
},
|
|
924
827
|
[setState]
|
|
925
828
|
);
|
|
926
|
-
|
|
829
|
+
react.useEffect(() => {
|
|
927
830
|
if (state !== void 0) {
|
|
928
831
|
setUncontrolledState(state);
|
|
929
832
|
}
|
|
930
833
|
}, [state]);
|
|
931
834
|
return [state ?? uncontrolledState, handleStateChange];
|
|
932
835
|
}
|
|
836
|
+
function useFallbackId(id) {
|
|
837
|
+
const fallbackId = react.useId();
|
|
838
|
+
return id ?? fallbackId;
|
|
839
|
+
}
|
|
840
|
+
const genericMemo = react.memo;
|
|
933
841
|
function mergeRefs(refs) {
|
|
934
842
|
return (value) => {
|
|
935
|
-
const cleanups = refs.reduce(
|
|
936
|
-
|
|
937
|
-
|
|
938
|
-
|
|
939
|
-
|
|
940
|
-
|
|
843
|
+
const cleanups = refs.reduce(
|
|
844
|
+
(cleanups2, ref) => {
|
|
845
|
+
if (typeof ref === "function") {
|
|
846
|
+
const cleanup = ref(value);
|
|
847
|
+
if (typeof cleanup === "function") {
|
|
848
|
+
cleanups2.push(cleanup);
|
|
849
|
+
} else {
|
|
850
|
+
cleanups2.push(() => {
|
|
851
|
+
ref(null);
|
|
852
|
+
});
|
|
853
|
+
}
|
|
854
|
+
} else if (ref != null) {
|
|
855
|
+
ref.current = value;
|
|
941
856
|
cleanups2.push(() => {
|
|
942
|
-
ref
|
|
857
|
+
ref.current = null;
|
|
943
858
|
});
|
|
944
859
|
}
|
|
945
|
-
|
|
946
|
-
|
|
947
|
-
|
|
948
|
-
|
|
949
|
-
});
|
|
950
|
-
}
|
|
951
|
-
return cleanups2;
|
|
952
|
-
}, []);
|
|
860
|
+
return cleanups2;
|
|
861
|
+
},
|
|
862
|
+
[]
|
|
863
|
+
);
|
|
953
864
|
return () => {
|
|
954
865
|
cleanups.forEach((cleanup) => {
|
|
955
866
|
cleanup();
|
|
@@ -960,11 +871,26 @@
|
|
|
960
871
|
const stopPropagation = (e) => {
|
|
961
872
|
e.stopPropagation();
|
|
962
873
|
};
|
|
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
|
+
}
|
|
963
889
|
const MultiSelectProvider = genericMemo(function MultiSelectProvider2(props) {
|
|
964
890
|
const { children, defaultValues, values: controlledValues, onValuesChange } = props;
|
|
965
|
-
const [itemValueMapping, setItemValueMapping] =
|
|
891
|
+
const [itemValueMapping, setItemValueMapping] = react.useState(/* @__PURE__ */ new Set());
|
|
966
892
|
const [values, setValues] = useControlledState(defaultValues ?? [], controlledValues, onValuesChange);
|
|
967
|
-
const registerValue =
|
|
893
|
+
const registerValue = react.useCallback((value) => {
|
|
968
894
|
setItemValueMapping((prev) => {
|
|
969
895
|
const newSet = new Set(prev);
|
|
970
896
|
newSet.add(value);
|
|
@@ -978,8 +904,8 @@
|
|
|
978
904
|
});
|
|
979
905
|
};
|
|
980
906
|
}, []);
|
|
981
|
-
const selected =
|
|
982
|
-
const selectValue =
|
|
907
|
+
const selected = react.useCallback((value) => values.includes(value), [values]);
|
|
908
|
+
const selectValue = react.useCallback(
|
|
983
909
|
(value) => {
|
|
984
910
|
if (selected(value)) {
|
|
985
911
|
setValues(values.filter((v) => v !== value));
|
|
@@ -989,20 +915,20 @@
|
|
|
989
915
|
},
|
|
990
916
|
[selected, setValues, values]
|
|
991
917
|
);
|
|
992
|
-
const allSelected =
|
|
918
|
+
const allSelected = react.useMemo(() => {
|
|
993
919
|
return Array.from(itemValueMapping.values()).every((value) => values.includes(value));
|
|
994
920
|
}, [itemValueMapping, values]);
|
|
995
|
-
const someSelected =
|
|
921
|
+
const someSelected = react.useMemo(() => {
|
|
996
922
|
return Array.from(itemValueMapping.values()).some((value) => values.includes(value));
|
|
997
923
|
}, [itemValueMapping, values]);
|
|
998
|
-
const toggleSelectAll =
|
|
924
|
+
const toggleSelectAll = react.useCallback(() => {
|
|
999
925
|
if (allSelected) {
|
|
1000
926
|
setValues([]);
|
|
1001
927
|
} else {
|
|
1002
928
|
setValues(Array.from(itemValueMapping.values()));
|
|
1003
929
|
}
|
|
1004
930
|
}, [allSelected, itemValueMapping, setValues]);
|
|
1005
|
-
const contextValue =
|
|
931
|
+
const contextValue = react.useMemo(
|
|
1006
932
|
() => ({ selected, selectValue, allSelected, someSelected, toggleSelectAll, registerValue }),
|
|
1007
933
|
[allSelected, registerValue, selectValue, selected, someSelected, toggleSelectAll]
|
|
1008
934
|
);
|
|
@@ -1011,51 +937,51 @@
|
|
|
1011
937
|
const SingleSelectRequiredProvider = genericMemo(function SingleSelectRequiredProvider2(props) {
|
|
1012
938
|
const { children, defaultValue, value, onValueChange } = props;
|
|
1013
939
|
const [controlledValue, setControlledValue] = useControlledState(defaultValue, value, onValueChange);
|
|
1014
|
-
const selected =
|
|
1015
|
-
const selectValue =
|
|
940
|
+
const selected = react.useCallback((v) => v === controlledValue, [controlledValue]);
|
|
941
|
+
const selectValue = react.useCallback(
|
|
1016
942
|
(v) => {
|
|
1017
943
|
if (selected(v)) return;
|
|
1018
944
|
setControlledValue(v);
|
|
1019
945
|
},
|
|
1020
946
|
[selected, setControlledValue]
|
|
1021
947
|
);
|
|
1022
|
-
const contextValue =
|
|
948
|
+
const contextValue = react.useMemo(() => ({ selected, selectValue }), [selectValue, selected]);
|
|
1023
949
|
return /* @__PURE__ */ jsxRuntime.jsx(SelectContext, { value: contextValue, children });
|
|
1024
950
|
});
|
|
1025
951
|
const SingleSelectNotRequiredProvider = genericMemo(function SingleSelectNotRequiredProvider2(props) {
|
|
1026
952
|
const { children, defaultValue = void 0, value: controlledValue, onValueChange } = props;
|
|
1027
953
|
const [value, setValue] = useControlledState(defaultValue, controlledValue, onValueChange);
|
|
1028
|
-
const selected =
|
|
1029
|
-
const selectValue =
|
|
954
|
+
const selected = react.useCallback((v) => v === value, [value]);
|
|
955
|
+
const selectValue = react.useCallback(
|
|
1030
956
|
(v) => {
|
|
1031
957
|
setValue(selected(v) ? void 0 : v);
|
|
1032
958
|
},
|
|
1033
959
|
[selected, setValue]
|
|
1034
960
|
);
|
|
1035
|
-
const contextValue =
|
|
961
|
+
const contextValue = react.useMemo(() => ({ selected, selectValue }), [selected, selectValue]);
|
|
1036
962
|
return /* @__PURE__ */ jsxRuntime.jsx(SelectContext, { value: contextValue, children });
|
|
1037
963
|
});
|
|
1038
|
-
const CheckboxGroupContext =
|
|
1039
|
-
const CheckboxGroupItem =
|
|
1040
|
-
const groupContext =
|
|
964
|
+
const CheckboxGroupContext = react.createContext({});
|
|
965
|
+
const CheckboxGroupItem = react.memo((props) => {
|
|
966
|
+
const groupContext = react.use(CheckboxGroupContext);
|
|
1041
967
|
const {
|
|
1042
968
|
ref,
|
|
1043
969
|
className,
|
|
1044
970
|
value,
|
|
1045
|
-
accentColor,
|
|
1046
971
|
disabled,
|
|
972
|
+
accentColor = groupContext.accentColor,
|
|
1047
973
|
variant = groupContext.variant,
|
|
1048
974
|
size = groupContext.size,
|
|
1049
975
|
radius = groupContext.radius,
|
|
1050
976
|
...rest
|
|
1051
977
|
} = props;
|
|
1052
|
-
const { selected, selectValue, registerValue } =
|
|
1053
|
-
|
|
978
|
+
const { selected, selectValue, registerValue } = react.use(MultiSelectContext);
|
|
979
|
+
react.useLayoutEffect(() => {
|
|
1054
980
|
return registerValue(value);
|
|
1055
981
|
}, [registerValue, value]);
|
|
1056
982
|
const isChecked = selected(value);
|
|
1057
983
|
const isDisabled = groupContext.disabled || disabled;
|
|
1058
|
-
const handleCheckedChange =
|
|
984
|
+
const handleCheckedChange = react.useCallback(() => {
|
|
1059
985
|
selectValue(value);
|
|
1060
986
|
}, [selectValue, value]);
|
|
1061
987
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
@@ -1075,15 +1001,12 @@
|
|
|
1075
1001
|
);
|
|
1076
1002
|
});
|
|
1077
1003
|
CheckboxGroupItem.displayName = "CheckboxGroupItem";
|
|
1078
|
-
const CheckboxGroupItemIndicator =
|
|
1004
|
+
const CheckboxGroupItemIndicator = react.memo((props) => {
|
|
1079
1005
|
const { ref, className, ...rest } = props;
|
|
1080
1006
|
return /* @__PURE__ */ jsxRuntime.jsx(RadixCheckbox__namespace.Indicator, { className: classVarianceAuthority.cx("flex items-center justify-center", className), ref, ...rest });
|
|
1081
1007
|
});
|
|
1082
1008
|
CheckboxGroupItemIndicator.displayName = "CheckboxGroupItemIndicator";
|
|
1083
|
-
|
|
1084
|
-
return value ? "true" : "false";
|
|
1085
|
-
}
|
|
1086
|
-
const CheckboxGroupRoot = React.memo((props) => {
|
|
1009
|
+
const CheckboxGroupRoot = react.memo((props) => {
|
|
1087
1010
|
const providerContext = useProvider();
|
|
1088
1011
|
const {
|
|
1089
1012
|
ref,
|
|
@@ -1100,25 +1023,27 @@
|
|
|
1100
1023
|
size = "md",
|
|
1101
1024
|
...rest
|
|
1102
1025
|
} = props;
|
|
1103
|
-
const contextValue =
|
|
1026
|
+
const contextValue = react.useMemo(
|
|
1104
1027
|
() => ({
|
|
1105
1028
|
name,
|
|
1106
1029
|
required,
|
|
1107
1030
|
disabled,
|
|
1031
|
+
// style props
|
|
1032
|
+
accentColor,
|
|
1108
1033
|
size,
|
|
1109
1034
|
variant,
|
|
1110
1035
|
radius
|
|
1111
1036
|
}),
|
|
1112
|
-
[disabled, name, radius, required, size, variant]
|
|
1037
|
+
[accentColor, disabled, name, radius, required, size, variant]
|
|
1113
1038
|
);
|
|
1114
1039
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
1115
1040
|
"div",
|
|
1116
1041
|
{
|
|
1117
1042
|
ref,
|
|
1118
1043
|
role: "group",
|
|
1119
|
-
"data-disabled": getBooleanState
|
|
1044
|
+
"data-disabled": getBooleanState(!!disabled),
|
|
1120
1045
|
"data-accent-color": accentColor,
|
|
1121
|
-
"aria-disabled": getBooleanState
|
|
1046
|
+
"aria-disabled": getBooleanState(!!disabled),
|
|
1122
1047
|
...rest,
|
|
1123
1048
|
children: /* @__PURE__ */ jsxRuntime.jsx(CheckboxGroupContext.Provider, { value: contextValue, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
1124
1049
|
MultiSelectProvider,
|
|
@@ -1133,19 +1058,19 @@
|
|
|
1133
1058
|
);
|
|
1134
1059
|
});
|
|
1135
1060
|
CheckboxGroupRoot.displayName = "CheckboxGroupRoot";
|
|
1136
|
-
const CheckboxGroupSelectAllItem =
|
|
1137
|
-
const groupContext =
|
|
1061
|
+
const CheckboxGroupSelectAllItem = react.memo((props) => {
|
|
1062
|
+
const groupContext = react.use(CheckboxGroupContext);
|
|
1138
1063
|
const {
|
|
1139
1064
|
ref,
|
|
1140
1065
|
className,
|
|
1141
|
-
accentColor,
|
|
1142
1066
|
disabled,
|
|
1067
|
+
accentColor = groupContext.accentColor,
|
|
1143
1068
|
variant = groupContext.variant,
|
|
1144
1069
|
size = groupContext.size,
|
|
1145
1070
|
radius = groupContext.radius,
|
|
1146
1071
|
...rest
|
|
1147
1072
|
} = props;
|
|
1148
|
-
const { allSelected, someSelected, toggleSelectAll } =
|
|
1073
|
+
const { allSelected, someSelected, toggleSelectAll } = react.use(MultiSelectContext);
|
|
1149
1074
|
const checked = allSelected ? true : someSelected ? "indeterminate" : false;
|
|
1150
1075
|
const isDisabled = groupContext.disabled || disabled;
|
|
1151
1076
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
@@ -1170,137 +1095,39 @@
|
|
|
1170
1095
|
SelectAllItem: CheckboxGroupSelectAllItem,
|
|
1171
1096
|
ItemIndicator: CheckboxGroupItemIndicator
|
|
1172
1097
|
};
|
|
1173
|
-
const
|
|
1174
|
-
|
|
1175
|
-
|
|
1176
|
-
|
|
1177
|
-
|
|
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]);
|
|
1098
|
+
const CheckedIndicatorContext = react.createContext({});
|
|
1099
|
+
const CheckedIndicator = react.memo((props) => {
|
|
1100
|
+
const { children, ref, className, ...rest } = props;
|
|
1101
|
+
const checked = react.useContext(CheckedIndicatorContext);
|
|
1102
|
+
const computedChildren = typeof children === "function" ? children(checked) : children;
|
|
1286
1103
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
1287
1104
|
"span",
|
|
1288
1105
|
{
|
|
1289
1106
|
ref,
|
|
1290
|
-
"data-state": getCheckedState$1(checkedState),
|
|
1291
1107
|
className: classVarianceAuthority.cx(
|
|
1292
|
-
"
|
|
1108
|
+
"flex size-max items-center",
|
|
1293
1109
|
{
|
|
1294
|
-
invisible:
|
|
1110
|
+
invisible: checked === false
|
|
1295
1111
|
},
|
|
1296
1112
|
className
|
|
1297
1113
|
),
|
|
1114
|
+
"data-state": getCheckedState(checked),
|
|
1298
1115
|
...rest,
|
|
1299
1116
|
children: computedChildren
|
|
1300
1117
|
}
|
|
1301
1118
|
);
|
|
1302
1119
|
});
|
|
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
|
+
});
|
|
1303
1125
|
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({});
|
|
1304
1131
|
const commandMenuContentCva = classVarianceAuthority.cva(
|
|
1305
1132
|
[
|
|
1306
1133
|
"ring",
|
|
@@ -1509,11 +1336,11 @@
|
|
|
1509
1336
|
}
|
|
1510
1337
|
}
|
|
1511
1338
|
);
|
|
1512
|
-
const CommandMenuItem =
|
|
1339
|
+
const CommandMenuItem = react.memo((props) => {
|
|
1513
1340
|
const { className, ref, closeOnSelect = true, onSelect, filterValue, ...rest } = props;
|
|
1514
|
-
const { size, variant, radius } =
|
|
1515
|
-
const { setOpen } =
|
|
1516
|
-
const handleSelect =
|
|
1341
|
+
const { size, variant, radius } = react.use(CommandMenuContext);
|
|
1342
|
+
const { setOpen } = react.use(CommandMenuDialogContext);
|
|
1343
|
+
const handleSelect = react.useCallback(() => {
|
|
1517
1344
|
onSelect == null ? void 0 : onSelect();
|
|
1518
1345
|
if (closeOnSelect) {
|
|
1519
1346
|
setOpen(false);
|
|
@@ -1531,16 +1358,16 @@
|
|
|
1531
1358
|
);
|
|
1532
1359
|
});
|
|
1533
1360
|
CommandMenuItem.displayName = "CommandMenuItem";
|
|
1534
|
-
const CommandMenuCheckboxItem =
|
|
1361
|
+
const CommandMenuCheckboxItem = react.memo((props) => {
|
|
1535
1362
|
const { children, ref, checked, onCheckedChange, onSelect, ...rest } = props;
|
|
1536
|
-
const handleSelect =
|
|
1363
|
+
const handleSelect = react.useCallback(() => {
|
|
1537
1364
|
onSelect == null ? void 0 : onSelect();
|
|
1538
1365
|
onCheckedChange(checked !== true);
|
|
1539
1366
|
}, [checked, onCheckedChange, onSelect]);
|
|
1540
|
-
return /* @__PURE__ */ jsxRuntime.jsx(CheckboxIndicatorContext, { value: checked, children: /* @__PURE__ */ jsxRuntime.jsx(CommandMenuItem, { ref, onSelect: handleSelect, "data-state": getCheckedState
|
|
1367
|
+
return /* @__PURE__ */ jsxRuntime.jsx(CheckboxIndicatorContext, { value: checked, children: /* @__PURE__ */ jsxRuntime.jsx(CommandMenuItem, { ref, onSelect: handleSelect, "data-state": getCheckedState(checked), ...rest, children }) });
|
|
1541
1368
|
});
|
|
1542
1369
|
CommandMenuCheckboxItem.displayName = "CommandMenuCheckboxItem";
|
|
1543
|
-
const CommandMenuContent =
|
|
1370
|
+
const CommandMenuContent = react.memo((props) => {
|
|
1544
1371
|
const providerContext = useProvider();
|
|
1545
1372
|
const {
|
|
1546
1373
|
children,
|
|
@@ -1560,13 +1387,14 @@
|
|
|
1560
1387
|
radius = providerContext.radius,
|
|
1561
1388
|
...rest
|
|
1562
1389
|
} = props;
|
|
1563
|
-
const contextValue =
|
|
1390
|
+
const contextValue = react.useMemo(() => {
|
|
1564
1391
|
return {
|
|
1565
1392
|
variant,
|
|
1566
1393
|
size,
|
|
1567
|
-
radius
|
|
1394
|
+
radius,
|
|
1395
|
+
accentColor
|
|
1568
1396
|
};
|
|
1569
|
-
}, [radius, size, variant]);
|
|
1397
|
+
}, [accentColor, radius, size, variant]);
|
|
1570
1398
|
return /* @__PURE__ */ jsxRuntime.jsx(RadixDialog.DialogPortal, { children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
1571
1399
|
RadixDialog.DialogContent,
|
|
1572
1400
|
{
|
|
@@ -1596,27 +1424,27 @@
|
|
|
1596
1424
|
) });
|
|
1597
1425
|
});
|
|
1598
1426
|
CommandMenuContent.displayName = "CommandMenuContent";
|
|
1599
|
-
const CommandMenuEmpty =
|
|
1427
|
+
const CommandMenuEmpty = react.memo((props) => {
|
|
1600
1428
|
const { className, ref, ...rest } = props;
|
|
1601
|
-
const { size } =
|
|
1429
|
+
const { size } = react.use(CommandMenuContext);
|
|
1602
1430
|
return /* @__PURE__ */ jsxRuntime.jsx(cmdk.CommandEmpty, { className: classVarianceAuthority.cx(commandMenuEmptyCva({ size }), className), ref, ...rest });
|
|
1603
1431
|
});
|
|
1604
1432
|
CommandMenuEmpty.displayName = "CommandMenuEmpty";
|
|
1605
|
-
const CommandMenuGroup =
|
|
1433
|
+
const CommandMenuGroup = react.memo((props) => {
|
|
1606
1434
|
const { className, ref, ...rest } = props;
|
|
1607
|
-
const { size } =
|
|
1435
|
+
const { size } = react.use(CommandMenuContext);
|
|
1608
1436
|
return /* @__PURE__ */ jsxRuntime.jsx(cmdk.CommandGroup, { className: classVarianceAuthority.cx(commandMenuGroupCva({ size }), className), ref, ...rest });
|
|
1609
1437
|
});
|
|
1610
1438
|
CommandMenuGroup.displayName = "CommandMenuGroup";
|
|
1611
|
-
const CommandMenuInput =
|
|
1439
|
+
const CommandMenuInput = react.memo((props) => {
|
|
1612
1440
|
const { className, ref, ...rest } = props;
|
|
1613
|
-
const { size } =
|
|
1441
|
+
const { size } = react.use(CommandMenuContext);
|
|
1614
1442
|
return /* @__PURE__ */ jsxRuntime.jsx(cmdk.CommandInput, { className: classVarianceAuthority.cx(commandMenuInputCva({ size }), className), ref, ...rest });
|
|
1615
1443
|
});
|
|
1616
1444
|
CommandMenuInput.displayName = "CommandMenuInput";
|
|
1617
|
-
const CommandMenuList =
|
|
1445
|
+
const CommandMenuList = react.memo((props) => {
|
|
1618
1446
|
const { className, ref, ...rest } = props;
|
|
1619
|
-
const { size } =
|
|
1447
|
+
const { size } = react.use(CommandMenuContext);
|
|
1620
1448
|
const filterCount = cmdk.useCommandState((state) => state.filtered.count);
|
|
1621
1449
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
1622
1450
|
cmdk.CommandList,
|
|
@@ -1639,11 +1467,11 @@
|
|
|
1639
1467
|
selected,
|
|
1640
1468
|
selectValue: handleSelectValue,
|
|
1641
1469
|
registerValue
|
|
1642
|
-
} =
|
|
1643
|
-
|
|
1470
|
+
} = react.use(MultiSelectContext);
|
|
1471
|
+
react.useLayoutEffect(() => {
|
|
1644
1472
|
return registerValue(value);
|
|
1645
1473
|
}, [registerValue, value]);
|
|
1646
|
-
const handleSelect =
|
|
1474
|
+
const handleSelect = react.useCallback(() => {
|
|
1647
1475
|
onSelect == null ? void 0 : onSelect();
|
|
1648
1476
|
handleSelectValue(value);
|
|
1649
1477
|
}, [handleSelectValue, onSelect, value]);
|
|
@@ -1653,7 +1481,7 @@
|
|
|
1653
1481
|
{
|
|
1654
1482
|
ref,
|
|
1655
1483
|
onSelect: handleSelect,
|
|
1656
|
-
"data-state": getSelectedState
|
|
1484
|
+
"data-state": getSelectedState(isSelected),
|
|
1657
1485
|
"aria-selected": isSelected,
|
|
1658
1486
|
closeOnSelect,
|
|
1659
1487
|
...rest,
|
|
@@ -1661,29 +1489,29 @@
|
|
|
1661
1489
|
}
|
|
1662
1490
|
) });
|
|
1663
1491
|
});
|
|
1664
|
-
const CommandMenuOverlay =
|
|
1492
|
+
const CommandMenuOverlay = react.memo((props) => {
|
|
1665
1493
|
const { container, className, ...rest } = props;
|
|
1666
1494
|
return /* @__PURE__ */ jsxRuntime.jsx(RadixDialog.DialogPortal, { container, children: /* @__PURE__ */ jsxRuntime.jsx(RadixDialog.DialogOverlay, { className: classVarianceAuthority.cx(commandMenuOverlayCva(), className), "data-floating-content": "", ...rest }) });
|
|
1667
1495
|
});
|
|
1668
1496
|
CommandMenuOverlay.displayName = "CommandMenuOverlay";
|
|
1669
|
-
const CommandMenuPage =
|
|
1497
|
+
const CommandMenuPage = react.memo((props) => {
|
|
1670
1498
|
const { children, ref, page, ...rest } = props;
|
|
1671
|
-
const { page: activePage } =
|
|
1672
|
-
const isActive =
|
|
1499
|
+
const { page: activePage } = react.use(CommandMenuPageContext);
|
|
1500
|
+
const isActive = react.useMemo(() => page === activePage, [page, activePage]);
|
|
1673
1501
|
return /* @__PURE__ */ jsxRuntime.jsx("div", { ref, "data-active": getActiveState(isActive), hidden: !isActive, ...rest, children: isActive ? children : null });
|
|
1674
1502
|
});
|
|
1675
1503
|
CommandMenuPage.displayName = "CommandMenuPage";
|
|
1676
|
-
const CommandMenuPages =
|
|
1504
|
+
const CommandMenuPages = react.memo((props) => {
|
|
1677
1505
|
const { children, defaultPage = "", page: controlledPage, onPageChange } = props;
|
|
1678
1506
|
const [page, setPage] = useControlledState(defaultPage, controlledPage, onPageChange);
|
|
1679
1507
|
return /* @__PURE__ */ jsxRuntime.jsx(CommandMenuPageContext, { value: { page, setPage }, children });
|
|
1680
1508
|
});
|
|
1681
1509
|
CommandMenuPages.displayName = "CommandMenuPages";
|
|
1682
|
-
const CommandMenuPageTriggerItem =
|
|
1510
|
+
const CommandMenuPageTriggerItem = react.memo((props) => {
|
|
1683
1511
|
const { ref, page, onSelect, closeOnSelect = false, ...rest } = props;
|
|
1684
|
-
const { page: activePage, setPage } =
|
|
1685
|
-
const isActive =
|
|
1686
|
-
const handleSelect =
|
|
1512
|
+
const { page: activePage, setPage } = react.use(CommandMenuPageContext);
|
|
1513
|
+
const isActive = react.useMemo(() => page === activePage, [page, activePage]);
|
|
1514
|
+
const handleSelect = react.useCallback(() => {
|
|
1687
1515
|
onSelect == null ? void 0 : onSelect();
|
|
1688
1516
|
setPage(page);
|
|
1689
1517
|
}, [onSelect, page, setPage]);
|
|
@@ -1721,18 +1549,18 @@
|
|
|
1721
1549
|
});
|
|
1722
1550
|
const CommandMenuRadioItem = genericMemo(function(props) {
|
|
1723
1551
|
const { children, ref, value, onSelect, ...rest } = props;
|
|
1724
|
-
const { selected, selectValue } =
|
|
1725
|
-
const handleSelect =
|
|
1552
|
+
const { selected, selectValue } = react.use(SelectContext);
|
|
1553
|
+
const handleSelect = react.useCallback(() => {
|
|
1726
1554
|
onSelect == null ? void 0 : onSelect();
|
|
1727
1555
|
selectValue(value);
|
|
1728
1556
|
}, [onSelect, selectValue, value]);
|
|
1729
1557
|
const isSelected = selected(value);
|
|
1730
|
-
return /* @__PURE__ */ jsxRuntime.jsx(SelectedIndicatorContext$1, { value: isSelected, children: /* @__PURE__ */ jsxRuntime.jsx(CommandMenuItem, { ref, onSelect: handleSelect, "data-state": getSelectedState
|
|
1558
|
+
return /* @__PURE__ */ jsxRuntime.jsx(SelectedIndicatorContext$1, { value: isSelected, children: /* @__PURE__ */ jsxRuntime.jsx(CommandMenuItem, { ref, onSelect: handleSelect, "data-state": getSelectedState(isSelected), ...rest, children }) });
|
|
1731
1559
|
});
|
|
1732
|
-
const CommandMenuRoot =
|
|
1560
|
+
const CommandMenuRoot = react.memo((props) => {
|
|
1733
1561
|
const { children, defaultOpen, open: controlledOpen, onOpenChange, modal } = props;
|
|
1734
1562
|
const [open, setOpen] = useControlledState(defaultOpen ?? false, controlledOpen, onOpenChange);
|
|
1735
|
-
const contextValue =
|
|
1563
|
+
const contextValue = react.useMemo(() => {
|
|
1736
1564
|
return {
|
|
1737
1565
|
open,
|
|
1738
1566
|
setOpen
|
|
@@ -1743,8 +1571,8 @@
|
|
|
1743
1571
|
CommandMenuRoot.displayName = "CommandMenuRoot";
|
|
1744
1572
|
const CommandMenuSelectAllItem = genericMemo(function(props) {
|
|
1745
1573
|
const { ref, onSelect, closeOnSelect = false, ...rest } = props;
|
|
1746
|
-
const { allSelected, someSelected, toggleSelectAll } =
|
|
1747
|
-
const handleSelect =
|
|
1574
|
+
const { allSelected, someSelected, toggleSelectAll } = react.use(MultiSelectContext);
|
|
1575
|
+
const handleSelect = react.useCallback(() => {
|
|
1748
1576
|
onSelect == null ? void 0 : onSelect();
|
|
1749
1577
|
toggleSelectAll();
|
|
1750
1578
|
}, [onSelect, toggleSelectAll]);
|
|
@@ -1755,43 +1583,47 @@
|
|
|
1755
1583
|
ref,
|
|
1756
1584
|
role: "menuitemcheckbox",
|
|
1757
1585
|
onSelect: handleSelect,
|
|
1758
|
-
"data-state": getCheckedState
|
|
1586
|
+
"data-state": getCheckedState(selectedState),
|
|
1759
1587
|
closeOnSelect,
|
|
1760
1588
|
...rest
|
|
1761
1589
|
}
|
|
1762
1590
|
) });
|
|
1763
1591
|
});
|
|
1764
|
-
const
|
|
1765
|
-
|
|
1766
|
-
const
|
|
1767
|
-
const
|
|
1768
|
-
|
|
1769
|
-
}, [isSelected, children]);
|
|
1592
|
+
const SelectedIndicatorContext = react.createContext(false);
|
|
1593
|
+
const SelectedIndicator = react.memo((props) => {
|
|
1594
|
+
const { ref, children, className, ...rest } = props;
|
|
1595
|
+
const isSelected = react.use(SelectedIndicatorContext);
|
|
1596
|
+
const computedChildren = typeof children === "function" ? children(isSelected) : children;
|
|
1770
1597
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
1771
1598
|
"span",
|
|
1772
1599
|
{
|
|
1773
1600
|
ref,
|
|
1774
|
-
"data-state": getSelectedState$1(isSelected),
|
|
1775
1601
|
className: classVarianceAuthority.cx(
|
|
1776
|
-
"
|
|
1602
|
+
"flex size-max items-center",
|
|
1777
1603
|
{
|
|
1778
1604
|
invisible: !isSelected
|
|
1779
1605
|
},
|
|
1780
1606
|
className
|
|
1781
1607
|
),
|
|
1608
|
+
"data-state": getSelectedState(isSelected),
|
|
1782
1609
|
...rest,
|
|
1783
1610
|
children: computedChildren
|
|
1784
1611
|
}
|
|
1785
1612
|
);
|
|
1786
1613
|
});
|
|
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
|
+
});
|
|
1787
1619
|
CommandMenuSelectedIndicator.displayName = "CommandMenuSelectedIndicator";
|
|
1788
|
-
const CommandMenuSeparator =
|
|
1620
|
+
const CommandMenuSeparator = react.memo((props) => {
|
|
1789
1621
|
const { className, ref, spacing = false, ...rest } = props;
|
|
1790
|
-
const { size } =
|
|
1622
|
+
const { size } = react.use(CommandMenuContext);
|
|
1791
1623
|
return /* @__PURE__ */ jsxRuntime.jsx(cmdk.CommandSeparator, { ref, className: classVarianceAuthority.cx(commandMenuSeparatorCva({ size, spacing }), className), ...rest });
|
|
1792
1624
|
});
|
|
1793
1625
|
CommandMenuSeparator.displayName = "CommandMenuSeparator";
|
|
1794
|
-
const CommandMenuTrigger =
|
|
1626
|
+
const CommandMenuTrigger = react.memo((props) => {
|
|
1795
1627
|
return /* @__PURE__ */ jsxRuntime.jsx(RadixDialog.DialogTrigger, { ...props });
|
|
1796
1628
|
});
|
|
1797
1629
|
CommandMenuTrigger.displayName = "CommandMenuTrigger";
|
|
@@ -1822,22 +1654,22 @@
|
|
|
1822
1654
|
Page: CommandMenuPage,
|
|
1823
1655
|
PageTriggerItem: CommandMenuPageTriggerItem
|
|
1824
1656
|
};
|
|
1825
|
-
const LuIcon =
|
|
1826
|
-
const { ref, icon, className, size = "1em", ...rest } = props;
|
|
1827
|
-
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
1657
|
+
const LuIcon = react.memo((props) => {
|
|
1658
|
+
const { ref, icon: Icon, className, size = "1em", ...rest } = props;
|
|
1659
|
+
return /* @__PURE__ */ jsxRuntime.jsx(Icon, { ref, className: classVarianceAuthority.cx("shrink-0", className), size, ...rest });
|
|
1828
1660
|
});
|
|
1829
1661
|
LuIcon.displayName = "LuIcon";
|
|
1830
1662
|
const Chevron = (props) => {
|
|
1831
1663
|
const { orientation, ...rest } = props;
|
|
1832
1664
|
switch (orientation) {
|
|
1833
1665
|
case "up":
|
|
1834
|
-
return /* @__PURE__ */ jsxRuntime.jsx(LuIcon, { icon:
|
|
1666
|
+
return /* @__PURE__ */ jsxRuntime.jsx(LuIcon, { icon: lucideReact.ChevronUp, ...rest });
|
|
1835
1667
|
case "down":
|
|
1836
|
-
return /* @__PURE__ */ jsxRuntime.jsx(LuIcon, { icon:
|
|
1668
|
+
return /* @__PURE__ */ jsxRuntime.jsx(LuIcon, { icon: lucideReact.ChevronDown, ...rest });
|
|
1837
1669
|
case "left":
|
|
1838
|
-
return /* @__PURE__ */ jsxRuntime.jsx(LuIcon, { icon:
|
|
1670
|
+
return /* @__PURE__ */ jsxRuntime.jsx(LuIcon, { icon: lucideReact.ChevronLeft, ...rest });
|
|
1839
1671
|
default:
|
|
1840
|
-
return /* @__PURE__ */ jsxRuntime.jsx(LuIcon, { icon:
|
|
1672
|
+
return /* @__PURE__ */ jsxRuntime.jsx(LuIcon, { icon: lucideReact.ChevronRight, ...rest });
|
|
1841
1673
|
}
|
|
1842
1674
|
};
|
|
1843
1675
|
const rootCva = classVarianceAuthority.cva(["relative", "size-max"], {
|
|
@@ -1978,7 +1810,7 @@
|
|
|
1978
1810
|
}
|
|
1979
1811
|
}
|
|
1980
1812
|
});
|
|
1981
|
-
const DayPicker =
|
|
1813
|
+
const DayPicker = react.memo((props) => {
|
|
1982
1814
|
const providerContext = useProvider();
|
|
1983
1815
|
const {
|
|
1984
1816
|
components,
|
|
@@ -1990,7 +1822,7 @@
|
|
|
1990
1822
|
showOutsideDays = true,
|
|
1991
1823
|
...rest
|
|
1992
1824
|
} = props;
|
|
1993
|
-
const computedClassNames =
|
|
1825
|
+
const computedClassNames = react.useMemo(() => {
|
|
1994
1826
|
return {
|
|
1995
1827
|
...classNames,
|
|
1996
1828
|
root: classVarianceAuthority.cx(classNames == null ? void 0 : classNames.root, rootCva({ size })),
|
|
@@ -2020,7 +1852,7 @@
|
|
|
2020
1852
|
range_end: classVarianceAuthority.cx(classNames == null ? void 0 : classNames.range_end, "rdp-range-end")
|
|
2021
1853
|
};
|
|
2022
1854
|
}, [classNames, radius, size, variant]);
|
|
2023
|
-
const computedComponents =
|
|
1855
|
+
const computedComponents = react.useMemo(() => {
|
|
2024
1856
|
return {
|
|
2025
1857
|
...components,
|
|
2026
1858
|
Chevron
|
|
@@ -2038,19 +1870,19 @@
|
|
|
2038
1870
|
);
|
|
2039
1871
|
});
|
|
2040
1872
|
DayPicker.displayName = "DayPicker";
|
|
2041
|
-
const CloseDialogContext =
|
|
1873
|
+
const CloseDialogContext = react.createContext({});
|
|
2042
1874
|
const useCloseDialog = () => {
|
|
2043
|
-
const dialogContext =
|
|
1875
|
+
const dialogContext = react.useContext(CloseDialogContext);
|
|
2044
1876
|
if (!dialogContext) {
|
|
2045
1877
|
throw new Error("useDialog must be used within a DialogRoot");
|
|
2046
1878
|
}
|
|
2047
1879
|
return dialogContext;
|
|
2048
1880
|
};
|
|
2049
|
-
const DialogContent =
|
|
1881
|
+
const DialogContent = react.memo((props) => {
|
|
2050
1882
|
const { radius } = useProvider();
|
|
2051
1883
|
const close = useCloseDialog();
|
|
2052
1884
|
const { ref, children, container, className, size, ...rest } = props;
|
|
2053
|
-
const computedChildren =
|
|
1885
|
+
const computedChildren = react.useMemo(() => {
|
|
2054
1886
|
return typeof children === "function" ? children(close) : children;
|
|
2055
1887
|
}, [children, close]);
|
|
2056
1888
|
return /* @__PURE__ */ jsxRuntime.jsx(RadixDialog__namespace.Portal, { container, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
@@ -2065,7 +1897,7 @@
|
|
|
2065
1897
|
) });
|
|
2066
1898
|
});
|
|
2067
1899
|
DialogContent.displayName = "DialogContent";
|
|
2068
|
-
const DialogOverlay =
|
|
1900
|
+
const DialogOverlay = react.memo((props) => {
|
|
2069
1901
|
const { ref, children, className, container, ...rest } = props;
|
|
2070
1902
|
return /* @__PURE__ */ jsxRuntime.jsx(RadixDialog__namespace.Portal, { container, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
2071
1903
|
RadixDialog__namespace.Overlay,
|
|
@@ -2079,7 +1911,7 @@
|
|
|
2079
1911
|
) });
|
|
2080
1912
|
});
|
|
2081
1913
|
DialogOverlay.displayName = "DialogOverlay";
|
|
2082
|
-
const DialogRoot =
|
|
1914
|
+
const DialogRoot = react.memo((props) => {
|
|
2083
1915
|
const {
|
|
2084
1916
|
children,
|
|
2085
1917
|
onOpen,
|
|
@@ -2089,9 +1921,9 @@
|
|
|
2089
1921
|
open: externalOpen,
|
|
2090
1922
|
onOpenChange: externalOpenChange
|
|
2091
1923
|
} = props;
|
|
2092
|
-
const [innerOpen, setInnerOpen] =
|
|
1924
|
+
const [innerOpen, setInnerOpen] = react.useState(defaultOpen ?? false);
|
|
2093
1925
|
const open = externalOpen ?? innerOpen;
|
|
2094
|
-
const handleOpenChange =
|
|
1926
|
+
const handleOpenChange = react.useCallback(
|
|
2095
1927
|
(next) => {
|
|
2096
1928
|
if (externalOpenChange) return externalOpenChange(next);
|
|
2097
1929
|
if (next && onOpen) {
|
|
@@ -2109,7 +1941,7 @@
|
|
|
2109
1941
|
},
|
|
2110
1942
|
[externalOpenChange, onOpen, onClose, onCloseInterrupt]
|
|
2111
1943
|
);
|
|
2112
|
-
const closeDialog =
|
|
1944
|
+
const closeDialog = react.useCallback(
|
|
2113
1945
|
(options) => {
|
|
2114
1946
|
if (options == null ? void 0 : options.force) {
|
|
2115
1947
|
return setInnerOpen(false);
|
|
@@ -2168,7 +2000,7 @@
|
|
|
2168
2000
|
}
|
|
2169
2001
|
}
|
|
2170
2002
|
});
|
|
2171
|
-
const Heading =
|
|
2003
|
+
const Heading = react.memo((props) => {
|
|
2172
2004
|
const {
|
|
2173
2005
|
ref,
|
|
2174
2006
|
children,
|
|
@@ -2201,7 +2033,7 @@
|
|
|
2201
2033
|
);
|
|
2202
2034
|
});
|
|
2203
2035
|
Heading.displayName = "Heading";
|
|
2204
|
-
const HoverCardArrow =
|
|
2036
|
+
const HoverCardArrow = react.memo((props) => {
|
|
2205
2037
|
const { ref, children, className, ...rest } = props;
|
|
2206
2038
|
return /* @__PURE__ */ jsxRuntime.jsx(RadixHoverCard__namespace.Arrow, { className: classVarianceAuthority.cx("fill-(--base-6)", className), ref, ...rest, children });
|
|
2207
2039
|
});
|
|
@@ -2220,7 +2052,7 @@
|
|
|
2220
2052
|
size: "md"
|
|
2221
2053
|
}
|
|
2222
2054
|
});
|
|
2223
|
-
const HoverCardContent =
|
|
2055
|
+
const HoverCardContent = react.memo((props) => {
|
|
2224
2056
|
const providerContext = useProvider();
|
|
2225
2057
|
const {
|
|
2226
2058
|
ref,
|
|
@@ -2260,12 +2092,12 @@
|
|
|
2260
2092
|
Root: RadixHoverCard__namespace.Root,
|
|
2261
2093
|
Trigger: RadixHoverCard__namespace.Trigger
|
|
2262
2094
|
};
|
|
2263
|
-
const HoverUtility =
|
|
2264
|
-
const [isHovered, setIsHovered] =
|
|
2265
|
-
const handlePointerEnter =
|
|
2095
|
+
const HoverUtility = react.memo(({ children, forceHover }) => {
|
|
2096
|
+
const [isHovered, setIsHovered] = react.useState(false);
|
|
2097
|
+
const handlePointerEnter = react.useCallback(() => {
|
|
2266
2098
|
setIsHovered(true);
|
|
2267
2099
|
}, []);
|
|
2268
|
-
const handlePointerLeave =
|
|
2100
|
+
const handlePointerLeave = react.useCallback(() => {
|
|
2269
2101
|
setIsHovered(false);
|
|
2270
2102
|
}, []);
|
|
2271
2103
|
return children({
|
|
@@ -2274,7 +2106,8 @@
|
|
|
2274
2106
|
onPointerLeave: handlePointerLeave
|
|
2275
2107
|
});
|
|
2276
2108
|
});
|
|
2277
|
-
|
|
2109
|
+
HoverUtility.displayName = "HoverUtility";
|
|
2110
|
+
const InputContext = react.createContext({});
|
|
2278
2111
|
const inputRoot$1 = classVarianceAuthority.cva(
|
|
2279
2112
|
[
|
|
2280
2113
|
"flex",
|
|
@@ -2349,9 +2182,9 @@
|
|
|
2349
2182
|
size: "md"
|
|
2350
2183
|
}
|
|
2351
2184
|
});
|
|
2352
|
-
const InputField =
|
|
2185
|
+
const InputField = react.memo((props) => {
|
|
2353
2186
|
const { ref, children, className, ...rest } = props;
|
|
2354
|
-
const { size, variant } =
|
|
2187
|
+
const { size, variant } = react.useContext(InputContext);
|
|
2355
2188
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
2356
2189
|
"input",
|
|
2357
2190
|
{
|
|
@@ -2363,7 +2196,7 @@
|
|
|
2363
2196
|
);
|
|
2364
2197
|
});
|
|
2365
2198
|
InputField.displayName = "InputField";
|
|
2366
|
-
const InputRoot =
|
|
2199
|
+
const InputRoot = react.memo((props) => {
|
|
2367
2200
|
const providerContext = useProvider();
|
|
2368
2201
|
const {
|
|
2369
2202
|
ref,
|
|
@@ -2387,9 +2220,9 @@
|
|
|
2387
2220
|
) });
|
|
2388
2221
|
});
|
|
2389
2222
|
InputRoot.displayName = "InputRoot";
|
|
2390
|
-
const InputSlot =
|
|
2223
|
+
const InputSlot = react.memo((props) => {
|
|
2391
2224
|
const { ref, children, className, ...rest } = props;
|
|
2392
|
-
const { size, variant } =
|
|
2225
|
+
const { size, variant } = react.useContext(InputContext);
|
|
2393
2226
|
return /* @__PURE__ */ jsxRuntime.jsx("div", { className: classVarianceAuthority.cx(inputSlot({ size, variant }), "flex items-center", className), ref, ...rest, children });
|
|
2394
2227
|
});
|
|
2395
2228
|
InputSlot.displayName = "InputSlot";
|
|
@@ -2398,27 +2231,27 @@
|
|
|
2398
2231
|
Root: InputRoot,
|
|
2399
2232
|
Slot: InputSlot
|
|
2400
2233
|
};
|
|
2401
|
-
const LayoutContext =
|
|
2402
|
-
const useLayoutContext = () =>
|
|
2403
|
-
const LayoutContainer =
|
|
2404
|
-
const { ref, children,
|
|
2234
|
+
const LayoutContext = react.createContext({});
|
|
2235
|
+
const useLayoutContext = () => react.useContext(LayoutContext);
|
|
2236
|
+
const LayoutContainer = react.memo((props) => {
|
|
2237
|
+
const { ref, children, ...rest } = props;
|
|
2405
2238
|
const { hideLayout = false } = useLayoutContext();
|
|
2406
|
-
return !hideLayout && /* @__PURE__ */ jsxRuntime.jsx("div", {
|
|
2239
|
+
return !hideLayout && /* @__PURE__ */ jsxRuntime.jsx("div", { ref, ...rest, children });
|
|
2407
2240
|
});
|
|
2408
2241
|
LayoutContainer.displayName = "LayoutContainer";
|
|
2409
|
-
const LayoutRoot =
|
|
2242
|
+
const LayoutRoot = react.memo((props) => {
|
|
2410
2243
|
const { children, small = false, hideLayout = false } = props;
|
|
2411
|
-
const [openMapping, setOpenMapping] =
|
|
2412
|
-
const isOpen =
|
|
2244
|
+
const [openMapping, setOpenMapping] = react.useState({});
|
|
2245
|
+
const isOpen = react.useCallback(
|
|
2413
2246
|
(id) => {
|
|
2414
2247
|
return openMapping[id] ?? false;
|
|
2415
2248
|
},
|
|
2416
2249
|
[openMapping]
|
|
2417
2250
|
);
|
|
2418
|
-
const setOpen =
|
|
2251
|
+
const setOpen = react.useCallback((id, open) => {
|
|
2419
2252
|
setOpenMapping((prev) => ({ ...prev, [id]: open }));
|
|
2420
2253
|
}, []);
|
|
2421
|
-
const contextValue =
|
|
2254
|
+
const contextValue = react.useMemo(
|
|
2422
2255
|
() => ({
|
|
2423
2256
|
small,
|
|
2424
2257
|
hideLayout,
|
|
@@ -2430,12 +2263,29 @@
|
|
|
2430
2263
|
return /* @__PURE__ */ jsxRuntime.jsx(LayoutContext.Provider, { value: contextValue, children });
|
|
2431
2264
|
});
|
|
2432
2265
|
LayoutRoot.displayName = "LayoutRoot";
|
|
2266
|
+
const SlideOutRootContext = react.createContext({});
|
|
2267
|
+
const SlideOutContextContext = react.createContext({});
|
|
2268
|
+
const SlideOutClose = react.memo((props) => {
|
|
2269
|
+
const { ref, onClick, disabled, ...rest } = props;
|
|
2270
|
+
const { setOpen } = react.use(SlideOutRootContext);
|
|
2271
|
+
const handleClick = react.useCallback(
|
|
2272
|
+
(e) => {
|
|
2273
|
+
onClick == null ? void 0 : onClick(e);
|
|
2274
|
+
if (e.defaultPrevented) return;
|
|
2275
|
+
setOpen(false);
|
|
2276
|
+
},
|
|
2277
|
+
[onClick, setOpen]
|
|
2278
|
+
);
|
|
2279
|
+
return /* @__PURE__ */ jsxRuntime.jsx(reactSlot.Slot, { ref, onClick: handleClick, "data-disabled": disabled ?? false, ...rest });
|
|
2280
|
+
});
|
|
2281
|
+
SlideOutClose.displayName = "SlideOutClose";
|
|
2282
|
+
const TIMEOUT_DURATION = 200;
|
|
2433
2283
|
function usePointerDownOutside(onPointerDownOutside, ownerElement = globalThis == null ? void 0 : globalThis.document.body) {
|
|
2434
2284
|
const handlePointerDownOutside = useCallbackRef(onPointerDownOutside);
|
|
2435
|
-
const isPointerInsideReactTreeRef =
|
|
2436
|
-
const handleClickRef =
|
|
2285
|
+
const isPointerInsideReactTreeRef = react.useRef(false);
|
|
2286
|
+
const handleClickRef = react.useRef(() => {
|
|
2437
2287
|
});
|
|
2438
|
-
|
|
2288
|
+
react.useEffect(() => {
|
|
2439
2289
|
const handlePointerDown = (event) => {
|
|
2440
2290
|
if (event.target && !isPointerInsideReactTreeRef.current) {
|
|
2441
2291
|
const eventDetail = { originalEvent: event };
|
|
@@ -2482,336 +2332,381 @@
|
|
|
2482
2332
|
}
|
|
2483
2333
|
}
|
|
2484
2334
|
function useCallbackRef(callback) {
|
|
2485
|
-
const callbackRef =
|
|
2486
|
-
|
|
2335
|
+
const callbackRef = react.useRef(callback);
|
|
2336
|
+
react.useEffect(() => {
|
|
2487
2337
|
callbackRef.current = callback;
|
|
2488
2338
|
});
|
|
2489
|
-
return
|
|
2339
|
+
return react.useMemo(() => (...args) => {
|
|
2490
2340
|
var _a;
|
|
2491
2341
|
return (_a = callbackRef.current) == null ? void 0 : _a.call(callbackRef, ...args);
|
|
2492
2342
|
}, []);
|
|
2493
2343
|
}
|
|
2494
|
-
const
|
|
2495
|
-
|
|
2496
|
-
const
|
|
2497
|
-
|
|
2498
|
-
|
|
2499
|
-
|
|
2500
|
-
|
|
2501
|
-
|
|
2502
|
-
|
|
2503
|
-
|
|
2504
|
-
|
|
2505
|
-
|
|
2506
|
-
|
|
2507
|
-
|
|
2508
|
-
|
|
2509
|
-
|
|
2510
|
-
|
|
2511
|
-
|
|
2512
|
-
|
|
2513
|
-
|
|
2514
|
-
|
|
2515
|
-
|
|
2516
|
-
|
|
2517
|
-
|
|
2518
|
-
|
|
2519
|
-
const
|
|
2520
|
-
|
|
2521
|
-
|
|
2522
|
-
|
|
2523
|
-
|
|
2524
|
-
|
|
2525
|
-
|
|
2526
|
-
|
|
2527
|
-
|
|
2528
|
-
|
|
2529
|
-
|
|
2530
|
-
|
|
2531
|
-
|
|
2532
|
-
|
|
2533
|
-
|
|
2344
|
+
const SlideOutContent = react.memo((props) => {
|
|
2345
|
+
const { ref, children, style, side, type, resizeable = false, initialSize, minSize, maxSize, hide, ...rest } = props;
|
|
2346
|
+
const internalRef = react.useRef(null);
|
|
2347
|
+
const { open, setOpen, parentElement, modal } = react.use(SlideOutRootContext);
|
|
2348
|
+
const [computedSize, setComputedSize] = react.useState(null);
|
|
2349
|
+
const handleClose = react.useCallback(() => {
|
|
2350
|
+
if (modal) setOpen(false);
|
|
2351
|
+
}, [modal, setOpen]);
|
|
2352
|
+
const { onPointerDownCapture: handlePointerDownCapture } = usePointerDownOutside(
|
|
2353
|
+
handleClose,
|
|
2354
|
+
parentElement ?? void 0
|
|
2355
|
+
);
|
|
2356
|
+
react.useLayoutEffect(() => {
|
|
2357
|
+
if (!open || !internalRef.current) return;
|
|
2358
|
+
const { offsetWidth, offsetHeight } = internalRef.current;
|
|
2359
|
+
switch (side) {
|
|
2360
|
+
case "left":
|
|
2361
|
+
case "right":
|
|
2362
|
+
setComputedSize(offsetWidth);
|
|
2363
|
+
break;
|
|
2364
|
+
case "top":
|
|
2365
|
+
case "bottom":
|
|
2366
|
+
setComputedSize(offsetHeight);
|
|
2367
|
+
}
|
|
2368
|
+
}, [open, side]);
|
|
2369
|
+
const computedStyle = react.useMemo(() => {
|
|
2370
|
+
switch (side) {
|
|
2371
|
+
case "left":
|
|
2372
|
+
return {
|
|
2373
|
+
...style,
|
|
2374
|
+
left: 0,
|
|
2375
|
+
width: computedSize ?? initialSize,
|
|
2376
|
+
maxWidth: maxSize,
|
|
2377
|
+
minWidth: minSize,
|
|
2378
|
+
position: type === "inline" ? "relative" : "absolute",
|
|
2379
|
+
"--slide-out-size": `${computedSize}px`
|
|
2380
|
+
};
|
|
2381
|
+
case "right":
|
|
2382
|
+
return {
|
|
2383
|
+
...style,
|
|
2384
|
+
right: 0,
|
|
2385
|
+
width: computedSize ?? initialSize,
|
|
2386
|
+
maxWidth: maxSize,
|
|
2387
|
+
minWidth: minSize,
|
|
2388
|
+
position: type === "inline" ? "relative" : "absolute",
|
|
2389
|
+
"--slide-out-size": `${computedSize}px`
|
|
2390
|
+
};
|
|
2391
|
+
case "top":
|
|
2392
|
+
return {
|
|
2393
|
+
...style,
|
|
2394
|
+
top: 0,
|
|
2395
|
+
height: computedSize ?? initialSize,
|
|
2396
|
+
maxHeight: maxSize,
|
|
2397
|
+
minHeight: minSize,
|
|
2398
|
+
position: type === "inline" ? "relative" : "absolute",
|
|
2399
|
+
"--slide-out-size": `${computedSize}px`
|
|
2400
|
+
};
|
|
2401
|
+
case "bottom":
|
|
2402
|
+
return {
|
|
2403
|
+
...style,
|
|
2404
|
+
bottom: 0,
|
|
2405
|
+
height: computedSize ?? initialSize,
|
|
2406
|
+
maxHeight: maxSize,
|
|
2407
|
+
minHeight: minSize,
|
|
2408
|
+
position: type === "inline" ? "relative" : "absolute",
|
|
2409
|
+
"--slide-out-size": `${computedSize}px`
|
|
2410
|
+
};
|
|
2534
2411
|
}
|
|
2535
|
-
}, []);
|
|
2536
|
-
|
|
2537
|
-
|
|
2538
|
-
|
|
2539
|
-
|
|
2540
|
-
|
|
2412
|
+
}, [computedSize, initialSize, maxSize, minSize, side, style, type]);
|
|
2413
|
+
const transitionClassNames = react.useMemo(() => {
|
|
2414
|
+
switch (side) {
|
|
2415
|
+
case "left":
|
|
2416
|
+
return {
|
|
2417
|
+
enter: "-ml-(--slide-out-size)",
|
|
2418
|
+
enterActive: "ease-linear duration-200 transition-[margin-left] ml-0",
|
|
2419
|
+
enterDone: "ml-0",
|
|
2420
|
+
exitActive: "ease-linear duration-200 transition-[margin-left] -ml-(--slide-out-size)",
|
|
2421
|
+
exitDone: "-ml-(--slide-out-size)"
|
|
2422
|
+
};
|
|
2423
|
+
case "right":
|
|
2424
|
+
return {
|
|
2425
|
+
enter: "-mr-(--slide-out-size)",
|
|
2426
|
+
enterActive: "ease-linear duration-200 transition-[margin-right] mr-0",
|
|
2427
|
+
enterDone: "mr-0",
|
|
2428
|
+
exitActive: "ease-linear duration-200 transition-[margin-right] -mr-(--slide-out-size)",
|
|
2429
|
+
exitDone: "-mr-(--slide-out-size)"
|
|
2430
|
+
};
|
|
2431
|
+
case "top":
|
|
2432
|
+
return {
|
|
2433
|
+
enter: "-mt-(--slide-out-size)",
|
|
2434
|
+
enterActive: "ease-linear duration-200 transition-[margin-top] mt-0",
|
|
2435
|
+
enterDone: "mt-0",
|
|
2436
|
+
exitActive: "ease-linear duration-200 transition-[margin-top] -mt-(--slide-out-size)",
|
|
2437
|
+
exitDone: "-mt-(--slide-out-size)"
|
|
2438
|
+
};
|
|
2439
|
+
case "bottom":
|
|
2440
|
+
return {
|
|
2441
|
+
enter: "-mb-(--slide-out-size)",
|
|
2442
|
+
enterActive: "ease-linear duration-200 transition-[margin-bottom] mb-0",
|
|
2443
|
+
enterDone: "mb-0",
|
|
2444
|
+
exitActive: "ease-linear duration-200 transition-[margin-bottom] -mb-(--slide-out-size)",
|
|
2445
|
+
exitDone: "-mb-(--slide-out-size)"
|
|
2446
|
+
};
|
|
2541
2447
|
}
|
|
2542
|
-
|
|
2543
|
-
|
|
2544
|
-
childrenContainerRef.current.style.pointerEvents = originalParentPointerEvents;
|
|
2545
|
-
}
|
|
2546
|
-
};
|
|
2547
|
-
}, [modal, open, parentContainer.style]);
|
|
2548
|
-
const { onPointerDownCapture: handlePointerDownCapture } = usePointerDownOutside(handleDismiss, parentContainer);
|
|
2549
|
-
const CSSTransitionClassNames = React.useMemo(
|
|
2448
|
+
}, [side]);
|
|
2449
|
+
const contextValue = react.useMemo(
|
|
2550
2450
|
() => ({
|
|
2551
|
-
|
|
2552
|
-
|
|
2553
|
-
|
|
2554
|
-
|
|
2555
|
-
|
|
2451
|
+
side,
|
|
2452
|
+
type,
|
|
2453
|
+
resizeable,
|
|
2454
|
+
computedSize,
|
|
2455
|
+
setComputedSize
|
|
2556
2456
|
}),
|
|
2557
|
-
[
|
|
2457
|
+
[computedSize, resizeable, side, type]
|
|
2558
2458
|
);
|
|
2559
|
-
|
|
2560
|
-
|
|
2561
|
-
|
|
2562
|
-
|
|
2563
|
-
|
|
2564
|
-
|
|
2459
|
+
return !hide ? (
|
|
2460
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
2461
|
+
// @ts-ignore
|
|
2462
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
2463
|
+
reactTransitionGroup.CSSTransition,
|
|
2464
|
+
{
|
|
2465
|
+
classNames: transitionClassNames,
|
|
2466
|
+
in: open,
|
|
2467
|
+
timeout: TIMEOUT_DURATION,
|
|
2468
|
+
unmountOnExit: true,
|
|
2469
|
+
mountOnEnter: true,
|
|
2470
|
+
nodeRef: internalRef,
|
|
2471
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
2472
|
+
"div",
|
|
2473
|
+
{
|
|
2474
|
+
ref: mergeRefs([ref, internalRef]),
|
|
2475
|
+
onPointerDownCapture: handlePointerDownCapture,
|
|
2476
|
+
"data-open": open,
|
|
2477
|
+
"data-side": side,
|
|
2478
|
+
"data-type": type,
|
|
2479
|
+
style: computedStyle,
|
|
2480
|
+
...rest,
|
|
2481
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(SlideOutContextContext, { value: contextValue, children })
|
|
2482
|
+
}
|
|
2483
|
+
)
|
|
2484
|
+
}
|
|
2485
|
+
)
|
|
2486
|
+
) : null;
|
|
2487
|
+
});
|
|
2488
|
+
SlideOutContent.displayName = "SlideOutContent";
|
|
2489
|
+
const SlideOutHandle = react.memo((props) => {
|
|
2490
|
+
const { ref, onMouseDown, disabled, ...rest } = props;
|
|
2491
|
+
const prevClientCoord = react.useRef(null);
|
|
2492
|
+
const [isResizing, setIsResizing] = react.useState(false);
|
|
2493
|
+
const { side, resizeable, computedSize, setComputedSize } = react.use(SlideOutContextContext);
|
|
2494
|
+
const computedDisabled = disabled ?? !resizeable;
|
|
2495
|
+
const setPrevClientCoord = react.useCallback(
|
|
2496
|
+
(clientX, clientY) => {
|
|
2497
|
+
switch (side) {
|
|
2498
|
+
case "left":
|
|
2499
|
+
prevClientCoord.current = clientX;
|
|
2500
|
+
break;
|
|
2501
|
+
case "right":
|
|
2502
|
+
prevClientCoord.current = clientX;
|
|
2503
|
+
break;
|
|
2504
|
+
case "top":
|
|
2505
|
+
prevClientCoord.current = clientY;
|
|
2506
|
+
break;
|
|
2507
|
+
case "bottom":
|
|
2508
|
+
prevClientCoord.current = clientY;
|
|
2509
|
+
break;
|
|
2510
|
+
}
|
|
2511
|
+
},
|
|
2512
|
+
[side]
|
|
2513
|
+
);
|
|
2514
|
+
const handlePointerDown = react.useCallback(
|
|
2515
|
+
(e) => {
|
|
2516
|
+
onMouseDown == null ? void 0 : onMouseDown(e);
|
|
2517
|
+
if (e.defaultPrevented || computedDisabled) return;
|
|
2518
|
+
e.preventDefault();
|
|
2519
|
+
setPrevClientCoord(e.clientX, e.clientY);
|
|
2520
|
+
setIsResizing(true);
|
|
2521
|
+
},
|
|
2522
|
+
[computedDisabled, onMouseDown, setPrevClientCoord]
|
|
2523
|
+
);
|
|
2524
|
+
const handlePointerMove = react.useCallback(
|
|
2565
2525
|
(e) => {
|
|
2566
|
-
if (!isResizing) return;
|
|
2567
|
-
|
|
2568
|
-
const
|
|
2569
|
-
|
|
2570
|
-
|
|
2526
|
+
if (!isResizing || !prevClientCoord.current || computedDisabled) return;
|
|
2527
|
+
e.preventDefault();
|
|
2528
|
+
const { clientX, clientY } = e;
|
|
2529
|
+
let delta = 0;
|
|
2530
|
+
switch (side) {
|
|
2531
|
+
case "left":
|
|
2532
|
+
delta = clientX - prevClientCoord.current;
|
|
2533
|
+
break;
|
|
2534
|
+
case "right":
|
|
2535
|
+
delta = (clientX - prevClientCoord.current) * -1;
|
|
2536
|
+
break;
|
|
2537
|
+
case "top":
|
|
2538
|
+
delta = clientY - prevClientCoord.current;
|
|
2539
|
+
break;
|
|
2540
|
+
case "bottom":
|
|
2541
|
+
delta = (clientY - prevClientCoord.current) * -1;
|
|
2542
|
+
break;
|
|
2543
|
+
}
|
|
2544
|
+
setPrevClientCoord(clientX, clientY);
|
|
2545
|
+
setComputedSize(computedSize + delta);
|
|
2571
2546
|
},
|
|
2572
|
-
[
|
|
2547
|
+
[computedDisabled, computedSize, isResizing, setComputedSize, setPrevClientCoord, side]
|
|
2573
2548
|
);
|
|
2574
|
-
const
|
|
2575
|
-
if (!isResizing) return;
|
|
2576
|
-
|
|
2549
|
+
const handlePointerUp = react.useCallback(() => {
|
|
2550
|
+
if (!isResizing || computedDisabled) return;
|
|
2551
|
+
prevClientCoord.current = null;
|
|
2577
2552
|
setIsResizing(false);
|
|
2578
|
-
}, [isResizing]);
|
|
2579
|
-
|
|
2580
|
-
|
|
2581
|
-
|
|
2553
|
+
}, [computedDisabled, isResizing]);
|
|
2554
|
+
react.useEffect(() => {
|
|
2555
|
+
document.addEventListener("pointermove", handlePointerMove);
|
|
2556
|
+
document.addEventListener("pointerup", handlePointerUp);
|
|
2582
2557
|
return () => {
|
|
2583
|
-
|
|
2584
|
-
|
|
2558
|
+
document.removeEventListener("pointermove", handlePointerMove);
|
|
2559
|
+
document.removeEventListener("pointerup", handlePointerUp);
|
|
2585
2560
|
};
|
|
2586
|
-
}, [
|
|
2587
|
-
|
|
2588
|
-
if (!open) return;
|
|
2589
|
-
setComputedWidth(localRef.current.offsetWidth);
|
|
2590
|
-
}, [open]);
|
|
2591
|
-
const resizableStyle = React.useMemo(
|
|
2592
|
-
() => ({
|
|
2593
|
-
...style,
|
|
2594
|
-
width: computedWidth ?? initialWidth,
|
|
2595
|
-
maxWidth,
|
|
2596
|
-
minWidth,
|
|
2597
|
-
position,
|
|
2598
|
-
"--slide-out-width": `${computedWidth}${typeof computedWidth === "number" ? "px" : ""}`
|
|
2599
|
-
}),
|
|
2600
|
-
[computedWidth, initialWidth, maxWidth, minWidth, position, style]
|
|
2601
|
-
);
|
|
2602
|
-
const resizableEnable = React.useMemo(
|
|
2603
|
-
() => ({ left: resizeable && !isLeft, right: resizeable && isLeft }),
|
|
2604
|
-
[isLeft, resizeable]
|
|
2605
|
-
);
|
|
2606
|
-
const SlideOut2 = React.useMemo(
|
|
2607
|
-
() => (
|
|
2608
|
-
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
2609
|
-
// @ts-ignore
|
|
2610
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
2611
|
-
reactTransitionGroup.CSSTransition,
|
|
2612
|
-
{
|
|
2613
|
-
classNames: CSSTransitionClassNames,
|
|
2614
|
-
in: open,
|
|
2615
|
-
timeout: TIMEOUT_DURATION,
|
|
2616
|
-
unmountOnExit: true,
|
|
2617
|
-
mountOnEnter: true,
|
|
2618
|
-
onEntering: onOpening,
|
|
2619
|
-
onExited: onClosed,
|
|
2620
|
-
nodeRef,
|
|
2621
|
-
children: /* @__PURE__ */ jsxRuntime.jsxs(
|
|
2622
|
-
"div",
|
|
2623
|
-
{
|
|
2624
|
-
className: classVarianceAuthority.cx(
|
|
2625
|
-
"top-0",
|
|
2626
|
-
"bottom-0",
|
|
2627
|
-
{
|
|
2628
|
-
"left-0": isLeft,
|
|
2629
|
-
"right-0": !isLeft,
|
|
2630
|
-
absolute: position === "absolute",
|
|
2631
|
-
relative: position === "relative"
|
|
2632
|
-
},
|
|
2633
|
-
className
|
|
2634
|
-
),
|
|
2635
|
-
ref: mergedRefs,
|
|
2636
|
-
onPointerDownCapture: handlePointerDownCapture,
|
|
2637
|
-
"data-side": side,
|
|
2638
|
-
style: resizableStyle,
|
|
2639
|
-
children: [
|
|
2640
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
2641
|
-
"div",
|
|
2642
|
-
{
|
|
2643
|
-
className: classVarianceAuthority.cx("absolute top-0 bottom-0 w-[3px]", {
|
|
2644
|
-
"right-0": isLeft,
|
|
2645
|
-
"left-0": !isLeft,
|
|
2646
|
-
"pointer-events-none": !resizableEnable
|
|
2647
|
-
}),
|
|
2648
|
-
onMouseDown: handleMouseDown,
|
|
2649
|
-
"data-resizing": isResizing ? "" : void 0
|
|
2650
|
-
}
|
|
2651
|
-
),
|
|
2652
|
-
content
|
|
2653
|
-
]
|
|
2654
|
-
}
|
|
2655
|
-
)
|
|
2656
|
-
}
|
|
2657
|
-
)
|
|
2658
|
-
),
|
|
2659
|
-
[
|
|
2660
|
-
CSSTransitionClassNames,
|
|
2661
|
-
open,
|
|
2662
|
-
onOpening,
|
|
2663
|
-
onClosed,
|
|
2664
|
-
className,
|
|
2665
|
-
isLeft,
|
|
2666
|
-
position,
|
|
2667
|
-
mergedRefs,
|
|
2668
|
-
handlePointerDownCapture,
|
|
2669
|
-
side,
|
|
2670
|
-
resizableStyle,
|
|
2671
|
-
handleMouseDown,
|
|
2672
|
-
isResizing,
|
|
2673
|
-
resizableEnable,
|
|
2674
|
-
content
|
|
2675
|
-
]
|
|
2676
|
-
);
|
|
2677
|
-
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
2561
|
+
}, [handlePointerMove, handlePointerUp]);
|
|
2562
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
2678
2563
|
"div",
|
|
2679
2564
|
{
|
|
2680
|
-
|
|
2681
|
-
|
|
2682
|
-
|
|
2683
|
-
|
|
2684
|
-
|
|
2685
|
-
|
|
2686
|
-
" ",
|
|
2687
|
-
content && SlideOut2
|
|
2688
|
-
] }),
|
|
2689
|
-
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex h-full max-w-full grow overflow-hidden", ref: childrenContainerRef, children }),
|
|
2690
|
-
side === "right" && !hide && /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
2691
|
-
open && overlayComponent,
|
|
2692
|
-
" ",
|
|
2693
|
-
content && SlideOut2
|
|
2694
|
-
] })
|
|
2695
|
-
]
|
|
2565
|
+
ref,
|
|
2566
|
+
onPointerDown: handlePointerDown,
|
|
2567
|
+
"data-resizing": isResizing,
|
|
2568
|
+
"data-side": side,
|
|
2569
|
+
"data-disabled": computedDisabled,
|
|
2570
|
+
...rest
|
|
2696
2571
|
}
|
|
2697
2572
|
);
|
|
2698
2573
|
});
|
|
2699
|
-
|
|
2700
|
-
const
|
|
2701
|
-
|
|
2702
|
-
const {
|
|
2703
|
-
|
|
2704
|
-
|
|
2705
|
-
|
|
2706
|
-
|
|
2707
|
-
|
|
2708
|
-
|
|
2709
|
-
|
|
2710
|
-
|
|
2711
|
-
|
|
2712
|
-
|
|
2713
|
-
} = props;
|
|
2714
|
-
const open = isOpen(id);
|
|
2715
|
-
React.useEffect(() => {
|
|
2716
|
-
if (small && (defaultOpen == null ? void 0 : defaultOpen.small) !== void 0) {
|
|
2717
|
-
setOpen(id, defaultOpen == null ? void 0 : defaultOpen.small);
|
|
2718
|
-
} else if (!small && (defaultOpen == null ? void 0 : defaultOpen.large) !== void 0) {
|
|
2719
|
-
setOpen(id, defaultOpen == null ? void 0 : defaultOpen.large);
|
|
2720
|
-
}
|
|
2721
|
-
}, [defaultOpen, id, setOpen, small]);
|
|
2722
|
-
const handleDismiss = React.useCallback(() => {
|
|
2723
|
-
setOpen(id, false);
|
|
2724
|
-
onDismiss == null ? void 0 : onDismiss();
|
|
2725
|
-
}, [id, onDismiss, setOpen]);
|
|
2726
|
-
return !hideLayout && /* @__PURE__ */ jsxRuntime.jsx(
|
|
2727
|
-
SlideOut,
|
|
2728
|
-
{
|
|
2729
|
-
className: classVarianceAuthority.cx(`overmap-layout-slideOut-${side}`, className),
|
|
2730
|
-
side,
|
|
2731
|
-
ref,
|
|
2574
|
+
SlideOutHandle.displayName = "SlideOutHandle";
|
|
2575
|
+
const SlideOutOverlay = react.memo((props) => {
|
|
2576
|
+
const { ref, ...rest } = props;
|
|
2577
|
+
const { open } = react.use(SlideOutRootContext);
|
|
2578
|
+
return open ? /* @__PURE__ */ jsxRuntime.jsx("div", { ref, "data-open": open, ...rest }) : null;
|
|
2579
|
+
});
|
|
2580
|
+
SlideOutOverlay.displayName = "SlideOutOverlay";
|
|
2581
|
+
const SlideOutRoot = react.memo((props) => {
|
|
2582
|
+
const { ref, children, defaultOpen = false, open: controlledOpen, onOpenChange, modal = false, ...rest } = props;
|
|
2583
|
+
const [parentElement, setParentElement] = react.useState(null);
|
|
2584
|
+
const [open, setOpen] = useControlledState(defaultOpen, controlledOpen, onOpenChange);
|
|
2585
|
+
const contextValue = react.useMemo(
|
|
2586
|
+
() => ({
|
|
2587
|
+
parentElement,
|
|
2732
2588
|
open,
|
|
2733
|
-
|
|
2734
|
-
modal
|
|
2735
|
-
|
|
2736
|
-
|
|
2737
|
-
|
|
2738
|
-
|
|
2739
|
-
|
|
2589
|
+
setOpen,
|
|
2590
|
+
modal
|
|
2591
|
+
}),
|
|
2592
|
+
[modal, open, parentElement, setOpen]
|
|
2593
|
+
);
|
|
2594
|
+
return /* @__PURE__ */ jsxRuntime.jsx("div", { ref: mergeRefs([ref, setParentElement]), ...rest, children: /* @__PURE__ */ jsxRuntime.jsx(SlideOutRootContext, { value: contextValue, children }) });
|
|
2595
|
+
});
|
|
2596
|
+
SlideOutRoot.displayName = "SlideOutRoot";
|
|
2597
|
+
const SlideOutTrigger = react.memo((props) => {
|
|
2598
|
+
const { ref, onClick, ...rest } = props;
|
|
2599
|
+
const { open, setOpen } = react.use(SlideOutRootContext);
|
|
2600
|
+
const handleClick = react.useCallback(
|
|
2601
|
+
(e) => {
|
|
2602
|
+
onClick == null ? void 0 : onClick(e);
|
|
2603
|
+
if (e.defaultPrevented) return;
|
|
2604
|
+
setOpen(!open);
|
|
2605
|
+
},
|
|
2606
|
+
[onClick, open, setOpen]
|
|
2740
2607
|
);
|
|
2608
|
+
return /* @__PURE__ */ jsxRuntime.jsx(reactSlot.Slot, { ref, onClick: handleClick, "data-disabled": props.disabled ?? false, ...rest });
|
|
2609
|
+
});
|
|
2610
|
+
SlideOutTrigger.displayName = "SlideOutTrigger";
|
|
2611
|
+
const SlideOutViewport = react.memo((props) => {
|
|
2612
|
+
const { ref, ...rest } = props;
|
|
2613
|
+
const internalRef = react.useRef(null);
|
|
2614
|
+
const { open, modal, parentElement } = react.use(SlideOutRootContext);
|
|
2615
|
+
react.useEffect(() => {
|
|
2616
|
+
if (!internalRef.current) return;
|
|
2617
|
+
const internalElement = internalRef.current;
|
|
2618
|
+
const originalParentPointerEvents = internalElement.style.pointerEvents;
|
|
2619
|
+
if (open && modal) {
|
|
2620
|
+
internalElement.style.pointerEvents = "none";
|
|
2621
|
+
}
|
|
2622
|
+
return () => {
|
|
2623
|
+
internalElement.style.pointerEvents = originalParentPointerEvents;
|
|
2624
|
+
};
|
|
2625
|
+
}, [modal, open, parentElement == null ? void 0 : parentElement.style]);
|
|
2626
|
+
return /* @__PURE__ */ jsxRuntime.jsx("div", { ref: mergeRefs([ref, internalRef]), ...rest });
|
|
2627
|
+
});
|
|
2628
|
+
SlideOutViewport.displayName = "SlideOutViewport";
|
|
2629
|
+
const SlideOut = {
|
|
2630
|
+
Close: SlideOutClose,
|
|
2631
|
+
Content: SlideOutContent,
|
|
2632
|
+
Handle: SlideOutHandle,
|
|
2633
|
+
Overlay: SlideOutOverlay,
|
|
2634
|
+
Root: SlideOutRoot,
|
|
2635
|
+
Trigger: SlideOutTrigger,
|
|
2636
|
+
Viewport: SlideOutViewport
|
|
2637
|
+
};
|
|
2638
|
+
const LayoutSlideOutClose = react.memo((props) => {
|
|
2639
|
+
const { ref, ...rest } = props;
|
|
2640
|
+
return /* @__PURE__ */ jsxRuntime.jsx(SlideOutClose, { ref, ...rest });
|
|
2641
|
+
});
|
|
2642
|
+
LayoutSlideOutClose.displayName = "LayoutSlideOutClose";
|
|
2643
|
+
const LayoutSlideOutContent = react.memo((props) => {
|
|
2644
|
+
const { ref, type, hide, ...rest } = props;
|
|
2645
|
+
const { small, hideLayout } = react.use(LayoutContext);
|
|
2646
|
+
return /* @__PURE__ */ jsxRuntime.jsx(SlideOutContent, { ref, type: type ?? (small ? "overlay" : "inline"), hide: hide ?? hideLayout, ...rest });
|
|
2647
|
+
});
|
|
2648
|
+
LayoutSlideOutContent.displayName = "LayoutSlideOutContent";
|
|
2649
|
+
const LayoutSlideOutHandle = react.memo((props) => {
|
|
2650
|
+
const { ref, ...rest } = props;
|
|
2651
|
+
return /* @__PURE__ */ jsxRuntime.jsx(SlideOutHandle, { ref, ...rest });
|
|
2741
2652
|
});
|
|
2742
|
-
|
|
2743
|
-
const LayoutSlideOutOverlay =
|
|
2744
|
-
const { ref,
|
|
2745
|
-
const { small, hideLayout
|
|
2746
|
-
const showOverlay =
|
|
2747
|
-
if (active !== void 0) return active;
|
|
2653
|
+
LayoutSlideOutHandle.displayName = "LayoutSlideOutHandle";
|
|
2654
|
+
const LayoutSlideOutOverlay = react.memo((props) => {
|
|
2655
|
+
const { ref, smallModeOnly = false, ...rest } = props;
|
|
2656
|
+
const { small, hideLayout } = useLayoutContext();
|
|
2657
|
+
const showOverlay = react.useMemo(() => {
|
|
2748
2658
|
if (hideLayout) return false;
|
|
2749
2659
|
if (smallModeOnly && !small) return false;
|
|
2750
|
-
return
|
|
2751
|
-
}, [
|
|
2752
|
-
return showOverlay
|
|
2660
|
+
return true;
|
|
2661
|
+
}, [hideLayout, small, smallModeOnly]);
|
|
2662
|
+
return showOverlay ? /* @__PURE__ */ jsxRuntime.jsx(SlideOutOverlay, { ref, ...rest }) : null;
|
|
2753
2663
|
});
|
|
2754
2664
|
LayoutSlideOutOverlay.displayName = "SlideOutOverlay";
|
|
2755
|
-
const
|
|
2756
|
-
|
|
2757
|
-
|
|
2758
|
-
|
|
2759
|
-
|
|
2760
|
-
|
|
2761
|
-
if (
|
|
2762
|
-
|
|
2763
|
-
|
|
2764
|
-
|
|
2765
|
-
|
|
2766
|
-
|
|
2767
|
-
|
|
2768
|
-
|
|
2769
|
-
|
|
2770
|
-
|
|
2771
|
-
|
|
2772
|
-
|
|
2773
|
-
|
|
2774
|
-
|
|
2775
|
-
|
|
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
|
-
}
|
|
2789
|
-
function nextStateBasedOnType(open, type) {
|
|
2790
|
-
switch (type) {
|
|
2791
|
-
case "toggle":
|
|
2792
|
-
return !open;
|
|
2793
|
-
case "open":
|
|
2794
|
-
return true;
|
|
2795
|
-
case "close":
|
|
2796
|
-
return false;
|
|
2797
|
-
}
|
|
2798
|
-
}
|
|
2799
|
-
const LayoutSlideOutTrigger = React.memo((props) => {
|
|
2800
|
-
const { ref, slideOutId, type = "toggle", children, ...rest } = props;
|
|
2665
|
+
const LayoutSlideOutRoot = react.memo((props) => {
|
|
2666
|
+
const { ref, slideOutId, defaultOpen, ...rest } = props;
|
|
2667
|
+
const { isOpen, setOpen, small } = react.use(LayoutContext);
|
|
2668
|
+
const open = isOpen(slideOutId);
|
|
2669
|
+
const handleOpenChange = react.useCallback(
|
|
2670
|
+
(open2) => {
|
|
2671
|
+
if (!open2) setOpen(slideOutId, false);
|
|
2672
|
+
},
|
|
2673
|
+
[setOpen, slideOutId]
|
|
2674
|
+
);
|
|
2675
|
+
react.useEffect(() => {
|
|
2676
|
+
if (small && (defaultOpen == null ? void 0 : defaultOpen.small) !== void 0) {
|
|
2677
|
+
setOpen(slideOutId, defaultOpen == null ? void 0 : defaultOpen.small);
|
|
2678
|
+
} else if (!small && (defaultOpen == null ? void 0 : defaultOpen.large) !== void 0) {
|
|
2679
|
+
setOpen(slideOutId, defaultOpen == null ? void 0 : defaultOpen.large);
|
|
2680
|
+
}
|
|
2681
|
+
}, [defaultOpen, slideOutId, setOpen, small]);
|
|
2682
|
+
return /* @__PURE__ */ jsxRuntime.jsx(SlideOutRoot, { ref, open, onOpenChange: handleOpenChange, modal: small, ...rest });
|
|
2683
|
+
});
|
|
2684
|
+
LayoutSlideOutRoot.displayName = "LayoutSlideOutRoot";
|
|
2685
|
+
const LayoutSlideOutTrigger = react.memo((props) => {
|
|
2686
|
+
const { ref, slideOutId, children, ...rest } = props;
|
|
2801
2687
|
const { isOpen, setOpen } = useLayoutContext();
|
|
2802
2688
|
const open = isOpen(slideOutId);
|
|
2803
|
-
const handleClick =
|
|
2804
|
-
setOpen(slideOutId,
|
|
2805
|
-
}, [open, setOpen, slideOutId
|
|
2689
|
+
const handleClick = react.useCallback(() => {
|
|
2690
|
+
setOpen(slideOutId, !open);
|
|
2691
|
+
}, [open, setOpen, slideOutId]);
|
|
2806
2692
|
return /* @__PURE__ */ jsxRuntime.jsx(reactSlot.Slot, { "data-state": getOpenState(open), ref, onClick: handleClick, ...rest, children });
|
|
2807
2693
|
});
|
|
2808
|
-
LayoutSlideOutTrigger.displayName = "
|
|
2694
|
+
LayoutSlideOutTrigger.displayName = "LayoutSlideOutTrigger";
|
|
2695
|
+
const LayoutSlideOutViewport = react.memo((props) => {
|
|
2696
|
+
const { ref, ...rest } = props;
|
|
2697
|
+
return /* @__PURE__ */ jsxRuntime.jsx(SlideOutViewport, { ref, ...rest });
|
|
2698
|
+
});
|
|
2699
|
+
LayoutSlideOutViewport.displayName = "LayoutSlideOutViewport";
|
|
2809
2700
|
const Layout = {
|
|
2810
2701
|
Root: LayoutRoot,
|
|
2811
2702
|
Container: LayoutContainer,
|
|
2703
|
+
SlideOutClose: LayoutSlideOutClose,
|
|
2704
|
+
SlideOutContent: LayoutSlideOutContent,
|
|
2705
|
+
SlideOutHandle: LayoutSlideOutHandle,
|
|
2812
2706
|
SlideOutOverlay: LayoutSlideOutOverlay,
|
|
2813
|
-
|
|
2814
|
-
SlideOutTrigger: LayoutSlideOutTrigger
|
|
2707
|
+
SlideOutRoot: LayoutSlideOutRoot,
|
|
2708
|
+
SlideOutTrigger: LayoutSlideOutTrigger,
|
|
2709
|
+
SlideOutViewport: LayoutSlideOutViewport
|
|
2815
2710
|
};
|
|
2816
2711
|
const linkCva = classVarianceAuthority.cva(["cursor-pointer"], {
|
|
2817
2712
|
variants: {
|
|
@@ -2849,7 +2744,7 @@
|
|
|
2849
2744
|
align: "left"
|
|
2850
2745
|
}
|
|
2851
2746
|
});
|
|
2852
|
-
const Link =
|
|
2747
|
+
const Link = react.memo((props) => {
|
|
2853
2748
|
const providerContext = useProvider();
|
|
2854
2749
|
const {
|
|
2855
2750
|
ref,
|
|
@@ -2881,28 +2776,6 @@
|
|
|
2881
2776
|
);
|
|
2882
2777
|
});
|
|
2883
2778
|
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
|
-
};
|
|
2906
2779
|
const menuItem = classVarianceAuthority.cva(
|
|
2907
2780
|
[
|
|
2908
2781
|
"select-none",
|
|
@@ -3048,101 +2921,116 @@
|
|
|
3048
2921
|
}
|
|
3049
2922
|
}
|
|
3050
2923
|
);
|
|
3051
|
-
const
|
|
3052
|
-
const
|
|
3053
|
-
const
|
|
3054
|
-
const
|
|
2924
|
+
const MenuContentContext = react.createContext({});
|
|
2925
|
+
const MenuContext = react.createContext({});
|
|
2926
|
+
const SubContext = react.createContext({});
|
|
2927
|
+
const TRIGGER_SELECT_KEYS = ["Enter", " "];
|
|
2928
|
+
const MenuItem = react.memo((props) => {
|
|
2929
|
+
const rootMenuContext = react.use(MenuContext);
|
|
2930
|
+
const { getItemProps, activeIndex, setOpen, size, variant, radius } = react.use(MenuContentContext);
|
|
2931
|
+
const { closeRoot } = react.use(SubContext);
|
|
3055
2932
|
const {
|
|
2933
|
+
ref: forwardedRef,
|
|
2934
|
+
className,
|
|
3056
2935
|
children,
|
|
3057
|
-
|
|
3058
|
-
|
|
3059
|
-
|
|
3060
|
-
|
|
3061
|
-
|
|
3062
|
-
|
|
3063
|
-
open: controlledOpen,
|
|
3064
|
-
onOpenChange,
|
|
3065
|
-
defaultOpen
|
|
2936
|
+
onSelect,
|
|
2937
|
+
onClick,
|
|
2938
|
+
onKeyDown,
|
|
2939
|
+
closeOnSelect = true,
|
|
2940
|
+
disabled = false,
|
|
2941
|
+
...rest
|
|
3066
2942
|
} = props;
|
|
3067
|
-
const
|
|
3068
|
-
const
|
|
3069
|
-
const
|
|
3070
|
-
|
|
3071
|
-
|
|
3072
|
-
|
|
3073
|
-
|
|
3074
|
-
|
|
3075
|
-
|
|
3076
|
-
|
|
3077
|
-
|
|
3078
|
-
|
|
3079
|
-
|
|
3080
|
-
|
|
3081
|
-
|
|
3082
|
-
|
|
3083
|
-
|
|
3084
|
-
|
|
3085
|
-
|
|
3086
|
-
|
|
3087
|
-
|
|
3088
|
-
|
|
2943
|
+
const { ref, index } = react$1.useListItem();
|
|
2944
|
+
const mergeRefs2 = react$1.useMergeRefs([ref, forwardedRef]);
|
|
2945
|
+
const handleClick = react.useCallback(
|
|
2946
|
+
(e) => {
|
|
2947
|
+
e.stopPropagation();
|
|
2948
|
+
if (disabled) return;
|
|
2949
|
+
onClick == null ? void 0 : onClick(e);
|
|
2950
|
+
onSelect == null ? void 0 : onSelect();
|
|
2951
|
+
if (closeOnSelect) setOpen(false);
|
|
2952
|
+
if (closeRoot) rootMenuContext.setOpen(false);
|
|
2953
|
+
},
|
|
2954
|
+
[closeOnSelect, closeRoot, disabled, rootMenuContext, onClick, onSelect, setOpen]
|
|
2955
|
+
);
|
|
2956
|
+
const handleKeyDown = react.useCallback(
|
|
2957
|
+
(e) => {
|
|
2958
|
+
if (disabled) return;
|
|
2959
|
+
onKeyDown == null ? void 0 : onKeyDown(e);
|
|
2960
|
+
if (TRIGGER_SELECT_KEYS.includes(e.key)) {
|
|
2961
|
+
onSelect == null ? void 0 : onSelect();
|
|
2962
|
+
if (closeOnSelect) setOpen(false);
|
|
2963
|
+
}
|
|
2964
|
+
},
|
|
2965
|
+
[closeOnSelect, disabled, onKeyDown, onSelect, setOpen]
|
|
2966
|
+
);
|
|
2967
|
+
const isActive = react.useMemo(() => index === activeIndex, [activeIndex, index]);
|
|
2968
|
+
const computedChildren = react.useMemo(() => {
|
|
2969
|
+
return typeof children === "function" ? children({ active: isActive, selected: false }) : children;
|
|
2970
|
+
}, [children, isActive]);
|
|
2971
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
2972
|
+
"li",
|
|
2973
|
+
{
|
|
2974
|
+
className: classVarianceAuthority.cx(menuItem({ size, variant }), radiusCva({ radius, maxLarge: true }), className),
|
|
2975
|
+
ref: mergeRefs2,
|
|
2976
|
+
role: "menuitem",
|
|
2977
|
+
"data-disabled": getBooleanState(disabled),
|
|
2978
|
+
"aria-disabled": disabled,
|
|
2979
|
+
"data-highlighted": isActive ? "" : void 0,
|
|
2980
|
+
...getItemProps({
|
|
2981
|
+
onClick: handleClick,
|
|
2982
|
+
onKeyDown: handleKeyDown,
|
|
2983
|
+
tabIndex: isActive ? 0 : -1,
|
|
2984
|
+
...rest
|
|
3089
2985
|
}),
|
|
3090
|
-
|
|
3091
|
-
|
|
3092
|
-
|
|
3093
|
-
|
|
3094
|
-
|
|
3095
|
-
|
|
3096
|
-
|
|
3097
|
-
|
|
3098
|
-
|
|
3099
|
-
|
|
3100
|
-
|
|
3101
|
-
|
|
3102
|
-
|
|
3103
|
-
|
|
3104
|
-
|
|
3105
|
-
|
|
3106
|
-
|
|
3107
|
-
|
|
3108
|
-
|
|
3109
|
-
|
|
3110
|
-
|
|
3111
|
-
|
|
3112
|
-
|
|
3113
|
-
|
|
3114
|
-
|
|
3115
|
-
|
|
3116
|
-
|
|
3117
|
-
|
|
3118
|
-
|
|
2986
|
+
children: computedChildren
|
|
2987
|
+
}
|
|
2988
|
+
);
|
|
2989
|
+
});
|
|
2990
|
+
MenuItem.displayName = "MenuItem";
|
|
2991
|
+
const MenuCheckboxItem = react.memo((props) => {
|
|
2992
|
+
const { ref, checked, onCheckedChange, onSelect, ...rest } = props;
|
|
2993
|
+
const handleSelect = react.useCallback(() => {
|
|
2994
|
+
onSelect == null ? void 0 : onSelect();
|
|
2995
|
+
switch (checked) {
|
|
2996
|
+
case true:
|
|
2997
|
+
onCheckedChange(false);
|
|
2998
|
+
break;
|
|
2999
|
+
case "indeterminate":
|
|
3000
|
+
case false:
|
|
3001
|
+
onCheckedChange(true);
|
|
3002
|
+
break;
|
|
3003
|
+
}
|
|
3004
|
+
}, [checked, onCheckedChange, onSelect]);
|
|
3005
|
+
return /* @__PURE__ */ jsxRuntime.jsx(CheckedIndicatorContext.Provider, { value: checked, children: /* @__PURE__ */ jsxRuntime.jsx(MenuItem, { ref, onSelect: handleSelect, ...rest }) });
|
|
3006
|
+
});
|
|
3007
|
+
MenuCheckboxItem.displayName = "MenuCheckboxItem";
|
|
3008
|
+
const MenuCheckboxItemIndicator = react.memo((props) => {
|
|
3009
|
+
const { ref, children, ...rest } = props;
|
|
3010
|
+
return /* @__PURE__ */ jsxRuntime.jsx(CheckedIndicator, { ref, ...rest, children });
|
|
3011
|
+
});
|
|
3012
|
+
MenuCheckboxItemIndicator.displayName = "MenuCheckboxItemIndicator";
|
|
3013
|
+
const MenuClickTrigger = react.memo((props) => {
|
|
3014
|
+
const { ref: forwardedRef, children, disabled = false } = props;
|
|
3015
|
+
const { getReferenceProps, refs, setTriggerType, open } = react.use(MenuContext);
|
|
3016
|
+
const mergedRefs = react$1.useMergeRefs([refs.setReference, forwardedRef]);
|
|
3017
|
+
react.useEffect(() => {
|
|
3018
|
+
setTriggerType("click");
|
|
3019
|
+
}, [setTriggerType]);
|
|
3020
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
3021
|
+
reactSlot.Slot,
|
|
3119
3022
|
{
|
|
3120
|
-
|
|
3121
|
-
|
|
3122
|
-
|
|
3123
|
-
|
|
3124
|
-
|
|
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
|
-
},
|
|
3023
|
+
ref: mergedRefs,
|
|
3024
|
+
"aria-disabled": disabled,
|
|
3025
|
+
"data-disabled": getBooleanState(disabled),
|
|
3026
|
+
"data-state": getOpenState(open),
|
|
3027
|
+
...getReferenceProps({ disabled }),
|
|
3138
3028
|
children
|
|
3139
3029
|
}
|
|
3140
|
-
)
|
|
3030
|
+
);
|
|
3141
3031
|
});
|
|
3142
|
-
|
|
3143
|
-
const
|
|
3144
|
-
const useMenuContentContext = () => React.useContext(MenuContentContext);
|
|
3145
|
-
const MenuContent = React.memo((props) => {
|
|
3032
|
+
MenuClickTrigger.displayName = "MenuClickTrigger";
|
|
3033
|
+
const MenuContent = react.memo((props) => {
|
|
3146
3034
|
var _a;
|
|
3147
3035
|
const providerContext = useProvider();
|
|
3148
3036
|
const {
|
|
@@ -3170,28 +3058,28 @@
|
|
|
3170
3058
|
floatingStyles,
|
|
3171
3059
|
modal,
|
|
3172
3060
|
side
|
|
3173
|
-
} =
|
|
3174
|
-
const computedFloatingStyles =
|
|
3061
|
+
} = react.use(MenuContext);
|
|
3062
|
+
const computedFloatingStyles = react.useMemo(() => {
|
|
3175
3063
|
var _a2;
|
|
3176
3064
|
return {
|
|
3177
3065
|
...floatingStyles,
|
|
3178
3066
|
visibility: ((_a2 = middlewareData.hide) == null ? void 0 : _a2.referenceHidden) ? "hidden" : "visible"
|
|
3179
3067
|
};
|
|
3180
3068
|
}, [floatingStyles, (_a = middlewareData.hide) == null ? void 0 : _a.referenceHidden]);
|
|
3181
|
-
const handleOverlayPointerDown =
|
|
3069
|
+
const handleOverlayPointerDown = react.useCallback(
|
|
3182
3070
|
(e) => {
|
|
3183
3071
|
if (modal) stopPropagation(e);
|
|
3184
3072
|
},
|
|
3185
3073
|
[modal]
|
|
3186
3074
|
);
|
|
3187
|
-
return /* @__PURE__ */ jsxRuntime.jsx(react.FloatingNode, { id: nodeId, children: open && /* @__PURE__ */ jsxRuntime.jsx(react.FloatingPortal, { children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
3188
|
-
react.FloatingOverlay,
|
|
3075
|
+
return /* @__PURE__ */ jsxRuntime.jsx(react$1.FloatingNode, { id: nodeId, children: open && /* @__PURE__ */ jsxRuntime.jsx(react$1.FloatingPortal, { children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
3076
|
+
react$1.FloatingOverlay,
|
|
3189
3077
|
{
|
|
3190
3078
|
className: menuOverlay({ modal }),
|
|
3191
3079
|
onClick: handleOverlayPointerDown,
|
|
3192
3080
|
lockScroll: true,
|
|
3193
3081
|
"data-floating-content": "",
|
|
3194
|
-
children: /* @__PURE__ */ jsxRuntime.jsx(react.FloatingFocusManager, { context, children: /* @__PURE__ */ jsxRuntime.jsx(react.FloatingList, { elementsRef, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
3082
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(react$1.FloatingFocusManager, { context, children: /* @__PURE__ */ jsxRuntime.jsx(react$1.FloatingList, { elementsRef, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
3195
3083
|
MenuContentContext.Provider,
|
|
3196
3084
|
{
|
|
3197
3085
|
value: {
|
|
@@ -3242,247 +3130,41 @@
|
|
|
3242
3130
|
) }) });
|
|
3243
3131
|
});
|
|
3244
3132
|
MenuContent.displayName = "Menu.Content";
|
|
3245
|
-
const
|
|
3246
|
-
|
|
3247
|
-
|
|
3248
|
-
const {
|
|
3249
|
-
|
|
3250
|
-
|
|
3251
|
-
|
|
3252
|
-
|
|
3253
|
-
|
|
3254
|
-
|
|
3255
|
-
|
|
3256
|
-
|
|
3257
|
-
|
|
3258
|
-
|
|
3259
|
-
|
|
3260
|
-
|
|
3261
|
-
|
|
3262
|
-
|
|
3263
|
-
|
|
3264
|
-
|
|
3265
|
-
|
|
3266
|
-
|
|
3267
|
-
|
|
3268
|
-
|
|
3269
|
-
|
|
3133
|
+
const MenuContextTrigger = react.memo((props) => {
|
|
3134
|
+
const { ref: forwardedRef, children, disabled = false } = props;
|
|
3135
|
+
const ref = react.useRef(null);
|
|
3136
|
+
const { setOpen, refs, setTriggerType, open } = react.use(MenuContext);
|
|
3137
|
+
const mergedRefs = react$1.useMergeRefs([forwardedRef, ref]);
|
|
3138
|
+
react.useEffect(() => {
|
|
3139
|
+
setTriggerType("context");
|
|
3140
|
+
}, [setTriggerType]);
|
|
3141
|
+
const handleContextMenu = react.useCallback(
|
|
3142
|
+
(e) => {
|
|
3143
|
+
const { clientY, clientX } = e;
|
|
3144
|
+
if (!disabled && ref.current) {
|
|
3145
|
+
e.preventDefault();
|
|
3146
|
+
refs.setPositionReference({
|
|
3147
|
+
getBoundingClientRect() {
|
|
3148
|
+
return {
|
|
3149
|
+
x: clientX,
|
|
3150
|
+
y: clientY,
|
|
3151
|
+
top: clientY,
|
|
3152
|
+
left: clientX,
|
|
3153
|
+
height: 0,
|
|
3154
|
+
width: 0,
|
|
3155
|
+
bottom: clientY,
|
|
3156
|
+
right: clientX
|
|
3157
|
+
};
|
|
3158
|
+
},
|
|
3159
|
+
contextElement: ref.current
|
|
3160
|
+
});
|
|
3161
|
+
setOpen(true);
|
|
3162
|
+
}
|
|
3270
3163
|
},
|
|
3271
|
-
|
|
3272
|
-
|
|
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
|
-
]);
|
|
3164
|
+
[disabled, refs, setOpen]
|
|
3165
|
+
);
|
|
3319
3166
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
3320
|
-
|
|
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);
|
|
3368
|
-
onSelect == null ? void 0 : onSelect();
|
|
3369
|
-
if (closeOnSelect) setOpen(false);
|
|
3370
|
-
if (closeRoot) rootMenuContext.setOpen(false);
|
|
3371
|
-
},
|
|
3372
|
-
[closeOnSelect, closeRoot, disabled, rootMenuContext, onClick, onSelect, setOpen]
|
|
3373
|
-
);
|
|
3374
|
-
const handleKeyDown = React.useCallback(
|
|
3375
|
-
(e) => {
|
|
3376
|
-
if (disabled) return;
|
|
3377
|
-
onKeyDown == null ? void 0 : onKeyDown(e);
|
|
3378
|
-
if (TRIGGER_SELECT_KEYS.includes(e.key)) {
|
|
3379
|
-
onSelect == null ? void 0 : onSelect();
|
|
3380
|
-
if (closeOnSelect) setOpen(false);
|
|
3381
|
-
}
|
|
3382
|
-
},
|
|
3383
|
-
[closeOnSelect, disabled, onKeyDown, onSelect, setOpen]
|
|
3384
|
-
);
|
|
3385
|
-
const isActive = React.useMemo(() => index === activeIndex, [activeIndex, index]);
|
|
3386
|
-
const computedChildren = React.useMemo(() => {
|
|
3387
|
-
return typeof children === "function" ? children({ active: isActive, selected: false }) : children;
|
|
3388
|
-
}, [children, isActive]);
|
|
3389
|
-
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
3390
|
-
"li",
|
|
3391
|
-
{
|
|
3392
|
-
className: classVarianceAuthority.cx(menuItem({ size, variant }), radiusCva({ radius, maxLarge: true }), className),
|
|
3393
|
-
ref: mergeRefs2,
|
|
3394
|
-
role: "menuitem",
|
|
3395
|
-
"data-disabled": getBooleanState(disabled),
|
|
3396
|
-
"aria-disabled": disabled,
|
|
3397
|
-
"data-highlighted": isActive ? "" : void 0,
|
|
3398
|
-
...getItemProps({
|
|
3399
|
-
onClick: handleClick,
|
|
3400
|
-
onKeyDown: handleKeyDown,
|
|
3401
|
-
tabIndex: isActive ? 0 : -1,
|
|
3402
|
-
...rest
|
|
3403
|
-
}),
|
|
3404
|
-
children: computedChildren
|
|
3405
|
-
}
|
|
3406
|
-
);
|
|
3407
|
-
});
|
|
3408
|
-
MenuItem.displayName = "MenuItem";
|
|
3409
|
-
const MenuCheckboxItem = React.memo((props) => {
|
|
3410
|
-
const { ref, checked, onCheckedChange, onSelect, ...rest } = props;
|
|
3411
|
-
const handleSelect = React.useCallback(() => {
|
|
3412
|
-
onSelect == null ? void 0 : onSelect();
|
|
3413
|
-
switch (checked) {
|
|
3414
|
-
case true:
|
|
3415
|
-
onCheckedChange(false);
|
|
3416
|
-
break;
|
|
3417
|
-
case "indeterminate":
|
|
3418
|
-
case false:
|
|
3419
|
-
onCheckedChange(true);
|
|
3420
|
-
break;
|
|
3421
|
-
}
|
|
3422
|
-
}, [checked, onCheckedChange, onSelect]);
|
|
3423
|
-
return /* @__PURE__ */ jsxRuntime.jsx(CheckedIndicatorContext.Provider, { value: checked, children: /* @__PURE__ */ jsxRuntime.jsx(MenuItem, { ref, onSelect: handleSelect, ...rest }) });
|
|
3424
|
-
});
|
|
3425
|
-
MenuCheckboxItem.displayName = "MenuCheckboxItem";
|
|
3426
|
-
const MenuCheckboxItemIndicator = React.memo((props) => {
|
|
3427
|
-
const { ref, children, ...rest } = props;
|
|
3428
|
-
return /* @__PURE__ */ jsxRuntime.jsx(CheckedIndicator, { ref, ...rest, children });
|
|
3429
|
-
});
|
|
3430
|
-
MenuCheckboxItemIndicator.displayName = "MenuCheckboxItemIndicator";
|
|
3431
|
-
const MenuClickTrigger = React.memo((props) => {
|
|
3432
|
-
const { ref: forwardedRef, children, disabled = false } = props;
|
|
3433
|
-
const { getReferenceProps, refs, setTriggerType, open } = useMenuContext();
|
|
3434
|
-
const mergedRefs = react.useMergeRefs([refs.setReference, forwardedRef]);
|
|
3435
|
-
React.useEffect(() => {
|
|
3436
|
-
setTriggerType("click");
|
|
3437
|
-
}, [setTriggerType]);
|
|
3438
|
-
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
3439
|
-
reactSlot.Slot,
|
|
3440
|
-
{
|
|
3441
|
-
ref: mergedRefs,
|
|
3442
|
-
"aria-disabled": disabled,
|
|
3443
|
-
"data-disabled": getBooleanState(disabled),
|
|
3444
|
-
"data-state": getOpenState(open),
|
|
3445
|
-
...getReferenceProps({ disabled }),
|
|
3446
|
-
children
|
|
3447
|
-
}
|
|
3448
|
-
);
|
|
3449
|
-
});
|
|
3450
|
-
MenuClickTrigger.displayName = "MenuClickTrigger";
|
|
3451
|
-
const MenuContextTrigger = React.memo((props) => {
|
|
3452
|
-
const { ref: forwardedRef, children, disabled = false } = props;
|
|
3453
|
-
const ref = React.useRef(null);
|
|
3454
|
-
const { setOpen, refs, setTriggerType, open } = useMenuContext();
|
|
3455
|
-
const mergedRefs = react.useMergeRefs([forwardedRef, ref]);
|
|
3456
|
-
React.useEffect(() => {
|
|
3457
|
-
setTriggerType("context");
|
|
3458
|
-
}, [setTriggerType]);
|
|
3459
|
-
const handleContextMenu = React.useCallback(
|
|
3460
|
-
(e) => {
|
|
3461
|
-
const { clientY, clientX } = e;
|
|
3462
|
-
if (!disabled && ref.current) {
|
|
3463
|
-
e.preventDefault();
|
|
3464
|
-
refs.setPositionReference({
|
|
3465
|
-
getBoundingClientRect() {
|
|
3466
|
-
return {
|
|
3467
|
-
x: clientX,
|
|
3468
|
-
y: clientY,
|
|
3469
|
-
top: clientY,
|
|
3470
|
-
left: clientX,
|
|
3471
|
-
height: 0,
|
|
3472
|
-
width: 0,
|
|
3473
|
-
bottom: clientY,
|
|
3474
|
-
right: clientX
|
|
3475
|
-
};
|
|
3476
|
-
},
|
|
3477
|
-
contextElement: ref.current
|
|
3478
|
-
});
|
|
3479
|
-
setOpen(true);
|
|
3480
|
-
}
|
|
3481
|
-
},
|
|
3482
|
-
[disabled, refs, setOpen]
|
|
3483
|
-
);
|
|
3484
|
-
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
3485
|
-
reactSlot.Slot,
|
|
3167
|
+
reactSlot.Slot,
|
|
3486
3168
|
{
|
|
3487
3169
|
ref: mergedRefs,
|
|
3488
3170
|
style: { WebkitTouchCallout: disabled ? "none" : "unset" },
|
|
@@ -3495,24 +3177,24 @@
|
|
|
3495
3177
|
);
|
|
3496
3178
|
});
|
|
3497
3179
|
MenuContextTrigger.displayName = "MenuContextTrigger";
|
|
3498
|
-
const MenuGroup =
|
|
3180
|
+
const MenuGroup = react.memo((props) => {
|
|
3499
3181
|
const { ref, children, ...rest } = props;
|
|
3500
3182
|
return /* @__PURE__ */ jsxRuntime.jsx("div", { ref, role: "group", ...rest, children });
|
|
3501
3183
|
});
|
|
3502
3184
|
MenuGroup.displayName = "MenuGroup";
|
|
3503
|
-
const MenuInputField =
|
|
3185
|
+
const MenuInputField = react.memo((props) => {
|
|
3504
3186
|
const { ref: forwardedRef, className, onValueChange, onChange, disabled = false, ...rest } = props;
|
|
3505
|
-
const { activeIndex, getItemProps } =
|
|
3506
|
-
const { index, ref } = react.useListItem();
|
|
3507
|
-
const mergedRefs = react.useMergeRefs([ref, forwardedRef]);
|
|
3508
|
-
const handleChange =
|
|
3187
|
+
const { activeIndex, getItemProps } = react.use(MenuContentContext);
|
|
3188
|
+
const { index, ref } = react$1.useListItem();
|
|
3189
|
+
const mergedRefs = react$1.useMergeRefs([ref, forwardedRef]);
|
|
3190
|
+
const handleChange = react.useCallback(
|
|
3509
3191
|
(e) => {
|
|
3510
3192
|
onChange == null ? void 0 : onChange(e);
|
|
3511
3193
|
onValueChange == null ? void 0 : onValueChange(e.target.value);
|
|
3512
3194
|
},
|
|
3513
3195
|
[onChange, onValueChange]
|
|
3514
3196
|
);
|
|
3515
|
-
|
|
3197
|
+
react.useEffect(() => {
|
|
3516
3198
|
return () => {
|
|
3517
3199
|
onValueChange == null ? void 0 : onValueChange("");
|
|
3518
3200
|
};
|
|
@@ -3533,20 +3215,20 @@
|
|
|
3533
3215
|
);
|
|
3534
3216
|
});
|
|
3535
3217
|
MenuInputField.displayName = "MenuInputField";
|
|
3536
|
-
const MenuInputRoot =
|
|
3218
|
+
const MenuInputRoot = react.memo((props) => {
|
|
3537
3219
|
const { ref, className, ...rest } = props;
|
|
3538
|
-
const { size } =
|
|
3220
|
+
const { size } = react.use(MenuContentContext);
|
|
3539
3221
|
return /* @__PURE__ */ jsxRuntime.jsx("div", { className: classVarianceAuthority.cx(inputRoot({ size }), className), ref, ...rest });
|
|
3540
3222
|
});
|
|
3541
3223
|
MenuInputRoot.displayName = "MenuInputRoot";
|
|
3542
|
-
const MenuInputSlot =
|
|
3224
|
+
const MenuInputSlot = react.memo((props) => {
|
|
3543
3225
|
const { ref, className, ...rest } = props;
|
|
3544
3226
|
return /* @__PURE__ */ jsxRuntime.jsx("div", { className: classVarianceAuthority.cx("flex", "items-center", "text-(--base-a11)", className), ref, ...rest });
|
|
3545
3227
|
});
|
|
3546
3228
|
MenuInputSlot.displayName = "MenuInputSlot";
|
|
3547
|
-
const MenuLabel =
|
|
3229
|
+
const MenuLabel = react.memo((props) => {
|
|
3548
3230
|
const { ref, className, ...rest } = props;
|
|
3549
|
-
const { size } =
|
|
3231
|
+
const { size } = react.use(MenuContentContext);
|
|
3550
3232
|
return /* @__PURE__ */ jsxRuntime.jsx("div", { ref, className: classVarianceAuthority.cx(menuLabelCva({ size }), className), ...rest });
|
|
3551
3233
|
});
|
|
3552
3234
|
MenuLabel.displayName = "MenuLabel";
|
|
@@ -3554,41 +3236,18 @@
|
|
|
3554
3236
|
const { ref, children, defaultValues, values, onValuesChange, ...rest } = props;
|
|
3555
3237
|
return /* @__PURE__ */ jsxRuntime.jsx(MenuGroup, { ref, ...rest, children: /* @__PURE__ */ jsxRuntime.jsx(MultiSelectProvider, { defaultValues, values, onValuesChange, children }) });
|
|
3556
3238
|
});
|
|
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
3239
|
const MenuMultiSelectItem = genericMemo(function(props) {
|
|
3581
3240
|
const { ref, onSelect, children, closeOnSelect = false, value, ...rest } = props;
|
|
3582
|
-
const { selected, selectValue, registerValue } =
|
|
3583
|
-
|
|
3241
|
+
const { selected, selectValue, registerValue } = react.use(MultiSelectContext);
|
|
3242
|
+
react.useLayoutEffect(() => {
|
|
3584
3243
|
return registerValue(value);
|
|
3585
3244
|
}, [registerValue, value]);
|
|
3586
3245
|
const isSelected = selected(value);
|
|
3587
|
-
const handleSelect =
|
|
3246
|
+
const handleSelect = react.useCallback(() => {
|
|
3588
3247
|
onSelect == null ? void 0 : onSelect();
|
|
3589
3248
|
selectValue(value);
|
|
3590
3249
|
}, [onSelect, selectValue, value]);
|
|
3591
|
-
const computedChildren =
|
|
3250
|
+
const computedChildren = react.useMemo(() => {
|
|
3592
3251
|
return typeof children === "function" ? ({ active }) => children({ selected: isSelected, active }) : children;
|
|
3593
3252
|
}, [children, isSelected]);
|
|
3594
3253
|
return /* @__PURE__ */ jsxRuntime.jsx(SelectedIndicatorContext.Provider, { value: isSelected, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
@@ -3604,26 +3263,25 @@
|
|
|
3604
3263
|
}
|
|
3605
3264
|
) });
|
|
3606
3265
|
});
|
|
3607
|
-
const PagesContext =
|
|
3608
|
-
const
|
|
3609
|
-
|
|
3266
|
+
const PagesContext = react.createContext({});
|
|
3267
|
+
const MenuPageContent = react.memo((props) => {
|
|
3268
|
+
const { page, children } = props;
|
|
3269
|
+
const { activePage } = react.use(PagesContext);
|
|
3270
|
+
return activePage === page ? children : null;
|
|
3271
|
+
});
|
|
3272
|
+
MenuPageContent.displayName = "PageContent";
|
|
3273
|
+
const MenuPages = react.memo((props) => {
|
|
3610
3274
|
const { children, defaultPage, page, onPageChange } = props;
|
|
3611
3275
|
const [activePage, setActivePage] = useControlledState(defaultPage ?? "", page, onPageChange);
|
|
3612
|
-
const contextValue =
|
|
3276
|
+
const contextValue = react.useMemo(() => ({ activePage, setActivePage }), [activePage, setActivePage]);
|
|
3613
3277
|
return /* @__PURE__ */ jsxRuntime.jsx(PagesContext.Provider, { value: contextValue, children });
|
|
3614
3278
|
});
|
|
3615
3279
|
MenuPages.displayName = "MenuPages";
|
|
3616
|
-
const
|
|
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) => {
|
|
3280
|
+
const MenuPageTrigger = react.memo((props) => {
|
|
3623
3281
|
const { ref, onSelect, page, ...rest } = props;
|
|
3624
|
-
const { refs, setActiveIndex } =
|
|
3625
|
-
const { setActivePage } =
|
|
3626
|
-
const handleSelect =
|
|
3282
|
+
const { refs, setActiveIndex } = react.use(MenuContentContext);
|
|
3283
|
+
const { setActivePage } = react.use(PagesContext);
|
|
3284
|
+
const handleSelect = react.useCallback(() => {
|
|
3627
3285
|
var _a;
|
|
3628
3286
|
onSelect == null ? void 0 : onSelect();
|
|
3629
3287
|
setActivePage(page);
|
|
@@ -3633,7 +3291,101 @@
|
|
|
3633
3291
|
return /* @__PURE__ */ jsxRuntime.jsx(MenuItem, { ref, onSelect: handleSelect, closeOnSelect: false, ...rest });
|
|
3634
3292
|
});
|
|
3635
3293
|
MenuPageTrigger.displayName = "MenuPageTrigger";
|
|
3636
|
-
const
|
|
3294
|
+
const MENU_OVERFLOW_PADDING = 20;
|
|
3295
|
+
const MENU_CONTENT_PADDING = 8;
|
|
3296
|
+
const MENU_MINIMUM_MAX_HEIGHT = 250;
|
|
3297
|
+
const DEFAULT_OFFSET = 5;
|
|
3298
|
+
const MenuRoot = react.memo((props) => {
|
|
3299
|
+
const {
|
|
3300
|
+
children,
|
|
3301
|
+
side = "bottom",
|
|
3302
|
+
align = "center",
|
|
3303
|
+
offset,
|
|
3304
|
+
loop = false,
|
|
3305
|
+
modal = false,
|
|
3306
|
+
// open state related props
|
|
3307
|
+
open: controlledOpen,
|
|
3308
|
+
onOpenChange,
|
|
3309
|
+
defaultOpen
|
|
3310
|
+
} = props;
|
|
3311
|
+
const [open, setOpen] = useControlledState(defaultOpen ?? false, controlledOpen, onOpenChange);
|
|
3312
|
+
const [activeIndex, setActiveIndex] = react.useState(null);
|
|
3313
|
+
const [triggerType, setTriggerType] = react.useState(null);
|
|
3314
|
+
const elementsRef = react.useRef([]);
|
|
3315
|
+
const nodeId = react$1.useFloatingNodeId();
|
|
3316
|
+
const { refs, floatingStyles, context, middlewareData } = react$1.useFloating({
|
|
3317
|
+
nodeId,
|
|
3318
|
+
strategy: "fixed",
|
|
3319
|
+
// TODO: probably some way with template string types to not need the "as Placement"
|
|
3320
|
+
placement: side + (align !== "center" ? "-" + align : ""),
|
|
3321
|
+
whileElementsMounted: react$1.autoUpdate,
|
|
3322
|
+
open,
|
|
3323
|
+
onOpenChange: setOpen,
|
|
3324
|
+
middleware: [
|
|
3325
|
+
react$1.offset({ mainAxis: offset ?? DEFAULT_OFFSET }),
|
|
3326
|
+
react$1.size({
|
|
3327
|
+
apply({ availableHeight, elements }) {
|
|
3328
|
+
elements.floating.style.setProperty(
|
|
3329
|
+
"--overmap-menu-available-height",
|
|
3330
|
+
`${Math.max(availableHeight, MENU_MINIMUM_MAX_HEIGHT)}px`
|
|
3331
|
+
);
|
|
3332
|
+
},
|
|
3333
|
+
padding: MENU_OVERFLOW_PADDING
|
|
3334
|
+
}),
|
|
3335
|
+
react$1.flip({ fallbackStrategy: "initialPlacement" }),
|
|
3336
|
+
react$1.shift({ padding: MENU_OVERFLOW_PADDING }),
|
|
3337
|
+
react$1.hide()
|
|
3338
|
+
]
|
|
3339
|
+
});
|
|
3340
|
+
const role = react$1.useRole(context, {
|
|
3341
|
+
role: "menu"
|
|
3342
|
+
});
|
|
3343
|
+
const dismiss = react$1.useDismiss(context, {
|
|
3344
|
+
capture: true,
|
|
3345
|
+
ancestorScroll: triggerType === "context" || triggerType === "virtual"
|
|
3346
|
+
});
|
|
3347
|
+
const click = react$1.useClick(context, {
|
|
3348
|
+
enabled: triggerType === "click"
|
|
3349
|
+
});
|
|
3350
|
+
const listNavigation = react$1.useListNavigation(context, {
|
|
3351
|
+
listRef: elementsRef,
|
|
3352
|
+
activeIndex,
|
|
3353
|
+
onNavigate: setActiveIndex,
|
|
3354
|
+
loop
|
|
3355
|
+
});
|
|
3356
|
+
const { getFloatingProps, getItemProps, getReferenceProps } = react$1.useInteractions([
|
|
3357
|
+
dismiss,
|
|
3358
|
+
listNavigation,
|
|
3359
|
+
click,
|
|
3360
|
+
role
|
|
3361
|
+
]);
|
|
3362
|
+
return /* @__PURE__ */ jsxRuntime.jsx(react$1.FloatingTree, { children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
3363
|
+
MenuContext.Provider,
|
|
3364
|
+
{
|
|
3365
|
+
value: {
|
|
3366
|
+
open,
|
|
3367
|
+
setOpen,
|
|
3368
|
+
refs,
|
|
3369
|
+
context,
|
|
3370
|
+
floatingStyles,
|
|
3371
|
+
elementsRef,
|
|
3372
|
+
getFloatingProps,
|
|
3373
|
+
getItemProps,
|
|
3374
|
+
getReferenceProps,
|
|
3375
|
+
nodeId,
|
|
3376
|
+
activeIndex,
|
|
3377
|
+
setActiveIndex,
|
|
3378
|
+
middlewareData,
|
|
3379
|
+
side,
|
|
3380
|
+
modal,
|
|
3381
|
+
setTriggerType
|
|
3382
|
+
},
|
|
3383
|
+
children
|
|
3384
|
+
}
|
|
3385
|
+
) });
|
|
3386
|
+
});
|
|
3387
|
+
MenuRoot.displayName = "Root";
|
|
3388
|
+
const MenuScroll = react.memo((props) => {
|
|
3637
3389
|
const { ref, className, ...rest } = props;
|
|
3638
3390
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
3639
3391
|
"div",
|
|
@@ -3650,13 +3402,13 @@
|
|
|
3650
3402
|
MenuScroll.displayName = "MenuScroll";
|
|
3651
3403
|
const MenuSelectAllItem = genericMemo((props) => {
|
|
3652
3404
|
const { ref, children, onSelect, closeOnSelect = false, ...rest } = props;
|
|
3653
|
-
const { allSelected, someSelected, toggleSelectAll } =
|
|
3405
|
+
const { allSelected, someSelected, toggleSelectAll } = react.use(MultiSelectContext);
|
|
3654
3406
|
const selectedState = allSelected ? true : someSelected ? "indeterminate" : false;
|
|
3655
|
-
const handleSelect =
|
|
3407
|
+
const handleSelect = react.useCallback(() => {
|
|
3656
3408
|
onSelect == null ? void 0 : onSelect();
|
|
3657
3409
|
toggleSelectAll();
|
|
3658
3410
|
}, [onSelect, toggleSelectAll]);
|
|
3659
|
-
const computedChildren =
|
|
3411
|
+
const computedChildren = react.useMemo(() => {
|
|
3660
3412
|
return typeof children === "function" ? ({ active }) => children({ selected: selectedState, active }) : children;
|
|
3661
3413
|
}, [children, selectedState]);
|
|
3662
3414
|
return /* @__PURE__ */ jsxRuntime.jsx(CheckedIndicatorContext, { value: selectedState, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
@@ -3671,6 +3423,11 @@
|
|
|
3671
3423
|
}
|
|
3672
3424
|
) });
|
|
3673
3425
|
});
|
|
3426
|
+
const MenuSelectedIndicator = react.memo((props) => {
|
|
3427
|
+
const { ref, children, ...rest } = props;
|
|
3428
|
+
return /* @__PURE__ */ jsxRuntime.jsx(SelectedIndicator, { ref, ...rest, children });
|
|
3429
|
+
});
|
|
3430
|
+
MenuSelectedIndicator.displayName = "MenuSelectedIndicator";
|
|
3674
3431
|
const MenuSelectGroup = genericMemo(function MenuSelectGroup2(props) {
|
|
3675
3432
|
const { ref, children, required, defaultValue, value, onValueChange, ...rest } = props;
|
|
3676
3433
|
return /* @__PURE__ */ jsxRuntime.jsx(MenuGroup, { ref, ...rest, children: required ? /* @__PURE__ */ jsxRuntime.jsx(SingleSelectRequiredProvider, { defaultValue, value, onValueChange, children }) : /* @__PURE__ */ jsxRuntime.jsx(
|
|
@@ -3685,13 +3442,13 @@
|
|
|
3685
3442
|
});
|
|
3686
3443
|
const MenuSelectItem = genericMemo(function(props) {
|
|
3687
3444
|
const { ref, value, onSelect, children, closeOnSelect = true, ...rest } = props;
|
|
3688
|
-
const { selected, selectValue } =
|
|
3689
|
-
const isSelected =
|
|
3690
|
-
const handleSelect =
|
|
3445
|
+
const { selected, selectValue } = react.use(SelectContext);
|
|
3446
|
+
const isSelected = selected(value);
|
|
3447
|
+
const handleSelect = react.useCallback(() => {
|
|
3691
3448
|
onSelect == null ? void 0 : onSelect();
|
|
3692
3449
|
selectValue(value);
|
|
3693
3450
|
}, [onSelect, selectValue, value]);
|
|
3694
|
-
const computedChildren =
|
|
3451
|
+
const computedChildren = react.useMemo(() => {
|
|
3695
3452
|
return typeof children === "function" ? ({ active }) => children({ selected: isSelected, active }) : children;
|
|
3696
3453
|
}, [children, isSelected]);
|
|
3697
3454
|
return /* @__PURE__ */ jsxRuntime.jsx(SelectedIndicatorContext.Provider, { value: isSelected, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
@@ -3705,19 +3462,136 @@
|
|
|
3705
3462
|
...rest,
|
|
3706
3463
|
children: computedChildren
|
|
3707
3464
|
}
|
|
3708
|
-
) });
|
|
3709
|
-
});
|
|
3710
|
-
const MenuSeparator =
|
|
3711
|
-
const { ref, className, ...rest } = props;
|
|
3712
|
-
const { size } =
|
|
3713
|
-
return /* @__PURE__ */ jsxRuntime.jsx(RadixSeparator__namespace.Root, { className: classVarianceAuthority.cx(menuSeparator({ size }), className), ref, ...rest });
|
|
3465
|
+
) });
|
|
3466
|
+
});
|
|
3467
|
+
const MenuSeparator = react.memo((props) => {
|
|
3468
|
+
const { ref, className, ...rest } = props;
|
|
3469
|
+
const { size } = react.use(MenuContentContext);
|
|
3470
|
+
return /* @__PURE__ */ jsxRuntime.jsx(RadixSeparator__namespace.Root, { className: classVarianceAuthority.cx(menuSeparator({ size }), className), ref, ...rest });
|
|
3471
|
+
});
|
|
3472
|
+
MenuSeparator.displayName = "MenuSeparator";
|
|
3473
|
+
const computeOffsets = (side, alignment) => {
|
|
3474
|
+
switch (side) {
|
|
3475
|
+
case "right":
|
|
3476
|
+
if (alignment === "start") {
|
|
3477
|
+
return { mainAxis: MENU_CONTENT_PADDING + 1, crossAxis: -MENU_CONTENT_PADDING };
|
|
3478
|
+
} else if (alignment === "end") {
|
|
3479
|
+
return { mainAxis: MENU_CONTENT_PADDING + 1, crossAxis: MENU_CONTENT_PADDING };
|
|
3480
|
+
}
|
|
3481
|
+
break;
|
|
3482
|
+
case "left":
|
|
3483
|
+
if (alignment === "start") {
|
|
3484
|
+
return { mainAxis: MENU_CONTENT_PADDING + 1, crossAxis: -MENU_CONTENT_PADDING };
|
|
3485
|
+
} else if (alignment === "end") {
|
|
3486
|
+
return { mainAxis: MENU_CONTENT_PADDING + 1, crossAxis: MENU_CONTENT_PADDING };
|
|
3487
|
+
}
|
|
3488
|
+
break;
|
|
3489
|
+
}
|
|
3490
|
+
return { mainAxis: MENU_CONTENT_PADDING + 1, crossAxis: 0 };
|
|
3491
|
+
};
|
|
3492
|
+
const MenuSub = react.memo((props) => {
|
|
3493
|
+
const {
|
|
3494
|
+
children,
|
|
3495
|
+
disabled = false,
|
|
3496
|
+
side = "right",
|
|
3497
|
+
align = "start",
|
|
3498
|
+
closeRoot = false,
|
|
3499
|
+
loop = false,
|
|
3500
|
+
modal = false,
|
|
3501
|
+
// open state related props
|
|
3502
|
+
open: controlledOpen,
|
|
3503
|
+
onOpenChange,
|
|
3504
|
+
defaultOpen
|
|
3505
|
+
} = props;
|
|
3506
|
+
const [open, setOpen] = useControlledState(defaultOpen ?? false, controlledOpen, onOpenChange);
|
|
3507
|
+
const nodeId = react$1.useFloatingNodeId();
|
|
3508
|
+
const { refs, floatingStyles, context } = react$1.useFloating({
|
|
3509
|
+
nodeId,
|
|
3510
|
+
strategy: "fixed",
|
|
3511
|
+
whileElementsMounted: react$1.autoUpdate,
|
|
3512
|
+
open,
|
|
3513
|
+
onOpenChange: (open2, _event, reason) => {
|
|
3514
|
+
if (reason) setOpen(open2);
|
|
3515
|
+
},
|
|
3516
|
+
placement: side + (align !== "center" ? "-" + align : ""),
|
|
3517
|
+
middleware: [
|
|
3518
|
+
react$1.offset({ ...computeOffsets(side, align) }),
|
|
3519
|
+
react$1.size({
|
|
3520
|
+
padding: MENU_OVERFLOW_PADDING,
|
|
3521
|
+
apply({ availableHeight, elements }) {
|
|
3522
|
+
elements.floating.style.setProperty(
|
|
3523
|
+
"--overmap-menu-available-height",
|
|
3524
|
+
`${Math.max(availableHeight, MENU_MINIMUM_MAX_HEIGHT)}px`
|
|
3525
|
+
);
|
|
3526
|
+
}
|
|
3527
|
+
}),
|
|
3528
|
+
react$1.flip(),
|
|
3529
|
+
react$1.shift({ padding: MENU_OVERFLOW_PADDING }),
|
|
3530
|
+
react$1.hide()
|
|
3531
|
+
]
|
|
3532
|
+
});
|
|
3533
|
+
const dismiss = react$1.useDismiss(context, {
|
|
3534
|
+
bubbles: closeRoot,
|
|
3535
|
+
outsidePress: closeRoot
|
|
3536
|
+
});
|
|
3537
|
+
const hover = react$1.useHover(context, {
|
|
3538
|
+
restMs: 50,
|
|
3539
|
+
handleClose: react$1.safePolygon({
|
|
3540
|
+
blockPointerEvents: true,
|
|
3541
|
+
requireIntent: false
|
|
3542
|
+
}),
|
|
3543
|
+
enabled: !disabled
|
|
3544
|
+
});
|
|
3545
|
+
const click = react$1.useClick(context, {
|
|
3546
|
+
enabled: !disabled
|
|
3547
|
+
});
|
|
3548
|
+
const elementsRef = react.useRef([]);
|
|
3549
|
+
const [activeIndex, setActiveIndex] = react.useState(null);
|
|
3550
|
+
const listNavigation = react$1.useListNavigation(context, {
|
|
3551
|
+
listRef: elementsRef,
|
|
3552
|
+
nested: true,
|
|
3553
|
+
activeIndex,
|
|
3554
|
+
onNavigate: setActiveIndex,
|
|
3555
|
+
loop,
|
|
3556
|
+
rtl: side === "left"
|
|
3557
|
+
});
|
|
3558
|
+
const { getFloatingProps, getItemProps, getReferenceProps } = react$1.useInteractions([
|
|
3559
|
+
listNavigation,
|
|
3560
|
+
dismiss,
|
|
3561
|
+
hover,
|
|
3562
|
+
click
|
|
3563
|
+
]);
|
|
3564
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
3565
|
+
SubContext.Provider,
|
|
3566
|
+
{
|
|
3567
|
+
value: {
|
|
3568
|
+
open,
|
|
3569
|
+
setOpen,
|
|
3570
|
+
nodeId,
|
|
3571
|
+
refs,
|
|
3572
|
+
floatingStyles,
|
|
3573
|
+
context,
|
|
3574
|
+
elementsRef,
|
|
3575
|
+
activeIndex,
|
|
3576
|
+
setActiveIndex,
|
|
3577
|
+
getFloatingProps,
|
|
3578
|
+
getItemProps,
|
|
3579
|
+
getReferenceProps,
|
|
3580
|
+
disabled,
|
|
3581
|
+
side,
|
|
3582
|
+
closeRoot,
|
|
3583
|
+
modal
|
|
3584
|
+
},
|
|
3585
|
+
children
|
|
3586
|
+
}
|
|
3587
|
+
);
|
|
3714
3588
|
});
|
|
3715
|
-
|
|
3716
|
-
const MenuSubContent =
|
|
3589
|
+
MenuSub.displayName = "SubMenu";
|
|
3590
|
+
const MenuSubContent = react.memo((props) => {
|
|
3717
3591
|
var _a;
|
|
3718
3592
|
const { ref: forwardedRef, children, ...rest } = props;
|
|
3719
|
-
const { middlewareData } =
|
|
3720
|
-
const { accentColor, radius, variant, size } =
|
|
3593
|
+
const { middlewareData } = react.use(MenuContext);
|
|
3594
|
+
const { accentColor, radius, variant, size } = react.use(MenuContentContext);
|
|
3721
3595
|
const {
|
|
3722
3596
|
open,
|
|
3723
3597
|
nodeId,
|
|
@@ -3731,17 +3605,17 @@
|
|
|
3731
3605
|
floatingStyles,
|
|
3732
3606
|
setOpen,
|
|
3733
3607
|
side
|
|
3734
|
-
} =
|
|
3735
|
-
const wrapperRef =
|
|
3736
|
-
const mergeRefs2 = react.useMergeRefs([refs.setFloating, wrapperRef]);
|
|
3737
|
-
const computedFloatingStyles =
|
|
3608
|
+
} = react.use(SubContext);
|
|
3609
|
+
const wrapperRef = react.useRef(null);
|
|
3610
|
+
const mergeRefs2 = react$1.useMergeRefs([refs.setFloating, wrapperRef]);
|
|
3611
|
+
const computedFloatingStyles = react.useMemo(() => {
|
|
3738
3612
|
var _a2;
|
|
3739
3613
|
return {
|
|
3740
3614
|
...floatingStyles,
|
|
3741
3615
|
visibility: ((_a2 = middlewareData.hide) == null ? void 0 : _a2.referenceHidden) ? "hidden" : "visible"
|
|
3742
3616
|
};
|
|
3743
3617
|
}, [floatingStyles, (_a = middlewareData.hide) == null ? void 0 : _a.referenceHidden]);
|
|
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(
|
|
3618
|
+
return /* @__PURE__ */ jsxRuntime.jsx(react$1.FloatingNode, { id: nodeId, children: open && /* @__PURE__ */ jsxRuntime.jsx(react$1.FloatingPortal, { children: /* @__PURE__ */ jsxRuntime.jsx(react$1.FloatingFocusManager, { context, initialFocus: wrapperRef, children: /* @__PURE__ */ jsxRuntime.jsx(react$1.FloatingList, { elementsRef, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
3745
3619
|
MenuContentContext.Provider,
|
|
3746
3620
|
{
|
|
3747
3621
|
value: {
|
|
@@ -3788,10 +3662,10 @@
|
|
|
3788
3662
|
) }) }) }) });
|
|
3789
3663
|
});
|
|
3790
3664
|
MenuSubContent.displayName = "MenuSubContent";
|
|
3791
|
-
const MenuSubTrigger =
|
|
3665
|
+
const MenuSubTrigger = react.memo((props) => {
|
|
3792
3666
|
const { ref: forwardedRef, children, ...rest } = props;
|
|
3793
|
-
const { refs, getReferenceProps, open, disabled } =
|
|
3794
|
-
const mergedRefs = react.useMergeRefs([forwardedRef, refs.setReference]);
|
|
3667
|
+
const { refs, getReferenceProps, open, disabled } = react.use(SubContext);
|
|
3668
|
+
const mergedRefs = react$1.useMergeRefs([forwardedRef, refs.setReference]);
|
|
3795
3669
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
3796
3670
|
MenuItem,
|
|
3797
3671
|
{
|
|
@@ -3806,13 +3680,13 @@
|
|
|
3806
3680
|
);
|
|
3807
3681
|
});
|
|
3808
3682
|
MenuSubTrigger.displayName = "MenuSubTrigger";
|
|
3809
|
-
const MenuVirtualTrigger =
|
|
3683
|
+
const MenuVirtualTrigger = react.memo((props) => {
|
|
3810
3684
|
const { virtualElement, disabled } = props;
|
|
3811
|
-
const { refs, setTriggerType, setOpen } =
|
|
3812
|
-
|
|
3685
|
+
const { refs, setTriggerType, setOpen } = react.use(MenuContext);
|
|
3686
|
+
react.useEffect(() => {
|
|
3813
3687
|
setTriggerType("virtual");
|
|
3814
3688
|
}, [setTriggerType]);
|
|
3815
|
-
|
|
3689
|
+
react.useEffect(() => {
|
|
3816
3690
|
if (!disabled && virtualElement) {
|
|
3817
3691
|
refs.setPositionReference(virtualElement);
|
|
3818
3692
|
setOpen(true);
|
|
@@ -3861,11 +3735,562 @@
|
|
|
3861
3735
|
Separator: MenuSeparator,
|
|
3862
3736
|
Scroll: MenuScroll
|
|
3863
3737
|
};
|
|
3864
|
-
const
|
|
3738
|
+
const KEY_MAPPING = {
|
|
3739
|
+
next: "ArrowDown",
|
|
3740
|
+
prev: "ArrowUp",
|
|
3741
|
+
first: "PageUp",
|
|
3742
|
+
last: "PageDown",
|
|
3743
|
+
selectItem: "Enter"
|
|
3744
|
+
};
|
|
3745
|
+
const ITEM_SELECTOR = "menu-item";
|
|
3746
|
+
const GROUP_SELECTOR = "menu-group";
|
|
3747
|
+
const MenuRootContext = react.createContext({});
|
|
3748
|
+
const MenuGroupContext = react.createContext({});
|
|
3749
|
+
const MenuPageContext = react.createContext({});
|
|
3750
|
+
const menuRootCva = classVarianceAuthority.cva(["w-full", "outline-none"], {
|
|
3751
|
+
variants: {
|
|
3752
|
+
size: {
|
|
3753
|
+
xs: ["p-0.5", "text-xs", "min-w-30"],
|
|
3754
|
+
sm: ["p-0.75", "text-sm", "min-w-35"],
|
|
3755
|
+
md: ["p-1", "text-md", "min-w-40"],
|
|
3756
|
+
lg: ["p-1.25", "text-lg", "min-w-45"],
|
|
3757
|
+
xl: ["p-1.5", "text-xl", "min-w-50"]
|
|
3758
|
+
},
|
|
3759
|
+
radius: {
|
|
3760
|
+
none: ["rounded-none"],
|
|
3761
|
+
xs: ["rounded-xs"],
|
|
3762
|
+
sm: ["rounded-sm"],
|
|
3763
|
+
md: ["rounded-md"],
|
|
3764
|
+
lg: ["rounded-lg"],
|
|
3765
|
+
xl: ["rounded-lg"],
|
|
3766
|
+
full: ["rounded-lg"]
|
|
3767
|
+
}
|
|
3768
|
+
}
|
|
3769
|
+
});
|
|
3770
|
+
const menuItemCva = classVarianceAuthority.cva(
|
|
3771
|
+
[
|
|
3772
|
+
"select-none",
|
|
3773
|
+
"relative",
|
|
3774
|
+
"flex",
|
|
3775
|
+
"items-center",
|
|
3776
|
+
"outline-none",
|
|
3777
|
+
"data-[disabled=true]:text-(--base-a8)",
|
|
3778
|
+
"data-[disabled=true]:pointer-events-none",
|
|
3779
|
+
"shrink-0",
|
|
3780
|
+
"py-1",
|
|
3781
|
+
"text-(--base-12)"
|
|
3782
|
+
],
|
|
3783
|
+
{
|
|
3784
|
+
variants: {
|
|
3785
|
+
size: {
|
|
3786
|
+
xs: ["gap-1.5", "px-3"],
|
|
3787
|
+
sm: ["gap-1.75", "px-3.5"],
|
|
3788
|
+
md: ["gap-2", "px-4"],
|
|
3789
|
+
lg: ["gap-2.25", "px-4.5"],
|
|
3790
|
+
xl: ["gap-2.5", "px-5"]
|
|
3791
|
+
},
|
|
3792
|
+
variant: {
|
|
3793
|
+
solid: [
|
|
3794
|
+
"data-[active=true]:not-[data-[disabled=true]]:text-(--accent-contrast)",
|
|
3795
|
+
"data-[active=true]:not-[data-[disabled=true]]:bg-(--accent-a9)",
|
|
3796
|
+
"data-[active=true]:not-[data-[disabled=true]]:active:brightness-110"
|
|
3797
|
+
],
|
|
3798
|
+
soft: [
|
|
3799
|
+
"data-[active=true]:not-[data-[disabled=true]]:bg-(--accent-a3)",
|
|
3800
|
+
"data-[active=true]:not-[data-[disabled=true]]:active:bg-(--accent-a4)"
|
|
3801
|
+
]
|
|
3802
|
+
}
|
|
3803
|
+
}
|
|
3804
|
+
}
|
|
3805
|
+
);
|
|
3806
|
+
const menuGroupLabelCva = classVarianceAuthority.cva(["text-(--base-a11)", "flex", "items-center", "select-none", "py-1"], {
|
|
3807
|
+
variants: {
|
|
3808
|
+
size: {
|
|
3809
|
+
xs: ["gap-1.5", "px-3", "text-xs"],
|
|
3810
|
+
sm: ["gap-1.75", "px-3.5", "text-xs"],
|
|
3811
|
+
md: ["gap-2", "px-4", "text-sm"],
|
|
3812
|
+
lg: ["gap-2.25", "px-4.5", "text-base"],
|
|
3813
|
+
xl: ["gap-2.5", "px-5", "text-lg"]
|
|
3814
|
+
}
|
|
3815
|
+
}
|
|
3816
|
+
});
|
|
3817
|
+
const menuSeparatorCva = classVarianceAuthority.cva(["h-px", "bg-(--base-a6)", "w-auto", "shrink-0"], {
|
|
3818
|
+
variants: {
|
|
3819
|
+
size: {
|
|
3820
|
+
xs: ["-mx-0.5", "my-0.5"],
|
|
3821
|
+
sm: ["-mx-0.75", "my-0.75"],
|
|
3822
|
+
md: ["-mx-1", "my-1"],
|
|
3823
|
+
lg: ["-mx-1.25", "my-1.25"],
|
|
3824
|
+
xl: ["-mx-1.5", "my-1.5"]
|
|
3825
|
+
}
|
|
3826
|
+
}
|
|
3827
|
+
});
|
|
3828
|
+
const MenuV2Item = react.memo((props) => {
|
|
3829
|
+
const {
|
|
3830
|
+
ref,
|
|
3831
|
+
children,
|
|
3832
|
+
className,
|
|
3833
|
+
disabled = false,
|
|
3834
|
+
onClick,
|
|
3835
|
+
onSelect,
|
|
3836
|
+
onPointerEnter,
|
|
3837
|
+
onPointerLeave,
|
|
3838
|
+
onPointerMove,
|
|
3839
|
+
...rest
|
|
3840
|
+
} = props;
|
|
3841
|
+
const internalRef = react.useRef(null);
|
|
3842
|
+
const itemId = react.useId();
|
|
3843
|
+
const { activeItemId, setActiveItemId, size, variant, radius } = react.use(MenuRootContext);
|
|
3844
|
+
const isActive = itemId === activeItemId;
|
|
3845
|
+
const handleSelect = react.useCallback(
|
|
3846
|
+
(e) => {
|
|
3847
|
+
onSelect == null ? void 0 : onSelect(e);
|
|
3848
|
+
},
|
|
3849
|
+
[onSelect]
|
|
3850
|
+
);
|
|
3851
|
+
const handleClick = react.useCallback(
|
|
3852
|
+
(e) => {
|
|
3853
|
+
onClick == null ? void 0 : onClick(e);
|
|
3854
|
+
handleSelect(new Event("menu-select"));
|
|
3855
|
+
},
|
|
3856
|
+
[handleSelect, onClick]
|
|
3857
|
+
);
|
|
3858
|
+
const handlePointerEnter = react.useCallback(
|
|
3859
|
+
(e) => {
|
|
3860
|
+
onPointerEnter == null ? void 0 : onPointerEnter(e);
|
|
3861
|
+
if (e.defaultPrevented) return;
|
|
3862
|
+
setActiveItemId(itemId);
|
|
3863
|
+
},
|
|
3864
|
+
[onPointerEnter, setActiveItemId, itemId]
|
|
3865
|
+
);
|
|
3866
|
+
const handlePointerLeave = react.useCallback(
|
|
3867
|
+
(e) => {
|
|
3868
|
+
onPointerLeave == null ? void 0 : onPointerLeave(e);
|
|
3869
|
+
if (e.defaultPrevented) return;
|
|
3870
|
+
setActiveItemId(null);
|
|
3871
|
+
},
|
|
3872
|
+
[onPointerLeave, setActiveItemId]
|
|
3873
|
+
);
|
|
3874
|
+
const handlePointerMove = react.useCallback(
|
|
3875
|
+
(e) => {
|
|
3876
|
+
onPointerMove == null ? void 0 : onPointerMove(e);
|
|
3877
|
+
if (e.defaultPrevented) return;
|
|
3878
|
+
setActiveItemId(itemId);
|
|
3879
|
+
},
|
|
3880
|
+
[onPointerMove, itemId, setActiveItemId]
|
|
3881
|
+
);
|
|
3882
|
+
react.useEffect(() => {
|
|
3883
|
+
if (!internalRef.current) return;
|
|
3884
|
+
const element = internalRef.current;
|
|
3885
|
+
element.addEventListener("menu-select", handleSelect);
|
|
3886
|
+
return () => {
|
|
3887
|
+
element.removeEventListener("menu-select", handleSelect);
|
|
3888
|
+
};
|
|
3889
|
+
}, [handleSelect]);
|
|
3890
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
3891
|
+
"div",
|
|
3892
|
+
{
|
|
3893
|
+
ref: mergeRefs([ref, internalRef]),
|
|
3894
|
+
className: classVarianceAuthority.cx(menuItemCva({ size, variant }), radiusCva({ radius, maxLarge: true }), className),
|
|
3895
|
+
role: "menuitem",
|
|
3896
|
+
onClick: handleClick,
|
|
3897
|
+
onPointerEnter: handlePointerEnter,
|
|
3898
|
+
onPointerLeave: handlePointerLeave,
|
|
3899
|
+
onPointerMove: handlePointerMove,
|
|
3900
|
+
...{ [ITEM_SELECTOR]: itemId },
|
|
3901
|
+
"data-active": getBooleanState(isActive),
|
|
3902
|
+
"data-disabled": getBooleanState(disabled),
|
|
3903
|
+
"aria-disabled": getBooleanState(disabled),
|
|
3904
|
+
...rest,
|
|
3905
|
+
children
|
|
3906
|
+
}
|
|
3907
|
+
);
|
|
3908
|
+
});
|
|
3909
|
+
MenuV2Item.displayName = "MenuItem";
|
|
3910
|
+
const MenuV2CheckboxItem = react.memo((props) => {
|
|
3911
|
+
const { ref, checked, onCheckedChange, onSelect, ...rest } = props;
|
|
3912
|
+
const handleSelect = react.useCallback(
|
|
3913
|
+
(e) => {
|
|
3914
|
+
onSelect == null ? void 0 : onSelect(e);
|
|
3915
|
+
if (e.defaultPrevented) return;
|
|
3916
|
+
switch (checked) {
|
|
3917
|
+
case true:
|
|
3918
|
+
onCheckedChange(false);
|
|
3919
|
+
break;
|
|
3920
|
+
case "indeterminate":
|
|
3921
|
+
onCheckedChange(true);
|
|
3922
|
+
break;
|
|
3923
|
+
case false:
|
|
3924
|
+
onCheckedChange(true);
|
|
3925
|
+
break;
|
|
3926
|
+
}
|
|
3927
|
+
},
|
|
3928
|
+
[checked, onCheckedChange, onSelect]
|
|
3929
|
+
);
|
|
3930
|
+
return /* @__PURE__ */ jsxRuntime.jsx(CheckedIndicatorContext.Provider, { value: checked, children: /* @__PURE__ */ jsxRuntime.jsx(MenuV2Item, { ref, onSelect: handleSelect, ...rest }) });
|
|
3931
|
+
});
|
|
3932
|
+
MenuV2CheckboxItem.displayName = "MenuCheckboxItem";
|
|
3933
|
+
const MenuV2CheckedIndicator = react.memo((props) => {
|
|
3934
|
+
const { ref, children, ...rest } = props;
|
|
3935
|
+
return /* @__PURE__ */ jsxRuntime.jsx(CheckedIndicator, { ref, ...rest, children });
|
|
3936
|
+
});
|
|
3937
|
+
MenuV2CheckedIndicator.displayName = "MenuCheckboxItemIndicator";
|
|
3938
|
+
const MenuV2Group = react.memo((props) => {
|
|
3939
|
+
const { ref, children, ...rest } = props;
|
|
3940
|
+
const groupId = react.useId();
|
|
3941
|
+
const [labelId, setLabelId] = react.useState(null);
|
|
3942
|
+
const contextValue = react.useMemo(
|
|
3943
|
+
() => ({
|
|
3944
|
+
labelId,
|
|
3945
|
+
setLabelId
|
|
3946
|
+
}),
|
|
3947
|
+
[labelId]
|
|
3948
|
+
);
|
|
3949
|
+
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 }) });
|
|
3950
|
+
});
|
|
3951
|
+
MenuV2Group.displayName = "MenuGroup";
|
|
3952
|
+
const MenuV2GroupLabel = react.memo((props) => {
|
|
3953
|
+
const { ref, children, id, className, ...rest } = props;
|
|
3954
|
+
const labelId = useFallbackId(id);
|
|
3955
|
+
const { size } = react.use(MenuRootContext);
|
|
3956
|
+
const { setLabelId } = react.use(MenuGroupContext);
|
|
3957
|
+
react.useEffect(() => {
|
|
3958
|
+
setLabelId(labelId);
|
|
3959
|
+
}, [labelId, setLabelId]);
|
|
3960
|
+
return /* @__PURE__ */ jsxRuntime.jsx("div", { ref, id: labelId, className: classVarianceAuthority.cx(menuGroupLabelCva({ size }), className), ...rest, children });
|
|
3961
|
+
});
|
|
3962
|
+
MenuV2GroupLabel.displayName = "MenuGroupLabel";
|
|
3963
|
+
const MenuV2SelectAllItem = genericMemo((props) => {
|
|
3964
|
+
const { ref, children, onSelect, ...rest } = props;
|
|
3965
|
+
const { allSelected, someSelected, toggleSelectAll } = react.use(MultiSelectContext);
|
|
3966
|
+
const selectedState = allSelected ? true : someSelected ? "indeterminate" : false;
|
|
3967
|
+
const handleSelect = react.useCallback(
|
|
3968
|
+
(e) => {
|
|
3969
|
+
onSelect == null ? void 0 : onSelect(e);
|
|
3970
|
+
if (e.defaultPrevented) return;
|
|
3971
|
+
toggleSelectAll();
|
|
3972
|
+
},
|
|
3973
|
+
[onSelect, toggleSelectAll]
|
|
3974
|
+
);
|
|
3975
|
+
return /* @__PURE__ */ jsxRuntime.jsx(MenuV2Item, { onSelect: handleSelect, ref, "data-state": getCheckedState(selectedState), ...rest, children: /* @__PURE__ */ jsxRuntime.jsx(CheckedIndicatorContext, { value: selectedState, children }) });
|
|
3976
|
+
});
|
|
3977
|
+
const MenuV2MultiSelectGroup = genericMemo(function MenuMultiSelectGroup2(props) {
|
|
3978
|
+
const { ref, children, defaultValues, values, onValuesChange, ...rest } = props;
|
|
3979
|
+
return /* @__PURE__ */ jsxRuntime.jsx(MenuV2Group, { ref, ...rest, children: /* @__PURE__ */ jsxRuntime.jsx(MultiSelectProvider, { defaultValues, values, onValuesChange, children }) });
|
|
3980
|
+
});
|
|
3981
|
+
const MenuV2MultiSelectItem = genericMemo(function(props) {
|
|
3982
|
+
const { ref, onSelect, children, value, ...rest } = props;
|
|
3983
|
+
const { selected, selectValue, registerValue } = react.use(MultiSelectContext);
|
|
3984
|
+
react.useLayoutEffect(() => {
|
|
3985
|
+
return registerValue(value);
|
|
3986
|
+
}, [registerValue, value]);
|
|
3987
|
+
const isSelected = selected(value);
|
|
3988
|
+
const handleSelect = react.useCallback(
|
|
3989
|
+
(e) => {
|
|
3990
|
+
onSelect == null ? void 0 : onSelect(e);
|
|
3991
|
+
if (e.defaultPrevented) return;
|
|
3992
|
+
selectValue(value);
|
|
3993
|
+
},
|
|
3994
|
+
[onSelect, selectValue, value]
|
|
3995
|
+
);
|
|
3996
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
3997
|
+
MenuV2Item,
|
|
3998
|
+
{
|
|
3999
|
+
ref,
|
|
4000
|
+
role: "menuitemcheckbox",
|
|
4001
|
+
onSelect: handleSelect,
|
|
4002
|
+
"data-state": getSelectedState(isSelected),
|
|
4003
|
+
...rest,
|
|
4004
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(SelectedIndicatorContext, { value: isSelected, children })
|
|
4005
|
+
}
|
|
4006
|
+
);
|
|
4007
|
+
});
|
|
4008
|
+
const MenuV2Page = react.memo((props) => {
|
|
4009
|
+
const { children, ref, page, ...rest } = props;
|
|
4010
|
+
const { page: activePage } = react.use(MenuPageContext);
|
|
4011
|
+
const isActive = page === activePage;
|
|
4012
|
+
return /* @__PURE__ */ jsxRuntime.jsx("div", { ref, "data-active": getActiveState(isActive), hidden: !isActive, ...rest, children: isActive ? children : null });
|
|
4013
|
+
});
|
|
4014
|
+
MenuV2Page.displayName = "MenuPage";
|
|
4015
|
+
const MenuV2Pages = react.memo((props) => {
|
|
4016
|
+
const { children, defaultPage = "", page: controlledPage, onPageChange } = props;
|
|
4017
|
+
const [page, setPage] = useControlledState(defaultPage, controlledPage, onPageChange);
|
|
4018
|
+
const contextValue = react.useMemo(
|
|
4019
|
+
() => ({
|
|
4020
|
+
page,
|
|
4021
|
+
setPage
|
|
4022
|
+
}),
|
|
4023
|
+
[page, setPage]
|
|
4024
|
+
);
|
|
4025
|
+
return /* @__PURE__ */ jsxRuntime.jsx(MenuPageContext, { value: contextValue, children });
|
|
4026
|
+
});
|
|
4027
|
+
MenuV2Pages.displayName = "MenuPages";
|
|
4028
|
+
const MenuV2PageTriggerItem = react.memo((props) => {
|
|
4029
|
+
const { ref, children, page, onSelect, ...rest } = props;
|
|
4030
|
+
const { page: activePage, setPage } = react.use(MenuPageContext);
|
|
4031
|
+
const isActive = page === activePage;
|
|
4032
|
+
const handleSelect = react.useCallback(
|
|
4033
|
+
(e) => {
|
|
4034
|
+
onSelect == null ? void 0 : onSelect(e);
|
|
4035
|
+
if (e.defaultPrevented) return;
|
|
4036
|
+
setPage(page);
|
|
4037
|
+
},
|
|
4038
|
+
[onSelect, page, setPage]
|
|
4039
|
+
);
|
|
4040
|
+
return /* @__PURE__ */ jsxRuntime.jsx(MenuV2Item, { ref, onSelect: handleSelect, "data-state": getActiveState(isActive), ...rest, children: /* @__PURE__ */ jsxRuntime.jsx(SelectedIndicatorContext, { value: isActive, children }) });
|
|
4041
|
+
});
|
|
4042
|
+
MenuV2PageTriggerItem.displayName = "CommandMenuPageTriggerItem";
|
|
4043
|
+
const computeNextIndex = (index, length, direction, loop) => {
|
|
4044
|
+
switch (direction) {
|
|
4045
|
+
case "next":
|
|
4046
|
+
return index === length - 1 ? loop ? 0 : index : index + 1;
|
|
4047
|
+
case "prev":
|
|
4048
|
+
return index === 0 ? loop ? length - 1 : index : index - 1;
|
|
4049
|
+
}
|
|
4050
|
+
};
|
|
4051
|
+
const MenuV2Root = react.memo((props) => {
|
|
4052
|
+
const providerContext = useProvider();
|
|
4053
|
+
const {
|
|
4054
|
+
ref,
|
|
4055
|
+
children,
|
|
4056
|
+
className,
|
|
4057
|
+
onKeyDown,
|
|
4058
|
+
loop = false,
|
|
4059
|
+
// style props
|
|
4060
|
+
radius = providerContext.radius,
|
|
4061
|
+
accentColor = "base",
|
|
4062
|
+
size = "md",
|
|
4063
|
+
variant = "soft",
|
|
4064
|
+
...rest
|
|
4065
|
+
} = props;
|
|
4066
|
+
const internalRef = react.useRef(null);
|
|
4067
|
+
const [activeItemId, setActiveItemId] = react.useState(null);
|
|
4068
|
+
const getItems = react.useCallback((element) => {
|
|
4069
|
+
return Array.from(element.querySelectorAll(`[${ITEM_SELECTOR}]:not([data-disabled=true]`));
|
|
4070
|
+
}, []);
|
|
4071
|
+
const getFirstItem = react.useCallback(
|
|
4072
|
+
(element) => {
|
|
4073
|
+
return getItems(element).at(0);
|
|
4074
|
+
},
|
|
4075
|
+
[getItems]
|
|
4076
|
+
);
|
|
4077
|
+
const getLastItem = react.useCallback(
|
|
4078
|
+
(element) => {
|
|
4079
|
+
return getItems(element).at(-1);
|
|
4080
|
+
},
|
|
4081
|
+
[getItems]
|
|
4082
|
+
);
|
|
4083
|
+
const getActiveItem = react.useCallback(
|
|
4084
|
+
(element) => {
|
|
4085
|
+
return getItems(element).find((itemEle) => itemEle.getAttribute(ITEM_SELECTOR) === activeItemId);
|
|
4086
|
+
},
|
|
4087
|
+
[activeItemId, getItems]
|
|
4088
|
+
);
|
|
4089
|
+
const getNextItem = react.useCallback(
|
|
4090
|
+
(element, direction) => {
|
|
4091
|
+
const items = getItems(element);
|
|
4092
|
+
const activeItem = getActiveItem(element);
|
|
4093
|
+
const activeItemIndex = items.findIndex((itemEle) => itemEle === activeItem);
|
|
4094
|
+
const nextItemIndex = computeNextIndex(activeItemIndex, items.length, direction, loop);
|
|
4095
|
+
return items[nextItemIndex];
|
|
4096
|
+
},
|
|
4097
|
+
[getActiveItem, getItems, loop]
|
|
4098
|
+
);
|
|
4099
|
+
const getGroups = react.useCallback(() => {
|
|
4100
|
+
if (!internalRef.current) return [];
|
|
4101
|
+
return Array.from(internalRef.current.querySelectorAll(`[${GROUP_SELECTOR}]`));
|
|
4102
|
+
}, []);
|
|
4103
|
+
const getActiveGroup = react.useCallback(() => {
|
|
4104
|
+
var _a;
|
|
4105
|
+
return ((_a = getActiveItem(internalRef.current)) == null ? void 0 : _a.closest(`[${GROUP_SELECTOR}]`)) ?? void 0;
|
|
4106
|
+
}, [getActiveItem]);
|
|
4107
|
+
const getNextGroup = react.useCallback(
|
|
4108
|
+
(direction) => {
|
|
4109
|
+
const groups = getGroups();
|
|
4110
|
+
const activeGroup = getActiveGroup();
|
|
4111
|
+
const activeGroupIndex = groups.findIndex((groupEle) => groupEle === activeGroup);
|
|
4112
|
+
const nextGroupIndex = computeNextIndex(activeGroupIndex, groups.length, direction, loop);
|
|
4113
|
+
return groups[nextGroupIndex];
|
|
4114
|
+
},
|
|
4115
|
+
[getActiveGroup, getGroups, loop]
|
|
4116
|
+
);
|
|
4117
|
+
const getFirstGroup = react.useCallback(() => {
|
|
4118
|
+
return getGroups().at(0);
|
|
4119
|
+
}, [getGroups]);
|
|
4120
|
+
const getLastGroup = react.useCallback(() => {
|
|
4121
|
+
return getGroups().at(-1);
|
|
4122
|
+
}, [getGroups]);
|
|
4123
|
+
const handleKeyDown = react.useCallback(
|
|
4124
|
+
(e) => {
|
|
4125
|
+
onKeyDown == null ? void 0 : onKeyDown(e);
|
|
4126
|
+
if (e.defaultPrevented) return;
|
|
4127
|
+
switch (e.code) {
|
|
4128
|
+
case KEY_MAPPING.selectItem: {
|
|
4129
|
+
const activeItem = getActiveItem(internalRef.current);
|
|
4130
|
+
if (activeItem) activeItem.dispatchEvent(new Event("menu-select"));
|
|
4131
|
+
break;
|
|
4132
|
+
}
|
|
4133
|
+
case KEY_MAPPING.next: {
|
|
4134
|
+
let nextItem;
|
|
4135
|
+
if (e.shiftKey) {
|
|
4136
|
+
const nextGroup = getNextGroup("next");
|
|
4137
|
+
if (!nextGroup) return;
|
|
4138
|
+
nextItem = getFirstItem(nextGroup);
|
|
4139
|
+
} else {
|
|
4140
|
+
nextItem = getNextItem(internalRef.current, "next");
|
|
4141
|
+
}
|
|
4142
|
+
if (!nextItem) return;
|
|
4143
|
+
setActiveItemId(nextItem.getAttribute(ITEM_SELECTOR));
|
|
4144
|
+
break;
|
|
4145
|
+
}
|
|
4146
|
+
case KEY_MAPPING.prev: {
|
|
4147
|
+
let prevItem;
|
|
4148
|
+
if (e.shiftKey) {
|
|
4149
|
+
const prevGroup = getNextGroup("prev");
|
|
4150
|
+
if (!prevGroup) return;
|
|
4151
|
+
prevItem = getFirstItem(prevGroup);
|
|
4152
|
+
} else {
|
|
4153
|
+
prevItem = getNextItem(internalRef.current, "prev");
|
|
4154
|
+
}
|
|
4155
|
+
if (!prevItem) return;
|
|
4156
|
+
setActiveItemId(prevItem.getAttribute(ITEM_SELECTOR));
|
|
4157
|
+
break;
|
|
4158
|
+
}
|
|
4159
|
+
case KEY_MAPPING.first: {
|
|
4160
|
+
let firstItem;
|
|
4161
|
+
if (e.shiftKey) {
|
|
4162
|
+
const firstGroup = getFirstGroup();
|
|
4163
|
+
if (!firstGroup) return;
|
|
4164
|
+
firstItem = getFirstItem(firstGroup);
|
|
4165
|
+
} else {
|
|
4166
|
+
firstItem = getFirstItem(internalRef.current);
|
|
4167
|
+
}
|
|
4168
|
+
if (!firstItem) return;
|
|
4169
|
+
setActiveItemId(firstItem.getAttribute(ITEM_SELECTOR));
|
|
4170
|
+
break;
|
|
4171
|
+
}
|
|
4172
|
+
case KEY_MAPPING.last: {
|
|
4173
|
+
let lastItem;
|
|
4174
|
+
if (e.shiftKey) {
|
|
4175
|
+
const lastGroup = getLastGroup();
|
|
4176
|
+
if (!lastGroup) return;
|
|
4177
|
+
lastItem = getFirstItem(lastGroup);
|
|
4178
|
+
} else {
|
|
4179
|
+
lastItem = getLastItem(internalRef.current);
|
|
4180
|
+
}
|
|
4181
|
+
if (!lastItem) return;
|
|
4182
|
+
setActiveItemId(lastItem.getAttribute(ITEM_SELECTOR));
|
|
4183
|
+
break;
|
|
4184
|
+
}
|
|
4185
|
+
}
|
|
4186
|
+
},
|
|
4187
|
+
[getActiveItem, getFirstGroup, getFirstItem, getLastGroup, getLastItem, getNextGroup, getNextItem, onKeyDown]
|
|
4188
|
+
);
|
|
4189
|
+
react.useEffect(() => {
|
|
4190
|
+
var _a;
|
|
4191
|
+
const firstItem = getFirstItem(internalRef.current);
|
|
4192
|
+
if (!firstItem) return;
|
|
4193
|
+
(_a = internalRef.current) == null ? void 0 : _a.focus();
|
|
4194
|
+
setActiveItemId(firstItem.getAttribute(ITEM_SELECTOR));
|
|
4195
|
+
}, [getFirstItem]);
|
|
4196
|
+
const contextValue = react.useMemo(
|
|
4197
|
+
() => ({
|
|
4198
|
+
activeItemId,
|
|
4199
|
+
setActiveItemId,
|
|
4200
|
+
// style props
|
|
4201
|
+
accentColor,
|
|
4202
|
+
radius,
|
|
4203
|
+
variant,
|
|
4204
|
+
size
|
|
4205
|
+
}),
|
|
4206
|
+
[accentColor, activeItemId, radius, size, variant]
|
|
4207
|
+
);
|
|
4208
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
4209
|
+
"div",
|
|
4210
|
+
{
|
|
4211
|
+
ref: mergeRefs([ref, internalRef]),
|
|
4212
|
+
className: classVarianceAuthority.cx(menuRootCva({ size }), radiusCva({ radius, maxLarge: true }), className),
|
|
4213
|
+
role: "menu",
|
|
4214
|
+
onKeyDown: handleKeyDown,
|
|
4215
|
+
tabIndex: 0,
|
|
4216
|
+
"aria-activedescendant": activeItemId ?? void 0,
|
|
4217
|
+
"data-accent-color": accentColor,
|
|
4218
|
+
...rest,
|
|
4219
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(MenuRootContext, { value: contextValue, children })
|
|
4220
|
+
}
|
|
4221
|
+
);
|
|
4222
|
+
});
|
|
4223
|
+
MenuV2Root.displayName = "MenuRoot";
|
|
4224
|
+
const MenuV2SelectedIndicator = react.memo((props) => {
|
|
4225
|
+
const { ref, children, ...rest } = props;
|
|
4226
|
+
return /* @__PURE__ */ jsxRuntime.jsx(SelectedIndicator, { ref, ...rest, children });
|
|
4227
|
+
});
|
|
4228
|
+
MenuV2SelectedIndicator.displayName = "MenuCheckboxItemIndicator";
|
|
4229
|
+
const MenuV2SelectGroup = genericMemo(function MenuSelectGroup2(props) {
|
|
4230
|
+
const { ref, children, required, defaultValue, value, onValueChange, ...rest } = props;
|
|
4231
|
+
return /* @__PURE__ */ jsxRuntime.jsx(MenuV2Group, { ref, ...rest, children: required ? /* @__PURE__ */ jsxRuntime.jsx(SingleSelectRequiredProvider, { defaultValue, value, onValueChange, children }) : /* @__PURE__ */ jsxRuntime.jsx(
|
|
4232
|
+
SingleSelectNotRequiredProvider,
|
|
4233
|
+
{
|
|
4234
|
+
defaultValue,
|
|
4235
|
+
value,
|
|
4236
|
+
onValueChange,
|
|
4237
|
+
children
|
|
4238
|
+
}
|
|
4239
|
+
) });
|
|
4240
|
+
});
|
|
4241
|
+
const MenuV2SelectItem = genericMemo(function(props) {
|
|
4242
|
+
const { ref, value, onSelect, children, ...rest } = props;
|
|
4243
|
+
const { selected, selectValue } = react.use(SelectContext);
|
|
4244
|
+
const isSelected = selected(value);
|
|
4245
|
+
const handleSelect = react.useCallback(
|
|
4246
|
+
(e) => {
|
|
4247
|
+
onSelect == null ? void 0 : onSelect(e);
|
|
4248
|
+
if (e.defaultPrevented) return;
|
|
4249
|
+
selectValue(value);
|
|
4250
|
+
},
|
|
4251
|
+
[onSelect, selectValue, value]
|
|
4252
|
+
);
|
|
4253
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
4254
|
+
MenuV2Item,
|
|
4255
|
+
{
|
|
4256
|
+
ref,
|
|
4257
|
+
role: "menuitemcheckbox",
|
|
4258
|
+
onSelect: handleSelect,
|
|
4259
|
+
"data-state": getSelectedState(isSelected),
|
|
4260
|
+
...rest,
|
|
4261
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(SelectedIndicatorContext, { value: isSelected, children })
|
|
4262
|
+
}
|
|
4263
|
+
);
|
|
4264
|
+
});
|
|
4265
|
+
const MenuV2Separator = react.memo((props) => {
|
|
4266
|
+
const { ref, className, ...rest } = props;
|
|
4267
|
+
const { size } = react.use(MenuRootContext);
|
|
4268
|
+
return /* @__PURE__ */ jsxRuntime.jsx(RadixSeparator__namespace.Root, { className: classVarianceAuthority.cx(menuSeparatorCva({ size }), className), ref, ...rest });
|
|
4269
|
+
});
|
|
4270
|
+
MenuV2Separator.displayName = "MenuSeparator";
|
|
4271
|
+
const MenuV2 = {
|
|
4272
|
+
Root: MenuV2Root,
|
|
4273
|
+
Group: MenuV2Group,
|
|
4274
|
+
GroupLabel: MenuV2GroupLabel,
|
|
4275
|
+
Item: MenuV2Item,
|
|
4276
|
+
Separator: MenuV2Separator,
|
|
4277
|
+
SelectGroup: MenuV2SelectGroup,
|
|
4278
|
+
SelectItem: MenuV2SelectItem,
|
|
4279
|
+
MultiSelectGroup: MenuV2MultiSelectGroup,
|
|
4280
|
+
MultiSelectItem: MenuV2MultiSelectItem,
|
|
4281
|
+
SelectAllItem: MenuV2SelectAllItem,
|
|
4282
|
+
SelectedIndicator: MenuV2SelectedIndicator,
|
|
4283
|
+
CheckboxItem: MenuV2CheckboxItem,
|
|
4284
|
+
CheckedIndicator: MenuV2CheckedIndicator,
|
|
4285
|
+
Pages: MenuV2Pages,
|
|
4286
|
+
Page: MenuV2Page,
|
|
4287
|
+
PageTriggerItem: MenuV2PageTriggerItem
|
|
4288
|
+
};
|
|
4289
|
+
const OneTimePasswordFieldHiddenInput = react.memo((props) => {
|
|
3865
4290
|
return /* @__PURE__ */ jsxRuntime.jsx(RadixOneTimePasswordField__namespace.HiddenInput, { ...props });
|
|
3866
4291
|
});
|
|
3867
4292
|
OneTimePasswordFieldHiddenInput.displayName = "OneTimePasswordFieldHiddenInput";
|
|
3868
|
-
const OneTimePasswordFieldContext =
|
|
4293
|
+
const OneTimePasswordFieldContext = react.createContext({});
|
|
3869
4294
|
const onetimePasswordFieldInput = classVarianceAuthority.cva(
|
|
3870
4295
|
[
|
|
3871
4296
|
"flex",
|
|
@@ -3922,9 +4347,9 @@
|
|
|
3922
4347
|
}
|
|
3923
4348
|
}
|
|
3924
4349
|
);
|
|
3925
|
-
const OneTimePasswordFieldInput =
|
|
4350
|
+
const OneTimePasswordFieldInput = react.memo((props) => {
|
|
3926
4351
|
const { ref, className, ...rest } = props;
|
|
3927
|
-
const { variant, size, radius, accentColor } =
|
|
4352
|
+
const { variant, size, radius, accentColor } = react.use(OneTimePasswordFieldContext);
|
|
3928
4353
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
3929
4354
|
RadixOneTimePasswordField__namespace.Input,
|
|
3930
4355
|
{
|
|
@@ -3940,7 +4365,7 @@
|
|
|
3940
4365
|
);
|
|
3941
4366
|
});
|
|
3942
4367
|
OneTimePasswordFieldInput.displayName = "OneTimePasswordFieldInput";
|
|
3943
|
-
const OneTimePasswordFieldRoot =
|
|
4368
|
+
const OneTimePasswordFieldRoot = react.memo((props) => {
|
|
3944
4369
|
const providerContext = useProvider();
|
|
3945
4370
|
const {
|
|
3946
4371
|
ref,
|
|
@@ -3951,7 +4376,7 @@
|
|
|
3951
4376
|
accentColor = providerContext.accentColor,
|
|
3952
4377
|
...rest
|
|
3953
4378
|
} = props;
|
|
3954
|
-
const contextValue =
|
|
4379
|
+
const contextValue = react.useMemo(() => ({ variant, size, radius, accentColor }), [accentColor, radius, size, variant]);
|
|
3955
4380
|
return /* @__PURE__ */ jsxRuntime.jsx(RadixOneTimePasswordField__namespace.Root, { ref, "data-accent-color": accentColor, ...rest, children: /* @__PURE__ */ jsxRuntime.jsx(OneTimePasswordFieldContext, { value: contextValue, children }) });
|
|
3956
4381
|
});
|
|
3957
4382
|
OneTimePasswordFieldRoot.displayName = "OneTimePasswordFieldRoot";
|
|
@@ -3960,7 +4385,7 @@
|
|
|
3960
4385
|
Input: OneTimePasswordFieldInput,
|
|
3961
4386
|
Root: OneTimePasswordFieldRoot
|
|
3962
4387
|
};
|
|
3963
|
-
const OverlayClose =
|
|
4388
|
+
const OverlayClose = react.memo((props) => {
|
|
3964
4389
|
const { ref, ...rest } = props;
|
|
3965
4390
|
return /* @__PURE__ */ jsxRuntime.jsx(RadixDialog__namespace.Close, { ref, ...rest });
|
|
3966
4391
|
});
|
|
@@ -3976,7 +4401,7 @@
|
|
|
3976
4401
|
"data-[state='open']:fade-in-0",
|
|
3977
4402
|
"data-[state='open']:zoom-in-95"
|
|
3978
4403
|
]);
|
|
3979
|
-
const OverlayContent =
|
|
4404
|
+
const OverlayContent = react.memo((props) => {
|
|
3980
4405
|
const { ref, container, className, ...rest } = props;
|
|
3981
4406
|
return /* @__PURE__ */ jsxRuntime.jsx(RadixDialog__namespace.Portal, { container, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
3982
4407
|
RadixDialog__namespace.Content,
|
|
@@ -3989,21 +4414,21 @@
|
|
|
3989
4414
|
) });
|
|
3990
4415
|
});
|
|
3991
4416
|
OverlayContent.displayName = "OverlayContent";
|
|
3992
|
-
const OverlayDescription =
|
|
4417
|
+
const OverlayDescription = react.memo((props) => {
|
|
3993
4418
|
const { ref, ...rest } = props;
|
|
3994
4419
|
return /* @__PURE__ */ jsxRuntime.jsx(RadixDialog__namespace.Description, { ref, ...rest });
|
|
3995
4420
|
});
|
|
3996
4421
|
OverlayDescription.displayName = "OverlayDescription";
|
|
3997
|
-
const OverlayRoot =
|
|
4422
|
+
const OverlayRoot = react.memo((props) => {
|
|
3998
4423
|
return /* @__PURE__ */ jsxRuntime.jsx(RadixDialog__namespace.Root, { ...props });
|
|
3999
4424
|
});
|
|
4000
4425
|
OverlayRoot.displayName = "OverlayRoot";
|
|
4001
|
-
const OverlayTitle =
|
|
4426
|
+
const OverlayTitle = react.memo((props) => {
|
|
4002
4427
|
const { ref, ...rest } = props;
|
|
4003
4428
|
return /* @__PURE__ */ jsxRuntime.jsx(RadixDialog__namespace.Title, { ref, ...rest });
|
|
4004
4429
|
});
|
|
4005
4430
|
OverlayTitle.displayName = "OverlayTitle";
|
|
4006
|
-
const OverlayTrigger =
|
|
4431
|
+
const OverlayTrigger = react.memo((props) => {
|
|
4007
4432
|
const { ref, ...rest } = props;
|
|
4008
4433
|
return /* @__PURE__ */ jsxRuntime.jsx(RadixDialog__namespace.Trigger, { ref, ...rest });
|
|
4009
4434
|
});
|
|
@@ -4017,32 +4442,32 @@
|
|
|
4017
4442
|
Close: OverlayClose
|
|
4018
4443
|
};
|
|
4019
4444
|
const centerStyles = { placeSelf: "center" };
|
|
4020
|
-
const ErrorFallback =
|
|
4445
|
+
const ErrorFallback = react.memo((props) => {
|
|
4021
4446
|
const { absoluteCentering, message = "Something went wrong", onRetry } = props;
|
|
4022
4447
|
const { resetBoundary } = reactErrorBoundary.useErrorBoundary();
|
|
4023
4448
|
const height = "20px";
|
|
4024
4449
|
const outerFlexStyles = absoluteCentering ? { position: "absolute", top: "50%", transform: "translateY(-50%)" } : void 0;
|
|
4025
|
-
const handleRetry =
|
|
4450
|
+
const handleRetry = react.useCallback(() => {
|
|
4026
4451
|
resetBoundary();
|
|
4027
4452
|
onRetry();
|
|
4028
4453
|
}, [onRetry, resetBoundary]);
|
|
4029
4454
|
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex w-full gap-2", style: outerFlexStyles, children: [
|
|
4030
4455
|
/* @__PURE__ */ jsxRuntime.jsx("div", { style: { flexGrow: 1 } }),
|
|
4031
|
-
/* @__PURE__ */ jsxRuntime.jsx(LuIcon, { icon:
|
|
4456
|
+
/* @__PURE__ */ jsxRuntime.jsx(LuIcon, { icon: lucideReact.AlertTriangle, size: height, style: centerStyles }),
|
|
4032
4457
|
/* @__PURE__ */ jsxRuntime.jsx("span", { style: { lineHeight: height, ...centerStyles }, children: message }),
|
|
4033
|
-
/* @__PURE__ */ jsxRuntime.jsx(IconButton, { "aria-label": "Try again", variant: "soft", onClick: handleRetry, style: centerStyles, children: /* @__PURE__ */ jsxRuntime.jsx(LuIcon, { icon:
|
|
4458
|
+
/* @__PURE__ */ jsxRuntime.jsx(IconButton, { "aria-label": "Try again", variant: "soft", onClick: handleRetry, style: centerStyles, children: /* @__PURE__ */ jsxRuntime.jsx(LuIcon, { icon: lucideReact.RotateCcw, size: height }) }),
|
|
4034
4459
|
/* @__PURE__ */ jsxRuntime.jsx("div", { style: { flexGrow: 1 } })
|
|
4035
4460
|
] });
|
|
4036
4461
|
});
|
|
4037
4462
|
ErrorFallback.displayName = "ErrorFallback";
|
|
4038
|
-
const OvermapErrorBoundary =
|
|
4463
|
+
const OvermapErrorBoundary = react.memo((props) => {
|
|
4039
4464
|
const { absoluteCentering, message } = props;
|
|
4040
|
-
const [attempt, setAttempt] =
|
|
4041
|
-
const logError =
|
|
4465
|
+
const [attempt, setAttempt] = react.useState(0);
|
|
4466
|
+
const logError = react.useCallback((error, info) => {
|
|
4042
4467
|
console.error("Error in OvermapErrorBoundary:", error, info);
|
|
4043
4468
|
setAttempt((prev) => prev + 1);
|
|
4044
4469
|
}, []);
|
|
4045
|
-
const handleRetry =
|
|
4470
|
+
const handleRetry = react.useCallback(() => {
|
|
4046
4471
|
setAttempt((prev) => prev + 1);
|
|
4047
4472
|
}, []);
|
|
4048
4473
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
@@ -4056,7 +4481,7 @@
|
|
|
4056
4481
|
);
|
|
4057
4482
|
});
|
|
4058
4483
|
OvermapErrorBoundary.displayName = "OvermapErrorBoundary";
|
|
4059
|
-
const PopoverArrow =
|
|
4484
|
+
const PopoverArrow = react.memo((props) => {
|
|
4060
4485
|
const { ref, children, className, ...rest } = props;
|
|
4061
4486
|
return /* @__PURE__ */ jsxRuntime.jsx(RadixPopover__namespace.Arrow, { className: classVarianceAuthority.cx("fill-(--base-6)", className), ref, ...rest, children });
|
|
4062
4487
|
});
|
|
@@ -4075,7 +4500,7 @@
|
|
|
4075
4500
|
size: "md"
|
|
4076
4501
|
}
|
|
4077
4502
|
});
|
|
4078
|
-
const PopoverContent =
|
|
4503
|
+
const PopoverContent = react.memo((props) => {
|
|
4079
4504
|
const providerContext = useProvider();
|
|
4080
4505
|
const {
|
|
4081
4506
|
ref,
|
|
@@ -4150,7 +4575,7 @@
|
|
|
4150
4575
|
}
|
|
4151
4576
|
}
|
|
4152
4577
|
);
|
|
4153
|
-
const Progress =
|
|
4578
|
+
const Progress = react.memo((props) => {
|
|
4154
4579
|
const providerContext = useProvider();
|
|
4155
4580
|
const {
|
|
4156
4581
|
ref,
|
|
@@ -4162,7 +4587,7 @@
|
|
|
4162
4587
|
accentColor = providerContext.accentColor,
|
|
4163
4588
|
...rest
|
|
4164
4589
|
} = props;
|
|
4165
|
-
const computedStyle =
|
|
4590
|
+
const computedStyle = react.useMemo(
|
|
4166
4591
|
() => ({
|
|
4167
4592
|
...style,
|
|
4168
4593
|
"--progress-value": rest.value ?? 0,
|
|
@@ -4183,7 +4608,7 @@
|
|
|
4183
4608
|
);
|
|
4184
4609
|
});
|
|
4185
4610
|
Progress.displayName = "Progress";
|
|
4186
|
-
const RadioCardsContext =
|
|
4611
|
+
const RadioCardsContext = react.createContext({});
|
|
4187
4612
|
const radioCardsRootCva = classVarianceAuthority.cva([], {
|
|
4188
4613
|
variants: {
|
|
4189
4614
|
size: {
|
|
@@ -4243,8 +4668,8 @@
|
|
|
4243
4668
|
}
|
|
4244
4669
|
}
|
|
4245
4670
|
);
|
|
4246
|
-
const RadioCardsItem =
|
|
4247
|
-
const { variant, size, radius } =
|
|
4671
|
+
const RadioCardsItem = react.memo((props) => {
|
|
4672
|
+
const { variant, size, radius } = react.use(RadioCardsContext);
|
|
4248
4673
|
const { className, accentColor, ...rest } = props;
|
|
4249
4674
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
4250
4675
|
RadixRadioGroup__namespace.Item,
|
|
@@ -4256,7 +4681,7 @@
|
|
|
4256
4681
|
);
|
|
4257
4682
|
});
|
|
4258
4683
|
RadioCardsItem.displayName = "RadioCardsItem";
|
|
4259
|
-
const RadioCardsRoot =
|
|
4684
|
+
const RadioCardsRoot = react.memo((props) => {
|
|
4260
4685
|
const providerContext = useProvider();
|
|
4261
4686
|
const {
|
|
4262
4687
|
className,
|
|
@@ -4267,7 +4692,7 @@
|
|
|
4267
4692
|
accentColor = providerContext.accentColor,
|
|
4268
4693
|
...rest
|
|
4269
4694
|
} = props;
|
|
4270
|
-
const contextValue =
|
|
4695
|
+
const contextValue = react.useMemo(
|
|
4271
4696
|
() => ({
|
|
4272
4697
|
variant,
|
|
4273
4698
|
size,
|
|
@@ -4290,7 +4715,7 @@
|
|
|
4290
4715
|
Root: RadioCardsRoot,
|
|
4291
4716
|
Item: RadioCardsItem
|
|
4292
4717
|
};
|
|
4293
|
-
const RadioGroupIndicator =
|
|
4718
|
+
const RadioGroupIndicator = react.memo((props) => {
|
|
4294
4719
|
const { ref, children, className, ...rest } = props;
|
|
4295
4720
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
4296
4721
|
RadixRadioGroup__namespace.Indicator,
|
|
@@ -4303,7 +4728,7 @@
|
|
|
4303
4728
|
);
|
|
4304
4729
|
});
|
|
4305
4730
|
RadioGroupIndicator.displayName = "RadioGroupIndicator";
|
|
4306
|
-
const RadioGroupContext =
|
|
4731
|
+
const RadioGroupContext = react.createContext({});
|
|
4307
4732
|
const radioGroupItem = classVarianceAuthority.cva(
|
|
4308
4733
|
[
|
|
4309
4734
|
"inline-flex",
|
|
@@ -4347,8 +4772,8 @@
|
|
|
4347
4772
|
}
|
|
4348
4773
|
}
|
|
4349
4774
|
);
|
|
4350
|
-
const RadioGroupItem =
|
|
4351
|
-
const radioGroupContext =
|
|
4775
|
+
const RadioGroupItem = react.memo((props) => {
|
|
4776
|
+
const radioGroupContext = react.useContext(RadioGroupContext);
|
|
4352
4777
|
const {
|
|
4353
4778
|
ref,
|
|
4354
4779
|
children,
|
|
@@ -4360,7 +4785,7 @@
|
|
|
4360
4785
|
return /* @__PURE__ */ jsxRuntime.jsx(RadixRadioGroup__namespace.Item, { className: classVarianceAuthority.cx(radioGroupItem({ size, variant }), className), ref, ...rest, children });
|
|
4361
4786
|
});
|
|
4362
4787
|
RadioGroupItem.displayName = "RadioGroupItem";
|
|
4363
|
-
const RadioGroupRoot =
|
|
4788
|
+
const RadioGroupRoot = react.memo((props) => {
|
|
4364
4789
|
const providerContext = useProvider();
|
|
4365
4790
|
const {
|
|
4366
4791
|
ref,
|
|
@@ -4379,6 +4804,65 @@
|
|
|
4379
4804
|
Item: RadioGroupItem,
|
|
4380
4805
|
Root: RadioGroupRoot
|
|
4381
4806
|
};
|
|
4807
|
+
const RatingRootContext = react.createContext({});
|
|
4808
|
+
const RatingItemContext = react.createContext({});
|
|
4809
|
+
const RatingItem = react.memo((props) => {
|
|
4810
|
+
const { ref, children, value, ...rest } = props;
|
|
4811
|
+
const { value: activeValue } = react.use(RatingRootContext);
|
|
4812
|
+
const active = !!activeValue && value <= activeValue;
|
|
4813
|
+
const contextValue = react.useMemo(() => ({ value }), [value]);
|
|
4814
|
+
return /* @__PURE__ */ jsxRuntime.jsx(RadixRadioGroup__namespace.Item, { ref, value: value.toString(), "data-active": active, ...rest, children: /* @__PURE__ */ jsxRuntime.jsx(RatingItemContext, { value: contextValue, children }) });
|
|
4815
|
+
});
|
|
4816
|
+
RatingItem.displayName = "RatingItem";
|
|
4817
|
+
const RatingItemIndicator = react.memo((props) => {
|
|
4818
|
+
const { ref, children, forceMount, ...rest } = props;
|
|
4819
|
+
const { value: activeValue } = react.use(RatingRootContext);
|
|
4820
|
+
const { value } = react.use(RatingItemContext);
|
|
4821
|
+
const active = !!activeValue && value <= activeValue;
|
|
4822
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
4823
|
+
RadixRadioGroup__namespace.Indicator,
|
|
4824
|
+
{
|
|
4825
|
+
ref,
|
|
4826
|
+
forceMount: forceMount ?? (active || void 0),
|
|
4827
|
+
"data-active": active,
|
|
4828
|
+
...rest,
|
|
4829
|
+
children
|
|
4830
|
+
}
|
|
4831
|
+
);
|
|
4832
|
+
});
|
|
4833
|
+
RatingItemIndicator.displayName = "RatingItemIndicator";
|
|
4834
|
+
const RatingRoot = react.memo((props) => {
|
|
4835
|
+
const { ref, children, defaultValue, value: controlledValue, onValueChange, ...rest } = props;
|
|
4836
|
+
const [value, setValue] = useControlledState(defaultValue ?? null, controlledValue, onValueChange);
|
|
4837
|
+
const handleValueChange = react.useCallback(
|
|
4838
|
+
(value2) => {
|
|
4839
|
+
setValue(parseInt(value2));
|
|
4840
|
+
},
|
|
4841
|
+
[setValue]
|
|
4842
|
+
);
|
|
4843
|
+
const contextValue = react.useMemo(
|
|
4844
|
+
() => ({
|
|
4845
|
+
value
|
|
4846
|
+
}),
|
|
4847
|
+
[value]
|
|
4848
|
+
);
|
|
4849
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
4850
|
+
RadixRadioGroup__namespace.Root,
|
|
4851
|
+
{
|
|
4852
|
+
ref,
|
|
4853
|
+
value: value ? value.toString() : null,
|
|
4854
|
+
onValueChange: handleValueChange,
|
|
4855
|
+
...rest,
|
|
4856
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(RatingRootContext, { value: contextValue, children })
|
|
4857
|
+
}
|
|
4858
|
+
);
|
|
4859
|
+
});
|
|
4860
|
+
RatingRoot.displayName = "RatingRoot";
|
|
4861
|
+
const Rating = {
|
|
4862
|
+
Item: RatingItem,
|
|
4863
|
+
ItemIndicator: RatingItemIndicator,
|
|
4864
|
+
Root: RatingRoot
|
|
4865
|
+
};
|
|
4382
4866
|
const segmentedControlRootCva = classVarianceAuthority.cva(
|
|
4383
4867
|
["shrink-0", "transition-colors", "inline-flex", "box-border", "min-w-max", "text-center"],
|
|
4384
4868
|
{
|
|
@@ -4522,15 +5006,15 @@
|
|
|
4522
5006
|
}
|
|
4523
5007
|
}
|
|
4524
5008
|
);
|
|
4525
|
-
const SegmentedControlContext =
|
|
5009
|
+
const SegmentedControlContext = react.createContext({});
|
|
4526
5010
|
const useSegmentedControl = () => {
|
|
4527
|
-
const segmentedControlContext =
|
|
5011
|
+
const segmentedControlContext = react.useContext(SegmentedControlContext);
|
|
4528
5012
|
if (!segmentedControlContext) {
|
|
4529
5013
|
throw new Error("useSegmentedControl must be used within a SegmentedControlProvider");
|
|
4530
5014
|
}
|
|
4531
5015
|
return segmentedControlContext;
|
|
4532
5016
|
};
|
|
4533
|
-
const SegmentedControlItem =
|
|
5017
|
+
const SegmentedControlItem = react.memo((props) => {
|
|
4534
5018
|
const { ref, className, ...rest } = props;
|
|
4535
5019
|
const { size, radius, variant, icon } = useSegmentedControl();
|
|
4536
5020
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
@@ -4543,7 +5027,7 @@
|
|
|
4543
5027
|
);
|
|
4544
5028
|
});
|
|
4545
5029
|
SegmentedControlItem.displayName = "SegmentedControlItem";
|
|
4546
|
-
const SegmentedControlRoot =
|
|
5030
|
+
const SegmentedControlRoot = react.memo((props) => {
|
|
4547
5031
|
const providerContext = useProvider();
|
|
4548
5032
|
const {
|
|
4549
5033
|
ref,
|
|
@@ -4577,7 +5061,7 @@
|
|
|
4577
5061
|
Item: SegmentedControlItem,
|
|
4578
5062
|
Root: SegmentedControlRoot
|
|
4579
5063
|
};
|
|
4580
|
-
const SegmentedTabsListContext =
|
|
5064
|
+
const SegmentedTabsListContext = react.createContext({});
|
|
4581
5065
|
const segmentedTabsListCva = classVarianceAuthority.cva(
|
|
4582
5066
|
["shrink-0", "transition-colors", "inline-flex", "box-border", "min-w-max", "text-center"],
|
|
4583
5067
|
{
|
|
@@ -4725,7 +5209,7 @@
|
|
|
4725
5209
|
}
|
|
4726
5210
|
}
|
|
4727
5211
|
);
|
|
4728
|
-
const SegmentedTabsList =
|
|
5212
|
+
const SegmentedTabsList = react.memo((props) => {
|
|
4729
5213
|
const providerContext = useProvider();
|
|
4730
5214
|
const {
|
|
4731
5215
|
ref,
|
|
@@ -4737,7 +5221,7 @@
|
|
|
4737
5221
|
accentColor = providerContext.accentColor,
|
|
4738
5222
|
...rest
|
|
4739
5223
|
} = props;
|
|
4740
|
-
const contextValue =
|
|
5224
|
+
const contextValue = react.useMemo(
|
|
4741
5225
|
() => ({
|
|
4742
5226
|
size,
|
|
4743
5227
|
variant,
|
|
@@ -4757,14 +5241,14 @@
|
|
|
4757
5241
|
);
|
|
4758
5242
|
});
|
|
4759
5243
|
SegmentedTabsList.displayName = "TabsList";
|
|
4760
|
-
const SegmentedTabsRoot =
|
|
5244
|
+
const SegmentedTabsRoot = react.memo((props) => {
|
|
4761
5245
|
const { ref, className, ...rest } = props;
|
|
4762
5246
|
return /* @__PURE__ */ jsxRuntime.jsx(RadixTabs__namespace.Root, { ref, className: classVarianceAuthority.cx("flex flex-col", className), ...rest });
|
|
4763
5247
|
});
|
|
4764
5248
|
SegmentedTabsRoot.displayName = "TabsRoot";
|
|
4765
|
-
const SegmentedTabsTrigger =
|
|
5249
|
+
const SegmentedTabsTrigger = react.memo((props) => {
|
|
4766
5250
|
const { ref, children, className, ...rest } = props;
|
|
4767
|
-
const { size, radius, variant } =
|
|
5251
|
+
const { size, radius, variant } = react.use(SegmentedTabsListContext);
|
|
4768
5252
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
4769
5253
|
RadixTabs__namespace.Trigger,
|
|
4770
5254
|
{
|
|
@@ -4864,7 +5348,7 @@
|
|
|
4864
5348
|
orientation: "horizontal"
|
|
4865
5349
|
}
|
|
4866
5350
|
});
|
|
4867
|
-
const Separator =
|
|
5351
|
+
const Separator = react.memo((props) => {
|
|
4868
5352
|
const { ref, className, accentColor = "base", orientation, size, ...rest } = props;
|
|
4869
5353
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
4870
5354
|
RadixSeparator__namespace.Root,
|
|
@@ -5086,7 +5570,7 @@
|
|
|
5086
5570
|
}
|
|
5087
5571
|
}
|
|
5088
5572
|
);
|
|
5089
|
-
const Slider =
|
|
5573
|
+
const Slider = react.memo((props) => {
|
|
5090
5574
|
const providerContext = useProvider();
|
|
5091
5575
|
const {
|
|
5092
5576
|
className,
|
|
@@ -5124,11 +5608,11 @@
|
|
|
5124
5608
|
);
|
|
5125
5609
|
});
|
|
5126
5610
|
Slider.displayName = "Slider";
|
|
5127
|
-
const Spinner =
|
|
5611
|
+
const Spinner = react.memo(() => {
|
|
5128
5612
|
return /* @__PURE__ */ jsxRuntime.jsx("div", { className: "size-6 animate-spin rounded-full border-2 border-(--base-a12) border-b-transparent" });
|
|
5129
5613
|
});
|
|
5130
5614
|
Spinner.displayName = "Spinner";
|
|
5131
|
-
const SwitchContext =
|
|
5615
|
+
const SwitchContext = react.createContext({});
|
|
5132
5616
|
const switchRoot = classVarianceAuthority.cva(
|
|
5133
5617
|
[
|
|
5134
5618
|
"shrink-0",
|
|
@@ -5188,7 +5672,7 @@
|
|
|
5188
5672
|
}
|
|
5189
5673
|
}
|
|
5190
5674
|
);
|
|
5191
|
-
const SwitchRoot =
|
|
5675
|
+
const SwitchRoot = react.memo((props) => {
|
|
5192
5676
|
const providerContext = useProvider();
|
|
5193
5677
|
const {
|
|
5194
5678
|
ref,
|
|
@@ -5211,9 +5695,9 @@
|
|
|
5211
5695
|
);
|
|
5212
5696
|
});
|
|
5213
5697
|
SwitchRoot.displayName = "SwitchRoot";
|
|
5214
|
-
const SwitchThumb =
|
|
5698
|
+
const SwitchThumb = react.memo((props) => {
|
|
5215
5699
|
const { ref, className, ...rest } = props;
|
|
5216
|
-
const { size, radius } =
|
|
5700
|
+
const { size, radius } = react.useContext(SwitchContext);
|
|
5217
5701
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
5218
5702
|
RadixSwitch__namespace.Thumb,
|
|
5219
5703
|
{
|
|
@@ -5228,12 +5712,12 @@
|
|
|
5228
5712
|
Root: SwitchRoot,
|
|
5229
5713
|
Thumb: SwitchThumb
|
|
5230
5714
|
};
|
|
5231
|
-
const TableBody =
|
|
5715
|
+
const TableBody = react.memo((props) => {
|
|
5232
5716
|
const { ref, className, ...rest } = props;
|
|
5233
5717
|
return /* @__PURE__ */ jsxRuntime.jsx("tbody", { ref, className: classVarianceAuthority.cx(className), ...rest });
|
|
5234
5718
|
});
|
|
5235
5719
|
TableBody.displayName = "TableBody";
|
|
5236
|
-
const TableContext =
|
|
5720
|
+
const TableContext = react.createContext({});
|
|
5237
5721
|
const tableRootCva = classVarianceAuthority.cva(["border-collapse text-left"], {
|
|
5238
5722
|
variants: {
|
|
5239
5723
|
variant: {
|
|
@@ -5274,29 +5758,29 @@
|
|
|
5274
5758
|
}
|
|
5275
5759
|
}
|
|
5276
5760
|
});
|
|
5277
|
-
const TableCell =
|
|
5761
|
+
const TableCell = react.memo((props) => {
|
|
5278
5762
|
const { ref, className, ...rest } = props;
|
|
5279
|
-
const { size, border, variant } =
|
|
5763
|
+
const { size, border, variant } = react.useContext(TableContext);
|
|
5280
5764
|
return /* @__PURE__ */ jsxRuntime.jsx("td", { ref, className: classVarianceAuthority.cx(tableCellCva({ size, border, cell: true, variant }), className), ...rest });
|
|
5281
5765
|
});
|
|
5282
5766
|
TableCell.displayName = "TableCell";
|
|
5283
|
-
const TableColumnHeaderCell =
|
|
5767
|
+
const TableColumnHeaderCell = react.memo((props) => {
|
|
5284
5768
|
const { ref, className, ...rest } = props;
|
|
5285
|
-
const { size, border, variant } =
|
|
5769
|
+
const { size, border, variant } = react.useContext(TableContext);
|
|
5286
5770
|
return /* @__PURE__ */ jsxRuntime.jsx("th", { ref, className: classVarianceAuthority.cx(tableCellCva({ size, border, cell: false, variant }), className), ...rest });
|
|
5287
5771
|
});
|
|
5288
5772
|
TableColumnHeaderCell.displayName = "TableColumnHeaderCell";
|
|
5289
|
-
const TableFooter =
|
|
5773
|
+
const TableFooter = react.memo((props) => {
|
|
5290
5774
|
const { ref, className, ...rest } = props;
|
|
5291
5775
|
return /* @__PURE__ */ jsxRuntime.jsx("tfoot", { ref, className: classVarianceAuthority.cx(className), ...rest });
|
|
5292
5776
|
});
|
|
5293
5777
|
TableFooter.displayName = "TableFooter";
|
|
5294
|
-
const TableHeader =
|
|
5778
|
+
const TableHeader = react.memo((props) => {
|
|
5295
5779
|
const { ref, className, ...rest } = props;
|
|
5296
5780
|
return /* @__PURE__ */ jsxRuntime.jsx("thead", { ref, className: classVarianceAuthority.cx(className), ...rest });
|
|
5297
5781
|
});
|
|
5298
5782
|
TableHeader.displayName = "TableHeader";
|
|
5299
|
-
const TableRoot =
|
|
5783
|
+
const TableRoot = react.memo((props) => {
|
|
5300
5784
|
const providerContext = useProvider();
|
|
5301
5785
|
const {
|
|
5302
5786
|
ref,
|
|
@@ -5324,14 +5808,14 @@
|
|
|
5324
5808
|
);
|
|
5325
5809
|
});
|
|
5326
5810
|
TableRoot.displayName = "TableRoot";
|
|
5327
|
-
const TableRow =
|
|
5811
|
+
const TableRow = react.memo((props) => {
|
|
5328
5812
|
const { ref, className, ...rest } = props;
|
|
5329
5813
|
return /* @__PURE__ */ jsxRuntime.jsx("tr", { ref, className: classVarianceAuthority.cx(className), ...rest });
|
|
5330
5814
|
});
|
|
5331
5815
|
TableRow.displayName = "TableRow";
|
|
5332
|
-
const TableRowHeaderCell =
|
|
5816
|
+
const TableRowHeaderCell = react.memo((props) => {
|
|
5333
5817
|
const { ref, className, ...rest } = props;
|
|
5334
|
-
const { size, border, variant } =
|
|
5818
|
+
const { size, border, variant } = react.useContext(TableContext);
|
|
5335
5819
|
return /* @__PURE__ */ jsxRuntime.jsx("th", { ref, className: classVarianceAuthority.cx(tableCellCva({ size, border, cell: true, variant }), className), ...rest });
|
|
5336
5820
|
});
|
|
5337
5821
|
TableRowHeaderCell.displayName = "TableRow";
|
|
@@ -5345,7 +5829,7 @@
|
|
|
5345
5829
|
RowHeaderCell: TableRowHeaderCell,
|
|
5346
5830
|
ColumnHeaderCell: TableColumnHeaderCell
|
|
5347
5831
|
};
|
|
5348
|
-
const TabsListContext =
|
|
5832
|
+
const TabsListContext = react.createContext({});
|
|
5349
5833
|
const tabsListCva = classVarianceAuthority.cva(["flex", "border-box", "inset-shadow-[0_-1px_0_0_var(--base-a6)]"], {
|
|
5350
5834
|
variants: {
|
|
5351
5835
|
size: {
|
|
@@ -5395,7 +5879,7 @@
|
|
|
5395
5879
|
}
|
|
5396
5880
|
}
|
|
5397
5881
|
);
|
|
5398
|
-
const TabsList =
|
|
5882
|
+
const TabsList = react.memo((props) => {
|
|
5399
5883
|
const providerContext = useProvider();
|
|
5400
5884
|
const { ref, children, className, size = "md", accentColor = providerContext.accentColor, ...rest } = props;
|
|
5401
5885
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
@@ -5410,19 +5894,19 @@
|
|
|
5410
5894
|
);
|
|
5411
5895
|
});
|
|
5412
5896
|
TabsList.displayName = "TabsList";
|
|
5413
|
-
const TabsRoot =
|
|
5897
|
+
const TabsRoot = react.memo((props) => {
|
|
5414
5898
|
const { ref, className, ...rest } = props;
|
|
5415
5899
|
return /* @__PURE__ */ jsxRuntime.jsx(RadixTabs__namespace.Root, { ref, className: classVarianceAuthority.cx("flex flex-col", className), ...rest });
|
|
5416
5900
|
});
|
|
5417
5901
|
TabsRoot.displayName = "TabsRoot";
|
|
5418
5902
|
const useTabsList = () => {
|
|
5419
|
-
const tabsListContext =
|
|
5903
|
+
const tabsListContext = react.useContext(TabsListContext);
|
|
5420
5904
|
if (!tabsListContext) {
|
|
5421
5905
|
throw new Error("useTabsList must be used within a TabsList component");
|
|
5422
5906
|
}
|
|
5423
5907
|
return tabsListContext;
|
|
5424
5908
|
};
|
|
5425
|
-
const TabsTrigger =
|
|
5909
|
+
const TabsTrigger = react.memo((props) => {
|
|
5426
5910
|
const { ref, children, className, ...rest } = props;
|
|
5427
5911
|
const { size } = useTabsList();
|
|
5428
5912
|
return /* @__PURE__ */ jsxRuntime.jsx(RadixTabs__namespace.Trigger, { ref, className: classVarianceAuthority.cx(tabsTriggerCva({ size }), className), ...rest, children });
|
|
@@ -5464,7 +5948,7 @@
|
|
|
5464
5948
|
}
|
|
5465
5949
|
}
|
|
5466
5950
|
});
|
|
5467
|
-
const Text =
|
|
5951
|
+
const Text = react.memo((props) => {
|
|
5468
5952
|
const { ref, className, size, weight, align, accentColor, highContrast = false, ...rest } = props;
|
|
5469
5953
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
5470
5954
|
"span",
|
|
@@ -5545,7 +6029,7 @@
|
|
|
5545
6029
|
}
|
|
5546
6030
|
}
|
|
5547
6031
|
);
|
|
5548
|
-
const TextArea =
|
|
6032
|
+
const TextArea = react.memo((props) => {
|
|
5549
6033
|
const providerContext = useProvider();
|
|
5550
6034
|
const {
|
|
5551
6035
|
ref,
|
|
@@ -5613,8 +6097,8 @@
|
|
|
5613
6097
|
action,
|
|
5614
6098
|
...rest
|
|
5615
6099
|
} = props;
|
|
5616
|
-
const [open, setOpen] =
|
|
5617
|
-
const handleOpenChange =
|
|
6100
|
+
const [open, setOpen] = react.useState(true);
|
|
6101
|
+
const handleOpenChange = react.useCallback(
|
|
5618
6102
|
(open2) => {
|
|
5619
6103
|
if (!open2 && onClose) onClose();
|
|
5620
6104
|
setOpen(open2);
|
|
@@ -5647,16 +6131,16 @@
|
|
|
5647
6131
|
action && /* @__PURE__ */ jsxRuntime.jsx(RadixToast__namespace.Action, { className: "w-max", altText: action.altText, asChild: true, children: action.content })
|
|
5648
6132
|
] })
|
|
5649
6133
|
] }),
|
|
5650
|
-
/* @__PURE__ */ jsxRuntime.jsx(RadixToast__namespace.Close, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(IconButton, { size, "aria-label": "Close", variant: "ghost", accentColor, children: /* @__PURE__ */ jsxRuntime.jsx(LuIcon, { icon:
|
|
6134
|
+
/* @__PURE__ */ jsxRuntime.jsx(RadixToast__namespace.Close, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(IconButton, { size, "aria-label": "Close", variant: "ghost", accentColor, children: /* @__PURE__ */ jsxRuntime.jsx(LuIcon, { icon: lucideReact.X }) }) })
|
|
5651
6135
|
]
|
|
5652
6136
|
}
|
|
5653
6137
|
);
|
|
5654
6138
|
};
|
|
5655
|
-
const Toast =
|
|
6139
|
+
const Toast = react.memo(_Toast);
|
|
5656
6140
|
Toast.displayName = "Toast";
|
|
5657
|
-
const ToastContext =
|
|
6141
|
+
const ToastContext = react.createContext({});
|
|
5658
6142
|
const useToast = () => {
|
|
5659
|
-
const context =
|
|
6143
|
+
const context = react.useContext(ToastContext);
|
|
5660
6144
|
if (!context) {
|
|
5661
6145
|
throw new Error("useToast must be used within a ToastProvider");
|
|
5662
6146
|
}
|
|
@@ -5670,15 +6154,15 @@
|
|
|
5670
6154
|
return MIN_DURATION + words / WORDS_PER_SECOND;
|
|
5671
6155
|
};
|
|
5672
6156
|
exports2.unsafeShowToast = void 0;
|
|
5673
|
-
const ToastProvider =
|
|
6157
|
+
const ToastProvider = react.memo(function ToastContextProvider({
|
|
5674
6158
|
children,
|
|
5675
6159
|
// Use this class to change where the viewport for the toasts should be
|
|
5676
6160
|
className,
|
|
5677
6161
|
hotkey,
|
|
5678
6162
|
...rest
|
|
5679
6163
|
}) {
|
|
5680
|
-
const [toasts, setToasts] =
|
|
5681
|
-
const handleCloseToast =
|
|
6164
|
+
const [toasts, setToasts] = react.useState([]);
|
|
6165
|
+
const handleCloseToast = react.useCallback((id, reason, callback) => {
|
|
5682
6166
|
setToasts((prevToasts) => {
|
|
5683
6167
|
const toast = prevToasts.find((toast2) => toast2.id === id);
|
|
5684
6168
|
if (toast && reason === 0) clearTimeout(toast.timeout);
|
|
@@ -5686,7 +6170,7 @@
|
|
|
5686
6170
|
});
|
|
5687
6171
|
if (callback) callback();
|
|
5688
6172
|
}, []);
|
|
5689
|
-
const toastContextValue =
|
|
6173
|
+
const toastContextValue = react.useMemo(() => {
|
|
5690
6174
|
let counter = 0;
|
|
5691
6175
|
const showToast = (toastProps) => {
|
|
5692
6176
|
const duration = calculatedDuration(toastProps);
|
|
@@ -5710,7 +6194,7 @@
|
|
|
5710
6194
|
showWarning
|
|
5711
6195
|
};
|
|
5712
6196
|
}, [handleCloseToast]);
|
|
5713
|
-
|
|
6197
|
+
react.useEffect(() => {
|
|
5714
6198
|
return () => {
|
|
5715
6199
|
for (const { timeout } of toasts) clearTimeout(timeout);
|
|
5716
6200
|
};
|
|
@@ -5851,7 +6335,7 @@
|
|
|
5851
6335
|
}
|
|
5852
6336
|
}
|
|
5853
6337
|
);
|
|
5854
|
-
const BaseToggleButton =
|
|
6338
|
+
const BaseToggleButton = react.memo((props) => {
|
|
5855
6339
|
const providerContext = useProvider();
|
|
5856
6340
|
const {
|
|
5857
6341
|
ref,
|
|
@@ -5874,15 +6358,15 @@
|
|
|
5874
6358
|
);
|
|
5875
6359
|
});
|
|
5876
6360
|
BaseToggleButton.displayName = "BaseToggleButton";
|
|
5877
|
-
const IconToggleButton =
|
|
6361
|
+
const IconToggleButton = react.memo((props) => {
|
|
5878
6362
|
return /* @__PURE__ */ jsxRuntime.jsx(BaseToggleButton, { icon: true, ...props });
|
|
5879
6363
|
});
|
|
5880
6364
|
IconToggleButton.displayName = "IconToggleButton";
|
|
5881
|
-
const ToggleButton =
|
|
6365
|
+
const ToggleButton = react.memo((props) => {
|
|
5882
6366
|
return /* @__PURE__ */ jsxRuntime.jsx(BaseToggleButton, { icon: false, ...props });
|
|
5883
6367
|
});
|
|
5884
6368
|
ToggleButton.displayName = "ToggleButton";
|
|
5885
|
-
const ToggleGroupContext =
|
|
6369
|
+
const ToggleGroupContext = react.createContext({});
|
|
5886
6370
|
const toggleGroupItemCva = classVarianceAuthority.cva(
|
|
5887
6371
|
[
|
|
5888
6372
|
"flex",
|
|
@@ -5998,8 +6482,8 @@
|
|
|
5998
6482
|
]
|
|
5999
6483
|
}
|
|
6000
6484
|
);
|
|
6001
|
-
const ToggleGroupBaseItem =
|
|
6002
|
-
const toggleGroupContext =
|
|
6485
|
+
const ToggleGroupBaseItem = react.memo((props) => {
|
|
6486
|
+
const toggleGroupContext = react.use(ToggleGroupContext);
|
|
6003
6487
|
const {
|
|
6004
6488
|
ref,
|
|
6005
6489
|
className,
|
|
@@ -6025,15 +6509,15 @@
|
|
|
6025
6509
|
);
|
|
6026
6510
|
});
|
|
6027
6511
|
ToggleGroupBaseItem.displayName = "ToggleGroupBaseItem";
|
|
6028
|
-
const ToggleGroupIconItem =
|
|
6512
|
+
const ToggleGroupIconItem = react.memo((props) => {
|
|
6029
6513
|
return /* @__PURE__ */ jsxRuntime.jsx(ToggleGroupBaseItem, { icon: true, ...props });
|
|
6030
6514
|
});
|
|
6031
6515
|
ToggleGroupIconItem.displayName = "ToggleGroupIconItem";
|
|
6032
|
-
const ToggleGroupItem =
|
|
6516
|
+
const ToggleGroupItem = react.memo((props) => {
|
|
6033
6517
|
return /* @__PURE__ */ jsxRuntime.jsx(ToggleGroupBaseItem, { icon: false, ...props });
|
|
6034
6518
|
});
|
|
6035
6519
|
ToggleGroupItem.displayName = "ToggleGroupItem";
|
|
6036
|
-
const ToggleGroupRoot =
|
|
6520
|
+
const ToggleGroupRoot = react.memo((props) => {
|
|
6037
6521
|
const providerContext = useProvider();
|
|
6038
6522
|
const {
|
|
6039
6523
|
ref,
|
|
@@ -6044,7 +6528,7 @@
|
|
|
6044
6528
|
size = "md",
|
|
6045
6529
|
...rest
|
|
6046
6530
|
} = props;
|
|
6047
|
-
const contextValue =
|
|
6531
|
+
const contextValue = react.useMemo(
|
|
6048
6532
|
() => ({
|
|
6049
6533
|
variant,
|
|
6050
6534
|
size,
|
|
@@ -6061,7 +6545,7 @@
|
|
|
6061
6545
|
Item: ToggleGroupItem,
|
|
6062
6546
|
IconItem: ToggleGroupIconItem
|
|
6063
6547
|
};
|
|
6064
|
-
const TooltipArrow =
|
|
6548
|
+
const TooltipArrow = react.memo((props) => {
|
|
6065
6549
|
const { ref, className, ...rest } = props;
|
|
6066
6550
|
return /* @__PURE__ */ jsxRuntime.jsx(RadixTooltip__namespace.Arrow, { className: classVarianceAuthority.cx("fill-(--base-6)", className), ref, ...rest });
|
|
6067
6551
|
});
|
|
@@ -6103,7 +6587,7 @@
|
|
|
6103
6587
|
}
|
|
6104
6588
|
}
|
|
6105
6589
|
);
|
|
6106
|
-
const TooltipContent =
|
|
6590
|
+
const TooltipContent = react.memo((props) => {
|
|
6107
6591
|
const providerContext = useProvider();
|
|
6108
6592
|
const {
|
|
6109
6593
|
ref,
|
|
@@ -6155,7 +6639,6 @@
|
|
|
6155
6639
|
exports2.CheckboxGroupSelectAllItem = CheckboxGroupSelectAllItem;
|
|
6156
6640
|
exports2.CheckboxIndicator = CheckboxIndicator;
|
|
6157
6641
|
exports2.CheckboxRoot = CheckboxRoot;
|
|
6158
|
-
exports2.CollapsibleTree = CollapsibleTree;
|
|
6159
6642
|
exports2.CommandMenu = CommandMenu;
|
|
6160
6643
|
exports2.CommandMenuCheckboxIndicator = CommandMenuCheckboxIndicator;
|
|
6161
6644
|
exports2.CommandMenuCheckboxItem = CommandMenuCheckboxItem;
|
|
@@ -6196,10 +6679,12 @@
|
|
|
6196
6679
|
exports2.InputSlot = InputSlot;
|
|
6197
6680
|
exports2.Layout = Layout;
|
|
6198
6681
|
exports2.LayoutContainer = LayoutContainer;
|
|
6199
|
-
exports2.LayoutContext = LayoutContext;
|
|
6200
6682
|
exports2.LayoutRoot = LayoutRoot;
|
|
6201
|
-
exports2.
|
|
6683
|
+
exports2.LayoutSlideOutClose = LayoutSlideOutClose;
|
|
6684
|
+
exports2.LayoutSlideOutContent = LayoutSlideOutContent;
|
|
6685
|
+
exports2.LayoutSlideOutHandle = LayoutSlideOutHandle;
|
|
6202
6686
|
exports2.LayoutSlideOutOverlay = LayoutSlideOutOverlay;
|
|
6687
|
+
exports2.LayoutSlideOutRoot = LayoutSlideOutRoot;
|
|
6203
6688
|
exports2.LayoutSlideOutTrigger = LayoutSlideOutTrigger;
|
|
6204
6689
|
exports2.Link = Link;
|
|
6205
6690
|
exports2.LuIcon = LuIcon;
|
|
@@ -6230,6 +6715,23 @@
|
|
|
6230
6715
|
exports2.MenuSub = MenuSub;
|
|
6231
6716
|
exports2.MenuSubContent = MenuSubContent;
|
|
6232
6717
|
exports2.MenuSubTrigger = MenuSubTrigger;
|
|
6718
|
+
exports2.MenuV2 = MenuV2;
|
|
6719
|
+
exports2.MenuV2CheckboxItem = MenuV2CheckboxItem;
|
|
6720
|
+
exports2.MenuV2CheckedIndicator = MenuV2CheckedIndicator;
|
|
6721
|
+
exports2.MenuV2Group = MenuV2Group;
|
|
6722
|
+
exports2.MenuV2GroupLabel = MenuV2GroupLabel;
|
|
6723
|
+
exports2.MenuV2Item = MenuV2Item;
|
|
6724
|
+
exports2.MenuV2MultiSelectGroup = MenuV2MultiSelectGroup;
|
|
6725
|
+
exports2.MenuV2MultiSelectItem = MenuV2MultiSelectItem;
|
|
6726
|
+
exports2.MenuV2Page = MenuV2Page;
|
|
6727
|
+
exports2.MenuV2PageTriggerItem = MenuV2PageTriggerItem;
|
|
6728
|
+
exports2.MenuV2Pages = MenuV2Pages;
|
|
6729
|
+
exports2.MenuV2Root = MenuV2Root;
|
|
6730
|
+
exports2.MenuV2SelectAllItem = MenuV2SelectAllItem;
|
|
6731
|
+
exports2.MenuV2SelectGroup = MenuV2SelectGroup;
|
|
6732
|
+
exports2.MenuV2SelectItem = MenuV2SelectItem;
|
|
6733
|
+
exports2.MenuV2SelectedIndicator = MenuV2SelectedIndicator;
|
|
6734
|
+
exports2.MenuV2Separator = MenuV2Separator;
|
|
6233
6735
|
exports2.MenuVirtualTrigger = MenuVirtualTrigger;
|
|
6234
6736
|
exports2.OneTimePasswordField = OneTimePasswordField;
|
|
6235
6737
|
exports2.OneTimePasswordFieldHiddenInput = OneTimePasswordFieldHiddenInput;
|
|
@@ -6255,6 +6757,10 @@
|
|
|
6255
6757
|
exports2.RadioGroupIndicator = RadioGroupIndicator;
|
|
6256
6758
|
exports2.RadioGroupItem = RadioGroupItem;
|
|
6257
6759
|
exports2.RadioGroupRoot = RadioGroupRoot;
|
|
6760
|
+
exports2.Rating = Rating;
|
|
6761
|
+
exports2.RatingItem = RatingItem;
|
|
6762
|
+
exports2.RatingItemIndicator = RatingItemIndicator;
|
|
6763
|
+
exports2.RatingRoot = RatingRoot;
|
|
6258
6764
|
exports2.SegmentedControl = SegmentedControl;
|
|
6259
6765
|
exports2.SegmentedControlItem = SegmentedControlItem;
|
|
6260
6766
|
exports2.SegmentedControlRoot = SegmentedControlRoot;
|
|
@@ -6262,9 +6768,15 @@
|
|
|
6262
6768
|
exports2.SegmentedTabsList = SegmentedTabsList;
|
|
6263
6769
|
exports2.SegmentedTabsRoot = SegmentedTabsRoot;
|
|
6264
6770
|
exports2.SegmentedTabsTrigger = SegmentedTabsTrigger;
|
|
6265
|
-
exports2.SelectedIndicatorContext = SelectedIndicatorContext;
|
|
6266
6771
|
exports2.Separator = Separator;
|
|
6267
6772
|
exports2.SlideOut = SlideOut;
|
|
6773
|
+
exports2.SlideOutClose = SlideOutClose;
|
|
6774
|
+
exports2.SlideOutContent = SlideOutContent;
|
|
6775
|
+
exports2.SlideOutHandle = SlideOutHandle;
|
|
6776
|
+
exports2.SlideOutOverlay = SlideOutOverlay;
|
|
6777
|
+
exports2.SlideOutRoot = SlideOutRoot;
|
|
6778
|
+
exports2.SlideOutTrigger = SlideOutTrigger;
|
|
6779
|
+
exports2.SlideOutViewport = SlideOutViewport;
|
|
6268
6780
|
exports2.Slider = Slider;
|
|
6269
6781
|
exports2.Spinner = Spinner;
|
|
6270
6782
|
exports2.Switch = Switch;
|
|
@@ -6299,21 +6811,21 @@
|
|
|
6299
6811
|
exports2.badge = badge;
|
|
6300
6812
|
exports2.buttonCva = buttonCva;
|
|
6301
6813
|
exports2.floating = floating;
|
|
6814
|
+
exports2.genericMemo = genericMemo;
|
|
6815
|
+
exports2.getActiveState = getActiveState;
|
|
6816
|
+
exports2.getBooleanState = getBooleanState;
|
|
6817
|
+
exports2.getCheckedState = getCheckedState;
|
|
6818
|
+
exports2.getOpenState = getOpenState;
|
|
6819
|
+
exports2.getSelectedState = getSelectedState;
|
|
6302
6820
|
exports2.mergeRefs = mergeRefs;
|
|
6303
6821
|
exports2.radiusCva = radiusCva;
|
|
6304
6822
|
exports2.stopPropagation = stopPropagation;
|
|
6305
6823
|
exports2.useAlertDialog = useAlertDialog;
|
|
6306
6824
|
exports2.useButtonGroup = useButtonGroup;
|
|
6307
6825
|
exports2.useControlledState = useControlledState;
|
|
6826
|
+
exports2.useFallbackId = useFallbackId;
|
|
6308
6827
|
exports2.useLayoutContext = useLayoutContext;
|
|
6309
|
-
exports2.useMenuContentContext = useMenuContentContext;
|
|
6310
|
-
exports2.useMenuContext = useMenuContext;
|
|
6311
|
-
exports2.usePagesContext = usePagesContext;
|
|
6312
6828
|
exports2.useProvider = useProvider;
|
|
6313
|
-
exports2.useSelectedIndicatorContext = useSelectedIndicatorContext;
|
|
6314
|
-
exports2.useSize = useSize;
|
|
6315
|
-
exports2.useStopEventPropagation = useStopEventPropagation;
|
|
6316
|
-
exports2.useSubContext = useSubContext;
|
|
6317
6829
|
exports2.useTextFilter = useTextFilter;
|
|
6318
6830
|
exports2.useToast = useToast;
|
|
6319
6831
|
exports2.useViewportSize = useViewportSize;
|