@prioticket/design-system-web 1.0.5 → 1.0.7

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
@@ -1,341 +1,344 @@
1
- # Prioticket Design System Web
2
-
3
- A comprehensive Web Components library built with **Lit** that provides Material Design components for Prioticket applications. This library is designed to work seamlessly across any frontend framework or in vanilla HTML.
4
-
5
- ## Features
6
-
7
- - 🎨 **Material Design 3** - Built on Google's official Material Web components
8
- - 🌈 **Dynamic Theming** - Real-time theme switching without page reload
9
- - 🌐 **Framework Agnostic** - Works with Angular, React, Vue, PHP, or any web technology
10
- - 📦 **Tree Shakable** - Load only the components you need
11
- - 🎯 **TypeScript** - Full type safety and excellent developer experience
12
- - 🔧 **Customizable** - Flexible theming with CSS custom properties
13
- - ⚡ **Performance Optimized** - Individual component bundles for maximum efficiency
14
- - 🎪 **Modern Standards** - ES Modules, Web Components, and HTTP/2 friendly
15
-
16
- ## Installation
17
-
18
- ```bash
19
- npm install @prioticket/design-system-web
20
- ```
21
-
22
- ## Usage Guide
23
-
24
- ### 1. Quick Start with CDN (Recommended for PHP, Vanilla HTML, etc.)
25
-
26
- This is the fastest way to try the components on any plain HTML page while keeping everything tree-shakable.
27
-
28
- **Instructions:**
29
- 1. Add the Material Symbols font (optional, only needed when you use icons).
30
- 2. Include one of the provided theme CSS files.
31
- 3. Copy the import map below so the browser can resolve the bare module specifiers used by Lit, Material Web, and tslib.
32
- 4. Import the components you need from the CDN.
33
-
34
- ```html
35
- <!DOCTYPE html>
36
- <html>
37
- <head>
38
- <title>My App</title>
39
- <!-- 1. Material Symbols for icons -->
40
- <link rel="stylesheet" href="https://fonts.googleapis.com/css2?family=Material+Symbols+Outlined:opsz,wght,FILL,GRAD@20..48,100..700,0..1,-50..200">
41
-
42
- <!-- 2. Theme CSS -->
43
- <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@prioticket/design-system-web@1.0.5/dist/theme-only.css">
44
-
45
- <!-- 3. Import map for the design system and its peer dependencies -->
46
- <script type="importmap">
47
- {
48
- "imports": {
49
- "lit": "https://cdn.jsdelivr.net/npm/lit@3.3.1/index.js",
50
- "lit/": "https://cdn.jsdelivr.net/npm/lit@3.3.1/",
51
- "lit-html": "https://cdn.jsdelivr.net/npm/lit-html@3.3.1/lit-html.js",
52
- "lit-html/": "https://cdn.jsdelivr.net/npm/lit-html@3.3.1/",
53
- "lit-element": "https://cdn.jsdelivr.net/npm/lit-element@4.2.1/lit-element.js",
54
- "lit-element/": "https://cdn.jsdelivr.net/npm/lit-element@4.2.1/",
55
- "@lit/reactive-element": "https://cdn.jsdelivr.net/npm/@lit/reactive-element@2.1.1/reactive-element.js",
56
- "@lit/reactive-element/": "https://cdn.jsdelivr.net/npm/@lit/reactive-element@2.1.1/",
57
- "@material/web": "https://cdn.jsdelivr.net/npm/@material/web@2.4.0/index.js",
58
- "@material/web/": "https://cdn.jsdelivr.net/npm/@material/web@2.4.0/",
59
- "tslib": "https://cdn.jsdelivr.net/npm/tslib@2.6.2/tslib.es6.js",
60
- "tslib/": "https://cdn.jsdelivr.net/npm/tslib@2.6.2/"
61
- }
62
- }
63
- </script>
64
- </head>
65
- <body>
66
- <pd-button>Click Me</pd-button>
67
-
68
- <!-- 4. Import the components you need -->
69
- <script type="module">
70
- await import("https://cdn.jsdelivr.net/npm/@prioticket/design-system-web@1.0.5/dist/components/pd-button.es.js");
71
- </script>
72
- </body>
73
- </html>
74
- ```
75
-
76
- **Notes:**
77
- - Reuse the same import map for every demo page; add or remove component imports as needed (see `public/component-gallery.html` for a larger example).
78
- - Chromium-based browsers allow this to run directly from `file://` URLs. For Safari/Firefox or when sharing with others, serve the folder over HTTP (for example, `npx http-server public` or `python3 -m http.server`).
79
- - Update the `@prioticket/design-system-web@1.0.5` version string when a new release becomes available.
80
-
81
- ```html
82
- <!-- Theme CSS options -->
83
- <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@prioticket/design-system-web@1.0.5/dist/theme-only.css">
84
- <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@prioticket/design-system-web@1.0.5/dist/theme-with-fonts.css">
85
- <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@prioticket/design-system-web@1.0.5/dist/fonts-only.css">
86
- ```
87
-
88
- **PHP Example:**
89
- ```php
90
- <!DOCTYPE html>
91
- <html>
92
- <head>
93
- <title><?= htmlspecialchars($pageTitle) ?></title>
94
- <link rel="stylesheet" href="https://fonts.googleapis.com/css2?family=Material+Symbols+Outlined:opsz,wght,FILL,GRAD@20..48,100..700,0..1,-50..200">
95
- <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@prioticket/design-system-web@1.0.5/dist/theme-only.css">
96
- <script type="importmap">{
97
- "imports": {
98
- "lit": "https://cdn.jsdelivr.net/npm/lit@3.3.1/index.js",
99
- "lit/": "https://cdn.jsdelivr.net/npm/lit@3.3.1/",
100
- "@material/web": "https://cdn.jsdelivr.net/npm/@material/web@2.4.0/index.js",
101
- "@material/web/": "https://cdn.jsdelivr.net/npm/@material/web@2.4.0/",
102
- "tslib": "https://cdn.jsdelivr.net/npm/tslib@2.6.2/tslib.es6.js",
103
- "tslib/": "https://cdn.jsdelivr.net/npm/tslib@2.6.2/"
104
- }
105
- }</script>
106
- </head>
107
- <body>
108
- <pd-button variant="filled"><?= htmlspecialchars($buttonText) ?></pd-button>
109
- <pd-card>
110
- <h3><?= htmlspecialchars($cardTitle) ?></h3>
111
- <p><?= htmlspecialchars($cardContent) ?></p>
112
- </pd-card>
113
-
114
- <script type="module">
115
- await import("https://cdn.jsdelivr.net/npm/@prioticket/design-system-web@1.0.5/dist/components/pd-button.es.js");
116
- await import("https://cdn.jsdelivr.net/npm/@prioticket/design-system-web@1.0.5/dist/components/pd-card.es.js");
117
- </script>
118
- </body>
119
- </html>
120
- ```
121
-
122
- #### About single-script bundles
123
-
124
- The published package focuses on ES modules so that browsers and bundlers can tree-shake unused Material Web dependencies. Producing a one-file UMD/IIFE bundle would dramatically increase payload size, and Vite cannot emit a shared UMD bundle while we expose every component as an entry point. We plan to revisit this once we have a dedicated aggregation build, but for 1.0.5 we recommend sticking with the import-map approach above or a real bundler setup.
125
-
126
- ### 2. Usage with a Bundler (Framework Integration)
127
-
128
- #### Angular
129
-
130
- **Step 1: Add CSS to angular.json**
131
-
132
- This tells the Angular CLI to include the theme styles in your application's global CSS bundle.
133
-
134
- ```json
135
- "styles": [
136
- "src/styles.css",
137
- "node_modules/@prioticket/design-system-web/dist/theme-only.css"
138
- ]
139
- ```
140
-
141
- **Step 1.5: Add Material Icons to index.html**
142
-
143
- Add the Material Icons font to your `src/index.html` file:
144
-
145
- ```html
146
- <head>
147
- <!-- Other head content -->
148
- <link rel="stylesheet" href="https://fonts.googleapis.com/css2?family=Material+Symbols+Outlined:opsz,wght,FILL,GRAD@20..48,100..700,0..1,-50..200">
149
- </head>
150
- ```
151
-
152
- **Step 2: Import Components and Add Schema**
153
-
154
- In your Angular component, import the components to register them and add `CUSTOM_ELEMENTS_SCHEMA`.
155
-
156
- ```typescript
157
- import { Component, CUSTOM_ELEMENTS_SCHEMA } from '@angular/core';
158
-
159
- // Import components by their package path
160
- import '@prioticket/design-system-web/components/pd-button';
161
-
162
- @Component({
163
- selector: 'app-example',
164
- template: `<pd-button>Hello from Angular</pd-button>`,
165
- schemas: [CUSTOM_ELEMENTS_SCHEMA]
166
- })
167
- export class ExampleComponent {}
168
- ```
169
-
170
- #### React / Vue / Other Frameworks
171
-
172
- Similar pattern - install via npm, import the CSS file, and import individual components:
173
-
174
- ```javascript
175
- // Import the theme CSS (exact method depends on your bundler)
176
- import '@prioticket/design-system-web/dist/theme-only.css';
177
-
178
- // Import components
179
- import '@prioticket/design-system-web/components/pd-button';
180
-
181
- // Use in JSX/template
182
- <pd-button>Hello from React</pd-button>
183
- ```
184
-
185
- ## Available Components
186
-
187
- | Component | Description | CDN Import Path |
188
- |-----------|-------------|-----------------|
189
- | pd-button | Material Design buttons | `components/pd-button.es.js` |
190
- | pd-card | Cards for content grouping | `components/pd-card.es.js` |
191
- | pd-checkbox | Checkboxes | `components/pd-checkbox.es.js` |
192
- | pd-chip | Chips for tags/filters | `components/pd-chip.es.js` |
193
- | pd-dialog | Modal dialogs | `components/pd-dialog.es.js` |
194
- | pd-expandable-card | Expandable cards with collapsible content | `components/pd-expandable-card.es.js` |
195
- | pd-fab | Floating action buttons | `components/pd-fab.es.js` |
196
- | pd-icon | Material Design icons | `components/pd-icon.es.js` |
197
- | pd-icon-button | Icon buttons | `components/pd-icon-button.es.js` |
198
- | pd-list | Lists with items | `components/pd-list.es.js` |
199
- | pd-menu | Dropdown menus | `components/pd-menu.es.js` |
200
- | pd-menu-item | Individual menu items | `components/pd-menu-item.es.js` |
201
- | pd-progress | Progress indicators | `components/pd-progress.es.js` |
202
- | pd-radio | Radio buttons | `components/pd-radio.es.js` |
203
- | pd-segmented-button | Segmented button controls | `components/pd-segmented-button.es.js` |
204
- | pd-segmented-stepper | Segmented stepper navigation | `components/pd-segmented-stepper.es.js` |
205
- | pd-select | Select dropdowns | `components/pd-select.es.js` |
206
- | pd-slider | Range sliders | `components/pd-slider.es.js` |
207
- | pd-stepper | Step indicators | `components/pd-stepper.es.js` |
208
- | pd-switch | Toggle switches | `components/pd-switch.es.js` |
209
- | pd-tabs | Tab navigation | `components/pd-tabs.es.js` |
210
- | pd-text-field | Text input fields | `components/pd-text-field.es.js` |
211
-
212
- ## Dynamic Theming
213
-
214
- The design system supports real-time theme switching without page reload. Apply custom themes dynamically to match your brand or user preferences.
215
-
216
- ### Basic Usage
217
-
218
- ```javascript
219
- // Import the theming system
220
- import { initialize } from '@prioticket/design-system-web/theming';
221
-
222
- // Apply a custom theme
223
- await initialize({
224
- theme: {
225
- colorPrimary: '#ff6600',
226
- colorOnPrimary: '#ffffff',
227
- colorSurface: '#fff8f5',
228
- shapeCornerSmall: '8px'
229
- }
230
- });
231
- ```
232
-
233
- ### CDN Usage
234
-
235
- ```html
236
- <script type="module">
237
- import { initialize } from 'https://cdn.jsdelivr.net/npm/@prioticket/design-system-web@latest/dist/theming.es.js';
238
-
239
- // Apply orange theme
240
- await initialize({
241
- theme: {
242
- colorPrimary: '#ff6600',
243
- colorPrimaryContainer: '#fff3e8',
244
- shapeCornerMedium: '12px'
245
- }
246
- });
247
- </script>
248
- ```
249
-
250
- ### Supported Theme Tokens
251
-
252
- - **Colors**: `colorPrimary`, `colorOnPrimary`, `colorPrimaryContainer`, `colorSecondary`, `colorSurface`, `colorOnSurface`, `colorBackground`, `colorError`
253
- - **Shapes**: `shapeCornerSmall`, `shapeCornerMedium`, `shapeCornerLarge`
254
-
255
- ### Framework Examples
256
-
257
- **React:**
258
- ```jsx
259
- useEffect(() => {
260
- initialize({
261
- theme: { colorPrimary: '#4caf50' }
262
- });
263
- }, []);
264
- ```
265
-
266
- **Angular:**
267
- ```typescript
268
- ngOnInit() {
269
- initialize({
270
- theme: { colorPrimary: '#2196f3' }
271
- });
272
- }
273
- ```
274
-
275
- ### Live Demo
276
-
277
- Run `npm run dev` and visit `/demo-theming.html` to see real-time theme switching in action.
278
-
279
- ## Customizing Fonts
280
-
281
- The design system is built to work with any font stack. The theme CSS uses CSS custom properties:
282
-
283
- ```css
284
- /* Override Prioticket fonts with your own */
285
- :root {
286
- --md-sys-typescale-body-large-font: "Your Font", Arial, sans-serif;
287
- --md-sys-typescale-title-medium-font: "Your Font", Arial, sans-serif;
288
- --md-sys-typescale-headline-small-font: "Your Font", Arial, sans-serif;
289
- }
290
- ```
291
-
292
- ## CSS Architecture
293
-
294
- - **theme-only.css** (14KB) - All component styles without fonts
295
- - **fonts-only.css** (1.3KB) - Just Prioticket font declarations
296
- - **theme-with-fonts.css** (15.7KB) - Complete theme including fonts
297
- - **fonts/** - Font files (~232KB total)
298
-
299
- Choose `theme-only.css` to use your existing fonts, or `theme-with-fonts.css` for the complete Prioticket experience.
300
-
301
- ## Performance Best Practices
302
-
303
- 1. **Load only what you need** - Import individual components via CDN
304
- 2. **Use theme-only.css** - If you already have fonts, skip the font files
305
- 3. **Leverage HTTP/2** - Multiple small files load efficiently on modern servers
306
- 4. **CDN for Lit** - Load the Lit dependency from a fast CDN
307
- 5. **Conditional loading** - In server-side apps, only load components used on each page
308
-
309
- ## Browser Support
310
-
311
- - Chrome 84+
312
- - Firefox 90+
313
- - Safari 14+
314
- - Edge 84+
315
-
316
- ## Development
317
-
318
- ```bash
319
- # Install dependencies
320
- npm install
321
-
322
- # Start development server
323
- npm run dev
324
-
325
- # Build the library
326
- npm run build
327
-
328
- # Run Storybook
329
- npm run storybook
330
- ```
331
-
332
- ## Source Code
333
-
334
- The source code for this library is proprietary and maintained in a private repository at Prioticket.
335
-
336
- ## Support
337
-
338
- For questions or bug reports, please contact the Prioticket development team internally.
339
-
340
-
341
-
1
+ # Prioticket Design System Web
2
+
3
+ A comprehensive Web Components library built with **Lit** that provides Material Design components for Prioticket applications. This library is designed to work seamlessly across any frontend framework or in vanilla HTML.
4
+
5
+ ## Features
6
+
7
+ - 🎨 **Material Design 3** - Built on Google's official Material Web components
8
+ - 🌈 **Dynamic Theming** - Real-time theme switching without page reload
9
+ - 🌐 **Framework Agnostic** - Works with Angular, React, Vue, PHP, or any web technology
10
+ - 📦 **Tree Shakable** - Load only the components you need
11
+ - 🎯 **TypeScript** - Full type safety and excellent developer experience
12
+ - 🔧 **Customizable** - Flexible theming with CSS custom properties
13
+ - ⚡ **Performance Optimized** - Individual component bundles for maximum efficiency
14
+ - 🎪 **Modern Standards** - ES Modules, Web Components, and HTTP/2 friendly
15
+
16
+ ## Installation
17
+
18
+ ```bash
19
+ npm install @prioticket/design-system-web
20
+ ```
21
+
22
+ ### React projects
23
+
24
+ We publish official wrappers as `@prioticket/design-system-react`. Install that package alongside the web components when building React apps—see `packages/react/README.md` for setup and usage details.
25
+
26
+ ## Usage Guide
27
+
28
+ ### 1. Quick Start with CDN (Recommended for PHP, Vanilla HTML, etc.)
29
+
30
+ This is the fastest way to try the components on any plain HTML page while keeping everything tree-shakable.
31
+
32
+ **Instructions:**
33
+ 1. Add the Material Symbols font (optional, only needed when you use icons).
34
+ 2. Include one of the provided theme CSS files.
35
+ 3. Copy the import map below so the browser can resolve the bare module specifiers used by Lit, Material Web, and tslib.
36
+ 4. Import the components you need from the CDN.
37
+
38
+ ```html
39
+ <!DOCTYPE html>
40
+ <html>
41
+ <head>
42
+ <title>My App</title>
43
+ <!-- 1. Material Symbols for icons -->
44
+ <link rel="stylesheet" href="https://fonts.googleapis.com/css2?family=Material+Symbols+Outlined:opsz,wght,FILL,GRAD@20..48,100..700,0..1,-50..200">
45
+
46
+ <!-- 2. Theme CSS -->
47
+ <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@prioticket/design-system-web@1.0.7/dist/theme-only.css">
48
+
49
+ <!-- 3. Import map for the design system and its peer dependencies -->
50
+ <script type="importmap">
51
+ {
52
+ "imports": {
53
+ "lit": "https://cdn.jsdelivr.net/npm/lit@3.3.1/index.js",
54
+ "lit/": "https://cdn.jsdelivr.net/npm/lit@3.3.1/",
55
+ "lit-html": "https://cdn.jsdelivr.net/npm/lit-html@3.3.1/lit-html.js",
56
+ "lit-html/": "https://cdn.jsdelivr.net/npm/lit-html@3.3.1/",
57
+ "lit-element": "https://cdn.jsdelivr.net/npm/lit-element@4.2.1/lit-element.js",
58
+ "lit-element/": "https://cdn.jsdelivr.net/npm/lit-element@4.2.1/",
59
+ "@lit/reactive-element": "https://cdn.jsdelivr.net/npm/@lit/reactive-element@2.1.1/reactive-element.js",
60
+ "@lit/reactive-element/": "https://cdn.jsdelivr.net/npm/@lit/reactive-element@2.1.1/",
61
+ "@material/web": "https://cdn.jsdelivr.net/npm/@material/web@2.4.0/index.js",
62
+ "@material/web/": "https://cdn.jsdelivr.net/npm/@material/web@2.4.0/",
63
+ "tslib": "https://cdn.jsdelivr.net/npm/tslib@2.6.2/tslib.es6.js",
64
+ "tslib/": "https://cdn.jsdelivr.net/npm/tslib@2.6.2/"
65
+ }
66
+ }
67
+ </script>
68
+ </head>
69
+ <body>
70
+ <pd-button>Click Me</pd-button>
71
+
72
+ <!-- 4. Import the components you need -->
73
+ <script type="module">
74
+ await import("https://cdn.jsdelivr.net/npm/@prioticket/design-system-web@1.0.7/dist/components/pd-button.es.js");
75
+ </script>
76
+ </body>
77
+ </html>
78
+ ```
79
+
80
+ **Notes:**
81
+ - Reuse the same import map for every demo page; add or remove component imports as needed (see `public/component-gallery.html` for a larger example).
82
+ - Chromium-based browsers allow this to run directly from `file://` URLs. For Safari/Firefox or when sharing with others, serve the folder over HTTP (for example, `npx http-server public` or `python3 -m http.server`).
83
+ - Update the `@prioticket/design-system-web@1.0.7` version string when a new release becomes available.
84
+
85
+ ```html
86
+ <!-- Theme CSS options -->
87
+ <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@prioticket/design-system-web@1.0.7/dist/theme-only.css">
88
+ <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@prioticket/design-system-web@1.0.7/dist/theme-with-fonts.css">
89
+ <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@prioticket/design-system-web@1.0.7/dist/fonts-only.css">
90
+ ```
91
+
92
+ **PHP Example:**
93
+ ```php
94
+ <!DOCTYPE html>
95
+ <html>
96
+ <head>
97
+ <title><?= htmlspecialchars($pageTitle) ?></title>
98
+ <link rel="stylesheet" href="https://fonts.googleapis.com/css2?family=Material+Symbols+Outlined:opsz,wght,FILL,GRAD@20..48,100..700,0..1,-50..200">
99
+ <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@prioticket/design-system-web@1.0.7/dist/theme-only.css">
100
+ <script type="importmap">{
101
+ "imports": {
102
+ "lit": "https://cdn.jsdelivr.net/npm/lit@3.3.1/index.js",
103
+ "lit/": "https://cdn.jsdelivr.net/npm/lit@3.3.1/",
104
+ "@material/web": "https://cdn.jsdelivr.net/npm/@material/web@2.4.0/index.js",
105
+ "@material/web/": "https://cdn.jsdelivr.net/npm/@material/web@2.4.0/",
106
+ "tslib": "https://cdn.jsdelivr.net/npm/tslib@2.6.2/tslib.es6.js",
107
+ "tslib/": "https://cdn.jsdelivr.net/npm/tslib@2.6.2/"
108
+ }
109
+ }</script>
110
+ </head>
111
+ <body>
112
+ <pd-button variant="filled"><?= htmlspecialchars($buttonText) ?></pd-button>
113
+ <pd-card>
114
+ <h3><?= htmlspecialchars($cardTitle) ?></h3>
115
+ <p><?= htmlspecialchars($cardContent) ?></p>
116
+ </pd-card>
117
+
118
+ <script type="module">
119
+ await import("https://cdn.jsdelivr.net/npm/@prioticket/design-system-web@1.0.7/dist/components/pd-button.es.js");
120
+ await import("https://cdn.jsdelivr.net/npm/@prioticket/design-system-web@1.0.7/dist/components/pd-card.es.js");
121
+ </script>
122
+ </body>
123
+ </html>
124
+ ```
125
+
126
+ #### About single-script bundles
127
+
128
+ The published package focuses on ES modules so that browsers and bundlers can tree-shake unused Material Web dependencies. Producing a one-file UMD/IIFE bundle would dramatically increase payload size, and Vite cannot emit a shared UMD bundle while we expose every component as an entry point. We plan to revisit this once we have a dedicated aggregation build, but for 1.0.7 we recommend sticking with the import-map approach above or a real bundler setup.
129
+
130
+ ### 2. Usage with a Bundler (Framework Integration)
131
+
132
+ #### Angular
133
+
134
+ **Step 1: Add CSS to angular.json**
135
+
136
+ This tells the Angular CLI to include the theme styles in your application's global CSS bundle.
137
+
138
+ ```json
139
+ "styles": [
140
+ "src/styles.css",
141
+ "node_modules/@prioticket/design-system-web/dist/theme-only.css"
142
+ ]
143
+ ```
144
+
145
+ **Step 1.5: Add Material Icons to index.html**
146
+
147
+ Add the Material Icons font to your `src/index.html` file:
148
+
149
+ ```html
150
+ <head>
151
+ <!-- Other head content -->
152
+ <link rel="stylesheet" href="https://fonts.googleapis.com/css2?family=Material+Symbols+Outlined:opsz,wght,FILL,GRAD@20..48,100..700,0..1,-50..200">
153
+ </head>
154
+ ```
155
+
156
+ **Step 2: Import Components and Add Schema**
157
+
158
+ In your Angular component, import the components to register them and add `CUSTOM_ELEMENTS_SCHEMA`.
159
+
160
+ ```typescript
161
+ import { Component, CUSTOM_ELEMENTS_SCHEMA } from '@angular/core';
162
+
163
+ // Import components by their package path
164
+ import '@prioticket/design-system-web/components/pd-button';
165
+
166
+ @Component({
167
+ selector: 'app-example',
168
+ template: `<pd-button>Hello from Angular</pd-button>`,
169
+ schemas: [CUSTOM_ELEMENTS_SCHEMA]
170
+ })
171
+ export class ExampleComponent {}
172
+ ```
173
+
174
+ #### React / Vue / Other Frameworks
175
+
176
+ Similar pattern - install via npm, import the CSS file, and import individual components:
177
+
178
+ ```javascript
179
+ // Import the theme CSS (exact method depends on your bundler)
180
+ import '@prioticket/design-system-web/dist/theme-only.css';
181
+
182
+ // Import components
183
+ import '@prioticket/design-system-web/components/pd-button';
184
+
185
+ // Use in JSX/template
186
+ <pd-button>Hello from React</pd-button>
187
+ ```
188
+
189
+ ## Available Components
190
+
191
+ | Component | Description | CDN Import Path |
192
+ |-----------|-------------|-----------------|
193
+ | pd-button | Material Design buttons | `components/pd-button.es.js` |
194
+ | pd-card | Cards for content grouping | `components/pd-card.es.js` |
195
+ | pd-checkbox | Checkboxes | `components/pd-checkbox.es.js` |
196
+ | pd-chip | Chips for tags/filters | `components/pd-chip.es.js` |
197
+ | pd-dialog | Modal dialogs | `components/pd-dialog.es.js` |
198
+ | pd-expandable-card | Expandable cards with collapsible content | `components/pd-expandable-card.es.js` |
199
+ | pd-fab | Floating action buttons | `components/pd-fab.es.js` |
200
+ | pd-icon | Material Design icons | `components/pd-icon.es.js` |
201
+ | pd-icon-button | Icon buttons | `components/pd-icon-button.es.js` |
202
+ | pd-list | Lists with items | `components/pd-list.es.js` |
203
+ | pd-menu | Dropdown menus | `components/pd-menu.es.js` |
204
+ | pd-menu-item | Individual menu items | `components/pd-menu-item.es.js` |
205
+ | pd-progress | Progress indicators | `components/pd-progress.es.js` |
206
+ | pd-radio | Radio buttons | `components/pd-radio.es.js` |
207
+ | pd-segmented-button | Segmented button controls | `components/pd-segmented-button.es.js` |
208
+ | pd-segmented-stepper | Segmented stepper navigation | `components/pd-segmented-stepper.es.js` |
209
+ | pd-select | Select dropdowns | `components/pd-select.es.js` |
210
+ | pd-slider | Range sliders | `components/pd-slider.es.js` |
211
+ | pd-stepper | Step indicators | `components/pd-stepper.es.js` |
212
+ | pd-switch | Toggle switches | `components/pd-switch.es.js` |
213
+ | pd-tabs | Tab navigation | `components/pd-tabs.es.js` |
214
+ | pd-text-field | Text input fields | `components/pd-text-field.es.js` |
215
+
216
+ ## Dynamic Theming
217
+
218
+ The design system supports real-time theme switching without page reload. Apply custom themes dynamically to match your brand or user preferences.
219
+
220
+ ### Basic Usage
221
+
222
+ ```javascript
223
+ // Import the theming system
224
+ import { initialize } from '@prioticket/design-system-web/theming';
225
+
226
+ // Apply a custom theme
227
+ await initialize({
228
+ theme: {
229
+ colorPrimary: '#ff6600',
230
+ colorOnPrimary: '#ffffff',
231
+ colorSurface: '#fff8f5',
232
+ shapeCornerSmall: '8px'
233
+ }
234
+ });
235
+ ```
236
+
237
+ ### CDN Usage
238
+
239
+ ```html
240
+ <script type="module">
241
+ import { initialize } from 'https://cdn.jsdelivr.net/npm/@prioticket/design-system-web@latest/dist/theming.es.js';
242
+
243
+ // Apply orange theme
244
+ await initialize({
245
+ theme: {
246
+ colorPrimary: '#ff6600',
247
+ colorPrimaryContainer: '#fff3e8',
248
+ shapeCornerMedium: '12px'
249
+ }
250
+ });
251
+ </script>
252
+ ```
253
+
254
+ ### Supported Theme Tokens
255
+
256
+ - **Colors**: `colorPrimary`, `colorOnPrimary`, `colorPrimaryContainer`, `colorSecondary`, `colorSurface`, `colorOnSurface`, `colorBackground`, `colorError`
257
+ - **Shapes**: `shapeCornerSmall`, `shapeCornerMedium`, `shapeCornerLarge`
258
+
259
+ ### Framework Examples
260
+
261
+ **React:**
262
+ ```jsx
263
+ useEffect(() => {
264
+ initialize({
265
+ theme: { colorPrimary: '#4caf50' }
266
+ });
267
+ }, []);
268
+ ```
269
+
270
+ **Angular:**
271
+ ```typescript
272
+ ngOnInit() {
273
+ initialize({
274
+ theme: { colorPrimary: '#2196f3' }
275
+ });
276
+ }
277
+ ```
278
+
279
+ ### Live Demo
280
+
281
+ Run `npm run dev` and visit `/demo-theming.html` to see real-time theme switching in action.
282
+
283
+ ## Customizing Fonts
284
+
285
+ The design system is built to work with any font stack. The theme CSS uses CSS custom properties:
286
+
287
+ ```css
288
+ /* Override Prioticket fonts with your own */
289
+ :root {
290
+ --md-sys-typescale-body-large-font: "Your Font", Arial, sans-serif;
291
+ --md-sys-typescale-title-medium-font: "Your Font", Arial, sans-serif;
292
+ --md-sys-typescale-headline-small-font: "Your Font", Arial, sans-serif;
293
+ }
294
+ ```
295
+
296
+ ## CSS Architecture
297
+
298
+ - **theme-only.css** (14KB) - All component styles without fonts
299
+ - **fonts-only.css** (1.3KB) - Just Prioticket font declarations
300
+ - **theme-with-fonts.css** (15.7KB) - Complete theme including fonts
301
+ - **fonts/** - Font files (~232KB total)
302
+
303
+ Choose `theme-only.css` to use your existing fonts, or `theme-with-fonts.css` for the complete Prioticket experience.
304
+
305
+ ## Performance Best Practices
306
+
307
+ 1. **Load only what you need** - Import individual components via CDN
308
+ 2. **Use theme-only.css** - If you already have fonts, skip the font files
309
+ 3. **Leverage HTTP/2** - Multiple small files load efficiently on modern servers
310
+ 4. **CDN for Lit** - Load the Lit dependency from a fast CDN
311
+ 5. **Conditional loading** - In server-side apps, only load components used on each page
312
+
313
+ ## Browser Support
314
+
315
+ - Chrome 84+
316
+ - Firefox 90+
317
+ - Safari 14+
318
+ - Edge 84+
319
+
320
+ ## Development
321
+
322
+ ```bash
323
+ # Install dependencies
324
+ npm install
325
+
326
+ # Start development server
327
+ npm run dev
328
+
329
+ # Build the library
330
+ npm run build
331
+
332
+ # Run Storybook
333
+ npm run storybook
334
+ ```
335
+
336
+ ## Source Code
337
+
338
+ The source code for this library is proprietary and maintained in a private repository at Prioticket.
339
+
340
+ ## Support
341
+
342
+ For questions or bug reports, please contact the Prioticket development team internally.
343
+
344
+