xiod-ui 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +73 -0
- package/README.md +167 -0
- package/dist/components/accordion.d.ts +9 -0
- package/dist/components/accordion.js +46 -0
- package/dist/components/agent-steps.d.ts +47 -0
- package/dist/components/agent-steps.js +223 -0
- package/dist/components/alert-dialog.d.ts +21 -0
- package/dist/components/alert-dialog.js +74 -0
- package/dist/components/alert.d.ts +12 -0
- package/dist/components/alert.js +45 -0
- package/dist/components/aspect-ratio.d.ts +9 -0
- package/dist/components/aspect-ratio.js +22 -0
- package/dist/components/autocomplete.d.ts +35 -0
- package/dist/components/autocomplete.js +160 -0
- package/dist/components/avatar.d.ts +17 -0
- package/dist/components/avatar.js +65 -0
- package/dist/components/badge.d.ts +15 -0
- package/dist/components/badge.js +46 -0
- package/dist/components/breadcrumb.d.ts +12 -0
- package/dist/components/breadcrumb.js +75 -0
- package/dist/components/button-group.d.ts +14 -0
- package/dist/components/button-group.js +45 -0
- package/dist/components/button-split.d.ts +19 -0
- package/dist/components/button-split.js +73 -0
- package/dist/components/button.d.ts +15 -0
- package/dist/components/button.js +54 -0
- package/dist/components/calendar.d.ts +63 -0
- package/dist/components/calendar.js +425 -0
- package/dist/components/card.d.ts +17 -0
- package/dist/components/card.js +139 -0
- package/dist/components/carousel.d.ts +59 -0
- package/dist/components/carousel.js +503 -0
- package/dist/components/checkbox.d.ts +16 -0
- package/dist/components/checkbox.js +86 -0
- package/dist/components/circular-progress.d.ts +28 -0
- package/dist/components/circular-progress.js +127 -0
- package/dist/components/collapsible.d.ts +8 -0
- package/dist/components/collapsible.js +27 -0
- package/dist/components/color-picker.d.ts +159 -0
- package/dist/components/color-picker.js +1589 -0
- package/dist/components/combobox.d.ts +46 -0
- package/dist/components/combobox.js +237 -0
- package/dist/components/command.d.ts +22 -0
- package/dist/components/command.js +129 -0
- package/dist/components/context-menu.d.ts +38 -0
- package/dist/components/context-menu.js +164 -0
- package/dist/components/copy-to-clipboard.d.ts +32 -0
- package/dist/components/copy-to-clipboard.js +83 -0
- package/dist/components/corner-badge.d.ts +22 -0
- package/dist/components/corner-badge.js +84 -0
- package/dist/components/dashboard-grid.d.ts +83 -0
- package/dist/components/dashboard-grid.js +486 -0
- package/dist/components/date-picker.d.ts +29 -0
- package/dist/components/date-picker.js +261 -0
- package/dist/components/dialog.d.ts +26 -0
- package/dist/components/dialog.js +97 -0
- package/dist/components/dot-matrix.d.ts +32 -0
- package/dist/components/dot-matrix.js +707 -0
- package/dist/components/draggable.d.ts +42 -0
- package/dist/components/draggable.js +346 -0
- package/dist/components/drawer.d.ts +66 -0
- package/dist/components/drawer.js +304 -0
- package/dist/components/empty.d.ts +14 -0
- package/dist/components/empty.js +75 -0
- package/dist/components/field.d.ts +12 -0
- package/dist/components/field.js +44 -0
- package/dist/components/fieldset.d.ts +7 -0
- package/dist/components/fieldset.js +21 -0
- package/dist/components/file-upload.d.ts +61 -0
- package/dist/components/file-upload.js +482 -0
- package/dist/components/form.d.ts +6 -0
- package/dist/components/form.js +14 -0
- package/dist/components/frame.d.ts +10 -0
- package/dist/components/frame.js +47 -0
- package/dist/components/gauge.d.ts +27 -0
- package/dist/components/gauge.js +74 -0
- package/dist/components/grid.d.ts +26 -0
- package/dist/components/grid.js +204 -0
- package/dist/components/group.d.ts +19 -0
- package/dist/components/group.js +45 -0
- package/dist/components/input-group.d.ts +15 -0
- package/dist/components/input-group.js +61 -0
- package/dist/components/input-otp.d.ts +24 -0
- package/dist/components/input-otp.js +50 -0
- package/dist/components/input-payment.d.ts +131 -0
- package/dist/components/input-payment.js +1140 -0
- package/dist/components/input-phone.d.ts +70 -0
- package/dist/components/input-phone.js +657 -0
- package/dist/components/input-sensitive.d.ts +12 -0
- package/dist/components/input-sensitive.js +169 -0
- package/dist/components/input.d.ts +13 -0
- package/dist/components/input.js +26 -0
- package/dist/components/kbd.d.ts +6 -0
- package/dist/components/kbd.js +19 -0
- package/dist/components/kinetic-click.d.ts +48 -0
- package/dist/components/kinetic-click.js +1184 -0
- package/dist/components/label.d.ts +6 -0
- package/dist/components/label.js +18 -0
- package/dist/components/list-box.d.ts +20 -0
- package/dist/components/list-box.js +148 -0
- package/dist/components/loader.d.ts +13 -0
- package/dist/components/loader.js +430 -0
- package/dist/components/marker.d.ts +15 -0
- package/dist/components/marker.js +59 -0
- package/dist/components/menu.d.ts +42 -0
- package/dist/components/menu.js +186 -0
- package/dist/components/menubar.d.ts +40 -0
- package/dist/components/menubar.js +107 -0
- package/dist/components/message.d.ts +33 -0
- package/dist/components/message.js +112 -0
- package/dist/components/meter.d.ts +10 -0
- package/dist/components/meter.js +42 -0
- package/dist/components/morphic-toast.d.ts +61 -0
- package/dist/components/morphic-toast.js +916 -0
- package/dist/components/navigation-menu.d.ts +26 -0
- package/dist/components/navigation-menu.js +116 -0
- package/dist/components/number-field.d.ts +15 -0
- package/dist/components/number-field.js +86 -0
- package/dist/components/option-picker.d.ts +18 -0
- package/dist/components/option-picker.js +89 -0
- package/dist/components/orb.d.ts +38 -0
- package/dist/components/orb.js +1413 -0
- package/dist/components/pagination.d.ts +25 -0
- package/dist/components/pagination.js +147 -0
- package/dist/components/popover.d.ts +22 -0
- package/dist/components/popover.js +79 -0
- package/dist/components/preview-card.d.ts +16 -0
- package/dist/components/preview-card.js +60 -0
- package/dist/components/progress.d.ts +21 -0
- package/dist/components/progress.js +139 -0
- package/dist/components/radio.d.ts +16 -0
- package/dist/components/radio.js +68 -0
- package/dist/components/resizable.d.ts +58 -0
- package/dist/components/resizable.js +964 -0
- package/dist/components/ruler-picker.d.ts +27 -0
- package/dist/components/ruler-picker.js +253 -0
- package/dist/components/scroll-area.d.ts +13 -0
- package/dist/components/scroll-area.js +34 -0
- package/dist/components/scroll-bar.d.ts +13 -0
- package/dist/components/scroll-bar.js +47 -0
- package/dist/components/select.d.ts +29 -0
- package/dist/components/select.js +140 -0
- package/dist/components/separator.d.ts +6 -0
- package/dist/components/separator.js +15 -0
- package/dist/components/sidebar.d.ts +65 -0
- package/dist/components/sidebar.js +408 -0
- package/dist/components/skeleton.d.ts +5 -0
- package/dist/components/skeleton.js +12 -0
- package/dist/components/slider.d.ts +12 -0
- package/dist/components/slider.js +96 -0
- package/dist/components/sortable.d.ts +44 -0
- package/dist/components/sortable.js +327 -0
- package/dist/components/switch.d.ts +15 -0
- package/dist/components/switch.js +63 -0
- package/dist/components/table.d.ts +12 -0
- package/dist/components/table.js +65 -0
- package/dist/components/tabs.d.ts +12 -0
- package/dist/components/tabs.js +39 -0
- package/dist/components/text.d.ts +14 -0
- package/dist/components/text.js +69 -0
- package/dist/components/textarea.d.ts +9 -0
- package/dist/components/textarea.js +20 -0
- package/dist/components/theme-provider.d.ts +52 -0
- package/dist/components/theme-provider.js +148 -0
- package/dist/components/timeline.d.ts +34 -0
- package/dist/components/timeline.js +147 -0
- package/dist/components/toast.d.ts +17 -0
- package/dist/components/toast.js +161 -0
- package/dist/components/toggle-group.d.ts +14 -0
- package/dist/components/toggle-group.js +53 -0
- package/dist/components/toggle.d.ts +11 -0
- package/dist/components/toggle.js +36 -0
- package/dist/components/toolbar.d.ts +11 -0
- package/dist/components/toolbar.js +49 -0
- package/dist/components/tooltip.d.ts +17 -0
- package/dist/components/tooltip.js +56 -0
- package/dist/components/waveform.d.ts +61 -0
- package/dist/components/waveform.js +500 -0
- package/dist/components/wheel-picker.d.ts +44 -0
- package/dist/components/wheel-picker.js +771 -0
- package/dist/hooks/use-copy-to-clipboard.d.ts +9 -0
- package/dist/hooks/use-copy-to-clipboard.js +36 -0
- package/dist/hooks/use-media-query.d.ts +21 -0
- package/dist/hooks/use-media-query.js +58 -0
- package/dist/styles.css +202 -0
- package/dist/themes/afterglow.css +89 -0
- package/dist/themes/afterglow.scoped.css +90 -0
- package/dist/themes/blacklight.css +89 -0
- package/dist/themes/blacklight.scoped.css +90 -0
- package/dist/themes/cathode.css +89 -0
- package/dist/themes/cathode.scoped.css +90 -0
- package/dist/themes/cel.css +89 -0
- package/dist/themes/cel.scoped.css +90 -0
- package/dist/themes/cinder.css +89 -0
- package/dist/themes/cinder.scoped.css +90 -0
- package/dist/themes/clay.css +89 -0
- package/dist/themes/clay.scoped.css +90 -0
- package/dist/themes/cobalt.css +89 -0
- package/dist/themes/cobalt.scoped.css +90 -0
- package/dist/themes/crimson.css +89 -0
- package/dist/themes/crimson.scoped.css +90 -0
- package/dist/themes/ion.css +89 -0
- package/dist/themes/ion.scoped.css +90 -0
- package/dist/themes/iris.css +89 -0
- package/dist/themes/iris.scoped.css +90 -0
- package/dist/themes/lagoon.css +89 -0
- package/dist/themes/lagoon.scoped.css +90 -0
- package/dist/themes/mochi.css +89 -0
- package/dist/themes/mochi.scoped.css +90 -0
- package/dist/themes/riso.css +89 -0
- package/dist/themes/riso.scoped.css +90 -0
- package/dist/themes/roast.css +89 -0
- package/dist/themes/roast.scoped.css +90 -0
- package/dist/themes/sage.css +89 -0
- package/dist/themes/sage.scoped.css +90 -0
- package/dist/themes/sepia.css +89 -0
- package/dist/themes/sepia.scoped.css +90 -0
- package/dist/themes/sorbet.css +89 -0
- package/dist/themes/sorbet.scoped.css +90 -0
- package/dist/themes/taffy.css +89 -0
- package/dist/themes/taffy.scoped.css +90 -0
- package/dist/themes/toxin.css +89 -0
- package/dist/themes/toxin.scoped.css +90 -0
- package/package.json +140 -0
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import * as React$1 from "react";
|
|
2
|
+
import { Combobox as Combobox$1, ComboboxItemCollection, CreateComboboxItemsOptions as ComboboxCreateItemsOptions } from "@base-ui/react/combobox";
|
|
3
|
+
//#region src/components/combobox.d.ts
|
|
4
|
+
declare function Combobox<Value, Multiple extends boolean | undefined = false, Item = Value>(props: Combobox$1.Root.Props<Value, Multiple, Item>): React$1.JSX.Element;
|
|
5
|
+
declare function ComboboxChipsInput({ className, size, ...props }: Omit<Combobox$1.Input.Props, "size"> & {
|
|
6
|
+
size?: "sm" | "default" | "lg" | number;
|
|
7
|
+
ref?: React$1.Ref<HTMLInputElement>;
|
|
8
|
+
}): React$1.JSX.Element;
|
|
9
|
+
declare function ComboboxInput({ className, showTrigger, showClear, startAddon, size, triggerProps, clearProps, ...props }: Omit<Combobox$1.Input.Props, "size"> & {
|
|
10
|
+
showTrigger?: boolean;
|
|
11
|
+
showClear?: boolean;
|
|
12
|
+
startAddon?: React$1.ReactNode;
|
|
13
|
+
size?: "sm" | "default" | "lg" | number;
|
|
14
|
+
ref?: React$1.Ref<HTMLInputElement>;
|
|
15
|
+
triggerProps?: Combobox$1.Trigger.Props;
|
|
16
|
+
clearProps?: Combobox$1.Clear.Props;
|
|
17
|
+
}): React$1.JSX.Element;
|
|
18
|
+
declare function ComboboxTrigger({ className, children, ...props }: Combobox$1.Trigger.Props): React$1.JSX.Element;
|
|
19
|
+
declare function ComboboxPopup({ className, children, side, sideOffset, alignOffset, align, anchor: anchorProp, ...props }: Combobox$1.Popup.Props & {
|
|
20
|
+
align?: Combobox$1.Positioner.Props["align"];
|
|
21
|
+
sideOffset?: Combobox$1.Positioner.Props["sideOffset"];
|
|
22
|
+
alignOffset?: Combobox$1.Positioner.Props["alignOffset"];
|
|
23
|
+
side?: Combobox$1.Positioner.Props["side"];
|
|
24
|
+
anchor?: Combobox$1.Positioner.Props["anchor"];
|
|
25
|
+
}): React$1.JSX.Element;
|
|
26
|
+
declare function ComboboxItem({ className, children, ...props }: Combobox$1.Item.Props): React$1.JSX.Element;
|
|
27
|
+
declare function ComboboxSeparator({ className, ...props }: Combobox$1.Separator.Props): React$1.JSX.Element;
|
|
28
|
+
declare function ComboboxGroup({ className, ...props }: Combobox$1.Group.Props): React$1.JSX.Element;
|
|
29
|
+
declare function ComboboxGroupLabel({ className, ...props }: Combobox$1.GroupLabel.Props): React$1.JSX.Element;
|
|
30
|
+
declare function ComboboxEmpty({ className, ...props }: Combobox$1.Empty.Props): React$1.JSX.Element;
|
|
31
|
+
declare function ComboboxRow({ className, ...props }: Combobox$1.Row.Props): React$1.JSX.Element;
|
|
32
|
+
declare function ComboboxValue({ ...props }: Combobox$1.Value.Props): React$1.JSX.Element;
|
|
33
|
+
declare function ComboboxList({ className, ...props }: Combobox$1.List.Props): React$1.JSX.Element;
|
|
34
|
+
declare function ComboboxClear({ className, ...props }: Combobox$1.Clear.Props): React$1.JSX.Element;
|
|
35
|
+
declare function ComboboxStatus({ className, ...props }: Combobox$1.Status.Props): React$1.JSX.Element;
|
|
36
|
+
declare function ComboboxCollection(props: Combobox$1.Collection.Props): React$1.JSX.Element;
|
|
37
|
+
declare function ComboboxChips({ className, children, startAddon, ...props }: Combobox$1.Chips.Props & {
|
|
38
|
+
startAddon?: React$1.ReactNode;
|
|
39
|
+
}): React$1.JSX.Element;
|
|
40
|
+
declare function ComboboxChip({ children, removeProps, ...props }: Combobox$1.Chip.Props & {
|
|
41
|
+
removeProps?: Combobox$1.ChipRemove.Props;
|
|
42
|
+
}): React$1.JSX.Element;
|
|
43
|
+
declare const createComboboxItems: typeof Combobox$1.createItems;
|
|
44
|
+
declare const useComboboxFilter: typeof Combobox$1.useFilter;
|
|
45
|
+
//#endregion
|
|
46
|
+
export { Combobox, ComboboxChip, ComboboxChips, ComboboxChipsInput, ComboboxClear, ComboboxCollection, type ComboboxCreateItemsOptions, ComboboxEmpty, ComboboxGroup, ComboboxGroupLabel, ComboboxInput, ComboboxItem, type ComboboxItemCollection, ComboboxList, ComboboxPopup, ComboboxRow, ComboboxSeparator, ComboboxStatus, ComboboxTrigger, ComboboxValue, createComboboxItems, useComboboxFilter };
|
|
@@ -0,0 +1,237 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { Input } from "./input.js";
|
|
3
|
+
import { ScrollArea } from "./scroll-area.js";
|
|
4
|
+
import { cn } from "cn";
|
|
5
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
6
|
+
import * as React$1 from "react";
|
|
7
|
+
import { Cancel } from "xiod-icons/icons/Cancel";
|
|
8
|
+
import { UnfoldMore } from "xiod-icons/icons/UnfoldMore";
|
|
9
|
+
import { Combobox as Combobox$1 } from "@base-ui/react/combobox";
|
|
10
|
+
//#region src/components/combobox.tsx
|
|
11
|
+
const ComboboxContext = React$1.createContext({
|
|
12
|
+
chipsRef: null,
|
|
13
|
+
multiple: false
|
|
14
|
+
});
|
|
15
|
+
function Combobox(props) {
|
|
16
|
+
const chipsRef = React$1.useRef(null);
|
|
17
|
+
const contextValue = React$1.useMemo(() => ({
|
|
18
|
+
chipsRef,
|
|
19
|
+
multiple: Boolean(props.multiple)
|
|
20
|
+
}), [props.multiple]);
|
|
21
|
+
return /* @__PURE__ */ jsx(ComboboxContext.Provider, {
|
|
22
|
+
value: contextValue,
|
|
23
|
+
children: /* @__PURE__ */ jsx(Combobox$1.Root, { ...props })
|
|
24
|
+
});
|
|
25
|
+
}
|
|
26
|
+
function ComboboxChipsInput({ className, size, ...props }) {
|
|
27
|
+
const sizeValue = size ?? "default";
|
|
28
|
+
return /* @__PURE__ */ jsx(Combobox$1.Input, {
|
|
29
|
+
className: cn("min-w-12 flex-1 text-base outline-none sm:text-sm [[data-slot=combobox-chip]+&]:ps-0.5", sizeValue === "sm" ? "ps-1.5" : "ps-2", className),
|
|
30
|
+
"data-size": typeof sizeValue === "string" ? sizeValue : void 0,
|
|
31
|
+
"data-slot": "combobox-chips-input",
|
|
32
|
+
size: typeof sizeValue === "number" ? sizeValue : void 0,
|
|
33
|
+
...props
|
|
34
|
+
});
|
|
35
|
+
}
|
|
36
|
+
function ComboboxInput({ className, showTrigger = true, showClear = false, startAddon, size, triggerProps, clearProps, ...props }) {
|
|
37
|
+
const sizeValue = size ?? "default";
|
|
38
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
39
|
+
className: "relative not-has-[>*.w-full]:w-fit w-full text-foreground has-disabled:opacity-64",
|
|
40
|
+
children: [
|
|
41
|
+
startAddon && /* @__PURE__ */ jsx("div", {
|
|
42
|
+
"aria-hidden": "true",
|
|
43
|
+
className: "[&_svg]:-mx-0.5 pointer-events-none absolute inset-y-0 inset-s-px z-10 flex items-center ps-[calc(--spacing(3)-1px)] opacity-80 has-[+[data-size=sm]]:ps-[calc(--spacing(2.5)-1px)] [&_svg:not([class*='size-'])]:size-4.5 sm:[&_svg:not([class*='size-'])]:size-4",
|
|
44
|
+
"data-slot": "combobox-start-addon",
|
|
45
|
+
children: startAddon
|
|
46
|
+
}),
|
|
47
|
+
/* @__PURE__ */ jsx(Combobox$1.Input, {
|
|
48
|
+
className: cn(startAddon && "data-[size=sm]:*:data-[slot=combobox-input]:ps-[calc(--spacing(7.5)-1px)] *:data-[slot=combobox-input]:ps-[calc(--spacing(8.5)-1px)] sm:data-[size=sm]:*:data-[slot=combobox-input]:ps-[calc(--spacing(7)-1px)] sm:*:data-[slot=combobox-input]:ps-[calc(--spacing(8)-1px)]", sizeValue === "sm" ? "has-[+[data-slot=combobox-trigger],+[data-slot=combobox-clear]]:*:data-[slot=combobox-input]:pe-6.5" : "has-[+[data-slot=combobox-trigger],+[data-slot=combobox-clear]]:*:data-[slot=combobox-input]:pe-7", className),
|
|
49
|
+
"data-slot": "combobox-input",
|
|
50
|
+
render: /* @__PURE__ */ jsx(Input, {
|
|
51
|
+
className: "has-disabled:opacity-[1]",
|
|
52
|
+
nativeInput: true,
|
|
53
|
+
size: sizeValue
|
|
54
|
+
}),
|
|
55
|
+
...props
|
|
56
|
+
}),
|
|
57
|
+
showTrigger && /* @__PURE__ */ jsx(ComboboxTrigger, {
|
|
58
|
+
"aria-label": "Open suggestions",
|
|
59
|
+
className: cn("-translate-y-1/2 absolute top-1/2 inline-flex size-8 shrink-0 cursor-pointer items-center justify-center rounded-md border border-transparent opacity-80 outline-none transition-opacity pointer-coarse:after:absolute pointer-coarse:after:min-h-11 pointer-coarse:after:min-w-11 hover:opacity-100 has-[+[data-slot=combobox-clear]]:hidden sm:size-7 [&_svg:not([class*='size-'])]:size-4.5 sm:[&_svg:not([class*='size-'])]:size-4 [&_svg]:pointer-events-none [&_svg]:shrink-0", sizeValue === "sm" ? "inset-e-0" : "inset-e-0.5"),
|
|
60
|
+
...triggerProps,
|
|
61
|
+
children: /* @__PURE__ */ jsx(Combobox$1.Icon, {
|
|
62
|
+
"data-slot": "combobox-icon",
|
|
63
|
+
children: /* @__PURE__ */ jsx(UnfoldMore, {})
|
|
64
|
+
})
|
|
65
|
+
}),
|
|
66
|
+
showClear && /* @__PURE__ */ jsx(ComboboxClear, {
|
|
67
|
+
"aria-label": "Clear value",
|
|
68
|
+
className: cn("-translate-y-1/2 absolute top-1/2 inline-flex size-8 shrink-0 cursor-pointer items-center justify-center rounded-md border border-transparent opacity-80 outline-none transition-opacity pointer-coarse:after:absolute pointer-coarse:after:min-h-11 pointer-coarse:after:min-w-11 hover:opacity-100 has-[+[data-slot=combobox-clear]]:hidden sm:size-7 [&_svg:not([class*='size-'])]:size-4.5 sm:[&_svg:not([class*='size-'])]:size-4 [&_svg]:pointer-events-none [&_svg]:shrink-0", sizeValue === "sm" ? "inset-e-0" : "inset-e-0.5"),
|
|
69
|
+
...clearProps,
|
|
70
|
+
children: /* @__PURE__ */ jsx(Cancel, {})
|
|
71
|
+
})
|
|
72
|
+
]
|
|
73
|
+
});
|
|
74
|
+
}
|
|
75
|
+
function ComboboxTrigger({ className, children, ...props }) {
|
|
76
|
+
return /* @__PURE__ */ jsx(Combobox$1.Trigger, {
|
|
77
|
+
className: cn(className),
|
|
78
|
+
"data-slot": "combobox-trigger",
|
|
79
|
+
...props,
|
|
80
|
+
children
|
|
81
|
+
});
|
|
82
|
+
}
|
|
83
|
+
function ComboboxPopup({ className, children, side = "bottom", sideOffset = 4, alignOffset, align = "start", anchor: anchorProp, ...props }) {
|
|
84
|
+
const { chipsRef } = React$1.useContext(ComboboxContext);
|
|
85
|
+
const anchor = anchorProp ?? chipsRef;
|
|
86
|
+
return /* @__PURE__ */ jsx(Combobox$1.Portal, { children: /* @__PURE__ */ jsx(Combobox$1.Positioner, {
|
|
87
|
+
align,
|
|
88
|
+
alignOffset,
|
|
89
|
+
anchor,
|
|
90
|
+
className: "z-50 select-none",
|
|
91
|
+
"data-slot": "combobox-positioner",
|
|
92
|
+
side,
|
|
93
|
+
sideOffset,
|
|
94
|
+
children: /* @__PURE__ */ jsx("span", {
|
|
95
|
+
className: cn("relative flex max-h-full min-w-(--anchor-width) max-w-(--available-width) origin-(--transform-origin) rounded-lg border bg-popover not-dark:bg-clip-padding shadow-lg/5 transition-[scale,opacity] duration-100 ease-out data-ending-style:scale-97 data-starting-style:scale-97 data-ending-style:opacity-0 data-starting-style:opacity-0 before:pointer-events-none before:absolute before:inset-0 before:rounded-[calc(var(--radius-lg)-1px)] before:shadow-[0_1px_--theme(--color-black/4%)] dark:before:shadow-[0_-1px_--theme(--color-white/6%)]", className),
|
|
96
|
+
children: /* @__PURE__ */ jsx(Combobox$1.Popup, {
|
|
97
|
+
className: "flex max-h-[min(var(--available-height),23rem)] flex-1 flex-col text-foreground",
|
|
98
|
+
"data-slot": "combobox-popup",
|
|
99
|
+
...props,
|
|
100
|
+
children
|
|
101
|
+
})
|
|
102
|
+
})
|
|
103
|
+
}) });
|
|
104
|
+
}
|
|
105
|
+
function ComboboxItem({ className, children, ...props }) {
|
|
106
|
+
return /* @__PURE__ */ jsxs(Combobox$1.Item, {
|
|
107
|
+
className: cn("grid min-h-8 in-data-[side=none]:min-w-[calc(var(--anchor-width)+1.25rem)] cursor-default grid-cols-[1rem_1fr] items-center gap-2 rounded-sm py-1 ps-2 pe-4 text-base outline-none data-disabled:pointer-events-none data-highlighted:bg-accent data-highlighted:text-accent-foreground data-disabled:opacity-64 sm:min-h-7 sm:text-sm [&_svg:not([class*='size-'])]:size-4.5 sm:[&_svg:not([class*='size-'])]:size-4 [&_svg]:pointer-events-none [&_svg]:shrink-0", className),
|
|
108
|
+
"data-slot": "combobox-item",
|
|
109
|
+
...props,
|
|
110
|
+
children: [/* @__PURE__ */ jsx(Combobox$1.ItemIndicator, {
|
|
111
|
+
className: "col-start-1",
|
|
112
|
+
children: /* @__PURE__ */ jsx("svg", {
|
|
113
|
+
fill: "none",
|
|
114
|
+
height: "24",
|
|
115
|
+
stroke: "currentColor",
|
|
116
|
+
strokeLinecap: "round",
|
|
117
|
+
strokeLinejoin: "round",
|
|
118
|
+
strokeWidth: "2",
|
|
119
|
+
viewBox: "0 0 24 24",
|
|
120
|
+
width: "24",
|
|
121
|
+
xmlns: "http://www.w3.org/1500/svg",
|
|
122
|
+
children: /* @__PURE__ */ jsx("path", { d: "M5.252 12.7 10.2 18.63 18.748 5.37" })
|
|
123
|
+
})
|
|
124
|
+
}), /* @__PURE__ */ jsx("div", {
|
|
125
|
+
className: "col-start-2",
|
|
126
|
+
children
|
|
127
|
+
})]
|
|
128
|
+
});
|
|
129
|
+
}
|
|
130
|
+
function ComboboxSeparator({ className, ...props }) {
|
|
131
|
+
return /* @__PURE__ */ jsx(Combobox$1.Separator, {
|
|
132
|
+
className: cn("mx-2 my-1 h-px bg-border last:hidden", className),
|
|
133
|
+
"data-slot": "combobox-separator",
|
|
134
|
+
...props
|
|
135
|
+
});
|
|
136
|
+
}
|
|
137
|
+
function ComboboxGroup({ className, ...props }) {
|
|
138
|
+
return /* @__PURE__ */ jsx(Combobox$1.Group, {
|
|
139
|
+
className: cn("[[role=group]+&]:mt-1.5", className),
|
|
140
|
+
"data-slot": "combobox-group",
|
|
141
|
+
...props
|
|
142
|
+
});
|
|
143
|
+
}
|
|
144
|
+
function ComboboxGroupLabel({ className, ...props }) {
|
|
145
|
+
return /* @__PURE__ */ jsx(Combobox$1.GroupLabel, {
|
|
146
|
+
className: cn("px-2 py-1.5 font-medium text-muted-foreground text-xs", className),
|
|
147
|
+
"data-slot": "combobox-group-label",
|
|
148
|
+
...props
|
|
149
|
+
});
|
|
150
|
+
}
|
|
151
|
+
function ComboboxEmpty({ className, ...props }) {
|
|
152
|
+
return /* @__PURE__ */ jsx(Combobox$1.Empty, {
|
|
153
|
+
className: cn("not-empty:p-2 text-center text-base text-muted-foreground sm:text-sm", className),
|
|
154
|
+
"data-slot": "combobox-empty",
|
|
155
|
+
...props
|
|
156
|
+
});
|
|
157
|
+
}
|
|
158
|
+
function ComboboxRow({ className, ...props }) {
|
|
159
|
+
return /* @__PURE__ */ jsx(Combobox$1.Row, {
|
|
160
|
+
className: cn(className),
|
|
161
|
+
"data-slot": "combobox-row",
|
|
162
|
+
...props
|
|
163
|
+
});
|
|
164
|
+
}
|
|
165
|
+
function ComboboxValue({ ...props }) {
|
|
166
|
+
return /* @__PURE__ */ jsx(Combobox$1.Value, {
|
|
167
|
+
"data-slot": "combobox-value",
|
|
168
|
+
...props
|
|
169
|
+
});
|
|
170
|
+
}
|
|
171
|
+
function ComboboxList({ className, ...props }) {
|
|
172
|
+
return /* @__PURE__ */ jsx(ScrollArea, {
|
|
173
|
+
scrollbarGutter: true,
|
|
174
|
+
scrollFade: true,
|
|
175
|
+
children: /* @__PURE__ */ jsx(Combobox$1.List, {
|
|
176
|
+
className: cn("not-empty:scroll-py-1 not-empty:px-1 not-empty:py-1 in-data-has-overflow-y:pe-3", className),
|
|
177
|
+
"data-slot": "combobox-list",
|
|
178
|
+
...props
|
|
179
|
+
})
|
|
180
|
+
});
|
|
181
|
+
}
|
|
182
|
+
function ComboboxClear({ className, ...props }) {
|
|
183
|
+
return /* @__PURE__ */ jsx(Combobox$1.Clear, {
|
|
184
|
+
className: cn(className),
|
|
185
|
+
"data-slot": "combobox-clear",
|
|
186
|
+
...props
|
|
187
|
+
});
|
|
188
|
+
}
|
|
189
|
+
function ComboboxStatus({ className, ...props }) {
|
|
190
|
+
return /* @__PURE__ */ jsx(Combobox$1.Status, {
|
|
191
|
+
className: cn("px-3 py-2 font-medium text-muted-foreground text-xs empty:m-0 empty:p-0", className),
|
|
192
|
+
"data-slot": "combobox-status",
|
|
193
|
+
...props
|
|
194
|
+
});
|
|
195
|
+
}
|
|
196
|
+
function ComboboxCollection(props) {
|
|
197
|
+
return /* @__PURE__ */ jsx(Combobox$1.Collection, {
|
|
198
|
+
"data-slot": "combobox-collection",
|
|
199
|
+
...props
|
|
200
|
+
});
|
|
201
|
+
}
|
|
202
|
+
function ComboboxChips({ className, children, startAddon, ...props }) {
|
|
203
|
+
const { chipsRef } = React$1.useContext(ComboboxContext);
|
|
204
|
+
return /* @__PURE__ */ jsxs(Combobox$1.Chips, {
|
|
205
|
+
className: cn("relative inline-flex min-h-9 w-full flex-wrap gap-1 rounded-lg border border-input bg-background not-dark:bg-clip-padding p-[calc(--spacing(1)-1px)] text-base shadow-xs/5 outline-none ring-ring/24 transition-shadow *:min-h-7 before:pointer-events-none before:absolute before:inset-0 before:rounded-[calc(var(--radius-lg)-1px)] not-has-disabled:not-focus-within:not-aria-invalid:before:shadow-[0_1px_--theme(--color-black/4%)] focus-within:border-ring focus-within:ring-[3px] has-disabled:pointer-events-none has-data-[size=lg]:min-h-10 has-data-[size=sm]:min-h-8 has-aria-invalid:border-destructive/36 has-autofill:bg-foreground/4 has-disabled:opacity-64 has-[:disabled,:focus-within,[aria-invalid]]:shadow-none focus-within:has-aria-invalid:border-destructive/64 focus-within:has-aria-invalid:ring-destructive/16 has-data-[size=lg]:*:min-h-8 has-data-[size=sm]:*:min-h-6 sm:min-h-8 sm:text-sm sm:has-data-[size=lg]:min-h-9 sm:has-data-[size=sm]:min-h-7 sm:*:min-h-6 sm:has-data-[size=lg]:*:min-h-7 sm:has-data-[size=sm]:*:min-h-5 dark:not-has-disabled:bg-input/32 dark:has-autofill:bg-foreground/8 dark:has-aria-invalid:ring-destructive/24 dark:not-has-disabled:not-focus-within:not-aria-invalid:before:shadow-[0_-1px_--theme(--color-white/6%)]", className),
|
|
206
|
+
"data-slot": "combobox-chips",
|
|
207
|
+
ref: chipsRef,
|
|
208
|
+
...props,
|
|
209
|
+
children: [startAddon && /* @__PURE__ */ jsx("div", {
|
|
210
|
+
"aria-hidden": "true",
|
|
211
|
+
className: "[&_svg]:-ms-0.5 [&_svg]:-me-1.5 flex shrink-0 items-center ps-2 opacity-80 has-[~[data-size=sm]]:has-[+[data-slot=combobox-chip]]:pe-1.5 has-[~[data-size=sm]]:ps-1.5 has-[+[data-slot=combobox-chip]]:pe-2 [&_svg:not([class*='size-'])]:size-4.5 sm:[&_svg:not([class*='size-'])]:size-4 [&_svg]:pointer-events-none",
|
|
212
|
+
"data-slot": "combobox-start-addon",
|
|
213
|
+
children: startAddon
|
|
214
|
+
}), children]
|
|
215
|
+
});
|
|
216
|
+
}
|
|
217
|
+
function ComboboxChip({ children, removeProps, ...props }) {
|
|
218
|
+
return /* @__PURE__ */ jsxs(Combobox$1.Chip, {
|
|
219
|
+
className: "flex items-center rounded-[calc(var(--radius-md)-1px)] bg-accent ps-2 font-medium text-accent-foreground text-sm outline-none sm:text-xs/(--text-xs--line-height) [&_svg:not([class*='size-'])]:size-4 sm:[&_svg:not([class*='size-'])]:size-3.5",
|
|
220
|
+
"data-slot": "combobox-chip",
|
|
221
|
+
...props,
|
|
222
|
+
children: [children, /* @__PURE__ */ jsx(ComboboxChipRemove, { ...removeProps })]
|
|
223
|
+
});
|
|
224
|
+
}
|
|
225
|
+
function ComboboxChipRemove(props) {
|
|
226
|
+
return /* @__PURE__ */ jsx(Combobox$1.ChipRemove, {
|
|
227
|
+
"aria-label": "Remove",
|
|
228
|
+
className: "h-full shrink-0 cursor-pointer px-1.5 opacity-80 hover:opacity-100 [&_svg:not([class*='size-'])]:size-4 sm:[&_svg:not([class*='size-'])]:size-3.5",
|
|
229
|
+
"data-slot": "combobox-chip-remove",
|
|
230
|
+
...props,
|
|
231
|
+
children: /* @__PURE__ */ jsx(Cancel, {})
|
|
232
|
+
});
|
|
233
|
+
}
|
|
234
|
+
const createComboboxItems = Combobox$1.createItems;
|
|
235
|
+
const useComboboxFilter = Combobox$1.useFilter;
|
|
236
|
+
//#endregion
|
|
237
|
+
export { Combobox, ComboboxChip, ComboboxChips, ComboboxChipsInput, ComboboxClear, ComboboxCollection, ComboboxEmpty, ComboboxGroup, ComboboxGroupLabel, ComboboxInput, ComboboxItem, ComboboxList, ComboboxPopup, ComboboxRow, ComboboxSeparator, ComboboxStatus, ComboboxTrigger, ComboboxValue, createComboboxItems, useComboboxFilter };
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { Autocomplete, AutocompleteCollection, AutocompleteEmpty, AutocompleteGroup, AutocompleteGroupLabel, AutocompleteInput, AutocompleteItem, AutocompleteList, AutocompleteSeparator } from "./autocomplete.js";
|
|
2
|
+
import * as React$1 from "react";
|
|
3
|
+
import { Dialog } from "@base-ui/react/dialog";
|
|
4
|
+
//#region src/components/command.d.ts
|
|
5
|
+
declare const CommandDialog: <Payload>(props: Dialog.Root.Props<Payload>) => React$1.JSX.Element;
|
|
6
|
+
declare const CommandCreateHandle: typeof Dialog.createHandle;
|
|
7
|
+
declare function CommandDialogTrigger(props: Dialog.Trigger.Props): React$1.JSX.Element;
|
|
8
|
+
declare function CommandDialogPopup({ className, children, ...props }: Dialog.Popup.Props): React$1.JSX.Element;
|
|
9
|
+
declare function Command({ autoHighlight, keepHighlight, ...props }: React$1.ComponentProps<typeof Autocomplete>): React$1.JSX.Element;
|
|
10
|
+
declare function CommandInput({ className, placeholder, ...props }: React$1.ComponentProps<typeof AutocompleteInput>): React$1.JSX.Element;
|
|
11
|
+
declare function CommandList({ className, ...props }: React$1.ComponentProps<typeof AutocompleteList>): React$1.JSX.Element;
|
|
12
|
+
declare function CommandEmpty({ className, ...props }: React$1.ComponentProps<typeof AutocompleteEmpty>): React$1.JSX.Element;
|
|
13
|
+
declare function CommandPanel({ className, ...props }: React$1.ComponentProps<"div">): React$1.JSX.Element;
|
|
14
|
+
declare function CommandGroup({ className, ...props }: React$1.ComponentProps<typeof AutocompleteGroup>): React$1.JSX.Element;
|
|
15
|
+
declare function CommandGroupLabel({ className, ...props }: React$1.ComponentProps<typeof AutocompleteGroupLabel>): React$1.JSX.Element;
|
|
16
|
+
declare function CommandCollection({ ...props }: React$1.ComponentProps<typeof AutocompleteCollection>): React$1.JSX.Element;
|
|
17
|
+
declare function CommandItem({ className, ...props }: React$1.ComponentProps<typeof AutocompleteItem>): React$1.JSX.Element;
|
|
18
|
+
declare function CommandSeparator({ className, ...props }: React$1.ComponentProps<typeof AutocompleteSeparator>): React$1.JSX.Element;
|
|
19
|
+
declare function CommandShortcut({ className, ...props }: React$1.ComponentProps<"kbd">): React$1.JSX.Element;
|
|
20
|
+
declare function CommandFooter({ className, ...props }: React$1.ComponentProps<"div">): React$1.JSX.Element;
|
|
21
|
+
//#endregion
|
|
22
|
+
export { Command, CommandCollection, CommandCreateHandle, CommandDialog, CommandDialogPopup, CommandDialogTrigger, CommandEmpty, CommandFooter, CommandGroup, CommandGroupLabel, CommandInput, CommandItem, CommandList, CommandPanel, CommandSeparator, CommandShortcut };
|
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { Autocomplete, AutocompleteCollection, AutocompleteEmpty, AutocompleteGroup, AutocompleteGroupLabel, AutocompleteInput, AutocompleteItem, AutocompleteList, AutocompleteSeparator } from "./autocomplete.js";
|
|
3
|
+
import { cn } from "cn";
|
|
4
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
5
|
+
import { Search } from "xiod-icons/icons/Search";
|
|
6
|
+
import { Dialog } from "@base-ui/react/dialog";
|
|
7
|
+
//#region src/components/command.tsx
|
|
8
|
+
const CommandDialog = Dialog.Root;
|
|
9
|
+
const CommandDialogPortal = Dialog.Portal;
|
|
10
|
+
const CommandCreateHandle = Dialog.createHandle;
|
|
11
|
+
function CommandDialogTrigger(props) {
|
|
12
|
+
return /* @__PURE__ */ jsx(Dialog.Trigger, {
|
|
13
|
+
"data-slot": "command-dialog-trigger",
|
|
14
|
+
...props
|
|
15
|
+
});
|
|
16
|
+
}
|
|
17
|
+
function CommandDialogBackdrop({ className, ...props }) {
|
|
18
|
+
return /* @__PURE__ */ jsx(Dialog.Backdrop, {
|
|
19
|
+
className: cn("fixed inset-0 z-50 bg-black/32 backdrop-blur-sm transition-all duration-200 data-ending-style:opacity-0 data-starting-style:opacity-0", className),
|
|
20
|
+
"data-slot": "command-dialog-backdrop",
|
|
21
|
+
...props
|
|
22
|
+
});
|
|
23
|
+
}
|
|
24
|
+
function CommandDialogViewport({ className, ...props }) {
|
|
25
|
+
return /* @__PURE__ */ jsx(Dialog.Viewport, {
|
|
26
|
+
className: cn("fixed inset-0 z-50 flex flex-col items-center px-4 py-[max(--spacing(4),4vh)] sm:py-[10vh]", className),
|
|
27
|
+
"data-slot": "command-dialog-viewport",
|
|
28
|
+
...props
|
|
29
|
+
});
|
|
30
|
+
}
|
|
31
|
+
function CommandDialogPopup({ className, children, ...props }) {
|
|
32
|
+
return /* @__PURE__ */ jsxs(CommandDialogPortal, { children: [/* @__PURE__ */ jsx(CommandDialogBackdrop, {}), /* @__PURE__ */ jsx(CommandDialogViewport, { children: /* @__PURE__ */ jsx(Dialog.Popup, {
|
|
33
|
+
className: cn("translate-y-[calc(-1.25rem*var(--nested-dialogs))] relative row-start-2 flex max-h-105 min-h-0 w-full min-w-0 max-w-xl scale-[calc(1-0.1*var(--nested-dialogs))] flex-col rounded-2xl border bg-popover not-dark:bg-clip-padding text-popover-foreground opacity-[calc(1-0.1*var(--nested-dialogs))] shadow-lg/5 outline-none transition-[scale,opacity,translate] duration-200 ease-in-out will-change-transform before:pointer-events-none before:absolute before:inset-0 before:rounded-[calc(var(--radius-2xl)-1px)] before:bg-muted/72 before:shadow-[0_1px_--theme(--color-black/4%)] data-nested:data-ending-style:translate-y-8 data-nested:data-starting-style:translate-y-8 data-nested-dialog-open:origin-top data-ending-style:scale-98 data-starting-style:scale-98 data-ending-style:opacity-0 data-starting-style:opacity-0 **:data-[slot=scroll-area-viewport]:data-has-overflow-y:pe-1 dark:before:shadow-[0_-1px_--theme(--color-white/6%)]", className),
|
|
34
|
+
"data-slot": "command-dialog-popup",
|
|
35
|
+
...props,
|
|
36
|
+
children
|
|
37
|
+
}) })] });
|
|
38
|
+
}
|
|
39
|
+
function Command({ autoHighlight = "always", keepHighlight = true, ...props }) {
|
|
40
|
+
return /* @__PURE__ */ jsx(Autocomplete, {
|
|
41
|
+
autoHighlight,
|
|
42
|
+
inline: true,
|
|
43
|
+
keepHighlight,
|
|
44
|
+
open: true,
|
|
45
|
+
...props
|
|
46
|
+
});
|
|
47
|
+
}
|
|
48
|
+
function CommandInput({ className, placeholder, ...props }) {
|
|
49
|
+
return /* @__PURE__ */ jsx("div", {
|
|
50
|
+
className: "px-2.5 py-1.5",
|
|
51
|
+
children: /* @__PURE__ */ jsx(AutocompleteInput, {
|
|
52
|
+
className: cn("border-transparent! bg-transparent! shadow-none before:hidden has-focus-visible:ring-0", className),
|
|
53
|
+
placeholder,
|
|
54
|
+
size: "lg",
|
|
55
|
+
startAddon: /* @__PURE__ */ jsx(Search, {}),
|
|
56
|
+
...props
|
|
57
|
+
})
|
|
58
|
+
});
|
|
59
|
+
}
|
|
60
|
+
function CommandList({ className, ...props }) {
|
|
61
|
+
return /* @__PURE__ */ jsx(AutocompleteList, {
|
|
62
|
+
className: cn("not-empty:scroll-py-2 not-empty:p-2", className),
|
|
63
|
+
"data-slot": "command-list",
|
|
64
|
+
...props
|
|
65
|
+
});
|
|
66
|
+
}
|
|
67
|
+
function CommandEmpty({ className, ...props }) {
|
|
68
|
+
return /* @__PURE__ */ jsx(AutocompleteEmpty, {
|
|
69
|
+
className: cn("not-empty:py-6", className),
|
|
70
|
+
"data-slot": "command-empty",
|
|
71
|
+
...props
|
|
72
|
+
});
|
|
73
|
+
}
|
|
74
|
+
function CommandPanel({ className, ...props }) {
|
|
75
|
+
return /* @__PURE__ */ jsx("div", {
|
|
76
|
+
className: cn("-mx-px not-has-[+[data-slot=command-footer]]:-mb-px relative min-h-0 rounded-t-xl not-has-[+[data-slot=command-footer]]:rounded-b-2xl border border-b-0 bg-popover bg-clip-padding shadow-xs/5 [clip-path:inset(0_1px)] not-has-[+[data-slot=command-footer]]:[clip-path:inset(0_1px_1px_1px_round_0_0_calc(var(--radius-2xl)-1px)_calc(var(--radius-2xl)-1px))] before:pointer-events-none before:absolute before:inset-0 before:rounded-t-[calc(var(--radius-xl)-1px)] **:data-[slot=scroll-area-scrollbar]:mt-2", className),
|
|
77
|
+
...props
|
|
78
|
+
});
|
|
79
|
+
}
|
|
80
|
+
function CommandGroup({ className, ...props }) {
|
|
81
|
+
return /* @__PURE__ */ jsx(AutocompleteGroup, {
|
|
82
|
+
className: cn(className),
|
|
83
|
+
"data-slot": "command-group",
|
|
84
|
+
...props
|
|
85
|
+
});
|
|
86
|
+
}
|
|
87
|
+
function CommandGroupLabel({ className, ...props }) {
|
|
88
|
+
return /* @__PURE__ */ jsx(AutocompleteGroupLabel, {
|
|
89
|
+
className: cn(className),
|
|
90
|
+
"data-slot": "command-group-label",
|
|
91
|
+
...props
|
|
92
|
+
});
|
|
93
|
+
}
|
|
94
|
+
function CommandCollection({ ...props }) {
|
|
95
|
+
return /* @__PURE__ */ jsx(AutocompleteCollection, {
|
|
96
|
+
"data-slot": "command-collection",
|
|
97
|
+
...props
|
|
98
|
+
});
|
|
99
|
+
}
|
|
100
|
+
function CommandItem({ className, ...props }) {
|
|
101
|
+
return /* @__PURE__ */ jsx(AutocompleteItem, {
|
|
102
|
+
className: cn("py-1.5", className),
|
|
103
|
+
"data-slot": "command-item",
|
|
104
|
+
...props
|
|
105
|
+
});
|
|
106
|
+
}
|
|
107
|
+
function CommandSeparator({ className, ...props }) {
|
|
108
|
+
return /* @__PURE__ */ jsx(AutocompleteSeparator, {
|
|
109
|
+
className: cn("my-2", className),
|
|
110
|
+
"data-slot": "command-separator",
|
|
111
|
+
...props
|
|
112
|
+
});
|
|
113
|
+
}
|
|
114
|
+
function CommandShortcut({ className, ...props }) {
|
|
115
|
+
return /* @__PURE__ */ jsx("kbd", {
|
|
116
|
+
className: cn("ms-auto font-medium font-sans text-muted-foreground/72 text-xs tracking-widest", className),
|
|
117
|
+
"data-slot": "command-shortcut",
|
|
118
|
+
...props
|
|
119
|
+
});
|
|
120
|
+
}
|
|
121
|
+
function CommandFooter({ className, ...props }) {
|
|
122
|
+
return /* @__PURE__ */ jsx("div", {
|
|
123
|
+
className: cn("flex items-center justify-between gap-2 rounded-b-[calc(var(--radius-2xl)-1px)] border-t px-5 pt-[calc(--spacing(3)-1px)] pb-3 text-muted-foreground text-xs", className),
|
|
124
|
+
"data-slot": "command-footer",
|
|
125
|
+
...props
|
|
126
|
+
});
|
|
127
|
+
}
|
|
128
|
+
//#endregion
|
|
129
|
+
export { Command, CommandCollection, CommandCreateHandle, CommandDialog, CommandDialogPopup, CommandDialogTrigger, CommandEmpty, CommandFooter, CommandGroup, CommandGroupLabel, CommandInput, CommandItem, CommandList, CommandPanel, CommandSeparator, CommandShortcut };
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import * as React$1 from "react";
|
|
2
|
+
import { ContextMenu as ContextMenu$1 } from "@base-ui/react/context-menu";
|
|
3
|
+
//#region src/components/context-menu.d.ts
|
|
4
|
+
declare const ContextMenu: typeof ContextMenu$1.Root;
|
|
5
|
+
declare const ContextMenuPortal: React$1.ForwardRefExoticComponent<Omit<import("@base-ui/react").ContextMenuPortalProps, "ref"> & React$1.RefAttributes<HTMLDivElement>>;
|
|
6
|
+
declare function ContextMenuTrigger({ className, children, ...props }: ContextMenu$1.Trigger.Props): React$1.JSX.Element;
|
|
7
|
+
declare function ContextMenuPopup({ children, className, sideOffset, align, alignOffset, side, ...props }: ContextMenu$1.Popup.Props & {
|
|
8
|
+
align?: ContextMenu$1.Positioner.Props["align"];
|
|
9
|
+
sideOffset?: ContextMenu$1.Positioner.Props["sideOffset"];
|
|
10
|
+
alignOffset?: ContextMenu$1.Positioner.Props["alignOffset"];
|
|
11
|
+
side?: ContextMenu$1.Positioner.Props["side"];
|
|
12
|
+
}): React$1.JSX.Element;
|
|
13
|
+
declare function ContextMenuGroup(props: ContextMenu$1.Group.Props): React$1.JSX.Element;
|
|
14
|
+
declare function ContextMenuItem({ className, inset, variant, ...props }: ContextMenu$1.Item.Props & {
|
|
15
|
+
inset?: boolean;
|
|
16
|
+
variant?: "default" | "destructive";
|
|
17
|
+
}): React$1.JSX.Element;
|
|
18
|
+
declare function ContextMenuCheckboxItem({ className, children, checked, variant, ...props }: ContextMenu$1.CheckboxItem.Props & {
|
|
19
|
+
variant?: "default" | "switch";
|
|
20
|
+
}): React$1.JSX.Element;
|
|
21
|
+
declare function ContextMenuRadioGroup(props: ContextMenu$1.RadioGroup.Props): React$1.JSX.Element;
|
|
22
|
+
declare function ContextMenuRadioItem({ className, children, ...props }: ContextMenu$1.RadioItem.Props): React$1.JSX.Element;
|
|
23
|
+
declare function ContextMenuLabel({ className, inset, ...props }: ContextMenu$1.GroupLabel.Props & {
|
|
24
|
+
inset?: boolean;
|
|
25
|
+
}): React$1.JSX.Element;
|
|
26
|
+
declare function ContextMenuSeparator({ className, ...props }: ContextMenu$1.Separator.Props): React$1.JSX.Element;
|
|
27
|
+
declare function ContextMenuShortcut({ className, ...props }: React$1.ComponentProps<"kbd">): React$1.JSX.Element;
|
|
28
|
+
declare function ContextMenuSub(props: ContextMenu$1.SubmenuRoot.Props): React$1.JSX.Element;
|
|
29
|
+
declare function ContextMenuSubTrigger({ className, inset, children, ...props }: ContextMenu$1.SubmenuTrigger.Props & {
|
|
30
|
+
inset?: boolean;
|
|
31
|
+
}): React$1.JSX.Element;
|
|
32
|
+
declare function ContextMenuSubPopup({ className, sideOffset, alignOffset, align, ...props }: ContextMenu$1.Popup.Props & {
|
|
33
|
+
align?: ContextMenu$1.Positioner.Props["align"];
|
|
34
|
+
sideOffset?: ContextMenu$1.Positioner.Props["sideOffset"];
|
|
35
|
+
alignOffset?: ContextMenu$1.Positioner.Props["alignOffset"];
|
|
36
|
+
}): React$1.JSX.Element;
|
|
37
|
+
//#endregion
|
|
38
|
+
export { ContextMenu, ContextMenuCheckboxItem, ContextMenuPopup as ContextMenuContent, ContextMenuGroup, ContextMenuItem, ContextMenuLabel, ContextMenuPortal, ContextMenuRadioGroup, ContextMenuRadioItem, ContextMenuSeparator, ContextMenuShortcut, ContextMenuSub, ContextMenuSubPopup as ContextMenuSubContent, ContextMenuSubTrigger, ContextMenuTrigger };
|
|
@@ -0,0 +1,164 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { cn } from "cn";
|
|
3
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
4
|
+
import { ChevronRight } from "xiod-icons/icons/ChevronRight";
|
|
5
|
+
import { ContextMenu as ContextMenu$1 } from "@base-ui/react/context-menu";
|
|
6
|
+
//#region src/components/context-menu.tsx
|
|
7
|
+
const ContextMenu = ContextMenu$1.Root;
|
|
8
|
+
const ContextMenuPortal = ContextMenu$1.Portal;
|
|
9
|
+
function ContextMenuTrigger({ className, children, ...props }) {
|
|
10
|
+
return /* @__PURE__ */ jsx(ContextMenu$1.Trigger, {
|
|
11
|
+
className: cn(className),
|
|
12
|
+
"data-slot": "context-menu-trigger",
|
|
13
|
+
...props,
|
|
14
|
+
children
|
|
15
|
+
});
|
|
16
|
+
}
|
|
17
|
+
function ContextMenuPopup({ children, className, sideOffset = 8, align = "start", alignOffset, side = "bottom", ...props }) {
|
|
18
|
+
return /* @__PURE__ */ jsx(ContextMenu$1.Portal, { children: /* @__PURE__ */ jsx(ContextMenu$1.Positioner, {
|
|
19
|
+
align,
|
|
20
|
+
alignOffset,
|
|
21
|
+
className: "z-50 outline-none",
|
|
22
|
+
"data-slot": "context-menu-positioner",
|
|
23
|
+
side,
|
|
24
|
+
sideOffset,
|
|
25
|
+
children: /* @__PURE__ */ jsx(ContextMenu$1.Popup, {
|
|
26
|
+
className: cn("relative flex not-[class*='w-']:min-w-32 origin-(--transform-origin) rounded-lg border bg-popover shadow-lg/5 outline-none before:pointer-events-none before:absolute before:inset-0 before:rounded-[calc(var(--radius-lg)-1px)] before:shadow-[0_1px_--theme(--color-black/4%)] focus:outline-none dark:before:shadow-[0_-1px_--theme(--color-white/6%)] transition-[opacity,transform,scale] duration-150 data-ending-style:opacity-0 data-starting-style:opacity-0 data-starting-style:scale-95 data-ending-style:scale-95", className),
|
|
27
|
+
"data-slot": "context-menu-popup",
|
|
28
|
+
...props,
|
|
29
|
+
children: /* @__PURE__ */ jsx("div", {
|
|
30
|
+
className: "max-h-(--available-height) w-full overflow-y-auto p-1",
|
|
31
|
+
children
|
|
32
|
+
})
|
|
33
|
+
})
|
|
34
|
+
}) });
|
|
35
|
+
}
|
|
36
|
+
function ContextMenuGroup(props) {
|
|
37
|
+
return /* @__PURE__ */ jsx(ContextMenu$1.Group, {
|
|
38
|
+
"data-slot": "context-menu-group",
|
|
39
|
+
...props
|
|
40
|
+
});
|
|
41
|
+
}
|
|
42
|
+
function ContextMenuItem({ className, inset, variant = "default", ...props }) {
|
|
43
|
+
return /* @__PURE__ */ jsx(ContextMenu$1.Item, {
|
|
44
|
+
className: cn("[&>svg]:-mx-0.5 relative flex min-h-8 cursor-default select-none items-center gap-2 rounded-sm px-2 py-1 text-base text-foreground outline-none data-disabled:pointer-events-none data-highlighted:bg-accent data-inset:ps-8 data-[variant=destructive]:text-destructive-foreground data-highlighted:text-accent-foreground data-disabled:opacity-64 pointer-coarse:after:absolute pointer-coarse:after:size-full pointer-coarse:after:min-h-11 pointer-coarse:after:min-w-11 sm:min-h-7 sm:text-sm [&>svg:not([class*='opacity-'])]:opacity-80 [&>svg:not([class*='size-'])]:size-4.5 sm:[&>svg:not([class*='size-'])]:size-4 [&>svg]:pointer-events-none [&>svg]:shrink-0", className),
|
|
45
|
+
"data-inset": inset,
|
|
46
|
+
"data-slot": "context-menu-item",
|
|
47
|
+
"data-variant": variant,
|
|
48
|
+
...props
|
|
49
|
+
});
|
|
50
|
+
}
|
|
51
|
+
function ContextMenuCheckboxItem({ className, children, checked, variant = "default", ...props }) {
|
|
52
|
+
return /* @__PURE__ */ jsx(ContextMenu$1.CheckboxItem, {
|
|
53
|
+
checked,
|
|
54
|
+
className: cn("relative grid min-h-8 in-data-[side=none]:min-w-[calc(var(--anchor-width)+1.25rem)] cursor-default items-center gap-2 rounded-sm py-1 ps-2 text-base text-foreground outline-none data-disabled:pointer-events-none data-highlighted:bg-accent data-highlighted:text-accent-foreground data-disabled:opacity-64 pointer-coarse:after:absolute pointer-coarse:after:size-full pointer-coarse:after:min-h-11 pointer-coarse:after:min-w-11 sm:min-h-7 sm:text-sm [&_svg:not([class*='size-'])]:size-4.5 sm:[&_svg:not([class*='size-'])]:size-4 [&_svg]:pointer-events-none [&_svg]:shrink-0", variant === "switch" ? "grid-cols-[1fr_auto] gap-4 pe-1.5" : "grid-cols-[.75rem_1fr] pe-4", className),
|
|
55
|
+
"data-slot": "context-menu-checkbox-item",
|
|
56
|
+
...props,
|
|
57
|
+
children: variant === "switch" ? /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx("span", {
|
|
58
|
+
className: "col-start-1",
|
|
59
|
+
children
|
|
60
|
+
}), /* @__PURE__ */ jsx(ContextMenu$1.CheckboxItemIndicator, {
|
|
61
|
+
className: "inset-shadow-[0_1px_--theme(--color-black/4%)] inline-flex h-[calc(var(--thumb-size)+2px)] w-[calc(var(--thumb-size)*2-2px)] shrink-0 items-center rounded-full p-px outline-none transition-[background-color,box-shadow] duration-200 [--thumb-size:--spacing(4)] focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-1 focus-visible:ring-offset-background data-checked:bg-primary data-unchecked:bg-input data-disabled:opacity-64 sm:[--thumb-size:--spacing(3)]",
|
|
62
|
+
keepMounted: true,
|
|
63
|
+
children: /* @__PURE__ */ jsx("span", { className: "pointer-events-none block aspect-square h-full in-[[data-slot=context-menu-checkbox-item][data-checked]]:origin-[var(--thumb-size)_50%] origin-left in-[[data-slot=context-menu-checkbox-item][data-checked]]:translate-x-[calc(var(--thumb-size)-4px)] in-[[data-slot=context-menu-checkbox-item]:active]:not-data-disabled:scale-x-110 in-[[data-slot=context-menu-checkbox-item]:active]:rounded-[var(--thumb-size)/calc(var(--thumb-size)*1.10)] rounded-(--thumb-size) bg-background shadow-sm/5 will-change-transform [transition:translate_.15s,border-radius_.15s,scale_.1s_.1s,transform-origin_.15s]" })
|
|
64
|
+
})] }) : /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx(ContextMenu$1.CheckboxItemIndicator, {
|
|
65
|
+
className: "-ms-0.5 col-start-1",
|
|
66
|
+
children: /* @__PURE__ */ jsx("svg", {
|
|
67
|
+
fill: "none",
|
|
68
|
+
height: "24",
|
|
69
|
+
stroke: "currentColor",
|
|
70
|
+
strokeLinecap: "round",
|
|
71
|
+
strokeLinejoin: "round",
|
|
72
|
+
strokeWidth: "2",
|
|
73
|
+
viewBox: "0 0 24 24",
|
|
74
|
+
width: "24",
|
|
75
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
76
|
+
children: /* @__PURE__ */ jsx("path", { d: "M5.252 12.7 10.2 18.63 18.748 5.37" })
|
|
77
|
+
})
|
|
78
|
+
}), /* @__PURE__ */ jsx("span", {
|
|
79
|
+
className: "col-start-2",
|
|
80
|
+
children
|
|
81
|
+
})] })
|
|
82
|
+
});
|
|
83
|
+
}
|
|
84
|
+
function ContextMenuRadioGroup(props) {
|
|
85
|
+
return /* @__PURE__ */ jsx(ContextMenu$1.RadioGroup, {
|
|
86
|
+
"data-slot": "context-menu-radio-group",
|
|
87
|
+
...props
|
|
88
|
+
});
|
|
89
|
+
}
|
|
90
|
+
function ContextMenuRadioItem({ className, children, ...props }) {
|
|
91
|
+
return /* @__PURE__ */ jsxs(ContextMenu$1.RadioItem, {
|
|
92
|
+
className: cn("relative grid min-h-8 in-data-[side=none]:min-w-[calc(var(--anchor-width)+1.25rem)] cursor-default grid-cols-[.75rem_1fr] items-center gap-2 rounded-sm py-1 ps-2 pe-4 text-base text-foreground outline-none data-disabled:pointer-events-none data-highlighted:bg-accent data-highlighted:text-accent-foreground data-disabled:opacity-64 pointer-coarse:after:absolute pointer-coarse:after:size-full pointer-coarse:after:min-h-11 pointer-coarse:after:min-w-11 sm:min-h-7 sm:text-sm [&_svg:not([class*='size-'])]:size-4.5 sm:[&_svg:not([class*='size-'])]:size-4 [&_svg]:pointer-events-none [&_svg]:shrink-0", className),
|
|
93
|
+
"data-slot": "context-menu-radio-item",
|
|
94
|
+
...props,
|
|
95
|
+
children: [/* @__PURE__ */ jsx(ContextMenu$1.RadioItemIndicator, {
|
|
96
|
+
className: "-ms-0.5 col-start-1",
|
|
97
|
+
children: /* @__PURE__ */ jsx("svg", {
|
|
98
|
+
fill: "none",
|
|
99
|
+
height: "24",
|
|
100
|
+
stroke: "currentColor",
|
|
101
|
+
strokeLinecap: "round",
|
|
102
|
+
strokeLinejoin: "round",
|
|
103
|
+
strokeWidth: "2",
|
|
104
|
+
viewBox: "0 0 24 24",
|
|
105
|
+
width: "24",
|
|
106
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
107
|
+
children: /* @__PURE__ */ jsx("path", { d: "M5.252 12.7 10.2 18.63 18.748 5.37" })
|
|
108
|
+
})
|
|
109
|
+
}), /* @__PURE__ */ jsx("span", {
|
|
110
|
+
className: "col-start-2",
|
|
111
|
+
children
|
|
112
|
+
})]
|
|
113
|
+
});
|
|
114
|
+
}
|
|
115
|
+
function ContextMenuLabel({ className, inset, ...props }) {
|
|
116
|
+
return /* @__PURE__ */ jsx(ContextMenu$1.GroupLabel, {
|
|
117
|
+
className: cn("px-2 py-1.5 font-medium text-muted-foreground text-xs data-inset:ps-9 sm:data-inset:ps-8", className),
|
|
118
|
+
"data-inset": inset,
|
|
119
|
+
"data-slot": "context-menu-label",
|
|
120
|
+
...props
|
|
121
|
+
});
|
|
122
|
+
}
|
|
123
|
+
function ContextMenuSeparator({ className, ...props }) {
|
|
124
|
+
return /* @__PURE__ */ jsx(ContextMenu$1.Separator, {
|
|
125
|
+
className: cn("mx-2 my-1 h-px bg-border", className),
|
|
126
|
+
"data-slot": "context-menu-separator",
|
|
127
|
+
...props
|
|
128
|
+
});
|
|
129
|
+
}
|
|
130
|
+
function ContextMenuShortcut({ className, ...props }) {
|
|
131
|
+
return /* @__PURE__ */ jsx("kbd", {
|
|
132
|
+
className: cn("ms-auto font-medium font-sans text-muted-foreground/72 text-xs tracking-widest", className),
|
|
133
|
+
"data-slot": "context-menu-shortcut",
|
|
134
|
+
...props
|
|
135
|
+
});
|
|
136
|
+
}
|
|
137
|
+
function ContextMenuSub(props) {
|
|
138
|
+
return /* @__PURE__ */ jsx(ContextMenu$1.SubmenuRoot, {
|
|
139
|
+
"data-slot": "context-menu-sub",
|
|
140
|
+
...props
|
|
141
|
+
});
|
|
142
|
+
}
|
|
143
|
+
function ContextMenuSubTrigger({ className, inset, children, ...props }) {
|
|
144
|
+
return /* @__PURE__ */ jsxs(ContextMenu$1.SubmenuTrigger, {
|
|
145
|
+
className: cn("[&>svg:not(:last-child)]:-mx-0.5 relative flex min-h-8 items-center gap-2 rounded-sm px-2 py-1 text-base text-foreground outline-none data-disabled:pointer-events-none data-highlighted:bg-accent data-popup-open:bg-accent data-inset:ps-8 data-highlighted:text-accent-foreground data-popup-open:text-accent-foreground data-disabled:opacity-64 pointer-coarse:after:absolute pointer-coarse:after:size-full pointer-coarse:after:min-h-11 pointer-coarse:after:min-w-11 sm:min-h-7 sm:text-sm [&_svg:not([class*='size-'])]:size-4.5 sm:[&_svg:not([class*='size-'])]:size-4 [&_svg]:pointer-events-none", className),
|
|
146
|
+
"data-inset": inset,
|
|
147
|
+
"data-slot": "context-menu-sub-trigger",
|
|
148
|
+
...props,
|
|
149
|
+
children: [children, /* @__PURE__ */ jsx(ChevronRight, { className: "-me-0.5 ms-auto opacity-80" })]
|
|
150
|
+
});
|
|
151
|
+
}
|
|
152
|
+
function ContextMenuSubPopup({ className, sideOffset = 0, alignOffset, align = "start", ...props }) {
|
|
153
|
+
return /* @__PURE__ */ jsx(ContextMenuPopup, {
|
|
154
|
+
align,
|
|
155
|
+
alignOffset: alignOffset ?? (align !== "center" ? -5 : void 0),
|
|
156
|
+
className: cn(className),
|
|
157
|
+
"data-slot": "context-menu-sub-content",
|
|
158
|
+
side: "inline-end",
|
|
159
|
+
sideOffset,
|
|
160
|
+
...props
|
|
161
|
+
});
|
|
162
|
+
}
|
|
163
|
+
//#endregion
|
|
164
|
+
export { ContextMenu, ContextMenuCheckboxItem, ContextMenuPopup as ContextMenuContent, ContextMenuGroup, ContextMenuItem, ContextMenuLabel, ContextMenuPortal, ContextMenuRadioGroup, ContextMenuRadioItem, ContextMenuSeparator, ContextMenuShortcut, ContextMenuSub, ContextMenuSubPopup as ContextMenuSubContent, ContextMenuSubTrigger, ContextMenuTrigger };
|