@greatapps/common 1.0.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 (205) hide show
  1. package/dist/components/handlers/SearchParamsHandler.mjs +23 -0
  2. package/dist/components/handlers/SearchParamsHandler.mjs.map +1 -0
  3. package/dist/components/layouts/MainLayout.mjs +60 -0
  4. package/dist/components/layouts/MainLayout.mjs.map +1 -0
  5. package/dist/components/layouts/MdSideBarNavigation.mjs +36 -0
  6. package/dist/components/layouts/MdSideBarNavigation.mjs.map +1 -0
  7. package/dist/components/layouts/NavBar.mjs +45 -0
  8. package/dist/components/layouts/NavBar.mjs.map +1 -0
  9. package/dist/components/layouts/NotificationItem.mjs +7 -0
  10. package/dist/components/layouts/NotificationItem.mjs.map +1 -0
  11. package/dist/components/layouts/SideBarNavigation.mjs +22 -0
  12. package/dist/components/layouts/SideBarNavigation.mjs.map +1 -0
  13. package/dist/components/ui/buttons/Button.mjs +51 -0
  14. package/dist/components/ui/buttons/Button.mjs.map +1 -0
  15. package/dist/components/ui/buttons/CancelButton.mjs +16 -0
  16. package/dist/components/ui/buttons/CancelButton.mjs.map +1 -0
  17. package/dist/components/ui/buttons/CopyButton.mjs +34 -0
  18. package/dist/components/ui/buttons/CopyButton.mjs.map +1 -0
  19. package/dist/components/ui/data-display/Accordion.mjs +73 -0
  20. package/dist/components/ui/data-display/Accordion.mjs.map +1 -0
  21. package/dist/components/ui/data-display/Badge.mjs +41 -0
  22. package/dist/components/ui/data-display/Badge.mjs.map +1 -0
  23. package/dist/components/ui/data-display/Card.mjs +91 -0
  24. package/dist/components/ui/data-display/Card.mjs.map +1 -0
  25. package/dist/components/ui/data-display/Pagination.mjs +115 -0
  26. package/dist/components/ui/data-display/Pagination.mjs.map +1 -0
  27. package/dist/components/ui/data-display/ScrollArea.mjs +60 -0
  28. package/dist/components/ui/data-display/ScrollArea.mjs.map +1 -0
  29. package/dist/components/ui/data-display/Separator.mjs +28 -0
  30. package/dist/components/ui/data-display/Separator.mjs.map +1 -0
  31. package/dist/components/ui/data-display/Table.mjs +116 -0
  32. package/dist/components/ui/data-display/Table.mjs.map +1 -0
  33. package/dist/components/ui/data-display/Tabs.mjs +69 -0
  34. package/dist/components/ui/data-display/Tabs.mjs.map +1 -0
  35. package/dist/components/ui/feedback/CircularProgress.mjs +61 -0
  36. package/dist/components/ui/feedback/CircularProgress.mjs.map +1 -0
  37. package/dist/components/ui/feedback/DefaultCircularProgress.mjs +49 -0
  38. package/dist/components/ui/feedback/DefaultCircularProgress.mjs.map +1 -0
  39. package/dist/components/ui/feedback/Progress.mjs +37 -0
  40. package/dist/components/ui/feedback/Progress.mjs.map +1 -0
  41. package/dist/components/ui/feedback/Toast.mjs +73 -0
  42. package/dist/components/ui/feedback/Toast.mjs.map +1 -0
  43. package/dist/components/ui/form/Calendar.mjs +203 -0
  44. package/dist/components/ui/form/Calendar.mjs.map +1 -0
  45. package/dist/components/ui/form/Checkbox.mjs +33 -0
  46. package/dist/components/ui/form/Checkbox.mjs.map +1 -0
  47. package/dist/components/ui/form/DatePicker.mjs +78 -0
  48. package/dist/components/ui/form/DatePicker.mjs.map +1 -0
  49. package/dist/components/ui/form/DateRangePicker.mjs +86 -0
  50. package/dist/components/ui/form/DateRangePicker.mjs.map +1 -0
  51. package/dist/components/ui/form/Input.mjs +20 -0
  52. package/dist/components/ui/form/Input.mjs.map +1 -0
  53. package/dist/components/ui/form/InputOtp.mjs +67 -0
  54. package/dist/components/ui/form/InputOtp.mjs.map +1 -0
  55. package/dist/components/ui/form/RadioGroup.mjs +36 -0
  56. package/dist/components/ui/form/RadioGroup.mjs.map +1 -0
  57. package/dist/components/ui/form/Select.mjs +172 -0
  58. package/dist/components/ui/form/Select.mjs.map +1 -0
  59. package/dist/components/ui/form/Switch.mjs +33 -0
  60. package/dist/components/ui/form/Switch.mjs.map +1 -0
  61. package/dist/components/ui/form/Textarea.mjs +19 -0
  62. package/dist/components/ui/form/Textarea.mjs.map +1 -0
  63. package/dist/components/ui/overlay/Command.mjs +170 -0
  64. package/dist/components/ui/overlay/Command.mjs.map +1 -0
  65. package/dist/components/ui/overlay/Dialog.mjs +131 -0
  66. package/dist/components/ui/overlay/Dialog.mjs.map +1 -0
  67. package/dist/components/ui/overlay/Popover.mjs +46 -0
  68. package/dist/components/ui/overlay/Popover.mjs.map +1 -0
  69. package/dist/components/ui/overlay/Sheet.mjs +129 -0
  70. package/dist/components/ui/overlay/Sheet.mjs.map +1 -0
  71. package/dist/components/ui/overlay/Tooltip.mjs +55 -0
  72. package/dist/components/ui/overlay/Tooltip.mjs.map +1 -0
  73. package/dist/hooks/copy-to-clipboard.hook.mjs +39 -0
  74. package/dist/hooks/copy-to-clipboard.hook.mjs.map +1 -0
  75. package/dist/index.mjs +57 -0
  76. package/dist/index.mjs.map +1 -0
  77. package/dist/infra/api/client.mjs +115 -0
  78. package/dist/infra/api/client.mjs.map +1 -0
  79. package/dist/infra/api/types.mjs +31 -0
  80. package/dist/infra/api/types.mjs.map +1 -0
  81. package/dist/infra/utils/client-info.mjs +27 -0
  82. package/dist/infra/utils/client-info.mjs.map +1 -0
  83. package/dist/infra/utils/clsx.mjs +9 -0
  84. package/dist/infra/utils/clsx.mjs.map +1 -0
  85. package/dist/infra/utils/params.mjs +21 -0
  86. package/dist/infra/utils/params.mjs.map +1 -0
  87. package/dist/infra/utils/percentage.mjs +20 -0
  88. package/dist/infra/utils/percentage.mjs.map +1 -0
  89. package/dist/middlewares/chain.mjs +37 -0
  90. package/dist/middlewares/chain.mjs.map +1 -0
  91. package/dist/middlewares/create-auth-middleware.mjs +28 -0
  92. package/dist/middlewares/create-auth-middleware.mjs.map +1 -0
  93. package/dist/middlewares/types.mjs +11 -0
  94. package/dist/middlewares/types.mjs.map +1 -0
  95. package/dist/middlewares/validate-session.mjs +92 -0
  96. package/dist/middlewares/validate-session.mjs.map +1 -0
  97. package/dist/modules/auth/actions/login.action.mjs +11 -0
  98. package/dist/modules/auth/actions/login.action.mjs.map +1 -0
  99. package/dist/modules/auth/actions/logout.action.mjs +11 -0
  100. package/dist/modules/auth/actions/logout.action.mjs.map +1 -0
  101. package/dist/modules/auth/actions/register.action.mjs +9 -0
  102. package/dist/modules/auth/actions/register.action.mjs.map +1 -0
  103. package/dist/modules/auth/actions/validate-session.action.mjs +44 -0
  104. package/dist/modules/auth/actions/validate-session.action.mjs.map +1 -0
  105. package/dist/modules/auth/hooks/login.hook.mjs +12 -0
  106. package/dist/modules/auth/hooks/login.hook.mjs.map +1 -0
  107. package/dist/modules/auth/hooks/logout.hook.mjs +12 -0
  108. package/dist/modules/auth/hooks/logout.hook.mjs.map +1 -0
  109. package/dist/modules/auth/hooks/register.hook.mjs +12 -0
  110. package/dist/modules/auth/hooks/register.hook.mjs.map +1 -0
  111. package/dist/modules/auth/hooks/useUserQuery.mjs +48 -0
  112. package/dist/modules/auth/hooks/useUserQuery.mjs.map +1 -0
  113. package/dist/modules/auth/schema.mjs +1 -0
  114. package/dist/modules/auth/schema.mjs.map +1 -0
  115. package/dist/modules/auth/services/auth.service.mjs +163 -0
  116. package/dist/modules/auth/services/auth.service.mjs.map +1 -0
  117. package/dist/modules/users/action/find-user-by-id.action.mjs +21 -0
  118. package/dist/modules/users/action/find-user-by-id.action.mjs.map +1 -0
  119. package/dist/modules/users/schema.mjs +11 -0
  120. package/dist/modules/users/schema.mjs.map +1 -0
  121. package/dist/modules/users/services/user.service.mjs +50 -0
  122. package/dist/modules/users/services/user.service.mjs.map +1 -0
  123. package/dist/modules/whitelabel/actions/find-whitelabel.action.mjs +19 -0
  124. package/dist/modules/whitelabel/actions/find-whitelabel.action.mjs.map +1 -0
  125. package/dist/modules/whitelabel/schema.mjs +1 -0
  126. package/dist/modules/whitelabel/schema.mjs.map +1 -0
  127. package/dist/modules/whitelabel/services/whitelabel.service.mjs +62 -0
  128. package/dist/modules/whitelabel/services/whitelabel.service.mjs.map +1 -0
  129. package/dist/providers/auth.provider.mjs +84 -0
  130. package/dist/providers/auth.provider.mjs.map +1 -0
  131. package/dist/providers/query.provider.mjs +37 -0
  132. package/dist/providers/query.provider.mjs.map +1 -0
  133. package/dist/providers/whitelabel.provider.mjs +33 -0
  134. package/dist/providers/whitelabel.provider.mjs.map +1 -0
  135. package/dist/store/useMdSidebarStore.mjs +11 -0
  136. package/dist/store/useMdSidebarStore.mjs.map +1 -0
  137. package/package.json +68 -0
  138. package/src/components/handlers/SearchParamsHandler.tsx +61 -0
  139. package/src/components/layouts/MainLayout.tsx +59 -0
  140. package/src/components/layouts/MdSideBarNavigation.tsx +39 -0
  141. package/src/components/layouts/NavBar.tsx +79 -0
  142. package/src/components/layouts/NotificationItem.tsx +26 -0
  143. package/src/components/layouts/SideBarNavigation.tsx +22 -0
  144. package/src/components/ui/buttons/Button.tsx +55 -0
  145. package/src/components/ui/buttons/CancelButton.tsx +12 -0
  146. package/src/components/ui/buttons/CopyButton.tsx +47 -0
  147. package/src/components/ui/data-display/Accordion.tsx +79 -0
  148. package/src/components/ui/data-display/Badge.tsx +45 -0
  149. package/src/components/ui/data-display/Card.tsx +91 -0
  150. package/src/components/ui/data-display/Pagination.tsx +124 -0
  151. package/src/components/ui/data-display/ScrollArea.tsx +57 -0
  152. package/src/components/ui/data-display/Separator.tsx +27 -0
  153. package/src/components/ui/data-display/Table.tsx +115 -0
  154. package/src/components/ui/data-display/Tabs.tsx +65 -0
  155. package/src/components/ui/feedback/CircularProgress.tsx +75 -0
  156. package/src/components/ui/feedback/DefaultCircularProgress.tsx +53 -0
  157. package/src/components/ui/feedback/Progress.tsx +38 -0
  158. package/src/components/ui/feedback/Toast.tsx +99 -0
  159. package/src/components/ui/form/Calendar.tsx +226 -0
  160. package/src/components/ui/form/Checkbox.tsx +31 -0
  161. package/src/components/ui/form/DatePicker.tsx +97 -0
  162. package/src/components/ui/form/DateRangePicker.tsx +108 -0
  163. package/src/components/ui/form/Input.tsx +18 -0
  164. package/src/components/ui/form/InputOtp.tsx +78 -0
  165. package/src/components/ui/form/RadioGroup.tsx +43 -0
  166. package/src/components/ui/form/Select.tsx +195 -0
  167. package/src/components/ui/form/Switch.tsx +30 -0
  168. package/src/components/ui/form/Textarea.tsx +17 -0
  169. package/src/components/ui/overlay/Command.tsx +183 -0
  170. package/src/components/ui/overlay/Dialog.tsx +146 -0
  171. package/src/components/ui/overlay/Popover.tsx +47 -0
  172. package/src/components/ui/overlay/Sheet.tsx +145 -0
  173. package/src/components/ui/overlay/Tooltip.tsx +60 -0
  174. package/src/hooks/copy-to-clipboard.hook.tsx +52 -0
  175. package/src/index.ts +50 -0
  176. package/src/infra/api/client.ts +142 -0
  177. package/src/infra/api/types.ts +79 -0
  178. package/src/infra/utils/client-info.ts +35 -0
  179. package/src/infra/utils/clsx.ts +6 -0
  180. package/src/infra/utils/params.ts +27 -0
  181. package/src/infra/utils/percentage.ts +42 -0
  182. package/src/middlewares/chain.ts +45 -0
  183. package/src/middlewares/create-auth-middleware.ts +38 -0
  184. package/src/middlewares/types.ts +24 -0
  185. package/src/middlewares/validate-session.ts +116 -0
  186. package/src/modules/auth/actions/login.action.ts +11 -0
  187. package/src/modules/auth/actions/logout.action.ts +11 -0
  188. package/src/modules/auth/actions/register.action.ts +8 -0
  189. package/src/modules/auth/actions/validate-session.action.ts +51 -0
  190. package/src/modules/auth/hooks/login.hook.tsx +10 -0
  191. package/src/modules/auth/hooks/logout.hook.tsx +10 -0
  192. package/src/modules/auth/hooks/register.hook.tsx +10 -0
  193. package/src/modules/auth/hooks/useUserQuery.ts +49 -0
  194. package/src/modules/auth/schema.ts +220 -0
  195. package/src/modules/auth/services/auth.service.ts +225 -0
  196. package/src/modules/users/action/find-user-by-id.action.ts +25 -0
  197. package/src/modules/users/schema.ts +79 -0
  198. package/src/modules/users/services/user.service.ts +63 -0
  199. package/src/modules/whitelabel/actions/find-whitelabel.action.ts +20 -0
  200. package/src/modules/whitelabel/schema.ts +49 -0
  201. package/src/modules/whitelabel/services/whitelabel.service.ts +77 -0
  202. package/src/providers/auth.provider.tsx +113 -0
  203. package/src/providers/query.provider.tsx +52 -0
  204. package/src/providers/whitelabel.provider.tsx +44 -0
  205. package/src/store/useMdSidebarStore.ts +15 -0
