@widgetic/design-system 0.3.68 → 0.3.71

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 (84) hide show
  1. package/README.md +126 -454
  2. package/dist/components/CopyableHeader.svelte +11 -13
  3. package/dist/components/EmptyState.svelte +4 -2
  4. package/dist/components/EmptyState.svelte.d.ts +2 -1
  5. package/dist/components/PasswordInput.svelte +5 -1
  6. package/dist/components/WScrollArea.svelte +3 -3
  7. package/dist/components/debug-grid/DebugGrid.svelte +1 -1
  8. package/dist/components/ic/browser/BrowserInputController.svelte +1 -1
  9. package/dist/components/index.d.ts +1 -1
  10. package/dist/components/index.js +1 -1
  11. package/dist/components/modals/BaseModal.svelte +1 -1
  12. package/dist/components/modals/NewItemDialog.svelte +1 -1
  13. package/dist/components/modals/RenameDialog.svelte +7 -6
  14. package/dist/components/navigation/Breadcrumbs.svelte +9 -9
  15. package/dist/components/pdf/PDFViewer.svelte +6 -16
  16. package/dist/components/search-input/SearchInput.svelte +3 -8
  17. package/dist/components/search-input/index.d.ts +3 -14
  18. package/dist/components/search-input/index.js +1 -2
  19. package/dist/components/search-input/index2.d.ts +14 -0
  20. package/dist/components/shad-editor/README.md +18 -0
  21. package/dist/components/shad-editor/custom/image-extended-component.svelte +1 -1
  22. package/dist/components/shad-editor/editor.css +8 -4
  23. package/dist/components/shad-editor/icons/table.svelte +3 -3
  24. package/dist/components/shad-editor/icons/text.svelte +1 -1
  25. package/dist/components/shad-editor/onedark.css +3 -0
  26. package/dist/components/shad-editor/shad-editor.svelte +1 -1
  27. package/dist/components/toast/ToasterModal.svelte +14 -10
  28. package/dist/components/ui/accordion/index.d.ts +1 -1
  29. package/dist/components/ui/badge/badge.svelte +1 -1
  30. package/dist/components/ui/badge/badge.svelte.d.ts +2 -2
  31. package/dist/components/ui/button/button.svelte +1 -1
  32. package/dist/components/ui/button/button.svelte.d.ts +2 -2
  33. package/dist/components/ui/calendar/calendar-day.svelte +4 -4
  34. package/dist/components/ui/calendar/calendar.svelte.d.ts +1 -1
  35. package/dist/components/ui/card/card.svelte +1 -1
  36. package/dist/components/ui/checkbox/checkbox.svelte +1 -1
  37. package/dist/components/ui/collapsible/index.d.ts +1 -1
  38. package/dist/components/ui/command/command-dialog.svelte +1 -1
  39. package/dist/components/ui/command/command-dialog.svelte.d.ts +1 -1
  40. package/dist/components/ui/command/command-input.svelte +1 -1
  41. package/dist/components/ui/command/command-input.svelte.d.ts +1 -1
  42. package/dist/components/ui/command/command-item.svelte +1 -1
  43. package/dist/components/ui/command/command-link-item.svelte +1 -1
  44. package/dist/components/ui/command/command.svelte.d.ts +1 -1
  45. package/dist/components/ui/dialog/dialog-content.svelte +1 -1
  46. package/dist/components/ui/dropdown-menu/dropdown-menu-checkbox-item.svelte +1 -1
  47. package/dist/components/ui/dropdown-menu/dropdown-menu-content.svelte +1 -1
  48. package/dist/components/ui/dropdown-menu/dropdown-menu-item.svelte +1 -1
  49. package/dist/components/ui/dropdown-menu/dropdown-menu-radio-item.svelte +1 -1
  50. package/dist/components/ui/dropdown-menu/dropdown-menu-sub-content.svelte +1 -1
  51. package/dist/components/ui/dropdown-menu/dropdown-menu-sub-trigger.svelte +1 -1
  52. package/dist/components/ui/dropdown-menu/index.d.ts +1 -1
  53. package/dist/components/ui/hover-card/hover-card-content.svelte +1 -1
  54. package/dist/components/ui/input/input.svelte +1 -1
  55. package/dist/components/ui/input/input.svelte.d.ts +1 -1
  56. package/dist/components/ui/input-otp/input-otp.svelte +1 -1
  57. package/dist/components/ui/input-otp/input-otp.svelte.d.ts +1 -1
  58. package/dist/components/ui/popover/popover-content.svelte +1 -1
  59. package/dist/components/ui/radio-group/radio-group-item.svelte +1 -1
  60. package/dist/components/ui/radio-group/radio-group.svelte.d.ts +1 -1
  61. package/dist/components/ui/range-calendar/range-calendar-day.svelte +6 -6
  62. package/dist/components/ui/range-calendar/range-calendar.svelte.d.ts +1 -1
  63. package/dist/components/ui/select/index.d.ts +1 -1
  64. package/dist/components/ui/select/select-item.svelte +1 -1
  65. package/dist/components/ui/select/select-trigger.svelte +1 -1
  66. package/dist/components/ui/slider/slider.svelte +1 -1
  67. package/dist/components/ui/slider/slider.svelte.d.ts +1 -1
  68. package/dist/components/ui/switch/switch.svelte +1 -1
  69. package/dist/components/ui/tabs/index.d.ts +1 -1
  70. package/dist/components/ui/tabs/tabs-content.svelte +1 -1
  71. package/dist/components/ui/tabs/tabs-trigger.svelte +1 -1
  72. package/dist/components/ui/textarea/textarea.svelte +1 -1
  73. package/dist/components/ui/textarea/textarea.svelte.d.ts +1 -1
  74. package/dist/components/ui/toggle/toggle.svelte +1 -1
  75. package/dist/components/ui/toggle/toggle.svelte.d.ts +2 -2
  76. package/dist/components/ui/toggle-group/toggle-group-item.svelte.d.ts +1 -1
  77. package/dist/components/ui/toggle-group/toggle-group.svelte.d.ts +1 -1
  78. package/dist/components/widget-system/Moveable.svelte +0 -1
  79. package/dist/icons/eye-off.svg +1 -0
  80. package/dist/icons/eye.svg +1 -0
  81. package/dist/styles/fonts.css +50 -39
  82. package/dist/styles/global.css +55 -36
  83. package/package.json +34 -33
  84. package/tailwind.config.ts +1 -6
