@kwtv/components 0.3.0 → 0.5.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 (49) hide show
  1. package/README.md +35 -0
  2. package/package.json +2 -2
  3. package/src/astro/Accordion.astro +10 -6
  4. package/src/astro/AccordionItem.astro +47 -43
  5. package/src/astro/ActiveFilterTags.astro +29 -25
  6. package/src/astro/Alert.astro +46 -41
  7. package/src/astro/Badge.astro +80 -76
  8. package/src/astro/Band.astro +104 -58
  9. package/src/astro/Breadcrumb.astro +33 -29
  10. package/src/astro/Button.astro +132 -128
  11. package/src/astro/Card.astro +64 -60
  12. package/src/astro/CartLine.astro +59 -55
  13. package/src/astro/Checkbox.astro +37 -32
  14. package/src/astro/Chip.astro +68 -64
  15. package/src/astro/DotGrid.astro +50 -46
  16. package/src/astro/EmptyState.astro +26 -22
  17. package/src/astro/FilterGroup.astro +29 -25
  18. package/src/astro/Filters.astro +50 -46
  19. package/src/astro/Footer.astro +179 -175
  20. package/src/astro/FooterColumn.astro +39 -35
  21. package/src/astro/Header.astro +67 -63
  22. package/src/astro/Icon.astro +1 -1
  23. package/src/astro/IconButton.astro +64 -60
  24. package/src/astro/Marquee.astro +33 -29
  25. package/src/astro/NavDropdown.astro +120 -116
  26. package/src/astro/NavLink.astro +59 -55
  27. package/src/astro/Newsletter.astro +58 -54
  28. package/src/astro/Pager.astro +43 -39
  29. package/src/astro/PickCard.astro +72 -68
  30. package/src/astro/ProductCard.astro +120 -116
  31. package/src/astro/Radio.astro +36 -32
  32. package/src/astro/Skeleton.astro +43 -39
  33. package/src/astro/Social.astro +26 -22
  34. package/src/astro/StepIndicator.astro +55 -51
  35. package/src/astro/Sticker.astro +50 -46
  36. package/src/astro/Swatch.astro +44 -40
  37. package/src/astro/Table.astro +58 -54
  38. package/src/astro/TableCard.astro +39 -35
  39. package/src/astro/TextField.astro +92 -88
  40. package/src/astro/Totals.astro +39 -35
  41. package/src/react/Drawer.css +60 -56
  42. package/src/react/Modal.css +97 -93
  43. package/src/react/NewsCarousel.css +108 -104
  44. package/src/react/QuantityStepper.css +84 -80
  45. package/src/react/Select.css +159 -155
  46. package/src/react/Toast.css +128 -124
  47. package/src/styles/base.css +30 -26
  48. package/src/styles/controls.css +183 -179
  49. package/src/styles/motion.css +203 -199
@@ -14,225 +14,229 @@
14
14
  * Import `@kwtv/tokens/tokens.css` before this file.
15
15
  */
16
16
 
17
- /* The default tone is the accent. Rust and Clay used to be the two choices
18
- here; Burgundy replaced both, so the alternative tone is Sage instead. */
19
- .pl-root {
20
- --play: var(--accent);
21
- }
22
- .pl-root[data-tone="sage"] {
23
- --play: var(--primary);
24
- }
17
+ @layer reset, tokens, base, components, motion, utilities;
25
18
 
