@phsa.tec/design-system-react 0.3.0 → 0.3.1
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 +70 -39
- package/dist/index.d.mts +1 -36
- package/dist/index.d.ts +1 -36
- package/dist/index.js +0 -14
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +0 -13
- package/dist/index.mjs.map +1 -1
- package/dist/styles.css +1 -1
- package/package.json +1 -2
package/README.md
CHANGED
|
@@ -26,64 +26,102 @@ pnpm add @phsa.tec/design-system-react
|
|
|
26
26
|
|
|
27
27
|
## Basic Usage
|
|
28
28
|
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
29
|
+
### Step 1: Add Styles to Your Project
|
|
30
|
+
|
|
31
|
+
Copy the design system styles to your project's `globals.css` (or main CSS file). You can customize all CSS variables and styles as needed:
|
|
32
|
+
|
|
33
|
+
```css
|
|
34
|
+
/* globals.css or your main CSS file */
|
|
35
|
+
@import url("https://fonts.googleapis.com/css2?family=Roboto:wght@100;300;400;500;700;900&display=swap");
|
|
36
|
+
|
|
37
|
+
@tailwind base;
|
|
38
|
+
@tailwind components;
|
|
39
|
+
@tailwind utilities;
|
|
40
|
+
|
|
41
|
+
@layer base {
|
|
42
|
+
:root {
|
|
43
|
+
--background: oklch(100% 0 0);
|
|
44
|
+
--foreground: oklch(25% 0.01 150);
|
|
45
|
+
--primary: oklch(42% 0.15 145);
|
|
46
|
+
--primary-foreground: oklch(98% 0 0);
|
|
47
|
+
/* ... customize all variables you want */
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
.dark {
|
|
51
|
+
--background: oklch(4% 0.01 150);
|
|
52
|
+
--foreground: oklch(95% 0.02 150);
|
|
53
|
+
/* ... customize dark mode variables */
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
**Important:** Place these styles in your project's `globals.css` file and customize the CSS variables (`--primary`, `--background`, etc.) to match your brand colors and design preferences.
|
|
32
59
|
|
|
33
|
-
|
|
34
|
-
|
|
60
|
+
### Step 2: Use Components
|
|
61
|
+
|
|
62
|
+
```tsx
|
|
63
|
+
// Import components
|
|
64
|
+
import { Button, Card } from "@phsa.tec/design-system-react";
|
|
35
65
|
|
|
36
66
|
function App() {
|
|
37
67
|
return (
|
|
38
|
-
<
|
|
39
|
-
<
|
|
40
|
-
|
|
41
|
-
</Card>
|
|
42
|
-
</DesignSystemProvider>
|
|
68
|
+
<Card>
|
|
69
|
+
<Button>Click me</Button>
|
|
70
|
+
</Card>
|
|
43
71
|
);
|
|
44
72
|
}
|
|
45
73
|
```
|
|
46
74
|
|
|
47
75
|
## Customization
|
|
48
76
|
|
|
49
|
-
|
|
77
|
+
The design system uses **OKLCH** color format for better color consistency and wider gamut support. All styles are in your `globals.css` file, so you can customize any variable or style you want.
|
|
50
78
|
|
|
51
|
-
|
|
79
|
+
### Customizing Colors
|
|
80
|
+
|
|
81
|
+
Simply modify the CSS variables in your `globals.css`:
|
|
52
82
|
|
|
53
83
|
```css
|
|
54
84
|
/* globals.css */
|
|
55
85
|
:root {
|
|
56
|
-
/* Primary colors */
|
|
57
|
-
--primary:
|
|
58
|
-
--primary-foreground: 0 0
|
|
59
|
-
|
|
60
|
-
|
|
86
|
+
/* Primary colors - using OKLCH format */
|
|
87
|
+
--primary: oklch(42% 0.15 145); /* Lightness Chroma Hue */
|
|
88
|
+
--primary-foreground: oklch(98% 0 0);
|
|
89
|
+
|
|
90
|
+
/* Change to your brand colors */
|
|
91
|
+
--secondary: oklch(96% 0.02 150);
|
|
92
|
+
--secondary-foreground: oklch(25% 0.01 150);
|
|
61
93
|
|
|
62
94
|
/* Feedback colors */
|
|
63
|
-
--destructive: 0
|
|
64
|
-
--success:
|
|
65
|
-
--warning:
|
|
95
|
+
--destructive: oklch(60% 0.20 0);
|
|
96
|
+
--success: oklch(42% 0.15 145);
|
|
97
|
+
--warning: oklch(50% 0.18 48);
|
|
66
98
|
|
|
67
99
|
/* Neutral colors */
|
|
68
|
-
--background: 0 0
|
|
69
|
-
--foreground:
|
|
70
|
-
--muted:
|
|
71
|
-
--muted-foreground:
|
|
72
|
-
--border:
|
|
100
|
+
--background: oklch(100% 0 0);
|
|
101
|
+
--foreground: oklch(25% 0.01 150);
|
|
102
|
+
--muted: oklch(96% 0.02 150);
|
|
103
|
+
--muted-foreground: oklch(45% 0.01 150);
|
|
104
|
+
--border: oklch(88% 0.03 150);
|
|
73
105
|
|
|
74
106
|
/* Other */
|
|
75
107
|
--radius: 0.5rem;
|
|
76
|
-
--font-family: "
|
|
108
|
+
--font-family: "Roboto", sans-serif;
|
|
77
109
|
}
|
|
78
110
|
|
|
79
111
|
/* Dark mode */
|
|
80
112
|
.dark {
|
|
81
|
-
--background:
|
|
82
|
-
--foreground:
|
|
83
|
-
|
|
113
|
+
--background: oklch(4% 0.01 150);
|
|
114
|
+
--foreground: oklch(95% 0.02 150);
|
|
115
|
+
--primary: oklch(48% 0.16 145);
|
|
116
|
+
/* ... customize any other variables */
|
|
84
117
|
}
|
|
85
118
|
```
|
|
86
119
|
|
|
120
|
+
**Tip:** You can use online OKLCH color pickers or convert from HSL/HEX to OKLCH. The format is `oklch(lightness% chroma hue)` where:
|
|
121
|
+
- Lightness: 0-100%
|
|
122
|
+
- Chroma: 0-0.4 (saturation)
|
|
123
|
+
- Hue: 0-360 (color angle)
|
|
124
|
+
|
|
87
125
|
### Option 2: Tailwind Preset (Advanced)
|
|
88
126
|
|
|
89
127
|
If your project uses Tailwind CSS, you can extend with our preset:
|
|
@@ -183,14 +221,11 @@ Add the `dark` class to the root element:
|
|
|
183
221
|
```tsx
|
|
184
222
|
// With next-themes
|
|
185
223
|
import { ThemeProvider } from "next-themes";
|
|
186
|
-
import { DesignSystemProvider } from "@phsa.tec/design-system-react";
|
|
187
224
|
|
|
188
225
|
function App() {
|
|
189
226
|
return (
|
|
190
227
|
<ThemeProvider attribute="class" defaultTheme="system">
|
|
191
|
-
|
|
192
|
-
{/* Your app */}
|
|
193
|
-
</DesignSystemProvider>
|
|
228
|
+
{/* Your app */}
|
|
194
229
|
</ThemeProvider>
|
|
195
230
|
);
|
|
196
231
|
}
|
|
@@ -209,12 +244,8 @@ function App() {
|
|
|
209
244
|
// Components
|
|
210
245
|
import { Button, Card } from "@phsa.tec/design-system-react";
|
|
211
246
|
|
|
212
|
-
// CSS
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
// Tailwind Preset (optional)
|
|
216
|
-
// In tailwind.config.js:
|
|
217
|
-
// presets: [require("@phsa.tec/design-system-react/tailwind-preset")]
|
|
247
|
+
// Note: CSS styles should be added to your project's globals.css file
|
|
248
|
+
// See "Basic Usage" section above for details
|
|
218
249
|
```
|
|
219
250
|
|
|
220
251
|
## Development
|
package/dist/index.d.mts
CHANGED
|
@@ -496,39 +496,4 @@ declare function useToast(): {
|
|
|
496
496
|
toasts: ToasterToast[];
|
|
497
497
|
};
|
|
498
498
|
|
|
499
|
-
type
|
|
500
|
-
children: React__default.ReactNode;
|
|
501
|
-
className?: string;
|
|
502
|
-
};
|
|
503
|
-
/**
|
|
504
|
-
* DesignSystemProvider - Wrapper que aplica o escopo do design system
|
|
505
|
-
*
|
|
506
|
-
* Uso básico:
|
|
507
|
-
* ```tsx
|
|
508
|
-
* import { DesignSystemProvider } from "@phsa.tec/design-system-react";
|
|
509
|
-
* import "@phsa.tec/design-system-react/styles.css";
|
|
510
|
-
*
|
|
511
|
-
* <DesignSystemProvider>
|
|
512
|
-
* <App />
|
|
513
|
-
* </DesignSystemProvider>
|
|
514
|
-
* ```
|
|
515
|
-
*
|
|
516
|
-
* Customização via CSS Variables:
|
|
517
|
-
* ```css
|
|
518
|
-
* :root {
|
|
519
|
-
* --primary: 220 90% 50%;
|
|
520
|
-
* --radius: 0.25rem;
|
|
521
|
-
* }
|
|
522
|
-
* ```
|
|
523
|
-
*
|
|
524
|
-
* Customização avançada via Tailwind Preset:
|
|
525
|
-
* ```js
|
|
526
|
-
* // tailwind.config.js
|
|
527
|
-
* module.exports = {
|
|
528
|
-
* presets: [require("@phsa.tec/design-system-react/tailwind-preset")],
|
|
529
|
-
* }
|
|
530
|
-
* ```
|
|
531
|
-
*/
|
|
532
|
-
declare function DesignSystemProvider({ children, className, }: DesignSystemProviderProps): React__default.JSX.Element;
|
|
533
|
-
|
|
534
|
-
export { AlertDialog, type AlertDialogProps, Avatar, AvatarFallback, AvatarImage, Badge, type BadgeProps, Breadcrumb, BreadcrumbEllipsis, BreadcrumbItem, BreadcrumbLink, BreadcrumbList, BreadcrumbPage, BreadcrumbSeparator, Button, type ButtonProps, Card$1 as Card, Card as CardBase, CardContent, CardDescription, CardFooter, CardHeader, type CardProps, CardTitle, Checkbox, type CheckboxProps, Collapsible, CollapsibleContent, CollapsibleTrigger, type Column, CustomDrawer, type CustomDrawerProps, DataPairList, type DataPairListProps, DesignSystemProvider, type DesignSystemProviderProps, Dialog, type DialogProps, DialogWithForm, type DialogWithFormProps, Drawer, DrawerClose, DrawerContent, DrawerDescription, DrawerFooter, DrawerHeader, DrawerOverlay, DrawerPortal, type DrawerProps, DrawerTitle, DrawerTrigger, DropdownMenu, DropdownMenuCheckboxItem, DropdownMenuContent, DropdownMenuGroup, DropdownMenuItem, DropdownMenuLabel, DropdownMenuPortal, DropdownMenuRadioGroup, DropdownMenuRadioItem, DropdownMenuSeparator, DropdownMenuShortcut, DropdownMenuSub, DropdownMenuSubContent, DropdownMenuSubTrigger, DropdownMenuTrigger, DynamicTable, Form, FormControl, FormDescription, FormField, FormItem, FormLabel, FormMessage, Icon, Input, MaskInput, type MaskInputProps, MultiSelect, MultipleInput, type MultipleInputProps, MultipleMaskInput, type MultipleMaskInputProps, NavUser, NumberInput, type NumberInputProps, PageLayout, type PageLayoutProps, Select, type SelectProps, Separator, Sheet, type SheetProps, Sidebar, Spinner, Steps, Switch, type SwitchProps, type TableProps, Tabs, Text, Toaster, badgeVariants, reducer, toast, useFormField, useToast };
|
|
499
|
+
export { AlertDialog, type AlertDialogProps, Avatar, AvatarFallback, AvatarImage, Badge, type BadgeProps, Breadcrumb, BreadcrumbEllipsis, BreadcrumbItem, BreadcrumbLink, BreadcrumbList, BreadcrumbPage, BreadcrumbSeparator, Button, type ButtonProps, Card$1 as Card, Card as CardBase, CardContent, CardDescription, CardFooter, CardHeader, type CardProps, CardTitle, Checkbox, type CheckboxProps, Collapsible, CollapsibleContent, CollapsibleTrigger, type Column, CustomDrawer, type CustomDrawerProps, DataPairList, type DataPairListProps, Dialog, type DialogProps, DialogWithForm, type DialogWithFormProps, Drawer, DrawerClose, DrawerContent, DrawerDescription, DrawerFooter, DrawerHeader, DrawerOverlay, DrawerPortal, type DrawerProps, DrawerTitle, DrawerTrigger, DropdownMenu, DropdownMenuCheckboxItem, DropdownMenuContent, DropdownMenuGroup, DropdownMenuItem, DropdownMenuLabel, DropdownMenuPortal, DropdownMenuRadioGroup, DropdownMenuRadioItem, DropdownMenuSeparator, DropdownMenuShortcut, DropdownMenuSub, DropdownMenuSubContent, DropdownMenuSubTrigger, DropdownMenuTrigger, DynamicTable, Form, FormControl, FormDescription, FormField, FormItem, FormLabel, FormMessage, Icon, Input, MaskInput, type MaskInputProps, MultiSelect, MultipleInput, type MultipleInputProps, MultipleMaskInput, type MultipleMaskInputProps, NavUser, NumberInput, type NumberInputProps, PageLayout, type PageLayoutProps, Select, type SelectProps, Separator, Sheet, type SheetProps, Sidebar, Spinner, Steps, Switch, type SwitchProps, type TableProps, Tabs, Text, Toaster, badgeVariants, reducer, toast, useFormField, useToast };
|
package/dist/index.d.ts
CHANGED
|
@@ -496,39 +496,4 @@ declare function useToast(): {
|
|
|
496
496
|
toasts: ToasterToast[];
|
|
497
497
|
};
|
|
498
498
|
|
|
499
|
-
type
|
|
500
|
-
children: React__default.ReactNode;
|
|
501
|
-
className?: string;
|
|
502
|
-
};
|
|
503
|
-
/**
|
|
504
|
-
* DesignSystemProvider - Wrapper que aplica o escopo do design system
|
|
505
|
-
*
|
|
506
|
-
* Uso básico:
|
|
507
|
-
* ```tsx
|
|
508
|
-
* import { DesignSystemProvider } from "@phsa.tec/design-system-react";
|
|
509
|
-
* import "@phsa.tec/design-system-react/styles.css";
|
|
510
|
-
*
|
|
511
|
-
* <DesignSystemProvider>
|
|
512
|
-
* <App />
|
|
513
|
-
* </DesignSystemProvider>
|
|
514
|
-
* ```
|
|
515
|
-
*
|
|
516
|
-
* Customização via CSS Variables:
|
|
517
|
-
* ```css
|
|
518
|
-
* :root {
|
|
519
|
-
* --primary: 220 90% 50%;
|
|
520
|
-
* --radius: 0.25rem;
|
|
521
|
-
* }
|
|
522
|
-
* ```
|
|
523
|
-
*
|
|
524
|
-
* Customização avançada via Tailwind Preset:
|
|
525
|
-
* ```js
|
|
526
|
-
* // tailwind.config.js
|
|
527
|
-
* module.exports = {
|
|
528
|
-
* presets: [require("@phsa.tec/design-system-react/tailwind-preset")],
|
|
529
|
-
* }
|
|
530
|
-
* ```
|
|
531
|
-
*/
|
|
532
|
-
declare function DesignSystemProvider({ children, className, }: DesignSystemProviderProps): React__default.JSX.Element;
|
|
533
|
-
|
|
534
|
-
export { AlertDialog, type AlertDialogProps, Avatar, AvatarFallback, AvatarImage, Badge, type BadgeProps, Breadcrumb, BreadcrumbEllipsis, BreadcrumbItem, BreadcrumbLink, BreadcrumbList, BreadcrumbPage, BreadcrumbSeparator, Button, type ButtonProps, Card$1 as Card, Card as CardBase, CardContent, CardDescription, CardFooter, CardHeader, type CardProps, CardTitle, Checkbox, type CheckboxProps, Collapsible, CollapsibleContent, CollapsibleTrigger, type Column, CustomDrawer, type CustomDrawerProps, DataPairList, type DataPairListProps, DesignSystemProvider, type DesignSystemProviderProps, Dialog, type DialogProps, DialogWithForm, type DialogWithFormProps, Drawer, DrawerClose, DrawerContent, DrawerDescription, DrawerFooter, DrawerHeader, DrawerOverlay, DrawerPortal, type DrawerProps, DrawerTitle, DrawerTrigger, DropdownMenu, DropdownMenuCheckboxItem, DropdownMenuContent, DropdownMenuGroup, DropdownMenuItem, DropdownMenuLabel, DropdownMenuPortal, DropdownMenuRadioGroup, DropdownMenuRadioItem, DropdownMenuSeparator, DropdownMenuShortcut, DropdownMenuSub, DropdownMenuSubContent, DropdownMenuSubTrigger, DropdownMenuTrigger, DynamicTable, Form, FormControl, FormDescription, FormField, FormItem, FormLabel, FormMessage, Icon, Input, MaskInput, type MaskInputProps, MultiSelect, MultipleInput, type MultipleInputProps, MultipleMaskInput, type MultipleMaskInputProps, NavUser, NumberInput, type NumberInputProps, PageLayout, type PageLayoutProps, Select, type SelectProps, Separator, Sheet, type SheetProps, Sidebar, Spinner, Steps, Switch, type SwitchProps, type TableProps, Tabs, Text, Toaster, badgeVariants, reducer, toast, useFormField, useToast };
|
|
499
|
+
export { AlertDialog, type AlertDialogProps, Avatar, AvatarFallback, AvatarImage, Badge, type BadgeProps, Breadcrumb, BreadcrumbEllipsis, BreadcrumbItem, BreadcrumbLink, BreadcrumbList, BreadcrumbPage, BreadcrumbSeparator, Button, type ButtonProps, Card$1 as Card, Card as CardBase, CardContent, CardDescription, CardFooter, CardHeader, type CardProps, CardTitle, Checkbox, type CheckboxProps, Collapsible, CollapsibleContent, CollapsibleTrigger, type Column, CustomDrawer, type CustomDrawerProps, DataPairList, type DataPairListProps, Dialog, type DialogProps, DialogWithForm, type DialogWithFormProps, Drawer, DrawerClose, DrawerContent, DrawerDescription, DrawerFooter, DrawerHeader, DrawerOverlay, DrawerPortal, type DrawerProps, DrawerTitle, DrawerTrigger, DropdownMenu, DropdownMenuCheckboxItem, DropdownMenuContent, DropdownMenuGroup, DropdownMenuItem, DropdownMenuLabel, DropdownMenuPortal, DropdownMenuRadioGroup, DropdownMenuRadioItem, DropdownMenuSeparator, DropdownMenuShortcut, DropdownMenuSub, DropdownMenuSubContent, DropdownMenuSubTrigger, DropdownMenuTrigger, DynamicTable, Form, FormControl, FormDescription, FormField, FormItem, FormLabel, FormMessage, Icon, Input, MaskInput, type MaskInputProps, MultiSelect, MultipleInput, type MultipleInputProps, MultipleMaskInput, type MultipleMaskInputProps, NavUser, NumberInput, type NumberInputProps, PageLayout, type PageLayoutProps, Select, type SelectProps, Separator, Sheet, type SheetProps, Sidebar, Spinner, Steps, Switch, type SwitchProps, type TableProps, Tabs, Text, Toaster, badgeVariants, reducer, toast, useFormField, useToast };
|
package/dist/index.js
CHANGED
|
@@ -86,7 +86,6 @@ __export(src_exports, {
|
|
|
86
86
|
CollapsibleTrigger: () => CollapsibleTrigger2,
|
|
87
87
|
CustomDrawer: () => CustomDrawer,
|
|
88
88
|
DataPairList: () => DataPairList,
|
|
89
|
-
DesignSystemProvider: () => DesignSystemProvider,
|
|
90
89
|
Dialog: () => Dialog2,
|
|
91
90
|
DialogWithForm: () => DialogWithForm,
|
|
92
91
|
Drawer: () => Drawer,
|
|
@@ -4267,18 +4266,6 @@ function Switch2(_a) {
|
|
|
4267
4266
|
}
|
|
4268
4267
|
);
|
|
4269
4268
|
}
|
|
4270
|
-
|
|
4271
|
-
// src/components/config/DesignSystemProvider/index.tsx
|
|
4272
|
-
var import_react15 = require("react");
|
|
4273
|
-
var import_jsx_runtime67 = require("react/jsx-runtime");
|
|
4274
|
-
function DesignSystemProvider({
|
|
4275
|
-
children,
|
|
4276
|
-
className = ""
|
|
4277
|
-
}) {
|
|
4278
|
-
const uniqueId = (0, import_react15.useId)().replace(/:/g, "_");
|
|
4279
|
-
const scopeClass = `ds-${uniqueId}`;
|
|
4280
|
-
return /* @__PURE__ */ (0, import_jsx_runtime67.jsx)("div", { className: `ds ${scopeClass} ${className}`.trim(), children });
|
|
4281
|
-
}
|
|
4282
4269
|
// Annotate the CommonJS export names for ESM import in node:
|
|
4283
4270
|
0 && (module.exports = {
|
|
4284
4271
|
AlertDialog,
|
|
@@ -4307,7 +4294,6 @@ function DesignSystemProvider({
|
|
|
4307
4294
|
CollapsibleTrigger,
|
|
4308
4295
|
CustomDrawer,
|
|
4309
4296
|
DataPairList,
|
|
4310
|
-
DesignSystemProvider,
|
|
4311
4297
|
Dialog,
|
|
4312
4298
|
DialogWithForm,
|
|
4313
4299
|
Drawer,
|