@boriaui/react 0.0.0-stage → 0.1.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 +21 -0
- package/README.md +80 -2
- package/dist/components/alert-dialog.d.ts +29 -0
- package/dist/components/alert-dialog.js +62 -0
- package/dist/components/alert.d.ts +12 -0
- package/dist/components/alert.js +35 -0
- package/dist/components/autosize-textarea.d.ts +26 -0
- package/dist/components/autosize-textarea.js +66 -0
- package/dist/components/avatar.d.ts +9 -0
- package/dist/components/avatar.js +30 -0
- package/dist/components/badge.d.ts +16 -0
- package/dist/components/badge.js +24 -0
- package/dist/components/breadcrumb.d.ts +29 -0
- package/dist/components/breadcrumb.js +64 -0
- package/dist/components/button.d.ts +15 -0
- package/dist/components/button.js +45 -0
- package/dist/components/calendar.d.ts +25 -0
- package/dist/components/calendar.js +109 -0
- package/dist/components/card.d.ts +11 -0
- package/dist/components/card.js +44 -0
- package/dist/components/checkbox.d.ts +20 -0
- package/dist/components/checkbox.js +29 -0
- package/dist/components/collapsible.d.ts +9 -0
- package/dist/components/collapsible.js +12 -0
- package/dist/components/command.d.ts +89 -0
- package/dist/components/command.js +79 -0
- package/dist/components/context-menu.d.ts +36 -0
- package/dist/components/context-menu.js +136 -0
- package/dist/components/dialog.d.ts +31 -0
- package/dist/components/dialog.js +58 -0
- package/dist/components/dropdown-menu.d.ts +33 -0
- package/dist/components/dropdown-menu.js +85 -0
- package/dist/components/empty.d.ts +35 -0
- package/dist/components/empty.js +61 -0
- package/dist/components/field.d.ts +64 -0
- package/dist/components/field.js +121 -0
- package/dist/components/hover-card.d.ts +9 -0
- package/dist/components/hover-card.js +25 -0
- package/dist/components/input-group.d.ts +42 -0
- package/dist/components/input-group.js +83 -0
- package/dist/components/input.d.ts +6 -0
- package/dist/components/input.js +17 -0
- package/dist/components/item.d.ts +61 -0
- package/dist/components/item.js +118 -0
- package/dist/components/kbd.d.ts +13 -0
- package/dist/components/kbd.js +21 -0
- package/dist/components/label.d.ts +7 -0
- package/dist/components/label.js +18 -0
- package/dist/components/popover.d.ts +10 -0
- package/dist/components/popover.js +23 -0
- package/dist/components/radio-group.d.ts +14 -0
- package/dist/components/radio-group.js +39 -0
- package/dist/components/resizable.d.ts +34 -0
- package/dist/components/resizable.js +25 -0
- package/dist/components/scroll-area.d.ts +11 -0
- package/dist/components/scroll-area.js +35 -0
- package/dist/components/select.d.ts +16 -0
- package/dist/components/select.js +77 -0
- package/dist/components/separator.d.ts +7 -0
- package/dist/components/separator.js +20 -0
- package/dist/components/sheet.d.ts +34 -0
- package/dist/components/sheet.js +68 -0
- package/dist/components/sidebar.d.ts +72 -0
- package/dist/components/sidebar.js +382 -0
- package/dist/components/skeleton.d.ts +9 -0
- package/dist/components/skeleton.js +13 -0
- package/dist/components/spinner.d.ts +9 -0
- package/dist/components/spinner.js +16 -0
- package/dist/components/switch.d.ts +28 -0
- package/dist/components/switch.js +31 -0
- package/dist/components/tabs.d.ts +10 -0
- package/dist/components/tabs.js +31 -0
- package/dist/components/textarea.d.ts +6 -0
- package/dist/components/textarea.js +16 -0
- package/dist/components/toaster.d.ts +10 -0
- package/dist/components/toaster.js +19 -0
- package/dist/components/toggle-group.d.ts +16 -0
- package/dist/components/toggle-group.js +43 -0
- package/dist/components/toggle.d.ts +16 -0
- package/dist/components/toggle.js +40 -0
- package/dist/components/tooltip.d.ts +10 -0
- package/dist/components/tooltip.js +22 -0
- package/dist/hooks/index.d.ts +3 -0
- package/dist/hooks/index.js +4 -0
- package/dist/hooks/use-media-query.d.ts +8 -0
- package/dist/hooks/use-media-query.js +20 -0
- package/dist/hooks/use-mobile.d.ts +4 -0
- package/dist/hooks/use-mobile.js +20 -0
- package/dist/lib/index.d.ts +3 -0
- package/dist/lib/index.js +4 -0
- package/dist/lib/keyboard-guards.d.ts +11 -0
- package/dist/lib/keyboard-guards.js +21 -0
- package/dist/lib/utils.d.ts +6 -0
- package/dist/lib/utils.js +10 -0
- package/dist/theme/index.d.ts +3 -0
- package/dist/theme/index.js +4 -0
- package/dist/theme/theme-options.d.ts +16 -0
- package/dist/theme/theme-options.js +25 -0
- package/dist/theme/theme-provider.d.ts +50 -0
- package/dist/theme/theme-provider.js +94 -0
- package/package.json +122 -4
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
import { cn } from "../lib/utils.js";
|
|
5
|
+
import { Button, buttonVariants } from "./button.js";
|
|
6
|
+
import * as React from "react";
|
|
7
|
+
import { jsx } from "react/jsx-runtime";
|
|
8
|
+
import { ChevronDownIcon, ChevronLeftIcon, ChevronRightIcon } from "lucide-react";
|
|
9
|
+
import { DayPicker, getDefaultClassNames } from "react-day-picker";
|
|
10
|
+
|
|
11
|
+
//#region src/components/calendar.tsx
|
|
12
|
+
function Calendar({ className, classNames, showOutsideDays = true, captionLayout = "label", buttonVariant = "ghost", formatters, components,...props }) {
|
|
13
|
+
const defaultClassNames = getDefaultClassNames();
|
|
14
|
+
return /* @__PURE__ */ jsx(DayPicker, {
|
|
15
|
+
showOutsideDays,
|
|
16
|
+
className: cn("bg-background group/calendar p-3 [--cell-size:2rem] [[data-slot=card-content]_&]:bg-transparent [[data-slot=popover-content]_&]:bg-transparent", String.raw`rtl:**:[.rdp-button\_next>svg]:rotate-180`, String.raw`rtl:**:[.rdp-button\_previous>svg]:rotate-180`, className),
|
|
17
|
+
captionLayout,
|
|
18
|
+
formatters: {
|
|
19
|
+
formatMonthDropdown: (date) => date.toLocaleString("default", { month: "short" }),
|
|
20
|
+
...formatters
|
|
21
|
+
},
|
|
22
|
+
classNames: {
|
|
23
|
+
root: cn("w-fit", defaultClassNames.root),
|
|
24
|
+
months: cn("relative flex flex-col gap-4 md:flex-row", defaultClassNames.months),
|
|
25
|
+
month: cn("flex w-full flex-col gap-4", defaultClassNames.month),
|
|
26
|
+
nav: cn("absolute inset-x-0 top-0 flex w-full items-center justify-between gap-1", defaultClassNames.nav),
|
|
27
|
+
button_previous: cn(buttonVariants({ variant: buttonVariant }), "h-[--cell-size] w-[--cell-size] select-none p-0 aria-disabled:opacity-50", defaultClassNames.button_previous),
|
|
28
|
+
button_next: cn(buttonVariants({ variant: buttonVariant }), "h-[--cell-size] w-[--cell-size] select-none p-0 aria-disabled:opacity-50", defaultClassNames.button_next),
|
|
29
|
+
month_caption: cn("flex h-[--cell-size] w-full items-center justify-center px-[--cell-size]", defaultClassNames.month_caption),
|
|
30
|
+
dropdowns: cn("flex h-[--cell-size] w-full items-center justify-center gap-1.5 text-sm font-medium", defaultClassNames.dropdowns),
|
|
31
|
+
dropdown_root: cn("has-focus:border-ring border-input shadow-xs has-focus:ring-ring/50 has-focus:ring-[3px] relative rounded-md border", defaultClassNames.dropdown_root),
|
|
32
|
+
dropdown: cn("bg-popover absolute inset-0 opacity-0", defaultClassNames.dropdown),
|
|
33
|
+
caption_label: cn("select-none font-medium", captionLayout === "label" ? "text-sm" : "[&>svg]:text-muted-foreground flex h-8 items-center gap-1 rounded-md pl-2 pr-1 text-sm [&>svg]:size-3.5", defaultClassNames.caption_label),
|
|
34
|
+
month_grid: cn("w-full border-collapse", defaultClassNames.month_grid),
|
|
35
|
+
weekdays: cn("flex", defaultClassNames.weekdays),
|
|
36
|
+
weekday: cn("text-muted-foreground flex-1 select-none rounded-md text-[0.8rem] font-normal", defaultClassNames.weekday),
|
|
37
|
+
week: cn("mt-2 flex w-full", defaultClassNames.week),
|
|
38
|
+
week_number_header: cn("w-[--cell-size] select-none", defaultClassNames.week_number_header),
|
|
39
|
+
week_number: cn("text-muted-foreground select-none text-[0.8rem]", defaultClassNames.week_number),
|
|
40
|
+
day: cn("group/day relative aspect-square h-full w-full select-none p-0 text-center [&:first-child[data-selected=true]_button]:rounded-l-md [&:last-child[data-selected=true]_button]:rounded-r-md", defaultClassNames.day),
|
|
41
|
+
range_start: cn("bg-accent rounded-l-md", defaultClassNames.range_start),
|
|
42
|
+
range_middle: cn("rounded-none", defaultClassNames.range_middle),
|
|
43
|
+
range_end: cn("bg-accent rounded-r-md", defaultClassNames.range_end),
|
|
44
|
+
today: cn("bg-accent text-accent-foreground rounded-md data-[selected=true]:rounded-none", defaultClassNames.today),
|
|
45
|
+
outside: cn("text-muted-foreground aria-selected:text-muted-foreground", defaultClassNames.outside),
|
|
46
|
+
disabled: cn("text-muted-foreground opacity-50", defaultClassNames.disabled),
|
|
47
|
+
hidden: cn("invisible", defaultClassNames.hidden),
|
|
48
|
+
...classNames
|
|
49
|
+
},
|
|
50
|
+
components: {
|
|
51
|
+
Root: ({ className: className$1, rootRef,...props$1 }) => {
|
|
52
|
+
return /* @__PURE__ */ jsx("div", {
|
|
53
|
+
"data-slot": "calendar",
|
|
54
|
+
ref: rootRef,
|
|
55
|
+
className: cn(className$1),
|
|
56
|
+
...props$1
|
|
57
|
+
});
|
|
58
|
+
},
|
|
59
|
+
Chevron: ({ className: className$1, orientation,...props$1 }) => {
|
|
60
|
+
if (orientation === "left") return /* @__PURE__ */ jsx(ChevronLeftIcon, {
|
|
61
|
+
className: cn("size-4", className$1),
|
|
62
|
+
...props$1
|
|
63
|
+
});
|
|
64
|
+
if (orientation === "right") return /* @__PURE__ */ jsx(ChevronRightIcon, {
|
|
65
|
+
className: cn("size-4", className$1),
|
|
66
|
+
...props$1
|
|
67
|
+
});
|
|
68
|
+
return /* @__PURE__ */ jsx(ChevronDownIcon, {
|
|
69
|
+
className: cn("size-4", className$1),
|
|
70
|
+
...props$1
|
|
71
|
+
});
|
|
72
|
+
},
|
|
73
|
+
DayButton: CalendarDayButton,
|
|
74
|
+
WeekNumber: ({ children,...props$1 }) => {
|
|
75
|
+
return /* @__PURE__ */ jsx("td", {
|
|
76
|
+
...props$1,
|
|
77
|
+
children: /* @__PURE__ */ jsx("div", {
|
|
78
|
+
className: "flex size-[--cell-size] items-center justify-center text-center",
|
|
79
|
+
children
|
|
80
|
+
})
|
|
81
|
+
});
|
|
82
|
+
},
|
|
83
|
+
...components
|
|
84
|
+
},
|
|
85
|
+
...props
|
|
86
|
+
});
|
|
87
|
+
}
|
|
88
|
+
function CalendarDayButton({ className, day, modifiers,...props }) {
|
|
89
|
+
const defaultClassNames = getDefaultClassNames();
|
|
90
|
+
const ref = React.useRef(null);
|
|
91
|
+
React.useEffect(() => {
|
|
92
|
+
if (modifiers.focused) ref.current?.focus();
|
|
93
|
+
}, [modifiers.focused]);
|
|
94
|
+
return /* @__PURE__ */ jsx(Button, {
|
|
95
|
+
ref,
|
|
96
|
+
variant: "ghost",
|
|
97
|
+
size: "icon",
|
|
98
|
+
"data-day": day.date.toLocaleDateString(),
|
|
99
|
+
"data-selected-single": modifiers.selected && !modifiers.range_start && !modifiers.range_end && !modifiers.range_middle,
|
|
100
|
+
"data-range-start": modifiers.range_start,
|
|
101
|
+
"data-range-end": modifiers.range_end,
|
|
102
|
+
"data-range-middle": modifiers.range_middle,
|
|
103
|
+
className: cn("data-[selected-single=true]:bg-primary data-[selected-single=true]:text-primary-foreground data-[range-middle=true]:bg-accent data-[range-middle=true]:text-accent-foreground data-[range-start=true]:bg-primary data-[range-start=true]:text-primary-foreground data-[range-end=true]:bg-primary data-[range-end=true]:text-primary-foreground group-data-[focused=true]/day:border-ring group-data-[focused=true]/day:ring-ring/50 flex aspect-square h-auto w-full min-w-[--cell-size] flex-col gap-1 font-normal leading-none data-[range-end=true]:rounded-md data-[range-middle=true]:rounded-none data-[range-start=true]:rounded-md group-data-[focused=true]/day:relative group-data-[focused=true]/day:z-10 group-data-[focused=true]/day:ring-[3px] [&>span]:text-xs [&>span]:opacity-70", defaultClassNames.day, className),
|
|
104
|
+
...props
|
|
105
|
+
});
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
//#endregion
|
|
109
|
+
export { Calendar, CalendarDayButton };
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
|
|
3
|
+
//#region src/components/card.d.ts
|
|
4
|
+
declare const Card: React.ForwardRefExoticComponent<React.HTMLAttributes<HTMLDivElement> & React.RefAttributes<HTMLDivElement>>;
|
|
5
|
+
declare const CardHeader: React.ForwardRefExoticComponent<React.HTMLAttributes<HTMLDivElement> & React.RefAttributes<HTMLDivElement>>;
|
|
6
|
+
declare const CardTitle: React.ForwardRefExoticComponent<React.HTMLAttributes<HTMLDivElement> & React.RefAttributes<HTMLDivElement>>;
|
|
7
|
+
declare const CardDescription: React.ForwardRefExoticComponent<React.HTMLAttributes<HTMLDivElement> & React.RefAttributes<HTMLDivElement>>;
|
|
8
|
+
declare const CardContent: React.ForwardRefExoticComponent<React.HTMLAttributes<HTMLDivElement> & React.RefAttributes<HTMLDivElement>>;
|
|
9
|
+
declare const CardFooter: React.ForwardRefExoticComponent<React.HTMLAttributes<HTMLDivElement> & React.RefAttributes<HTMLDivElement>>;
|
|
10
|
+
//#endregion
|
|
11
|
+
export { Card, CardContent, CardDescription, CardFooter, CardHeader, CardTitle };
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { cn } from "../lib/utils.js";
|
|
2
|
+
import * as React from "react";
|
|
3
|
+
import { jsx } from "react/jsx-runtime";
|
|
4
|
+
|
|
5
|
+
//#region src/components/card.tsx
|
|
6
|
+
const Card = React.forwardRef(({ className,...props }, ref) => /* @__PURE__ */ jsx("div", {
|
|
7
|
+
ref,
|
|
8
|
+
className: cn("rounded-lg border bg-card text-card-foreground shadow-sm", className),
|
|
9
|
+
...props
|
|
10
|
+
}));
|
|
11
|
+
Card.displayName = "Card";
|
|
12
|
+
const CardHeader = React.forwardRef(({ className,...props }, ref) => /* @__PURE__ */ jsx("div", {
|
|
13
|
+
ref,
|
|
14
|
+
className: cn("flex flex-col space-y-1.5 p-6", className),
|
|
15
|
+
...props
|
|
16
|
+
}));
|
|
17
|
+
CardHeader.displayName = "CardHeader";
|
|
18
|
+
const CardTitle = React.forwardRef(({ className,...props }, ref) => /* @__PURE__ */ jsx("div", {
|
|
19
|
+
ref,
|
|
20
|
+
className: cn("font-semibold leading-none tracking-tight", className),
|
|
21
|
+
...props
|
|
22
|
+
}));
|
|
23
|
+
CardTitle.displayName = "CardTitle";
|
|
24
|
+
const CardDescription = React.forwardRef(({ className,...props }, ref) => /* @__PURE__ */ jsx("div", {
|
|
25
|
+
ref,
|
|
26
|
+
className: cn("text-sm text-muted-foreground", className),
|
|
27
|
+
...props
|
|
28
|
+
}));
|
|
29
|
+
CardDescription.displayName = "CardDescription";
|
|
30
|
+
const CardContent = React.forwardRef(({ className,...props }, ref) => /* @__PURE__ */ jsx("div", {
|
|
31
|
+
ref,
|
|
32
|
+
className: cn("p-6 pt-0", className),
|
|
33
|
+
...props
|
|
34
|
+
}));
|
|
35
|
+
CardContent.displayName = "CardContent";
|
|
36
|
+
const CardFooter = React.forwardRef(({ className,...props }, ref) => /* @__PURE__ */ jsx("div", {
|
|
37
|
+
ref,
|
|
38
|
+
className: cn("flex items-center p-6 pt-0", className),
|
|
39
|
+
...props
|
|
40
|
+
}));
|
|
41
|
+
CardFooter.displayName = "CardFooter";
|
|
42
|
+
|
|
43
|
+
//#endregion
|
|
44
|
+
export { Card, CardContent, CardDescription, CardFooter, CardHeader, CardTitle };
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
|
|
3
|
+
//#region src/components/checkbox.d.ts
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Minimal, dependency-free checkbox (shadcn-styled) with explicit
|
|
7
|
+
* `indeterminate` support. The project does not vendor
|
|
8
|
+
* `@radix-ui/react-checkbox`, so this native implementation keeps the
|
|
9
|
+
* accessible tri-state contract: `aria-checked="mixed"` mirrors the DOM
|
|
10
|
+
* `indeterminate` property.
|
|
11
|
+
*/
|
|
12
|
+
interface CheckboxProps extends Omit<React.InputHTMLAttributes<HTMLInputElement>, "type" | "onChange" | "checked"> {
|
|
13
|
+
checked?: boolean;
|
|
14
|
+
/** Renders the browser's third (mixed) visual state. */
|
|
15
|
+
indeterminate?: boolean;
|
|
16
|
+
onCheckedChange?: (checked: boolean) => void;
|
|
17
|
+
}
|
|
18
|
+
declare const Checkbox: React.ForwardRefExoticComponent<CheckboxProps & React.RefAttributes<HTMLInputElement>>;
|
|
19
|
+
//#endregion
|
|
20
|
+
export { Checkbox, CheckboxProps };
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
import { cn } from "../lib/utils.js";
|
|
5
|
+
import * as React from "react";
|
|
6
|
+
import { jsx } from "react/jsx-runtime";
|
|
7
|
+
|
|
8
|
+
//#region src/components/checkbox.tsx
|
|
9
|
+
const Checkbox = React.forwardRef(({ className, checked, indeterminate = false, onCheckedChange,...props }, ref) => {
|
|
10
|
+
const innerRef = React.useRef(null);
|
|
11
|
+
React.useImperativeHandle(ref, () => innerRef.current);
|
|
12
|
+
React.useEffect(() => {
|
|
13
|
+
if (innerRef.current) innerRef.current.indeterminate = indeterminate;
|
|
14
|
+
}, [indeterminate]);
|
|
15
|
+
return /* @__PURE__ */ jsx("input", {
|
|
16
|
+
ref: innerRef,
|
|
17
|
+
type: "checkbox",
|
|
18
|
+
checked: !!checked,
|
|
19
|
+
"aria-checked": indeterminate ? "mixed" : !!checked,
|
|
20
|
+
"data-state": indeterminate ? "indeterminate" : checked ? "checked" : "unchecked",
|
|
21
|
+
onChange: (event) => onCheckedChange?.(event.target.checked),
|
|
22
|
+
className: cn("size-3.5 shrink-0 cursor-pointer rounded-sm border border-primary text-primary accent-primary", "focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring", "disabled:cursor-not-allowed disabled:opacity-50", className),
|
|
23
|
+
...props
|
|
24
|
+
});
|
|
25
|
+
});
|
|
26
|
+
Checkbox.displayName = "Checkbox";
|
|
27
|
+
|
|
28
|
+
//#endregion
|
|
29
|
+
export { Checkbox };
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import * as react17 from "react";
|
|
2
|
+
import * as CollapsiblePrimitive from "@radix-ui/react-collapsible";
|
|
3
|
+
|
|
4
|
+
//#region src/components/collapsible.d.ts
|
|
5
|
+
declare const Collapsible: react17.ForwardRefExoticComponent<CollapsiblePrimitive.CollapsibleProps & react17.RefAttributes<HTMLDivElement>>;
|
|
6
|
+
declare const CollapsibleTrigger: react17.ForwardRefExoticComponent<CollapsiblePrimitive.CollapsibleTriggerProps & react17.RefAttributes<HTMLButtonElement>>;
|
|
7
|
+
declare const CollapsibleContent: react17.ForwardRefExoticComponent<CollapsiblePrimitive.CollapsibleContentProps & react17.RefAttributes<HTMLDivElement>>;
|
|
8
|
+
//#endregion
|
|
9
|
+
export { Collapsible, CollapsibleContent, CollapsibleTrigger };
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
import * as CollapsiblePrimitive from "@radix-ui/react-collapsible";
|
|
5
|
+
|
|
6
|
+
//#region src/components/collapsible.tsx
|
|
7
|
+
const Collapsible = CollapsiblePrimitive.Root;
|
|
8
|
+
const CollapsibleTrigger = CollapsiblePrimitive.CollapsibleTrigger;
|
|
9
|
+
const CollapsibleContent = CollapsiblePrimitive.CollapsibleContent;
|
|
10
|
+
|
|
11
|
+
//#endregion
|
|
12
|
+
export { Collapsible, CollapsibleContent, CollapsibleTrigger };
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import { DialogProps } from "@radix-ui/react-dialog";
|
|
3
|
+
|
|
4
|
+
//#region src/components/command.d.ts
|
|
5
|
+
declare const Command: React.ForwardRefExoticComponent<Omit<{
|
|
6
|
+
children?: React.ReactNode;
|
|
7
|
+
} & Pick<Pick<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "key" | keyof React.HTMLAttributes<HTMLDivElement>> & {
|
|
8
|
+
ref?: React.Ref<HTMLDivElement>;
|
|
9
|
+
} & {
|
|
10
|
+
asChild?: boolean;
|
|
11
|
+
}, "asChild" | "key" | keyof React.HTMLAttributes<HTMLDivElement>> & {
|
|
12
|
+
label?: string;
|
|
13
|
+
shouldFilter?: boolean;
|
|
14
|
+
filter?: (value: string, search: string, keywords?: string[]) => number;
|
|
15
|
+
defaultValue?: string;
|
|
16
|
+
value?: string;
|
|
17
|
+
onValueChange?: (value: string) => void;
|
|
18
|
+
loop?: boolean;
|
|
19
|
+
disablePointerSelection?: boolean;
|
|
20
|
+
vimBindings?: boolean;
|
|
21
|
+
} & React.RefAttributes<HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;
|
|
22
|
+
declare const CommandDialog: ({
|
|
23
|
+
children,
|
|
24
|
+
...props
|
|
25
|
+
}: DialogProps) => React.JSX.Element;
|
|
26
|
+
declare const CommandInput: React.ForwardRefExoticComponent<Omit<Omit<Pick<Pick<React.DetailedHTMLProps<React.InputHTMLAttributes<HTMLInputElement>, HTMLInputElement>, "key" | keyof React.InputHTMLAttributes<HTMLInputElement>> & {
|
|
27
|
+
ref?: React.Ref<HTMLInputElement>;
|
|
28
|
+
} & {
|
|
29
|
+
asChild?: boolean;
|
|
30
|
+
}, "asChild" | "key" | keyof React.InputHTMLAttributes<HTMLInputElement>>, "type" | "value" | "onChange"> & {
|
|
31
|
+
value?: string;
|
|
32
|
+
onValueChange?: (search: string) => void;
|
|
33
|
+
} & React.RefAttributes<HTMLInputElement>, "ref"> & React.RefAttributes<HTMLInputElement>>;
|
|
34
|
+
declare const CommandList: React.ForwardRefExoticComponent<Omit<{
|
|
35
|
+
children?: React.ReactNode;
|
|
36
|
+
} & Pick<Pick<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "key" | keyof React.HTMLAttributes<HTMLDivElement>> & {
|
|
37
|
+
ref?: React.Ref<HTMLDivElement>;
|
|
38
|
+
} & {
|
|
39
|
+
asChild?: boolean;
|
|
40
|
+
}, "asChild" | "key" | keyof React.HTMLAttributes<HTMLDivElement>> & {
|
|
41
|
+
label?: string;
|
|
42
|
+
} & React.RefAttributes<HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;
|
|
43
|
+
declare const CommandEmpty: React.ForwardRefExoticComponent<Omit<{
|
|
44
|
+
children?: React.ReactNode;
|
|
45
|
+
} & Pick<Pick<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "key" | keyof React.HTMLAttributes<HTMLDivElement>> & {
|
|
46
|
+
ref?: React.Ref<HTMLDivElement>;
|
|
47
|
+
} & {
|
|
48
|
+
asChild?: boolean;
|
|
49
|
+
}, "asChild" | "key" | keyof React.HTMLAttributes<HTMLDivElement>> & React.RefAttributes<HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;
|
|
50
|
+
declare const CommandGroup: React.ForwardRefExoticComponent<Omit<{
|
|
51
|
+
children?: React.ReactNode;
|
|
52
|
+
} & Omit<Pick<Pick<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "key" | keyof React.HTMLAttributes<HTMLDivElement>> & {
|
|
53
|
+
ref?: React.Ref<HTMLDivElement>;
|
|
54
|
+
} & {
|
|
55
|
+
asChild?: boolean;
|
|
56
|
+
}, "asChild" | "key" | keyof React.HTMLAttributes<HTMLDivElement>>, "value" | "heading"> & {
|
|
57
|
+
heading?: React.ReactNode;
|
|
58
|
+
value?: string;
|
|
59
|
+
forceMount?: boolean;
|
|
60
|
+
} & React.RefAttributes<HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;
|
|
61
|
+
declare const CommandSeparator: React.ForwardRefExoticComponent<Omit<Pick<Pick<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "key" | keyof React.HTMLAttributes<HTMLDivElement>> & {
|
|
62
|
+
ref?: React.Ref<HTMLDivElement>;
|
|
63
|
+
} & {
|
|
64
|
+
asChild?: boolean;
|
|
65
|
+
}, "asChild" | "key" | keyof React.HTMLAttributes<HTMLDivElement>> & {
|
|
66
|
+
alwaysRender?: boolean;
|
|
67
|
+
} & React.RefAttributes<HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;
|
|
68
|
+
declare const CommandItem: React.ForwardRefExoticComponent<Omit<{
|
|
69
|
+
children?: React.ReactNode;
|
|
70
|
+
} & Omit<Pick<Pick<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "key" | keyof React.HTMLAttributes<HTMLDivElement>> & {
|
|
71
|
+
ref?: React.Ref<HTMLDivElement>;
|
|
72
|
+
} & {
|
|
73
|
+
asChild?: boolean;
|
|
74
|
+
}, "asChild" | "key" | keyof React.HTMLAttributes<HTMLDivElement>>, "disabled" | "value" | "onSelect"> & {
|
|
75
|
+
disabled?: boolean;
|
|
76
|
+
onSelect?: (value: string) => void;
|
|
77
|
+
value?: string;
|
|
78
|
+
keywords?: string[];
|
|
79
|
+
forceMount?: boolean;
|
|
80
|
+
} & React.RefAttributes<HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;
|
|
81
|
+
declare const CommandShortcut: {
|
|
82
|
+
({
|
|
83
|
+
className,
|
|
84
|
+
...props
|
|
85
|
+
}: React.HTMLAttributes<HTMLSpanElement>): React.JSX.Element;
|
|
86
|
+
displayName: string;
|
|
87
|
+
};
|
|
88
|
+
//#endregion
|
|
89
|
+
export { Command, CommandDialog, CommandEmpty, CommandGroup, CommandInput, CommandItem, CommandList, CommandSeparator, CommandShortcut };
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
import { cn } from "../lib/utils.js";
|
|
5
|
+
import { Dialog, DialogContent } from "./dialog.js";
|
|
6
|
+
import * as React from "react";
|
|
7
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
8
|
+
import { Search } from "lucide-react";
|
|
9
|
+
import { Command as Command$1 } from "cmdk";
|
|
10
|
+
|
|
11
|
+
//#region src/components/command.tsx
|
|
12
|
+
const Command = React.forwardRef(({ className,...props }, ref) => /* @__PURE__ */ jsx(Command$1, {
|
|
13
|
+
ref,
|
|
14
|
+
className: cn("flex h-full w-full flex-col overflow-hidden rounded-md bg-popover text-popover-foreground", className),
|
|
15
|
+
...props
|
|
16
|
+
}));
|
|
17
|
+
Command.displayName = Command$1.displayName;
|
|
18
|
+
const CommandDialog = ({ children,...props }) => {
|
|
19
|
+
return /* @__PURE__ */ jsx(Dialog, {
|
|
20
|
+
...props,
|
|
21
|
+
children: /* @__PURE__ */ jsx(DialogContent, {
|
|
22
|
+
className: "overflow-hidden p-0",
|
|
23
|
+
children: /* @__PURE__ */ jsx(Command, {
|
|
24
|
+
className: "[&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:font-medium [&_[cmdk-group-heading]]:text-muted-foreground [&_[cmdk-group]:not([hidden])_~[cmdk-group]]:pt-0 [&_[cmdk-group]]:px-2 [&_[cmdk-input-wrapper]_svg]:h-5 [&_[cmdk-input-wrapper]_svg]:w-5 [&_[cmdk-input]]:h-12 [&_[cmdk-item]]:px-2 [&_[cmdk-item]]:py-3 [&_[cmdk-item]_svg]:h-5 [&_[cmdk-item]_svg]:w-5",
|
|
25
|
+
children
|
|
26
|
+
})
|
|
27
|
+
})
|
|
28
|
+
});
|
|
29
|
+
};
|
|
30
|
+
const CommandInput = React.forwardRef(({ className,...props }, ref) => /* @__PURE__ */ jsxs("div", {
|
|
31
|
+
className: "flex items-center border-b px-3",
|
|
32
|
+
"cmdk-input-wrapper": "",
|
|
33
|
+
children: [/* @__PURE__ */ jsx(Search, { className: "mr-2 h-4 w-4 shrink-0 opacity-50" }), /* @__PURE__ */ jsx(Command$1.Input, {
|
|
34
|
+
ref,
|
|
35
|
+
className: cn("flex h-10 w-full rounded-md bg-transparent py-3 text-sm outline-none placeholder:text-muted-foreground disabled:cursor-not-allowed disabled:opacity-50", className),
|
|
36
|
+
...props
|
|
37
|
+
})]
|
|
38
|
+
}));
|
|
39
|
+
CommandInput.displayName = Command$1.Input.displayName;
|
|
40
|
+
const CommandList = React.forwardRef(({ className,...props }, ref) => /* @__PURE__ */ jsx(Command$1.List, {
|
|
41
|
+
ref,
|
|
42
|
+
className: cn("max-h-[300px] overflow-y-auto overflow-x-hidden", className),
|
|
43
|
+
...props
|
|
44
|
+
}));
|
|
45
|
+
CommandList.displayName = Command$1.List.displayName;
|
|
46
|
+
const CommandEmpty = React.forwardRef((props, ref) => /* @__PURE__ */ jsx(Command$1.Empty, {
|
|
47
|
+
ref,
|
|
48
|
+
className: "py-6 text-center text-sm",
|
|
49
|
+
...props
|
|
50
|
+
}));
|
|
51
|
+
CommandEmpty.displayName = Command$1.Empty.displayName;
|
|
52
|
+
const CommandGroup = React.forwardRef(({ className,...props }, ref) => /* @__PURE__ */ jsx(Command$1.Group, {
|
|
53
|
+
ref,
|
|
54
|
+
className: cn("overflow-hidden p-1 text-foreground [&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:py-1.5 [&_[cmdk-group-heading]]:text-xs [&_[cmdk-group-heading]]:font-medium [&_[cmdk-group-heading]]:text-muted-foreground", className),
|
|
55
|
+
...props
|
|
56
|
+
}));
|
|
57
|
+
CommandGroup.displayName = Command$1.Group.displayName;
|
|
58
|
+
const CommandSeparator = React.forwardRef(({ className,...props }, ref) => /* @__PURE__ */ jsx(Command$1.Separator, {
|
|
59
|
+
ref,
|
|
60
|
+
className: cn("-mx-1 h-px bg-border", className),
|
|
61
|
+
...props
|
|
62
|
+
}));
|
|
63
|
+
CommandSeparator.displayName = Command$1.Separator.displayName;
|
|
64
|
+
const CommandItem = React.forwardRef(({ className,...props }, ref) => /* @__PURE__ */ jsx(Command$1.Item, {
|
|
65
|
+
ref,
|
|
66
|
+
className: cn("relative flex cursor-default gap-2 select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none data-[disabled=true]:pointer-events-none data-[selected=true]:bg-accent data-[selected=true]:text-accent-foreground data-[disabled=true]:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0", className),
|
|
67
|
+
...props
|
|
68
|
+
}));
|
|
69
|
+
CommandItem.displayName = Command$1.Item.displayName;
|
|
70
|
+
const CommandShortcut = ({ className,...props }) => {
|
|
71
|
+
return /* @__PURE__ */ jsx("span", {
|
|
72
|
+
className: cn("ml-auto text-xs tracking-widest text-muted-foreground", className),
|
|
73
|
+
...props
|
|
74
|
+
});
|
|
75
|
+
};
|
|
76
|
+
CommandShortcut.displayName = "CommandShortcut";
|
|
77
|
+
|
|
78
|
+
//#endregion
|
|
79
|
+
export { Command, CommandDialog, CommandEmpty, CommandGroup, CommandInput, CommandItem, CommandList, CommandSeparator, CommandShortcut };
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import * as ContextMenuPrimitive from "@radix-ui/react-context-menu";
|
|
3
|
+
|
|
4
|
+
//#region src/components/context-menu.d.ts
|
|
5
|
+
declare const ContextMenu: ({
|
|
6
|
+
onOpenChange,
|
|
7
|
+
...props
|
|
8
|
+
}: React.ComponentProps<typeof ContextMenuPrimitive.Root>) => React.JSX.Element;
|
|
9
|
+
declare const ContextMenuTrigger: React.ForwardRefExoticComponent<ContextMenuPrimitive.ContextMenuTriggerProps & React.RefAttributes<HTMLSpanElement>>;
|
|
10
|
+
declare const ContextMenuGroup: React.ForwardRefExoticComponent<ContextMenuPrimitive.ContextMenuGroupProps & React.RefAttributes<HTMLDivElement>>;
|
|
11
|
+
declare const ContextMenuPortal: React.FC<ContextMenuPrimitive.ContextMenuPortalProps>;
|
|
12
|
+
declare const ContextMenuSub: React.FC<ContextMenuPrimitive.ContextMenuSubProps>;
|
|
13
|
+
declare const ContextMenuRadioGroup: React.ForwardRefExoticComponent<ContextMenuPrimitive.ContextMenuRadioGroupProps & React.RefAttributes<HTMLDivElement>>;
|
|
14
|
+
declare const ContextMenuSubTrigger: React.ForwardRefExoticComponent<Omit<ContextMenuPrimitive.ContextMenuSubTriggerProps & React.RefAttributes<HTMLDivElement>, "ref"> & {
|
|
15
|
+
inset?: boolean;
|
|
16
|
+
} & React.RefAttributes<HTMLDivElement>>;
|
|
17
|
+
declare const ContextMenuSubContent: React.ForwardRefExoticComponent<Omit<ContextMenuPrimitive.ContextMenuSubContentProps & React.RefAttributes<HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;
|
|
18
|
+
declare const ContextMenuContent: React.ForwardRefExoticComponent<Omit<ContextMenuPrimitive.ContextMenuContentProps & React.RefAttributes<HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;
|
|
19
|
+
declare const ContextMenuItem: React.ForwardRefExoticComponent<Omit<ContextMenuPrimitive.ContextMenuItemProps & React.RefAttributes<HTMLDivElement>, "ref"> & {
|
|
20
|
+
inset?: boolean;
|
|
21
|
+
} & React.RefAttributes<HTMLDivElement>>;
|
|
22
|
+
declare const ContextMenuCheckboxItem: React.ForwardRefExoticComponent<Omit<ContextMenuPrimitive.ContextMenuCheckboxItemProps & React.RefAttributes<HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;
|
|
23
|
+
declare const ContextMenuRadioItem: React.ForwardRefExoticComponent<Omit<ContextMenuPrimitive.ContextMenuRadioItemProps & React.RefAttributes<HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;
|
|
24
|
+
declare const ContextMenuLabel: React.ForwardRefExoticComponent<Omit<ContextMenuPrimitive.ContextMenuLabelProps & React.RefAttributes<HTMLDivElement>, "ref"> & {
|
|
25
|
+
inset?: boolean;
|
|
26
|
+
} & React.RefAttributes<HTMLDivElement>>;
|
|
27
|
+
declare const ContextMenuSeparator: React.ForwardRefExoticComponent<Omit<ContextMenuPrimitive.ContextMenuSeparatorProps & React.RefAttributes<HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;
|
|
28
|
+
declare const ContextMenuShortcut: {
|
|
29
|
+
({
|
|
30
|
+
className,
|
|
31
|
+
...props
|
|
32
|
+
}: React.HTMLAttributes<HTMLSpanElement>): React.JSX.Element;
|
|
33
|
+
displayName: string;
|
|
34
|
+
};
|
|
35
|
+
//#endregion
|
|
36
|
+
export { ContextMenu, ContextMenuCheckboxItem, ContextMenuContent, ContextMenuGroup, ContextMenuItem, ContextMenuLabel, ContextMenuPortal, ContextMenuRadioGroup, ContextMenuRadioItem, ContextMenuSeparator, ContextMenuShortcut, ContextMenuSub, ContextMenuSubContent, ContextMenuSubTrigger, ContextMenuTrigger };
|
|
@@ -0,0 +1,136 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
import { cn } from "../lib/utils.js";
|
|
5
|
+
import * as React from "react";
|
|
6
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
7
|
+
import { Check, ChevronRight, Circle } from "lucide-react";
|
|
8
|
+
import * as ContextMenuPrimitive from "@radix-ui/react-context-menu";
|
|
9
|
+
|
|
10
|
+
//#region src/components/context-menu.tsx
|
|
11
|
+
const ContextMenuGuardContext = React.createContext(null);
|
|
12
|
+
const ContextMenu = ({ onOpenChange,...props }) => {
|
|
13
|
+
const pointerDownRef = React.useRef(false);
|
|
14
|
+
const pointerUpRef = React.useRef(false);
|
|
15
|
+
return /* @__PURE__ */ jsx(ContextMenuGuardContext.Provider, {
|
|
16
|
+
value: {
|
|
17
|
+
pointerDownRef,
|
|
18
|
+
pointerUpRef
|
|
19
|
+
},
|
|
20
|
+
children: /* @__PURE__ */ jsx(ContextMenuPrimitive.Root, {
|
|
21
|
+
...props,
|
|
22
|
+
onOpenChange: (open) => {
|
|
23
|
+
if (open) {
|
|
24
|
+
pointerDownRef.current = false;
|
|
25
|
+
pointerUpRef.current = false;
|
|
26
|
+
}
|
|
27
|
+
onOpenChange?.(open);
|
|
28
|
+
}
|
|
29
|
+
})
|
|
30
|
+
});
|
|
31
|
+
};
|
|
32
|
+
const ContextMenuTrigger = ContextMenuPrimitive.Trigger;
|
|
33
|
+
const ContextMenuGroup = ContextMenuPrimitive.Group;
|
|
34
|
+
const ContextMenuPortal = ContextMenuPrimitive.Portal;
|
|
35
|
+
const ContextMenuSub = ContextMenuPrimitive.Sub;
|
|
36
|
+
const ContextMenuRadioGroup = ContextMenuPrimitive.RadioGroup;
|
|
37
|
+
const ContextMenuSubTrigger = React.forwardRef(({ className, inset, children,...props }, ref) => /* @__PURE__ */ jsxs(ContextMenuPrimitive.SubTrigger, {
|
|
38
|
+
ref,
|
|
39
|
+
className: cn("flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-hidden focus:bg-accent focus:text-accent-foreground data-[state=open]:bg-accent data-[state=open]:text-accent-foreground", inset && "pl-8", className),
|
|
40
|
+
...props,
|
|
41
|
+
children: [children, /* @__PURE__ */ jsx(ChevronRight, { className: "ml-auto h-4 w-4" })]
|
|
42
|
+
}));
|
|
43
|
+
ContextMenuSubTrigger.displayName = ContextMenuPrimitive.SubTrigger.displayName;
|
|
44
|
+
const ContextMenuSubContent = React.forwardRef(({ className,...props }, ref) => /* @__PURE__ */ jsx(ContextMenuPrimitive.SubContent, {
|
|
45
|
+
ref,
|
|
46
|
+
className: cn("z-50 min-w-32 overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-lg data-[state=open]:animate-in data-[state=open]:fade-in-0 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 origin-(--radix-context-menu-content-transform-origin)", className),
|
|
47
|
+
...props
|
|
48
|
+
}));
|
|
49
|
+
ContextMenuSubContent.displayName = ContextMenuPrimitive.SubContent.displayName;
|
|
50
|
+
const ContextMenuContent = React.forwardRef(({ className, onPointerDownCapture, onPointerUpCapture,...props }, ref) => {
|
|
51
|
+
const guard = React.useContext(ContextMenuGuardContext);
|
|
52
|
+
const handlePointerDownCapture = React.useCallback((event) => {
|
|
53
|
+
if (guard) {
|
|
54
|
+
guard.pointerDownRef.current = true;
|
|
55
|
+
guard.pointerUpRef.current = false;
|
|
56
|
+
}
|
|
57
|
+
onPointerDownCapture?.(event);
|
|
58
|
+
}, [guard, onPointerDownCapture]);
|
|
59
|
+
const handlePointerUpCapture = React.useCallback((event) => {
|
|
60
|
+
if (guard) guard.pointerUpRef.current = true;
|
|
61
|
+
onPointerUpCapture?.(event);
|
|
62
|
+
}, [guard, onPointerUpCapture]);
|
|
63
|
+
return /* @__PURE__ */ jsx(ContextMenuPrimitive.Portal, { children: /* @__PURE__ */ jsx(ContextMenuPrimitive.Content, {
|
|
64
|
+
ref,
|
|
65
|
+
className: cn("z-50 max-h-(--radix-context-menu-content-available-height) min-w-32 overflow-y-auto overflow-x-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-md data-[state=open]:animate-in data-[state=open]:fade-in-0 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 origin-(--radix-context-menu-content-transform-origin)", className),
|
|
66
|
+
onPointerDownCapture: handlePointerDownCapture,
|
|
67
|
+
onPointerUpCapture: handlePointerUpCapture,
|
|
68
|
+
...props
|
|
69
|
+
}) });
|
|
70
|
+
});
|
|
71
|
+
ContextMenuContent.displayName = ContextMenuPrimitive.Content.displayName;
|
|
72
|
+
const ContextMenuItem = React.forwardRef(({ className, inset, onClick,...props }, ref) => {
|
|
73
|
+
const guard = React.useContext(ContextMenuGuardContext);
|
|
74
|
+
const handleClick = React.useCallback((event) => {
|
|
75
|
+
if (guard) {
|
|
76
|
+
const syntheticGestureClick = guard.pointerUpRef.current && !guard.pointerDownRef.current;
|
|
77
|
+
guard.pointerDownRef.current = false;
|
|
78
|
+
guard.pointerUpRef.current = false;
|
|
79
|
+
if (syntheticGestureClick) {
|
|
80
|
+
event.preventDefault();
|
|
81
|
+
return;
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
onClick?.(event);
|
|
85
|
+
}, [guard, onClick]);
|
|
86
|
+
return /* @__PURE__ */ jsx(ContextMenuPrimitive.Item, {
|
|
87
|
+
ref,
|
|
88
|
+
className: cn("relative flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-hidden focus:bg-accent focus:text-accent-foreground data-disabled:pointer-events-none data-disabled:opacity-50", inset && "pl-8", className),
|
|
89
|
+
onClick: handleClick,
|
|
90
|
+
...props
|
|
91
|
+
});
|
|
92
|
+
});
|
|
93
|
+
ContextMenuItem.displayName = ContextMenuPrimitive.Item.displayName;
|
|
94
|
+
const ContextMenuCheckboxItem = React.forwardRef(({ className, children, checked,...props }, ref) => /* @__PURE__ */ jsxs(ContextMenuPrimitive.CheckboxItem, {
|
|
95
|
+
ref,
|
|
96
|
+
className: cn("relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-hidden focus:bg-accent focus:text-accent-foreground data-disabled:pointer-events-none data-disabled:opacity-50", className),
|
|
97
|
+
checked,
|
|
98
|
+
...props,
|
|
99
|
+
children: [/* @__PURE__ */ jsx("span", {
|
|
100
|
+
className: "absolute left-2 flex h-3.5 w-3.5 items-center justify-center",
|
|
101
|
+
children: /* @__PURE__ */ jsx(ContextMenuPrimitive.ItemIndicator, { children: /* @__PURE__ */ jsx(Check, { className: "h-4 w-4" }) })
|
|
102
|
+
}), children]
|
|
103
|
+
}));
|
|
104
|
+
ContextMenuCheckboxItem.displayName = ContextMenuPrimitive.CheckboxItem.displayName;
|
|
105
|
+
const ContextMenuRadioItem = React.forwardRef(({ className, children,...props }, ref) => /* @__PURE__ */ jsxs(ContextMenuPrimitive.RadioItem, {
|
|
106
|
+
ref,
|
|
107
|
+
className: cn("relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-hidden focus:bg-accent focus:text-accent-foreground data-disabled:pointer-events-none data-disabled:opacity-50", className),
|
|
108
|
+
...props,
|
|
109
|
+
children: [/* @__PURE__ */ jsx("span", {
|
|
110
|
+
className: "absolute left-2 flex h-3.5 w-3.5 items-center justify-center",
|
|
111
|
+
children: /* @__PURE__ */ jsx(ContextMenuPrimitive.ItemIndicator, { children: /* @__PURE__ */ jsx(Circle, { className: "h-4 w-4 fill-current" }) })
|
|
112
|
+
}), children]
|
|
113
|
+
}));
|
|
114
|
+
ContextMenuRadioItem.displayName = ContextMenuPrimitive.RadioItem.displayName;
|
|
115
|
+
const ContextMenuLabel = React.forwardRef(({ className, inset,...props }, ref) => /* @__PURE__ */ jsx(ContextMenuPrimitive.Label, {
|
|
116
|
+
ref,
|
|
117
|
+
className: cn("px-2 py-1.5 text-sm font-semibold text-foreground", inset && "pl-8", className),
|
|
118
|
+
...props
|
|
119
|
+
}));
|
|
120
|
+
ContextMenuLabel.displayName = ContextMenuPrimitive.Label.displayName;
|
|
121
|
+
const ContextMenuSeparator = React.forwardRef(({ className,...props }, ref) => /* @__PURE__ */ jsx(ContextMenuPrimitive.Separator, {
|
|
122
|
+
ref,
|
|
123
|
+
className: cn("-mx-1 my-1 h-px bg-border", className),
|
|
124
|
+
...props
|
|
125
|
+
}));
|
|
126
|
+
ContextMenuSeparator.displayName = ContextMenuPrimitive.Separator.displayName;
|
|
127
|
+
const ContextMenuShortcut = ({ className,...props }) => {
|
|
128
|
+
return /* @__PURE__ */ jsx("span", {
|
|
129
|
+
className: cn("ml-auto text-xs tracking-widest text-muted-foreground", className),
|
|
130
|
+
...props
|
|
131
|
+
});
|
|
132
|
+
};
|
|
133
|
+
ContextMenuShortcut.displayName = "ContextMenuShortcut";
|
|
134
|
+
|
|
135
|
+
//#endregion
|
|
136
|
+
export { ContextMenu, ContextMenuCheckboxItem, ContextMenuContent, ContextMenuGroup, ContextMenuItem, ContextMenuLabel, ContextMenuPortal, ContextMenuRadioGroup, ContextMenuRadioItem, ContextMenuSeparator, ContextMenuShortcut, ContextMenuSub, ContextMenuSubContent, ContextMenuSubTrigger, ContextMenuTrigger };
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import * as DialogPrimitive from "@radix-ui/react-dialog";
|
|
3
|
+
|
|
4
|
+
//#region src/components/dialog.d.ts
|
|
5
|
+
declare const Dialog: React.FC<DialogPrimitive.DialogProps>;
|
|
6
|
+
declare const DialogTrigger: React.ForwardRefExoticComponent<DialogPrimitive.DialogTriggerProps & React.RefAttributes<HTMLButtonElement>>;
|
|
7
|
+
declare const DialogPortal: React.FC<DialogPrimitive.DialogPortalProps>;
|
|
8
|
+
declare const DialogClose: React.ForwardRefExoticComponent<DialogPrimitive.DialogCloseProps & React.RefAttributes<HTMLButtonElement>>;
|
|
9
|
+
declare const DialogOverlay: React.ForwardRefExoticComponent<Omit<DialogPrimitive.DialogOverlayProps & React.RefAttributes<HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;
|
|
10
|
+
declare const DialogContent: React.ForwardRefExoticComponent<Omit<DialogPrimitive.DialogContentProps & React.RefAttributes<HTMLDivElement>, "ref"> & {
|
|
11
|
+
/** Render the default top-right close button. Off when the content draws its own. */
|
|
12
|
+
showCloseButton?: boolean;
|
|
13
|
+
} & React.RefAttributes<HTMLDivElement>>;
|
|
14
|
+
declare const DialogHeader: {
|
|
15
|
+
({
|
|
16
|
+
className,
|
|
17
|
+
...props
|
|
18
|
+
}: React.HTMLAttributes<HTMLDivElement>): React.JSX.Element;
|
|
19
|
+
displayName: string;
|
|
20
|
+
};
|
|
21
|
+
declare const DialogFooter: {
|
|
22
|
+
({
|
|
23
|
+
className,
|
|
24
|
+
...props
|
|
25
|
+
}: React.HTMLAttributes<HTMLDivElement>): React.JSX.Element;
|
|
26
|
+
displayName: string;
|
|
27
|
+
};
|
|
28
|
+
declare const DialogTitle: React.ForwardRefExoticComponent<Omit<DialogPrimitive.DialogTitleProps & React.RefAttributes<HTMLHeadingElement>, "ref"> & React.RefAttributes<HTMLHeadingElement>>;
|
|
29
|
+
declare const DialogDescription: React.ForwardRefExoticComponent<Omit<DialogPrimitive.DialogDescriptionProps & React.RefAttributes<HTMLParagraphElement>, "ref"> & React.RefAttributes<HTMLParagraphElement>>;
|
|
30
|
+
//#endregion
|
|
31
|
+
export { Dialog, DialogClose, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogOverlay, DialogPortal, DialogTitle, DialogTrigger };
|