@auriel/peppertino 0.5.0 → 0.6.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (134) hide show
  1. package/CHANGELOG.txt +249 -224
  2. package/LICENSE +21 -21
  3. package/MIGRATION.md +52 -52
  4. package/README.md +811 -764
  5. package/agents/peppertino/SKILL.md +84 -0
  6. package/agents/peppertino/accordion.md +134 -0
  7. package/agents/peppertino/alert.md +116 -0
  8. package/agents/peppertino/badge.md +74 -0
  9. package/agents/peppertino/base.md +252 -0
  10. package/agents/peppertino/button.md +65 -0
  11. package/agents/peppertino/card.md +82 -0
  12. package/agents/peppertino/carousel.md +147 -0
  13. package/agents/peppertino/catalog.md +83 -0
  14. package/agents/peppertino/components-ai-search.md +10 -0
  15. package/agents/peppertino/components-display.md +19 -0
  16. package/agents/peppertino/components-inputs.md +15 -0
  17. package/agents/peppertino/components-navigation.md +12 -0
  18. package/agents/peppertino/dark-mode.md +152 -0
  19. package/agents/peppertino/footer.md +109 -0
  20. package/agents/peppertino/forms-fieldset.md +85 -0
  21. package/agents/peppertino/forms-form-instructions.md +94 -0
  22. package/agents/peppertino/forms-label.md +110 -0
  23. package/agents/peppertino/forms-text-field.md +134 -0
  24. package/agents/peppertino/forms-validation.md +153 -0
  25. package/agents/peppertino/gradient.md +41 -0
  26. package/agents/peppertino/header.md +105 -0
  27. package/agents/peppertino/modal.md +123 -0
  28. package/agents/peppertino/section.md +56 -0
  29. package/agents/peppertino/select.md +110 -0
  30. package/agents/peppertino/switch.md +72 -0
  31. package/agents/peppertino/table.md +69 -0
  32. package/agents/peppertino/tabs.md +115 -0
  33. package/agents/peppertino/toast.md +96 -0
  34. package/agents/peppertino/tooltip.md +111 -0
  35. package/agents/peppertino/typography.md +118 -0
  36. package/agents/peppertino/utilities.md +194 -0
  37. package/agents/skill.md +65 -0
  38. package/build.js +53 -53
  39. package/dist/accordion.js +1 -1
  40. package/dist/accordion.js.map +2 -2
  41. package/dist/alert.js.map +1 -1
  42. package/dist/carousel.js.map +1 -1
  43. package/dist/header.js.map +1 -1
  44. package/dist/main.css +2566 -1008
  45. package/dist/main.css.map +1 -1
  46. package/dist/main.min.css +1 -0
  47. package/dist/modal.js.map +1 -1
  48. package/dist/peppertino.js +1 -1
  49. package/dist/peppertino.js.map +2 -2
  50. package/dist/select.js.map +1 -1
  51. package/dist/switch.js.map +1 -1
  52. package/dist/tabs.js.map +1 -1
  53. package/dist/theme.js.map +1 -1
  54. package/dist/toast.js.map +1 -1
  55. package/dist/validation.js.map +1 -1
  56. package/icon.svg +4 -0
  57. package/index.html +2177 -2098
  58. package/package.json +28 -28
  59. package/scripts/hex-to-hsl.mjs +75 -75
  60. package/scripts/lint-bem.mjs +53 -53
  61. package/scripts/lint-colors.mjs +87 -87
  62. package/site.webmanifest +18 -0
  63. package/src/js/accordion.js +105 -103
  64. package/src/js/alert.js +28 -28
  65. package/src/js/carousel.js +153 -153
  66. package/src/js/header.js +85 -85
  67. package/src/js/modal.js +138 -138
  68. package/src/js/peppertino.js +15 -15
  69. package/src/js/select.js +101 -101
  70. package/src/js/switch.js +28 -28
  71. package/src/js/tabs.js +104 -104
  72. package/src/js/theme.js +47 -47
  73. package/src/js/toast.js +79 -79
  74. package/src/js/validation.js +132 -132
  75. package/src/scss/accordion.scss +190 -156
  76. package/src/scss/activity.scss +17 -0
  77. package/src/scss/alert.scss +203 -203
  78. package/src/scss/badge.scss +90 -90
  79. package/src/scss/base.scss +511 -506
  80. package/src/scss/button.scss +119 -119
  81. package/src/scss/card.scss +121 -121
  82. package/src/scss/carousel.scss +303 -303
  83. package/src/scss/code-block.scss +22 -0
  84. package/src/scss/counter.scss +5 -0
  85. package/src/scss/dark-mode.scss +514 -514
  86. package/src/scss/duration.scss +26 -0
  87. package/src/scss/folder.scss +27 -0
  88. package/src/scss/footer.scss +224 -224
  89. package/src/scss/forms/fieldset.scss +127 -127
  90. package/src/scss/forms/form-instructions.scss +133 -133
  91. package/src/scss/forms/label.scss +115 -115
  92. package/src/scss/forms/text-field.scss +240 -240
  93. package/src/scss/forms/validation.scss +215 -215
  94. package/src/scss/forms.scss +8 -8
  95. package/src/scss/gradient.scss +11 -11
  96. package/src/scss/gravity-letters.scss +7 -0
  97. package/src/scss/header.scss +257 -238
  98. package/src/scss/helpers/color.scss +9 -0
  99. package/src/scss/helpers/flex.scss +14 -0
  100. package/src/scss/helpers/index.scss +6 -0
  101. package/src/scss/helpers/layout.scss +14 -0
  102. package/src/scss/helpers/spacing.scss +14 -0
  103. package/src/scss/helpers/typography.scss +11 -0
  104. package/src/scss/helpers/visibility.scss +9 -0
  105. package/src/scss/main.scss +49 -24
  106. package/src/scss/modal.scss +188 -188
  107. package/src/scss/model-picker.scss +5 -0
  108. package/src/scss/notification.scss +5 -0
  109. package/src/scss/orb.scss +7 -0
  110. package/src/scss/otp.scss +5 -0
  111. package/src/scss/pill-nav.scss +10 -0
  112. package/src/scss/prompt.scss +28 -0
  113. package/src/scss/rail.scss +7 -0
  114. package/src/scss/reactions.scss +5 -0
  115. package/src/scss/reset.scss +84 -84
  116. package/src/scss/response.scss +11 -0
  117. package/src/scss/reveal.scss +5 -0
  118. package/src/scss/scroll-progress.scss +4 -0
  119. package/src/scss/search-results.scss +13 -0
  120. package/src/scss/section.scss +87 -79
  121. package/src/scss/select.scss +210 -210
  122. package/src/scss/sidebar.scss +8 -0
  123. package/src/scss/status.scss +5 -0
  124. package/src/scss/step-list.scss +13 -0
  125. package/src/scss/switch.scss +121 -121
  126. package/src/scss/table.scss +89 -89
  127. package/src/scss/tabs.scss +156 -156
  128. package/src/scss/task-list.scss +18 -0
  129. package/src/scss/theme-picker.scss +5 -0
  130. package/src/scss/toast.scss +170 -170
  131. package/src/scss/tooltip.scss +126 -126
  132. package/src/scss/typography.scss +58 -58
  133. package/src/scss/utilities.scss +243 -243
  134. package/src/scss/voice-note.scss +5 -0
