@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,114 +0,0 @@
1
- "use client";
2
-
3
- import {
4
- BadgeCheck,
5
- Bell,
6
- ChevronsUpDown,
7
- CreditCard,
8
- LogOut,
9
- Sparkles,
10
- } from "lucide-react";
11
- import {
12
- SidebarMenu,
13
- SidebarMenuButton,
14
- SidebarMenuItem,
15
- useSidebar,
16
- } from "../../../ui/sidebar";
17
- import { Avatar, AvatarFallback, AvatarImage } from "../../../ui/avatar";
18
- import {
19
- DropdownMenu,
20
- DropdownMenuContent,
21
- DropdownMenuGroup,
22
- DropdownMenuItem,
23
- DropdownMenuLabel,
24
- DropdownMenuSeparator,
25
- DropdownMenuTrigger,
26
- } from "../../../ui/dropdown-menu";
27
- import { useCallback } from "react";
28
-
29
- export function NavUser({
30
- user,
31
- logoutAction = () => {},
32
- }: {
33
- user: {
34
- name: string;
35
- email: string;
36
- avatar: string;
37
- };
38
-
39
- logoutAction?: () => void;
40
- }) {
41
- const { isMobile } = useSidebar();
42
-
43
- const renderUserInformation = useCallback(() => {
44
- return (
45
- <>
46
- <Avatar className="h-8 w-8 rounded-lg">
47
- <AvatarImage src={user?.avatar} alt={user?.name} />
48
- <AvatarFallback className="rounded-lg">CN</AvatarFallback>
49
- </Avatar>
50
- <div className="grid flex-1 text-left text-sm leading-tight">
51
- <span className="truncate font-semibold">{user?.name}</span>
52
- <span className="truncate text-xs">{user?.email}</span>
53
- </div>
54
- </>
55
- );
56
- }, [user]);
57
-
58
- return (
59
- <SidebarMenu>
60
- <SidebarMenuItem>
61
- <DropdownMenu>
62
- <DropdownMenuTrigger asChild>
63
- <SidebarMenuButton
64
- size="lg"
65
- className="data-[state=open]:bg-sidebar-accent data-[state=open]:text-sidebar-accent-foreground"
66
- >
67
- {renderUserInformation()}
68
- <ChevronsUpDown className="ml-auto size-4" />
69
- </SidebarMenuButton>
70
- </DropdownMenuTrigger>
71
- <DropdownMenuContent
72
- className="w-[--radix-dropdown-menu-trigger-width] min-w-56 rounded-lg"
73
- side={isMobile ? "bottom" : "right"}
74
- align="end"
75
- sideOffset={4}
76
- >
77
- <DropdownMenuLabel className="p-0 font-normal">
78
- <div className="flex items-center gap-2 px-1 py-1.5 text-left text-sm">
79
- {renderUserInformation()}
80
- </div>
81
- </DropdownMenuLabel>
82
- <DropdownMenuSeparator />
83
- <DropdownMenuGroup>
84
- <DropdownMenuItem>
85
- <Sparkles />
86
- Upgrade to Pro
87
- </DropdownMenuItem>
88
- </DropdownMenuGroup>
89
- <DropdownMenuSeparator />
90
- <DropdownMenuGroup>
91
- <DropdownMenuItem>
92
- <BadgeCheck />
93
- Account
94
- </DropdownMenuItem>
95
- <DropdownMenuItem>
96
- <CreditCard />
97
- Billing
98
- </DropdownMenuItem>
99
- <DropdownMenuItem>
100
- <Bell />
101
- Notifications
102
- </DropdownMenuItem>
103
- </DropdownMenuGroup>
104
- <DropdownMenuSeparator />
105
- <DropdownMenuItem onClick={logoutAction}>
106
- <LogOut />
107
- Log out
108
- </DropdownMenuItem>
109
- </DropdownMenuContent>
110
- </DropdownMenu>
111
- </SidebarMenuItem>
112
- </SidebarMenu>
113
- );
114
- }
@@ -1,85 +0,0 @@
1
- "use client";
2
-
3
- import * as React from "react";
4
- import { ChevronsUpDown, Plus } from "lucide-react";
5
- import {
6
- SidebarMenu,
7
- SidebarMenuButton,
8
- SidebarMenuItem,
9
- useSidebar,
10
- } from "../../../ui/sidebar";
11
- import {
12
- DropdownMenu,
13
- DropdownMenuContent,
14
- DropdownMenuItem,
15
- DropdownMenuLabel,
16
- DropdownMenuSeparator,
17
- DropdownMenuShortcut,
18
- DropdownMenuTrigger,
19
- } from "../../../ui/dropdown-menu";
20
-
21
- export function TeamSwitcher({
22
- teams,
23
- }: {
24
- teams: {
25
- name: string;
26
- logo: () => React.ReactNode;
27
- plan: string;
28
- };
29
- }) {
30
- const { isMobile } = useSidebar();
31
-
32
- return (
33
- <SidebarMenu>
34
- <SidebarMenuItem>
35
- <DropdownMenu>
36
- <DropdownMenuTrigger asChild>
37
- <SidebarMenuButton
38
- size="lg"
39
- className="data-[state=open]:bg-sidebar-accent data-[state=open]:text-sidebar-accent-foreground"
40
- >
41
- <div className="flex aspect-square size-8 items-center justify-center rounded-lg bg-sidebar-primary text-sidebar-primary-foreground">
42
- {/* {teams?.logo && teams?.logo?.()} */}
43
- </div>
44
- <div className="grid flex-1 text-left text-sm leading-tight">
45
- <span className="truncate font-semibold">{teams?.name}</span>
46
- <span className="truncate text-xs">{teams?.plan}</span>
47
- </div>
48
- <ChevronsUpDown className="ml-auto" />
49
- </SidebarMenuButton>
50
- </DropdownMenuTrigger>
51
- {/* <DropdownMenuContent
52
- className="w-[--radix-dropdown-menu-trigger-width] min-w-56 rounded-lg"
53
- align="start"
54
- side={isMobile ? "bottom" : "right"}
55
- sideOffset={4}
56
- >
57
- <DropdownMenuLabel className="text-xs text-muted-foreground">
58
- Teams
59
- </DropdownMenuLabel>
60
- {teams.map((team, index) => (
61
- <DropdownMenuItem
62
- key={team.name}
63
- onClick={() => setActiveTeam(team)}
64
- className="gap-2 p-2"
65
- >
66
- <div className="flex size-6 items-center justify-center rounded-sm border">
67
- <team.logo className="size-4 shrink-0" />
68
- </div>
69
- {team.name}
70
- <DropdownMenuShortcut>⌘{index + 1}</DropdownMenuShortcut>
71
- </DropdownMenuItem>
72
- ))}
73
- <DropdownMenuSeparator />
74
- <DropdownMenuItem className="gap-2 p-2">
75
- <div className="flex size-6 items-center justify-center rounded-md border bg-background">
76
- <Plus className="size-4" />
77
- </div>
78
- <div className="font-medium text-muted-foreground">Add team</div>
79
- </DropdownMenuItem>
80
- </DropdownMenuContent> */}
81
- </DropdownMenu>
82
- </SidebarMenuItem>
83
- </SidebarMenu>
84
- );
85
- }
@@ -1,2 +0,0 @@
1
- export * from "./Sidebar";
2
- export * from "./components/nav-user";
@@ -1,51 +0,0 @@
1
- "use client";
2
- import { createContext, useContext, useState } from "react";
3
-
4
- interface SidebarContextData {
5
- currentPath: string;
6
- isCollapsed: boolean;
7
- toggleCollapse: () => void;
8
- setCurrentPath: (path: string) => void;
9
- }
10
-
11
- interface SidebarProviderProps {
12
- children: React.ReactNode;
13
- defaultPath?: string;
14
- defaultCollapsed?: boolean;
15
- }
16
-
17
- const SidebarContext = createContext({} as SidebarContextData);
18
-
19
- export function SidebarProvider({
20
- children,
21
- defaultPath = "/",
22
- defaultCollapsed = false,
23
- }: SidebarProviderProps) {
24
- const [isCollapsed, setIsCollapsed] = useState(defaultCollapsed);
25
- const [currentPath, setCurrentPath] = useState(defaultPath);
26
-
27
- const toggleCollapse = () => setIsCollapsed((prev) => !prev);
28
-
29
- return (
30
- <SidebarContext.Provider
31
- value={{
32
- currentPath,
33
- isCollapsed,
34
- toggleCollapse,
35
- setCurrentPath,
36
- }}
37
- >
38
- {children}
39
- </SidebarContext.Provider>
40
- );
41
- }
42
-
43
- export function useSidebar() {
44
- const context = useContext(SidebarContext);
45
-
46
- if (!context) {
47
- throw new Error("useSidebar must be used within a SidebarProvider");
48
- }
49
-
50
- return context;
51
- }
@@ -1,51 +0,0 @@
1
- "use client";
2
-
3
- import * as React from "react";
4
- import {
5
- Tabs as TabsUI,
6
- TabsContent,
7
- TabsList,
8
- TabsTrigger,
9
- } from "../../../components/ui/tabs";
10
- import { cn } from "../../../lib/utils";
11
-
12
- interface TabsProps {
13
- tabs: {
14
- label: string;
15
- content: React.ReactNode;
16
- }[];
17
- activeTabIndex?: number;
18
- onTabChange?: (index: number) => void;
19
- className?: string;
20
- }
21
-
22
- export const Tabs: React.FC<TabsProps> = ({
23
- tabs,
24
- activeTabIndex = 0,
25
- onTabChange,
26
- className,
27
- }) => {
28
- return (
29
- <TabsUI
30
- value={tabs[activeTabIndex].label}
31
- onValueChange={(value) => {
32
- const index = tabs.findIndex((tab) => tab.label === value);
33
- if (onTabChange) onTabChange(index);
34
- }}
35
- className={cn("w-full", className)}
36
- >
37
- <TabsList>
38
- {tabs.map((tab, index) => (
39
- <TabsTrigger key={index} value={tab.label}>
40
- {tab.label}
41
- </TabsTrigger>
42
- ))}
43
- </TabsList>
44
- {tabs.map((tab, index) => (
45
- <TabsContent key={index} value={tab.label}>
46
- {tab.content}
47
- </TabsContent>
48
- ))}
49
- </TabsUI>
50
- );
51
- };
@@ -1 +0,0 @@
1
- export * from "./Tabs";
@@ -1,57 +0,0 @@
1
- import type { Meta, StoryObj } from "@storybook/nextjs";
2
- import { Tabs } from ".";
3
-
4
- const meta: Meta<typeof Tabs> = {
5
- title: "Layout/Tabs",
6
- component: Tabs,
7
- parameters: {
8
- layout: "centered",
9
- },
10
- tags: ["autodocs"],
11
- };
12
-
13
- export default meta;
14
- type Story = StoryObj<typeof meta>;
15
-
16
- export const Default: Story = {
17
- args: {
18
- activeTabIndex: 1,
19
- tabs: [
20
- {
21
- label: "Tab 1",
22
- content: <div>Conteúdo da Tab 1</div>,
23
- },
24
- {
25
- label: "Tab 2",
26
- content: <div>Conteúdo da Tab 2</div>,
27
- },
28
- {
29
- label: "Tab 3",
30
- content: <div>Conteúdo da Tab 3</div>,
31
- },
32
- ],
33
- },
34
- };
35
-
36
- export const Controlled: Story = {
37
- args: {
38
- tabs: [
39
- {
40
- label: "Tab 1",
41
- content: <div>Conteúdo da Tab 1</div>,
42
- },
43
- {
44
- label: "Tab 2",
45
- content: <div>Conteúdo da Tab 2</div>,
46
- },
47
- {
48
- label: "Tab 3",
49
- content: <div>Conteúdo da Tab 3</div>,
50
- },
51
- ],
52
- activeTabIndex: 0,
53
- onTabChange: (index) => {
54
- console.log(`Aba selecionada: ${index}`);
55
- },
56
- },
57
- };
@@ -1,6 +0,0 @@
1
- export * from "./Drawer";
2
- export * from "./Sheet";
3
- export * from "./Sidebar";
4
- export * from "./Separator";
5
- export * from "./PageLayout";
6
- export * from "./Tabs";
@@ -1,66 +0,0 @@
1
- import {
2
- Breadcrumb,
3
- BreadcrumbItem,
4
- BreadcrumbLink,
5
- BreadcrumbList,
6
- BreadcrumbPage,
7
- BreadcrumbSeparator,
8
- } from "../../../components/ui/breadcrumb";
9
- import { Icon } from "../../dataDisplay";
10
- import { useMemo } from "react";
11
- import { usePathname } from "next/navigation";
12
-
13
- export type BreadcrumbsProps = {
14
- data: {
15
- href: string;
16
- label: string;
17
- }[];
18
- isAutoGenerate?: boolean;
19
- };
20
-
21
- export function Breadcrumbs({
22
- data,
23
- isAutoGenerate = false,
24
- }: BreadcrumbsProps) {
25
- const pathname = usePathname();
26
- const breadCrumData = useMemo(() => {
27
- if (isAutoGenerate) {
28
- const path = pathname.split("/").map((item) => ({
29
- href: item,
30
- label: item,
31
- }));
32
- return path.map((item) => {
33
- return {
34
- href: item.href,
35
- label: item.label,
36
- };
37
- });
38
- }
39
- return data;
40
- }, [data, isAutoGenerate, pathname]);
41
-
42
- return (
43
- <Breadcrumb>
44
- <BreadcrumbList>
45
- {breadCrumData?.map((item, index) => {
46
- const isLast = index === data.length - 1;
47
- if (isLast) {
48
- return (
49
- <BreadcrumbItem key={index}>
50
- <BreadcrumbPage>{item.label}</BreadcrumbPage>
51
- </BreadcrumbItem>
52
- );
53
- }
54
- return (
55
- <BreadcrumbItem key={index}>
56
- <BreadcrumbLink href={item.href}>{item.label}</BreadcrumbLink>
57
- <BreadcrumbSeparator>
58
- <Icon name="BsSlashLg" />
59
- </BreadcrumbSeparator>
60
- </BreadcrumbItem>
61
- );
62
- })}
63
- </BreadcrumbList>
64
- </Breadcrumb>
65
- );
66
- }
@@ -1,2 +0,0 @@
1
- // export * from "./Breadcrumbs";
2
- export * from "../../ui/breadcrumb";
@@ -1 +0,0 @@
1
- export * from "./Breadcrumbs";
@@ -1,141 +0,0 @@
1
- "use client";
2
-
3
- import * as React from "react";
4
- import * as AlertDialogPrimitive from "@radix-ui/react-alert-dialog";
5
-
6
- import { cn } from "../../lib/utils";
7
- import { buttonVariants } from "../../components/ui/button";
8
-
9
- const AlertDialog = AlertDialogPrimitive.Root;
10
-
11
- const AlertDialogTrigger = AlertDialogPrimitive.Trigger;
12
-
13
- const AlertDialogPortal = AlertDialogPrimitive.Portal;
14
-
15
- const AlertDialogOverlay = React.forwardRef<
16
- React.ElementRef<typeof AlertDialogPrimitive.Overlay>,
17
- React.ComponentPropsWithoutRef<typeof AlertDialogPrimitive.Overlay>
18
- >(({ className, ...props }, ref) => (
19
- <AlertDialogPrimitive.Overlay
20
- className={cn(
21
- "fixed inset-0 z-50 bg-black/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",
22
- className
23
- )}
24
- {...props}
25
- ref={ref}
26
- />
27
- ));
28
- AlertDialogOverlay.displayName = AlertDialogPrimitive.Overlay.displayName;
29
-
30
- const AlertDialogContent = React.forwardRef<
31
- React.ElementRef<typeof AlertDialogPrimitive.Content>,
32
- React.ComponentPropsWithoutRef<typeof AlertDialogPrimitive.Content>
33
- >(({ className, ...props }, ref) => (
34
- <AlertDialogPortal>
35
- <AlertDialogOverlay />
36
- <AlertDialogPrimitive.Content
37
- ref={ref}
38
- className={cn(
39
- "fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border bg-background p-6 shadow-lg duration-200 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-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] sm:rounded-lg",
40
- className
41
- )}
42
- {...props}
43
- />
44
- </AlertDialogPortal>
45
- ));
46
- AlertDialogContent.displayName = AlertDialogPrimitive.Content.displayName;
47
-
48
- const AlertDialogHeader = ({
49
- className,
50
- ...props
51
- }: React.HTMLAttributes<HTMLDivElement>) => (
52
- <div
53
- className={cn(
54
- "flex flex-col space-y-2 text-center sm:text-left",
55
- className
56
- )}
57
- {...props}
58
- />
59
- );
60
- AlertDialogHeader.displayName = "AlertDialogHeader";
61
-
62
- const AlertDialogFooter = ({
63
- className,
64
- ...props
65
- }: React.HTMLAttributes<HTMLDivElement>) => (
66
- <div
67
- className={cn(
68
- "flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",
69
- className
70
- )}
71
- {...props}
72
- />
73
- );
74
- AlertDialogFooter.displayName = "AlertDialogFooter";
75
-
76
- const AlertDialogTitle = React.forwardRef<
77
- React.ElementRef<typeof AlertDialogPrimitive.Title>,
78
- React.ComponentPropsWithoutRef<typeof AlertDialogPrimitive.Title>
79
- >(({ className, ...props }, ref) => (
80
- <AlertDialogPrimitive.Title
81
- ref={ref}
82
- className={cn("text-lg font-semibold", className)}
83
- {...props}
84
- />
85
- ));
86
- AlertDialogTitle.displayName = AlertDialogPrimitive.Title.displayName;
87
-
88
- const AlertDialogDescription = React.forwardRef<
89
- React.ElementRef<typeof AlertDialogPrimitive.Description>,
90
- React.ComponentPropsWithoutRef<typeof AlertDialogPrimitive.Description>
91
- >(({ className, ...props }, ref) => (
92
- <AlertDialogPrimitive.Description
93
- ref={ref}
94
- className={cn("text-sm text-muted-foreground", className)}
95
- {...props}
96
- />
97
- ));
98
- AlertDialogDescription.displayName =
99
- AlertDialogPrimitive.Description.displayName;
100
-
101
- const AlertDialogAction = React.forwardRef<
102
- React.ElementRef<typeof AlertDialogPrimitive.Action>,
103
- React.ComponentPropsWithoutRef<typeof AlertDialogPrimitive.Action>
104
- >(({ className, ...props }, ref) => (
105
- <AlertDialogPrimitive.Action
106
- ref={ref}
107
- className={cn(buttonVariants(), className)}
108
- {...props}
109
- />
110
- ));
111
- AlertDialogAction.displayName = AlertDialogPrimitive.Action.displayName;
112
-
113
- const AlertDialogCancel = React.forwardRef<
114
- React.ElementRef<typeof AlertDialogPrimitive.Cancel>,
115
- React.ComponentPropsWithoutRef<typeof AlertDialogPrimitive.Cancel>
116
- >(({ className, ...props }, ref) => (
117
- <AlertDialogPrimitive.Cancel
118
- ref={ref}
119
- className={cn(
120
- buttonVariants({ variant: "outline" }),
121
- "mt-2 sm:mt-0",
122
- className
123
- )}
124
- {...props}
125
- />
126
- ));
127
- AlertDialogCancel.displayName = AlertDialogPrimitive.Cancel.displayName;
128
-
129
- export {
130
- AlertDialog,
131
- AlertDialogPortal,
132
- AlertDialogOverlay,
133
- AlertDialogTrigger,
134
- AlertDialogContent,
135
- AlertDialogHeader,
136
- AlertDialogFooter,
137
- AlertDialogTitle,
138
- AlertDialogDescription,
139
- AlertDialogAction,
140
- AlertDialogCancel,
141
- };
@@ -1,59 +0,0 @@
1
- import * as React from "react"
2
- import { cva, type VariantProps } from "class-variance-authority"
3
-
4
- import { cn } from "@/lib/utils"
5
-
6
- const alertVariants = cva(
7
- "relative w-full rounded-lg border px-4 py-3 text-sm [&>svg+div]:translate-y-[-3px] [&>svg]:absolute [&>svg]:left-4 [&>svg]:top-4 [&>svg]:text-foreground [&>svg~*]:pl-7",
8
- {
9
- variants: {
10
- variant: {
11
- default: "bg-background text-foreground",
12
- destructive:
13
- "border-destructive/50 text-destructive dark:border-destructive [&>svg]:text-destructive",
14
- },
15
- },
16
- defaultVariants: {
17
- variant: "default",
18
- },
19
- }
20
- )
21
-
22
- const Alert = React.forwardRef<
23
- HTMLDivElement,
24
- React.HTMLAttributes<HTMLDivElement> & VariantProps<typeof alertVariants>
25
- >(({ className, variant, ...props }, ref) => (
26
- <div
27
- ref={ref}
28
- role="alert"
29
- className={cn(alertVariants({ variant }), className)}
30
- {...props}
31
- />
32
- ))
33
- Alert.displayName = "Alert"
34
-
35
- const AlertTitle = React.forwardRef<
36
- HTMLParagraphElement,
37
- React.HTMLAttributes<HTMLHeadingElement>
38
- >(({ className, ...props }, ref) => (
39
- <h5
40
- ref={ref}
41
- className={cn("mb-1 font-medium leading-none tracking-tight", className)}
42
- {...props}
43
- />
44
- ))
45
- AlertTitle.displayName = "AlertTitle"
46
-
47
- const AlertDescription = React.forwardRef<
48
- HTMLParagraphElement,
49
- React.HTMLAttributes<HTMLParagraphElement>
50
- >(({ className, ...props }, ref) => (
51
- <div
52
- ref={ref}
53
- className={cn("text-sm [&_p]:leading-relaxed", className)}
54
- {...props}
55
- />
56
- ))
57
- AlertDescription.displayName = "AlertDescription"
58
-
59
- export { Alert, AlertTitle, AlertDescription }