@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,47 @@
1
+ import { cn } from "../lib/cn.js";
2
+ import "react";
3
+ import { cva } from "class-variance-authority";
4
+ import { Slot } from "radix-ui";
5
+ import { jsx } from "react/jsx-runtime";
6
+ // src/components/button.tsx
7
+ const buttonVariants = cva("group/button focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:border-destructive aria-invalid:ring-destructive/20 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40 inline-flex shrink-0 items-center justify-center rounded-lg border border-transparent bg-clip-padding text-sm font-medium whitespace-nowrap transition-all outline-none select-none focus-visible:ring-3 active:not-aria-[haspopup]:translate-y-px disabled:pointer-events-none disabled:opacity-50 aria-invalid:ring-3 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4", {
8
+ variants: {
9
+ variant: {
10
+ default: "bg-primary text-primary-foreground [a]:hover:bg-primary/80",
11
+ outline: "border-border bg-background hover:bg-muted hover:text-foreground aria-expanded:bg-muted aria-expanded:text-foreground dark:border-input dark:bg-input/30 dark:hover:bg-input/50",
12
+ secondary: "bg-secondary text-secondary-foreground hover:bg-secondary/80 aria-expanded:bg-secondary aria-expanded:text-secondary-foreground",
13
+ ghost: "hover:bg-muted hover:text-foreground aria-expanded:bg-muted aria-expanded:text-foreground dark:hover:bg-muted/50",
14
+ destructive: "bg-destructive/10 text-destructive hover:bg-destructive/20 focus-visible:border-destructive/40 focus-visible:ring-destructive/20 dark:bg-destructive/20 dark:hover:bg-destructive/30 dark:focus-visible:ring-destructive/40",
15
+ link: "text-primary underline-offset-4 hover:underline"
16
+ },
17
+ size: {
18
+ default: "h-8 gap-1.5 px-2.5 has-data-[icon=inline-end]:pr-2 has-data-[icon=inline-start]:pl-2",
19
+ xs: "h-6 gap-1 rounded-[min(var(--radius-md),10px)] px-2 text-xs in-data-[slot=button-group]:rounded-lg has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5 [&_svg:not([class*='size-'])]:size-3",
20
+ sm: "h-7 gap-1 rounded-[min(var(--radius-md),12px)] px-2.5 text-[0.8rem] in-data-[slot=button-group]:rounded-lg has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5 [&_svg:not([class*='size-'])]:size-3.5",
21
+ lg: "h-9 gap-1.5 px-2.5 has-data-[icon=inline-end]:pr-2 has-data-[icon=inline-start]:pl-2",
22
+ icon: "size-8",
23
+ "icon-xs": "size-6 rounded-[min(var(--radius-md),10px)] in-data-[slot=button-group]:rounded-lg [&_svg:not([class*='size-'])]:size-3",
24
+ "icon-sm": "size-7 rounded-[min(var(--radius-md),12px)] in-data-[slot=button-group]:rounded-lg",
25
+ "icon-lg": "size-9"
26
+ }
27
+ },
28
+ defaultVariants: {
29
+ variant: "default",
30
+ size: "default"
31
+ }
32
+ });
33
+ function Button({ className, variant = "default", size = "default", asChild = false, ...props }) {
34
+ const Comp = asChild ? Slot.Root : "button";
35
+ return /* @__PURE__ */ jsx(Comp, {
36
+ "data-slot": "button",
37
+ "data-variant": variant,
38
+ "data-size": size,
39
+ className: cn(buttonVariants({
40
+ variant,
41
+ size,
42
+ className
43
+ })),
44
+ ...props
45
+ });
46
+ }
47
+ export { Button, buttonVariants };
@@ -0,0 +1,7 @@
1
+ import { Button } from "./button.js";
2
+ import * as React from "react";
3
+ import { DayPicker } from "react-day-picker";
4
+ declare function Calendar({ className, classNames, showOutsideDays, captionLayout, buttonVariant, formatters, components, ...props }: React.ComponentProps<typeof DayPicker> & {
5
+ buttonVariant?: React.ComponentProps<typeof Button>['variant'];
6
+ }): React.JSX.Element;
7
+ export { Calendar };
@@ -0,0 +1,142 @@
1
+ "use client";
2
+ import { cn } from "../lib/cn.js";
3
+ import { Button, buttonVariants } from "./button.js";
4
+ import { Select, SelectContent, SelectItem, SelectTrigger } from "./select.js";
5
+ import * as React from "react";
6
+ import { Fragment, jsx, jsxs } from "react/jsx-runtime";
7
+ import { ChevronLeftIcon, ChevronRightIcon } from "lucide-react";
8
+ import { DayPicker, getDefaultClassNames } from "react-day-picker";
9
+ import { ptBR } from "react-day-picker/locale";
10
+ // src/components/calendar.tsx
11
+ function Calendar({ className, classNames, showOutsideDays = true, captionLayout = "label", buttonVariant = "ghost", formatters, components, ...props }) {
12
+ const defaultClassNames = getDefaultClassNames();
13
+ return /* @__PURE__ */ jsx(DayPicker, {
14
+ locale: ptBR,
15
+ showOutsideDays,
16
+ className: cn("group/calendar bg-background p-3 [--cell-size:--spacing(8)] [[data-slot=card-content]_&]:bg-transparent [[data-slot=popover-content]_&]:bg-transparent", String.raw`rtl:**:[.rdp-button\_next>svg]:rotate-180`, String.raw`rtl:**:[.rdp-button\_previous>svg]:rotate-180`, className),
17
+ captionLayout,
18
+ formatters: {
19
+ formatMonthDropdown: (date) => date.toLocaleString("pt-BR", { month: "short" }),
20
+ ...formatters
21
+ },
22
+ classNames: {
23
+ root: cn("w-fit", defaultClassNames.root),
24
+ months: cn("relative flex flex-col gap-4 md:flex-row", defaultClassNames.months),
25
+ month: cn("flex w-full flex-col gap-4", defaultClassNames.month),
26
+ nav: cn("absolute inset-x-0 top-0 flex w-full items-center justify-between gap-1", defaultClassNames.nav),
27
+ button_previous: cn(buttonVariants({ variant: buttonVariant }), "size-(--cell-size) p-0 select-none aria-disabled:opacity-50", defaultClassNames.button_previous),
28
+ button_next: cn(buttonVariants({ variant: buttonVariant }), "size-(--cell-size) p-0 select-none aria-disabled:opacity-50", defaultClassNames.button_next),
29
+ month_caption: cn("flex h-(--cell-size) w-full items-center justify-center px-(--cell-size)", defaultClassNames.month_caption),
30
+ dropdowns: cn("flex h-(--cell-size) w-full items-center justify-center gap-1.5 text-sm font-medium", defaultClassNames.dropdowns),
31
+ dropdown_root: cn("relative", defaultClassNames.dropdown_root),
32
+ dropdown: defaultClassNames.dropdown,
33
+ caption_label: cn("font-medium select-none", captionLayout === "label" ? "text-sm" : "[&>svg]:text-muted-foreground flex h-8 items-center gap-1 rounded-md pr-1 pl-2 text-sm [&>svg]:size-3.5", defaultClassNames.caption_label),
34
+ table: "w-full border-collapse",
35
+ weekdays: cn("flex", defaultClassNames.weekdays),
36
+ weekday: cn("text-muted-foreground flex-1 rounded-md text-[0.8rem] font-normal select-none", defaultClassNames.weekday),
37
+ week: cn("mt-2 flex w-full", defaultClassNames.week),
38
+ week_number_header: cn("w-(--cell-size) select-none", defaultClassNames.week_number_header),
39
+ week_number: cn("text-muted-foreground text-[0.8rem] select-none", defaultClassNames.week_number),
40
+ day: cn("group/day relative aspect-square h-full w-full p-0 text-center select-none [&:first-child[data-selected=true]_button]:rounded-l-md [&:last-child[data-selected=true]_button]:rounded-r-md", defaultClassNames.day),
41
+ range_start: cn("bg-accent rounded-l-md", defaultClassNames.range_start),
42
+ range_middle: cn("rounded-none", defaultClassNames.range_middle),
43
+ range_end: cn("bg-accent rounded-r-md", defaultClassNames.range_end),
44
+ today: cn("bg-accent text-accent-foreground rounded-md data-[selected=true]:rounded-none", defaultClassNames.today),
45
+ outside: cn("text-muted-foreground aria-selected:text-muted-foreground", defaultClassNames.outside),
46
+ disabled: cn("text-muted-foreground opacity-50", defaultClassNames.disabled),
47
+ hidden: cn("invisible", defaultClassNames.hidden),
48
+ ...classNames
49
+ },
50
+ components: {
51
+ Root: ({ className: rootClassName, rootRef, ...rootProps }) => /* @__PURE__ */ jsx("div", {
52
+ "data-slot": "calendar",
53
+ ref: rootRef,
54
+ className: cn(rootClassName),
55
+ ...rootProps
56
+ }),
57
+ Chevron: ({ className: chevronClassName, orientation, ...chevronProps }) => orientation === "left" ? /* @__PURE__ */ jsx(ChevronLeftIcon, {
58
+ className: cn("size-4", chevronClassName),
59
+ ...chevronProps
60
+ }) : /* @__PURE__ */ jsx(ChevronRightIcon, {
61
+ className: cn("size-4", chevronClassName),
62
+ ...chevronProps
63
+ }),
64
+ Dropdown: CalendarDropdown,
65
+ DayButton: CalendarDayButton,
66
+ WeekNumber: ({ children, ...weekNumberProps }) => /* @__PURE__ */ jsx("td", {
67
+ ...weekNumberProps,
68
+ children: /* @__PURE__ */ jsx("div", {
69
+ className: "flex size-(--cell-size) items-center justify-center text-center",
70
+ children
71
+ })
72
+ }),
73
+ ...components
74
+ },
75
+ ...props
76
+ });
77
+ }
78
+ function CalendarDayButton({ className, day, modifiers, ...props }) {
79
+ const defaultClassNames = getDefaultClassNames();
80
+ const ref = React.useRef(null);
81
+ React.useEffect(() => {
82
+ if (modifiers.focused) ref.current?.focus();
83
+ }, [modifiers.focused]);
84
+ return /* @__PURE__ */ jsx(Button, {
85
+ ref,
86
+ variant: "ghost",
87
+ size: "icon",
88
+ "data-day": day.date.toLocaleDateString(),
89
+ "data-selected-single": modifiers.selected && !modifiers.range_start && !modifiers.range_end && !modifiers.range_middle,
90
+ "data-range-start": modifiers.range_start,
91
+ "data-range-end": modifiers.range_end,
92
+ "data-range-middle": modifiers.range_middle,
93
+ className: cn("data-[selected-single=true]:bg-primary data-[selected-single=true]:text-primary-foreground data-[range-middle=true]:bg-accent data-[range-middle=true]:text-accent-foreground data-[range-start=true]:bg-primary data-[range-start=true]:text-primary-foreground data-[range-end=true]:bg-primary data-[range-end=true]:text-primary-foreground group-data-[focused=true]/day:border-ring group-data-[focused=true]/day:ring-ring/50 flex aspect-square size-auto w-full min-w-(--cell-size) flex-col gap-1 leading-none font-normal group-data-[focused=true]/day:relative group-data-[focused=true]/day:z-10 group-data-[focused=true]/day:ring-[3px] data-[range-end=true]:rounded-md data-[range-end=true]:rounded-r-md data-[range-middle=true]:rounded-none data-[range-start=true]:rounded-md data-[range-start=true]:rounded-l-md [&>span]:text-xs [&>span]:opacity-70", defaultClassNames.day, className),
94
+ ...props
95
+ });
96
+ }
97
+ function CalendarDropdown({ options = [], value, onChange, disabled, ...props }) {
98
+ const nativeRef = React.useRef(null);
99
+ const selectedValue = value != null ? String(value) : void 0;
100
+ const current = options.find((option) => String(option.value) === selectedValue);
101
+ const ariaLabel = props["aria-label"];
102
+ function handleValueChange(next) {
103
+ const node = nativeRef.current;
104
+ const descriptor = Object.getOwnPropertyDescriptor(HTMLSelectElement.prototype, "value");
105
+ if (node && descriptor?.set) {
106
+ descriptor.set.call(node, next);
107
+ node.dispatchEvent(new Event("change", { bubbles: true }));
108
+ }
109
+ }
110
+ return /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx("select", {
111
+ ref: nativeRef,
112
+ value: selectedValue,
113
+ onChange,
114
+ disabled,
115
+ tabIndex: -1,
116
+ "aria-hidden": true,
117
+ className: "sr-only",
118
+ children: options.map((option) => /* @__PURE__ */ jsx("option", {
119
+ value: option.value,
120
+ disabled: option.disabled,
121
+ children: option.label
122
+ }, option.value))
123
+ }), /* @__PURE__ */ jsxs(Select, {
124
+ value: selectedValue,
125
+ onValueChange: handleValueChange,
126
+ disabled,
127
+ children: [/* @__PURE__ */ jsx(SelectTrigger, {
128
+ size: "sm",
129
+ "aria-label": ariaLabel,
130
+ className: "w-auto gap-1",
131
+ children: current?.label
132
+ }), /* @__PURE__ */ jsx(SelectContent, {
133
+ className: "max-h-72",
134
+ children: options.map((option) => /* @__PURE__ */ jsx(SelectItem, {
135
+ value: String(option.value),
136
+ disabled: option.disabled,
137
+ children: option.label
138
+ }, option.value))
139
+ })]
140
+ })] });
141
+ }
142
+ export { Calendar, CalendarDayButton, CalendarDropdown };
@@ -0,0 +1,13 @@
1
+ import * as React from "react";
2
+ declare function Card({ className, size, ...props }: React.ComponentProps<'div'> & {
3
+ size?: 'default' | 'sm';
4
+ }): React.JSX.Element;
5
+ declare function CardHeader({ className, ...props }: React.ComponentProps<'div'>): React.JSX.Element;
6
+ declare function CardTitle({ className, asChild, ...props }: React.ComponentProps<'div'> & {
7
+ asChild?: boolean;
8
+ }): React.JSX.Element;
9
+ declare function CardDescription({ className, ...props }: React.ComponentProps<'div'>): React.JSX.Element;
10
+ declare function CardAction({ className, ...props }: React.ComponentProps<'div'>): React.JSX.Element;
11
+ declare function CardContent({ className, ...props }: React.ComponentProps<'div'>): React.JSX.Element;
12
+ declare function CardFooter({ className, ...props }: React.ComponentProps<'div'>): React.JSX.Element;
13
+ export { Card, CardAction, CardContent, CardDescription, CardFooter, CardHeader, CardTitle };
@@ -0,0 +1,57 @@
1
+ import { cn } from "../lib/cn.js";
2
+ import "react";
3
+ import { Slot } from "radix-ui";
4
+ import { jsx } from "react/jsx-runtime";
5
+ // src/components/card.tsx
6
+ function Card({ className, size = "default", ...props }) {
7
+ return /* @__PURE__ */ jsx("div", {
8
+ "data-slot": "card",
9
+ "data-size": size,
10
+ className: cn("group/card bg-card text-card-foreground ring-foreground/10 flex flex-col gap-4 overflow-hidden rounded-xl py-4 text-sm ring-1 has-data-[slot=card-footer]:pb-0 has-[>img:first-child]:pt-0 data-[size=sm]:gap-3 data-[size=sm]:py-3 data-[size=sm]:has-data-[slot=card-footer]:pb-0 *:[img:first-child]:rounded-t-xl *:[img:last-child]:rounded-b-xl", className),
11
+ ...props
12
+ });
13
+ }
14
+ function CardHeader({ className, ...props }) {
15
+ return /* @__PURE__ */ jsx("div", {
16
+ "data-slot": "card-header",
17
+ className: cn("group/card-header @container/card-header grid auto-rows-min items-start gap-1 rounded-t-xl px-4 group-data-[size=sm]/card:px-3 has-data-[slot=card-action]:grid-cols-[1fr_auto] has-data-[slot=card-description]:grid-rows-[auto_auto] [.border-b]:pb-4 group-data-[size=sm]/card:[.border-b]:pb-3", className),
18
+ ...props
19
+ });
20
+ }
21
+ function CardTitle({ className, asChild = false, ...props }) {
22
+ const Comp = asChild ? Slot.Root : "div";
23
+ return /* @__PURE__ */ jsx(Comp, {
24
+ "data-slot": "card-title",
25
+ className: cn("font-heading text-base leading-snug font-medium group-data-[size=sm]/card:text-sm", className),
26
+ ...props
27
+ });
28
+ }
29
+ function CardDescription({ className, ...props }) {
30
+ return /* @__PURE__ */ jsx("div", {
31
+ "data-slot": "card-description",
32
+ className: cn("text-muted-foreground text-sm", className),
33
+ ...props
34
+ });
35
+ }
36
+ function CardAction({ className, ...props }) {
37
+ return /* @__PURE__ */ jsx("div", {
38
+ "data-slot": "card-action",
39
+ className: cn("col-start-2 row-span-2 row-start-1 self-start justify-self-end", className),
40
+ ...props
41
+ });
42
+ }
43
+ function CardContent({ className, ...props }) {
44
+ return /* @__PURE__ */ jsx("div", {
45
+ "data-slot": "card-content",
46
+ className: cn("px-4 group-data-[size=sm]/card:px-3", className),
47
+ ...props
48
+ });
49
+ }
50
+ function CardFooter({ className, ...props }) {
51
+ return /* @__PURE__ */ jsx("div", {
52
+ "data-slot": "card-footer",
53
+ className: cn("bg-muted/50 flex items-center rounded-b-xl border-t p-4 group-data-[size=sm]/card:p-3", className),
54
+ ...props
55
+ });
56
+ }
57
+ export { Card, CardAction, CardContent, CardDescription, CardFooter, CardHeader, CardTitle };
@@ -0,0 +1,4 @@
1
+ import * as React from "react";
2
+ import { Checkbox as Checkbox$1 } from "radix-ui";
3
+ declare function Checkbox({ className, ...props }: React.ComponentProps<typeof Checkbox$1.Root>): React.JSX.Element;
4
+ export { Checkbox };
@@ -0,0 +1,20 @@
1
+ "use client";
2
+ import { cn } from "../lib/cn.js";
3
+ import "react";
4
+ import { Checkbox as Checkbox$1 } from "radix-ui";
5
+ import { jsx } from "react/jsx-runtime";
6
+ import { CheckIcon } from "lucide-react";
7
+ // src/components/checkbox.tsx
8
+ function Checkbox({ className, ...props }) {
9
+ return /* @__PURE__ */ jsx(Checkbox$1.Root, {
10
+ "data-slot": "checkbox",
11
+ className: cn("peer border-input focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:border-destructive aria-invalid:ring-destructive/20 data-checked:border-primary data-checked:bg-primary data-checked:text-primary-foreground dark:bg-input/30 dark:data-checked:bg-primary size-4 shrink-0 rounded-[4px] border shadow-xs transition-shadow outline-none focus-visible:ring-3 disabled:cursor-not-allowed disabled:opacity-50 aria-invalid:ring-3", className),
12
+ ...props,
13
+ children: /* @__PURE__ */ jsx(Checkbox$1.Indicator, {
14
+ "data-slot": "checkbox-indicator",
15
+ className: "flex items-center justify-center text-current transition-none",
16
+ children: /* @__PURE__ */ jsx(CheckIcon, { className: "size-3.5" })
17
+ })
18
+ });
19
+ }
20
+ export { Checkbox };
@@ -0,0 +1,5 @@
1
+ import { Collapsible as Collapsible$1 } from "radix-ui";
2
+ declare function Collapsible({ ...props }: React.ComponentProps<typeof Collapsible$1.Root>): import("react").JSX.Element;
3
+ declare function CollapsibleTrigger({ ...props }: React.ComponentProps<typeof Collapsible$1.CollapsibleTrigger>): import("react").JSX.Element;
4
+ declare function CollapsibleContent({ ...props }: React.ComponentProps<typeof Collapsible$1.CollapsibleContent>): import("react").JSX.Element;
5
+ export { Collapsible, CollapsibleContent, CollapsibleTrigger };
@@ -0,0 +1,23 @@
1
+ "use client";
2
+ import { Collapsible as Collapsible$1 } from "radix-ui";
3
+ import { jsx } from "react/jsx-runtime";
4
+ // src/components/collapsible.tsx
5
+ function Collapsible({ ...props }) {
6
+ return /* @__PURE__ */ jsx(Collapsible$1.Root, {
7
+ "data-slot": "collapsible",
8
+ ...props
9
+ });
10
+ }
11
+ function CollapsibleTrigger({ ...props }) {
12
+ return /* @__PURE__ */ jsx(Collapsible$1.CollapsibleTrigger, {
13
+ "data-slot": "collapsible-trigger",
14
+ ...props
15
+ });
16
+ }
17
+ function CollapsibleContent({ ...props }) {
18
+ return /* @__PURE__ */ jsx(Collapsible$1.CollapsibleContent, {
19
+ "data-slot": "collapsible-content",
20
+ ...props
21
+ });
22
+ }
23
+ export { Collapsible, CollapsibleContent, CollapsibleTrigger };
@@ -0,0 +1,31 @@
1
+ import { Calendar } from "./calendar.js";
2
+ import * as React from "react";
3
+ export type DateFieldProps = {
4
+ /** Submitted form field name — a hidden input carries the ISO value. */
5
+ name?: string;
6
+ /** Controlled ISO value (`yyyy-mm-dd`). */
7
+ value?: string;
8
+ /** Uncontrolled initial ISO value (`yyyy-mm-dd`). */
9
+ defaultValue?: string;
10
+ /** Called with the ISO value (`''` while incomplete/invalid). */
11
+ onValueChange?: (iso: string) => void;
12
+ /** Show the calendar popover affordance. Defaults to `true`. Ignored (always
13
+ * on) when `presentation="button"`. */
14
+ calendar?: boolean;
15
+ /** `input` = masked text field; `button` = icon/label trigger only. */
16
+ presentation?: 'input' | 'button';
17
+ /** Calendar caption: `label` (arrows, default) or a `dropdown*` variant with
18
+ * month/year selects — ideal for far-past dates like birthdays. The year range
19
+ * derives from `min`/`max` (falling back to the last 100 years). */
20
+ captionLayout?: React.ComponentProps<typeof Calendar>['captionLayout'];
21
+ placeholder?: string;
22
+ disabled?: boolean;
23
+ required?: boolean;
24
+ id?: string;
25
+ /** ISO lower/upper bounds for the calendar. */
26
+ min?: string;
27
+ max?: string;
28
+ className?: string;
29
+ 'aria-label'?: string;
30
+ };
31
+ export declare function DateField({ name, value, defaultValue, onValueChange, calendar, presentation, captionLayout, placeholder, disabled, required, id, min, max, className, 'aria-label': ariaLabel }: DateFieldProps): React.JSX.Element;
@@ -0,0 +1,129 @@
1
+ "use client";
2
+ import { cn } from "../lib/cn.js";
3
+ import { brDateToIso, dateToIso, isoToBrDate, isoToDate, maskBrDate } from "../lib/date.js";
4
+ import { Button } from "./button.js";
5
+ import { Calendar } from "./calendar.js";
6
+ import { Input } from "./input.js";
7
+ import { Popover, PopoverContent, PopoverTrigger } from "./popover.js";
8
+ import * as React from "react";
9
+ import { Fragment, jsx, jsxs } from "react/jsx-runtime";
10
+ import { CalendarDays } from "lucide-react";
11
+ // src/components/date-field.tsx
12
+ function DateField({ name, value, defaultValue, onValueChange, calendar = true, presentation = "input", captionLayout, placeholder = "dd/mm/aaaa", disabled, required, id, min, max, className, "aria-label": ariaLabel }) {
13
+ const isControlled = value !== void 0;
14
+ const [text, setText] = React.useState(() => isoToBrDate(value ?? defaultValue ?? ""));
15
+ const [focused, setFocused] = React.useState(false);
16
+ const [open, setOpen] = React.useState(false);
17
+ React.useEffect(() => {
18
+ if (isControlled && !focused) setText(isoToBrDate(value ?? ""));
19
+ }, [
20
+ value,
21
+ isControlled,
22
+ focused
23
+ ]);
24
+ const iso = brDateToIso(text);
25
+ function commit(nextText) {
26
+ setText(nextText);
27
+ onValueChange?.(brDateToIso(nextText));
28
+ }
29
+ function pick(nextIso) {
30
+ commit(isoToBrDate(nextIso));
31
+ setOpen(false);
32
+ }
33
+ const showCalendar = calendar || presentation === "button";
34
+ const calendarBody = /* @__PURE__ */ jsx(DateCalendar, {
35
+ iso,
36
+ min,
37
+ max,
38
+ captionLayout,
39
+ onPick: pick
40
+ });
41
+ return /* @__PURE__ */ jsxs("div", {
42
+ className: cn("relative", presentation === "input" && "w-full", className),
43
+ children: [name ? /* @__PURE__ */ jsx("input", {
44
+ type: "hidden",
45
+ name,
46
+ value: iso
47
+ }) : null, presentation === "button" ? /* @__PURE__ */ jsxs(Popover, {
48
+ open,
49
+ onOpenChange: setOpen,
50
+ children: [/* @__PURE__ */ jsx(PopoverTrigger, {
51
+ asChild: true,
52
+ children: /* @__PURE__ */ jsxs(Button, {
53
+ type: "button",
54
+ variant: "outline",
55
+ id,
56
+ disabled,
57
+ "aria-label": ariaLabel,
58
+ className: cn("justify-start gap-2 font-normal", !iso && "text-muted-foreground"),
59
+ children: [/* @__PURE__ */ jsx(CalendarDays, {
60
+ className: "size-4",
61
+ "aria-hidden": "true"
62
+ }), iso ? isoToBrDate(iso) : placeholder]
63
+ })
64
+ }), /* @__PURE__ */ jsx(PopoverContent, {
65
+ className: "w-auto p-0",
66
+ align: "start",
67
+ children: calendarBody
68
+ })]
69
+ }) : /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx(Input, {
70
+ id,
71
+ type: "text",
72
+ inputMode: "numeric",
73
+ autoComplete: "off",
74
+ placeholder,
75
+ value: text,
76
+ disabled,
77
+ required,
78
+ "aria-label": ariaLabel,
79
+ pattern: "\\d{2}/\\d{2}/\\d{4}",
80
+ className: cn(showCalendar && "pr-9"),
81
+ onFocus: () => setFocused(true),
82
+ onBlur: () => setFocused(false),
83
+ onChange: (e) => commit(maskBrDate(e.target.value))
84
+ }), showCalendar ? /* @__PURE__ */ jsxs(Popover, {
85
+ open,
86
+ onOpenChange: setOpen,
87
+ children: [/* @__PURE__ */ jsx(PopoverTrigger, {
88
+ asChild: true,
89
+ children: /* @__PURE__ */ jsx(Button, {
90
+ type: "button",
91
+ variant: "ghost",
92
+ size: "icon-sm",
93
+ disabled,
94
+ "aria-label": "Abrir calendário",
95
+ className: "text-muted-foreground absolute top-1/2 right-1 -translate-y-1/2",
96
+ children: /* @__PURE__ */ jsx(CalendarDays, {
97
+ className: "size-4",
98
+ "aria-hidden": "true"
99
+ })
100
+ })
101
+ }), /* @__PURE__ */ jsx(PopoverContent, {
102
+ className: "w-auto p-0",
103
+ align: "end",
104
+ children: calendarBody
105
+ })]
106
+ }) : null] })]
107
+ });
108
+ }
109
+ function DateCalendar({ iso, min, max, captionLayout, onPick }) {
110
+ const minDate = min ? isoToDate(min) : void 0;
111
+ const maxDate = max ? isoToDate(max) : void 0;
112
+ const disabled = [...minDate ? [{ before: minDate }] : [], ...maxDate ? [{ after: maxDate }] : []];
113
+ const isDropdown = captionLayout != null && captionLayout !== "label";
114
+ const endBound = maxDate ?? /* @__PURE__ */ new Date();
115
+ const startBound = minDate ?? new Date(endBound.getFullYear() - 100, 0, 1);
116
+ return /* @__PURE__ */ jsx(Calendar, {
117
+ mode: "single",
118
+ captionLayout,
119
+ startMonth: isDropdown ? startBound : void 0,
120
+ endMonth: isDropdown ? endBound : void 0,
121
+ selected: isoToDate(iso),
122
+ defaultMonth: isoToDate(iso),
123
+ disabled: disabled.length > 0 ? disabled : void 0,
124
+ onSelect: (date) => {
125
+ if (date) onPick(dateToIso(date));
126
+ }
127
+ });
128
+ }
129
+ export { DateField };
@@ -0,0 +1,17 @@
1
+ import * as React from "react";
2
+ import { Dialog as Dialog$1 } from "radix-ui";
3
+ declare function Dialog({ ...props }: React.ComponentProps<typeof Dialog$1.Root>): React.JSX.Element;
4
+ declare function DialogTrigger({ ...props }: React.ComponentProps<typeof Dialog$1.Trigger>): React.JSX.Element;
5
+ declare function DialogPortal({ ...props }: React.ComponentProps<typeof Dialog$1.Portal>): React.JSX.Element;
6
+ declare function DialogClose({ ...props }: React.ComponentProps<typeof Dialog$1.Close>): React.JSX.Element;
7
+ declare function DialogOverlay({ className, ...props }: React.ComponentProps<typeof Dialog$1.Overlay>): React.JSX.Element;
8
+ declare function DialogContent({ className, children, showCloseButton, ...props }: React.ComponentProps<typeof Dialog$1.Content> & {
9
+ showCloseButton?: boolean;
10
+ }): React.JSX.Element;
11
+ declare function DialogHeader({ className, ...props }: React.ComponentProps<'div'>): React.JSX.Element;
12
+ declare function DialogFooter({ className, showCloseButton, children, ...props }: React.ComponentProps<'div'> & {
13
+ showCloseButton?: boolean;
14
+ }): React.JSX.Element;
15
+ declare function DialogTitle({ className, ...props }: React.ComponentProps<typeof Dialog$1.Title>): React.JSX.Element;
16
+ declare function DialogDescription({ className, ...props }: React.ComponentProps<typeof Dialog$1.Description>): React.JSX.Element;
17
+ export { Dialog, DialogClose, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogOverlay, DialogPortal, DialogTitle, DialogTrigger };
@@ -0,0 +1,95 @@
1
+ "use client";
2
+ import { cn } from "../lib/cn.js";
3
+ import { Button } from "./button.js";
4
+ import "react";
5
+ import { Dialog as Dialog$1 } from "radix-ui";
6
+ import { jsx, jsxs } from "react/jsx-runtime";
7
+ import { XIcon } from "lucide-react";
8
+ // src/components/dialog.tsx
9
+ function Dialog({ ...props }) {
10
+ return /* @__PURE__ */ jsx(Dialog$1.Root, {
11
+ "data-slot": "dialog",
12
+ ...props
13
+ });
14
+ }
15
+ function DialogTrigger({ ...props }) {
16
+ return /* @__PURE__ */ jsx(Dialog$1.Trigger, {
17
+ "data-slot": "dialog-trigger",
18
+ ...props
19
+ });
20
+ }
21
+ function DialogPortal({ ...props }) {
22
+ return /* @__PURE__ */ jsx(Dialog$1.Portal, {
23
+ "data-slot": "dialog-portal",
24
+ ...props
25
+ });
26
+ }
27
+ function DialogClose({ ...props }) {
28
+ return /* @__PURE__ */ jsx(Dialog$1.Close, {
29
+ "data-slot": "dialog-close",
30
+ ...props
31
+ });
32
+ }
33
+ function DialogOverlay({ className, ...props }) {
34
+ return /* @__PURE__ */ jsx(Dialog$1.Overlay, {
35
+ "data-slot": "dialog-overlay",
36
+ className: cn("data-open:animate-in data-open:fade-in-0 data-closed:animate-out data-closed:fade-out-0 fixed inset-0 isolate z-50 bg-black/10 duration-100 supports-backdrop-filter:backdrop-blur-xs", className),
37
+ ...props
38
+ });
39
+ }
40
+ function DialogContent({ className, children, showCloseButton = true, ...props }) {
41
+ return /* @__PURE__ */ jsxs(DialogPortal, { children: [/* @__PURE__ */ jsx(DialogOverlay, {}), /* @__PURE__ */ jsxs(Dialog$1.Content, {
42
+ "data-slot": "dialog-content",
43
+ className: cn("bg-popover text-popover-foreground ring-foreground/10 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 fixed top-1/2 left-1/2 z-50 grid w-full max-w-[calc(100%-2rem)] -translate-x-1/2 -translate-y-1/2 gap-4 rounded-xl p-4 text-sm ring-1 duration-100 outline-none sm:max-w-sm", className),
44
+ ...props,
45
+ children: [children, showCloseButton && /* @__PURE__ */ jsx(Dialog$1.Close, {
46
+ "data-slot": "dialog-close",
47
+ asChild: true,
48
+ children: /* @__PURE__ */ jsxs(Button, {
49
+ variant: "ghost",
50
+ className: "absolute top-2 right-2",
51
+ size: "icon-sm",
52
+ children: [/* @__PURE__ */ jsx(XIcon, {}), /* @__PURE__ */ jsx("span", {
53
+ className: "sr-only",
54
+ children: "Close"
55
+ })]
56
+ })
57
+ })]
58
+ })] });
59
+ }
60
+ function DialogHeader({ className, ...props }) {
61
+ return /* @__PURE__ */ jsx("div", {
62
+ "data-slot": "dialog-header",
63
+ className: cn("flex flex-col gap-2", className),
64
+ ...props
65
+ });
66
+ }
67
+ function DialogFooter({ className, showCloseButton = false, children, ...props }) {
68
+ return /* @__PURE__ */ jsxs("div", {
69
+ "data-slot": "dialog-footer",
70
+ className: cn("bg-muted/50 -mx-4 -mb-4 flex flex-col-reverse gap-2 rounded-b-xl border-t p-4 sm:flex-row sm:justify-end", className),
71
+ ...props,
72
+ children: [children, showCloseButton && /* @__PURE__ */ jsx(Dialog$1.Close, {
73
+ asChild: true,
74
+ children: /* @__PURE__ */ jsx(Button, {
75
+ variant: "outline",
76
+ children: "Close"
77
+ })
78
+ })]
79
+ });
80
+ }
81
+ function DialogTitle({ className, ...props }) {
82
+ return /* @__PURE__ */ jsx(Dialog$1.Title, {
83
+ "data-slot": "dialog-title",
84
+ className: cn("font-heading text-base leading-none font-medium", className),
85
+ ...props
86
+ });
87
+ }
88
+ function DialogDescription({ className, ...props }) {
89
+ return /* @__PURE__ */ jsx(Dialog$1.Description, {
90
+ "data-slot": "dialog-description",
91
+ className: cn("text-muted-foreground *:[a]:hover:text-foreground text-sm *:[a]:underline *:[a]:underline-offset-3", className),
92
+ ...props
93
+ });
94
+ }
95
+ export { Dialog, DialogClose, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogOverlay, DialogPortal, DialogTitle, DialogTrigger };
@@ -0,0 +1,29 @@
1
+ import * as React from "react";
2
+ import { DropdownMenu as DropdownMenu$1 } from "radix-ui";
3
+ declare function DropdownMenu({ ...props }: React.ComponentProps<typeof DropdownMenu$1.Root>): React.JSX.Element;
4
+ declare function DropdownMenuPortal({ ...props }: React.ComponentProps<typeof DropdownMenu$1.Portal>): React.JSX.Element;
5
+ declare function DropdownMenuTrigger({ ...props }: React.ComponentProps<typeof DropdownMenu$1.Trigger>): React.JSX.Element;
6
+ declare function DropdownMenuContent({ className, align, sideOffset, ...props }: React.ComponentProps<typeof DropdownMenu$1.Content>): React.JSX.Element;
7
+ declare function DropdownMenuGroup({ ...props }: React.ComponentProps<typeof DropdownMenu$1.Group>): React.JSX.Element;
8
+ declare function DropdownMenuItem({ className, inset, variant, ...props }: React.ComponentProps<typeof DropdownMenu$1.Item> & {
9
+ inset?: boolean;
10
+ variant?: 'default' | 'destructive';
11
+ }): React.JSX.Element;
12
+ declare function DropdownMenuCheckboxItem({ className, children, checked, inset, ...props }: React.ComponentProps<typeof DropdownMenu$1.CheckboxItem> & {
13
+ inset?: boolean;
14
+ }): React.JSX.Element;
15
+ declare function DropdownMenuRadioGroup({ ...props }: React.ComponentProps<typeof DropdownMenu$1.RadioGroup>): React.JSX.Element;
16
+ declare function DropdownMenuRadioItem({ className, children, inset, ...props }: React.ComponentProps<typeof DropdownMenu$1.RadioItem> & {
17
+ inset?: boolean;
18
+ }): React.JSX.Element;
19
+ declare function DropdownMenuLabel({ className, inset, ...props }: React.ComponentProps<typeof DropdownMenu$1.Label> & {
20
+ inset?: boolean;
21
+ }): React.JSX.Element;
22
+ declare function DropdownMenuSeparator({ className, ...props }: React.ComponentProps<typeof DropdownMenu$1.Separator>): React.JSX.Element;
23
+ declare function DropdownMenuShortcut({ className, ...props }: React.ComponentProps<'span'>): React.JSX.Element;
24
+ declare function DropdownMenuSub({ ...props }: React.ComponentProps<typeof DropdownMenu$1.Sub>): React.JSX.Element;
25
+ declare function DropdownMenuSubTrigger({ className, inset, children, ...props }: React.ComponentProps<typeof DropdownMenu$1.SubTrigger> & {
26
+ inset?: boolean;
27
+ }): React.JSX.Element;
28
+ declare function DropdownMenuSubContent({ className, ...props }: React.ComponentProps<typeof DropdownMenu$1.SubContent>): React.JSX.Element;
29
+ export { DropdownMenu, DropdownMenuCheckboxItem, DropdownMenuContent, DropdownMenuGroup, DropdownMenuItem, DropdownMenuLabel, DropdownMenuPortal, DropdownMenuRadioGroup, DropdownMenuRadioItem, DropdownMenuSeparator, DropdownMenuShortcut, DropdownMenuSub, DropdownMenuSubContent, DropdownMenuSubTrigger, DropdownMenuTrigger };