@auriel/peppertino 0.2.0 → 0.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (46) hide show
  1. package/CHANGELOG.txt +122 -56
  2. package/README.md +333 -38
  3. package/dist/accordion.js +51 -0
  4. package/dist/accordion.js.map +7 -0
  5. package/dist/carousel.js +152 -0
  6. package/dist/carousel.js.map +7 -0
  7. package/dist/header.js +30 -3
  8. package/dist/header.js.map +2 -2
  9. package/dist/main.css +4660 -710
  10. package/dist/main.css.map +1 -1
  11. package/dist/modal.js +61 -2
  12. package/dist/modal.js.map +2 -2
  13. package/dist/peppertino.js +477 -17
  14. package/dist/peppertino.js.map +4 -4
  15. package/dist/select.js +25 -8
  16. package/dist/select.js.map +3 -3
  17. package/dist/tabs.js +31 -4
  18. package/dist/tabs.js.map +2 -2
  19. package/dist/validation.js +130 -0
  20. package/dist/validation.js.map +7 -0
  21. package/index.html +1493 -42
  22. package/package.json +1 -1
  23. package/src/js/accordion.js +61 -0
  24. package/src/js/carousel.js +148 -0
  25. package/src/js/peppertino.js +4 -0
  26. package/src/js/validation.js +132 -0
  27. package/src/scss/accordion.scss +156 -0
  28. package/src/scss/alert.scss +204 -0
  29. package/src/scss/base.scss +130 -16
  30. package/src/scss/card.scss +4 -4
  31. package/src/scss/carousel.scss +313 -0
  32. package/src/scss/dark-mode.scss +474 -0
  33. package/src/scss/footer.scss +224 -0
  34. package/src/scss/forms/fieldset.scss +127 -0
  35. package/src/scss/forms/form-instructions.scss +133 -0
  36. package/src/scss/forms/label.scss +115 -0
  37. package/src/scss/forms/text-field.scss +240 -0
  38. package/src/scss/forms/validation.scss +215 -0
  39. package/src/scss/forms.scss +8 -0
  40. package/src/scss/header.scss +8 -8
  41. package/src/scss/main.scss +7 -0
  42. package/src/scss/section.scss +1 -1
  43. package/src/scss/select.scss +5 -5
  44. package/src/scss/table.scss +5 -5
  45. package/src/scss/utilities.scss +243 -0
  46. package/.claude/settings.local.json +0 -8
