@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.
- package/README.md +390 -209
- package/dist/index.d.mts +485 -0
- package/dist/index.d.ts +485 -0
- package/dist/index.js +4259 -0
- package/dist/index.js.map +1 -0
- package/dist/index.mjs +4186 -0
- package/dist/index.mjs.map +1 -0
- package/dist/styles.css +2534 -0
- package/dist/styles.css.map +1 -0
- package/dist/styles.d.mts +2 -0
- package/dist/styles.d.ts +2 -0
- package/package.json +46 -6
- package/.eslintrc.json +0 -7
- package/.github/workflows/deploy-storybook.yml +0 -75
- package/.storybook/main.ts +0 -16
- package/.storybook/preview.ts +0 -15
- package/components.json +0 -21
- package/jest.config.ts +0 -25
- package/next.config.ts +0 -7
- package/postcss.config.mjs +0 -8
- package/public/file.svg +0 -1
- package/public/globe.svg +0 -1
- package/public/next.svg +0 -1
- package/public/vercel.svg +0 -1
- package/public/window.svg +0 -1
- package/src/app/columns.tsx +0 -178
- package/src/app/favicon.ico +0 -0
- package/src/app/fonts/GeistMonoVF.woff +0 -0
- package/src/app/fonts/GeistVF.woff +0 -0
- package/src/app/globals.css +0 -94
- package/src/app/layout.tsx +0 -35
- package/src/app/page.tsx +0 -7
- package/src/components/actions/AlertDialog/AlertDialog.tsx +0 -45
- package/src/components/actions/AlertDialog/alert-dialog.stories.tsx +0 -21
- package/src/components/actions/AlertDialog/index.ts +0 -1
- package/src/components/actions/Button/Button.stories.ts +0 -38
- package/src/components/actions/Button/Button.tsx +0 -23
- package/src/components/actions/Button/index.ts +0 -1
- package/src/components/actions/Collapsible/index.ts +0 -1
- package/src/components/actions/Dialog/Dialog.stories.tsx +0 -70
- package/src/components/actions/Dialog/Dialog.tsx +0 -87
- package/src/components/actions/Dialog/components/DialogWithActions/index.tsx +0 -40
- package/src/components/actions/Dialog/index.ts +0 -1
- package/src/components/actions/Steps/Steps.stories.tsx +0 -25
- package/src/components/actions/Steps/Steps.tsx +0 -51
- package/src/components/actions/Steps/index.ts +0 -1
- package/src/components/actions/index.ts +0 -5
- package/src/components/dataDisplay/Avatar/Avatar.stories.tsx +0 -22
- package/src/components/dataDisplay/Avatar/Avatar.tsx +0 -21
- package/src/components/dataDisplay/Avatar/index.ts +0 -2
- package/src/components/dataDisplay/Badge/Badge.stories.tsx +0 -36
- package/src/components/dataDisplay/Badge/index.ts +0 -1
- package/src/components/dataDisplay/Card/Card.stories.tsx +0 -24
- package/src/components/dataDisplay/Card/Card.tsx +0 -34
- package/src/components/dataDisplay/Card/index.ts +0 -1
- package/src/components/dataDisplay/DataPairList/DataPairList.tsx +0 -56
- package/src/components/dataDisplay/DataPairList/data-pair-list.stories.tsx +0 -87
- package/src/components/dataDisplay/DataPairList/index.ts +0 -2
- package/src/components/dataDisplay/DataPairList/types.ts +0 -10
- package/src/components/dataDisplay/DropDownMenu/index.ts +0 -1
- package/src/components/dataDisplay/ErrorMessage/ErrorMessage.tsx +0 -6
- package/src/components/dataDisplay/ErrorMessage/index.ts +0 -1
- package/src/components/dataDisplay/Icon/Icon.stories.tsx +0 -21
- package/src/components/dataDisplay/Icon/Icon.tsx +0 -47
- package/src/components/dataDisplay/Icon/index.ts +0 -1
- package/src/components/dataDisplay/Icon/types.ts +0 -6
- package/src/components/dataDisplay/Label/Label.stories.tsx +0 -21
- package/src/components/dataDisplay/Label/Label.tsx +0 -10
- package/src/components/dataDisplay/Label/index.ts +0 -1
- package/src/components/dataDisplay/Table/Table.tsx +0 -173
- package/src/components/dataDisplay/Table/columns.tsx +0 -223
- package/src/components/dataDisplay/Table/components/DynamicTable/data-table-column-header.tsx +0 -72
- package/src/components/dataDisplay/Table/components/DynamicTable/data-table-pagination.tsx +0 -91
- package/src/components/dataDisplay/Table/components/DynamicTable/data-table-toolbar.tsx +0 -17
- package/src/components/dataDisplay/Table/components/DynamicTable/data-table-view-options.tsx +0 -58
- package/src/components/dataDisplay/Table/components/DynamicTable/data-table.stories.tsx +0 -118
- package/src/components/dataDisplay/Table/components/DynamicTable/index.tsx +0 -136
- package/src/components/dataDisplay/Table/components/DynamicTable/types.ts +0 -43
- package/src/components/dataDisplay/Table/custom/CustomTable/data-table-column-header.tsx +0 -71
- package/src/components/dataDisplay/Table/custom/CustomTable/data-table-faceted-filter.tsx +0 -147
- package/src/components/dataDisplay/Table/custom/CustomTable/data-table-pagination.tsx +0 -97
- package/src/components/dataDisplay/Table/custom/CustomTable/data-table-row-actions.tsx +0 -78
- package/src/components/dataDisplay/Table/custom/CustomTable/data-table-toolbar.tsx +0 -60
- package/src/components/dataDisplay/Table/custom/CustomTable/data-table-view-options.tsx +0 -59
- package/src/components/dataDisplay/Table/custom/CustomTable/data-table.tsx +0 -145
- package/src/components/dataDisplay/Table/custom/CustomTable/data.ts +0 -71
- package/src/components/dataDisplay/Table/custom/CustomTable/index.tsx +0 -34
- package/src/components/dataDisplay/Table/custom/CustomTable/schema.ts +0 -11
- package/src/components/dataDisplay/Table/index.ts +0 -2
- package/src/components/dataDisplay/Table/table.stories.tsx +0 -147
- package/src/components/dataDisplay/Table/types.ts +0 -15
- package/src/components/dataDisplay/Tabs/Tabs.stories.tsx +0 -34
- package/src/components/dataDisplay/Tabs/Tabs.tsx +0 -53
- package/src/components/dataDisplay/Tabs/index.ts +0 -1
- package/src/components/dataDisplay/Text/Text.stories.tsx +0 -66
- package/src/components/dataDisplay/Text/Text.tsx +0 -56
- package/src/components/dataDisplay/Text/index.ts +0 -1
- package/src/components/dataDisplay/index.ts +0 -8
- package/src/components/dataInput/Input/components/Input/Input.stories.tsx +0 -99
- package/src/components/dataInput/Input/components/Input/InputBase.tsx +0 -50
- package/src/components/dataInput/Input/components/Input/__tests__/input.test.tsx +0 -38
- package/src/components/dataInput/Input/components/Input/index.tsx +0 -48
- package/src/components/dataInput/Input/components/Input/types.ts +0 -15
- package/src/components/dataInput/Input/components/InputBase/index.tsx +0 -31
- package/src/components/dataInput/Input/components/MaskInput/__tests__/mask-input.test.tsx +0 -77
- package/src/components/dataInput/Input/components/MaskInput/index.ts +0 -1
- package/src/components/dataInput/Input/components/MaskInput/mask-input.stories.tsx +0 -85
- package/src/components/dataInput/Input/components/MaskInput/mask-input.tsx +0 -73
- package/src/components/dataInput/Input/components/MultipleInput/MultipleInput.tsx +0 -105
- package/src/components/dataInput/Input/components/MultipleInput/MultipleInputBase.tsx +0 -100
- package/src/components/dataInput/Input/components/MultipleInput/MultipleMaskInput.tsx +0 -35
- package/src/components/dataInput/Input/components/MultipleInput/MultipleNumberInput.tsx +0 -35
- package/src/components/dataInput/Input/components/MultipleInput/__tests__/multiple-input.test.tsx +0 -152
- package/src/components/dataInput/Input/components/MultipleInput/index.ts +0 -2
- package/src/components/dataInput/Input/components/MultipleInput/multiple-input.stories.tsx +0 -96
- package/src/components/dataInput/Input/components/NumberInput/__tests__/number-input.test.tsx +0 -175
- package/src/components/dataInput/Input/components/NumberInput/index.ts +0 -1
- package/src/components/dataInput/Input/components/NumberInput/number-input.stories.tsx +0 -76
- package/src/components/dataInput/Input/components/NumberInput/number-input.tsx +0 -70
- package/src/components/dataInput/Input/index.ts +0 -4
- package/src/components/dataInput/Select/MultiSelect/MultiSelect.stories.tsx +0 -119
- package/src/components/dataInput/Select/MultiSelect/MultiSelectBase.tsx +0 -135
- package/src/components/dataInput/Select/MultiSelect/index.tsx +0 -75
- package/src/components/dataInput/Select/Select.stories.tsx +0 -61
- package/src/components/dataInput/Select/Select.tsx +0 -73
- package/src/components/dataInput/Select/SelectBase.tsx +0 -58
- package/src/components/dataInput/Select/index.ts +0 -2
- package/src/components/dataInput/Switch/Switch.stories.tsx +0 -75
- package/src/components/dataInput/Switch/Switch.tsx +0 -52
- package/src/components/dataInput/Switch/index.ts +0 -1
- package/src/components/dataInput/checkbox/Checkbox.tsx +0 -57
- package/src/components/dataInput/checkbox/Checkbox_old.tsx +0 -58
- package/src/components/dataInput/checkbox/Checkout.stories.tsx +0 -62
- package/src/components/dataInput/checkbox/index.ts +0 -1
- package/src/components/dataInput/form/Form.tsx +0 -47
- package/src/components/dataInput/form/index.ts +0 -3
- package/src/components/dataInput/index.ts +0 -5
- package/src/components/feedback/ErrorLabel/index.tsx +0 -24
- package/src/components/feedback/Spinner/index.ts +0 -1
- package/src/components/feedback/Toast/Toast.stories.tsx +0 -45
- package/src/components/feedback/Toast/index.ts +0 -2
- package/src/components/feedback/index.ts +0 -2
- package/src/components/index.ts +0 -6
- package/src/components/layout/Crud/components/Table/index.tsx +0 -183
- package/src/components/layout/Crud/components/Table/types.ts +0 -15
- package/src/components/layout/Crud/crud.stories.tsx +0 -317
- package/src/components/layout/Crud/hook/useCrudLayout/index.tsx +0 -94
- package/src/components/layout/Crud/hook/useRequest/index.tsx +0 -156
- package/src/components/layout/Crud/index.tsx +0 -295
- package/src/components/layout/Crud/store/CrudLayoutStore.ts +0 -75
- package/src/components/layout/Crud/types.ts +0 -14
- package/src/components/layout/Drawer/CustomDrawer/index.tsx +0 -33
- package/src/components/layout/Drawer/Drawer.stories.tsx +0 -80
- package/src/components/layout/Drawer/index.ts +0 -2
- package/src/components/layout/PageLayout/PageLayout.stories.tsx +0 -42
- package/src/components/layout/PageLayout/index.tsx +0 -28
- package/src/components/layout/Separator/index.ts +0 -1
- package/src/components/layout/Sheet/Sheet.stories.tsx +0 -28
- package/src/components/layout/Sheet/Sheet.tsx +0 -22
- package/src/components/layout/Sheet/index.ts +0 -1
- package/src/components/layout/Sidebar/Sidebar.stories.tsx +0 -116
- package/src/components/layout/Sidebar/Sidebar.tsx +0 -50
- package/src/components/layout/Sidebar/components/app-sidebar.tsx +0 -203
- package/src/components/layout/Sidebar/components/footer-sidebar.tsx +0 -17
- package/src/components/layout/Sidebar/components/header-sidebar.tsx +0 -90
- package/src/components/layout/Sidebar/components/menus.tsx +0 -55
- package/src/components/layout/Sidebar/components/nav-projects.tsx +0 -88
- package/src/components/layout/Sidebar/components/nav-user.tsx +0 -114
- package/src/components/layout/Sidebar/components/team-switcher.tsx +0 -85
- package/src/components/layout/Sidebar/index.ts +0 -2
- package/src/components/layout/Sidebar/provider/index.tsx +0 -51
- package/src/components/layout/Tabs/Tabs.tsx +0 -51
- package/src/components/layout/Tabs/index.ts +0 -1
- package/src/components/layout/Tabs/tabs.stories.tsx +0 -57
- package/src/components/layout/index.ts +0 -6
- package/src/components/navigation/Breadcrumbs/Breadcrumbs.tsx +0 -66
- package/src/components/navigation/Breadcrumbs/index.ts +0 -2
- package/src/components/navigation/index.ts +0 -1
- package/src/components/ui/alert-dialog.tsx +0 -141
- package/src/components/ui/alert.tsx +0 -59
- package/src/components/ui/avatar.tsx +0 -50
- package/src/components/ui/badge.tsx +0 -40
- package/src/components/ui/breadcrumb.tsx +0 -115
- package/src/components/ui/button.tsx +0 -57
- package/src/components/ui/card.tsx +0 -83
- package/src/components/ui/checkbox.tsx +0 -34
- package/src/components/ui/collapsible.tsx +0 -11
- package/src/components/ui/command.tsx +0 -153
- package/src/components/ui/dialog.tsx +0 -124
- package/src/components/ui/drawer.tsx +0 -117
- package/src/components/ui/dropdown-menu.tsx +0 -201
- package/src/components/ui/form.tsx +0 -179
- package/src/components/ui/input.tsx +0 -24
- package/src/components/ui/label.tsx +0 -30
- package/src/components/ui/popover.tsx +0 -33
- package/src/components/ui/select.tsx +0 -161
- package/src/components/ui/separator.tsx +0 -31
- package/src/components/ui/sheet.tsx +0 -140
- package/src/components/ui/sidebar.tsx +0 -763
- package/src/components/ui/skeleton.tsx +0 -15
- package/src/components/ui/sonner.tsx +0 -31
- package/src/components/ui/spinner.tsx +0 -54
- package/src/components/ui/switch.tsx +0 -33
- package/src/components/ui/table.tsx +0 -120
- package/src/components/ui/tabs.tsx +0 -55
- package/src/components/ui/toast.tsx +0 -130
- package/src/components/ui/toaster.tsx +0 -35
- package/src/components/ui/tooltip.tsx +0 -32
- package/src/hooks/use-conditional-controller.tsx +0 -35
- package/src/hooks/use-mask.tsx +0 -116
- package/src/hooks/use-mobile.tsx +0 -19
- package/src/hooks/use-toast.ts +0 -191
- package/src/index.ts +0 -1
- package/src/introduction.mdx +0 -132
- package/src/lib/utils.ts +0 -6
- package/tailwind.config.ts +0 -83
- package/tsconfig.json +0 -27
package/README.md
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
#
|
|
1
|
+
# �� PHSA Design System React
|
|
2
2
|
|
|
3
3
|
A comprehensive React design system built with modern tools and best practices, featuring reusable components, consistent styling, and powerful layout solutions.
|
|
4
4
|
|
|
@@ -6,289 +6,470 @@ A comprehensive React design system built with modern tools and best practices,
|
|
|
6
6
|
|
|
7
7
|
🌐 **[View Live Documentation](https://henriques4nti4go.github.io/phsa-design-system/)**
|
|
8
8
|
|
|
9
|
-
Explore all components interactively in our Storybook documentation
|
|
9
|
+
Explore all components interactively in our Storybook documentation.
|
|
10
10
|
|
|
11
11
|
## ✨ Features
|
|
12
12
|
|
|
13
|
-
- 🧩 **Modular Components** -
|
|
14
|
-
-
|
|
15
|
-
-
|
|
16
|
-
-
|
|
17
|
-
-
|
|
18
|
-
-
|
|
19
|
-
-
|
|
20
|
-
- 🧪 **Testing Ready** - Jest and Testing Library setup
|
|
21
|
-
- 📱 **Responsive Design** - Mobile-first approach
|
|
13
|
+
- 🧩 **50+ Modular Components** - Complete component library with TypeScript
|
|
14
|
+
- 🎨 **Tailwind CSS Ready** - Pre-styled components with customizable themes
|
|
15
|
+
- 🔧 **Form Management** - Integrated with React Hook Form + Zod validation
|
|
16
|
+
- 📊 **Advanced Data Tables** - Built with TanStack Table
|
|
17
|
+
- 🌙 **Dark/Light Theme** - Built-in theme switching
|
|
18
|
+
- 🔍 **Full TypeScript Support** - Complete type safety
|
|
19
|
+
- 📱 **Responsive & Accessible** - Mobile-first and WCAG compliant
|
|
22
20
|
|
|
23
|
-
##
|
|
24
|
-
|
|
25
|
-
- **Framework**: Next.js 15
|
|
26
|
-
- **UI Library**: Radix UI primitives
|
|
27
|
-
- **Styling**: Tailwind CSS
|
|
28
|
-
- **State Management**: Zustand
|
|
29
|
-
- **Forms**: React Hook Form + Zod validation
|
|
30
|
-
- **Data Fetching**: TanStack Query
|
|
31
|
-
- **Icons**: Lucide React
|
|
32
|
-
- **Documentation**: Storybook
|
|
33
|
-
- **Testing**: Jest + Testing Library
|
|
34
|
-
- **Language**: TypeScript
|
|
35
|
-
|
|
36
|
-
## 🚀 Getting Started
|
|
37
|
-
|
|
38
|
-
### Prerequisites
|
|
39
|
-
|
|
40
|
-
Make sure you have Node.js installed on your machine (version 18 or higher recommended).
|
|
41
|
-
|
|
42
|
-
### Installation
|
|
43
|
-
|
|
44
|
-
#### Option 1: Install from npm (Recommended)
|
|
45
|
-
|
|
46
|
-
Install the published package directly from npm:
|
|
21
|
+
## 🚀 Installation
|
|
47
22
|
|
|
48
23
|
```bash
|
|
49
24
|
npm install @phsa.tec/design-system-react
|
|
50
|
-
# or
|
|
51
|
-
yarn add @phsa.tec/design-system-react
|
|
52
|
-
# or
|
|
53
|
-
pnpm add @phsa.tec/design-system-react
|
|
54
25
|
```
|
|
55
26
|
|
|
56
|
-
|
|
27
|
+
### Required Peer Dependencies
|
|
57
28
|
|
|
58
|
-
|
|
29
|
+
Install the required peer dependencies in your project:
|
|
59
30
|
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
```bash
|
|
65
|
-
git clone <repository-url>
|
|
66
|
-
cd phsa-design-system
|
|
67
|
-
```
|
|
68
|
-
|
|
69
|
-
2. **Install dependencies**
|
|
70
|
-
```bash
|
|
71
|
-
npm install
|
|
72
|
-
# or
|
|
73
|
-
yarn install
|
|
74
|
-
# or
|
|
75
|
-
pnpm install
|
|
76
|
-
```
|
|
77
|
-
|
|
78
|
-
### 🏃 Running the Project
|
|
79
|
-
|
|
80
|
-
#### Development Server
|
|
31
|
+
```bash
|
|
32
|
+
npm install react react-dom @radix-ui/react-alert-dialog @radix-ui/react-avatar @radix-ui/react-checkbox @radix-ui/react-collapsible @radix-ui/react-dialog @radix-ui/react-dropdown-menu @radix-ui/react-icons @radix-ui/react-label @radix-ui/react-popover @radix-ui/react-select @radix-ui/react-separator @radix-ui/react-slot @radix-ui/react-switch @radix-ui/react-tabs @radix-ui/react-toast @radix-ui/react-tooltip class-variance-authority clsx lucide-react tailwind-merge
|
|
33
|
+
```
|
|
81
34
|
|
|
82
|
-
|
|
35
|
+
Or use yarn:
|
|
83
36
|
|
|
84
37
|
```bash
|
|
85
|
-
|
|
38
|
+
yarn add react react-dom @radix-ui/react-alert-dialog @radix-ui/react-avatar @radix-ui/react-checkbox @radix-ui/react-collapsible @radix-ui/react-dialog @radix-ui/react-dropdown-menu @radix-ui/react-icons @radix-ui/react-label @radix-ui/react-popover @radix-ui/react-select @radix-ui/react-separator @radix-ui/react-slot @radix-ui/react-switch @radix-ui/react-tabs @radix-ui/react-toast @radix-ui/react-tooltip class-variance-authority clsx lucide-react tailwind-merge
|
|
86
39
|
```
|
|
87
40
|
|
|
88
|
-
|
|
41
|
+
## ⚙️ Setup
|
|
89
42
|
|
|
90
|
-
|
|
43
|
+
### 1. Configure Tailwind CSS
|
|
91
44
|
|
|
92
|
-
|
|
45
|
+
Add to your `tailwind.config.js`:
|
|
93
46
|
|
|
94
|
-
```
|
|
95
|
-
|
|
47
|
+
```javascript
|
|
48
|
+
/** @type {import('tailwindcss').Config} */
|
|
49
|
+
module.exports = {
|
|
50
|
+
content: [
|
|
51
|
+
"./src/**/*.{js,ts,jsx,tsx,mdx}",
|
|
52
|
+
"./node_modules/@phsa.tec/design-system-react/**/*.{js,ts,jsx,tsx}",
|
|
53
|
+
],
|
|
54
|
+
theme: {
|
|
55
|
+
extend: {
|
|
56
|
+
colors: {
|
|
57
|
+
border: "hsl(var(--border))",
|
|
58
|
+
background: "hsl(var(--background))",
|
|
59
|
+
foreground: "hsl(var(--foreground))",
|
|
60
|
+
primary: {
|
|
61
|
+
DEFAULT: "hsl(var(--primary))",
|
|
62
|
+
foreground: "hsl(var(--primary-foreground))",
|
|
63
|
+
},
|
|
64
|
+
secondary: {
|
|
65
|
+
DEFAULT: "hsl(var(--secondary))",
|
|
66
|
+
foreground: "hsl(var(--secondary-foreground))",
|
|
67
|
+
},
|
|
68
|
+
// Add more theme colors as needed
|
|
69
|
+
},
|
|
70
|
+
},
|
|
71
|
+
},
|
|
72
|
+
plugins: [],
|
|
73
|
+
};
|
|
96
74
|
```
|
|
97
75
|
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
76
|
+
### 2. Add CSS Variables
|
|
77
|
+
|
|
78
|
+
Add these CSS variables to your global CSS file (`globals.css` or `index.css`):
|
|
79
|
+
|
|
80
|
+
```css
|
|
81
|
+
@tailwind base;
|
|
82
|
+
@tailwind components;
|
|
83
|
+
@tailwind utilities;
|
|
84
|
+
|
|
85
|
+
@layer base {
|
|
86
|
+
:root {
|
|
87
|
+
--background: 0 0% 100%;
|
|
88
|
+
--foreground: 222.2 84% 4.9%;
|
|
89
|
+
--card: 0 0% 100%;
|
|
90
|
+
--card-foreground: 222.2 84% 4.9%;
|
|
91
|
+
--popover: 0 0% 100%;
|
|
92
|
+
--popover-foreground: 222.2 84% 4.9%;
|
|
93
|
+
--primary: 222.2 47.4% 11.2%;
|
|
94
|
+
--primary-foreground: 210 40% 98%;
|
|
95
|
+
--secondary: 210 40% 96%;
|
|
96
|
+
--secondary-foreground: 222.2 84% 4.9%;
|
|
97
|
+
--muted: 210 40% 96%;
|
|
98
|
+
--muted-foreground: 215.4 16.3% 46.9%;
|
|
99
|
+
--accent: 210 40% 96%;
|
|
100
|
+
--accent-foreground: 222.2 84% 4.9%;
|
|
101
|
+
--destructive: 0 84.2% 60.2%;
|
|
102
|
+
--destructive-foreground: 210 40% 98%;
|
|
103
|
+
--border: 214.3 31.8% 91.4%;
|
|
104
|
+
--input: 214.3 31.8% 91.4%;
|
|
105
|
+
--ring: 222.2 84% 4.9%;
|
|
106
|
+
--radius: 0.5rem;
|
|
107
|
+
}
|
|
101
108
|
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
109
|
+
.dark {
|
|
110
|
+
--background: 222.2 84% 4.9%;
|
|
111
|
+
--foreground: 210 40% 98%;
|
|
112
|
+
--card: 222.2 84% 4.9%;
|
|
113
|
+
--card-foreground: 210 40% 98%;
|
|
114
|
+
--popover: 222.2 84% 4.9%;
|
|
115
|
+
--popover-foreground: 210 40% 98%;
|
|
116
|
+
--primary: 210 40% 98%;
|
|
117
|
+
--primary-foreground: 222.2 47.4% 11.2%;
|
|
118
|
+
--secondary: 217.2 32.6% 17.5%;
|
|
119
|
+
--secondary-foreground: 210 40% 98%;
|
|
120
|
+
--muted: 217.2 32.6% 17.5%;
|
|
121
|
+
--muted-foreground: 215 20.2% 65.1%;
|
|
122
|
+
--accent: 217.2 32.6% 17.5%;
|
|
123
|
+
--accent-foreground: 210 40% 98%;
|
|
124
|
+
--destructive: 0 62.8% 30.6%;
|
|
125
|
+
--destructive-foreground: 210 40% 98%;
|
|
126
|
+
--border: 217.2 32.6% 17.5%;
|
|
127
|
+
--input: 217.2 32.6% 17.5%;
|
|
128
|
+
--ring: 212.7 26.8% 83.9%;
|
|
129
|
+
}
|
|
130
|
+
}
|
|
105
131
|
```
|
|
106
132
|
|
|
107
|
-
|
|
133
|
+
### 3. Theme Provider (Optional)
|
|
108
134
|
|
|
109
|
-
|
|
110
|
-
npm run test
|
|
111
|
-
```
|
|
135
|
+
For dark/light mode support, wrap your app with the theme provider:
|
|
112
136
|
|
|
113
|
-
|
|
137
|
+
```tsx
|
|
138
|
+
import { ThemeProvider } from "next-themes";
|
|
114
139
|
|
|
115
|
-
|
|
116
|
-
|
|
140
|
+
function App() {
|
|
141
|
+
return (
|
|
142
|
+
<ThemeProvider attribute="class" defaultTheme="system" enableSystem>
|
|
143
|
+
{/* Your app components */}
|
|
144
|
+
</ThemeProvider>
|
|
145
|
+
);
|
|
146
|
+
}
|
|
117
147
|
```
|
|
118
148
|
|
|
119
|
-
##
|
|
149
|
+
## 🎯 Usage Examples
|
|
120
150
|
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
151
|
+
### Basic Components
|
|
152
|
+
|
|
153
|
+
```tsx
|
|
154
|
+
import {
|
|
155
|
+
Button,
|
|
156
|
+
Input,
|
|
157
|
+
Badge,
|
|
158
|
+
Card,
|
|
159
|
+
CardContent,
|
|
160
|
+
CardHeader,
|
|
161
|
+
CardTitle,
|
|
162
|
+
} from "@phsa.tec/design-system-react";
|
|
163
|
+
|
|
164
|
+
function MyComponent() {
|
|
165
|
+
return (
|
|
166
|
+
<Card>
|
|
167
|
+
<CardHeader>
|
|
168
|
+
<CardTitle>Welcome</CardTitle>
|
|
169
|
+
</CardHeader>
|
|
170
|
+
<CardContent>
|
|
171
|
+
<div className="space-y-4">
|
|
172
|
+
<Input placeholder="Enter your name" />
|
|
173
|
+
<div className="flex gap-2">
|
|
174
|
+
<Button>Primary Action</Button>
|
|
175
|
+
<Button variant="secondary">Secondary</Button>
|
|
176
|
+
</div>
|
|
177
|
+
<Badge>New Feature</Badge>
|
|
178
|
+
</div>
|
|
179
|
+
</CardContent>
|
|
180
|
+
</Card>
|
|
181
|
+
);
|
|
182
|
+
}
|
|
131
183
|
```
|
|
132
184
|
|
|
133
|
-
|
|
185
|
+
### Form Example with Validation
|
|
134
186
|
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
187
|
+
```tsx
|
|
188
|
+
import {
|
|
189
|
+
Form,
|
|
190
|
+
FormControl,
|
|
191
|
+
FormField,
|
|
192
|
+
FormItem,
|
|
193
|
+
FormLabel,
|
|
194
|
+
FormMessage,
|
|
195
|
+
Input,
|
|
196
|
+
Button,
|
|
197
|
+
Select,
|
|
198
|
+
SelectContent,
|
|
199
|
+
SelectItem,
|
|
200
|
+
SelectTrigger,
|
|
201
|
+
SelectValue,
|
|
202
|
+
} from "@phsa.tec/design-system-react";
|
|
203
|
+
import { useForm } from "react-hook-form";
|
|
204
|
+
import { zodResolver } from "@hookform/resolvers/zod";
|
|
205
|
+
import * as z from "zod";
|
|
206
|
+
|
|
207
|
+
const formSchema = z.object({
|
|
208
|
+
name: z.string().min(2, "Name must be at least 2 characters"),
|
|
209
|
+
email: z.string().email("Invalid email address"),
|
|
210
|
+
role: z.string().min(1, "Please select a role"),
|
|
211
|
+
});
|
|
212
|
+
|
|
213
|
+
function UserForm() {
|
|
214
|
+
const form = useForm<z.infer<typeof formSchema>>({
|
|
215
|
+
resolver: zodResolver(formSchema),
|
|
216
|
+
defaultValues: {
|
|
217
|
+
name: "",
|
|
218
|
+
email: "",
|
|
219
|
+
role: "",
|
|
220
|
+
},
|
|
221
|
+
});
|
|
145
222
|
|
|
146
|
-
|
|
223
|
+
function onSubmit(values: z.infer<typeof formSchema>) {
|
|
224
|
+
console.log(values);
|
|
225
|
+
}
|
|
147
226
|
|
|
148
|
-
|
|
227
|
+
return (
|
|
228
|
+
<Form {...form}>
|
|
229
|
+
<form onSubmit={form.handleSubmit(onSubmit)} className="space-y-8">
|
|
230
|
+
<FormField
|
|
231
|
+
control={form.control}
|
|
232
|
+
name="name"
|
|
233
|
+
render={({ field }) => (
|
|
234
|
+
<FormItem>
|
|
235
|
+
<FormLabel>Name</FormLabel>
|
|
236
|
+
<FormControl>
|
|
237
|
+
<Input placeholder="John Doe" {...field} />
|
|
238
|
+
</FormControl>
|
|
239
|
+
<FormMessage />
|
|
240
|
+
</FormItem>
|
|
241
|
+
)}
|
|
242
|
+
/>
|
|
243
|
+
|
|
244
|
+
<FormField
|
|
245
|
+
control={form.control}
|
|
246
|
+
name="email"
|
|
247
|
+
render={({ field }) => (
|
|
248
|
+
<FormItem>
|
|
249
|
+
<FormLabel>Email</FormLabel>
|
|
250
|
+
<FormControl>
|
|
251
|
+
<Input placeholder="john@example.com" {...field} />
|
|
252
|
+
</FormControl>
|
|
253
|
+
<FormMessage />
|
|
254
|
+
</FormItem>
|
|
255
|
+
)}
|
|
256
|
+
/>
|
|
257
|
+
|
|
258
|
+
<FormField
|
|
259
|
+
control={form.control}
|
|
260
|
+
name="role"
|
|
261
|
+
render={({ field }) => (
|
|
262
|
+
<FormItem>
|
|
263
|
+
<FormLabel>Role</FormLabel>
|
|
264
|
+
<Select onValueChange={field.onChange} defaultValue={field.value}>
|
|
265
|
+
<FormControl>
|
|
266
|
+
<SelectTrigger>
|
|
267
|
+
<SelectValue placeholder="Select a role" />
|
|
268
|
+
</SelectTrigger>
|
|
269
|
+
</FormControl>
|
|
270
|
+
<SelectContent>
|
|
271
|
+
<SelectItem value="admin">Admin</SelectItem>
|
|
272
|
+
<SelectItem value="user">User</SelectItem>
|
|
273
|
+
<SelectItem value="viewer">Viewer</SelectItem>
|
|
274
|
+
</SelectContent>
|
|
275
|
+
</Select>
|
|
276
|
+
<FormMessage />
|
|
277
|
+
</FormItem>
|
|
278
|
+
)}
|
|
279
|
+
/>
|
|
280
|
+
|
|
281
|
+
<Button type="submit">Submit</Button>
|
|
282
|
+
</form>
|
|
283
|
+
</Form>
|
|
284
|
+
);
|
|
285
|
+
}
|
|
286
|
+
```
|
|
149
287
|
|
|
150
|
-
###
|
|
288
|
+
### Data Table Example
|
|
151
289
|
|
|
152
|
-
|
|
153
|
-
|
|
290
|
+
```tsx
|
|
291
|
+
import { DataTable } from "@phsa.tec/design-system-react";
|
|
292
|
+
import { ColumnDef } from "@tanstack/react-table";
|
|
293
|
+
|
|
294
|
+
type User = {
|
|
295
|
+
id: string;
|
|
296
|
+
name: string;
|
|
297
|
+
email: string;
|
|
298
|
+
role: string;
|
|
299
|
+
};
|
|
154
300
|
|
|
155
|
-
|
|
301
|
+
const columns: ColumnDef<User>[] = [
|
|
302
|
+
{
|
|
303
|
+
accessorKey: "name",
|
|
304
|
+
header: "Name",
|
|
305
|
+
},
|
|
306
|
+
{
|
|
307
|
+
accessorKey: "email",
|
|
308
|
+
header: "Email",
|
|
309
|
+
},
|
|
310
|
+
{
|
|
311
|
+
accessorKey: "role",
|
|
312
|
+
header: "Role",
|
|
313
|
+
},
|
|
314
|
+
];
|
|
156
315
|
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
316
|
+
function UsersTable() {
|
|
317
|
+
const data: User[] = [
|
|
318
|
+
{ id: "1", name: "John Doe", email: "john@example.com", role: "Admin" },
|
|
319
|
+
{ id: "2", name: "Jane Smith", email: "jane@example.com", role: "User" },
|
|
320
|
+
];
|
|
161
321
|
|
|
162
|
-
|
|
322
|
+
return (
|
|
323
|
+
<DataTable
|
|
324
|
+
columns={columns}
|
|
325
|
+
data={data}
|
|
326
|
+
searchKey="name"
|
|
327
|
+
searchPlaceholder="Search users..."
|
|
328
|
+
/>
|
|
329
|
+
);
|
|
330
|
+
}
|
|
331
|
+
```
|
|
163
332
|
|
|
164
|
-
|
|
165
|
-
- **Toast** - Notification system
|
|
166
|
-
- **Avatar** - User avatar component
|
|
167
|
-
- **Tooltip** - Contextual help tooltips
|
|
333
|
+
### Dialog/Modal Example
|
|
168
334
|
|
|
169
|
-
|
|
335
|
+
```tsx
|
|
336
|
+
import {
|
|
337
|
+
Dialog,
|
|
338
|
+
DialogContent,
|
|
339
|
+
DialogDescription,
|
|
340
|
+
DialogHeader,
|
|
341
|
+
DialogTitle,
|
|
342
|
+
DialogTrigger,
|
|
343
|
+
Button,
|
|
344
|
+
} from "@phsa.tec/design-system-react";
|
|
345
|
+
|
|
346
|
+
function MyDialog() {
|
|
347
|
+
return (
|
|
348
|
+
<Dialog>
|
|
349
|
+
<DialogTrigger asChild>
|
|
350
|
+
<Button>Open Dialog</Button>
|
|
351
|
+
</DialogTrigger>
|
|
352
|
+
<DialogContent>
|
|
353
|
+
<DialogHeader>
|
|
354
|
+
<DialogTitle>Confirm Action</DialogTitle>
|
|
355
|
+
<DialogDescription>
|
|
356
|
+
This action cannot be undone. Are you sure you want to continue?
|
|
357
|
+
</DialogDescription>
|
|
358
|
+
</DialogHeader>
|
|
359
|
+
<div className="flex justify-end space-x-2">
|
|
360
|
+
<Button variant="outline">Cancel</Button>
|
|
361
|
+
<Button>Confirm</Button>
|
|
362
|
+
</div>
|
|
363
|
+
</DialogContent>
|
|
364
|
+
</Dialog>
|
|
365
|
+
);
|
|
366
|
+
}
|
|
367
|
+
```
|
|
170
368
|
|
|
171
|
-
|
|
369
|
+
## 🧩 Available Components
|
|
172
370
|
|
|
173
|
-
|
|
371
|
+
### Layout
|
|
174
372
|
|
|
175
|
-
|
|
373
|
+
- `Card`, `CardContent`, `CardHeader`, `CardTitle`, `CardDescription`
|
|
374
|
+
- `Sheet`, `SheetContent`, `SheetHeader`, `SheetTitle`
|
|
375
|
+
- `Tabs`, `TabsList`, `TabsTrigger`, `TabsContent`
|
|
376
|
+
- `Separator`
|
|
176
377
|
|
|
177
|
-
|
|
378
|
+
### Data Display
|
|
178
379
|
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
380
|
+
- `DataTable` - Advanced table with sorting, filtering, pagination
|
|
381
|
+
- `Badge` - Status indicators
|
|
382
|
+
- `Avatar`, `AvatarImage`, `AvatarFallback`
|
|
383
|
+
- `Tooltip`, `TooltipContent`, `TooltipProvider`, `TooltipTrigger`
|
|
182
384
|
|
|
183
|
-
|
|
385
|
+
### Data Input
|
|
184
386
|
|
|
185
|
-
-
|
|
186
|
-
-
|
|
187
|
-
-
|
|
188
|
-
-
|
|
387
|
+
- `Input` - Text input with validation
|
|
388
|
+
- `Button` - Customizable button component
|
|
389
|
+
- `Select`, `SelectContent`, `SelectItem`, `SelectTrigger`, `SelectValue`
|
|
390
|
+
- `Checkbox` - Checkbox input
|
|
391
|
+
- `Switch` - Toggle switch
|
|
392
|
+
- `Form`, `FormControl`, `FormField`, `FormItem`, `FormLabel`, `FormMessage`
|
|
189
393
|
|
|
190
|
-
|
|
394
|
+
### Feedback
|
|
191
395
|
|
|
192
|
-
|
|
396
|
+
- `Dialog`, `DialogContent`, `DialogHeader`, `DialogTitle`, `DialogTrigger`
|
|
397
|
+
- `AlertDialog`, `AlertDialogAction`, `AlertDialogCancel`
|
|
398
|
+
- `Toast` - Notification system
|
|
399
|
+
- `Alert`, `AlertDescription`, `AlertTitle`
|
|
193
400
|
|
|
194
|
-
|
|
195
|
-
import { ThemeProvider } from "next-themes";
|
|
401
|
+
### Navigation
|
|
196
402
|
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
<ThemeProvider attribute="class" defaultTheme="system">
|
|
200
|
-
{/* Your app */}
|
|
201
|
-
</ThemeProvider>
|
|
202
|
-
);
|
|
203
|
-
}
|
|
204
|
-
```
|
|
403
|
+
- `DropdownMenu`, `DropdownMenuContent`, `DropdownMenuItem`
|
|
404
|
+
- `Command`, `CommandDialog`, `CommandInput`, `CommandList`
|
|
205
405
|
|
|
206
|
-
##
|
|
406
|
+
## 🎨 Customization
|
|
207
407
|
|
|
208
|
-
###
|
|
408
|
+
### Component Variants
|
|
209
409
|
|
|
210
|
-
|
|
410
|
+
Most components support multiple variants:
|
|
211
411
|
|
|
212
|
-
```
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
412
|
+
```tsx
|
|
413
|
+
// Button variants
|
|
414
|
+
<Button variant="default">Default</Button>
|
|
415
|
+
<Button variant="destructive">Delete</Button>
|
|
416
|
+
<Button variant="outline">Outline</Button>
|
|
417
|
+
<Button variant="secondary">Secondary</Button>
|
|
418
|
+
<Button variant="ghost">Ghost</Button>
|
|
419
|
+
<Button variant="link">Link</Button>
|
|
420
|
+
|
|
421
|
+
// Button sizes
|
|
422
|
+
<Button size="sm">Small</Button>
|
|
423
|
+
<Button size="default">Default</Button>
|
|
424
|
+
<Button size="lg">Large</Button>
|
|
225
425
|
```
|
|
226
426
|
|
|
227
|
-
###
|
|
427
|
+
### Custom Styling
|
|
228
428
|
|
|
229
|
-
Components
|
|
429
|
+
Components accept custom className props:
|
|
230
430
|
|
|
231
431
|
```tsx
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
variants: {
|
|
236
|
-
variant: {
|
|
237
|
-
default: "bg-primary text-primary-foreground",
|
|
238
|
-
secondary: "bg-secondary text-secondary-foreground",
|
|
239
|
-
},
|
|
240
|
-
},
|
|
241
|
-
}
|
|
242
|
-
);
|
|
432
|
+
<Button className="bg-purple-500 hover:bg-purple-600">
|
|
433
|
+
Custom Purple Button
|
|
434
|
+
</Button>
|
|
243
435
|
```
|
|
244
436
|
|
|
245
|
-
##
|
|
437
|
+
## 🔧 TypeScript Support
|
|
246
438
|
|
|
247
|
-
|
|
248
|
-
2. Create a feature branch (`git checkout -b feature/amazing-feature`)
|
|
249
|
-
3. Commit your changes (`git commit -m 'Add some amazing feature'`)
|
|
250
|
-
4. Push to the branch (`git push origin feature/amazing-feature`)
|
|
251
|
-
5. Open a Pull Request
|
|
439
|
+
All components are fully typed with TypeScript:
|
|
252
440
|
|
|
253
|
-
|
|
441
|
+
```tsx
|
|
442
|
+
import type { ButtonProps } from "@phsa.tec/design-system-react";
|
|
254
443
|
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
- Follow the existing code style
|
|
259
|
-
- Update documentation as needed
|
|
444
|
+
interface CustomButtonProps extends ButtonProps {
|
|
445
|
+
isLoading?: boolean;
|
|
446
|
+
}
|
|
260
447
|
|
|
261
|
-
|
|
448
|
+
function CustomButton({ isLoading, children, ...props }: CustomButtonProps) {
|
|
449
|
+
return (
|
|
450
|
+
<Button disabled={isLoading} {...props}>
|
|
451
|
+
{isLoading ? "Loading..." : children}
|
|
452
|
+
</Button>
|
|
453
|
+
);
|
|
454
|
+
}
|
|
455
|
+
```
|
|
262
456
|
|
|
263
|
-
|
|
264
|
-
| ------------------------- | ------------------------ |
|
|
265
|
-
| `npm run dev` | Start development server |
|
|
266
|
-
| `npm run build` | Build for production |
|
|
267
|
-
| `npm run start` | Start production server |
|
|
268
|
-
| `npm run lint` | Run ESLint |
|
|
269
|
-
| `npm run storybook` | Start Storybook |
|
|
270
|
-
| `npm run build-storybook` | Build Storybook |
|
|
271
|
-
| `npm run test` | Run tests |
|
|
457
|
+
## 📚 Documentation & Storybook
|
|
272
458
|
|
|
273
|
-
|
|
459
|
+
- **Live Documentation**: [https://henriques4nti4go.github.io/phsa-design-system/](https://henriques4nti4go.github.io/phsa-design-system/)
|
|
460
|
+
- **Interactive Examples**: All components include interactive Storybook stories
|
|
461
|
+
- **Props Documentation**: Complete API reference for all components
|
|
274
462
|
|
|
275
|
-
|
|
463
|
+
## 🤝 Support & Contributing
|
|
276
464
|
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
465
|
+
- **Issues**: [GitHub Issues](https://github.com/henriques4nti4go/phsa-design-system/issues)
|
|
466
|
+
- **Repository**: [GitHub](https://github.com/henriques4nti4go/phsa-design-system)
|
|
467
|
+
- **NPM Package**: [@phsa.tec/design-system-react](https://www.npmjs.com/package/@phsa.tec/design-system-react)
|
|
280
468
|
|
|
281
469
|
## 📄 License
|
|
282
470
|
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
## 🙏 Acknowledgments
|
|
286
|
-
|
|
287
|
-
- [Radix UI](https://radix-ui.com/) for accessible component primitives
|
|
288
|
-
- [Tailwind CSS](https://tailwindcss.com/) for the utility-first CSS framework
|
|
289
|
-
- [Shadcn/ui](https://ui.shadcn.com/) for component inspiration
|
|
290
|
-
- [Storybook](https://storybook.js.org/) for component documentation
|
|
471
|
+
MIT License - see the [LICENSE](LICENSE) file for details.
|
|
291
472
|
|
|
292
473
|
---
|
|
293
474
|
|
|
294
|
-
Built with ❤️
|
|
475
|
+
Built with ❤️ using React, TypeScript, Tailwind CSS, and Radix UI
|