@cbrl/design 0.0.0-stage → 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (104) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +100 -2
  3. package/dist/components/alert-dialog.d.ts +14 -0
  4. package/dist/components/alert-dialog.js +82 -0
  5. package/dist/components/app-shell.d.ts +38 -0
  6. package/dist/components/app-shell.js +72 -0
  7. package/dist/components/auth-split-screen.d.ts +30 -0
  8. package/dist/components/auth-split-screen.js +45 -0
  9. package/dist/components/avatar.d.ts +11 -0
  10. package/dist/components/avatar.js +50 -0
  11. package/dist/components/badge.d.ts +9 -0
  12. package/dist/components/badge.js +27 -0
  13. package/dist/components/breadcrumb.d.ts +11 -0
  14. package/dist/components/breadcrumb.js +69 -0
  15. package/dist/components/button.d.ts +10 -0
  16. package/dist/components/button.js +47 -0
  17. package/dist/components/calendar.d.ts +7 -0
  18. package/dist/components/calendar.js +142 -0
  19. package/dist/components/card.d.ts +13 -0
  20. package/dist/components/card.js +57 -0
  21. package/dist/components/checkbox.d.ts +4 -0
  22. package/dist/components/checkbox.js +20 -0
  23. package/dist/components/collapsible.d.ts +5 -0
  24. package/dist/components/collapsible.js +23 -0
  25. package/dist/components/date-field.d.ts +31 -0
  26. package/dist/components/date-field.js +129 -0
  27. package/dist/components/dialog.d.ts +17 -0
  28. package/dist/components/dialog.js +95 -0
  29. package/dist/components/dropdown-menu.d.ts +29 -0
  30. package/dist/components/dropdown-menu.js +127 -0
  31. package/dist/components/empty-state.d.ts +32 -0
  32. package/dist/components/empty-state.js +61 -0
  33. package/dist/components/field.d.ts +25 -0
  34. package/dist/components/field.js +121 -0
  35. package/dist/components/highlighted-textarea.d.ts +6 -0
  36. package/dist/components/highlighted-textarea.js +68 -0
  37. package/dist/components/input-group.d.ts +8 -0
  38. package/dist/components/input-group.js +28 -0
  39. package/dist/components/input.d.ts +3 -0
  40. package/dist/components/input.js +13 -0
  41. package/dist/components/label.d.ts +4 -0
  42. package/dist/components/label.js +14 -0
  43. package/dist/components/list.d.ts +174 -0
  44. package/dist/components/list.js +281 -0
  45. package/dist/components/main.d.ts +10 -0
  46. package/dist/components/main.js +36 -0
  47. package/dist/components/pagination.d.ts +25 -0
  48. package/dist/components/pagination.js +104 -0
  49. package/dist/components/popover.d.ts +6 -0
  50. package/dist/components/popover.js +28 -0
  51. package/dist/components/radio-group.d.ts +5 -0
  52. package/dist/components/radio-group.js +27 -0
  53. package/dist/components/scroll-area.d.ts +5 -0
  54. package/dist/components/scroll-area.js +35 -0
  55. package/dist/components/select.d.ts +15 -0
  56. package/dist/components/select.js +95 -0
  57. package/dist/components/separator.d.ts +4 -0
  58. package/dist/components/separator.js +16 -0
  59. package/dist/components/setting-row.d.ts +8 -0
  60. package/dist/components/setting-row.js +36 -0
  61. package/dist/components/settings-section.d.ts +7 -0
  62. package/dist/components/settings-section.js +36 -0
  63. package/dist/components/sheet.d.ts +14 -0
  64. package/dist/components/sheet.js +89 -0
  65. package/dist/components/sidebar-core.d.ts +33 -0
  66. package/dist/components/sidebar-core.js +220 -0
  67. package/dist/components/sidebar-menu.d.ts +38 -0
  68. package/dist/components/sidebar-menu.js +168 -0
  69. package/dist/components/sidebar.d.ts +3 -0
  70. package/dist/components/skeleton.d.ts +2 -0
  71. package/dist/components/skeleton.js +11 -0
  72. package/dist/components/sonner.d.ts +3 -0
  73. package/dist/components/sonner.js +31 -0
  74. package/dist/components/stepper.d.ts +8 -0
  75. package/dist/components/stepper.js +58 -0
  76. package/dist/components/switch.d.ts +6 -0
  77. package/dist/components/switch.js +19 -0
  78. package/dist/components/table.d.ts +10 -0
  79. package/dist/components/table.js +65 -0
  80. package/dist/components/tabs.d.ts +7 -0
  81. package/dist/components/tabs.js +35 -0
  82. package/dist/components/textarea.d.ts +3 -0
  83. package/dist/components/textarea.js +12 -0
  84. package/dist/components/tooltip.d.ts +7 -0
  85. package/dist/components/tooltip.js +35 -0
  86. package/dist/components/typography.d.ts +9 -0
  87. package/dist/components/typography.js +45 -0
  88. package/dist/components/user-menu.d.ts +24 -0
  89. package/dist/components/user-menu.js +48 -0
  90. package/dist/globals.css +60 -0
  91. package/dist/hooks/use-mobile.d.ts +1 -0
  92. package/dist/hooks/use-mobile.js +17 -0
  93. package/dist/index.d.ts +48 -0
  94. package/dist/index.js +47 -0
  95. package/dist/lib/cn.d.ts +2 -0
  96. package/dist/lib/cn.js +7 -0
  97. package/dist/lib/css-vars.js +5 -0
  98. package/dist/lib/date.js +38 -0
  99. package/dist/lib/nav.d.ts +15 -0
  100. package/dist/lib/nav.js +11 -0
  101. package/dist/lib/toaster-theme.js +5 -0
  102. package/dist/shadcn.css +635 -0
  103. package/dist/tokens.css +160 -0
  104. package/package.json +85 -3
