@phsa.tec/design-system-react 0.3.0 → 0.3.2

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 CHANGED
@@ -5,7 +5,7 @@ A modern, **fully isolated** React component library built with TypeScript, Tail
5
5
  ## Features
6
6
 
7
7
  - **Zero Conflicts** - Fully isolated CSS, won't interfere with your project's styles
8
- - **Customizable** - Via CSS Variables or Tailwind Preset
8
+ - **Customizable** - Via CSS Variables
9
9
  - **Accessible** - Built with Radix UI primitives
10
10
  - **Dark Mode** - Native dark theme support
11
11
  - **TypeScript** - Full type support
@@ -26,84 +26,180 @@ pnpm add @phsa.tec/design-system-react
26
26
 
27
27
  ## Basic Usage
28
28
 
29
- ```tsx
30
- // 1. Import CSS (required)
31
- import "@phsa.tec/design-system-react/styles.css";
29
+ ### Step 1: Add Styles to Your Project
30
+
31
+ You have two options to add the design system styles:
32
+
33
+ #### Option 1: Import CSS Directly (Quick Start)
34
+
35
+ Import the CSS file at the **top** of your project's `globals.css` file:
32
36
 
33
- // 2. Import components
34
- import { DesignSystemProvider, Button, Card } from "@phsa.tec/design-system-react";
37
+ ```css
38
+ /* globals.css - Import at the top */
39
+ @import "@phsa.tec/design-system-react/styles.css";
40
+
41
+ /* Your other styles below */
42
+ @tailwind base;
43
+ @tailwind components;
44
+ @tailwind utilities;
45
+ ```
46
+
47
+ This will use the default styles. To customize the CSS variables, use Option 2.
48
+
49
+ #### Option 2: Copy to globals.css (Recommended for Customization)
50
+
51
+ Copy the design system styles to your project's `globals.css` (or main CSS file) and customize the CSS variables:
52
+
53
+ ```css
54
+ /* globals.css or your main CSS file */
55
+ @import url("https://fonts.googleapis.com/css2?family=Roboto:wght@100;300;400;500;700;900&display=swap");
56
+
57
+ @tailwind base;
58
+ @tailwind components;
59
+ @tailwind utilities;
60
+
61
+ @layer base {
62
+ :root {
63
+ --background: oklch(100% 0 0);
64
+ --foreground: oklch(25% 0.01 150);
65
+ --card: oklch(100% 0 0);
66
+ --card-foreground: oklch(25% 0.01 150);
67
+ --popover: oklch(100% 0 0);
68
+ --popover-foreground: oklch(25% 0.01 150);
69
+ --primary: oklch(42% 0.15 145);
70
+ --primary-foreground: oklch(98% 0 0);
71
+ --secondary: oklch(96% 0.02 150);
72
+ --secondary-foreground: oklch(25% 0.01 150);
73
+ --muted: oklch(96% 0.02 150);
74
+ --muted-foreground: oklch(45% 0.01 150);
75
+ --accent: oklch(96% 0.02 150);
76
+ --accent-foreground: oklch(25% 0.01 150);
77
+ --success: oklch(42% 0.15 145);
78
+ --success-foreground: oklch(98% 0 0);
79
+ --warning: oklch(50% 0.18 48);
80
+ --destructive: oklch(60% 0.20 0);
81
+ --destructive-foreground: oklch(98% 0 0);
82
+ --border: oklch(88% 0.03 150);
83
+ --input: oklch(88% 0.03 150);
84
+ --ring: oklch(42% 0.15 145);
85
+ --radius: 0.5rem;
86
+ --sidebar-background: oklch(98% 0.04 150);
87
+ --sidebar-foreground: oklch(30% 0.01 150);
88
+ --sidebar-primary: oklch(42% 0.15 145);
89
+ --sidebar-primary-foreground: oklch(98% 0 0);
90
+ --sidebar-accent: oklch(95% 0.04 150);
91
+ --sidebar-accent-foreground: oklch(25% 0.01 150);
92
+ --sidebar-border: oklch(90% 0.04 150);
93
+ --sidebar-ring: oklch(42% 0.15 145);
94
+ }
95
+
96
+ .dark {
97
+ --background: oklch(4% 0.01 150);
98
+ --foreground: oklch(95% 0.02 150);
99
+ --card: oklch(4% 0.01 150);
100
+ --card-foreground: oklch(95% 0.02 150);
101
+ --popover: oklch(4% 0.01 150);
102
+ --popover-foreground: oklch(95% 0.02 150);
103
+ --primary: oklch(48% 0.16 145);
104
+ --primary-foreground: oklch(8% 0.01 150);
105
+ --secondary: oklch(12% 0.02 150);
106
+ --secondary-foreground: oklch(95% 0.02 150);
107
+ --muted: oklch(12% 0.02 150);
108
+ --muted-foreground: oklch(60% 0.02 150);
109
+ --accent: oklch(12% 0.02 150);
110
+ --accent-foreground: oklch(95% 0.02 150);
111
+ --destructive: oklch(31% 0.12 0);
112
+ --destructive-foreground: oklch(98% 0 0);
113
+ --border: oklch(18% 0.02 150);
114
+ --input: oklch(18% 0.02 150);
115
+ --ring: oklch(48% 0.16 145);
116
+ --sidebar-background: oklch(8% 0.01 150);
117
+ --sidebar-foreground: oklch(90% 0.02 150);
118
+ --sidebar-primary: oklch(48% 0.16 145);
119
+ --sidebar-primary-foreground: oklch(8% 0.01 150);
120
+ --sidebar-accent: oklch(15% 0.02 150);
121
+ --sidebar-accent-foreground: oklch(90% 0.02 150);
122
+ --sidebar-border: oklch(15% 0.02 150);
123
+ --sidebar-ring: oklch(48% 0.16 145);
124
+ }
125
+ }
126
+
127
+ @layer base {
128
+ * {
129
+ @apply border-border;
130
+ }
131
+ body {
132
+ @apply bg-background text-foreground;
133
+ }
134
+ }
135
+ ```
136
+
137
+ **Tip:** Customize the CSS variables (`--primary`, `--background`, etc.) to match your brand colors and design preferences.
138
+
139
+ ### Step 2: Use Components
140
+
141
+ ```tsx
142
+ // Import components
143
+ import { Button, Card } from "@phsa.tec/design-system-react";
35
144
 