26
- /* Hover lift. −5 px, shadow-lg, photo scales slightly. --tilt rotates, never
27
- past 6deg, and never on text. */
28
- .pl-lift {
29
- --tilt: 0deg;
30
- transition:
31
- transform var(--duration-base) var(--ease-standard),
32
- box-shadow var(--duration-base) var(--ease-standard);
33
- }
34
- .pl-lift:hover,
35
- .pl-lift:focus-within {
36
- transform: translateY(-5px) rotate(var(--tilt));
37
- box-shadow: var(--shadow-lg);
38
- }
39
- .pl-lift :is(img, .ui-product__img) {
40
- transition: transform var(--duration-base) var(--ease-standard);
41
- }
42
- .pl-lift:hover :is(img, .ui-product__img) {
43
- transform: scale(1.04);
44
- }
19
+ @layer motion {
20
+ /* The default tone is the accent. Rust and Clay used to be the two choices
21
+ here; Burgundy replaced both, so the alternative tone is Sage instead. */
22
+ .pl-root {
23
+ --play: var(--accent);
24
+ }
25
+ .pl-root[data-tone="sage"] {
26
+ --play: var(--primary);
27
+ }
45
28
 
46
- /* Drawn underline. 3 px, left to right, 200 ms. Sage in the hero. */
47
- .pl-ul {
48
- position: relative;
49
- text-decoration: none;
50
- color: inherit;
51
- }
52
- .pl-ul::after {
53
- content: "";
54
- position: absolute;
55
- left: 0;
56
- right: 0;
57
- bottom: -2px;
58
- height: 3px;
59
- background: var(--play);
60
- transform: scaleX(0);
61
- transform-origin: left;
62
- transition: transform var(--duration-base) var(--ease-standard);
63
- }
64
- .pl-ul:hover::after,
65
- .pl-ul:focus-visible::after {
66
- transform: scaleX(1);
67
- }
68
- .pl-hero .pl-ul::after {
69
- background: var(--sage-text);
70
- }
29
+ /* Hover lift. −5 px, shadow-lg, photo scales slightly. --tilt rotates, never
30
+ past 6deg, and never on text. */
31
+ .pl-lift {
32
+ --tilt: 0deg;
33
+ transition:
34
+ transform var(--duration-base) var(--ease-standard),
35
+ box-shadow var(--duration-base) var(--ease-standard);
36
+ }
37
+ .pl-lift:hover,
38
+ .pl-lift:focus-within {
39
+ transform: translateY(-5px) rotate(var(--tilt));
40
+ box-shadow: var(--shadow-lg);
41
+ }
42
+ .pl-lift :is(img, .ui-product__img) {
43
+ transition: transform var(--duration-base) var(--ease-standard);
44
+ }
45
+ .pl-lift:hover :is(img, .ui-product__img) {
46
+ transform: scale(1.04);
47
+ }
71
48
 
72
- /* Arrow nudge. +5 px on the parent's hover. */
73
- .pl-arrow {
74
- display: inline-flex;
75
- transition: transform var(--duration-fast) var(--ease-standard);
76
- }
77
- :hover > .pl-arrow,
78
- :focus-visible > .pl-arrow {
79
- transform: translateX(5px);
80
- }
49
+ /* Drawn underline. 3 px, left to right, 200 ms. Sage in the hero. */
50
+ .pl-ul {
51
+ position: relative;
52
+ text-decoration: none;
53
+ color: inherit;
54
+ }
55
+ .pl-ul::after {
56
+ content: "";
57
+ position: absolute;
58
+ left: 0;
59
+ right: 0;
60
+ bottom: -2px;
61
+ height: 3px;
62
+ background: var(--play);
63
+ transform: scaleX(0);
64
+ transform-origin: left;
65
+ transition: transform var(--duration-base) var(--ease-standard);
66
+ }
67
+ .pl-ul:hover::after,
68
+ .pl-ul:focus-visible::after {
69
+ transform: scaleX(1);
70
+ }
71
+ .pl-hero .pl-ul::after {
72
+ background: var(--sage-text);
73
+ }
81
74
 
82
- /* Row nudge. +6 px, and a table row gets a 3 px edge. */
83
- .pl-row {
84
- display: block;
85
- transition: transform var(--duration-fast) var(--ease-standard);
86
- }
87
- .pl-row:hover,
88
- .pl-row:focus-visible {
89
- transform: translateX(6px);
90
- }
91
- .pl-tr {
92
- transition: box-shadow var(--duration-fast) var(--ease-standard);
93
- }
94
- .pl-tr:hover {
95
- box-shadow: inset 3px 0 0 var(--play);
96
- }
75
+ /* Arrow nudge. +5 px on the parent's hover. */
76
+ .pl-arrow {
77
+ display: inline-flex;
78
+ transition: transform var(--duration-fast) var(--ease-standard);
79
+ }
80
+ :hover > .pl-arrow,
81
+ :focus-visible > .pl-arrow {
82
+ transform: translateX(5px);
83
+ }
97
84
 
98
- /* Entrance and press. Rise is staggered by animation-delay at the call site. */
99
- .pl-rise {
100
- animation: pl-rise var(--duration-slow) var(--ease-enter) both;
101
- }
102
- @keyframes pl-rise {
103
- from {
104
- opacity: 0;
105
- transform: translateY(10px);
85
+ /* Row nudge. +6 px, and a table row gets a 3 px edge. */
86
+ .pl-row {
87
+ display: block;
88
+ transition: transform var(--duration-fast) var(--ease-standard);
106
89
  }
107
- to {
108
- opacity: 1;
109
- transform: translateY(0);
90
+ .pl-row:hover,
91
+ .pl-row:focus-visible {
92
+ transform: translateX(6px);
110
93
  }
111
- }
112
- .pl-press {
113
- transition: transform var(--duration-fast) var(--ease-standard);
114
- }
115
- .pl-press:active {
116
- transform: scale(0.97);
117
- }
118
- .pl-btn-bounce:hover {
119
- animation: pl-wiggle var(--duration-slower) var(--ease-spring);
120
- }
121
- @keyframes pl-wiggle {
122
- 25% {
123
- transform: rotate(-2deg);
94
+ .pl-tr {
95
+ transition: box-shadow var(--duration-fast) var(--ease-standard);
124
96
  }
125
- 75% {
126
- transform: rotate(2deg);
97
+ .pl-tr:hover {
98
+ box-shadow: inset 3px 0 0 var(--play);
127
99
  }
128
- }
129
100
 
130
- /* Decorative loops for the composed home-page pieces. All aria-hidden at the
131
- call site. */
132
- @keyframes pl-drift {
133
- to {
134
- background-position: 28px 28px;
101
+ /* Entrance and press. Rise is staggered by animation-delay at the call site. */
102
+ .pl-rise {
103
+ animation: pl-rise var(--duration-slow) var(--ease-enter) both;
135
104
  }
136
- }
137
- @keyframes pl-spin {
138
- to {
139
- transform: rotate(360deg);
105
+ @keyframes pl-rise {
106
+ from {
107
+ opacity: 0;
108
+ transform: translateY(10px);
109
+ }
110
+ to {
111
+ opacity: 1;
112
+ transform: translateY(0);
113
+ }
140
114
  }
141
- }
142
- @keyframes pl-bob {
143
- 50% {
144
- transform: translateY(4px);
115
+ .pl-press {
116
+ transition: transform var(--duration-fast) var(--ease-standard);
145
117
  }
146
- }
147
- @keyframes pl-marquee {
148
- to {
149
- transform: translateX(-50%);
118
+ .pl-press:active {
119
+ transform: scale(0.97);
120
+ }
121
+ .pl-btn-bounce:hover {
122
+ animation: pl-wiggle var(--duration-slower) var(--ease-spring);
123
+ }
124
+ @keyframes pl-wiggle {
125
+ 25% {
126
+ transform: rotate(-2deg);
127
+ }
128
+ 75% {
129
+ transform: rotate(2deg);
130
+ }
150
131
  }
151
- }
152
132
 
153
- /* Horizontal category rail. The current item is marked with data-on. */
154
- .pl-chips {
155
- display: flex;
156
- gap: var(--space-2);
157
- overflow-x: auto;
158
- padding: var(--space-0-5, 2px) var(--space-5) var(--space-2);
159
- scrollbar-width: none;
160
- }
161
- .pl-chips::-webkit-scrollbar {
162
- display: none;
163
- }
164
- .pl-chip {
165
- flex: none;
166
- min-height: 44px;
167
- padding: var(--space-2) var(--space-3-5, 14px);
168
- display: inline-flex;
169
- align-items: center;
170
- border: 1px solid var(--border);
171
- border-radius: var(--radius-full);
172
- background: var(--surface);
173
- color: var(--text);
174
- font-size: var(--text-sm);
175
- font-weight: var(--weight-medium);
176
- text-decoration: none;
177
- white-space: nowrap;
178
- }
179
- .pl-chip:hover {
180
- border-color: var(--border-strong);
181
- color: var(--text);
182
- }
183
- .pl-chip:focus-visible {
184
- outline: 2px solid var(--focus);
185
- outline-offset: 2px;
186
- }
187
- .pl-chip[data-on="1"] {
188
- border-color: var(--sage-xdark);
189
- background: var(--sage-xdark);
190
- color: var(--ivory-light);
191
- }
133
+ /* Decorative loops for the composed home-page pieces. All aria-hidden at the
134
+ call site. */
135
+ @keyframes pl-drift {
136
+ to {
137
+ background-position: 28px 28px;
138
+ }
139
+ }
140
+ @keyframes pl-spin {
141
+ to {
142
+ transform: rotate(360deg);
143
+ }
144
+ }
145
+ @keyframes pl-bob {
146
+ 50% {
147
+ transform: translateY(4px);
148
+ }
149
+ }
150
+ @keyframes pl-marquee {
151
+ to {
152
+ transform: translateX(-50%);
153
+ }
154
+ }
192
155
 
193
- /* Mobile product rail. Consumers use a regular grid at wider viewports. */
194
- .pl-carousel {
195
- display: flex;
196
- gap: var(--space-3);
197
- overflow-x: auto;
198
- scroll-snap-type: x mandatory;
199
- -webkit-overflow-scrolling: touch;
200
- scrollbar-width: none;
201
- padding: 0 var(--space-5) var(--space-2);
202
- }
203
- .pl-carousel::-webkit-scrollbar {
204
- display: none;
205
- }
206
- .pl-carousel > * {
207
- flex: 0 0 86%;
208
- scroll-snap-align: center;
209
- }
210
- .pl-carousel:focus-visible {
211
- outline: 2px solid var(--focus);
212
- outline-offset: 2px;
213
- }
156
+ /* Horizontal category rail. The current item is marked with data-on. */
157
+ .pl-chips {
158
+ display: flex;
159
+ gap: var(--space-2);
160
+ overflow-x: auto;
161
+ padding: var(--space-0-5, 2px) var(--space-5) var(--space-2);
162
+ scrollbar-width: none;
163
+ }
164
+ .pl-chips::-webkit-scrollbar {
165
+ display: none;
166
+ }
167
+ .pl-chip {
168
+ flex: none;
169
+ min-height: 44px;
170
+ padding: var(--space-2) var(--space-3-5, 14px);
171
+ display: inline-flex;
172
+ align-items: center;
173
+ border: 1px solid var(--border);
174
+ border-radius: var(--radius-full);
175
+ background: var(--surface);
176
+ color: var(--text);
177
+ font-size: var(--text-sm);
178
+ font-weight: var(--weight-medium);
179
+ text-decoration: none;
180
+ white-space: nowrap;
181
+ }
182
+ .pl-chip:hover {
183
+ border-color: var(--border-strong);
184
+ color: var(--text);
185
+ }
186
+ .pl-chip:focus-visible {
187
+ outline: 2px solid var(--focus);
188
+ outline-offset: 2px;
189
+ }
190
+ .pl-chip[data-on="1"] {
191
+ border-color: var(--sage-xdark);
192
+ background: var(--sage-xdark);
193
+ color: var(--ivory-light);
194
+ }
214
195
 
215
- /* The kill switch and the OS setting both stop every loop and transition in
216
- the layer, so it degrades to the plain components. */
217
- .pl-root[data-motion="off"] *,
218
- .pl-root[data-motion="off"] *::after,
219
- .pl-root[data-motion="off"] *::before {
220
- animation: none !important;
221
- transition: none !important;
222
- }
196
+ /* Mobile product rail. Consumers use a regular grid at wider viewports. */
197
+ .pl-carousel {
198
+ display: flex;
199
+ gap: var(--space-3);
200
+ overflow-x: auto;
201
+ scroll-snap-type: x mandatory;
202
+ -webkit-overflow-scrolling: touch;
203
+ scrollbar-width: none;
204
+ padding: 0 var(--space-5) var(--space-2);
205
+ }
206
+ .pl-carousel::-webkit-scrollbar {
207
+ display: none;
208
+ }
209
+ .pl-carousel > * {
210
+ flex: 0 0 86%;
211
+ scroll-snap-align: center;
212
+ }
213
+ .pl-carousel:focus-visible {
214
+ outline: 2px solid var(--focus);
215
+ outline-offset: 2px;
216
+ }
223
217
 
224
- @media (prefers-reduced-motion: reduce) {
225
- .pl-root *,
226
- .pl-root *::after,
227
- .pl-root *::before {
218
+ /* The kill switch and the OS setting both stop every loop and transition in
219
+ the layer, so it degrades to the plain components. */
220
+ .pl-root[data-motion="off"] *,
221
+ .pl-root[data-motion="off"] *::after,
222
+ .pl-root[data-motion="off"] *::before {
228
223
  animation: none !important;
229
224
  transition: none !important;
230
225
  }
231
- .pl-lift:hover,
232
- .pl-lift:focus-within {
233
- transform: none;
234
- }
235
- .pl-ul::after {
236
- transform: scaleX(1);
226
+
227
+ @media (prefers-reduced-motion: reduce) {
228
+ .pl-root *,
229
+ .pl-root *::after,
230
+ .pl-root *::before {
231
+ animation: none !important;
232
+ transition: none !important;
233
+ }
234
+ .pl-lift:hover,
235
+ .pl-lift:focus-within {
236
+ transform: none;
237
+ }
238
+ .pl-ul::after {
239
+ transform: scaleX(1);
240
+ }
237
241
  }
238
242
  }