@parallelogram-js/dashboard 0.0.0-stage → 0.1.1

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