@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,28 @@
1
+ import { Text } from "../../../components/dataDisplay";
2
+ import { PropsWithChildren } from "react";
3
+
4
+ export type PageLayoutProps = PropsWithChildren & {
5
+ title: string;
6
+ subtitle?: string;
7
+ header?: React.ReactNode;
8
+ };
9
+
10
+ export const PageLayout = ({
11
+ subtitle,
12
+ title,
13
+ children,
14
+ header,
15
+ }: PageLayoutProps) => {
16
+ return (
17
+ <div className="m-5 p-4 bg-white">
18
+ <div className="flex justify-between">
19
+ <div>
20
+ {title && <Text variant="title">{title}</Text>}
21
+ {subtitle && <Text variant="muted">{subtitle}</Text>}
22
+ </div>
23
+ {header}
24
+ </div>
25
+ <div className="mt-5">{children}</div>
26
+ </div>
27
+ );
28
+ };
@@ -0,0 +1 @@
1
+ export * from "../../ui/separator";
@@ -0,0 +1,28 @@
1
+ import type { Meta, StoryObj } from "@storybook/nextjs";
2
+
3
+ import { Sheet } from "./index";
4
+
5
+ const meta = {
6
+ title: "Layout/Sheet",
7
+ component: Sheet,
8
+ parameters: {
9
+ layout: "centered",
10
+ },
11
+ args: {
12
+ open: false,
13
+ children: "Sheet content",
14
+ },
15
+ argTypes: {
16
+ open: {
17
+ control: {
18
+ type: "boolean",
19
+ },
20
+ },
21
+ },
22
+ tags: ["autodocs"],
23
+ } satisfies Meta<typeof Sheet>;
24
+
25
+ export default meta;
26
+ type Story = StoryObj<typeof meta>;
27
+
28
+ export const Default: Story = {};
@@ -0,0 +1,22 @@
1
+ import {
2
+ Sheet as SheetComponent,
3
+ SheetContent,
4
+ } from "../../../components/ui/sheet";
5
+ import { PropsWithChildren } from "react";
6
+
7
+ export type SheetProps = typeof SheetComponent &
8
+ PropsWithChildren & {
9
+ side?: "left" | "right" | "top" | "bottom";
10
+ className?: string;
11
+ onOpenChange?: (open: boolean) => void;
12
+ open?: boolean;
13
+ };
14
+ export function Sheet({ side, className, children, ...props }: SheetProps) {
15
+ return (
16
+ <SheetComponent {...props}>
17
+ <SheetContent side={side} className={className}>
18
+ {children}
19
+ </SheetContent>
20
+ </SheetComponent>
21
+ );
22
+ }
@@ -0,0 +1 @@
1
+ export * from "./Sheet";
@@ -0,0 +1,116 @@
1
+ import type { Meta, StoryObj } from "@storybook/nextjs";
2
+ import { Sidebar } from "./Sidebar";
3
+ import {
4
+ Users,
5
+ FileText,
6
+ LayoutDashboard,
7
+ UserRound,
8
+ Archive,
9
+ Share,
10
+ BarChart,
11
+ Shield,
12
+ } from "lucide-react";
13
+
14
+ const meta = {
15
+ title: "Layout/Sidebar",
16
+ component: Sidebar,
17
+ parameters: {
18
+ layout: "fullscreen",
19
+ },
20
+ tags: ["autodocs"],
21
+ decorators: [
22
+ (Story) => (
23
+ <div className="h-screen">
24
+ <Story />
25
+ </div>
26
+ ),
27
+ ],
28
+ } satisfies Meta<typeof Sidebar>;
29
+
30
+ export default meta;
31
+ type Story = StoryObj<typeof meta>;
32
+
33
+ const defaultNavbar = [
34
+ {
35
+ title: "Dashboard",
36
+ items: [
37
+ { title: "Overview", url: "/dashboard", icon: () => <LayoutDashboard /> },
38
+ {
39
+ title: "Analytics",
40
+ url: "/dashboard/analytics",
41
+ icon: () => <BarChart />,
42
+ },
43
+ {
44
+ title: "Reports",
45
+ url: "/dashboard/reports",
46
+ isActive: true,
47
+ icon: () => <Archive />,
48
+ },
49
+ ],
50
+ },
51
+ {
52
+ title: "Users",
53
+ url: "/users",
54
+
55
+ items: [
56
+ { title: "All Users", url: "/users", icon: () => <Users /> },
57
+ {
58
+ title: "Permissions",
59
+ url: "/users/permissions",
60
+ icon: () => <Shield />,
61
+ },
62
+ { title: "Roles", url: "/users/roles", icon: () => <UserRound /> },
63
+ ],
64
+ },
65
+ {
66
+ title: "Documents",
67
+ url: "/documents",
68
+ items: [
69
+ { title: "All Documents", url: "/documents", icon: () => <FileText /> },
70
+ { title: "Shared", url: "/documents/shared", icon: () => <Share /> },
71
+ { title: "Archive", url: "/documents/archive", icon: () => <Archive /> },
72
+ ],
73
+ },
74
+ ];
75
+
76
+ export const Default: Story = {
77
+ args: {
78
+ navbar: defaultNavbar,
79
+ footer: () => <div>Footer</div>,
80
+ children: (
81
+ <div className="space-y-4">
82
+ <h1 className="text-2xl font-bold">Dashboard Overview</h1>
83
+ <p className="text-muted-foreground">Welcome to your dashboard.</p>
84
+ <div className="grid gap-4 md:grid-cols-2 lg:grid-cols-3">
85
+ {Array.from({ length: 6 }).map((_, i) => (
86
+ <div key={i} className="rounded-lg bg-white p-6 shadow-sm">
87
+ <h3 className="font-semibold">Card {i + 1}</h3>
88
+ <p className="text-sm text-muted-foreground">
89
+ Card description here
90
+ </p>
91
+ </div>
92
+ ))}
93
+ </div>
94
+ </div>
95
+ ),
96
+ },
97
+ };
98
+
99
+ export const WithoutFooter: Story = {
100
+ args: {
101
+ navbar: defaultNavbar,
102
+ showFooter: false,
103
+ children: (
104
+ <div className="space-y-4">
105
+ <h1 className="text-2xl font-bold">Settings</h1>
106
+ <p className="text-muted-foreground">Manage your account settings.</p>
107
+ <div className="rounded-lg bg-white p-6 shadow-sm">
108
+ <h3 className="font-semibold">Settings Content</h3>
109
+ <p className="text-sm text-muted-foreground">
110
+ Settings form would go here
111
+ </p>
112
+ </div>
113
+ </div>
114
+ ),
115
+ },
116
+ };
@@ -0,0 +1,50 @@
1
+ "use client";
2
+ import {
3
+ SidebarInset,
4
+ SidebarProvider as UISidebarProvider,
5
+ } from "../../ui/sidebar";
6
+ import { AppSidebar, AppSidebarProps } from "./components/app-sidebar";
7
+ import { HeaderSidebar } from "./components/header-sidebar";
8
+ import { FooterSidebar } from "./components/footer-sidebar";
9
+ import { cn } from "../../../lib/utils";
10
+ import { SidebarProvider } from "./provider";
11
+
12
+ interface SidebarProps extends AppSidebarProps {
13
+ children: React.ReactNode;
14
+ contentClassName?: string;
15
+ showFooter?: boolean;
16
+ defaultPath?: string;
17
+ defaultCollapsed?: boolean;
18
+ }
19
+
20
+ export const Sidebar = ({
21
+ children,
22
+ contentClassName,
23
+ showFooter = true,
24
+ defaultPath,
25
+ defaultCollapsed,
26
+ ...rest
27
+ }: SidebarProps) => {
28
+ return (
29
+ <SidebarProvider
30
+ defaultPath={defaultPath}
31
+ defaultCollapsed={defaultCollapsed}
32
+ >
33
+ <UISidebarProvider>
34
+ <AppSidebar {...rest} />
35
+ <SidebarInset className="overflow-auto bg-slate-50">
36
+ <HeaderSidebar />
37
+ <main
38
+ className={cn(
39
+ "flex flex-1 flex-col gap-4 p-4 pt-0",
40
+ contentClassName
41
+ )}
42
+ >
43
+ {children}
44
+ </main>
45
+ {showFooter && <FooterSidebar />}
46
+ </SidebarInset>
47
+ </UISidebarProvider>
48
+ </SidebarProvider>
49
+ );
50
+ };
@@ -0,0 +1,203 @@
1
+ "use client";
2
+
3
+ import * as React from "react";
4
+ import {
5
+ AudioWaveform,
6
+ BookOpen,
7
+ Bot,
8
+ Command,
9
+ Frame,
10
+ GalleryVerticalEnd,
11
+ Map,
12
+ PieChart,
13
+ Settings2,
14
+ SquareTerminal,
15
+ } from "lucide-react";
16
+ import {
17
+ Sidebar,
18
+ SidebarContent,
19
+ SidebarFooter,
20
+ SidebarHeader,
21
+ SidebarRail,
22
+ } from "../../../ui/sidebar";
23
+ import { TeamSwitcher } from "./team-switcher";
24
+ import { Menus } from "./menus";
25
+ import { NavProjects } from "./nav-projects";
26
+ import { NavUser } from "./nav-user";
27
+
28
+ // This is sample data.
29
+ const data = {
30
+ user: {
31
+ name: "shadcn",
32
+ email: "m@example.com",
33
+ avatar: "/avatars/shadcn.jpg",
34
+ },
35
+ teams: [
36
+ {
37
+ name: "Acme Inc",
38
+ logo: GalleryVerticalEnd,
39
+ plan: "Enterprise",
40
+ },
41
+ {
42
+ name: "Acme Corp.",
43
+ logo: AudioWaveform,
44
+ plan: "Startup",
45
+ },
46
+ {
47
+ name: "Evil Corp.",
48
+ logo: Command,
49
+ plan: "Free",
50
+ },
51
+ ],
52
+ navMain: [
53
+ {
54
+ title: "Playground",
55
+ url: "#",
56
+ icon: SquareTerminal,
57
+ isActive: true,
58
+ items: [
59
+ {
60
+ title: "History",
61
+ url: "#",
62
+ },
63
+ {
64
+ title: "Starred",
65
+ url: "#",
66
+ },
67
+ {
68
+ title: "Settings",
69
+ url: "#",
70
+ },
71
+ ],
72
+ },
73
+ {
74
+ title: "Models",
75
+ url: "#",
76
+ icon: Bot,
77
+ items: [
78
+ {
79
+ title: "Genesis",
80
+ url: "#",
81
+ },
82
+ {
83
+ title: "Explorer",
84
+ url: "#",
85
+ },
86
+ {
87
+ title: "Quantum",
88
+ url: "#",
89
+ },
90
+ ],
91
+ },
92
+ {
93
+ title: "Documentation",
94
+ url: "#",
95
+ icon: BookOpen,
96
+ items: [
97
+ {
98
+ title: "Introduction",
99
+ url: "#",
100
+ },
101
+ {
102
+ title: "Get Started",
103
+ url: "#",
104
+ },
105
+ {
106
+ title: "Tutorials",
107
+ url: "#",
108
+ },
109
+ {
110
+ title: "Changelog",
111
+ url: "#",
112
+ },
113
+ ],
114
+ },
115
+ {
116
+ title: "Settings",
117
+ url: "#",
118
+ icon: Settings2,
119
+ items: [
120
+ {
121
+ title: "General",
122
+ url: "#",
123
+ },
124
+ {
125
+ title: "Team",
126
+ url: "#",
127
+ },
128
+ {
129
+ title: "Billing",
130
+ url: "#",
131
+ },
132
+ {
133
+ title: "Limits",
134
+ url: "#",
135
+ },
136
+ ],
137
+ },
138
+ ],
139
+ projects: [
140
+ {
141
+ name: "Design Engineering",
142
+ url: "#",
143
+ icon: Frame,
144
+ },
145
+ {
146
+ name: "Sales & Marketing",
147
+ url: "#",
148
+ icon: PieChart,
149
+ },
150
+ {
151
+ name: "Travel",
152
+ url: "#",
153
+ icon: Map,
154
+ },
155
+ ],
156
+ };
157
+
158
+ export type AppSidebarProps = {
159
+ footer?: () => React.ReactNode;
160
+ user?: {
161
+ email?: string;
162
+ name?: string;
163
+ };
164
+ enterprise?: {
165
+ name: string;
166
+ logo: () => React.ReactNode;
167
+ plan: string;
168
+ };
169
+ navbar: {
170
+ title: string;
171
+ items: {
172
+ title: string;
173
+ url: string;
174
+ isActive?: boolean | undefined;
175
+ icon?: () => React.ReactNode;
176
+ }[];
177
+ }[];
178
+ };
179
+
180
+ export function AppSidebar({
181
+ navbar = [],
182
+ user = {},
183
+ enterprise = {
184
+ name: "Acme Inc",
185
+ logo: GalleryVerticalEnd,
186
+ plan: "Enterprise",
187
+ },
188
+ footer,
189
+ ...props
190
+ }: AppSidebarProps) {
191
+ return (
192
+ <Sidebar collapsible="icon" {...props}>
193
+ <SidebarHeader>
194
+ <TeamSwitcher teams={enterprise} />
195
+ </SidebarHeader>
196
+ <SidebarContent>
197
+ <Menus items={navbar} />
198
+ </SidebarContent>
199
+ {footer && <SidebarFooter>{footer()}</SidebarFooter>}
200
+ <SidebarRail />
201
+ </Sidebar>
202
+ );
203
+ }
@@ -0,0 +1,17 @@
1
+ import { Separator } from "../../Separator";
2
+
3
+ export const FooterSidebar = () => {
4
+ return (
5
+ <footer className="h-[65px]">
6
+ <Separator />
7
+ <div className="flex items-center justify-between h-16 bg-background px-5">
8
+ <span className="text-sm text-muted-foreground">
9
+ © {new Date().getFullYear()} Your Company
10
+ </span>
11
+ <span className="text-sm text-muted-foreground">
12
+ Feito na terra do sol 🌞
13
+ </span>
14
+ </div>
15
+ </footer>
16
+ );
17
+ };
@@ -0,0 +1,90 @@
1
+ "use client";
2
+ import { SidebarTrigger } from "../../../ui/sidebar";
3
+ import {
4
+ Breadcrumb,
5
+ BreadcrumbList,
6
+ BreadcrumbItem,
7
+ BreadcrumbPage,
8
+ BreadcrumbLink,
9
+ BreadcrumbSeparator,
10
+ } from "../../../ui/breadcrumb";
11
+ import { Separator } from "../../Separator";
12
+ import { useSidebar } from "../provider";
13
+
14
+ interface BreadcrumbItemProps {
15
+ isLast?: boolean;
16
+ path: string;
17
+ label: string;
18
+ }
19
+
20
+ const routeMap: Record<string, string> = {
21
+ dashboard: "Dashboard",
22
+ users: "Usuários",
23
+ documents: "Documentos",
24
+ settings: "Configurações",
25
+ create: "Criar",
26
+ edit: "Editar",
27
+ profile: "Perfil",
28
+ analytics: "Análises",
29
+ reports: "Relatórios",
30
+ };
31
+
32
+ const BreadcrumbElement = ({ isLast, path, label }: BreadcrumbItemProps) => {
33
+ if (isLast) {
34
+ return (
35
+ <BreadcrumbItem>
36
+ <BreadcrumbPage className="capitalize">{label}</BreadcrumbPage>
37
+ </BreadcrumbItem>
38
+ );
39
+ }
40
+
41
+ return (
42
+ <BreadcrumbItem>
43
+ <BreadcrumbLink href={path} className="capitalize">
44
+ {label}
45
+ </BreadcrumbLink>
46
+ <BreadcrumbSeparator />
47
+ </BreadcrumbItem>
48
+ );
49
+ };
50
+
51
+ export const HeaderSidebar = () => {
52
+ const { currentPath } = useSidebar();
53
+
54
+ const breadcrumbItems = currentPath
55
+ .split("/")
56
+ .filter(Boolean)
57
+ .map((segment, index, array) => {
58
+ const path = `/${array.slice(0, index + 1).join("/")}`;
59
+ const isLast = index === array.length - 1;
60
+ const label = routeMap[segment] || segment;
61
+
62
+ return {
63
+ path,
64
+ label,
65
+ isLast,
66
+ };
67
+ });
68
+
69
+ return (
70
+ <header className="flex h-16 shrink-0 items-center border-b border-border bg-background px-4 transition-[width,height] ease-linear group-has-[[data-collapsible=icon]]/sidebar-wrapper:h-12">
71
+ <div className="flex items-center gap-4">
72
+ <SidebarTrigger className="-ml-2 h-9 w-9" />
73
+ <Separator orientation="vertical" className="h-6" />
74
+ <Breadcrumb>
75
+ <BreadcrumbList>
76
+ <BreadcrumbItem>
77
+ <BreadcrumbLink href="/" className="capitalize">
78
+ Home
79
+ </BreadcrumbLink>
80
+ <BreadcrumbSeparator />
81
+ </BreadcrumbItem>
82
+ {breadcrumbItems.map((item) => (
83
+ <BreadcrumbElement key={item.path} {...item} />
84
+ ))}
85
+ </BreadcrumbList>
86
+ </Breadcrumb>
87
+ </div>
88
+ </header>
89
+ );
90
+ };
@@ -0,0 +1,55 @@
1
+ "use client";
2
+
3
+ import { cn } from "../../../../lib/utils";
4
+ import {
5
+ SidebarGroup,
6
+ SidebarGroupLabel,
7
+ SidebarMenu,
8
+ SidebarMenuButton,
9
+ SidebarMenuItem,
10
+ } from "../../../ui/sidebar";
11
+ import React from "react";
12
+
13
+ export function Menus({
14
+ items,
15
+ }: {
16
+ items: {
17
+ title: string;
18
+ url: string;
19
+ items?: {
20
+ title: string;
21
+ url: string;
22
+ icon?: () => React.ReactNode;
23
+ isActive?: boolean | undefined;
24
+ }[];
25
+ }[];
26
+ }) {
27
+ return (
28
+ <>
29
+ {items.map((item, index) => {
30
+ return (
31
+ <SidebarGroup key={index}>
32
+ <SidebarGroupLabel>{item.title}</SidebarGroupLabel>
33
+ <SidebarMenu>
34
+ {item.items?.map((subItem) => (
35
+ <SidebarMenuItem key={subItem.title}>
36
+ <SidebarMenuButton
37
+ asChild
38
+ className={cn(
39
+ subItem?.isActive && "bg-sidebar-accent font-semibold"
40
+ )}
41
+ >
42
+ <a href={subItem.url}>
43
+ {subItem?.icon && subItem.icon()}
44
+ <span>{subItem.title}</span>
45
+ </a>
46
+ </SidebarMenuButton>
47
+ </SidebarMenuItem>
48
+ ))}
49
+ </SidebarMenu>
50
+ </SidebarGroup>
51
+ );
52
+ })}
53
+ </>
54
+ );
55
+ }