@alpic-ai/ui 0.0.0-dev.4a35dc7 → 0.0.0-dev.6d637e5

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.
Files changed (99) hide show
  1. package/dist/components/accordion-card.d.mts +1 -1
  2. package/dist/components/accordion.d.mts +1 -1
  3. package/dist/components/alert.d.mts +1 -1
  4. package/dist/components/attachment-tile.mjs +1 -1
  5. package/dist/components/avatar.d.mts +1 -1
  6. package/dist/components/breadcrumb.d.mts +1 -1
  7. package/dist/components/button.d.mts +1 -1
  8. package/dist/components/card.d.mts +1 -1
  9. package/dist/components/checkbox.d.mts +1 -1
  10. package/dist/components/collapsible.d.mts +1 -1
  11. package/dist/components/combobox.d.mts +1 -1
  12. package/dist/components/combobox.mjs +2 -2
  13. package/dist/components/command.d.mts +1 -1
  14. package/dist/components/copyable.d.mts +1 -1
  15. package/dist/components/copyable.mjs +1 -1
  16. package/dist/components/description-list.d.mts +1 -1
  17. package/dist/components/dialog.d.mts +1 -1
  18. package/dist/components/dialog.mjs +2 -2
  19. package/dist/components/dropdown-menu.d.mts +1 -1
  20. package/dist/components/form.d.mts +119 -0
  21. package/dist/components/form.mjs +192 -0
  22. package/dist/components/input-group.d.mts +1 -1
  23. package/dist/components/input.d.mts +3 -1
  24. package/dist/components/input.mjs +20 -11
  25. package/dist/components/label.d.mts +1 -1
  26. package/dist/components/pagination.d.mts +1 -1
  27. package/dist/components/popover.d.mts +1 -1
  28. package/dist/components/radio-group.d.mts +1 -1
  29. package/dist/components/scroll-area.d.mts +1 -1
  30. package/dist/components/select-trigger-variants.mjs +1 -0
  31. package/dist/components/select.d.mts +2 -10
  32. package/dist/components/select.mjs +8 -28
  33. package/dist/components/separator.d.mts +1 -1
  34. package/dist/components/sheet.d.mts +1 -1
  35. package/dist/components/sidebar.d.mts +1 -1
  36. package/dist/components/sidebar.mjs +8 -8
  37. package/dist/components/sonner.d.mts +1 -1
  38. package/dist/components/switch.d.mts +1 -1
  39. package/dist/components/table.d.mts +1 -1
  40. package/dist/components/tabs.d.mts +1 -1
  41. package/dist/components/tabs.mjs +1 -1
  42. package/dist/components/textarea.d.mts +3 -1
  43. package/dist/components/textarea.mjs +20 -11
  44. package/dist/components/toggle-group.d.mts +1 -1
  45. package/dist/components/toggle-group.mjs +1 -1
  46. package/dist/components/tooltip-icon-button.mjs +1 -1
  47. package/dist/components/tooltip.d.mts +1 -1
  48. package/package.json +10 -11
  49. package/src/components/combobox.tsx +1 -1
  50. package/src/components/dialog.tsx +2 -2
  51. package/src/components/form.tsx +343 -0
  52. package/src/components/input.tsx +12 -0
  53. package/src/components/select-trigger-variants.ts +1 -0
  54. package/src/components/select.tsx +2 -35
  55. package/src/components/sidebar.tsx +8 -10
  56. package/src/components/textarea.tsx +12 -1
  57. package/src/stories/accordion-card.stories.tsx +53 -0
  58. package/src/stories/accordion.stories.tsx +65 -0
  59. package/src/stories/alert.stories.tsx +58 -0
  60. package/src/stories/attachment-tile.stories.tsx +37 -0
  61. package/src/stories/avatar.stories.tsx +54 -0
  62. package/src/stories/badge.stories.tsx +50 -0
  63. package/src/stories/breadcrumb.stories.tsx +107 -0
  64. package/src/stories/button.stories.tsx +342 -0
  65. package/src/stories/card.stories.tsx +89 -0
  66. package/src/stories/checkbox.stories.tsx +56 -0
  67. package/src/stories/collapsible.stories.tsx +69 -0
  68. package/src/stories/combobox.stories.tsx +214 -0
  69. package/src/stories/command.stories.tsx +95 -0
  70. package/src/stories/copyable.stories.tsx +29 -0
  71. package/src/stories/description-list.stories.tsx +71 -0
  72. package/src/stories/dialog.stories.tsx +135 -0
  73. package/src/stories/dropdown-menu.stories.tsx +191 -0
  74. package/src/stories/form.stories.tsx +91 -0
  75. package/src/stories/input-group.stories.tsx +63 -0
  76. package/src/stories/input.stories.tsx +72 -0
  77. package/src/stories/label.stories.tsx +26 -0
  78. package/src/stories/ladle.css +3 -0
  79. package/src/stories/pagination.stories.tsx +35 -0
  80. package/src/stories/popover.stories.tsx +34 -0
  81. package/src/stories/radio-group.stories.tsx +59 -0
  82. package/src/stories/scroll-area.stories.tsx +43 -0
  83. package/src/stories/select.stories.tsx +95 -0
  84. package/src/stories/separator.stories.tsx +36 -0
  85. package/src/stories/sheet.stories.tsx +76 -0
  86. package/src/stories/sidebar.stories.tsx +255 -0
  87. package/src/stories/skeleton.stories.tsx +47 -0
  88. package/src/stories/sonner.stories.tsx +91 -0
  89. package/src/stories/spinner.stories.tsx +66 -0
  90. package/src/stories/status-dot.stories.tsx +27 -0
  91. package/src/stories/switch.stories.tsx +46 -0
  92. package/src/stories/table.stories.tsx +242 -0
  93. package/src/stories/tabs.stories.tsx +169 -0
  94. package/src/stories/tag.stories.tsx +82 -0
  95. package/src/stories/textarea.stories.tsx +60 -0
  96. package/src/stories/toggle-group.stories.tsx +142 -0
  97. package/src/stories/tooltip-icon-button.stories.tsx +59 -0
  98. package/src/stories/tooltip.stories.tsx +54 -0
  99. package/README.md +0 -33
