@phsa.tec/design-system-react 0.1.6 → 0.1.9

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 (217) hide show
  1. package/README.md +390 -209
  2. package/dist/index.d.mts +485 -0
  3. package/dist/index.d.ts +485 -0
  4. package/dist/index.js +4259 -0
  5. package/dist/index.js.map +1 -0
  6. package/dist/index.mjs +4186 -0
  7. package/dist/index.mjs.map +1 -0
  8. package/dist/styles.css +2534 -0
  9. package/dist/styles.css.map +1 -0
  10. package/dist/styles.d.mts +2 -0
  11. package/dist/styles.d.ts +2 -0
  12. package/package.json +46 -6
  13. package/.eslintrc.json +0 -7
  14. package/.github/workflows/deploy-storybook.yml +0 -75
  15. package/.storybook/main.ts +0 -16
  16. package/.storybook/preview.ts +0 -15
  17. package/components.json +0 -21
  18. package/jest.config.ts +0 -25
  19. package/next.config.ts +0 -7
  20. package/postcss.config.mjs +0 -8
  21. package/public/file.svg +0 -1
  22. package/public/globe.svg +0 -1
  23. package/public/next.svg +0 -1
  24. package/public/vercel.svg +0 -1
  25. package/public/window.svg +0 -1
  26. package/src/app/columns.tsx +0 -178
  27. package/src/app/favicon.ico +0 -0
  28. package/src/app/fonts/GeistMonoVF.woff +0 -0
  29. package/src/app/fonts/GeistVF.woff +0 -0
  30. package/src/app/globals.css +0 -94
  31. package/src/app/layout.tsx +0 -35
  32. package/src/app/page.tsx +0 -7
  33. package/src/components/actions/AlertDialog/AlertDialog.tsx +0 -45
  34. package/src/components/actions/AlertDialog/alert-dialog.stories.tsx +0 -21
  35. package/src/components/actions/AlertDialog/index.ts +0 -1
  36. package/src/components/actions/Button/Button.stories.ts +0 -38
  37. package/src/components/actions/Button/Button.tsx +0 -23
  38. package/src/components/actions/Button/index.ts +0 -1
  39. package/src/components/actions/Collapsible/index.ts +0 -1
  40. package/src/components/actions/Dialog/Dialog.stories.tsx +0 -70
  41. package/src/components/actions/Dialog/Dialog.tsx +0 -87
  42. package/src/components/actions/Dialog/components/DialogWithActions/index.tsx +0 -40
  43. package/src/components/actions/Dialog/index.ts +0 -1
  44. package/src/components/actions/Steps/Steps.stories.tsx +0 -25
  45. package/src/components/actions/Steps/Steps.tsx +0 -51
  46. package/src/components/actions/Steps/index.ts +0 -1
  47. package/src/components/actions/index.ts +0 -5
  48. package/src/components/dataDisplay/Avatar/Avatar.stories.tsx +0 -22
  49. package/src/components/dataDisplay/Avatar/Avatar.tsx +0 -21
  50. package/src/components/dataDisplay/Avatar/index.ts +0 -2
  51. package/src/components/dataDisplay/Badge/Badge.stories.tsx +0 -36
  52. package/src/components/dataDisplay/Badge/index.ts +0 -1
  53. package/src/components/dataDisplay/Card/Card.stories.tsx +0 -24
  54. package/src/components/dataDisplay/Card/Card.tsx +0 -34
  55. package/src/components/dataDisplay/Card/index.ts +0 -1
  56. package/src/components/dataDisplay/DataPairList/DataPairList.tsx +0 -56
  57. package/src/components/dataDisplay/DataPairList/data-pair-list.stories.tsx +0 -87
  58. package/src/components/dataDisplay/DataPairList/index.ts +0 -2
  59. package/src/components/dataDisplay/DataPairList/types.ts +0 -10
  60. package/src/components/dataDisplay/DropDownMenu/index.ts +0 -1
  61. package/src/components/dataDisplay/ErrorMessage/ErrorMessage.tsx +0 -6
  62. package/src/components/dataDisplay/ErrorMessage/index.ts +0 -1
  63. package/src/components/dataDisplay/Icon/Icon.stories.tsx +0 -21
  64. package/src/components/dataDisplay/Icon/Icon.tsx +0 -47
  65. package/src/components/dataDisplay/Icon/index.ts +0 -1
  66. package/src/components/dataDisplay/Icon/types.ts +0 -6
  67. package/src/components/dataDisplay/Label/Label.stories.tsx +0 -21
  68. package/src/components/dataDisplay/Label/Label.tsx +0 -10
  69. package/src/components/dataDisplay/Label/index.ts +0 -1
  70. package/src/components/dataDisplay/Table/Table.tsx +0 -173
  71. package/src/components/dataDisplay/Table/columns.tsx +0 -223
  72. package/src/components/dataDisplay/Table/components/DynamicTable/data-table-column-header.tsx +0 -72
  73. package/src/components/dataDisplay/Table/components/DynamicTable/data-table-pagination.tsx +0 -91
  74. package/src/components/dataDisplay/Table/components/DynamicTable/data-table-toolbar.tsx +0 -17
  75. package/src/components/dataDisplay/Table/components/DynamicTable/data-table-view-options.tsx +0 -58
  76. package/src/components/dataDisplay/Table/components/DynamicTable/data-table.stories.tsx +0 -118
  77. package/src/components/dataDisplay/Table/components/DynamicTable/index.tsx +0 -136
  78. package/src/components/dataDisplay/Table/components/DynamicTable/types.ts +0 -43
  79. package/src/components/dataDisplay/Table/custom/CustomTable/data-table-column-header.tsx +0 -71
  80. package/src/components/dataDisplay/Table/custom/CustomTable/data-table-faceted-filter.tsx +0 -147
  81. package/src/components/dataDisplay/Table/custom/CustomTable/data-table-pagination.tsx +0 -97
  82. package/src/components/dataDisplay/Table/custom/CustomTable/data-table-row-actions.tsx +0 -78
  83. package/src/components/dataDisplay/Table/custom/CustomTable/data-table-toolbar.tsx +0 -60
  84. package/src/components/dataDisplay/Table/custom/CustomTable/data-table-view-options.tsx +0 -59
  85. package/src/components/dataDisplay/Table/custom/CustomTable/data-table.tsx +0 -145
  86. package/src/components/dataDisplay/Table/custom/CustomTable/data.ts +0 -71
  87. package/src/components/dataDisplay/Table/custom/CustomTable/index.tsx +0 -34
  88. package/src/components/dataDisplay/Table/custom/CustomTable/schema.ts +0 -11
  89. package/src/components/dataDisplay/Table/index.ts +0 -2
  90. package/src/components/dataDisplay/Table/table.stories.tsx +0 -147
  91. package/src/components/dataDisplay/Table/types.ts +0 -15
  92. package/src/components/dataDisplay/Tabs/Tabs.stories.tsx +0 -34
  93. package/src/components/dataDisplay/Tabs/Tabs.tsx +0 -53
  94. package/src/components/dataDisplay/Tabs/index.ts +0 -1
  95. package/src/components/dataDisplay/Text/Text.stories.tsx +0 -66
  96. package/src/components/dataDisplay/Text/Text.tsx +0 -56
  97. package/src/components/dataDisplay/Text/index.ts +0 -1
  98. package/src/components/dataDisplay/index.ts +0 -8
  99. package/src/components/dataInput/Input/components/Input/Input.stories.tsx +0 -99
  100. package/src/components/dataInput/Input/components/Input/InputBase.tsx +0 -50
  101. package/src/components/dataInput/Input/components/Input/__tests__/input.test.tsx +0 -38
  102. package/src/components/dataInput/Input/components/Input/index.tsx +0 -48
  103. package/src/components/dataInput/Input/components/Input/types.ts +0 -15
  104. package/src/components/dataInput/Input/components/InputBase/index.tsx +0 -31
  105. package/src/components/dataInput/Input/components/MaskInput/__tests__/mask-input.test.tsx +0 -77
  106. package/src/components/dataInput/Input/components/MaskInput/index.ts +0 -1
  107. package/src/components/dataInput/Input/components/MaskInput/mask-input.stories.tsx +0 -85
  108. package/src/components/dataInput/Input/components/MaskInput/mask-input.tsx +0 -73
  109. package/src/components/dataInput/Input/components/MultipleInput/MultipleInput.tsx +0 -105
  110. package/src/components/dataInput/Input/components/MultipleInput/MultipleInputBase.tsx +0 -100
  111. package/src/components/dataInput/Input/components/MultipleInput/MultipleMaskInput.tsx +0 -35
  112. package/src/components/dataInput/Input/components/MultipleInput/MultipleNumberInput.tsx +0 -35
  113. package/src/components/dataInput/Input/components/MultipleInput/__tests__/multiple-input.test.tsx +0 -152
  114. package/src/components/dataInput/Input/components/MultipleInput/index.ts +0 -2
  115. package/src/components/dataInput/Input/components/MultipleInput/multiple-input.stories.tsx +0 -96
  116. package/src/components/dataInput/Input/components/NumberInput/__tests__/number-input.test.tsx +0 -175
  117. package/src/components/dataInput/Input/components/NumberInput/index.ts +0 -1
  118. package/src/components/dataInput/Input/components/NumberInput/number-input.stories.tsx +0 -76
  119. package/src/components/dataInput/Input/components/NumberInput/number-input.tsx +0 -70
  120. package/src/components/dataInput/Input/index.ts +0 -4
  121. package/src/components/dataInput/Select/MultiSelect/MultiSelect.stories.tsx +0 -119
  122. package/src/components/dataInput/Select/MultiSelect/MultiSelectBase.tsx +0 -135
  123. package/src/components/dataInput/Select/MultiSelect/index.tsx +0 -75
  124. package/src/components/dataInput/Select/Select.stories.tsx +0 -61
  125. package/src/components/dataInput/Select/Select.tsx +0 -73
  126. package/src/components/dataInput/Select/SelectBase.tsx +0 -58
  127. package/src/components/dataInput/Select/index.ts +0 -2
  128. package/src/components/dataInput/Switch/Switch.stories.tsx +0 -75
  129. package/src/components/dataInput/Switch/Switch.tsx +0 -52
  130. package/src/components/dataInput/Switch/index.ts +0 -1
  131. package/src/components/dataInput/checkbox/Checkbox.tsx +0 -57
  132. package/src/components/dataInput/checkbox/Checkbox_old.tsx +0 -58
  133. package/src/components/dataInput/checkbox/Checkout.stories.tsx +0 -62
  134. package/src/components/dataInput/checkbox/index.ts +0 -1
  135. package/src/components/dataInput/form/Form.tsx +0 -47
  136. package/src/components/dataInput/form/index.ts +0 -3
  137. package/src/components/dataInput/index.ts +0 -5
  138. package/src/components/feedback/ErrorLabel/index.tsx +0 -24
  139. package/src/components/feedback/Spinner/index.ts +0 -1
  140. package/src/components/feedback/Toast/Toast.stories.tsx +0 -45
  141. package/src/components/feedback/Toast/index.ts +0 -2
  142. package/src/components/feedback/index.ts +0 -2
  143. package/src/components/index.ts +0 -6
  144. package/src/components/layout/Crud/components/Table/index.tsx +0 -183
  145. package/src/components/layout/Crud/components/Table/types.ts +0 -15
  146. package/src/components/layout/Crud/crud.stories.tsx +0 -317
  147. package/src/components/layout/Crud/hook/useCrudLayout/index.tsx +0 -94
  148. package/src/components/layout/Crud/hook/useRequest/index.tsx +0 -156
  149. package/src/components/layout/Crud/index.tsx +0 -295
  150. package/src/components/layout/Crud/store/CrudLayoutStore.ts +0 -75
  151. package/src/components/layout/Crud/types.ts +0 -14
  152. package/src/components/layout/Drawer/CustomDrawer/index.tsx +0 -33
  153. package/src/components/layout/Drawer/Drawer.stories.tsx +0 -80
  154. package/src/components/layout/Drawer/index.ts +0 -2
  155. package/src/components/layout/PageLayout/PageLayout.stories.tsx +0 -42
  156. package/src/components/layout/PageLayout/index.tsx +0 -28
  157. package/src/components/layout/Separator/index.ts +0 -1
  158. package/src/components/layout/Sheet/Sheet.stories.tsx +0 -28
  159. package/src/components/layout/Sheet/Sheet.tsx +0 -22
  160. package/src/components/layout/Sheet/index.ts +0 -1
  161. package/src/components/layout/Sidebar/Sidebar.stories.tsx +0 -116
  162. package/src/components/layout/Sidebar/Sidebar.tsx +0 -50
  163. package/src/components/layout/Sidebar/components/app-sidebar.tsx +0 -203
  164. package/src/components/layout/Sidebar/components/footer-sidebar.tsx +0 -17
  165. package/src/components/layout/Sidebar/components/header-sidebar.tsx +0 -90
  166. package/src/components/layout/Sidebar/components/menus.tsx +0 -55
  167. package/src/components/layout/Sidebar/components/nav-projects.tsx +0 -88
  168. package/src/components/layout/Sidebar/components/nav-user.tsx +0 -114
  169. package/src/components/layout/Sidebar/components/team-switcher.tsx +0 -85
  170. package/src/components/layout/Sidebar/index.ts +0 -2
  171. package/src/components/layout/Sidebar/provider/index.tsx +0 -51
  172. package/src/components/layout/Tabs/Tabs.tsx +0 -51
  173. package/src/components/layout/Tabs/index.ts +0 -1
  174. package/src/components/layout/Tabs/tabs.stories.tsx +0 -57
  175. package/src/components/layout/index.ts +0 -6
  176. package/src/components/navigation/Breadcrumbs/Breadcrumbs.tsx +0 -66
  177. package/src/components/navigation/Breadcrumbs/index.ts +0 -2
  178. package/src/components/navigation/index.ts +0 -1
  179. package/src/components/ui/alert-dialog.tsx +0 -141
  180. package/src/components/ui/alert.tsx +0 -59
  181. package/src/components/ui/avatar.tsx +0 -50
  182. package/src/components/ui/badge.tsx +0 -40
  183. package/src/components/ui/breadcrumb.tsx +0 -115
  184. package/src/components/ui/button.tsx +0 -57
  185. package/src/components/ui/card.tsx +0 -83
  186. package/src/components/ui/checkbox.tsx +0 -34
  187. package/src/components/ui/collapsible.tsx +0 -11
  188. package/src/components/ui/command.tsx +0 -153
  189. package/src/components/ui/dialog.tsx +0 -124
  190. package/src/components/ui/drawer.tsx +0 -117
  191. package/src/components/ui/dropdown-menu.tsx +0 -201
  192. package/src/components/ui/form.tsx +0 -179
  193. package/src/components/ui/input.tsx +0 -24
  194. package/src/components/ui/label.tsx +0 -30
  195. package/src/components/ui/popover.tsx +0 -33
  196. package/src/components/ui/select.tsx +0 -161
  197. package/src/components/ui/separator.tsx +0 -31
  198. package/src/components/ui/sheet.tsx +0 -140
  199. package/src/components/ui/sidebar.tsx +0 -763
  200. package/src/components/ui/skeleton.tsx +0 -15
  201. package/src/components/ui/sonner.tsx +0 -31
  202. package/src/components/ui/spinner.tsx +0 -54
  203. package/src/components/ui/switch.tsx +0 -33
  204. package/src/components/ui/table.tsx +0 -120
  205. package/src/components/ui/tabs.tsx +0 -55
  206. package/src/components/ui/toast.tsx +0 -130
  207. package/src/components/ui/toaster.tsx +0 -35
  208. package/src/components/ui/tooltip.tsx +0 -32
  209. package/src/hooks/use-conditional-controller.tsx +0 -35
  210. package/src/hooks/use-mask.tsx +0 -116
  211. package/src/hooks/use-mobile.tsx +0 -19
  212. package/src/hooks/use-toast.ts +0 -191
  213. package/src/index.ts +0 -1
  214. package/src/introduction.mdx +0 -132
  215. package/src/lib/utils.ts +0 -6
  216. package/tailwind.config.ts +0 -83
  217. package/tsconfig.json +0 -27
