@nyxwire/css 0.0.0-stage → 0.1.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/LICENSE +21 -0
- package/README.md +133 -2
- package/dist/base.css +850 -0
- package/dist/components.css +10508 -0
- package/dist/docs/components/accordion.md +83 -0
- package/dist/docs/components/alert.md +52 -0
- package/dist/docs/components/avatar.md +55 -0
- package/dist/docs/components/badge.md +64 -0
- package/dist/docs/components/breadcrumbs.md +64 -0
- package/dist/docs/components/button.md +197 -0
- package/dist/docs/components/card.md +103 -0
- package/dist/docs/components/checkbox.md +45 -0
- package/dist/docs/components/chip.md +30 -0
- package/dist/docs/components/cluster.md +33 -0
- package/dist/docs/components/code.md +65 -0
- package/dist/docs/components/container.md +24 -0
- package/dist/docs/components/dialog.md +199 -0
- package/dist/docs/components/divider.md +31 -0
- package/dist/docs/components/dl.md +24 -0
- package/dist/docs/components/effect-utilities.md +82 -0
- package/dist/docs/components/empty.md +40 -0
- package/dist/docs/components/frame.md +27 -0
- package/dist/docs/components/grid.md +31 -0
- package/dist/docs/components/hud.md +75 -0
- package/dist/docs/components/input-group.md +28 -0
- package/dist/docs/components/input.md +52 -0
- package/dist/docs/components/kbd.md +42 -0
- package/dist/docs/components/label-and-field.md +31 -0
- package/dist/docs/components/link.md +41 -0
- package/dist/docs/components/list.md +67 -0
- package/dist/docs/components/menu.md +85 -0
- package/dist/docs/components/meter.md +77 -0
- package/dist/docs/components/navbar.md +66 -0
- package/dist/docs/components/pagination.md +64 -0
- package/dist/docs/components/popover.md +59 -0
- package/dist/docs/components/progress.md +32 -0
- package/dist/docs/components/prose.md +29 -0
- package/dist/docs/components/select.md +51 -0
- package/dist/docs/components/sidebar.md +35 -0
- package/dist/docs/components/sidenav.md +45 -0
- package/dist/docs/components/skeleton.md +36 -0
- package/dist/docs/components/slider.md +32 -0
- package/dist/docs/components/spinner.md +30 -0
- package/dist/docs/components/stack.md +26 -0
- package/dist/docs/components/steps.md +49 -0
- package/dist/docs/components/switch.md +19 -0
- package/dist/docs/components/table.md +83 -0
- package/dist/docs/components/tabs.md +207 -0
- package/dist/docs/components/textarea.md +13 -0
- package/dist/docs/components/toast.md +86 -0
- package/dist/docs/components/tooltip.md +39 -0
- package/dist/docs/components/typography-classes.md +38 -0
- package/dist/docs/families/data-display.md +15 -0
- package/dist/docs/families/feedback.md +13 -0
- package/dist/docs/families/forms.md +141 -0
- package/dist/docs/families/layout-typography.md +17 -0
- package/dist/docs/families/navigation.md +13 -0
- package/dist/docs/families/overlays.md +13 -0
- package/dist/docs/families/surfaces.md +11 -0
- package/dist/docs/foundations/accessibility.md +71 -0
- package/dist/docs/foundations/color-roles.md +114 -0
- package/dist/docs/foundations/effects-motion.md +150 -0
- package/dist/docs/foundations/flavors.md +156 -0
- package/dist/docs/foundations/icons.md +45 -0
- package/dist/docs/foundations/palette.md +180 -0
- package/dist/docs/foundations/spacing-elevation.md +168 -0
- package/dist/docs/foundations/typography.md +80 -0
- package/dist/docs/index.md +233 -0
- package/dist/docs/manifest.json +859 -0
- package/dist/fonts/inter-OFL.txt +93 -0
- package/dist/fonts/inter-latin-ext-wght-italic.woff2 +0 -0
- package/dist/fonts/inter-latin-ext-wght-normal.woff2 +0 -0
- package/dist/fonts/inter-latin-wght-italic.woff2 +0 -0
- package/dist/fonts/inter-latin-wght-normal.woff2 +0 -0
- package/dist/fonts/martian-mono-OFL.txt +93 -0
- package/dist/fonts/martian-mono-latin-ext-wdth-normal.woff2 +0 -0
- package/dist/fonts/martian-mono-latin-wdth-normal.woff2 +0 -0
- package/dist/fonts/space-grotesk-OFL.txt +93 -0
- package/dist/fonts/space-grotesk-latin-ext-wght-normal.woff2 +0 -0
- package/dist/fonts/space-grotesk-latin-wght-normal.woff2 +0 -0
- package/dist/fonts.css +73 -0
- package/dist/nyxwire.css +12183 -0
- package/dist/tokens.css +579 -0
- package/dist/utilities.css +176 -0
- package/nyxwire.d.ts +2 -0
- package/package.json +66 -3
- package/skills/nyxwire/SKILL.md +63 -0
- package/src/base.css +158 -0
- package/src/components/accordion.css +280 -0
- package/src/components/alert.css +176 -0
- package/src/components/avatar.css +262 -0
- package/src/components/badge.css +193 -0
- package/src/components/breadcrumbs.css +209 -0
- package/src/components/btn.css +517 -0
- package/src/components/card.css +327 -0
- package/src/components/checkbox.css +202 -0
- package/src/components/chip.css +345 -0
- package/src/components/code.css +340 -0
- package/src/components/dialog.css +411 -0
- package/src/components/divider.css +201 -0
- package/src/components/empty.css +216 -0
- package/src/components/field.css +161 -0
- package/src/components/hud.css +212 -0
- package/src/components/index.css +50 -0
- package/src/components/input.css +383 -0
- package/src/components/kbd.css +197 -0
- package/src/components/layout.css +344 -0
- package/src/components/link.css +178 -0
- package/src/components/list.css +353 -0
- package/src/components/menu.css +347 -0
- package/src/components/meter.css +238 -0
- package/src/components/navbar.css +309 -0
- package/src/components/pagination.css +302 -0
- package/src/components/popover.css +352 -0
- package/src/components/progress.css +241 -0
- package/src/components/select.css +121 -0
- package/src/components/sidenav.css +326 -0
- package/src/components/skeleton.css +193 -0
- package/src/components/slider.css +201 -0
- package/src/components/spinner.css +200 -0
- package/src/components/stat.css +263 -0
- package/src/components/steps.css +311 -0
- package/src/components/switch.css +183 -0
- package/src/components/table.css +290 -0
- package/src/components/tabs.css +271 -0
- package/src/components/toast.css +413 -0
- package/src/components/tooltip.css +288 -0
- package/src/fonts.css +92 -0
- package/src/index.css +6 -0
- package/src/motion.css +177 -0
- package/src/semantic.css +85 -0
- package/src/tokens.css +276 -0
- package/src/typography.css +430 -0
- package/src/utilities.css +198 -0
|
@@ -0,0 +1,327 @@
|
|
|
1
|
+
/* Card: one padded surface with a grid gap, so content can go straight in without a body wrapper.
|
|
2
|
+
Parts are optional: header, title, description, body, footer, media.
|
|
3
|
+
Variants change the surface: solid (default), soft (a wash of the intent), outline, ghost.
|
|
4
|
+
An intent class on a plain card does nothing visible until it is interactive or soft: the card
|
|
5
|
+
stays neutral and spends the accent on its edge, its selection and its glow.
|
|
6
|
+
.nw-card-cut is opt-in and composes with .nw-card-wire; .nw-card-glow follows the cut. */
|
|
7
|
+
@layer components {
|
|
8
|
+
.nw-card {
|
|
9
|
+
--_intent: var(--nw-primary);
|
|
10
|
+
--_soft: var(--nw-primary-soft);
|
|
11
|
+
--_pad: var(--nw-space-6);
|
|
12
|
+
--_radius: var(--nw-radius-lg);
|
|
13
|
+
--_cut-size: var(--nw-space-4);
|
|
14
|
+
--_fill: var(--nw-panel);
|
|
15
|
+
--_line: var(--nw-line);
|
|
16
|
+
--_fill-hover: var(--nw-panel-hover);
|
|
17
|
+
--_fill-active: var(--nw-panel-active);
|
|
18
|
+
--_line-hover: color-mix(in oklab, var(--_intent) 50%, var(--nw-line));
|
|
19
|
+
--_shadow: var(--nw-shadow-sm);
|
|
20
|
+
|
|
21
|
+
position: relative;
|
|
22
|
+
display: grid;
|
|
23
|
+
align-content: start;
|
|
24
|
+
gap: var(--nw-space-4);
|
|
25
|
+
min-inline-size: 0;
|
|
26
|
+
box-sizing: border-box;
|
|
27
|
+
padding: var(--_pad);
|
|
28
|
+
border: 1px solid var(--_line);
|
|
29
|
+
border-radius: var(--_radius);
|
|
30
|
+
color: var(--nw-fg);
|
|
31
|
+
background-color: var(--_fill);
|
|
32
|
+
box-shadow: var(--_shadow);
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
/* Intents: the accent of the edge, the selection and the soft wash ---------------------------- */
|
|
36
|
+
.nw-card-primary {
|
|
37
|
+
--_intent: var(--nw-primary);
|
|
38
|
+
--_soft: var(--nw-primary-soft);
|
|
39
|
+
}
|
|
40
|
+
.nw-card-secondary {
|
|
41
|
+
--_intent: var(--nw-secondary);
|
|
42
|
+
--_soft: var(--nw-secondary-soft);
|
|
43
|
+
}
|
|
44
|
+
.nw-card-tertiary {
|
|
45
|
+
--_intent: var(--nw-tertiary);
|
|
46
|
+
--_soft: var(--nw-tertiary-soft);
|
|
47
|
+
}
|
|
48
|
+
.nw-card-neutral {
|
|
49
|
+
--_intent: var(--nw-fg-muted);
|
|
50
|
+
--_soft: color-mix(in oklab, var(--nw-fg-muted) 16%, transparent);
|
|
51
|
+
}
|
|
52
|
+
.nw-card-info {
|
|
53
|
+
--_intent: var(--nw-info);
|
|
54
|
+
--_soft: var(--nw-info-soft);
|
|
55
|
+
}
|
|
56
|
+
.nw-card-success {
|
|
57
|
+
--_intent: var(--nw-success);
|
|
58
|
+
--_soft: var(--nw-success-soft);
|
|
59
|
+
}
|
|
60
|
+
.nw-card-warning {
|
|
61
|
+
--_intent: var(--nw-warning);
|
|
62
|
+
--_soft: var(--nw-warning-soft);
|
|
63
|
+
}
|
|
64
|
+
.nw-card-danger {
|
|
65
|
+
--_intent: var(--nw-danger);
|
|
66
|
+
--_soft: var(--nw-danger-soft);
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
/* Variants ------------------------------------------------------------------------------- */
|
|
70
|
+
.nw-card-solid {
|
|
71
|
+
--_fill: var(--nw-panel);
|
|
72
|
+
--_line: var(--nw-line);
|
|
73
|
+
}
|
|
74
|
+
.nw-card-soft {
|
|
75
|
+
--_fill: var(--_soft);
|
|
76
|
+
--_line: color-mix(in oklab, var(--_intent) 35%, transparent);
|
|
77
|
+
--_fill-hover: var(--_soft);
|
|
78
|
+
--_fill-active: var(--_soft);
|
|
79
|
+
--_line-hover: var(--_intent);
|
|
80
|
+
}
|
|
81
|
+
.nw-card-outline {
|
|
82
|
+
--_fill: transparent;
|
|
83
|
+
--_line: var(--nw-line-strong);
|
|
84
|
+
--_shadow: none;
|
|
85
|
+
--_fill-hover: var(--nw-panel);
|
|
86
|
+
--_fill-active: var(--nw-panel-hover);
|
|
87
|
+
}
|
|
88
|
+
.nw-card-ghost {
|
|
89
|
+
--_fill: transparent;
|
|
90
|
+
--_line: transparent;
|
|
91
|
+
--_shadow: none;
|
|
92
|
+
--_fill-hover: var(--nw-panel-hover);
|
|
93
|
+
--_fill-active: var(--nw-panel-active);
|
|
94
|
+
--_line-hover: transparent;
|
|
95
|
+
padding-inline: 0;
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
/* Sizes ---------------------------------------------------------------------------------- */
|
|
99
|
+
.nw-card-sm {
|
|
100
|
+
--_pad: var(--nw-space-4);
|
|
101
|
+
--_radius: var(--nw-radius-md);
|
|
102
|
+
--_cut-size: var(--nw-space-3);
|
|
103
|
+
gap: var(--nw-space-3);
|
|
104
|
+
}
|
|
105
|
+
.nw-card-md {
|
|
106
|
+
--_pad: var(--nw-space-6);
|
|
107
|
+
--_radius: var(--nw-radius-lg);
|
|
108
|
+
--_cut-size: var(--nw-space-4);
|
|
109
|
+
}
|
|
110
|
+
.nw-card-lg {
|
|
111
|
+
--_pad: var(--nw-space-8);
|
|
112
|
+
--_radius: var(--nw-radius-xl);
|
|
113
|
+
--_cut-size: var(--nw-space-5);
|
|
114
|
+
gap: var(--nw-space-5);
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
/* Parts ---------------------------------------------------------------------------------- */
|
|
118
|
+
.nw-card-header {
|
|
119
|
+
display: flex;
|
|
120
|
+
flex-wrap: wrap;
|
|
121
|
+
align-items: flex-start;
|
|
122
|
+
justify-content: space-between;
|
|
123
|
+
gap: var(--nw-space-2) var(--nw-space-4);
|
|
124
|
+
min-inline-size: 0;
|
|
125
|
+
}
|
|
126
|
+
.nw-card-title {
|
|
127
|
+
margin: 0;
|
|
128
|
+
font-family: var(--nw-font-display);
|
|
129
|
+
font-size: var(--nw-text-lg);
|
|
130
|
+
font-weight: 600;
|
|
131
|
+
line-height: var(--nw-leading-snug);
|
|
132
|
+
letter-spacing: var(--nw-tracking-tight);
|
|
133
|
+
color: var(--nw-fg);
|
|
134
|
+
}
|
|
135
|
+
.nw-card-description {
|
|
136
|
+
margin: 0;
|
|
137
|
+
font-size: var(--nw-text-sm);
|
|
138
|
+
line-height: var(--nw-leading-normal);
|
|
139
|
+
color: var(--nw-fg-muted);
|
|
140
|
+
}
|
|
141
|
+
.nw-card-body {
|
|
142
|
+
display: grid;
|
|
143
|
+
gap: var(--nw-space-3);
|
|
144
|
+
min-inline-size: 0;
|
|
145
|
+
font-size: var(--nw-text-sm);
|
|
146
|
+
line-height: var(--nw-leading-normal);
|
|
147
|
+
}
|
|
148
|
+
.nw-card-footer {
|
|
149
|
+
display: flex;
|
|
150
|
+
flex-wrap: wrap;
|
|
151
|
+
align-items: center;
|
|
152
|
+
gap: var(--nw-space-2);
|
|
153
|
+
}
|
|
154
|
+
.nw-card-footer-end {
|
|
155
|
+
justify-content: flex-end;
|
|
156
|
+
}
|
|
157
|
+
.nw-card-footer-divided {
|
|
158
|
+
padding-block-start: var(--nw-space-4);
|
|
159
|
+
border-block-start: 1px solid var(--nw-line);
|
|
160
|
+
}
|
|
161
|
+
/* Full-bleed media: it escapes the padding but never the radius or the chamfer. */
|
|
162
|
+
.nw-card-media {
|
|
163
|
+
display: block;
|
|
164
|
+
inline-size: calc(100% + 2 * var(--_pad));
|
|
165
|
+
max-inline-size: none;
|
|
166
|
+
margin-inline: calc(-1 * var(--_pad));
|
|
167
|
+
aspect-ratio: 16 / 9;
|
|
168
|
+
object-fit: cover;
|
|
169
|
+
background-color: var(--nw-canvas-sunken);
|
|
170
|
+
}
|
|
171
|
+
.nw-card-media:first-child {
|
|
172
|
+
margin-block-start: calc(-1 * var(--_pad));
|
|
173
|
+
border-start-start-radius: calc(var(--_radius) - 1px);
|
|
174
|
+
border-start-end-radius: calc(var(--_radius) - 1px);
|
|
175
|
+
}
|
|
176
|
+
.nw-card-media:last-child {
|
|
177
|
+
margin-block-end: calc(-1 * var(--_pad));
|
|
178
|
+
border-end-start-radius: calc(var(--_radius) - 1px);
|
|
179
|
+
border-end-end-radius: calc(var(--_radius) - 1px);
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
/* Interactive ------------------------------------------------------------------------------ */
|
|
183
|
+
.nw-card-interactive {
|
|
184
|
+
cursor: pointer;
|
|
185
|
+
text-decoration-line: none;
|
|
186
|
+
transition:
|
|
187
|
+
background-color var(--nw-duration-base) var(--nw-ease-standard),
|
|
188
|
+
border-color var(--nw-duration-base) var(--nw-ease-standard),
|
|
189
|
+
box-shadow var(--nw-duration-base) var(--nw-ease-standard),
|
|
190
|
+
filter var(--nw-duration-base) var(--nw-ease-standard),
|
|
191
|
+
translate var(--nw-duration-base) var(--nw-ease-out);
|
|
192
|
+
}
|
|
193
|
+
.nw-card-interactive:hover:not([aria-disabled='true']) {
|
|
194
|
+
--_fill: var(--_fill-hover);
|
|
195
|
+
--_line: var(--_line-hover);
|
|
196
|
+
--_shadow: var(--nw-shadow-md);
|
|
197
|
+
translate: 0 calc(-1 * var(--nw-space-0-5));
|
|
198
|
+
}
|
|
199
|
+
.nw-card-interactive:active:not([aria-disabled='true']) {
|
|
200
|
+
--_fill: var(--_fill-active);
|
|
201
|
+
translate: none;
|
|
202
|
+
transition-duration: var(--nw-duration-instant);
|
|
203
|
+
}
|
|
204
|
+
.nw-card-interactive:focus-visible {
|
|
205
|
+
outline: var(--nw-ring-width) solid var(--nw-ring);
|
|
206
|
+
outline-offset: var(--nw-ring-offset);
|
|
207
|
+
}
|
|
208
|
+
/* Selected: a tonal wash and a 1px intent edge, not a second accent outline. */
|
|
209
|
+
.nw-card:is(
|
|
210
|
+
[aria-selected='true'],
|
|
211
|
+
[aria-pressed='true'],
|
|
212
|
+
[aria-checked='true'],
|
|
213
|
+
[data-state='on']
|
|
214
|
+
),
|
|
215
|
+
.nw-card-selected {
|
|
216
|
+
--_fill: color-mix(in oklab, var(--_intent) 10%, var(--nw-panel));
|
|
217
|
+
--_line: var(--_intent);
|
|
218
|
+
}
|
|
219
|
+
.nw-card[aria-disabled='true'] {
|
|
220
|
+
--_fill: var(--nw-panel);
|
|
221
|
+
--_line: var(--nw-line);
|
|
222
|
+
--_shadow: none;
|
|
223
|
+
color: var(--nw-fg-disabled);
|
|
224
|
+
cursor: not-allowed;
|
|
225
|
+
translate: none;
|
|
226
|
+
}
|
|
227
|
+
|
|
228
|
+
/* Cut corners and the wire edge ------------------------------------------------------------ */
|
|
229
|
+
.nw-card-cut {
|
|
230
|
+
isolation: isolate;
|
|
231
|
+
border: 0;
|
|
232
|
+
border-radius: 0;
|
|
233
|
+
background: var(--nw-cut-surface);
|
|
234
|
+
--nw-cut: var(--_cut-size);
|
|
235
|
+
--nw-fill: var(--_fill);
|
|
236
|
+
/* clip-path clips box-shadow, so a cut card glows through a filter instead. */
|
|
237
|
+
box-shadow: none;
|
|
238
|
+
}
|
|
239
|
+
.nw-card-cut::before {
|
|
240
|
+
content: '';
|
|
241
|
+
position: absolute;
|
|
242
|
+
inset: 0;
|
|
243
|
+
z-index: 1;
|
|
244
|
+
pointer-events: none;
|
|
245
|
+
background: var(--_line);
|
|
246
|
+
clip-path: var(--nw-cut-ring);
|
|
247
|
+
}
|
|
248
|
+
.nw-card-wire {
|
|
249
|
+
background:
|
|
250
|
+
linear-gradient(var(--_fill), var(--_fill)) padding-box,
|
|
251
|
+
var(--nw-gradient-wire) border-box;
|
|
252
|
+
}
|
|
253
|
+
.nw-card-cut.nw-card-wire {
|
|
254
|
+
background: var(--nw-cut-surface);
|
|
255
|
+
}
|
|
256
|
+
.nw-card-cut.nw-card-wire::before {
|
|
257
|
+
background: var(--nw-gradient-wire);
|
|
258
|
+
}
|
|
259
|
+
.nw-card-cut > .nw-card-media {
|
|
260
|
+
clip-path: var(--nw-cut-path);
|
|
261
|
+
}
|
|
262
|
+
.nw-card-glow {
|
|
263
|
+
--nw-glow-color: var(--_intent);
|
|
264
|
+
box-shadow: var(--nw-glow-md);
|
|
265
|
+
}
|
|
266
|
+
.nw-card-cut.nw-card-glow {
|
|
267
|
+
box-shadow: none;
|
|
268
|
+
filter: var(--nw-glow-drop-md);
|
|
269
|
+
}
|
|
270
|
+
.nw-card-cut.nw-card-wire-glow {
|
|
271
|
+
box-shadow: none;
|
|
272
|
+
filter: var(--nw-glow-drop-wire);
|
|
273
|
+
}
|
|
274
|
+
.nw-card-interactive:is(
|
|
275
|
+
:hover,
|
|
276
|
+
[aria-selected='true'],
|
|
277
|
+
[aria-pressed='true'],
|
|
278
|
+
[aria-checked='true'],
|
|
279
|
+
[data-state='on']
|
|
280
|
+
):not([aria-disabled='true']) {
|
|
281
|
+
--nw-glow-color: var(--_intent);
|
|
282
|
+
}
|
|
283
|
+
.nw-card-cut.nw-card-interactive:is(
|
|
284
|
+
:hover,
|
|
285
|
+
[aria-selected='true'],
|
|
286
|
+
[aria-pressed='true'],
|
|
287
|
+
[aria-checked='true'],
|
|
288
|
+
[data-state='on']
|
|
289
|
+
):not([aria-disabled='true']) {
|
|
290
|
+
filter: var(--nw-glow-drop-sm);
|
|
291
|
+
}
|
|
292
|
+
|
|
293
|
+
@media (prefers-reduced-motion: reduce) {
|
|
294
|
+
.nw-card-interactive:hover:not([aria-disabled='true']) {
|
|
295
|
+
translate: none;
|
|
296
|
+
}
|
|
297
|
+
}
|
|
298
|
+
|
|
299
|
+
@media (forced-colors: active) {
|
|
300
|
+
.nw-card,
|
|
301
|
+
.nw-card-cut,
|
|
302
|
+
.nw-card-wire {
|
|
303
|
+
background: Canvas;
|
|
304
|
+
color: CanvasText;
|
|
305
|
+
border: 1px solid CanvasText;
|
|
306
|
+
box-shadow: none;
|
|
307
|
+
filter: none;
|
|
308
|
+
}
|
|
309
|
+
.nw-card-cut::before {
|
|
310
|
+
display: none;
|
|
311
|
+
}
|
|
312
|
+
.nw-card:is(
|
|
313
|
+
[aria-selected='true'],
|
|
314
|
+
[aria-pressed='true'],
|
|
315
|
+
[aria-checked='true'],
|
|
316
|
+
[data-state='on']
|
|
317
|
+
),
|
|
318
|
+
.nw-card-selected {
|
|
319
|
+
background: Canvas;
|
|
320
|
+
border-color: Highlight;
|
|
321
|
+
}
|
|
322
|
+
.nw-card[aria-disabled='true'] {
|
|
323
|
+
color: GrayText;
|
|
324
|
+
border-color: GrayText;
|
|
325
|
+
}
|
|
326
|
+
}
|
|
327
|
+
}
|
|
@@ -0,0 +1,202 @@
|
|
|
1
|
+
/* Checkbox and radio, drawn from tokens on the native input: no extra markup, and :checked,
|
|
2
|
+
:indeterminate, :disabled and :focus-visible keep working.
|
|
3
|
+
The mark is a clipped pseudo-element whose color is currentColor, so it reads in every intent
|
|
4
|
+
and survives forced colors. An intent class colors the checked control.
|
|
5
|
+
Wrap one in a .nw-label to make its text clickable; the label aligns the control to the first
|
|
6
|
+
text line through the lh margin below.
|
|
7
|
+
The visible box is small by design; the ::after hit area is at least 24px, and a wrapping label
|
|
8
|
+
makes the whole row a target. */
|
|
9
|
+
@layer components {
|
|
10
|
+
.nw-checkbox,
|
|
11
|
+
.nw-radio {
|
|
12
|
+
--_intent: var(--nw-primary);
|
|
13
|
+
--_on: var(--nw-on-primary);
|
|
14
|
+
--_size: var(--nw-space-4);
|
|
15
|
+
--_fill: var(--nw-line-strong);
|
|
16
|
+
--_mark: var(--nw-fg-subtle);
|
|
17
|
+
--_glow: none;
|
|
18
|
+
|
|
19
|
+
position: relative;
|
|
20
|
+
display: inline-grid;
|
|
21
|
+
place-content: center;
|
|
22
|
+
flex: none;
|
|
23
|
+
box-sizing: border-box;
|
|
24
|
+
inline-size: var(--_size);
|
|
25
|
+
block-size: var(--_size);
|
|
26
|
+
margin: 0;
|
|
27
|
+
border: 1px solid var(--_fill);
|
|
28
|
+
background-color: color-mix(
|
|
29
|
+
in oklab,
|
|
30
|
+
var(--nw-canvas-sunken) calc(100% * var(--nw-flavor-dark)),
|
|
31
|
+
var(--nw-canvas)
|
|
32
|
+
);
|
|
33
|
+
color: var(--_on);
|
|
34
|
+
cursor: pointer;
|
|
35
|
+
appearance: none;
|
|
36
|
+
-webkit-tap-highlight-color: transparent;
|
|
37
|
+
transition:
|
|
38
|
+
background-color var(--nw-duration-fast) var(--nw-ease-standard),
|
|
39
|
+
border-color var(--nw-duration-fast) var(--nw-ease-standard),
|
|
40
|
+
box-shadow var(--nw-duration-fast) var(--nw-ease-standard);
|
|
41
|
+
}
|
|
42
|
+
.nw-checkbox {
|
|
43
|
+
border-radius: var(--nw-radius-sm);
|
|
44
|
+
}
|
|
45
|
+
.nw-radio {
|
|
46
|
+
border-radius: var(--nw-radius-full);
|
|
47
|
+
}
|
|
48
|
+
.nw-checkbox::before,
|
|
49
|
+
.nw-radio::before {
|
|
50
|
+
content: '';
|
|
51
|
+
display: block;
|
|
52
|
+
background-color: currentColor;
|
|
53
|
+
transform: scale(0);
|
|
54
|
+
transition: transform var(--nw-duration-fast) var(--nw-ease-back);
|
|
55
|
+
}
|
|
56
|
+
.nw-checkbox::before {
|
|
57
|
+
inline-size: calc(var(--_size) * 0.75);
|
|
58
|
+
block-size: calc(var(--_size) * 0.75);
|
|
59
|
+
clip-path: polygon(14% 44%, 0 59%, 40% 100%, 100% 22%, 84% 7%, 38% 68%);
|
|
60
|
+
}
|
|
61
|
+
.nw-radio::before {
|
|
62
|
+
inline-size: calc(var(--_size) * 0.5);
|
|
63
|
+
block-size: calc(var(--_size) * 0.5);
|
|
64
|
+
border-radius: var(--nw-radius-full);
|
|
65
|
+
}
|
|
66
|
+
.nw-checkbox:checked::before,
|
|
67
|
+
.nw-radio:checked::before {
|
|
68
|
+
transform: scale(1);
|
|
69
|
+
}
|
|
70
|
+
.nw-checkbox:indeterminate::before {
|
|
71
|
+
transform: scale(1);
|
|
72
|
+
clip-path: polygon(0 38%, 100% 38%, 100% 62%, 0 62%);
|
|
73
|
+
}
|
|
74
|
+
.nw-checkbox:checked,
|
|
75
|
+
.nw-radio:checked,
|
|
76
|
+
.nw-checkbox:indeterminate {
|
|
77
|
+
--_fill: var(--_intent);
|
|
78
|
+
background-color: var(--_intent);
|
|
79
|
+
}
|
|
80
|
+
.nw-checkbox:hover:not(:disabled),
|
|
81
|
+
.nw-radio:hover:not(:disabled) {
|
|
82
|
+
--_fill: var(--_intent);
|
|
83
|
+
--_glow: var(--nw-glow-sm);
|
|
84
|
+
box-shadow: var(--_glow);
|
|
85
|
+
}
|
|
86
|
+
.nw-checkbox:active:not(:disabled)::before,
|
|
87
|
+
.nw-radio:active:not(:disabled)::before {
|
|
88
|
+
transition-duration: var(--nw-duration-instant);
|
|
89
|
+
}
|
|
90
|
+
.nw-checkbox:focus-visible,
|
|
91
|
+
.nw-radio:focus-visible {
|
|
92
|
+
outline: var(--nw-ring-width) solid var(--nw-ring);
|
|
93
|
+
outline-offset: var(--nw-ring-offset);
|
|
94
|
+
box-shadow: var(--nw-glow-sm);
|
|
95
|
+
}
|
|
96
|
+
.nw-checkbox:is([aria-invalid='true'], :user-invalid),
|
|
97
|
+
.nw-radio:is([aria-invalid='true'], :user-invalid) {
|
|
98
|
+
--_fill: var(--nw-danger);
|
|
99
|
+
}
|
|
100
|
+
.nw-checkbox:disabled,
|
|
101
|
+
.nw-radio:disabled {
|
|
102
|
+
--_fill: var(--nw-line);
|
|
103
|
+
background-color: var(--nw-canvas-subtle);
|
|
104
|
+
color: var(--nw-fg-disabled);
|
|
105
|
+
box-shadow: none;
|
|
106
|
+
cursor: not-allowed;
|
|
107
|
+
}
|
|
108
|
+
.nw-checkbox:disabled:checked,
|
|
109
|
+
.nw-radio:disabled:checked,
|
|
110
|
+
.nw-checkbox:disabled:indeterminate {
|
|
111
|
+
background-color: var(--nw-panel-active);
|
|
112
|
+
}
|
|
113
|
+
.nw-checkbox::after,
|
|
114
|
+
.nw-radio::after {
|
|
115
|
+
content: '';
|
|
116
|
+
position: absolute;
|
|
117
|
+
inset: calc(50% - var(--nw-space-3));
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
/* Intents -------------------------------------------------------------------------------- */
|
|
121
|
+
.nw-checkbox-primary,
|
|
122
|
+
.nw-radio-primary {
|
|
123
|
+
--_intent: var(--nw-primary);
|
|
124
|
+
--_on: var(--nw-on-primary);
|
|
125
|
+
}
|
|
126
|
+
.nw-checkbox-secondary,
|
|
127
|
+
.nw-radio-secondary {
|
|
128
|
+
--_intent: var(--nw-secondary);
|
|
129
|
+
--_on: var(--nw-on-secondary);
|
|
130
|
+
}
|
|
131
|
+
.nw-checkbox-tertiary,
|
|
132
|
+
.nw-radio-tertiary {
|
|
133
|
+
--_intent: var(--nw-tertiary);
|
|
134
|
+
--_on: var(--nw-on-tertiary);
|
|
135
|
+
}
|
|
136
|
+
.nw-checkbox-neutral,
|
|
137
|
+
.nw-radio-neutral {
|
|
138
|
+
--_intent: var(--nw-fg-muted);
|
|
139
|
+
--_on: var(--nw-canvas);
|
|
140
|
+
}
|
|
141
|
+
.nw-checkbox-info,
|
|
142
|
+
.nw-radio-info {
|
|
143
|
+
--_intent: var(--nw-info);
|
|
144
|
+
--_on: var(--nw-on-info);
|
|
145
|
+
}
|
|
146
|
+
.nw-checkbox-success,
|
|
147
|
+
.nw-radio-success {
|
|
148
|
+
--_intent: var(--nw-success);
|
|
149
|
+
--_on: var(--nw-on-success);
|
|
150
|
+
}
|
|
151
|
+
.nw-checkbox-warning,
|
|
152
|
+
.nw-radio-warning {
|
|
153
|
+
--_intent: var(--nw-warning);
|
|
154
|
+
--_on: var(--nw-on-warning);
|
|
155
|
+
}
|
|
156
|
+
.nw-checkbox-danger,
|
|
157
|
+
.nw-radio-danger {
|
|
158
|
+
--_intent: var(--nw-danger);
|
|
159
|
+
--_on: var(--nw-on-danger);
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
/* Sizes ---------------------------------------------------------------------------------- */
|
|
163
|
+
.nw-checkbox-sm,
|
|
164
|
+
.nw-radio-sm {
|
|
165
|
+
/* 14px: the grid has no 3.5 step. */
|
|
166
|
+
--_size: calc(var(--nw-space-4) - var(--nw-space-0-5));
|
|
167
|
+
}
|
|
168
|
+
.nw-checkbox-md,
|
|
169
|
+
.nw-radio-md {
|
|
170
|
+
--_size: var(--nw-space-4);
|
|
171
|
+
}
|
|
172
|
+
.nw-checkbox-lg,
|
|
173
|
+
.nw-radio-lg {
|
|
174
|
+
--_size: var(--nw-space-5);
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
/* Alignment inside a wrapping label -------------------------------------------------------- */
|
|
178
|
+
.nw-label > .nw-checkbox,
|
|
179
|
+
.nw-label > .nw-radio {
|
|
180
|
+
margin-block: calc((1lh - var(--_size)) / 2);
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
@media (forced-colors: active) {
|
|
184
|
+
.nw-checkbox,
|
|
185
|
+
.nw-radio {
|
|
186
|
+
border-color: ButtonText;
|
|
187
|
+
box-shadow: none;
|
|
188
|
+
}
|
|
189
|
+
.nw-checkbox:checked,
|
|
190
|
+
.nw-radio:checked,
|
|
191
|
+
.nw-checkbox:indeterminate {
|
|
192
|
+
background: Highlight;
|
|
193
|
+
border-color: Highlight;
|
|
194
|
+
color: HighlightText;
|
|
195
|
+
}
|
|
196
|
+
.nw-checkbox:disabled,
|
|
197
|
+
.nw-radio:disabled {
|
|
198
|
+
border-color: GrayText;
|
|
199
|
+
color: GrayText;
|
|
200
|
+
}
|
|
201
|
+
}
|
|
202
|
+
}
|