@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,115 @@
1
+ "use client"
2
+
3
+ import * as React from "react"
4
+ import { cn } from "../../../infra/utils/clsx"
5
+
6
+ function Table({ className, ...props }: React.ComponentProps<"table">) {
7
+ return (
8
+ <div
9
+ data-slot="table-container"
10
+ className="relative w-full overflow-x-auto"
11
+ >
12
+ <table
13
+ data-slot="table"
14
+ className={cn("w-full caption-bottom text-sm", className)}
15
+ {...props}
16
+ />
17
+ </div>
18
+ )
19
+ }
20
+
21
+ function TableHeader({ className, ...props }: React.ComponentProps<"thead">) {
22
+ return (
23
+ <thead
24
+ data-slot="table-header"
25
+ className={cn("[&_tr]:border-b", className)}
26
+ {...props}
27
+ />
28
+ )
29
+ }
30
+
31
+ function TableBody({ className, ...props }: React.ComponentProps<"tbody">) {
32
+ return (
33
+ <tbody
34
+ data-slot="table-body"
35
+ className={cn("[&_tr:last-child]:border-0", className)}
36
+ {...props}
37
+ />
38
+ )
39
+ }
40
+
41
+ function TableFooter({ className, ...props }: React.ComponentProps<"tfoot">) {
42
+ return (
43
+ <tfoot
44
+ data-slot="table-footer"
45
+ className={cn(
46
+ "bg-muted/50 border-t font-medium [&>tr]:last:border-b-0",
47
+ className
48
+ )}
49
+ {...props}
50
+ />
51
+ )
52
+ }
53
+
54
+ function TableRow({ className, ...props }: React.ComponentProps<"tr">) {
55
+ return (
56
+ <tr
57
+ data-slot="table-row"
58
+ className={cn(
59
+ "hover:bg-muted/50 data-[state=selected]:bg-muted border-b transition-colors",
60
+ className
61
+ )}
62
+ {...props}
63
+ />
64
+ )
65
+ }
66
+
67
+ function TableHead({ className, ...props }: React.ComponentProps<"th">) {
68
+ return (
69
+ <th
70
+ data-slot="table-head"
71
+ className={cn(
72
+ "text-foreground h-10 px-2 text-left align-middle font-medium whitespace-nowrap [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px]",
73
+ className
74
+ )}
75
+ {...props}
76
+ />
77
+ )
78
+ }
79
+
80
+ function TableCell({ className, ...props }: React.ComponentProps<"td">) {
81
+ return (
82
+ <td
83
+ data-slot="table-cell"
84
+ className={cn(
85
+ "p-2 align-middle whitespace-nowrap [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px]",
86
+ className
87
+ )}
88
+ {...props}
89
+ />
90
+ )
91
+ }
92
+
93
+ function TableCaption({
94
+ className,
95
+ ...props
96
+ }: React.ComponentProps<"caption">) {
97
+ return (
98
+ <caption
99
+ data-slot="table-caption"
100
+ className={cn("text-muted-foreground mt-4 text-sm", className)}
101
+ {...props}
102
+ />
103
+ )
104
+ }
105
+
106
+ export {
107
+ Table,
108
+ TableHeader,
109
+ TableBody,
110
+ TableFooter,
111
+ TableHead,
112
+ TableRow,
113
+ TableCell,
114
+ TableCaption,
115
+ }
@@ -0,0 +1,65 @@
1
+ "use client"
2
+
3
+ import * as React from "react"
4
+ import * as TabsPrimitive from "@radix-ui/react-tabs"
5
+ import { cn } from "../../../infra/utils/clsx"
6
+
7
+ function Tabs({
8
+ className,
9
+ ...props
10
+ }: React.ComponentProps<typeof TabsPrimitive.Root>) {
11
+ return (
12
+ <TabsPrimitive.Root
13
+ data-slot="tabs"
14
+ className={cn("flex flex-col gap-2", className)}
15
+ {...props}
16
+ />
17
+ )
18
+ }
19
+
20
+ function TabsList({
21
+ className,
22
+ ...props
23
+ }: React.ComponentProps<typeof TabsPrimitive.List>) {
24
+ return (
25
+ <TabsPrimitive.List
26
+ data-slot="tabs-list"
27
+ className={cn(
28
+ "inline-flex w-full items-center justify-start border-b border-gray-200",
29
+ className
30
+ )}
31
+ {...props}
32
+ />
33
+ )
34
+ }
35
+
36
+ function TabsTrigger({
37
+ className,
38
+ ...props
39
+ }: React.ComponentProps<typeof TabsPrimitive.Trigger>) {
40
+ return (
41
+ <TabsPrimitive.Trigger
42
+ data-slot="tabs-trigger"
43
+ className={cn(
44
+ "inline-flex items-center justify-center whitespace-nowrap px-4 py-3 text-sm font-medium text-gray-500 transition-all border-b-2 border-transparent hover:text-gray-900 cursor-pointer data-[state=active]:text-gray-950 data-[state=active]:border-gray-950 disabled:pointer-events-none disabled:opacity-50",
45
+ className
46
+ )}
47
+ {...props}
48
+ />
49
+ )
50
+ }
51
+
52
+ function TabsContent({
53
+ className,
54
+ ...props
55
+ }: React.ComponentProps<typeof TabsPrimitive.Content>) {
56
+ return (
57
+ <TabsPrimitive.Content
58
+ data-slot="tabs-content"
59
+ className={cn("flex-1 outline-none", className)}
60
+ {...props}
61
+ />
62
+ )
63
+ }
64
+
65
+ export { Tabs, TabsList, TabsTrigger, TabsContent }
@@ -0,0 +1,75 @@
1
+ import { ReactNode } from "react";
2
+ import {
3
+ calculateRadius,
4
+ calculateCircumference,
5
+ calculatePercentage,
6
+ calculateCircularProgressOffset,
7
+ } from "../../../infra/utils/percentage";
8
+
9
+ interface CircularProgressProps {
10
+ current: number;
11
+ total: number;
12
+ size?: number;
13
+ strokeWidth?: number;
14
+ children?: ReactNode;
15
+ }
16
+
17
+ export default function CircularProgress({
18
+ current,
19
+ total,
20
+ size = 62,
21
+ strokeWidth = 3,
22
+ children,
23
+ }: CircularProgressProps) {
24
+ const radius = calculateRadius(size, strokeWidth);
25
+ const circumference = calculateCircumference(radius);
26
+ const percentage = calculatePercentage(current, total);
27
+ const offset = calculateCircularProgressOffset(percentage, circumference);
28
+
29
+ return (
30
+ <div
31
+ className="relative flex items-center justify-center"
32
+ style={{ width: size, height: size }}
33
+ role="progressbar"
34
+ aria-valuenow={current}
35
+ aria-valuemin={0}
36
+ aria-valuemax={total}
37
+ aria-label="Progresso"
38
+ >
39
+ <svg width={size} height={size} className="absolute">
40
+ <circle
41
+ cx={size / 2}
42
+ cy={size / 2}
43
+ r={radius}
44
+ stroke="var(--color-gray-50)"
45
+ strokeWidth={strokeWidth}
46
+ fill="white"
47
+ />
48
+
49
+ <circle
50
+ cx={size / 2}
51
+ cy={size / 2}
52
+ r={radius}
53
+ stroke="var(--color-gray-950)"
54
+ strokeWidth={strokeWidth}
55
+ fill="none"
56
+ strokeDasharray={circumference}
57
+ strokeDashoffset={offset}
58
+ strokeLinecap="round"
59
+ transform={`rotate(-90 ${size / 2} ${size / 2})`}
60
+ className="transition-all duration-300 ease-in-out"
61
+ />
62
+ </svg>
63
+
64
+ <div className="relative z-10 flex items-center justify-center w-[50px] h-[50px] rounded-full bg-gray-50 paragraph-small-semibold">
65
+ {children ?? (
66
+ <>
67
+ <span className="text-gray-600">{current}</span>
68
+ <span className="text-gray-500">/</span>
69
+ <span className="text-gray-600">{total}</span>
70
+ </>
71
+ )}
72
+ </div>
73
+ </div>
74
+ );
75
+ }
@@ -0,0 +1,53 @@
1
+ import {
2
+ calculateRadius,
3
+ calculateCircumference,
4
+ calculatePercentage,
5
+ calculateCircularProgressOffset,
6
+ } from "../../../infra/utils/percentage";
7
+
8
+ interface CircularProgressProps {
9
+ current: number;
10
+ total: number;
11
+ size?: number;
12
+ strokeWidth?: number;
13
+ }
14
+
15
+ export default function DefaultCircularProgress({
16
+ current,
17
+ total,
18
+ size = 62,
19
+ strokeWidth = 3,
20
+ }: CircularProgressProps) {
21
+ const radius = calculateRadius(size, strokeWidth);
22
+ const circumference = calculateCircumference(radius);
23
+ const percentage = calculatePercentage(current, total);
24
+ const offset = calculateCircularProgressOffset(percentage, circumference);
25
+
26
+ return (
27
+ <div
28
+ className="relative flex items-center justify-center"
29
+ style={{ width: size, height: size }}
30
+ role="progressbar"
31
+ aria-valuenow={current}
32
+ aria-valuemin={0}
33
+ aria-valuemax={total}
34
+ aria-label="Progresso de exportação"
35
+ >
36
+ <svg width={size} height={size} className="absolute">
37
+ <circle
38
+ cx={size / 2}
39
+ cy={size / 2}
40
+ r={radius}
41
+ stroke="var(--color-pages-300)"
42
+ strokeWidth={strokeWidth}
43
+ fill="none"
44
+ strokeDasharray={circumference}
45
+ strokeDashoffset={offset}
46
+ strokeLinecap="round"
47
+ transform={`rotate(-90 ${size / 2} ${size / 2})`}
48
+ className="transition-all duration-300 ease-in-out"
49
+ />
50
+ </svg>
51
+ </div>
52
+ );
53
+ }
@@ -0,0 +1,38 @@
1
+ "use client"
2
+
3
+ import * as React from "react"
4
+ import * as ProgressPrimitive from "@radix-ui/react-progress"
5
+ import { cn } from "../../../infra/utils/clsx"
6
+
7
+ interface ProgressProps extends React.ComponentProps<typeof ProgressPrimitive.Root> {
8
+ indicatorColor?: string
9
+ }
10
+
11
+ function Progress({
12
+ className,
13
+ value,
14
+ indicatorColor,
15
+ ...props
16
+ }: ProgressProps) {
17
+ return (
18
+ <ProgressPrimitive.Root
19
+ data-slot="progress"
20
+ className={cn(
21
+ "bg-primary/20 relative h-2 w-full overflow-hidden rounded-full",
22
+ className
23
+ )}
24
+ {...props}
25
+ >
26
+ <ProgressPrimitive.Indicator
27
+ data-slot="progress-indicator"
28
+ className={cn(
29
+ "bg-primary h-full w-full flex-1 transition-all rounded-full",
30
+ indicatorColor
31
+ )}
32
+ style={{ transform: `translateX(-${100 - (value || 0)}%)` }}
33
+ />
34
+ </ProgressPrimitive.Root>
35
+ )
36
+ }
37
+
38
+ export { Progress }
@@ -0,0 +1,99 @@
1
+ "use client"
2
+
3
+ import * as React from "react"
4
+ import { cva, type VariantProps } from "class-variance-authority"
5
+ import { CheckCircle, XCircle, AlertCircle, Info, Circle, X } from "lucide-react"
6
+ import { toast } from "sonner"
7
+ import { cn } from "../../../infra/utils/clsx"
8
+ import { Button } from "../buttons/Button"
9
+
10
+ const toastVariants = cva(
11
+ "w-full bg-white rounded-lg p-4 shadow-lg backdrop-blur-sm transition-all",
12
+ {
13
+ variants: {
14
+ variant: {
15
+ success: "",
16
+ error: "",
17
+ warning: "",
18
+ info: "",
19
+ default: "",
20
+ },
21
+ },
22
+ defaultVariants: {
23
+ variant: "default",
24
+ },
25
+ }
26
+ )
27
+
28
+ const toastIconContainerVariants = cva(
29
+ "size-10 rounded-lg flex items-center justify-center shrink-0",
30
+ {
31
+ variants: {
32
+ variant: {
33
+ success: "bg-green-50 text-green-500",
34
+ error: "bg-red-50 text-red-500",
35
+ warning: "bg-yellow-50 text-yellow-400",
36
+ info: "bg-pages-50 text-pages-500",
37
+ default: "bg-gray-50 text-gray-950",
38
+ },
39
+ },
40
+ defaultVariants: {
41
+ variant: "default",
42
+ },
43
+ }
44
+ )
45
+
46
+ const TOAST_ICONS = {
47
+ success: CheckCircle,
48
+ error: XCircle,
49
+ warning: AlertCircle,
50
+ info: Info,
51
+ default: Circle,
52
+ } as const
53
+
54
+ interface ToastProps extends VariantProps<typeof toastIconContainerVariants> {
55
+ message?: React.ReactNode
56
+ icon?: React.ReactNode
57
+ children?: React.ReactNode
58
+ className?: string
59
+ toastId?: string | number
60
+ }
61
+
62
+ function Toast({
63
+ variant = "default",
64
+ message,
65
+ icon,
66
+ children,
67
+ className,
68
+ toastId,
69
+ }: ToastProps) {
70
+ const Icon = variant ? TOAST_ICONS[variant] : null
71
+
72
+ return (
73
+ <div data-slot="toast" className={cn(toastVariants({ variant }), className, "md:min-w-[310px] lg:min-w-[310px]")}>
74
+ {children ? (
75
+ children
76
+ ) : (
77
+ <div className="flex items-center gap-3 flex-1 min-w-0">
78
+ <div className={cn(toastIconContainerVariants({ variant }))}>
79
+ {icon || (Icon && <Icon size={16} />)}
80
+ </div>
81
+
82
+ <span className="w-full text-gray-600 paragraph-small-medium">
83
+ {message}
84
+ </span>
85
+ <Button
86
+ variant={"ghost"}
87
+ className="size-8 rounded-full"
88
+ onClick={() => toastId && toast.dismiss(toastId)}
89
+ >
90
+ <X size={18} />
91
+ </Button>
92
+ </div>
93
+ )}
94
+ </div>
95
+ )
96
+ }
97
+
98
+ export { Toast, toastVariants, toastIconContainerVariants }
99
+ export type { ToastProps }
@@ -0,0 +1,226 @@
1
+ "use client"
2
+
3
+ import * as React from "react"
4
+ import { ptBR } from "date-fns/locale"
5
+ import {
6
+ ChevronDownIcon,
7
+ ChevronLeftIcon,
8
+ ChevronRightIcon,
9
+ } from "lucide-react"
10
+ import { DayButton, DayPicker, getDefaultClassNames } from "react-day-picker"
11
+ import { Button, buttonVariants } from "../buttons/Button"
12
+ import { cn } from "../../../infra/utils/clsx"
13
+
14
+ function Calendar({
15
+ className,
16
+ classNames,
17
+ showOutsideDays = true,
18
+ captionLayout = "label",
19
+ buttonVariant = "ghost",
20
+ formatters,
21
+ components,
22
+ ...props
23
+ }: React.ComponentProps<typeof DayPicker> & {
24
+ buttonVariant?: React.ComponentProps<typeof Button>["variant"]
25
+ }) {
26
+ const defaultClassNames = getDefaultClassNames()
27
+
28
+ return (
29
+ <DayPicker
30
+ locale={ptBR}
31
+ showOutsideDays={showOutsideDays}
32
+ className={cn(
33
+ "bg-background group/calendar p-3 [--cell-size:--spacing(8)] in-data-[slot=card-content]:bg-transparent in-data-[slot=popover-content]:bg-transparent",
34
+ String.raw`rtl:**:[.rdp-button\_next>svg]:rotate-180`,
35
+ String.raw`rtl:**:[.rdp-button\_previous>svg]:rotate-180`,
36
+ className
37
+ )}
38
+ captionLayout={captionLayout}
39
+ formatters={{
40
+ formatWeekdayName: (date) => {
41
+ const weekdays = ['D', 'S', 'T', 'Q', 'Q', 'S', 'S'];
42
+ return weekdays[date.getDay()];
43
+ },
44
+ formatCaption: (date) => {
45
+ const month = date.toLocaleDateString('pt-BR', { month: 'long' });
46
+ const year = date.getFullYear();
47
+ return `${month.charAt(0).toUpperCase() + month.slice(1)} / ${year}`;
48
+ },
49
+ formatMonthDropdown: (date) =>
50
+ date.toLocaleString("default", { month: "short" }),
51
+ ...formatters,
52
+ }}
53
+ classNames={{
54
+ root: cn("w-fit", defaultClassNames.root),
55
+ months: cn(
56
+ "flex gap-4 flex-col md:flex-row relative",
57
+ defaultClassNames.months
58
+ ),
59
+ month: cn("flex flex-col w-full gap-4", defaultClassNames.month),
60
+ nav: cn(
61
+ "flex items-center gap-1 w-auto absolute top-0 right-0",
62
+ defaultClassNames.nav
63
+ ),
64
+ button_previous: cn(
65
+ buttonVariants({ variant: buttonVariant }),
66
+ "size-(--cell-size) aria-disabled:opacity-50 p-0 select-none",
67
+ defaultClassNames.button_previous
68
+ ),
69
+ button_next: cn(
70
+ buttonVariants({ variant: buttonVariant }),
71
+ "size-(--cell-size) aria-disabled:opacity-50 p-0 select-none",
72
+ defaultClassNames.button_next
73
+ ),
74
+ month_caption: cn(
75
+ "flex items-center justify-start h-(--cell-size) w-full pr-(--cell-size)",
76
+ defaultClassNames.month_caption
77
+ ),
78
+ dropdowns: cn(
79
+ "w-full flex items-center text-sm font-medium justify-center h-(--cell-size) gap-1.5",
80
+ defaultClassNames.dropdowns
81
+ ),
82
+ dropdown_root: cn(
83
+ "relative has-focus:border-ring border border-input shadow-xs has-focus:ring-ring/50 has-focus:ring-[3px] rounded-md",
84
+ defaultClassNames.dropdown_root
85
+ ),
86
+ dropdown: cn(
87
+ "absolute bg-popover inset-0 opacity-0",
88
+ defaultClassNames.dropdown
89
+ ),
90
+ caption_label: cn(
91
+ "select-none font-medium",
92
+ captionLayout === "label"
93
+ ? "text-sm"
94
+ : "rounded-md pl-2 pr-1 flex items-center gap-1 text-sm h-8 [&>svg]:text-muted-foreground [&>svg]:size-3.5",
95
+ defaultClassNames.caption_label
96
+ ),
97
+ table: "w-full border-collapse",
98
+ weekdays: cn("flex", defaultClassNames.weekdays),
99
+ weekday: cn(
100
+ "text-gray-500 font-medium text-sm w-10 h-10 flex items-center justify-center uppercase",
101
+ defaultClassNames.weekday
102
+ ),
103
+ week: cn("flex w-full mt-2", defaultClassNames.week),
104
+ week_number_header: cn(
105
+ "select-none w-(--cell-size)",
106
+ defaultClassNames.week_number_header
107
+ ),
108
+ week_number: cn(
109
+ "text-[0.8rem] select-none text-muted-foreground",
110
+ defaultClassNames.week_number
111
+ ),
112
+ day: cn(
113
+ "relative w-full h-full p-0 text-center [&:last-child[data-selected=true]_button]:rounded-r-md group/day aspect-square select-none",
114
+ props.showWeekNumber
115
+ ? "[&:nth-child(2)[data-selected=true]_button]:rounded-l-md"
116
+ : "[&:first-child[data-selected=true]_button]:rounded-l-md",
117
+ defaultClassNames.day
118
+ ),
119
+ range_start: cn(
120
+ "rounded-l-md bg-accent",
121
+ defaultClassNames.range_start
122
+ ),
123
+ range_middle: cn("rounded-none", defaultClassNames.range_middle),
124
+ range_end: cn("rounded-r-md bg-accent", defaultClassNames.range_end),
125
+ today: cn(
126
+ "bg-accent text-accent-foreground rounded-md data-[selected=true]:rounded-none",
127
+ defaultClassNames.today
128
+ ),
129
+ outside: cn(
130
+ "text-muted-foreground aria-selected:text-muted-foreground",
131
+ defaultClassNames.outside
132
+ ),
133
+ disabled: cn(
134
+ "text-muted-foreground opacity-50",
135
+ defaultClassNames.disabled
136
+ ),
137
+ hidden: cn("invisible", defaultClassNames.hidden),
138
+ ...classNames,
139
+ }}
140
+ components={{
141
+ Root: ({ className, rootRef, ...props }) => {
142
+ return (
143
+ <div
144
+ data-slot="calendar"
145
+ ref={rootRef}
146
+ className={cn(className)}
147
+ {...props}
148
+ />
149
+ )
150
+ },
151
+ Chevron: ({ className, orientation, ...props }) => {
152
+ if (orientation === "left") {
153
+ return (
154
+ <ChevronLeftIcon className={cn("size-4", className)} {...props} />
155
+ )
156
+ }
157
+
158
+ if (orientation === "right") {
159
+ return (
160
+ <ChevronRightIcon
161
+ className={cn("size-4", className)}
162
+ {...props}
163
+ />
164
+ )
165
+ }
166
+
167
+ return (
168
+ <ChevronDownIcon className={cn("size-4", className)} {...props} />
169
+ )
170
+ },
171
+ DayButton: CalendarDayButton,
172
+ WeekNumber: ({ children, ...props }) => {
173
+ return (
174
+ <td {...props}>
175
+ <div className="flex size-(--cell-size) items-center justify-center text-center">
176
+ {children}
177
+ </div>
178
+ </td>
179
+ )
180
+ },
181
+ ...components,
182
+ }}
183
+ {...props}
184
+ />
185
+ )
186
+ }
187
+
188
+ function CalendarDayButton({
189
+ className,
190
+ day,
191
+ modifiers,
192
+ ...props
193
+ }: React.ComponentProps<typeof DayButton>) {
194
+ const defaultClassNames = getDefaultClassNames()
195
+
196
+ const ref = React.useRef<HTMLButtonElement>(null)
197
+ React.useEffect(() => {
198
+ if (modifiers.focused) ref.current?.focus()
199
+ }, [modifiers.focused])
200
+
201
+ return (
202
+ <Button
203
+ ref={ref}
204
+ variant="ghost"
205
+ size="icon"
206
+ data-day={day.date.toLocaleDateString()}
207
+ data-selected-single={
208
+ modifiers.selected &&
209
+ !modifiers.range_start &&
210
+ !modifiers.range_end &&
211
+ !modifiers.range_middle
212
+ }
213
+ data-range-start={modifiers.range_start}
214
+ data-range-end={modifiers.range_end}
215
+ data-range-middle={modifiers.range_middle}
216
+ className={cn(
217
+ "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 dark:hover:text-accent-foreground 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",
218
+ defaultClassNames.day,
219
+ className
220
+ )}
221
+ {...props}
222
+ />
223
+ )
224
+ }
225
+
226
+ export { Calendar, CalendarDayButton }
@@ -0,0 +1,31 @@
1
+ "use client";
2
+
3
+ import * as React from "react";
4
+ import * as CheckboxPrimitive from "@radix-ui/react-checkbox";
5
+ import { CheckIcon } from "lucide-react";
6
+ import { cn } from "../../../infra/utils/clsx";
7
+
8
+ function Checkbox({
9
+ className,
10
+ ...props
11
+ }: React.ComponentProps<typeof CheckboxPrimitive.Root>) {
12
+ return (
13
+ <CheckboxPrimitive.Root
14
+ data-slot="checkbox"
15
+ className={cn(
16
+ "peer border-input dark:bg-input/30 data-[state=checked]:bg-primary data-[state=checked]:text-primary-foreground dark:data-[state=checked]:bg-primary data-[state=checked]:border-primary focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive size-4.5 shrink-0 rounded-[4px] border-[1.6px] shadow-xs transition-shadow outline-none focus-visible:ring-[3px] disabled:cursor-not-allowed disabled:opacity-50 hover:border-gray-950 cursor-pointer",
17
+ className,
18
+ )}
19
+ {...props}
20
+ >
21
+ <CheckboxPrimitive.Indicator
22
+ data-slot="checkbox-indicator"
23
+ className="grid place-content-center text-current transition-none"
24
+ >
25
+ <CheckIcon className="size-3 text-current" />
26
+ </CheckboxPrimitive.Indicator>
27
+ </CheckboxPrimitive.Root>
28
+ );
29
+ }
30
+
31
+ export { Checkbox };