@auriel/peppertino 0.1.0 → 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 +144 -24
- 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/src/js/select.js
ADDED
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
(function () {
|
|
2
|
+
function initSelect(wrapper, idx) {
|
|
3
|
+
const trigger = wrapper.querySelector('.pp-select__trigger');
|
|
4
|
+
const panel = wrapper.querySelector('.pp-select__panel');
|
|
5
|
+
const options = wrapper.querySelectorAll('.pp-select__option');
|
|
6
|
+
const valueEl = wrapper.querySelector('.pp-select__value');
|
|
7
|
+
|
|
8
|
+
if (!trigger || !panel) return;
|
|
9
|
+
|
|
10
|
+
// IDs for aria-controls / aria-activedescendant
|
|
11
|
+
const panelId = panel.id || `pp-select-panel-${idx}`;
|
|
12
|
+
panel.id = panelId;
|
|
13
|
+
|
|
14
|
+
options.forEach((opt, i) => {
|
|
15
|
+
if (!opt.id) opt.id = `pp-select-opt-${idx}-${i}`;
|
|
16
|
+
opt.setAttribute('role', 'option');
|
|
17
|
+
opt.setAttribute('aria-selected', opt.classList.contains('is-selected') ? 'true' : 'false');
|
|
18
|
+
});
|
|
19
|
+
|
|
20
|
+
panel.setAttribute('role', 'listbox');
|
|
21
|
+
trigger.setAttribute('role', 'combobox');
|
|
22
|
+
trigger.setAttribute('aria-haspopup', 'listbox');
|
|
23
|
+
trigger.setAttribute('aria-expanded', 'false');
|
|
24
|
+
trigger.setAttribute('aria-controls', panelId);
|
|
25
|
+
|
|
26
|
+
// Set initial aria-activedescendant to the selected option
|
|
27
|
+
const selected = wrapper.querySelector('.pp-select__option.is-selected');
|
|
28
|
+
if (selected) trigger.setAttribute('aria-activedescendant', selected.id);
|
|
29
|
+
|
|
30
|
+
function open() {
|
|
31
|
+
wrapper.classList.add('is-open');
|
|
32
|
+
trigger.setAttribute('aria-expanded', 'true');
|
|
33
|
+
panel.removeAttribute('hidden');
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
function close() {
|
|
37
|
+
wrapper.classList.remove('is-open');
|
|
38
|
+
trigger.setAttribute('aria-expanded', 'false');
|
|
39
|
+
panel.setAttribute('hidden', '');
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
function toggle() {
|
|
43
|
+
wrapper.classList.contains('is-open') ? close() : open();
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
// Initial state — JS takes over from :focus-within
|
|
47
|
+
panel.setAttribute('hidden', '');
|
|
48
|
+
|
|
49
|
+
trigger.addEventListener('click', (e) => {
|
|
50
|
+
e.stopPropagation();
|
|
51
|
+
toggle();
|
|
52
|
+
});
|
|
53
|
+
|
|
54
|
+
// Option selection
|
|
55
|
+
options.forEach((opt) => {
|
|
56
|
+
opt.addEventListener('click', () => {
|
|
57
|
+
options.forEach((o) => {
|
|
58
|
+
o.classList.remove('is-selected');
|
|
59
|
+
o.setAttribute('aria-selected', 'false');
|
|
60
|
+
});
|
|
61
|
+
opt.classList.add('is-selected');
|
|
62
|
+
opt.setAttribute('aria-selected', 'true');
|
|
63
|
+
trigger.setAttribute('aria-activedescendant', opt.id);
|
|
64
|
+
|
|
65
|
+
if (valueEl) valueEl.textContent = opt.textContent.trim();
|
|
66
|
+
|
|
67
|
+
const nativeSelect = wrapper.querySelector('select[data-pp-select]');
|
|
68
|
+
if (nativeSelect) nativeSelect.value = opt.dataset.value ?? opt.textContent.trim();
|
|
69
|
+
|
|
70
|
+
wrapper.dispatchEvent(new CustomEvent('pp-select:change', {
|
|
71
|
+
bubbles: true,
|
|
72
|
+
detail: { value: opt.dataset.value, label: opt.textContent.trim() },
|
|
73
|
+
}));
|
|
74
|
+
|
|
75
|
+
close();
|
|
76
|
+
trigger.focus();
|
|
77
|
+
});
|
|
78
|
+
});
|
|
79
|
+
|
|
80
|
+
// Keyboard navigation
|
|
81
|
+
trigger.addEventListener('keydown', (e) => {
|
|
82
|
+
if (e.key === 'ArrowDown') { e.preventDefault(); open(); options[0]?.focus(); }
|
|
83
|
+
if (e.key === 'Escape') close();
|
|
84
|
+
});
|
|
85
|
+
|
|
86
|
+
panel.addEventListener('keydown', (e) => {
|
|
87
|
+
const focusable = [...options];
|
|
88
|
+
const idx = focusable.indexOf(document.activeElement);
|
|
89
|
+
|
|
90
|
+
if (e.key === 'ArrowDown') { e.preventDefault(); focusable[idx + 1]?.focus(); }
|
|
91
|
+
if (e.key === 'ArrowUp') { e.preventDefault(); idx > 0 ? focusable[idx - 1]?.focus() : trigger.focus(); }
|
|
92
|
+
if (e.key === 'Escape') { close(); trigger.focus(); }
|
|
93
|
+
if (e.key === 'Enter' || e.key === ' ') { e.preventDefault(); document.activeElement?.click(); }
|
|
94
|
+
});
|
|
95
|
+
|
|
96
|
+
// Close on outside click
|
|
97
|
+
document.addEventListener('click', (e) => {
|
|
98
|
+
if (!wrapper.contains(e.target)) close();
|
|
99
|
+
});
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
document.querySelectorAll('.pp-select').forEach((el, i) => initSelect(el, i));
|
|
103
|
+
})();
|
package/src/js/tabs.js
ADDED
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
(function () {
|
|
2
|
+
function initTabs(tabGroup, groupIdx) {
|
|
3
|
+
const items = tabGroup.querySelectorAll('.pp-tabs__item');
|
|
4
|
+
const targetAttr = 'data-tab-target';
|
|
5
|
+
|
|
6
|
+
// Ensure tablist role
|
|
7
|
+
if (!tabGroup.getAttribute('role')) tabGroup.setAttribute('role', 'tablist');
|
|
8
|
+
|
|
9
|
+
// Wire up tab roles and aria-controls
|
|
10
|
+
items.forEach((item, i) => {
|
|
11
|
+
item.setAttribute('role', 'tab');
|
|
12
|
+
if (!item.id) item.id = `pp-tab-${groupIdx}-${i}`;
|
|
13
|
+
|
|
14
|
+
const targetId = item.getAttribute(targetAttr);
|
|
15
|
+
if (targetId) {
|
|
16
|
+
item.setAttribute('aria-controls', targetId);
|
|
17
|
+
const panel = document.querySelector(`[data-tab-panel="${targetId}"]`);
|
|
18
|
+
if (panel) {
|
|
19
|
+
if (!panel.id) panel.id = targetId;
|
|
20
|
+
panel.setAttribute('role', 'tabpanel');
|
|
21
|
+
panel.setAttribute('aria-labelledby', item.id);
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
});
|
|
25
|
+
|
|
26
|
+
function activate(item) {
|
|
27
|
+
items.forEach((i) => {
|
|
28
|
+
i.classList.remove('is-active');
|
|
29
|
+
i.setAttribute('aria-selected', 'false');
|
|
30
|
+
i.setAttribute('tabindex', '-1');
|
|
31
|
+
});
|
|
32
|
+
|
|
33
|
+
item.classList.add('is-active');
|
|
34
|
+
item.setAttribute('aria-selected', 'true');
|
|
35
|
+
item.setAttribute('tabindex', '0');
|
|
36
|
+
|
|
37
|
+
// Show/hide associated panels if present
|
|
38
|
+
const targetId = item.getAttribute(targetAttr);
|
|
39
|
+
if (targetId) {
|
|
40
|
+
document.querySelectorAll('[data-tab-panel]').forEach((panel) => {
|
|
41
|
+
const isVisible = panel.getAttribute('data-tab-panel') === targetId;
|
|
42
|
+
panel.hidden = !isVisible;
|
|
43
|
+
panel.setAttribute('aria-hidden', String(!isVisible));
|
|
44
|
+
});
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
tabGroup.dispatchEvent(new CustomEvent('pp-tabs:change', {
|
|
48
|
+
bubbles: true,
|
|
49
|
+
detail: { value: item.dataset.tabTarget, label: item.textContent.trim() },
|
|
50
|
+
}));
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
// Click
|
|
54
|
+
items.forEach((item) => {
|
|
55
|
+
item.addEventListener('click', () => activate(item));
|
|
56
|
+
});
|
|
57
|
+
|
|
58
|
+
// Keyboard: left/right arrow navigation
|
|
59
|
+
tabGroup.addEventListener('keydown', (e) => {
|
|
60
|
+
const current = [...items].findIndex((i) => i === document.activeElement);
|
|
61
|
+
if (current === -1) return;
|
|
62
|
+
|
|
63
|
+
if (e.key === 'ArrowRight') {
|
|
64
|
+
e.preventDefault();
|
|
65
|
+
const next = items[(current + 1) % items.length];
|
|
66
|
+
activate(next);
|
|
67
|
+
next.focus();
|
|
68
|
+
}
|
|
69
|
+
if (e.key === 'ArrowLeft') {
|
|
70
|
+
e.preventDefault();
|
|
71
|
+
const prev = items[(current - 1 + items.length) % items.length];
|
|
72
|
+
activate(prev);
|
|
73
|
+
prev.focus();
|
|
74
|
+
}
|
|
75
|
+
if (e.key === 'Home') {
|
|
76
|
+
e.preventDefault();
|
|
77
|
+
activate(items[0]);
|
|
78
|
+
items[0].focus();
|
|
79
|
+
}
|
|
80
|
+
if (e.key === 'End') {
|
|
81
|
+
e.preventDefault();
|
|
82
|
+
activate(items[items.length - 1]);
|
|
83
|
+
items[items.length - 1].focus();
|
|
84
|
+
}
|
|
85
|
+
});
|
|
86
|
+
|
|
87
|
+
// Set initial tabindex
|
|
88
|
+
items.forEach((item) => {
|
|
89
|
+
item.setAttribute('tabindex', item.classList.contains('is-active') ? '0' : '-1');
|
|
90
|
+
});
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
document.querySelectorAll('.pp-tabs').forEach((el, i) => initTabs(el, i));
|
|
94
|
+
})();
|
package/src/scss/button.scss
CHANGED
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
// PeppertinoCSS — Button
|
|
2
2
|
|
|
3
|
+
@use 'sass:map';
|
|
3
4
|
@use 'base' as *;
|
|
4
5
|
|
|
6
|
+
// ─── Base ─────────────────────────────────────────────────────────────────────
|
|
5
7
|
.button {
|
|
6
8
|
cursor: pointer;
|
|
7
9
|
display: inline-block;
|
|
@@ -20,35 +22,100 @@
|
|
|
20
22
|
background: $color-primary;
|
|
21
23
|
color: #fff;
|
|
22
24
|
border-color: transparent;
|
|
25
|
+
transition: background $transition-fast, border-color $transition-fast, opacity $transition-fast;
|
|
23
26
|
--sk-button-margin-horizontal: 14px;
|
|
24
27
|
--sk-button-margin-vertical: 14px;
|
|
25
28
|
|
|
26
|
-
&:hover
|
|
27
|
-
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
&:active {
|
|
31
|
-
background: $color-primary-dark;
|
|
32
|
-
opacity: 0.85;
|
|
33
|
-
}
|
|
29
|
+
&:hover { background: $color-primary-light; }
|
|
30
|
+
&:active { background: $color-primary-dark; opacity: 0.85; }
|
|
34
31
|
}
|
|
35
32
|
|
|
33
|
+
// ─── Outline base ────────────────────────────────────────────────────────────
|
|
36
34
|
.button-outline {
|
|
37
35
|
@extend .button;
|
|
38
|
-
|
|
39
36
|
background: transparent;
|
|
40
37
|
color: $color-primary;
|
|
41
38
|
border-color: $color-primary;
|
|
42
39
|
|
|
43
|
-
&:hover
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
}
|
|
40
|
+
&:hover { background: $color-primary; color: #fff; }
|
|
41
|
+
&:active { background: $color-primary-dark; border-color: $color-primary-dark; color: #fff; opacity: 0.85; }
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
// ─── Variant mixin ───────────────────────────────────────────────────────────
|
|
45
|
+
@mixin button-variant($bg, $bg-hover, $bg-active) {
|
|
46
|
+
background: $bg;
|
|
47
|
+
border-color: transparent;
|
|
48
|
+
color: #fff;
|
|
49
|
+
&:hover { background: $bg-hover; }
|
|
50
|
+
&:active { background: $bg-active; opacity: 0.85; }
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
@mixin button-outline-variant($color, $color-hover) {
|
|
54
|
+
background: transparent;
|
|
55
|
+
border-color: $color;
|
|
56
|
+
color: $color;
|
|
57
|
+
&:hover { background: $color; color: #fff; }
|
|
58
|
+
&:active { background: $color-hover; border-color: $color-hover; color: #fff; opacity: 0.85; }
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
// ─── Filled variants ─────────────────────────────────────────────────────────
|
|
62
|
+
.button-success {
|
|
63
|
+
@extend .button;
|
|
64
|
+
@include button-variant(#16a34a, #15803d, #166534);
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
.button-warning {
|
|
68
|
+
@extend .button;
|
|
69
|
+
@include button-variant(#d97706, #b45309, #92400e);
|
|
70
|
+
color: #fff;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
.button-error {
|
|
74
|
+
@extend .button;
|
|
75
|
+
@include button-variant($color-error, #dc2626, #b91c1c);
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
.button-dark {
|
|
79
|
+
@extend .button;
|
|
80
|
+
@include button-variant($color-neutral-900, $color-neutral-700, $color-neutral-800);
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
.button-ghost {
|
|
84
|
+
@extend .button;
|
|
85
|
+
background: transparent;
|
|
86
|
+
color: $color-on-surface;
|
|
87
|
+
border-color: $color-border;
|
|
88
|
+
|
|
89
|
+
&:hover { background: $color-neutral-100; border-color: $color-neutral-300; }
|
|
90
|
+
&:active { background: $color-neutral-200; opacity: 0.85; }
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
.button-gradient {
|
|
94
|
+
@extend .button;
|
|
95
|
+
background: linear-gradient(135deg, $gradient-start, $gradient-end);
|
|
96
|
+
border-color: transparent;
|
|
97
|
+
|
|
98
|
+
&:hover { background: linear-gradient(135deg, $gradient-end, $gradient-start); }
|
|
99
|
+
&:active { opacity: 0.85; }
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
// ─── Outline variants ────────────────────────────────────────────────────────
|
|
103
|
+
.button-outline-success {
|
|
104
|
+
@extend .button;
|
|
105
|
+
@include button-outline-variant(#16a34a, #15803d);
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
.button-outline-warning {
|
|
109
|
+
@extend .button;
|
|
110
|
+
@include button-outline-variant(#d97706, #b45309);
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
.button-outline-error {
|
|
114
|
+
@extend .button;
|
|
115
|
+
@include button-outline-variant($color-error, #dc2626);
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
.button-outline-dark {
|
|
119
|
+
@extend .button;
|
|
120
|
+
@include button-outline-variant($color-neutral-900, $color-neutral-700);
|
|
54
121
|
}
|
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
// PeppertinoCSS — Card
|
|
2
|
+
|
|
3
|
+
@use 'sass:map';
|
|
4
|
+
@use 'base' as *;
|
|
5
|
+
|
|
6
|
+
.pp-card {
|
|
7
|
+
background: #fff;
|
|
8
|
+
border-radius: 16px;
|
|
9
|
+
padding: spacing(6);
|
|
10
|
+
box-shadow: $shadow-md;
|
|
11
|
+
display: flex;
|
|
12
|
+
flex-direction: column;
|
|
13
|
+
gap: spacing(3);
|
|
14
|
+
transition: box-shadow $transition-base, transform $transition-base;
|
|
15
|
+
|
|
16
|
+
&:hover {
|
|
17
|
+
box-shadow: $shadow-xl;
|
|
18
|
+
transform: translateY(-2px);
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
// ─── Parts ───────────────────────────────────────────────────────────────────
|
|
23
|
+
.pp-card__eyebrow {
|
|
24
|
+
font-family: $font-sans;
|
|
25
|
+
font-size: font-size('xs');
|
|
26
|
+
font-weight: map.get($font-weights, 'semibold');
|
|
27
|
+
letter-spacing: 0.08em;
|
|
28
|
+
text-transform: uppercase;
|
|
29
|
+
color: $color-primary;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
.pp-card__title {
|
|
33
|
+
font-family: $font-sans;
|
|
34
|
+
font-size: font-size('xl');
|
|
35
|
+
font-weight: map.get($font-weights, 'bold');
|
|
36
|
+
color: $color-neutral-900;
|
|
37
|
+
line-height: 1.25;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
.pp-card__body {
|
|
41
|
+
font-family: $font-sans;
|
|
42
|
+
font-size: font-size('sm');
|
|
43
|
+
font-weight: map.get($font-weights, 'regular');
|
|
44
|
+
color: $color-neutral-500;
|
|
45
|
+
line-height: 1.6;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
.pp-card__footer {
|
|
49
|
+
display: flex;
|
|
50
|
+
align-items: center;
|
|
51
|
+
gap: spacing(3);
|
|
52
|
+
padding-top: spacing(2);
|
|
53
|
+
border-top: 1px solid $color-border;
|
|
54
|
+
margin-top: auto;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
.pp-card__media {
|
|
58
|
+
width: 100%;
|
|
59
|
+
aspect-ratio: 16 / 9;
|
|
60
|
+
object-fit: cover;
|
|
61
|
+
border-radius: 10px;
|
|
62
|
+
background: $color-neutral-100;
|
|
63
|
+
margin: 0 calc(-1 * spacing(6));
|
|
64
|
+
width: calc(100% + spacing(12));
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
// ─── Variants ────────────────────────────────────────────────────────────────
|
|
68
|
+
.pp-card--primary {
|
|
69
|
+
background: $color-primary;
|
|
70
|
+
|
|
71
|
+
.pp-card__eyebrow { color: rgba(#fff, 0.6); }
|
|
72
|
+
.pp-card__title { color: #fff; }
|
|
73
|
+
.pp-card__body { color: rgba(#fff, 0.75); }
|
|
74
|
+
.pp-card__footer { border-color: rgba(#fff, 0.2); }
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
.pp-card--dark {
|
|
78
|
+
background: $color-neutral-900;
|
|
79
|
+
|
|
80
|
+
.pp-card__eyebrow { color: $color-primary-light; }
|
|
81
|
+
.pp-card__title { color: #fff; }
|
|
82
|
+
.pp-card__body { color: $color-neutral-400; }
|
|
83
|
+
.pp-card__footer { border-color: $color-neutral-700; }
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
.pp-card--gradient {
|
|
87
|
+
background: linear-gradient(135deg, $gradient-start, $gradient-end);
|
|
88
|
+
|
|
89
|
+
.pp-card__eyebrow { color: rgba(#fff, 0.7); }
|
|
90
|
+
.pp-card__title { color: #fff; }
|
|
91
|
+
.pp-card__body { color: rgba(#fff, 0.8); }
|
|
92
|
+
.pp-card__footer { border-color: rgba(#fff, 0.25); }
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
.pp-card--ghost {
|
|
96
|
+
background: transparent;
|
|
97
|
+
box-shadow: none;
|
|
98
|
+
border: 1px solid $color-border;
|
|
99
|
+
|
|
100
|
+
&:hover {
|
|
101
|
+
box-shadow: $shadow-md;
|
|
102
|
+
background: #fff;
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
// ─── Grid helper ─────────────────────────────────────────────────────────────
|
|
107
|
+
.pp-card-grid {
|
|
108
|
+
display: grid;
|
|
109
|
+
gap: spacing(6);
|
|
110
|
+
width: 100%;
|
|
111
|
+
|
|
112
|
+
&--2 { grid-template-columns: repeat(2, 1fr); }
|
|
113
|
+
&--3 { grid-template-columns: repeat(3, 1fr); }
|
|
114
|
+
&--4 { grid-template-columns: repeat(4, 1fr); }
|
|
115
|
+
|
|
116
|
+
@media (max-width: 767px) {
|
|
117
|
+
&--2,
|
|
118
|
+
&--3,
|
|
119
|
+
&--4 { grid-template-columns: 1fr; }
|
|
120
|
+
}
|
|
121
|
+
}
|
package/src/scss/header.scss
CHANGED
|
@@ -92,7 +92,8 @@
|
|
|
92
92
|
visibility $transition-base;
|
|
93
93
|
|
|
94
94
|
.pp-header__nav-item:hover > &,
|
|
95
|
-
.pp-header__nav-item:focus-within >
|
|
95
|
+
.pp-header__nav-item:focus-within > &,
|
|
96
|
+
[aria-expanded='true'] + & {
|
|
96
97
|
opacity: 1;
|
|
97
98
|
visibility: visible;
|
|
98
99
|
transform: translateY(0);
|
|
@@ -176,6 +177,8 @@
|
|
|
176
177
|
border-bottom: 1px solid $color-border;
|
|
177
178
|
box-shadow: $shadow-md;
|
|
178
179
|
|
|
180
|
+
// CSS-only: hidden by default, visible when toggle is focused/active
|
|
181
|
+
// JS enhances this with .is-open for outside-click + burger animation
|
|
179
182
|
opacity: 0;
|
|
180
183
|
visibility: hidden;
|
|
181
184
|
transform: translateY(-8px);
|
|
@@ -184,19 +187,30 @@
|
|
|
184
187
|
transform $transition-base,
|
|
185
188
|
visibility $transition-base;
|
|
186
189
|
|
|
187
|
-
|
|
190
|
+
// CSS-only fallback — drawer opens when toggle button is :focus-within
|
|
191
|
+
.pp-header:focus-within &,
|
|
192
|
+
&.is-open,
|
|
193
|
+
&[aria-hidden='false'] {
|
|
188
194
|
opacity: 1;
|
|
189
195
|
visibility: visible;
|
|
190
196
|
transform: translateY(0);
|
|
191
197
|
}
|
|
192
198
|
}
|
|
193
199
|
|
|
200
|
+
// Re-hide when focus moves inside the nav itself (not the toggle)
|
|
201
|
+
// JS takes over for a better UX; this is the no-JS baseline
|
|
202
|
+
.pp-header__nav:focus-within {
|
|
203
|
+
opacity: 1;
|
|
204
|
+
visibility: visible;
|
|
205
|
+
transform: translateY(0);
|
|
206
|
+
}
|
|
207
|
+
|
|
194
208
|
.pp-header__nav-link {
|
|
195
209
|
font-size: font-size('base');
|
|
196
210
|
padding: spacing(3) spacing(4);
|
|
197
211
|
}
|
|
198
212
|
|
|
199
|
-
// Inline dropdown on mobile
|
|
213
|
+
// Inline dropdown on mobile
|
|
200
214
|
.pp-header__dropdown {
|
|
201
215
|
position: static;
|
|
202
216
|
opacity: 1;
|
|
@@ -208,10 +222,17 @@
|
|
|
208
222
|
background: transparent;
|
|
209
223
|
backdrop-filter: none;
|
|
210
224
|
padding-left: spacing(4);
|
|
211
|
-
|
|
225
|
+
// CSS-only: always visible on mobile (no JS toggle needed)
|
|
226
|
+
display: block;
|
|
227
|
+
|
|
228
|
+
// JS can hide/show individual dropdowns with .is-open
|
|
229
|
+
&.is-js-controlled {
|
|
230
|
+
display: none;
|
|
212
231
|
|
|
213
|
-
|
|
214
|
-
|
|
232
|
+
.pp-header__nav-item.is-open > &,
|
|
233
|
+
[aria-expanded='true'] + & {
|
|
234
|
+
display: block;
|
|
235
|
+
}
|
|
215
236
|
}
|
|
216
237
|
}
|
|
217
238
|
}
|