@parallelogram-js/dashboard 0.0.0-stage → 0.1.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.
Files changed (78) hide show
  1. package/CHANGELOG.md +124 -0
  2. package/LICENSE +21 -0
  3. package/README.md +1391 -2
  4. package/dist/parallelogram-dashboard.css +9478 -0
  5. package/dist/parallelogram-dashboard.css.map +1 -0
  6. package/dist/parallelogram-dashboard.min.css +1 -0
  7. package/package.json +72 -4
  8. package/scss/_base.scss +403 -0
  9. package/scss/_datetime.scss +50 -0
  10. package/scss/_icon.scss +40 -0
  11. package/scss/_index.scss +61 -0
  12. package/scss/_mixins.scss +396 -0
  13. package/scss/_tokens.scss +340 -0
  14. package/scss/_utilities.scss +464 -0
  15. package/scss/_variables.scss +219 -0
  16. package/scss/components/_accordion.scss +297 -0
  17. package/scss/components/_actionbar.scss +333 -0
  18. package/scss/components/_alert.scss +183 -0
  19. package/scss/components/_auth.scss +98 -0
  20. package/scss/components/_avatar.scss +203 -0
  21. package/scss/components/_badge.scss +176 -0
  22. package/scss/components/_banner.scss +344 -0
  23. package/scss/components/_breadcrumb.scss +220 -0
  24. package/scss/components/_button.scss +264 -0
  25. package/scss/components/_card.scss +256 -0
  26. package/scss/components/_chart.scss +246 -0
  27. package/scss/components/_command.scss +267 -0
  28. package/scss/components/_dashboard.scss +681 -0
  29. package/scss/components/_data-list.scss +280 -0
  30. package/scss/components/_dropdown.scss +318 -0
  31. package/scss/components/_empty.scss +226 -0
  32. package/scss/components/_filebrowser.scss +906 -0
  33. package/scss/components/_form-layout.scss +332 -0
  34. package/scss/components/_input.scss +310 -0
  35. package/scss/components/_list.scss +130 -0
  36. package/scss/components/_media.scss +239 -0
  37. package/scss/components/_modal.scss +298 -0
  38. package/scss/components/_navbar.scss +312 -0
  39. package/scss/components/_notification.scss +59 -0
  40. package/scss/components/_pageheader.scss +99 -0
  41. package/scss/components/_pagination.scss +165 -0
  42. package/scss/components/_progress.scss +333 -0
  43. package/scss/components/_separator.scss +129 -0
  44. package/scss/components/_sheet.scss +286 -0
  45. package/scss/components/_sidebar.scss +324 -0
  46. package/scss/components/_skeleton.scss +246 -0
  47. package/scss/components/_stat.scss +218 -0
  48. package/scss/components/_table.scss +589 -0
  49. package/scss/components/_tabs.scss +266 -0
  50. package/scss/components/_timeline.scss +339 -0
  51. package/scss/components/_toast.scss +259 -0
  52. package/scss/components/_toolbar.scss +301 -0
  53. package/scss/components/_tooltip.scss +250 -0
  54. package/scss/main.scss +6 -0
  55. package/src/js/behaviours/accordion.js +58 -0
  56. package/src/js/behaviours/action-bar-list.js +406 -0
  57. package/src/js/behaviours/action-bar.js +29 -0
  58. package/src/js/behaviours/chart.js +339 -0
  59. package/src/js/behaviours/collapsible.js +34 -0
  60. package/src/js/behaviours/editable-table.js +91 -0
  61. package/src/js/behaviours/expandable.js +80 -0
  62. package/src/js/behaviours/overflow-actions.js +137 -0
  63. package/src/js/behaviours/publish-schedule.js +91 -0
  64. package/src/js/behaviours/search-clear.js +19 -0
  65. package/src/js/behaviours/segmented-control.js +43 -0
  66. package/src/js/behaviours/submenu.js +73 -0
  67. package/src/js/behaviours/table-columns.js +77 -0
  68. package/src/js/behaviours/table-paste.js +305 -0
  69. package/src/js/behaviours/table-reorder.js +252 -0
  70. package/src/js/behaviours/table-sort.js +101 -0
  71. package/src/js/behaviours/tabs.js +148 -0
  72. package/src/js/behaviours/toast-manager.js +106 -0
  73. package/src/js/behaviours/toggle.js +186 -0
  74. package/src/js/behaviours/unsaved-guard.js +88 -0
  75. package/src/js/core-loader.js +26 -0
  76. package/src/js/index.js +85 -0
  77. package/src/js/polyfills/dialog-commands.js +20 -0
  78. package/src/js/util/dom.js +39 -0