package/README.md CHANGED
@@ -1,493 +1,165 @@
1
- # Widgetic Design System
1
+ # Widgetic Design System (`@widgetic/design-system`)
2
+
3
+ This is the official design system package for the Widgetic platform.
4
+
5
+ Built with SvelteKit and Tailwind CSS (using shadcn-svelte components as a base), it provides reusable UI components, global styles, design tokens, icons, and fonts for building consistent interfaces across Widgetic projects.
6
+
7
+ ## Features
8
+
9
+ * **Styles:** Exports global CSS styles, including CSS variables for design tokens (colors, spacing, etc.) and utility classes based on Tailwind CSS v4.
10
+ * **UI Components:** A library of Svelte components built upon [shadcn-svelte](https://shadcn-svelte.com/), providing elements like Buttons, Cards, Dialogs, Input fields, Accordions, etc. Includes both base shadcn components and custom Widgetic components.
11
+ * **Icons:** Exports icons from [Lucide Svelte](https://lucide.dev/) and potentially [Tabler Icons](https://tabler-icons.io/), accessible via named imports.
12
+ * **Fonts:** Includes specific font families used across the Widgetic platform. Font files themselves are exported, but consuming projects need to ensure they are loaded correctly (e.g., via CSS `@import` or `<link>`).
13
+
14
+ ## Installation
15
+
16
+ 1. **Install the package:**
17
+ ```bash
18
+ npm install @widgetic/design-system
19
+ ```
20
+
21
+ 2. **Install Peer Dependencies:** This package relies on several peer dependencies that you need to install in your project if you haven't already. Ensure your `package.json` includes compatible versions:
22
+ ```json
23
+ "devDependencies": {
24
+ // Required by Tailwind v4 setup
25
+ "postcss": "^8.x.x",
26
+ "@tailwindcss/postcss": "^4.x.x",
27
+ "tailwindcss": "^4.x.x",
28
+ // Required by SvelteKit/Svelte 5
29
+ "svelte": "^5.x.x",
30
+ "@sveltejs/kit": "^2.x.x",
31
+ // Required by shadcn-svelte components used internally
32
+ "bits-ui": "^1.x.x",
33
+ "clsx": "^2.x.x",
34
+ "tailwind-merge": "^2.x.x",
35
+ "tailwind-variants": "^0.x.x",
36
+ "svelte-sonner": "^0.x.x",
37
+ // Required by specific components if used
38
+ "@internationalized/date": "^3.x.x",
39
+ "lucide-svelte": "^0.x.x",
40
+ "@tabler/icons-svelte": "^3.x.x",
41
+ "vaul-svelte": "^1.x.x-next.x"
42
+ // ... other project devDependencies
43
+ }
44
+ ```
45
+ *Note: Replace `x.x` with appropriate version numbers compatible with the design system's requirements (check its `package.json` `peerDependencies` for specifics).* Make sure you have `postcss.config.js` (or `.mjs`) set up.
46
+
47
+ ## Setup
48
+
49
+ ### 1. Tailwind Configuration
50
+
51
+ To ensure Tailwind processes the design system's classes and applies your project's customizations correctly, configure your project's `tailwind.config.ts` (or `.js`) to use the design system's configuration as a preset:
2
52
 
3
- This is the design system package for the Widgetic platform.
4
-
5
- It is built with SvelteKit and TailwindCSS and exports styles(with tailwind), ui components(with shadcn), icons and fonts for the entire platform.
6
-
7
- 0. Styles: it uses tailwindcss and exports global styles and design tokens that are imported in the project where the design system is imported:
8
-
9
- ```svelte
10
- <script>
11
- import '@widgetic/design-system/styles';
12
- </script>
13
- ```
14
-
15
- 0.1. To add new fonts:
16
- - Add the font in the fonts folder.
17
- - Add the font-face rule and the class in the fonts.css file and then the class can be used anywhere in the projects that import the design system's styles:
18
- ```css
19
- /* First font-face rule */
20
- @font-face {
21
- font-family: 'BL Melody';
22
- src: url('@widgetic/design-system/fonts/BLMelody/BLMelody-ExtraLight.woff2') format('woff2');
23
- font-weight: 200;
24
- font-style: normal;
25
- font-display: swap;
26
- }
27
-
28
- /* Second fonte class(can be any custom name) */
29
- .font-bl-melody-extra-light {
30
- font-family: 'BL Melody';
31
- font-weight: 200;
32
- }
33
- ```
34
-
35
- - Use the font-family in any class in the global.css file if needed like this:
36
- ```css
37
- .my-button-class {
38
- /* other CSS properties */
39
- background-color: red;
40
-
41
- /* font-family properties here */
42
- font-family: 'BL Melody', sans-serif;
43
- font-weight: 200;
44
- font-style: normal;
45
- }
46
- ```
47
-
48
- 1.1. Components: It uses the SHADCN UI components for basic ui components and custom components for the Widgetic platform.
49
-
50
- a. (Re)Install latest all shadcn components:
51
-
52
- ```bash
53
- npm run i-shadcn
54
- ```
55
-
56
- At prompt answer like this:
57
- ```bash
58
- Which style would you like to use?
59
- │ Default
60
- │
61
- ◇ Which base color would you like to use?
62
- │ Slate
63
- │
64
- ◇ Where is your global CSS file? (this file will be overwritten)
65
- │ src/app.css (!!! add local project's css file as we don't want to overwrite our project's global styles)
66
- │
67
- ◇ Where is your Tailwind config located? (this file will be overwritten)
68
- │ tailwind.config.ts
69
- │
70
- ◇ Configure the import alias for components:
71
- │ $lib/components
72
- │
73
- ◆ Configure the import alias for utils:
74
- │ $lib/utils
75
- │
76
- ◆ Configure the import alias for hooks:
77
- │ $lib/hooks
78
- │
79
- ◆ Configure the import alias for ui:
80
- │ $lib/components/ui
81
-
82
-
83
- Components to install:
84
- │ accordion, badge, button, calendar, range-calendar, card, checkbox, collapsible, dialog,
85
- │ drawer, dropdown-menu, input, input-otp, label, popover, progress, radio-group, scroll-area,
86
- │ select, separator, slider, switch, table, tabs, textarea, tooltip
87
- │
88
- ◆ Ready to install components and dependencies?
89
- │ ● Yes / ○ No
90
- ...
91
- tooltip installed at src/lib/components/ui/tooltip
92
- │
93
- ◇ Dependencies installed with npm
94
- │
95
- ◇ Config file components.json updated
96
- │
97
- └ Success! Component installation completed.
98
-
99
- !!! On commit the change uncheck the grouped components(Table, Select, etc.) baerel file.
100
- ```
101
-
102
- b. Installing the shadcn-svelte package:
103
-
104
- ```bash
105
- npx shadcn-svelte@next init
106
- ```
107
-
108
- c. Add one or more SHADCN UI components:
109
-
110
- ```bash
111
- npx shadcn-svelte@next add <component-name component-name2>
112
- ```
113
-
114
- d. Check tailwind.config.ts file to see if you didn't lose any of the project's config.
115
-
116
- e. Check /src/lib/utils/utils.ts file to see if you didn't lose any of the project's utils.
117
-
118
- f. Check /src/lib/hooks/hooks.ts file to see if you didn't lose any of the project's hooks.
119
-
120
- g. Check SHADCN UI Grouped components(eg. Table or Select) barel file to export a constant with the subcomponents.
121
- We do that just be wrapping the first part of the export statement with a constant named as the component ("Table" here) and replace the exported subcomponent: "Table" in this case with "TableRoot".
122
53
  ```ts
123
- // src/lib/components/ui/table/index.ts
124
- const Table = {
125
- Root,
126
- Body,
127
- Caption,
128
- Cell,
129
- Footer,
130
- Head,
131
- Header,
132
- Row
133
- };
134
-
135
- export {
136
- Table, // add the constant name "Table" that will be the namespace for the grouped components
137
- Root as TableRoot, // Change the name of the Root component from "Table" to "TableRoot"
138
- Body as TableBody,
139
- Caption as TableCaption,
140
- Cell as TableCell,
141
- Footer as TableFooter,
142
- Head as TableHead,
143
- Header as TableHeader,
144
- Row as TableRow,
145
- };
146
- ```
147
- Then you can import and use the namespace in the project:
148
- ```svelte
149
- import { Table } from '@widgetic/design-system';
150
- ```
54
+ // tailwind.config.ts
55
+ import type { Config } from 'tailwindcss';
56
+ import designSystemPreset from '@widgetic/design-system/tailwind.config'; // Import the preset
151
57
 
152
- h. If there is a component that looks compound but is not, add the @notCompound marker in the file:
153
- ```ts
154
- // @notCompound
155
- export {
156
- Root,
157
- Scrollbar,
158
- //,
159
- Root as ScrollArea,
160
- Scrollbar as ScrollAreaScrollbar,
161
- };
162
- ```
163
- ScrollArea is not a compound component but it looks like one.
58
+ const config = {
59
+ // Use the design system preset
60
+ presets: [designSystemPreset],
61
+
62
+ // Add your project's paths AND the design system's path to the content array
63
+ content: [
64
+ './src/**/*.{html,js,svelte,ts}', // Your project files
65
+ './node_modules/@widgetic/design-system/dist/**/*.{html,js,svelte,ts}' // Design system package files
66
+ ],
67
+
68
+ // You can optionally extend the theme further here
69
+ theme: {
70
+ extend: {
71
+ // Your project-specific theme extensions
72
+ }
73
+ },
74
+
75
+ plugins: [
76
+ // Your project-specific plugins (if any)
77
+ ]
78
+ } satisfies Config;
164
79
 
165
- h. If you want to export only the main component and not the subcomponents, add the @noSubcomponents marker in the file:
166
- ```ts
167
- // @noSubcomponents
168
- export {
169
- Day,
170
- Cell,
171
- Grid,
172
- Header,
173
- Months,
174
- GridRow,
175
- Heading,
176
- GridBody,
177
- GridHead,
178
- HeadCell,
179
- NextButton,
180
- PrevButton,
181
- //
182
- Root as RangeCalendar,
183
- };
80
+ export default config;
184
81
  ```
185
- RangeCalendar share the same subcomponents with Calendar so we don't want to export them.
186
-
187
- 1.2. In general we should follow the shadcn-svelte approach to export the components with more subcomponents or compound components.
188
82
 
189
- 2. Icons: It also uses the Lucide and Tabler icons or custom icons for the platform.
190
-
191
- ```svelte
192
- import { IconName } from '@widgetic/design-system/icons';
193
- ```
83
+ * **Presets:** The `presets` array applies the design system's base configuration (colors, fonts, plugins like `tailwindcss-animate`).
84
+ * **Content:** It's crucial to include the path to the installed design system package (`./node_modules/@widgetic/design-system/dist/...`) in your `content` array. This allows Tailwind to scan the design system's components and generate the necessary utility classes.
194
85
 
86
+ ### 2. Global Styles
195
87
 
196
- 3. Fonts: The design system uses Google Fonts that we need to import in the project where the design system is imported.
88
+ Import the design system's global CSS file into your main layout file (e.g., `src/routes/+layout.svelte`). This file includes base styles, CSS variables (design tokens), and imports necessary fonts.
197
89
 
198
90
  ```svelte
199
- import { FontName } from '@widgetic/design-system/fonts';
200
- ```
201
-
202
-
203
- ## Performance Optimization for Linked Design System
204
-
205
- When using the linked design system in development mode, you may experience slow initial load times and delayed navigation. This is because Vite's default file watching behavior can create performance issues when working with linked packages.
206
-
207
- ### Common Issues:
208
- - Long initial loading time (>1 minute)
209
- - "Pending" status on network requests when navigating between pages
210
- - High CPU usage during development
211
-
212
- ### Solution:
213
-
214
- #### 1. For consuming projects (like site, context-chat, etc.):
215
-
216
- Optimize your `vite.config.ts` with these settings:
217
-
218
- ```ts
219
- server: {
220
- watch: {
221
- // Don't use polling (which causes high CPU usage)
222
- // Remove the following if present:
223
- // usePolling: true,
224
- // interval: 2000,
225
- // binaryInterval: 2000,
226
-
227
- // Ignore all node_modules EXCEPT the design system dist folder if needed
228
- ignored: [
229
- '**/node_modules/**',
230
- '**/*.map',
231
- '**/*.d.ts',
232
- '**/*.log'
233
- ]
234
- },
235
- hmr: {
236
- // Reduce timeout for faster updates
237
- timeout: 2000
238
- }
239
- },
240
- optimizeDeps: {
241
- // Don't include the design system in optimizeDeps
242
- // Remove this if present:
243
- // include: ['@widgetic/design-system']
244
-
245
- // Keep other settings
246
- exclude: ['@sveltejs/kit']
247
- },
248
- build: {
249
- // Add these for faster builds
250
- sourcemap: false,
251
- reportCompressedSize: false
252
- }
253
- ```
254
-
255
- #### 2. For production deployments:
256
-
257
- When deploying to production, you'll use the published npm package instead of the linked development version. No special configuration is needed beyond the optimizations above.
258
-
259
- #### 3. Development vs. Production Mode:
260
-
261
- The design system's `vite.config.ts` already includes development-specific optimizations. When publishing the package to npm, the built version will be used, and these configurations won't affect end users.
262
-
263
- **Note:** These optimizations are only needed during development with linked packages and won't affect the published npm package performance.
264
-
265
-
266
- ## How to link DS into another project and develop it(first time)
267
-
268
- 0. Go into the DS project and link it in the system and start it with: `cd Frontend/design-system && npm link && npm run dev`
269
-
270
- 1. Go into the consuming project and make sure you have installed tailwindcss and postcss by checking in package.json if it has these dependencies:
91
+ <!-- src/routes/+layout.svelte -->
92
+ <script>
93
+ import '@widgetic/design-system/styles'; // Import global styles
271
94
 
272
- ```json
273
- "dependencies": {
274
- "tailwindcss": "^3.4.16",
275
- "@tailwindcss/postcss": "^4.1.2",
276
- }
277
- ```
95
+ // Your layout script...
96
+ </script>
278
97
 
279
- Also make sure you have a 'tailwind.config.ts'(if there is a '.js' version rename it to '.ts') and a 'postcss.config.js' file.
280
- (optional)If not already in the project follow the install guide at: https://tailwindcss.com/docs/installation/using-postcss.
281
-
282
-
283
- 2. Also add these dependencies and overrides(that are needed for DS) with these exact versions into the package.json file of the consuming project:
284
- ```json package.json
285
- "dependencies": {
286
- "@sveltejs/kit": "^2.20.2",
287
- "svelte": "^5.25.6",
288
- "@tabler/icons-svelte": "^3.24.0",
289
- "lucide-svelte": "^0.468.0",
290
- "bits-ui": "^1.3.0",
291
- "svelte-sonner": "^0.3.28",
292
-
293
- "tailwind-merge": "^2.5.2",
294
- "tailwind-variants": "^0.2.1",
295
- "tailwindcss-animate": "^1.0.7",
296
- }
297
-
298
- "overrides": {
299
- "bits-ui": {
300
- "@melt-ui/svelte": "^0.86.3"
301
- },
302
- "vaul-svelte": {
303
- "bits-ui": {
304
- "@melt-ui/svelte": "^0.86.3"
305
- }
306
- },
307
- "svelte": "^5.25.6"
308
- },
98
+ <slot />
309
99
  ```
310
100
 
311
- Also keep the exact versions mentioned above and check and remove these dependencies from devDependencies or peerDependencies in the package.json of the consuming project.
312
-
313
- 3. Also add this "i"(install) and "lds"(link) scripts into the package.json file exactly as following:
314
- "i": "rm -rf node_modules && npm i && npm run lds",
315
- "lds": "volta run npm link @widgetic/design-system",
316
- Then run it with: `npm run i`
317
-
318
- 4. Also add these "dev" scripts into the package.json file for usual start of the consuming project:
319
- "dev": "npm run dev-sv -- --open",
320
- "dev-sv": "NODE_ENV=development vite dev",
321
-
322
- 5. Import DS config into the tailwind.config.ts file(of consuming project) and add it in the presets array:
323
- ```ts
324
- // tailwind.config.ts
325
-
326
- import designSystemPreset from '@widgetic/design-system/tailwind.config';
101
+ ## Usage
327
102
 
328
- const config = {
329
- // add here the DS preset
330
- presets: [
331
- designSystemPreset
332
- ],
333
- // add here the '@widgetic/*/dist/...' to scan also the DS package files
334
- content: [
335
- "./src/**/*.{html,js,svelte,ts}",
336
- // Include all @widgetic packages from node_modules(for development only) to be sure Tailwind scans all the files
337
- "./node_modules/@widgetic/*/dist/**/*.{html,js,svelte,ts}"
338
- ],
339
- // the rest of the config properties
340
- theme: {
341
- extend: {
342
- // current extend config...
343
- }
344
- }
345
- };
103
+ ### Components
346
104
 
347
- export default config;
348
- ```
349
- Also make sure you remove the type of the config to avoid conflicts with the DS config.
350
- Then leave the rest of the config as it is.
105
+ Import components directly from the package:
351
106
 
352
- 6. Import styles and a test component from DS in the consuming project:
353
- a. In the root layout of the project import the global styles:
354
107
  ```svelte
355
- <!-- +layout.svelte -->
356
108
  <script>
357
- import '@widgetic/design-system/styles';
109
+ import { Button, Card, CardHeader, CardTitle, CardContent } from '@widgetic/design-system';
110
+ // For grouped components (like Table, Accordion), use the namespace
111
+ import { Table } from '@widgetic/design-system';
358
112
  </script>
359
- ```
360
- b. In the root page of the consuming project import any component(e.g. Button) and use it:
361
- ```svelte
362
- <!-- +page.svelte -->
363
- <script>
364
- import { Button } from '@widgetic/design-system/';
365
- </script>
366
-
367
- <!-- HTML zone -->
368
- <Button>Click me</Button>
369
- ```
370
-
371
- 7. Finally: go into the in the consuming project's folder and start the development server with:
372
- ```bash
373
- npm run dev
374
- ```
375
-
376
- This automatically opens the http://localhost:5173 (default port) for the consuming project and you can see how DS components work in it.
377
-
378
113
 
114
+ <Button>Click Me</Button>
379
115
 
380
- ## Developing inside this project:
116
+ <Card.Root>
117
+ <Card.Header>
118
+ <Card.Title>Card Title</Card.Title>
119
+ </Card.Header>
120
+ <Card.Content>
121
+ <p>Card body content...</p>
122
+ </Card.Content>
123
+ </Card.Root>
381
124
 
382
- 1. Install dependencies with `npm install`
383
-
384
- 2. Link the package in the system with npm:
385
- ```bash
386
- npm link
387
- ```
388
-
389
- 3. Start the development server with:
390
- ```bash
391
- npm run dev
392
- ```
393
-
394
- 3. Test the design system in action:
395
- - In the root layout of the DS project there is a global styles import to test the design system's global styles.
396
- - In the root page of the project there is a button component import to test the design system's components.
397
-
398
- Open in new tab in browser with address: http://localhost:5173/ to see the design system in action.
399
-
400
-
401
-
402
- ### Global Tailwind CSS and Design Tokens:
403
-
404
- ```css
405
- /* src/lib/styles/global.css */
406
- @tailwind base;
407
- @tailwind components;
408
- @tailwind utilities;
409
-
410
- /* CUSTOM GLOBAL STYLES */
411
- /* ADD HERE CLASSES AND CSS VARIABLES that are used in the projects where the design system is imported */
412
-
413
- /* Base styles */
414
- @layer base {
415
- :root {
416
- /* Design tokens */
417
- --color-primary: 30 158 210; /* RGB values for easier theming */
418
- --color-secondary: 46 204 113;
419
- --radius: 0.5rem;
420
- }
421
-
422
- /* Dark mode tokens */
423
- .dark {
424
- --color-primary: 100 200 255;
425
- --color-secondary: 100 255 150;
426
- }
427
- }
428
-
429
- /* Reusable component classes */
430
- @layer components {
431
- .btn-primary {
432
- @apply bg-[rgb(var(--color-primary))] text-white rounded-[var(--radius)];
433
- }
434
-
435
- .card {
436
- @apply shadow-md rounded-lg p-4 bg-white dark:bg-gray-800;
437
- }
438
- }
439
-
440
- /* Custom utility classes */
441
- @layer utilities {
442
- .text-balance {
443
- text-wrap: balance;
444
- }
445
- }
125
+ <Table.Root>
126
+ <Table.Header>
127
+ <Table.Row>
128
+ <Table.Head>Header 1</Table.Head>
129
+ </Table.Row>
130
+ </Table.Header>
131
+ <Table.Body>
132
+ <Table.Row>
133
+ <Table.Cell>Cell 1</Table.Cell>
134
+ </Table.Row>
135
+ </Table.Body>
136
+ </Table.Root>
446
137
  ```
447
138
 
448
- 2. In the project where the design system is imported:
449
- - Import the global styles in the +layout.svelte file:
450
- ```svelte
451
- <script>
452
- import '@widgetic/design-system/styles';
453
- </script>
454
- ```
139
+ Refer to the specific component documentation or source code for available props and variants.
455
140
 
141
+ ### Icons
456
142
 
457
- ### Create a Custom Shared Component in the Design System project using a SHADCN UI component and classes from the global styles:
143
+ Import required icons by name:
458
144
 
459
- src/lib/components/MyButton.svelte:
460
145
  ```svelte
461
146
  <script>
462
- <!-- Import Button from the SHADCN UI components -->
463
- import { Button } from './components/ui';
147
+ import { ChevronUp, IconSettings } from '@widgetic/design-system/icons'; // Example names
464
148
  </script>
465
149
 
466
- <MyButton
467
- {type}
468
- class="btn-primary"
469
- on:click
470
- >
471
- <slot />
472
- </MyButton>
473
- ```
474
- Then export the component in the "src/lib/components/index.ts" file:
475
- ```ts
476
- export {default as MyButton } from './components/MyButton.svelte';
150
+ <button>
151
+ <ChevronUp class="size-4" /> Settings <IconSettings class="size-4" />
152
+ </button>
477
153
  ```
478
154
 
155
+ ### Fonts & Typography
479
156
 
480
- ## Deployment of Design System
157
+ The global styles load the necessary `@font-face` rules. You can apply typography using standard Tailwind utility classes (e.g., `text-lg`, `font-semibold`) or the custom typography utility classes exported by the design system (defined in `fonts.css`, like `h1`, `body-medium`, `subtext`).
481
158
 
482
- To deploy the design system, run the following command:
483
- ```bash
484
- npm run prepublishOnly
485
- ```
486
- This will create a `dist` folder with the production build of the design system.
487
-
488
- To publish the design system to the npm registry, run the following command:
489
- ```bash
490
- npm run publish-package
159
+ ```svelte
160
+ <h1 class="h1">Main Title</h1>
161
+ <p class="body-medium">This is body text.</p>
162
+ <span class="subtext">Some smaller text.</span>
491
163
  ```
492
164
 
493
165
  ## Grid System