@open-elements/ui 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 +201 -0
- package/README.md +37 -0
- package/dist/brand.css +48 -0
- package/dist/components/alert-dialog.d.ts +19 -0
- package/dist/components/alert-dialog.d.ts.map +1 -0
- package/dist/components/alert-dialog.js +66 -0
- package/dist/components/alert-dialog.js.map +1 -0
- package/dist/components/badge.d.ts +10 -0
- package/dist/components/badge.d.ts.map +1 -0
- package/dist/components/badge.js +37 -0
- package/dist/components/badge.js.map +1 -0
- package/dist/components/button.d.ts +11 -0
- package/dist/components/button.d.ts.map +1 -0
- package/dist/components/button.js +48 -0
- package/dist/components/button.js.map +1 -0
- package/dist/components/calendar.d.ts +9 -0
- package/dist/components/calendar.d.ts.map +1 -0
- package/dist/components/calendar.js +58 -0
- package/dist/components/calendar.js.map +1 -0
- package/dist/components/card.d.ts +10 -0
- package/dist/components/card.d.ts.map +1 -0
- package/dist/components/card.js +43 -0
- package/dist/components/card.js.map +1 -0
- package/dist/components/combobox.d.ts +25 -0
- package/dist/components/combobox.d.ts.map +1 -0
- package/dist/components/combobox.js +85 -0
- package/dist/components/combobox.js.map +1 -0
- package/dist/components/dialog.d.ts +18 -0
- package/dist/components/dialog.d.ts.map +1 -0
- package/dist/components/dialog.js +59 -0
- package/dist/components/dialog.js.map +1 -0
- package/dist/components/health-status.d.ts +12 -0
- package/dist/components/health-status.d.ts.map +1 -0
- package/dist/components/health-status.js +8 -0
- package/dist/components/health-status.js.map +1 -0
- package/dist/components/input-group.d.ts +17 -0
- package/dist/components/input-group.d.ts.map +1 -0
- package/dist/components/input-group.js +82 -0
- package/dist/components/input-group.js.map +1 -0
- package/dist/components/input.d.ts +4 -0
- package/dist/components/input.d.ts.map +1 -0
- package/dist/components/input.js +19 -0
- package/dist/components/input.js.map +1 -0
- package/dist/components/label.d.ts +5 -0
- package/dist/components/label.d.ts.map +1 -0
- package/dist/components/label.js +21 -0
- package/dist/components/label.js.map +1 -0
- package/dist/components/language-switch.d.ts +2 -0
- package/dist/components/language-switch.d.ts.map +1 -0
- package/dist/components/language-switch.js +13 -0
- package/dist/components/language-switch.js.map +1 -0
- package/dist/components/popover.d.ts +11 -0
- package/dist/components/popover.d.ts.map +1 -0
- package/dist/components/popover.js +45 -0
- package/dist/components/popover.js.map +1 -0
- package/dist/components/select.d.ts +16 -0
- package/dist/components/select.d.ts.map +1 -0
- package/dist/components/select.js +60 -0
- package/dist/components/select.js.map +1 -0
- package/dist/components/separator.d.ts +5 -0
- package/dist/components/separator.d.ts.map +1 -0
- package/dist/components/separator.js +21 -0
- package/dist/components/separator.js.map +1 -0
- package/dist/components/sheet.d.ts +15 -0
- package/dist/components/sheet.d.ts.map +1 -0
- package/dist/components/sheet.js +62 -0
- package/dist/components/sheet.js.map +1 -0
- package/dist/components/sidebar.d.ts +53 -0
- package/dist/components/sidebar.d.ts.map +1 -0
- package/dist/components/sidebar.js +44 -0
- package/dist/components/sidebar.js.map +1 -0
- package/dist/components/skeleton.d.ts +3 -0
- package/dist/components/skeleton.d.ts.map +1 -0
- package/dist/components/skeleton.js +19 -0
- package/dist/components/skeleton.js.map +1 -0
- package/dist/components/table.d.ts +11 -0
- package/dist/components/table.d.ts.map +1 -0
- package/dist/components/table.js +48 -0
- package/dist/components/table.js.map +1 -0
- package/dist/components/tag-chips.d.ts +8 -0
- package/dist/components/tag-chips.d.ts.map +1 -0
- package/dist/components/tag-chips.js +22 -0
- package/dist/components/tag-chips.js.map +1 -0
- package/dist/components/tag-form.d.ts +29 -0
- package/dist/components/tag-form.d.ts.map +1 -0
- package/dist/components/tag-form.js +84 -0
- package/dist/components/tag-form.js.map +1 -0
- package/dist/components/tag-multi-select.d.ts +4 -0
- package/dist/components/tag-multi-select.d.ts.map +1 -0
- package/dist/components/tag-multi-select.js +30 -0
- package/dist/components/tag-multi-select.js.map +1 -0
- package/dist/components/textarea.d.ts +4 -0
- package/dist/components/textarea.d.ts.map +1 -0
- package/dist/components/textarea.js +19 -0
- package/dist/components/textarea.js.map +1 -0
- package/dist/components/tooltip.d.ts +8 -0
- package/dist/components/tooltip.d.ts.map +1 -0
- package/dist/components/tooltip.js +26 -0
- package/dist/components/tooltip.js.map +1 -0
- package/dist/i18n/de.d.ts +7 -0
- package/dist/i18n/de.d.ts.map +1 -0
- package/dist/i18n/de.js +7 -0
- package/dist/i18n/de.js.map +1 -0
- package/dist/i18n/en.d.ts +7 -0
- package/dist/i18n/en.d.ts.map +1 -0
- package/dist/i18n/en.js +7 -0
- package/dist/i18n/en.js.map +1 -0
- package/dist/i18n/language-context.d.ts +14 -0
- package/dist/i18n/language-context.d.ts.map +1 -0
- package/dist/i18n/language-context.js +77 -0
- package/dist/i18n/language-context.js.map +1 -0
- package/dist/index.d.ts +36 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +34 -0
- package/dist/index.js.map +1 -0
- package/dist/lib/utils.d.ts +3 -0
- package/dist/lib/utils.d.ts.map +1 -0
- package/dist/lib/utils.js +6 -0
- package/dist/lib/utils.js.map +1 -0
- package/dist/tsconfig.build.tsbuildinfo +1 -0
- package/dist/types/index.d.ts +27 -0
- package/dist/types/index.d.ts.map +1 -0
- package/dist/types/index.js +2 -0
- package/dist/types/index.js.map +1 -0
- package/package.json +77 -0
- package/src/components/__tests__/button.test.tsx +41 -0
- package/src/components/__tests__/input.test.tsx +28 -0
- package/src/components/__tests__/tag-multi-select.test.tsx +131 -0
- package/src/components/__tests__/textarea.test.tsx +22 -0
- package/src/components/alert-dialog.tsx +179 -0
- package/src/components/badge.tsx +46 -0
- package/src/components/button.tsx +62 -0
- package/src/components/calendar.tsx +180 -0
- package/src/components/card.tsx +75 -0
- package/src/components/combobox.tsx +277 -0
- package/src/components/dialog.tsx +144 -0
- package/src/components/health-status.tsx +37 -0
- package/src/components/input-group.tsx +158 -0
- package/src/components/input.tsx +21 -0
- package/src/components/label.tsx +21 -0
- package/src/components/language-switch.tsx +36 -0
- package/src/components/popover.tsx +74 -0
- package/src/components/select.tsx +175 -0
- package/src/components/separator.tsx +28 -0
- package/src/components/sheet.tsx +134 -0
- package/src/components/sidebar.tsx +290 -0
- package/src/components/skeleton.tsx +13 -0
- package/src/components/table.tsx +92 -0
- package/src/components/tag-chips.tsx +47 -0
- package/src/components/tag-form.tsx +200 -0
- package/src/components/tag-multi-select.tsx +84 -0
- package/src/components/textarea.tsx +18 -0
- package/src/components/tooltip.tsx +32 -0
- package/src/i18n/de.ts +6 -0
- package/src/i18n/en.ts +6 -0
- package/src/i18n/language-context.tsx +104 -0
- package/src/index.ts +156 -0
- package/src/lib/__tests__/utils.test.ts +29 -0
- package/src/lib/utils.ts +6 -0
- package/src/styles/brand.css +48 -0
- package/src/test/setup.ts +1 -0
- package/src/types/index.ts +29 -0
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
import { Card, CardContent, CardHeader, CardTitle } from "./card";
|
|
4
|
+
|
|
5
|
+
interface HealthStatusTranslations {
|
|
6
|
+
readonly title: string;
|
|
7
|
+
readonly statusUp: string;
|
|
8
|
+
readonly statusDown: string;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
interface HealthStatusProps {
|
|
12
|
+
readonly healthy: boolean;
|
|
13
|
+
readonly translations: HealthStatusTranslations;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export function HealthStatus({ healthy, translations }: HealthStatusProps) {
|
|
17
|
+
const statusText = healthy ? translations.statusUp : translations.statusDown;
|
|
18
|
+
|
|
19
|
+
return (
|
|
20
|
+
<Card className="border-oe-gray-light">
|
|
21
|
+
<CardHeader>
|
|
22
|
+
<CardTitle className="font-heading text-lg text-oe-dark">{translations.title}</CardTitle>
|
|
23
|
+
</CardHeader>
|
|
24
|
+
<CardContent>
|
|
25
|
+
<div className="flex items-center gap-3">
|
|
26
|
+
<span
|
|
27
|
+
className={`inline-block h-4 w-4 rounded-full ${healthy ? "bg-oe-green" : "bg-oe-red"}`}
|
|
28
|
+
aria-label={statusText}
|
|
29
|
+
/>
|
|
30
|
+
<span className="text-base font-medium">{statusText}</span>
|
|
31
|
+
</div>
|
|
32
|
+
</CardContent>
|
|
33
|
+
</Card>
|
|
34
|
+
);
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
export type { HealthStatusProps, HealthStatusTranslations };
|
|
@@ -0,0 +1,158 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
import * as React from "react";
|
|
4
|
+
import { cva, type VariantProps } from "class-variance-authority";
|
|
5
|
+
|
|
6
|
+
import { cn } from "../lib/utils";
|
|
7
|
+
import { Button } from "./button";
|
|
8
|
+
import { Input } from "./input";
|
|
9
|
+
import { Textarea } from "./textarea";
|
|
10
|
+
|
|
11
|
+
function InputGroup({ className, ...props }: React.ComponentProps<"div">) {
|
|
12
|
+
return (
|
|
13
|
+
<div
|
|
14
|
+
data-slot="input-group"
|
|
15
|
+
role="group"
|
|
16
|
+
className={cn(
|
|
17
|
+
"group/input-group relative flex w-full items-center rounded-md border border-input shadow-xs transition-[color,box-shadow] outline-none dark:bg-input/30",
|
|
18
|
+
"h-9 min-w-0 has-[>textarea]:h-auto",
|
|
19
|
+
|
|
20
|
+
// Variants based on alignment.
|
|
21
|
+
"has-[>[data-align=inline-start]]:[&>input]:pl-2",
|
|
22
|
+
"has-[>[data-align=inline-end]]:[&>input]:pr-2",
|
|
23
|
+
"has-[>[data-align=block-start]]:h-auto has-[>[data-align=block-start]]:flex-col has-[>[data-align=block-start]]:[&>input]:pb-3",
|
|
24
|
+
"has-[>[data-align=block-end]]:h-auto has-[>[data-align=block-end]]:flex-col has-[>[data-align=block-end]]:[&>input]:pt-3",
|
|
25
|
+
|
|
26
|
+
// Focus state.
|
|
27
|
+
"has-[[data-slot=input-group-control]:focus-visible]:border-ring has-[[data-slot=input-group-control]:focus-visible]:ring-[3px] has-[[data-slot=input-group-control]:focus-visible]:ring-ring/50",
|
|
28
|
+
|
|
29
|
+
// Error state.
|
|
30
|
+
"has-[[data-slot][aria-invalid=true]]:border-destructive has-[[data-slot][aria-invalid=true]]:ring-destructive/20 dark:has-[[data-slot][aria-invalid=true]]:ring-destructive/40",
|
|
31
|
+
|
|
32
|
+
className,
|
|
33
|
+
)}
|
|
34
|
+
{...props}
|
|
35
|
+
/>
|
|
36
|
+
);
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
const inputGroupAddonVariants = cva(
|
|
40
|
+
"flex h-auto cursor-text items-center justify-center gap-2 py-1.5 text-sm font-medium text-muted-foreground select-none group-data-[disabled=true]/input-group:opacity-50 [&>kbd]:rounded-[calc(var(--radius)-5px)] [&>svg:not([class*='size-'])]:size-4",
|
|
41
|
+
{
|
|
42
|
+
variants: {
|
|
43
|
+
align: {
|
|
44
|
+
"inline-start": "order-first pl-3 has-[>button]:ml-[-0.45rem] has-[>kbd]:ml-[-0.35rem]",
|
|
45
|
+
"inline-end": "order-last pr-3 has-[>button]:mr-[-0.45rem] has-[>kbd]:mr-[-0.35rem]",
|
|
46
|
+
"block-start":
|
|
47
|
+
"order-first w-full justify-start px-3 pt-3 group-has-[>input]/input-group:pt-2.5 [.border-b]:pb-3",
|
|
48
|
+
"block-end":
|
|
49
|
+
"order-last w-full justify-start px-3 pb-3 group-has-[>input]/input-group:pb-2.5 [.border-t]:pt-3",
|
|
50
|
+
},
|
|
51
|
+
},
|
|
52
|
+
defaultVariants: {
|
|
53
|
+
align: "inline-start",
|
|
54
|
+
},
|
|
55
|
+
},
|
|
56
|
+
);
|
|
57
|
+
|
|
58
|
+
function InputGroupAddon({
|
|
59
|
+
className,
|
|
60
|
+
align = "inline-start",
|
|
61
|
+
...props
|
|
62
|
+
}: React.ComponentProps<"div"> & VariantProps<typeof inputGroupAddonVariants>) {
|
|
63
|
+
return (
|
|
64
|
+
<div
|
|
65
|
+
role="group"
|
|
66
|
+
data-slot="input-group-addon"
|
|
67
|
+
data-align={align}
|
|
68
|
+
className={cn(inputGroupAddonVariants({ align }), className)}
|
|
69
|
+
onClick={(e) => {
|
|
70
|
+
if ((e.target as HTMLElement).closest("button")) {
|
|
71
|
+
return;
|
|
72
|
+
}
|
|
73
|
+
e.currentTarget.parentElement?.querySelector("input")?.focus();
|
|
74
|
+
}}
|
|
75
|
+
{...props}
|
|
76
|
+
/>
|
|
77
|
+
);
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
const inputGroupButtonVariants = cva("flex items-center gap-2 text-sm shadow-none", {
|
|
81
|
+
variants: {
|
|
82
|
+
size: {
|
|
83
|
+
xs: "h-6 gap-1 rounded-[calc(var(--radius)-5px)] px-2 has-[>svg]:px-2 [&>svg:not([class*='size-'])]:size-3.5",
|
|
84
|
+
sm: "h-8 gap-1.5 rounded-md px-2.5 has-[>svg]:px-2.5",
|
|
85
|
+
"icon-xs": "size-6 rounded-[calc(var(--radius)-5px)] p-0 has-[>svg]:p-0",
|
|
86
|
+
"icon-sm": "size-8 p-0 has-[>svg]:p-0",
|
|
87
|
+
},
|
|
88
|
+
},
|
|
89
|
+
defaultVariants: {
|
|
90
|
+
size: "xs",
|
|
91
|
+
},
|
|
92
|
+
});
|
|
93
|
+
|
|
94
|
+
function InputGroupButton({
|
|
95
|
+
className,
|
|
96
|
+
type = "button",
|
|
97
|
+
variant = "ghost",
|
|
98
|
+
size = "xs",
|
|
99
|
+
...props
|
|
100
|
+
}: Omit<React.ComponentProps<typeof Button>, "size"> &
|
|
101
|
+
VariantProps<typeof inputGroupButtonVariants>) {
|
|
102
|
+
return (
|
|
103
|
+
<Button
|
|
104
|
+
type={type}
|
|
105
|
+
data-size={size}
|
|
106
|
+
variant={variant}
|
|
107
|
+
className={cn(inputGroupButtonVariants({ size }), className)}
|
|
108
|
+
{...props}
|
|
109
|
+
/>
|
|
110
|
+
);
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
function InputGroupText({ className, ...props }: React.ComponentProps<"span">) {
|
|
114
|
+
return (
|
|
115
|
+
<span
|
|
116
|
+
className={cn(
|
|
117
|
+
"flex items-center gap-2 text-sm text-muted-foreground [&_svg]:pointer-events-none [&_svg:not([class*='size-'])]:size-4",
|
|
118
|
+
className,
|
|
119
|
+
)}
|
|
120
|
+
{...props}
|
|
121
|
+
/>
|
|
122
|
+
);
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
function InputGroupInput({ className, ...props }: React.ComponentProps<"input">) {
|
|
126
|
+
return (
|
|
127
|
+
<Input
|
|
128
|
+
data-slot="input-group-control"
|
|
129
|
+
className={cn(
|
|
130
|
+
"flex-1 rounded-none border-0 bg-transparent shadow-none focus-visible:ring-0 dark:bg-transparent",
|
|
131
|
+
className,
|
|
132
|
+
)}
|
|
133
|
+
{...props}
|
|
134
|
+
/>
|
|
135
|
+
);
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
function InputGroupTextarea({ className, ...props }: React.ComponentProps<"textarea">) {
|
|
139
|
+
return (
|
|
140
|
+
<Textarea
|
|
141
|
+
data-slot="input-group-control"
|
|
142
|
+
className={cn(
|
|
143
|
+
"flex-1 resize-none rounded-none border-0 bg-transparent py-3 shadow-none focus-visible:ring-0 dark:bg-transparent",
|
|
144
|
+
className,
|
|
145
|
+
)}
|
|
146
|
+
{...props}
|
|
147
|
+
/>
|
|
148
|
+
);
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
export {
|
|
152
|
+
InputGroup,
|
|
153
|
+
InputGroupAddon,
|
|
154
|
+
InputGroupButton,
|
|
155
|
+
InputGroupText,
|
|
156
|
+
InputGroupInput,
|
|
157
|
+
InputGroupTextarea,
|
|
158
|
+
};
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
|
|
3
|
+
import { cn } from "../lib/utils";
|
|
4
|
+
|
|
5
|
+
function Input({ className, type, ...props }: React.ComponentProps<"input">) {
|
|
6
|
+
return (
|
|
7
|
+
<input
|
|
8
|
+
type={type}
|
|
9
|
+
data-slot="input"
|
|
10
|
+
className={cn(
|
|
11
|
+
"h-9 w-full min-w-0 rounded-md border border-input bg-transparent px-3 py-1 text-base shadow-xs transition-[color,box-shadow] outline-none selection:bg-primary selection:text-primary-foreground file:inline-flex file:h-7 file:border-0 file:bg-transparent file:text-sm file:font-medium file:text-foreground placeholder:text-muted-foreground disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50 md:text-sm dark:bg-input/30",
|
|
12
|
+
"focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50",
|
|
13
|
+
"aria-invalid:border-destructive aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40",
|
|
14
|
+
className,
|
|
15
|
+
)}
|
|
16
|
+
{...props}
|
|
17
|
+
/>
|
|
18
|
+
);
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
export { Input };
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
import * as React from "react";
|
|
4
|
+
import { Label as LabelPrimitive } from "radix-ui";
|
|
5
|
+
|
|
6
|
+
import { cn } from "../lib/utils";
|
|
7
|
+
|
|
8
|
+
function Label({ className, ...props }: React.ComponentProps<typeof LabelPrimitive.Root>) {
|
|
9
|
+
return (
|
|
10
|
+
<LabelPrimitive.Root
|
|
11
|
+
data-slot="label"
|
|
12
|
+
className={cn(
|
|
13
|
+
"flex items-center gap-2 text-sm leading-none font-medium select-none group-data-[disabled=true]:pointer-events-none group-data-[disabled=true]:opacity-50 peer-disabled:cursor-not-allowed peer-disabled:opacity-50",
|
|
14
|
+
className,
|
|
15
|
+
)}
|
|
16
|
+
{...props}
|
|
17
|
+
/>
|
|
18
|
+
);
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
export { Label };
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
import { cn } from "../lib/utils";
|
|
4
|
+
import { useLanguage } from "../i18n/language-context";
|
|
5
|
+
|
|
6
|
+
export function LanguageSwitch() {
|
|
7
|
+
const { language, setLanguage } = useLanguage();
|
|
8
|
+
|
|
9
|
+
return (
|
|
10
|
+
<div className="flex items-center gap-2 text-sm">
|
|
11
|
+
<button
|
|
12
|
+
onClick={() => setLanguage("de")}
|
|
13
|
+
className={cn(
|
|
14
|
+
"transition-colors",
|
|
15
|
+
language === "de"
|
|
16
|
+
? "text-oe-green font-bold"
|
|
17
|
+
: "text-oe-white/70 hover:text-oe-white cursor-pointer",
|
|
18
|
+
)}
|
|
19
|
+
>
|
|
20
|
+
DE
|
|
21
|
+
</button>
|
|
22
|
+
<span className="text-oe-white/30">|</span>
|
|
23
|
+
<button
|
|
24
|
+
onClick={() => setLanguage("en")}
|
|
25
|
+
className={cn(
|
|
26
|
+
"transition-colors",
|
|
27
|
+
language === "en"
|
|
28
|
+
? "text-oe-green font-bold"
|
|
29
|
+
: "text-oe-white/70 hover:text-oe-white cursor-pointer",
|
|
30
|
+
)}
|
|
31
|
+
>
|
|
32
|
+
EN
|
|
33
|
+
</button>
|
|
34
|
+
</div>
|
|
35
|
+
);
|
|
36
|
+
}
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
import * as React from "react";
|
|
4
|
+
import { Popover as PopoverPrimitive } from "radix-ui";
|
|
5
|
+
|
|
6
|
+
import { cn } from "../lib/utils";
|
|
7
|
+
|
|
8
|
+
function Popover({ ...props }: React.ComponentProps<typeof PopoverPrimitive.Root>) {
|
|
9
|
+
return <PopoverPrimitive.Root data-slot="popover" {...props} />;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
function PopoverTrigger({ ...props }: React.ComponentProps<typeof PopoverPrimitive.Trigger>) {
|
|
13
|
+
return <PopoverPrimitive.Trigger data-slot="popover-trigger" {...props} />;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
function PopoverContent({
|
|
17
|
+
className,
|
|
18
|
+
align = "center",
|
|
19
|
+
sideOffset = 4,
|
|
20
|
+
...props
|
|
21
|
+
}: React.ComponentProps<typeof PopoverPrimitive.Content>) {
|
|
22
|
+
return (
|
|
23
|
+
<PopoverPrimitive.Portal>
|
|
24
|
+
<PopoverPrimitive.Content
|
|
25
|
+
data-slot="popover-content"
|
|
26
|
+
align={align}
|
|
27
|
+
sideOffset={sideOffset}
|
|
28
|
+
className={cn(
|
|
29
|
+
"z-50 w-72 origin-(--radix-popover-content-transform-origin) rounded-md border bg-popover p-4 text-popover-foreground shadow-md outline-hidden 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 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[state=open]:animate-in data-[state=open]:fade-in-0 data-[state=open]:zoom-in-95",
|
|
30
|
+
className,
|
|
31
|
+
)}
|
|
32
|
+
{...props}
|
|
33
|
+
/>
|
|
34
|
+
</PopoverPrimitive.Portal>
|
|
35
|
+
);
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
function PopoverAnchor({ ...props }: React.ComponentProps<typeof PopoverPrimitive.Anchor>) {
|
|
39
|
+
return <PopoverPrimitive.Anchor data-slot="popover-anchor" {...props} />;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
function PopoverHeader({ className, ...props }: React.ComponentProps<"div">) {
|
|
43
|
+
return (
|
|
44
|
+
<div
|
|
45
|
+
data-slot="popover-header"
|
|
46
|
+
className={cn("flex flex-col gap-1 text-sm", className)}
|
|
47
|
+
{...props}
|
|
48
|
+
/>
|
|
49
|
+
);
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
function PopoverTitle({ className, ...props }: React.ComponentProps<"h2">) {
|
|
53
|
+
return <div data-slot="popover-title" className={cn("font-medium", className)} {...props} />;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
function PopoverDescription({ className, ...props }: React.ComponentProps<"p">) {
|
|
57
|
+
return (
|
|
58
|
+
<p
|
|
59
|
+
data-slot="popover-description"
|
|
60
|
+
className={cn("text-muted-foreground", className)}
|
|
61
|
+
{...props}
|
|
62
|
+
/>
|
|
63
|
+
);
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
export {
|
|
67
|
+
Popover,
|
|
68
|
+
PopoverTrigger,
|
|
69
|
+
PopoverContent,
|
|
70
|
+
PopoverAnchor,
|
|
71
|
+
PopoverHeader,
|
|
72
|
+
PopoverTitle,
|
|
73
|
+
PopoverDescription,
|
|
74
|
+
};
|
|
@@ -0,0 +1,175 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
import * as React from "react";
|
|
4
|
+
import { CheckIcon, ChevronDownIcon, ChevronUpIcon } from "lucide-react";
|
|
5
|
+
import { Select as SelectPrimitive } from "radix-ui";
|
|
6
|
+
|
|
7
|
+
import { cn } from "../lib/utils";
|
|
8
|
+
|
|
9
|
+
function Select({ ...props }: React.ComponentProps<typeof SelectPrimitive.Root>) {
|
|
10
|
+
return <SelectPrimitive.Root data-slot="select" {...props} />;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
function SelectGroup({ ...props }: React.ComponentProps<typeof SelectPrimitive.Group>) {
|
|
14
|
+
return <SelectPrimitive.Group data-slot="select-group" {...props} />;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
function SelectValue({ ...props }: React.ComponentProps<typeof SelectPrimitive.Value>) {
|
|
18
|
+
return <SelectPrimitive.Value data-slot="select-value" {...props} />;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
function SelectTrigger({
|
|
22
|
+
className,
|
|
23
|
+
size = "default",
|
|
24
|
+
children,
|
|
25
|
+
...props
|
|
26
|
+
}: React.ComponentProps<typeof SelectPrimitive.Trigger> & {
|
|
27
|
+
size?: "sm" | "default";
|
|
28
|
+
}) {
|
|
29
|
+
return (
|
|
30
|
+
<SelectPrimitive.Trigger
|
|
31
|
+
data-slot="select-trigger"
|
|
32
|
+
data-size={size}
|
|
33
|
+
className={cn(
|
|
34
|
+
"flex w-fit items-center justify-between gap-2 rounded-md border border-input bg-transparent px-3 py-2 text-sm whitespace-nowrap shadow-xs transition-[color,box-shadow] outline-none focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:cursor-not-allowed disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-destructive/20 data-[placeholder]:text-muted-foreground data-[size=default]:h-9 data-[size=sm]:h-8 *:data-[slot=select-value]:line-clamp-1 *:data-[slot=select-value]:flex *:data-[slot=select-value]:items-center *:data-[slot=select-value]:gap-2 dark:bg-input/30 dark:hover:bg-input/50 dark:aria-invalid:ring-destructive/40 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 [&_svg:not([class*='text-'])]:text-muted-foreground",
|
|
35
|
+
className,
|
|
36
|
+
)}
|
|
37
|
+
{...props}
|
|
38
|
+
>
|
|
39
|
+
{children}
|
|
40
|
+
<SelectPrimitive.Icon asChild>
|
|
41
|
+
<ChevronDownIcon className="size-4 opacity-50" />
|
|
42
|
+
</SelectPrimitive.Icon>
|
|
43
|
+
</SelectPrimitive.Trigger>
|
|
44
|
+
);
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
function SelectContent({
|
|
48
|
+
className,
|
|
49
|
+
children,
|
|
50
|
+
position = "item-aligned",
|
|
51
|
+
align = "center",
|
|
52
|
+
...props
|
|
53
|
+
}: React.ComponentProps<typeof SelectPrimitive.Content>) {
|
|
54
|
+
return (
|
|
55
|
+
<SelectPrimitive.Portal>
|
|
56
|
+
<SelectPrimitive.Content
|
|
57
|
+
data-slot="select-content"
|
|
58
|
+
className={cn(
|
|
59
|
+
"relative z-50 max-h-(--radix-select-content-available-height) min-w-[8rem] origin-(--radix-select-content-transform-origin) overflow-x-hidden overflow-y-auto rounded-md border bg-popover text-popover-foreground shadow-md 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 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[state=open]:animate-in data-[state=open]:fade-in-0 data-[state=open]:zoom-in-95",
|
|
60
|
+
position === "popper" &&
|
|
61
|
+
"data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1",
|
|
62
|
+
className,
|
|
63
|
+
)}
|
|
64
|
+
position={position}
|
|
65
|
+
align={align}
|
|
66
|
+
{...props}
|
|
67
|
+
>
|
|
68
|
+
<SelectScrollUpButton />
|
|
69
|
+
<SelectPrimitive.Viewport
|
|
70
|
+
className={cn(
|
|
71
|
+
"p-1",
|
|
72
|
+
position === "popper" &&
|
|
73
|
+
"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)] scroll-my-1",
|
|
74
|
+
)}
|
|
75
|
+
>
|
|
76
|
+
{children}
|
|
77
|
+
</SelectPrimitive.Viewport>
|
|
78
|
+
<SelectScrollDownButton />
|
|
79
|
+
</SelectPrimitive.Content>
|
|
80
|
+
</SelectPrimitive.Portal>
|
|
81
|
+
);
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
function SelectLabel({ className, ...props }: React.ComponentProps<typeof SelectPrimitive.Label>) {
|
|
85
|
+
return (
|
|
86
|
+
<SelectPrimitive.Label
|
|
87
|
+
data-slot="select-label"
|
|
88
|
+
className={cn("px-2 py-1.5 text-xs text-muted-foreground", className)}
|
|
89
|
+
{...props}
|
|
90
|
+
/>
|
|
91
|
+
);
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
function SelectItem({
|
|
95
|
+
className,
|
|
96
|
+
children,
|
|
97
|
+
...props
|
|
98
|
+
}: React.ComponentProps<typeof SelectPrimitive.Item>) {
|
|
99
|
+
return (
|
|
100
|
+
<SelectPrimitive.Item
|
|
101
|
+
data-slot="select-item"
|
|
102
|
+
className={cn(
|
|
103
|
+
"relative flex w-full cursor-default items-center gap-2 rounded-sm py-1.5 pr-8 pl-2 text-sm outline-hidden select-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 [&_svg:not([class*='text-'])]:text-muted-foreground *:[span]:last:flex *:[span]:last:items-center *:[span]:last:gap-2",
|
|
104
|
+
className,
|
|
105
|
+
)}
|
|
106
|
+
{...props}
|
|
107
|
+
>
|
|
108
|
+
<span
|
|
109
|
+
data-slot="select-item-indicator"
|
|
110
|
+
className="absolute right-2 flex size-3.5 items-center justify-center"
|
|
111
|
+
>
|
|
112
|
+
<SelectPrimitive.ItemIndicator>
|
|
113
|
+
<CheckIcon className="size-4" />
|
|
114
|
+
</SelectPrimitive.ItemIndicator>
|
|
115
|
+
</span>
|
|
116
|
+
<SelectPrimitive.ItemText>{children}</SelectPrimitive.ItemText>
|
|
117
|
+
</SelectPrimitive.Item>
|
|
118
|
+
);
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
function SelectSeparator({
|
|
122
|
+
className,
|
|
123
|
+
...props
|
|
124
|
+
}: React.ComponentProps<typeof SelectPrimitive.Separator>) {
|
|
125
|
+
return (
|
|
126
|
+
<SelectPrimitive.Separator
|
|
127
|
+
data-slot="select-separator"
|
|
128
|
+
className={cn("pointer-events-none -mx-1 my-1 h-px bg-border", className)}
|
|
129
|
+
{...props}
|
|
130
|
+
/>
|
|
131
|
+
);
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
function SelectScrollUpButton({
|
|
135
|
+
className,
|
|
136
|
+
...props
|
|
137
|
+
}: React.ComponentProps<typeof SelectPrimitive.ScrollUpButton>) {
|
|
138
|
+
return (
|
|
139
|
+
<SelectPrimitive.ScrollUpButton
|
|
140
|
+
data-slot="select-scroll-up-button"
|
|
141
|
+
className={cn("flex cursor-default items-center justify-center py-1", className)}
|
|
142
|
+
{...props}
|
|
143
|
+
>
|
|
144
|
+
<ChevronUpIcon className="size-4" />
|
|
145
|
+
</SelectPrimitive.ScrollUpButton>
|
|
146
|
+
);
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
function SelectScrollDownButton({
|
|
150
|
+
className,
|
|
151
|
+
...props
|
|
152
|
+
}: React.ComponentProps<typeof SelectPrimitive.ScrollDownButton>) {
|
|
153
|
+
return (
|
|
154
|
+
<SelectPrimitive.ScrollDownButton
|
|
155
|
+
data-slot="select-scroll-down-button"
|
|
156
|
+
className={cn("flex cursor-default items-center justify-center py-1", className)}
|
|
157
|
+
{...props}
|
|
158
|
+
>
|
|
159
|
+
<ChevronDownIcon className="size-4" />
|
|
160
|
+
</SelectPrimitive.ScrollDownButton>
|
|
161
|
+
);
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
export {
|
|
165
|
+
Select,
|
|
166
|
+
SelectContent,
|
|
167
|
+
SelectGroup,
|
|
168
|
+
SelectItem,
|
|
169
|
+
SelectLabel,
|
|
170
|
+
SelectScrollDownButton,
|
|
171
|
+
SelectScrollUpButton,
|
|
172
|
+
SelectSeparator,
|
|
173
|
+
SelectTrigger,
|
|
174
|
+
SelectValue,
|
|
175
|
+
};
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
import * as React from "react";
|
|
4
|
+
import { Separator as SeparatorPrimitive } from "radix-ui";
|
|
5
|
+
|
|
6
|
+
import { cn } from "../lib/utils";
|
|
7
|
+
|
|
8
|
+
function Separator({
|
|
9
|
+
className,
|
|
10
|
+
orientation = "horizontal",
|
|
11
|
+
decorative = true,
|
|
12
|
+
...props
|
|
13
|
+
}: React.ComponentProps<typeof SeparatorPrimitive.Root>) {
|
|
14
|
+
return (
|
|
15
|
+
<SeparatorPrimitive.Root
|
|
16
|
+
data-slot="separator"
|
|
17
|
+
decorative={decorative}
|
|
18
|
+
orientation={orientation}
|
|
19
|
+
className={cn(
|
|
20
|
+
"shrink-0 bg-border data-[orientation=horizontal]:h-px data-[orientation=horizontal]:w-full data-[orientation=vertical]:h-full data-[orientation=vertical]:w-px",
|
|
21
|
+
className,
|
|
22
|
+
)}
|
|
23
|
+
{...props}
|
|
24
|
+
/>
|
|
25
|
+
);
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
export { Separator };
|
|
@@ -0,0 +1,134 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
import * as React from "react";
|
|
4
|
+
import { XIcon } from "lucide-react";
|
|
5
|
+
import { Dialog as SheetPrimitive } from "radix-ui";
|
|
6
|
+
|
|
7
|
+
import { cn } from "../lib/utils";
|
|
8
|
+
|
|
9
|
+
function Sheet({ ...props }: React.ComponentProps<typeof SheetPrimitive.Root>) {
|
|
10
|
+
return <SheetPrimitive.Root data-slot="sheet" {...props} />;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
function SheetTrigger({ ...props }: React.ComponentProps<typeof SheetPrimitive.Trigger>) {
|
|
14
|
+
return <SheetPrimitive.Trigger data-slot="sheet-trigger" {...props} />;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
function SheetClose({ ...props }: React.ComponentProps<typeof SheetPrimitive.Close>) {
|
|
18
|
+
return <SheetPrimitive.Close data-slot="sheet-close" {...props} />;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
function SheetPortal({ ...props }: React.ComponentProps<typeof SheetPrimitive.Portal>) {
|
|
22
|
+
return <SheetPrimitive.Portal data-slot="sheet-portal" {...props} />;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
function SheetOverlay({
|
|
26
|
+
className,
|
|
27
|
+
...props
|
|
28
|
+
}: React.ComponentProps<typeof SheetPrimitive.Overlay>) {
|
|
29
|
+
return (
|
|
30
|
+
<SheetPrimitive.Overlay
|
|
31
|
+
data-slot="sheet-overlay"
|
|
32
|
+
className={cn(
|
|
33
|
+
"fixed inset-0 z-50 bg-black/50 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:animate-in data-[state=open]:fade-in-0",
|
|
34
|
+
className,
|
|
35
|
+
)}
|
|
36
|
+
{...props}
|
|
37
|
+
/>
|
|
38
|
+
);
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
function SheetContent({
|
|
42
|
+
className,
|
|
43
|
+
children,
|
|
44
|
+
side = "right",
|
|
45
|
+
showCloseButton = true,
|
|
46
|
+
...props
|
|
47
|
+
}: React.ComponentProps<typeof SheetPrimitive.Content> & {
|
|
48
|
+
side?: "top" | "right" | "bottom" | "left";
|
|
49
|
+
showCloseButton?: boolean;
|
|
50
|
+
}) {
|
|
51
|
+
return (
|
|
52
|
+
<SheetPortal>
|
|
53
|
+
<SheetOverlay />
|
|
54
|
+
<SheetPrimitive.Content
|
|
55
|
+
data-slot="sheet-content"
|
|
56
|
+
className={cn(
|
|
57
|
+
"fixed z-50 flex flex-col gap-4 bg-background shadow-lg transition ease-in-out data-[state=closed]:animate-out data-[state=closed]:duration-300 data-[state=open]:animate-in data-[state=open]:duration-500",
|
|
58
|
+
side === "right" &&
|
|
59
|
+
"inset-y-0 right-0 h-full w-3/4 border-l data-[state=closed]:slide-out-to-right data-[state=open]:slide-in-from-right sm:max-w-sm",
|
|
60
|
+
side === "left" &&
|
|
61
|
+
"inset-y-0 left-0 h-full w-3/4 border-r data-[state=closed]:slide-out-to-left data-[state=open]:slide-in-from-left sm:max-w-sm",
|
|
62
|
+
side === "top" &&
|
|
63
|
+
"inset-x-0 top-0 h-auto border-b data-[state=closed]:slide-out-to-top data-[state=open]:slide-in-from-top",
|
|
64
|
+
side === "bottom" &&
|
|
65
|
+
"inset-x-0 bottom-0 h-auto border-t data-[state=closed]:slide-out-to-bottom data-[state=open]:slide-in-from-bottom",
|
|
66
|
+
className,
|
|
67
|
+
)}
|
|
68
|
+
{...props}
|
|
69
|
+
>
|
|
70
|
+
{children}
|
|
71
|
+
{showCloseButton && (
|
|
72
|
+
<SheetPrimitive.Close className="absolute top-4 right-4 rounded-xs opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:ring-2 focus:ring-ring focus:ring-offset-2 focus:outline-hidden disabled:pointer-events-none data-[state=open]:bg-secondary">
|
|
73
|
+
<XIcon className="size-4" />
|
|
74
|
+
<span className="sr-only">Close</span>
|
|
75
|
+
</SheetPrimitive.Close>
|
|
76
|
+
)}
|
|
77
|
+
</SheetPrimitive.Content>
|
|
78
|
+
</SheetPortal>
|
|
79
|
+
);
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
function SheetHeader({ className, ...props }: React.ComponentProps<"div">) {
|
|
83
|
+
return (
|
|
84
|
+
<div
|
|
85
|
+
data-slot="sheet-header"
|
|
86
|
+
className={cn("flex flex-col gap-1.5 p-4", className)}
|
|
87
|
+
{...props}
|
|
88
|
+
/>
|
|
89
|
+
);
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
function SheetFooter({ className, ...props }: React.ComponentProps<"div">) {
|
|
93
|
+
return (
|
|
94
|
+
<div
|
|
95
|
+
data-slot="sheet-footer"
|
|
96
|
+
className={cn("mt-auto flex flex-col gap-2 p-4", className)}
|
|
97
|
+
{...props}
|
|
98
|
+
/>
|
|
99
|
+
);
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
function SheetTitle({ className, ...props }: React.ComponentProps<typeof SheetPrimitive.Title>) {
|
|
103
|
+
return (
|
|
104
|
+
<SheetPrimitive.Title
|
|
105
|
+
data-slot="sheet-title"
|
|
106
|
+
className={cn("font-semibold text-foreground", className)}
|
|
107
|
+
{...props}
|
|
108
|
+
/>
|
|
109
|
+
);
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
function SheetDescription({
|
|
113
|
+
className,
|
|
114
|
+
...props
|
|
115
|
+
}: React.ComponentProps<typeof SheetPrimitive.Description>) {
|
|
116
|
+
return (
|
|
117
|
+
<SheetPrimitive.Description
|
|
118
|
+
data-slot="sheet-description"
|
|
119
|
+
className={cn("text-sm text-muted-foreground", className)}
|
|
120
|
+
{...props}
|
|
121
|
+
/>
|
|
122
|
+
);
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
export {
|
|
126
|
+
Sheet,
|
|
127
|
+
SheetTrigger,
|
|
128
|
+
SheetClose,
|
|
129
|
+
SheetContent,
|
|
130
|
+
SheetHeader,
|
|
131
|
+
SheetFooter,
|
|
132
|
+
SheetTitle,
|
|
133
|
+
SheetDescription,
|
|
134
|
+
};
|