package/README.md CHANGED
@@ -1,3 +1,1392 @@
1
- # Temporary Holding Version
1
+ # Parallelogram Dashboard
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ A BEM-style CSS dashboard component library inspired by shadcn/ui. Built with SCSS, vanilla JavaScript, and zero framework dependencies.
4
+
5
+ ## Quick Start
6
+
7
+ ```bash
8
+ # Install dependencies
9
+ npm install
10
+
11
+ # Build the library (expanded and minified) and the demo stylesheet
12
+ npm run build
13
+
14
+ # Watch for changes during development
15
+ npm run watch
16
+
17
+ # Serve the demo pages at http://localhost:8080 (no caching, so edits show on reload)
18
+ npm run serve
19
+ ```
20
+
21
+ ## Using the Package
22
+
23
+ The library is consumed as `@parallelogram-js/dashboard` from another project's build. There is no
24
+ CDN copy and no prebuilt `<script>` bundle. Install a published version from npm:
25
+
26
+ ```bash
27
+ npm install @parallelogram-js/dashboard@0.1.1
28
+ ```
29
+
30
+ Or install a tagged release straight from GitHub, which needs git access to the repository:
31
+
32
+ ```bash
33
+ npm install "git+ssh://git@github.com/parallelogram-dev/parallelogram-dashboard.git#v0.1.1"
34
+ ```
35
+
36
+ To upgrade, read the [changelog](CHANGELOG.md) entries since the current version, make any listed
37
+ markup changes in the project's templates, then install the new version. The compiled CSS in
38
+ `dist/` ships with the package, so nothing needs building after install.
39
+
40
+ ```js
41
+ import { init } from '@parallelogram-js/dashboard';
42
+ import { TableSort } from '@parallelogram-js/dashboard/behaviours/table-sort';
43
+ ```
44
+
45
+ ```scss
46
+ @use "@parallelogram-js/dashboard/scss" with ($control-border-width: 2px);
47
+ ```
48
+
49
+ Keep the project's own look in a theme file of token values (see [Theme files](#theme-files)) and
50
+ write each component's markup once in the project's templates, so a markup change in a release is
51
+ one edit.
52
+
53
+ ## Component Pages and Playground
54
+
55
+ `demo/index.html` links to one page per component in `demo/components/`, each with examples and,
56
+ where available, a live playground: controls for every variant, size and state, an "All variants"
57
+ grid, viewport widths and copyable markup. Each variant is labelled with its BEM classes, with
58
+ buttons to copy the class list (`btn btn--outline btn--sm`) or a CSS selector (`.btn.btn--outline.btn--sm`).
59
+ The playground state is kept in the URL hash, e.g. `components/button.html#variant=destructive&size=sm`.
60
+
61
+ - `demo/js/components/manifest.js` lists every page, its group and the SCSS partial it documents.
62
+ - `demo/js/playground/specs/` holds one spec per component: controls, presets, a `target` selector for
63
+ the element the variants apply to, and a `render(state)` function returning HTML. Register specs in
64
+ `specs/index.js` and set `spec` on the component's manifest entry.
65
+
66
+ Specs can also set `layout: 'block'` (full-width stage) or `layout: 'full'` (no padding, opens at the
67
+ Desktop width; for page-level layouts such as the dashboard shell). In the "All variants" grid each
68
+ cell gets its own ids, so toggles and labels keep working in every copy.
69
+
70
+ `npm run playground:register` registers every spec file in `specs/`: it rewrites `specs/index.js`, sets
71
+ `spec` on the matching manifest entry and adds the Playground section to the component page.
72
+
73
+ `npm run playground:check` fails if a spec never renders a class its SCSS `sources` define, or if a
74
+ component partial has no page, and lists pages still without a playground. Pass spec files to check
75
+ just those, before registering them: `node scripts/playground-check.mjs demo/js/playground/specs/table.js`. It runs in CI before the
76
+ demo is deployed to GitHub Pages.
77
+
78
+ ### LLM references
79
+
80
+ `npm run build` generates [llms.txt](https://llmstxt.org) files (git-ignored, published with the demo):
81
+ `demo/llms.txt` lists every component with usage rules, `demo/llms/<slug>.md` holds each component's
82
+ classes, modifiers and example markup, and `demo/llms-full.txt` concatenates them all. Each component page
83
+ has a **Copy for LLM** button that copies its reference plus the current playground markup. Links use
84
+ `SITE_URL` (default: the GitHub Pages address).
85
+
86
+ `npm run build` also copies `@parallelogram-js/core` into `demo/vendor/` (git-ignored); the demo pages
87
+ load `<p-modal>`, `<p-datetime>` and the modal trigger from there. Pages must be served over HTTP
88
+ (`npm run serve`) because they use ES modules, which browsers block on `file://` URLs.
89
+
90
+ ## File Structure
91
+
92
+ ```
93
+ parallelogram-dashboard/
94
+ ├── scss/ # SCSS source files
95
+ │ ├── _variables.scss # Sass values (palette, spacing, type, breakpoints); emits no CSS
96
+ │ ├── _tokens.scss # Theme custom properties and the @parallelogram-js/core tokens they feed
97
+ │ ├── _mixins.scss # Reusable SCSS mixins
98
+ │ ├── _base.scss # Reset & base styles
99
+ │ ├── _utilities.scss # Utility classes
100
+ │ ├── _icon.scss # Icon styles
101
+ │ ├── _datetime.scss # <p-datetime> web component theming
102
+ │ ├── _demo.scss # Demo page styles (not part of the library)
103
+ │ ├── components/ # Component styles
104
+ │ │ ├── _accordion.scss
105
+ │ │ ├── _alert.scss
106
+ │ │ ├── _auth.scss
107
+ │ │ ├── _avatar.scss
108
+ │ │ ├── _badge.scss
109
+ │ │ ├── _banner.scss
110
+ │ │ ├── _breadcrumb.scss
111
+ │ │ ├── _button.scss
112
+ │ │ ├── _card.scss
113
+ │ │ ├── _command.scss
114
+ │ │ ├── _dashboard.scss
115
+ │ │ ├── _data-list.scss
116
+ │ │ ├── _dropdown.scss
117
+ │ │ ├── _empty.scss
118
+ │ │ ├── _form-layout.scss
119
+ │ │ ├── _input.scss
120
+ │ │ ├── _modal.scss
121
+ │ │ ├── _navbar.scss
122
+ │ │ ├── _pageheader.scss
123
+ │ │ ├── _pagination.scss
124
+ │ │ ├── _progress.scss
125
+ │ │ ├── _separator.scss
126
+ │ │ ├── _sheet.scss
127
+ │ │ ├── _sidebar.scss
128
+ │ │ ├── _skeleton.scss
129
+ │ │ ├── _stat.scss
130
+ │ │ ├── _table.scss
131
+ │ │ ├── _tabs.scss
132
+ │ │ ├── _timeline.scss
133
+ │ │ ├── _toast.scss
134
+ │ │ ├── _toolbar.scss
135
+ │ │ └── _tooltip.scss
136
+ │ ├── main.scss # Library entry point → dist/parallelogram-dashboard.css
137
+ │ └── demo-pages.scss # Demo entry point → demo/css/demo.css
138
+ ├── demo/ # Demo pages & assets
139
+ │ ├── css/ # Built CSS (auto-copied on build)
140
+ │ ├── js/
141
+ │ │ └── main.js # JavaScript components
142
+ │ └── *.html # Demo template pages
143
+ ├── dist/ # Distribution folder
144
+ └── package.json
145
+ ```
146
+
147
+ ---
148
+
149
+ ## Design System
150
+
151
+ ### Colors
152
+
153
+ Colors are defined as CSS custom properties for easy theming. Edit the `$theme-tokens` map in
154
+ `scss/_tokens.scss` to customize; each entry holds its light and dark value.
155
+
156
+ #### Semantic Colors
157
+
158
+ | Variable | Light | Dark | Usage |
159
+ |----------|-------|------|-------|
160
+ | `--bg` | zinc-50 | zinc-950 | Page background |
161
+ | `--fg` | zinc-950 | zinc-50 | Primary text |
162
+ | `--fg-muted` | zinc-500 | zinc-400 | Secondary text |
163
+ | `--border` | zinc-200 | zinc-800 | Borders |
164
+ | `--primary` | zinc-900 | zinc-50 | Primary actions |
165
+ | `--secondary` | zinc-100 | zinc-800 | Secondary actions |
166
+ | `--destructive` | red-500 | red-600 | Destructive actions |
167
+ | `--success` | green-500 | green-500 | Success states |
168
+ | `--warning` | amber-500 | amber-500 | Warning states |
169
+ | `--info` | blue-500 | blue-500 | Info states |
170
+
171
+ #### Component Colors
172
+
173
+ | Variable | Usage |
174
+ |----------|-------|
175
+ | `--card` | Card backgrounds |
176
+ | `--popover` | Dropdown/popover backgrounds |
177
+ | `--input` | Input borders |
178
+ | `--accent` | Hover highlights |
179
+ | `--ring` | Focus rings |
180
+
181
+ ### Spacing Scale
182
+
183
+ Consistent spacing using size-based naming:
184
+
185
+ | Variable | Value | Pixels |
186
+ |----------|-------|--------|
187
+ | `$spacing-3xs` | 0.25rem | 4px |
188
+ | `$spacing-2xs` | 0.5rem | 8px |
189
+ | `$spacing-xs` | 0.75rem | 12px |
190
+ | `$spacing-sm` | 1rem | 16px |
191
+ | `$spacing-md` | 1.25rem | 20px |
192
+ | `$spacing-lg` | 1.5rem | 24px |
193
+ | `$spacing-xl` | 2rem | 32px |
194
+ | `$spacing-2xl` | 2.5rem | 40px |
195
+ | `$spacing-3xl` | 3rem | 48px |
196
+ | `$spacing-4xl` | 4rem | 64px |
197
+
198
+ ### Typography
199
+
200
+ ```scss
201
+ // Font families
202
+ $font-sans: ui-sans-serif, system-ui, -apple-system, ...;
203
+ $font-mono: ui-monospace, SFMono-Regular, ...;
204
+
205
+ // Font sizes
206
+ $font-size-xs: 0.75rem; // 12px
207
+ $font-size-sm: 0.875rem; // 14px
208
+ $font-size-base: 1rem; // 16px
209
+ $font-size-lg: 1.125rem; // 18px
210
+ $font-size-xl: 1.25rem; // 20px
211
+ $font-size-2xl: 1.5rem; // 24px
212
+ $font-size-3xl: 1.875rem; // 30px
213
+ $font-size-4xl: 2.25rem; // 36px
214
+
215
+ // Heading scale (h6 → h1): each level is the ratio times the one below, from 1rem.
216
+ // Below the md breakpoint the gentler ratio keeps h1 readable on phones.
217
+ $type-scale-ratio: 1.333; // 16 / 21 / 28 / 38 / 50 / 67px
218
+ $type-scale-ratio-sm: 1.2; // 16 / 19 / 23 / 28 / 33 / 40px
219
+
220
+ // Font weights
221
+ $font-weight-normal: 400;
222
+ $font-weight-medium: 500;
223
+ $font-weight-semibold: 600;
224
+ $font-weight-bold: 700;
225
+ ```
226
+
227
+ ### Border Radius
228
+
229
+ ```scss
230
+ $radius-sm: 0.25rem; // 4px
231
+ $radius-md: 0.375rem; // 6px
232
+ $radius-lg: 0.5rem; // 8px (default)
233
+ $radius-xl: 0.75rem; // 12px
234
+ $radius-full: 9999px; // Pill/circle
235
+ ```
236
+
237
+ ### Shadows
238
+
239
+ ```scss
240
+ $shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
241
+ $shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), ...;
242
+ $shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), ...;
243
+ $shadow-xl: 0 20px 25px -5px rgb(0 0 0 / 0.1), ...;
244
+ ```
245
+
246
+ ### Breakpoints
247
+
248
+ ```scss
249
+ $breakpoint-sm: 640px;
250
+ $breakpoint-md: 768px;
251
+ $breakpoint-lg: 1024px;
252
+ $breakpoint-xl: 1280px;
253
+ $breakpoint-2xl: 1536px;
254
+
255
+ // Usage with mixins
256
+ @include sm { ... } // min-width: 640px
257
+ @include md { ... } // min-width: 768px
258
+ @include lg { ... } // min-width: 1024px
259
+ @include max-sm { ... } // max-width: 639px
260
+ @include max-md { ... } // max-width: 767px
261
+ ```
262
+
263
+ ---
264
+
265
+ ## BEM Naming Convention
266
+
267
+ This library follows strict BEM (Block Element Modifier) naming:
268
+
269
+ ```
270
+ .block
271
+ .block__element
272
+ .block--modifier
273
+ .block__element--modifier
274
+ ```
275
+
276
+ ### Rules
277
+
278
+ 1. **Blocks** use single words or camelCase: `.card`, `.navmenu`, `.datalist`
279
+ 2. **Elements** use double underscore: `.card__header`, `.card__title`
280
+ 3. **Modifiers** use double hyphen: `.card--elevated`, `.btn--primary`
281
+ 4. **No nesting beyond one level**: Use `.card__title` not `.card__header__title`
282
+
283
+ ### Examples
284
+
285
+ ```html
286
+ <!-- Block with modifiers -->
287
+ <div class="card card--elevated">
288
+
289
+ <!-- Elements -->
290
+ <div class="card__header">
291
+ <h3 class="card__title">Title</h3>
292
+ <p class="card__description">Description</p>
293
+ </div>
294
+
295
+ <div class="card__content">
296
+ Content here
297
+ </div>
298
+
299
+ <!-- Element with modifier -->
300
+ <div class="card__footer card__footer--border">
301
+ Footer
302
+ </div>
303
+ </div>
304
+ ```
305
+
306
+ ---
307
+
308
+ ## State Conventions
309
+
310
+ Classes describe what a component *looks like* (variant, size, layout). What a component *is
311
+ doing* — disabled, open, current, selected, invalid — is expressed with native HTML attributes,
312
+ pseudo-classes and ARIA states, and the stylesheet reads those directly. The markup that is
313
+ correct for assistive technology is then also the markup that gets styled, and scripts only
314
+ ever flip attributes.
315
+
316
+ | State | Markup | Applies to |
317
+ |---|---|---|
318
+ | Disabled | `disabled` on form controls; `aria-disabled="true"` on links and other non-form elements | `.btn`, `.input`, `.select`, `.textarea`, `.checkbox__input`, `.radio__input`, `.switch__input`, `.dropdown__item`, `.tabs__trigger`, `.pagination__item`, `.command__item`, nav items |
319
+ | Disabled wrapper | automatic via `:has(:disabled)` | `.checkbox`, `.radio`, `.switch` |
320
+ | Hidden | `hidden` (forced with `display: none !important`) | anything |
321
+ | Open (overlay) | `<dialog open>` (or `showModal()`) | `.modal`, `.modaloverlay`, `.sheet`, `.command`, `.navbarmobile` |
322
+ | Open (disclosure) | `aria-expanded="true"` on the trigger, or `<details open>` | `.accordion__item`, `.collapsible`, `.dropdown`, `.breadcrumb__dropdown`, `.sidebar__submenu`, `.subnav__submenu` |
323
+ | Current | `aria-current="page"` (navigation), `aria-current="step"` (steps) | `.navbar__item`, `.navbarmobile__item`, `.sidebar__item`, `.navmenu__item`, `.subnav__item`, `.subnav__subitem`, `.pagination__item`, `.breadcrumb__link`, `.steps__item` |
324
+ | Selected | `aria-selected="true"` | `.tabs__trigger` (`role="tab"`), `.command__item` (`role="option"`) |
325
+ | Pressed | `aria-pressed="true"` | `.btn` (toggle buttons), `.segmented-control__item`, `.filter__label` |
326
+ | Checked | `role="menuitemcheckbox" aria-checked="true"` | `.dropdown__item` (shows its `.dropdown__item-check`) |
327
+ | Invalid | `aria-invalid="true"`, or automatically via `:user-invalid` once the user has interacted | `.input`, `.select`, `.textarea`, `.checkbox__input`, `.radio__input` |
328
+ | Required | `required` on the control, plus an explicit `.form__required` marker in the label (not added automatically, so existing forms keep their look) | `.form__field` |
329
+ | Read-only | `readonly` | `.input`, `.textarea` |
330
+ | Busy | `aria-busy="true"` | `.btn` (pair with `disabled` and a `.btn__spinner`) |
331
+ | Sorted | `aria-sort="ascending"` / `"descending"` on the `<th>` | `.table__head`, `.table__sort-icon` |
332
+ | Search has value | automatic via `.toolbar__input:not(:placeholder-shown)` (the input needs a `placeholder`) | `.toolbar__clear` |
333
+
334
+ ```html
335
+ <a class="btn btn--outline" href="#" aria-disabled="true" tabindex="-1">Archived</a>
336
+ <button class="btn" disabled aria-busy="true"><svg class="icon btn__icon btn__spinner">…</svg>Saving</button>
337
+
338
+ <input class="input" type="email" aria-invalid="true" aria-describedby="email-error">
339
+
340
+ <nav class="pagination">
341
+ <button class="pagination__item" aria-current="page">1</button>
342
+ <button class="pagination__item">2</button>
343
+ </nav>
344
+
345
+ <dialog class="sheet sheet--right" open>…</dialog>
346
+ ```
347
+
348
+ **Content behind overlays.** When a `.modal`, `.sheet` or `.command` is open without
349
+ `showModal()`, mark the rest of the page `inert` so it cannot be focused or clicked, and remove
350
+ the attribute on close. `showModal()` does this for you.
351
+
352
+ ```js
353
+ document.querySelector('.dashboard').inert = true;
354
+ ```
355
+
356
+ **Still classes.** States with no native or ARIA equivalent remain modifiers for now:
357
+ `.sidebar--collapsed`, `.subnav--collapsed`, `.sidebar--open` / `.subnav--open` (mobile
358
+ off-canvas; the Toggle script adds them, see below), `.sidebaroverlay--visible`, `.dashboard__overlay--visible`,
359
+ `.tooltip__content--visible`, `.steps__item--completed`, `.form__counter--warning` /
360
+ `--error`, and `.filter__label--active` (an applied-filter chip, not a toggle).
361
+
362
+ ### Deprecated state classes
363
+
364
+ These classes still work for one release and will then be removed. `npm run playground:check`
365
+ warns when a playground spec or demo page renders one. The list lives in
366
+ `scripts/deprecated-states.mjs`.
367
+
368
+ | Deprecated class | Use instead |
369
+ |---|---|
370
+ | `.btn--disabled` | disabled, or aria-disabled="true" on <a> |
371
+ | `.input--disabled` | disabled |
372
+ | `.input--error` | aria-invalid="true" (or rely on :user-invalid) |
373
+ | `.checkbox--disabled` | disabled on the inner .checkbox__input |
374
+ | `.radio--disabled` | disabled on the inner .radio__input |
375
+ | `.form__field--error` | aria-invalid="true" on the control |
376
+ | `.accordion__item--open` | aria-expanded="true" on .accordion__trigger, or <details open> |
377
+ | `.collapsible--open` | aria-expanded="true" on .collapsible__trigger, or <details open> |
378
+ | `.dropdown--open` | aria-expanded="true" on .dropdown__trigger |
379
+ | `.dropdown__menu--open` | aria-expanded="true" on .dropdown__trigger |
380
+ | `.dropdown__item--active` | aria-current="true" |
381
+ | `.dropdown__item--disabled` | disabled, or aria-disabled="true" |
382
+ | `.dropdown__item-check--checked` | role="menuitemcheckbox" aria-checked="true" on .dropdown__item |
383
+ | `.tabs__trigger--active` | aria-selected="true" |
384
+ | `.tabs__trigger--disabled` | disabled, or aria-disabled="true" |
385
+ | `.segmented-control__item--active` | aria-pressed="true" |
386
+ | `.pagination__item--active` | aria-current="page" |
387
+ | `.pagination__item--disabled` | disabled, or aria-disabled="true" |
388
+ | `.breadcrumb__dropdown-menu--open` | aria-expanded="true" on .breadcrumb__dropdown-trigger |
389
+ | `.steps__item--active` | aria-current="step" |
390
+ | `.table__head--sorted` | aria-sort="ascending\|descending" on the <th> |
391
+ | `.table__sort-icon--asc` | aria-sort="ascending" on the <th> |
392
+ | `.table__sort-icon--desc` | aria-sort="descending" on the <th> |
393
+ | `.toolbar__clear--visible` | automatic: shown while .toolbar__input is not :placeholder-shown |
394
+ | `.command--open` | <dialog class="command" open> |
395
+ | `.command__item--selected` | role="option" aria-selected="true" |
396
+ | `.command__item--disabled` | aria-disabled="true" |
397
+ | `.modal--open` | <dialog class="modal" open> |
398
+ | `.modaloverlay--open` | [open] |
399
+ | `.sheet--open` | <dialog class="sheet" open> |
400
+ | `.navbar__item--active` | aria-current="page" |
401
+ | `.navbar__item--disabled` | aria-disabled="true" |
402
+ | `.navbarmobile--open` | <dialog class="navbarmobile" open> |
403
+ | `.navbarmobile__item--active` | aria-current="page" |
404
+ | `.sidebar__item--active` | aria-current="page" |
405
+ | `.sidebar__item--disabled` | aria-disabled="true" |
406
+ | `.sidebar__submenu--open` | aria-expanded="true" on the preceding .sidebar__item |
407
+ | `.navmenu__item--active` | aria-current="page" |
408
+ | `.subnav__item--active` | aria-current="page" |
409
+ | `.subnav__item--disabled` | aria-disabled="true" |
410
+ | `.subnav__subitem--active` | aria-current="page" |
411
+ | `.subnav__submenu--open` | aria-expanded="true" on the preceding .subnav__item |
412
+
413
+ ---
414
+
415
+ ## Components
416
+
417
+ ### Button `.btn`
418
+
419
+ ```html
420
+ <!-- Variants -->
421
+ <button class="btn btn--primary">Primary</button>
422
+ <button class="btn btn--secondary">Secondary</button>
423
+ <button class="btn btn--destructive">Destructive</button>
424
+ <button class="btn btn--outline">Outline</button>
425
+ <button class="btn btn--ghost">Ghost</button>
426
+ <button class="btn btn--link">Link</button>
427
+
428
+ <!-- Sizes (a bare .btn is primary; add a variant to change colour) -->
429
+ <button class="btn btn--sm">Small</button>
430
+ <button class="btn">Default</button>
431
+ <button class="btn btn--lg">Large</button>
432
+
433
+ <!-- Icon button -->
434
+ <button class="btn btn--icon">
435
+ <svg class="icon">...</svg>
436
+ </button>
437
+
438
+ <!-- With icon -->
439
+ <button class="btn btn--primary">
440
+ <svg class="icon">...</svg>
441
+ Save Changes
442
+ </button>
443
+
444
+ <!-- Loading state -->
445
+ <button class="btn btn--primary btn--loading" disabled>
446
+ <span class="btn__spinner"></span>
447
+ Loading...
448
+ </button>
449
+
450
+ <!-- Full width -->
451
+ <button class="btn btn--primary w--full">Full Width</button>
452
+ ```
453
+
454
+ ### Card `.card`
455
+
456
+ ```html
457
+ <div class="card">
458
+ <div class="card__header">
459
+ <h3 class="card__title">Card Title</h3>
460
+ <p class="card__description">Optional description</p>
461
+ </div>
462
+ <div class="card__content">
463
+ Card content goes here
464
+ </div>
465
+ <div class="card__footer">
466
+ <button class="btn btn--outline">Cancel</button>
467
+ <button class="btn btn--primary">Save</button>
468
+ </div>
469
+ </div>
470
+
471
+ <!-- Variants -->
472
+ <div class="card card--elevated">...</div> <!-- Drop shadow, no border -->
473
+ <div class="card card--ghost">...</div> <!-- Transparent background -->
474
+ <div class="card card--interactive">...</div> <!-- Hover effects -->
475
+ <div class="card card--destructive">...</div> <!-- Red background -->
476
+
477
+ <!-- Padding sizes -->
478
+ <div class="card card--sm">...</div> <!-- Smaller padding (0.75rem) -->
479
+ <div class="card card--lg">...</div> <!-- Larger padding (1.5rem) -->
480
+
481
+ <!-- Header variants -->
482
+ <div class="card__header card__header--row">...</div> <!-- Horizontal layout -->
483
+ <div class="card__header card__header--center">...</div> <!-- Centered -->
484
+
485
+ <!-- Content variants -->
486
+ <div class="card__content card__content--pt">...</div> <!-- With top padding -->
487
+ <div class="card__content card__content--flush">...</div> <!-- No padding -->
488
+
489
+ <!-- Footer variants -->
490
+ <div class="card__footer card__footer--border">...</div> <!-- Top border -->
491
+ <div class="card__footer card__footer--end">...</div> <!-- Right aligned -->
492
+ <div class="card__footer card__footer--between">...</div> <!-- Space between -->
493
+ ```
494
+
495
+ ### Alert `.alert`
496
+
497
+ ```html
498
+ <div class="alert">
499
+ <svg class="icon alert__icon">...</svg>
500
+ <div class="alert__content">
501
+ <h4 class="alert__title">Heads up!</h4>
502
+ <p class="alert__description">This is an alert message.</p>
503
+ </div>
504
+ </div>
505
+
506
+ <!-- Variants -->
507
+ <div class="alert alert--destructive">...</div>
508
+ <div class="alert alert--success">...</div>
509
+ <div class="alert alert--warning">...</div>
510
+ <div class="alert alert--info">...</div>
511
+ ```
512
+
513
+ ### Badge `.badge`
514
+
515
+ ```html
516
+ <span class="badge">Default</span>
517
+ <span class="badge badge--sm badge--pill">Primary, small pill</span>
518
+ <span class="badge badge--secondary">Secondary</span>
519
+ <span class="badge badge--outline">Outline</span>
520
+ <span class="badge badge--destructive">Destructive</span>
521
+
522
+ <!-- Muted variants (softer backgrounds) -->
523
+ <span class="badge badge--success-muted">Success</span>
524
+ <span class="badge badge--warning-muted">Warning</span>
525
+ <span class="badge badge--info-muted">Info</span>
526
+ <span class="badge badge--destructive-muted">Error</span>
527
+ ```
528
+
529
+ ### Avatar `.avatar`
530
+
531
+ ```html
532
+ <!-- With image -->
533
+ <span class="avatar">
534
+ <img src="user.jpg" alt="User" class="avatar__image">
535
+ </span>
536
+
537
+ <!-- With fallback initials -->
538
+ <span class="avatar">
539
+ <span class="avatar__fallback">JD</span>
540
+ </span>
541
+
542
+ <!-- With status indicator -->
543
+ <span class="avatar">
544
+ <span class="avatar__fallback">JD</span>
545
+ <span class="avatar__status avatar__status--online"></span>
546
+ </span>
547
+
548
+ <!-- Sizes -->
549
+ <span class="avatar avatar--sm">...</span>
550
+ <span class="avatar">...</span>
551
+ <span class="avatar avatar--lg">...</span>
552
+
553
+ <!-- Colored fallbacks -->
554
+ <span class="avatar__fallback avatar__fallback--blue">AB</span>
555
+ <span class="avatar__fallback avatar__fallback--green">CD</span>
556
+ <span class="avatar__fallback avatar__fallback--red">EF</span>
557
+ ```
558
+
559
+ ### Input `.input`
560
+
561
+ ```html
562
+ <!-- Basic input -->
563
+ <input type="text" class="input" placeholder="Enter text...">
564
+
565
+ <!-- Sizes -->
566
+ <input class="input input--sm">
567
+ <input class="input">
568
+ <input class="input input--lg">
569
+
570
+ <!-- Select -->
571
+ <select class="select">
572
+ <option>Option 1</option>
573
+ <option>Option 2</option>
574
+ </select>
575
+
576
+ <!-- Textarea -->
577
+ <textarea class="textarea" rows="4"></textarea>
578
+
579
+ <!-- Checkbox -->
580
+ <label class="checkbox">
581
+ <input type="checkbox" class="checkbox__input">
582
+ <span class="checkbox__label">Accept terms</span>
583
+ </label>
584
+
585
+ <!-- Radio -->
586
+ <label class="radio">
587
+ <input type="radio" name="choice" class="radio__input">
588
+ <span class="radio__label">Option A</span>
589
+ </label>
590
+
591
+ <!-- Switch/Toggle -->
592
+ <label class="switch">
593
+ <input type="checkbox" class="switch__input">
594
+ <span class="switch__slider"></span>
595
+ </label>
596
+ ```
597
+
598
+ ### Form `.form`
599
+
600
+ Form parts are elements of the `.form` block. A `.form__field` bundles a label, the control(s), a description, an error and any extra markup; `.form__control` marks the concrete input, select, textarea or custom widget inside it.
601
+
602
+ ```html
603
+ <form class="form">
604
+ <!-- Field -->
605
+ <div class="form__field">
606
+ <label class="form__label" for="email">Email <span class="form__required">*</span></label>
607
+ <input type="email" id="email" class="input form__control">
608
+ <p class="form__description">We'll never share your email.</p>
609
+ </div>
610
+
611
+ <!-- Error state: aria-invalid on the control (form__field--error is deprecated) -->
612
+ <div class="form__field">
613
+ <label class="form__label" for="password">Password</label>
614
+ <input type="password" id="password" class="input form__control" required aria-invalid="true" aria-describedby="password-error">
615
+ <p class="form__error" id="password-error">Password is required.</p>
616
+ </div>
617
+
618
+ <!-- Optional marker and character counter -->
619
+ <div class="form__field">
620
+ <label class="form__label" for="bio">Bio <span class="form__optional">(optional)</span></label>
621
+ <textarea id="bio" class="textarea form__control" rows="3"></textarea>
622
+ <div class="form__counter">0 / 500</div>
623
+ </div>
624
+
625
+ <!-- Group: controls joined into one unit, like .btn__group -->
626
+ <div class="form__field">
627
+ <label class="form__label" for="price">Price</label>
628
+ <div class="form__group">
629
+ <span class="form__addon">$</span>
630
+ <input type="number" id="price" class="input form__control">
631
+ <button type="button" class="btn btn--outline">Apply</button>
632
+ </div>
633
+ </div>
634
+
635
+ <!-- Stacked group -->
636
+ <div class="form__group form__group--block">...</div>
637
+
638
+ <!-- Fieldset -->
639
+ <fieldset class="form__fieldset">
640
+ <legend class="form__legend">Contact</legend>
641
+ <div class="form__row form__row--2">
642
+ <div class="form__field">...</div>
643
+ <div class="form__field">...</div>
644
+ </div>
645
+ </fieldset>
646
+
647
+ <div class="form__actions form__actions--end">
648
+ <button class="btn">Save</button>
649
+ </div>
650
+ </form>
651
+
652
+ <!-- Horizontal: labels in a fixed column, everything else beside them (stacks below md) -->
653
+ <form class="form form--horizontal">...</form>
654
+ ```
655
+
656
+ ### Table `.table`
657
+
658
+ ```html
659
+ <div class="table__wrapper">
660
+ <table class="table">
661
+ <thead class="table__header">
662
+ <tr class="table__row">
663
+ <th class="table__head">Name</th>
664
+ <th class="table__head">Status</th>
665
+ <th class="table__head table__actions">Actions</th>
666
+ </tr>
667
+ </thead>
668
+ <tbody class="table__body">
669
+ <tr class="table__row">
670
+ <td class="table__cell">John Doe</td>
671
+ <td class="table__cell"><span class="badge badge--success-muted">Active</span></td>
672
+ <td class="table__cell table__actions">
673
+ <button class="btn btn--ghost btn--icon btn--sm">
674
+ <svg class="icon">...</svg>
675
+ </button>
676
+ </td>
677
+ </tr>
678
+ </tbody>
679
+ </table>
680
+ </div>
681
+
682
+ <!-- Variants -->
683
+ <table class="table table--striped">...</table> <!-- Alternating row colors -->
684
+ <table class="table table--hoverable">...</table> <!-- Row hover effect -->
685
+ <table class="table table--compact">...</table> <!-- Smaller padding -->
686
+ <table class="table table--card">...</table> <!-- Card-compatible padding -->
687
+
688
+ <!-- Borderless wrapper (for use inside cards) -->
689
+ <div class="table__wrapper table__wrapper--borderless">...</div>
690
+
691
+ <!-- Checkbox column -->
692
+ <th class="table__head table__checkbox">
693
+ <label class="checkbox">
694
+ <input type="checkbox" class="checkbox__input">
695
+ </label>
696
+ </th>
697
+
698
+ <!-- Sortable header -->
699
+ <th class="table__head table__head--sortable" aria-sort="ascending">
700
+ Name
701
+ <span class="table__sort-icon">
702
+ <svg class="icon icon--sm">...</svg>
703
+ </span>
704
+ </th>
705
+ ```
706
+
707
+ ### Tabs `.tabs`
708
+
709
+ ```html
710
+ <div class="tabs" data-tabs>
711
+ <div class="tabs__list" data-tabs-list>
712
+ <button class="tabs__trigger" data-tab="tab1" aria-selected="true">Tab 1</button>
713
+ <button class="tabs__trigger" data-tab="tab2" aria-selected="false">Tab 2</button>
714
+ <button class="tabs__trigger" data-tab="tab3" aria-selected="false">Tab 3</button>
715
+ </div>
716
+ <div class="tabs__panels" data-tabs-panels>
717
+ <div class="tabs__content" id="tab1" data-tab-panel>Content 1</div>
718
+ <div class="tabs__content" id="tab2" data-tab-panel hidden>Content 2</div>
719
+ <div class="tabs__content" id="tab3" data-tab-panel hidden>Content 3</div>
720
+ </div>
721
+ </div>
722
+
723
+ <!-- Variants -->
724
+ <div class="tabs tabs--underline">...</div> <!-- Underline style -->
725
+ <div class="tabs tabs--pills">...</div> <!-- Pill buttons -->
726
+ <div class="tabs tabs--full">...</div> <!-- Full width tabs -->
727
+ ```
728
+
729
+ ### Accordion `.accordion`
730
+
731
+ ```html
732
+ <div class="accordion" data-accordion>
733
+ <div class="accordion__item">
734
+ <button type="button" class="accordion__trigger" aria-expanded="false" aria-controls="faq-1">
735
+ <span>Section Title</span>
736
+ <svg class="icon accordion__icon">...</svg>
737
+ </button>
738
+ <div class="accordion__content" id="faq-1">
739
+ <div class="accordion__body">
740
+ Content goes here
741
+ </div>
742
+ </div>
743
+ </div>
744
+ </div>
745
+
746
+ <!-- Allow multiple open -->
747
+ <div class="accordion" data-accordion data-accordion-multiple="true">...</div>
748
+
749
+ <!-- Pre-opened item: the trigger's aria-expanded drives the open state -->
750
+ <button class="accordion__trigger" aria-expanded="true">...</button>
751
+
752
+ <!-- No-JS alternative: native <details>; a shared name keeps one open at a time -->
753
+ <div class="accordion">
754
+ <details class="accordion__item" name="faq" open>
755
+ <summary class="accordion__trigger">Section Title <svg class="icon accordion__icon">...</svg></summary>
756
+ <div class="accordion__content"><div class="accordion__body">Content goes here</div></div>
757
+ </details>
758
+ <details class="accordion__item" name="faq">...</details>
759
+ </div>
760
+
761
+ <!-- Single item: <details class="collapsible">, or a button trigger (wired automatically) -->
762
+ <div class="collapsible">
763
+ <button type="button" class="collapsible__trigger" aria-expanded="false">
764
+ <span>Advanced options</span>
765
+ <svg class="icon collapsible__icon">...</svg>
766
+ </button>
767
+ <div class="collapsible__content"><div class="collapsible__body">Content goes here</div></div>
768
+ </div>
769
+ ```
770
+
771
+ Content animates to its natural height, so there is no maximum to tune.
772
+
773
+ ### Dropdown `.dropdown`
774
+
775
+ ```html
776
+ <!-- aria-expanded="true" on the trigger opens the menu -->
777
+ <div class="dropdown">
778
+ <button class="btn dropdown__trigger" aria-expanded="false" aria-haspopup="menu">
779
+ Options
780
+ <svg class="icon icon--sm">...</svg>
781
+ </button>
782
+ <div class="dropdown__menu">
783
+ <button class="dropdown__item">Edit</button>
784
+ <button class="dropdown__item">Duplicate</button>
785
+ <div class="dropdown__separator"></div>
786
+ <button class="dropdown__item dropdown__item--destructive">Delete</button>
787
+ </div>
788
+ </div>
789
+
790
+ <!-- With icons -->
791
+ <button class="dropdown__item">
792
+ <svg class="icon dropdown__item-icon">...</svg>
793
+ <span>Edit</span>
794
+ </button>
795
+
796
+ <!-- With labels/shortcuts -->
797
+ <button class="dropdown__item">
798
+ <span>Save</span>
799
+ <span class="dropdown__item-label">Ctrl+S</span>
800
+ </button>
801
+ ```
802
+
803
+ ### Modal `.modal`
804
+
805
+ The interactive modal is the `<p-modal>` web component from `@parallelogram-js/core`; the
806
+ stylesheet themes it. For a modal without the component, use a native `<dialog>`:
807
+
808
+ ```html
809
+ <button type="button" class="btn btn--primary" commandfor="edit-profile" command="show-modal">Edit profile</button>
810
+
811
+ <dialog class="modal" id="edit-profile" aria-labelledby="edit-profile-title">
812
+ <div class="modal__dialog">
813
+ <div class="modal__header">
814
+ <div>
815
+ <h2 class="modal__title" id="edit-profile-title">Edit profile</h2>
816
+ <p class="modal__description">Make changes to your profile here.</p>
817
+ </div>
818
+ <button type="button" class="modal__close" commandfor="edit-profile" command="close" aria-label="Close">
819
+ <svg class="icon">...</svg>
820
+ </button>
821
+ </div>
822
+ <div class="modal__content">Content</div>
823
+ <div class="modal__footer">
824
+ <button type="button" class="btn btn--outline" commandfor="edit-profile" command="close">Cancel</button>
825
+ <button type="button" class="btn btn--primary">Save changes</button>
826
+ </div>
827
+ </div>
828
+ </dialog>
829
+
830
+ <!-- Sizes go on the dialog box -->
831
+ <div class="modal__dialog modal__dialog--sm">...</div> <!-- --xs, --sm, --lg, --xl, --fullscreen -->
832
+
833
+ <!-- Confirmations: <dialog class="alertdialog" role="alertdialog"> with alertdialog__* parts -->
834
+ ```
835
+
836
+ Opened with `command="show-modal"` (or `showModal()`), the dialog draws its own dimmed
837
+ backdrop. A `<dialog class="modaloverlay" open>` sibling is only needed when the modal is
838
+ shown non-modally with the `open` attribute.
839
+
840
+ ### Pagination `.pagination`
841
+
842
+ ```html
843
+ <div class="pagination__info">
844
+ <div class="pagination__text">
845
+ Showing <strong>1</strong> to <strong>10</strong> of <strong>100</strong>
846
+ </div>
847
+ <div class="pagination__select">
848
+ <span>Rows per page:</span>
849
+ <select class="select select--sm select--auto">
850
+ <option>10</option>
851
+ <option>25</option>
852
+ <option>50</option>
853
+ </select>
854
+ </div>
855
+ <nav class="pagination">
856
+ <button class="pagination__prev" disabled>
857
+ <svg class="icon">...</svg>
858
+ </button>
859
+ <button class="pagination__item" aria-current="page">1</button>
860
+ <button class="pagination__item">2</button>
861
+ <button class="pagination__item">3</button>
862
+ <span class="pagination__ellipsis">...</span>
863
+ <button class="pagination__item">10</button>
864
+ <button class="pagination__next">
865
+ <svg class="icon">...</svg>
866
+ </button>
867
+ </nav>
868
+ </div>
869
+ ```
870
+
871
+ ### Dashboard Layout `.dashboard`
872
+
873
+ ```html
874
+ <div class="dashboard">
875
+ <!-- Icon rail navigation -->
876
+ <nav class="navmenu">
877
+ <div class="navmenu__header">
878
+ <a href="/" class="navmenu__logo">
879
+ <svg class="icon icon--lg">...</svg>
880
+ </a>
881
+ </div>
882
+ <div class="navmenu__content">
883
+ <div class="navmenu__section">
884
+ <a href="#" class="navmenu__item" aria-current="page">
885
+ <svg class="icon">...</svg>
886
+ <span class="navmenu__tooltip">Dashboard</span>
887
+ </a>
888
+ </div>
889
+ </div>
890
+ <div class="navmenu__footer">
891
+ <button class="navmenu__avatar">
892
+ <span class="navmenu__avatar-fallback">JD</span>
893
+ </button>
894
+ </div>
895
+ </nav>
896
+
897
+ <!-- Secondary sidebar -->
898
+ <aside class="subnav">
899
+ <div class="subnav__header">
900
+ <h2 class="subnav__title">Section</h2>
901
+ </div>
902
+ <div class="subnav__content">
903
+ <div class="subnav__section">
904
+ <div class="subnav__section-header">
905
+ <span class="subnav__section-title">Category</span>
906
+ </div>
907
+ <div class="subnav__list">
908
+ <a href="#" class="subnav__item" aria-current="page">
909
+ <svg class="icon subnav__item-icon">...</svg>
910
+ <span class="subnav__item-text">Item</span>
911
+ <span class="subnav__item-badge">12</span>
912
+ </a>
913
+ </div>
914
+ </div>
915
+ </div>
916
+ </aside>
917
+
918
+ <!-- Main content -->
919
+ <main class="dashboard__main">
920
+ <header class="dashboard__header">
921
+ <div class="dashboard__header-left">
922
+ <nav class="breadcrumb">...</nav>
923
+ </div>
924
+ <div class="dashboard__header-right">
925
+ <!-- Header actions -->
926
+ </div>
927
+ </header>
928
+ <div class="dashboard__content">
929
+ <!-- Page content -->
930
+ </div>
931
+ </main>
932
+ </div>
933
+ ```
934
+
935
+ ---
936
+
937
+ ## Utility Classes
938
+
939
+ ### Layout
940
+
941
+ ```html
942
+ <!-- Flexbox -->
943
+ <div class="layout">...</div>
944
+ <div class="layout layout--col">...</div>
945
+ <div class="layout layout--center">...</div>
946
+ <div class="layout layout--between">...</div>
947
+ <div class="layout layout--gap-md">...</div>
948
+
949
+ <!-- Stack (vertical) -->
950
+ <div class="stack stack--sm">...</div>
951
+ <div class="stack stack--md">...</div>
952
+ <div class="stack stack--lg">...</div>
953
+ <div class="stack stack--divided">...</div> <!-- With dividers -->
954
+
955
+ <!-- Cluster (horizontal, wrapping) -->
956
+ <div class="cluster cluster--sm">...</div>
957
+ <div class="cluster cluster--md">...</div>
958
+
959
+ <!-- Grid -->
960
+ <div class="grid grid--2">...</div> <!-- 2 columns -->
961
+ <div class="grid grid--3">...</div> <!-- 3 columns -->
962
+ <div class="grid grid--4">...</div> <!-- 4 columns -->
963
+ <div class="grid grid--2-1">...</div> <!-- 2:1 ratio -->
964
+
965
+ <!-- Centering -->
966
+ <div class="center center--sm">...</div>
967
+ <div class="center center--md">...</div>
968
+ ```
969
+
970
+ ### Spacing
971
+
972
+ ```html
973
+ <!-- Margin bottom -->
974
+ <div class="mb--xs">...</div>
975
+ <div class="mb--sm">...</div>
976
+ <div class="mb--md">...</div>
977
+ <div class="mb--lg">...</div>
978
+
979
+ <!-- Margin top -->
980
+ <div class="mt--sm">...</div>
981
+ <div class="mt--lg">...</div>
982
+ <div class="mt--2xl">...</div>
983
+
984
+ <!-- Vertical margin -->
985
+ <div class="my--md">...</div>
986
+ <div class="my--lg">...</div>
987
+ ```
988
+
989
+ ### Typography
990
+
991
+ ```html
992
+ <p class="text--sm">Small text</p>
993
+ <p class="text--lg">Large text</p>
994
+ <p class="text--muted">Muted color</p>
995
+ <p class="text--center">Centered</p>
996
+ <p class="text--semibold">Semi-bold</p>
997
+
998
+ <!-- Colors -->
999
+ <span class="text--primary">Primary</span>
1000
+ <span class="text--success">Success</span>
1001
+ <span class="text--warning">Warning</span>
1002
+ <span class="text--destructive">Destructive</span>
1003
+ ```
1004
+
1005
+ ### Flex utilities
1006
+
1007
+ ```html
1008
+ <div class="flex--1">...</div> <!-- flex: 1 -->
1009
+ <div class="flex--none">...</div> <!-- flex: none -->
1010
+ <div class="flex--shrink0">...</div> <!-- flex-shrink: 0 -->
1011
+ ```
1012
+
1013
+ ### Width
1014
+
1015
+ ```html
1016
+ <div class="w--full">...</div> <!-- width: 100% -->
1017
+ ```
1018
+
1019
+ ### Box
1020
+
1021
+ ```html
1022
+ <!-- Icon box -->
1023
+ <div class="box box--icon">
1024
+ <svg class="icon">...</svg>
1025
+ </div>
1026
+
1027
+ <!-- Colored icon boxes -->
1028
+ <div class="box box--icon box--primary">...</div>
1029
+ <div class="box box--icon box--success">...</div>
1030
+ <div class="box box--icon box--warning">...</div>
1031
+ <div class="box box--icon box--destructive">...</div>
1032
+
1033
+ <!-- Muted background box -->
1034
+ <div class="box box--muted">...</div>
1035
+ ```
1036
+
1037
+ ### Dot indicators
1038
+
1039
+ ```html
1040
+ <span class="dot dot--blue"></span>
1041
+ <span class="dot dot--green"></span>
1042
+ <span class="dot dot--yellow"></span>
1043
+ <span class="dot dot--red"></span>
1044
+ ```
1045
+
1046
+ ---
1047
+
1048
+ ## JavaScript Components
1049
+
1050
+ The `demo/js/main.js` file provides interactive behavior for:
1051
+
1052
+ ### Accordion
1053
+
1054
+ ```html
1055
+ <div class="accordion" data-accordion>
1056
+ <!-- Automatically enhanced -->
1057
+ </div>
1058
+
1059
+ <!-- Allow multiple panels open -->
1060
+ <div class="accordion" data-accordion data-accordion-multiple="true">
1061
+ ```
1062
+
1063
+ Button triggers get `type="button"` and `aria-controls` pointing at their `.accordion__content`
1064
+ (an id is generated when the content has none). A `.collapsible` with a `<button>` trigger is
1065
+ wired the same way without any data attribute.
1066
+
1067
+ ### Tabs
1068
+
1069
+ ```html
1070
+ <div class="tabs" data-tabs>
1071
+ <!-- Automatically enhanced -->
1072
+ </div>
1073
+ ```
1074
+
1075
+ ### Toggle (dropdowns and other disclosures)
1076
+
1077
+ ```html
1078
+ <div class="dropdown">
1079
+ <button class="btn dropdown__trigger" data-toggle data-toggle-target="#menu" data-toggle-capture="true">Options</button>
1080
+ <div class="dropdown__menu" id="menu">...</div>
1081
+ </div>
1082
+ ```
1083
+
1084
+ Toggle sets `aria-expanded` on the trigger (and `open` when the target is a `<dialog>` or
1085
+ `<details>`); the stylesheet does the rest. Escape and, with `data-toggle-capture`, an
1086
+ outside click close it again. `data-toggle-class="…"` additionally toggles that class on the
1087
+ target, for markup that isn't styled from `aria-expanded`.
1088
+
1089
+ Off-canvas navigation below the `lg` breakpoint uses the class and an overlay together;
1090
+ `data-toggle-overlay` adds `--visible` to the overlay's first class and closes on a click on it:
1091
+
1092
+ ```html
1093
+ <button class="btn btn--ghost btn--icon" aria-label="Menu"
1094
+ data-toggle data-toggle-target="#sidebar" data-toggle-class="sidebar--open"
1095
+ data-toggle-overlay="#sidebar-overlay">…</button>
1096
+ <aside class="sidebar" id="sidebar">…</aside>
1097
+ <div class="sidebaroverlay" id="sidebar-overlay" aria-hidden="true"></div>
1098
+
1099
+ <!-- Dashboard section nav: data-toggle-class="subnav--open" with a .dashboard__overlay -->
1100
+ ```
1101
+
1102
+ A `.sidebar--right` offsets `.sidebarlayout__main` on the right; beside a navbar use
1103
+ `.navbar--with-sidebar` plus `.navbar--sidebar-collapsed` and/or `.navbar--sidebar-right`.
1104
+
1105
+ Dropdown submenus (`.dropdown__submenu`) open on hover in CSS; the script lets keyboard and
1106
+ touch users open them with a click or ArrowRight and close them with ArrowLeft or Escape.
1107
+ `.segmented-control` items are kept mutually exclusive through `aria-pressed` (or
1108
+ `aria-checked` when the items are `role="radio"`). Tabs skip disabled tabs with the arrow keys,
1109
+ link each tab and panel with `aria-controls`/`aria-labelledby`, and slide the
1110
+ `.tabs__indicator` of a `.tabs--animated` list under the selected tab.
1111
+
1112
+ Apart from `data-toggle-class`, none of the scripts add state classes: Accordion and Collapsible flip `aria-expanded`, Tabs flips
1113
+ `aria-selected` and the panels' `hidden` attribute.
1114
+
1115
+ ### Dark Mode Toggle
1116
+
1117
+ The page follows the OS until a toggle pins it, so the toggle writes an explicit theme:
1118
+
1119
+ ```javascript
1120
+ function toggleTheme() {
1121
+ const html = document.documentElement;
1122
+ const theme = html.getAttribute('data-theme');
1123
+ const dark = theme === 'dark' || (theme !== 'light' && matchMedia('(prefers-color-scheme: dark)').matches);
1124
+ html.setAttribute('data-theme', dark ? 'light' : 'dark');
1125
+ }
1126
+ ```
1127
+
1128
+ ### Demo Navigation
1129
+
1130
+ A floating navigation button is automatically added to all demo pages, allowing quick switching between templates.
1131
+
1132
+ ---
1133
+
1134
+ ## Theming
1135
+
1136
+ ### Light/Dark Mode
1137
+
1138
+ The theme follows the operating system's light or dark setting. Each colour token is a
1139
+ `light-dark()` pair and `:root` sets `color-scheme: light dark`, so no second block of overrides
1140
+ is needed. Set `data-theme` to pin a theme, on `<html>` or on any element to pin just that subtree:
1141
+
1142
+ ```html
1143
+ <html data-theme="dark">
1144
+ <section data-theme="light">
1145
+ ```
1146
+
1147
+ ### Customizing Colors
1148
+
1149
+ Edit the `$theme-tokens` map in `scss/_tokens.scss`. Each entry is a light and a dark value, and
1150
+ an entry whose two values match is emitted as a plain colour:
1151
+
1152
+ ```scss
1153
+ $theme-tokens: (
1154
+ primary: (#your-light-primary, #your-dark-primary),
1155
+ primary-fg: (#text-on-light-primary, #text-on-dark-primary),
1156
+ success: (#22c55e, #22c55e),
1157
+ // ...
1158
+ );
1159
+ ```
1160
+
1161
+ At runtime, override a token for both themes with a plain value or keep the pair:
1162
+
1163
+ ```css
1164
+ :root {
1165
+ --primary: light-dark(#4f46e5, #818cf8);
1166
+ }
1167
+ ```
1168
+
1169
+ ### Theme files
1170
+
1171
+ A theme is a stylesheet of token values loaded after the library, so it survives upgrades as long
1172
+ as the token names stay the same. `demo/css/brand-contenir.css` is a worked example. Besides the
1173
+ colour tokens it can set:
1174
+
1175
+ | Tokens | What they colour or shape |
1176
+ |--------|---------------------------|
1177
+ | `--navmenu-*` | The icon rail: `bg`, `fg`, `fg-muted`, `fg-subtle`, `bg-muted`, `bg-subtle`, `accent`, `accent-fg`, `border`, `input`, `input-placeholder`, `icon-stroke-width`, plus `indicator` for the current-page marker |
1178
+ | `--subnav-*` | The section menu, with the same names |
1179
+ | `--header-*` | The page header, with the same names |
1180
+ | `--navmenu-head-*`, `--subnav-head-*` | The rail's logo cell and the section menu's title bar: `bg`, `fg`, `fg-muted`, `accent`, `accent-fg`, `border` |
1181
+ | `--radius-sm` … `--radius-2xl` | Corner radius scale |
1182
+ | `--control-border-width` | Borders of inputs, selects, add-ons and outline buttons |
1183
+ | `--icon-stroke-width` | Line icon strokes |
1184
+ | `--avatar-bg`, `--avatar-fg` | Avatar initials |
1185
+
1186
+ Inside the rail, section menu and header the general tokens (`--fg`, `--accent`, `--border` and
1187
+ so on) are pointed at the region's own, so everything in a region follows its tokens; menus and
1188
+ tooltips that open there keep the page's colours. Every region token defaults to the general
1189
+ token, so a theme sets only what differs.
1190
+
1191
+ ### Typography
1192
+
1193
+ `html` keeps the reader's browser font size (`100%`), so every `rem` scales with it. Element
1194
+ styles for headings, `code`, `kbd`, `pre`, `blockquote` and `hr` sit inside `:where()` and carry
1195
+ no specificity, so any component class overrides them.
1196
+
1197
+ Headings use a compact fluid scale, set in `$heading-sizes` in `scss/_variables.scss` and
1198
+ exposed as `--heading-1` to `--heading-6`. h1 runs from 24px on a phone to 30px on desktop, h3
1199
+ from 18px to 20px, and h4 to h6 are fixed at 18, 16 and 14px. Fonts and leading are
1200
+ `--font-sans`, `--font-mono`, `--leading-tight`, `--leading-normal` and `--leading-relaxed`.
1201
+
1202
+ | Class | Use |
1203
+ |-------|-----|
1204
+ | `.heading .heading--1` … `--6` | Heading sizes on any element, for when the look and the outline level differ |
1205
+ | `.text--lead` | Introductory paragraph under a page or section title |
1206
+ | `.text--overline` | Small uppercase label above a title |
1207
+ | `.text--tabular` | Tabular figures; tables and `.stat__value` already use them |
1208
+ | `.text--mono` | Monospace text |
1209
+
1210
+ ### @parallelogram-js/core
1211
+
1212
+ `scss/_tokens.scss` also sets core's role and surface tokens (`--color-*`, `--surface-*`,
1213
+ `--button-*`, `--form-control-*`, `--framework-focus-*`, `--framework-transition-*`) from the
1214
+ dashboard theme. Core's web components (`<p-modal>`, `<p-datetime>`, `<p-select>`, `<p-uploader>`,
1215
+ toasts) and its per-component stylesheets (`styles/components/*.css`) therefore match the
1216
+ dashboard in both themes with no further theming. Load this stylesheet instead of core's
1217
+ `styles/index.css`, whose own `:root` palette would compete with it.
1218
+
1219
+ The dashboard's transitions and focus rings read the same `--framework-transition-duration`,
1220
+ `--framework-transition-easing` and `--framework-focus-*` tokens, and transitions drop to `0s`
1221
+ under `prefers-reduced-motion: reduce`.
1222
+
1223
+ ---
1224
+
1225
+ ## Demo Pages
1226
+
1227
+ Use these as starting templates:
1228
+
1229
+ | Page | File | Description |
1230
+ |------|------|-------------|
1231
+ | Component Library | `index.html` | All components showcase |
1232
+ | Dashboard | `dashboard.html` | Stats, charts, activity feed |
1233
+ | Records List | `records.html` | Data table with search, filters, pagination |
1234
+ | Record Form | `record-form.html` | Create/edit form with validation |
1235
+ | Record Delete | `record-delete.html` | Confirmation pattern |
1236
+ | Settings Index | `settings.html` | Settings category cards |
1237
+ | Account Settings | `settings-account.html` | Form-heavy settings page |
1238
+ | Login | `login.html` | Authentication page |
1239
+ | Forgot Password | `forgot-password.html` | Password reset flow |
1240
+
1241
+ ---
1242
+
1243
+ ## Creating New Pages
1244
+
1245
+ 1. Copy an existing demo page as a starting point
1246
+ 2. Update the `<title>` tag
1247
+ 3. Modify the navigation active states
1248
+ 4. Replace the main content
1249
+
1250
+ ### Minimal Template
1251
+
1252
+ ```html
1253
+ <!DOCTYPE html>
1254
+ <html lang="en">
1255
+ <head>
1256
+ <meta charset="UTF-8">
1257
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
1258
+ <title>Page Title - Your App</title>
1259
+ <link rel="stylesheet" href="css/parallelogram-dashboard.css">
1260
+ </head>
1261
+ <body>
1262
+ <div class="dashboard">
1263
+ <!-- Navigation (copy from dashboard.html) -->
1264
+ <nav class="navmenu">...</nav>
1265
+ <aside class="subnav">...</aside>
1266
+
1267
+ <!-- Main content -->
1268
+ <main class="dashboard__main">
1269
+ <header class="dashboard__header">
1270
+ <div class="dashboard__header-left">
1271
+ <nav class="breadcrumb">...</nav>
1272
+ </div>
1273
+ <div class="dashboard__header-right">
1274
+ <!-- Theme toggle, notifications, user avatar -->
1275
+ </div>
1276
+ </header>
1277
+
1278
+ <div class="dashboard__content">
1279
+ <!-- Your page content here -->
1280
+ </div>
1281
+ </main>
1282
+ </div>
1283
+
1284
+ <script type="module" src="js/main.js"></script>
1285
+ </body>
1286
+ </html>
1287
+ ```
1288
+
1289
+ ---
1290
+
1291
+ ## Best Practices
1292
+
1293
+ ### 1. Use semantic HTML
1294
+ ```html
1295
+ <!-- Good -->
1296
+ <button class="btn btn--primary">Save</button>
1297
+
1298
+ <!-- Avoid -->
1299
+ <div class="btn btn--primary" onclick="...">Save</div>
1300
+ ```
1301
+
1302
+ ### 2. Combine utilities with components
1303
+ ```html
1304
+ <div class="card mb--lg">
1305
+ <div class="card__content">
1306
+ <div class="stack stack--sm">
1307
+ <!-- Stack utility for consistent spacing -->
1308
+ </div>
1309
+ </div>
1310
+ </div>
1311
+ ```
1312
+
1313
+ ### 3. Use appropriate semantic colors
1314
+ ```html
1315
+ <!-- For actions -->
1316
+ <button class="btn btn--destructive">Delete</button>
1317
+
1318
+ <!-- For status -->
1319
+ <span class="badge badge--success-muted">Active</span>
1320
+ <span class="badge badge--warning-muted">Pending</span>
1321
+ ```
1322
+
1323
+ ### 4. Keep modifiers minimal
1324
+ ```html
1325
+ <!-- Good: Clear intent -->
1326
+ <div class="card card--elevated">
1327
+
1328
+ <!-- Avoid: Too many modifiers -->
1329
+ <div class="card card--elevated card--lg card--interactive card--bordered">
1330
+ ```
1331
+
1332
+ ### 5. Use the grid for layouts
1333
+ ```html
1334
+ <div class="grid grid--2">
1335
+ <div class="card">...</div>
1336
+ <div class="card">...</div>
1337
+ </div>
1338
+ ```
1339
+
1340
+ ## Versioning
1341
+
1342
+ Releases follow semantic versioning, read for markup as well as code. While the version is below
1343
+ 1.0, the minor number stands in for the major one:
1344
+
1345
+ | Change | Below 1.0 | From 1.0 |
1346
+ |--------|-----------|----------|
1347
+ | A class renamed or removed, required markup added or moved, a token renamed or removed, a behaviour's options or events changed | Minor (0.2.0) | Major (2.0.0) |
1348
+ | A new component, modifier, token or behaviour that leaves existing markup working | Patch (0.1.1) | Minor (1.1.0) |
1349
+ | A fix to CSS or JavaScript that keeps markup and tokens as they are | Patch | Patch |
1350
+
1351
+ Every change that needs a site to edit its templates goes under **Markup changes** in the
1352
+ [changelog](CHANGELOG.md), with the markup before and after.
1353
+
1354
+ ## Releasing
1355
+
1356
+ 1. While working, add entries under `## [Unreleased]` in `CHANGELOG.md`, with a **Markup changes**
1357
+ section whenever templates need editing.
1358
+ 2. On a clean `main`, run `npm run release -- <patch|minor|major|x.y.z>`. It builds, runs the
1359
+ playground check, sets the version in `package.json` and `package-lock.json`, moves the
1360
+ Unreleased entries under the new version and date, commits, and creates the tag `vX.Y.Z`.
1361
+ 3. Check the commit, then push it with its tag: `git push --follow-tags`.
1362
+ 4. Publish that version to npm from the same clean `main`: `npm publish` (after `npm login` as an
1363
+ owner of the `@parallelogram-js` scope). `publishConfig` makes it public.
1364
+
1365
+ ## Comparing Styles Between Releases
1366
+
1367
+ To see what a release changes on screen, compare the current build with an earlier tag:
1368
+
1369
+ ```bash
1370
+ npm run compare -- v0.1.0
1371
+ npm run serve
1372
+ ```
1373
+
1374
+ `npm run compare` copies that tag's compiled CSS into `demo/compare/` (git-ignored). Open
1375
+ `http://localhost:8080/compare.html`, choose pages and a width, and run it: each page loads with
1376
+ the current CSS and then the tag's, and every element whose computed styles differ is listed with
1377
+ the before and after values.
1378
+
1379
+ ---
1380
+
1381
+ ## Browser Support
1382
+
1383
+ - Chrome (latest)
1384
+ - Firefox (latest)
1385
+ - Safari (latest)
1386
+ - Edge (latest)
1387
+
1388
+ ---
1389
+
1390
+ ## License
1391
+
1392
+ MIT