@@ -0,0 +1,127 @@
1
+ "use client";
2
+ import { cn } from "../lib/cn.js";
3
+ import "react";
4
+ import { DropdownMenu as DropdownMenu$1 } from "radix-ui";
5
+ import { jsx, jsxs } from "react/jsx-runtime";
6
+ import { CheckIcon, ChevronRightIcon } from "lucide-react";
7
+ // src/components/dropdown-menu.tsx
8
+ function DropdownMenu({ ...props }) {
9
+ return /* @__PURE__ */ jsx(DropdownMenu$1.Root, {
10
+ "data-slot": "dropdown-menu",
11
+ ...props
12
+ });
13
+ }
14
+ function DropdownMenuPortal({ ...props }) {
15
+ return /* @__PURE__ */ jsx(DropdownMenu$1.Portal, {
16
+ "data-slot": "dropdown-menu-portal",
17
+ ...props
18
+ });
19
+ }
20
+ function DropdownMenuTrigger({ ...props }) {
21
+ return /* @__PURE__ */ jsx(DropdownMenu$1.Trigger, {
22
+ "data-slot": "dropdown-menu-trigger",
23
+ ...props
24
+ });
25
+ }
26
+ function DropdownMenuContent({ className, align = "start", sideOffset = 4, ...props }) {
27
+ return /* @__PURE__ */ jsx(DropdownMenu$1.Portal, { children: /* @__PURE__ */ jsx(DropdownMenu$1.Content, {
28
+ "data-slot": "dropdown-menu-content",
29
+ sideOffset,
30
+ align,
31
+ className: cn("bg-popover text-popover-foreground ring-foreground/10 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-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95 z-50 max-h-(--radix-dropdown-menu-content-available-height) w-(--radix-dropdown-menu-trigger-width) min-w-32 origin-(--radix-dropdown-menu-content-transform-origin) overflow-x-hidden overflow-y-auto rounded-lg p-1 shadow-md ring-1 duration-100 data-[state=closed]:overflow-hidden", className),
32
+ ...props
33
+ }) });
34
+ }
35
+ function DropdownMenuGroup({ ...props }) {
36
+ return /* @__PURE__ */ jsx(DropdownMenu$1.Group, {
37
+ "data-slot": "dropdown-menu-group",
38
+ ...props
39
+ });
40
+ }
41
+ function DropdownMenuItem({ className, inset, variant = "default", ...props }) {
42
+ return /* @__PURE__ */ jsx(DropdownMenu$1.Item, {
43
+ "data-slot": "dropdown-menu-item",
44
+ "data-inset": inset,
45
+ "data-variant": variant,
46
+ className: cn("group/dropdown-menu-item focus:bg-accent focus:text-accent-foreground not-data-[variant=destructive]:focus:**:text-accent-foreground data-[variant=destructive]:text-destructive data-[variant=destructive]:focus:bg-destructive/10 data-[variant=destructive]:focus:text-destructive dark:data-[variant=destructive]:focus:bg-destructive/20 data-[variant=destructive]:*:[svg]:text-destructive relative flex cursor-default items-center gap-1.5 rounded-md px-1.5 py-1 text-sm outline-hidden select-none data-disabled:pointer-events-none data-disabled:opacity-50 data-inset:pl-7 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4", className),
47
+ ...props
48
+ });
49
+ }
50
+ function DropdownMenuCheckboxItem({ className, children, checked, inset, ...props }) {
51
+ return /* @__PURE__ */ jsxs(DropdownMenu$1.CheckboxItem, {
52
+ "data-slot": "dropdown-menu-checkbox-item",
53
+ "data-inset": inset,
54
+ className: cn("focus:bg-accent focus:text-accent-foreground focus:**:text-accent-foreground relative flex cursor-default items-center gap-1.5 rounded-md py-1 pr-8 pl-1.5 text-sm outline-hidden select-none data-disabled:pointer-events-none data-disabled:opacity-50 data-inset:pl-7 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4", className),
55
+ checked,
56
+ ...props,
57
+ children: [/* @__PURE__ */ jsx("span", {
58
+ className: "pointer-events-none absolute right-2 flex items-center justify-center",
59
+ "data-slot": "dropdown-menu-checkbox-item-indicator",
60
+ children: /* @__PURE__ */ jsx(DropdownMenu$1.ItemIndicator, { children: /* @__PURE__ */ jsx(CheckIcon, {}) })
61
+ }), children]
62
+ });
63
+ }
64
+ function DropdownMenuRadioGroup({ ...props }) {
65
+ return /* @__PURE__ */ jsx(DropdownMenu$1.RadioGroup, {
66
+ "data-slot": "dropdown-menu-radio-group",
67
+ ...props
68
+ });
69
+ }
70
+ function DropdownMenuRadioItem({ className, children, inset, ...props }) {
71
+ return /* @__PURE__ */ jsxs(DropdownMenu$1.RadioItem, {
72
+ "data-slot": "dropdown-menu-radio-item",
73
+ "data-inset": inset,
74
+ className: cn("focus:bg-accent focus:text-accent-foreground focus:**:text-accent-foreground relative flex cursor-default items-center gap-1.5 rounded-md py-1 pr-8 pl-1.5 text-sm outline-hidden select-none data-disabled:pointer-events-none data-disabled:opacity-50 data-inset:pl-7 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4", className),
75
+ ...props,
76
+ children: [/* @__PURE__ */ jsx("span", {
77
+ className: "pointer-events-none absolute right-2 flex items-center justify-center",
78
+ "data-slot": "dropdown-menu-radio-item-indicator",
79
+ children: /* @__PURE__ */ jsx(DropdownMenu$1.ItemIndicator, { children: /* @__PURE__ */ jsx(CheckIcon, {}) })
80
+ }), children]
81
+ });
82
+ }
83
+ function DropdownMenuLabel({ className, inset, ...props }) {
84
+ return /* @__PURE__ */ jsx(DropdownMenu$1.Label, {
85
+ "data-slot": "dropdown-menu-label",
86
+ "data-inset": inset,
87
+ className: cn("text-muted-foreground px-1.5 py-1 text-xs font-medium data-inset:pl-7", className),
88
+ ...props
89
+ });
90
+ }
91
+ function DropdownMenuSeparator({ className, ...props }) {
92
+ return /* @__PURE__ */ jsx(DropdownMenu$1.Separator, {
93
+ "data-slot": "dropdown-menu-separator",
94
+ className: cn("bg-border -mx-1 my-1 h-px", className),
95
+ ...props
96
+ });
97
+ }
98
+ function DropdownMenuShortcut({ className, ...props }) {
99
+ return /* @__PURE__ */ jsx("span", {
100
+ "data-slot": "dropdown-menu-shortcut",
101
+ className: cn("text-muted-foreground group-focus/dropdown-menu-item:text-accent-foreground ml-auto text-xs tracking-widest", className),
102
+ ...props
103
+ });
104
+ }
105
+ function DropdownMenuSub({ ...props }) {
106
+ return /* @__PURE__ */ jsx(DropdownMenu$1.Sub, {
107
+ "data-slot": "dropdown-menu-sub",
108
+ ...props
109
+ });
110
+ }
111
+ function DropdownMenuSubTrigger({ className, inset, children, ...props }) {
112
+ return /* @__PURE__ */ jsxs(DropdownMenu$1.SubTrigger, {
113
+ "data-slot": "dropdown-menu-sub-trigger",
114
+ "data-inset": inset,
115
+ className: cn("focus:bg-accent focus:text-accent-foreground not-data-[variant=destructive]:focus:**:text-accent-foreground data-open:bg-accent data-open:text-accent-foreground flex cursor-default items-center gap-1.5 rounded-md px-1.5 py-1 text-sm outline-hidden select-none data-inset:pl-7 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4", className),
116
+ ...props,
117
+ children: [children, /* @__PURE__ */ jsx(ChevronRightIcon, { className: "ml-auto" })]
118
+ });
119
+ }
120
+ function DropdownMenuSubContent({ className, ...props }) {
121
+ return /* @__PURE__ */ jsx(DropdownMenu$1.SubContent, {
122
+ "data-slot": "dropdown-menu-sub-content",
123
+ className: cn("bg-popover text-popover-foreground ring-foreground/10 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-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95 z-50 min-w-[96px] origin-(--radix-dropdown-menu-content-transform-origin) overflow-hidden rounded-lg p-1 shadow-lg ring-1 duration-100", className),
124
+ ...props
125
+ });
126
+ }
127
+ export { DropdownMenu, DropdownMenuCheckboxItem, DropdownMenuContent, DropdownMenuGroup, DropdownMenuItem, DropdownMenuLabel, DropdownMenuPortal, DropdownMenuRadioGroup, DropdownMenuRadioItem, DropdownMenuSeparator, DropdownMenuShortcut, DropdownMenuSub, DropdownMenuSubContent, DropdownMenuSubTrigger, DropdownMenuTrigger };
@@ -0,0 +1,32 @@
1
+ import * as React from "react";
2
+ type EmptyStateAction = {
3
+ label: string;
4
+ } & ({
5
+ href: string;
6
+ onClick?: never;
7
+ } | {
8
+ onClick: () => void;
9
+ href?: never;
10
+ });
11
+ type EmptyStateProps = React.ComponentProps<'div'> & {
12
+ /** Short, value-oriented headline — e.g. "Nenhuma unidade cadastrada". */
13
+ title: string;
14
+ /** Optional supporting copy that frames the value of creating the first item. */
15
+ description?: string;
16
+ /** Optional leading icon (typically a `lucide-react` glyph). */
17
+ icon?: React.ReactNode;
18
+ /**
19
+ * Primary call-to-action. Either a link (`href`) or a click handler
20
+ * (`onClick`) — never both. Rendered as a `Button`; when `href` is set the
21
+ * caller can wrap with their router's `<Link asChild>` via `actionAsChild`.
22
+ */
23
+ action?: EmptyStateAction;
24
+ /**
25
+ * When the action uses `href`, render the Button `asChild` so the consumer
26
+ * can pass a framework `<Link>` as the single child instead of the label.
27
+ * Defaults to false (plain anchor via `<a href>`).
28
+ */
29
+ actionSlot?: React.ReactNode;
30
+ };
31
+ declare function EmptyState({ title, description, icon, action, actionSlot, className, ...props }: EmptyStateProps): React.JSX.Element;
32
+ export { EmptyState, type EmptyStateProps };
@@ -0,0 +1,61 @@
1
+ import { cn } from "../lib/cn.js";
2
+ import { Button } from "./button.js";
3
+ import "react";
4
+ import { jsx, jsxs } from "react/jsx-runtime";
5
+ // src/components/empty-state.tsx
6
+ /**
7
+ * Actionable empty state for list/CRUD surfaces: a value-oriented headline,
8
+ * optional supporting copy + icon, and a primary CTA that opens the real
9
+ * creation flow. Shared so every area renders the same affordance instead of a
10
+ * bare "Nenhum X cadastrado" line.
11
+ */
12
+ function renderAction(action, actionSlot) {
13
+ if (actionSlot) return /* @__PURE__ */ jsx(Button, {
14
+ asChild: true,
15
+ className: "mt-1",
16
+ children: actionSlot
17
+ });
18
+ if (!action) return null;
19
+ if (action.href) return /* @__PURE__ */ jsx(Button, {
20
+ asChild: true,
21
+ className: "mt-1",
22
+ children: /* @__PURE__ */ jsx("a", {
23
+ href: action.href,
24
+ children: action.label
25
+ })
26
+ });
27
+ return /* @__PURE__ */ jsx(Button, {
28
+ type: "button",
29
+ onClick: action.onClick,
30
+ className: "mt-1",
31
+ children: action.label
32
+ });
33
+ }
34
+ function EmptyState({ title, description, icon, action, actionSlot, className, ...props }) {
35
+ return /* @__PURE__ */ jsxs("div", {
36
+ "data-slot": "empty-state",
37
+ className: cn("border-border bg-muted/20 flex w-full flex-col items-center gap-3 rounded-md border p-12 text-center", className),
38
+ ...props,
39
+ children: [
40
+ icon ? /* @__PURE__ */ jsx("div", {
41
+ "data-slot": "empty-state-icon",
42
+ className: "text-muted-foreground [&_svg]:size-8",
43
+ children: icon
44
+ }) : null,
45
+ /* @__PURE__ */ jsxs("div", {
46
+ className: "flex flex-col gap-1",
47
+ children: [/* @__PURE__ */ jsx("p", {
48
+ "data-slot": "empty-state-title",
49
+ className: "text-foreground text-sm font-medium",
50
+ children: title
51
+ }), description ? /* @__PURE__ */ jsx("p", {
52
+ "data-slot": "empty-state-description",
53
+ className: "text-muted-foreground text-sm",
54
+ children: description
55
+ }) : null]
56
+ }),
57
+ renderAction(action, actionSlot)
58
+ ]
59
+ });
60
+ }
61
+ export { EmptyState };
@@ -0,0 +1,25 @@
1
+ import { Label } from "./label.js";
2
+ import * as React from "react";
3
+ import { VariantProps } from "class-variance-authority";
4
+ declare function FieldSet({ className, ...props }: React.ComponentProps<'fieldset'>): React.JSX.Element;
5
+ declare function FieldLegend({ className, variant, ...props }: React.ComponentProps<'legend'> & {
6
+ variant?: 'legend' | 'label';
7
+ }): React.JSX.Element;
8
+ declare function FieldGroup({ className, ...props }: React.ComponentProps<'div'>): React.JSX.Element;
9
+ declare const fieldVariants: (props?: ({
10
+ orientation?: "vertical" | "horizontal" | "responsive" | null | undefined;
11
+ } & import("class-variance-authority/types").ClassProp) | undefined) => string;
12
+ declare function Field({ className, orientation, ...props }: React.ComponentProps<'div'> & VariantProps<typeof fieldVariants>): React.JSX.Element;
13
+ declare function FieldContent({ className, ...props }: React.ComponentProps<'div'>): React.JSX.Element;
14
+ declare function FieldLabel({ className, required, children, ...props }: React.ComponentProps<typeof Label> & {
15
+ required?: boolean;
16
+ }): React.JSX.Element;
17
+ declare function FieldTitle({ className, ...props }: React.ComponentProps<'div'>): React.JSX.Element;
18
+ declare function FieldDescription({ className, ...props }: React.ComponentProps<'p'>): React.JSX.Element;
19
+ declare function FieldSeparator({ children, className, ...props }: React.ComponentProps<'div'>): React.JSX.Element;
20
+ declare function FieldError({ className, children, errors, ...props }: React.ComponentProps<'div'> & {
21
+ errors?: Array<{
22
+ message?: string;
23
+ } | undefined>;
24
+ }): React.JSX.Element | null;
25
+ export { Field, FieldContent, FieldDescription, FieldError, FieldGroup, FieldLabel, FieldLegend, FieldSeparator, FieldSet, FieldTitle };
@@ -0,0 +1,121 @@
1
+ "use client";
2
+ import { cn } from "../lib/cn.js";
3
+ import { Label } from "./label.js";
4
+ import { Separator } from "./separator.js";
5
+ import * as React from "react";
6
+ import { cva } from "class-variance-authority";
7
+ import { jsx, jsxs } from "react/jsx-runtime";
8
+ // src/components/field.tsx
9
+ function FieldSet({ className, ...props }) {
10
+ return /* @__PURE__ */ jsx("fieldset", {
11
+ "data-slot": "field-set",
12
+ className: cn("flex flex-col gap-4 has-[>[data-slot=checkbox-group]]:gap-3 has-[>[data-slot=radio-group]]:gap-3", className),
13
+ ...props
14
+ });
15
+ }
16
+ function FieldLegend({ className, variant = "legend", ...props }) {
17
+ return /* @__PURE__ */ jsx("legend", {
18
+ "data-slot": "field-legend",
19
+ "data-variant": variant,
20
+ className: cn("mb-3 font-medium data-[variant=label]:text-sm data-[variant=legend]:text-base", className),
21
+ ...props
22
+ });
23
+ }
24
+ function FieldGroup({ className, ...props }) {
25
+ return /* @__PURE__ */ jsx("div", {
26
+ "data-slot": "field-group",
27
+ className: cn("group/field-group @container/field-group flex w-full flex-col gap-6 data-[slot=checkbox-group]:gap-3 [&>[data-slot=field-group]]:gap-4", className),
28
+ ...props
29
+ });
30
+ }
31
+ const fieldVariants = cva("group/field data-[invalid=true]:text-destructive flex w-full gap-3", {
32
+ variants: { orientation: {
33
+ vertical: "flex-col [&>*]:w-full [&>.sr-only]:w-auto",
34
+ horizontal: [
35
+ "flex-row items-center",
36
+ "[&>[data-slot=field-label]]:flex-auto",
37
+ "has-[>[data-slot=field-content]]:items-start has-[>[data-slot=field-content]]:[&>[role=checkbox],[role=radio],[data-slot=switch]]:mt-px"
38
+ ],
39
+ responsive: ["flex-col @md/field-group:flex-row @md/field-group:items-center [&>*]:w-full @md/field-group:[&>*]:w-auto [&>.sr-only]:w-auto", "@md/field-group:[&>[data-slot=field-label]]:flex-auto"]
40
+ } },
41
+ defaultVariants: { orientation: "vertical" }
42
+ });
43
+ function Field({ className, orientation = "vertical", ...props }) {
44
+ return /* @__PURE__ */ jsx("div", {
45
+ role: "group",
46
+ "data-slot": "field",
47
+ "data-orientation": orientation,
48
+ className: cn(fieldVariants({ orientation }), className),
49
+ ...props
50
+ });
51
+ }
52
+ function FieldContent({ className, ...props }) {
53
+ return /* @__PURE__ */ jsx("div", {
54
+ "data-slot": "field-content",
55
+ className: cn("group/field-content flex flex-1 flex-col gap-1.5 leading-snug", className),
56
+ ...props
57
+ });
58
+ }
59
+ function FieldLabel({ className, required, children, ...props }) {
60
+ return /* @__PURE__ */ jsx(Label, {
61
+ "data-slot": "field-label",
62
+ className: cn("group/field-label peer/field-label flex w-fit gap-2 leading-snug group-data-[disabled=true]/field:opacity-50 has-[>[data-slot=field]]:w-full has-[>[data-slot=field]]:flex-col has-[>[data-slot=field]]:rounded-md", className),
63
+ ...props,
64
+ children: required ? /* @__PURE__ */ jsxs("span", {
65
+ className: "inline-flex items-center gap-1.5",
66
+ children: [children, /* @__PURE__ */ jsx("span", {
67
+ "aria-hidden": true,
68
+ className: "text-destructive",
69
+ children: "*"
70
+ })]
71
+ }) : children
72
+ });
73
+ }
74
+ function FieldTitle({ className, ...props }) {
75
+ return /* @__PURE__ */ jsx("div", {
76
+ "data-slot": "field-label",
77
+ className: cn("flex w-fit items-center gap-2 text-sm leading-snug font-medium group-data-[disabled=true]/field:opacity-50", className),
78
+ ...props
79
+ });
80
+ }
81
+ function FieldDescription({ className, ...props }) {
82
+ return /* @__PURE__ */ jsx("p", {
83
+ "data-slot": "field-description",
84
+ className: cn("text-muted-foreground text-xs leading-normal font-normal group-has-[[data-orientation=horizontal]]/field:text-balance", className),
85
+ ...props
86
+ });
87
+ }
88
+ function FieldSeparator({ children, className, ...props }) {
89
+ return /* @__PURE__ */ jsxs("div", {
90
+ "data-slot": "field-separator",
91
+ "data-content": !!children,
92
+ className: cn("relative -my-2 h-5 text-sm group-data-[variant=outline]/field-group:-mb-2", className),
93
+ ...props,
94
+ children: [/* @__PURE__ */ jsx(Separator, { className: "absolute inset-0 top-1/2" }), children ? /* @__PURE__ */ jsx("span", {
95
+ className: "bg-background text-muted-foreground relative mx-auto block w-fit px-2",
96
+ "data-slot": "field-separator-content",
97
+ children
98
+ }) : null]
99
+ });
100
+ }
101
+ function FieldError({ className, children, errors, ...props }) {
102
+ const content = React.useMemo(() => {
103
+ if (children) return children;
104
+ if (!errors) return null;
105
+ const list = errors.filter((e) => e !== void 0);
106
+ if (list.length === 1 && list[0]?.message) return list[0].message;
107
+ return /* @__PURE__ */ jsx("ul", {
108
+ className: "ml-4 flex list-disc flex-col gap-1",
109
+ children: list.map((e, i) => e?.message ? /* @__PURE__ */ jsx("li", { children: e.message }, i) : null)
110
+ });
111
+ }, [children, errors]);
112
+ if (!content) return null;
113
+ return /* @__PURE__ */ jsx("div", {
114
+ role: "alert",
115
+ "data-slot": "field-error",
116
+ className: cn("text-destructive text-sm font-normal", className),
117
+ ...props,
118
+ children: content
119
+ });
120
+ }
121
+ export { Field, FieldContent, FieldDescription, FieldError, FieldGroup, FieldLabel, FieldLegend, FieldSeparator, FieldSet, FieldTitle };
@@ -0,0 +1,6 @@
1
+ import * as React from "react";
2
+ declare function HighlightedTextarea({ value, tokens, className, onScroll, ...props }: Omit<React.ComponentProps<'textarea'>, 'value'> & {
3
+ value: string;
4
+ tokens: readonly string[];
5
+ }): React.JSX.Element;
6
+ export { HighlightedTextarea };
@@ -0,0 +1,68 @@
1
+ "use client";
2
+ import { cn } from "../lib/cn.js";
3
+ import * as React from "react";
4
+ import { jsx, jsxs } from "react/jsx-runtime";
5
+ // src/components/highlighted-textarea.tsx
6
+ function escapeRegExp(value) {
7
+ return value.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
8
+ }
9
+ function segment(text, tokens) {
10
+ const active = tokens.filter((t) => t.length > 0);
11
+ if (active.length === 0) return [{
12
+ text,
13
+ match: false
14
+ }];
15
+ const pattern = [...active].sort((a, b) => b.length - a.length).map(escapeRegExp).join("|");
16
+ const re = new RegExp(pattern, "g");
17
+ const out = [];
18
+ let last = 0;
19
+ for (let m = re.exec(text); m !== null; m = re.exec(text)) {
20
+ if (m.index > last) out.push({
21
+ text: text.slice(last, m.index),
22
+ match: false
23
+ });
24
+ out.push({
25
+ text: m[0],
26
+ match: true
27
+ });
28
+ last = m.index + m[0].length;
29
+ }
30
+ if (last < text.length) out.push({
31
+ text: text.slice(last),
32
+ match: false
33
+ });
34
+ return out;
35
+ }
36
+ function syncScrollToBackdrop(textarea) {
37
+ const backdrop = textarea.previousElementSibling;
38
+ if (!(backdrop instanceof HTMLElement)) return;
39
+ backdrop.scrollTop = textarea.scrollTop;
40
+ backdrop.scrollLeft = textarea.scrollLeft;
41
+ }
42
+ const SHARED_BOX = "w-full rounded-lg border px-2.5 py-2 text-base whitespace-pre-wrap break-words md:text-sm";
43
+ function HighlightedTextarea({ value, tokens, className, onScroll, ...props }) {
44
+ function handleScroll(event) {
45
+ syncScrollToBackdrop(event.currentTarget);
46
+ onScroll?.(event);
47
+ }
48
+ const segments = segment(value, tokens);
49
+ return /* @__PURE__ */ jsxs("div", {
50
+ "data-slot": "highlighted-textarea",
51
+ className: "relative",
52
+ children: [/* @__PURE__ */ jsxs("div", {
53
+ "aria-hidden": "true",
54
+ className: cn(SHARED_BOX, "text-foreground border-transparent", "pointer-events-none absolute inset-0 overflow-auto select-none", className),
55
+ children: [segments.map((seg, i) => seg.match ? /* @__PURE__ */ jsx("mark", {
56
+ className: "bg-primary/15 text-primary rounded-[3px] px-0.5 font-medium",
57
+ children: seg.text
58
+ }, i) : /* @__PURE__ */ jsx(React.Fragment, { children: seg.text }, i)), "\n"]
59
+ }), /* @__PURE__ */ jsx("textarea", {
60
+ "data-slot": "highlighted-textarea-input",
61
+ value,
62
+ onScroll: handleScroll,
63
+ className: cn(SHARED_BOX, "border-input focus-visible:border-ring focus-visible:ring-ring/50 caret-foreground relative bg-transparent text-transparent transition-colors outline-none focus-visible:ring-3", "disabled:cursor-not-allowed disabled:opacity-50", "placeholder:text-muted-foreground field-sizing-content min-h-16 resize-y", className),
64
+ ...props
65
+ })]
66
+ });
67
+ }
68
+ export { HighlightedTextarea, syncScrollToBackdrop };
@@ -0,0 +1,8 @@
1
+ import { Input } from "./input.js";
2
+ import * as React from "react";
3
+ declare function InputGroup({ className, ...props }: React.ComponentProps<'div'>): React.JSX.Element;
4
+ declare function InputGroupInput({ className, ...props }: React.ComponentProps<typeof Input>): React.JSX.Element;
5
+ declare function InputGroupAddon({ className, align, ...props }: React.ComponentProps<'div'> & {
6
+ align?: 'inline-start' | 'inline-end';
7
+ }): React.JSX.Element;
8
+ export { InputGroup, InputGroupAddon, InputGroupInput };
@@ -0,0 +1,28 @@
1
+ import { cn } from "../lib/cn.js";
2
+ import { Input } from "./input.js";
3
+ import "react";
4
+ import { jsx } from "react/jsx-runtime";
5
+ // src/components/input-group.tsx
6
+ function InputGroup({ className, ...props }) {
7
+ return /* @__PURE__ */ jsx("div", {
8
+ "data-slot": "input-group",
9
+ role: "group",
10
+ className: cn("group/input-group border-input relative flex w-full items-center gap-1.5 rounded-lg border bg-transparent px-2.5 transition-[color,box-shadow] outline-none", "has-[input:focus-visible]:border-ring has-[input:focus-visible]:ring-ring/50 has-[input:focus-visible]:ring-3", "has-[[aria-invalid=true]]:border-destructive has-[[aria-invalid=true]]:ring-destructive/20 has-[[aria-invalid=true]]:ring-3", "dark:bg-input/30", className),
11
+ ...props
12
+ });
13
+ }
14
+ function InputGroupInput({ className, ...props }) {
15
+ return /* @__PURE__ */ jsx(Input, {
16
+ "data-slot": "input-group-control",
17
+ className: cn("h-8 flex-1 rounded-none border-0 bg-transparent px-0 shadow-none focus-visible:border-0 focus-visible:ring-0 disabled:bg-transparent dark:bg-transparent dark:disabled:bg-transparent", className),
18
+ ...props
19
+ });
20
+ }
21
+ function InputGroupAddon({ className, align = "inline-end", ...props }) {
22
+ return /* @__PURE__ */ jsx("div", {
23
+ "data-slot": "input-group-addon",
24
+ className: cn("text-muted-foreground flex shrink-0 items-center [&_svg]:size-4 [&_svg]:shrink-0", align === "inline-start" ? "order-first" : "order-last", className),
25
+ ...props
26
+ });
27
+ }
28
+ export { InputGroup, InputGroupAddon, InputGroupInput };
@@ -0,0 +1,3 @@
1
+ import * as React from "react";
2
+ declare function Input({ className, type, ...props }: React.ComponentProps<'input'>): React.JSX.Element;
3
+ export { Input };
@@ -0,0 +1,13 @@
1
+ import { cn } from "../lib/cn.js";
2
+ import "react";
3
+ import { jsx } from "react/jsx-runtime";
4
+ // src/components/input.tsx
5
+ function Input({ className, type, ...props }) {
6
+ return /* @__PURE__ */ jsx("input", {
7
+ type,
8
+ "data-slot": "input",
9
+ className: cn("border-input file:text-foreground placeholder:text-muted-foreground focus-visible:border-ring focus-visible:ring-ring/50 disabled:bg-input/50 aria-invalid:border-destructive aria-invalid:ring-destructive/20 dark:bg-input/30 dark:disabled:bg-input/80 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40 h-8 w-full min-w-0 rounded-lg border bg-transparent px-2.5 py-1 text-base transition-colors outline-none file:inline-flex file:h-6 file:border-0 file:bg-transparent file:text-sm file:font-medium focus-visible:ring-3 disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50 aria-invalid:ring-3 md:text-sm", className),
10
+ ...props
11
+ });
12
+ }
13
+ export { Input };
@@ -0,0 +1,4 @@
1
+ import * as React from "react";
2
+ import { Label as Label$1 } from "radix-ui";
3
+ declare function Label({ className, ...props }: React.ComponentProps<typeof Label$1.Root>): React.JSX.Element;
4
+ export { Label };
@@ -0,0 +1,14 @@
1
+ "use client";
2
+ import { cn } from "../lib/cn.js";
3
+ import "react";
4
+ import { Label as Label$1 } from "radix-ui";
5
+ import { jsx } from "react/jsx-runtime";
6
+ // src/components/label.tsx
7
+ function Label({ className, ...props }) {
8
+ return /* @__PURE__ */ jsx(Label$1.Root, {
9
+ "data-slot": "label",
10
+ className: cn("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", className),
11
+ ...props
12
+ });
13
+ }
14
+ export { Label };