@alpic-ai/ui 0.0.0 → 1.111.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/alert.d.mts +1 -1
- package/dist/components/avatar.d.mts +1 -1
- package/dist/components/badge.d.mts +1 -1
- package/dist/components/button.d.mts +2 -2
- package/dist/components/combobox.mjs +1 -1
- package/dist/components/dialog.mjs +2 -2
- package/dist/components/form.d.mts +119 -0
- package/dist/components/form.mjs +192 -0
- package/dist/components/input.d.mts +2 -0
- package/dist/components/input.mjs +19 -10
- package/dist/components/select-trigger-variants.mjs +1 -0
- package/dist/components/select.d.mts +1 -9
- package/dist/components/select.mjs +8 -28
- package/dist/components/sidebar.d.mts +1 -1
- package/dist/components/sidebar.mjs +6 -6
- package/dist/components/spinner.d.mts +1 -1
- package/dist/components/status-dot.d.mts +1 -1
- package/dist/components/tabs.d.mts +1 -1
- package/dist/components/textarea.d.mts +2 -0
- package/dist/components/textarea.mjs +19 -10
- package/dist/components/toggle-group.d.mts +1 -1
- package/package.json +31 -40
- package/src/components/combobox.tsx +1 -1
- package/src/components/dialog.tsx +2 -2
- package/src/components/form.tsx +343 -0
- package/src/components/input.tsx +12 -0
- package/src/components/select-trigger-variants.ts +1 -0
- package/src/components/select.tsx +2 -35
- package/src/components/sidebar.tsx +8 -10
- package/src/components/textarea.tsx +12 -1
- package/src/stories/accordion-card.stories.tsx +53 -0
- package/src/stories/accordion.stories.tsx +65 -0
- package/src/stories/alert.stories.tsx +58 -0
- package/src/stories/attachment-tile.stories.tsx +37 -0
- package/src/stories/avatar.stories.tsx +54 -0
- package/src/stories/badge.stories.tsx +50 -0
- package/src/stories/breadcrumb.stories.tsx +107 -0
- package/src/stories/button.stories.tsx +342 -0
- package/src/stories/card.stories.tsx +89 -0
- package/src/stories/checkbox.stories.tsx +56 -0
- package/src/stories/collapsible.stories.tsx +69 -0
- package/src/stories/combobox.stories.tsx +214 -0
- package/src/stories/command.stories.tsx +95 -0
- package/src/stories/copyable.stories.tsx +29 -0
- package/src/stories/description-list.stories.tsx +71 -0
- package/src/stories/dialog.stories.tsx +135 -0
- package/src/stories/dropdown-menu.stories.tsx +191 -0
- package/src/stories/form.stories.tsx +91 -0
- package/src/stories/input-group.stories.tsx +63 -0
- package/src/stories/input.stories.tsx +72 -0
- package/src/stories/label.stories.tsx +26 -0
- package/src/stories/ladle.css +3 -0
- package/src/stories/pagination.stories.tsx +35 -0
- package/src/stories/popover.stories.tsx +34 -0
- package/src/stories/radio-group.stories.tsx +59 -0
- package/src/stories/scroll-area.stories.tsx +43 -0
- package/src/stories/select.stories.tsx +95 -0
- package/src/stories/separator.stories.tsx +36 -0
- package/src/stories/sheet.stories.tsx +76 -0
- package/src/stories/sidebar.stories.tsx +255 -0
- package/src/stories/skeleton.stories.tsx +47 -0
- package/src/stories/sonner.stories.tsx +91 -0
- package/src/stories/spinner.stories.tsx +66 -0
- package/src/stories/status-dot.stories.tsx +27 -0
- package/src/stories/switch.stories.tsx +46 -0
- package/src/stories/table.stories.tsx +242 -0
- package/src/stories/tabs.stories.tsx +169 -0
- package/src/stories/tag.stories.tsx +82 -0
- package/src/stories/textarea.stories.tsx +60 -0
- package/src/stories/toggle-group.stories.tsx +142 -0
- package/src/stories/tooltip-icon-button.stories.tsx +59 -0
- package/src/stories/tooltip.stories.tsx +54 -0
|
@@ -5,7 +5,7 @@ import * as _$class_variance_authority_types0 from "class-variance-authority/typ
|
|
|
5
5
|
|
|
6
6
|
//#region src/components/alert.d.ts
|
|
7
7
|
declare const alertVariants: (props?: ({
|
|
8
|
-
variant?: "
|
|
8
|
+
variant?: "default" | "destructive" | "warning" | "success" | null | undefined;
|
|
9
9
|
} & _$class_variance_authority_types0.ClassProp) | undefined) => string;
|
|
10
10
|
interface AlertProps extends React.HTMLAttributes<HTMLDivElement>, VariantProps<typeof alertVariants> {}
|
|
11
11
|
declare function Alert({
|
|
@@ -6,7 +6,7 @@ import * as _$class_variance_authority_types0 from "class-variance-authority/typ
|
|
|
6
6
|
|
|
7
7
|
//#region src/components/avatar.d.ts
|
|
8
8
|
declare const avatarVariants: (props?: ({
|
|
9
|
-
size?: "
|
|
9
|
+
size?: "xs" | "sm" | "md" | "lg" | "xl" | null | undefined;
|
|
10
10
|
} & _$class_variance_authority_types0.ClassProp) | undefined) => string;
|
|
11
11
|
type AvatarSize = NonNullable<VariantProps<typeof avatarVariants>["size"]>;
|
|
12
12
|
type AvatarStatus = "online";
|
|
@@ -4,7 +4,7 @@ import * as _$class_variance_authority_types0 from "class-variance-authority/typ
|
|
|
4
4
|
|
|
5
5
|
//#region src/components/badge.d.ts
|
|
6
6
|
declare const badgeVariants: (props?: ({
|
|
7
|
-
variant?: "
|
|
7
|
+
variant?: "warning" | "success" | "secondary" | "primary" | "error" | null | undefined;
|
|
8
8
|
size?: "sm" | "md" | null | undefined;
|
|
9
9
|
} & _$class_variance_authority_types0.ClassProp) | undefined) => string;
|
|
10
10
|
interface BadgeProps extends React.ComponentProps<"span">, VariantProps<typeof badgeVariants> {}
|
|
@@ -5,8 +5,8 @@ import * as _$class_variance_authority_types0 from "class-variance-authority/typ
|
|
|
5
5
|
|
|
6
6
|
//#region src/components/button.d.ts
|
|
7
7
|
declare const buttonVariants: (props?: ({
|
|
8
|
-
variant?: "
|
|
9
|
-
size?: "default" | "
|
|
8
|
+
variant?: "destructive" | "secondary" | "primary" | "tertiary" | "link" | "link-muted" | null | undefined;
|
|
9
|
+
size?: "default" | "icon" | "icon-rounded" | "pill" | null | undefined;
|
|
10
10
|
} & _$class_variance_authority_types0.ClassProp) | undefined) => string;
|
|
11
11
|
interface ButtonProps extends React.ComponentProps<"button">, VariantProps<typeof buttonVariants> {
|
|
12
12
|
asChild?: boolean;
|
|
@@ -187,7 +187,7 @@ function ComboboxItem({ className, children, itemValue, ...props }) {
|
|
|
187
187
|
"data-slot": "combobox-item",
|
|
188
188
|
"data-selected-item": selected || void 0,
|
|
189
189
|
onSelect: () => onSelect(itemValue),
|
|
190
|
-
className: cn("relative flex cursor-default items-center gap-2 rounded-sm px-2 py-
|
|
190
|
+
className: cn("relative flex cursor-default items-center gap-2 rounded-sm px-2 py-1.5 outline-hidden select-none", "type-text-md font-medium text-foreground mx-1.5 my-px", "data-[selected=true]:bg-background-hover", "data-[selected-item]:bg-accent", "data-[disabled=true]:pointer-events-none data-[disabled=true]:text-disabled-foreground", "[&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-5", className),
|
|
191
191
|
...props,
|
|
192
192
|
children: [/* @__PURE__ */ jsx("span", {
|
|
193
193
|
className: "flex flex-1 items-center gap-2 truncate",
|
|
@@ -33,7 +33,7 @@ function DialogOverlay({ className, ...props }) {
|
|
|
33
33
|
}
|
|
34
34
|
const dialogContentVariants = cva([
|
|
35
35
|
"bg-background fixed top-1/2 left-1/2 z-50 grid w-full -translate-x-1/2 -translate-y-1/2",
|
|
36
|
-
"
|
|
36
|
+
"max-h-[calc(100vh-4rem)] overflow-hidden rounded-2xl px-6 shadow-lg outline-none",
|
|
37
37
|
"data-[state=open]:animate-in data-[state=closed]:animate-out",
|
|
38
38
|
"data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",
|
|
39
39
|
"data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95",
|
|
@@ -63,7 +63,7 @@ function DialogContent({ className, children, size, showCloseButton = true, ...p
|
|
|
63
63
|
function DialogHeader({ className, ...props }) {
|
|
64
64
|
return /* @__PURE__ */ jsx("div", {
|
|
65
65
|
"data-slot": "dialog-header",
|
|
66
|
-
className: cn("flex flex-col gap-0.5
|
|
66
|
+
className: cn("flex flex-col gap-0.5 py-6 pr-10", className),
|
|
67
67
|
...props
|
|
68
68
|
});
|
|
69
69
|
}
|
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
import { InputProps } from "./input.mjs";
|
|
2
|
+
import { Label } from "./label.mjs";
|
|
3
|
+
import { TextareaProps } from "./textarea.mjs";
|
|
4
|
+
import * as _$react_jsx_runtime0 from "react/jsx-runtime";
|
|
5
|
+
import * as React from "react";
|
|
6
|
+
import { Slot } from "@radix-ui/react-slot";
|
|
7
|
+
import * as _$react_hook_form0 from "react-hook-form";
|
|
8
|
+
import { ControllerProps, FieldPath, FieldValues } from "react-hook-form";
|
|
9
|
+
|
|
10
|
+
//#region src/components/form.d.ts
|
|
11
|
+
declare const Form: <TFieldValues extends FieldValues, TContext = any, TTransformedValues = TFieldValues>(props: _$react_hook_form0.FormProviderProps<TFieldValues, TContext, TTransformedValues>) => React.JSX.Element;
|
|
12
|
+
declare const FormField: <TFieldValues extends FieldValues = FieldValues, TName extends FieldPath<TFieldValues> = FieldPath<TFieldValues>>({
|
|
13
|
+
...props
|
|
14
|
+
}: ControllerProps<TFieldValues, TName>) => _$react_jsx_runtime0.JSX.Element;
|
|
15
|
+
declare const useFormField: () => {
|
|
16
|
+
invalid: boolean;
|
|
17
|
+
isDirty: boolean;
|
|
18
|
+
isTouched: boolean;
|
|
19
|
+
isValidating: boolean;
|
|
20
|
+
error?: _$react_hook_form0.FieldError;
|
|
21
|
+
id: string;
|
|
22
|
+
name: string;
|
|
23
|
+
formItemId: string;
|
|
24
|
+
formDescriptionId: string;
|
|
25
|
+
formMessageId: string;
|
|
26
|
+
};
|
|
27
|
+
declare function FormItem({
|
|
28
|
+
className,
|
|
29
|
+
...props
|
|
30
|
+
}: React.ComponentProps<"div">): _$react_jsx_runtime0.JSX.Element;
|
|
31
|
+
interface FormLabelProps extends React.ComponentProps<typeof Label> {
|
|
32
|
+
required?: boolean;
|
|
33
|
+
tooltip?: string;
|
|
34
|
+
}
|
|
35
|
+
declare function FormLabel({
|
|
36
|
+
className,
|
|
37
|
+
required,
|
|
38
|
+
tooltip,
|
|
39
|
+
children,
|
|
40
|
+
...props
|
|
41
|
+
}: FormLabelProps): _$react_jsx_runtime0.JSX.Element;
|
|
42
|
+
declare function FormControl({
|
|
43
|
+
...props
|
|
44
|
+
}: React.ComponentProps<typeof Slot>): _$react_jsx_runtime0.JSX.Element;
|
|
45
|
+
declare function FormDescription({
|
|
46
|
+
className,
|
|
47
|
+
...props
|
|
48
|
+
}: React.ComponentProps<"p">): _$react_jsx_runtime0.JSX.Element;
|
|
49
|
+
declare function FormMessage({
|
|
50
|
+
className,
|
|
51
|
+
...props
|
|
52
|
+
}: React.ComponentProps<"p">): _$react_jsx_runtime0.JSX.Element | null;
|
|
53
|
+
interface FormHeaderProps extends React.ComponentProps<"div"> {
|
|
54
|
+
title: string;
|
|
55
|
+
description?: string;
|
|
56
|
+
}
|
|
57
|
+
declare function FormHeader({
|
|
58
|
+
title,
|
|
59
|
+
description,
|
|
60
|
+
className,
|
|
61
|
+
...props
|
|
62
|
+
}: FormHeaderProps): _$react_jsx_runtime0.JSX.Element;
|
|
63
|
+
declare function FormFields({
|
|
64
|
+
className,
|
|
65
|
+
...props
|
|
66
|
+
}: React.ComponentProps<"div">): _$react_jsx_runtime0.JSX.Element;
|
|
67
|
+
interface FormFieldBaseProps<TFieldValues extends FieldValues, TName extends FieldPath<TFieldValues>> {
|
|
68
|
+
control: ControllerProps<TFieldValues, TName>["control"];
|
|
69
|
+
name: TName;
|
|
70
|
+
rules?: ControllerProps<TFieldValues, TName>["rules"];
|
|
71
|
+
required?: boolean;
|
|
72
|
+
label?: string;
|
|
73
|
+
description?: string;
|
|
74
|
+
tooltip?: string;
|
|
75
|
+
}
|
|
76
|
+
interface InputFieldProps<TFieldValues extends FieldValues, TName extends FieldPath<TFieldValues>> extends FormFieldBaseProps<TFieldValues, TName>, Omit<InputProps, "name" | "label"> {}
|
|
77
|
+
declare function InputField<TFieldValues extends FieldValues, TName extends FieldPath<TFieldValues>>({
|
|
78
|
+
control,
|
|
79
|
+
name,
|
|
80
|
+
rules,
|
|
81
|
+
required,
|
|
82
|
+
label,
|
|
83
|
+
description,
|
|
84
|
+
tooltip,
|
|
85
|
+
...inputProps
|
|
86
|
+
}: InputFieldProps<TFieldValues, TName>): _$react_jsx_runtime0.JSX.Element;
|
|
87
|
+
interface TextareaFieldProps<TFieldValues extends FieldValues, TName extends FieldPath<TFieldValues>> extends FormFieldBaseProps<TFieldValues, TName>, Omit<TextareaProps, "name" | "label"> {}
|
|
88
|
+
declare function TextareaField<TFieldValues extends FieldValues, TName extends FieldPath<TFieldValues>>({
|
|
89
|
+
control,
|
|
90
|
+
name,
|
|
91
|
+
rules,
|
|
92
|
+
required,
|
|
93
|
+
label,
|
|
94
|
+
description,
|
|
95
|
+
tooltip,
|
|
96
|
+
...textareaProps
|
|
97
|
+
}: TextareaFieldProps<TFieldValues, TName>): _$react_jsx_runtime0.JSX.Element;
|
|
98
|
+
interface SelectFieldOption {
|
|
99
|
+
value: string;
|
|
100
|
+
label: string;
|
|
101
|
+
disabled?: boolean;
|
|
102
|
+
}
|
|
103
|
+
interface SelectFieldProps<TFieldValues extends FieldValues, TName extends FieldPath<TFieldValues>> extends FormFieldBaseProps<TFieldValues, TName> {
|
|
104
|
+
options: SelectFieldOption[];
|
|
105
|
+
placeholder?: string;
|
|
106
|
+
}
|
|
107
|
+
declare function SelectField<TFieldValues extends FieldValues, TName extends FieldPath<TFieldValues>>({
|
|
108
|
+
control,
|
|
109
|
+
name,
|
|
110
|
+
rules,
|
|
111
|
+
required,
|
|
112
|
+
label,
|
|
113
|
+
description,
|
|
114
|
+
tooltip,
|
|
115
|
+
options,
|
|
116
|
+
placeholder
|
|
117
|
+
}: SelectFieldProps<TFieldValues, TName>): _$react_jsx_runtime0.JSX.Element;
|
|
118
|
+
//#endregion
|
|
119
|
+
export { Form, FormControl, FormDescription, FormField, FormFields, FormHeader, FormItem, FormLabel, FormMessage, InputField, SelectField, type SelectFieldOption, TextareaField, useFormField };
|
|
@@ -0,0 +1,192 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { cn } from "../lib/cn.mjs";
|
|
3
|
+
import { Tooltip, TooltipContent, TooltipTrigger } from "./tooltip.mjs";
|
|
4
|
+
import { Label } from "./label.mjs";
|
|
5
|
+
import { Input } from "./input.mjs";
|
|
6
|
+
import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from "./select.mjs";
|
|
7
|
+
import { Textarea } from "./textarea.mjs";
|
|
8
|
+
import { Info } from "lucide-react";
|
|
9
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
10
|
+
import * as React from "react";
|
|
11
|
+
import { Slot } from "@radix-ui/react-slot";
|
|
12
|
+
import { Controller, FormProvider, useFormContext, useFormState } from "react-hook-form";
|
|
13
|
+
//#region src/components/form.tsx
|
|
14
|
+
const Form = FormProvider;
|
|
15
|
+
const FormFieldContext = React.createContext({});
|
|
16
|
+
const FormField = ({ ...props }) => {
|
|
17
|
+
return /* @__PURE__ */ jsx(FormFieldContext.Provider, {
|
|
18
|
+
value: { name: props.name },
|
|
19
|
+
children: /* @__PURE__ */ jsx(Controller, { ...props })
|
|
20
|
+
});
|
|
21
|
+
};
|
|
22
|
+
const useFormField = () => {
|
|
23
|
+
const fieldContext = React.useContext(FormFieldContext);
|
|
24
|
+
const itemContext = React.useContext(FormItemContext);
|
|
25
|
+
if (!fieldContext.name) throw new Error("useFormField should be used within <FormField>");
|
|
26
|
+
const { getFieldState } = useFormContext();
|
|
27
|
+
const formState = useFormState({ name: fieldContext.name });
|
|
28
|
+
const fieldState = getFieldState(fieldContext.name, formState);
|
|
29
|
+
const { id } = itemContext;
|
|
30
|
+
return {
|
|
31
|
+
id,
|
|
32
|
+
name: fieldContext.name,
|
|
33
|
+
formItemId: `${id}-form-item`,
|
|
34
|
+
formDescriptionId: `${id}-form-item-description`,
|
|
35
|
+
formMessageId: `${id}-form-item-message`,
|
|
36
|
+
...fieldState
|
|
37
|
+
};
|
|
38
|
+
};
|
|
39
|
+
const FormItemContext = React.createContext({});
|
|
40
|
+
function FormItem({ className, ...props }) {
|
|
41
|
+
const id = React.useId();
|
|
42
|
+
return /* @__PURE__ */ jsx(FormItemContext.Provider, {
|
|
43
|
+
value: { id },
|
|
44
|
+
children: /* @__PURE__ */ jsx("div", {
|
|
45
|
+
"data-slot": "form-item",
|
|
46
|
+
className: cn("grid gap-2", className),
|
|
47
|
+
...props
|
|
48
|
+
})
|
|
49
|
+
});
|
|
50
|
+
}
|
|
51
|
+
function FormLabel({ className, required, tooltip, children, ...props }) {
|
|
52
|
+
const { error, formItemId } = useFormField();
|
|
53
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
54
|
+
className: "flex items-center gap-0.5",
|
|
55
|
+
children: [
|
|
56
|
+
/* @__PURE__ */ jsx(Label, {
|
|
57
|
+
"data-slot": "form-label",
|
|
58
|
+
"data-error": !!error,
|
|
59
|
+
className: cn("data-[error=true]:text-destructive", className),
|
|
60
|
+
htmlFor: formItemId,
|
|
61
|
+
...props,
|
|
62
|
+
children
|
|
63
|
+
}),
|
|
64
|
+
required && /* @__PURE__ */ jsx("span", {
|
|
65
|
+
"aria-hidden": true,
|
|
66
|
+
className: "type-text-sm font-medium text-required",
|
|
67
|
+
children: "*"
|
|
68
|
+
}),
|
|
69
|
+
tooltip && /* @__PURE__ */ jsxs(Tooltip, { children: [/* @__PURE__ */ jsx(TooltipTrigger, {
|
|
70
|
+
asChild: true,
|
|
71
|
+
children: /* @__PURE__ */ jsx(Info, { className: "size-4 text-quaternary-foreground" })
|
|
72
|
+
}), /* @__PURE__ */ jsx(TooltipContent, { children: tooltip })] })
|
|
73
|
+
]
|
|
74
|
+
});
|
|
75
|
+
}
|
|
76
|
+
function FormControl({ ...props }) {
|
|
77
|
+
const { error, formItemId, formDescriptionId, formMessageId } = useFormField();
|
|
78
|
+
return /* @__PURE__ */ jsx(Slot, {
|
|
79
|
+
"data-slot": "form-control",
|
|
80
|
+
id: formItemId,
|
|
81
|
+
"aria-describedby": !error ? `${formDescriptionId}` : `${formDescriptionId} ${formMessageId}`,
|
|
82
|
+
"aria-invalid": !!error,
|
|
83
|
+
...props
|
|
84
|
+
});
|
|
85
|
+
}
|
|
86
|
+
function FormDescription({ className, ...props }) {
|
|
87
|
+
const { formDescriptionId } = useFormField();
|
|
88
|
+
return /* @__PURE__ */ jsx("p", {
|
|
89
|
+
"data-slot": "form-description",
|
|
90
|
+
id: formDescriptionId,
|
|
91
|
+
className: cn("text-muted-foreground text-sm", className),
|
|
92
|
+
...props
|
|
93
|
+
});
|
|
94
|
+
}
|
|
95
|
+
function FormMessage({ className, ...props }) {
|
|
96
|
+
const { error, formMessageId } = useFormField();
|
|
97
|
+
const body = error ? String(error?.message ?? "") : props.children;
|
|
98
|
+
if (!body) return null;
|
|
99
|
+
return /* @__PURE__ */ jsx("p", {
|
|
100
|
+
"data-slot": "form-message",
|
|
101
|
+
id: formMessageId,
|
|
102
|
+
className: cn("text-destructive text-sm", className),
|
|
103
|
+
...props,
|
|
104
|
+
children: body
|
|
105
|
+
});
|
|
106
|
+
}
|
|
107
|
+
function FormHeader({ title, description, className, ...props }) {
|
|
108
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
109
|
+
className: cn("flex flex-col gap-1", className),
|
|
110
|
+
...props,
|
|
111
|
+
children: [/* @__PURE__ */ jsx("h2", {
|
|
112
|
+
className: "type-display-sm font-semibold text-foreground",
|
|
113
|
+
children: title
|
|
114
|
+
}), description && /* @__PURE__ */ jsx("p", {
|
|
115
|
+
className: "type-text-xl text-subtle-foreground",
|
|
116
|
+
children: description
|
|
117
|
+
})]
|
|
118
|
+
});
|
|
119
|
+
}
|
|
120
|
+
function FormFields({ className, ...props }) {
|
|
121
|
+
return /* @__PURE__ */ jsx("div", {
|
|
122
|
+
className: cn("flex flex-col gap-6", className),
|
|
123
|
+
...props
|
|
124
|
+
});
|
|
125
|
+
}
|
|
126
|
+
function InputField({ control, name, rules, required, label, description, tooltip, ...inputProps }) {
|
|
127
|
+
return /* @__PURE__ */ jsx(FormField, {
|
|
128
|
+
control,
|
|
129
|
+
name,
|
|
130
|
+
rules,
|
|
131
|
+
render: ({ field }) => /* @__PURE__ */ jsxs(FormItem, { children: [
|
|
132
|
+
label && /* @__PURE__ */ jsx(FormLabel, {
|
|
133
|
+
required,
|
|
134
|
+
tooltip,
|
|
135
|
+
children: label
|
|
136
|
+
}),
|
|
137
|
+
/* @__PURE__ */ jsx(FormControl, { children: /* @__PURE__ */ jsx(Input, {
|
|
138
|
+
...inputProps,
|
|
139
|
+
...field
|
|
140
|
+
}) }),
|
|
141
|
+
description && /* @__PURE__ */ jsx(FormDescription, { children: description }),
|
|
142
|
+
/* @__PURE__ */ jsx(FormMessage, {})
|
|
143
|
+
] })
|
|
144
|
+
});
|
|
145
|
+
}
|
|
146
|
+
function TextareaField({ control, name, rules, required, label, description, tooltip, ...textareaProps }) {
|
|
147
|
+
return /* @__PURE__ */ jsx(FormField, {
|
|
148
|
+
control,
|
|
149
|
+
name,
|
|
150
|
+
rules,
|
|
151
|
+
render: ({ field }) => /* @__PURE__ */ jsxs(FormItem, { children: [
|
|
152
|
+
label && /* @__PURE__ */ jsx(FormLabel, {
|
|
153
|
+
required,
|
|
154
|
+
tooltip,
|
|
155
|
+
children: label
|
|
156
|
+
}),
|
|
157
|
+
/* @__PURE__ */ jsx(FormControl, { children: /* @__PURE__ */ jsx(Textarea, {
|
|
158
|
+
...textareaProps,
|
|
159
|
+
...field
|
|
160
|
+
}) }),
|
|
161
|
+
description && /* @__PURE__ */ jsx(FormDescription, { children: description }),
|
|
162
|
+
/* @__PURE__ */ jsx(FormMessage, {})
|
|
163
|
+
] })
|
|
164
|
+
});
|
|
165
|
+
}
|
|
166
|
+
function SelectField({ control, name, rules, required, label, description, tooltip, options, placeholder }) {
|
|
167
|
+
return /* @__PURE__ */ jsx(FormField, {
|
|
168
|
+
control,
|
|
169
|
+
name,
|
|
170
|
+
rules,
|
|
171
|
+
render: ({ field }) => /* @__PURE__ */ jsxs(FormItem, { children: [
|
|
172
|
+
label && /* @__PURE__ */ jsx(FormLabel, {
|
|
173
|
+
required,
|
|
174
|
+
tooltip,
|
|
175
|
+
children: label
|
|
176
|
+
}),
|
|
177
|
+
/* @__PURE__ */ jsxs(Select, {
|
|
178
|
+
value: field.value,
|
|
179
|
+
onValueChange: field.onChange,
|
|
180
|
+
children: [/* @__PURE__ */ jsx(FormControl, { children: /* @__PURE__ */ jsx(SelectTrigger, { children: /* @__PURE__ */ jsx(SelectValue, { placeholder }) }) }), /* @__PURE__ */ jsx(SelectContent, { children: options.map((option) => /* @__PURE__ */ jsx(SelectItem, {
|
|
181
|
+
value: option.value,
|
|
182
|
+
disabled: option.disabled,
|
|
183
|
+
children: option.label
|
|
184
|
+
}, option.value)) })]
|
|
185
|
+
}),
|
|
186
|
+
description && /* @__PURE__ */ jsx(FormDescription, { children: description }),
|
|
187
|
+
/* @__PURE__ */ jsx(FormMessage, {})
|
|
188
|
+
] })
|
|
189
|
+
});
|
|
190
|
+
}
|
|
191
|
+
//#endregion
|
|
192
|
+
export { Form, FormControl, FormDescription, FormField, FormFields, FormHeader, FormItem, FormLabel, FormMessage, InputField, SelectField, TextareaField, useFormField };
|
|
@@ -7,6 +7,7 @@ interface InputProps extends Omit<React.ComponentProps<"input">, "size"> {
|
|
|
7
7
|
required?: boolean;
|
|
8
8
|
hint?: string;
|
|
9
9
|
error?: string;
|
|
10
|
+
tooltip?: string;
|
|
10
11
|
leadingText?: string;
|
|
11
12
|
leadingIcon?: React.ReactNode;
|
|
12
13
|
size?: "sm" | "md";
|
|
@@ -18,6 +19,7 @@ declare function Input({
|
|
|
18
19
|
required,
|
|
19
20
|
hint,
|
|
20
21
|
error,
|
|
22
|
+
tooltip,
|
|
21
23
|
leadingText,
|
|
22
24
|
leadingIcon,
|
|
23
25
|
size,
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { cn } from "../lib/cn.mjs";
|
|
3
|
+
import { Tooltip, TooltipContent, TooltipTrigger } from "./tooltip.mjs";
|
|
3
4
|
import { Label } from "./label.mjs";
|
|
5
|
+
import { Info } from "lucide-react";
|
|
4
6
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
5
7
|
import * as React from "react";
|
|
6
8
|
//#region src/components/input.tsx
|
|
@@ -22,7 +24,7 @@ const inputSizeStyles = {
|
|
|
22
24
|
leadingIcon: "pl-2.5 [&_svg]:size-5"
|
|
23
25
|
}
|
|
24
26
|
};
|
|
25
|
-
function Input({ className, id, label, required, hint, error, leadingText, leadingIcon, size = "md", ...props }) {
|
|
27
|
+
function Input({ className, id, label, required, hint, error, tooltip, leadingText, leadingIcon, size = "md", ...props }) {
|
|
26
28
|
const generatedId = React.useId();
|
|
27
29
|
const fieldId = id ?? generatedId;
|
|
28
30
|
const hasAddons = leadingText || leadingIcon;
|
|
@@ -67,15 +69,22 @@ function Input({ className, id, label, required, hint, error, leadingText, leadi
|
|
|
67
69
|
children: [
|
|
68
70
|
label && /* @__PURE__ */ jsxs("div", {
|
|
69
71
|
className: "flex items-center gap-0.5",
|
|
70
|
-
children: [
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
72
|
+
children: [
|
|
73
|
+
/* @__PURE__ */ jsx(Label, {
|
|
74
|
+
htmlFor: fieldId,
|
|
75
|
+
className: "type-text-sm font-medium text-muted-foreground",
|
|
76
|
+
children: label
|
|
77
|
+
}),
|
|
78
|
+
required && /* @__PURE__ */ jsx("span", {
|
|
79
|
+
"aria-hidden": true,
|
|
80
|
+
className: "type-text-sm font-medium text-required",
|
|
81
|
+
children: "*"
|
|
82
|
+
}),
|
|
83
|
+
tooltip && /* @__PURE__ */ jsxs(Tooltip, { children: [/* @__PURE__ */ jsx(TooltipTrigger, {
|
|
84
|
+
asChild: true,
|
|
85
|
+
children: /* @__PURE__ */ jsx(Info, { className: "size-4 text-muted-foreground" })
|
|
86
|
+
}), /* @__PURE__ */ jsx(TooltipContent, { children: tooltip })] })
|
|
87
|
+
]
|
|
79
88
|
}),
|
|
80
89
|
wrappedInput,
|
|
81
90
|
(hint || error) && /* @__PURE__ */ jsx("p", {
|
|
@@ -11,6 +11,7 @@ const selectTriggerVariants = cva([
|
|
|
11
11
|
"focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background",
|
|
12
12
|
"data-[state=open]:ring-2 data-[state=open]:ring-ring data-[state=open]:ring-offset-2 data-[state=open]:ring-offset-background",
|
|
13
13
|
"disabled:pointer-events-none disabled:bg-disabled disabled:text-disabled-foreground disabled:border-disabled",
|
|
14
|
+
"aria-invalid:border-border-error",
|
|
14
15
|
"[&_svg:not([class*='size-'])]:size-5 [&_svg]:shrink-0"
|
|
15
16
|
].join(" "), {
|
|
16
17
|
variants: { size: {
|
|
@@ -39,13 +39,5 @@ declare function SelectSeparator({
|
|
|
39
39
|
className,
|
|
40
40
|
...props
|
|
41
41
|
}: React.ComponentProps<typeof SelectPrimitive.Separator>): _$react_jsx_runtime0.JSX.Element;
|
|
42
|
-
declare function SelectScrollUpButton({
|
|
43
|
-
className,
|
|
44
|
-
...props
|
|
45
|
-
}: React.ComponentProps<typeof SelectPrimitive.ScrollUpButton>): _$react_jsx_runtime0.JSX.Element;
|
|
46
|
-
declare function SelectScrollDownButton({
|
|
47
|
-
className,
|
|
48
|
-
...props
|
|
49
|
-
}: React.ComponentProps<typeof SelectPrimitive.ScrollDownButton>): _$react_jsx_runtime0.JSX.Element;
|
|
50
42
|
//#endregion
|
|
51
|
-
export { Select, SelectContent, SelectGroup, SelectItem, SelectLabel,
|
|
43
|
+
export { Select, SelectContent, SelectGroup, SelectItem, SelectLabel, SelectSeparator, SelectTrigger, SelectValue, selectTriggerVariants };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { cn } from "../lib/cn.mjs";
|
|
3
3
|
import { selectTriggerVariants } from "./select-trigger-variants.mjs";
|
|
4
|
-
import { CheckIcon, ChevronDownIcon
|
|
4
|
+
import { CheckIcon, ChevronDownIcon } from "lucide-react";
|
|
5
5
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
6
6
|
import * as SelectPrimitive from "@radix-ui/react-select";
|
|
7
7
|
//#region src/components/select.tsx
|
|
@@ -35,19 +35,15 @@ function SelectTrigger({ className, size = "md", children, ...props }) {
|
|
|
35
35
|
});
|
|
36
36
|
}
|
|
37
37
|
function SelectContent({ className, children, position = "popper", ...props }) {
|
|
38
|
-
return /* @__PURE__ */ jsx(SelectPrimitive.Portal, { children: /* @__PURE__ */
|
|
38
|
+
return /* @__PURE__ */ jsx(SelectPrimitive.Portal, { children: /* @__PURE__ */ jsx(SelectPrimitive.Content, {
|
|
39
39
|
"data-slot": "select-content",
|
|
40
40
|
className: cn("bg-popover text-popover-foreground", "relative z-50 max-h-[min(var(--radix-select-content-available-height),300px)] min-w-[8rem] overflow-hidden rounded-md border border-border-secondary py-1 shadow-lg", "origin-(--radix-select-content-transform-origin)", "data-[state=open]:animate-in data-[state=closed]:animate-out", "data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0", "data-[state=closed]:zoom-out-95 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", position === "popper" && "data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1", className),
|
|
41
41
|
position,
|
|
42
42
|
...props,
|
|
43
|
-
children:
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
children
|
|
48
|
-
}),
|
|
49
|
-
/* @__PURE__ */ jsx(SelectScrollDownButton, {})
|
|
50
|
-
]
|
|
43
|
+
children: /* @__PURE__ */ jsx(SelectPrimitive.Viewport, {
|
|
44
|
+
className: cn("p-1", position === "popper" && "h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)] scroll-my-1"),
|
|
45
|
+
children
|
|
46
|
+
})
|
|
51
47
|
}) });
|
|
52
48
|
}
|
|
53
49
|
function SelectLabel({ className, ...props }) {
|
|
@@ -60,7 +56,7 @@ function SelectLabel({ className, ...props }) {
|
|
|
60
56
|
function SelectItem({ className, children, ...props }) {
|
|
61
57
|
return /* @__PURE__ */ jsxs(SelectPrimitive.Item, {
|
|
62
58
|
"data-slot": "select-item",
|
|
63
|
-
className: cn("relative flex
|
|
59
|
+
className: cn("relative flex cursor-default items-center gap-2 rounded-sm py-1.5 pl-2 outline-hidden select-none", "type-text-md font-medium text-foreground mx-1 my-px", "[@media(hover:hover)]:hover:bg-background-hover", "focus:bg-background-hover", "data-[disabled]:pointer-events-none data-[disabled]:text-disabled-foreground", "[&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4", className),
|
|
64
60
|
...props,
|
|
65
61
|
children: [/* @__PURE__ */ jsx("span", {
|
|
66
62
|
className: "absolute right-2 flex size-4 items-center justify-center",
|
|
@@ -75,21 +71,5 @@ function SelectSeparator({ className, ...props }) {
|
|
|
75
71
|
...props
|
|
76
72
|
});
|
|
77
73
|
}
|
|
78
|
-
function SelectScrollUpButton({ className, ...props }) {
|
|
79
|
-
return /* @__PURE__ */ jsx(SelectPrimitive.ScrollUpButton, {
|
|
80
|
-
"data-slot": "select-scroll-up-button",
|
|
81
|
-
className: cn("flex cursor-default items-center justify-center py-1", className),
|
|
82
|
-
...props,
|
|
83
|
-
children: /* @__PURE__ */ jsx(ChevronUpIcon, { className: "size-4" })
|
|
84
|
-
});
|
|
85
|
-
}
|
|
86
|
-
function SelectScrollDownButton({ className, ...props }) {
|
|
87
|
-
return /* @__PURE__ */ jsx(SelectPrimitive.ScrollDownButton, {
|
|
88
|
-
"data-slot": "select-scroll-down-button",
|
|
89
|
-
className: cn("flex cursor-default items-center justify-center py-1", className),
|
|
90
|
-
...props,
|
|
91
|
-
children: /* @__PURE__ */ jsx(ChevronDownIcon, { className: "size-4" })
|
|
92
|
-
});
|
|
93
|
-
}
|
|
94
74
|
//#endregion
|
|
95
|
-
export { Select, SelectContent, SelectGroup, SelectItem, SelectLabel,
|
|
75
|
+
export { Select, SelectContent, SelectGroup, SelectItem, SelectLabel, SelectSeparator, SelectTrigger, SelectValue, selectTriggerVariants };
|
|
@@ -108,7 +108,7 @@ declare function SidebarMenuItem({
|
|
|
108
108
|
}: React.ComponentProps<"li">): _$react_jsx_runtime0.JSX.Element;
|
|
109
109
|
declare const sidebarMenuButtonVariants: (props?: ({
|
|
110
110
|
variant?: "default" | "outline" | null | undefined;
|
|
111
|
-
size?: "
|
|
111
|
+
size?: "default" | "sm" | "lg" | null | undefined;
|
|
112
112
|
} & _$class_variance_authority_types0.ClassProp) | undefined) => string;
|
|
113
113
|
declare function SidebarMenuButton({
|
|
114
114
|
asChild,
|
|
@@ -182,10 +182,10 @@ function SidebarHeader({ className, icon, title, children, ...props }) {
|
|
|
182
182
|
return /* @__PURE__ */ jsxs("div", {
|
|
183
183
|
"data-slot": "sidebar-header",
|
|
184
184
|
"data-sidebar": "header",
|
|
185
|
-
className: cn("flex flex-col gap-2 p-2
|
|
185
|
+
className: cn("flex flex-col gap-2 p-2", className),
|
|
186
186
|
...props,
|
|
187
187
|
children: [/* @__PURE__ */ jsxs("div", {
|
|
188
|
-
className: "flex h-8 items-center gap-2 px-
|
|
188
|
+
className: "flex h-8 items-center gap-2 px-3",
|
|
189
189
|
children: [
|
|
190
190
|
/* @__PURE__ */ jsxs("div", {
|
|
191
191
|
className: "relative shrink-0",
|
|
@@ -194,10 +194,10 @@ function SidebarHeader({ className, icon, title, children, ...props }) {
|
|
|
194
194
|
children: icon
|
|
195
195
|
}), /* @__PURE__ */ jsx("div", {
|
|
196
196
|
className: "absolute inset-0 flex items-center justify-center opacity-0 transition-opacity group-data-[collapsible=icon]:group-hover:opacity-100",
|
|
197
|
-
children: /* @__PURE__ */ jsx(SidebarTrigger, {
|
|
197
|
+
children: /* @__PURE__ */ jsx(SidebarTrigger, {})
|
|
198
198
|
})]
|
|
199
199
|
}),
|
|
200
|
-
|
|
200
|
+
/* @__PURE__ */ jsx("span", {
|
|
201
201
|
className: "text-foreground text-md min-w-0 truncate font-medium group-data-[collapsible=icon]:hidden",
|
|
202
202
|
children: title
|
|
203
203
|
}),
|
|
@@ -232,7 +232,7 @@ function SidebarGroup({ className, ...props }) {
|
|
|
232
232
|
return /* @__PURE__ */ jsx("div", {
|
|
233
233
|
"data-slot": "sidebar-group",
|
|
234
234
|
"data-sidebar": "group",
|
|
235
|
-
className: cn("relative flex w-full min-w-0 flex-col
|
|
235
|
+
className: cn("relative flex w-full min-w-0 flex-col", className),
|
|
236
236
|
...props
|
|
237
237
|
});
|
|
238
238
|
}
|
|
@@ -272,7 +272,7 @@ function SidebarMenuItem({ className, ...props }) {
|
|
|
272
272
|
return /* @__PURE__ */ jsx("li", {
|
|
273
273
|
"data-slot": "sidebar-menu-item",
|
|
274
274
|
"data-sidebar": "menu-item",
|
|
275
|
-
className: cn("group/menu-item relative", className),
|
|
275
|
+
className: cn("group/menu-item relative px-3", className),
|
|
276
276
|
...props
|
|
277
277
|
});
|
|
278
278
|
}
|
|
@@ -5,7 +5,7 @@ import * as _$class_variance_authority_types0 from "class-variance-authority/typ
|
|
|
5
5
|
//#region src/components/spinner.d.ts
|
|
6
6
|
declare const spinnerVariants: (props?: ({
|
|
7
7
|
variant?: "secondary" | "primary" | null | undefined;
|
|
8
|
-
size?: "sm" | "
|
|
8
|
+
size?: "sm" | "md" | "lg" | "xl" | null | undefined;
|
|
9
9
|
} & _$class_variance_authority_types0.ClassProp) | undefined) => string;
|
|
10
10
|
interface SpinnerProps extends Omit<React.ComponentProps<"svg">, "children">, VariantProps<typeof spinnerVariants> {}
|
|
11
11
|
declare function Spinner({
|
|
@@ -4,7 +4,7 @@ import * as _$class_variance_authority_types0 from "class-variance-authority/typ
|
|
|
4
4
|
|
|
5
5
|
//#region src/components/status-dot.d.ts
|
|
6
6
|
declare const statusDotVariants: (props?: ({
|
|
7
|
-
variant?: "
|
|
7
|
+
variant?: "destructive" | "warning" | "success" | "muted" | null | undefined;
|
|
8
8
|
pulse?: boolean | null | undefined;
|
|
9
9
|
} & _$class_variance_authority_types0.ClassProp) | undefined) => string;
|
|
10
10
|
interface StatusDotProps extends React.HTMLAttributes<HTMLDivElement>, VariantProps<typeof statusDotVariants> {}
|
|
@@ -6,7 +6,7 @@ import * as _$class_variance_authority_types0 from "class-variance-authority/typ
|
|
|
6
6
|
|
|
7
7
|
//#region src/components/tabs.d.ts
|
|
8
8
|
declare const tabsTriggerVariants: (props?: ({
|
|
9
|
-
variant?: "default" | "
|
|
9
|
+
variant?: "default" | "pill" | "line" | null | undefined;
|
|
10
10
|
} & _$class_variance_authority_types0.ClassProp) | undefined) => string;
|
|
11
11
|
declare function Tabs({
|
|
12
12
|
className,
|
|
@@ -7,6 +7,7 @@ interface TextareaProps extends React.ComponentProps<"textarea"> {
|
|
|
7
7
|
required?: boolean;
|
|
8
8
|
hint?: string;
|
|
9
9
|
error?: string;
|
|
10
|
+
tooltip?: string;
|
|
10
11
|
}
|
|
11
12
|
declare function Textarea({
|
|
12
13
|
className,
|
|
@@ -15,6 +16,7 @@ declare function Textarea({
|
|
|
15
16
|
required,
|
|
16
17
|
hint,
|
|
17
18
|
error,
|
|
19
|
+
tooltip,
|
|
18
20
|
...props
|
|
19
21
|
}: TextareaProps): _$react_jsx_runtime0.JSX.Element;
|
|
20
22
|
//#endregion
|