36
145
  function App() {
37
146
  return (
38
- <DesignSystemProvider>
39
- <Card>
40
- <Button>Click me</Button>
41
- </Card>
42
- </DesignSystemProvider>
147
+ <Card>
148
+ <Button>Click me</Button>
149
+ </Card>
43
150
  );
44
151
  }
45
152
  ```
46
153
 
47
154
  ## Customization
48
155
 
49
- ### Option 1: CSS Variables (Recommended)
156
+ 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.
157
+
158
+ ### Customizing Colors
50
159
 
51
- Override CSS variables in your stylesheet:
160
+ Simply modify the CSS variables in your `globals.css`:
52
161
 
53
162
  ```css
54
163
  /* globals.css */
55
164
  :root {
56
- /* Primary colors */
57
- --primary: 220 90% 50%;
58
- --primary-foreground: 0 0% 100%;
59
- --secondary: 210 40% 96%;
60
- --secondary-foreground: 222 47% 11%;
165
+ /* Primary colors - using OKLCH format */
166
+ --primary: oklch(42% 0.15 145); /* Lightness Chroma Hue */
167
+ --primary-foreground: oklch(98% 0 0);
168
+
169
+ /* Change to your brand colors */
170
+ --secondary: oklch(96% 0.02 150);
171
+ --secondary-foreground: oklch(25% 0.01 150);
61
172
 
62
173
  /* Feedback colors */
63
- --destructive: 0 84% 60%;
64
- --success: 142 76% 36%;
65
- --warning: 38 92% 50%;
174
+ --destructive: oklch(60% 0.20 0);
175
+ --success: oklch(42% 0.15 145);
176
+ --warning: oklch(50% 0.18 48);
66
177
 
67
178
  /* Neutral colors */
68
- --background: 0 0% 100%;
69
- --foreground: 222 84% 5%;
70
- --muted: 210 40% 96%;
71
- --muted-foreground: 215 16% 47%;
72
- --border: 214 32% 91%;
179
+ --background: oklch(100% 0 0);
180
+ --foreground: oklch(25% 0.01 150);
181
+ --muted: oklch(96% 0.02 150);
182
+ --muted-foreground: oklch(45% 0.01 150);
183
+ --border: oklch(88% 0.03 150);
73
184
 
74
185
  /* Other */
75
186
  --radius: 0.5rem;
76
- --font-family: "Inter", sans-serif;
187
+ --font-family: "Roboto", sans-serif;
77
188
  }
