@overmap-ai/blocks 1.0.39 → 1.0.40-TableStyling.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/ButtonGroup/ButtonGroup.d.ts +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/CheckboxItem.d.ts +1 -1
- package/dist/CommandMenu/SelectedIndicator.d.ts +2 -3
- package/dist/CommandMenu/context.d.ts +2 -3
- package/dist/DayPicker/typings.d.ts +1 -1
- package/dist/Dialog/typings.d.ts +2 -2
- 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 +1 -3
- package/dist/Layout/hooks.d.ts +1 -0
- 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 +6 -0
- package/dist/LuIcon/index.d.ts +2 -0
- package/dist/LuIcon/typings.d.ts +3 -0
- 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/typings.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/OneTimePasswordField/HiddenInput.d.ts +5 -0
- package/dist/OneTimePasswordField/Input.d.ts +5 -0
- package/dist/OneTimePasswordField/Root.d.ts +6 -0
- package/dist/OneTimePasswordField/context.d.ts +9 -0
- package/dist/{Toast → OneTimePasswordField}/cva.d.ts +2 -2
- package/dist/OneTimePasswordField/index.d.ts +10 -0
- package/dist/OneTimePasswordField/typings.d.ts +9 -0
- package/dist/Overlay/Close.d.ts +5 -0
- package/dist/Overlay/Content.d.ts +6 -0
- package/dist/Overlay/Description.d.ts +5 -0
- package/dist/Overlay/Root.d.ts +5 -0
- package/dist/Overlay/Title.d.ts +5 -0
- package/dist/Overlay/Trigger.d.ts +5 -0
- package/dist/Overlay/cva.d.ts +1 -0
- package/dist/Overlay/index.d.ts +15 -0
- package/dist/RadioCards/Item.d.ts +2 -2
- package/dist/RadioCards/Root.d.ts +2 -2
- 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/SegmentedControl/context.d.ts +1 -1
- 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 +11 -0
- package/dist/SlideOut/Handle.d.ts +5 -0
- package/dist/SlideOut/Overlay.d.ts +4 -0
- package/dist/SlideOut/Root.d.ts +9 -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 +17 -0
- package/dist/SlideOut/index.d.ts +18 -1
- package/dist/SlideOut/typings.d.ts +2 -0
- package/dist/Slider/Slider.d.ts +2 -2
- package/dist/Table/cva.d.ts +6 -0
- package/dist/Text/cva.d.ts +1 -1
- package/dist/Toast/CustomToast.d.ts +6 -0
- package/dist/Toast/Toaster.d.ts +4 -0
- package/dist/Toast/index.d.ts +3 -4
- package/dist/Toast/toast.d.ts +12 -0
- package/dist/Toast/typings.d.ts +3 -52
- package/dist/blocks.js +1877 -1236
- package/dist/blocks.js.map +1 -1
- package/dist/blocks.umd.cjs +2130 -1488
- package/dist/blocks.umd.cjs.map +1 -1
- package/dist/hooks.d.ts +20 -0
- package/dist/index.d.ts +7 -3
- package/dist/typings.d.ts +0 -5
- package/dist/utils.d.ts +7 -30
- package/package.json +21 -46
- package/dist/CheckboxGroup/cva.d.ts +0 -0
- 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/RiIcon/RiIcon.d.ts +0 -7
- package/dist/RiIcon/index.d.ts +0 -1
- package/dist/SlideOut/SlideOut.d.ts +0 -50
- package/dist/Toast/Toast.d.ts +0 -17
- package/dist/Toast/ToastContext.d.ts +0 -3
- package/dist/Toast/ToastProvider.d.ts +0 -13
- /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("sonner"), 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", "sonner", "@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.sonner, 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, sonner, Toggle, RadixTooltip) {
|
|
4
4
|
"use strict";
|
|
5
5
|
function _interopNamespaceDefault(e) {
|
|
6
6
|
const n = Object.create(null, { [Symbol.toStringTag]: { value: "Module" } });
|
|
@@ -19,14 +19,12 @@
|
|
|
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
|
-
const RiIcons__namespace = /* @__PURE__ */ _interopNamespaceDefault(RiIcons);
|
|
28
25
|
const RadixHoverCard__namespace = /* @__PURE__ */ _interopNamespaceDefault(RadixHoverCard);
|
|
29
26
|
const RadixSeparator__namespace = /* @__PURE__ */ _interopNamespaceDefault(RadixSeparator);
|
|
27
|
+
const RadixOneTimePasswordField__namespace = /* @__PURE__ */ _interopNamespaceDefault(RadixOneTimePasswordField);
|
|
30
28
|
const RadixPopover__namespace = /* @__PURE__ */ _interopNamespaceDefault(RadixPopover);
|
|
31
29
|
const RadixProgress__namespace = /* @__PURE__ */ _interopNamespaceDefault(RadixProgress);
|
|
32
30
|
const RadixRadioGroup__namespace = /* @__PURE__ */ _interopNamespaceDefault(RadixRadioGroup);
|
|
@@ -34,7 +32,6 @@
|
|
|
34
32
|
const RadixTabs__namespace = /* @__PURE__ */ _interopNamespaceDefault(RadixTabs);
|
|
35
33
|
const RadixSlider__namespace = /* @__PURE__ */ _interopNamespaceDefault(RadixSlider);
|
|
36
34
|
const RadixSwitch__namespace = /* @__PURE__ */ _interopNamespaceDefault(RadixSwitch);
|
|
37
|
-
const RadixToast__namespace = /* @__PURE__ */ _interopNamespaceDefault(RadixToast);
|
|
38
35
|
const Toggle__namespace = /* @__PURE__ */ _interopNamespaceDefault(Toggle);
|
|
39
36
|
const RadixTooltip__namespace = /* @__PURE__ */ _interopNamespaceDefault(RadixTooltip);
|
|
40
37
|
const floating = classVarianceAuthority.cva(
|
|
@@ -103,17 +100,17 @@
|
|
|
103
100
|
}
|
|
104
101
|
]
|
|
105
102
|
});
|
|
106
|
-
const ProviderContext =
|
|
103
|
+
const ProviderContext = react.createContext({});
|
|
107
104
|
const useProvider = () => {
|
|
108
|
-
const context =
|
|
105
|
+
const context = react.useContext(ProviderContext);
|
|
109
106
|
if (!context) {
|
|
110
107
|
throw new Error("useProvider must be used within a Provider");
|
|
111
108
|
}
|
|
112
109
|
return context;
|
|
113
110
|
};
|
|
114
|
-
const Provider =
|
|
111
|
+
const Provider = react.memo((props) => {
|
|
115
112
|
const { accentColor, radius = "md", children } = props;
|
|
116
|
-
const contextValue =
|
|
113
|
+
const contextValue = react.useMemo(
|
|
117
114
|
() => ({
|
|
118
115
|
accentColor,
|
|
119
116
|
radius
|
|
@@ -180,7 +177,7 @@
|
|
|
180
177
|
}
|
|
181
178
|
}
|
|
182
179
|
);
|
|
183
|
-
const AlertDialogContent =
|
|
180
|
+
const AlertDialogContent = react.memo((props) => {
|
|
184
181
|
const { radius } = useProvider();
|
|
185
182
|
const { ref, children, className, size, container, ...rest } = props;
|
|
186
183
|
return /* @__PURE__ */ jsxRuntime.jsxs(RadixAlertDialog__namespace.Portal, { container, children: [
|
|
@@ -198,18 +195,18 @@
|
|
|
198
195
|
] });
|
|
199
196
|
});
|
|
200
197
|
AlertDialogContent.displayName = "AlertDialogContent";
|
|
201
|
-
const AlertDialogContext =
|
|
198
|
+
const AlertDialogContext = react.createContext(() => {
|
|
202
199
|
throw new Error("No AlertDialogProvider found");
|
|
203
200
|
});
|
|
204
201
|
const useAlertDialog = () => {
|
|
205
|
-
const alertDialogContext =
|
|
202
|
+
const alertDialogContext = react.useContext(AlertDialogContext);
|
|
206
203
|
if (!alertDialogContext) {
|
|
207
204
|
throw new Error("No AlertDialogProvider found");
|
|
208
205
|
}
|
|
209
206
|
return alertDialogContext;
|
|
210
207
|
};
|
|
211
|
-
const ButtonGroupContext =
|
|
212
|
-
const ButtonGroup =
|
|
208
|
+
const ButtonGroupContext = react.createContext({});
|
|
209
|
+
const ButtonGroup = react.memo((props) => {
|
|
213
210
|
const providerContext = useProvider();
|
|
214
211
|
const {
|
|
215
212
|
children,
|
|
@@ -219,7 +216,7 @@
|
|
|
219
216
|
accentColor = providerContext.accentColor,
|
|
220
217
|
...rest
|
|
221
218
|
} = props;
|
|
222
|
-
const value =
|
|
219
|
+
const value = react.useMemo(
|
|
223
220
|
() => ({
|
|
224
221
|
variant,
|
|
225
222
|
size,
|
|
@@ -231,7 +228,7 @@
|
|
|
231
228
|
return /* @__PURE__ */ jsxRuntime.jsx("div", { ...rest, children: /* @__PURE__ */ jsxRuntime.jsx(ButtonGroupContext.Provider, { value, children }) });
|
|
232
229
|
});
|
|
233
230
|
ButtonGroup.displayName = "Buttons";
|
|
234
|
-
const useButtonGroup = () =>
|
|
231
|
+
const useButtonGroup = () => react.useContext(ButtonGroupContext);
|
|
235
232
|
const buttonCva = classVarianceAuthority.cva(
|
|
236
233
|
[
|
|
237
234
|
"inline-flex",
|
|
@@ -385,7 +382,7 @@
|
|
|
385
382
|
}
|
|
386
383
|
}
|
|
387
384
|
);
|
|
388
|
-
const Button =
|
|
385
|
+
const Button = react.memo((props) => {
|
|
389
386
|
const providerContext = useProvider();
|
|
390
387
|
const buttonsContext = useButtonGroup();
|
|
391
388
|
const {
|
|
@@ -410,7 +407,7 @@
|
|
|
410
407
|
);
|
|
411
408
|
});
|
|
412
409
|
Button.displayName = "Button";
|
|
413
|
-
const IconButton =
|
|
410
|
+
const IconButton = react.memo((props) => {
|
|
414
411
|
const providerContext = useProvider();
|
|
415
412
|
const buttonsContext = useButtonGroup();
|
|
416
413
|
const {
|
|
@@ -435,11 +432,11 @@
|
|
|
435
432
|
);
|
|
436
433
|
});
|
|
437
434
|
IconButton.displayName = "IconButton";
|
|
438
|
-
const AlertDialogProvider =
|
|
435
|
+
const AlertDialogProvider = react.memo((props) => {
|
|
439
436
|
const { children } = props;
|
|
440
|
-
const [open, setOpen] =
|
|
441
|
-
const [options, setOptions] =
|
|
442
|
-
const handleOpenChange =
|
|
437
|
+
const [open, setOpen] = react.useState(false);
|
|
438
|
+
const [options, setOptions] = react.useState(null);
|
|
439
|
+
const handleOpenChange = react.useCallback(
|
|
443
440
|
(open2) => {
|
|
444
441
|
var _a;
|
|
445
442
|
setOpen(open2);
|
|
@@ -448,7 +445,7 @@
|
|
|
448
445
|
},
|
|
449
446
|
[options]
|
|
450
447
|
);
|
|
451
|
-
const openAlertDialog =
|
|
448
|
+
const openAlertDialog = react.useCallback(
|
|
452
449
|
(config) => {
|
|
453
450
|
if (open) throw new Error("AlertDialog is already open");
|
|
454
451
|
setOpen(true);
|
|
@@ -485,7 +482,7 @@
|
|
|
485
482
|
Action: RadixAlertDialog__namespace.Action,
|
|
486
483
|
Cancel: RadixAlertDialog__namespace.Cancel
|
|
487
484
|
};
|
|
488
|
-
const AvatarContext =
|
|
485
|
+
const AvatarContext = react.createContext({});
|
|
489
486
|
const avatar = classVarianceAuthority.cva(["shrink-0", "select-none", "inline-block", "align-middle"], {
|
|
490
487
|
variants: {
|
|
491
488
|
size: {
|
|
@@ -513,13 +510,13 @@
|
|
|
513
510
|
variant: "solid"
|
|
514
511
|
}
|
|
515
512
|
});
|
|
516
|
-
const AvatarFallback =
|
|
513
|
+
const AvatarFallback = react.memo((props) => {
|
|
517
514
|
const { ref, children, className, ...rest } = props;
|
|
518
|
-
const { variant } =
|
|
515
|
+
const { variant } = react.useContext(AvatarContext);
|
|
519
516
|
return /* @__PURE__ */ jsxRuntime.jsx(RadixAvatar__namespace.AvatarFallback, { className: classVarianceAuthority.cx(avatarFallback({ variant }), className), ref, ...rest, children });
|
|
520
517
|
});
|
|
521
518
|
AvatarFallback.displayName = "AvatarFallback";
|
|
522
|
-
const AvatarImage =
|
|
519
|
+
const AvatarImage = react.memo((props) => {
|
|
523
520
|
const { ref, className, ...rest } = props;
|
|
524
521
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
525
522
|
RadixAvatar__namespace.Image,
|
|
@@ -531,7 +528,7 @@
|
|
|
531
528
|
);
|
|
532
529
|
});
|
|
533
530
|
AvatarImage.displayName = "AvatarImage";
|
|
534
|
-
const AvatarRoot =
|
|
531
|
+
const AvatarRoot = react.memo((props) => {
|
|
535
532
|
const providerContext = useProvider();
|
|
536
533
|
const {
|
|
537
534
|
ref,
|
|
@@ -639,7 +636,7 @@
|
|
|
639
636
|
icon: false
|
|
640
637
|
}
|
|
641
638
|
});
|
|
642
|
-
const Badge =
|
|
639
|
+
const Badge = react.memo((props) => {
|
|
643
640
|
const providerContext = useProvider();
|
|
644
641
|
const {
|
|
645
642
|
ref,
|
|
@@ -684,7 +681,7 @@
|
|
|
684
681
|
variant: "surface"
|
|
685
682
|
}
|
|
686
683
|
});
|
|
687
|
-
const Card =
|
|
684
|
+
const Card = react.memo((props) => {
|
|
688
685
|
const providerContext = useProvider();
|
|
689
686
|
const {
|
|
690
687
|
ref,
|
|
@@ -708,7 +705,7 @@
|
|
|
708
705
|
);
|
|
709
706
|
});
|
|
710
707
|
Card.displayName = "Card";
|
|
711
|
-
const CheckboxIndicator =
|
|
708
|
+
const CheckboxIndicator = react.memo((props) => {
|
|
712
709
|
const { ref, children, className, ...rest } = props;
|
|
713
710
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
714
711
|
RadixCheckbox__namespace.CheckboxIndicator,
|
|
@@ -764,7 +761,7 @@
|
|
|
764
761
|
}
|
|
765
762
|
}
|
|
766
763
|
);
|
|
767
|
-
const CheckboxRoot =
|
|
764
|
+
const CheckboxRoot = react.memo((props) => {
|
|
768
765
|
const providerContext = useProvider();
|
|
769
766
|
const {
|
|
770
767
|
ref,
|
|
@@ -792,94 +789,18 @@
|
|
|
792
789
|
Root: CheckboxRoot,
|
|
793
790
|
Indicator: CheckboxIndicator
|
|
794
791
|
};
|
|
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;
|
|
792
|
+
const SelectContext = react.createContext({});
|
|
793
|
+
const MultiSelectContext = react.createContext({});
|
|
873
794
|
const useViewportSize = (props) => {
|
|
874
795
|
const { xs: xsProps, sm: smProps, md: mdProps, lg: lgProps, xl: xlProps } = props;
|
|
875
|
-
const [prevSize, setPrevSize] =
|
|
876
|
-
const [size, setSize] =
|
|
796
|
+
const [prevSize, setPrevSize] = react.useState("initial");
|
|
797
|
+
const [size, setSize] = react.useState("initial");
|
|
877
798
|
const xs = reactResponsive.useMediaQuery({ minWidth: xsProps });
|
|
878
799
|
const sm = reactResponsive.useMediaQuery({ minWidth: smProps });
|
|
879
800
|
const md = reactResponsive.useMediaQuery({ minWidth: mdProps });
|
|
880
801
|
const lg = reactResponsive.useMediaQuery({ minWidth: lgProps });
|
|
881
802
|
const xl = reactResponsive.useMediaQuery({ minWidth: xlProps });
|
|
882
|
-
|
|
803
|
+
react.useLayoutEffect(() => {
|
|
883
804
|
setSize((prev) => {
|
|
884
805
|
setPrevSize(prev);
|
|
885
806
|
return xl ? "xl" : lg ? "lg" : md ? "md" : sm ? "sm" : xs ? "xs" : "initial";
|
|
@@ -887,69 +808,58 @@
|
|
|
887
808
|
}, [lg, md, sm, xl, xs]);
|
|
888
809
|
return { size, prevSize, xs, sm, md, lg, xl };
|
|
889
810
|
};
|
|
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]);
|
|
811
|
+
function useTextFilter(items, filterFunction) {
|
|
812
|
+
const [filteredOptions, setFilteredOptions] = react.useState([]);
|
|
813
|
+
const [filterValue, setFilterValue] = react.useState("");
|
|
814
|
+
react.useEffect(() => {
|
|
815
|
+
setFilteredOptions(items.filter((value) => filterFunction(value, filterValue)));
|
|
816
|
+
}, [filterFunction, filterValue, items]);
|
|
901
817
|
return [filteredOptions, filterValue, setFilterValue];
|
|
902
818
|
}
|
|
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
819
|
function useControlledState(initialState, state, setState) {
|
|
918
|
-
const [uncontrolledState, setUncontrolledState] =
|
|
919
|
-
const handleStateChange =
|
|
820
|
+
const [uncontrolledState, setUncontrolledState] = react.useState(initialState);
|
|
821
|
+
const handleStateChange = react.useCallback(
|
|
920
822
|
(state2) => {
|
|
921
823
|
setUncontrolledState(state2);
|
|
922
824
|
setState == null ? void 0 : setState(state2);
|
|
923
825
|
},
|
|
924
826
|
[setState]
|
|
925
827
|
);
|
|
926
|
-
|
|
828
|
+
react.useEffect(() => {
|
|
927
829
|
if (state !== void 0) {
|
|
928
830
|
setUncontrolledState(state);
|
|
929
831
|
}
|
|
930
832
|
}, [state]);
|
|
931
833
|
return [state ?? uncontrolledState, handleStateChange];
|
|
932
834
|
}
|
|
835
|
+
function useFallbackId(id) {
|
|
836
|
+
const fallbackId = react.useId();
|
|
837
|
+
return id ?? fallbackId;
|
|
838
|
+
}
|
|
839
|
+
const genericMemo = react.memo;
|
|
933
840
|
function mergeRefs(refs) {
|
|
934
841
|
return (value) => {
|
|
935
|
-
const cleanups = refs.reduce(
|
|
936
|
-
|
|
937
|
-
|
|
938
|
-
|
|
939
|
-
|
|
940
|
-
|
|
842
|
+
const cleanups = refs.reduce(
|
|
843
|
+
(cleanups2, ref) => {
|
|
844
|
+
if (typeof ref === "function") {
|
|
845
|
+
const cleanup = ref(value);
|
|
846
|
+
if (typeof cleanup === "function") {
|
|
847
|
+
cleanups2.push(cleanup);
|
|
848
|
+
} else {
|
|
849
|
+
cleanups2.push(() => {
|
|
850
|
+
ref(null);
|
|
851
|
+
});
|
|
852
|
+
}
|
|
853
|
+
} else if (ref != null) {
|
|
854
|
+
ref.current = value;
|
|
941
855
|
cleanups2.push(() => {
|
|
942
|
-
ref
|
|
856
|
+
ref.current = null;
|
|
943
857
|
});
|
|
944
858
|
}
|
|
945
|
-
|
|
946
|
-
|
|
947
|
-
|
|
948
|
-
|
|
949
|
-
});
|
|
950
|
-
}
|
|
951
|
-
return cleanups2;
|
|
952
|
-
}, []);
|
|
859
|
+
return cleanups2;
|
|
860
|
+
},
|
|
861
|
+
[]
|
|
862
|
+
);
|
|
953
863
|
return () => {
|
|
954
864
|
cleanups.forEach((cleanup) => {
|
|
955
865
|
cleanup();
|
|
@@ -960,11 +870,26 @@
|
|
|
960
870
|
const stopPropagation = (e) => {
|
|
961
871
|
e.stopPropagation();
|
|
962
872
|
};
|
|
873
|
+
function getSelectedState(selected) {
|
|
874
|
+
return selected ? "selected" : "unselected";
|
|
875
|
+
}
|
|
876
|
+
function getCheckedState(checked) {
|
|
877
|
+
return checked === true ? "checked" : checked === false ? "unchecked" : "indeterminate";
|
|
878
|
+
}
|
|
879
|
+
function getActiveState(active) {
|
|
880
|
+
return active ? "active" : "inactive";
|
|
881
|
+
}
|
|
882
|
+
function getBooleanState(value) {
|
|
883
|
+
return value ? "true" : "false";
|
|
884
|
+
}
|
|
885
|
+
function getOpenState(open) {
|
|
886
|
+
return open ? "open" : "closed";
|
|
887
|
+
}
|
|
963
888
|
const MultiSelectProvider = genericMemo(function MultiSelectProvider2(props) {
|
|
964
889
|
const { children, defaultValues, values: controlledValues, onValuesChange } = props;
|
|
965
|
-
const [itemValueMapping, setItemValueMapping] =
|
|
890
|
+
const [itemValueMapping, setItemValueMapping] = react.useState(/* @__PURE__ */ new Set());
|
|
966
891
|
const [values, setValues] = useControlledState(defaultValues ?? [], controlledValues, onValuesChange);
|
|
967
|
-
const registerValue =
|
|
892
|
+
const registerValue = react.useCallback((value) => {
|
|
968
893
|
setItemValueMapping((prev) => {
|
|
969
894
|
const newSet = new Set(prev);
|
|
970
895
|
newSet.add(value);
|
|
@@ -978,8 +903,8 @@
|
|
|
978
903
|
});
|
|
979
904
|
};
|
|
980
905
|
}, []);
|
|
981
|
-
const selected =
|
|
982
|
-
const selectValue =
|
|
906
|
+
const selected = react.useCallback((value) => values.includes(value), [values]);
|
|
907
|
+
const selectValue = react.useCallback(
|
|
983
908
|
(value) => {
|
|
984
909
|
if (selected(value)) {
|
|
985
910
|
setValues(values.filter((v) => v !== value));
|
|
@@ -989,20 +914,20 @@
|
|
|
989
914
|
},
|
|
990
915
|
[selected, setValues, values]
|
|
991
916
|
);
|
|
992
|
-
const allSelected =
|
|
917
|
+
const allSelected = react.useMemo(() => {
|
|
993
918
|
return Array.from(itemValueMapping.values()).every((value) => values.includes(value));
|
|
994
919
|
}, [itemValueMapping, values]);
|
|
995
|
-
const someSelected =
|
|
920
|
+
const someSelected = react.useMemo(() => {
|
|
996
921
|
return Array.from(itemValueMapping.values()).some((value) => values.includes(value));
|
|
997
922
|
}, [itemValueMapping, values]);
|
|
998
|
-
const toggleSelectAll =
|
|
923
|
+
const toggleSelectAll = react.useCallback(() => {
|
|
999
924
|
if (allSelected) {
|
|
1000
925
|
setValues([]);
|
|
1001
926
|
} else {
|
|
1002
927
|
setValues(Array.from(itemValueMapping.values()));
|
|
1003
928
|
}
|
|
1004
929
|
}, [allSelected, itemValueMapping, setValues]);
|
|
1005
|
-
const contextValue =
|
|
930
|
+
const contextValue = react.useMemo(
|
|
1006
931
|
() => ({ selected, selectValue, allSelected, someSelected, toggleSelectAll, registerValue }),
|
|
1007
932
|
[allSelected, registerValue, selectValue, selected, someSelected, toggleSelectAll]
|
|
1008
933
|
);
|
|
@@ -1011,51 +936,51 @@
|
|
|
1011
936
|
const SingleSelectRequiredProvider = genericMemo(function SingleSelectRequiredProvider2(props) {
|
|
1012
937
|
const { children, defaultValue, value, onValueChange } = props;
|
|
1013
938
|
const [controlledValue, setControlledValue] = useControlledState(defaultValue, value, onValueChange);
|
|
1014
|
-
const selected =
|
|
1015
|
-
const selectValue =
|
|
939
|
+
const selected = react.useCallback((v) => v === controlledValue, [controlledValue]);
|
|
940
|
+
const selectValue = react.useCallback(
|
|
1016
941
|
(v) => {
|
|
1017
942
|
if (selected(v)) return;
|
|
1018
943
|
setControlledValue(v);
|
|
1019
944
|
},
|
|
1020
945
|
[selected, setControlledValue]
|
|
1021
946
|
);
|
|
1022
|
-
const contextValue =
|
|
947
|
+
const contextValue = react.useMemo(() => ({ selected, selectValue }), [selectValue, selected]);
|
|
1023
948
|
return /* @__PURE__ */ jsxRuntime.jsx(SelectContext, { value: contextValue, children });
|
|
1024
949
|
});
|
|
1025
950
|
const SingleSelectNotRequiredProvider = genericMemo(function SingleSelectNotRequiredProvider2(props) {
|
|
1026
951
|
const { children, defaultValue = void 0, value: controlledValue, onValueChange } = props;
|
|
1027
952
|
const [value, setValue] = useControlledState(defaultValue, controlledValue, onValueChange);
|
|
1028
|
-
const selected =
|
|
1029
|
-
const selectValue =
|
|
953
|
+
const selected = react.useCallback((v) => v === value, [value]);
|
|
954
|
+
const selectValue = react.useCallback(
|
|
1030
955
|
(v) => {
|
|
1031
956
|
setValue(selected(v) ? void 0 : v);
|
|
1032
957
|
},
|
|
1033
958
|
[selected, setValue]
|
|
1034
959
|
);
|
|
1035
|
-
const contextValue =
|
|
960
|
+
const contextValue = react.useMemo(() => ({ selected, selectValue }), [selected, selectValue]);
|
|
1036
961
|
return /* @__PURE__ */ jsxRuntime.jsx(SelectContext, { value: contextValue, children });
|
|
1037
962
|
});
|
|
1038
|
-
const CheckboxGroupContext =
|
|
1039
|
-
const CheckboxGroupItem =
|
|
1040
|
-
const groupContext =
|
|
963
|
+
const CheckboxGroupContext = react.createContext({});
|
|
964
|
+
const CheckboxGroupItem = react.memo((props) => {
|
|
965
|
+
const groupContext = react.use(CheckboxGroupContext);
|
|
1041
966
|
const {
|
|
1042
967
|
ref,
|
|
1043
968
|
className,
|
|
1044
969
|
value,
|
|
1045
|
-
accentColor,
|
|
1046
970
|
disabled,
|
|
971
|
+
accentColor = groupContext.accentColor,
|
|
1047
972
|
variant = groupContext.variant,
|
|
1048
973
|
size = groupContext.size,
|
|
1049
974
|
radius = groupContext.radius,
|
|
1050
975
|
...rest
|
|
1051
976
|
} = props;
|
|
1052
|
-
const { selected, selectValue, registerValue } =
|
|
1053
|
-
|
|
977
|
+
const { selected, selectValue, registerValue } = react.use(MultiSelectContext);
|
|
978
|
+
react.useLayoutEffect(() => {
|
|
1054
979
|
return registerValue(value);
|
|
1055
980
|
}, [registerValue, value]);
|
|
1056
981
|
const isChecked = selected(value);
|
|
1057
982
|
const isDisabled = groupContext.disabled || disabled;
|
|
1058
|
-
const handleCheckedChange =
|
|
983
|
+
const handleCheckedChange = react.useCallback(() => {
|
|
1059
984
|
selectValue(value);
|
|
1060
985
|
}, [selectValue, value]);
|
|
1061
986
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
@@ -1075,15 +1000,12 @@
|
|
|
1075
1000
|
);
|
|
1076
1001
|
});
|
|
1077
1002
|
CheckboxGroupItem.displayName = "CheckboxGroupItem";
|
|
1078
|
-
const CheckboxGroupItemIndicator =
|
|
1003
|
+
const CheckboxGroupItemIndicator = react.memo((props) => {
|
|
1079
1004
|
const { ref, className, ...rest } = props;
|
|
1080
1005
|
return /* @__PURE__ */ jsxRuntime.jsx(RadixCheckbox__namespace.Indicator, { className: classVarianceAuthority.cx("flex items-center justify-center", className), ref, ...rest });
|
|
1081
1006
|
});
|
|
1082
1007
|
CheckboxGroupItemIndicator.displayName = "CheckboxGroupItemIndicator";
|
|
1083
|
-
|
|
1084
|
-
return value ? "true" : "false";
|
|
1085
|
-
}
|
|
1086
|
-
const CheckboxGroupRoot = React.memo((props) => {
|
|
1008
|
+
const CheckboxGroupRoot = react.memo((props) => {
|
|
1087
1009
|
const providerContext = useProvider();
|
|
1088
1010
|
const {
|
|
1089
1011
|
ref,
|
|
@@ -1100,25 +1022,27 @@
|
|
|
1100
1022
|
size = "md",
|
|
1101
1023
|
...rest
|
|
1102
1024
|
} = props;
|
|
1103
|
-
const contextValue =
|
|
1025
|
+
const contextValue = react.useMemo(
|
|
1104
1026
|
() => ({
|
|
1105
1027
|
name,
|
|
1106
1028
|
required,
|
|
1107
1029
|
disabled,
|
|
1030
|
+
// style props
|
|
1031
|
+
accentColor,
|
|
1108
1032
|
size,
|
|
1109
1033
|
variant,
|
|
1110
1034
|
radius
|
|
1111
1035
|
}),
|
|
1112
|
-
[disabled, name, radius, required, size, variant]
|
|
1036
|
+
[accentColor, disabled, name, radius, required, size, variant]
|
|
1113
1037
|
);
|
|
1114
1038
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
1115
1039
|
"div",
|
|
1116
1040
|
{
|
|
1117
1041
|
ref,
|
|
1118
1042
|
role: "group",
|
|
1119
|
-
"data-disabled": getBooleanState
|
|
1043
|
+
"data-disabled": getBooleanState(!!disabled),
|
|
1120
1044
|
"data-accent-color": accentColor,
|
|
1121
|
-
"aria-disabled": getBooleanState
|
|
1045
|
+
"aria-disabled": getBooleanState(!!disabled),
|
|
1122
1046
|
...rest,
|
|
1123
1047
|
children: /* @__PURE__ */ jsxRuntime.jsx(CheckboxGroupContext.Provider, { value: contextValue, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
1124
1048
|
MultiSelectProvider,
|
|
@@ -1133,19 +1057,19 @@
|
|
|
1133
1057
|
);
|
|
1134
1058
|
});
|
|
1135
1059
|
CheckboxGroupRoot.displayName = "CheckboxGroupRoot";
|
|
1136
|
-
const CheckboxGroupSelectAllItem =
|
|
1137
|
-
const groupContext =
|
|
1060
|
+
const CheckboxGroupSelectAllItem = react.memo((props) => {
|
|
1061
|
+
const groupContext = react.use(CheckboxGroupContext);
|
|
1138
1062
|
const {
|
|
1139
1063
|
ref,
|
|
1140
1064
|
className,
|
|
1141
|
-
accentColor,
|
|
1142
1065
|
disabled,
|
|
1066
|
+
accentColor = groupContext.accentColor,
|
|
1143
1067
|
variant = groupContext.variant,
|
|
1144
1068
|
size = groupContext.size,
|
|
1145
1069
|
radius = groupContext.radius,
|
|
1146
1070
|
...rest
|
|
1147
1071
|
} = props;
|
|
1148
|
-
const { allSelected, someSelected, toggleSelectAll } =
|
|
1072
|
+
const { allSelected, someSelected, toggleSelectAll } = react.use(MultiSelectContext);
|
|
1149
1073
|
const checked = allSelected ? true : someSelected ? "indeterminate" : false;
|
|
1150
1074
|
const isDisabled = groupContext.disabled || disabled;
|
|
1151
1075
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
@@ -1170,137 +1094,39 @@
|
|
|
1170
1094
|
SelectAllItem: CheckboxGroupSelectAllItem,
|
|
1171
1095
|
ItemIndicator: CheckboxGroupItemIndicator
|
|
1172
1096
|
};
|
|
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]);
|
|
1097
|
+
const CheckedIndicatorContext = react.createContext({});
|
|
1098
|
+
const CheckedIndicator = react.memo((props) => {
|
|
1099
|
+
const { children, ref, className, ...rest } = props;
|
|
1100
|
+
const checked = react.useContext(CheckedIndicatorContext);
|
|
1101
|
+
const computedChildren = typeof children === "function" ? children(checked) : children;
|
|
1286
1102
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
1287
1103
|
"span",
|
|
1288
1104
|
{
|
|
1289
1105
|
ref,
|
|
1290
|
-
"data-state": getCheckedState$1(checkedState),
|
|
1291
1106
|
className: classVarianceAuthority.cx(
|
|
1292
|
-
"
|
|
1107
|
+
"flex size-max items-center",
|
|
1293
1108
|
{
|
|
1294
|
-
invisible:
|
|
1109
|
+
invisible: checked === false
|
|
1295
1110
|
},
|
|
1296
1111
|
className
|
|
1297
1112
|
),
|
|
1113
|
+
"data-state": getCheckedState(checked),
|
|
1298
1114
|
...rest,
|
|
1299
1115
|
children: computedChildren
|
|
1300
1116
|
}
|
|
1301
1117
|
);
|
|
1302
1118
|
});
|
|
1119
|
+
CheckedIndicator.displayName = "CheckedIndicator";
|
|
1120
|
+
const CommandMenuCheckboxIndicator = react.memo((props) => {
|
|
1121
|
+
const { ref, children, ...rest } = props;
|
|
1122
|
+
return /* @__PURE__ */ jsxRuntime.jsx(CheckedIndicator, { ref, ...rest, children });
|
|
1123
|
+
});
|
|
1303
1124
|
CommandMenuCheckboxIndicator.displayName = "CommandMenuCheckboxIndicator";
|
|
1125
|
+
const CommandMenuContext = react.createContext({});
|
|
1126
|
+
const SelectedIndicatorContext$1 = react.createContext(false);
|
|
1127
|
+
const CheckboxIndicatorContext = react.createContext(false);
|
|
1128
|
+
const CommandMenuPageContext = react.createContext({});
|
|
1129
|
+
const CommandMenuDialogContext = react.createContext({});
|
|
1304
1130
|
const commandMenuContentCva = classVarianceAuthority.cva(
|
|
1305
1131
|
[
|
|
1306
1132
|
"ring",
|
|
@@ -1509,11 +1335,11 @@
|
|
|
1509
1335
|
}
|
|
1510
1336
|
}
|
|
1511
1337
|
);
|
|
1512
|
-
const CommandMenuItem =
|
|
1338
|
+
const CommandMenuItem = react.memo((props) => {
|
|
1513
1339
|
const { className, ref, closeOnSelect = true, onSelect, filterValue, ...rest } = props;
|
|
1514
|
-
const { size, variant, radius } =
|
|
1515
|
-
const { setOpen } =
|
|
1516
|
-
const handleSelect =
|
|
1340
|
+
const { size, variant, radius } = react.use(CommandMenuContext);
|
|
1341
|
+
const { setOpen } = react.use(CommandMenuDialogContext);
|
|
1342
|
+
const handleSelect = react.useCallback(() => {
|
|
1517
1343
|
onSelect == null ? void 0 : onSelect();
|
|
1518
1344
|
if (closeOnSelect) {
|
|
1519
1345
|
setOpen(false);
|
|
@@ -1531,16 +1357,16 @@
|
|
|
1531
1357
|
);
|
|
1532
1358
|
});
|
|
1533
1359
|
CommandMenuItem.displayName = "CommandMenuItem";
|
|
1534
|
-
const CommandMenuCheckboxItem =
|
|
1360
|
+
const CommandMenuCheckboxItem = react.memo((props) => {
|
|
1535
1361
|
const { children, ref, checked, onCheckedChange, onSelect, ...rest } = props;
|
|
1536
|
-
const handleSelect =
|
|
1362
|
+
const handleSelect = react.useCallback(() => {
|
|
1537
1363
|
onSelect == null ? void 0 : onSelect();
|
|
1538
1364
|
onCheckedChange(checked !== true);
|
|
1539
1365
|
}, [checked, onCheckedChange, onSelect]);
|
|
1540
|
-
return /* @__PURE__ */ jsxRuntime.jsx(CheckboxIndicatorContext, { value: checked, children: /* @__PURE__ */ jsxRuntime.jsx(CommandMenuItem, { ref, onSelect: handleSelect, "data-state": getCheckedState
|
|
1366
|
+
return /* @__PURE__ */ jsxRuntime.jsx(CheckboxIndicatorContext, { value: checked, children: /* @__PURE__ */ jsxRuntime.jsx(CommandMenuItem, { ref, onSelect: handleSelect, "data-state": getCheckedState(checked), ...rest, children }) });
|
|
1541
1367
|
});
|
|
1542
1368
|
CommandMenuCheckboxItem.displayName = "CommandMenuCheckboxItem";
|
|
1543
|
-
const CommandMenuContent =
|
|
1369
|
+
const CommandMenuContent = react.memo((props) => {
|
|
1544
1370
|
const providerContext = useProvider();
|
|
1545
1371
|
const {
|
|
1546
1372
|
children,
|
|
@@ -1560,13 +1386,14 @@
|
|
|
1560
1386
|
radius = providerContext.radius,
|
|
1561
1387
|
...rest
|
|
1562
1388
|
} = props;
|
|
1563
|
-
const contextValue =
|
|
1389
|
+
const contextValue = react.useMemo(() => {
|
|
1564
1390
|
return {
|
|
1565
1391
|
variant,
|
|
1566
1392
|
size,
|
|
1567
|
-
radius
|
|
1393
|
+
radius,
|
|
1394
|
+
accentColor
|
|
1568
1395
|
};
|
|
1569
|
-
}, [radius, size, variant]);
|
|
1396
|
+
}, [accentColor, radius, size, variant]);
|
|
1570
1397
|
return /* @__PURE__ */ jsxRuntime.jsx(RadixDialog.DialogPortal, { children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
1571
1398
|
RadixDialog.DialogContent,
|
|
1572
1399
|
{
|
|
@@ -1596,27 +1423,27 @@
|
|
|
1596
1423
|
) });
|
|
1597
1424
|
});
|
|
1598
1425
|
CommandMenuContent.displayName = "CommandMenuContent";
|
|
1599
|
-
const CommandMenuEmpty =
|
|
1426
|
+
const CommandMenuEmpty = react.memo((props) => {
|
|
1600
1427
|
const { className, ref, ...rest } = props;
|
|
1601
|
-
const { size } =
|
|
1428
|
+
const { size } = react.use(CommandMenuContext);
|
|
1602
1429
|
return /* @__PURE__ */ jsxRuntime.jsx(cmdk.CommandEmpty, { className: classVarianceAuthority.cx(commandMenuEmptyCva({ size }), className), ref, ...rest });
|
|
1603
1430
|
});
|
|
1604
1431
|
CommandMenuEmpty.displayName = "CommandMenuEmpty";
|
|
1605
|
-
const CommandMenuGroup =
|
|
1432
|
+
const CommandMenuGroup = react.memo((props) => {
|
|
1606
1433
|
const { className, ref, ...rest } = props;
|
|
1607
|
-
const { size } =
|
|
1434
|
+
const { size } = react.use(CommandMenuContext);
|
|
1608
1435
|
return /* @__PURE__ */ jsxRuntime.jsx(cmdk.CommandGroup, { className: classVarianceAuthority.cx(commandMenuGroupCva({ size }), className), ref, ...rest });
|
|
1609
1436
|
});
|
|
1610
1437
|
CommandMenuGroup.displayName = "CommandMenuGroup";
|
|
1611
|
-
const CommandMenuInput =
|
|
1438
|
+
const CommandMenuInput = react.memo((props) => {
|
|
1612
1439
|
const { className, ref, ...rest } = props;
|
|
1613
|
-
const { size } =
|
|
1440
|
+
const { size } = react.use(CommandMenuContext);
|
|
1614
1441
|
return /* @__PURE__ */ jsxRuntime.jsx(cmdk.CommandInput, { className: classVarianceAuthority.cx(commandMenuInputCva({ size }), className), ref, ...rest });
|
|
1615
1442
|
});
|
|
1616
1443
|
CommandMenuInput.displayName = "CommandMenuInput";
|
|
1617
|
-
const CommandMenuList =
|
|
1444
|
+
const CommandMenuList = react.memo((props) => {
|
|
1618
1445
|
const { className, ref, ...rest } = props;
|
|
1619
|
-
const { size } =
|
|
1446
|
+
const { size } = react.use(CommandMenuContext);
|
|
1620
1447
|
const filterCount = cmdk.useCommandState((state) => state.filtered.count);
|
|
1621
1448
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
1622
1449
|
cmdk.CommandList,
|
|
@@ -1639,11 +1466,11 @@
|
|
|
1639
1466
|
selected,
|
|
1640
1467
|
selectValue: handleSelectValue,
|
|
1641
1468
|
registerValue
|
|
1642
|
-
} =
|
|
1643
|
-
|
|
1469
|
+
} = react.use(MultiSelectContext);
|
|
1470
|
+
react.useLayoutEffect(() => {
|
|
1644
1471
|
return registerValue(value);
|
|
1645
1472
|
}, [registerValue, value]);
|
|
1646
|
-
const handleSelect =
|
|
1473
|
+
const handleSelect = react.useCallback(() => {
|
|
1647
1474
|
onSelect == null ? void 0 : onSelect();
|
|
1648
1475
|
handleSelectValue(value);
|
|
1649
1476
|
}, [handleSelectValue, onSelect, value]);
|
|
@@ -1653,7 +1480,7 @@
|
|
|
1653
1480
|
{
|
|
1654
1481
|
ref,
|
|
1655
1482
|
onSelect: handleSelect,
|
|
1656
|
-
"data-state": getSelectedState
|
|
1483
|
+
"data-state": getSelectedState(isSelected),
|
|
1657
1484
|
"aria-selected": isSelected,
|
|
1658
1485
|
closeOnSelect,
|
|
1659
1486
|
...rest,
|
|
@@ -1661,29 +1488,29 @@
|
|
|
1661
1488
|
}
|
|
1662
1489
|
) });
|
|
1663
1490
|
});
|
|
1664
|
-
const CommandMenuOverlay =
|
|
1491
|
+
const CommandMenuOverlay = react.memo((props) => {
|
|
1665
1492
|
const { container, className, ...rest } = props;
|
|
1666
1493
|
return /* @__PURE__ */ jsxRuntime.jsx(RadixDialog.DialogPortal, { container, children: /* @__PURE__ */ jsxRuntime.jsx(RadixDialog.DialogOverlay, { className: classVarianceAuthority.cx(commandMenuOverlayCva(), className), "data-floating-content": "", ...rest }) });
|
|
1667
1494
|
});
|
|
1668
1495
|
CommandMenuOverlay.displayName = "CommandMenuOverlay";
|
|
1669
|
-
const CommandMenuPage =
|
|
1496
|
+
const CommandMenuPage = react.memo((props) => {
|
|
1670
1497
|
const { children, ref, page, ...rest } = props;
|
|
1671
|
-
const { page: activePage } =
|
|
1672
|
-
const isActive =
|
|
1498
|
+
const { page: activePage } = react.use(CommandMenuPageContext);
|
|
1499
|
+
const isActive = react.useMemo(() => page === activePage, [page, activePage]);
|
|
1673
1500
|
return /* @__PURE__ */ jsxRuntime.jsx("div", { ref, "data-active": getActiveState(isActive), hidden: !isActive, ...rest, children: isActive ? children : null });
|
|
1674
1501
|
});
|
|
1675
1502
|
CommandMenuPage.displayName = "CommandMenuPage";
|
|
1676
|
-
const CommandMenuPages =
|
|
1503
|
+
const CommandMenuPages = react.memo((props) => {
|
|
1677
1504
|
const { children, defaultPage = "", page: controlledPage, onPageChange } = props;
|
|
1678
1505
|
const [page, setPage] = useControlledState(defaultPage, controlledPage, onPageChange);
|
|
1679
1506
|
return /* @__PURE__ */ jsxRuntime.jsx(CommandMenuPageContext, { value: { page, setPage }, children });
|
|
1680
1507
|
});
|
|
1681
1508
|
CommandMenuPages.displayName = "CommandMenuPages";
|
|
1682
|
-
const CommandMenuPageTriggerItem =
|
|
1509
|
+
const CommandMenuPageTriggerItem = react.memo((props) => {
|
|
1683
1510
|
const { ref, page, onSelect, closeOnSelect = false, ...rest } = props;
|
|
1684
|
-
const { page: activePage, setPage } =
|
|
1685
|
-
const isActive =
|
|
1686
|
-
const handleSelect =
|
|
1511
|
+
const { page: activePage, setPage } = react.use(CommandMenuPageContext);
|
|
1512
|
+
const isActive = react.useMemo(() => page === activePage, [page, activePage]);
|
|
1513
|
+
const handleSelect = react.useCallback(() => {
|
|
1687
1514
|
onSelect == null ? void 0 : onSelect();
|
|
1688
1515
|
setPage(page);
|
|
1689
1516
|
}, [onSelect, page, setPage]);
|
|
@@ -1721,18 +1548,25 @@
|
|
|
1721
1548
|
});
|
|
1722
1549
|
const CommandMenuRadioItem = genericMemo(function(props) {
|
|
1723
1550
|
const { children, ref, value, onSelect, ...rest } = props;
|
|
1724
|
-
const { selected, selectValue } =
|
|
1725
|
-
const handleSelect =
|
|
1551
|
+
const { selected, selectValue } = react.use(SelectContext);
|
|
1552
|
+
const handleSelect = react.useCallback(() => {
|
|
1726
1553
|
onSelect == null ? void 0 : onSelect();
|
|
1727
1554
|
selectValue(value);
|
|
1728
1555
|
}, [onSelect, selectValue, value]);
|
|
1729
1556
|
const isSelected = selected(value);
|
|
1730
|
-
return /* @__PURE__ */ jsxRuntime.jsx(SelectedIndicatorContext$1, { value: isSelected, children: /* @__PURE__ */ jsxRuntime.jsx(CommandMenuItem, { ref, onSelect: handleSelect, "data-state": getSelectedState
|
|
1557
|
+
return /* @__PURE__ */ jsxRuntime.jsx(SelectedIndicatorContext$1, { value: isSelected, children: /* @__PURE__ */ jsxRuntime.jsx(CommandMenuItem, { ref, onSelect: handleSelect, "data-state": getSelectedState(isSelected), ...rest, children }) });
|
|
1731
1558
|
});
|
|
1732
|
-
const CommandMenuRoot =
|
|
1733
|
-
const {
|
|
1559
|
+
const CommandMenuRoot = react.memo((props) => {
|
|
1560
|
+
const {
|
|
1561
|
+
children,
|
|
1562
|
+
defaultOpen,
|
|
1563
|
+
open: controlledOpen,
|
|
1564
|
+
// oxlint-disable-next-line typescript/unbound-method
|
|
1565
|
+
onOpenChange,
|
|
1566
|
+
modal
|
|
1567
|
+
} = props;
|
|
1734
1568
|
const [open, setOpen] = useControlledState(defaultOpen ?? false, controlledOpen, onOpenChange);
|
|
1735
|
-
const contextValue =
|
|
1569
|
+
const contextValue = react.useMemo(() => {
|
|
1736
1570
|
return {
|
|
1737
1571
|
open,
|
|
1738
1572
|
setOpen
|
|
@@ -1743,8 +1577,8 @@
|
|
|
1743
1577
|
CommandMenuRoot.displayName = "CommandMenuRoot";
|
|
1744
1578
|
const CommandMenuSelectAllItem = genericMemo(function(props) {
|
|
1745
1579
|
const { ref, onSelect, closeOnSelect = false, ...rest } = props;
|
|
1746
|
-
const { allSelected, someSelected, toggleSelectAll } =
|
|
1747
|
-
const handleSelect =
|
|
1580
|
+
const { allSelected, someSelected, toggleSelectAll } = react.use(MultiSelectContext);
|
|
1581
|
+
const handleSelect = react.useCallback(() => {
|
|
1748
1582
|
onSelect == null ? void 0 : onSelect();
|
|
1749
1583
|
toggleSelectAll();
|
|
1750
1584
|
}, [onSelect, toggleSelectAll]);
|
|
@@ -1755,43 +1589,47 @@
|
|
|
1755
1589
|
ref,
|
|
1756
1590
|
role: "menuitemcheckbox",
|
|
1757
1591
|
onSelect: handleSelect,
|
|
1758
|
-
"data-state": getCheckedState
|
|
1592
|
+
"data-state": getCheckedState(selectedState),
|
|
1759
1593
|
closeOnSelect,
|
|
1760
1594
|
...rest
|
|
1761
1595
|
}
|
|
1762
1596
|
) });
|
|
1763
1597
|
});
|
|
1764
|
-
const
|
|
1765
|
-
|
|
1766
|
-
const
|
|
1767
|
-
const
|
|
1768
|
-
|
|
1769
|
-
}, [isSelected, children]);
|
|
1598
|
+
const SelectedIndicatorContext = react.createContext(false);
|
|
1599
|
+
const SelectedIndicator = react.memo((props) => {
|
|
1600
|
+
const { ref, children, className, ...rest } = props;
|
|
1601
|
+
const isSelected = react.use(SelectedIndicatorContext);
|
|
1602
|
+
const computedChildren = typeof children === "function" ? children(isSelected) : children;
|
|
1770
1603
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
1771
1604
|
"span",
|
|
1772
1605
|
{
|
|
1773
1606
|
ref,
|
|
1774
|
-
"data-state": getSelectedState$1(isSelected),
|
|
1775
1607
|
className: classVarianceAuthority.cx(
|
|
1776
|
-
"
|
|
1608
|
+
"flex size-max items-center",
|
|
1777
1609
|
{
|
|
1778
1610
|
invisible: !isSelected
|
|
1779
1611
|
},
|
|
1780
1612
|
className
|
|
1781
1613
|
),
|
|
1614
|
+
"data-state": getSelectedState(isSelected),
|
|
1782
1615
|
...rest,
|
|
1783
1616
|
children: computedChildren
|
|
1784
1617
|
}
|
|
1785
1618
|
);
|
|
1786
1619
|
});
|
|
1620
|
+
SelectedIndicator.displayName = "SelectedIndicator";
|
|
1621
|
+
const CommandMenuSelectedIndicator = react.memo((props) => {
|
|
1622
|
+
const { ref, children, ...rest } = props;
|
|
1623
|
+
return /* @__PURE__ */ jsxRuntime.jsx(SelectedIndicator, { ref, ...rest, children });
|
|
1624
|
+
});
|
|
1787
1625
|
CommandMenuSelectedIndicator.displayName = "CommandMenuSelectedIndicator";
|
|
1788
|
-
const CommandMenuSeparator =
|
|
1626
|
+
const CommandMenuSeparator = react.memo((props) => {
|
|
1789
1627
|
const { className, ref, spacing = false, ...rest } = props;
|
|
1790
|
-
const { size } =
|
|
1628
|
+
const { size } = react.use(CommandMenuContext);
|
|
1791
1629
|
return /* @__PURE__ */ jsxRuntime.jsx(cmdk.CommandSeparator, { ref, className: classVarianceAuthority.cx(commandMenuSeparatorCva({ size, spacing }), className), ...rest });
|
|
1792
1630
|
});
|
|
1793
1631
|
CommandMenuSeparator.displayName = "CommandMenuSeparator";
|
|
1794
|
-
const CommandMenuTrigger =
|
|
1632
|
+
const CommandMenuTrigger = react.memo((props) => {
|
|
1795
1633
|
return /* @__PURE__ */ jsxRuntime.jsx(RadixDialog.DialogTrigger, { ...props });
|
|
1796
1634
|
});
|
|
1797
1635
|
CommandMenuTrigger.displayName = "CommandMenuTrigger";
|
|
@@ -1822,17 +1660,22 @@
|
|
|
1822
1660
|
Page: CommandMenuPage,
|
|
1823
1661
|
PageTriggerItem: CommandMenuPageTriggerItem
|
|
1824
1662
|
};
|
|
1663
|
+
const LuIcon = react.memo((props) => {
|
|
1664
|
+
const { ref, icon: Icon, className, size = "1em", ...rest } = props;
|
|
1665
|
+
return /* @__PURE__ */ jsxRuntime.jsx(Icon, { ref, className: classVarianceAuthority.cx("shrink-0", className), size, ...rest });
|
|
1666
|
+
});
|
|
1667
|
+
LuIcon.displayName = "LuIcon";
|
|
1825
1668
|
const Chevron = (props) => {
|
|
1826
1669
|
const { orientation, ...rest } = props;
|
|
1827
1670
|
switch (orientation) {
|
|
1828
1671
|
case "up":
|
|
1829
|
-
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
1672
|
+
return /* @__PURE__ */ jsxRuntime.jsx(LuIcon, { icon: lucideReact.ChevronUp, ...rest });
|
|
1830
1673
|
case "down":
|
|
1831
|
-
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
1674
|
+
return /* @__PURE__ */ jsxRuntime.jsx(LuIcon, { icon: lucideReact.ChevronDown, ...rest });
|
|
1832
1675
|
case "left":
|
|
1833
|
-
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
1676
|
+
return /* @__PURE__ */ jsxRuntime.jsx(LuIcon, { icon: lucideReact.ChevronLeft, ...rest });
|
|
1834
1677
|
default:
|
|
1835
|
-
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
1678
|
+
return /* @__PURE__ */ jsxRuntime.jsx(LuIcon, { icon: lucideReact.ChevronRight, ...rest });
|
|
1836
1679
|
}
|
|
1837
1680
|
};
|
|
1838
1681
|
const rootCva = classVarianceAuthority.cva(["relative", "size-max"], {
|
|
@@ -1973,7 +1816,7 @@
|
|
|
1973
1816
|
}
|
|
1974
1817
|
}
|
|
1975
1818
|
});
|
|
1976
|
-
const DayPicker =
|
|
1819
|
+
const DayPicker = react.memo((props) => {
|
|
1977
1820
|
const providerContext = useProvider();
|
|
1978
1821
|
const {
|
|
1979
1822
|
components,
|
|
@@ -1985,7 +1828,7 @@
|
|
|
1985
1828
|
showOutsideDays = true,
|
|
1986
1829
|
...rest
|
|
1987
1830
|
} = props;
|
|
1988
|
-
const computedClassNames =
|
|
1831
|
+
const computedClassNames = react.useMemo(() => {
|
|
1989
1832
|
return {
|
|
1990
1833
|
...classNames,
|
|
1991
1834
|
root: classVarianceAuthority.cx(classNames == null ? void 0 : classNames.root, rootCva({ size })),
|
|
@@ -2015,7 +1858,7 @@
|
|
|
2015
1858
|
range_end: classVarianceAuthority.cx(classNames == null ? void 0 : classNames.range_end, "rdp-range-end")
|
|
2016
1859
|
};
|
|
2017
1860
|
}, [classNames, radius, size, variant]);
|
|
2018
|
-
const computedComponents =
|
|
1861
|
+
const computedComponents = react.useMemo(() => {
|
|
2019
1862
|
return {
|
|
2020
1863
|
...components,
|
|
2021
1864
|
Chevron
|
|
@@ -2033,19 +1876,19 @@
|
|
|
2033
1876
|
);
|
|
2034
1877
|
});
|
|
2035
1878
|
DayPicker.displayName = "DayPicker";
|
|
2036
|
-
const CloseDialogContext =
|
|
1879
|
+
const CloseDialogContext = react.createContext({});
|
|
2037
1880
|
const useCloseDialog = () => {
|
|
2038
|
-
const dialogContext =
|
|
1881
|
+
const dialogContext = react.useContext(CloseDialogContext);
|
|
2039
1882
|
if (!dialogContext) {
|
|
2040
1883
|
throw new Error("useDialog must be used within a DialogRoot");
|
|
2041
1884
|
}
|
|
2042
1885
|
return dialogContext;
|
|
2043
1886
|
};
|
|
2044
|
-
const DialogContent =
|
|
1887
|
+
const DialogContent = react.memo((props) => {
|
|
2045
1888
|
const { radius } = useProvider();
|
|
2046
1889
|
const close = useCloseDialog();
|
|
2047
1890
|
const { ref, children, container, className, size, ...rest } = props;
|
|
2048
|
-
const computedChildren =
|
|
1891
|
+
const computedChildren = react.useMemo(() => {
|
|
2049
1892
|
return typeof children === "function" ? children(close) : children;
|
|
2050
1893
|
}, [children, close]);
|
|
2051
1894
|
return /* @__PURE__ */ jsxRuntime.jsx(RadixDialog__namespace.Portal, { container, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
@@ -2060,7 +1903,7 @@
|
|
|
2060
1903
|
) });
|
|
2061
1904
|
});
|
|
2062
1905
|
DialogContent.displayName = "DialogContent";
|
|
2063
|
-
const DialogOverlay =
|
|
1906
|
+
const DialogOverlay = react.memo((props) => {
|
|
2064
1907
|
const { ref, children, className, container, ...rest } = props;
|
|
2065
1908
|
return /* @__PURE__ */ jsxRuntime.jsx(RadixDialog__namespace.Portal, { container, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
2066
1909
|
RadixDialog__namespace.Overlay,
|
|
@@ -2074,7 +1917,7 @@
|
|
|
2074
1917
|
) });
|
|
2075
1918
|
});
|
|
2076
1919
|
DialogOverlay.displayName = "DialogOverlay";
|
|
2077
|
-
const DialogRoot =
|
|
1920
|
+
const DialogRoot = react.memo((props) => {
|
|
2078
1921
|
const {
|
|
2079
1922
|
children,
|
|
2080
1923
|
onOpen,
|
|
@@ -2082,11 +1925,12 @@
|
|
|
2082
1925
|
defaultOpen,
|
|
2083
1926
|
onCloseInterrupt,
|
|
2084
1927
|
open: externalOpen,
|
|
1928
|
+
// oxlint-disable-next-line typescript/unbound-method
|
|
2085
1929
|
onOpenChange: externalOpenChange
|
|
2086
1930
|
} = props;
|
|
2087
|
-
const [innerOpen, setInnerOpen] =
|
|
1931
|
+
const [innerOpen, setInnerOpen] = react.useState(defaultOpen ?? false);
|
|
2088
1932
|
const open = externalOpen ?? innerOpen;
|
|
2089
|
-
const handleOpenChange =
|
|
1933
|
+
const handleOpenChange = react.useCallback(
|
|
2090
1934
|
(next) => {
|
|
2091
1935
|
if (externalOpenChange) return externalOpenChange(next);
|
|
2092
1936
|
if (next && onOpen) {
|
|
@@ -2104,7 +1948,7 @@
|
|
|
2104
1948
|
},
|
|
2105
1949
|
[externalOpenChange, onOpen, onClose, onCloseInterrupt]
|
|
2106
1950
|
);
|
|
2107
|
-
const closeDialog =
|
|
1951
|
+
const closeDialog = react.useCallback(
|
|
2108
1952
|
(options) => {
|
|
2109
1953
|
if (options == null ? void 0 : options.force) {
|
|
2110
1954
|
return setInnerOpen(false);
|
|
@@ -2163,7 +2007,7 @@
|
|
|
2163
2007
|
}
|
|
2164
2008
|
}
|
|
2165
2009
|
});
|
|
2166
|
-
const Heading =
|
|
2010
|
+
const Heading = react.memo((props) => {
|
|
2167
2011
|
const {
|
|
2168
2012
|
ref,
|
|
2169
2013
|
children,
|
|
@@ -2196,7 +2040,7 @@
|
|
|
2196
2040
|
);
|
|
2197
2041
|
});
|
|
2198
2042
|
Heading.displayName = "Heading";
|
|
2199
|
-
const HoverCardArrow =
|
|
2043
|
+
const HoverCardArrow = react.memo((props) => {
|
|
2200
2044
|
const { ref, children, className, ...rest } = props;
|
|
2201
2045
|
return /* @__PURE__ */ jsxRuntime.jsx(RadixHoverCard__namespace.Arrow, { className: classVarianceAuthority.cx("fill-(--base-6)", className), ref, ...rest, children });
|
|
2202
2046
|
});
|
|
@@ -2215,7 +2059,7 @@
|
|
|
2215
2059
|
size: "md"
|
|
2216
2060
|
}
|
|
2217
2061
|
});
|
|
2218
|
-
const HoverCardContent =
|
|
2062
|
+
const HoverCardContent = react.memo((props) => {
|
|
2219
2063
|
const providerContext = useProvider();
|
|
2220
2064
|
const {
|
|
2221
2065
|
ref,
|
|
@@ -2255,12 +2099,12 @@
|
|
|
2255
2099
|
Root: RadixHoverCard__namespace.Root,
|
|
2256
2100
|
Trigger: RadixHoverCard__namespace.Trigger
|
|
2257
2101
|
};
|
|
2258
|
-
const HoverUtility =
|
|
2259
|
-
const [isHovered, setIsHovered] =
|
|
2260
|
-
const handlePointerEnter =
|
|
2102
|
+
const HoverUtility = react.memo(({ children, forceHover }) => {
|
|
2103
|
+
const [isHovered, setIsHovered] = react.useState(false);
|
|
2104
|
+
const handlePointerEnter = react.useCallback(() => {
|
|
2261
2105
|
setIsHovered(true);
|
|
2262
2106
|
}, []);
|
|
2263
|
-
const handlePointerLeave =
|
|
2107
|
+
const handlePointerLeave = react.useCallback(() => {
|
|
2264
2108
|
setIsHovered(false);
|
|
2265
2109
|
}, []);
|
|
2266
2110
|
return children({
|
|
@@ -2269,7 +2113,8 @@
|
|
|
2269
2113
|
onPointerLeave: handlePointerLeave
|
|
2270
2114
|
});
|
|
2271
2115
|
});
|
|
2272
|
-
|
|
2116
|
+
HoverUtility.displayName = "HoverUtility";
|
|
2117
|
+
const InputContext = react.createContext({});
|
|
2273
2118
|
const inputRoot$1 = classVarianceAuthority.cva(
|
|
2274
2119
|
[
|
|
2275
2120
|
"flex",
|
|
@@ -2344,21 +2189,20 @@
|
|
|
2344
2189
|
size: "md"
|
|
2345
2190
|
}
|
|
2346
2191
|
});
|
|
2347
|
-
const InputField =
|
|
2348
|
-
const { ref,
|
|
2349
|
-
const { size, variant } =
|
|
2192
|
+
const InputField = react.memo((props) => {
|
|
2193
|
+
const { ref, className, ...rest } = props;
|
|
2194
|
+
const { size, variant } = react.useContext(InputContext);
|
|
2350
2195
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
2351
2196
|
"input",
|
|
2352
2197
|
{
|
|
2353
2198
|
className: classVarianceAuthority.cx(inputField({ size, variant }), "grow bg-transparent outline-0", className),
|
|
2354
2199
|
ref,
|
|
2355
|
-
...rest
|
|
2356
|
-
children
|
|
2200
|
+
...rest
|
|
2357
2201
|
}
|
|
2358
2202
|
);
|
|
2359
2203
|
});
|
|
2360
2204
|
InputField.displayName = "InputField";
|
|
2361
|
-
const InputRoot =
|
|
2205
|
+
const InputRoot = react.memo((props) => {
|
|
2362
2206
|
const providerContext = useProvider();
|
|
2363
2207
|
const {
|
|
2364
2208
|
ref,
|
|
@@ -2382,9 +2226,9 @@
|
|
|
2382
2226
|
) });
|
|
2383
2227
|
});
|
|
2384
2228
|
InputRoot.displayName = "InputRoot";
|
|
2385
|
-
const InputSlot =
|
|
2229
|
+
const InputSlot = react.memo((props) => {
|
|
2386
2230
|
const { ref, children, className, ...rest } = props;
|
|
2387
|
-
const { size, variant } =
|
|
2231
|
+
const { size, variant } = react.useContext(InputContext);
|
|
2388
2232
|
return /* @__PURE__ */ jsxRuntime.jsx("div", { className: classVarianceAuthority.cx(inputSlot({ size, variant }), "flex items-center", className), ref, ...rest, children });
|
|
2389
2233
|
});
|
|
2390
2234
|
InputSlot.displayName = "InputSlot";
|
|
@@ -2393,27 +2237,27 @@
|
|
|
2393
2237
|
Root: InputRoot,
|
|
2394
2238
|
Slot: InputSlot
|
|
2395
2239
|
};
|
|
2396
|
-
const LayoutContext =
|
|
2397
|
-
const useLayoutContext = () =>
|
|
2398
|
-
const LayoutContainer =
|
|
2399
|
-
const { ref, children,
|
|
2240
|
+
const LayoutContext = react.createContext({});
|
|
2241
|
+
const useLayoutContext = () => react.useContext(LayoutContext);
|
|
2242
|
+
const LayoutContainer = react.memo((props) => {
|
|
2243
|
+
const { ref, children, ...rest } = props;
|
|
2400
2244
|
const { hideLayout = false } = useLayoutContext();
|
|
2401
|
-
return !hideLayout && /* @__PURE__ */ jsxRuntime.jsx("div", {
|
|
2245
|
+
return !hideLayout && /* @__PURE__ */ jsxRuntime.jsx("div", { ref, ...rest, children });
|
|
2402
2246
|
});
|
|
2403
2247
|
LayoutContainer.displayName = "LayoutContainer";
|
|
2404
|
-
const LayoutRoot =
|
|
2248
|
+
const LayoutRoot = react.memo((props) => {
|
|
2405
2249
|
const { children, small = false, hideLayout = false } = props;
|
|
2406
|
-
const [openMapping, setOpenMapping] =
|
|
2407
|
-
const isOpen =
|
|
2250
|
+
const [openMapping, setOpenMapping] = react.useState({});
|
|
2251
|
+
const isOpen = react.useCallback(
|
|
2408
2252
|
(id) => {
|
|
2409
2253
|
return openMapping[id] ?? false;
|
|
2410
2254
|
},
|
|
2411
2255
|
[openMapping]
|
|
2412
2256
|
);
|
|
2413
|
-
const setOpen =
|
|
2257
|
+
const setOpen = react.useCallback((id, open) => {
|
|
2414
2258
|
setOpenMapping((prev) => ({ ...prev, [id]: open }));
|
|
2415
2259
|
}, []);
|
|
2416
|
-
const contextValue =
|
|
2260
|
+
const contextValue = react.useMemo(
|
|
2417
2261
|
() => ({
|
|
2418
2262
|
small,
|
|
2419
2263
|
hideLayout,
|
|
@@ -2425,12 +2269,29 @@
|
|
|
2425
2269
|
return /* @__PURE__ */ jsxRuntime.jsx(LayoutContext.Provider, { value: contextValue, children });
|
|
2426
2270
|
});
|
|
2427
2271
|
LayoutRoot.displayName = "LayoutRoot";
|
|
2272
|
+
const SlideOutRootContext = react.createContext({});
|
|
2273
|
+
const SlideOutContextContext = react.createContext({});
|
|
2274
|
+
const SlideOutClose = react.memo((props) => {
|
|
2275
|
+
const { ref, onClick, disabled, ...rest } = props;
|
|
2276
|
+
const { setOpen } = react.use(SlideOutRootContext);
|
|
2277
|
+
const handleClick = react.useCallback(
|
|
2278
|
+
(e) => {
|
|
2279
|
+
onClick == null ? void 0 : onClick(e);
|
|
2280
|
+
if (e.defaultPrevented) return;
|
|
2281
|
+
setOpen(false);
|
|
2282
|
+
},
|
|
2283
|
+
[onClick, setOpen]
|
|
2284
|
+
);
|
|
2285
|
+
return /* @__PURE__ */ jsxRuntime.jsx(reactSlot.Slot, { ref, onClick: handleClick, "data-disabled": disabled ?? false, ...rest });
|
|
2286
|
+
});
|
|
2287
|
+
SlideOutClose.displayName = "SlideOutClose";
|
|
2288
|
+
const TIMEOUT_DURATION = 200;
|
|
2428
2289
|
function usePointerDownOutside(onPointerDownOutside, ownerElement = globalThis == null ? void 0 : globalThis.document.body) {
|
|
2429
2290
|
const handlePointerDownOutside = useCallbackRef(onPointerDownOutside);
|
|
2430
|
-
const isPointerInsideReactTreeRef =
|
|
2431
|
-
const handleClickRef =
|
|
2291
|
+
const isPointerInsideReactTreeRef = react.useRef(false);
|
|
2292
|
+
const handleClickRef = react.useRef(() => {
|
|
2432
2293
|
});
|
|
2433
|
-
|
|
2294
|
+
react.useEffect(() => {
|
|
2434
2295
|
const handlePointerDown = (event) => {
|
|
2435
2296
|
if (event.target && !isPointerInsideReactTreeRef.current) {
|
|
2436
2297
|
const eventDetail = { originalEvent: event };
|
|
@@ -2477,336 +2338,401 @@
|
|
|
2477
2338
|
}
|
|
2478
2339
|
}
|
|
2479
2340
|
function useCallbackRef(callback) {
|
|
2480
|
-
const callbackRef =
|
|
2481
|
-
|
|
2341
|
+
const callbackRef = react.useRef(callback);
|
|
2342
|
+
react.useEffect(() => {
|
|
2482
2343
|
callbackRef.current = callback;
|
|
2483
2344
|
});
|
|
2484
|
-
return
|
|
2345
|
+
return react.useMemo(() => (...args) => {
|
|
2485
2346
|
var _a;
|
|
2486
2347
|
return (_a = callbackRef.current) == null ? void 0 : _a.call(callbackRef, ...args);
|
|
2487
2348
|
}, []);
|
|
2488
2349
|
}
|
|
2489
|
-
const
|
|
2490
|
-
|
|
2491
|
-
const
|
|
2492
|
-
|
|
2493
|
-
|
|
2494
|
-
|
|
2495
|
-
|
|
2496
|
-
|
|
2497
|
-
|
|
2498
|
-
|
|
2499
|
-
|
|
2500
|
-
|
|
2501
|
-
|
|
2502
|
-
|
|
2503
|
-
|
|
2504
|
-
|
|
2505
|
-
|
|
2506
|
-
|
|
2507
|
-
|
|
2508
|
-
|
|
2509
|
-
|
|
2510
|
-
|
|
2511
|
-
|
|
2512
|
-
|
|
2513
|
-
|
|
2514
|
-
const
|
|
2515
|
-
|
|
2516
|
-
|
|
2517
|
-
|
|
2518
|
-
|
|
2519
|
-
|
|
2520
|
-
|
|
2521
|
-
|
|
2522
|
-
|
|
2523
|
-
|
|
2524
|
-
|
|
2525
|
-
|
|
2526
|
-
|
|
2527
|
-
|
|
2528
|
-
|
|
2350
|
+
const SlideOutContent = react.memo((props) => {
|
|
2351
|
+
const { ref, children, style, side, type, resizeable = false, initialSize, minSize, maxSize, ...rest } = props;
|
|
2352
|
+
const internalRef = react.useRef(null);
|
|
2353
|
+
const { open, setOpen, parentElement, modal, hide } = react.use(SlideOutRootContext);
|
|
2354
|
+
const [computedSize, setComputedSize] = react.useState(null);
|
|
2355
|
+
const handleClose = react.useCallback(() => {
|
|
2356
|
+
if (modal) setOpen(false);
|
|
2357
|
+
}, [modal, setOpen]);
|
|
2358
|
+
const { onPointerDownCapture: handlePointerDownCapture } = usePointerDownOutside(
|
|
2359
|
+
handleClose,
|
|
2360
|
+
parentElement ?? void 0
|
|
2361
|
+
);
|
|
2362
|
+
react.useLayoutEffect(() => {
|
|
2363
|
+
if (!open || !internalRef.current) return;
|
|
2364
|
+
const { offsetWidth, offsetHeight } = internalRef.current;
|
|
2365
|
+
switch (side) {
|
|
2366
|
+
case "left":
|
|
2367
|
+
case "right":
|
|
2368
|
+
setComputedSize(offsetWidth);
|
|
2369
|
+
break;
|
|
2370
|
+
case "top":
|
|
2371
|
+
case "bottom":
|
|
2372
|
+
setComputedSize(offsetHeight);
|
|
2373
|
+
}
|
|
2374
|
+
}, [open, side]);
|
|
2375
|
+
const computedStyle = react.useMemo(() => {
|
|
2376
|
+
switch (side) {
|
|
2377
|
+
case "left":
|
|
2378
|
+
return {
|
|
2379
|
+
...style,
|
|
2380
|
+
left: 0,
|
|
2381
|
+
width: computedSize ?? initialSize,
|
|
2382
|
+
maxWidth: maxSize,
|
|
2383
|
+
minWidth: minSize,
|
|
2384
|
+
position: type === "inline" ? "relative" : "absolute",
|
|
2385
|
+
"--slide-out-size": `${computedSize}px`
|
|
2386
|
+
};
|
|
2387
|
+
case "right":
|
|
2388
|
+
return {
|
|
2389
|
+
...style,
|
|
2390
|
+
right: 0,
|
|
2391
|
+
width: computedSize ?? initialSize,
|
|
2392
|
+
maxWidth: maxSize,
|
|
2393
|
+
minWidth: minSize,
|
|
2394
|
+
position: type === "inline" ? "relative" : "absolute",
|
|
2395
|
+
"--slide-out-size": `${computedSize}px`
|
|
2396
|
+
};
|
|
2397
|
+
case "top":
|
|
2398
|
+
return {
|
|
2399
|
+
...style,
|
|
2400
|
+
top: 0,
|
|
2401
|
+
height: computedSize ?? initialSize,
|
|
2402
|
+
maxHeight: maxSize,
|
|
2403
|
+
minHeight: minSize,
|
|
2404
|
+
position: type === "inline" ? "relative" : "absolute",
|
|
2405
|
+
"--slide-out-size": `${computedSize}px`
|
|
2406
|
+
};
|
|
2407
|
+
case "bottom":
|
|
2408
|
+
return {
|
|
2409
|
+
...style,
|
|
2410
|
+
bottom: 0,
|
|
2411
|
+
height: computedSize ?? initialSize,
|
|
2412
|
+
maxHeight: maxSize,
|
|
2413
|
+
minHeight: minSize,
|
|
2414
|
+
position: type === "inline" ? "relative" : "absolute",
|
|
2415
|
+
"--slide-out-size": `${computedSize}px`
|
|
2416
|
+
};
|
|
2529
2417
|
}
|
|
2530
|
-
}, []);
|
|
2531
|
-
|
|
2532
|
-
|
|
2533
|
-
|
|
2534
|
-
|
|
2535
|
-
|
|
2418
|
+
}, [computedSize, initialSize, maxSize, minSize, side, style, type]);
|
|
2419
|
+
const transitionClassNames = react.useMemo(() => {
|
|
2420
|
+
switch (side) {
|
|
2421
|
+
case "left":
|
|
2422
|
+
return {
|
|
2423
|
+
enter: "-ml-(--slide-out-size)",
|
|
2424
|
+
enterActive: "ease-linear duration-200 transition-[margin-left] ml-0",
|
|
2425
|
+
enterDone: "ml-0",
|
|
2426
|
+
exitActive: "ease-linear duration-200 transition-[margin-left] -ml-(--slide-out-size)",
|
|
2427
|
+
exitDone: "-ml-(--slide-out-size)"
|
|
2428
|
+
};
|
|
2429
|
+
case "right":
|
|
2430
|
+
return {
|
|
2431
|
+
enter: "-mr-(--slide-out-size)",
|
|
2432
|
+
enterActive: "ease-linear duration-200 transition-[margin-right] mr-0",
|
|
2433
|
+
enterDone: "mr-0",
|
|
2434
|
+
exitActive: "ease-linear duration-200 transition-[margin-right] -mr-(--slide-out-size)",
|
|
2435
|
+
exitDone: "-mr-(--slide-out-size)"
|
|
2436
|
+
};
|
|
2437
|
+
case "top":
|
|
2438
|
+
return {
|
|
2439
|
+
enter: "-mt-(--slide-out-size)",
|
|
2440
|
+
enterActive: "ease-linear duration-200 transition-[margin-top] mt-0",
|
|
2441
|
+
enterDone: "mt-0",
|
|
2442
|
+
exitActive: "ease-linear duration-200 transition-[margin-top] -mt-(--slide-out-size)",
|
|
2443
|
+
exitDone: "-mt-(--slide-out-size)"
|
|
2444
|
+
};
|
|
2445
|
+
case "bottom":
|
|
2446
|
+
return {
|
|
2447
|
+
enter: "-mb-(--slide-out-size)",
|
|
2448
|
+
enterActive: "ease-linear duration-200 transition-[margin-bottom] mb-0",
|
|
2449
|
+
enterDone: "mb-0",
|
|
2450
|
+
exitActive: "ease-linear duration-200 transition-[margin-bottom] -mb-(--slide-out-size)",
|
|
2451
|
+
exitDone: "-mb-(--slide-out-size)"
|
|
2452
|
+
};
|
|
2536
2453
|
}
|
|
2537
|
-
|
|
2538
|
-
|
|
2539
|
-
childrenContainerRef.current.style.pointerEvents = originalParentPointerEvents;
|
|
2540
|
-
}
|
|
2541
|
-
};
|
|
2542
|
-
}, [modal, open, parentContainer.style]);
|
|
2543
|
-
const { onPointerDownCapture: handlePointerDownCapture } = usePointerDownOutside(handleDismiss, parentContainer);
|
|
2544
|
-
const CSSTransitionClassNames = React.useMemo(
|
|
2454
|
+
}, [side]);
|
|
2455
|
+
const contextValue = react.useMemo(
|
|
2545
2456
|
() => ({
|
|
2546
|
-
|
|
2547
|
-
|
|
2548
|
-
|
|
2549
|
-
|
|
2550
|
-
|
|
2457
|
+
side,
|
|
2458
|
+
type,
|
|
2459
|
+
resizeable,
|
|
2460
|
+
computedSize,
|
|
2461
|
+
setComputedSize
|
|
2551
2462
|
}),
|
|
2552
|
-
[
|
|
2463
|
+
[computedSize, resizeable, side, type]
|
|
2553
2464
|
);
|
|
2554
|
-
|
|
2555
|
-
|
|
2556
|
-
|
|
2557
|
-
|
|
2558
|
-
|
|
2559
|
-
|
|
2465
|
+
return !hide ? (
|
|
2466
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
2467
|
+
// @ts-ignore
|
|
2468
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
2469
|
+
reactTransitionGroup.CSSTransition,
|
|
2470
|
+
{
|
|
2471
|
+
classNames: transitionClassNames,
|
|
2472
|
+
in: open,
|
|
2473
|
+
timeout: TIMEOUT_DURATION,
|
|
2474
|
+
unmountOnExit: true,
|
|
2475
|
+
mountOnEnter: true,
|
|
2476
|
+
nodeRef: internalRef,
|
|
2477
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
2478
|
+
"div",
|
|
2479
|
+
{
|
|
2480
|
+
ref: mergeRefs([ref, internalRef]),
|
|
2481
|
+
onPointerDownCapture: handlePointerDownCapture,
|
|
2482
|
+
"data-open": open,
|
|
2483
|
+
"data-side": side,
|
|
2484
|
+
"data-type": type,
|
|
2485
|
+
style: computedStyle,
|
|
2486
|
+
...rest,
|
|
2487
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(SlideOutContextContext, { value: contextValue, children })
|
|
2488
|
+
}
|
|
2489
|
+
)
|
|
2490
|
+
}
|
|
2491
|
+
)
|
|
2492
|
+
) : null;
|
|
2493
|
+
});
|
|
2494
|
+
SlideOutContent.displayName = "SlideOutContent";
|
|
2495
|
+
const SlideOutHandle = react.memo((props) => {
|
|
2496
|
+
const { ref, onMouseDown, disabled, ...rest } = props;
|
|
2497
|
+
const prevClientCoord = react.useRef(null);
|
|
2498
|
+
const [isResizing, setIsResizing] = react.useState(false);
|
|
2499
|
+
const { side, resizeable, computedSize, setComputedSize } = react.use(SlideOutContextContext);
|
|
2500
|
+
const computedDisabled = disabled ?? !resizeable;
|
|
2501
|
+
const setPrevClientCoord = react.useCallback(
|
|
2502
|
+
(clientX, clientY) => {
|
|
2503
|
+
switch (side) {
|
|
2504
|
+
case "left":
|
|
2505
|
+
prevClientCoord.current = clientX;
|
|
2506
|
+
break;
|
|
2507
|
+
case "right":
|
|
2508
|
+
prevClientCoord.current = clientX;
|
|
2509
|
+
break;
|
|
2510
|
+
case "top":
|
|
2511
|
+
prevClientCoord.current = clientY;
|
|
2512
|
+
break;
|
|
2513
|
+
case "bottom":
|
|
2514
|
+
prevClientCoord.current = clientY;
|
|
2515
|
+
break;
|
|
2516
|
+
}
|
|
2517
|
+
},
|
|
2518
|
+
[side]
|
|
2519
|
+
);
|
|
2520
|
+
const handlePointerDown = react.useCallback(
|
|
2521
|
+
(e) => {
|
|
2522
|
+
onMouseDown == null ? void 0 : onMouseDown(e);
|
|
2523
|
+
if (e.defaultPrevented || computedDisabled) return;
|
|
2524
|
+
e.preventDefault();
|
|
2525
|
+
setPrevClientCoord(e.clientX, e.clientY);
|
|
2526
|
+
setIsResizing(true);
|
|
2527
|
+
},
|
|
2528
|
+
[computedDisabled, onMouseDown, setPrevClientCoord]
|
|
2529
|
+
);
|
|
2530
|
+
const handlePointerMove = react.useCallback(
|
|
2560
2531
|
(e) => {
|
|
2561
|
-
if (!isResizing) return;
|
|
2562
|
-
|
|
2563
|
-
const
|
|
2564
|
-
|
|
2565
|
-
|
|
2532
|
+
if (!isResizing || !prevClientCoord.current || computedDisabled) return;
|
|
2533
|
+
e.preventDefault();
|
|
2534
|
+
const { clientX, clientY } = e;
|
|
2535
|
+
let delta = 0;
|
|
2536
|
+
switch (side) {
|
|
2537
|
+
case "left":
|
|
2538
|
+
delta = clientX - prevClientCoord.current;
|
|
2539
|
+
break;
|
|
2540
|
+
case "right":
|
|
2541
|
+
delta = (clientX - prevClientCoord.current) * -1;
|
|
2542
|
+
break;
|
|
2543
|
+
case "top":
|
|
2544
|
+
delta = clientY - prevClientCoord.current;
|
|
2545
|
+
break;
|
|
2546
|
+
case "bottom":
|
|
2547
|
+
delta = (clientY - prevClientCoord.current) * -1;
|
|
2548
|
+
break;
|
|
2549
|
+
}
|
|
2550
|
+
setPrevClientCoord(clientX, clientY);
|
|
2551
|
+
setComputedSize(computedSize + delta);
|
|
2566
2552
|
},
|
|
2567
|
-
[
|
|
2553
|
+
[computedDisabled, computedSize, isResizing, setComputedSize, setPrevClientCoord, side]
|
|
2568
2554
|
);
|
|
2569
|
-
const
|
|
2570
|
-
if (!isResizing) return;
|
|
2571
|
-
|
|
2555
|
+
const handlePointerUp = react.useCallback(() => {
|
|
2556
|
+
if (!isResizing || computedDisabled) return;
|
|
2557
|
+
prevClientCoord.current = null;
|
|
2572
2558
|
setIsResizing(false);
|
|
2573
|
-
}, [isResizing]);
|
|
2574
|
-
|
|
2575
|
-
|
|
2576
|
-
|
|
2559
|
+
}, [computedDisabled, isResizing]);
|
|
2560
|
+
react.useEffect(() => {
|
|
2561
|
+
document.addEventListener("pointermove", handlePointerMove);
|
|
2562
|
+
document.addEventListener("pointerup", handlePointerUp);
|
|
2577
2563
|
return () => {
|
|
2578
|
-
|
|
2579
|
-
|
|
2564
|
+
document.removeEventListener("pointermove", handlePointerMove);
|
|
2565
|
+
document.removeEventListener("pointerup", handlePointerUp);
|
|
2580
2566
|
};
|
|
2581
|
-
}, [
|
|
2582
|
-
|
|
2583
|
-
if (!open) return;
|
|
2584
|
-
setComputedWidth(localRef.current.offsetWidth);
|
|
2585
|
-
}, [open]);
|
|
2586
|
-
const resizableStyle = React.useMemo(
|
|
2587
|
-
() => ({
|
|
2588
|
-
...style,
|
|
2589
|
-
width: computedWidth ?? initialWidth,
|
|
2590
|
-
maxWidth,
|
|
2591
|
-
minWidth,
|
|
2592
|
-
position,
|
|
2593
|
-
"--slide-out-width": `${computedWidth}${typeof computedWidth === "number" ? "px" : ""}`
|
|
2594
|
-
}),
|
|
2595
|
-
[computedWidth, initialWidth, maxWidth, minWidth, position, style]
|
|
2596
|
-
);
|
|
2597
|
-
const resizableEnable = React.useMemo(
|
|
2598
|
-
() => ({ left: resizeable && !isLeft, right: resizeable && isLeft }),
|
|
2599
|
-
[isLeft, resizeable]
|
|
2600
|
-
);
|
|
2601
|
-
const SlideOut2 = React.useMemo(
|
|
2602
|
-
() => (
|
|
2603
|
-
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
2604
|
-
// @ts-ignore
|
|
2605
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
2606
|
-
reactTransitionGroup.CSSTransition,
|
|
2607
|
-
{
|
|
2608
|
-
classNames: CSSTransitionClassNames,
|
|
2609
|
-
in: open,
|
|
2610
|
-
timeout: TIMEOUT_DURATION,
|
|
2611
|
-
unmountOnExit: true,
|
|
2612
|
-
mountOnEnter: true,
|
|
2613
|
-
onEntering: onOpening,
|
|
2614
|
-
onExited: onClosed,
|
|
2615
|
-
nodeRef,
|
|
2616
|
-
children: /* @__PURE__ */ jsxRuntime.jsxs(
|
|
2617
|
-
"div",
|
|
2618
|
-
{
|
|
2619
|
-
className: classVarianceAuthority.cx(
|
|
2620
|
-
"top-0",
|
|
2621
|
-
"bottom-0",
|
|
2622
|
-
{
|
|
2623
|
-
"left-0": isLeft,
|
|
2624
|
-
"right-0": !isLeft,
|
|
2625
|
-
absolute: position === "absolute",
|
|
2626
|
-
relative: position === "relative"
|
|
2627
|
-
},
|
|
2628
|
-
className
|
|
2629
|
-
),
|
|
2630
|
-
ref: mergedRefs,
|
|
2631
|
-
onPointerDownCapture: handlePointerDownCapture,
|
|
2632
|
-
"data-side": side,
|
|
2633
|
-
style: resizableStyle,
|
|
2634
|
-
children: [
|
|
2635
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
2636
|
-
"div",
|
|
2637
|
-
{
|
|
2638
|
-
className: classVarianceAuthority.cx("absolute top-0 bottom-0 w-[3px]", {
|
|
2639
|
-
"right-0": isLeft,
|
|
2640
|
-
"left-0": !isLeft,
|
|
2641
|
-
"pointer-events-none": !resizableEnable
|
|
2642
|
-
}),
|
|
2643
|
-
onMouseDown: handleMouseDown,
|
|
2644
|
-
"data-resizing": isResizing ? "" : void 0
|
|
2645
|
-
}
|
|
2646
|
-
),
|
|
2647
|
-
content
|
|
2648
|
-
]
|
|
2649
|
-
}
|
|
2650
|
-
)
|
|
2651
|
-
}
|
|
2652
|
-
)
|
|
2653
|
-
),
|
|
2654
|
-
[
|
|
2655
|
-
CSSTransitionClassNames,
|
|
2656
|
-
open,
|
|
2657
|
-
onOpening,
|
|
2658
|
-
onClosed,
|
|
2659
|
-
className,
|
|
2660
|
-
isLeft,
|
|
2661
|
-
position,
|
|
2662
|
-
mergedRefs,
|
|
2663
|
-
handlePointerDownCapture,
|
|
2664
|
-
side,
|
|
2665
|
-
resizableStyle,
|
|
2666
|
-
handleMouseDown,
|
|
2667
|
-
isResizing,
|
|
2668
|
-
resizableEnable,
|
|
2669
|
-
content
|
|
2670
|
-
]
|
|
2671
|
-
);
|
|
2672
|
-
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
2567
|
+
}, [handlePointerMove, handlePointerUp]);
|
|
2568
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
2673
2569
|
"div",
|
|
2674
2570
|
{
|
|
2675
|
-
|
|
2676
|
-
|
|
2677
|
-
|
|
2678
|
-
|
|
2679
|
-
|
|
2680
|
-
|
|
2681
|
-
" ",
|
|
2682
|
-
content && SlideOut2
|
|
2683
|
-
] }),
|
|
2684
|
-
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex h-full max-w-full grow overflow-hidden", ref: childrenContainerRef, children }),
|
|
2685
|
-
side === "right" && !hide && /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
2686
|
-
open && overlayComponent,
|
|
2687
|
-
" ",
|
|
2688
|
-
content && SlideOut2
|
|
2689
|
-
] })
|
|
2690
|
-
]
|
|
2571
|
+
ref,
|
|
2572
|
+
onPointerDown: handlePointerDown,
|
|
2573
|
+
"data-resizing": isResizing,
|
|
2574
|
+
"data-side": side,
|
|
2575
|
+
"data-disabled": computedDisabled,
|
|
2576
|
+
...rest
|
|
2691
2577
|
}
|
|
2692
2578
|
);
|
|
2693
2579
|
});
|
|
2694
|
-
|
|
2695
|
-
const
|
|
2696
|
-
|
|
2697
|
-
const {
|
|
2580
|
+
SlideOutHandle.displayName = "SlideOutHandle";
|
|
2581
|
+
const SlideOutOverlay = react.memo((props) => {
|
|
2582
|
+
const { ref, ...rest } = props;
|
|
2583
|
+
const { open, hide } = react.use(SlideOutRootContext);
|
|
2584
|
+
return open && !hide ? /* @__PURE__ */ jsxRuntime.jsx("div", { ref, "data-open": open, ...rest }) : null;
|
|
2585
|
+
});
|
|
2586
|
+
SlideOutOverlay.displayName = "SlideOutOverlay";
|
|
2587
|
+
const SlideOutRoot = react.memo((props) => {
|
|
2698
2588
|
const {
|
|
2699
2589
|
ref,
|
|
2700
|
-
id,
|
|
2701
2590
|
children,
|
|
2702
|
-
|
|
2703
|
-
|
|
2704
|
-
|
|
2705
|
-
|
|
2706
|
-
|
|
2591
|
+
defaultOpen = false,
|
|
2592
|
+
open: controlledOpen,
|
|
2593
|
+
onOpenChange,
|
|
2594
|
+
modal = false,
|
|
2595
|
+
hide = false,
|
|
2707
2596
|
...rest
|
|
2708
2597
|
} = props;
|
|
2709
|
-
const
|
|
2710
|
-
|
|
2598
|
+
const [parentElement, setParentElement] = react.useState(null);
|
|
2599
|
+
const [open, setOpen] = useControlledState(defaultOpen, controlledOpen, onOpenChange);
|
|
2600
|
+
const contextValue = react.useMemo(
|
|
2601
|
+
() => ({
|
|
2602
|
+
parentElement,
|
|
2603
|
+
open,
|
|
2604
|
+
setOpen,
|
|
2605
|
+
modal,
|
|
2606
|
+
hide
|
|
2607
|
+
}),
|
|
2608
|
+
[hide, modal, open, parentElement, setOpen]
|
|
2609
|
+
);
|
|
2610
|
+
return /* @__PURE__ */ jsxRuntime.jsx("div", { ref: mergeRefs([ref, setParentElement]), ...rest, children: /* @__PURE__ */ jsxRuntime.jsx(SlideOutRootContext, { value: contextValue, children }) });
|
|
2611
|
+
});
|
|
2612
|
+
SlideOutRoot.displayName = "SlideOutRoot";
|
|
2613
|
+
const SlideOutTrigger = react.memo((props) => {
|
|
2614
|
+
const { ref, onClick, ...rest } = props;
|
|
2615
|
+
const { open, setOpen } = react.use(SlideOutRootContext);
|
|
2616
|
+
const handleClick = react.useCallback(
|
|
2617
|
+
(e) => {
|
|
2618
|
+
onClick == null ? void 0 : onClick(e);
|
|
2619
|
+
if (e.defaultPrevented) return;
|
|
2620
|
+
setOpen(!open);
|
|
2621
|
+
},
|
|
2622
|
+
[onClick, open, setOpen]
|
|
2623
|
+
);
|
|
2624
|
+
return /* @__PURE__ */ jsxRuntime.jsx(reactSlot.Slot, { ref, onClick: handleClick, "data-disabled": props.disabled ?? false, ...rest });
|
|
2625
|
+
});
|
|
2626
|
+
SlideOutTrigger.displayName = "SlideOutTrigger";
|
|
2627
|
+
const SlideOutViewport = react.memo((props) => {
|
|
2628
|
+
const { ref, ...rest } = props;
|
|
2629
|
+
const internalRef = react.useRef(null);
|
|
2630
|
+
const { open, modal, parentElement } = react.use(SlideOutRootContext);
|
|
2631
|
+
react.useEffect(() => {
|
|
2632
|
+
if (!internalRef.current) return;
|
|
2633
|
+
const internalElement = internalRef.current;
|
|
2634
|
+
const originalParentPointerEvents = internalElement.style.pointerEvents;
|
|
2635
|
+
if (open && modal) {
|
|
2636
|
+
internalElement.style.pointerEvents = "none";
|
|
2637
|
+
}
|
|
2638
|
+
return () => {
|
|
2639
|
+
internalElement.style.pointerEvents = originalParentPointerEvents;
|
|
2640
|
+
};
|
|
2641
|
+
}, [modal, open, parentElement == null ? void 0 : parentElement.style]);
|
|
2642
|
+
return /* @__PURE__ */ jsxRuntime.jsx("div", { ref: mergeRefs([ref, internalRef]), ...rest });
|
|
2643
|
+
});
|
|
2644
|
+
SlideOutViewport.displayName = "SlideOutViewport";
|
|
2645
|
+
const SlideOut = {
|
|
2646
|
+
Close: SlideOutClose,
|
|
2647
|
+
Content: SlideOutContent,
|
|
2648
|
+
Handle: SlideOutHandle,
|
|
2649
|
+
Overlay: SlideOutOverlay,
|
|
2650
|
+
Root: SlideOutRoot,
|
|
2651
|
+
Trigger: SlideOutTrigger,
|
|
2652
|
+
Viewport: SlideOutViewport
|
|
2653
|
+
};
|
|
2654
|
+
const LayoutSlideOutClose = react.memo((props) => {
|
|
2655
|
+
const { ref, ...rest } = props;
|
|
2656
|
+
return /* @__PURE__ */ jsxRuntime.jsx(SlideOutClose, { ref, ...rest });
|
|
2657
|
+
});
|
|
2658
|
+
LayoutSlideOutClose.displayName = "LayoutSlideOutClose";
|
|
2659
|
+
const LayoutSlideOutContent = react.memo((props) => {
|
|
2660
|
+
const { ref, type, ...rest } = props;
|
|
2661
|
+
const { small } = react.use(LayoutContext);
|
|
2662
|
+
return /* @__PURE__ */ jsxRuntime.jsx(SlideOutContent, { ref, type: type ?? (small ? "overlay" : "inline"), ...rest });
|
|
2663
|
+
});
|
|
2664
|
+
LayoutSlideOutContent.displayName = "LayoutSlideOutContent";
|
|
2665
|
+
const LayoutSlideOutHandle = react.memo((props) => {
|
|
2666
|
+
const { ref, ...rest } = props;
|
|
2667
|
+
return /* @__PURE__ */ jsxRuntime.jsx(SlideOutHandle, { ref, ...rest });
|
|
2668
|
+
});
|
|
2669
|
+
LayoutSlideOutHandle.displayName = "LayoutSlideOutHandle";
|
|
2670
|
+
const LayoutSlideOutOverlay = react.memo((props) => {
|
|
2671
|
+
const { ref, smallModeOnly = false, ...rest } = props;
|
|
2672
|
+
const { small, hideLayout } = useLayoutContext();
|
|
2673
|
+
const showOverlay = react.useMemo(() => {
|
|
2674
|
+
if (hideLayout) return false;
|
|
2675
|
+
if (smallModeOnly && !small) return false;
|
|
2676
|
+
return true;
|
|
2677
|
+
}, [hideLayout, small, smallModeOnly]);
|
|
2678
|
+
return showOverlay ? /* @__PURE__ */ jsxRuntime.jsx(SlideOutOverlay, { ref, ...rest }) : null;
|
|
2679
|
+
});
|
|
2680
|
+
LayoutSlideOutOverlay.displayName = "SlideOutOverlay";
|
|
2681
|
+
const LayoutSlideOutRoot = react.memo((props) => {
|
|
2682
|
+
const { ref, slideOutId, defaultOpen, hide, ...rest } = props;
|
|
2683
|
+
const { isOpen, setOpen, small, hideLayout } = react.use(LayoutContext);
|
|
2684
|
+
const open = isOpen(slideOutId);
|
|
2685
|
+
const handleOpenChange = react.useCallback(
|
|
2686
|
+
(open2) => {
|
|
2687
|
+
if (!open2) setOpen(slideOutId, false);
|
|
2688
|
+
},
|
|
2689
|
+
[setOpen, slideOutId]
|
|
2690
|
+
);
|
|
2691
|
+
react.useEffect(() => {
|
|
2711
2692
|
if (small && (defaultOpen == null ? void 0 : defaultOpen.small) !== void 0) {
|
|
2712
|
-
setOpen(
|
|
2693
|
+
setOpen(slideOutId, defaultOpen == null ? void 0 : defaultOpen.small);
|
|
2713
2694
|
} else if (!small && (defaultOpen == null ? void 0 : defaultOpen.large) !== void 0) {
|
|
2714
|
-
setOpen(
|
|
2715
|
-
}
|
|
2716
|
-
}, [defaultOpen,
|
|
2717
|
-
|
|
2718
|
-
|
|
2719
|
-
onDismiss == null ? void 0 : onDismiss();
|
|
2720
|
-
}, [id, onDismiss, setOpen]);
|
|
2721
|
-
return !hideLayout && /* @__PURE__ */ jsxRuntime.jsx(
|
|
2722
|
-
SlideOut,
|
|
2695
|
+
setOpen(slideOutId, defaultOpen == null ? void 0 : defaultOpen.large);
|
|
2696
|
+
}
|
|
2697
|
+
}, [defaultOpen, slideOutId, setOpen, small]);
|
|
2698
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
2699
|
+
SlideOutRoot,
|
|
2723
2700
|
{
|
|
2724
|
-
className: classVarianceAuthority.cx(`overmap-layout-slideOut-${side}`, className),
|
|
2725
|
-
side,
|
|
2726
2701
|
ref,
|
|
2727
2702
|
open,
|
|
2728
|
-
|
|
2703
|
+
onOpenChange: handleOpenChange,
|
|
2729
2704
|
modal: small,
|
|
2730
|
-
|
|
2731
|
-
|
|
2732
|
-
...rest,
|
|
2733
|
-
children
|
|
2705
|
+
hide: hide ?? hideLayout,
|
|
2706
|
+
...rest
|
|
2734
2707
|
}
|
|
2735
2708
|
);
|
|
2736
2709
|
});
|
|
2737
|
-
|
|
2738
|
-
const
|
|
2739
|
-
const { ref,
|
|
2740
|
-
const {
|
|
2741
|
-
const
|
|
2742
|
-
|
|
2743
|
-
|
|
2744
|
-
|
|
2745
|
-
|
|
2746
|
-
}, [active, hideLayout, isOpen, slideOutId, small, smallModeOnly]);
|
|
2747
|
-
return showOverlay && /* @__PURE__ */ jsxRuntime.jsx("div", { className: classVarianceAuthority.cx("overmap-layout-overlay", "fixed inset-0", className), ref, ...rest, children });
|
|
2710
|
+
LayoutSlideOutRoot.displayName = "LayoutSlideOutRoot";
|
|
2711
|
+
const LayoutSlideOutTrigger = react.memo((props) => {
|
|
2712
|
+
const { ref, slideOutId, children, ...rest } = props;
|
|
2713
|
+
const { isOpen, setOpen } = useLayoutContext();
|
|
2714
|
+
const open = isOpen(slideOutId);
|
|
2715
|
+
const handleClick = react.useCallback(() => {
|
|
2716
|
+
setOpen(slideOutId, !open);
|
|
2717
|
+
}, [open, setOpen, slideOutId]);
|
|
2718
|
+
return /* @__PURE__ */ jsxRuntime.jsx(reactSlot.Slot, { "data-state": getOpenState(open), ref, onClick: handleClick, ...rest, children });
|
|
2748
2719
|
});
|
|
2749
|
-
|
|
2750
|
-
const
|
|
2751
|
-
|
|
2752
|
-
|
|
2753
|
-
|
|
2754
|
-
|
|
2755
|
-
|
|
2756
|
-
|
|
2757
|
-
|
|
2758
|
-
|
|
2759
|
-
|
|
2760
|
-
|
|
2761
|
-
|
|
2762
|
-
|
|
2763
|
-
|
|
2764
|
-
|
|
2765
|
-
} else if (alignment === "end") {
|
|
2766
|
-
return { mainAxis: MENU_CONTENT_PADDING + 1, crossAxis: MENU_CONTENT_PADDING };
|
|
2767
|
-
}
|
|
2768
|
-
break;
|
|
2769
|
-
}
|
|
2770
|
-
return { mainAxis: MENU_CONTENT_PADDING + 1, crossAxis: 0 };
|
|
2771
|
-
};
|
|
2772
|
-
function getSelectedState(selected) {
|
|
2773
|
-
return selected ? "selected" : "unselected";
|
|
2774
|
-
}
|
|
2775
|
-
function getCheckedState(checked) {
|
|
2776
|
-
return checked === true ? "checked" : checked === false ? "unchecked" : "indeterminate";
|
|
2777
|
-
}
|
|
2778
|
-
function getBooleanState(value) {
|
|
2779
|
-
return value ? "true" : "false";
|
|
2780
|
-
}
|
|
2781
|
-
function getOpenState(open) {
|
|
2782
|
-
return open ? "open" : "closed";
|
|
2783
|
-
}
|
|
2784
|
-
function nextStateBasedOnType(open, type) {
|
|
2785
|
-
switch (type) {
|
|
2786
|
-
case "toggle":
|
|
2787
|
-
return !open;
|
|
2788
|
-
case "open":
|
|
2789
|
-
return true;
|
|
2790
|
-
case "close":
|
|
2791
|
-
return false;
|
|
2792
|
-
}
|
|
2793
|
-
}
|
|
2794
|
-
const LayoutSlideOutTrigger = React.memo((props) => {
|
|
2795
|
-
const { ref, slideOutId, type = "toggle", children, ...rest } = props;
|
|
2796
|
-
const { isOpen, setOpen } = useLayoutContext();
|
|
2797
|
-
const open = isOpen(slideOutId);
|
|
2798
|
-
const handleClick = React.useCallback(() => {
|
|
2799
|
-
setOpen(slideOutId, nextStateBasedOnType(open, type));
|
|
2800
|
-
}, [open, setOpen, slideOutId, type]);
|
|
2801
|
-
return /* @__PURE__ */ jsxRuntime.jsx(reactSlot.Slot, { "data-state": getOpenState(open), ref, onClick: handleClick, ...rest, children });
|
|
2802
|
-
});
|
|
2803
|
-
LayoutSlideOutTrigger.displayName = "SlideOutTrigger";
|
|
2804
|
-
const Layout = {
|
|
2805
|
-
Root: LayoutRoot,
|
|
2806
|
-
Container: LayoutContainer,
|
|
2807
|
-
SlideOutOverlay: LayoutSlideOutOverlay,
|
|
2808
|
-
SlideOut: LayoutSlideOut,
|
|
2809
|
-
SlideOutTrigger: LayoutSlideOutTrigger
|
|
2720
|
+
LayoutSlideOutTrigger.displayName = "LayoutSlideOutTrigger";
|
|
2721
|
+
const LayoutSlideOutViewport = react.memo((props) => {
|
|
2722
|
+
const { ref, ...rest } = props;
|
|
2723
|
+
return /* @__PURE__ */ jsxRuntime.jsx(SlideOutViewport, { ref, ...rest });
|
|
2724
|
+
});
|
|
2725
|
+
LayoutSlideOutViewport.displayName = "LayoutSlideOutViewport";
|
|
2726
|
+
const Layout = {
|
|
2727
|
+
Root: LayoutRoot,
|
|
2728
|
+
Container: LayoutContainer,
|
|
2729
|
+
SlideOutClose: LayoutSlideOutClose,
|
|
2730
|
+
SlideOutContent: LayoutSlideOutContent,
|
|
2731
|
+
SlideOutHandle: LayoutSlideOutHandle,
|
|
2732
|
+
SlideOutOverlay: LayoutSlideOutOverlay,
|
|
2733
|
+
SlideOutRoot: LayoutSlideOutRoot,
|
|
2734
|
+
SlideOutTrigger: LayoutSlideOutTrigger,
|
|
2735
|
+
SlideOutViewport: LayoutSlideOutViewport
|
|
2810
2736
|
};
|
|
2811
2737
|
const linkCva = classVarianceAuthority.cva(["cursor-pointer"], {
|
|
2812
2738
|
variants: {
|
|
@@ -2844,7 +2770,7 @@
|
|
|
2844
2770
|
align: "left"
|
|
2845
2771
|
}
|
|
2846
2772
|
});
|
|
2847
|
-
const Link =
|
|
2773
|
+
const Link = react.memo((props) => {
|
|
2848
2774
|
const providerContext = useProvider();
|
|
2849
2775
|
const {
|
|
2850
2776
|
ref,
|
|
@@ -2876,27 +2802,6 @@
|
|
|
2876
2802
|
);
|
|
2877
2803
|
});
|
|
2878
2804
|
Link.displayName = "Link";
|
|
2879
|
-
const CheckedIndicatorContext = React.createContext({});
|
|
2880
|
-
const CheckedIndicator = (props) => {
|
|
2881
|
-
const { children, ref, className, ...rest } = props;
|
|
2882
|
-
const checked = React.useContext(CheckedIndicatorContext);
|
|
2883
|
-
const computedChildren = typeof children === "function" ? children(checked === "indeterminate") : children;
|
|
2884
|
-
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
2885
|
-
"span",
|
|
2886
|
-
{
|
|
2887
|
-
ref,
|
|
2888
|
-
className: classVarianceAuthority.cx(
|
|
2889
|
-
{
|
|
2890
|
-
invisible: checked === false
|
|
2891
|
-
},
|
|
2892
|
-
className
|
|
2893
|
-
),
|
|
2894
|
-
"data-state": getCheckedState$1(checked),
|
|
2895
|
-
...rest,
|
|
2896
|
-
children: computedChildren
|
|
2897
|
-
}
|
|
2898
|
-
);
|
|
2899
|
-
};
|
|
2900
2805
|
const menuItem = classVarianceAuthority.cva(
|
|
2901
2806
|
[
|
|
2902
2807
|
"select-none",
|
|
@@ -2906,16 +2811,17 @@
|
|
|
2906
2811
|
"rounded",
|
|
2907
2812
|
"outline-none",
|
|
2908
2813
|
"data-[disabled=true]:text-(--base-a8)",
|
|
2909
|
-
"shrink-0"
|
|
2814
|
+
"shrink-0",
|
|
2815
|
+
"py-1"
|
|
2910
2816
|
],
|
|
2911
2817
|
{
|
|
2912
2818
|
variants: {
|
|
2913
2819
|
size: {
|
|
2914
|
-
xs: ["
|
|
2915
|
-
sm: ["
|
|
2916
|
-
md: ["
|
|
2917
|
-
lg: ["
|
|
2918
|
-
xl: ["
|
|
2820
|
+
xs: ["gap-1.5", "px-3"],
|
|
2821
|
+
sm: ["gap-1.75", "px-3.5"],
|
|
2822
|
+
md: ["gap-2", "px-4"],
|
|
2823
|
+
lg: ["gap-2.25", "px-4.5"],
|
|
2824
|
+
xl: ["gap-2.5", "px-5"]
|
|
2919
2825
|
},
|
|
2920
2826
|
variant: {
|
|
2921
2827
|
solid: [
|
|
@@ -2937,14 +2843,14 @@
|
|
|
2937
2843
|
}
|
|
2938
2844
|
}
|
|
2939
2845
|
);
|
|
2940
|
-
const menuLabelCva = classVarianceAuthority.cva(["text-(--base-a10)", "flex", "items-center", "select-none"], {
|
|
2846
|
+
const menuLabelCva = classVarianceAuthority.cva(["text-(--base-a10)", "flex", "items-center", "select-none", "py-1"], {
|
|
2941
2847
|
variants: {
|
|
2942
2848
|
size: {
|
|
2943
|
-
xs: ["
|
|
2944
|
-
sm: ["
|
|
2945
|
-
md: ["
|
|
2946
|
-
lg: ["
|
|
2947
|
-
xl: ["
|
|
2849
|
+
xs: ["gap-1.5", "px-3", "text-xs"],
|
|
2850
|
+
sm: ["gap-1.75", "px-3.5", "text-xs"],
|
|
2851
|
+
md: ["gap-2", "px-4", "text-sm"],
|
|
2852
|
+
lg: ["gap-2.25", "px-4.5", "text-base"],
|
|
2853
|
+
xl: ["gap-2.5", "px-5", "text-lg"]
|
|
2948
2854
|
}
|
|
2949
2855
|
},
|
|
2950
2856
|
defaultVariants: {
|
|
@@ -3041,101 +2947,116 @@
|
|
|
3041
2947
|
}
|
|
3042
2948
|
}
|
|
3043
2949
|
);
|
|
3044
|
-
const
|
|
3045
|
-
const
|
|
3046
|
-
const
|
|
3047
|
-
const
|
|
2950
|
+
const MenuContentContext = react.createContext({});
|
|
2951
|
+
const MenuContext = react.createContext({});
|
|
2952
|
+
const SubContext = react.createContext({});
|
|
2953
|
+
const TRIGGER_SELECT_KEYS = ["Enter", " "];
|
|
2954
|
+
const MenuItem = react.memo((props) => {
|
|
2955
|
+
const rootMenuContext = react.use(MenuContext);
|
|
2956
|
+
const { getItemProps, activeIndex, setOpen, size, variant, radius } = react.use(MenuContentContext);
|
|
2957
|
+
const { closeRoot } = react.use(SubContext);
|
|
3048
2958
|
const {
|
|
2959
|
+
ref: forwardedRef,
|
|
2960
|
+
className,
|
|
3049
2961
|
children,
|
|
3050
|
-
|
|
3051
|
-
|
|
3052
|
-
|
|
3053
|
-
|
|
3054
|
-
|
|
3055
|
-
|
|
3056
|
-
open: controlledOpen,
|
|
3057
|
-
onOpenChange,
|
|
3058
|
-
defaultOpen
|
|
2962
|
+
onSelect,
|
|
2963
|
+
onClick,
|
|
2964
|
+
onKeyDown,
|
|
2965
|
+
closeOnSelect = true,
|
|
2966
|
+
disabled = false,
|
|
2967
|
+
...rest
|
|
3059
2968
|
} = props;
|
|
3060
|
-
const
|
|
3061
|
-
const
|
|
3062
|
-
const
|
|
3063
|
-
|
|
3064
|
-
|
|
3065
|
-
|
|
3066
|
-
|
|
3067
|
-
|
|
3068
|
-
|
|
3069
|
-
|
|
3070
|
-
|
|
3071
|
-
|
|
3072
|
-
|
|
3073
|
-
|
|
3074
|
-
|
|
3075
|
-
|
|
3076
|
-
|
|
3077
|
-
|
|
3078
|
-
|
|
3079
|
-
|
|
3080
|
-
|
|
3081
|
-
|
|
2969
|
+
const { ref, index } = react$1.useListItem();
|
|
2970
|
+
const mergeRefs2 = react$1.useMergeRefs([ref, forwardedRef]);
|
|
2971
|
+
const handleClick = react.useCallback(
|
|
2972
|
+
(e) => {
|
|
2973
|
+
e.stopPropagation();
|
|
2974
|
+
if (disabled) return;
|
|
2975
|
+
onClick == null ? void 0 : onClick(e);
|
|
2976
|
+
onSelect == null ? void 0 : onSelect();
|
|
2977
|
+
if (closeOnSelect) setOpen(false);
|
|
2978
|
+
if (closeRoot) rootMenuContext.setOpen(false);
|
|
2979
|
+
},
|
|
2980
|
+
[closeOnSelect, closeRoot, disabled, rootMenuContext, onClick, onSelect, setOpen]
|
|
2981
|
+
);
|
|
2982
|
+
const handleKeyDown = react.useCallback(
|
|
2983
|
+
(e) => {
|
|
2984
|
+
if (disabled) return;
|
|
2985
|
+
onKeyDown == null ? void 0 : onKeyDown(e);
|
|
2986
|
+
if (TRIGGER_SELECT_KEYS.includes(e.key)) {
|
|
2987
|
+
onSelect == null ? void 0 : onSelect();
|
|
2988
|
+
if (closeOnSelect) setOpen(false);
|
|
2989
|
+
}
|
|
2990
|
+
},
|
|
2991
|
+
[closeOnSelect, disabled, onKeyDown, onSelect, setOpen]
|
|
2992
|
+
);
|
|
2993
|
+
const isActive = react.useMemo(() => index === activeIndex, [activeIndex, index]);
|
|
2994
|
+
const computedChildren = react.useMemo(() => {
|
|
2995
|
+
return typeof children === "function" ? children({ active: isActive, selected: false }) : children;
|
|
2996
|
+
}, [children, isActive]);
|
|
2997
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
2998
|
+
"li",
|
|
2999
|
+
{
|
|
3000
|
+
className: classVarianceAuthority.cx(menuItem({ size, variant }), radiusCva({ radius, maxLarge: true }), className),
|
|
3001
|
+
ref: mergeRefs2,
|
|
3002
|
+
role: "menuitem",
|
|
3003
|
+
"data-disabled": getBooleanState(disabled),
|
|
3004
|
+
"aria-disabled": disabled,
|
|
3005
|
+
"data-highlighted": isActive ? "" : void 0,
|
|
3006
|
+
...getItemProps({
|
|
3007
|
+
onClick: handleClick,
|
|
3008
|
+
onKeyDown: handleKeyDown,
|
|
3009
|
+
tabIndex: isActive ? 0 : -1,
|
|
3010
|
+
...rest
|
|
3082
3011
|
}),
|
|
3083
|
-
|
|
3084
|
-
|
|
3085
|
-
|
|
3086
|
-
|
|
3087
|
-
|
|
3088
|
-
|
|
3089
|
-
|
|
3090
|
-
|
|
3091
|
-
|
|
3092
|
-
|
|
3093
|
-
|
|
3094
|
-
|
|
3095
|
-
|
|
3096
|
-
|
|
3097
|
-
|
|
3098
|
-
|
|
3099
|
-
|
|
3100
|
-
|
|
3101
|
-
|
|
3102
|
-
|
|
3103
|
-
|
|
3104
|
-
|
|
3105
|
-
|
|
3106
|
-
|
|
3107
|
-
|
|
3108
|
-
|
|
3109
|
-
|
|
3110
|
-
|
|
3111
|
-
|
|
3012
|
+
children: computedChildren
|
|
3013
|
+
}
|
|
3014
|
+
);
|
|
3015
|
+
});
|
|
3016
|
+
MenuItem.displayName = "MenuItem";
|
|
3017
|
+
const MenuCheckboxItem = react.memo((props) => {
|
|
3018
|
+
const { ref, checked, onCheckedChange, onSelect, ...rest } = props;
|
|
3019
|
+
const handleSelect = react.useCallback(() => {
|
|
3020
|
+
onSelect == null ? void 0 : onSelect();
|
|
3021
|
+
switch (checked) {
|
|
3022
|
+
case true:
|
|
3023
|
+
onCheckedChange(false);
|
|
3024
|
+
break;
|
|
3025
|
+
case "indeterminate":
|
|
3026
|
+
case false:
|
|
3027
|
+
onCheckedChange(true);
|
|
3028
|
+
break;
|
|
3029
|
+
}
|
|
3030
|
+
}, [checked, onCheckedChange, onSelect]);
|
|
3031
|
+
return /* @__PURE__ */ jsxRuntime.jsx(CheckedIndicatorContext.Provider, { value: checked, children: /* @__PURE__ */ jsxRuntime.jsx(MenuItem, { ref, onSelect: handleSelect, ...rest }) });
|
|
3032
|
+
});
|
|
3033
|
+
MenuCheckboxItem.displayName = "MenuCheckboxItem";
|
|
3034
|
+
const MenuCheckboxItemIndicator = react.memo((props) => {
|
|
3035
|
+
const { ref, children, ...rest } = props;
|
|
3036
|
+
return /* @__PURE__ */ jsxRuntime.jsx(CheckedIndicator, { ref, ...rest, children });
|
|
3037
|
+
});
|
|
3038
|
+
MenuCheckboxItemIndicator.displayName = "MenuCheckboxItemIndicator";
|
|
3039
|
+
const MenuClickTrigger = react.memo((props) => {
|
|
3040
|
+
const { ref: forwardedRef, children, disabled = false } = props;
|
|
3041
|
+
const { getReferenceProps, refs, setTriggerType, open } = react.use(MenuContext);
|
|
3042
|
+
const mergedRefs = react$1.useMergeRefs([refs.setReference, forwardedRef]);
|
|
3043
|
+
react.useEffect(() => {
|
|
3044
|
+
setTriggerType("click");
|
|
3045
|
+
}, [setTriggerType]);
|
|
3046
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
3047
|
+
reactSlot.Slot,
|
|
3112
3048
|
{
|
|
3113
|
-
|
|
3114
|
-
|
|
3115
|
-
|
|
3116
|
-
|
|
3117
|
-
|
|
3118
|
-
floatingStyles,
|
|
3119
|
-
elementsRef,
|
|
3120
|
-
getFloatingProps,
|
|
3121
|
-
getItemProps,
|
|
3122
|
-
getReferenceProps,
|
|
3123
|
-
nodeId,
|
|
3124
|
-
activeIndex,
|
|
3125
|
-
setActiveIndex,
|
|
3126
|
-
middlewareData,
|
|
3127
|
-
side,
|
|
3128
|
-
modal,
|
|
3129
|
-
setTriggerType
|
|
3130
|
-
},
|
|
3049
|
+
ref: mergedRefs,
|
|
3050
|
+
"aria-disabled": disabled,
|
|
3051
|
+
"data-disabled": getBooleanState(disabled),
|
|
3052
|
+
"data-state": getOpenState(open),
|
|
3053
|
+
...getReferenceProps({ disabled }),
|
|
3131
3054
|
children
|
|
3132
3055
|
}
|
|
3133
|
-
)
|
|
3056
|
+
);
|
|
3134
3057
|
});
|
|
3135
|
-
|
|
3136
|
-
const
|
|
3137
|
-
const useMenuContentContext = () => React.useContext(MenuContentContext);
|
|
3138
|
-
const MenuContent = React.memo((props) => {
|
|
3058
|
+
MenuClickTrigger.displayName = "MenuClickTrigger";
|
|
3059
|
+
const MenuContent = react.memo((props) => {
|
|
3139
3060
|
var _a;
|
|
3140
3061
|
const providerContext = useProvider();
|
|
3141
3062
|
const {
|
|
@@ -3163,28 +3084,28 @@
|
|
|
3163
3084
|
floatingStyles,
|
|
3164
3085
|
modal,
|
|
3165
3086
|
side
|
|
3166
|
-
} =
|
|
3167
|
-
const computedFloatingStyles =
|
|
3087
|
+
} = react.use(MenuContext);
|
|
3088
|
+
const computedFloatingStyles = react.useMemo(() => {
|
|
3168
3089
|
var _a2;
|
|
3169
3090
|
return {
|
|
3170
3091
|
...floatingStyles,
|
|
3171
3092
|
visibility: ((_a2 = middlewareData.hide) == null ? void 0 : _a2.referenceHidden) ? "hidden" : "visible"
|
|
3172
3093
|
};
|
|
3173
3094
|
}, [floatingStyles, (_a = middlewareData.hide) == null ? void 0 : _a.referenceHidden]);
|
|
3174
|
-
const handleOverlayPointerDown =
|
|
3095
|
+
const handleOverlayPointerDown = react.useCallback(
|
|
3175
3096
|
(e) => {
|
|
3176
3097
|
if (modal) stopPropagation(e);
|
|
3177
3098
|
},
|
|
3178
3099
|
[modal]
|
|
3179
3100
|
);
|
|
3180
|
-
return /* @__PURE__ */ jsxRuntime.jsx(react.FloatingNode, { id: nodeId, children: open && /* @__PURE__ */ jsxRuntime.jsx(react.FloatingPortal, { children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
3181
|
-
react.FloatingOverlay,
|
|
3101
|
+
return /* @__PURE__ */ jsxRuntime.jsx(react$1.FloatingNode, { id: nodeId, children: open && /* @__PURE__ */ jsxRuntime.jsx(react$1.FloatingPortal, { children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
3102
|
+
react$1.FloatingOverlay,
|
|
3182
3103
|
{
|
|
3183
3104
|
className: menuOverlay({ modal }),
|
|
3184
3105
|
onClick: handleOverlayPointerDown,
|
|
3185
3106
|
lockScroll: true,
|
|
3186
3107
|
"data-floating-content": "",
|
|
3187
|
-
children: /* @__PURE__ */ jsxRuntime.jsx(react.FloatingFocusManager, { context, children: /* @__PURE__ */ jsxRuntime.jsx(react.FloatingList, { elementsRef, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
3108
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(react$1.FloatingFocusManager, { context, children: /* @__PURE__ */ jsxRuntime.jsx(react$1.FloatingList, { elementsRef, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
3188
3109
|
MenuContentContext.Provider,
|
|
3189
3110
|
{
|
|
3190
3111
|
value: {
|
|
@@ -3235,242 +3156,36 @@
|
|
|
3235
3156
|
) }) });
|
|
3236
3157
|
});
|
|
3237
3158
|
MenuContent.displayName = "Menu.Content";
|
|
3238
|
-
const
|
|
3239
|
-
|
|
3240
|
-
|
|
3241
|
-
const {
|
|
3242
|
-
|
|
3243
|
-
|
|
3244
|
-
|
|
3245
|
-
|
|
3246
|
-
|
|
3247
|
-
|
|
3248
|
-
|
|
3249
|
-
|
|
3250
|
-
|
|
3251
|
-
|
|
3252
|
-
|
|
3253
|
-
|
|
3254
|
-
|
|
3255
|
-
|
|
3256
|
-
|
|
3257
|
-
|
|
3258
|
-
|
|
3259
|
-
|
|
3260
|
-
|
|
3261
|
-
|
|
3262
|
-
|
|
3263
|
-
|
|
3264
|
-
|
|
3265
|
-
|
|
3266
|
-
|
|
3267
|
-
|
|
3268
|
-
padding: MENU_OVERFLOW_PADDING,
|
|
3269
|
-
apply({ availableHeight, elements }) {
|
|
3270
|
-
elements.floating.style.setProperty(
|
|
3271
|
-
"--overmap-menu-available-height",
|
|
3272
|
-
`${Math.max(availableHeight, MENU_MINIMUM_MAX_HEIGHT)}px`
|
|
3273
|
-
);
|
|
3274
|
-
}
|
|
3275
|
-
}),
|
|
3276
|
-
react.flip(),
|
|
3277
|
-
react.shift({ padding: MENU_OVERFLOW_PADDING }),
|
|
3278
|
-
react.hide()
|
|
3279
|
-
]
|
|
3280
|
-
});
|
|
3281
|
-
const dismiss = react.useDismiss(context, {
|
|
3282
|
-
bubbles: closeRoot,
|
|
3283
|
-
outsidePress: closeRoot
|
|
3284
|
-
});
|
|
3285
|
-
const hover = react.useHover(context, {
|
|
3286
|
-
restMs: 50,
|
|
3287
|
-
handleClose: react.safePolygon({
|
|
3288
|
-
blockPointerEvents: true,
|
|
3289
|
-
requireIntent: false
|
|
3290
|
-
}),
|
|
3291
|
-
enabled: !disabled
|
|
3292
|
-
});
|
|
3293
|
-
const click = react.useClick(context, {
|
|
3294
|
-
enabled: !disabled
|
|
3295
|
-
});
|
|
3296
|
-
const elementsRef = React.useRef([]);
|
|
3297
|
-
const [activeIndex, setActiveIndex] = React.useState(null);
|
|
3298
|
-
const listNavigation = react.useListNavigation(context, {
|
|
3299
|
-
listRef: elementsRef,
|
|
3300
|
-
nested: true,
|
|
3301
|
-
activeIndex,
|
|
3302
|
-
onNavigate: setActiveIndex,
|
|
3303
|
-
loop,
|
|
3304
|
-
rtl: side === "left"
|
|
3305
|
-
});
|
|
3306
|
-
const { getFloatingProps, getItemProps, getReferenceProps } = react.useInteractions([
|
|
3307
|
-
listNavigation,
|
|
3308
|
-
dismiss,
|
|
3309
|
-
hover,
|
|
3310
|
-
click
|
|
3311
|
-
]);
|
|
3312
|
-
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
3313
|
-
SubContext.Provider,
|
|
3314
|
-
{
|
|
3315
|
-
value: {
|
|
3316
|
-
open,
|
|
3317
|
-
setOpen,
|
|
3318
|
-
nodeId,
|
|
3319
|
-
refs,
|
|
3320
|
-
floatingStyles,
|
|
3321
|
-
context,
|
|
3322
|
-
elementsRef,
|
|
3323
|
-
activeIndex,
|
|
3324
|
-
setActiveIndex,
|
|
3325
|
-
getFloatingProps,
|
|
3326
|
-
getItemProps,
|
|
3327
|
-
getReferenceProps,
|
|
3328
|
-
disabled,
|
|
3329
|
-
side,
|
|
3330
|
-
closeRoot,
|
|
3331
|
-
modal
|
|
3332
|
-
},
|
|
3333
|
-
children
|
|
3334
|
-
}
|
|
3335
|
-
);
|
|
3336
|
-
});
|
|
3337
|
-
MenuSub.displayName = "SubMenu";
|
|
3338
|
-
const TRIGGER_SELECT_KEYS = ["Enter", " "];
|
|
3339
|
-
const MenuItem = React.memo((props) => {
|
|
3340
|
-
const rootMenuContext = useMenuContext();
|
|
3341
|
-
const { getItemProps, activeIndex, setOpen, size, variant, radius } = useMenuContentContext();
|
|
3342
|
-
const { closeRoot } = useSubContext();
|
|
3343
|
-
const {
|
|
3344
|
-
ref: forwardedRef,
|
|
3345
|
-
className,
|
|
3346
|
-
children,
|
|
3347
|
-
onSelect,
|
|
3348
|
-
onClick,
|
|
3349
|
-
onKeyDown,
|
|
3350
|
-
closeOnSelect = true,
|
|
3351
|
-
disabled = false,
|
|
3352
|
-
...rest
|
|
3353
|
-
} = props;
|
|
3354
|
-
const { ref, index } = react.useListItem();
|
|
3355
|
-
const mergeRefs2 = react.useMergeRefs([ref, forwardedRef]);
|
|
3356
|
-
const handleClick = React.useCallback(
|
|
3357
|
-
(e) => {
|
|
3358
|
-
e.stopPropagation();
|
|
3359
|
-
if (disabled) return;
|
|
3360
|
-
onClick == null ? void 0 : onClick(e);
|
|
3361
|
-
onSelect == null ? void 0 : onSelect();
|
|
3362
|
-
if (closeOnSelect) setOpen(false);
|
|
3363
|
-
if (closeRoot) rootMenuContext.setOpen(false);
|
|
3364
|
-
},
|
|
3365
|
-
[closeOnSelect, closeRoot, disabled, rootMenuContext, onClick, onSelect, setOpen]
|
|
3366
|
-
);
|
|
3367
|
-
const handleKeyDown = React.useCallback(
|
|
3368
|
-
(e) => {
|
|
3369
|
-
if (disabled) return;
|
|
3370
|
-
onKeyDown == null ? void 0 : onKeyDown(e);
|
|
3371
|
-
if (TRIGGER_SELECT_KEYS.includes(e.key)) {
|
|
3372
|
-
onSelect == null ? void 0 : onSelect();
|
|
3373
|
-
if (closeOnSelect) setOpen(false);
|
|
3374
|
-
}
|
|
3375
|
-
},
|
|
3376
|
-
[closeOnSelect, disabled, onKeyDown, onSelect, setOpen]
|
|
3377
|
-
);
|
|
3378
|
-
const isActive = React.useMemo(() => index === activeIndex, [activeIndex, index]);
|
|
3379
|
-
const computedChildren = React.useMemo(() => {
|
|
3380
|
-
return typeof children === "function" ? children({ active: isActive, selected: false }) : children;
|
|
3381
|
-
}, [children, isActive]);
|
|
3382
|
-
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
3383
|
-
"li",
|
|
3384
|
-
{
|
|
3385
|
-
className: classVarianceAuthority.cx(menuItem({ size, variant }), radiusCva({ radius, maxLarge: true }), className),
|
|
3386
|
-
ref: mergeRefs2,
|
|
3387
|
-
role: "menuitem",
|
|
3388
|
-
"data-disabled": getBooleanState(disabled),
|
|
3389
|
-
"aria-disabled": disabled,
|
|
3390
|
-
"data-highlighted": isActive ? "" : void 0,
|
|
3391
|
-
...getItemProps({
|
|
3392
|
-
onClick: handleClick,
|
|
3393
|
-
onKeyDown: handleKeyDown,
|
|
3394
|
-
tabIndex: isActive ? 0 : -1,
|
|
3395
|
-
...rest
|
|
3396
|
-
}),
|
|
3397
|
-
children: computedChildren
|
|
3398
|
-
}
|
|
3399
|
-
);
|
|
3400
|
-
});
|
|
3401
|
-
MenuItem.displayName = "MenuItem";
|
|
3402
|
-
const MenuCheckboxItem = React.memo((props) => {
|
|
3403
|
-
const { ref, checked, onCheckedChange, onSelect, ...rest } = props;
|
|
3404
|
-
const handleSelect = React.useCallback(() => {
|
|
3405
|
-
onSelect == null ? void 0 : onSelect();
|
|
3406
|
-
switch (checked) {
|
|
3407
|
-
case true:
|
|
3408
|
-
onCheckedChange(false);
|
|
3409
|
-
break;
|
|
3410
|
-
case "indeterminate":
|
|
3411
|
-
case false:
|
|
3412
|
-
onCheckedChange(true);
|
|
3413
|
-
break;
|
|
3414
|
-
}
|
|
3415
|
-
}, [checked, onCheckedChange, onSelect]);
|
|
3416
|
-
return /* @__PURE__ */ jsxRuntime.jsx(CheckedIndicatorContext.Provider, { value: checked, children: /* @__PURE__ */ jsxRuntime.jsx(MenuItem, { ref, onSelect: handleSelect, ...rest }) });
|
|
3417
|
-
});
|
|
3418
|
-
MenuCheckboxItem.displayName = "MenuCheckboxItem";
|
|
3419
|
-
const MenuCheckboxItemIndicator = React.memo((props) => {
|
|
3420
|
-
const { ref, children, ...rest } = props;
|
|
3421
|
-
return /* @__PURE__ */ jsxRuntime.jsx(CheckedIndicator, { ref, ...rest, children });
|
|
3422
|
-
});
|
|
3423
|
-
MenuCheckboxItemIndicator.displayName = "MenuCheckboxItemIndicator";
|
|
3424
|
-
const MenuClickTrigger = React.memo((props) => {
|
|
3425
|
-
const { ref: forwardedRef, children, disabled = false } = props;
|
|
3426
|
-
const { getReferenceProps, refs, setTriggerType, open } = useMenuContext();
|
|
3427
|
-
const mergedRefs = react.useMergeRefs([refs.setReference, forwardedRef]);
|
|
3428
|
-
React.useEffect(() => {
|
|
3429
|
-
setTriggerType("click");
|
|
3430
|
-
}, [setTriggerType]);
|
|
3431
|
-
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
3432
|
-
reactSlot.Slot,
|
|
3433
|
-
{
|
|
3434
|
-
ref: mergedRefs,
|
|
3435
|
-
"aria-disabled": disabled,
|
|
3436
|
-
"data-disabled": getBooleanState(disabled),
|
|
3437
|
-
"data-state": getOpenState(open),
|
|
3438
|
-
...getReferenceProps({ disabled }),
|
|
3439
|
-
children
|
|
3440
|
-
}
|
|
3441
|
-
);
|
|
3442
|
-
});
|
|
3443
|
-
MenuClickTrigger.displayName = "MenuClickTrigger";
|
|
3444
|
-
const MenuContextTrigger = React.memo((props) => {
|
|
3445
|
-
const { ref: forwardedRef, children, disabled = false } = props;
|
|
3446
|
-
const ref = React.useRef(null);
|
|
3447
|
-
const { setOpen, refs, setTriggerType, open } = useMenuContext();
|
|
3448
|
-
const mergedRefs = react.useMergeRefs([forwardedRef, ref]);
|
|
3449
|
-
React.useEffect(() => {
|
|
3450
|
-
setTriggerType("context");
|
|
3451
|
-
}, [setTriggerType]);
|
|
3452
|
-
const handleContextMenu = React.useCallback(
|
|
3453
|
-
(e) => {
|
|
3454
|
-
const { clientY, clientX } = e;
|
|
3455
|
-
if (!disabled && ref.current) {
|
|
3456
|
-
e.preventDefault();
|
|
3457
|
-
refs.setPositionReference({
|
|
3458
|
-
getBoundingClientRect() {
|
|
3459
|
-
return {
|
|
3460
|
-
x: clientX,
|
|
3461
|
-
y: clientY,
|
|
3462
|
-
top: clientY,
|
|
3463
|
-
left: clientX,
|
|
3464
|
-
height: 0,
|
|
3465
|
-
width: 0,
|
|
3466
|
-
bottom: clientY,
|
|
3467
|
-
right: clientX
|
|
3468
|
-
};
|
|
3469
|
-
},
|
|
3470
|
-
contextElement: ref.current
|
|
3471
|
-
});
|
|
3472
|
-
setOpen(true);
|
|
3473
|
-
}
|
|
3159
|
+
const MenuContextTrigger = react.memo((props) => {
|
|
3160
|
+
const { ref: forwardedRef, children, disabled = false } = props;
|
|
3161
|
+
const ref = react.useRef(null);
|
|
3162
|
+
const { setOpen, refs, setTriggerType, open } = react.use(MenuContext);
|
|
3163
|
+
const mergedRefs = react$1.useMergeRefs([forwardedRef, ref]);
|
|
3164
|
+
react.useEffect(() => {
|
|
3165
|
+
setTriggerType("context");
|
|
3166
|
+
}, [setTriggerType]);
|
|
3167
|
+
const handleContextMenu = react.useCallback(
|
|
3168
|
+
(e) => {
|
|
3169
|
+
const { clientY, clientX } = e;
|
|
3170
|
+
if (!disabled && ref.current) {
|
|
3171
|
+
e.preventDefault();
|
|
3172
|
+
refs.setPositionReference({
|
|
3173
|
+
getBoundingClientRect() {
|
|
3174
|
+
return {
|
|
3175
|
+
x: clientX,
|
|
3176
|
+
y: clientY,
|
|
3177
|
+
top: clientY,
|
|
3178
|
+
left: clientX,
|
|
3179
|
+
height: 0,
|
|
3180
|
+
width: 0,
|
|
3181
|
+
bottom: clientY,
|
|
3182
|
+
right: clientX
|
|
3183
|
+
};
|
|
3184
|
+
},
|
|
3185
|
+
contextElement: ref.current
|
|
3186
|
+
});
|
|
3187
|
+
setOpen(true);
|
|
3188
|
+
}
|
|
3474
3189
|
},
|
|
3475
3190
|
[disabled, refs, setOpen]
|
|
3476
3191
|
);
|
|
@@ -3488,24 +3203,24 @@
|
|
|
3488
3203
|
);
|
|
3489
3204
|
});
|
|
3490
3205
|
MenuContextTrigger.displayName = "MenuContextTrigger";
|
|
3491
|
-
const MenuGroup =
|
|
3206
|
+
const MenuGroup = react.memo((props) => {
|
|
3492
3207
|
const { ref, children, ...rest } = props;
|
|
3493
3208
|
return /* @__PURE__ */ jsxRuntime.jsx("div", { ref, role: "group", ...rest, children });
|
|
3494
3209
|
});
|
|
3495
3210
|
MenuGroup.displayName = "MenuGroup";
|
|
3496
|
-
const MenuInputField =
|
|
3211
|
+
const MenuInputField = react.memo((props) => {
|
|
3497
3212
|
const { ref: forwardedRef, className, onValueChange, onChange, disabled = false, ...rest } = props;
|
|
3498
|
-
const { activeIndex, getItemProps } =
|
|
3499
|
-
const { index, ref } = react.useListItem();
|
|
3500
|
-
const mergedRefs = react.useMergeRefs([ref, forwardedRef]);
|
|
3501
|
-
const handleChange =
|
|
3213
|
+
const { activeIndex, getItemProps } = react.use(MenuContentContext);
|
|
3214
|
+
const { index, ref } = react$1.useListItem();
|
|
3215
|
+
const mergedRefs = react$1.useMergeRefs([ref, forwardedRef]);
|
|
3216
|
+
const handleChange = react.useCallback(
|
|
3502
3217
|
(e) => {
|
|
3503
3218
|
onChange == null ? void 0 : onChange(e);
|
|
3504
3219
|
onValueChange == null ? void 0 : onValueChange(e.target.value);
|
|
3505
3220
|
},
|
|
3506
3221
|
[onChange, onValueChange]
|
|
3507
3222
|
);
|
|
3508
|
-
|
|
3223
|
+
react.useEffect(() => {
|
|
3509
3224
|
return () => {
|
|
3510
3225
|
onValueChange == null ? void 0 : onValueChange("");
|
|
3511
3226
|
};
|
|
@@ -3526,20 +3241,20 @@
|
|
|
3526
3241
|
);
|
|
3527
3242
|
});
|
|
3528
3243
|
MenuInputField.displayName = "MenuInputField";
|
|
3529
|
-
const MenuInputRoot =
|
|
3244
|
+
const MenuInputRoot = react.memo((props) => {
|
|
3530
3245
|
const { ref, className, ...rest } = props;
|
|
3531
|
-
const { size } =
|
|
3246
|
+
const { size } = react.use(MenuContentContext);
|
|
3532
3247
|
return /* @__PURE__ */ jsxRuntime.jsx("div", { className: classVarianceAuthority.cx(inputRoot({ size }), className), ref, ...rest });
|
|
3533
3248
|
});
|
|
3534
3249
|
MenuInputRoot.displayName = "MenuInputRoot";
|
|
3535
|
-
const MenuInputSlot =
|
|
3250
|
+
const MenuInputSlot = react.memo((props) => {
|
|
3536
3251
|
const { ref, className, ...rest } = props;
|
|
3537
3252
|
return /* @__PURE__ */ jsxRuntime.jsx("div", { className: classVarianceAuthority.cx("flex", "items-center", "text-(--base-a11)", className), ref, ...rest });
|
|
3538
3253
|
});
|
|
3539
3254
|
MenuInputSlot.displayName = "MenuInputSlot";
|
|
3540
|
-
const MenuLabel =
|
|
3255
|
+
const MenuLabel = react.memo((props) => {
|
|
3541
3256
|
const { ref, className, ...rest } = props;
|
|
3542
|
-
const { size } =
|
|
3257
|
+
const { size } = react.use(MenuContentContext);
|
|
3543
3258
|
return /* @__PURE__ */ jsxRuntime.jsx("div", { ref, className: classVarianceAuthority.cx(menuLabelCva({ size }), className), ...rest });
|
|
3544
3259
|
});
|
|
3545
3260
|
MenuLabel.displayName = "MenuLabel";
|
|
@@ -3547,40 +3262,18 @@
|
|
|
3547
3262
|
const { ref, children, defaultValues, values, onValuesChange, ...rest } = props;
|
|
3548
3263
|
return /* @__PURE__ */ jsxRuntime.jsx(MenuGroup, { ref, ...rest, children: /* @__PURE__ */ jsxRuntime.jsx(MultiSelectProvider, { defaultValues, values, onValuesChange, children }) });
|
|
3549
3264
|
});
|
|
3550
|
-
const SelectedIndicatorContext = React.createContext(false);
|
|
3551
|
-
const useSelectedIndicatorContext = () => React.useContext(SelectedIndicatorContext);
|
|
3552
|
-
const MenuSelectedIndicator = React.memo((props) => {
|
|
3553
|
-
const { ref, children, className, ...rest } = props;
|
|
3554
|
-
const isSelected = useSelectedIndicatorContext();
|
|
3555
|
-
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
3556
|
-
"span",
|
|
3557
|
-
{
|
|
3558
|
-
ref,
|
|
3559
|
-
className: classVarianceAuthority.cx(
|
|
3560
|
-
{
|
|
3561
|
-
invisible: !isSelected
|
|
3562
|
-
},
|
|
3563
|
-
className
|
|
3564
|
-
),
|
|
3565
|
-
"data-state": getSelectedState(isSelected),
|
|
3566
|
-
...rest,
|
|
3567
|
-
children
|
|
3568
|
-
}
|
|
3569
|
-
);
|
|
3570
|
-
});
|
|
3571
|
-
MenuSelectedIndicator.displayName = "SelectedIndicator";
|
|
3572
3265
|
const MenuMultiSelectItem = genericMemo(function(props) {
|
|
3573
3266
|
const { ref, onSelect, children, closeOnSelect = false, value, ...rest } = props;
|
|
3574
|
-
const { selected, selectValue, registerValue } =
|
|
3575
|
-
|
|
3267
|
+
const { selected, selectValue, registerValue } = react.use(MultiSelectContext);
|
|
3268
|
+
react.useLayoutEffect(() => {
|
|
3576
3269
|
return registerValue(value);
|
|
3577
3270
|
}, [registerValue, value]);
|
|
3578
3271
|
const isSelected = selected(value);
|
|
3579
|
-
const handleSelect =
|
|
3272
|
+
const handleSelect = react.useCallback(() => {
|
|
3580
3273
|
onSelect == null ? void 0 : onSelect();
|
|
3581
3274
|
selectValue(value);
|
|
3582
3275
|
}, [onSelect, selectValue, value]);
|
|
3583
|
-
const computedChildren =
|
|
3276
|
+
const computedChildren = react.useMemo(() => {
|
|
3584
3277
|
return typeof children === "function" ? ({ active }) => children({ selected: isSelected, active }) : children;
|
|
3585
3278
|
}, [children, isSelected]);
|
|
3586
3279
|
return /* @__PURE__ */ jsxRuntime.jsx(SelectedIndicatorContext.Provider, { value: isSelected, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
@@ -3596,26 +3289,25 @@
|
|
|
3596
3289
|
}
|
|
3597
3290
|
) });
|
|
3598
3291
|
});
|
|
3599
|
-
const PagesContext =
|
|
3600
|
-
const
|
|
3601
|
-
|
|
3292
|
+
const PagesContext = react.createContext({});
|
|
3293
|
+
const MenuPageContent = react.memo((props) => {
|
|
3294
|
+
const { page, children } = props;
|
|
3295
|
+
const { activePage } = react.use(PagesContext);
|
|
3296
|
+
return activePage === page ? children : null;
|
|
3297
|
+
});
|
|
3298
|
+
MenuPageContent.displayName = "PageContent";
|
|
3299
|
+
const MenuPages = react.memo((props) => {
|
|
3602
3300
|
const { children, defaultPage, page, onPageChange } = props;
|
|
3603
3301
|
const [activePage, setActivePage] = useControlledState(defaultPage ?? "", page, onPageChange);
|
|
3604
|
-
const contextValue =
|
|
3302
|
+
const contextValue = react.useMemo(() => ({ activePage, setActivePage }), [activePage, setActivePage]);
|
|
3605
3303
|
return /* @__PURE__ */ jsxRuntime.jsx(PagesContext.Provider, { value: contextValue, children });
|
|
3606
3304
|
});
|
|
3607
3305
|
MenuPages.displayName = "MenuPages";
|
|
3608
|
-
const
|
|
3609
|
-
const { page, children } = props;
|
|
3610
|
-
const { activePage } = usePagesContext();
|
|
3611
|
-
return activePage === page ? children : null;
|
|
3612
|
-
};
|
|
3613
|
-
MenuPageContent.displayName = "PageContent";
|
|
3614
|
-
const MenuPageTrigger = React.memo((props) => {
|
|
3306
|
+
const MenuPageTrigger = react.memo((props) => {
|
|
3615
3307
|
const { ref, onSelect, page, ...rest } = props;
|
|
3616
|
-
const { refs, setActiveIndex } =
|
|
3617
|
-
const { setActivePage } =
|
|
3618
|
-
const handleSelect =
|
|
3308
|
+
const { refs, setActiveIndex } = react.use(MenuContentContext);
|
|
3309
|
+
const { setActivePage } = react.use(PagesContext);
|
|
3310
|
+
const handleSelect = react.useCallback(() => {
|
|
3619
3311
|
var _a;
|
|
3620
3312
|
onSelect == null ? void 0 : onSelect();
|
|
3621
3313
|
setActivePage(page);
|
|
@@ -3625,7 +3317,101 @@
|
|
|
3625
3317
|
return /* @__PURE__ */ jsxRuntime.jsx(MenuItem, { ref, onSelect: handleSelect, closeOnSelect: false, ...rest });
|
|
3626
3318
|
});
|
|
3627
3319
|
MenuPageTrigger.displayName = "MenuPageTrigger";
|
|
3628
|
-
const
|
|
3320
|
+
const MENU_OVERFLOW_PADDING = 20;
|
|
3321
|
+
const MENU_CONTENT_PADDING = 8;
|
|
3322
|
+
const MENU_MINIMUM_MAX_HEIGHT = 250;
|
|
3323
|
+
const DEFAULT_OFFSET = 5;
|
|
3324
|
+
const MenuRoot = react.memo((props) => {
|
|
3325
|
+
const {
|
|
3326
|
+
children,
|
|
3327
|
+
side = "bottom",
|
|
3328
|
+
align = "center",
|
|
3329
|
+
offset,
|
|
3330
|
+
loop = false,
|
|
3331
|
+
modal = false,
|
|
3332
|
+
// open state related props
|
|
3333
|
+
open: controlledOpen,
|
|
3334
|
+
onOpenChange,
|
|
3335
|
+
defaultOpen
|
|
3336
|
+
} = props;
|
|
3337
|
+
const [open, setOpen] = useControlledState(defaultOpen ?? false, controlledOpen, onOpenChange);
|
|
3338
|
+
const [activeIndex, setActiveIndex] = react.useState(null);
|
|
3339
|
+
const [triggerType, setTriggerType] = react.useState(null);
|
|
3340
|
+
const elementsRef = react.useRef([]);
|
|
3341
|
+
const nodeId = react$1.useFloatingNodeId();
|
|
3342
|
+
const { refs, floatingStyles, context, middlewareData } = react$1.useFloating({
|
|
3343
|
+
nodeId,
|
|
3344
|
+
strategy: "fixed",
|
|
3345
|
+
// TODO: probably some way with template string types to not need the "as Placement"
|
|
3346
|
+
placement: side + (align !== "center" ? "-" + align : ""),
|
|
3347
|
+
whileElementsMounted: react$1.autoUpdate,
|
|
3348
|
+
open,
|
|
3349
|
+
onOpenChange: setOpen,
|
|
3350
|
+
middleware: [
|
|
3351
|
+
react$1.offset({ mainAxis: offset ?? DEFAULT_OFFSET }),
|
|
3352
|
+
react$1.size({
|
|
3353
|
+
apply({ availableHeight, elements }) {
|
|
3354
|
+
elements.floating.style.setProperty(
|
|
3355
|
+
"--overmap-menu-available-height",
|
|
3356
|
+
`${Math.max(availableHeight, MENU_MINIMUM_MAX_HEIGHT)}px`
|
|
3357
|
+
);
|
|
3358
|
+
},
|
|
3359
|
+
padding: MENU_OVERFLOW_PADDING
|
|
3360
|
+
}),
|
|
3361
|
+
react$1.flip({ fallbackStrategy: "initialPlacement" }),
|
|
3362
|
+
react$1.shift({ padding: MENU_OVERFLOW_PADDING }),
|
|
3363
|
+
react$1.hide()
|
|
3364
|
+
]
|
|
3365
|
+
});
|
|
3366
|
+
const role = react$1.useRole(context, {
|
|
3367
|
+
role: "menu"
|
|
3368
|
+
});
|
|
3369
|
+
const dismiss = react$1.useDismiss(context, {
|
|
3370
|
+
capture: true,
|
|
3371
|
+
ancestorScroll: triggerType === "context" || triggerType === "virtual"
|
|
3372
|
+
});
|
|
3373
|
+
const click = react$1.useClick(context, {
|
|
3374
|
+
enabled: triggerType === "click"
|
|
3375
|
+
});
|
|
3376
|
+
const listNavigation = react$1.useListNavigation(context, {
|
|
3377
|
+
listRef: elementsRef,
|
|
3378
|
+
activeIndex,
|
|
3379
|
+
onNavigate: setActiveIndex,
|
|
3380
|
+
loop
|
|
3381
|
+
});
|
|
3382
|
+
const { getFloatingProps, getItemProps, getReferenceProps } = react$1.useInteractions([
|
|
3383
|
+
dismiss,
|
|
3384
|
+
listNavigation,
|
|
3385
|
+
click,
|
|
3386
|
+
role
|
|
3387
|
+
]);
|
|
3388
|
+
return /* @__PURE__ */ jsxRuntime.jsx(react$1.FloatingTree, { children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
3389
|
+
MenuContext.Provider,
|
|
3390
|
+
{
|
|
3391
|
+
value: {
|
|
3392
|
+
open,
|
|
3393
|
+
setOpen,
|
|
3394
|
+
refs,
|
|
3395
|
+
context,
|
|
3396
|
+
floatingStyles,
|
|
3397
|
+
elementsRef,
|
|
3398
|
+
getFloatingProps,
|
|
3399
|
+
getItemProps,
|
|
3400
|
+
getReferenceProps,
|
|
3401
|
+
nodeId,
|
|
3402
|
+
activeIndex,
|
|
3403
|
+
setActiveIndex,
|
|
3404
|
+
middlewareData,
|
|
3405
|
+
side,
|
|
3406
|
+
modal,
|
|
3407
|
+
setTriggerType
|
|
3408
|
+
},
|
|
3409
|
+
children
|
|
3410
|
+
}
|
|
3411
|
+
) });
|
|
3412
|
+
});
|
|
3413
|
+
MenuRoot.displayName = "Root";
|
|
3414
|
+
const MenuScroll = react.memo((props) => {
|
|
3629
3415
|
const { ref, className, ...rest } = props;
|
|
3630
3416
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
3631
3417
|
"div",
|
|
@@ -3642,13 +3428,13 @@
|
|
|
3642
3428
|
MenuScroll.displayName = "MenuScroll";
|
|
3643
3429
|
const MenuSelectAllItem = genericMemo((props) => {
|
|
3644
3430
|
const { ref, children, onSelect, closeOnSelect = false, ...rest } = props;
|
|
3645
|
-
const { allSelected, someSelected, toggleSelectAll } =
|
|
3431
|
+
const { allSelected, someSelected, toggleSelectAll } = react.use(MultiSelectContext);
|
|
3646
3432
|
const selectedState = allSelected ? true : someSelected ? "indeterminate" : false;
|
|
3647
|
-
const handleSelect =
|
|
3433
|
+
const handleSelect = react.useCallback(() => {
|
|
3648
3434
|
onSelect == null ? void 0 : onSelect();
|
|
3649
3435
|
toggleSelectAll();
|
|
3650
3436
|
}, [onSelect, toggleSelectAll]);
|
|
3651
|
-
const computedChildren =
|
|
3437
|
+
const computedChildren = react.useMemo(() => {
|
|
3652
3438
|
return typeof children === "function" ? ({ active }) => children({ selected: selectedState, active }) : children;
|
|
3653
3439
|
}, [children, selectedState]);
|
|
3654
3440
|
return /* @__PURE__ */ jsxRuntime.jsx(CheckedIndicatorContext, { value: selectedState, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
@@ -3663,6 +3449,11 @@
|
|
|
3663
3449
|
}
|
|
3664
3450
|
) });
|
|
3665
3451
|
});
|
|
3452
|
+
const MenuSelectedIndicator = react.memo((props) => {
|
|
3453
|
+
const { ref, children, ...rest } = props;
|
|
3454
|
+
return /* @__PURE__ */ jsxRuntime.jsx(SelectedIndicator, { ref, ...rest, children });
|
|
3455
|
+
});
|
|
3456
|
+
MenuSelectedIndicator.displayName = "MenuSelectedIndicator";
|
|
3666
3457
|
const MenuSelectGroup = genericMemo(function MenuSelectGroup2(props) {
|
|
3667
3458
|
const { ref, children, required, defaultValue, value, onValueChange, ...rest } = props;
|
|
3668
3459
|
return /* @__PURE__ */ jsxRuntime.jsx(MenuGroup, { ref, ...rest, children: required ? /* @__PURE__ */ jsxRuntime.jsx(SingleSelectRequiredProvider, { defaultValue, value, onValueChange, children }) : /* @__PURE__ */ jsxRuntime.jsx(
|
|
@@ -3677,13 +3468,13 @@
|
|
|
3677
3468
|
});
|
|
3678
3469
|
const MenuSelectItem = genericMemo(function(props) {
|
|
3679
3470
|
const { ref, value, onSelect, children, closeOnSelect = true, ...rest } = props;
|
|
3680
|
-
const { selected, selectValue } =
|
|
3681
|
-
const isSelected =
|
|
3682
|
-
const handleSelect =
|
|
3471
|
+
const { selected, selectValue } = react.use(SelectContext);
|
|
3472
|
+
const isSelected = selected(value);
|
|
3473
|
+
const handleSelect = react.useCallback(() => {
|
|
3683
3474
|
onSelect == null ? void 0 : onSelect();
|
|
3684
3475
|
selectValue(value);
|
|
3685
3476
|
}, [onSelect, selectValue, value]);
|
|
3686
|
-
const computedChildren =
|
|
3477
|
+
const computedChildren = react.useMemo(() => {
|
|
3687
3478
|
return typeof children === "function" ? ({ active }) => children({ selected: isSelected, active }) : children;
|
|
3688
3479
|
}, [children, isSelected]);
|
|
3689
3480
|
return /* @__PURE__ */ jsxRuntime.jsx(SelectedIndicatorContext.Provider, { value: isSelected, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
@@ -3699,23 +3490,140 @@
|
|
|
3699
3490
|
}
|
|
3700
3491
|
) });
|
|
3701
3492
|
});
|
|
3702
|
-
const MenuSeparator =
|
|
3493
|
+
const MenuSeparator = react.memo((props) => {
|
|
3703
3494
|
const { ref, className, ...rest } = props;
|
|
3704
|
-
const { size } =
|
|
3495
|
+
const { size } = react.use(MenuContentContext);
|
|
3705
3496
|
return /* @__PURE__ */ jsxRuntime.jsx(RadixSeparator__namespace.Root, { className: classVarianceAuthority.cx(menuSeparator({ size }), className), ref, ...rest });
|
|
3706
3497
|
});
|
|
3707
3498
|
MenuSeparator.displayName = "MenuSeparator";
|
|
3708
|
-
const
|
|
3709
|
-
|
|
3710
|
-
|
|
3711
|
-
|
|
3712
|
-
|
|
3713
|
-
|
|
3714
|
-
|
|
3715
|
-
|
|
3716
|
-
|
|
3717
|
-
|
|
3718
|
-
|
|
3499
|
+
const computeOffsets = (side, alignment) => {
|
|
3500
|
+
switch (side) {
|
|
3501
|
+
case "right":
|
|
3502
|
+
if (alignment === "start") {
|
|
3503
|
+
return { mainAxis: MENU_CONTENT_PADDING + 1, crossAxis: -MENU_CONTENT_PADDING };
|
|
3504
|
+
} else if (alignment === "end") {
|
|
3505
|
+
return { mainAxis: MENU_CONTENT_PADDING + 1, crossAxis: MENU_CONTENT_PADDING };
|
|
3506
|
+
}
|
|
3507
|
+
break;
|
|
3508
|
+
case "left":
|
|
3509
|
+
if (alignment === "start") {
|
|
3510
|
+
return { mainAxis: MENU_CONTENT_PADDING + 1, crossAxis: -MENU_CONTENT_PADDING };
|
|
3511
|
+
} else if (alignment === "end") {
|
|
3512
|
+
return { mainAxis: MENU_CONTENT_PADDING + 1, crossAxis: MENU_CONTENT_PADDING };
|
|
3513
|
+
}
|
|
3514
|
+
break;
|
|
3515
|
+
}
|
|
3516
|
+
return { mainAxis: MENU_CONTENT_PADDING + 1, crossAxis: 0 };
|
|
3517
|
+
};
|
|
3518
|
+
const MenuSub = react.memo((props) => {
|
|
3519
|
+
const {
|
|
3520
|
+
children,
|
|
3521
|
+
disabled = false,
|
|
3522
|
+
side = "right",
|
|
3523
|
+
align = "start",
|
|
3524
|
+
closeRoot = false,
|
|
3525
|
+
loop = false,
|
|
3526
|
+
modal = false,
|
|
3527
|
+
// open state related props
|
|
3528
|
+
open: controlledOpen,
|
|
3529
|
+
onOpenChange,
|
|
3530
|
+
defaultOpen
|
|
3531
|
+
} = props;
|
|
3532
|
+
const [open, setOpen] = useControlledState(defaultOpen ?? false, controlledOpen, onOpenChange);
|
|
3533
|
+
const nodeId = react$1.useFloatingNodeId();
|
|
3534
|
+
const { refs, floatingStyles, context } = react$1.useFloating({
|
|
3535
|
+
nodeId,
|
|
3536
|
+
strategy: "fixed",
|
|
3537
|
+
whileElementsMounted: react$1.autoUpdate,
|
|
3538
|
+
open,
|
|
3539
|
+
onOpenChange: (open2, _event, reason) => {
|
|
3540
|
+
if (reason) setOpen(open2);
|
|
3541
|
+
},
|
|
3542
|
+
placement: side + (align !== "center" ? "-" + align : ""),
|
|
3543
|
+
middleware: [
|
|
3544
|
+
react$1.offset({ ...computeOffsets(side, align) }),
|
|
3545
|
+
react$1.size({
|
|
3546
|
+
padding: MENU_OVERFLOW_PADDING,
|
|
3547
|
+
apply({ availableHeight, elements }) {
|
|
3548
|
+
elements.floating.style.setProperty(
|
|
3549
|
+
"--overmap-menu-available-height",
|
|
3550
|
+
`${Math.max(availableHeight, MENU_MINIMUM_MAX_HEIGHT)}px`
|
|
3551
|
+
);
|
|
3552
|
+
}
|
|
3553
|
+
}),
|
|
3554
|
+
react$1.flip(),
|
|
3555
|
+
react$1.shift({ padding: MENU_OVERFLOW_PADDING }),
|
|
3556
|
+
react$1.hide()
|
|
3557
|
+
]
|
|
3558
|
+
});
|
|
3559
|
+
const dismiss = react$1.useDismiss(context, {
|
|
3560
|
+
bubbles: closeRoot,
|
|
3561
|
+
outsidePress: closeRoot
|
|
3562
|
+
});
|
|
3563
|
+
const hover = react$1.useHover(context, {
|
|
3564
|
+
restMs: 50,
|
|
3565
|
+
handleClose: react$1.safePolygon({
|
|
3566
|
+
blockPointerEvents: true,
|
|
3567
|
+
requireIntent: false
|
|
3568
|
+
}),
|
|
3569
|
+
enabled: !disabled
|
|
3570
|
+
});
|
|
3571
|
+
const click = react$1.useClick(context, {
|
|
3572
|
+
enabled: !disabled
|
|
3573
|
+
});
|
|
3574
|
+
const elementsRef = react.useRef([]);
|
|
3575
|
+
const [activeIndex, setActiveIndex] = react.useState(null);
|
|
3576
|
+
const listNavigation = react$1.useListNavigation(context, {
|
|
3577
|
+
listRef: elementsRef,
|
|
3578
|
+
nested: true,
|
|
3579
|
+
activeIndex,
|
|
3580
|
+
onNavigate: setActiveIndex,
|
|
3581
|
+
loop,
|
|
3582
|
+
rtl: side === "left"
|
|
3583
|
+
});
|
|
3584
|
+
const { getFloatingProps, getItemProps, getReferenceProps } = react$1.useInteractions([
|
|
3585
|
+
listNavigation,
|
|
3586
|
+
dismiss,
|
|
3587
|
+
hover,
|
|
3588
|
+
click
|
|
3589
|
+
]);
|
|
3590
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
3591
|
+
SubContext.Provider,
|
|
3592
|
+
{
|
|
3593
|
+
value: {
|
|
3594
|
+
open,
|
|
3595
|
+
setOpen,
|
|
3596
|
+
nodeId,
|
|
3597
|
+
refs,
|
|
3598
|
+
floatingStyles,
|
|
3599
|
+
context,
|
|
3600
|
+
elementsRef,
|
|
3601
|
+
activeIndex,
|
|
3602
|
+
setActiveIndex,
|
|
3603
|
+
getFloatingProps,
|
|
3604
|
+
getItemProps,
|
|
3605
|
+
getReferenceProps,
|
|
3606
|
+
disabled,
|
|
3607
|
+
side,
|
|
3608
|
+
closeRoot,
|
|
3609
|
+
modal
|
|
3610
|
+
},
|
|
3611
|
+
children
|
|
3612
|
+
}
|
|
3613
|
+
);
|
|
3614
|
+
});
|
|
3615
|
+
MenuSub.displayName = "SubMenu";
|
|
3616
|
+
const MenuSubContent = react.memo((props) => {
|
|
3617
|
+
var _a;
|
|
3618
|
+
const { ref: forwardedRef, children, ...rest } = props;
|
|
3619
|
+
const { middlewareData } = react.use(MenuContext);
|
|
3620
|
+
const { accentColor, radius, variant, size } = react.use(MenuContentContext);
|
|
3621
|
+
const {
|
|
3622
|
+
open,
|
|
3623
|
+
nodeId,
|
|
3624
|
+
refs,
|
|
3625
|
+
context,
|
|
3626
|
+
getFloatingProps,
|
|
3719
3627
|
getItemProps,
|
|
3720
3628
|
activeIndex,
|
|
3721
3629
|
setActiveIndex,
|
|
@@ -3723,17 +3631,17 @@
|
|
|
3723
3631
|
floatingStyles,
|
|
3724
3632
|
setOpen,
|
|
3725
3633
|
side
|
|
3726
|
-
} =
|
|
3727
|
-
const wrapperRef =
|
|
3728
|
-
const mergeRefs2 = react.useMergeRefs([refs.setFloating, wrapperRef]);
|
|
3729
|
-
const computedFloatingStyles =
|
|
3634
|
+
} = react.use(SubContext);
|
|
3635
|
+
const wrapperRef = react.useRef(null);
|
|
3636
|
+
const mergeRefs2 = react$1.useMergeRefs([refs.setFloating, wrapperRef]);
|
|
3637
|
+
const computedFloatingStyles = react.useMemo(() => {
|
|
3730
3638
|
var _a2;
|
|
3731
3639
|
return {
|
|
3732
3640
|
...floatingStyles,
|
|
3733
3641
|
visibility: ((_a2 = middlewareData.hide) == null ? void 0 : _a2.referenceHidden) ? "hidden" : "visible"
|
|
3734
3642
|
};
|
|
3735
3643
|
}, [floatingStyles, (_a = middlewareData.hide) == null ? void 0 : _a.referenceHidden]);
|
|
3736
|
-
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(
|
|
3644
|
+
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(
|
|
3737
3645
|
MenuContentContext.Provider,
|
|
3738
3646
|
{
|
|
3739
3647
|
value: {
|
|
@@ -3749,158 +3657,843 @@
|
|
|
3749
3657
|
accentColor,
|
|
3750
3658
|
variant
|
|
3751
3659
|
},
|
|
3752
|
-
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
3753
|
-
"div",
|
|
3754
|
-
{
|
|
3755
|
-
className: "outline-none",
|
|
3756
|
-
ref: mergeRefs2,
|
|
3757
|
-
style: computedFloatingStyles,
|
|
3758
|
-
...getFloatingProps(),
|
|
3759
|
-
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
3760
|
-
"ul",
|
|
3761
|
-
{
|
|
3762
|
-
className: classVarianceAuthority.cx(
|
|
3763
|
-
"overmap-menu-sub-content",
|
|
3764
|
-
menuContent({ size }),
|
|
3765
|
-
floating({ side, shadow: "3" }),
|
|
3766
|
-
radiusCva({ radius, maxLarge: true }),
|
|
3767
|
-
"max-h-(--overmap-menu-available-height)"
|
|
3768
|
-
),
|
|
3769
|
-
ref: forwardedRef,
|
|
3770
|
-
"data-state": getOpenState(open),
|
|
3771
|
-
"data-side": side,
|
|
3772
|
-
"data-accent-color": accentColor,
|
|
3773
|
-
...rest,
|
|
3774
|
-
children
|
|
3775
|
-
}
|
|
3776
|
-
)
|
|
3777
|
-
}
|
|
3778
|
-
)
|
|
3660
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
3661
|
+
"div",
|
|
3662
|
+
{
|
|
3663
|
+
className: "outline-none",
|
|
3664
|
+
ref: mergeRefs2,
|
|
3665
|
+
style: computedFloatingStyles,
|
|
3666
|
+
...getFloatingProps(),
|
|
3667
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
3668
|
+
"ul",
|
|
3669
|
+
{
|
|
3670
|
+
className: classVarianceAuthority.cx(
|
|
3671
|
+
"overmap-menu-sub-content",
|
|
3672
|
+
menuContent({ size }),
|
|
3673
|
+
floating({ side, shadow: "3" }),
|
|
3674
|
+
radiusCva({ radius, maxLarge: true }),
|
|
3675
|
+
"max-h-(--overmap-menu-available-height)"
|
|
3676
|
+
),
|
|
3677
|
+
ref: forwardedRef,
|
|
3678
|
+
"data-state": getOpenState(open),
|
|
3679
|
+
"data-side": side,
|
|
3680
|
+
"data-accent-color": accentColor,
|
|
3681
|
+
...rest,
|
|
3682
|
+
children
|
|
3683
|
+
}
|
|
3684
|
+
)
|
|
3685
|
+
}
|
|
3686
|
+
)
|
|
3687
|
+
}
|
|
3688
|
+
) }) }) }) });
|
|
3689
|
+
});
|
|
3690
|
+
MenuSubContent.displayName = "MenuSubContent";
|
|
3691
|
+
const MenuSubTrigger = react.memo((props) => {
|
|
3692
|
+
const { ref: forwardedRef, children, ...rest } = props;
|
|
3693
|
+
const { refs, getReferenceProps, open, disabled } = react.use(SubContext);
|
|
3694
|
+
const mergedRefs = react$1.useMergeRefs([forwardedRef, refs.setReference]);
|
|
3695
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
3696
|
+
MenuItem,
|
|
3697
|
+
{
|
|
3698
|
+
ref: mergedRefs,
|
|
3699
|
+
closeOnSelect: false,
|
|
3700
|
+
"aria-haspopup": "menu",
|
|
3701
|
+
"data-state": getOpenState(open),
|
|
3702
|
+
disabled,
|
|
3703
|
+
...getReferenceProps(rest),
|
|
3704
|
+
children
|
|
3705
|
+
}
|
|
3706
|
+
);
|
|
3707
|
+
});
|
|
3708
|
+
MenuSubTrigger.displayName = "MenuSubTrigger";
|
|
3709
|
+
const MenuVirtualTrigger = react.memo((props) => {
|
|
3710
|
+
const { virtualElement, disabled } = props;
|
|
3711
|
+
const { refs, setTriggerType, setOpen } = react.use(MenuContext);
|
|
3712
|
+
react.useEffect(() => {
|
|
3713
|
+
setTriggerType("virtual");
|
|
3714
|
+
}, [setTriggerType]);
|
|
3715
|
+
react.useEffect(() => {
|
|
3716
|
+
if (!disabled && virtualElement) {
|
|
3717
|
+
refs.setPositionReference(virtualElement);
|
|
3718
|
+
setOpen(true);
|
|
3719
|
+
} else {
|
|
3720
|
+
refs.setPositionReference(null);
|
|
3721
|
+
setOpen(false);
|
|
3722
|
+
}
|
|
3723
|
+
}, [disabled, refs, setOpen, virtualElement]);
|
|
3724
|
+
return null;
|
|
3725
|
+
});
|
|
3726
|
+
MenuVirtualTrigger.displayName = "VirtualTrigger";
|
|
3727
|
+
const Menu = {
|
|
3728
|
+
Root: MenuRoot,
|
|
3729
|
+
Content: MenuContent,
|
|
3730
|
+
// sub
|
|
3731
|
+
Sub: MenuSub,
|
|
3732
|
+
SubContent: MenuSubContent,
|
|
3733
|
+
SubTrigger: MenuSubTrigger,
|
|
3734
|
+
// pages
|
|
3735
|
+
Pages: MenuPages,
|
|
3736
|
+
PageContent: MenuPageContent,
|
|
3737
|
+
PageTrigger: MenuPageTrigger,
|
|
3738
|
+
// triggers
|
|
3739
|
+
ClickTrigger: MenuClickTrigger,
|
|
3740
|
+
ContextTrigger: MenuContextTrigger,
|
|
3741
|
+
VirtualTrigger: MenuVirtualTrigger,
|
|
3742
|
+
// groups
|
|
3743
|
+
Group: MenuGroup,
|
|
3744
|
+
SelectGroup: MenuSelectGroup,
|
|
3745
|
+
MultiSelectGroup: MenuMultiSelectGroup,
|
|
3746
|
+
// items
|
|
3747
|
+
Item: MenuItem,
|
|
3748
|
+
SelectItem: MenuSelectItem,
|
|
3749
|
+
MultiSelectItem: MenuMultiSelectItem,
|
|
3750
|
+
SelectAllItem: MenuSelectAllItem,
|
|
3751
|
+
CheckboxItem: MenuCheckboxItem,
|
|
3752
|
+
// indicators
|
|
3753
|
+
SelectedIndicator: MenuSelectedIndicator,
|
|
3754
|
+
CheckboxItemIndicator: MenuCheckboxItemIndicator,
|
|
3755
|
+
// input
|
|
3756
|
+
InputRoot: MenuInputRoot,
|
|
3757
|
+
InputField: MenuInputField,
|
|
3758
|
+
InputSlot: MenuInputSlot,
|
|
3759
|
+
// others
|
|
3760
|
+
Label: MenuLabel,
|
|
3761
|
+
Separator: MenuSeparator,
|
|
3762
|
+
Scroll: MenuScroll
|
|
3763
|
+
};
|
|
3764
|
+
const KEY_MAPPING = {
|
|
3765
|
+
next: "ArrowDown",
|
|
3766
|
+
prev: "ArrowUp",
|
|
3767
|
+
first: "PageUp",
|
|
3768
|
+
last: "PageDown",
|
|
3769
|
+
selectItem: "Enter"
|
|
3770
|
+
};
|
|
3771
|
+
const ITEM_SELECTOR = "menu-item";
|
|
3772
|
+
const GROUP_SELECTOR = "menu-group";
|
|
3773
|
+
const MenuRootContext = react.createContext({});
|
|
3774
|
+
const MenuGroupContext = react.createContext({});
|
|
3775
|
+
const MenuPageContext = react.createContext({});
|
|
3776
|
+
const menuRootCva = classVarianceAuthority.cva(["w-full", "outline-none"], {
|
|
3777
|
+
variants: {
|
|
3778
|
+
size: {
|
|
3779
|
+
xs: ["p-0.5", "text-xs", "min-w-30"],
|
|
3780
|
+
sm: ["p-0.75", "text-sm", "min-w-35"],
|
|
3781
|
+
md: ["p-1", "text-md", "min-w-40"],
|
|
3782
|
+
lg: ["p-1.25", "text-lg", "min-w-45"],
|
|
3783
|
+
xl: ["p-1.5", "text-xl", "min-w-50"]
|
|
3784
|
+
},
|
|
3785
|
+
radius: {
|
|
3786
|
+
none: ["rounded-none"],
|
|
3787
|
+
xs: ["rounded-xs"],
|
|
3788
|
+
sm: ["rounded-sm"],
|
|
3789
|
+
md: ["rounded-md"],
|
|
3790
|
+
lg: ["rounded-lg"],
|
|
3791
|
+
xl: ["rounded-lg"],
|
|
3792
|
+
full: ["rounded-lg"]
|
|
3793
|
+
}
|
|
3794
|
+
}
|
|
3795
|
+
});
|
|
3796
|
+
const menuItemCva = classVarianceAuthority.cva(
|
|
3797
|
+
[
|
|
3798
|
+
"select-none",
|
|
3799
|
+
"relative",
|
|
3800
|
+
"flex",
|
|
3801
|
+
"items-center",
|
|
3802
|
+
"outline-none",
|
|
3803
|
+
"data-[disabled=true]:text-(--base-a8)",
|
|
3804
|
+
"data-[disabled=true]:pointer-events-none",
|
|
3805
|
+
"shrink-0",
|
|
3806
|
+
"py-1",
|
|
3807
|
+
"text-(--base-12)"
|
|
3808
|
+
],
|
|
3809
|
+
{
|
|
3810
|
+
variants: {
|
|
3811
|
+
size: {
|
|
3812
|
+
xs: ["gap-1.5", "px-3"],
|
|
3813
|
+
sm: ["gap-1.75", "px-3.5"],
|
|
3814
|
+
md: ["gap-2", "px-4"],
|
|
3815
|
+
lg: ["gap-2.25", "px-4.5"],
|
|
3816
|
+
xl: ["gap-2.5", "px-5"]
|
|
3817
|
+
},
|
|
3818
|
+
variant: {
|
|
3819
|
+
solid: [
|
|
3820
|
+
"data-[active=true]:not-[data-[disabled=true]]:text-(--accent-contrast)",
|
|
3821
|
+
"data-[active=true]:not-[data-[disabled=true]]:bg-(--accent-a9)",
|
|
3822
|
+
"data-[active=true]:not-[data-[disabled=true]]:active:brightness-110"
|
|
3823
|
+
],
|
|
3824
|
+
soft: [
|
|
3825
|
+
"data-[active=true]:not-[data-[disabled=true]]:bg-(--accent-a3)",
|
|
3826
|
+
"data-[active=true]:not-[data-[disabled=true]]:active:bg-(--accent-a4)"
|
|
3827
|
+
]
|
|
3828
|
+
}
|
|
3829
|
+
}
|
|
3830
|
+
}
|
|
3831
|
+
);
|
|
3832
|
+
const menuGroupLabelCva = classVarianceAuthority.cva(["text-(--base-a11)", "flex", "items-center", "select-none", "py-1"], {
|
|
3833
|
+
variants: {
|
|
3834
|
+
size: {
|
|
3835
|
+
xs: ["gap-1.5", "px-3", "text-xs"],
|
|
3836
|
+
sm: ["gap-1.75", "px-3.5", "text-xs"],
|
|
3837
|
+
md: ["gap-2", "px-4", "text-sm"],
|
|
3838
|
+
lg: ["gap-2.25", "px-4.5", "text-base"],
|
|
3839
|
+
xl: ["gap-2.5", "px-5", "text-lg"]
|
|
3840
|
+
}
|
|
3841
|
+
}
|
|
3842
|
+
});
|
|
3843
|
+
const menuSeparatorCva = classVarianceAuthority.cva(["h-px", "bg-(--base-a6)", "w-auto", "shrink-0"], {
|
|
3844
|
+
variants: {
|
|
3845
|
+
size: {
|
|
3846
|
+
xs: ["-mx-0.5", "my-0.5"],
|
|
3847
|
+
sm: ["-mx-0.75", "my-0.75"],
|
|
3848
|
+
md: ["-mx-1", "my-1"],
|
|
3849
|
+
lg: ["-mx-1.25", "my-1.25"],
|
|
3850
|
+
xl: ["-mx-1.5", "my-1.5"]
|
|
3851
|
+
}
|
|
3852
|
+
}
|
|
3853
|
+
});
|
|
3854
|
+
const MenuV2Item = react.memo((props) => {
|
|
3855
|
+
const {
|
|
3856
|
+
ref,
|
|
3857
|
+
children,
|
|
3858
|
+
className,
|
|
3859
|
+
disabled = false,
|
|
3860
|
+
onClick,
|
|
3861
|
+
onSelect,
|
|
3862
|
+
onPointerEnter,
|
|
3863
|
+
onPointerLeave,
|
|
3864
|
+
onPointerMove,
|
|
3865
|
+
...rest
|
|
3866
|
+
} = props;
|
|
3867
|
+
const internalRef = react.useRef(null);
|
|
3868
|
+
const itemId = react.useId();
|
|
3869
|
+
const { activeItemId, setActiveItemId, size, variant, radius } = react.use(MenuRootContext);
|
|
3870
|
+
const isActive = itemId === activeItemId;
|
|
3871
|
+
const handleSelect = react.useCallback(
|
|
3872
|
+
(e) => {
|
|
3873
|
+
onSelect == null ? void 0 : onSelect(e);
|
|
3874
|
+
},
|
|
3875
|
+
[onSelect]
|
|
3876
|
+
);
|
|
3877
|
+
const handleClick = react.useCallback(
|
|
3878
|
+
(e) => {
|
|
3879
|
+
onClick == null ? void 0 : onClick(e);
|
|
3880
|
+
handleSelect(new Event("menu-select"));
|
|
3881
|
+
},
|
|
3882
|
+
[handleSelect, onClick]
|
|
3883
|
+
);
|
|
3884
|
+
const handlePointerEnter = react.useCallback(
|
|
3885
|
+
(e) => {
|
|
3886
|
+
onPointerEnter == null ? void 0 : onPointerEnter(e);
|
|
3887
|
+
if (e.defaultPrevented) return;
|
|
3888
|
+
setActiveItemId(itemId);
|
|
3889
|
+
},
|
|
3890
|
+
[onPointerEnter, setActiveItemId, itemId]
|
|
3891
|
+
);
|
|
3892
|
+
const handlePointerLeave = react.useCallback(
|
|
3893
|
+
(e) => {
|
|
3894
|
+
onPointerLeave == null ? void 0 : onPointerLeave(e);
|
|
3895
|
+
if (e.defaultPrevented) return;
|
|
3896
|
+
setActiveItemId(null);
|
|
3897
|
+
},
|
|
3898
|
+
[onPointerLeave, setActiveItemId]
|
|
3899
|
+
);
|
|
3900
|
+
const handlePointerMove = react.useCallback(
|
|
3901
|
+
(e) => {
|
|
3902
|
+
onPointerMove == null ? void 0 : onPointerMove(e);
|
|
3903
|
+
if (e.defaultPrevented) return;
|
|
3904
|
+
setActiveItemId(itemId);
|
|
3905
|
+
},
|
|
3906
|
+
[onPointerMove, itemId, setActiveItemId]
|
|
3907
|
+
);
|
|
3908
|
+
react.useEffect(() => {
|
|
3909
|
+
if (!internalRef.current) return;
|
|
3910
|
+
const element = internalRef.current;
|
|
3911
|
+
element.addEventListener("menu-select", handleSelect);
|
|
3912
|
+
return () => {
|
|
3913
|
+
element.removeEventListener("menu-select", handleSelect);
|
|
3914
|
+
};
|
|
3915
|
+
}, [handleSelect]);
|
|
3916
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
3917
|
+
"div",
|
|
3918
|
+
{
|
|
3919
|
+
ref: mergeRefs([ref, internalRef]),
|
|
3920
|
+
className: classVarianceAuthority.cx(menuItemCva({ size, variant }), radiusCva({ radius, maxLarge: true }), className),
|
|
3921
|
+
role: "menuitem",
|
|
3922
|
+
onClick: handleClick,
|
|
3923
|
+
onPointerEnter: handlePointerEnter,
|
|
3924
|
+
onPointerLeave: handlePointerLeave,
|
|
3925
|
+
onPointerMove: handlePointerMove,
|
|
3926
|
+
...{ [ITEM_SELECTOR]: itemId },
|
|
3927
|
+
"data-active": getBooleanState(isActive),
|
|
3928
|
+
"data-disabled": getBooleanState(disabled),
|
|
3929
|
+
"aria-disabled": getBooleanState(disabled),
|
|
3930
|
+
...rest,
|
|
3931
|
+
children
|
|
3932
|
+
}
|
|
3933
|
+
);
|
|
3934
|
+
});
|
|
3935
|
+
MenuV2Item.displayName = "MenuItem";
|
|
3936
|
+
const MenuV2CheckboxItem = react.memo((props) => {
|
|
3937
|
+
const { ref, checked, onCheckedChange, onSelect, ...rest } = props;
|
|
3938
|
+
const handleSelect = react.useCallback(
|
|
3939
|
+
(e) => {
|
|
3940
|
+
onSelect == null ? void 0 : onSelect(e);
|
|
3941
|
+
if (e.defaultPrevented) return;
|
|
3942
|
+
switch (checked) {
|
|
3943
|
+
case true:
|
|
3944
|
+
onCheckedChange(false);
|
|
3945
|
+
break;
|
|
3946
|
+
case "indeterminate":
|
|
3947
|
+
onCheckedChange(true);
|
|
3948
|
+
break;
|
|
3949
|
+
case false:
|
|
3950
|
+
onCheckedChange(true);
|
|
3951
|
+
break;
|
|
3952
|
+
}
|
|
3953
|
+
},
|
|
3954
|
+
[checked, onCheckedChange, onSelect]
|
|
3955
|
+
);
|
|
3956
|
+
return /* @__PURE__ */ jsxRuntime.jsx(CheckedIndicatorContext.Provider, { value: checked, children: /* @__PURE__ */ jsxRuntime.jsx(MenuV2Item, { ref, onSelect: handleSelect, ...rest }) });
|
|
3957
|
+
});
|
|
3958
|
+
MenuV2CheckboxItem.displayName = "MenuCheckboxItem";
|
|
3959
|
+
const MenuV2CheckedIndicator = react.memo((props) => {
|
|
3960
|
+
const { ref, children, ...rest } = props;
|
|
3961
|
+
return /* @__PURE__ */ jsxRuntime.jsx(CheckedIndicator, { ref, ...rest, children });
|
|
3962
|
+
});
|
|
3963
|
+
MenuV2CheckedIndicator.displayName = "MenuCheckboxItemIndicator";
|
|
3964
|
+
const MenuV2Group = react.memo((props) => {
|
|
3965
|
+
const { ref, children, ...rest } = props;
|
|
3966
|
+
const groupId = react.useId();
|
|
3967
|
+
const [labelId, setLabelId] = react.useState(null);
|
|
3968
|
+
const contextValue = react.useMemo(
|
|
3969
|
+
() => ({
|
|
3970
|
+
labelId,
|
|
3971
|
+
setLabelId
|
|
3972
|
+
}),
|
|
3973
|
+
[labelId]
|
|
3974
|
+
);
|
|
3975
|
+
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 }) });
|
|
3976
|
+
});
|
|
3977
|
+
MenuV2Group.displayName = "MenuGroup";
|
|
3978
|
+
const MenuV2GroupLabel = react.memo((props) => {
|
|
3979
|
+
const { ref, children, id, className, ...rest } = props;
|
|
3980
|
+
const labelId = useFallbackId(id);
|
|
3981
|
+
const { size } = react.use(MenuRootContext);
|
|
3982
|
+
const { setLabelId } = react.use(MenuGroupContext);
|
|
3983
|
+
react.useEffect(() => {
|
|
3984
|
+
setLabelId(labelId);
|
|
3985
|
+
}, [labelId, setLabelId]);
|
|
3986
|
+
return /* @__PURE__ */ jsxRuntime.jsx("div", { ref, id: labelId, className: classVarianceAuthority.cx(menuGroupLabelCva({ size }), className), ...rest, children });
|
|
3987
|
+
});
|
|
3988
|
+
MenuV2GroupLabel.displayName = "MenuGroupLabel";
|
|
3989
|
+
const MenuV2SelectAllItem = genericMemo((props) => {
|
|
3990
|
+
const { ref, children, onSelect, ...rest } = props;
|
|
3991
|
+
const { allSelected, someSelected, toggleSelectAll } = react.use(MultiSelectContext);
|
|
3992
|
+
const selectedState = allSelected ? true : someSelected ? "indeterminate" : false;
|
|
3993
|
+
const handleSelect = react.useCallback(
|
|
3994
|
+
(e) => {
|
|
3995
|
+
onSelect == null ? void 0 : onSelect(e);
|
|
3996
|
+
if (e.defaultPrevented) return;
|
|
3997
|
+
toggleSelectAll();
|
|
3998
|
+
},
|
|
3999
|
+
[onSelect, toggleSelectAll]
|
|
4000
|
+
);
|
|
4001
|
+
return /* @__PURE__ */ jsxRuntime.jsx(MenuV2Item, { onSelect: handleSelect, ref, "data-state": getCheckedState(selectedState), ...rest, children: /* @__PURE__ */ jsxRuntime.jsx(CheckedIndicatorContext, { value: selectedState, children }) });
|
|
4002
|
+
});
|
|
4003
|
+
const MenuV2MultiSelectGroup = genericMemo(function MenuMultiSelectGroup2(props) {
|
|
4004
|
+
const { ref, children, defaultValues, values, onValuesChange, ...rest } = props;
|
|
4005
|
+
return /* @__PURE__ */ jsxRuntime.jsx(MenuV2Group, { ref, ...rest, children: /* @__PURE__ */ jsxRuntime.jsx(MultiSelectProvider, { defaultValues, values, onValuesChange, children }) });
|
|
4006
|
+
});
|
|
4007
|
+
const MenuV2MultiSelectItem = genericMemo(function(props) {
|
|
4008
|
+
const { ref, onSelect, children, value, ...rest } = props;
|
|
4009
|
+
const { selected, selectValue, registerValue } = react.use(MultiSelectContext);
|
|
4010
|
+
react.useLayoutEffect(() => {
|
|
4011
|
+
return registerValue(value);
|
|
4012
|
+
}, [registerValue, value]);
|
|
4013
|
+
const isSelected = selected(value);
|
|
4014
|
+
const handleSelect = react.useCallback(
|
|
4015
|
+
(e) => {
|
|
4016
|
+
onSelect == null ? void 0 : onSelect(e);
|
|
4017
|
+
if (e.defaultPrevented) return;
|
|
4018
|
+
selectValue(value);
|
|
4019
|
+
},
|
|
4020
|
+
[onSelect, selectValue, value]
|
|
4021
|
+
);
|
|
4022
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
4023
|
+
MenuV2Item,
|
|
4024
|
+
{
|
|
4025
|
+
ref,
|
|
4026
|
+
role: "menuitemcheckbox",
|
|
4027
|
+
onSelect: handleSelect,
|
|
4028
|
+
"data-state": getSelectedState(isSelected),
|
|
4029
|
+
...rest,
|
|
4030
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(SelectedIndicatorContext, { value: isSelected, children })
|
|
4031
|
+
}
|
|
4032
|
+
);
|
|
4033
|
+
});
|
|
4034
|
+
const MenuV2Page = react.memo((props) => {
|
|
4035
|
+
const { children, ref, page, ...rest } = props;
|
|
4036
|
+
const { page: activePage } = react.use(MenuPageContext);
|
|
4037
|
+
const isActive = page === activePage;
|
|
4038
|
+
return /* @__PURE__ */ jsxRuntime.jsx("div", { ref, "data-active": getActiveState(isActive), hidden: !isActive, ...rest, children: isActive ? children : null });
|
|
4039
|
+
});
|
|
4040
|
+
MenuV2Page.displayName = "MenuPage";
|
|
4041
|
+
const MenuV2Pages = react.memo((props) => {
|
|
4042
|
+
const { children, defaultPage = "", page: controlledPage, onPageChange } = props;
|
|
4043
|
+
const [page, setPage] = useControlledState(defaultPage, controlledPage, onPageChange);
|
|
4044
|
+
const contextValue = react.useMemo(
|
|
4045
|
+
() => ({
|
|
4046
|
+
page,
|
|
4047
|
+
setPage
|
|
4048
|
+
}),
|
|
4049
|
+
[page, setPage]
|
|
4050
|
+
);
|
|
4051
|
+
return /* @__PURE__ */ jsxRuntime.jsx(MenuPageContext, { value: contextValue, children });
|
|
4052
|
+
});
|
|
4053
|
+
MenuV2Pages.displayName = "MenuPages";
|
|
4054
|
+
const MenuV2PageTriggerItem = react.memo((props) => {
|
|
4055
|
+
const { ref, children, page, onSelect, ...rest } = props;
|
|
4056
|
+
const { page: activePage, setPage } = react.use(MenuPageContext);
|
|
4057
|
+
const isActive = page === activePage;
|
|
4058
|
+
const handleSelect = react.useCallback(
|
|
4059
|
+
(e) => {
|
|
4060
|
+
onSelect == null ? void 0 : onSelect(e);
|
|
4061
|
+
if (e.defaultPrevented) return;
|
|
4062
|
+
setPage(page);
|
|
4063
|
+
},
|
|
4064
|
+
[onSelect, page, setPage]
|
|
4065
|
+
);
|
|
4066
|
+
return /* @__PURE__ */ jsxRuntime.jsx(MenuV2Item, { ref, onSelect: handleSelect, "data-state": getActiveState(isActive), ...rest, children: /* @__PURE__ */ jsxRuntime.jsx(SelectedIndicatorContext, { value: isActive, children }) });
|
|
4067
|
+
});
|
|
4068
|
+
MenuV2PageTriggerItem.displayName = "CommandMenuPageTriggerItem";
|
|
4069
|
+
const computeNextIndex = (index, length, direction, loop) => {
|
|
4070
|
+
switch (direction) {
|
|
4071
|
+
case "next":
|
|
4072
|
+
return index === length - 1 ? loop ? 0 : index : index + 1;
|
|
4073
|
+
case "prev":
|
|
4074
|
+
return index === 0 ? loop ? length - 1 : index : index - 1;
|
|
4075
|
+
}
|
|
4076
|
+
};
|
|
4077
|
+
const MenuV2Root = react.memo((props) => {
|
|
4078
|
+
const providerContext = useProvider();
|
|
4079
|
+
const {
|
|
4080
|
+
ref,
|
|
4081
|
+
children,
|
|
4082
|
+
className,
|
|
4083
|
+
onKeyDown,
|
|
4084
|
+
loop = false,
|
|
4085
|
+
// style props
|
|
4086
|
+
radius = providerContext.radius,
|
|
4087
|
+
accentColor = "base",
|
|
4088
|
+
size = "md",
|
|
4089
|
+
variant = "soft",
|
|
4090
|
+
...rest
|
|
4091
|
+
} = props;
|
|
4092
|
+
const internalRef = react.useRef(null);
|
|
4093
|
+
const [activeItemId, setActiveItemId] = react.useState(null);
|
|
4094
|
+
const getItems = react.useCallback((element) => {
|
|
4095
|
+
return Array.from(element.querySelectorAll(`[${ITEM_SELECTOR}]:not([data-disabled=true]`));
|
|
4096
|
+
}, []);
|
|
4097
|
+
const getFirstItem = react.useCallback(
|
|
4098
|
+
(element) => {
|
|
4099
|
+
return getItems(element).at(0);
|
|
4100
|
+
},
|
|
4101
|
+
[getItems]
|
|
4102
|
+
);
|
|
4103
|
+
const getLastItem = react.useCallback(
|
|
4104
|
+
(element) => {
|
|
4105
|
+
return getItems(element).at(-1);
|
|
4106
|
+
},
|
|
4107
|
+
[getItems]
|
|
4108
|
+
);
|
|
4109
|
+
const getActiveItem = react.useCallback(
|
|
4110
|
+
(element) => {
|
|
4111
|
+
return getItems(element).find((itemEle) => itemEle.getAttribute(ITEM_SELECTOR) === activeItemId);
|
|
4112
|
+
},
|
|
4113
|
+
[activeItemId, getItems]
|
|
4114
|
+
);
|
|
4115
|
+
const getNextItem = react.useCallback(
|
|
4116
|
+
(element, direction) => {
|
|
4117
|
+
const items = getItems(element);
|
|
4118
|
+
const activeItem = getActiveItem(element);
|
|
4119
|
+
const activeItemIndex = items.findIndex((itemEle) => itemEle === activeItem);
|
|
4120
|
+
const nextItemIndex = computeNextIndex(activeItemIndex, items.length, direction, loop);
|
|
4121
|
+
return items[nextItemIndex];
|
|
4122
|
+
},
|
|
4123
|
+
[getActiveItem, getItems, loop]
|
|
4124
|
+
);
|
|
4125
|
+
const getGroups = react.useCallback(() => {
|
|
4126
|
+
if (!internalRef.current) return [];
|
|
4127
|
+
return Array.from(internalRef.current.querySelectorAll(`[${GROUP_SELECTOR}]`));
|
|
4128
|
+
}, []);
|
|
4129
|
+
const getActiveGroup = react.useCallback(() => {
|
|
4130
|
+
var _a;
|
|
4131
|
+
return ((_a = getActiveItem(internalRef.current)) == null ? void 0 : _a.closest(`[${GROUP_SELECTOR}]`)) ?? void 0;
|
|
4132
|
+
}, [getActiveItem]);
|
|
4133
|
+
const getNextGroup = react.useCallback(
|
|
4134
|
+
(direction) => {
|
|
4135
|
+
const groups = getGroups();
|
|
4136
|
+
const activeGroup = getActiveGroup();
|
|
4137
|
+
const activeGroupIndex = groups.findIndex((groupEle) => groupEle === activeGroup);
|
|
4138
|
+
const nextGroupIndex = computeNextIndex(activeGroupIndex, groups.length, direction, loop);
|
|
4139
|
+
return groups[nextGroupIndex];
|
|
4140
|
+
},
|
|
4141
|
+
[getActiveGroup, getGroups, loop]
|
|
4142
|
+
);
|
|
4143
|
+
const getFirstGroup = react.useCallback(() => {
|
|
4144
|
+
return getGroups().at(0);
|
|
4145
|
+
}, [getGroups]);
|
|
4146
|
+
const getLastGroup = react.useCallback(() => {
|
|
4147
|
+
return getGroups().at(-1);
|
|
4148
|
+
}, [getGroups]);
|
|
4149
|
+
const handleKeyDown = react.useCallback(
|
|
4150
|
+
(e) => {
|
|
4151
|
+
onKeyDown == null ? void 0 : onKeyDown(e);
|
|
4152
|
+
if (e.defaultPrevented) return;
|
|
4153
|
+
switch (e.code) {
|
|
4154
|
+
case KEY_MAPPING.selectItem: {
|
|
4155
|
+
const activeItem = getActiveItem(internalRef.current);
|
|
4156
|
+
if (activeItem) activeItem.dispatchEvent(new Event("menu-select"));
|
|
4157
|
+
break;
|
|
4158
|
+
}
|
|
4159
|
+
case KEY_MAPPING.next: {
|
|
4160
|
+
let nextItem;
|
|
4161
|
+
if (e.shiftKey) {
|
|
4162
|
+
const nextGroup = getNextGroup("next");
|
|
4163
|
+
if (!nextGroup) return;
|
|
4164
|
+
nextItem = getFirstItem(nextGroup);
|
|
4165
|
+
} else {
|
|
4166
|
+
nextItem = getNextItem(internalRef.current, "next");
|
|
4167
|
+
}
|
|
4168
|
+
if (!nextItem) return;
|
|
4169
|
+
setActiveItemId(nextItem.getAttribute(ITEM_SELECTOR));
|
|
4170
|
+
break;
|
|
4171
|
+
}
|
|
4172
|
+
case KEY_MAPPING.prev: {
|
|
4173
|
+
let prevItem;
|
|
4174
|
+
if (e.shiftKey) {
|
|
4175
|
+
const prevGroup = getNextGroup("prev");
|
|
4176
|
+
if (!prevGroup) return;
|
|
4177
|
+
prevItem = getFirstItem(prevGroup);
|
|
4178
|
+
} else {
|
|
4179
|
+
prevItem = getNextItem(internalRef.current, "prev");
|
|
4180
|
+
}
|
|
4181
|
+
if (!prevItem) return;
|
|
4182
|
+
setActiveItemId(prevItem.getAttribute(ITEM_SELECTOR));
|
|
4183
|
+
break;
|
|
4184
|
+
}
|
|
4185
|
+
case KEY_MAPPING.first: {
|
|
4186
|
+
let firstItem;
|
|
4187
|
+
if (e.shiftKey) {
|
|
4188
|
+
const firstGroup = getFirstGroup();
|
|
4189
|
+
if (!firstGroup) return;
|
|
4190
|
+
firstItem = getFirstItem(firstGroup);
|
|
4191
|
+
} else {
|
|
4192
|
+
firstItem = getFirstItem(internalRef.current);
|
|
4193
|
+
}
|
|
4194
|
+
if (!firstItem) return;
|
|
4195
|
+
setActiveItemId(firstItem.getAttribute(ITEM_SELECTOR));
|
|
4196
|
+
break;
|
|
4197
|
+
}
|
|
4198
|
+
case KEY_MAPPING.last: {
|
|
4199
|
+
let lastItem;
|
|
4200
|
+
if (e.shiftKey) {
|
|
4201
|
+
const lastGroup = getLastGroup();
|
|
4202
|
+
if (!lastGroup) return;
|
|
4203
|
+
lastItem = getFirstItem(lastGroup);
|
|
4204
|
+
} else {
|
|
4205
|
+
lastItem = getLastItem(internalRef.current);
|
|
4206
|
+
}
|
|
4207
|
+
if (!lastItem) return;
|
|
4208
|
+
setActiveItemId(lastItem.getAttribute(ITEM_SELECTOR));
|
|
4209
|
+
break;
|
|
4210
|
+
}
|
|
4211
|
+
}
|
|
4212
|
+
},
|
|
4213
|
+
[getActiveItem, getFirstGroup, getFirstItem, getLastGroup, getLastItem, getNextGroup, getNextItem, onKeyDown]
|
|
4214
|
+
);
|
|
4215
|
+
react.useEffect(() => {
|
|
4216
|
+
var _a;
|
|
4217
|
+
const firstItem = getFirstItem(internalRef.current);
|
|
4218
|
+
if (!firstItem) return;
|
|
4219
|
+
(_a = internalRef.current) == null ? void 0 : _a.focus();
|
|
4220
|
+
setActiveItemId(firstItem.getAttribute(ITEM_SELECTOR));
|
|
4221
|
+
}, [getFirstItem]);
|
|
4222
|
+
const contextValue = react.useMemo(
|
|
4223
|
+
() => ({
|
|
4224
|
+
activeItemId,
|
|
4225
|
+
setActiveItemId,
|
|
4226
|
+
// style props
|
|
4227
|
+
accentColor,
|
|
4228
|
+
radius,
|
|
4229
|
+
variant,
|
|
4230
|
+
size
|
|
4231
|
+
}),
|
|
4232
|
+
[accentColor, activeItemId, radius, size, variant]
|
|
4233
|
+
);
|
|
4234
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
4235
|
+
"div",
|
|
4236
|
+
{
|
|
4237
|
+
ref: mergeRefs([ref, internalRef]),
|
|
4238
|
+
className: classVarianceAuthority.cx(menuRootCva({ size }), radiusCva({ radius, maxLarge: true }), className),
|
|
4239
|
+
role: "menu",
|
|
4240
|
+
onKeyDown: handleKeyDown,
|
|
4241
|
+
tabIndex: 0,
|
|
4242
|
+
"aria-activedescendant": activeItemId ?? void 0,
|
|
4243
|
+
"data-accent-color": accentColor,
|
|
4244
|
+
...rest,
|
|
4245
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(MenuRootContext, { value: contextValue, children })
|
|
4246
|
+
}
|
|
4247
|
+
);
|
|
4248
|
+
});
|
|
4249
|
+
MenuV2Root.displayName = "MenuRoot";
|
|
4250
|
+
const MenuV2SelectedIndicator = react.memo((props) => {
|
|
4251
|
+
const { ref, children, ...rest } = props;
|
|
4252
|
+
return /* @__PURE__ */ jsxRuntime.jsx(SelectedIndicator, { ref, ...rest, children });
|
|
4253
|
+
});
|
|
4254
|
+
MenuV2SelectedIndicator.displayName = "MenuCheckboxItemIndicator";
|
|
4255
|
+
const MenuV2SelectGroup = genericMemo(function MenuSelectGroup2(props) {
|
|
4256
|
+
const { ref, children, required, defaultValue, value, onValueChange, ...rest } = props;
|
|
4257
|
+
return /* @__PURE__ */ jsxRuntime.jsx(MenuV2Group, { ref, ...rest, children: required ? /* @__PURE__ */ jsxRuntime.jsx(SingleSelectRequiredProvider, { defaultValue, value, onValueChange, children }) : /* @__PURE__ */ jsxRuntime.jsx(
|
|
4258
|
+
SingleSelectNotRequiredProvider,
|
|
4259
|
+
{
|
|
4260
|
+
defaultValue,
|
|
4261
|
+
value,
|
|
4262
|
+
onValueChange,
|
|
4263
|
+
children
|
|
4264
|
+
}
|
|
4265
|
+
) });
|
|
4266
|
+
});
|
|
4267
|
+
const MenuV2SelectItem = genericMemo(function(props) {
|
|
4268
|
+
const { ref, value, onSelect, children, ...rest } = props;
|
|
4269
|
+
const { selected, selectValue } = react.use(SelectContext);
|
|
4270
|
+
const isSelected = selected(value);
|
|
4271
|
+
const handleSelect = react.useCallback(
|
|
4272
|
+
(e) => {
|
|
4273
|
+
onSelect == null ? void 0 : onSelect(e);
|
|
4274
|
+
if (e.defaultPrevented) return;
|
|
4275
|
+
selectValue(value);
|
|
4276
|
+
},
|
|
4277
|
+
[onSelect, selectValue, value]
|
|
4278
|
+
);
|
|
4279
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
4280
|
+
MenuV2Item,
|
|
4281
|
+
{
|
|
4282
|
+
ref,
|
|
4283
|
+
role: "menuitemcheckbox",
|
|
4284
|
+
onSelect: handleSelect,
|
|
4285
|
+
"data-state": getSelectedState(isSelected),
|
|
4286
|
+
...rest,
|
|
4287
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(SelectedIndicatorContext, { value: isSelected, children })
|
|
4288
|
+
}
|
|
4289
|
+
);
|
|
4290
|
+
});
|
|
4291
|
+
const MenuV2Separator = react.memo((props) => {
|
|
4292
|
+
const { ref, className, ...rest } = props;
|
|
4293
|
+
const { size } = react.use(MenuRootContext);
|
|
4294
|
+
return /* @__PURE__ */ jsxRuntime.jsx(RadixSeparator__namespace.Root, { className: classVarianceAuthority.cx(menuSeparatorCva({ size }), className), ref, ...rest });
|
|
4295
|
+
});
|
|
4296
|
+
MenuV2Separator.displayName = "MenuSeparator";
|
|
4297
|
+
const MenuV2 = {
|
|
4298
|
+
Root: MenuV2Root,
|
|
4299
|
+
Group: MenuV2Group,
|
|
4300
|
+
GroupLabel: MenuV2GroupLabel,
|
|
4301
|
+
Item: MenuV2Item,
|
|
4302
|
+
Separator: MenuV2Separator,
|
|
4303
|
+
SelectGroup: MenuV2SelectGroup,
|
|
4304
|
+
SelectItem: MenuV2SelectItem,
|
|
4305
|
+
MultiSelectGroup: MenuV2MultiSelectGroup,
|
|
4306
|
+
MultiSelectItem: MenuV2MultiSelectItem,
|
|
4307
|
+
SelectAllItem: MenuV2SelectAllItem,
|
|
4308
|
+
SelectedIndicator: MenuV2SelectedIndicator,
|
|
4309
|
+
CheckboxItem: MenuV2CheckboxItem,
|
|
4310
|
+
CheckedIndicator: MenuV2CheckedIndicator,
|
|
4311
|
+
Pages: MenuV2Pages,
|
|
4312
|
+
Page: MenuV2Page,
|
|
4313
|
+
PageTriggerItem: MenuV2PageTriggerItem
|
|
4314
|
+
};
|
|
4315
|
+
const OneTimePasswordFieldHiddenInput = react.memo((props) => {
|
|
4316
|
+
return /* @__PURE__ */ jsxRuntime.jsx(RadixOneTimePasswordField__namespace.HiddenInput, { ...props });
|
|
4317
|
+
});
|
|
4318
|
+
OneTimePasswordFieldHiddenInput.displayName = "OneTimePasswordFieldHiddenInput";
|
|
4319
|
+
const OneTimePasswordFieldContext = react.createContext({});
|
|
4320
|
+
const onetimePasswordFieldInput = classVarianceAuthority.cva(
|
|
4321
|
+
[
|
|
4322
|
+
"flex",
|
|
4323
|
+
"items-center",
|
|
4324
|
+
"justify-center",
|
|
4325
|
+
"text-center",
|
|
4326
|
+
"focus-visible:outline-2",
|
|
4327
|
+
"focus-visible:outline-(--accent-8)",
|
|
4328
|
+
"focus-visible:-outline-offset-1",
|
|
4329
|
+
"disabled:opacity-50",
|
|
4330
|
+
"disabled:pointer-events-none",
|
|
4331
|
+
"transition-[background,color,box-shadow]"
|
|
4332
|
+
],
|
|
4333
|
+
{
|
|
4334
|
+
variants: {
|
|
4335
|
+
variant: {
|
|
4336
|
+
surface: [
|
|
4337
|
+
"inset-ring",
|
|
4338
|
+
"inset-ring-(--accent-a7)",
|
|
4339
|
+
"bg-(--accent-surface)",
|
|
4340
|
+
"text-(--accent-a12)",
|
|
4341
|
+
"placeholder-(--accent-12)",
|
|
4342
|
+
"placeholder:opacity-60",
|
|
4343
|
+
"selection:bg-(--accent-a5)"
|
|
4344
|
+
],
|
|
4345
|
+
soft: [
|
|
4346
|
+
"bg-(--accent-a3)",
|
|
4347
|
+
"text-(--accent-12)",
|
|
4348
|
+
"placeholder-(--accent-12)",
|
|
4349
|
+
"placeholder:opacity-60",
|
|
4350
|
+
"selection:bg-(--accent-a5)"
|
|
4351
|
+
],
|
|
4352
|
+
outline: [
|
|
4353
|
+
"inset-ring",
|
|
4354
|
+
"inset-ring-(--base-a7)",
|
|
4355
|
+
"bg-transparent",
|
|
4356
|
+
"text-(--base-12)",
|
|
4357
|
+
"placeholder-(--base-a9)",
|
|
4358
|
+
"selection:bg-(--accent-a5)"
|
|
4359
|
+
],
|
|
4360
|
+
ghost: ["bg-transparent", "text-(--base-12)", 'placeholder-(--base-a9)", "selection:bg-(--accent-a5)']
|
|
4361
|
+
},
|
|
4362
|
+
size: {
|
|
4363
|
+
xs: ["size-6 w-6", "text-xs"],
|
|
4364
|
+
sm: ["size-7 w-7", "text-sm"],
|
|
4365
|
+
md: ["size-8 w-8", "text-base"],
|
|
4366
|
+
lg: ["size-9 w-9", "text-lg"],
|
|
4367
|
+
xl: ["size-10 w-10", "text-xl"]
|
|
4368
|
+
}
|
|
4369
|
+
},
|
|
4370
|
+
defaultVariants: {
|
|
4371
|
+
size: "md",
|
|
4372
|
+
variant: "surface"
|
|
3779
4373
|
}
|
|
3780
|
-
|
|
3781
|
-
|
|
3782
|
-
|
|
3783
|
-
|
|
3784
|
-
const {
|
|
3785
|
-
const { refs, getReferenceProps, open, disabled } = useSubContext();
|
|
3786
|
-
const mergedRefs = react.useMergeRefs([forwardedRef, refs.setReference]);
|
|
4374
|
+
}
|
|
4375
|
+
);
|
|
4376
|
+
const OneTimePasswordFieldInput = react.memo((props) => {
|
|
4377
|
+
const { ref, className, ...rest } = props;
|
|
4378
|
+
const { variant, size, radius, accentColor } = react.use(OneTimePasswordFieldContext);
|
|
3787
4379
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
3788
|
-
|
|
4380
|
+
RadixOneTimePasswordField__namespace.Input,
|
|
3789
4381
|
{
|
|
3790
|
-
ref
|
|
3791
|
-
|
|
3792
|
-
|
|
3793
|
-
|
|
3794
|
-
|
|
3795
|
-
|
|
3796
|
-
|
|
4382
|
+
ref,
|
|
4383
|
+
className: classVarianceAuthority.cx(
|
|
4384
|
+
onetimePasswordFieldInput({ variant, size }),
|
|
4385
|
+
radiusCva({ radius, maxLarge: true }),
|
|
4386
|
+
className
|
|
4387
|
+
),
|
|
4388
|
+
"data-accent-color": accentColor,
|
|
4389
|
+
...rest
|
|
3797
4390
|
}
|
|
3798
4391
|
);
|
|
3799
4392
|
});
|
|
3800
|
-
|
|
3801
|
-
const
|
|
3802
|
-
const
|
|
3803
|
-
const {
|
|
3804
|
-
|
|
3805
|
-
|
|
3806
|
-
|
|
3807
|
-
|
|
3808
|
-
|
|
3809
|
-
|
|
3810
|
-
|
|
3811
|
-
|
|
3812
|
-
|
|
3813
|
-
|
|
3814
|
-
|
|
3815
|
-
|
|
3816
|
-
|
|
3817
|
-
|
|
3818
|
-
|
|
3819
|
-
|
|
3820
|
-
Root: MenuRoot,
|
|
3821
|
-
Content: MenuContent,
|
|
3822
|
-
// sub
|
|
3823
|
-
Sub: MenuSub,
|
|
3824
|
-
SubContent: MenuSubContent,
|
|
3825
|
-
SubTrigger: MenuSubTrigger,
|
|
3826
|
-
// pages
|
|
3827
|
-
Pages: MenuPages,
|
|
3828
|
-
PageContent: MenuPageContent,
|
|
3829
|
-
PageTrigger: MenuPageTrigger,
|
|
3830
|
-
// triggers
|
|
3831
|
-
ClickTrigger: MenuClickTrigger,
|
|
3832
|
-
ContextTrigger: MenuContextTrigger,
|
|
3833
|
-
VirtualTrigger: MenuVirtualTrigger,
|
|
3834
|
-
// groups
|
|
3835
|
-
Group: MenuGroup,
|
|
3836
|
-
SelectGroup: MenuSelectGroup,
|
|
3837
|
-
MultiSelectGroup: MenuMultiSelectGroup,
|
|
3838
|
-
// items
|
|
3839
|
-
Item: MenuItem,
|
|
3840
|
-
SelectItem: MenuSelectItem,
|
|
3841
|
-
MultiSelectItem: MenuMultiSelectItem,
|
|
3842
|
-
SelectAllItem: MenuSelectAllItem,
|
|
3843
|
-
CheckboxItem: MenuCheckboxItem,
|
|
3844
|
-
// indicators
|
|
3845
|
-
SelectedIndicator: MenuSelectedIndicator,
|
|
3846
|
-
CheckboxItemIndicator: MenuCheckboxItemIndicator,
|
|
3847
|
-
// input
|
|
3848
|
-
InputRoot: MenuInputRoot,
|
|
3849
|
-
InputField: MenuInputField,
|
|
3850
|
-
InputSlot: MenuInputSlot,
|
|
3851
|
-
// others
|
|
3852
|
-
Label: MenuLabel,
|
|
3853
|
-
Separator: MenuSeparator,
|
|
3854
|
-
Scroll: MenuScroll
|
|
4393
|
+
OneTimePasswordFieldInput.displayName = "OneTimePasswordFieldInput";
|
|
4394
|
+
const OneTimePasswordFieldRoot = react.memo((props) => {
|
|
4395
|
+
const providerContext = useProvider();
|
|
4396
|
+
const {
|
|
4397
|
+
ref,
|
|
4398
|
+
children,
|
|
4399
|
+
variant = "surface",
|
|
4400
|
+
size = "md",
|
|
4401
|
+
radius = providerContext.radius,
|
|
4402
|
+
accentColor = providerContext.accentColor,
|
|
4403
|
+
...rest
|
|
4404
|
+
} = props;
|
|
4405
|
+
const contextValue = react.useMemo(() => ({ variant, size, radius, accentColor }), [accentColor, radius, size, variant]);
|
|
4406
|
+
return /* @__PURE__ */ jsxRuntime.jsx(RadixOneTimePasswordField__namespace.Root, { ref, "data-accent-color": accentColor, ...rest, children: /* @__PURE__ */ jsxRuntime.jsx(OneTimePasswordFieldContext, { value: contextValue, children }) });
|
|
4407
|
+
});
|
|
4408
|
+
OneTimePasswordFieldRoot.displayName = "OneTimePasswordFieldRoot";
|
|
4409
|
+
const OneTimePasswordField = {
|
|
4410
|
+
HiddenInput: OneTimePasswordFieldHiddenInput,
|
|
4411
|
+
Input: OneTimePasswordFieldInput,
|
|
4412
|
+
Root: OneTimePasswordFieldRoot
|
|
3855
4413
|
};
|
|
3856
|
-
const
|
|
3857
|
-
const { ref,
|
|
3858
|
-
|
|
3859
|
-
|
|
3860
|
-
|
|
3861
|
-
|
|
3862
|
-
|
|
3863
|
-
|
|
3864
|
-
)
|
|
3865
|
-
|
|
4414
|
+
const OverlayClose = react.memo((props) => {
|
|
4415
|
+
const { ref, ...rest } = props;
|
|
4416
|
+
return /* @__PURE__ */ jsxRuntime.jsx(RadixDialog__namespace.Close, { ref, ...rest });
|
|
4417
|
+
});
|
|
4418
|
+
OverlayClose.displayName = "OverlayClose";
|
|
4419
|
+
const overlayContentCva = classVarianceAuthority.cva([
|
|
4420
|
+
"fixed",
|
|
4421
|
+
"inset-0",
|
|
4422
|
+
"bg-(--color-background)",
|
|
4423
|
+
"data-[state='closed']:animate-out",
|
|
4424
|
+
"data-[state='closed']:fade-out-0",
|
|
4425
|
+
"data-[state='closed']:zoom-out-95",
|
|
4426
|
+
"data-[state='open']:animate-in",
|
|
4427
|
+
"data-[state='open']:fade-in-0",
|
|
4428
|
+
"data-[state='open']:zoom-in-95"
|
|
4429
|
+
]);
|
|
4430
|
+
const OverlayContent = react.memo((props) => {
|
|
4431
|
+
const { ref, container, className, ...rest } = props;
|
|
4432
|
+
return /* @__PURE__ */ jsxRuntime.jsx(RadixDialog__namespace.Portal, { container, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
4433
|
+
RadixDialog__namespace.Content,
|
|
3866
4434
|
{
|
|
3867
|
-
className: classVarianceAuthority.cx(
|
|
4435
|
+
className: classVarianceAuthority.cx(overlayContentCva(), className),
|
|
3868
4436
|
ref,
|
|
3869
|
-
|
|
3870
|
-
size,
|
|
3871
|
-
color,
|
|
4437
|
+
"data-floating-content": "",
|
|
3872
4438
|
...rest
|
|
3873
4439
|
}
|
|
3874
|
-
);
|
|
4440
|
+
) });
|
|
3875
4441
|
});
|
|
3876
|
-
|
|
4442
|
+
OverlayContent.displayName = "OverlayContent";
|
|
4443
|
+
const OverlayDescription = react.memo((props) => {
|
|
4444
|
+
const { ref, ...rest } = props;
|
|
4445
|
+
return /* @__PURE__ */ jsxRuntime.jsx(RadixDialog__namespace.Description, { ref, ...rest });
|
|
4446
|
+
});
|
|
4447
|
+
OverlayDescription.displayName = "OverlayDescription";
|
|
4448
|
+
const OverlayRoot = react.memo((props) => {
|
|
4449
|
+
return /* @__PURE__ */ jsxRuntime.jsx(RadixDialog__namespace.Root, { ...props });
|
|
4450
|
+
});
|
|
4451
|
+
OverlayRoot.displayName = "OverlayRoot";
|
|
4452
|
+
const OverlayTitle = react.memo((props) => {
|
|
4453
|
+
const { ref, ...rest } = props;
|
|
4454
|
+
return /* @__PURE__ */ jsxRuntime.jsx(RadixDialog__namespace.Title, { ref, ...rest });
|
|
4455
|
+
});
|
|
4456
|
+
OverlayTitle.displayName = "OverlayTitle";
|
|
4457
|
+
const OverlayTrigger = react.memo((props) => {
|
|
4458
|
+
const { ref, ...rest } = props;
|
|
4459
|
+
return /* @__PURE__ */ jsxRuntime.jsx(RadixDialog__namespace.Trigger, { ref, ...rest });
|
|
4460
|
+
});
|
|
4461
|
+
OverlayTrigger.displayName = "OverlayTrigger";
|
|
4462
|
+
const Overlay = {
|
|
4463
|
+
Root: OverlayRoot,
|
|
4464
|
+
Content: OverlayContent,
|
|
4465
|
+
Title: OverlayTitle,
|
|
4466
|
+
Description: OverlayDescription,
|
|
4467
|
+
Trigger: OverlayTrigger,
|
|
4468
|
+
Close: OverlayClose
|
|
4469
|
+
};
|
|
3877
4470
|
const centerStyles = { placeSelf: "center" };
|
|
3878
|
-
const ErrorFallback =
|
|
4471
|
+
const ErrorFallback = react.memo((props) => {
|
|
3879
4472
|
const { absoluteCentering, message = "Something went wrong", onRetry } = props;
|
|
3880
4473
|
const { resetBoundary } = reactErrorBoundary.useErrorBoundary();
|
|
3881
4474
|
const height = "20px";
|
|
3882
4475
|
const outerFlexStyles = absoluteCentering ? { position: "absolute", top: "50%", transform: "translateY(-50%)" } : void 0;
|
|
3883
|
-
const handleRetry =
|
|
4476
|
+
const handleRetry = react.useCallback(() => {
|
|
3884
4477
|
resetBoundary();
|
|
3885
4478
|
onRetry();
|
|
3886
4479
|
}, [onRetry, resetBoundary]);
|
|
3887
4480
|
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex w-full gap-2", style: outerFlexStyles, children: [
|
|
3888
4481
|
/* @__PURE__ */ jsxRuntime.jsx("div", { style: { flexGrow: 1 } }),
|
|
3889
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
4482
|
+
/* @__PURE__ */ jsxRuntime.jsx(LuIcon, { icon: lucideReact.AlertTriangle, size: height, style: centerStyles }),
|
|
3890
4483
|
/* @__PURE__ */ jsxRuntime.jsx("span", { style: { lineHeight: height, ...centerStyles }, children: message }),
|
|
3891
|
-
/* @__PURE__ */ jsxRuntime.jsx(IconButton, { "aria-label": "Try again", variant: "soft", onClick: handleRetry, style: centerStyles, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
4484
|
+
/* @__PURE__ */ jsxRuntime.jsx(IconButton, { "aria-label": "Try again", variant: "soft", onClick: handleRetry, style: centerStyles, children: /* @__PURE__ */ jsxRuntime.jsx(LuIcon, { icon: lucideReact.RotateCcw, size: height }) }),
|
|
3892
4485
|
/* @__PURE__ */ jsxRuntime.jsx("div", { style: { flexGrow: 1 } })
|
|
3893
4486
|
] });
|
|
3894
4487
|
});
|
|
3895
4488
|
ErrorFallback.displayName = "ErrorFallback";
|
|
3896
|
-
const OvermapErrorBoundary =
|
|
4489
|
+
const OvermapErrorBoundary = react.memo((props) => {
|
|
3897
4490
|
const { absoluteCentering, message } = props;
|
|
3898
|
-
const [attempt, setAttempt] =
|
|
3899
|
-
const logError =
|
|
3900
|
-
console.error("Error in OvermapErrorBoundary:",
|
|
4491
|
+
const [attempt, setAttempt] = react.useState(0);
|
|
4492
|
+
const logError = react.useCallback((error2, info2) => {
|
|
4493
|
+
console.error("Error in OvermapErrorBoundary:", error2, info2);
|
|
3901
4494
|
setAttempt((prev) => prev + 1);
|
|
3902
4495
|
}, []);
|
|
3903
|
-
const handleRetry =
|
|
4496
|
+
const handleRetry = react.useCallback(() => {
|
|
3904
4497
|
setAttempt((prev) => prev + 1);
|
|
3905
4498
|
}, []);
|
|
3906
4499
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
@@ -3914,7 +4507,7 @@
|
|
|
3914
4507
|
);
|
|
3915
4508
|
});
|
|
3916
4509
|
OvermapErrorBoundary.displayName = "OvermapErrorBoundary";
|
|
3917
|
-
const PopoverArrow =
|
|
4510
|
+
const PopoverArrow = react.memo((props) => {
|
|
3918
4511
|
const { ref, children, className, ...rest } = props;
|
|
3919
4512
|
return /* @__PURE__ */ jsxRuntime.jsx(RadixPopover__namespace.Arrow, { className: classVarianceAuthority.cx("fill-(--base-6)", className), ref, ...rest, children });
|
|
3920
4513
|
});
|
|
@@ -3933,7 +4526,7 @@
|
|
|
3933
4526
|
size: "md"
|
|
3934
4527
|
}
|
|
3935
4528
|
});
|
|
3936
|
-
const PopoverContent =
|
|
4529
|
+
const PopoverContent = react.memo((props) => {
|
|
3937
4530
|
const providerContext = useProvider();
|
|
3938
4531
|
const {
|
|
3939
4532
|
ref,
|
|
@@ -4008,7 +4601,7 @@
|
|
|
4008
4601
|
}
|
|
4009
4602
|
}
|
|
4010
4603
|
);
|
|
4011
|
-
const Progress =
|
|
4604
|
+
const Progress = react.memo((props) => {
|
|
4012
4605
|
const providerContext = useProvider();
|
|
4013
4606
|
const {
|
|
4014
4607
|
ref,
|
|
@@ -4020,7 +4613,7 @@
|
|
|
4020
4613
|
accentColor = providerContext.accentColor,
|
|
4021
4614
|
...rest
|
|
4022
4615
|
} = props;
|
|
4023
|
-
const computedStyle =
|
|
4616
|
+
const computedStyle = react.useMemo(
|
|
4024
4617
|
() => ({
|
|
4025
4618
|
...style,
|
|
4026
4619
|
"--progress-value": rest.value ?? 0,
|
|
@@ -4041,7 +4634,7 @@
|
|
|
4041
4634
|
);
|
|
4042
4635
|
});
|
|
4043
4636
|
Progress.displayName = "Progress";
|
|
4044
|
-
const RadioCardsContext =
|
|
4637
|
+
const RadioCardsContext = react.createContext({});
|
|
4045
4638
|
const radioCardsRootCva = classVarianceAuthority.cva([], {
|
|
4046
4639
|
variants: {
|
|
4047
4640
|
size: {
|
|
@@ -4101,8 +4694,8 @@
|
|
|
4101
4694
|
}
|
|
4102
4695
|
}
|
|
4103
4696
|
);
|
|
4104
|
-
const RadioCardsItem =
|
|
4105
|
-
const { variant, size, radius } =
|
|
4697
|
+
const RadioCardsItem = react.memo((props) => {
|
|
4698
|
+
const { variant, size, radius } = react.use(RadioCardsContext);
|
|
4106
4699
|
const { className, accentColor, ...rest } = props;
|
|
4107
4700
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
4108
4701
|
RadixRadioGroup__namespace.Item,
|
|
@@ -4114,7 +4707,7 @@
|
|
|
4114
4707
|
);
|
|
4115
4708
|
});
|
|
4116
4709
|
RadioCardsItem.displayName = "RadioCardsItem";
|
|
4117
|
-
const RadioCardsRoot =
|
|
4710
|
+
const RadioCardsRoot = react.memo((props) => {
|
|
4118
4711
|
const providerContext = useProvider();
|
|
4119
4712
|
const {
|
|
4120
4713
|
className,
|
|
@@ -4125,7 +4718,7 @@
|
|
|
4125
4718
|
accentColor = providerContext.accentColor,
|
|
4126
4719
|
...rest
|
|
4127
4720
|
} = props;
|
|
4128
|
-
const contextValue =
|
|
4721
|
+
const contextValue = react.useMemo(
|
|
4129
4722
|
() => ({
|
|
4130
4723
|
variant,
|
|
4131
4724
|
size,
|
|
@@ -4148,7 +4741,7 @@
|
|
|
4148
4741
|
Root: RadioCardsRoot,
|
|
4149
4742
|
Item: RadioCardsItem
|
|
4150
4743
|
};
|
|
4151
|
-
const RadioGroupIndicator =
|
|
4744
|
+
const RadioGroupIndicator = react.memo((props) => {
|
|
4152
4745
|
const { ref, children, className, ...rest } = props;
|
|
4153
4746
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
4154
4747
|
RadixRadioGroup__namespace.Indicator,
|
|
@@ -4161,7 +4754,7 @@
|
|
|
4161
4754
|
);
|
|
4162
4755
|
});
|
|
4163
4756
|
RadioGroupIndicator.displayName = "RadioGroupIndicator";
|
|
4164
|
-
const RadioGroupContext =
|
|
4757
|
+
const RadioGroupContext = react.createContext({});
|
|
4165
4758
|
const radioGroupItem = classVarianceAuthority.cva(
|
|
4166
4759
|
[
|
|
4167
4760
|
"inline-flex",
|
|
@@ -4205,8 +4798,8 @@
|
|
|
4205
4798
|
}
|
|
4206
4799
|
}
|
|
4207
4800
|
);
|
|
4208
|
-
const RadioGroupItem =
|
|
4209
|
-
const radioGroupContext =
|
|
4801
|
+
const RadioGroupItem = react.memo((props) => {
|
|
4802
|
+
const radioGroupContext = react.useContext(RadioGroupContext);
|
|
4210
4803
|
const {
|
|
4211
4804
|
ref,
|
|
4212
4805
|
children,
|
|
@@ -4218,7 +4811,7 @@
|
|
|
4218
4811
|
return /* @__PURE__ */ jsxRuntime.jsx(RadixRadioGroup__namespace.Item, { className: classVarianceAuthority.cx(radioGroupItem({ size, variant }), className), ref, ...rest, children });
|
|
4219
4812
|
});
|
|
4220
4813
|
RadioGroupItem.displayName = "RadioGroupItem";
|
|
4221
|
-
const RadioGroupRoot =
|
|
4814
|
+
const RadioGroupRoot = react.memo((props) => {
|
|
4222
4815
|
const providerContext = useProvider();
|
|
4223
4816
|
const {
|
|
4224
4817
|
ref,
|
|
@@ -4237,6 +4830,65 @@
|
|
|
4237
4830
|
Item: RadioGroupItem,
|
|
4238
4831
|
Root: RadioGroupRoot
|
|
4239
4832
|
};
|
|
4833
|
+
const RatingRootContext = react.createContext({});
|
|
4834
|
+
const RatingItemContext = react.createContext({});
|
|
4835
|
+
const RatingItem = react.memo((props) => {
|
|
4836
|
+
const { ref, children, value, ...rest } = props;
|
|
4837
|
+
const { value: activeValue } = react.use(RatingRootContext);
|
|
4838
|
+
const active = !!activeValue && value <= activeValue;
|
|
4839
|
+
const contextValue = react.useMemo(() => ({ value }), [value]);
|
|
4840
|
+
return /* @__PURE__ */ jsxRuntime.jsx(RadixRadioGroup__namespace.Item, { ref, value: value.toString(), "data-active": active, ...rest, children: /* @__PURE__ */ jsxRuntime.jsx(RatingItemContext, { value: contextValue, children }) });
|
|
4841
|
+
});
|
|
4842
|
+
RatingItem.displayName = "RatingItem";
|
|
4843
|
+
const RatingItemIndicator = react.memo((props) => {
|
|
4844
|
+
const { ref, children, forceMount, ...rest } = props;
|
|
4845
|
+
const { value: activeValue } = react.use(RatingRootContext);
|
|
4846
|
+
const { value } = react.use(RatingItemContext);
|
|
4847
|
+
const active = !!activeValue && value <= activeValue;
|
|
4848
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
4849
|
+
RadixRadioGroup__namespace.Indicator,
|
|
4850
|
+
{
|
|
4851
|
+
ref,
|
|
4852
|
+
forceMount: forceMount ?? (active || void 0),
|
|
4853
|
+
"data-active": active,
|
|
4854
|
+
...rest,
|
|
4855
|
+
children
|
|
4856
|
+
}
|
|
4857
|
+
);
|
|
4858
|
+
});
|
|
4859
|
+
RatingItemIndicator.displayName = "RatingItemIndicator";
|
|
4860
|
+
const RatingRoot = react.memo((props) => {
|
|
4861
|
+
const { ref, children, defaultValue, value: controlledValue, onValueChange, ...rest } = props;
|
|
4862
|
+
const [value, setValue] = useControlledState(defaultValue ?? null, controlledValue, onValueChange);
|
|
4863
|
+
const handleValueChange = react.useCallback(
|
|
4864
|
+
(value2) => {
|
|
4865
|
+
setValue(parseInt(value2));
|
|
4866
|
+
},
|
|
4867
|
+
[setValue]
|
|
4868
|
+
);
|
|
4869
|
+
const contextValue = react.useMemo(
|
|
4870
|
+
() => ({
|
|
4871
|
+
value
|
|
4872
|
+
}),
|
|
4873
|
+
[value]
|
|
4874
|
+
);
|
|
4875
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
4876
|
+
RadixRadioGroup__namespace.Root,
|
|
4877
|
+
{
|
|
4878
|
+
ref,
|
|
4879
|
+
value: value ? value.toString() : null,
|
|
4880
|
+
onValueChange: handleValueChange,
|
|
4881
|
+
...rest,
|
|
4882
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(RatingRootContext, { value: contextValue, children })
|
|
4883
|
+
}
|
|
4884
|
+
);
|
|
4885
|
+
});
|
|
4886
|
+
RatingRoot.displayName = "RatingRoot";
|
|
4887
|
+
const Rating = {
|
|
4888
|
+
Item: RatingItem,
|
|
4889
|
+
ItemIndicator: RatingItemIndicator,
|
|
4890
|
+
Root: RatingRoot
|
|
4891
|
+
};
|
|
4240
4892
|
const segmentedControlRootCva = classVarianceAuthority.cva(
|
|
4241
4893
|
["shrink-0", "transition-colors", "inline-flex", "box-border", "min-w-max", "text-center"],
|
|
4242
4894
|
{
|
|
@@ -4380,15 +5032,15 @@
|
|
|
4380
5032
|
}
|
|
4381
5033
|
}
|
|
4382
5034
|
);
|
|
4383
|
-
const SegmentedControlContext =
|
|
5035
|
+
const SegmentedControlContext = react.createContext({});
|
|
4384
5036
|
const useSegmentedControl = () => {
|
|
4385
|
-
const segmentedControlContext =
|
|
5037
|
+
const segmentedControlContext = react.useContext(SegmentedControlContext);
|
|
4386
5038
|
if (!segmentedControlContext) {
|
|
4387
5039
|
throw new Error("useSegmentedControl must be used within a SegmentedControlProvider");
|
|
4388
5040
|
}
|
|
4389
5041
|
return segmentedControlContext;
|
|
4390
5042
|
};
|
|
4391
|
-
const SegmentedControlItem =
|
|
5043
|
+
const SegmentedControlItem = react.memo((props) => {
|
|
4392
5044
|
const { ref, className, ...rest } = props;
|
|
4393
5045
|
const { size, radius, variant, icon } = useSegmentedControl();
|
|
4394
5046
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
@@ -4401,7 +5053,7 @@
|
|
|
4401
5053
|
);
|
|
4402
5054
|
});
|
|
4403
5055
|
SegmentedControlItem.displayName = "SegmentedControlItem";
|
|
4404
|
-
const SegmentedControlRoot =
|
|
5056
|
+
const SegmentedControlRoot = react.memo((props) => {
|
|
4405
5057
|
const providerContext = useProvider();
|
|
4406
5058
|
const {
|
|
4407
5059
|
ref,
|
|
@@ -4435,7 +5087,7 @@
|
|
|
4435
5087
|
Item: SegmentedControlItem,
|
|
4436
5088
|
Root: SegmentedControlRoot
|
|
4437
5089
|
};
|
|
4438
|
-
const SegmentedTabsListContext =
|
|
5090
|
+
const SegmentedTabsListContext = react.createContext({});
|
|
4439
5091
|
const segmentedTabsListCva = classVarianceAuthority.cva(
|
|
4440
5092
|
["shrink-0", "transition-colors", "inline-flex", "box-border", "min-w-max", "text-center"],
|
|
4441
5093
|
{
|
|
@@ -4583,7 +5235,7 @@
|
|
|
4583
5235
|
}
|
|
4584
5236
|
}
|
|
4585
5237
|
);
|
|
4586
|
-
const SegmentedTabsList =
|
|
5238
|
+
const SegmentedTabsList = react.memo((props) => {
|
|
4587
5239
|
const providerContext = useProvider();
|
|
4588
5240
|
const {
|
|
4589
5241
|
ref,
|
|
@@ -4595,7 +5247,7 @@
|
|
|
4595
5247
|
accentColor = providerContext.accentColor,
|
|
4596
5248
|
...rest
|
|
4597
5249
|
} = props;
|
|
4598
|
-
const contextValue =
|
|
5250
|
+
const contextValue = react.useMemo(
|
|
4599
5251
|
() => ({
|
|
4600
5252
|
size,
|
|
4601
5253
|
variant,
|
|
@@ -4615,14 +5267,14 @@
|
|
|
4615
5267
|
);
|
|
4616
5268
|
});
|
|
4617
5269
|
SegmentedTabsList.displayName = "TabsList";
|
|
4618
|
-
const SegmentedTabsRoot =
|
|
5270
|
+
const SegmentedTabsRoot = react.memo((props) => {
|
|
4619
5271
|
const { ref, className, ...rest } = props;
|
|
4620
5272
|
return /* @__PURE__ */ jsxRuntime.jsx(RadixTabs__namespace.Root, { ref, className: classVarianceAuthority.cx("flex flex-col", className), ...rest });
|
|
4621
5273
|
});
|
|
4622
5274
|
SegmentedTabsRoot.displayName = "TabsRoot";
|
|
4623
|
-
const SegmentedTabsTrigger =
|
|
5275
|
+
const SegmentedTabsTrigger = react.memo((props) => {
|
|
4624
5276
|
const { ref, children, className, ...rest } = props;
|
|
4625
|
-
const { size, radius, variant } =
|
|
5277
|
+
const { size, radius, variant } = react.use(SegmentedTabsListContext);
|
|
4626
5278
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
4627
5279
|
RadixTabs__namespace.Trigger,
|
|
4628
5280
|
{
|
|
@@ -4722,7 +5374,7 @@
|
|
|
4722
5374
|
orientation: "horizontal"
|
|
4723
5375
|
}
|
|
4724
5376
|
});
|
|
4725
|
-
const Separator =
|
|
5377
|
+
const Separator = react.memo((props) => {
|
|
4726
5378
|
const { ref, className, accentColor = "base", orientation, size, ...rest } = props;
|
|
4727
5379
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
4728
5380
|
RadixSeparator__namespace.Root,
|
|
@@ -4944,7 +5596,7 @@
|
|
|
4944
5596
|
}
|
|
4945
5597
|
}
|
|
4946
5598
|
);
|
|
4947
|
-
const Slider =
|
|
5599
|
+
const Slider = react.memo((props) => {
|
|
4948
5600
|
const providerContext = useProvider();
|
|
4949
5601
|
const {
|
|
4950
5602
|
className,
|
|
@@ -4982,11 +5634,11 @@
|
|
|
4982
5634
|
);
|
|
4983
5635
|
});
|
|
4984
5636
|
Slider.displayName = "Slider";
|
|
4985
|
-
const Spinner =
|
|
5637
|
+
const Spinner = react.memo(() => {
|
|
4986
5638
|
return /* @__PURE__ */ jsxRuntime.jsx("div", { className: "size-6 animate-spin rounded-full border-2 border-(--base-a12) border-b-transparent" });
|
|
4987
5639
|
});
|
|
4988
5640
|
Spinner.displayName = "Spinner";
|
|
4989
|
-
const SwitchContext =
|
|
5641
|
+
const SwitchContext = react.createContext({});
|
|
4990
5642
|
const switchRoot = classVarianceAuthority.cva(
|
|
4991
5643
|
[
|
|
4992
5644
|
"shrink-0",
|
|
@@ -5046,7 +5698,7 @@
|
|
|
5046
5698
|
}
|
|
5047
5699
|
}
|
|
5048
5700
|
);
|
|
5049
|
-
const SwitchRoot =
|
|
5701
|
+
const SwitchRoot = react.memo((props) => {
|
|
5050
5702
|
const providerContext = useProvider();
|
|
5051
5703
|
const {
|
|
5052
5704
|
ref,
|
|
@@ -5069,9 +5721,9 @@
|
|
|
5069
5721
|
);
|
|
5070
5722
|
});
|
|
5071
5723
|
SwitchRoot.displayName = "SwitchRoot";
|
|
5072
|
-
const SwitchThumb =
|
|
5724
|
+
const SwitchThumb = react.memo((props) => {
|
|
5073
5725
|
const { ref, className, ...rest } = props;
|
|
5074
|
-
const { size, radius } =
|
|
5726
|
+
const { size, radius } = react.useContext(SwitchContext);
|
|
5075
5727
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
5076
5728
|
RadixSwitch__namespace.Thumb,
|
|
5077
5729
|
{
|
|
@@ -5086,12 +5738,12 @@
|
|
|
5086
5738
|
Root: SwitchRoot,
|
|
5087
5739
|
Thumb: SwitchThumb
|
|
5088
5740
|
};
|
|
5089
|
-
const TableBody =
|
|
5741
|
+
const TableBody = react.memo((props) => {
|
|
5090
5742
|
const { ref, className, ...rest } = props;
|
|
5091
5743
|
return /* @__PURE__ */ jsxRuntime.jsx("tbody", { ref, className: classVarianceAuthority.cx(className), ...rest });
|
|
5092
5744
|
});
|
|
5093
5745
|
TableBody.displayName = "TableBody";
|
|
5094
|
-
const TableContext =
|
|
5746
|
+
const TableContext = react.createContext({});
|
|
5095
5747
|
const tableRootCva = classVarianceAuthority.cva(["border-collapse text-left"], {
|
|
5096
5748
|
variants: {
|
|
5097
5749
|
variant: {
|
|
@@ -5107,7 +5759,7 @@
|
|
|
5107
5759
|
}
|
|
5108
5760
|
}
|
|
5109
5761
|
});
|
|
5110
|
-
const
|
|
5762
|
+
const tableHeaderCellCva = classVarianceAuthority.cva([], {
|
|
5111
5763
|
variants: {
|
|
5112
5764
|
variant: {
|
|
5113
5765
|
surface: [],
|
|
@@ -5132,29 +5784,54 @@
|
|
|
5132
5784
|
}
|
|
5133
5785
|
}
|
|
5134
5786
|
});
|
|
5135
|
-
const
|
|
5787
|
+
const tableCellCva = classVarianceAuthority.cva([], {
|
|
5788
|
+
variants: {
|
|
5789
|
+
variant: {
|
|
5790
|
+
surface: [],
|
|
5791
|
+
ghost: []
|
|
5792
|
+
},
|
|
5793
|
+
cell: {
|
|
5794
|
+
true: [],
|
|
5795
|
+
false: []
|
|
5796
|
+
},
|
|
5797
|
+
size: {
|
|
5798
|
+
xs: ["p-1"],
|
|
5799
|
+
sm: ["p-2"],
|
|
5800
|
+
md: ["p-3"],
|
|
5801
|
+
lg: ["p-4"],
|
|
5802
|
+
xl: ["p-5"]
|
|
5803
|
+
},
|
|
5804
|
+
border: {
|
|
5805
|
+
grid: ["box-border", "border", "border-(--accent-a6)"],
|
|
5806
|
+
row: ["box-border", "border-b", "border-(--accent-a6)"],
|
|
5807
|
+
col: ["box-border", "border-x", "border-(--accent-a6)"],
|
|
5808
|
+
none: []
|
|
5809
|
+
}
|
|
5810
|
+
}
|
|
5811
|
+
});
|
|
5812
|
+
const TableCell = react.memo((props) => {
|
|
5136
5813
|
const { ref, className, ...rest } = props;
|
|
5137
|
-
const { size, border, variant } =
|
|
5814
|
+
const { size, border, variant } = react.useContext(TableContext);
|
|
5138
5815
|
return /* @__PURE__ */ jsxRuntime.jsx("td", { ref, className: classVarianceAuthority.cx(tableCellCva({ size, border, cell: true, variant }), className), ...rest });
|
|
5139
5816
|
});
|
|
5140
5817
|
TableCell.displayName = "TableCell";
|
|
5141
|
-
const TableColumnHeaderCell =
|
|
5818
|
+
const TableColumnHeaderCell = react.memo((props) => {
|
|
5142
5819
|
const { ref, className, ...rest } = props;
|
|
5143
|
-
const { size, border, variant } =
|
|
5144
|
-
return /* @__PURE__ */ jsxRuntime.jsx("th", { ref, className: classVarianceAuthority.cx(
|
|
5820
|
+
const { size, border, variant } = react.useContext(TableContext);
|
|
5821
|
+
return /* @__PURE__ */ jsxRuntime.jsx("th", { ref, className: classVarianceAuthority.cx(tableHeaderCellCva({ size, border, cell: false, variant }), className), ...rest });
|
|
5145
5822
|
});
|
|
5146
5823
|
TableColumnHeaderCell.displayName = "TableColumnHeaderCell";
|
|
5147
|
-
const TableFooter =
|
|
5824
|
+
const TableFooter = react.memo((props) => {
|
|
5148
5825
|
const { ref, className, ...rest } = props;
|
|
5149
5826
|
return /* @__PURE__ */ jsxRuntime.jsx("tfoot", { ref, className: classVarianceAuthority.cx(className), ...rest });
|
|
5150
5827
|
});
|
|
5151
5828
|
TableFooter.displayName = "TableFooter";
|
|
5152
|
-
const TableHeader =
|
|
5829
|
+
const TableHeader = react.memo((props) => {
|
|
5153
5830
|
const { ref, className, ...rest } = props;
|
|
5154
5831
|
return /* @__PURE__ */ jsxRuntime.jsx("thead", { ref, className: classVarianceAuthority.cx(className), ...rest });
|
|
5155
5832
|
});
|
|
5156
5833
|
TableHeader.displayName = "TableHeader";
|
|
5157
|
-
const TableRoot =
|
|
5834
|
+
const TableRoot = react.memo((props) => {
|
|
5158
5835
|
const providerContext = useProvider();
|
|
5159
5836
|
const {
|
|
5160
5837
|
ref,
|
|
@@ -5182,17 +5859,17 @@
|
|
|
5182
5859
|
);
|
|
5183
5860
|
});
|
|
5184
5861
|
TableRoot.displayName = "TableRoot";
|
|
5185
|
-
const TableRow =
|
|
5862
|
+
const TableRow = react.memo((props) => {
|
|
5186
5863
|
const { ref, className, ...rest } = props;
|
|
5187
5864
|
return /* @__PURE__ */ jsxRuntime.jsx("tr", { ref, className: classVarianceAuthority.cx(className), ...rest });
|
|
5188
5865
|
});
|
|
5189
5866
|
TableRow.displayName = "TableRow";
|
|
5190
|
-
const TableRowHeaderCell =
|
|
5867
|
+
const TableRowHeaderCell = react.memo((props) => {
|
|
5191
5868
|
const { ref, className, ...rest } = props;
|
|
5192
|
-
const { size, border, variant } =
|
|
5869
|
+
const { size, border, variant } = react.useContext(TableContext);
|
|
5193
5870
|
return /* @__PURE__ */ jsxRuntime.jsx("th", { ref, className: classVarianceAuthority.cx(tableCellCva({ size, border, cell: true, variant }), className), ...rest });
|
|
5194
5871
|
});
|
|
5195
|
-
TableRowHeaderCell.displayName = "
|
|
5872
|
+
TableRowHeaderCell.displayName = "TableRowHeaderCell";
|
|
5196
5873
|
const Table = {
|
|
5197
5874
|
Root: TableRoot,
|
|
5198
5875
|
Header: TableHeader,
|
|
@@ -5203,7 +5880,7 @@
|
|
|
5203
5880
|
RowHeaderCell: TableRowHeaderCell,
|
|
5204
5881
|
ColumnHeaderCell: TableColumnHeaderCell
|
|
5205
5882
|
};
|
|
5206
|
-
const TabsListContext =
|
|
5883
|
+
const TabsListContext = react.createContext({});
|
|
5207
5884
|
const tabsListCva = classVarianceAuthority.cva(["flex", "border-box", "inset-shadow-[0_-1px_0_0_var(--base-a6)]"], {
|
|
5208
5885
|
variants: {
|
|
5209
5886
|
size: {
|
|
@@ -5253,7 +5930,7 @@
|
|
|
5253
5930
|
}
|
|
5254
5931
|
}
|
|
5255
5932
|
);
|
|
5256
|
-
const TabsList =
|
|
5933
|
+
const TabsList = react.memo((props) => {
|
|
5257
5934
|
const providerContext = useProvider();
|
|
5258
5935
|
const { ref, children, className, size = "md", accentColor = providerContext.accentColor, ...rest } = props;
|
|
5259
5936
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
@@ -5268,19 +5945,19 @@
|
|
|
5268
5945
|
);
|
|
5269
5946
|
});
|
|
5270
5947
|
TabsList.displayName = "TabsList";
|
|
5271
|
-
const TabsRoot =
|
|
5948
|
+
const TabsRoot = react.memo((props) => {
|
|
5272
5949
|
const { ref, className, ...rest } = props;
|
|
5273
5950
|
return /* @__PURE__ */ jsxRuntime.jsx(RadixTabs__namespace.Root, { ref, className: classVarianceAuthority.cx("flex flex-col", className), ...rest });
|
|
5274
5951
|
});
|
|
5275
5952
|
TabsRoot.displayName = "TabsRoot";
|
|
5276
5953
|
const useTabsList = () => {
|
|
5277
|
-
const tabsListContext =
|
|
5954
|
+
const tabsListContext = react.useContext(TabsListContext);
|
|
5278
5955
|
if (!tabsListContext) {
|
|
5279
5956
|
throw new Error("useTabsList must be used within a TabsList component");
|
|
5280
5957
|
}
|
|
5281
5958
|
return tabsListContext;
|
|
5282
5959
|
};
|
|
5283
|
-
const TabsTrigger =
|
|
5960
|
+
const TabsTrigger = react.memo((props) => {
|
|
5284
5961
|
const { ref, children, className, ...rest } = props;
|
|
5285
5962
|
const { size } = useTabsList();
|
|
5286
5963
|
return /* @__PURE__ */ jsxRuntime.jsx(RadixTabs__namespace.Trigger, { ref, className: classVarianceAuthority.cx(tabsTriggerCva({ size }), className), ...rest, children });
|
|
@@ -5322,7 +5999,7 @@
|
|
|
5322
5999
|
}
|
|
5323
6000
|
}
|
|
5324
6001
|
});
|
|
5325
|
-
const Text =
|
|
6002
|
+
const Text = react.memo((props) => {
|
|
5326
6003
|
const { ref, className, size, weight, align, accentColor, highContrast = false, ...rest } = props;
|
|
5327
6004
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
5328
6005
|
"span",
|
|
@@ -5403,7 +6080,7 @@
|
|
|
5403
6080
|
}
|
|
5404
6081
|
}
|
|
5405
6082
|
);
|
|
5406
|
-
const TextArea =
|
|
6083
|
+
const TextArea = react.memo((props) => {
|
|
5407
6084
|
const providerContext = useProvider();
|
|
5408
6085
|
const {
|
|
5409
6086
|
ref,
|
|
@@ -5425,170 +6102,98 @@
|
|
|
5425
6102
|
);
|
|
5426
6103
|
});
|
|
5427
6104
|
TextArea.displayName = "TextArea";
|
|
5428
|
-
const
|
|
5429
|
-
|
|
5430
|
-
|
|
5431
|
-
|
|
5432
|
-
|
|
5433
|
-
|
|
5434
|
-
"data-[state='open']:zoom-in-95",
|
|
5435
|
-
"data-[state='closed']:animate-out",
|
|
5436
|
-
"data-[state='closed']:fade-out-0",
|
|
5437
|
-
"data-[state='closed']:zoom-out-95"
|
|
5438
|
-
],
|
|
5439
|
-
{
|
|
5440
|
-
variants: {
|
|
5441
|
-
variant: {
|
|
5442
|
-
surface: ["bg-(--accent-1)", "text-(--accent-11)", "ring-1", "ring-inset", "ring-(--accent-6)"],
|
|
5443
|
-
soft: ["bg-(--accent-1)", "text-(--accent-11)"]
|
|
5444
|
-
},
|
|
5445
|
-
size: {
|
|
5446
|
-
xs: ["text-xs", "p-2"],
|
|
5447
|
-
sm: ["text-sm", "p-3"],
|
|
5448
|
-
md: ["text-base", "p-4"],
|
|
5449
|
-
lg: ["text-lg", "p-5"],
|
|
5450
|
-
xl: ["text-xl", "p-6"]
|
|
5451
|
-
}
|
|
5452
|
-
},
|
|
5453
|
-
defaultVariants: {
|
|
5454
|
-
variant: "surface",
|
|
5455
|
-
size: "md"
|
|
5456
|
-
}
|
|
5457
|
-
}
|
|
5458
|
-
);
|
|
5459
|
-
const _Toast = function Toast2(props) {
|
|
5460
|
-
const { radius, ...restProviderContext } = useProvider();
|
|
5461
|
-
const {
|
|
5462
|
-
ref,
|
|
5463
|
-
title,
|
|
5464
|
-
description,
|
|
5465
|
-
icon,
|
|
5466
|
-
size = "md",
|
|
5467
|
-
accentColor = restProviderContext.accentColor,
|
|
5468
|
-
variant,
|
|
5469
|
-
onClose,
|
|
5470
|
-
sensitivity,
|
|
5471
|
-
action,
|
|
5472
|
-
...rest
|
|
5473
|
-
} = props;
|
|
5474
|
-
const [open, setOpen] = React.useState(true);
|
|
5475
|
-
const handleOpenChange = React.useCallback(
|
|
5476
|
-
(open2) => {
|
|
5477
|
-
if (!open2 && onClose) onClose();
|
|
5478
|
-
setOpen(open2);
|
|
5479
|
-
},
|
|
5480
|
-
[onClose]
|
|
5481
|
-
);
|
|
6105
|
+
const CustomToast = react.memo((props) => {
|
|
6106
|
+
const { toastId, title, description, icon, accentColor } = props;
|
|
6107
|
+
const { radius } = useProvider();
|
|
6108
|
+
const handleClose = react.useCallback(() => {
|
|
6109
|
+
sonner.toast.dismiss(toastId);
|
|
6110
|
+
}, [toastId]);
|
|
5482
6111
|
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
5483
|
-
|
|
6112
|
+
"div",
|
|
5484
6113
|
{
|
|
5485
6114
|
className: classVarianceAuthority.cx(
|
|
5486
|
-
"flex
|
|
5487
|
-
toastCva({ size, variant }),
|
|
6115
|
+
"flex items-center gap-2 bg-(--base-2) p-4 ring ring-(--base-6) shadow-md max-w-full max-h-full",
|
|
5488
6116
|
radiusCva({ radius, maxLarge: true })
|
|
5489
6117
|
),
|
|
5490
|
-
ref,
|
|
5491
|
-
open,
|
|
5492
|
-
type: sensitivity,
|
|
5493
|
-
onOpenChange: handleOpenChange,
|
|
5494
6118
|
"data-accent-color": accentColor,
|
|
5495
|
-
"data-floating-content": "",
|
|
5496
|
-
...rest,
|
|
5497
6119
|
children: [
|
|
5498
|
-
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex
|
|
6120
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-4 grow min-w-0", children: [
|
|
5499
6121
|
icon,
|
|
5500
|
-
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col
|
|
5501
|
-
/* @__PURE__ */ jsxRuntime.
|
|
5502
|
-
|
|
5503
|
-
/* @__PURE__ */ jsxRuntime.jsx(RadixToast__namespace.Description, { children: description })
|
|
5504
|
-
] }),
|
|
5505
|
-
action && /* @__PURE__ */ jsxRuntime.jsx(RadixToast__namespace.Action, { className: "w-max", altText: action.altText, asChild: true, children: action.content })
|
|
6122
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col min-w-0 select-none", children: [
|
|
6123
|
+
/* @__PURE__ */ jsxRuntime.jsx(Text, { className: "truncate", children: title }),
|
|
6124
|
+
description && /* @__PURE__ */ jsxRuntime.jsx(Text, { accentColor: "base", size: "sm", weight: "regular", children: description })
|
|
5506
6125
|
] })
|
|
5507
6126
|
] }),
|
|
5508
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
6127
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
6128
|
+
IconButton,
|
|
6129
|
+
{
|
|
6130
|
+
type: "button",
|
|
6131
|
+
onClick: handleClose,
|
|
6132
|
+
"aria-label": "Close",
|
|
6133
|
+
accentColor: "base",
|
|
6134
|
+
variant: "ghost",
|
|
6135
|
+
size: "sm",
|
|
6136
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(LuIcon, { icon: lucideReact.X })
|
|
6137
|
+
}
|
|
6138
|
+
)
|
|
5509
6139
|
]
|
|
5510
6140
|
}
|
|
5511
6141
|
);
|
|
6142
|
+
});
|
|
6143
|
+
const basic = (options) => {
|
|
6144
|
+
const { icon, description, title, ...rest } = options;
|
|
6145
|
+
return sonner.toast.custom(
|
|
6146
|
+
(id) => /* @__PURE__ */ jsxRuntime.jsx(CustomToast, { toastId: id, icon, description, title }),
|
|
6147
|
+
rest
|
|
6148
|
+
);
|
|
5512
6149
|
};
|
|
5513
|
-
const
|
|
5514
|
-
|
|
5515
|
-
|
|
5516
|
-
|
|
5517
|
-
|
|
5518
|
-
|
|
5519
|
-
throw new Error("useToast must be used within a ToastProvider");
|
|
5520
|
-
}
|
|
5521
|
-
return context;
|
|
6150
|
+
const success = (options) => {
|
|
6151
|
+
const { icon = /* @__PURE__ */ jsxRuntime.jsx(LuIcon, { icon: lucideReact.Check, color: "var(--accent-9)" }), description, title, ...rest } = options;
|
|
6152
|
+
return sonner.toast.custom(
|
|
6153
|
+
(id) => /* @__PURE__ */ jsxRuntime.jsx(CustomToast, { accentColor: "success", toastId: id, icon, description, title }),
|
|
6154
|
+
rest
|
|
6155
|
+
);
|
|
5522
6156
|
};
|
|
5523
|
-
const
|
|
5524
|
-
|
|
5525
|
-
|
|
5526
|
-
|
|
5527
|
-
|
|
5528
|
-
|
|
6157
|
+
const info = (options) => {
|
|
6158
|
+
const { icon = /* @__PURE__ */ jsxRuntime.jsx(LuIcon, { icon: lucideReact.InfoIcon, color: "var(--base-11)" }), description, title, ...rest } = options;
|
|
6159
|
+
return sonner.toast.custom(
|
|
6160
|
+
(id) => /* @__PURE__ */ jsxRuntime.jsx(CustomToast, { toastId: id, icon, description, title }),
|
|
6161
|
+
rest
|
|
6162
|
+
);
|
|
5529
6163
|
};
|
|
5530
|
-
|
|
5531
|
-
|
|
5532
|
-
|
|
5533
|
-
|
|
5534
|
-
|
|
5535
|
-
|
|
5536
|
-
|
|
5537
|
-
|
|
5538
|
-
const
|
|
5539
|
-
|
|
5540
|
-
|
|
5541
|
-
|
|
5542
|
-
|
|
5543
|
-
|
|
5544
|
-
|
|
5545
|
-
|
|
5546
|
-
|
|
5547
|
-
|
|
5548
|
-
|
|
5549
|
-
|
|
5550
|
-
|
|
5551
|
-
|
|
5552
|
-
|
|
5553
|
-
|
|
5554
|
-
|
|
5555
|
-
|
|
5556
|
-
|
|
5557
|
-
|
|
5558
|
-
|
|
5559
|
-
|
|
5560
|
-
|
|
5561
|
-
exports2.unsafeShowToast = showToast;
|
|
5562
|
-
return {
|
|
5563
|
-
showToast,
|
|
5564
|
-
showPrimary,
|
|
5565
|
-
showSuccess,
|
|
5566
|
-
showError,
|
|
5567
|
-
showInfo,
|
|
5568
|
-
showWarning
|
|
5569
|
-
};
|
|
5570
|
-
}, [handleCloseToast]);
|
|
5571
|
-
React.useEffect(() => {
|
|
5572
|
-
return () => {
|
|
5573
|
-
for (const { timeout } of toasts) clearTimeout(timeout);
|
|
5574
|
-
};
|
|
5575
|
-
}, []);
|
|
5576
|
-
return /* @__PURE__ */ jsxRuntime.jsx(ToastContext.Provider, { value: toastContextValue, children: /* @__PURE__ */ jsxRuntime.jsxs(RadixToast.ToastProvider, { ...rest, children: [
|
|
5577
|
-
children,
|
|
5578
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
5579
|
-
RadixToast.ToastViewport,
|
|
5580
|
-
{
|
|
5581
|
-
className: classVarianceAuthority.cx(
|
|
5582
|
-
"fixed top-0 right-0 z-[2147483647] flex w-full max-w-md list-none flex-col items-end gap-3 overflow-x-hidden overflow-y-auto p-5 outline-none",
|
|
5583
|
-
className
|
|
5584
|
-
),
|
|
5585
|
-
hotkey
|
|
5586
|
-
}
|
|
5587
|
-
),
|
|
5588
|
-
toasts.map(({ id, onClose, ...toastProps }) => /* @__PURE__ */ jsxRuntime.jsx(Toast, { ...toastProps, onClose: () => handleCloseToast(id, 0, onClose) }, id))
|
|
5589
|
-
] }) });
|
|
6164
|
+
const warning = (options) => {
|
|
6165
|
+
const { icon = /* @__PURE__ */ jsxRuntime.jsx(LuIcon, { icon: lucideReact.TriangleAlertIcon, color: "var(--accent-9)" }), description, title, ...rest } = options;
|
|
6166
|
+
return sonner.toast.custom(
|
|
6167
|
+
(id) => /* @__PURE__ */ jsxRuntime.jsx(CustomToast, { accentColor: "warning", toastId: id, icon, description, title }),
|
|
6168
|
+
rest
|
|
6169
|
+
);
|
|
6170
|
+
};
|
|
6171
|
+
const error = (options) => {
|
|
6172
|
+
const { icon = /* @__PURE__ */ jsxRuntime.jsx(LuIcon, { icon: lucideReact.CircleAlertIcon, color: "var(--accent-9)" }), description, title, ...rest } = options;
|
|
6173
|
+
return sonner.toast.custom(
|
|
6174
|
+
(id) => /* @__PURE__ */ jsxRuntime.jsx(CustomToast, { accentColor: "danger", toastId: id, icon, description, title }),
|
|
6175
|
+
rest
|
|
6176
|
+
);
|
|
6177
|
+
};
|
|
6178
|
+
const toast = Object.assign(
|
|
6179
|
+
basic,
|
|
6180
|
+
{
|
|
6181
|
+
success,
|
|
6182
|
+
info,
|
|
6183
|
+
warning,
|
|
6184
|
+
error,
|
|
6185
|
+
custom: sonner.toast.custom,
|
|
6186
|
+
dismiss: sonner.toast.dismiss
|
|
6187
|
+
},
|
|
6188
|
+
{ getHistory: sonner.toast.getHistory, getToasts: sonner.toast.getToasts }
|
|
6189
|
+
);
|
|
6190
|
+
const TOAST_OPTIONS = {
|
|
6191
|
+
unstyled: true
|
|
6192
|
+
};
|
|
6193
|
+
const Toaster = react.memo((props) => {
|
|
6194
|
+
return /* @__PURE__ */ jsxRuntime.jsx(sonner.Toaster, { toastOptions: TOAST_OPTIONS, richColors: false, closeButton: false, theme: "system", ...props });
|
|
5590
6195
|
});
|
|
5591
|
-
|
|
6196
|
+
Toaster.displayName = "Toaster";
|
|
5592
6197
|
const toggleButtonCva = classVarianceAuthority.cva(
|
|
5593
6198
|
[
|
|
5594
6199
|
"flex",
|
|
@@ -5709,7 +6314,7 @@
|
|
|
5709
6314
|
}
|
|
5710
6315
|
}
|
|
5711
6316
|
);
|
|
5712
|
-
const BaseToggleButton =
|
|
6317
|
+
const BaseToggleButton = react.memo((props) => {
|
|
5713
6318
|
const providerContext = useProvider();
|
|
5714
6319
|
const {
|
|
5715
6320
|
ref,
|
|
@@ -5732,15 +6337,15 @@
|
|
|
5732
6337
|
);
|
|
5733
6338
|
});
|
|
5734
6339
|
BaseToggleButton.displayName = "BaseToggleButton";
|
|
5735
|
-
const IconToggleButton =
|
|
6340
|
+
const IconToggleButton = react.memo((props) => {
|
|
5736
6341
|
return /* @__PURE__ */ jsxRuntime.jsx(BaseToggleButton, { icon: true, ...props });
|
|
5737
6342
|
});
|
|
5738
6343
|
IconToggleButton.displayName = "IconToggleButton";
|
|
5739
|
-
const ToggleButton =
|
|
6344
|
+
const ToggleButton = react.memo((props) => {
|
|
5740
6345
|
return /* @__PURE__ */ jsxRuntime.jsx(BaseToggleButton, { icon: false, ...props });
|
|
5741
6346
|
});
|
|
5742
6347
|
ToggleButton.displayName = "ToggleButton";
|
|
5743
|
-
const ToggleGroupContext =
|
|
6348
|
+
const ToggleGroupContext = react.createContext({});
|
|
5744
6349
|
const toggleGroupItemCva = classVarianceAuthority.cva(
|
|
5745
6350
|
[
|
|
5746
6351
|
"flex",
|
|
@@ -5856,8 +6461,8 @@
|
|
|
5856
6461
|
]
|
|
5857
6462
|
}
|
|
5858
6463
|
);
|
|
5859
|
-
const ToggleGroupBaseItem =
|
|
5860
|
-
const toggleGroupContext =
|
|
6464
|
+
const ToggleGroupBaseItem = react.memo((props) => {
|
|
6465
|
+
const toggleGroupContext = react.use(ToggleGroupContext);
|
|
5861
6466
|
const {
|
|
5862
6467
|
ref,
|
|
5863
6468
|
className,
|
|
@@ -5883,15 +6488,15 @@
|
|
|
5883
6488
|
);
|
|
5884
6489
|
});
|
|
5885
6490
|
ToggleGroupBaseItem.displayName = "ToggleGroupBaseItem";
|
|
5886
|
-
const ToggleGroupIconItem =
|
|
6491
|
+
const ToggleGroupIconItem = react.memo((props) => {
|
|
5887
6492
|
return /* @__PURE__ */ jsxRuntime.jsx(ToggleGroupBaseItem, { icon: true, ...props });
|
|
5888
6493
|
});
|
|
5889
6494
|
ToggleGroupIconItem.displayName = "ToggleGroupIconItem";
|
|
5890
|
-
const ToggleGroupItem =
|
|
6495
|
+
const ToggleGroupItem = react.memo((props) => {
|
|
5891
6496
|
return /* @__PURE__ */ jsxRuntime.jsx(ToggleGroupBaseItem, { icon: false, ...props });
|
|
5892
6497
|
});
|
|
5893
6498
|
ToggleGroupItem.displayName = "ToggleGroupItem";
|
|
5894
|
-
const ToggleGroupRoot =
|
|
6499
|
+
const ToggleGroupRoot = react.memo((props) => {
|
|
5895
6500
|
const providerContext = useProvider();
|
|
5896
6501
|
const {
|
|
5897
6502
|
ref,
|
|
@@ -5902,7 +6507,7 @@
|
|
|
5902
6507
|
size = "md",
|
|
5903
6508
|
...rest
|
|
5904
6509
|
} = props;
|
|
5905
|
-
const contextValue =
|
|
6510
|
+
const contextValue = react.useMemo(
|
|
5906
6511
|
() => ({
|
|
5907
6512
|
variant,
|
|
5908
6513
|
size,
|
|
@@ -5919,7 +6524,7 @@
|
|
|
5919
6524
|
Item: ToggleGroupItem,
|
|
5920
6525
|
IconItem: ToggleGroupIconItem
|
|
5921
6526
|
};
|
|
5922
|
-
const TooltipArrow =
|
|
6527
|
+
const TooltipArrow = react.memo((props) => {
|
|
5923
6528
|
const { ref, className, ...rest } = props;
|
|
5924
6529
|
return /* @__PURE__ */ jsxRuntime.jsx(RadixTooltip__namespace.Arrow, { className: classVarianceAuthority.cx("fill-(--base-6)", className), ref, ...rest });
|
|
5925
6530
|
});
|
|
@@ -5961,7 +6566,7 @@
|
|
|
5961
6566
|
}
|
|
5962
6567
|
}
|
|
5963
6568
|
);
|
|
5964
|
-
const TooltipContent =
|
|
6569
|
+
const TooltipContent = react.memo((props) => {
|
|
5965
6570
|
const providerContext = useProvider();
|
|
5966
6571
|
const {
|
|
5967
6572
|
ref,
|
|
@@ -6013,7 +6618,6 @@
|
|
|
6013
6618
|
exports2.CheckboxGroupSelectAllItem = CheckboxGroupSelectAllItem;
|
|
6014
6619
|
exports2.CheckboxIndicator = CheckboxIndicator;
|
|
6015
6620
|
exports2.CheckboxRoot = CheckboxRoot;
|
|
6016
|
-
exports2.CollapsibleTree = CollapsibleTree;
|
|
6017
6621
|
exports2.CommandMenu = CommandMenu;
|
|
6018
6622
|
exports2.CommandMenuCheckboxIndicator = CommandMenuCheckboxIndicator;
|
|
6019
6623
|
exports2.CommandMenuCheckboxItem = CommandMenuCheckboxItem;
|
|
@@ -6054,12 +6658,15 @@
|
|
|
6054
6658
|
exports2.InputSlot = InputSlot;
|
|
6055
6659
|
exports2.Layout = Layout;
|
|
6056
6660
|
exports2.LayoutContainer = LayoutContainer;
|
|
6057
|
-
exports2.LayoutContext = LayoutContext;
|
|
6058
6661
|
exports2.LayoutRoot = LayoutRoot;
|
|
6059
|
-
exports2.
|
|
6662
|
+
exports2.LayoutSlideOutClose = LayoutSlideOutClose;
|
|
6663
|
+
exports2.LayoutSlideOutContent = LayoutSlideOutContent;
|
|
6664
|
+
exports2.LayoutSlideOutHandle = LayoutSlideOutHandle;
|
|
6060
6665
|
exports2.LayoutSlideOutOverlay = LayoutSlideOutOverlay;
|
|
6666
|
+
exports2.LayoutSlideOutRoot = LayoutSlideOutRoot;
|
|
6061
6667
|
exports2.LayoutSlideOutTrigger = LayoutSlideOutTrigger;
|
|
6062
6668
|
exports2.Link = Link;
|
|
6669
|
+
exports2.LuIcon = LuIcon;
|
|
6063
6670
|
exports2.Menu = Menu;
|
|
6064
6671
|
exports2.MenuCheckboxItem = MenuCheckboxItem;
|
|
6065
6672
|
exports2.MenuCheckboxItemIndicator = MenuCheckboxItemIndicator;
|
|
@@ -6087,7 +6694,35 @@
|
|
|
6087
6694
|
exports2.MenuSub = MenuSub;
|
|
6088
6695
|
exports2.MenuSubContent = MenuSubContent;
|
|
6089
6696
|
exports2.MenuSubTrigger = MenuSubTrigger;
|
|
6697
|
+
exports2.MenuV2 = MenuV2;
|
|
6698
|
+
exports2.MenuV2CheckboxItem = MenuV2CheckboxItem;
|
|
6699
|
+
exports2.MenuV2CheckedIndicator = MenuV2CheckedIndicator;
|
|
6700
|
+
exports2.MenuV2Group = MenuV2Group;
|
|
6701
|
+
exports2.MenuV2GroupLabel = MenuV2GroupLabel;
|
|
6702
|
+
exports2.MenuV2Item = MenuV2Item;
|
|
6703
|
+
exports2.MenuV2MultiSelectGroup = MenuV2MultiSelectGroup;
|
|
6704
|
+
exports2.MenuV2MultiSelectItem = MenuV2MultiSelectItem;
|
|
6705
|
+
exports2.MenuV2Page = MenuV2Page;
|
|
6706
|
+
exports2.MenuV2PageTriggerItem = MenuV2PageTriggerItem;
|
|
6707
|
+
exports2.MenuV2Pages = MenuV2Pages;
|
|
6708
|
+
exports2.MenuV2Root = MenuV2Root;
|
|
6709
|
+
exports2.MenuV2SelectAllItem = MenuV2SelectAllItem;
|
|
6710
|
+
exports2.MenuV2SelectGroup = MenuV2SelectGroup;
|
|
6711
|
+
exports2.MenuV2SelectItem = MenuV2SelectItem;
|
|
6712
|
+
exports2.MenuV2SelectedIndicator = MenuV2SelectedIndicator;
|
|
6713
|
+
exports2.MenuV2Separator = MenuV2Separator;
|
|
6090
6714
|
exports2.MenuVirtualTrigger = MenuVirtualTrigger;
|
|
6715
|
+
exports2.OneTimePasswordField = OneTimePasswordField;
|
|
6716
|
+
exports2.OneTimePasswordFieldHiddenInput = OneTimePasswordFieldHiddenInput;
|
|
6717
|
+
exports2.OneTimePasswordFieldInput = OneTimePasswordFieldInput;
|
|
6718
|
+
exports2.OneTimePasswordFieldRoot = OneTimePasswordFieldRoot;
|
|
6719
|
+
exports2.Overlay = Overlay;
|
|
6720
|
+
exports2.OverlayClose = OverlayClose;
|
|
6721
|
+
exports2.OverlayContent = OverlayContent;
|
|
6722
|
+
exports2.OverlayDescription = OverlayDescription;
|
|
6723
|
+
exports2.OverlayRoot = OverlayRoot;
|
|
6724
|
+
exports2.OverlayTitle = OverlayTitle;
|
|
6725
|
+
exports2.OverlayTrigger = OverlayTrigger;
|
|
6091
6726
|
exports2.OvermapErrorBoundary = OvermapErrorBoundary;
|
|
6092
6727
|
exports2.Popover = Popover;
|
|
6093
6728
|
exports2.PopoverArrow = PopoverArrow;
|
|
@@ -6101,7 +6736,10 @@
|
|
|
6101
6736
|
exports2.RadioGroupIndicator = RadioGroupIndicator;
|
|
6102
6737
|
exports2.RadioGroupItem = RadioGroupItem;
|
|
6103
6738
|
exports2.RadioGroupRoot = RadioGroupRoot;
|
|
6104
|
-
exports2.
|
|
6739
|
+
exports2.Rating = Rating;
|
|
6740
|
+
exports2.RatingItem = RatingItem;
|
|
6741
|
+
exports2.RatingItemIndicator = RatingItemIndicator;
|
|
6742
|
+
exports2.RatingRoot = RatingRoot;
|
|
6105
6743
|
exports2.SegmentedControl = SegmentedControl;
|
|
6106
6744
|
exports2.SegmentedControlItem = SegmentedControlItem;
|
|
6107
6745
|
exports2.SegmentedControlRoot = SegmentedControlRoot;
|
|
@@ -6109,9 +6747,15 @@
|
|
|
6109
6747
|
exports2.SegmentedTabsList = SegmentedTabsList;
|
|
6110
6748
|
exports2.SegmentedTabsRoot = SegmentedTabsRoot;
|
|
6111
6749
|
exports2.SegmentedTabsTrigger = SegmentedTabsTrigger;
|
|
6112
|
-
exports2.SelectedIndicatorContext = SelectedIndicatorContext;
|
|
6113
6750
|
exports2.Separator = Separator;
|
|
6114
6751
|
exports2.SlideOut = SlideOut;
|
|
6752
|
+
exports2.SlideOutClose = SlideOutClose;
|
|
6753
|
+
exports2.SlideOutContent = SlideOutContent;
|
|
6754
|
+
exports2.SlideOutHandle = SlideOutHandle;
|
|
6755
|
+
exports2.SlideOutOverlay = SlideOutOverlay;
|
|
6756
|
+
exports2.SlideOutRoot = SlideOutRoot;
|
|
6757
|
+
exports2.SlideOutTrigger = SlideOutTrigger;
|
|
6758
|
+
exports2.SlideOutViewport = SlideOutViewport;
|
|
6115
6759
|
exports2.Slider = Slider;
|
|
6116
6760
|
exports2.Spinner = Spinner;
|
|
6117
6761
|
exports2.Switch = Switch;
|
|
@@ -6132,9 +6776,7 @@
|
|
|
6132
6776
|
exports2.TabsTrigger = TabsTrigger;
|
|
6133
6777
|
exports2.Text = Text;
|
|
6134
6778
|
exports2.TextArea = TextArea;
|
|
6135
|
-
exports2.
|
|
6136
|
-
exports2.ToastContext = ToastContext;
|
|
6137
|
-
exports2.ToastProvider = ToastProvider;
|
|
6779
|
+
exports2.Toaster = Toaster;
|
|
6138
6780
|
exports2.ToggleButton = ToggleButton;
|
|
6139
6781
|
exports2.ToggleGroup = ToggleGroup;
|
|
6140
6782
|
exports2.ToggleGroupIconItem = ToggleGroupIconItem;
|
|
@@ -6146,23 +6788,23 @@
|
|
|
6146
6788
|
exports2.badge = badge;
|
|
6147
6789
|
exports2.buttonCva = buttonCva;
|
|
6148
6790
|
exports2.floating = floating;
|
|
6791
|
+
exports2.genericMemo = genericMemo;
|
|
6792
|
+
exports2.getActiveState = getActiveState;
|
|
6793
|
+
exports2.getBooleanState = getBooleanState;
|
|
6794
|
+
exports2.getCheckedState = getCheckedState;
|
|
6795
|
+
exports2.getOpenState = getOpenState;
|
|
6796
|
+
exports2.getSelectedState = getSelectedState;
|
|
6149
6797
|
exports2.mergeRefs = mergeRefs;
|
|
6150
6798
|
exports2.radiusCva = radiusCva;
|
|
6151
6799
|
exports2.stopPropagation = stopPropagation;
|
|
6800
|
+
exports2.toast = toast;
|
|
6152
6801
|
exports2.useAlertDialog = useAlertDialog;
|
|
6153
6802
|
exports2.useButtonGroup = useButtonGroup;
|
|
6154
6803
|
exports2.useControlledState = useControlledState;
|
|
6804
|
+
exports2.useFallbackId = useFallbackId;
|
|
6155
6805
|
exports2.useLayoutContext = useLayoutContext;
|
|
6156
|
-
exports2.useMenuContentContext = useMenuContentContext;
|
|
6157
|
-
exports2.useMenuContext = useMenuContext;
|
|
6158
|
-
exports2.usePagesContext = usePagesContext;
|
|
6159
6806
|
exports2.useProvider = useProvider;
|
|
6160
|
-
exports2.useSelectedIndicatorContext = useSelectedIndicatorContext;
|
|
6161
|
-
exports2.useSize = useSize;
|
|
6162
|
-
exports2.useStopEventPropagation = useStopEventPropagation;
|
|
6163
|
-
exports2.useSubContext = useSubContext;
|
|
6164
6807
|
exports2.useTextFilter = useTextFilter;
|
|
6165
|
-
exports2.useToast = useToast;
|
|
6166
6808
|
exports2.useViewportSize = useViewportSize;
|
|
6167
6809
|
Object.defineProperty(exports2, Symbol.toStringTag, { value: "Module" });
|
|
6168
6810
|
});
|