@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,117 +0,0 @@
1
- "use client";
2
-
3
- import * as React from "react";
4
- import { Drawer as DrawerPrimitive } from "vaul";
5
-
6
- import { cn } from "../../lib/utils";
7
-
8
- export type DrawerProps = React.ComponentProps<typeof DrawerPrimitive.Root>;
9
-
10
- const Drawer = ({ shouldScaleBackground = true, ...props }: DrawerProps) => (
11
- <DrawerPrimitive.Root
12
- shouldScaleBackground={shouldScaleBackground}
13
- {...props}
14
- />
15
- );
16
- Drawer.displayName = "Drawer";
17
-
18
- const DrawerTrigger = DrawerPrimitive.Trigger;
19
-
20
- const DrawerPortal = DrawerPrimitive.Portal;
21
-
22
- const DrawerClose = DrawerPrimitive.Close;
23
-
24
- const DrawerOverlay = React.forwardRef<
25
- React.ElementRef<typeof DrawerPrimitive.Overlay>,
26
- React.ComponentPropsWithoutRef<typeof DrawerPrimitive.Overlay>
27
- >(({ className, ...props }, ref) => (
28
- <DrawerPrimitive.Overlay
29
- ref={ref}
30
- className={cn("fixed inset-0 z-50 bg-black/80", className)}
31
- {...props}
32
- />
33
- ));
34
- DrawerOverlay.displayName = DrawerPrimitive.Overlay.displayName;
35
-
36
- const DrawerContent = React.forwardRef<
37
- React.ElementRef<typeof DrawerPrimitive.Content>,
38
- React.ComponentPropsWithoutRef<typeof DrawerPrimitive.Content>
39
- >(({ className, children, ...props }, ref) => (
40
- <DrawerPortal>
41
- <DrawerOverlay />
42
- <DrawerPrimitive.Content
43
- ref={ref}
44
- className={cn(
45
- "fixed inset-x-0 bottom-0 z-50 mt-24 flex h-auto flex-col rounded-t-[10px] border bg-background",
46
- className
47
- )}
48
- {...props}
49
- >
50
- <div className="mx-auto mt-4 h-2 w-[100px] rounded-full bg-muted" />
51
- {children}
52
- </DrawerPrimitive.Content>
53
- </DrawerPortal>
54
- ));
55
- DrawerContent.displayName = "DrawerContent";
56
-
57
- const DrawerHeader = ({
58
- className,
59
- ...props
60
- }: React.HTMLAttributes<HTMLDivElement>) => (
61
- <div
62
- className={cn("grid gap-1.5 p-4 text-center sm:text-left", className)}
63
- {...props}
64
- />
65
- );
66
- DrawerHeader.displayName = "DrawerHeader";
67
-
68
- const DrawerFooter = ({
69
- className,
70
- ...props
71
- }: React.HTMLAttributes<HTMLDivElement>) => (
72
- <div
73
- className={cn("mt-auto flex flex-col gap-2 p-4", className)}
74
- {...props}
75
- />
76
- );
77
- DrawerFooter.displayName = "DrawerFooter";
78
-
79
- const DrawerTitle = React.forwardRef<
80
- React.ElementRef<typeof DrawerPrimitive.Title>,
81
- React.ComponentPropsWithoutRef<typeof DrawerPrimitive.Title>
82
- >(({ className, ...props }, ref) => (
83
- <DrawerPrimitive.Title
84
- ref={ref}
85
- className={cn(
86
- "text-lg font-semibold leading-none tracking-tight",
87
- className
88
- )}
89
- {...props}
90
- />
91
- ));
92
- DrawerTitle.displayName = DrawerPrimitive.Title.displayName;
93
-
94
- const DrawerDescription = React.forwardRef<
95
- React.ElementRef<typeof DrawerPrimitive.Description>,
96
- React.ComponentPropsWithoutRef<typeof DrawerPrimitive.Description>
97
- >(({ className, ...props }, ref) => (
98
- <DrawerPrimitive.Description
99
- ref={ref}
100
- className={cn("text-sm text-muted-foreground", className)}
101
- {...props}
102
- />
103
- ));
104
- DrawerDescription.displayName = DrawerPrimitive.Description.displayName;
105
-
106
- export {
107
- Drawer,
108
- DrawerPortal,
109
- DrawerOverlay,
110
- DrawerTrigger,
111
- DrawerClose,
112
- DrawerContent,
113
- DrawerHeader,
114
- DrawerFooter,
115
- DrawerTitle,
116
- DrawerDescription,
117
- };
@@ -1,201 +0,0 @@
1
- "use client";
2
-
3
- import * as React from "react";
4
- import * as DropdownMenuPrimitive from "@radix-ui/react-dropdown-menu";
5
- import { Check, ChevronRight, Circle } from "lucide-react";
6
-
7
- import { cn } from "../../lib/utils";
8
-
9
- const DropdownMenu = DropdownMenuPrimitive.Root;
10
-
11
- const DropdownMenuTrigger = DropdownMenuPrimitive.Trigger;
12
-
13
- const DropdownMenuGroup = DropdownMenuPrimitive.Group;
14
-
15
- const DropdownMenuPortal = DropdownMenuPrimitive.Portal;
16
-
17
- const DropdownMenuSub = DropdownMenuPrimitive.Sub;
18
-
19
- const DropdownMenuRadioGroup = DropdownMenuPrimitive.RadioGroup;
20
-
21
- const DropdownMenuSubTrigger = React.forwardRef<
22
- React.ElementRef<typeof DropdownMenuPrimitive.SubTrigger>,
23
- React.ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.SubTrigger> & {
24
- inset?: boolean;
25
- }
26
- >(({ className, inset, children, ...props }, ref) => (
27
- <DropdownMenuPrimitive.SubTrigger
28
- ref={ref}
29
- className={cn(
30
- "flex cursor-default gap-2 select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none focus:bg-accent data-[state=open]:bg-accent [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0",
31
- inset && "pl-8",
32
- className
33
- )}
34
- {...props}
35
- >
36
- {children}
37
- <ChevronRight className="ml-auto" />
38
- </DropdownMenuPrimitive.SubTrigger>
39
- ));
40
- DropdownMenuSubTrigger.displayName =
41
- DropdownMenuPrimitive.SubTrigger.displayName;
42
-
43
- const DropdownMenuSubContent = React.forwardRef<
44
- React.ElementRef<typeof DropdownMenuPrimitive.SubContent>,
45
- React.ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.SubContent>
46
- >(({ className, ...props }, ref) => (
47
- <DropdownMenuPrimitive.SubContent
48
- ref={ref}
49
- className={cn(
50
- "z-50 min-w-[8rem] overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-lg data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",
51
- className
52
- )}
53
- {...props}
54
- />
55
- ));
56
- DropdownMenuSubContent.displayName =
57
- DropdownMenuPrimitive.SubContent.displayName;
58
-
59
- const DropdownMenuContent = React.forwardRef<
60
- React.ElementRef<typeof DropdownMenuPrimitive.Content>,
61
- React.ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.Content>
62
- >(({ className, sideOffset = 4, ...props }, ref) => (
63
- <DropdownMenuPrimitive.Portal>
64
- <DropdownMenuPrimitive.Content
65
- ref={ref}
66
- sideOffset={sideOffset}
67
- className={cn(
68
- "z-50 min-w-[8rem] overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-md",
69
- "data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",
70
- className
71
- )}
72
- {...props}
73
- />
74
- </DropdownMenuPrimitive.Portal>
75
- ));
76
- DropdownMenuContent.displayName = DropdownMenuPrimitive.Content.displayName;
77
-
78
- const DropdownMenuItem = React.forwardRef<
79
- React.ElementRef<typeof DropdownMenuPrimitive.Item>,
80
- React.ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.Item> & {
81
- inset?: boolean;
82
- }
83
- >(({ className, inset, ...props }, ref) => (
84
- <DropdownMenuPrimitive.Item
85
- ref={ref}
86
- className={cn(
87
- "relative flex cursor-default select-none items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&>svg]:size-4 [&>svg]:shrink-0",
88
- inset && "pl-8",
89
- className
90
- )}
91
- {...props}
92
- />
93
- ));
94
- DropdownMenuItem.displayName = DropdownMenuPrimitive.Item.displayName;
95
-
96
- const DropdownMenuCheckboxItem = React.forwardRef<
97
- React.ElementRef<typeof DropdownMenuPrimitive.CheckboxItem>,
98
- React.ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.CheckboxItem>
99
- >(({ className, children, checked, ...props }, ref) => (
100
- <DropdownMenuPrimitive.CheckboxItem
101
- ref={ref}
102
- className={cn(
103
- "relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",
104
- className
105
- )}
106
- checked={checked}
107
- {...props}
108
- >
109
- <span className="absolute left-2 flex h-3.5 w-3.5 items-center justify-center">
110
- <DropdownMenuPrimitive.ItemIndicator>
111
- <Check className="h-4 w-4" />
112
- </DropdownMenuPrimitive.ItemIndicator>
113
- </span>
114
- {children}
115
- </DropdownMenuPrimitive.CheckboxItem>
116
- ));
117
- DropdownMenuCheckboxItem.displayName =
118
- DropdownMenuPrimitive.CheckboxItem.displayName;
119
-
120
- const DropdownMenuRadioItem = React.forwardRef<
121
- React.ElementRef<typeof DropdownMenuPrimitive.RadioItem>,
122
- React.ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.RadioItem>
123
- >(({ className, children, ...props }, ref) => (
124
- <DropdownMenuPrimitive.RadioItem
125
- ref={ref}
126
- className={cn(
127
- "relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",
128
- className
129
- )}
130
- {...props}
131
- >
132
- <span className="absolute left-2 flex h-3.5 w-3.5 items-center justify-center">
133
- <DropdownMenuPrimitive.ItemIndicator>
134
- <Circle className="h-2 w-2 fill-current" />
135
- </DropdownMenuPrimitive.ItemIndicator>
136
- </span>
137
- {children}
138
- </DropdownMenuPrimitive.RadioItem>
139
- ));
140
- DropdownMenuRadioItem.displayName = DropdownMenuPrimitive.RadioItem.displayName;
141
-
142
- const DropdownMenuLabel = React.forwardRef<
143
- React.ElementRef<typeof DropdownMenuPrimitive.Label>,
144
- React.ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.Label> & {
145
- inset?: boolean;
146
- }
147
- >(({ className, inset, ...props }, ref) => (
148
- <DropdownMenuPrimitive.Label
149
- ref={ref}
150
- className={cn(
151
- "px-2 py-1.5 text-sm font-semibold",
152
- inset && "pl-8",
153
- className
154
- )}
155
- {...props}
156
- />
157
- ));
158
- DropdownMenuLabel.displayName = DropdownMenuPrimitive.Label.displayName;
159
-
160
- const DropdownMenuSeparator = React.forwardRef<
161
- React.ElementRef<typeof DropdownMenuPrimitive.Separator>,
162
- React.ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.Separator>
163
- >(({ className, ...props }, ref) => (
164
- <DropdownMenuPrimitive.Separator
165
- ref={ref}
166
- className={cn("-mx-1 my-1 h-px bg-muted", className)}
167
- {...props}
168
- />
169
- ));
170
- DropdownMenuSeparator.displayName = DropdownMenuPrimitive.Separator.displayName;
171
-
172
- const DropdownMenuShortcut = ({
173
- className,
174
- ...props
175
- }: React.HTMLAttributes<HTMLSpanElement>) => {
176
- return (
177
- <span
178
- className={cn("ml-auto text-xs tracking-widest opacity-60", className)}
179
- {...props}
180
- />
181
- );
182
- };
183
- DropdownMenuShortcut.displayName = "DropdownMenuShortcut";
184
-
185
- export {
186
- DropdownMenu,
187
- DropdownMenuTrigger,
188
- DropdownMenuContent,
189
- DropdownMenuItem,
190
- DropdownMenuCheckboxItem,
191
- DropdownMenuRadioItem,
192
- DropdownMenuLabel,
193
- DropdownMenuSeparator,
194
- DropdownMenuShortcut,
195
- DropdownMenuGroup,
196
- DropdownMenuPortal,
197
- DropdownMenuSub,
198
- DropdownMenuSubContent,
199
- DropdownMenuSubTrigger,
200
- DropdownMenuRadioGroup,
201
- };
@@ -1,179 +0,0 @@
1
- "use client";
2
-
3
- import * as React from "react";
4
- import * as LabelPrimitive from "@radix-ui/react-label";
5
- import { Slot } from "@radix-ui/react-slot";
6
- import {
7
- Controller,
8
- ControllerProps,
9
- FieldPath,
10
- FieldValues,
11
- FormProvider,
12
- useFormContext,
13
- } from "react-hook-form";
14
-
15
- import { cn } from "../../lib/utils";
16
- import { Label } from "../../components/ui/label";
17
-
18
- const Form = FormProvider;
19
-
20
- type FormFieldContextValue<
21
- TFieldValues extends FieldValues = FieldValues,
22
- TName extends FieldPath<TFieldValues> = FieldPath<TFieldValues>
23
- > = {
24
- name: TName;
25
- };
26
-
27
- const FormFieldContext = React.createContext<FormFieldContextValue>(
28
- {} as FormFieldContextValue
29
- );
30
-
31
- const FormField = <
32
- TFieldValues extends FieldValues = FieldValues,
33
- TName extends FieldPath<TFieldValues> = FieldPath<TFieldValues>
34
- >({
35
- ...props
36
- }: ControllerProps<TFieldValues, TName>) => {
37
- return (
38
- <FormFieldContext.Provider value={{ name: props.name }}>
39
- <Controller {...props} />
40
- </FormFieldContext.Provider>
41
- );
42
- };
43
-
44
- const useFormField = () => {
45
- const fieldContext = React.useContext(FormFieldContext);
46
- const itemContext = React.useContext(FormItemContext);
47
- const { getFieldState, formState } = useFormContext();
48
-
49
- const fieldState = getFieldState(fieldContext.name, formState);
50
-
51
- if (!fieldContext) {
52
- throw new Error("useFormField should be used within <FormField>");
53
- }
54
-
55
- const { id } = itemContext;
56
-
57
- return {
58
- id,
59
- name: fieldContext.name,
60
- formItemId: `${id}-form-item`,
61
- formDescriptionId: `${id}-form-item-description`,
62
- formMessageId: `${id}-form-item-message`,
63
- ...fieldState,
64
- };
65
- };
66
-
67
- type FormItemContextValue = {
68
- id: string;
69
- };
70
-
71
- const FormItemContext = React.createContext<FormItemContextValue>(
72
- {} as FormItemContextValue
73
- );
74
-
75
- const FormItem = React.forwardRef<
76
- HTMLDivElement,
77
- React.HTMLAttributes<HTMLDivElement>
78
- >(({ className, ...props }, ref) => {
79
- const id = React.useId();
80
-
81
- return (
82
- <FormItemContext.Provider value={{ id }}>
83
- <div ref={ref} className={cn("space-y-2", className)} {...props} />
84
- </FormItemContext.Provider>
85
- );
86
- });
87
- FormItem.displayName = "FormItem";
88
-
89
- const FormLabel = React.forwardRef<
90
- React.ElementRef<typeof LabelPrimitive.Root>,
91
- React.ComponentPropsWithoutRef<typeof LabelPrimitive.Root>
92
- >(({ className, ...props }, ref) => {
93
- const { error, formItemId } = useFormField();
94
-
95
- return (
96
- <Label
97
- ref={ref}
98
- className={cn(error && "text-destructive", className)}
99
- htmlFor={formItemId}
100
- {...props}
101
- />
102
- );
103
- });
104
- FormLabel.displayName = "FormLabel";
105
-
106
- const FormControl = React.forwardRef<
107
- React.ElementRef<typeof Slot>,
108
- React.ComponentPropsWithoutRef<typeof Slot>
109
- >(({ ...props }, ref) => {
110
- const { error, formItemId, formDescriptionId, formMessageId } =
111
- useFormField();
112
-
113
- return (
114
- <Slot
115
- ref={ref}
116
- id={formItemId}
117
- aria-describedby={
118
- !error
119
- ? `${formDescriptionId}`
120
- : `${formDescriptionId} ${formMessageId}`
121
- }
122
- aria-invalid={!!error}
123
- {...props}
124
- />
125
- );
126
- });
127
- FormControl.displayName = "FormControl";
128
-
129
- const FormDescription = React.forwardRef<
130
- HTMLParagraphElement,
131
- React.HTMLAttributes<HTMLParagraphElement>
132
- >(({ className, ...props }, ref) => {
133
- const { formDescriptionId } = useFormField();
134
-
135
- return (
136
- <p
137
- ref={ref}
138
- id={formDescriptionId}
139
- className={cn("text-[0.8rem] text-muted-foreground", className)}
140
- {...props}
141
- />
142
- );
143
- });
144
- FormDescription.displayName = "FormDescription";
145
-
146
- const FormMessage = React.forwardRef<
147
- HTMLParagraphElement,
148
- React.HTMLAttributes<HTMLParagraphElement>
149
- >(({ className, children, ...props }, ref) => {
150
- const { error, formMessageId } = useFormField();
151
- const body = error ? String(error?.message) : children;
152
-
153
- if (!body) {
154
- return null;
155
- }
156
-
157
- return (
158
- <p
159
- ref={ref}
160
- id={formMessageId}
161
- className={cn("text-[0.8rem] font-medium text-destructive", className)}
162
- {...props}
163
- >
164
- {body}
165
- </p>
166
- );
167
- });
168
- FormMessage.displayName = "FormMessage";
169
-
170
- export {
171
- useFormField,
172
- Form,
173
- FormItem,
174
- FormLabel,
175
- FormControl,
176
- FormDescription,
177
- FormMessage,
178
- FormField,
179
- };
@@ -1,24 +0,0 @@
1
- import * as React from "react";
2
-
3
- import { cn } from "../../lib/utils";
4
-
5
- export type InputProps = React.ComponentProps<"input">;
6
-
7
- const Input = React.forwardRef<HTMLInputElement, InputProps>(
8
- ({ className, type, ...props }, ref) => {
9
- return (
10
- <input
11
- type={type}
12
- className={cn(
13
- "flex h-9 w-full rounded-md border border-input bg-transparent px-3 py-1 text-base shadow-sm transition-colors file:border-0 file:bg-transparent file:text-sm file:font-medium file:text-foreground placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50 md:text-sm",
14
- className
15
- )}
16
- ref={ref}
17
- {...props}
18
- />
19
- );
20
- }
21
- );
22
- Input.displayName = "Input";
23
-
24
- export { Input };
@@ -1,30 +0,0 @@
1
- "use client";
2
-
3
- import * as React from "react";
4
- import * as LabelPrimitive from "@radix-ui/react-label";
5
- import { cva, type VariantProps } from "class-variance-authority";
6
-
7
- import { cn } from "../../lib/utils";
8
-
9
- const labelVariants = cva(
10
- "text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70"
11
- );
12
-
13
- export type LabelProps = React.ComponentPropsWithoutRef<
14
- typeof LabelPrimitive.Root
15
- > &
16
- VariantProps<typeof labelVariants>;
17
-
18
- const Label = React.forwardRef<
19
- React.ElementRef<typeof LabelPrimitive.Root>,
20
- LabelProps
21
- >(({ className, ...props }, ref) => (
22
- <LabelPrimitive.Root
23
- ref={ref}
24
- className={cn(labelVariants(), className)}
25
- {...props}
26
- />
27
- ));
28
- Label.displayName = LabelPrimitive.Root.displayName;
29
-
30
- export { Label };
@@ -1,33 +0,0 @@
1
- "use client";
2
-
3
- import * as React from "react";
4
- import * as PopoverPrimitive from "@radix-ui/react-popover";
5
-
6
- import { cn } from "../../lib/utils";
7
-
8
- const Popover = PopoverPrimitive.Root;
9
-
10
- const PopoverTrigger = PopoverPrimitive.Trigger;
11
-
12
- const PopoverAnchor = PopoverPrimitive.Anchor;
13
-
14
- const PopoverContent = React.forwardRef<
15
- React.ElementRef<typeof PopoverPrimitive.Content>,
16
- React.ComponentPropsWithoutRef<typeof PopoverPrimitive.Content>
17
- >(({ className, align = "center", sideOffset = 4, ...props }, ref) => (
18
- <PopoverPrimitive.Portal>
19
- <PopoverPrimitive.Content
20
- ref={ref}
21
- align={align}
22
- sideOffset={sideOffset}
23
- className={cn(
24
- "z-50 w-72 rounded-md border bg-popover p-4 text-popover-foreground shadow-md outline-none data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",
25
- className
26
- )}
27
- {...props}
28
- />
29
- </PopoverPrimitive.Portal>
30
- ));
31
- PopoverContent.displayName = PopoverPrimitive.Content.displayName;
32
-
33
- export { Popover, PopoverTrigger, PopoverContent, PopoverAnchor };