@auriel/peppertino 0.1.1 → 0.2.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/.claude/settings.local.json +8 -0
- package/CHANGELOG.txt +70 -0
- package/README.md +143 -23
- package/build.js +27 -12
- package/dist/header.js +42 -0
- package/dist/header.js.map +7 -0
- package/dist/main.css +1429 -0
- package/dist/main.css.map +1 -0
- package/dist/modal.js +53 -0
- package/dist/modal.js.map +7 -0
- package/dist/peppertino.js +227 -0
- package/dist/peppertino.js.map +7 -0
- package/dist/select.js +82 -0
- package/dist/select.js.map +7 -0
- package/dist/tabs.js +52 -0
- package/dist/tabs.js.map +7 -0
- package/index.html +254 -21
- package/package.json +1 -1
- package/src/js/header.js +43 -4
- package/src/js/modal.js +134 -0
- package/src/js/peppertino.js +7 -0
- package/src/js/select.js +103 -0
- package/src/js/tabs.js +94 -0
- package/src/scss/button.scss +87 -20
- package/src/scss/card.scss +121 -0
- package/src/scss/header.scss +27 -6
- package/src/scss/main.scss +4 -0
- package/src/scss/modal.scss +188 -0
- package/src/scss/section.scss +1 -1
- package/src/scss/select.scss +210 -0
- package/src/scss/tabs.scss +156 -0
package/CHANGELOG.txt
ADDED
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
PeppertinoCSS — Changelog
|
|
2
|
+
=========================
|
|
3
|
+
|
|
4
|
+
v0.2.0 — 2026-06-01
|
|
5
|
+
--------------------
|
|
6
|
+
Accessibility (ARIA) — full pass across all components.
|
|
7
|
+
|
|
8
|
+
Header
|
|
9
|
+
- role="menubar" on nav list
|
|
10
|
+
- role="menu" on dropdowns, role="menuitem" on all links
|
|
11
|
+
- role="none" on <li> wrappers
|
|
12
|
+
- aria-haspopup + aria-expanded on dropdown triggers
|
|
13
|
+
- aria-controls wired to dropdown IDs
|
|
14
|
+
- aria-hidden toggled on mobile nav drawer
|
|
15
|
+
- aria-label on <nav>
|
|
16
|
+
|
|
17
|
+
Modal
|
|
18
|
+
- role="dialog" + aria-modal="true" on backdrop
|
|
19
|
+
- aria-labelledby + aria-describedby auto-wired to title/description IDs
|
|
20
|
+
- aria-label="Close" on close button
|
|
21
|
+
- Focus trap: Tab/Shift+Tab stays inside open modal
|
|
22
|
+
- Focus restored to triggering element on close
|
|
23
|
+
|
|
24
|
+
Select
|
|
25
|
+
- role="combobox" on trigger
|
|
26
|
+
- role="listbox" on panel
|
|
27
|
+
- role="option" + aria-selected on every option
|
|
28
|
+
- aria-controls + aria-activedescendant kept in sync on selection
|
|
29
|
+
- aria-disabled CSS hook for disabled state
|
|
30
|
+
|
|
31
|
+
Tabs
|
|
32
|
+
- role="tablist" on container (enforced by JS if missing)
|
|
33
|
+
- role="tab" on items
|
|
34
|
+
- aria-controls wired to panel IDs
|
|
35
|
+
- role="tabpanel" + aria-labelledby on panels
|
|
36
|
+
- Home / End keyboard shortcuts added
|
|
37
|
+
|
|
38
|
+
CSS
|
|
39
|
+
- ARIA attribute selectors (aria-expanded, aria-hidden, aria-selected,
|
|
40
|
+
aria-disabled) are now first-class CSS hooks in header.scss, modal.scss,
|
|
41
|
+
and select.scss — visual state is driven by ARIA, not just class names
|
|
42
|
+
|
|
43
|
+
HTML demo
|
|
44
|
+
- All modal backdrops updated with role, aria-modal, aria-labelledby,
|
|
45
|
+
aria-describedby, aria-hidden in markup
|
|
46
|
+
- Nav updated with full menubar / menu / menuitem semantics
|
|
47
|
+
|
|
48
|
+
Page structure
|
|
49
|
+
- Section order updated: Hero → Colors → Typography → Components (A→Z)
|
|
50
|
+
|
|
51
|
+
Package
|
|
52
|
+
- Version bumped to 2.0.0
|
|
53
|
+
|
|
54
|
+
|
|
55
|
+
v0.1.1 — initial release
|
|
56
|
+
-------------------------
|
|
57
|
+
- Reset, base design tokens, button, card, gradient text
|
|
58
|
+
- Header: glassmorphism sticky, mobile hamburger drawer
|
|
59
|
+
- Modal: glassmorphic backdrop, native <dialog> support
|
|
60
|
+
- Section: full-viewport sections, custom gradient scrollbar
|
|
61
|
+
- Select: native <select> restyling + .pp-select custom dropdown
|
|
62
|
+
- Table: Apple-style clean tables
|
|
63
|
+
- Tabs: pill-style, icon + label, four variants (normal, outline,
|
|
64
|
+
gradient, gradient-outline), sm/lg sizes
|
|
65
|
+
- Typography: Inter + Kode Mono, weight/size/spacing utility classes
|
|
66
|
+
- Progressive enhancement: CSS-only baseline for all interactive
|
|
67
|
+
components; JS adds keyboard nav, animations, outside-click close
|
|
68
|
+
- Single Google Fonts request for Inter + Kode Mono
|
|
69
|
+
- esbuild bundler: per-component files + peppertino.js aggregator
|
|
70
|
+
- MIT license
|
package/README.md
CHANGED
|
@@ -46,22 +46,32 @@ Then open `http://localhost:3000` in your browser.
|
|
|
46
46
|
|---|---|
|
|
47
47
|
| `reset.scss` | Opinionated modern reset |
|
|
48
48
|
| `base.scss` | Design tokens, helper functions, base element styles |
|
|
49
|
-
| `button.scss` | `.button`, `.button-outline
|
|
49
|
+
| `button.scss` | `.button`, `.button-outline`, semantic variants |
|
|
50
|
+
| `card.scss` | `.pp-card` and variants |
|
|
50
51
|
| `gradient.scss` | `.gradient-txt` |
|
|
51
52
|
| `header.scss` | `.pp-header` — glassmorphism sticky header |
|
|
53
|
+
| `modal.scss` | `.pp-modal-backdrop` + `.pp-modal` — glassmorphic modals |
|
|
52
54
|
| `section.scss` | `.pp-section` — full-viewport sections + custom scrollbar |
|
|
55
|
+
| `select.scss` | Native `<select>` restyling + `.pp-select` custom dropdown |
|
|
53
56
|
| `table.scss` | `.pp-table` — clean Apple-style data tables |
|
|
57
|
+
| `tabs.scss` | `.pp-tabs` — pill-style tabs with icon + label |
|
|
54
58
|
| `typography.scss` | Utility classes for font, size, weight, spacing |
|
|
55
59
|
|
|
56
60
|
### JS components (`src/js/`)
|
|
57
61
|
|
|
58
62
|
| File | Purpose |
|
|
59
63
|
|---|---|
|
|
60
|
-
| `header.js` | Mobile drawer
|
|
64
|
+
| `header.js` | Mobile drawer, dropdown ARIA wiring for `.pp-header` |
|
|
65
|
+
| `modal.js` | Open/close, focus trap, focus restore, ARIA for `.pp-modal` |
|
|
66
|
+
| `select.js` | Keyboard nav, ARIA listbox/option for `.pp-select` |
|
|
67
|
+
| `tabs.js` | Click + arrow key activation, ARIA tablist for `.pp-tabs` |
|
|
68
|
+
| `peppertino.js` | Single-file bundle of all the above |
|
|
69
|
+
|
|
70
|
+
All JS follows progressive enhancement — CSS provides full visual baseline without JS. JS adds keyboard navigation, focus management, and ARIA state.
|
|
61
71
|
|
|
62
72
|
---
|
|
63
73
|
|
|
64
|
-
## Design tokens (base.scss)
|
|
74
|
+
## Design tokens (`base.scss`)
|
|
65
75
|
|
|
66
76
|
### Colors
|
|
67
77
|
|
|
@@ -132,32 +142,55 @@ Breakpoints: `sm` 640px · `md` 768px · `lg` 1024px · `xl` 1280px · `2xl` 153
|
|
|
132
142
|
### Button
|
|
133
143
|
|
|
134
144
|
```html
|
|
135
|
-
|
|
136
|
-
<button class="button
|
|
145
|
+
<!-- Filled -->
|
|
146
|
+
<button class="button">Primary</button>
|
|
147
|
+
<button class="button-success">Success</button>
|
|
148
|
+
<button class="button-warning">Warning</button>
|
|
149
|
+
<button class="button-error">Error</button>
|
|
150
|
+
<button class="button-dark">Dark</button>
|
|
151
|
+
<button class="button-gradient">Gradient</button>
|
|
152
|
+
<button class="button-ghost">Ghost</button>
|
|
153
|
+
|
|
154
|
+
<!-- Outline -->
|
|
155
|
+
<button class="button-outline">Primary</button>
|
|
156
|
+
<button class="button-outline-success">Success</button>
|
|
157
|
+
<button class="button-outline-warning">Warning</button>
|
|
158
|
+
<button class="button-outline-error">Error</button>
|
|
159
|
+
<button class="button-outline-dark">Dark</button>
|
|
137
160
|
```
|
|
138
161
|
|
|
162
|
+
### Card
|
|
163
|
+
|
|
164
|
+
```html
|
|
165
|
+
<div class="pp-card">...</div>
|
|
166
|
+
<div class="pp-card pp-card--dark">...</div>
|
|
167
|
+
<div class="pp-card pp-card--gradient">...</div>
|
|
168
|
+
<div class="pp-card pp-card--primary">...</div>
|
|
169
|
+
<div class="pp-card pp-card--ghost">...</div>
|
|
170
|
+
```
|
|
171
|
+
|
|
172
|
+
Grid helpers: `.pp-card-grid--2` · `.pp-card-grid--3` · `.pp-card-grid--4`
|
|
173
|
+
|
|
139
174
|
### Gradient text
|
|
140
175
|
|
|
141
176
|
```html
|
|
142
177
|
<h1 class="gradient-txt">PeppertinoCSS</h1>
|
|
143
178
|
```
|
|
144
179
|
|
|
145
|
-
Gradient colors are driven by `$gradient-start` and `$gradient-end` in `base.scss`.
|
|
146
|
-
|
|
147
180
|
### Header
|
|
148
181
|
|
|
149
182
|
```html
|
|
150
183
|
<header class="pp-header">
|
|
151
184
|
<a href="#" class="pp-header__brand">Brand</a>
|
|
152
|
-
<nav>
|
|
153
|
-
<ul class="pp-header__nav">
|
|
154
|
-
<li class="pp-header__nav-item">
|
|
155
|
-
<a href="#" class="pp-header__nav-link">Link</a>
|
|
185
|
+
<nav aria-label="Main navigation">
|
|
186
|
+
<ul class="pp-header__nav" role="menubar">
|
|
187
|
+
<li class="pp-header__nav-item" role="none">
|
|
188
|
+
<a href="#" class="pp-header__nav-link" role="menuitem">Link</a>
|
|
156
189
|
</li>
|
|
157
|
-
<li class="pp-header__nav-item">
|
|
158
|
-
<a href="#" class="pp-header__nav-link">Dropdown</a>
|
|
159
|
-
<ul class="pp-header__dropdown">
|
|
160
|
-
<li><a href="#" class="pp-header__dropdown-link">Item</a></li>
|
|
190
|
+
<li class="pp-header__nav-item" role="none">
|
|
191
|
+
<a href="#" class="pp-header__nav-link" role="menuitem" aria-haspopup="true" aria-expanded="false">Dropdown</a>
|
|
192
|
+
<ul class="pp-header__dropdown" role="menu">
|
|
193
|
+
<li role="none"><a href="#" class="pp-header__dropdown-link" role="menuitem">Item</a></li>
|
|
161
194
|
</ul>
|
|
162
195
|
</li>
|
|
163
196
|
</ul>
|
|
@@ -169,19 +202,67 @@ Gradient colors are driven by `$gradient-start` and `$gradient-end` in `base.scs
|
|
|
169
202
|
<script src="dist/header.js" defer></script>
|
|
170
203
|
```
|
|
171
204
|
|
|
172
|
-
Sticky, glassmorphism background. Dropdowns appear on hover (desktop) or tap (mobile).
|
|
205
|
+
Sticky, glassmorphism background. Dropdowns appear on hover (desktop) or tap (mobile). Hamburger animates to × when open. Full ARIA menubar/menu/menuitem semantics.
|
|
173
206
|
|
|
174
|
-
###
|
|
207
|
+
### Modal
|
|
175
208
|
|
|
176
209
|
```html
|
|
177
|
-
<
|
|
178
|
-
|
|
179
|
-
|
|
210
|
+
<button data-modal-open="my-modal">Open</button>
|
|
211
|
+
|
|
212
|
+
<div id="my-modal" class="pp-modal-backdrop"
|
|
213
|
+
role="dialog" aria-modal="true"
|
|
214
|
+
aria-labelledby="my-modal-title"
|
|
215
|
+
aria-describedby="my-modal-desc"
|
|
216
|
+
aria-hidden="true">
|
|
217
|
+
<div class="pp-modal">
|
|
218
|
+
<button class="pp-modal__close" data-modal-close="my-modal" aria-label="Close">✕</button>
|
|
219
|
+
<p class="pp-modal__title" id="my-modal-title">Title</p>
|
|
220
|
+
<p class="pp-modal__description" id="my-modal-desc">Description text.</p>
|
|
221
|
+
<ul class="pp-modal__actions">
|
|
222
|
+
<li><button class="pp-modal__action">Action</button></li>
|
|
223
|
+
<li><button class="pp-modal__action pp-modal__action--cancel" data-modal-close="my-modal">Cancel</button></li>
|
|
224
|
+
</ul>
|
|
180
225
|
</div>
|
|
181
|
-
</
|
|
226
|
+
</div>
|
|
227
|
+
<script src="dist/modal.js" defer></script>
|
|
182
228
|
```
|
|
183
229
|
|
|
184
|
-
|
|
230
|
+
JS adds focus trap, focus restore on close, and Escape key support. `window.ppModal.open(id)` / `.close(id)` / `.closeAll()` available globally.
|
|
231
|
+
|
|
232
|
+
### Select
|
|
233
|
+
|
|
234
|
+
```html
|
|
235
|
+
<div class="pp-select">
|
|
236
|
+
<button class="pp-select__trigger" type="button">
|
|
237
|
+
<span class="pp-select__value">Choose…</span>
|
|
238
|
+
<span class="pp-select__chevron"></span>
|
|
239
|
+
</button>
|
|
240
|
+
<ul class="pp-select__panel" role="listbox">
|
|
241
|
+
<li><button class="pp-select__option" data-value="a" role="option">Option A</button></li>
|
|
242
|
+
<li><button class="pp-select__option" data-value="b" role="option">Option B</button></li>
|
|
243
|
+
</ul>
|
|
244
|
+
</div>
|
|
245
|
+
<script src="dist/select.js" defer></script>
|
|
246
|
+
```
|
|
247
|
+
|
|
248
|
+
Sizes: `.pp-select--sm` · `.pp-select--lg`
|
|
249
|
+
|
|
250
|
+
### Tabs
|
|
251
|
+
|
|
252
|
+
```html
|
|
253
|
+
<div class="pp-tabs" role="tablist">
|
|
254
|
+
<button class="pp-tabs__item is-active" role="tab" aria-selected="true">Tab 1</button>
|
|
255
|
+
<button class="pp-tabs__item" role="tab" aria-selected="false">Tab 2</button>
|
|
256
|
+
</div>
|
|
257
|
+
<!-- optional panels -->
|
|
258
|
+
<div data-tab-panel="tab1" role="tabpanel">Panel 1</div>
|
|
259
|
+
<div data-tab-panel="tab2" role="tabpanel" hidden>Panel 2</div>
|
|
260
|
+
<script src="dist/tabs.js" defer></script>
|
|
261
|
+
```
|
|
262
|
+
|
|
263
|
+
Variants: default · `.pp-tabs--outline` · `.pp-tabs--gradient` · `.pp-tabs--gradient-outline`
|
|
264
|
+
Sizes: `.pp-tabs--sm` · `.pp-tabs--lg`
|
|
265
|
+
Keyboard: `←` / `→` arrows, `Home`, `End`.
|
|
185
266
|
|
|
186
267
|
### Table
|
|
187
268
|
|
|
@@ -194,7 +275,46 @@ Variants: `pp-section--primary` · `pp-section--dark` · `pp-section--muted` ·
|
|
|
194
275
|
```
|
|
195
276
|
|
|
196
277
|
Column helpers: `.pp-table--cols-1` → `.pp-table--cols-4`
|
|
197
|
-
|
|
278
|
+
|
|
279
|
+
### Section
|
|
280
|
+
|
|
281
|
+
```html
|
|
282
|
+
<section class="pp-section">
|
|
283
|
+
<div class="pp-section__inner">
|
|
284
|
+
<!-- content -->
|
|
285
|
+
</div>
|
|
286
|
+
</section>
|
|
287
|
+
```
|
|
288
|
+
|
|
289
|
+
Variants: `pp-section--primary` · `pp-section--dark` · `pp-section--muted` · `pp-section--gradient`
|
|
290
|
+
|
|
291
|
+
---
|
|
292
|
+
|
|
293
|
+
## Changelog
|
|
294
|
+
|
|
295
|
+
### v0.2.0 — 2026-06-01
|
|
296
|
+
|
|
297
|
+
**Accessibility (ARIA) — full pass across all components**
|
|
298
|
+
|
|
299
|
+
- **Header:** `role="menubar"` on nav list, `role="menu"` on dropdowns, `role="menuitem"` on all links and dropdown items, `role="none"` on `<li>` wrappers; `aria-haspopup` + `aria-expanded` on dropdown triggers; `aria-controls` wired to dropdown `id`s; `aria-hidden` toggled on mobile nav drawer; `aria-label` on `<nav>`.
|
|
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.
|
|
305
|
+
|
|
306
|
+
**Page structure**
|
|
307
|
+
|
|
308
|
+
- Section order updated: Hero → Colors → Typography → Components (A→Z).
|
|
309
|
+
|
|
310
|
+
---
|
|
311
|
+
|
|
312
|
+
### v0.1.1
|
|
313
|
+
|
|
314
|
+
- Initial release with: reset, base tokens, button, card, gradient, header, modal, section, select, table, tabs, typography.
|
|
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.
|
|
198
318
|
|
|
199
319
|
---
|
|
200
320
|
|
package/build.js
CHANGED
|
@@ -1,23 +1,33 @@
|
|
|
1
|
-
// PeppertinoCSS — esbuild bundler (per-component
|
|
1
|
+
// PeppertinoCSS — esbuild bundler (per-component + aggregator)
|
|
2
2
|
const esbuild = require('esbuild');
|
|
3
3
|
const path = require('path');
|
|
4
4
|
const fs = require('fs');
|
|
5
5
|
|
|
6
6
|
const isWatch = process.argv.includes('--watch');
|
|
7
7
|
|
|
8
|
+
const AGGREGATOR = 'src/js/peppertino.js';
|
|
9
|
+
|
|
10
|
+
// Per-component entries (everything except the aggregator)
|
|
8
11
|
const components = fs
|
|
9
12
|
.readdirSync('src/js')
|
|
10
|
-
.filter((f) => f.endsWith('.js'))
|
|
13
|
+
.filter((f) => f.endsWith('.js') && f !== 'peppertino.js')
|
|
11
14
|
.map((f) => path.join('src/js', f));
|
|
12
15
|
|
|
13
|
-
|
|
14
|
-
console.log('[esbuild] No JS components found in src/js/ — skipping.');
|
|
15
|
-
process.exit(0);
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
const buildOptions = {
|
|
16
|
+
const componentOptions = {
|
|
19
17
|
entryPoints: components,
|
|
20
18
|
outdir: 'dist',
|
|
19
|
+
bundle: false,
|
|
20
|
+
format: 'iife',
|
|
21
|
+
platform: 'browser',
|
|
22
|
+
target: ['es2018'],
|
|
23
|
+
sourcemap: true,
|
|
24
|
+
minify: false,
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
// Aggregator — bundled single file
|
|
28
|
+
const aggregatorOptions = {
|
|
29
|
+
entryPoints: [AGGREGATOR],
|
|
30
|
+
outfile: 'dist/peppertino.js',
|
|
21
31
|
bundle: true,
|
|
22
32
|
format: 'iife',
|
|
23
33
|
platform: 'browser',
|
|
@@ -27,12 +37,17 @@ const buildOptions = {
|
|
|
27
37
|
};
|
|
28
38
|
|
|
29
39
|
if (isWatch) {
|
|
30
|
-
|
|
31
|
-
ctx.watch()
|
|
40
|
+
Promise.all([
|
|
41
|
+
esbuild.context(componentOptions).then((ctx) => ctx.watch()),
|
|
42
|
+
esbuild.context(aggregatorOptions).then((ctx) => ctx.watch()),
|
|
43
|
+
]).then(() => {
|
|
32
44
|
console.log('[esbuild] Watching src/js/ for changes...');
|
|
33
45
|
});
|
|
34
46
|
} else {
|
|
35
|
-
|
|
36
|
-
|
|
47
|
+
Promise.all([
|
|
48
|
+
esbuild.build(componentOptions),
|
|
49
|
+
esbuild.build(aggregatorOptions),
|
|
50
|
+
]).then(() => {
|
|
51
|
+
console.log(`[esbuild] Built ${components.length} component(s) + peppertino.js → dist/`);
|
|
37
52
|
});
|
|
38
53
|
}
|
package/dist/header.js
ADDED
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
(() => {
|
|
2
|
+
(function() {
|
|
3
|
+
function initHeader(header) {
|
|
4
|
+
const toggle = header.querySelector(".pp-header__toggle");
|
|
5
|
+
const nav = header.querySelector(".pp-header__nav");
|
|
6
|
+
header.querySelectorAll(".pp-header__dropdown").forEach((d) => {
|
|
7
|
+
d.classList.add("is-js-controlled");
|
|
8
|
+
});
|
|
9
|
+
if (toggle && nav) {
|
|
10
|
+
toggle.addEventListener("click", (e) => {
|
|
11
|
+
e.stopPropagation();
|
|
12
|
+
const isOpen = nav.classList.toggle("is-open");
|
|
13
|
+
toggle.setAttribute("aria-expanded", String(isOpen));
|
|
14
|
+
});
|
|
15
|
+
document.addEventListener("click", (e) => {
|
|
16
|
+
if (!header.contains(e.target)) {
|
|
17
|
+
nav.classList.remove("is-open");
|
|
18
|
+
toggle.setAttribute("aria-expanded", "false");
|
|
19
|
+
}
|
|
20
|
+
});
|
|
21
|
+
}
|
|
22
|
+
header.querySelectorAll(".pp-header__nav-item").forEach((item) => {
|
|
23
|
+
const dropdown = item.querySelector(".pp-header__dropdown");
|
|
24
|
+
if (!dropdown) return;
|
|
25
|
+
item.addEventListener("click", (e) => {
|
|
26
|
+
if (window.innerWidth >= 768) return;
|
|
27
|
+
e.stopPropagation();
|
|
28
|
+
item.classList.toggle("is-open");
|
|
29
|
+
});
|
|
30
|
+
});
|
|
31
|
+
window.addEventListener("resize", () => {
|
|
32
|
+
if (window.innerWidth >= 768) {
|
|
33
|
+
nav == null ? void 0 : nav.classList.remove("is-open");
|
|
34
|
+
toggle == null ? void 0 : toggle.setAttribute("aria-expanded", "false");
|
|
35
|
+
header.querySelectorAll(".pp-header__nav-item").forEach((i) => i.classList.remove("is-open"));
|
|
36
|
+
}
|
|
37
|
+
});
|
|
38
|
+
}
|
|
39
|
+
document.querySelectorAll(".pp-header").forEach(initHeader);
|
|
40
|
+
})();
|
|
41
|
+
})();
|
|
42
|
+
//# sourceMappingURL=header.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../src/js/header.js"],
|
|
4
|
+
"sourcesContent": ["(function () {\n function initHeader(header) {\n const toggle = header.querySelector('.pp-header__toggle');\n const nav = header.querySelector('.pp-header__nav');\n\n // Signal CSS that JS controls mobile dropdowns\n header.querySelectorAll('.pp-header__dropdown').forEach((d) => {\n d.classList.add('is-js-controlled');\n });\n\n // Mobile hamburger\n if (toggle && nav) {\n toggle.addEventListener('click', (e) => {\n e.stopPropagation();\n const isOpen = nav.classList.toggle('is-open');\n toggle.setAttribute('aria-expanded', String(isOpen));\n });\n\n // Close drawer on outside click\n document.addEventListener('click', (e) => {\n if (!header.contains(e.target)) {\n nav.classList.remove('is-open');\n toggle.setAttribute('aria-expanded', 'false');\n }\n });\n }\n\n // Mobile: tap to expand dropdown items\n header.querySelectorAll('.pp-header__nav-item').forEach((item) => {\n const dropdown = item.querySelector('.pp-header__dropdown');\n if (!dropdown) return;\n\n item.addEventListener('click', (e) => {\n if (window.innerWidth >= 768) return;\n e.stopPropagation();\n item.classList.toggle('is-open');\n });\n });\n\n // Reset on resize to desktop\n window.addEventListener('resize', () => {\n if (window.innerWidth >= 768) {\n nav?.classList.remove('is-open');\n toggle?.setAttribute('aria-expanded', 'false');\n header.querySelectorAll('.pp-header__nav-item').forEach((i) => i.classList.remove('is-open'));\n }\n });\n }\n\n document.querySelectorAll('.pp-header').forEach(initHeader);\n})();\n"],
|
|
5
|
+
"mappings": ";AAAA,GAAC,WAAY;AACX,aAAS,WAAW,QAAQ;AAC1B,YAAM,SAAS,OAAO,cAAc,oBAAoB;AACxD,YAAM,MAAM,OAAO,cAAc,iBAAiB;AAGlD,aAAO,iBAAiB,sBAAsB,EAAE,QAAQ,CAAC,MAAM;AAC7D,UAAE,UAAU,IAAI,kBAAkB;AAAA,MACpC,CAAC;AAGD,UAAI,UAAU,KAAK;AACjB,eAAO,iBAAiB,SAAS,CAAC,MAAM;AACtC,YAAE,gBAAgB;AAClB,gBAAM,SAAS,IAAI,UAAU,OAAO,SAAS;AAC7C,iBAAO,aAAa,iBAAiB,OAAO,MAAM,CAAC;AAAA,QACrD,CAAC;AAGD,iBAAS,iBAAiB,SAAS,CAAC,MAAM;AACxC,cAAI,CAAC,OAAO,SAAS,EAAE,MAAM,GAAG;AAC9B,gBAAI,UAAU,OAAO,SAAS;AAC9B,mBAAO,aAAa,iBAAiB,OAAO;AAAA,UAC9C;AAAA,QACF,CAAC;AAAA,MACH;AAGA,aAAO,iBAAiB,sBAAsB,EAAE,QAAQ,CAAC,SAAS;AAChE,cAAM,WAAW,KAAK,cAAc,sBAAsB;AAC1D,YAAI,CAAC,SAAU;AAEf,aAAK,iBAAiB,SAAS,CAAC,MAAM;AACpC,cAAI,OAAO,cAAc,IAAK;AAC9B,YAAE,gBAAgB;AAClB,eAAK,UAAU,OAAO,SAAS;AAAA,QACjC,CAAC;AAAA,MACH,CAAC;AAGD,aAAO,iBAAiB,UAAU,MAAM;AACtC,YAAI,OAAO,cAAc,KAAK;AAC5B,qCAAK,UAAU,OAAO;AACtB,2CAAQ,aAAa,iBAAiB;AACtC,iBAAO,iBAAiB,sBAAsB,EAAE,QAAQ,CAAC,MAAM,EAAE,UAAU,OAAO,SAAS,CAAC;AAAA,QAC9F;AAAA,MACF,CAAC;AAAA,IACH;AAEA,aAAS,iBAAiB,YAAY,EAAE,QAAQ,UAAU;AAAA,EAC5D,GAAG;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|