asta-ui 0.7.0 → 0.8.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.
@@ -0,0 +1,702 @@
1
+ /* Core: buttons, fields, dialog, menu, tabs, badges and the other small parts.
2
+ * Class lists mirror go/ui/<name>.templ. Modifiers come after the base class so they win. */
3
+
4
+ /* ---- Button (button.templ) ----
5
+ * <button class="asta-btn asta-btn-accent asta-btn-sm"><span class="asta-btn-label">Save</span></button>
6
+ * Variants: (solid) accent danger outline soft ghost link. Sizes: xs sm (md) lg. Also asta-btn-icon, asta-btn-pill.
7
+ * Loading: aria-busy="true" or htmx's .htmx-request shows .asta-btn-spinner over the label. */
8
+ .asta-btn {
9
+ @apply relative inline-flex shrink-0 select-none items-center [&_svg]:shrink-0 justify-center whitespace-nowrap font-medium tracking-[-0.01em] outline-none;
10
+ @apply transition-[background-color,color,box-shadow,transform,opacity] duration-200 ease-out active:scale-[0.97];
11
+ @apply focus-visible:ring-2 focus-visible:ring-brand/50 focus-visible:ring-offset-2 focus-visible:ring-offset-paper;
12
+ @apply disabled:pointer-events-none disabled:opacity-45 aria-disabled:pointer-events-none aria-disabled:opacity-45 [&.htmx-request]:pointer-events-none;
13
+ @apply h-10 gap-2 rounded-lg px-4 text-[14px];
14
+ @apply bg-ink text-paper shadow-[inset_0_1px_0_rgb(255_255_255/0.18),0_1px_2px_rgb(0_0_0/0.16),0_6px_14px_-8px_rgb(0_0_0/0.45)] hover:bg-[color-mix(in_srgb,var(--ink)_84%,var(--paper))];
15
+ }
16
+ .asta-btn-accent {
17
+ @apply bg-brand text-white hover:bg-[color-mix(in_srgb,var(--brand)_88%,black)];
18
+ }
19
+ .asta-btn-danger {
20
+ @apply bg-[#e5484d] text-white hover:bg-[#d13d42];
21
+ }
22
+ .asta-btn-outline {
23
+ @apply bg-paper text-ink shadow-[inset_0_0_0_1px_color-mix(in_srgb,var(--ink)_14%,transparent),0_1px_2px_rgb(0_0_0/0.05)];
24
+ @apply hover:bg-paper-2 hover:shadow-[inset_0_0_0_1px_color-mix(in_srgb,var(--ink)_24%,transparent),0_1px_2px_rgb(0_0_0/0.05)];
25
+ }
26
+ .asta-btn-soft {
27
+ @apply bg-paper-2 text-ink shadow-none hover:bg-[color-mix(in_srgb,var(--ink)_8%,var(--paper-2))];
28
+ }
29
+ .asta-btn-ghost {
30
+ @apply bg-transparent text-ink-2 shadow-none hover:bg-paper-2 hover:text-ink;
31
+ }
32
+ .asta-btn-link {
33
+ @apply !h-auto !px-0 bg-transparent text-ink shadow-none hover:bg-transparent bg-[linear-gradient(currentColor,currentColor)] bg-[length:0%_1px] bg-[position:0_100%] bg-no-repeat;
34
+ @apply transition-[background-size,color] duration-300 hover:bg-[length:100%_1px] active:scale-100;
35
+ }
36
+ .asta-btn-xs {
37
+ @apply h-7 gap-1.5 rounded-md px-2.5 text-[12px];
38
+ }
39
+ .asta-btn-sm {
40
+ @apply h-8 gap-1.5 rounded-md px-3 text-[13px];
41
+ }
42
+ .asta-btn-lg {
43
+ @apply h-12 gap-2.5 rounded-[9px] px-5 text-[15px];
44
+ }
45
+ .asta-btn-icon {
46
+ @apply w-10 !px-0;
47
+ &.asta-btn-xs {
48
+ @apply w-7;
49
+ }
50
+ &.asta-btn-sm {
51
+ @apply w-8;
52
+ }
53
+ &.asta-btn-lg {
54
+ @apply w-12;
55
+ }
56
+ }
57
+ .asta-btn-pill {
58
+ @apply !rounded-full;
59
+ }
60
+ .asta-btn-label {
61
+ @apply inline-flex items-center gap-[inherit] transition-opacity duration-200 [&>svg]:h-[1.15em] [&>svg]:w-[1.15em];
62
+ :is(.asta-btn[aria-busy="true"], .asta-btn.htmx-request) > & {
63
+ @apply opacity-0;
64
+ }
65
+ }
66
+ .asta-btn-spinner {
67
+ @apply pointer-events-none absolute inset-0 flex items-center justify-center opacity-0 transition-opacity duration-200 [&>svg]:h-4 [&>svg]:w-4 [&>svg]:animate-spin;
68
+ :is(.asta-btn[aria-busy="true"], .asta-btn.htmx-request) > & {
69
+ @apply opacity-100;
70
+ }
71
+ }
72
+ .asta-btn-kbd {
73
+ @apply -mr-1.5 ml-1 rounded-md bg-white/15 px-1.5 font-sans text-[0.8em] leading-[1.6] text-current;
74
+ :is(.asta-btn-outline, .asta-btn-soft, .asta-btn-ghost, .asta-btn-link) & {
75
+ @apply bg-[color-mix(in_srgb,var(--ink)_7%,transparent)] text-mute;
76
+ }
77
+ }
78
+
79
+ /* ---- Input (field.templ) ----
80
+ * <label class="asta-input"><span class="asta-input-icon"><svg/></span><input class="asta-input-control" name="q"></label>
81
+ * Sizes: asta-input-sm, asta-input-lg. States: asta-input-error, asta-input-success, or aria-invalid="true" on the
82
+ * input. A disabled input dims the whole field. */
83
+ .asta-input {
84
+ @apply relative flex w-full items-center bg-paper text-ink transition-shadow duration-200;
85
+ @apply h-10 rounded-lg px-3 text-[14px] gap-2.5;
86
+ @apply shadow-[inset_0_0_0_1px_color-mix(in_srgb,var(--ink)_14%,transparent)] hover:shadow-[inset_0_0_0_1px_color-mix(in_srgb,var(--ink)_24%,transparent)];
87
+ @apply focus-within:!shadow-[inset_0_0_0_1px_var(--brand),0_0_0_4px_color-mix(in_srgb,var(--brand)_16%,transparent)];
88
+ @apply has-[input:disabled]:pointer-events-none has-[input:disabled]:opacity-50;
89
+ }
90
+ .asta-input-sm {
91
+ @apply h-8 rounded-md px-2.5 text-[13px] gap-2;
92
+ }
93
+ .asta-input-lg {
94
+ @apply h-12 rounded-[9px] px-4 text-[15px] gap-3;
95
+ }
96
+ .asta-input-error,
97
+ .asta-input:has(> input[aria-invalid="true"]) {
98
+ @apply shadow-[inset_0_0_0_1px_#e5484d] hover:shadow-[inset_0_0_0_1px_#e5484d] focus-within:!shadow-[inset_0_0_0_1px_#e5484d,0_0_0_4px_rgb(229_72_77/0.16)];
99
+ }
100
+ .asta-input-success {
101
+ @apply shadow-[inset_0_0_0_1px_#30a46c] hover:shadow-[inset_0_0_0_1px_#30a46c] focus-within:!shadow-[inset_0_0_0_1px_#30a46c,0_0_0_4px_rgb(48_164_108/0.16)];
102
+ }
103
+ .asta-input-control {
104
+ @apply h-full min-w-0 flex-1 bg-transparent outline-none placeholder:text-mute;
105
+ }
106
+ .asta-input-icon {
107
+ @apply flex shrink-0 text-mute transition-colors [&_svg]:h-4 [&_svg]:w-4;
108
+ .asta-input:focus-within > & {
109
+ @apply text-ink;
110
+ }
111
+ }
112
+ .asta-input-trailing {
113
+ @apply flex shrink-0 text-mute [&_svg]:h-4 [&_svg]:w-4;
114
+ }
115
+ /* The error or success icon at the end of the field. */
116
+ .asta-input-status {
117
+ @apply h-4 w-4 shrink-0 text-[#e5484d];
118
+ .asta-input-success > & {
119
+ @apply text-[#30a46c];
120
+ }
121
+ }
122
+
123
+ /* ---- Field (field.templ) ----
124
+ * <div class="asta-field"><div class="asta-field-head"><label class="asta-label" for="email">Email</label></div>
125
+ * …control… <p class="asta-hint">We never share it.</p></div>
126
+ * asta-error replaces the hint (role="alert", optional leading svg). asta-counter sits on the right of the head. */
127
+ .asta-field {
128
+ @apply flex flex-col gap-1.5;
129
+ }
130
+ .asta-field-head {
131
+ @apply flex items-baseline justify-between gap-3;
132
+ }
133
+ .asta-label {
134
+ @apply text-[13px] font-medium tracking-[-0.01em] text-ink;
135
+ }
136
+ .asta-label-required {
137
+ @apply ml-0.5 text-[#e5484d];
138
+ }
139
+ .asta-counter {
140
+ @apply text-[12px] tabular-nums text-mute;
141
+ }
142
+ .asta-error {
143
+ @apply flex items-start gap-1.5 text-[12.5px] leading-snug text-[#e5484d] animate-[asta-field-in_.3s_cubic-bezier(.16,1,.3,1)_both];
144
+ & > svg {
145
+ @apply mt-px h-3.5 w-3.5 shrink-0;
146
+ }
147
+ }
148
+ .asta-hint {
149
+ @apply text-[12.5px] leading-snug text-mute;
150
+ }
151
+
152
+ /* ---- Textarea (textarea.templ) ----
153
+ * <div class="asta-textarea"><textarea class="asta-textarea-control" rows="3"></textarea></div>
154
+ * asta-textarea-error (or aria-invalid="true"). asta-textarea-auto on the control grows with its content. */
155
+ .asta-textarea {
156
+ @apply relative w-full rounded-xl bg-paper text-ink transition-shadow duration-200;
157
+ @apply shadow-[inset_0_0_0_1px_color-mix(in_srgb,var(--ink)_14%,transparent)] hover:shadow-[inset_0_0_0_1px_color-mix(in_srgb,var(--ink)_24%,transparent)];
158
+ @apply focus-within:!shadow-[inset_0_0_0_1px_var(--brand),0_0_0_4px_color-mix(in_srgb,var(--brand)_16%,transparent)];
159
+ @apply has-[textarea:disabled]:opacity-50;
160
+ }
161
+ .asta-textarea-error,
162
+ .asta-textarea:has(> textarea[aria-invalid="true"]) {
163
+ @apply shadow-[inset_0_0_0_1px_#e5484d] hover:shadow-[inset_0_0_0_1px_#e5484d] focus-within:!shadow-[inset_0_0_0_1px_#e5484d,0_0_0_4px_rgb(229_72_77/0.16)];
164
+ }
165
+ .asta-textarea-control {
166
+ @apply block w-full resize-none bg-transparent px-3.5 py-3 text-[14px] leading-[1.55] outline-none placeholder:text-mute disabled:cursor-not-allowed;
167
+ }
168
+ .asta-textarea-auto {
169
+ @apply [field-sizing:content] overflow-y-auto min-h-[calc(3lh+24px)] max-h-[calc(10lh+24px)];
170
+ }
171
+
172
+ /* ---- Select (select.templ) ----
173
+ * <div class="asta-select"><select class="asta-select-control">…</select><svg class="asta-select-icon"/></div>
174
+ * asta-select-sm, asta-select-error (or aria-invalid="true"). An empty-value option shows as a muted placeholder. */
175
+ .asta-select {
176
+ @apply relative w-full;
177
+ }
178
+ .asta-select-control {
179
+ @apply w-full cursor-pointer appearance-none truncate bg-paper text-ink outline-none transition-shadow duration-200;
180
+ @apply disabled:cursor-not-allowed disabled:opacity-45;
181
+ @apply [&:has(option[value='']:checked)]:text-mute [&_option]:bg-paper [&_option]:text-ink;
182
+ @apply h-10 rounded-lg pl-3 pr-9 text-[14px];
183
+ @apply shadow-[inset_0_0_0_1px_color-mix(in_srgb,var(--ink)_14%,transparent)] hover:shadow-[inset_0_0_0_1px_color-mix(in_srgb,var(--ink)_24%,transparent)];
184
+ @apply focus:!shadow-[inset_0_0_0_1px_var(--brand),0_0_0_3px_color-mix(in_srgb,var(--brand)_18%,transparent)];
185
+ .asta-select-sm > & {
186
+ @apply h-8 rounded-md pl-2.5 pr-8 text-[13px];
187
+ }
188
+ .asta-select-error > &,
189
+ &[aria-invalid="true"] {
190
+ @apply shadow-[inset_0_0_0_1px_#e5484d] hover:shadow-[inset_0_0_0_1px_#e5484d] focus:!shadow-[inset_0_0_0_1px_#e5484d,0_0_0_3px_rgb(229_72_77/0.16)];
191
+ }
192
+ }
193
+ .asta-select-icon {
194
+ @apply pointer-events-none absolute right-3 top-1/2 h-4 w-4 -translate-y-1/2 text-mute;
195
+ .asta-select-sm > & {
196
+ @apply right-2.5;
197
+ }
198
+ .asta-select:has(select:disabled) > & {
199
+ @apply opacity-45;
200
+ }
201
+ }
202
+
203
+ /* ---- Checkbox (checkbox.templ) ----
204
+ * <label class="asta-checkbox"><span class="asta-checkbox-box"><input type="checkbox" class="asta-checkbox-input">
205
+ * <svg class="asta-checkbox-check"/><span class="asta-checkbox-dash"></span></span>
206
+ * <span><span class="asta-checkbox-label">Email me</span><span class="asta-checkbox-desc">…</span></span></label>
207
+ * A bare asta-checkbox-box works without a label. data-indeterminate on the input shows the dash. */
208
+ .asta-checkbox {
209
+ @apply flex cursor-pointer items-start gap-3;
210
+ &:has(input:disabled) {
211
+ @apply cursor-default opacity-60;
212
+ }
213
+ & > .asta-checkbox-box {
214
+ @apply mt-px;
215
+ }
216
+ }
217
+ .asta-checkbox-box {
218
+ @apply relative inline-grid h-[18px] w-[18px] shrink-0 place-items-center align-middle;
219
+ }
220
+ .asta-checkbox-input {
221
+ @apply col-start-1 row-start-1 h-[18px] w-[18px] cursor-pointer appearance-none rounded-[6px] bg-paper outline-none;
222
+ @apply shadow-[inset_0_0_0_1.5px_color-mix(in_srgb,var(--ink)_22%,transparent)] hover:shadow-[inset_0_0_0_1.5px_color-mix(in_srgb,var(--ink)_40%,transparent)];
223
+ @apply transition-[background-color,box-shadow,scale] duration-200 ease-[cubic-bezier(.16,1,.3,1)] active:scale-90 motion-reduce:transition-none;
224
+ @apply checked:bg-brand checked:shadow-[inset_0_1px_0_rgb(255_255_255/0.2),0_1px_2px_rgb(0_0_0/0.2)] checked:hover:shadow-[inset_0_1px_0_rgb(255_255_255/0.2),0_1px_2px_rgb(0_0_0/0.2)];
225
+ @apply data-[indeterminate]:bg-brand data-[indeterminate]:shadow-[inset_0_1px_0_rgb(255_255_255/0.2),0_1px_2px_rgb(0_0_0/0.2)];
226
+ @apply focus-visible:ring-2 focus-visible:ring-brand/50 focus-visible:ring-offset-2 focus-visible:ring-offset-paper;
227
+ @apply disabled:cursor-not-allowed disabled:opacity-45;
228
+ }
229
+ .asta-checkbox-check {
230
+ @apply pointer-events-none col-start-1 row-start-1 h-3 w-3 scale-50 text-white opacity-0 transition-[opacity,scale] duration-300 ease-[cubic-bezier(.16,1,.3,1)] motion-reduce:transition-none;
231
+ input:checked ~ & {
232
+ @apply scale-100 opacity-100;
233
+ }
234
+ }
235
+ .asta-checkbox-dash {
236
+ @apply pointer-events-none col-start-1 row-start-1 h-[2.2px] w-2 scale-x-0 rounded-full bg-white transition-[scale] duration-300 ease-[cubic-bezier(.16,1,.3,1)] motion-reduce:transition-none;
237
+ input[data-indeterminate] ~ & {
238
+ @apply scale-x-100;
239
+ }
240
+ input:checked ~ & {
241
+ @apply !scale-x-0;
242
+ }
243
+ }
244
+ .asta-checkbox-label,
245
+ .asta-switch-label {
246
+ @apply block select-none text-[14px] leading-5 text-ink;
247
+ }
248
+ .asta-checkbox-desc,
249
+ .asta-switch-desc {
250
+ @apply mt-0.5 block text-[13px] leading-snug text-mute;
251
+ }
252
+
253
+ /* ---- Radio group (radio.templ) ----
254
+ * <div role="radiogroup" class="asta-radio-group"><label class="asta-radio"><span class="asta-radio-row">
255
+ * <span class="asta-radio-dot"><input type="radio" class="asta-radio-input" name="plan"><span class="asta-radio-mark"></span></span>
256
+ * <span class="asta-radio-label">Pro</span><span class="asta-radio-aside">$12</span></span>
257
+ * <span class="asta-radio-desc">…</span></label></div>
258
+ * Cards in 3 columns from sm up; asta-radio-group-cols-1 / -cols-2. asta-radio-group-list for a compact list. */
259
+ .asta-radio-group {
260
+ @apply grid gap-2.5 sm:grid-cols-3;
261
+ }
262
+ .asta-radio-group-cols-1 {
263
+ @apply sm:grid-cols-1;
264
+ }
265
+ .asta-radio-group-cols-2 {
266
+ @apply sm:grid-cols-2;
267
+ }
268
+ .asta-radio {
269
+ @apply relative flex cursor-pointer text-left transition-[background-color,box-shadow,opacity] duration-300 ease-[cubic-bezier(.16,1,.3,1)];
270
+ @apply has-[:focus-visible]:ring-2 has-[:focus-visible]:ring-brand/50 has-[:disabled]:cursor-not-allowed has-[:disabled]:opacity-45;
271
+ @apply flex-col gap-1 rounded-xl bg-paper p-4 shadow-[inset_0_0_0_1px_color-mix(in_srgb,var(--ink)_14%,transparent)];
272
+ @apply hover:bg-paper-2 has-[:checked]:bg-paper has-[:checked]:shadow-[inset_0_0_0_2px_var(--brand),0_0_0_4px_color-mix(in_srgb,var(--brand)_14%,transparent)];
273
+ }
274
+ .asta-radio-group-list {
275
+ @apply flex flex-col gap-0 rounded-xl bg-paper p-1.5 shadow-[inset_0_0_0_1px_color-mix(in_srgb,var(--ink)_14%,transparent)];
276
+ & > .asta-radio {
277
+ @apply gap-0.5 rounded-lg bg-transparent px-3 py-2.5 shadow-none hover:bg-paper-2/60 has-[:checked]:bg-paper-2 has-[:checked]:shadow-none;
278
+ }
279
+ }
280
+ .asta-radio-row {
281
+ @apply flex w-full items-center gap-3;
282
+ }
283
+ .asta-radio-dot {
284
+ @apply relative flex h-4 w-4 shrink-0;
285
+ }
286
+ .asta-radio-input {
287
+ @apply h-4 w-4 cursor-[inherit] appearance-none rounded-full bg-paper outline-none shadow-[inset_0_0_0_1.5px_color-mix(in_srgb,var(--ink)_24%,transparent)] transition-[background-color,box-shadow] duration-300 checked:bg-brand checked:!shadow-none;
288
+ .asta-radio:hover & {
289
+ @apply shadow-[inset_0_0_0_1.5px_color-mix(in_srgb,var(--ink)_40%,transparent)];
290
+ }
291
+ }
292
+ .asta-radio-mark {
293
+ @apply pointer-events-none absolute inset-0 m-auto h-1.5 w-1.5 scale-0 rounded-full bg-white transition-[scale] duration-300 ease-[cubic-bezier(.16,1,.3,1)] motion-reduce:transition-none;
294
+ input:checked ~ & {
295
+ @apply scale-100;
296
+ }
297
+ }
298
+ .asta-radio-label {
299
+ @apply min-w-0 flex-1 text-[14px] font-medium tracking-[-0.01em] text-ink;
300
+ }
301
+ .asta-radio-aside {
302
+ @apply text-[13px] tabular-nums text-ink-2;
303
+ }
304
+ .asta-radio-desc {
305
+ @apply pl-7 text-[13px] leading-snug text-mute;
306
+ }
307
+
308
+ /* ---- Switch (switch.templ) ----
309
+ * <label class="asta-switch"><span><span class="asta-switch-label">Alerts</span><span class="asta-switch-desc">…</span></span>
310
+ * <span class="asta-switch-track"><input type="checkbox" role="switch" class="asta-switch-input"><span class="asta-switch-thumb"></span></span></label>
311
+ * A bare asta-switch-track works without a label. Sizes: asta-switch-sm, asta-switch-lg on the label or the track. */
312
+ .asta-switch {
313
+ @apply flex cursor-pointer items-center justify-between gap-4;
314
+ &:has(input:disabled) {
315
+ @apply cursor-default opacity-60;
316
+ }
317
+ & > span:first-child {
318
+ @apply min-w-0;
319
+ }
320
+ }
321
+ .asta-switch-track {
322
+ @apply relative inline-flex h-6 w-10 shrink-0 align-middle;
323
+ }
324
+ .asta-switch-input {
325
+ @apply absolute inset-0 h-full w-full cursor-pointer appearance-none rounded-full outline-none transition-[background-color,box-shadow] duration-300;
326
+ @apply bg-[color-mix(in_srgb,var(--ink)_14%,var(--paper))] shadow-[inset_0_1px_2px_rgb(0_0_0/0.08)] checked:bg-brand checked:shadow-[inset_0_1px_2px_rgb(0_0_0/0.15)];
327
+ @apply focus-visible:ring-2 focus-visible:ring-brand/50 focus-visible:ring-offset-2 focus-visible:ring-offset-paper disabled:cursor-not-allowed disabled:opacity-45;
328
+ }
329
+ .asta-switch-thumb {
330
+ @apply pointer-events-none absolute left-[2px] top-[2px] block h-5 w-5 origin-left rounded-full bg-white shadow-[0_1px_2px_rgb(0_0_0/0.2),0_2px_6px_-1px_rgb(0_0_0/0.18)];
331
+ @apply transition-[translate,scale] duration-[450ms] ease-[cubic-bezier(.16,1,.3,1)] motion-reduce:transition-none;
332
+ input:checked ~ & {
333
+ @apply origin-right translate-x-4;
334
+ }
335
+ input:active ~ & {
336
+ @apply scale-x-[1.3];
337
+ }
338
+ }
339
+ .asta-switch-sm .asta-switch-track,
340
+ .asta-switch-track.asta-switch-sm {
341
+ @apply h-[18px] w-[30px];
342
+ & > .asta-switch-thumb {
343
+ @apply h-[14px] w-[14px];
344
+ }
345
+ & > input:checked ~ .asta-switch-thumb {
346
+ @apply translate-x-[12px];
347
+ }
348
+ }
349
+ .asta-switch-lg .asta-switch-track,
350
+ .asta-switch-track.asta-switch-lg {
351
+ @apply h-[30px] w-[52px];
352
+ & > .asta-switch-thumb {
353
+ @apply h-[26px] w-[26px];
354
+ }
355
+ & > input:checked ~ .asta-switch-thumb {
356
+ @apply translate-x-[22px];
357
+ }
358
+ }
359
+
360
+ /* ---- Slider (slider.templ) ----
361
+ * <div class="asta-slider"><input type="range" class="asta-slider-input" min="0" max="100" value="40">
362
+ * <div class="asta-slider-ticks" aria-hidden="true"><span class="asta-slider-tick" style="left:0%"></span>…</div></div> */
363
+ .asta-slider {
364
+ @apply relative w-full select-none;
365
+ }
366
+ .asta-slider-input {
367
+ @apply block h-6 w-full cursor-pointer appearance-none bg-transparent outline-none disabled:cursor-not-allowed disabled:opacity-45;
368
+ @apply [&::-webkit-slider-runnable-track]:h-1.5 [&::-webkit-slider-runnable-track]:rounded-full [&::-webkit-slider-runnable-track]:bg-[color-mix(in_srgb,var(--ink)_12%,transparent)];
369
+ @apply [&::-webkit-slider-thumb]:-mt-[7px] [&::-webkit-slider-thumb]:h-5 [&::-webkit-slider-thumb]:w-5 [&::-webkit-slider-thumb]:appearance-none [&::-webkit-slider-thumb]:rounded-full [&::-webkit-slider-thumb]:bg-white;
370
+ @apply [&::-webkit-slider-thumb]:shadow-[0_0_0_1px_color-mix(in_srgb,var(--ink)_14%,transparent),0_1px_3px_rgb(0_0_0/0.2),0_4px_10px_-2px_rgb(0_0_0/0.2)];
371
+ @apply [&::-webkit-slider-thumb]:transition-[scale] [&::-webkit-slider-thumb]:duration-300 [&::-webkit-slider-thumb]:ease-[cubic-bezier(.16,1,.3,1)] motion-reduce:[&::-webkit-slider-thumb]:transition-none;
372
+ @apply hover:[&::-webkit-slider-thumb]:scale-105 active:[&::-webkit-slider-thumb]:scale-110;
373
+ @apply focus-visible:[&::-webkit-slider-thumb]:ring-4 focus-visible:[&::-webkit-slider-thumb]:ring-brand/30;
374
+ @apply [&::-moz-range-track]:h-1.5 [&::-moz-range-track]:rounded-full [&::-moz-range-track]:bg-[color-mix(in_srgb,var(--ink)_12%,transparent)];
375
+ @apply [&::-moz-range-progress]:h-1.5 [&::-moz-range-progress]:rounded-full [&::-moz-range-progress]:bg-brand;
376
+ @apply [&::-moz-range-thumb]:h-5 [&::-moz-range-thumb]:w-5 [&::-moz-range-thumb]:rounded-full [&::-moz-range-thumb]:border-0 [&::-moz-range-thumb]:bg-white;
377
+ @apply [&::-moz-range-thumb]:shadow-[0_0_0_1px_color-mix(in_srgb,var(--ink)_14%,transparent),0_1px_3px_rgb(0_0_0/0.2),0_4px_10px_-2px_rgb(0_0_0/0.2)];
378
+ @apply [&::-moz-range-thumb]:transition-[scale] [&::-moz-range-thumb]:duration-300 [&::-moz-range-thumb]:ease-[cubic-bezier(.16,1,.3,1)] motion-reduce:[&::-moz-range-thumb]:transition-none;
379
+ @apply hover:[&::-moz-range-thumb]:scale-105 active:[&::-moz-range-thumb]:scale-110;
380
+ @apply focus-visible:[&::-moz-range-thumb]:ring-4 focus-visible:[&::-moz-range-thumb]:ring-brand/30;
381
+ }
382
+ .asta-slider-ticks {
383
+ @apply pointer-events-none relative mx-[10px] h-1;
384
+ }
385
+ .asta-slider-tick {
386
+ @apply absolute top-0 h-1 w-1 -translate-x-1/2 rounded-full bg-[color-mix(in_srgb,var(--ink)_28%,transparent)];
387
+ }
388
+
389
+ /* ---- Badge (badge.templ) ----
390
+ * <span class="asta-badge asta-badge-success"><span class="asta-badge-dot"></span>Live</span>
391
+ * Variants: (soft) solid outline. Tones: (neutral) accent success warning danger. Size: asta-badge-sm.
392
+ * asta-badge-dot can hold <span class="asta-badge-ping"></span> for a pulse. asta-badge-remove is the × button.
393
+ * asta-count is the small red counter (e.g. on a bell). */
394
+ .asta-badge {
395
+ --kit-badge: var(--ink);
396
+ --kit-badge-on: var(--paper);
397
+ @apply inline-flex shrink-0 items-center gap-1.5 whitespace-nowrap rounded-md font-medium tracking-[-0.005em];
398
+ @apply h-6 px-2.5 text-[12px];
399
+ @apply bg-[color-mix(in_srgb,var(--kit-badge)_12%,transparent)] text-[color-mix(in_srgb,var(--kit-badge)_80%,var(--ink))];
400
+ &:has(> .asta-badge-remove) {
401
+ @apply pr-1;
402
+ }
403
+ }
404
+ .asta-badge-accent {
405
+ --kit-badge: var(--brand);
406
+ --kit-badge-on: #fff;
407
+ }
408
+ .asta-badge-success {
409
+ --kit-badge: #30a46c;
410
+ --kit-badge-on: #fff;
411
+ }
412
+ .asta-badge-warning {
413
+ --kit-badge: #f5a524;
414
+ --kit-badge-on: #1a1300;
415
+ }
416
+ .asta-badge-danger {
417
+ --kit-badge: #e5484d;
418
+ --kit-badge-on: #fff;
419
+ }
420
+ .asta-badge-solid {
421
+ @apply bg-[var(--kit-badge)] text-[var(--kit-badge-on)];
422
+ }
423
+ .asta-badge-outline {
424
+ @apply bg-transparent text-[color-mix(in_srgb,var(--kit-badge)_80%,var(--ink))] shadow-[inset_0_0_0_1px_color-mix(in_srgb,var(--kit-badge)_35%,transparent)];
425
+ }
426
+ .asta-badge-sm {
427
+ @apply h-5 px-2 text-[11px];
428
+ &:has(> .asta-badge-remove) {
429
+ @apply pr-0.5;
430
+ }
431
+ }
432
+ .asta-badge-dot {
433
+ @apply relative flex h-1.5 w-1.5 shrink-0;
434
+ &::after {
435
+ @apply relative h-1.5 w-1.5 rounded-full bg-[var(--kit-badge)] content-[''];
436
+ .asta-badge-solid > & {
437
+ @apply bg-current;
438
+ }
439
+ }
440
+ }
441
+ .asta-badge-ping {
442
+ @apply absolute inset-0 animate-[asta-badge-ping_1.6s_cubic-bezier(.16,1,.3,1)_infinite] rounded-full bg-current motion-reduce:hidden;
443
+ }
444
+ .asta-badge-remove {
445
+ @apply inline-flex h-[18px] w-[18px] items-center justify-center rounded-full opacity-60 outline-none transition-[opacity,background-color] hover:bg-[color-mix(in_srgb,currentColor_15%,transparent)] hover:opacity-100 focus-visible:opacity-100 focus-visible:ring-2 focus-visible:ring-brand/50;
446
+ .asta-badge-sm > & {
447
+ @apply h-4 w-4;
448
+ }
449
+ & > svg {
450
+ @apply h-2.5 w-2.5;
451
+ }
452
+ }
453
+ .asta-count {
454
+ @apply inline-flex h-[18px] min-w-[18px] animate-[asta-pop_.4s_cubic-bezier(.16,1,.3,1)] items-center justify-center rounded-[5px] bg-[#e5484d] px-1 text-[10.5px] font-semibold tabular-nums leading-none text-white shadow-[0_0_0_2px_var(--paper)] motion-reduce:animate-none;
455
+ }
456
+
457
+ /* ---- Dialog (dialog.templ) ----
458
+ * <button data-asta-open="invite">Invite</button>
459
+ * <dialog id="invite" class="asta-dialog" aria-labelledby="invite-title">
460
+ * <button type="button" class="asta-dialog-close" data-asta-close aria-label="Close"><svg/></button>
461
+ * <h2 id="invite-title" class="asta-dialog-title">Invite</h2><p class="asta-dialog-desc">…</p>
462
+ * <div class="asta-dialog-body">…<div class="asta-dialog-footer">…buttons…</div></div></dialog>
463
+ * The open/close motion lives in the runtime part of components.css. data-asta-autoopen opens it on load.
464
+ * Drawer and command palette are dialogs too, with their own panel classes. */
465
+ .asta-dialog:not(.asta-drawer, .asta-cmd) {
466
+ @apply m-auto w-[calc(100%-2rem)] max-w-[400px] rounded-2xl bg-paper p-6 text-ink outline-none;
467
+ @apply shadow-[inset_0_0_0_1px_color-mix(in_srgb,var(--ink)_8%,transparent),0_24px_60px_-20px_rgb(0_0_0/0.45)];
468
+ }
469
+ .asta-dialog-close {
470
+ @apply absolute right-3.5 top-3.5 flex h-8 w-8 items-center justify-center rounded-full text-mute outline-none transition-colors hover:bg-paper-2 hover:text-ink focus-visible:ring-2 focus-visible:ring-brand/50;
471
+ & > svg {
472
+ @apply h-3.5 w-3.5;
473
+ }
474
+ }
475
+ .asta-dialog-title {
476
+ @apply pr-8 text-[18px] font-medium tracking-[-0.02em] text-ink;
477
+ }
478
+ .asta-dialog-desc {
479
+ @apply mt-1.5 text-[14px] leading-relaxed text-mute;
480
+ }
481
+ .asta-dialog-body {
482
+ @apply mt-5;
483
+ }
484
+ .asta-dialog-footer {
485
+ @apply mt-6 flex flex-col-reverse gap-2 sm:flex-row sm:justify-end;
486
+ }
487
+
488
+ /* ---- Menu (menu.templ) ----
489
+ * <div class="asta-menu" data-asta-menu>
490
+ * <button class="asta-btn asta-btn-outline asta-menu-trigger" data-asta-menu-trigger aria-haspopup="menu" aria-expanded="false">
491
+ * Actions<svg class="asta-menu-chevron"/></button>
492
+ * <div role="menu" hidden tabindex="-1" class="asta-menu-panel">
493
+ * <button type="button" role="menuitem" tabindex="-1" class="asta-menu-item"><span class="asta-menu-item-icon"><svg/></span>
494
+ * <span class="asta-menu-item-text">Rename</span><kbd class="asta-menu-shortcut">R</kbd></button>
495
+ * <div role="separator" class="asta-menu-separator"></div></div></div>
496
+ * asta.js sets data-open on the root and data-up when it flips above. data-align="end" pins it to the right. */
497
+ .asta-menu {
498
+ @apply relative inline-flex;
499
+ }
500
+ .asta-menu-trigger {
501
+ [data-asta-menu][data-open] > & {
502
+ @apply bg-paper-2;
503
+ }
504
+ }
505
+ .asta-menu-chevron {
506
+ @apply -mr-1 h-3.5 w-3.5 text-mute transition-transform duration-300 ease-[cubic-bezier(.16,1,.3,1)] motion-reduce:transition-none;
507
+ [data-asta-menu][data-open] > * > & {
508
+ @apply rotate-180;
509
+ }
510
+ }
511
+ .asta-menu-panel {
512
+ @apply absolute left-0 top-full z-50 mt-1.5 min-w-[232px] rounded-xl bg-paper p-1.5 text-left outline-none;
513
+ @apply shadow-[inset_0_0_0_1px_color-mix(in_srgb,var(--ink)_10%,transparent),0_12px_32px_-12px_rgb(0_0_0/0.28),0_4px_10px_-6px_rgb(0_0_0/0.12)];
514
+ [data-align="end"] > & {
515
+ @apply left-auto right-0;
516
+ }
517
+ }
518
+ .asta-menu-item {
519
+ @apply flex h-9 w-full cursor-pointer select-none items-center gap-2.5 rounded-[10px] px-2.5 text-left text-[13.5px] outline-none transition-colors duration-150;
520
+ @apply disabled:cursor-not-allowed disabled:opacity-40 aria-disabled:cursor-not-allowed aria-disabled:opacity-40;
521
+ @apply text-ink hover:bg-paper-2 focus:bg-paper-2;
522
+ }
523
+ .asta-menu-item-danger {
524
+ @apply text-[#e5484d] hover:bg-[#e5484d]/10 focus:bg-[#e5484d]/10;
525
+ }
526
+ .asta-menu-item-icon {
527
+ @apply inline-flex h-4 w-4 shrink-0 text-mute [&_svg]:h-4 [&_svg]:w-4;
528
+ .asta-menu-item:is(:hover, :focus) > & {
529
+ @apply text-ink;
530
+ }
531
+ .asta-menu-item-danger > & {
532
+ @apply text-current;
533
+ }
534
+ }
535
+ .asta-menu-item-text {
536
+ @apply flex-1 truncate;
537
+ }
538
+ .asta-menu-shortcut {
539
+ @apply font-sans text-[11.5px] tracking-wide text-mute;
540
+ }
541
+ .asta-menu-label {
542
+ @apply px-2.5 pb-1 pt-1.5 text-[11px] font-medium uppercase tracking-wider text-mute;
543
+ }
544
+ .asta-menu-separator {
545
+ @apply mx-1 my-1.5 h-px bg-[color-mix(in_srgb,var(--ink)_8%,transparent)];
546
+ }
547
+
548
+ /* ---- Tabs (tabs.templ) ----
549
+ * <div class="asta-tabs" data-asta-tabs><div role="tablist" class="asta-tabs-list">
550
+ * <span class="asta-tabs-line" aria-hidden="true"></span><span class="asta-tabs-indicator" data-asta-tab-indicator aria-hidden="true"></span>
551
+ * <button role="tab" class="asta-tab" id="t-a" aria-controls="p-a" aria-selected="true">Overview<span class="asta-tab-count">4</span></button>…</div>
552
+ * <div role="tabpanel" class="asta-tabs-panel" id="p-a" aria-labelledby="t-a" tabindex="0">…</div></div>
553
+ * Variants on the root: (underline) asta-tabs-pill, asta-tabs-segmented (+ asta-tabs-full, asta-tabs-sm).
554
+ * asta-tabs-line is the underline variant's base rule; leave it out for the others. */
555
+ .asta-tabs-list {
556
+ @apply relative flex gap-5 overflow-x-auto [scrollbar-width:none] sm:gap-6;
557
+ }
558
+ .asta-tabs-line {
559
+ @apply absolute inset-x-0 bottom-0 h-px bg-[color-mix(in_srgb,var(--ink)_10%,transparent)];
560
+ }
561
+ .asta-tabs-indicator {
562
+ @apply pointer-events-none absolute left-0 origin-left opacity-0 transition-transform duration-500 ease-[cubic-bezier(.16,1,.3,1)] motion-reduce:!transition-none;
563
+ @apply bottom-0 h-0.5 rounded-full bg-ink;
564
+ }
565
+ .asta-tab {
566
+ @apply relative z-10 inline-flex shrink-0 items-center whitespace-nowrap font-medium tracking-[-0.01em] text-mute outline-none;
567
+ @apply transition-colors duration-300 hover:text-ink focus-visible:ring-2 focus-visible:ring-brand/50 aria-selected:text-ink;
568
+ @apply disabled:pointer-events-none disabled:opacity-40;
569
+ @apply h-11 gap-2 rounded-md text-[14px];
570
+ }
571
+ .asta-tab-icon {
572
+ @apply inline-flex shrink-0 [&_svg]:h-4 [&_svg]:w-4;
573
+ }
574
+ .asta-tab-count {
575
+ @apply rounded-[5px] bg-[color-mix(in_srgb,var(--ink)_7%,transparent)] px-1.5 text-[11px] leading-[18px] tabular-nums text-mute transition-colors duration-300;
576
+ .asta-tab[aria-selected="true"] > & {
577
+ @apply bg-brand text-white;
578
+ }
579
+ }
580
+ .asta-tabs-panel {
581
+ @apply rounded-md pt-5 outline-none focus-visible:ring-2 focus-visible:ring-brand/50;
582
+ @apply transition-[opacity,translate] duration-[450ms] ease-[cubic-bezier(.16,1,.3,1)] starting:translate-y-1.5 starting:opacity-0 motion-reduce:transition-none;
583
+ }
584
+ .asta-tabs-pill {
585
+ & > .asta-tabs-list {
586
+ @apply gap-1 rounded-[10px] bg-paper-2 p-1 sm:gap-1;
587
+ }
588
+ & .asta-tabs-indicator {
589
+ @apply top-1 bottom-1 h-auto rounded-[7px] bg-paper shadow-[0_1px_2px_rgb(0_0_0/0.08),inset_0_0_0_1px_color-mix(in_srgb,var(--ink)_8%,transparent)];
590
+ }
591
+ & .asta-tab {
592
+ @apply h-8 gap-2 rounded-[7px] px-3.5 text-[14px];
593
+ }
594
+ }
595
+ .asta-tabs-segmented {
596
+ @apply inline-flex flex-col;
597
+ & > .asta-tabs-list {
598
+ @apply inline-flex gap-0 overflow-visible rounded-[10px] bg-paper-2 p-1 shadow-[inset_0_0_0_1px_color-mix(in_srgb,var(--ink)_6%,transparent)] sm:gap-0;
599
+ }
600
+ & .asta-tabs-indicator {
601
+ @apply top-1 bottom-1 h-auto rounded-[7px] bg-paper shadow-[0_1px_2px_rgb(0_0_0/0.08),0_3px_10px_-4px_rgb(0_0_0/0.18),inset_0_0_0_1px_color-mix(in_srgb,var(--ink)_8%,transparent)];
602
+ }
603
+ & .asta-tab {
604
+ @apply h-10 justify-center gap-1.5 rounded-[7px] px-4 text-[14px] [&_svg]:h-[1.05em] [&_svg]:w-[1.05em];
605
+ }
606
+ &.asta-tabs-sm .asta-tab {
607
+ @apply h-8 px-3 text-[13px];
608
+ }
609
+ &.asta-tabs-full {
610
+ @apply flex;
611
+ & > .asta-tabs-list {
612
+ @apply flex w-full;
613
+ }
614
+ & .asta-tab {
615
+ @apply flex-1;
616
+ }
617
+ }
618
+ }
619
+
620
+ /* ---- Table (table.templ) ----
621
+ * <div class="asta-table-wrap"><div class="asta-table-scroll"><table class="asta-table">
622
+ * <thead><tr><th class="asta-th" scope="col">Name</th><th class="asta-th asta-th-right">Amount</th></tr></thead>
623
+ * <tbody><tr class="asta-tr"><td class="asta-td">Astabyte</td><td class="asta-td asta-td-right">$1,200</td></tr></tbody></table></div></div>
624
+ * Sortable header: <th class="asta-th" aria-sort="ascending"><a class="asta-th-sort" href="?sort=name">Name<svg class="asta-th-sort-icon"/></a></th>.
625
+ * Selected row: aria-selected="true" (or asta-tr-selected). asta-td-wrap lets a cell wrap. */
626
+ .asta-table-wrap {
627
+ @apply relative rounded-xl bg-paper after:pointer-events-none after:absolute after:inset-0 after:z-20 after:rounded-xl after:shadow-[inset_0_0_0_1px_color-mix(in_srgb,var(--ink)_10%,transparent)];
628
+ }
629
+ .asta-table-scroll {
630
+ @apply overflow-auto rounded-xl;
631
+ }
632
+ .asta-table {
633
+ @apply w-full border-separate border-spacing-0 text-[13.5px];
634
+ }
635
+ .asta-th {
636
+ @apply sticky top-0 z-10 whitespace-nowrap bg-paper-2 px-4 py-2.5 text-left text-[12px] font-medium text-mute;
637
+ }
638
+ .asta-th-sort {
639
+ @apply -mx-1.5 inline-flex items-center gap-1 rounded-md px-1.5 py-0.5 outline-none transition-colors duration-150 hover:text-ink focus-visible:ring-2 focus-visible:ring-brand/50;
640
+ .asta-th:is([aria-sort="ascending"], [aria-sort="descending"]) > & {
641
+ @apply text-ink;
642
+ }
643
+ .asta-th-right > & {
644
+ @apply flex-row-reverse;
645
+ }
646
+ }
647
+ .asta-th-sort-icon {
648
+ @apply h-3 w-3 opacity-0 transition-[transform,opacity] duration-300 ease-[cubic-bezier(.16,1,.3,1)] motion-reduce:transition-none;
649
+ .asta-th-sort:is(:hover, :focus-visible) > & {
650
+ @apply opacity-40;
651
+ }
652
+ .asta-th:is([aria-sort="ascending"], [aria-sort="descending"]) & {
653
+ @apply opacity-100;
654
+ }
655
+ .asta-th[aria-sort="descending"] & {
656
+ @apply rotate-180;
657
+ }
658
+ }
659
+ .asta-tr {
660
+ @apply [transition:background-color_150ms,opacity_420ms_cubic-bezier(.16,1,.3,1),translate_420ms_cubic-bezier(.16,1,.3,1)] starting:translate-y-1.5 starting:opacity-0 motion-reduce:[transition:background-color_150ms];
661
+ @apply hover:bg-[color-mix(in_srgb,var(--ink)_3%,transparent)];
662
+ &:is([aria-selected="true"], .asta-tr-selected) {
663
+ @apply bg-[color-mix(in_srgb,var(--brand)_7%,transparent)] hover:bg-[color-mix(in_srgb,var(--brand)_7%,transparent)];
664
+ }
665
+ }
666
+ .asta-td {
667
+ @apply whitespace-nowrap px-4 py-3 text-left align-middle text-ink-2;
668
+ }
669
+ .asta-td-wrap {
670
+ @apply whitespace-normal;
671
+ }
672
+ .asta-th-center,
673
+ .asta-td-center {
674
+ @apply text-center;
675
+ }
676
+ .asta-th-right,
677
+ .asta-td-right {
678
+ @apply text-right;
679
+ }
680
+ .asta-td-right {
681
+ @apply tabular-nums;
682
+ }
683
+ .asta-table-empty {
684
+ @apply px-4 py-14 text-center;
685
+ }
686
+ .asta-table-empty-body {
687
+ @apply mx-auto flex max-w-[260px] flex-col items-center gap-1.5;
688
+ }
689
+ .asta-table-empty-icon {
690
+ @apply grid h-10 w-10 place-items-center rounded-[10px] bg-paper-2 text-mute [&_svg]:h-4 [&_svg]:w-4;
691
+ }
692
+ .asta-table-empty-title {
693
+ @apply mt-1.5 text-[14px] font-medium text-ink;
694
+ }
695
+ .asta-table-empty-text {
696
+ @apply text-[13px] text-mute;
697
+ }
698
+
699
+ /* ---- Toast (asta.js) ----
700
+ * Toasts are built by asta.js: call asta.toast({ title, description, tone: "success" | "error", duration }) or send
701
+ * an HX-Trigger header {"asta:toast": {...}}. A <template data-asta-toast='[{"title":"Saved"}]'> in the page shows
702
+ * them on load. Their utility classes come with components.css (it @source's asta.js) and with asta.css. */