78
189
 
79
190
  /* Dark mode */
80
191
  .dark {
81
- --background: 222 84% 5%;
82
- --foreground: 210 40% 98%;
83
- /* ... other variables */
192
+ --background: oklch(4% 0.01 150);
193
+ --foreground: oklch(95% 0.02 150);
194
+ --primary: oklch(48% 0.16 145);
195
+ /* ... customize any other variables */
84
196
  }
85
197
  ```
86
198
 
87
- ### Option 2: Tailwind Preset (Advanced)
88
-
89
- If your project uses Tailwind CSS, you can extend with our preset:
90
-
91
- ```js
92
- // tailwind.config.js
93
- module.exports = {
94
- presets: [require("@phsa.tec/design-system-react/tailwind-preset")],
95
- theme: {
96
- extend: {
97
- // Your customizations
98
- colors: {
99
- primary: {
100
- DEFAULT: "#your-color",
101
- },
102
- },
103
- },
104
- },
105
- };
106
- ```
199
+ **Tip:** You can use online OKLCH color pickers or convert from HSL/HEX to OKLCH. The format is `oklch(lightness% chroma hue)` where:
200
+ - Lightness: 0-100%
201
+ - Chroma: 0-0.4 (saturation)
202
+ - Hue: 0-360 (color angle)
107
203
 
108
204
  ## Available CSS Variables
109
205
 
@@ -183,14 +279,11 @@ Add the `dark` class to the root element:
183
279
  ```tsx
184
280
  // With next-themes
185
281
  import { ThemeProvider } from "next-themes";
186
- import { DesignSystemProvider } from "@phsa.tec/design-system-react";
187
282
 
188
283
  function App() {
189
284
  return (
190
285
  <ThemeProvider attribute="class" defaultTheme="system">
191
- <DesignSystemProvider>
192
- {/* Your app */}
193
- </DesignSystemProvider>
286
+ {/* Your app */}
194
287
  </ThemeProvider>
195
288
  );
196
289
  }
@@ -208,13 +301,14 @@ function App() {
208
301
  ```typescript
209
302
  // Components
210
303
  import { Button, Card } from "@phsa.tec/design-system-react";
304
+ ```
211
305
 
212
- // CSS (required)
213
- import "@phsa.tec/design-system-react/styles.css";
306
+ ```css
307
+ /* globals.css - Import at the top (Option 1: Quick start) */
308
+ @import "@phsa.tec/design-system-react/styles.css";
214
309
 
215
- // Tailwind Preset (optional)
216
- // In tailwind.config.js:
217
- // presets: [require("@phsa.tec/design-system-react/tailwind-preset")]
310
+ /* Or copy the full styles to your globals.css (Option 2: For customization) */
311
+ /* See "Basic Usage" section above for details */
218
312
  ```
219
313
 
220
314
  ## Development
package/dist/index.d.mts CHANGED
@@ -496,39 +496,4 @@ declare function useToast(): {
496
496
  toasts: ToasterToast[];
497
497
  };
498
498
 
499
- type DesignSystemProviderProps = {
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 DesignSystemProviderProps = {
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,