@phsa.tec/design-system-react 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (201) hide show
  1. package/.eslintrc.json +7 -0
  2. package/.storybook/main.ts +16 -0
  3. package/.storybook/preview.ts +15 -0
  4. package/README.md +36 -0
  5. package/components.json +21 -0
  6. package/jest.config.ts +25 -0
  7. package/next.config.ts +7 -0
  8. package/package.json +88 -0
  9. package/postcss.config.mjs +8 -0
  10. package/public/file.svg +1 -0
  11. package/public/globe.svg +1 -0
  12. package/public/next.svg +1 -0
  13. package/public/vercel.svg +1 -0
  14. package/public/window.svg +1 -0
  15. package/src/app/columns.tsx +178 -0
  16. package/src/app/favicon.ico +0 -0
  17. package/src/app/fonts/GeistMonoVF.woff +0 -0
  18. package/src/app/fonts/GeistVF.woff +0 -0
  19. package/src/app/globals.css +94 -0
  20. package/src/app/layout.tsx +35 -0
  21. package/src/app/page.tsx +7 -0
  22. package/src/components/actions/AlertDialog/AlertDialog.tsx +45 -0
  23. package/src/components/actions/AlertDialog/alert-dialog.stories.tsx +21 -0
  24. package/src/components/actions/AlertDialog/index.ts +1 -0
  25. package/src/components/actions/Button/Button.stories.ts +38 -0
  26. package/src/components/actions/Button/Button.tsx +23 -0
  27. package/src/components/actions/Button/index.ts +1 -0
  28. package/src/components/actions/Collapsible/index.ts +1 -0
  29. package/src/components/actions/Dialog/Dialog.stories.tsx +70 -0
  30. package/src/components/actions/Dialog/Dialog.tsx +87 -0
  31. package/src/components/actions/Dialog/components/DialogWithActions/index.tsx +40 -0
  32. package/src/components/actions/Dialog/index.ts +1 -0
  33. package/src/components/actions/Steps/Steps.stories.tsx +25 -0
  34. package/src/components/actions/Steps/Steps.tsx +51 -0
  35. package/src/components/actions/Steps/index.ts +1 -0
  36. package/src/components/actions/index.ts +5 -0
  37. package/src/components/dataDisplay/Avatar/Avatar.stories.tsx +22 -0
  38. package/src/components/dataDisplay/Avatar/Avatar.tsx +21 -0
  39. package/src/components/dataDisplay/Avatar/index.ts +2 -0
  40. package/src/components/dataDisplay/Badge/Badge.stories.tsx +36 -0
  41. package/src/components/dataDisplay/Badge/index.ts +1 -0
  42. package/src/components/dataDisplay/Card/Card.stories.tsx +24 -0
  43. package/src/components/dataDisplay/Card/Card.tsx +34 -0
  44. package/src/components/dataDisplay/Card/index.ts +1 -0
  45. package/src/components/dataDisplay/DataPairList/DataPairList.tsx +56 -0
  46. package/src/components/dataDisplay/DataPairList/data-pair-list.stories.tsx +87 -0
  47. package/src/components/dataDisplay/DataPairList/index.ts +2 -0
  48. package/src/components/dataDisplay/DataPairList/types.ts +10 -0
  49. package/src/components/dataDisplay/DropDownMenu/index.ts +1 -0
  50. package/src/components/dataDisplay/ErrorMessage/ErrorMessage.tsx +6 -0
  51. package/src/components/dataDisplay/ErrorMessage/index.ts +1 -0
  52. package/src/components/dataDisplay/Icon/Icon.stories.tsx +21 -0
  53. package/src/components/dataDisplay/Icon/Icon.tsx +47 -0
  54. package/src/components/dataDisplay/Icon/index.ts +1 -0
  55. package/src/components/dataDisplay/Icon/types.ts +6 -0
  56. package/src/components/dataDisplay/Label/Label.stories.tsx +21 -0
  57. package/src/components/dataDisplay/Label/Label.tsx +10 -0
  58. package/src/components/dataDisplay/Label/index.ts +1 -0
  59. package/src/components/dataDisplay/Table/Table.tsx +173 -0
  60. package/src/components/dataDisplay/Table/columns.tsx +223 -0
  61. package/src/components/dataDisplay/Table/components/DynamicTable/data-table-column-header.tsx +72 -0
  62. package/src/components/dataDisplay/Table/components/DynamicTable/data-table-pagination.tsx +91 -0
  63. package/src/components/dataDisplay/Table/components/DynamicTable/data-table-toolbar.tsx +17 -0
  64. package/src/components/dataDisplay/Table/components/DynamicTable/data-table-view-options.tsx +58 -0
  65. package/src/components/dataDisplay/Table/components/DynamicTable/data-table.stories.tsx +118 -0
  66. package/src/components/dataDisplay/Table/components/DynamicTable/index.tsx +136 -0
  67. package/src/components/dataDisplay/Table/components/DynamicTable/types.ts +43 -0
  68. package/src/components/dataDisplay/Table/custom/CustomTable/data-table-column-header.tsx +71 -0
  69. package/src/components/dataDisplay/Table/custom/CustomTable/data-table-faceted-filter.tsx +147 -0
  70. package/src/components/dataDisplay/Table/custom/CustomTable/data-table-pagination.tsx +97 -0
  71. package/src/components/dataDisplay/Table/custom/CustomTable/data-table-row-actions.tsx +78 -0
  72. package/src/components/dataDisplay/Table/custom/CustomTable/data-table-toolbar.tsx +60 -0
  73. package/src/components/dataDisplay/Table/custom/CustomTable/data-table-view-options.tsx +59 -0
  74. package/src/components/dataDisplay/Table/custom/CustomTable/data-table.tsx +145 -0
  75. package/src/components/dataDisplay/Table/custom/CustomTable/data.ts +71 -0
  76. package/src/components/dataDisplay/Table/custom/CustomTable/index.tsx +34 -0
  77. package/src/components/dataDisplay/Table/custom/CustomTable/schema.ts +11 -0
  78. package/src/components/dataDisplay/Table/index.ts +2 -0
  79. package/src/components/dataDisplay/Table/table.stories.tsx +147 -0
  80. package/src/components/dataDisplay/Table/types.ts +15 -0
  81. package/src/components/dataDisplay/Tabs/Tabs.stories.tsx +34 -0
  82. package/src/components/dataDisplay/Tabs/Tabs.tsx +53 -0
  83. package/src/components/dataDisplay/Tabs/index.ts +1 -0
  84. package/src/components/dataDisplay/Text/Text.stories.tsx +66 -0
  85. package/src/components/dataDisplay/Text/Text.tsx +56 -0
  86. package/src/components/dataDisplay/Text/index.ts +1 -0
  87. package/src/components/dataDisplay/index.ts +8 -0
  88. package/src/components/dataInput/Input/components/Input/Input.stories.tsx +99 -0
  89. package/src/components/dataInput/Input/components/Input/InputBase.tsx +50 -0
  90. package/src/components/dataInput/Input/components/Input/__tests__/Input.test.tsx +100 -0
  91. package/src/components/dataInput/Input/components/Input/index.tsx +257 -0
  92. package/src/components/dataInput/Input/components/InputBase/__tests__/InputBase.test.tsx +120 -0
  93. package/src/components/dataInput/Input/components/InputBase/index.tsx +89 -0
  94. package/src/components/dataInput/Input/components/MaskInput/__tests__/mask-input.test.tsx +67 -0
  95. package/src/components/dataInput/Input/components/MaskInput/index.ts +1 -0
  96. package/src/components/dataInput/Input/components/MaskInput/mask-input.stories.tsx +59 -0
  97. package/src/components/dataInput/Input/components/MaskInput/mask-input.tsx +43 -0
  98. package/src/components/dataInput/Input/components/MultipleInput/MultipleInput.tsx +36 -0
  99. package/src/components/dataInput/Input/components/MultipleInput/MultipleInputBase.tsx +100 -0
  100. package/src/components/dataInput/Input/components/MultipleInput/MultipleMaskInput.tsx +35 -0
  101. package/src/components/dataInput/Input/components/MultipleInput/MultipleNumberInput.tsx +35 -0
  102. package/src/components/dataInput/Input/components/MultipleInput/index.ts +2 -0
  103. package/src/components/dataInput/Input/components/MultipleInput/multiple-input.stories.tsx +71 -0
  104. package/src/components/dataInput/Input/components/NumberInput/__tests__/number-input.test.tsx +95 -0
  105. package/src/components/dataInput/Input/components/NumberInput/index.ts +1 -0
  106. package/src/components/dataInput/Input/components/NumberInput/number-input.stories.tsx +76 -0
  107. package/src/components/dataInput/Input/components/NumberInput/number-input.tsx +68 -0
  108. package/src/components/dataInput/Input/index.ts +4 -0
  109. package/src/components/dataInput/Select/MultiSelect/MultiSelect.stories.tsx +119 -0
  110. package/src/components/dataInput/Select/MultiSelect/MultiSelectBase.tsx +135 -0
  111. package/src/components/dataInput/Select/MultiSelect/index.tsx +75 -0
  112. package/src/components/dataInput/Select/Select.stories.tsx +61 -0
  113. package/src/components/dataInput/Select/Select.tsx +73 -0
  114. package/src/components/dataInput/Select/SelectBase.tsx +58 -0
  115. package/src/components/dataInput/Select/index.ts +2 -0
  116. package/src/components/dataInput/Switch/Switch.stories.tsx +75 -0
  117. package/src/components/dataInput/Switch/Switch.tsx +52 -0
  118. package/src/components/dataInput/Switch/index.ts +1 -0
  119. package/src/components/dataInput/checkbox/Checkbox.tsx +57 -0
  120. package/src/components/dataInput/checkbox/Checkbox_old.tsx +58 -0
  121. package/src/components/dataInput/checkbox/Checkout.stories.tsx +62 -0
  122. package/src/components/dataInput/checkbox/index.ts +1 -0
  123. package/src/components/dataInput/form/Form.tsx +47 -0
  124. package/src/components/dataInput/form/index.ts +3 -0
  125. package/src/components/dataInput/index.ts +5 -0
  126. package/src/components/feedback/Spinner/index.ts +1 -0
  127. package/src/components/feedback/Toast/Toast.stories.tsx +45 -0
  128. package/src/components/feedback/Toast/index.ts +2 -0
  129. package/src/components/feedback/index.ts +2 -0
  130. package/src/components/index.ts +6 -0
  131. package/src/components/layout/Crud/components/Table/index.tsx +183 -0
  132. package/src/components/layout/Crud/components/Table/types.ts +15 -0
  133. package/src/components/layout/Crud/crud.stories.tsx +317 -0
  134. package/src/components/layout/Crud/hook/useCrudLayout/index.tsx +94 -0
  135. package/src/components/layout/Crud/hook/useRequest/index.tsx +156 -0
  136. package/src/components/layout/Crud/index.tsx +295 -0
  137. package/src/components/layout/Crud/store/CrudLayoutStore.ts +75 -0
  138. package/src/components/layout/Crud/types.ts +14 -0
  139. package/src/components/layout/Drawer/CustomDrawer/index.tsx +33 -0
  140. package/src/components/layout/Drawer/Drawer.stories.tsx +80 -0
  141. package/src/components/layout/Drawer/index.ts +2 -0
  142. package/src/components/layout/PageLayout/PageLayout.stories.tsx +42 -0
  143. package/src/components/layout/PageLayout/index.tsx +28 -0
  144. package/src/components/layout/Separator/index.ts +1 -0
  145. package/src/components/layout/Sheet/Sheet.stories.tsx +28 -0
  146. package/src/components/layout/Sheet/Sheet.tsx +22 -0
  147. package/src/components/layout/Sheet/index.ts +1 -0
  148. package/src/components/layout/Sidebar/Sidebar.stories.tsx +116 -0
  149. package/src/components/layout/Sidebar/Sidebar.tsx +50 -0
  150. package/src/components/layout/Sidebar/components/app-sidebar.tsx +203 -0
  151. package/src/components/layout/Sidebar/components/footer-sidebar.tsx +17 -0
  152. package/src/components/layout/Sidebar/components/header-sidebar.tsx +90 -0
  153. package/src/components/layout/Sidebar/components/menus.tsx +55 -0
  154. package/src/components/layout/Sidebar/components/nav-projects.tsx +88 -0
  155. package/src/components/layout/Sidebar/components/nav-user.tsx +114 -0
  156. package/src/components/layout/Sidebar/components/team-switcher.tsx +85 -0
  157. package/src/components/layout/Sidebar/index.ts +2 -0
  158. package/src/components/layout/Sidebar/provider/index.tsx +51 -0
  159. package/src/components/layout/Tabs/Tabs.tsx +51 -0
  160. package/src/components/layout/Tabs/index.ts +1 -0
  161. package/src/components/layout/Tabs/tabs.stories.tsx +57 -0
  162. package/src/components/layout/index.ts +6 -0
  163. package/src/components/navigation/Breadcrumbs/Breadcrumbs.tsx +66 -0
  164. package/src/components/navigation/Breadcrumbs/index.ts +2 -0
  165. package/src/components/navigation/index.ts +1 -0
  166. package/src/components/ui/alert-dialog.tsx +141 -0
  167. package/src/components/ui/alert.tsx +59 -0
  168. package/src/components/ui/avatar.tsx +50 -0
  169. package/src/components/ui/badge.tsx +40 -0
  170. package/src/components/ui/breadcrumb.tsx +115 -0
  171. package/src/components/ui/button.tsx +57 -0
  172. package/src/components/ui/card.tsx +83 -0
  173. package/src/components/ui/checkbox.tsx +34 -0
  174. package/src/components/ui/collapsible.tsx +11 -0
  175. package/src/components/ui/command.tsx +153 -0
  176. package/src/components/ui/dialog.tsx +124 -0
  177. package/src/components/ui/drawer.tsx +117 -0
  178. package/src/components/ui/dropdown-menu.tsx +201 -0
  179. package/src/components/ui/form.tsx +179 -0
  180. package/src/components/ui/input.tsx +24 -0
  181. package/src/components/ui/label.tsx +30 -0
  182. package/src/components/ui/popover.tsx +33 -0
  183. package/src/components/ui/select.tsx +161 -0
  184. package/src/components/ui/separator.tsx +31 -0
  185. package/src/components/ui/sheet.tsx +140 -0
  186. package/src/components/ui/sidebar.tsx +763 -0
  187. package/src/components/ui/skeleton.tsx +15 -0
  188. package/src/components/ui/sonner.tsx +31 -0
  189. package/src/components/ui/spinner.tsx +54 -0
  190. package/src/components/ui/switch.tsx +33 -0
  191. package/src/components/ui/table.tsx +120 -0
  192. package/src/components/ui/tabs.tsx +55 -0
  193. package/src/components/ui/toast.tsx +130 -0
  194. package/src/components/ui/toaster.tsx +35 -0
  195. package/src/components/ui/tooltip.tsx +32 -0
  196. package/src/hooks/use-mobile.tsx +19 -0
  197. package/src/hooks/use-toast.ts +191 -0
  198. package/src/index.ts +1 -0
  199. package/src/lib/utils.ts +6 -0
  200. package/tailwind.config.ts +83 -0
  201. package/tsconfig.json +27 -0
@@ -0,0 +1,15 @@
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 };
@@ -0,0 +1,31 @@
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 }
@@ -0,0 +1,54 @@
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
+ }
@@ -0,0 +1,33 @@
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 };
@@ -0,0 +1,120 @@
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
+ };
@@ -0,0 +1,55 @@
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 };
@@ -0,0 +1,130 @@
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
+ };
@@ -0,0 +1,35 @@
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
+ }
@@ -0,0 +1,32 @@
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 };
@@ -0,0 +1,19 @@
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
+ }