@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/index.html
CHANGED
|
@@ -5,7 +5,9 @@
|
|
|
5
5
|
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
6
6
|
<title>PeppertinoCSS — Dev Sandbox</title>
|
|
7
7
|
<link rel="stylesheet" href="dist/main.css" />
|
|
8
|
-
<script src="dist/
|
|
8
|
+
<script src="https://cdn.jsdelivr.net/npm/feather-icons/dist/feather.min.js"></script>
|
|
9
|
+
<script src="dist/peppertino.js" defer></script>
|
|
10
|
+
<script>document.addEventListener('DOMContentLoaded', () => feather.replace());</script>
|
|
9
11
|
<style>
|
|
10
12
|
/* Sandbox-only helpers — not part of the framework */
|
|
11
13
|
.row { display: flex; flex-wrap: wrap; gap: 0.5rem; align-items: center; justify-content: center; }
|
|
@@ -16,20 +18,24 @@
|
|
|
16
18
|
|
|
17
19
|
<header class="pp-header">
|
|
18
20
|
<a href="#hero" class="pp-header__brand font-sans font-600">PeppertinoCSS</a>
|
|
19
|
-
<nav>
|
|
20
|
-
<ul class="pp-header__nav">
|
|
21
|
-
<li class="pp-header__nav-item">
|
|
22
|
-
<a href="#colors" class="pp-header__nav-link font-sans font-400">Colors</a>
|
|
21
|
+
<nav aria-label="Main navigation">
|
|
22
|
+
<ul class="pp-header__nav" role="menubar">
|
|
23
|
+
<li class="pp-header__nav-item" role="none">
|
|
24
|
+
<a href="#colors" class="pp-header__nav-link font-sans font-400" role="menuitem">Colors</a>
|
|
23
25
|
</li>
|
|
24
|
-
<li class="pp-header__nav-item">
|
|
25
|
-
<a href="#typography" class="pp-header__nav-link font-sans font-400">Typography</a>
|
|
26
|
+
<li class="pp-header__nav-item" role="none">
|
|
27
|
+
<a href="#typography" class="pp-header__nav-link font-sans font-400" role="menuitem">Typography</a>
|
|
26
28
|
</li>
|
|
27
|
-
<li class="pp-header__nav-item">
|
|
28
|
-
<a href="#components" class="pp-header__nav-link font-sans font-400">Components</a>
|
|
29
|
-
<ul class="pp-header__dropdown">
|
|
30
|
-
<li><a href="#buttons"
|
|
31
|
-
<li><a href="#
|
|
32
|
-
<li><a href="#
|
|
29
|
+
<li class="pp-header__nav-item" role="none">
|
|
30
|
+
<a href="#components" class="pp-header__nav-link font-sans font-400" role="menuitem" aria-haspopup="true" aria-expanded="false">Components</a>
|
|
31
|
+
<ul class="pp-header__dropdown" role="menu" aria-label="Components">
|
|
32
|
+
<li role="none"><a href="#buttons" class="pp-header__dropdown-link font-sans font-400" role="menuitem">Buttons</a></li>
|
|
33
|
+
<li role="none"><a href="#cards" class="pp-header__dropdown-link font-sans font-400" role="menuitem">Cards</a></li>
|
|
34
|
+
<li role="none"><a href="#gradient" class="pp-header__dropdown-link font-sans font-400" role="menuitem">Gradient</a></li>
|
|
35
|
+
<li role="none"><a href="#modals" class="pp-header__dropdown-link font-sans font-400" role="menuitem">Modals</a></li>
|
|
36
|
+
<li role="none"><a href="#selects" class="pp-header__dropdown-link font-sans font-400" role="menuitem">Selects</a></li>
|
|
37
|
+
<li role="none"><a href="#tabs" class="pp-header__dropdown-link font-sans font-400" role="menuitem">Tabs</a></li>
|
|
38
|
+
<li role="none"><a href="#tables" class="pp-header__dropdown-link font-sans font-400" role="menuitem">Tables</a></li>
|
|
33
39
|
</ul>
|
|
34
40
|
</li>
|
|
35
41
|
</ul>
|
|
@@ -52,7 +58,7 @@
|
|
|
52
58
|
</section>
|
|
53
59
|
|
|
54
60
|
<!-- Colors -->
|
|
55
|
-
<section id="colors" class="pp-section
|
|
61
|
+
<section id="colors" class="pp-section">
|
|
56
62
|
<div class="pp-section__inner">
|
|
57
63
|
<h2 class="font-sans font-700 tracking-tight">Color Palette</h2>
|
|
58
64
|
|
|
@@ -64,7 +70,6 @@
|
|
|
64
70
|
<span class="swatch" style="background:#a8000c" title="primary-dark"></span>
|
|
65
71
|
</div>
|
|
66
72
|
</div>
|
|
67
|
-
|
|
68
73
|
<div>
|
|
69
74
|
<p class="font-sans font-500 text-xs uppercase tracking-wider" style="color:#71717a;">Gradient</p>
|
|
70
75
|
<div class="row">
|
|
@@ -73,7 +78,6 @@
|
|
|
73
78
|
<span class="swatch" style="background:linear-gradient(135deg,#ffcf67,#ea5753)" title="gradient"></span>
|
|
74
79
|
</div>
|
|
75
80
|
</div>
|
|
76
|
-
|
|
77
81
|
<div>
|
|
78
82
|
<p class="font-sans font-500 text-xs uppercase tracking-wider" style="color:#71717a;">Neutrals</p>
|
|
79
83
|
<div class="row">
|
|
@@ -89,7 +93,6 @@
|
|
|
89
93
|
<span class="swatch" style="background:#18181b"></span>
|
|
90
94
|
</div>
|
|
91
95
|
</div>
|
|
92
|
-
|
|
93
96
|
<div>
|
|
94
97
|
<p class="font-sans font-500 text-xs uppercase tracking-wider" style="color:#71717a;">Semantic</p>
|
|
95
98
|
<div class="row">
|
|
@@ -160,11 +163,80 @@ const greet = (name) => `Hello, ${name}!`;</code></pre>
|
|
|
160
163
|
|
|
161
164
|
<!-- Buttons -->
|
|
162
165
|
<section id="buttons" class="pp-section">
|
|
163
|
-
<div class="pp-section__inner">
|
|
166
|
+
<div class="pp-section__inner" style="align-items:flex-start;">
|
|
164
167
|
<h2 class="font-sans font-700 tracking-tight">Buttons</h2>
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
+
|
|
169
|
+
<p class="font-sans font-500 text-xs uppercase tracking-wider" style="color:#71717a;">Filled</p>
|
|
170
|
+
<div class="row" style="justify-content:flex-start;">
|
|
171
|
+
<button class="button font-sans">Primary</button>
|
|
172
|
+
<button class="button-success font-sans">Success</button>
|
|
173
|
+
<button class="button-warning font-sans">Warning</button>
|
|
174
|
+
<button class="button-error font-sans">Error</button>
|
|
175
|
+
<button class="button-dark font-sans">Dark</button>
|
|
176
|
+
<button class="button-gradient font-sans">Gradient</button>
|
|
177
|
+
<button class="button-ghost font-sans">Ghost</button>
|
|
178
|
+
</div>
|
|
179
|
+
|
|
180
|
+
<p class="font-sans font-500 text-xs uppercase tracking-wider" style="color:#71717a;margin-top:1.5rem;">Outline</p>
|
|
181
|
+
<div class="row" style="justify-content:flex-start;">
|
|
182
|
+
<button class="button-outline font-sans">Primary</button>
|
|
183
|
+
<button class="button-outline-success font-sans">Success</button>
|
|
184
|
+
<button class="button-outline-warning font-sans">Warning</button>
|
|
185
|
+
<button class="button-outline-error font-sans">Error</button>
|
|
186
|
+
<button class="button-outline-dark font-sans">Dark</button>
|
|
187
|
+
</div>
|
|
188
|
+
</div>
|
|
189
|
+
</section>
|
|
190
|
+
|
|
191
|
+
<!-- Cards -->
|
|
192
|
+
<section id="cards" class="pp-section pp-section--muted">
|
|
193
|
+
<div class="pp-section__inner" style="max-width:1100px;">
|
|
194
|
+
<h2 class="font-sans font-700 tracking-tight">Cards</h2>
|
|
195
|
+
|
|
196
|
+
<div class="pp-card-grid pp-card-grid--3">
|
|
197
|
+
<div class="pp-card">
|
|
198
|
+
<p class="pp-card__eyebrow">Framework</p>
|
|
199
|
+
<p class="pp-card__title">Clean by default</p>
|
|
200
|
+
<p class="pp-card__body">White background, subtle shadow, 16px radius. The base card — works for anything.</p>
|
|
201
|
+
<div class="pp-card__footer">
|
|
202
|
+
<button class="button font-sans font-400">Learn more</button>
|
|
203
|
+
</div>
|
|
204
|
+
</div>
|
|
205
|
+
<div class="pp-card pp-card--dark">
|
|
206
|
+
<p class="pp-card__eyebrow">Dark variant</p>
|
|
207
|
+
<p class="pp-card__title">Midnight surface</p>
|
|
208
|
+
<p class="pp-card__body">Deep neutral background with a primary-light eyebrow. Pairs well with dark sections.</p>
|
|
209
|
+
<div class="pp-card__footer">
|
|
210
|
+
<button class="button font-sans font-400">Learn more</button>
|
|
211
|
+
</div>
|
|
212
|
+
</div>
|
|
213
|
+
<div class="pp-card pp-card--gradient">
|
|
214
|
+
<p class="pp-card__eyebrow">Gradient variant</p>
|
|
215
|
+
<p class="pp-card__title">A little spice</p>
|
|
216
|
+
<p class="pp-card__body">The signature PeppertinoCSS gradient — warm gold to red. Use sparingly for emphasis.</p>
|
|
217
|
+
<div class="pp-card__footer">
|
|
218
|
+
<button class="button font-sans font-400" style="background:#fff;color:#ea5753;">Learn more</button>
|
|
219
|
+
</div>
|
|
220
|
+
</div>
|
|
221
|
+
</div>
|
|
222
|
+
|
|
223
|
+
<div class="pp-card-grid pp-card-grid--2" style="margin-top:1.5rem;">
|
|
224
|
+
<div class="pp-card pp-card--primary">
|
|
225
|
+
<p class="pp-card__eyebrow">Primary variant</p>
|
|
226
|
+
<p class="pp-card__title">Solid red card</p>
|
|
227
|
+
<p class="pp-card__body">Full primary background. Strong call-to-action surface — use for featured content.</p>
|
|
228
|
+
<div class="pp-card__footer">
|
|
229
|
+
<button class="button-outline font-sans font-400" style="border-color:rgba(255,255,255,0.5);color:#fff;">Explore</button>
|
|
230
|
+
</div>
|
|
231
|
+
</div>
|
|
232
|
+
<div class="pp-card pp-card--ghost">
|
|
233
|
+
<p class="pp-card__eyebrow">Ghost variant</p>
|
|
234
|
+
<p class="pp-card__title">Transparent surface</p>
|
|
235
|
+
<p class="pp-card__body">No background, border only. Fills white and gains a shadow on hover. Great for secondary content.</p>
|
|
236
|
+
<div class="pp-card__footer">
|
|
237
|
+
<button class="button-outline font-sans font-400">Explore</button>
|
|
238
|
+
</div>
|
|
239
|
+
</div>
|
|
168
240
|
</div>
|
|
169
241
|
</div>
|
|
170
242
|
</section>
|
|
@@ -178,6 +250,166 @@ const greet = (name) => `Hello, ${name}!`;</code></pre>
|
|
|
178
250
|
</div>
|
|
179
251
|
</section>
|
|
180
252
|
|
|
253
|
+
<!-- Modals -->
|
|
254
|
+
<section id="modals" class="pp-section pp-section--dark">
|
|
255
|
+
<div class="pp-section__inner">
|
|
256
|
+
<h2 class="font-sans font-700 tracking-tight" style="color:#fff;">Modals</h2>
|
|
257
|
+
<p class="font-sans font-400 text-sm" style="color:rgba(255,255,255,0.6);">Glassmorphic backdrop blur with frosted container.</p>
|
|
258
|
+
<div class="row">
|
|
259
|
+
<button class="button font-sans" data-modal-open="modal-basic">Basic</button>
|
|
260
|
+
<button class="button font-sans" data-modal-open="modal-destructive">Destructive</button>
|
|
261
|
+
<button class="button-outline font-sans" style="border-color:rgba(255,255,255,0.4);color:#fff;" data-modal-open="modal-confirm">Confirm</button>
|
|
262
|
+
</div>
|
|
263
|
+
</div>
|
|
264
|
+
</section>
|
|
265
|
+
|
|
266
|
+
<!-- Modal: basic -->
|
|
267
|
+
<div id="modal-basic" class="pp-modal-backdrop" role="dialog" aria-modal="true" aria-labelledby="modal-basic-title" aria-describedby="modal-basic-desc" aria-hidden="true">
|
|
268
|
+
<div class="pp-modal">
|
|
269
|
+
<button class="pp-modal__close font-sans" data-modal-close="modal-basic" aria-label="Close">✕</button>
|
|
270
|
+
<p class="pp-modal__title font-sans" id="modal-basic-title">Action Title</p>
|
|
271
|
+
<p class="pp-modal__description font-sans" id="modal-basic-desc">A short description of the action you are about to take.</p>
|
|
272
|
+
<ul class="pp-modal__actions">
|
|
273
|
+
<li><button class="pp-modal__action font-sans">Action 1</button></li>
|
|
274
|
+
<li><button class="pp-modal__action font-sans">Action 2</button></li>
|
|
275
|
+
<li><button class="pp-modal__action font-sans">Action 3</button></li>
|
|
276
|
+
<li><button class="pp-modal__action pp-modal__action--cancel font-sans" data-modal-close="modal-basic">Cancel</button></li>
|
|
277
|
+
</ul>
|
|
278
|
+
</div>
|
|
279
|
+
</div>
|
|
280
|
+
|
|
281
|
+
<!-- Modal: destructive -->
|
|
282
|
+
<div id="modal-destructive" class="pp-modal-backdrop" role="dialog" aria-modal="true" aria-labelledby="modal-destructive-title" aria-describedby="modal-destructive-desc" aria-hidden="true">
|
|
283
|
+
<div class="pp-modal">
|
|
284
|
+
<button class="pp-modal__close font-sans" data-modal-close="modal-destructive" aria-label="Close">✕</button>
|
|
285
|
+
<p class="pp-modal__title font-sans" id="modal-destructive-title">Delete Item</p>
|
|
286
|
+
<p class="pp-modal__description font-sans" id="modal-destructive-desc">This action cannot be undone. The item will be permanently removed.</p>
|
|
287
|
+
<ul class="pp-modal__actions">
|
|
288
|
+
<li><button class="pp-modal__action pp-modal__action--destructive font-sans">Delete permanently</button></li>
|
|
289
|
+
<li><button class="pp-modal__action pp-modal__action--cancel font-sans" data-modal-close="modal-destructive">Cancel</button></li>
|
|
290
|
+
</ul>
|
|
291
|
+
</div>
|
|
292
|
+
</div>
|
|
293
|
+
|
|
294
|
+
<!-- Modal: confirm -->
|
|
295
|
+
<div id="modal-confirm" class="pp-modal-backdrop" role="dialog" aria-modal="true" aria-labelledby="modal-confirm-title" aria-describedby="modal-confirm-desc" aria-hidden="true">
|
|
296
|
+
<div class="pp-modal">
|
|
297
|
+
<button class="pp-modal__close font-sans" data-modal-close="modal-confirm" aria-label="Close">✕</button>
|
|
298
|
+
<p class="pp-modal__title font-sans" id="modal-confirm-title">Confirm Changes</p>
|
|
299
|
+
<p class="pp-modal__description font-sans" id="modal-confirm-desc">Save and publish your changes? They will be visible immediately.</p>
|
|
300
|
+
<ul class="pp-modal__actions">
|
|
301
|
+
<li><button class="pp-modal__action font-sans">Save & Publish</button></li>
|
|
302
|
+
<li><button class="pp-modal__action font-sans">Save as Draft</button></li>
|
|
303
|
+
<li><button class="pp-modal__action pp-modal__action--cancel font-sans" data-modal-close="modal-confirm">Discard</button></li>
|
|
304
|
+
</ul>
|
|
305
|
+
</div>
|
|
306
|
+
</div>
|
|
307
|
+
|
|
308
|
+
<!-- Selects -->
|
|
309
|
+
<section id="selects" class="pp-section">
|
|
310
|
+
<div class="pp-section__inner text-left" style="align-items:flex-start;max-width:560px;">
|
|
311
|
+
<h2 class="font-sans font-700 tracking-tight">Selects</h2>
|
|
312
|
+
|
|
313
|
+
<p class="font-sans font-500 text-xs uppercase tracking-wider" style="color:#71717a;">Native <select></p>
|
|
314
|
+
<select>
|
|
315
|
+
<option value="">Choose a framework</option>
|
|
316
|
+
<option value="peppertino">PeppertinoCSS</option>
|
|
317
|
+
<option value="tailwind">Tailwind</option>
|
|
318
|
+
<option value="bootstrap">Bootstrap</option>
|
|
319
|
+
</select>
|
|
320
|
+
|
|
321
|
+
<p class="font-sans font-500 text-xs uppercase tracking-wider" style="color:#71717a;margin-top:2rem;">Custom .pp-select</p>
|
|
322
|
+
<div class="pp-select">
|
|
323
|
+
<button class="pp-select__trigger font-sans" type="button">
|
|
324
|
+
<span class="pp-select__value">Choose a color</span>
|
|
325
|
+
<span class="pp-select__chevron"></span>
|
|
326
|
+
</button>
|
|
327
|
+
<ul class="pp-select__panel" role="listbox">
|
|
328
|
+
<li><button class="pp-select__option font-sans" data-value="primary" role="option">Primary Red</button></li>
|
|
329
|
+
<li><button class="pp-select__option font-sans" data-value="gradient-start" role="option">Gradient Gold</button></li>
|
|
330
|
+
<li><button class="pp-select__option font-sans" data-value="gradient-end" role="option">Gradient Red</button></li>
|
|
331
|
+
<li class="pp-select__divider"></li>
|
|
332
|
+
<span class="pp-select__group-label font-sans">Neutrals</span>
|
|
333
|
+
<li><button class="pp-select__option font-sans" data-value="light" role="option">Light</button></li>
|
|
334
|
+
<li><button class="pp-select__option font-sans is-selected" data-value="dark" role="option">Dark</button></li>
|
|
335
|
+
</ul>
|
|
336
|
+
</div>
|
|
337
|
+
|
|
338
|
+
<p class="font-sans font-500 text-xs uppercase tracking-wider" style="color:#71717a;margin-top:2rem;">Sizes</p>
|
|
339
|
+
<div class="pp-select pp-select--sm" style="margin-bottom:1rem;">
|
|
340
|
+
<button class="pp-select__trigger font-sans" type="button">
|
|
341
|
+
<span class="pp-select__value">Small</span>
|
|
342
|
+
<span class="pp-select__chevron"></span>
|
|
343
|
+
</button>
|
|
344
|
+
<ul class="pp-select__panel" role="listbox">
|
|
345
|
+
<li><button class="pp-select__option font-sans" role="option">Option A</button></li>
|
|
346
|
+
<li><button class="pp-select__option font-sans" role="option">Option B</button></li>
|
|
347
|
+
</ul>
|
|
348
|
+
</div>
|
|
349
|
+
<div class="pp-select pp-select--lg">
|
|
350
|
+
<button class="pp-select__trigger font-sans" type="button">
|
|
351
|
+
<span class="pp-select__value">Large</span>
|
|
352
|
+
<span class="pp-select__chevron"></span>
|
|
353
|
+
</button>
|
|
354
|
+
<ul class="pp-select__panel" role="listbox">
|
|
355
|
+
<li><button class="pp-select__option font-sans" role="option">Option A</button></li>
|
|
356
|
+
<li><button class="pp-select__option font-sans" role="option">Option B</button></li>
|
|
357
|
+
</ul>
|
|
358
|
+
</div>
|
|
359
|
+
</div>
|
|
360
|
+
</section>
|
|
361
|
+
|
|
362
|
+
<!-- Tabs -->
|
|
363
|
+
<section id="tabs" class="pp-section pp-section--dark">
|
|
364
|
+
<div class="pp-section__inner">
|
|
365
|
+
<h2 class="font-sans font-700 tracking-tight" style="color:#fff;">Tabs</h2>
|
|
366
|
+
|
|
367
|
+
<p class="font-sans font-500 text-xs uppercase tracking-wider" style="color:rgba(255,255,255,0.6);">Normal (filled primary)</p>
|
|
368
|
+
<div class="pp-tabs" role="tablist">
|
|
369
|
+
<button class="pp-tabs__item is-active font-sans" role="tab" aria-selected="true"><i data-feather="home"></i>Home</button>
|
|
370
|
+
<button class="pp-tabs__item font-sans" role="tab" aria-selected="false"><i data-feather="star"></i>Starred</button>
|
|
371
|
+
<button class="pp-tabs__item font-sans" role="tab" aria-selected="false"><i data-feather="settings"></i>Settings</button>
|
|
372
|
+
<button class="pp-tabs__item font-sans" role="tab" aria-selected="false"><i data-feather="user"></i>Profile</button>
|
|
373
|
+
</div>
|
|
374
|
+
|
|
375
|
+
<p class="font-sans font-500 text-xs uppercase tracking-wider" style="color:rgba(255,255,255,0.6);margin-top:2rem;">Outline</p>
|
|
376
|
+
<div class="pp-tabs pp-tabs--outline" role="tablist">
|
|
377
|
+
<button class="pp-tabs__item is-active font-sans" role="tab" aria-selected="true"><i data-feather="home"></i>Home</button>
|
|
378
|
+
<button class="pp-tabs__item font-sans" role="tab" aria-selected="false"><i data-feather="star"></i>Starred</button>
|
|
379
|
+
<button class="pp-tabs__item font-sans" role="tab" aria-selected="false"><i data-feather="settings"></i>Settings</button>
|
|
380
|
+
<button class="pp-tabs__item font-sans" role="tab" aria-selected="false"><i data-feather="user"></i>Profile</button>
|
|
381
|
+
</div>
|
|
382
|
+
|
|
383
|
+
<p class="font-sans font-500 text-xs uppercase tracking-wider" style="color:rgba(255,255,255,0.6);margin-top:2rem;">Gradient</p>
|
|
384
|
+
<div class="pp-tabs pp-tabs--gradient" role="tablist">
|
|
385
|
+
<button class="pp-tabs__item is-active font-sans" role="tab" aria-selected="true"><i data-feather="zap"></i>Speed</button>
|
|
386
|
+
<button class="pp-tabs__item font-sans" role="tab" aria-selected="false"><i data-feather="shield"></i>Security</button>
|
|
387
|
+
<button class="pp-tabs__item font-sans" role="tab" aria-selected="false"><i data-feather="layers"></i>Design</button>
|
|
388
|
+
<button class="pp-tabs__item font-sans" role="tab" aria-selected="false"><i data-feather="cpu"></i>System</button>
|
|
389
|
+
</div>
|
|
390
|
+
|
|
391
|
+
<p class="font-sans font-500 text-xs uppercase tracking-wider" style="color:rgba(255,255,255,0.6);margin-top:2rem;">Gradient Outline</p>
|
|
392
|
+
<div class="pp-tabs pp-tabs--gradient-outline" role="tablist">
|
|
393
|
+
<button class="pp-tabs__item is-active font-sans" role="tab" aria-selected="true"><i data-feather="zap"></i>Speed</button>
|
|
394
|
+
<button class="pp-tabs__item font-sans" role="tab" aria-selected="false"><i data-feather="shield"></i>Security</button>
|
|
395
|
+
<button class="pp-tabs__item font-sans" role="tab" aria-selected="false"><i data-feather="layers"></i>Design</button>
|
|
396
|
+
<button class="pp-tabs__item font-sans" role="tab" aria-selected="false"><i data-feather="cpu"></i>System</button>
|
|
397
|
+
</div>
|
|
398
|
+
|
|
399
|
+
<p class="font-sans font-500 text-xs uppercase tracking-wider" style="color:rgba(255,255,255,0.6);margin-top:2rem;">Sizes — sm / lg</p>
|
|
400
|
+
<div class="pp-tabs pp-tabs--sm" role="tablist" style="margin-bottom:1rem;">
|
|
401
|
+
<button class="pp-tabs__item is-active font-sans" role="tab" aria-selected="true"><i data-feather="home"></i>Home</button>
|
|
402
|
+
<button class="pp-tabs__item font-sans" role="tab" aria-selected="false"><i data-feather="search"></i>Search</button>
|
|
403
|
+
<button class="pp-tabs__item font-sans" role="tab" aria-selected="false"><i data-feather="bell"></i>Alerts</button>
|
|
404
|
+
</div>
|
|
405
|
+
<div class="pp-tabs pp-tabs--lg" role="tablist">
|
|
406
|
+
<button class="pp-tabs__item is-active font-sans" role="tab" aria-selected="true"><i data-feather="home"></i>Home</button>
|
|
407
|
+
<button class="pp-tabs__item font-sans" role="tab" aria-selected="false"><i data-feather="search"></i>Search</button>
|
|
408
|
+
<button class="pp-tabs__item font-sans" role="tab" aria-selected="false"><i data-feather="bell"></i>Alerts</button>
|
|
409
|
+
</div>
|
|
410
|
+
</div>
|
|
411
|
+
</section>
|
|
412
|
+
|
|
181
413
|
<!-- Tables -->
|
|
182
414
|
<section id="tables" class="pp-section">
|
|
183
415
|
<div class="pp-section__inner text-left" style="align-items:flex-start;max-width:1100px;">
|
|
@@ -214,5 +446,6 @@ const greet = (name) => `Hello, ${name}!`;</code></pre>
|
|
|
214
446
|
</div>
|
|
215
447
|
</section>
|
|
216
448
|
|
|
449
|
+
|
|
217
450
|
</body>
|
|
218
451
|
</html>
|
package/package.json
CHANGED
package/src/js/header.js
CHANGED
|
@@ -3,11 +3,42 @@
|
|
|
3
3
|
const toggle = header.querySelector('.pp-header__toggle');
|
|
4
4
|
const nav = header.querySelector('.pp-header__nav');
|
|
5
5
|
|
|
6
|
+
// Signal CSS that JS controls mobile dropdowns
|
|
7
|
+
header.querySelectorAll('.pp-header__dropdown').forEach((d, i) => {
|
|
8
|
+
d.classList.add('is-js-controlled');
|
|
9
|
+
// Ensure each dropdown has an id for aria-controls
|
|
10
|
+
if (!d.id) d.id = `pp-dropdown-${i}`;
|
|
11
|
+
});
|
|
12
|
+
|
|
13
|
+
// Wire up nav-item toggles with aria
|
|
14
|
+
header.querySelectorAll('.pp-header__nav-item').forEach((item) => {
|
|
15
|
+
const dropdown = item.querySelector('.pp-header__dropdown');
|
|
16
|
+
if (!dropdown) return;
|
|
17
|
+
|
|
18
|
+
const link = item.querySelector('.pp-header__nav-link');
|
|
19
|
+
if (link) {
|
|
20
|
+
link.setAttribute('aria-haspopup', 'true');
|
|
21
|
+
link.setAttribute('aria-expanded', 'false');
|
|
22
|
+
if (dropdown.id) link.setAttribute('aria-controls', dropdown.id);
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
dropdown.setAttribute('role', 'menu');
|
|
26
|
+
dropdown.querySelectorAll('.pp-header__dropdown-link').forEach((a) => {
|
|
27
|
+
a.setAttribute('role', 'menuitem');
|
|
28
|
+
});
|
|
29
|
+
});
|
|
30
|
+
|
|
6
31
|
// Mobile hamburger
|
|
7
32
|
if (toggle && nav) {
|
|
8
|
-
|
|
33
|
+
if (!nav.id) nav.id = 'pp-header-nav';
|
|
34
|
+
toggle.setAttribute('aria-controls', nav.id);
|
|
35
|
+
nav.setAttribute('aria-hidden', 'true');
|
|
36
|
+
|
|
37
|
+
toggle.addEventListener('click', (e) => {
|
|
38
|
+
e.stopPropagation();
|
|
9
39
|
const isOpen = nav.classList.toggle('is-open');
|
|
10
40
|
toggle.setAttribute('aria-expanded', String(isOpen));
|
|
41
|
+
nav.setAttribute('aria-hidden', String(!isOpen));
|
|
11
42
|
});
|
|
12
43
|
|
|
13
44
|
// Close drawer on outside click
|
|
@@ -15,6 +46,7 @@
|
|
|
15
46
|
if (!header.contains(e.target)) {
|
|
16
47
|
nav.classList.remove('is-open');
|
|
17
48
|
toggle.setAttribute('aria-expanded', 'false');
|
|
49
|
+
nav.setAttribute('aria-hidden', 'true');
|
|
18
50
|
}
|
|
19
51
|
});
|
|
20
52
|
}
|
|
@@ -23,20 +55,27 @@
|
|
|
23
55
|
header.querySelectorAll('.pp-header__nav-item').forEach((item) => {
|
|
24
56
|
const dropdown = item.querySelector('.pp-header__dropdown');
|
|
25
57
|
if (!dropdown) return;
|
|
58
|
+
const link = item.querySelector('.pp-header__nav-link');
|
|
26
59
|
|
|
27
60
|
item.addEventListener('click', (e) => {
|
|
28
61
|
if (window.innerWidth >= 768) return;
|
|
29
62
|
e.stopPropagation();
|
|
30
|
-
item.classList.toggle('is-open');
|
|
63
|
+
const isOpen = item.classList.toggle('is-open');
|
|
64
|
+
if (link) link.setAttribute('aria-expanded', String(isOpen));
|
|
31
65
|
});
|
|
32
66
|
});
|
|
33
67
|
|
|
34
|
-
//
|
|
68
|
+
// Reset on resize to desktop
|
|
35
69
|
window.addEventListener('resize', () => {
|
|
36
70
|
if (window.innerWidth >= 768) {
|
|
37
71
|
nav?.classList.remove('is-open');
|
|
38
72
|
toggle?.setAttribute('aria-expanded', 'false');
|
|
39
|
-
|
|
73
|
+
nav?.setAttribute('aria-hidden', 'true');
|
|
74
|
+
header.querySelectorAll('.pp-header__nav-item').forEach((i) => {
|
|
75
|
+
i.classList.remove('is-open');
|
|
76
|
+
const link = i.querySelector('.pp-header__nav-link');
|
|
77
|
+
if (link?.hasAttribute('aria-expanded')) link.setAttribute('aria-expanded', 'false');
|
|
78
|
+
});
|
|
40
79
|
}
|
|
41
80
|
});
|
|
42
81
|
}
|
package/src/js/modal.js
ADDED
|
@@ -0,0 +1,134 @@
|
|
|
1
|
+
(function () {
|
|
2
|
+
const FOCUSABLE = 'button:not([disabled]), [href], input:not([disabled]), select:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex="-1"])';
|
|
3
|
+
let lastFocused = null;
|
|
4
|
+
|
|
5
|
+
document.querySelectorAll('.pp-modal-backdrop').forEach((backdrop) => {
|
|
6
|
+
backdrop.classList.add('is-animated');
|
|
7
|
+
backdrop.setAttribute('aria-hidden', 'true');
|
|
8
|
+
|
|
9
|
+
// Role and modal semantics (skip if native <dialog>)
|
|
10
|
+
if (!(backdrop instanceof HTMLDialogElement)) {
|
|
11
|
+
backdrop.setAttribute('role', 'dialog');
|
|
12
|
+
backdrop.setAttribute('aria-modal', 'true');
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
// Wire aria-labelledby to the modal title if present
|
|
16
|
+
const modal = backdrop.querySelector('.pp-modal');
|
|
17
|
+
const title = modal?.querySelector('.pp-modal__title');
|
|
18
|
+
if (title) {
|
|
19
|
+
if (!title.id) title.id = `pp-modal-title-${backdrop.id}`;
|
|
20
|
+
backdrop.setAttribute('aria-labelledby', title.id);
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
// Wire aria-describedby to description if present
|
|
24
|
+
const desc = modal?.querySelector('.pp-modal__description');
|
|
25
|
+
if (desc) {
|
|
26
|
+
if (!desc.id) desc.id = `pp-modal-desc-${backdrop.id}`;
|
|
27
|
+
backdrop.setAttribute('aria-describedby', desc.id);
|
|
28
|
+
}
|
|
29
|
+
});
|
|
30
|
+
|
|
31
|
+
function getFocusable(backdrop) {
|
|
32
|
+
return [...backdrop.querySelectorAll(FOCUSABLE)];
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
function trapFocus(e, backdrop) {
|
|
36
|
+
const focusable = getFocusable(backdrop);
|
|
37
|
+
if (!focusable.length) return;
|
|
38
|
+
const first = focusable[0];
|
|
39
|
+
const last = focusable[focusable.length - 1];
|
|
40
|
+
|
|
41
|
+
if (e.key === 'Tab') {
|
|
42
|
+
if (e.shiftKey) {
|
|
43
|
+
if (document.activeElement === first) { e.preventDefault(); last.focus(); }
|
|
44
|
+
} else {
|
|
45
|
+
if (document.activeElement === last) { e.preventDefault(); first.focus(); }
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
function openModal(id) {
|
|
51
|
+
const backdrop = document.getElementById(id);
|
|
52
|
+
if (!backdrop) return;
|
|
53
|
+
|
|
54
|
+
lastFocused = document.activeElement;
|
|
55
|
+
|
|
56
|
+
if (backdrop instanceof HTMLDialogElement) {
|
|
57
|
+
backdrop.showModal();
|
|
58
|
+
} else {
|
|
59
|
+
backdrop.classList.add('is-open');
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
backdrop.removeAttribute('aria-hidden');
|
|
63
|
+
backdrop.setAttribute('aria-hidden', 'false');
|
|
64
|
+
|
|
65
|
+
const focusable = getFocusable(backdrop);
|
|
66
|
+
if (focusable.length) focusable[0].focus();
|
|
67
|
+
|
|
68
|
+
backdrop._trapFocus = (e) => trapFocus(e, backdrop);
|
|
69
|
+
backdrop.addEventListener('keydown', backdrop._trapFocus);
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
function closeModal(id) {
|
|
73
|
+
const backdrop = document.getElementById(id);
|
|
74
|
+
if (!backdrop) return;
|
|
75
|
+
|
|
76
|
+
if (backdrop instanceof HTMLDialogElement) {
|
|
77
|
+
backdrop.close();
|
|
78
|
+
} else {
|
|
79
|
+
backdrop.classList.remove('is-open');
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
backdrop.setAttribute('aria-hidden', 'true');
|
|
83
|
+
|
|
84
|
+
if (backdrop._trapFocus) {
|
|
85
|
+
backdrop.removeEventListener('keydown', backdrop._trapFocus);
|
|
86
|
+
delete backdrop._trapFocus;
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
// Restore focus to the element that opened the modal
|
|
90
|
+
if (lastFocused && typeof lastFocused.focus === 'function') {
|
|
91
|
+
lastFocused.focus();
|
|
92
|
+
lastFocused = null;
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
function closeAll() {
|
|
97
|
+
document.querySelectorAll('.pp-modal-backdrop').forEach((b) => {
|
|
98
|
+
if (b instanceof HTMLDialogElement) b.close();
|
|
99
|
+
else b.classList.remove('is-open');
|
|
100
|
+
b.setAttribute('aria-hidden', 'true');
|
|
101
|
+
if (b._trapFocus) {
|
|
102
|
+
b.removeEventListener('keydown', b._trapFocus);
|
|
103
|
+
delete b._trapFocus;
|
|
104
|
+
}
|
|
105
|
+
});
|
|
106
|
+
if (lastFocused && typeof lastFocused.focus === 'function') {
|
|
107
|
+
lastFocused.focus();
|
|
108
|
+
lastFocused = null;
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
// Close on backdrop click outside .pp-modal
|
|
113
|
+
document.querySelectorAll('.pp-modal-backdrop').forEach((backdrop) => {
|
|
114
|
+
backdrop.addEventListener('click', (e) => {
|
|
115
|
+
if (e.target === backdrop) closeModal(backdrop.id);
|
|
116
|
+
});
|
|
117
|
+
});
|
|
118
|
+
|
|
119
|
+
// Escape key
|
|
120
|
+
document.addEventListener('keydown', (e) => {
|
|
121
|
+
if (e.key === 'Escape') closeAll();
|
|
122
|
+
});
|
|
123
|
+
|
|
124
|
+
// data-modal-open / data-modal-close triggers
|
|
125
|
+
document.querySelectorAll('[data-modal-open]').forEach((el) => {
|
|
126
|
+
el.addEventListener('click', () => openModal(el.dataset.modalOpen));
|
|
127
|
+
});
|
|
128
|
+
|
|
129
|
+
document.querySelectorAll('[data-modal-close]').forEach((el) => {
|
|
130
|
+
el.addEventListener('click', () => closeModal(el.dataset.modalClose));
|
|
131
|
+
});
|
|
132
|
+
|
|
133
|
+
window.ppModal = { open: openModal, close: closeModal, closeAll };
|
|
134
|
+
})();
|