@@ -0,0 +1,97 @@
1
+ "use client";
2
+
3
+ import { useState, forwardRef, useEffect } from "react";
4
+ import { format } from "date-fns";
5
+ import { Calendar } from "./Calendar";
6
+ import { Popover, PopoverContent, PopoverTrigger } from "../overlay/Popover";
7
+ import { cn } from "../../../infra/utils/clsx";
8
+
9
+ // Converte string ISO (yyyy-MM-dd) para Date no fuso horário local
10
+ // Evita bug de timezone onde new Date("2025-08-02") interpreta como UTC
11
+ const isoParaDataLocal = (iso: string): Date => {
12
+ const [ano, mes, dia] = iso.split("-").map(Number);
13
+ return new Date(ano, mes - 1, dia);
14
+ };
15
+
16
+ interface DatePickerProps {
17
+ value?: string;
18
+ onChange?: (date: string | undefined) => void;
19
+ placeholder?: string;
20
+ className?: string;
21
+ disabled?: boolean;
22
+ }
23
+
24
+ export const DatePicker = forwardRef<HTMLButtonElement, DatePickerProps>(
25
+ (
26
+ { value, onChange, placeholder = "Selecione a data", className, disabled },
27
+ ref,
28
+ ) => {
29
+ const [open, setOpen] = useState(false);
30
+ const [date, setDate] = useState<Date | undefined>(() => {
31
+ return value ? isoParaDataLocal(value) : undefined;
32
+ });
33
+
34
+ // Sincroniza estado interno quando value mudar externamente
35
+ useEffect(() => {
36
+ if (value) {
37
+ setDate(isoParaDataLocal(value));
38
+ } else {
39
+ setDate(undefined);
40
+ }
41
+ }, [value]);
42
+
43
+ const handleDateSelect = (selectedDate: Date | undefined) => {
44
+ setDate(selectedDate);
45
+
46
+ if (selectedDate) {
47
+ onChange?.(format(selectedDate, "yyyy-MM-dd"));
48
+ setOpen(false); // Fecha o popover após seleção
49
+ } else {
50
+ onChange?.(undefined);
51
+ }
52
+ };
53
+
54
+ const displayText = date ? format(date, "dd/MM/yyyy") : placeholder;
55
+
56
+ return (
57
+ <Popover open={open} onOpenChange={setOpen}>
58
+ <PopoverTrigger asChild>
59
+ <button
60
+ ref={ref}
61
+ disabled={disabled}
62
+ className={cn(
63
+ "flex items-center gap-2 px-4 h-10 border rounded-lg transition-colors w-full justify-start",
64
+ "border-gray-200 hover:border-gray-400 focus-within:border-gray-950",
65
+ "disabled:opacity-50 disabled:cursor-not-allowed",
66
+ className,
67
+ )}
68
+ >
69
+ <span
70
+ className={cn(
71
+ "paragraph-small-medium",
72
+ date ? "text-gray-950" : "text-gray-500",
73
+ )}
74
+ >
75
+ {displayText}
76
+ </span>
77
+ </button>
78
+ </PopoverTrigger>
79
+ <PopoverContent
80
+ className="w-auto p-0 bg-white rounded-2xl shadow-md border border-gray-200"
81
+ align="start"
82
+ sideOffset={8}
83
+ >
84
+ <div className="p-3">
85
+ <Calendar
86
+ mode="single"
87
+ selected={date}
88
+ onSelect={handleDateSelect}
89
+ />
90
+ </div>
91
+ </PopoverContent>
92
+ </Popover>
93
+ );
94
+ },
95
+ );
96
+
97
+ DatePicker.displayName = "DatePicker";
@@ -0,0 +1,108 @@
1
+ "use client";
2
+
3
+ import { useState, forwardRef, useEffect } from "react";
4
+ import { format } from "date-fns";
5
+ import { Calendar as CalendarIcon } from "lucide-react";
6
+ import { DateRange } from "react-day-picker";
7
+ import { Calendar } from "./Calendar";
8
+ import { Popover, PopoverContent, PopoverTrigger } from "../overlay/Popover";
9
+ import { cn } from "../../../infra/utils/clsx";
10
+
11
+ // Converte string ISO (yyyy-MM-dd) para Date no fuso horário local
12
+ // Evita bug de timezone onde new Date("2025-08-02") interpreta como UTC
13
+ const isoParaDataLocal = (iso: string): Date => {
14
+ const [ano, mes, dia] = iso.split("-").map(Number);
15
+ return new Date(ano, mes - 1, dia);
16
+ };
17
+
18
+ interface DateRangePickerProps {
19
+ value?: { from: string; to: string };
20
+ onChange?: (range: { from: string; to: string } | undefined) => void;
21
+ placeholder?: string;
22
+ className?: string;
23
+ disabled?: boolean;
24
+ }
25
+
26
+ export const DateRangePicker = forwardRef<HTMLButtonElement, DateRangePickerProps>(
27
+ ({ value, onChange, placeholder = "Selecione o período", className, disabled }, ref) => {
28
+ const [open, setOpen] = useState(false);
29
+ const [range, setRange] = useState<DateRange | undefined>(() => {
30
+ if (value?.from && value?.to) {
31
+ return {
32
+ from: isoParaDataLocal(value.from),
33
+ to: isoParaDataLocal(value.to)
34
+ };
35
+ }
36
+ return undefined;
37
+ });
38
+
39
+ useEffect(() => {
40
+ if (value?.from && value?.to) {
41
+ setRange({
42
+ from: isoParaDataLocal(value.from),
43
+ to: isoParaDataLocal(value.to)
44
+ });
45
+ } else {
46
+ setRange(undefined);
47
+ }
48
+ }, [value]);
49
+
50
+ const handleRangeSelect = (newRange: DateRange | undefined) => {
51
+ setRange(newRange);
52
+
53
+ if (newRange?.from && newRange?.to) {
54
+ onChange?.({
55
+ from: format(newRange.from, "yyyy-MM-dd"),
56
+ to: format(newRange.to, "yyyy-MM-dd")
57
+ });
58
+ } else {
59
+ onChange?.(undefined);
60
+ }
61
+ };
62
+
63
+ const displayText = range?.from && range?.to
64
+ ? `${format(range.from, "dd/MM/yyyy")} - ${format(range.to, "dd/MM/yyyy")}`
65
+ : placeholder;
66
+
67
+ return (
68
+ <Popover open={open} onOpenChange={setOpen}>
69
+ <PopoverTrigger asChild>
70
+ <button
71
+ ref={ref}
72
+ disabled={disabled}
73
+ className={cn(
74
+ "flex items-center gap-2 px-4 h-10 border rounded-lg transition-colors w-full justify-start",
75
+ "border-gray-200 hover:border-gray-400 focus-within:border-gray-950",
76
+ "disabled:opacity-50 disabled:cursor-not-allowed",
77
+ className
78
+ )}
79
+ >
80
+ <CalendarIcon size={20} className="text-gray-400" />
81
+ <span className={cn(
82
+ "paragraph-small-medium",
83
+ range?.from && range?.to ? "text-gray-950" : "text-gray-500"
84
+ )}>
85
+ {displayText}
86
+ </span>
87
+ </button>
88
+ </PopoverTrigger>
89
+ <PopoverContent
90
+ className="w-auto p-0 bg-white rounded-2xl shadow-md border border-gray-200"
91
+ align="start"
92
+ sideOffset={8}
93
+ >
94
+ <div className="p-3">
95
+ <Calendar
96
+ mode="range"
97
+ selected={range}
98
+ onSelect={handleRangeSelect}
99
+ numberOfMonths={1}
100
+ />
101
+ </div>
102
+ </PopoverContent>
103
+ </Popover>
104
+ );
105
+ }
106
+ );
107
+
108
+ DateRangePicker.displayName = "DateRangePicker";
@@ -0,0 +1,18 @@
1
+ import * as React from "react"
2
+ import { cn } from "../../../infra/utils/clsx"
3
+
4
+ function Input({ className, type, ...props }: React.ComponentProps<"input">) {
5
+ return (
6
+ <input
7
+ type={type}
8
+ data-slot="input"
9
+ className={cn(
10
+ "outline-none",
11
+ className
12
+ )}
13
+ {...props}
14
+ />
15
+ )
16
+ }
17
+
18
+ export { Input }
@@ -0,0 +1,78 @@
1
+ "use client"
2
+
3
+ import * as React from "react"
4
+ import { OTPInput, OTPInputContext } from "input-otp"
5
+ import { MinusIcon } from "lucide-react"
6
+ import { cn } from "../../../infra/utils/clsx"
7
+
8
+ function InputOTP({
9
+ className,
10
+ containerClassName,
11
+ ...props
12
+ }: React.ComponentProps<typeof OTPInput> & {
13
+ containerClassName?: string
14
+ }) {
15
+ return (
16
+ <OTPInput
17
+ data-slot="input-otp"
18
+ containerClassName={cn(
19
+ "flex items-center gap-2 has-disabled:opacity-50",
20
+ containerClassName
21
+ )}
22
+ className={cn("disabled:cursor-not-allowed", className)}
23
+ {...props}
24
+ />
25
+ )
26
+ }
27
+
28
+ function InputOTPGroup({ className, ...props }: React.ComponentProps<"div">) {
29
+ return (
30
+ <div
31
+ data-slot="input-otp-group"
32
+ className={cn("flex items-center", className)}
33
+ {...props}
34
+ />
35
+ )
36
+ }
37
+
38
+ function InputOTPSlot({
39
+ index,
40
+ className,
41
+ ...props
42
+ }: React.ComponentProps<"div"> & {
43
+ index: number
44
+ }) {
45
+ const inputOTPContext = React.useContext(OTPInputContext)
46
+ const { char, hasFakeCaret, isActive } = inputOTPContext?.slots[index] ?? {}
47
+
48
+ return (
49
+ <div
50
+ data-slot="input-otp-slot"
51
+ data-active={isActive}
52
+ className={cn(
53
+ "relative flex h-9 w-9 items-center justify-center border text-sm transition-all outline-none first:rounded-l-md first:border-l last:rounded-r-md",
54
+ "border-gray-200 hover:border-gray-400 data-[active=true]:border-gray-950",
55
+ "data-[active=true]:z-10",
56
+ className
57
+ )}
58
+ {...props}
59
+ >
60
+ {char}
61
+ {hasFakeCaret && (
62
+ <div className="pointer-events-none absolute inset-0 flex items-center justify-center">
63
+ <div className="animate-caret-blink bg-foreground h-4 w-px duration-1000" />
64
+ </div>
65
+ )}
66
+ </div>
67
+ )
68
+ }
69
+
70
+ function InputOTPSeparator({ ...props }: React.ComponentProps<"div">) {
71
+ return (
72
+ <div data-slot="input-otp-separator" role="separator" {...props}>
73
+ <MinusIcon />
74
+ </div>
75
+ )
76
+ }
77
+
78
+ export { InputOTP, InputOTPGroup, InputOTPSlot, InputOTPSeparator }
@@ -0,0 +1,43 @@
1
+ "use client"
2
+
3
+ import * as React from "react"
4
+ import * as RadioGroupPrimitive from "@radix-ui/react-radio-group"
5
+ import { Circle } from "lucide-react"
6
+ import { cn } from "../../../infra/utils/clsx"
7
+
8
+ const RadioGroup = React.forwardRef<
9
+ React.ElementRef<typeof RadioGroupPrimitive.Root>,
10
+ React.ComponentPropsWithoutRef<typeof RadioGroupPrimitive.Root>
11
+ >(({ className, ...props }, ref) => {
12
+ return (
13
+ <RadioGroupPrimitive.Root
14
+ className={cn("grid gap-2", className)}
15
+ {...props}
16
+ ref={ref}
17
+ />
18
+ )
19
+ })
20
+ RadioGroup.displayName = RadioGroupPrimitive.Root.displayName
21
+
22
+ const RadioGroupItem = React.forwardRef<
23
+ React.ElementRef<typeof RadioGroupPrimitive.Item>,
24
+ React.ComponentPropsWithoutRef<typeof RadioGroupPrimitive.Item>
25
+ >(({ className, ...props }, ref) => {
26
+ return (
27
+ <RadioGroupPrimitive.Item
28
+ ref={ref}
29
+ className={cn(
30
+ "aspect-square h-4 w-4 rounded-full border border-gray-300 text-gray-950 ring-offset-white focus:outline-none focus-visible:ring-2 focus-visible:ring-gray-950 focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50",
31
+ className
32
+ )}
33
+ {...props}
34
+ >
35
+ <RadioGroupPrimitive.Indicator className="flex items-center justify-center">
36
+ <Circle className="h-2.5 w-2.5 fill-current text-current" />
37
+ </RadioGroupPrimitive.Indicator>
38
+ </RadioGroupPrimitive.Item>
39
+ )
40
+ })
41
+ RadioGroupItem.displayName = RadioGroupPrimitive.Item.displayName
42
+
43
+ export { RadioGroup, RadioGroupItem }
@@ -0,0 +1,195 @@
1
+ "use client"
2
+
3
+ import * as React from "react"
4
+ import * as SelectPrimitive from "@radix-ui/react-select"
5
+ import { CheckIcon, ChevronDownIcon, ChevronUpIcon } from "lucide-react"
6
+ import { cn } from "../../../infra/utils/clsx"
7
+
8
+ function Select({
9
+ ...props
10
+ }: React.ComponentProps<typeof SelectPrimitive.Root>) {
11
+ return <SelectPrimitive.Root data-slot="select" {...props} />
12
+ }
13
+
14
+ function SelectGroup({
15
+ ...props
16
+ }: React.ComponentProps<typeof SelectPrimitive.Group>) {
17
+ return <SelectPrimitive.Group data-slot="select-group" {...props} />
18
+ }
19
+
20
+ function SelectValue({
21
+ ...props
22
+ }: React.ComponentProps<typeof SelectPrimitive.Value>) {
23
+ return <SelectPrimitive.Value data-slot="select-value" {...props} />
24
+ }
25
+
26
+ function SelectTrigger({
27
+ className,
28
+ size = "default",
29
+ children,
30
+ ...props
31
+ }: React.ComponentProps<typeof SelectPrimitive.Trigger> & {
32
+ size?: "sm" | "default"
33
+ }) {
34
+ return (
35
+ <SelectPrimitive.Trigger
36
+ data-slot="select-trigger"
37
+ data-size={size}
38
+ className={cn(
39
+ "group/data-select border-input data-placeholder:text-muted-foreground [&_svg:not([class*='text-'])]:text-muted-foreground focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive dark:bg-input/30 dark:hover:bg-input/50 flex w-fit items-center justify-between gap-2 rounded-md border bg-transparent px-3 py-2 text-sm whitespace-nowrap shadow-xs transition-[color,box-shadow] outline-none focus-visible:ring-[3px] disabled:cursor-not-allowed disabled:opacity-50 data-[size=default]:h-9 data-[size=sm]:h-8 *:data-[slot=select-value]:line-clamp-1 *:data-[slot=select-value]:flex *:data-[slot=select-value]:items-center *:data-[slot=select-value]:gap-2 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 cursor-pointer",
40
+ className
41
+ )}
42
+ {...props}
43
+ >
44
+ {children}
45
+
46
+ <SelectPrimitive.Icon asChild>
47
+ <ChevronDownIcon
48
+ className="
49
+ size-4 opacity-50 transition-all duration-200
50
+ group-data-[state=open]/data-select:rotate-180
51
+ group-data-[state=open]/data-select:opacity-100
52
+ group-data-[state=open]/data-select:text-gray-950!
53
+ "
54
+ />
55
+ </SelectPrimitive.Icon>
56
+ </SelectPrimitive.Trigger>
57
+ )
58
+
59
+ }
60
+
61
+ function SelectContent({
62
+ className,
63
+ children,
64
+ position = "popper",
65
+ align = "center",
66
+ ...props
67
+ }: React.ComponentProps<typeof SelectPrimitive.Content>) {
68
+ return (
69
+ <SelectPrimitive.Portal>
70
+ <SelectPrimitive.Content
71
+ data-slot="select-content"
72
+ className={cn(
73
+ "bg-popover text-popover-foreground data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 relative z-[1001] max-h-(--radix-select-content-available-height) min-w-32 origin-(--radix-select-content-transform-origin) overflow-x-hidden overflow-y-auto rounded-md border shadow-md",
74
+ position === "popper" &&
75
+ "data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1",
76
+ className
77
+ )}
78
+ position={position}
79
+ align={align}
80
+ {...props}
81
+ >
82
+ <SelectScrollUpButton />
83
+ <SelectPrimitive.Viewport
84
+ className={cn(
85
+ "p-1",
86
+ position === "popper" &&
87
+ "h-(--radix-select-trigger-height) w-full min-w-(--radix-select-trigger-width) scroll-my-1"
88
+ )}
89
+ >
90
+ {children}
91
+ </SelectPrimitive.Viewport>
92
+ <SelectScrollDownButton />
93
+ </SelectPrimitive.Content>
94
+ </SelectPrimitive.Portal>
95
+ )
96
+ }
97
+
98
+ function SelectLabel({
99
+ className,
100
+ ...props
101
+ }: React.ComponentProps<typeof SelectPrimitive.Label>) {
102
+ return (
103
+ <SelectPrimitive.Label
104
+ data-slot="select-label"
105
+ className={cn("text-muted-foreground px-2 py-1.5 text-xs", className)}
106
+ {...props}
107
+ />
108
+ )
109
+ }
110
+
111
+ function SelectItem({
112
+ className,
113
+ children,
114
+ ...props
115
+ }: React.ComponentProps<typeof SelectPrimitive.Item>) {
116
+ return (
117
+ <SelectPrimitive.Item
118
+ data-slot="select-item"
119
+ className={cn(
120
+ "focus:bg-accent focus:text-accent-foreground [&_svg:not([class*='text-'])]:text-muted-foreground relative flex w-full items-center gap-2 rounded-sm py-1.5 pr-8 pl-2 text-sm outline-hidden select-none data-disabled:pointer-events-none data-disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 *:[span]:last:flex *:[span]:last:items-center *:[span]:last:gap-2 cursor-pointer",
121
+ className
122
+ )}
123
+ {...props}
124
+ >
125
+ <span className="absolute right-2 flex size-3.5 items-center justify-center">
126
+ <SelectPrimitive.ItemIndicator>
127
+ <CheckIcon className="size-4" />
128
+ </SelectPrimitive.ItemIndicator>
129
+ </span>
130
+ <SelectPrimitive.ItemText className="cursor-pointer">{children}</SelectPrimitive.ItemText>
131
+ </SelectPrimitive.Item>
132
+ )
133
+ }
134
+
135
+ function SelectSeparator({
136
+ className,
137
+ ...props
138
+ }: React.ComponentProps<typeof SelectPrimitive.Separator>) {
139
+ return (
140
+ <SelectPrimitive.Separator
141
+ data-slot="select-separator"
142
+ className={cn("bg-border pointer-events-none -mx-1 my-1 h-px", className)}
143
+ {...props}
144
+ />
145
+ )
146
+ }
147
+
148
+ function SelectScrollUpButton({
149
+ className,
150
+ ...props
151
+ }: React.ComponentProps<typeof SelectPrimitive.ScrollUpButton>) {
152
+ return (
153
+ <SelectPrimitive.ScrollUpButton
154
+ data-slot="select-scroll-up-button"
155
+ className={cn(
156
+ "flex cursor-default items-center justify-center py-1",
157
+ className
158
+ )}
159
+ {...props}
160
+ >
161
+ <ChevronUpIcon className="size-4" />
162
+ </SelectPrimitive.ScrollUpButton>
163
+ )
164
+ }
165
+
166
+ function SelectScrollDownButton({
167
+ className,
168
+ ...props
169
+ }: React.ComponentProps<typeof SelectPrimitive.ScrollDownButton>) {
170
+ return (
171
+ <SelectPrimitive.ScrollDownButton
172
+ data-slot="select-scroll-down-button"
173
+ className={cn(
174
+ "flex cursor-default items-center justify-center py-1",
175
+ className
176
+ )}
177
+ {...props}
178
+ >
179
+ <ChevronDownIcon className="size-4" />
180
+ </SelectPrimitive.ScrollDownButton>
181
+ )
182
+ }
183
+
184
+ export {
185
+ Select,
186
+ SelectContent,
187
+ SelectGroup,
188
+ SelectItem,
189
+ SelectLabel,
190
+ SelectScrollDownButton,
191
+ SelectScrollUpButton,
192
+ SelectSeparator,
193
+ SelectTrigger,
194
+ SelectValue,
195
+ }
@@ -0,0 +1,30 @@
1
+ "use client"
2
+
3
+ import * as React from "react"
4
+ import * as SwitchPrimitive from "@radix-ui/react-switch"
5
+ import { cn } from "../../../infra/utils/clsx"
6
+
7
+ function Switch({
8
+ className,
9
+ ...props
10
+ }: React.ComponentProps<typeof SwitchPrimitive.Root>) {
11
+ return (
12
+ <SwitchPrimitive.Root
13
+ data-slot="switch"
14
+ className={cn(
15
+ "peer data-[state=checked]:bg-primary data-[state=unchecked]:bg-input focus-visible:border-ring focus-visible:ring-ring/50 cursor-pointer dark:data-[state=unchecked]:bg-input/80 inline-flex h-[1.15rem] w-8 shrink-0 items-center rounded-full border border-transparent shadow-xs transition-all outline-none focus-visible:ring-[3px] disabled:cursor-not-allowed disabled:opacity-50",
16
+ className
17
+ )}
18
+ {...props}
19
+ >
20
+ <SwitchPrimitive.Thumb
21
+ data-slot="switch-thumb"
22
+ className={cn(
23
+ "bg-background dark:data-[state=unchecked]:bg-foreground dark:data-[state=checked]:bg-primary-foreground pointer-events-none block size-4 rounded-full ring-0 transition-transform data-[state=checked]:translate-x-[calc(100%-2px)] data-[state=unchecked]:translate-x-0"
24
+ )}
25
+ />
26
+ </SwitchPrimitive.Root>
27
+ )
28
+ }
29
+
30
+ export { Switch }
@@ -0,0 +1,17 @@
1
+ import * as React from "react"
2
+ import { cn } from "../../../infra/utils/clsx"
3
+
4
+ function Textarea({ className, ...props }: React.ComponentProps<"textarea">) {
5
+ return (
6
+ <textarea
7
+ data-slot="textarea"
8
+ className={cn(
9
+ "border-input placeholder:text-muted-foreground focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive dark:bg-input/30 flex field-sizing-content min-h-16 w-full rounded-md border bg-transparent px-3 py-2 text-base shadow-xs transition-[color,box-shadow] outline-none focus-visible:ring-[3px] disabled:cursor-not-allowed disabled:opacity-50 md:text-sm",
10
+ className
11
+ )}
12
+ {...props}
13
+ />
14
+ )
15
+ }
16
+
17
+ export { Textarea }