@auriel/peppertino 0.2.0 → 0.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.txt +122 -56
- package/README.md +333 -38
- package/dist/accordion.js +51 -0
- package/dist/accordion.js.map +7 -0
- package/dist/carousel.js +152 -0
- package/dist/carousel.js.map +7 -0
- package/dist/header.js +30 -3
- package/dist/header.js.map +2 -2
- package/dist/main.css +4660 -710
- package/dist/main.css.map +1 -1
- package/dist/modal.js +61 -2
- package/dist/modal.js.map +2 -2
- package/dist/peppertino.js +477 -17
- package/dist/peppertino.js.map +4 -4
- package/dist/select.js +25 -8
- package/dist/select.js.map +3 -3
- package/dist/tabs.js +31 -4
- package/dist/tabs.js.map +2 -2
- package/dist/validation.js +130 -0
- package/dist/validation.js.map +7 -0
- package/index.html +1493 -42
- package/package.json +1 -1
- package/src/js/accordion.js +61 -0
- package/src/js/carousel.js +148 -0
- package/src/js/peppertino.js +4 -0
- package/src/js/validation.js +132 -0
- package/src/scss/accordion.scss +156 -0
- package/src/scss/alert.scss +204 -0
- package/src/scss/base.scss +130 -16
- package/src/scss/card.scss +4 -4
- package/src/scss/carousel.scss +313 -0
- package/src/scss/dark-mode.scss +474 -0
- package/src/scss/footer.scss +224 -0
- package/src/scss/forms/fieldset.scss +127 -0
- package/src/scss/forms/form-instructions.scss +133 -0
- package/src/scss/forms/label.scss +115 -0
- package/src/scss/forms/text-field.scss +240 -0
- package/src/scss/forms/validation.scss +215 -0
- package/src/scss/forms.scss +8 -0
- package/src/scss/header.scss +8 -8
- package/src/scss/main.scss +7 -0
- package/src/scss/section.scss +1 -1
- package/src/scss/select.scss +5 -5
- package/src/scss/table.scss +5 -5
- package/src/scss/utilities.scss +243 -0
- package/.claude/settings.local.json +0 -8
package/README.md
CHANGED
|
@@ -10,7 +10,26 @@ PeppertinoCSS is an Apple-inspired CSS framework built with SCSS, featuring the
|
|
|
10
10
|
npm install @auriel/peppertino
|
|
11
11
|
```
|
|
12
12
|
|
|
13
|
-
|
|
13
|
+
CDN — stylesheet only:
|
|
14
|
+
|
|
15
|
+
```html
|
|
16
|
+
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@auriel/peppertino@latest/dist/main.min.css" />
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
CDN — with JS components:
|
|
20
|
+
|
|
21
|
+
```html
|
|
22
|
+
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@auriel/peppertino@latest/dist/main.min.css" />
|
|
23
|
+
<script src="https://cdn.jsdelivr.net/npm/@auriel/peppertino@latest/dist/peppertino.js" defer></script>
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
SCSS import into your own build:
|
|
27
|
+
|
|
28
|
+
```scss
|
|
29
|
+
@use '@auriel/peppertino/src/scss/main';
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
Clone and build locally:
|
|
14
33
|
|
|
15
34
|
```bash
|
|
16
35
|
git clone https://codeberg.org/debaditya/Peppertino
|
|
@@ -38,6 +57,58 @@ Then open `http://localhost:3000` in your browser.
|
|
|
38
57
|
|
|
39
58
|
---
|
|
40
59
|
|
|
60
|
+
## Claude Code skill
|
|
61
|
+
|
|
62
|
+
The `agents/` directory ships a Claude Code skill that gives AI agents per-component reference documentation covering classes, variants, ARIA requirements, and JS APIs.
|
|
63
|
+
|
|
64
|
+
### Install (project-level)
|
|
65
|
+
|
|
66
|
+
Copy the skill into your project's Claude skills directory:
|
|
67
|
+
|
|
68
|
+
```bash
|
|
69
|
+
cp -r agents/peppertino .claude/skills/peppertino
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
Then invoke it in Claude Code:
|
|
73
|
+
|
|
74
|
+
```
|
|
75
|
+
/peppertino
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
### Install (user-level — available in all projects)
|
|
79
|
+
|
|
80
|
+
```bash
|
|
81
|
+
cp -r agents/peppertino ~/.claude/skills/peppertino
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
### What the skill contains
|
|
85
|
+
|
|
86
|
+
| File | Covers |
|
|
87
|
+
|---|---|
|
|
88
|
+
| `skill.md` | Index, ARIA/WCAG requirements, conventions |
|
|
89
|
+
| `base.md` | Design tokens, spacing, breakpoints, mixins |
|
|
90
|
+
| `button.md` | All button variants |
|
|
91
|
+
| `card.md` | Card parts, variants, grid |
|
|
92
|
+
| `carousel.md` | Carousel markup, API, keyboard |
|
|
93
|
+
| `footer.md` | Footer columns, social links |
|
|
94
|
+
| `forms-fieldset.md` | Fieldset & legend |
|
|
95
|
+
| `forms-form-instructions.md` | Pre-form instructions, hints |
|
|
96
|
+
| `forms-label.md` | Label tiers, scale, icon row |
|
|
97
|
+
| `forms-text-field.md` | Field wrapper, input, hint, validation |
|
|
98
|
+
| `forms-validation.md` | Summary, confirmation checkbox, `ppValidation` API |
|
|
99
|
+
| `gradient.md` | Gradient text |
|
|
100
|
+
| `header.md` | Header, nav, dropdown, mobile drawer |
|
|
101
|
+
| `modal.md` | Modal, actions, `ppModal` API |
|
|
102
|
+
| `section.md` | Section variants, scrollbar |
|
|
103
|
+
| `select.md` | Native select, custom dropdown |
|
|
104
|
+
| `table.md` | Table, column helpers |
|
|
105
|
+
| `tabs.md` | Tabs, variants, keyboard nav |
|
|
106
|
+
| `typography.md` | All typography utility classes |
|
|
107
|
+
|
|
108
|
+
The skill's `skill.md` enforces ARIA and WCAG AA compliance rules and instructs the agent to fetch authoritative specs from w3.org when uncertain.
|
|
109
|
+
|
|
110
|
+
---
|
|
111
|
+
|
|
41
112
|
## What's inside
|
|
42
113
|
|
|
43
114
|
### SCSS modules (`src/scss/`)
|
|
@@ -45,9 +116,20 @@ Then open `http://localhost:3000` in your browser.
|
|
|
45
116
|
| File | Purpose |
|
|
46
117
|
|---|---|
|
|
47
118
|
| `reset.scss` | Opinionated modern reset |
|
|
48
|
-
| `base.scss` | Design tokens, helper functions, base element styles |
|
|
119
|
+
| `base.scss` | Design tokens, CSS custom properties, helper functions, base element styles |
|
|
120
|
+
| `accordion.scss` | `.pp-accordion` — collapsible panels; variants: `--flush`, `--dark`, `--primary` |
|
|
121
|
+
| `alert.scss` | `.pp-alert` — inline feedback; variants: `--info/success/warning/error/primary/neutral`, `--filled` |
|
|
49
122
|
| `button.scss` | `.button`, `.button-outline`, semantic variants |
|
|
50
123
|
| `card.scss` | `.pp-card` and variants |
|
|
124
|
+
| `carousel.scss` | `.pp-carousel` — CSS scroll-snap carousel |
|
|
125
|
+
| `dark-mode.scss` | `.dark` overrides for all `--pp-*` tokens — applied last |
|
|
126
|
+
| `footer.scss` | `.pp-footer` — multi-column footer |
|
|
127
|
+
| `forms.scss` | Aggregator for all form partials |
|
|
128
|
+
| `forms/fieldset.scss` | `.pp-fieldset` + `.pp-legend` |
|
|
129
|
+
| `forms/form-instructions.scss` | `.pp-form-instructions`, `.pp-form-hint` |
|
|
130
|
+
| `forms/label.scss` | `.pp-label` — Apple HIG four-tier label system |
|
|
131
|
+
| `forms/text-field.scss` | `.pp-field` — labelled input/textarea with validation states |
|
|
132
|
+
| `forms/validation.scss` | `.pp-validation-summary`, `.pp-confirm`, `.pp-field--validate` |
|
|
51
133
|
| `gradient.scss` | `.gradient-txt` |
|
|
52
134
|
| `header.scss` | `.pp-header` — glassmorphism sticky header |
|
|
53
135
|
| `modal.scss` | `.pp-modal-backdrop` + `.pp-modal` — glassmorphic modals |
|
|
@@ -56,18 +138,24 @@ Then open `http://localhost:3000` in your browser.
|
|
|
56
138
|
| `table.scss` | `.pp-table` — clean Apple-style data tables |
|
|
57
139
|
| `tabs.scss` | `.pp-tabs` — pill-style tabs with icon + label |
|
|
58
140
|
| `typography.scss` | Utility classes for font, size, weight, spacing |
|
|
141
|
+
| `utilities.scss` | Single-purpose layout/spacing/display/visibility classes |
|
|
59
142
|
|
|
60
143
|
### JS components (`src/js/`)
|
|
61
144
|
|
|
145
|
+
Each file is a self-contained IIFE. Import only what you need, or include `peppertino.js` for everything.
|
|
146
|
+
|
|
62
147
|
| File | Purpose |
|
|
63
148
|
|---|---|
|
|
149
|
+
| `accordion.js` | `aria-expanded`/`aria-hidden`, keyboard nav (↑ ↓ Home End), `data-allow-multiple` |
|
|
150
|
+
| `carousel.js` | ARIA wiring, IntersectionObserver sync, `ppCarousel` API |
|
|
64
151
|
| `header.js` | Mobile drawer, dropdown ARIA wiring for `.pp-header` |
|
|
65
152
|
| `modal.js` | Open/close, focus trap, focus restore, ARIA for `.pp-modal` |
|
|
66
153
|
| `select.js` | Keyboard nav, ARIA listbox/option for `.pp-select` |
|
|
67
154
|
| `tabs.js` | Click + arrow key activation, ARIA tablist for `.pp-tabs` |
|
|
68
|
-
| `
|
|
155
|
+
| `validation.js` | `aria-invalid` wiring, summary focus, `ppValidation` API |
|
|
156
|
+
| `peppertino.js` | Aggregator — imports all of the above |
|
|
69
157
|
|
|
70
|
-
All JS follows progressive enhancement — CSS provides full visual baseline without JS. JS adds keyboard navigation, focus management, and ARIA state.
|
|
158
|
+
All JS follows progressive enhancement — CSS provides the full visual baseline without JS. JS adds keyboard navigation, focus management, and ARIA state.
|
|
71
159
|
|
|
72
160
|
---
|
|
73
161
|
|
|
@@ -104,15 +192,17 @@ radius('lg') // → 0.5rem
|
|
|
104
192
|
z('modal') // → 200
|
|
105
193
|
```
|
|
106
194
|
|
|
107
|
-
### Responsive
|
|
195
|
+
### Responsive mixins
|
|
108
196
|
|
|
109
197
|
```scss
|
|
110
|
-
@include respond-to('md')
|
|
111
|
-
|
|
112
|
-
}
|
|
198
|
+
@include respond-to('md') { /* min-width: 768px */ }
|
|
199
|
+
@include respond-below('md') { /* max-width: 767px */ }
|
|
200
|
+
@include respond-between('sm','lg') { /* 640px – 1023px */ }
|
|
113
201
|
```
|
|
114
202
|
|
|
115
|
-
|
|
203
|
+
Tailwind breakpoints: `sm` 640px · `md` 768px · `lg` 1024px · `xl` 1280px · `2xl` 1536px
|
|
204
|
+
|
|
205
|
+
Apple device breakpoints: `iphone-se` · `iphone` · `iphone-plus` · `iphone-pro-max` · `ipad-mini` · `ipad-air` · `ipad-pro-11` · `ipad-pro-13` · `macbook-air-13` · `macbook-pro-14` · `macbook-pro-16` · `imac`
|
|
116
206
|
|
|
117
207
|
---
|
|
118
208
|
|
|
@@ -139,10 +229,56 @@ Breakpoints: `sm` 640px · `md` 768px · `lg` 1024px · `xl` 1280px · `2xl` 153
|
|
|
139
229
|
|
|
140
230
|
## Components
|
|
141
231
|
|
|
232
|
+
### Accordion
|
|
233
|
+
|
|
234
|
+
```html
|
|
235
|
+
<div class="pp-accordion" data-allow-multiple>
|
|
236
|
+
<div class="pp-accordion__item">
|
|
237
|
+
<button class="pp-accordion__trigger" aria-expanded="false" aria-controls="acc-1">
|
|
238
|
+
Question
|
|
239
|
+
<svg class="pp-accordion__icon" viewBox="0 0 24 24" aria-hidden="true"><polyline points="6 9 12 15 18 9"/></svg>
|
|
240
|
+
</button>
|
|
241
|
+
<div class="pp-accordion__panel" id="acc-1" aria-hidden="true">
|
|
242
|
+
<p class="pp-accordion__content">Answer text.</p>
|
|
243
|
+
</div>
|
|
244
|
+
</div>
|
|
245
|
+
</div>
|
|
246
|
+
<script src="dist/accordion.js" defer></script>
|
|
247
|
+
```
|
|
248
|
+
|
|
249
|
+
Variants: `--flush` · `--dark` · `--primary`
|
|
250
|
+
Attribute: `data-allow-multiple` — allow multiple panels open at once
|
|
251
|
+
Keyboard: `↑` / `↓` arrows, `Home`, `End`
|
|
252
|
+
|
|
253
|
+
### Alert
|
|
254
|
+
|
|
255
|
+
```html
|
|
256
|
+
<div class="pp-alert pp-alert--info" role="note">
|
|
257
|
+
<span class="pp-alert__icon"><i data-lucide="info" aria-hidden="true"></i></span>
|
|
258
|
+
<div class="pp-alert__body">
|
|
259
|
+
<p class="pp-alert__title">Heads up</p>
|
|
260
|
+
<p class="pp-alert__message">Your session expires in 10 minutes.</p>
|
|
261
|
+
</div>
|
|
262
|
+
</div>
|
|
263
|
+
|
|
264
|
+
<!-- Dismissible -->
|
|
265
|
+
<div class="pp-alert pp-alert--success is-dismissible" role="status" id="a1">
|
|
266
|
+
<span class="pp-alert__icon"><i data-lucide="circle-check" aria-hidden="true"></i></span>
|
|
267
|
+
<div class="pp-alert__body"><p class="pp-alert__message">Saved.</p></div>
|
|
268
|
+
<button class="pp-alert__dismiss" aria-label="Dismiss"
|
|
269
|
+
onclick="const e=document.getElementById('a1');e.classList.add('is-dismissing');setTimeout(()=>e.remove(),200);">
|
|
270
|
+
<i data-lucide="x" aria-hidden="true"></i>
|
|
271
|
+
</button>
|
|
272
|
+
</div>
|
|
273
|
+
```
|
|
274
|
+
|
|
275
|
+
Variants: `--info` · `--success` · `--warning` · `--error` · `--primary` · `--neutral`
|
|
276
|
+
Modifier: `--filled` (solid background instead of tint)
|
|
277
|
+
States: `.is-dismissible` · `.is-dismissing` (slide-out before removal)
|
|
278
|
+
|
|
142
279
|
### Button
|
|
143
280
|
|
|
144
281
|
```html
|
|
145
|
-
<!-- Filled -->
|
|
146
282
|
<button class="button">Primary</button>
|
|
147
283
|
<button class="button-success">Success</button>
|
|
148
284
|
<button class="button-warning">Warning</button>
|
|
@@ -151,7 +287,6 @@ Breakpoints: `sm` 640px · `md` 768px · `lg` 1024px · `xl` 1280px · `2xl` 153
|
|
|
151
287
|
<button class="button-gradient">Gradient</button>
|
|
152
288
|
<button class="button-ghost">Ghost</button>
|
|
153
289
|
|
|
154
|
-
<!-- Outline -->
|
|
155
290
|
<button class="button-outline">Primary</button>
|
|
156
291
|
<button class="button-outline-success">Success</button>
|
|
157
292
|
<button class="button-outline-warning">Warning</button>
|
|
@@ -171,6 +306,143 @@ Breakpoints: `sm` 640px · `md` 768px · `lg` 1024px · `xl` 1280px · `2xl` 153
|
|
|
171
306
|
|
|
172
307
|
Grid helpers: `.pp-card-grid--2` · `.pp-card-grid--3` · `.pp-card-grid--4`
|
|
173
308
|
|
|
309
|
+
### Carousel
|
|
310
|
+
|
|
311
|
+
```html
|
|
312
|
+
<div class="pp-carousel" id="my-carousel" data-label="Featured">
|
|
313
|
+
<div class="pp-carousel__track">
|
|
314
|
+
<div class="pp-carousel__slide" id="my-carousel-slide-0">...</div>
|
|
315
|
+
<div class="pp-carousel__slide" id="my-carousel-slide-1">...</div>
|
|
316
|
+
</div>
|
|
317
|
+
<button class="pp-carousel__prev" type="button" aria-label="Previous slide">
|
|
318
|
+
<svg viewBox="0 0 24 24" aria-hidden="true"><polyline points="15 18 9 12 15 6"/></svg>
|
|
319
|
+
</button>
|
|
320
|
+
<button class="pp-carousel__next" type="button" aria-label="Next slide">
|
|
321
|
+
<svg viewBox="0 0 24 24" aria-hidden="true"><polyline points="9 6 15 12 9 18"/></svg>
|
|
322
|
+
</button>
|
|
323
|
+
<div class="pp-carousel__dots" aria-label="Slide navigation">
|
|
324
|
+
<button class="pp-carousel__dot" type="button" aria-label="Go to slide 1" aria-controls="my-carousel-slide-0"></button>
|
|
325
|
+
<button class="pp-carousel__dot" type="button" aria-label="Go to slide 2" aria-controls="my-carousel-slide-1"></button>
|
|
326
|
+
</div>
|
|
327
|
+
<div class="pp-carousel__announcer" aria-live="polite" aria-atomic="true"></div>
|
|
328
|
+
</div>
|
|
329
|
+
<script src="dist/carousel.js" defer></script>
|
|
330
|
+
```
|
|
331
|
+
|
|
332
|
+
Variants: `--peek-2` · `--peek-3` · `--dark` · `--flush`
|
|
333
|
+
API: `ppCarousel.get(id).goTo(n)`
|
|
334
|
+
|
|
335
|
+
### Footer
|
|
336
|
+
|
|
337
|
+
```html
|
|
338
|
+
<footer class="pp-footer" role="contentinfo">
|
|
339
|
+
<div class="pp-footer__top">
|
|
340
|
+
<div class="pp-footer__brand">
|
|
341
|
+
<a href="#" class="pp-footer__logo">Brand</a>
|
|
342
|
+
<p class="pp-footer__tagline">Tagline</p>
|
|
343
|
+
</div>
|
|
344
|
+
<div class="pp-footer__col">
|
|
345
|
+
<p class="pp-footer__col-title">Column</p>
|
|
346
|
+
<ul class="pp-footer__nav" aria-label="Column links">
|
|
347
|
+
<li><a href="#" class="pp-footer__nav-link">Link</a></li>
|
|
348
|
+
</ul>
|
|
349
|
+
</div>
|
|
350
|
+
</div>
|
|
351
|
+
<div class="pp-footer__bottom">
|
|
352
|
+
<p class="pp-footer__legal">© 2026 Brand.</p>
|
|
353
|
+
<ul class="pp-footer__social" aria-label="Social links">
|
|
354
|
+
<li><a href="#" class="pp-footer__social-link" aria-label="GitHub"><i data-lucide="github"></i></a></li>
|
|
355
|
+
</ul>
|
|
356
|
+
</div>
|
|
357
|
+
</footer>
|
|
358
|
+
```
|
|
359
|
+
|
|
360
|
+
Variants: `--dark` · `--accent`
|
|
361
|
+
|
|
362
|
+
### Forms
|
|
363
|
+
|
|
364
|
+
#### Label
|
|
365
|
+
|
|
366
|
+
```html
|
|
367
|
+
<span class="pp-label pp-label--primary">Primary</span>
|
|
368
|
+
<span class="pp-label pp-label--secondary pp-label--callout">Secondary callout</span>
|
|
369
|
+
<span class="pp-label pp-label--selectable">Selectable text</span>
|
|
370
|
+
<span class="pp-label-row pp-label"><i data-lucide="wifi" aria-hidden="true"></i> Wi-Fi</span>
|
|
371
|
+
```
|
|
372
|
+
|
|
373
|
+
Tiers: `--primary` · `--secondary` · `--tertiary` · `--quaternary`
|
|
374
|
+
Scale: `--headline` · `--subheadline` · `--body` · `--callout` · `--footnote` · `--caption`
|
|
375
|
+
|
|
376
|
+
#### Fieldset
|
|
377
|
+
|
|
378
|
+
```html
|
|
379
|
+
<fieldset class="pp-fieldset">
|
|
380
|
+
<legend>Group name</legend>
|
|
381
|
+
<!-- controls -->
|
|
382
|
+
</fieldset>
|
|
383
|
+
```
|
|
384
|
+
|
|
385
|
+
Variants: `--ghost` · `--filled` · `--primary` · `--error`
|
|
386
|
+
Legend modifiers: `--sm` · `--lg` · `--inline`
|
|
387
|
+
|
|
388
|
+
#### Form Instructions
|
|
389
|
+
|
|
390
|
+
```html
|
|
391
|
+
<!-- Place BEFORE <form> -->
|
|
392
|
+
<div class="pp-form-instructions" role="note" aria-label="Form instructions">
|
|
393
|
+
<p class="pp-form-instructions__title">Before you begin</p>
|
|
394
|
+
<ul class="pp-form-instructions__list">
|
|
395
|
+
<li class="pp-form-instructions__item">Fields marked * are required.</li>
|
|
396
|
+
</ul>
|
|
397
|
+
</div>
|
|
398
|
+
```
|
|
399
|
+
|
|
400
|
+
Variants: `--neutral` · `--warning` · `--error` (use `role="alert"` for errors)
|
|
401
|
+
|
|
402
|
+
#### Text Field
|
|
403
|
+
|
|
404
|
+
```html
|
|
405
|
+
<div class="pp-field">
|
|
406
|
+
<label class="pp-field__label" for="name">
|
|
407
|
+
Name
|
|
408
|
+
<abbr class="pp-field__required" aria-label="required" title="required"></abbr>
|
|
409
|
+
</label>
|
|
410
|
+
<input class="pp-field__input" type="text" id="name" name="name"
|
|
411
|
+
required aria-required="true" aria-describedby="name-hint" />
|
|
412
|
+
<span class="pp-field__hint" id="name-hint">Your full legal name.</span>
|
|
413
|
+
</div>
|
|
414
|
+
```
|
|
415
|
+
|
|
416
|
+
States: `--error` · `--success` · `--warning` · `--validating`
|
|
417
|
+
Sizes: `--sm` · `--lg`
|
|
418
|
+
|
|
419
|
+
#### Validation
|
|
420
|
+
|
|
421
|
+
```html
|
|
422
|
+
<!-- Summary (place before or at top of form) -->
|
|
423
|
+
<div class="pp-validation-summary" role="alert" aria-label="Form errors">
|
|
424
|
+
<p class="pp-validation-summary__title">Errors prevented submission</p>
|
|
425
|
+
<ul class="pp-validation-summary__list"></ul>
|
|
426
|
+
</div>
|
|
427
|
+
|
|
428
|
+
<!-- Confirmation checkbox -->
|
|
429
|
+
<label class="pp-confirm">
|
|
430
|
+
<input class="pp-confirm__input" type="checkbox" />
|
|
431
|
+
<span class="pp-confirm__label">I confirm this action.</span>
|
|
432
|
+
</label>
|
|
433
|
+
<button class="button pp-submit--gated" type="submit">Submit</button>
|
|
434
|
+
```
|
|
435
|
+
|
|
436
|
+
JS API (optional — CSS works without it):
|
|
437
|
+
|
|
438
|
+
```js
|
|
439
|
+
ppValidation.setError(input, 'Message')
|
|
440
|
+
ppValidation.clearError(input)
|
|
441
|
+
ppValidation.setSuccess(input, 'Message')
|
|
442
|
+
ppValidation.setValidating(input)
|
|
443
|
+
ppValidation.setSummary([{ input, message }], summaryEl)
|
|
444
|
+
```
|
|
445
|
+
|
|
174
446
|
### Gradient text
|
|
175
447
|
|
|
176
448
|
```html
|
|
@@ -202,8 +474,6 @@ Grid helpers: `.pp-card-grid--2` · `.pp-card-grid--3` · `.pp-card-grid--4`
|
|
|
202
474
|
<script src="dist/header.js" defer></script>
|
|
203
475
|
```
|
|
204
476
|
|
|
205
|
-
Sticky, glassmorphism background. Dropdowns appear on hover (desktop) or tap (mobile). Hamburger animates to × when open. Full ARIA menubar/menu/menuitem semantics.
|
|
206
|
-
|
|
207
477
|
### Modal
|
|
208
478
|
|
|
209
479
|
```html
|
|
@@ -227,19 +497,19 @@ Sticky, glassmorphism background. Dropdowns appear on hover (desktop) or tap (mo
|
|
|
227
497
|
<script src="dist/modal.js" defer></script>
|
|
228
498
|
```
|
|
229
499
|
|
|
230
|
-
|
|
500
|
+
`window.ppModal.open(id)` / `.close(id)` / `.closeAll()`
|
|
231
501
|
|
|
232
502
|
### Select
|
|
233
503
|
|
|
234
504
|
```html
|
|
235
505
|
<div class="pp-select">
|
|
236
|
-
<button class="pp-select__trigger" type="button">
|
|
506
|
+
<button class="pp-select__trigger" type="button" aria-label="Choose option">
|
|
237
507
|
<span class="pp-select__value">Choose…</span>
|
|
238
508
|
<span class="pp-select__chevron"></span>
|
|
239
509
|
</button>
|
|
240
510
|
<ul class="pp-select__panel" role="listbox">
|
|
241
|
-
<li><button class="pp-select__option" data-value="a"
|
|
242
|
-
<li><button class="pp-select__option" data-value="b"
|
|
511
|
+
<li role="option"><button class="pp-select__option" data-value="a">Option A</button></li>
|
|
512
|
+
<li role="option"><button class="pp-select__option" data-value="b">Option B</button></li>
|
|
243
513
|
</ul>
|
|
244
514
|
</div>
|
|
245
515
|
<script src="dist/select.js" defer></script>
|
|
@@ -254,15 +524,14 @@ Sizes: `.pp-select--sm` · `.pp-select--lg`
|
|
|
254
524
|
<button class="pp-tabs__item is-active" role="tab" aria-selected="true">Tab 1</button>
|
|
255
525
|
<button class="pp-tabs__item" role="tab" aria-selected="false">Tab 2</button>
|
|
256
526
|
</div>
|
|
257
|
-
<!-- optional panels -->
|
|
258
527
|
<div data-tab-panel="tab1" role="tabpanel">Panel 1</div>
|
|
259
528
|
<div data-tab-panel="tab2" role="tabpanel" hidden>Panel 2</div>
|
|
260
529
|
<script src="dist/tabs.js" defer></script>
|
|
261
530
|
```
|
|
262
531
|
|
|
263
|
-
Variants: default ·
|
|
264
|
-
Sizes:
|
|
265
|
-
Keyboard: `←` / `→` arrows, `Home`, `End
|
|
532
|
+
Variants: default · `--outline` · `--gradient` · `--gradient-outline`
|
|
533
|
+
Sizes: `--sm` · `--lg`
|
|
534
|
+
Keyboard: `←` / `→` arrows, `Home`, `End`
|
|
266
535
|
|
|
267
536
|
### Table
|
|
268
537
|
|
|
@@ -286,35 +555,61 @@ Column helpers: `.pp-table--cols-1` → `.pp-table--cols-4`
|
|
|
286
555
|
</section>
|
|
287
556
|
```
|
|
288
557
|
|
|
289
|
-
Variants:
|
|
558
|
+
Variants: `--primary` · `--dark` · `--muted` · `--gradient`
|
|
290
559
|
|
|
291
560
|
---
|
|
292
561
|
|
|
293
|
-
##
|
|
562
|
+
## Utilities
|
|
563
|
+
|
|
564
|
+
Single-purpose classes — no JavaScript required. Import `utilities.scss` or use the compiled CSS.
|
|
565
|
+
|
|
566
|
+
| Group | Classes |
|
|
567
|
+
|---|---|
|
|
568
|
+
| Display | `.d-{block\|inline\|inline-block\|flex\|inline-flex\|grid\|inline-grid\|none\|contents}` |
|
|
569
|
+
| Visibility | `.visible` `.invisible` `.sr-only` `.not-sr-only` |
|
|
570
|
+
| Opacity | `.opacity-{0\|25\|50\|75\|100}` |
|
|
571
|
+
| Margin | `.m-*` `.mt-*` `.mb-*` `.ml-*` `.mr-*` `.mx-*` `.my-*` (keys 0–32, `auto`) |
|
|
572
|
+
| Padding | `.p-*` `.pt-*` `.pb-*` `.pl-*` `.pr-*` `.px-*` `.py-*` (keys 0–32) |
|
|
573
|
+
| Gap | `.gap-*` `.gap-x-*` `.gap-y-*` (keys 0–32) |
|
|
574
|
+
| Flex | direction, wrap, grow/shrink, justify-content, align-items, align-self |
|
|
575
|
+
| Grid | `.grid-cols-{1–6,12}` `.grid-rows-{1–4}` `.col-span-*` `.row-span-*` |
|
|
576
|
+
| Width | `.w-full` `.w-screen` `.w-auto` `.w-fit` `.w-min` `.w-max` `.w-half` |
|
|
577
|
+
| Height | `.h-full` `.h-screen` `.h-auto` `.h-fit` |
|
|
578
|
+
| Overflow | `.overflow-{auto\|hidden\|visible\|scroll}`, x/y variants |
|
|
579
|
+
| Position | `.static` `.relative` `.absolute` `.fixed` `.sticky` |
|
|
580
|
+
| Z-index | `.z-{below\|base\|raised\|overlay\|modal\|toast\|tooltip}` |
|
|
581
|
+
| Border-radius | `.rounded-{none\|sm\|base\|md\|lg\|xl\|2xl\|full}` |
|
|
582
|
+
| Shadow | `.shadow-{none\|sm\|md\|lg\|xl}` |
|
|
583
|
+
| Cursor | `.cursor-{default\|pointer\|not-allowed\|grab\|text}` |
|
|
584
|
+
| Responsive | `.sm-d-*` `.md-d-*` `.lg-d-*` `.xl-d-*` `.w2xl-d-*` (display only) |
|
|
294
585
|
|
|
295
|
-
|
|
586
|
+
---
|
|
296
587
|
|
|
297
|
-
|
|
588
|
+
## Dark mode
|
|
298
589
|
|
|
299
|
-
|
|
300
|
-
- **Modal:** `role="dialog"` + `aria-modal="true"` on backdrop; `aria-labelledby` + `aria-describedby` auto-wired to title/description elements; `aria-label="Close"` on close button; focus trap (Tab/Shift+Tab stays inside open modal); focus restored to the triggering element on close.
|
|
301
|
-
- **Select:** `role="combobox"` on trigger; `role="listbox"` on panel; `role="option"` + `aria-selected` on every option; `aria-controls` + `aria-activedescendant` kept in sync; `aria-disabled` CSS hook for disabled state.
|
|
302
|
-
- **Tabs:** `role="tablist"` on container; `role="tab"` on items; `aria-controls` wired to panel `id`s; `role="tabpanel"` + `aria-labelledby` on panels; `Home`/`End` keyboard shortcuts added.
|
|
303
|
-
- **CSS:** All ARIA attribute states (`aria-expanded`, `aria-selected`, `aria-hidden`, `aria-disabled`) are now first-class CSS selectors — visual state is driven by ARIA, not just class names.
|
|
304
|
-
- **HTML demo:** All modal backdrops updated with `role`, `aria-modal`, `aria-labelledby`, `aria-describedby`, `aria-hidden`; nav updated with full menubar semantics.
|
|
590
|
+
Add `class="dark"` to `<html>` (or any ancestor element). All component tokens flip automatically via CSS custom properties — no extra classes needed on individual components.
|
|
305
591
|
|
|
306
|
-
|
|
592
|
+
```html
|
|
593
|
+
<html class="dark">
|
|
594
|
+
<!-- everything inside uses dark surface tokens -->
|
|
595
|
+
</html>
|
|
596
|
+
```
|
|
307
597
|
|
|
308
|
-
|
|
598
|
+
Toggle from JS:
|
|
599
|
+
|
|
600
|
+
```js
|
|
601
|
+
document.documentElement.classList.toggle('dark');
|
|
602
|
+
// persist across sessions:
|
|
603
|
+
localStorage.setItem('pp-dark', document.documentElement.classList.contains('dark'));
|
|
604
|
+
```
|
|
605
|
+
|
|
606
|
+
All `--pp-*` tokens are defined on `:root` as light defaults. `dark-mode.scss` overrides them under `.dark`. The neutral scale is fully inverted (50 ↔ 900), surfaces swap, and glass/shadow values are strengthened for dark backgrounds.
|
|
309
607
|
|
|
310
608
|
---
|
|
311
609
|
|
|
312
|
-
|
|
610
|
+
## Changelog
|
|
313
611
|
|
|
314
|
-
|
|
315
|
-
- Progressive enhancement: CSS-only baseline for all interactive components; JS adds keyboard navigation, animations, outside-click close.
|
|
316
|
-
- Single Google Fonts request for Inter + Kode Mono.
|
|
317
|
-
- esbuild bundler with per-component files + `peppertino.js` aggregator.
|
|
612
|
+
See [CHANGELOG.txt](CHANGELOG.txt)
|
|
318
613
|
|
|
319
614
|
---
|
|
320
615
|
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
(() => {
|
|
2
|
+
(function() {
|
|
3
|
+
document.querySelectorAll(".pp-accordion").forEach((accordion) => {
|
|
4
|
+
const allowMultiple = accordion.hasAttribute("data-allow-multiple");
|
|
5
|
+
accordion.querySelectorAll(".pp-accordion__trigger").forEach((trigger) => {
|
|
6
|
+
const panelId = trigger.getAttribute("aria-controls");
|
|
7
|
+
const panel = panelId ? document.getElementById(panelId) : trigger.nextElementSibling;
|
|
8
|
+
if (!panel) return;
|
|
9
|
+
const isOpen = trigger.getAttribute("aria-expanded") === "true";
|
|
10
|
+
panel.setAttribute("aria-hidden", isOpen ? "false" : "true");
|
|
11
|
+
if (isOpen) panel.classList.add("is-open");
|
|
12
|
+
trigger.addEventListener("click", () => {
|
|
13
|
+
const expanded = trigger.getAttribute("aria-expanded") === "true";
|
|
14
|
+
if (!allowMultiple) {
|
|
15
|
+
accordion.querySelectorAll(".pp-accordion__trigger").forEach((t) => {
|
|
16
|
+
if (t === trigger) return;
|
|
17
|
+
t.setAttribute("aria-expanded", "false");
|
|
18
|
+
const p = t.getAttribute("aria-controls") ? document.getElementById(t.getAttribute("aria-controls")) : t.nextElementSibling;
|
|
19
|
+
if (p) {
|
|
20
|
+
p.setAttribute("aria-hidden", "true");
|
|
21
|
+
p.classList.remove("is-open");
|
|
22
|
+
}
|
|
23
|
+
});
|
|
24
|
+
}
|
|
25
|
+
const next = !expanded;
|
|
26
|
+
trigger.setAttribute("aria-expanded", String(next));
|
|
27
|
+
panel.setAttribute("aria-hidden", String(!next));
|
|
28
|
+
panel.classList.toggle("is-open", next);
|
|
29
|
+
});
|
|
30
|
+
trigger.addEventListener("keydown", (e) => {
|
|
31
|
+
const triggers = [...accordion.querySelectorAll(".pp-accordion__trigger")];
|
|
32
|
+
const idx = triggers.indexOf(trigger);
|
|
33
|
+
if (e.key === "ArrowDown") {
|
|
34
|
+
e.preventDefault();
|
|
35
|
+
triggers[(idx + 1) % triggers.length].focus();
|
|
36
|
+
} else if (e.key === "ArrowUp") {
|
|
37
|
+
e.preventDefault();
|
|
38
|
+
triggers[(idx - 1 + triggers.length) % triggers.length].focus();
|
|
39
|
+
} else if (e.key === "Home") {
|
|
40
|
+
e.preventDefault();
|
|
41
|
+
triggers[0].focus();
|
|
42
|
+
} else if (e.key === "End") {
|
|
43
|
+
e.preventDefault();
|
|
44
|
+
triggers[triggers.length - 1].focus();
|
|
45
|
+
}
|
|
46
|
+
});
|
|
47
|
+
});
|
|
48
|
+
});
|
|
49
|
+
})();
|
|
50
|
+
})();
|
|
51
|
+
//# sourceMappingURL=accordion.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../src/js/accordion.js"],
|
|
4
|
+
"sourcesContent": ["(function () {\n document.querySelectorAll('.pp-accordion').forEach((accordion) => {\n const allowMultiple = accordion.hasAttribute('data-allow-multiple');\n\n accordion.querySelectorAll('.pp-accordion__trigger').forEach((trigger) => {\n const panelId = trigger.getAttribute('aria-controls');\n const panel = panelId\n ? document.getElementById(panelId)\n : trigger.nextElementSibling;\n\n if (!panel) return;\n\n // Ensure ARIA state matches DOM on init\n const isOpen = trigger.getAttribute('aria-expanded') === 'true';\n panel.setAttribute('aria-hidden', isOpen ? 'false' : 'true');\n if (isOpen) panel.classList.add('is-open');\n\n trigger.addEventListener('click', () => {\n const expanded = trigger.getAttribute('aria-expanded') === 'true';\n\n if (!allowMultiple) {\n accordion.querySelectorAll('.pp-accordion__trigger').forEach((t) => {\n if (t === trigger) return;\n t.setAttribute('aria-expanded', 'false');\n const p = t.getAttribute('aria-controls')\n ? document.getElementById(t.getAttribute('aria-controls'))\n : t.nextElementSibling;\n if (p) {\n p.setAttribute('aria-hidden', 'true');\n p.classList.remove('is-open');\n }\n });\n }\n\n const next = !expanded;\n trigger.setAttribute('aria-expanded', String(next));\n panel.setAttribute('aria-hidden', String(!next));\n panel.classList.toggle('is-open', next);\n });\n\n // Keyboard: Home/End focus management within accordion\n trigger.addEventListener('keydown', (e) => {\n const triggers = [...accordion.querySelectorAll('.pp-accordion__trigger')];\n const idx = triggers.indexOf(trigger);\n if (e.key === 'ArrowDown') {\n e.preventDefault();\n triggers[(idx + 1) % triggers.length].focus();\n } else if (e.key === 'ArrowUp') {\n e.preventDefault();\n triggers[(idx - 1 + triggers.length) % triggers.length].focus();\n } else if (e.key === 'Home') {\n e.preventDefault();\n triggers[0].focus();\n } else if (e.key === 'End') {\n e.preventDefault();\n triggers[triggers.length - 1].focus();\n }\n });\n });\n });\n})();\n"],
|
|
5
|
+
"mappings": ";AAAA,GAAC,WAAY;AACX,aAAS,iBAAiB,eAAe,EAAE,QAAQ,CAAC,cAAc;AAChE,YAAM,gBAAgB,UAAU,aAAa,qBAAqB;AAElE,gBAAU,iBAAiB,wBAAwB,EAAE,QAAQ,CAAC,YAAY;AACxE,cAAM,UAAU,QAAQ,aAAa,eAAe;AACpD,cAAM,QAAQ,UACV,SAAS,eAAe,OAAO,IAC/B,QAAQ;AAEZ,YAAI,CAAC,MAAO;AAGZ,cAAM,SAAS,QAAQ,aAAa,eAAe,MAAM;AACzD,cAAM,aAAa,eAAe,SAAS,UAAU,MAAM;AAC3D,YAAI,OAAQ,OAAM,UAAU,IAAI,SAAS;AAEzC,gBAAQ,iBAAiB,SAAS,MAAM;AACtC,gBAAM,WAAW,QAAQ,aAAa,eAAe,MAAM;AAE3D,cAAI,CAAC,eAAe;AAClB,sBAAU,iBAAiB,wBAAwB,EAAE,QAAQ,CAAC,MAAM;AAClE,kBAAI,MAAM,QAAS;AACnB,gBAAE,aAAa,iBAAiB,OAAO;AACvC,oBAAM,IAAI,EAAE,aAAa,eAAe,IACpC,SAAS,eAAe,EAAE,aAAa,eAAe,CAAC,IACvD,EAAE;AACN,kBAAI,GAAG;AACL,kBAAE,aAAa,eAAe,MAAM;AACpC,kBAAE,UAAU,OAAO,SAAS;AAAA,cAC9B;AAAA,YACF,CAAC;AAAA,UACH;AAEA,gBAAM,OAAO,CAAC;AACd,kBAAQ,aAAa,iBAAiB,OAAO,IAAI,CAAC;AAClD,gBAAM,aAAa,eAAe,OAAO,CAAC,IAAI,CAAC;AAC/C,gBAAM,UAAU,OAAO,WAAW,IAAI;AAAA,QACxC,CAAC;AAGD,gBAAQ,iBAAiB,WAAW,CAAC,MAAM;AACzC,gBAAM,WAAW,CAAC,GAAG,UAAU,iBAAiB,wBAAwB,CAAC;AACzE,gBAAM,MAAM,SAAS,QAAQ,OAAO;AACpC,cAAI,EAAE,QAAQ,aAAa;AACzB,cAAE,eAAe;AACjB,sBAAU,MAAM,KAAK,SAAS,MAAM,EAAE,MAAM;AAAA,UAC9C,WAAW,EAAE,QAAQ,WAAW;AAC9B,cAAE,eAAe;AACjB,sBAAU,MAAM,IAAI,SAAS,UAAU,SAAS,MAAM,EAAE,MAAM;AAAA,UAChE,WAAW,EAAE,QAAQ,QAAQ;AAC3B,cAAE,eAAe;AACjB,qBAAS,CAAC,EAAE,MAAM;AAAA,UACpB,WAAW,EAAE,QAAQ,OAAO;AAC1B,cAAE,eAAe;AACjB,qBAAS,SAAS,SAAS,CAAC,EAAE,MAAM;AAAA,UACtC;AAAA,QACF,CAAC;AAAA,MACH,CAAC;AAAA,IACH,CAAC;AAAA,EACH,GAAG;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|