package/src/js/header.js CHANGED
@@ -1,85 +1,85 @@
1
- (function () {
2
- function initHeader(header) {
3
- const toggle = header.querySelector('.pp-header__toggle');
4
- const nav = header.querySelector('.pp-header__nav');
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
-
31
- // Mobile hamburger
32
- if (toggle && nav) {
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();
39
- const isOpen = nav.classList.toggle('is-open');
40
- toggle.setAttribute('aria-expanded', String(isOpen));
41
- nav.setAttribute('aria-hidden', String(!isOpen));
42
- header.dispatchEvent(new CustomEvent(isOpen ? 'pp:header:open' : 'pp:header:close', { bubbles: true }));
43
- });
44
-
45
- // Close drawer on outside click
46
- document.addEventListener('click', (e) => {
47
- if (!header.contains(e.target)) {
48
- nav.classList.remove('is-open');
49
- toggle.setAttribute('aria-expanded', 'false');
50
- nav.setAttribute('aria-hidden', 'true');
51
- }
52
- });
53
- }
54
-
55
- // Mobile: tap to expand dropdown items
56
- header.querySelectorAll('.pp-header__nav-item').forEach((item) => {
57
- const dropdown = item.querySelector('.pp-header__dropdown');
58
- if (!dropdown) return;
59
- const link = item.querySelector('.pp-header__nav-link');
60
-
61
- item.addEventListener('click', (e) => {
62
- if (window.innerWidth >= 768) return;
63
- e.stopPropagation();
64
- const isOpen = item.classList.toggle('is-open');
65
- if (link) link.setAttribute('aria-expanded', String(isOpen));
66
- });
67
- });
68
-
69
- // Reset on resize to desktop
70
- window.addEventListener('resize', () => {
71
- if (window.innerWidth >= 768) {
72
- nav?.classList.remove('is-open');
73
- toggle?.setAttribute('aria-expanded', 'false');
74
- nav?.setAttribute('aria-hidden', 'true');
75
- header.querySelectorAll('.pp-header__nav-item').forEach((i) => {
76
- i.classList.remove('is-open');
77
- const link = i.querySelector('.pp-header__nav-link');
78
- if (link?.hasAttribute('aria-expanded')) link.setAttribute('aria-expanded', 'false');
79
- });
80
- }
81
- });
82
- }
83
-
84
- document.querySelectorAll('.pp-header').forEach(initHeader);
85
- })();
1
+ (function () {
2
+ function initHeader(header) {
3
+ const toggle = header.querySelector('.pp-header__toggle');
4
+ const nav = header.querySelector('.pp-header__nav');
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
+
31
+ // Mobile hamburger
32
+ if (toggle && nav) {
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();
39
+ const isOpen = nav.classList.toggle('is-open');
40
+ toggle.setAttribute('aria-expanded', String(isOpen));
41
+ nav.setAttribute('aria-hidden', String(!isOpen));
42
+ header.dispatchEvent(new CustomEvent(isOpen ? 'pp:header:open' : 'pp:header:close', { bubbles: true }));
43
+ });
44
+
45
+ // Close drawer on outside click
46
+ document.addEventListener('click', (e) => {
47
+ if (!header.contains(e.target)) {
48
+ nav.classList.remove('is-open');
49
+ toggle.setAttribute('aria-expanded', 'false');
50
+ nav.setAttribute('aria-hidden', 'true');
51
+ }
52
+ });
53
+ }
54
+
55
+ // Mobile: tap to expand dropdown items
56
+ header.querySelectorAll('.pp-header__nav-item').forEach((item) => {
57
+ const dropdown = item.querySelector('.pp-header__dropdown');
58
+ if (!dropdown) return;
59
+ const link = item.querySelector('.pp-header__nav-link');
60
+
61
+ item.addEventListener('click', (e) => {
62
+ if (window.innerWidth >= 768) return;
63
+ e.stopPropagation();
64
+ const isOpen = item.classList.toggle('is-open');
65
+ if (link) link.setAttribute('aria-expanded', String(isOpen));
66
+ });
67
+ });
68
+
69
+ // Reset on resize to desktop
70
+ window.addEventListener('resize', () => {
71
+ if (window.innerWidth >= 768) {
72
+ nav?.classList.remove('is-open');
73
+ toggle?.setAttribute('aria-expanded', 'false');
74
+ nav?.setAttribute('aria-hidden', 'true');
75
+ header.querySelectorAll('.pp-header__nav-item').forEach((i) => {
76
+ i.classList.remove('is-open');
77
+ const link = i.querySelector('.pp-header__nav-link');
78
+ if (link?.hasAttribute('aria-expanded')) link.setAttribute('aria-expanded', 'false');
79
+ });
80
+ }
81
+ });
82
+ }
83
+
84
+ document.querySelectorAll('.pp-header').forEach(initHeader);
85
+ })();
package/src/js/modal.js CHANGED
@@ -1,138 +1,138 @@
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
- backdrop.dispatchEvent(new CustomEvent('pp:modal:open', { bubbles: true }));
72
- }
73
-
74
- function closeModal(id) {
75
- const backdrop = document.getElementById(id);
76
- if (!backdrop) return;
77
-
78
- if (backdrop instanceof HTMLDialogElement) {
79
- backdrop.close();
80
- } else {
81
- backdrop.classList.remove('is-open');
82
- }
83
-
84
- backdrop.setAttribute('aria-hidden', 'true');
85
-
86
- if (backdrop._trapFocus) {
87
- backdrop.removeEventListener('keydown', backdrop._trapFocus);
88
- delete backdrop._trapFocus;
89
- }
90
-
91
- backdrop.dispatchEvent(new CustomEvent('pp:modal:close', { bubbles: true }));
92
-
93
- // Restore focus to the element that opened the modal
94
- if (lastFocused && typeof lastFocused.focus === 'function') {
95
- lastFocused.focus();
96
- lastFocused = null;
97
- }
98
- }
99
-
100
- function closeAll() {
101
- document.querySelectorAll('.pp-modal-backdrop').forEach((b) => {
102
- if (b instanceof HTMLDialogElement) b.close();
103
- else b.classList.remove('is-open');
104
- b.setAttribute('aria-hidden', 'true');
105
- if (b._trapFocus) {
106
- b.removeEventListener('keydown', b._trapFocus);
107
- delete b._trapFocus;
108
- }
109
- });
110
- if (lastFocused && typeof lastFocused.focus === 'function') {
111
- lastFocused.focus();
112
- lastFocused = null;
113
- }
114
- }
115
-
116
- // Close on backdrop click outside .pp-modal
117
- document.querySelectorAll('.pp-modal-backdrop').forEach((backdrop) => {
118
- backdrop.addEventListener('click', (e) => {
119
- if (e.target === backdrop) closeModal(backdrop.id);
120
- });
121
- });
122
-
123
- // Escape key
124
- document.addEventListener('keydown', (e) => {
125
- if (e.key === 'Escape') closeAll();
126
- });
127
-
128
- // data-modal-open / data-modal-close triggers
129
- document.querySelectorAll('[data-modal-open]').forEach((el) => {
130
- el.addEventListener('click', () => openModal(el.dataset.modalOpen));
131
- });
132
-
133
- document.querySelectorAll('[data-modal-close]').forEach((el) => {
134
- el.addEventListener('click', () => closeModal(el.dataset.modalClose));
135
- });
136
-
137
- window.ppModal = { open: openModal, close: closeModal, closeAll };
138
- })();
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
+ backdrop.dispatchEvent(new CustomEvent('pp:modal:open', { bubbles: true }));
72
+ }
73
+
74
+ function closeModal(id) {
75
+ const backdrop = document.getElementById(id);
76
+ if (!backdrop) return;
77
+
78
+ if (backdrop instanceof HTMLDialogElement) {
79
+ backdrop.close();
80
+ } else {
81
+ backdrop.classList.remove('is-open');
82
+ }
83
+
84
+ backdrop.setAttribute('aria-hidden', 'true');
85
+
86
+ if (backdrop._trapFocus) {
87
+ backdrop.removeEventListener('keydown', backdrop._trapFocus);
88
+ delete backdrop._trapFocus;
89
+ }
90
+
91
+ backdrop.dispatchEvent(new CustomEvent('pp:modal:close', { bubbles: true }));
92
+
93
+ // Restore focus to the element that opened the modal
94
+ if (lastFocused && typeof lastFocused.focus === 'function') {
95
+ lastFocused.focus();
96
+ lastFocused = null;
97
+ }
98
+ }
99
+
100
+ function closeAll() {
101
+ document.querySelectorAll('.pp-modal-backdrop').forEach((b) => {
102
+ if (b instanceof HTMLDialogElement) b.close();
103
+ else b.classList.remove('is-open');
104
+ b.setAttribute('aria-hidden', 'true');
105
+ if (b._trapFocus) {
106
+ b.removeEventListener('keydown', b._trapFocus);
107
+ delete b._trapFocus;
108
+ }
109
+ });
110
+ if (lastFocused && typeof lastFocused.focus === 'function') {
111
+ lastFocused.focus();
112
+ lastFocused = null;
113
+ }
114
+ }
115
+
116
+ // Close on backdrop click outside .pp-modal
117
+ document.querySelectorAll('.pp-modal-backdrop').forEach((backdrop) => {
118
+ backdrop.addEventListener('click', (e) => {
119
+ if (e.target === backdrop) closeModal(backdrop.id);
120
+ });
121
+ });
122
+
123
+ // Escape key
124
+ document.addEventListener('keydown', (e) => {
125
+ if (e.key === 'Escape') closeAll();
126
+ });
127
+
128
+ // data-modal-open / data-modal-close triggers
129
+ document.querySelectorAll('[data-modal-open]').forEach((el) => {
130
+ el.addEventListener('click', () => openModal(el.dataset.modalOpen));
131
+ });
132
+
133
+ document.querySelectorAll('[data-modal-close]').forEach((el) => {
134
+ el.addEventListener('click', () => closeModal(el.dataset.modalClose));
135
+ });
136
+
137
+ window.ppModal = { open: openModal, close: closeModal, closeAll };
138
+ })();
@@ -1,15 +1,15 @@
1
- // PeppertinoCSS — aggregator
2
- // Imports all JS components so users can include a single <script> tag.
3
- // Each component is a self-contained IIFE in its own file — import only what you need.
4
-
5
- import './accordion.js';
6
- import './alert.js';
7
- import './carousel.js';
8
- import './header.js';
9
- import './modal.js';
10
- import './select.js';
11
- import './switch.js';
12
- import './tabs.js';
13
- import './theme.js';
14
- import './toast.js';
15
- import './validation.js';
1
+ // PeppertinoCSS — aggregator
2
+ // Imports all JS components so users can include a single <script> tag.
3
+ // Each component is a self-contained IIFE in its own file — import only what you need.
4
+
5
+ import './accordion.js';
6
+ import './alert.js';
7
+ import './carousel.js';
8
+ import './header.js';
9
+ import './modal.js';
10
+ import './select.js';
11
+ import './switch.js';
12
+ import './tabs.js';
13
+ import './theme.js';
14
+ import './toast.js';
15
+ import './validation.js';