@@ -1,6 +1,6 @@
1
- import * as React from "react";
2
1
  import * as AccordionPrimitive from "@radix-ui/react-accordion";
3
2
  import * as _$react_jsx_runtime0 from "react/jsx-runtime";
3
+ import * as React from "react";
4
4
 
5
5
  //#region src/components/accordion-card.d.ts
6
6
  declare function AccordionCard({
@@ -1,6 +1,6 @@
1
- import * as React from "react";
2
1
  import * as AccordionPrimitive from "@radix-ui/react-accordion";
3
2
  import * as _$react_jsx_runtime0 from "react/jsx-runtime";
3
+ import * as React from "react";
4
4
 
5
5
  //#region src/components/accordion.d.ts
6
6
  declare function Accordion({
@@ -1,6 +1,6 @@
1
- import * as React from "react";
2
1
  import * as _$react_jsx_runtime0 from "react/jsx-runtime";
3
2
  import { VariantProps } from "class-variance-authority";
3
+ import * as React from "react";
4
4
  import * as _$class_variance_authority_types0 from "class-variance-authority/types";
5
5
 
6
6
  //#region src/components/alert.d.ts
@@ -1,9 +1,9 @@
1
1
  "use client";
2
2
  import { cn } from "../lib/cn.mjs";
3
3
  import { TooltipIconButton } from "./tooltip-icon-button.mjs";
4
- import { useState } from "react";
5
4
  import { FileText, XIcon } from "lucide-react";
6
5
  import { jsx, jsxs } from "react/jsx-runtime";
6
+ import { useState } from "react";
7
7
  //#region src/components/attachment-tile.tsx
8
8
  function AttachmentTile({ src, isImage, label, onRemove, onClick, className }) {
9
9
  const [hasError, setHasError] = useState(false);
@@ -1,6 +1,6 @@
1
- import * as React from "react";
2
1
  import * as _$react_jsx_runtime0 from "react/jsx-runtime";
3
2
  import { VariantProps } from "class-variance-authority";
3
+ import * as React from "react";
4
4
  import * as AvatarPrimitive from "@radix-ui/react-avatar";
5
5
  import * as _$class_variance_authority_types0 from "class-variance-authority/types";
6
6
 
@@ -1,5 +1,5 @@
1
- import * as React from "react";
2
1
  import * as _$react_jsx_runtime0 from "react/jsx-runtime";
2
+ import * as React from "react";
3
3
 
4
4
  //#region src/components/breadcrumb.d.ts
5
5
  declare function Breadcrumb({
@@ -1,6 +1,6 @@
1
- import * as React from "react";
2
1
  import * as _$react_jsx_runtime0 from "react/jsx-runtime";
3
2
  import { VariantProps } from "class-variance-authority";
3
+ import * as React from "react";
4
4
  import * as _$class_variance_authority_types0 from "class-variance-authority/types";
5
5
 
6
6
  //#region src/components/button.d.ts
@@ -1,5 +1,5 @@
1
- import * as React from "react";
2
1
  import * as _$react_jsx_runtime0 from "react/jsx-runtime";
2
+ import * as React from "react";
3
3
 
4
4
  //#region src/components/card.d.ts
5
5
  declare function Card({
@@ -1,5 +1,5 @@
1
- import * as React from "react";
2
1
  import * as _$react_jsx_runtime0 from "react/jsx-runtime";
2
+ import * as React from "react";
3
3
  import * as CheckboxPrimitive from "@radix-ui/react-checkbox";
4
4
 
5
5
  //#region src/components/checkbox.d.ts
@@ -1,5 +1,5 @@
1
- import * as React from "react";
2
1
  import * as _$react_jsx_runtime0 from "react/jsx-runtime";
2
+ import * as React from "react";
3
3
  import * as CollapsiblePrimitive from "@radix-ui/react-collapsible";
4
4
 
5
5
  //#region src/components/collapsible.d.ts
@@ -1,8 +1,8 @@
1
1
  import { PopoverContent } from "./popover.mjs";
2
2
  import { selectTriggerVariants } from "./select-trigger-variants.mjs";
3
- import { ReactNode } from "react";
4
3
  import * as _$react_jsx_runtime0 from "react/jsx-runtime";
5
4
  import { VariantProps } from "class-variance-authority";
5
+ import { ReactNode } from "react";
6
6
  import { Command } from "cmdk";
7
7
 
8
8
  //#region src/components/combobox.d.ts
@@ -3,9 +3,9 @@ import { cn } from "../lib/cn.mjs";
3
3
  import { Popover, PopoverContent, PopoverTrigger } from "./popover.mjs";
4
4
  import { selectTriggerVariants } from "./select-trigger-variants.mjs";
5
5
  import { TagDismissible } from "./tag.mjs";
6
- import { createContext, useCallback, useContext, useMemo, useState } from "react";
7
6
  import { CheckIcon, ChevronDownIcon, SearchIcon } from "lucide-react";
8
7
  import { Fragment, jsx, jsxs } from "react/jsx-runtime";
8
+ import { createContext, useCallback, useContext, useMemo, useState } from "react";
9
9
  import { Command } from "cmdk";
10
10
  //#region src/components/combobox.tsx
11
11
  const ComboboxContext = createContext(null);
@@ -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-2.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),
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",
@@ -1,5 +1,5 @@
1
- import * as React from "react";
2
1
  import * as _$react_jsx_runtime0 from "react/jsx-runtime";
2
+ import * as React from "react";
3
3
  import { Command as Command$1 } from "cmdk";
4
4
 
5
5
  //#region src/components/command.d.ts
@@ -1,5 +1,5 @@
1
- import { ReactNode } from "react";
2
1
  import * as _$react_jsx_runtime0 from "react/jsx-runtime";
2
+ import { ReactNode } from "react";
3
3
 
4
4
  //#region src/components/copyable.d.ts
5
5
  interface CopyableProps {
@@ -1,7 +1,7 @@
1
1
  "use client";
2
- import { useCopyToClipboard } from "../hooks/use-copy-to-clipboard.mjs";
3
2
  import { cn } from "../lib/cn.mjs";
4
3
  import { Button } from "./button.mjs";
4
+ import { useCopyToClipboard } from "../hooks/use-copy-to-clipboard.mjs";
5
5
  import { Check, Copy } from "lucide-react";
6
6
  import { jsx, jsxs } from "react/jsx-runtime";
7
7
  //#region src/components/copyable.tsx
@@ -1,5 +1,5 @@
1
- import * as React from "react";
2
1
  import * as _$react_jsx_runtime0 from "react/jsx-runtime";
2
+ import * as React from "react";
3
3
 
4
4
  //#region src/components/description-list.d.ts
5
5
  declare function DescriptionList({
@@ -1,7 +1,7 @@
1
1
  import { ButtonProps } from "./button.mjs";
2
- import * as React from "react";
3
2
  import * as _$react_jsx_runtime0 from "react/jsx-runtime";
4
3
  import { VariantProps } from "class-variance-authority";
4
+ import * as React from "react";
5
5
  import * as DialogPrimitive from "@radix-ui/react-dialog";
6
6
  import * as _$class_variance_authority_types0 from "class-variance-authority/types";
7
7
 
@@ -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
- "overflow-y-auto rounded-2xl px-6 shadow-lg outline-none",
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 pt-6 pr-10", className),
66
+ className: cn("flex flex-col gap-0.5 py-6 pr-10", className),
67
67
  ...props
68
68
  });
69
69
  }
@@ -1,6 +1,6 @@
1
- import * as React from "react";
2
1
  import * as _$react_jsx_runtime0 from "react/jsx-runtime";
3
2
  import { VariantProps } from "class-variance-authority";
3
+ import * as React from "react";
4
4
  import * as DropdownMenuPrimitive from "@radix-ui/react-dropdown-menu";
5
5
  import * as _$class_variance_authority_types0 from "class-variance-authority/types";
6
6
 
@@ -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 };
@@ -1,6 +1,6 @@
1
- import * as React from "react";
2
1
  import * as _$react_jsx_runtime0 from "react/jsx-runtime";
3
2
  import { VariantProps } from "class-variance-authority";
3
+ import * as React from "react";
4
4
  import * as _$class_variance_authority_types0 from "class-variance-authority/types";
5
5
 
6
6
  //#region src/components/input-group.d.ts
@@ -1,5 +1,5 @@
1
- import * as React from "react";
2
1
  import * as _$react_jsx_runtime0 from "react/jsx-runtime";
2
+ import * as React from "react";
3
3
 
4
4
  //#region src/components/input.d.ts
5
5
  interface InputProps extends Omit<React.ComponentProps<"input">, "size"> {
@@ -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,8 +1,10 @@
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";
4
- import * as React from "react";
5
+ import { Info } from "lucide-react";
5
6
  import { jsx, jsxs } from "react/jsx-runtime";
7
+ import * as React from "react";
6
8
  //#region src/components/input.tsx
7
9
  const inputSizeStyles = {
8
10
  sm: {
@@ -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: [/* @__PURE__ */ jsx(Label, {
71
- htmlFor: fieldId,
72
- className: "type-text-sm font-medium text-muted-foreground",
73
- children: label
74
- }), required && /* @__PURE__ */ jsx("span", {
75
- "aria-hidden": true,
76
- className: "type-text-sm font-medium text-required",
77
- children: "*"
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", {
@@ -1,5 +1,5 @@
1
- import * as React from "react";
2
1
  import * as _$react_jsx_runtime0 from "react/jsx-runtime";
2
+ import * as React from "react";
3
3
  import * as LabelPrimitive from "@radix-ui/react-label";
4
4
 
5
5
  //#region src/components/label.d.ts
@@ -1,5 +1,5 @@
1
- import * as React from "react";
2
1
  import * as _$react_jsx_runtime0 from "react/jsx-runtime";
2
+ import * as React from "react";
3
3
 
4
4
  //#region src/components/pagination.d.ts
5
5
  interface PaginationProps extends React.ComponentProps<"nav"> {
@@ -1,5 +1,5 @@
1
- import * as React from "react";
2
1
  import * as _$react_jsx_runtime0 from "react/jsx-runtime";
2
+ import * as React from "react";
3
3
  import * as PopoverPrimitive from "@radix-ui/react-popover";
4
4
 
5
5
  //#region src/components/popover.d.ts
@@ -1,5 +1,5 @@
1
- import * as React from "react";
2
1
  import * as _$react_jsx_runtime0 from "react/jsx-runtime";
2
+ import * as React from "react";
3
3
  import * as RadioGroupPrimitive from "@radix-ui/react-radio-group";
4
4
 
5
5
  //#region src/components/radio-group.d.ts
@@ -1,5 +1,5 @@
1
- import * as React from "react";
2
1
  import * as _$react_jsx_runtime0 from "react/jsx-runtime";
2
+ import * as React from "react";
3
3
  import * as ScrollAreaPrimitive from "@radix-ui/react-scroll-area";
4
4
 
5
5
  //#region src/components/scroll-area.d.ts
@@ -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: {