@@ -1,15 +0,0 @@
1
- import { cn } from "../../lib/utils";
2
-
3
- function Skeleton({
4
- className,
5
- ...props
6
- }: React.HTMLAttributes<HTMLDivElement>) {
7
- return (
8
- <div
9
- className={cn("animate-pulse rounded-md bg-primary/10", className)}
10
- {...props}
11
- />
12
- );
13
- }
14
-
15
- export { Skeleton };
@@ -1,31 +0,0 @@
1
- "use client"
2
-
3
- import { useTheme } from "next-themes"
4
- import { Toaster as Sonner } from "sonner"
5
-
6
- type ToasterProps = React.ComponentProps<typeof Sonner>
7
-
8
- const Toaster = ({ ...props }: ToasterProps) => {
9
- const { theme = "system" } = useTheme()
10
-
11
- return (
12
- <Sonner
13
- theme={theme as ToasterProps["theme"]}
14
- className="toaster group"
15
- toastOptions={{
16
- classNames: {
17
- toast:
18
- "group toast group-[.toaster]:bg-background group-[.toaster]:text-foreground group-[.toaster]:border-border group-[.toaster]:shadow-lg",
19
- description: "group-[.toast]:text-muted-foreground",
20
- actionButton:
21
- "group-[.toast]:bg-primary group-[.toast]:text-primary-foreground",
22
- cancelButton:
23
- "group-[.toast]:bg-muted group-[.toast]:text-muted-foreground",
24
- },
25
- }}
26
- {...props}
27
- />
28
- )
29
- }
30
-
31
- export { Toaster }
@@ -1,54 +0,0 @@
1
- import React from "react";
2
- import { cn } from "../../lib/utils";
3
- import { VariantProps, cva } from "class-variance-authority";
4
- import { Loader } from "lucide-react";
5
- import { Icon } from "../dataDisplay";
6
-
7
- const spinnerVariants = cva("flex-col items-center justify-center", {
8
- variants: {
9
- show: {
10
- true: "flex",
11
- false: "hidden",
12
- },
13
- },
14
- defaultVariants: {
15
- show: true,
16
- },
17
- });
18
-
19
- const loaderVariants = cva("animate-spin text-primary", {
20
- variants: {
21
- size: {
22
- small: "size-6",
23
- medium: "size-8",
24
- large: "size-12",
25
- },
26
- },
27
- defaultVariants: {
28
- size: "medium",
29
- },
30
- });
31
-
32
- interface SpinnerContentProps
33
- extends VariantProps<typeof spinnerVariants>,
34
- VariantProps<typeof loaderVariants> {
35
- className?: string;
36
- children?: React.ReactNode;
37
- }
38
-
39
- export function Spinner({
40
- size,
41
- show,
42
- children,
43
- className,
44
- }: SpinnerContentProps) {
45
- return (
46
- <span className={spinnerVariants({ show })}>
47
- <Icon
48
- name="FaSpinner"
49
- className={cn(loaderVariants({ size }), className)}
50
- />
51
- {children}
52
- </span>
53
- );
54
- }
@@ -1,33 +0,0 @@
1
- "use client";
2
-
3
- import * as React from "react";
4
- import * as SwitchPrimitives from "@radix-ui/react-switch";
5
-
6
- import { cn } from "../../lib/utils";
7
-
8
- export type SwitchProps = React.ComponentPropsWithoutRef<
9
- typeof SwitchPrimitives.Root
10
- >;
11
-
12
- const Switch = React.forwardRef<
13
- React.ElementRef<typeof SwitchPrimitives.Root>,
14
- SwitchProps
15
- >(({ className, ...props }, ref) => (
16
- <SwitchPrimitives.Root
17
- className={cn(
18
- "peer inline-flex h-5 w-9 shrink-0 cursor-pointer items-center rounded-full border-2 border-transparent shadow-sm transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-primary data-[state=unchecked]:bg-input",
19
- className
20
- )}
21
- {...props}
22
- ref={ref}
23
- >
24
- <SwitchPrimitives.Thumb
25
- className={cn(
26
- "pointer-events-none block h-4 w-4 rounded-full bg-background shadow-lg ring-0 transition-transform data-[state=checked]:translate-x-4 data-[state=unchecked]:translate-x-0"
27
- )}
28
- />
29
- </SwitchPrimitives.Root>
30
- ));
31
- Switch.displayName = SwitchPrimitives.Root.displayName;
32
-
33
- export { Switch };
@@ -1,120 +0,0 @@
1
- import * as React from "react";
2
-
3
- import { cn } from "../../lib/utils";
4
-
5
- const Table = React.forwardRef<
6
- HTMLTableElement,
7
- React.HTMLAttributes<HTMLTableElement>
8
- >(({ className, ...props }, ref) => (
9
- <div className="relative w-full overflow-auto">
10
- <table
11
- ref={ref}
12
- className={cn("w-full caption-bottom text-sm", className)}
13
- {...props}
14
- />
15
- </div>
16
- ));
17
- Table.displayName = "Table";
18
-
19
- const TableHeader = React.forwardRef<
20
- HTMLTableSectionElement,
21
- React.HTMLAttributes<HTMLTableSectionElement>
22
- >(({ className, ...props }, ref) => (
23
- <thead ref={ref} className={cn("[&_tr]:border-b", className)} {...props} />
24
- ));
25
- TableHeader.displayName = "TableHeader";
26
-
27
- const TableBody = React.forwardRef<
28
- HTMLTableSectionElement,
29
- React.HTMLAttributes<HTMLTableSectionElement>
30
- >(({ className, ...props }, ref) => (
31
- <tbody
32
- ref={ref}
33
- className={cn("[&_tr:last-child]:border-0", className)}
34
- {...props}
35
- />
36
- ));
37
- TableBody.displayName = "TableBody";
38
-
39
- const TableFooter = React.forwardRef<
40
- HTMLTableSectionElement,
41
- React.HTMLAttributes<HTMLTableSectionElement>
42
- >(({ className, ...props }, ref) => (
43
- <tfoot
44
- ref={ref}
45
- className={cn(
46
- "border-t bg-muted/50 font-medium [&>tr]:last:border-b-0",
47
- className
48
- )}
49
- {...props}
50
- />
51
- ));
52
- TableFooter.displayName = "TableFooter";
53
-
54
- const TableRow = React.forwardRef<
55
- HTMLTableRowElement,
56
- React.HTMLAttributes<HTMLTableRowElement>
57
- >(({ className, ...props }, ref) => (
58
- <tr
59
- ref={ref}
60
- className={cn(
61
- "border-b transition-colors hover:bg-muted/50 data-[state=selected]:bg-muted",
62
- className
63
- )}
64
- {...props}
65
- />
66
- ));
67
- TableRow.displayName = "TableRow";
68
-
69
- const TableHead = React.forwardRef<
70
- HTMLTableCellElement,
71
- React.ThHTMLAttributes<HTMLTableCellElement>
72
- >(({ className, ...props }, ref) => (
73
- <th
74
- ref={ref}
75
- className={cn(
76
- "h-10 px-2 text-left align-middle font-medium text-muted-foreground [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px]",
77
- className
78
- )}
79
- {...props}
80
- />
81
- ));
82
- TableHead.displayName = "TableHead";
83
-
84
- const TableCell = React.forwardRef<
85
- HTMLTableCellElement,
86
- React.TdHTMLAttributes<HTMLTableCellElement>
87
- >(({ className, ...props }, ref) => (
88
- <td
89
- ref={ref}
90
- className={cn(
91
- "p-2 align-middle [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px]",
92
- className
93
- )}
94
- {...props}
95
- />
96
- ));
97
- TableCell.displayName = "TableCell";
98
-
99
- const TableCaption = React.forwardRef<
100
- HTMLTableCaptionElement,
101
- React.HTMLAttributes<HTMLTableCaptionElement>
102
- >(({ className, ...props }, ref) => (
103
- <caption
104
- ref={ref}
105
- className={cn("mt-4 text-sm text-muted-foreground", className)}
106
- {...props}
107
- />
108
- ));
109
- TableCaption.displayName = "TableCaption";
110
-
111
- export {
112
- Table,
113
- TableHeader,
114
- TableBody,
115
- TableFooter,
116
- TableHead,
117
- TableRow,
118
- TableCell,
119
- TableCaption,
120
- };
@@ -1,55 +0,0 @@
1
- "use client";
2
-
3
- import * as React from "react";
4
- import * as TabsPrimitive from "@radix-ui/react-tabs";
5
-
6
- import { cn } from "../../lib/utils";
7
-
8
- const Tabs = TabsPrimitive.Root;
9
-
10
- const TabsList = React.forwardRef<
11
- React.ElementRef<typeof TabsPrimitive.List>,
12
- React.ComponentPropsWithoutRef<typeof TabsPrimitive.List>
13
- >(({ className, ...props }, ref) => (
14
- <TabsPrimitive.List
15
- ref={ref}
16
- className={cn(
17
- "inline-flex h-9 items-center justify-center rounded-lg bg-muted p-1 text-muted-foreground",
18
- className
19
- )}
20
- {...props}
21
- />
22
- ));
23
- TabsList.displayName = TabsPrimitive.List.displayName;
24
-
25
- const TabsTrigger = React.forwardRef<
26
- React.ElementRef<typeof TabsPrimitive.Trigger>,
27
- React.ComponentPropsWithoutRef<typeof TabsPrimitive.Trigger>
28
- >(({ className, ...props }, ref) => (
29
- <TabsPrimitive.Trigger
30
- ref={ref}
31
- className={cn(
32
- "inline-flex items-center justify-center whitespace-nowrap rounded-md px-3 py-1 text-sm font-medium ring-offset-background transition-all focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 data-[state=active]:bg-background data-[state=active]:text-foreground data-[state=active]:shadow",
33
- className
34
- )}
35
- {...props}
36
- />
37
- ));
38
- TabsTrigger.displayName = TabsPrimitive.Trigger.displayName;
39
-
40
- const TabsContent = React.forwardRef<
41
- React.ElementRef<typeof TabsPrimitive.Content>,
42
- React.ComponentPropsWithoutRef<typeof TabsPrimitive.Content>
43
- >(({ className, ...props }, ref) => (
44
- <TabsPrimitive.Content
45
- ref={ref}
46
- className={cn(
47
- "mt-2 ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2",
48
- className
49
- )}
50
- {...props}
51
- />
52
- ));
53
- TabsContent.displayName = TabsPrimitive.Content.displayName;
54
-
55
- export { Tabs, TabsList, TabsTrigger, TabsContent };
@@ -1,130 +0,0 @@
1
- "use client";
2
-
3
- import * as React from "react";
4
- import * as ToastPrimitives from "@radix-ui/react-toast";
5
- import { cva, type VariantProps } from "class-variance-authority";
6
- import { X } from "lucide-react";
7
-
8
- import { cn } from "../../lib/utils";
9
-
10
- const ToastProvider = ToastPrimitives.Provider;
11
-
12
- const ToastViewport = React.forwardRef<
13
- React.ElementRef<typeof ToastPrimitives.Viewport>,
14
- React.ComponentPropsWithoutRef<typeof ToastPrimitives.Viewport>
15
- >(({ className, ...props }, ref) => (
16
- <ToastPrimitives.Viewport
17
- ref={ref}
18
- className={cn(
19
- "fixed top-0 z-[100] flex max-h-screen w-full flex-col-reverse p-4 sm:bottom-0 sm:right-0 sm:top-auto sm:flex-col md:max-w-[420px]",
20
- className
21
- )}
22
- {...props}
23
- />
24
- ));
25
- ToastViewport.displayName = ToastPrimitives.Viewport.displayName;
26
-
27
- const toastVariants = cva(
28
- "group pointer-events-auto relative flex w-full items-center justify-between space-x-2 overflow-hidden rounded-md border p-4 pr-6 shadow-lg transition-all data-[swipe=cancel]:translate-x-0 data-[swipe=end]:translate-x-[var(--radix-toast-swipe-end-x)] data-[swipe=move]:translate-x-[var(--radix-toast-swipe-move-x)] data-[swipe=move]:transition-none data-[state=open]:animate-in data-[state=closed]:animate-out data-[swipe=end]:animate-out data-[state=closed]:fade-out-80 data-[state=closed]:slide-out-to-right-full data-[state=open]:slide-in-from-top-full data-[state=open]:sm:slide-in-from-bottom-full",
29
- {
30
- variants: {
31
- variant: {
32
- default: "border bg-background text-foreground",
33
- success: "border-success bg-success text-success-foreground",
34
- destructive:
35
- "destructive group border-destructive bg-destructive text-destructive-foreground",
36
- },
37
- },
38
- defaultVariants: {
39
- variant: "default",
40
- },
41
- }
42
- );
43
-
44
- const Toast = React.forwardRef<
45
- React.ElementRef<typeof ToastPrimitives.Root>,
46
- React.ComponentPropsWithoutRef<typeof ToastPrimitives.Root> &
47
- VariantProps<typeof toastVariants>
48
- >(({ className, variant, ...props }, ref) => {
49
- return (
50
- <ToastPrimitives.Root
51
- ref={ref}
52
- className={cn(toastVariants({ variant }), className)}
53
- {...props}
54
- />
55
- );
56
- });
57
- Toast.displayName = ToastPrimitives.Root.displayName;
58
-
59
- const ToastAction = React.forwardRef<
60
- React.ElementRef<typeof ToastPrimitives.Action>,
61
- React.ComponentPropsWithoutRef<typeof ToastPrimitives.Action>
62
- >(({ className, ...props }, ref) => (
63
- <ToastPrimitives.Action
64
- ref={ref}
65
- className={cn(
66
- "inline-flex h-8 shrink-0 items-center justify-center rounded-md border bg-transparent px-3 text-sm font-medium transition-colors hover:bg-secondary focus:outline-none focus:ring-1 focus:ring-ring disabled:pointer-events-none disabled:opacity-50 group-[.destructive]:border-muted/40 group-[.destructive]:hover:border-destructive/30 group-[.destructive]:hover:bg-destructive group-[.destructive]:hover:text-destructive-foreground group-[.destructive]:focus:ring-destructive",
67
- className
68
- )}
69
- {...props}
70
- />
71
- ));
72
- ToastAction.displayName = ToastPrimitives.Action.displayName;
73
-
74
- const ToastClose = React.forwardRef<
75
- React.ElementRef<typeof ToastPrimitives.Close>,
76
- React.ComponentPropsWithoutRef<typeof ToastPrimitives.Close>
77
- >(({ className, ...props }, ref) => (
78
- <ToastPrimitives.Close
79
- ref={ref}
80
- className={cn(
81
- "absolute right-1 top-1 rounded-md p-1 text-foreground/50 opacity-0 transition-opacity hover:text-foreground focus:opacity-100 focus:outline-none focus:ring-1 group-hover:opacity-100 group-[.destructive]:text-red-300 group-[.destructive]:hover:text-red-50 group-[.destructive]:focus:ring-red-400 group-[.destructive]:focus:ring-offset-red-600",
82
- className
83
- )}
84
- toast-close=""
85
- {...props}
86
- >
87
- <X className="h-4 w-4" />
88
- </ToastPrimitives.Close>
89
- ));
90
- ToastClose.displayName = ToastPrimitives.Close.displayName;
91
-
92
- const ToastTitle = React.forwardRef<
93
- React.ElementRef<typeof ToastPrimitives.Title>,
94
- React.ComponentPropsWithoutRef<typeof ToastPrimitives.Title>
95
- >(({ className, ...props }, ref) => (
96
- <ToastPrimitives.Title
97
- ref={ref}
98
- className={cn("text-sm font-semibold [&+div]:text-xs", className)}
99
- {...props}
100
- />
101
- ));
102
- ToastTitle.displayName = ToastPrimitives.Title.displayName;
103
-
104
- const ToastDescription = React.forwardRef<
105
- React.ElementRef<typeof ToastPrimitives.Description>,
106
- React.ComponentPropsWithoutRef<typeof ToastPrimitives.Description>
107
- >(({ className, ...props }, ref) => (
108
- <ToastPrimitives.Description
109
- ref={ref}
110
- className={cn("text-sm opacity-90", className)}
111
- {...props}
112
- />
113
- ));
114
- ToastDescription.displayName = ToastPrimitives.Description.displayName;
115
-
116
- type ToastProps = React.ComponentPropsWithoutRef<typeof Toast>;
117
-
118
- type ToastActionElement = React.ReactElement<typeof ToastAction>;
119
-
120
- export {
121
- type ToastProps,
122
- type ToastActionElement,
123
- ToastProvider,
124
- ToastViewport,
125
- Toast,
126
- ToastTitle,
127
- ToastDescription,
128
- ToastClose,
129
- ToastAction,
130
- };
@@ -1,35 +0,0 @@
1
- "use client";
2
-
3
- import { useToast } from "../../hooks/use-toast";
4
- import {
5
- Toast,
6
- ToastClose,
7
- ToastDescription,
8
- ToastProvider,
9
- ToastTitle,
10
- ToastViewport,
11
- } from "../../components/ui/toast";
12
-
13
- export function Toaster() {
14
- const { toasts } = useToast();
15
-
16
- return (
17
- <ToastProvider>
18
- {toasts.map(function ({ id, title, description, action, ...props }) {
19
- return (
20
- <Toast key={id} {...props}>
21
- <div className="grid gap-1">
22
- {title && <ToastTitle>{title}</ToastTitle>}
23
- {description && (
24
- <ToastDescription>{description}</ToastDescription>
25
- )}
26
- </div>
27
- {action}
28
- <ToastClose />
29
- </Toast>
30
- );
31
- })}
32
- <ToastViewport />
33
- </ToastProvider>
34
- );
35
- }
@@ -1,32 +0,0 @@
1
- "use client";
2
-
3
- import * as React from "react";
4
- import * as TooltipPrimitive from "@radix-ui/react-tooltip";
5
-
6
- import { cn } from "../../lib/utils";
7
-
8
- const TooltipProvider = TooltipPrimitive.Provider;
9
-
10
- const Tooltip = TooltipPrimitive.Root;
11
-
12
- const TooltipTrigger = TooltipPrimitive.Trigger;
13
-
14
- const TooltipContent = React.forwardRef<
15
- React.ElementRef<typeof TooltipPrimitive.Content>,
16
- React.ComponentPropsWithoutRef<typeof TooltipPrimitive.Content>
17
- >(({ className, sideOffset = 4, ...props }, ref) => (
18
- <TooltipPrimitive.Portal>
19
- <TooltipPrimitive.Content
20
- ref={ref}
21
- sideOffset={sideOffset}
22
- className={cn(
23
- "z-50 overflow-hidden rounded-md bg-primary px-3 py-1.5 text-xs text-primary-foreground animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-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",
24
- className
25
- )}
26
- {...props}
27
- />
28
- </TooltipPrimitive.Portal>
29
- ));
30
- TooltipContent.displayName = TooltipPrimitive.Content.displayName;
31
-
32
- export { Tooltip, TooltipTrigger, TooltipContent, TooltipProvider };
@@ -1,35 +0,0 @@
1
- import { useMemo } from "react";
2
- import {
3
- useController,
4
- useForm,
5
- useFormContext,
6
- ControllerRenderProps,
7
- FieldValues,
8
- } from "react-hook-form";
9
-
10
- export const useConditionalController = ({
11
- name,
12
- withoutForm,
13
- }: {
14
- name: string;
15
- withoutForm?: boolean;
16
- }): ControllerRenderProps<FieldValues, string> | Record<string, never> => {
17
- const form = useFormContext();
18
-
19
- const hasForm = useMemo(() => {
20
- return !withoutForm && !!form?.control;
21
- }, [withoutForm, form]);
22
-
23
- const tempForm = useForm();
24
-
25
- const controlToUse = useMemo(() => {
26
- return hasForm ? form.control : tempForm.control;
27
- }, [tempForm, form, hasForm]);
28
-
29
- const controller = useController({
30
- control: controlToUse,
31
- name: name || "temp",
32
- });
33
-
34
- return hasForm ? controller.field : {};
35
- };
@@ -1,116 +0,0 @@
1
- import { useState, useCallback } from "react";
2
-
3
- export type UseMaskProps = {
4
- mask: string;
5
- placeholder?: string; // Placeholder que mostra a máscara
6
- showMask?: boolean; // Se deve mostrar a máscara mesmo sem valor
7
- allowEmpty?: boolean; // Se permite valor vazio
8
- transform?: "uppercase" | "lowercase" | "capitalize"; // Transformação do texto
9
- };
10
-
11
- export const useMask = ({ mask, ...options }: UseMaskProps) => {
12
- const [value, setValue] = useState("");
13
-
14
- const applyMask = useCallback(
15
- (inputValue: string) => {
16
- if (!inputValue || !mask) return "";
17
-
18
- // Remove todos os caracteres que não são letras ou números
19
- const cleanValue = inputValue.replace(/[^a-zA-Z0-9]/g, "");
20
-
21
- let maskedValue = "";
22
- let cleanIndex = 0;
23
-
24
- for (let i = 0; i < mask.length && cleanIndex < cleanValue.length; i++) {
25
- const maskChar = mask[i];
26
- const inputChar = cleanValue[cleanIndex];
27
-
28
- if (maskChar === "9") {
29
- // Só aceita números
30
- if (/\d/.test(inputChar)) {
31
- maskedValue += inputChar;
32
- cleanIndex++;
33
- } else {
34
- // Se não for número, pula esse caractere do input
35
- cleanIndex++;
36
- i--; // Volta um passo na máscara para tentar novamente
37
- }
38
- } else if (maskChar === "A") {
39
- // Só aceita letras
40
- if (/[a-zA-Z]/.test(inputChar)) {
41
- let char = inputChar;
42
- // Aplica transformação se especificada
43
- if (options.transform === "uppercase") char = char.toUpperCase();
44
- else if (options.transform === "lowercase")
45
- char = char.toLowerCase();
46
- maskedValue += char;
47
- cleanIndex++;
48
- } else {
49
- // Se não for letra, pula esse caractere do input
50
- cleanIndex++;
51
- i--; // Volta um passo na máscara para tentar novamente
52
- }
53
- } else {
54
- // Caractere literal da máscara (parênteses, hífen, etc.)
55
- maskedValue += maskChar;
56
- }
57
- }
58
-
59
- return maskedValue;
60
- },
61
- [mask, options.transform]
62
- );
63
-
64
- const handleSetValue = useCallback(
65
- (newValue: string) => {
66
- const maskedValue = applyMask(newValue);
67
- setValue(maskedValue);
68
- },
69
- [applyMask]
70
- );
71
-
72
- // Função para obter valor sem máscara (raw)
73
- const getRawValue = useCallback(() => {
74
- return value.replace(/[^a-zA-Z0-9]/g, "");
75
- }, [value]);
76
-
77
- // Função para verificar se está completo
78
- const isComplete = useCallback(() => {
79
- return value.length === mask.length;
80
- }, [value, mask]);
81
-
82
- // Função para verificar se é válido
83
- const isValid = useCallback(() => {
84
- // Implementar validação específica
85
- return isComplete() && value.length > 0;
86
- }, [isComplete, value]);
87
-
88
- // Função para limpar o valor
89
- const clear = useCallback(() => {
90
- setValue("");
91
- }, []);
92
-
93
- // Compatibilidade com react-hook-form
94
- const getFormProps = useCallback(
95
- () => ({
96
- value,
97
- onChange: (e: React.ChangeEvent<HTMLInputElement>) => {
98
- handleSetValue(e.target.value);
99
- },
100
- placeholder: options.placeholder,
101
- }),
102
- [value, handleSetValue, options.placeholder]
103
- );
104
-
105
- return {
106
- value,
107
- setValue: handleSetValue,
108
- rawValue: getRawValue(),
109
- isComplete: isComplete(),
110
- isValid: isValid(),
111
- applyMask,
112
- clear,
113
- placeholder: options.placeholder || mask.replace(/[9A]/g, "_"),
114
- formProps: getFormProps(),
115
- };
116
- };
@@ -1,19 +0,0 @@
1
- import * as React from "react"
2
-
3
- const MOBILE_BREAKPOINT = 768
4
-
5
- export function useIsMobile() {
6
- const [isMobile, setIsMobile] = React.useState<boolean | undefined>(undefined)
7
-
8
- React.useEffect(() => {
9
- const mql = window.matchMedia(`(max-width: ${MOBILE_BREAKPOINT - 1}px)`)
10
- const onChange = () => {
11
- setIsMobile(window.innerWidth < MOBILE_BREAKPOINT)
12
- }
13
- mql.addEventListener("change", onChange)
14
- setIsMobile(window.innerWidth < MOBILE_BREAKPOINT)
15
- return () => mql.removeEventListener("change", onChange)
16
- }, [])
17
-
18
- return !!isMobile
19
- }