@@ -0,0 +1,204 @@
1
+ // PeppertinoCSS — Alert
2
+
3
+ @use 'sass:map';
4
+ @use 'base' as *;
5
+
6
+ // ─── Base ─────────────────────────────────────────────────────────────────────
7
+ .pp-alert {
8
+ display: flex;
9
+ align-items: flex-start;
10
+ gap: spacing(3);
11
+ padding: spacing(4) spacing(5);
12
+ border-radius: 12px;
13
+ border: 1px solid transparent;
14
+ font-family: $font-sans;
15
+ font-size: font-size('sm');
16
+ line-height: $line-height-base;
17
+ width: 100%;
18
+
19
+ // Dismiss button (optional)
20
+ &.is-dismissible {
21
+ padding-right: spacing(10);
22
+ position: relative;
23
+ }
24
+ }
25
+
26
+ // ─── Icon slot ────────────────────────────────────────────────────────────────
27
+ .pp-alert__icon {
28
+ flex-shrink: 0;
29
+ width: 18px;
30
+ height: 18px;
31
+ margin-top: 2px;
32
+
33
+ svg, i {
34
+ width: 18px;
35
+ height: 18px;
36
+ stroke: currentColor;
37
+ stroke-width: 2;
38
+ fill: none;
39
+ }
40
+ }
41
+
42
+ // ─── Body ─────────────────────────────────────────────────────────────────────
43
+ .pp-alert__body {
44
+ flex: 1;
45
+ min-width: 0;
46
+ }
47
+
48
+ .pp-alert__title {
49
+ font-weight: map.get($font-weights, 'semibold');
50
+ color: inherit;
51
+ margin-bottom: spacing(1);
52
+ font-size: font-size('sm');
53
+ }
54
+
55
+ .pp-alert__message {
56
+ font-weight: map.get($font-weights, 'regular');
57
+ opacity: 0.85;
58
+ }
59
+
60
+ // ─── Dismiss button ───────────────────────────────────────────────────────────
61
+ .pp-alert__dismiss {
62
+ position: absolute;
63
+ top: spacing(3);
64
+ right: spacing(3);
65
+ width: 24px;
66
+ height: 24px;
67
+ display: flex;
68
+ align-items: center;
69
+ justify-content: center;
70
+ background: transparent;
71
+ border: none;
72
+ cursor: pointer;
73
+ border-radius: 50%;
74
+ color: inherit;
75
+ opacity: 0.55;
76
+ transition: opacity $transition-fast, background $transition-fast;
77
+
78
+ &:hover {
79
+ opacity: 1;
80
+ background: rgba(0, 0, 0, 0.08);
81
+ }
82
+
83
+ svg, i {
84
+ width: 14px;
85
+ height: 14px;
86
+ stroke: currentColor;
87
+ stroke-width: 2.5;
88
+ fill: none;
89
+ }
90
+ }
91
+
92
+ // ─── Variant mixin ────────────────────────────────────────────────────────────
93
+ @mixin alert-variant($bg, $border, $text, $icon-color: $text) {
94
+ background: $bg;
95
+ border-color: $border;
96
+ color: $text;
97
+
98
+ .pp-alert__icon { color: $icon-color; }
99
+ }
100
+
101
+ // ─── Variants ─────────────────────────────────────────────────────────────────
102
+ .pp-alert--info {
103
+ @include alert-variant(
104
+ rgba($color-info, 0.08),
105
+ rgba($color-info, 0.3),
106
+ #1e3a5f,
107
+ $color-info
108
+ );
109
+ }
110
+
111
+ .pp-alert--success {
112
+ @include alert-variant(
113
+ rgba($color-success, 0.08),
114
+ rgba($color-success, 0.3),
115
+ #14532d,
116
+ $color-success
117
+ );
118
+ }
119
+
120
+ .pp-alert--warning {
121
+ @include alert-variant(
122
+ rgba($color-warning, 0.1),
123
+ rgba($color-warning, 0.35),
124
+ #78350f,
125
+ $color-warning
126
+ );
127
+ }
128
+
129
+ .pp-alert--error {
130
+ @include alert-variant(
131
+ rgba($color-error, 0.08),
132
+ rgba($color-error, 0.3),
133
+ #7f1d1d,
134
+ $color-error
135
+ );
136
+ }
137
+
138
+ .pp-alert--primary {
139
+ @include alert-variant(
140
+ rgba($color-primary, 0.07),
141
+ rgba($color-primary, 0.3),
142
+ $color-primary-dark,
143
+ $color-primary
144
+ );
145
+ }
146
+
147
+ .pp-alert--neutral {
148
+ @include alert-variant(
149
+ $color-neutral-100,
150
+ $color-neutral-200,
151
+ $color-neutral-700,
152
+ $color-neutral-500
153
+ );
154
+ }
155
+
156
+ // ─── Variant: filled (solid background) ──────────────────────────────────────
157
+ .pp-alert--filled {
158
+ &.pp-alert--info {
159
+ @include alert-variant($color-info, $color-info, #fff);
160
+ }
161
+
162
+ &.pp-alert--success {
163
+ @include alert-variant($color-success, $color-success, #fff);
164
+ }
165
+
166
+ &.pp-alert--warning {
167
+ @include alert-variant($color-warning, $color-warning, #fff);
168
+ }
169
+
170
+ &.pp-alert--error {
171
+ @include alert-variant($color-error, $color-error, #fff);
172
+ }
173
+
174
+ &.pp-alert--primary {
175
+ @include alert-variant($color-primary, $color-primary, #fff);
176
+ }
177
+
178
+ &.pp-alert--neutral {
179
+ @include alert-variant($color-neutral-800, $color-neutral-800, #fff, rgba(#fff, 0.7));
180
+ }
181
+
182
+ .pp-alert__dismiss:hover {
183
+ background: rgba(#fff, 0.15);
184
+ }
185
+ }
186
+
187
+ // ─── Enter / dismiss animations ───────────────────────────────────────────────
188
+ .pp-alert {
189
+ animation: pp-alert-in 200ms ease forwards;
190
+ }
191
+
192
+ @keyframes pp-alert-in {
193
+ from { opacity: 0; transform: translateY(-6px); }
194
+ to { opacity: 1; transform: translateY(0); }
195
+ }
196
+
197
+ .pp-alert.is-dismissing {
198
+ animation: pp-alert-out 180ms ease forwards;
199
+ }
200
+
201
+ @keyframes pp-alert-out {
202
+ from { opacity: 1; transform: translateY(0); max-height: 200px; }
203
+ to { opacity: 0; transform: translateY(-6px); max-height: 0; padding-top: 0; padding-bottom: 0; margin: 0; }
204
+ }
@@ -5,14 +5,17 @@
5
5
 
6
6
  @import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;900&family=Kode+Mono:wght@400;500;600;700&display=swap');
7
7
 
8
- // ─── Color palette ───────────────────────────────────────────────────────────
8
+ // ─── Static SCSS palette (source of truth) ───────────────────────────────────
9
+ // These never change at runtime; they feed both the CSS vars and any SCSS
10
+ // math that needs a compile-time value.
11
+
9
12
  $color-primary: #e90111 !default;
10
13
  $color-primary-light: #ff4d5a !default;
11
14
  $color-primary-dark: #a8000c !default;
12
15
 
13
16
  $color-accent: #f77f00 !default;
14
17
 
15
- $gradient-start: #ffcf67!default;
18
+ $gradient-start: #ffcf67 !default;
16
19
  $gradient-end: #ea5753 !default;
17
20
 
18
21
  $color-neutral-50: #fafafa !default;
@@ -26,10 +29,6 @@ $color-neutral-700: #3f3f46 !default;
26
29
  $color-neutral-800: #27272a !default;
27
30
  $color-neutral-900: #18181b !default;
28
31
 
29
- $color-surface: $color-neutral-50 !default;
30
- $color-on-surface: $color-neutral-900 !default;
31
- $color-border: $color-neutral-200 !default;
32
-
33
32
  $color-success: #22c55e !default;
34
33
  $color-warning: #f59e0b !default;
35
34
  $color-error: #ef4444 !default;
@@ -41,8 +40,8 @@ $font-sans: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI',
41
40
  $font-mono: 'Kode Mono', ui-monospace, 'Cascadia Code', 'Courier New',
42
41
  monospace !default;
43
42
 
44
- $font-size-base: 1rem !default; // 16px
45
- $line-height-base: 1.6 !default;
43
+ $font-size-base: 1rem !default;
44
+ $line-height-base: 1.6 !default;
46
45
 
47
46
  $font-sizes: (
48
47
  'xs': 0.75rem,
@@ -102,7 +101,7 @@ $shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1) !d
102
101
  $shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1) !default;
103
102
  $shadow-xl: 0 20px 25px -5px rgb(0 0 0 / 0.1), 0 8px 10px -6px rgb(0 0 0 / 0.1) !default;
104
103
 
105
- // ─── Breakpoints ─────────────────────────────────────────────────────────────
104
+ // ─── Breakpoints (Tailwind-compatible) ───────────────────────────────────────
106
105
  $breakpoints: (
107
106
  'sm': 640px,
108
107
  'md': 768px,
@@ -111,6 +110,22 @@ $breakpoints: (
111
110
  '2xl': 1536px,
112
111
  ) !default;
113
112
 
113
+ // ─── Apple / Mac device breakpoints ──────────────────────────────────────────
114
+ $mac-breakpoints: (
115
+ 'iphone-se': 375px,
116
+ 'iphone': 390px,
117
+ 'iphone-plus': 430px,
118
+ 'iphone-pro-max': 440px,
119
+ 'ipad-mini': 768px,
120
+ 'ipad-air': 820px,
121
+ 'ipad-pro-11': 834px,
122
+ 'ipad-pro-13': 1024px,
123
+ 'macbook-air-13': 1280px,
124
+ 'macbook-pro-14': 1512px,
125
+ 'macbook-pro-16': 1728px,
126
+ 'imac': 2560px,
127
+ ) !default;
128
+
114
129
  // ─── Z-index scale ────────────────────────────────────────────────────────────
115
130
  $z: (
116
131
  'below': -1,
@@ -127,6 +142,85 @@ $transition-fast: 100ms ease !default;
127
142
  $transition-base: 200ms ease !default;
128
143
  $transition-slow: 400ms ease !default;
129
144
 
145
+ // ─── CSS custom properties (light defaults) ──────────────────────────────────
146
+ // All runtime-switchable tokens live here. Dark-mode.scss overrides these
147
+ // under .dark (applied to <html> or any ancestor).
148
+ // SCSS variables below alias these vars so component code stays unchanged.
149
+
150
+ :root {
151
+ // Primaries (static — no dark flip)
152
+ --pp-primary: #{$color-primary};
153
+ --pp-primary-light: #{$color-primary-light};
154
+ --pp-primary-dark: #{$color-primary-dark};
155
+
156
+ // Gradient (static — same in dark)
157
+ --pp-gradient-start: #{$gradient-start};
158
+ --pp-gradient-end: #{$gradient-end};
159
+
160
+ // Semantic status (static)
161
+ --pp-success: #{$color-success};
162
+ --pp-warning: #{$color-warning};
163
+ --pp-error: #{$color-error};
164
+ --pp-info: #{$color-info};
165
+
166
+ // Neutral scale (flipped in dark mode)
167
+ --pp-neutral-50: #{$color-neutral-50};
168
+ --pp-neutral-100: #{$color-neutral-100};
169
+ --pp-neutral-200: #{$color-neutral-200};
170
+ --pp-neutral-300: #{$color-neutral-300};
171
+ --pp-neutral-400: #{$color-neutral-400};
172
+ --pp-neutral-500: #{$color-neutral-500};
173
+ --pp-neutral-600: #{$color-neutral-600};
174
+ --pp-neutral-700: #{$color-neutral-700};
175
+ --pp-neutral-800: #{$color-neutral-800};
176
+ --pp-neutral-900: #{$color-neutral-900};
177
+
178
+ // Semantic surface tokens (the ones components most commonly reference)
179
+ --pp-surface: #{$color-neutral-50};
180
+ --pp-on-surface: #{$color-neutral-900};
181
+ --pp-border: #{$color-neutral-200};
182
+
183
+ // Component-surface: white in light, dark card in dark
184
+ --pp-bg-card: #ffffff;
185
+ --pp-bg-input: #ffffff;
186
+ --pp-bg-select: #ffffff;
187
+ --pp-bg-select-panel: #ffffff;
188
+ --pp-bg-header: rgb(255 255 255 / 0.65);
189
+ --pp-bg-header-mobile: rgb(255 255 255 / 0.90);
190
+ --pp-bg-dropdown: rgb(255 255 255 / 0.85);
191
+ --pp-bg-footer: #{$color-neutral-50};
192
+
193
+ // Glassmorphism overlays (header, modal)
194
+ --pp-glass-border: rgb(255 255 255 / 0.30);
195
+ --pp-glass-hover: rgb(0 0 0 / 0.05);
196
+
197
+ // Shadows (intensity flips in dark)
198
+ --pp-shadow-sm: #{$shadow-sm};
199
+ --pp-shadow: #{$shadow};
200
+ --pp-shadow-md: #{$shadow-md};
201
+ --pp-shadow-lg: #{$shadow-lg};
202
+ --pp-shadow-xl: #{$shadow-xl};
203
+
204
+ // Label tier vars (consumed by label.scss)
205
+ --pp-label-primary: #{$color-neutral-900};
206
+ --pp-label-secondary: #{$color-neutral-500};
207
+ --pp-label-tertiary: #{$color-neutral-400};
208
+ --pp-label-quaternary: #{$color-neutral-300};
209
+
210
+ // Section --muted background
211
+ --pp-section-muted-bg: #{$color-neutral-100};
212
+
213
+ // Scrollbar
214
+ --pp-scrollbar-thumb: linear-gradient(180deg, #{$gradient-start}, #{$gradient-end});
215
+ }
216
+
217
+ // ─── SCSS variable aliases → CSS vars ────────────────────────────────────────
218
+ // Components use these aliases; they resolve to the CSS var at runtime.
219
+
220
+ $color-surface: var(--pp-surface) !default;
221
+ $color-on-surface: var(--pp-on-surface) !default;
222
+ $color-border: var(--pp-border) !default;
223
+
130
224
  // ─── Helper functions ─────────────────────────────────────────────────────────
131
225
  @function spacing($key) {
132
226
  @return map.get($spacing, '#{$key}');
@@ -144,30 +238,49 @@ $transition-slow: 400ms ease !default;
144
238
  @return map.get($z, $key);
145
239
  }
146
240
 
147
- // ─── Responsive mixin ─────────────────────────────────────────────────────────
241
+ // ─── Responsive mixins ────────────────────────────────────────────────────────
148
242
  @mixin respond-to($bp) {
149
243
  $value: map.get($breakpoints, $bp);
150
244
  @if $value {
151
- @media (min-width: $value) {
152
- @content;
153
- }
245
+ @media (min-width: $value) { @content; }
154
246
  } @else {
155
247
  @warn "Unknown breakpoint: `#{$bp}`.";
156
248
  }
157
249
  }
158
250
 
251
+ @mixin respond-below($bp) {
252
+ $value: map.get($breakpoints, $bp);
253
+ @if $value {
254
+ @media (max-width: calc(#{$value} - 1px)) { @content; }
255
+ } @else {
256
+ @warn "Unknown breakpoint: `#{$bp}`.";
257
+ }
258
+ }
259
+
260
+ @mixin respond-between($lower, $upper) {
261
+ $lo: map.get($breakpoints, $lower);
262
+ $hi: map.get($breakpoints, $upper);
263
+ @if $lo and $hi {
264
+ @media (min-width: $lo) and (max-width: calc(#{$hi} - 1px)) { @content; }
265
+ } @else {
266
+ @warn "Unknown breakpoint pair: `#{$lower}` / `#{$upper}`.";
267
+ }
268
+ }
269
+
159
270
  // ─── Base element styles ─────────────────────────────────────────────────────
160
271
  body {
161
272
  font-family: $font-sans;
162
273
  font-size: $font-size-base;
163
274
  line-height: $line-height-base;
164
- color: $color-on-surface;
165
- background-color: $color-surface;
275
+ color: var(--pp-on-surface);
276
+ background-color: var(--pp-surface);
277
+ transition: background-color $transition-base, color $transition-base;
166
278
  }
167
279
 
168
280
  h1, h2, h3, h4, h5, h6 {
169
281
  font-weight: map.get($font-weights, 'bold');
170
282
  line-height: 1.25;
283
+ color: var(--pp-on-surface);
171
284
  }
172
285
 
173
286
  h1 { font-size: font-size('5xl'); }
@@ -186,6 +299,7 @@ pre {
186
299
  pre {
187
300
  overflow-x: auto;
188
301
  padding: spacing(4);
189
- background-color: $color-neutral-100;
302
+ background-color: var(--pp-neutral-100);
190
303
  border-radius: radius('md');
304
+ color: var(--pp-on-surface);
191
305
  }
@@ -4,7 +4,7 @@
4
4
  @use 'base' as *;
5
5
 
6
6
  .pp-card {
7
- background: #fff;
7
+ background: var(--pp-bg-card);
8
8
  border-radius: 16px;
9
9
  padding: spacing(6);
10
10
  box-shadow: $shadow-md;
@@ -33,7 +33,7 @@
33
33
  font-family: $font-sans;
34
34
  font-size: font-size('xl');
35
35
  font-weight: map.get($font-weights, 'bold');
36
- color: $color-neutral-900;
36
+ color: var(--pp-on-surface);
37
37
  line-height: 1.25;
38
38
  }
39
39
 
@@ -41,7 +41,7 @@
41
41
  font-family: $font-sans;
42
42
  font-size: font-size('sm');
43
43
  font-weight: map.get($font-weights, 'regular');
44
- color: $color-neutral-500;
44
+ color: var(--pp-neutral-500);
45
45
  line-height: 1.6;
46
46
  }
47
47
 
@@ -99,7 +99,7 @@
99
99
 
100
100
  &:hover {
101
101
  box-shadow: $shadow-md;
102
- background: #fff;
102
+ background: var(--pp-bg-card);
103
103
  }
104
104
  }
105
105