basecoat-css 1.0.2 → 1.2.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 (107) hide show
  1. package/README.md +1 -1
  2. package/dist/base/base.css +11 -1
  3. package/dist/base/scroll-fade.css +41 -0
  4. package/dist/base/transition-details.css +12 -0
  5. package/dist/basecoat-base.bundle.css +2532 -0
  6. package/dist/basecoat-base.cdn.css +1948 -677
  7. package/dist/basecoat-base.cdn.min.css +1 -2
  8. package/dist/basecoat-compat.cdn.css +251 -76
  9. package/dist/basecoat-compat.cdn.min.css +1 -2
  10. package/dist/basecoat-components.css +10 -0
  11. package/dist/basecoat-luma.bundle.css +4309 -0
  12. package/dist/basecoat-luma.cdn.css +5309 -3216
  13. package/dist/basecoat-luma.cdn.min.css +1 -2
  14. package/dist/basecoat-lyra.bundle.css +4287 -0
  15. package/dist/basecoat-lyra.cdn.css +5130 -3099
  16. package/dist/basecoat-lyra.cdn.min.css +1 -2
  17. package/dist/basecoat-maia.bundle.css +4275 -0
  18. package/dist/basecoat-maia.cdn.css +5220 -3158
  19. package/dist/basecoat-maia.cdn.min.css +1 -2
  20. package/dist/basecoat-mira.bundle.css +4284 -0
  21. package/dist/basecoat-mira.cdn.css +3530 -1494
  22. package/dist/basecoat-mira.cdn.min.css +1 -2
  23. package/dist/basecoat-nova.bundle.css +4300 -0
  24. package/dist/basecoat-nova.cdn.css +3685 -1623
  25. package/dist/basecoat-nova.cdn.min.css +1 -2
  26. package/dist/basecoat-rhea.bundle.css +4314 -0
  27. package/dist/basecoat-rhea.cdn.css +5315 -3219
  28. package/dist/basecoat-rhea.cdn.min.css +1 -2
  29. package/dist/basecoat-sera.bundle.css +4295 -0
  30. package/dist/basecoat-sera.cdn.css +3219 -1191
  31. package/dist/basecoat-sera.cdn.min.css +1 -2
  32. package/dist/basecoat-vega.bundle.css +4289 -0
  33. package/dist/basecoat-vega.cdn.css +3681 -1616
  34. package/dist/basecoat-vega.cdn.min.css +1 -2
  35. package/dist/basecoat.bundle.css +4289 -0
  36. package/dist/basecoat.cdn.css +3681 -1616
  37. package/dist/basecoat.cdn.min.css +1 -2
  38. package/dist/compat/legacy.css +3 -18
  39. package/dist/components/accordion.css +15 -1
  40. package/dist/components/alert.css +4 -0
  41. package/dist/components/attachment.css +66 -0
  42. package/dist/components/bubble.css +28 -0
  43. package/dist/components/button-group.css +2 -1
  44. package/dist/components/button.css +23 -0
  45. package/dist/components/carousel.css +30 -0
  46. package/dist/components/checkbox.css +5 -1
  47. package/dist/components/code-block.css +80 -0
  48. package/dist/components/collapsible.css +0 -9
  49. package/dist/components/command.css +13 -0
  50. package/dist/components/dialog.css +13 -1
  51. package/dist/components/drawer.css +48 -14
  52. package/dist/components/input-otp.css +49 -0
  53. package/dist/components/item.css +6 -0
  54. package/dist/components/marker.css +20 -0
  55. package/dist/components/message.css +24 -0
  56. package/dist/components/range.css +7 -0
  57. package/dist/components/scrollbar.css +20 -42
  58. package/dist/components/sheet.css +123 -0
  59. package/dist/components/shimmer.css +49 -0
  60. package/dist/components/sidebar.css +19 -8
  61. package/dist/components/toast.css +59 -44
  62. package/dist/components/tooltip.css +1 -1
  63. package/dist/components/trace.css +34 -0
  64. package/dist/js/all.js +513 -122
  65. package/dist/js/all.min.js +1 -1
  66. package/dist/js/carousel.js +105 -0
  67. package/dist/js/carousel.min.js +1 -0
  68. package/dist/js/code-block.js +47 -0
  69. package/dist/js/code-block.min.js +1 -0
  70. package/dist/js/combobox.js +6 -2
  71. package/dist/js/combobox.min.js +1 -1
  72. package/dist/js/drawer.js +6 -2
  73. package/dist/js/drawer.min.js +1 -1
  74. package/dist/js/dropdown-menu.js +1 -1
  75. package/dist/js/dropdown-menu.min.js +1 -1
  76. package/dist/js/input-otp.js +76 -0
  77. package/dist/js/input-otp.min.js +1 -0
  78. package/dist/js/popover.js +1 -1
  79. package/dist/js/popover.min.js +1 -1
  80. package/dist/js/select.js +1 -1
  81. package/dist/js/select.min.js +1 -1
  82. package/dist/js/sidebar.js +1 -1
  83. package/dist/js/sidebar.min.js +1 -1
  84. package/dist/js/tabs.js +31 -58
  85. package/dist/js/tabs.min.js +1 -1
  86. package/dist/js/toast.js +236 -57
  87. package/dist/js/toast.min.js +1 -1
  88. package/dist/styles/luma.css +451 -50
  89. package/dist/styles/lyra.css +418 -42
  90. package/dist/styles/maia.css +427 -48
  91. package/dist/styles/mira.css +422 -43
  92. package/dist/styles/nova.css +432 -51
  93. package/dist/styles/rhea.css +453 -52
  94. package/dist/styles/sera.css +416 -50
  95. package/dist/styles/vega.css +418 -47
  96. package/dist/typeset.cdn.css +381 -0
  97. package/dist/typeset.cdn.min.css +1 -0
  98. package/dist/typeset.css +435 -0
  99. package/package.json +18 -6
  100. package/templates/jinja/command.html.jinja +1 -1
  101. package/templates/jinja/dialog.html.jinja +1 -1
  102. package/templates/jinja/tabs.html.jinja +0 -1
  103. package/templates/jinja/toast.html.jinja +29 -26
  104. package/templates/nunjucks/command.njk +1 -1
  105. package/templates/nunjucks/dialog.njk +1 -1
  106. package/templates/nunjucks/tabs.njk +1 -1
  107. package/templates/nunjucks/toast.njk +30 -27
@@ -0,0 +1,435 @@
1
+ /*
2
+ * Basecoat Typeset
3
+ * Adapted from shadcn/typeset: https://ui.shadcn.com/docs/typeset
4
+ */
5
+
6
+ @layer components {
7
+ .typeset {
8
+ --typeset-font-body: inherit;
9
+ --typeset-font-heading: var(--font-heading, inherit);
10
+ --typeset-font-mono: var(--font-mono, ui-monospace, monospace);
11
+ --typeset-size: 1em;
12
+ --typeset-leading: 1.75;
13
+ --typeset-flow: 1.25em;
14
+
15
+ font-family: var(--typeset-font-body);
16
+ font-size: calc(var(--typeset-size) * 1.125);
17
+ line-height: var(--typeset-leading);
18
+ color: var(--color-foreground, currentColor);
19
+ overflow-wrap: break-word;
20
+ margin-trim: block-start;
21
+ --typeset-muted: var(--color-muted-foreground, color-mix(in oklab, currentColor 60%, transparent));
22
+ --typeset-rule: var(--color-border, color-mix(in oklab, currentColor 20%, transparent));
23
+
24
+ @media (min-width: 48rem), print {
25
+ font-size: var(--typeset-size);
26
+ }
27
+ }
28
+
29
+ .typeset
30
+ *:not(
31
+ :where(
32
+ .not-typeset,
33
+ [data-not-typeset],
34
+ .not-typeset *,
35
+ [data-not-typeset] *
36
+ )
37
+ ) {
38
+ &:where(p) {
39
+ margin-block-start: var(--typeset-flow);
40
+ margin-block-end: 0;
41
+ }
42
+
43
+ &:where(h1, h2, h3, h4, h5, h6) {
44
+ color: var(--color-foreground, currentColor);
45
+ font-family: var(--typeset-font-heading);
46
+ font-weight: 600;
47
+ margin-block-end: 0;
48
+ }
49
+ &:where(h1) {
50
+ font-size: 1.75em;
51
+ line-height: 1.3;
52
+ margin-block-start: var(--typeset-flow);
53
+ }
54
+ &:where(h2) {
55
+ font-size: 1.25em;
56
+ line-height: 1.4;
57
+ margin-block-start: calc(var(--typeset-flow) * 1.4);
58
+ }
59
+ &:where(h3) {
60
+ font-size: 1.125em;
61
+ line-height: 1.45;
62
+ margin-block-start: var(--typeset-flow);
63
+ }
64
+ &:where(h4) {
65
+ font-size: 1em;
66
+ line-height: 1.5;
67
+ margin-block-start: var(--typeset-flow);
68
+ }
69
+ &:where(h5) {
70
+ font-size: 0.875em;
71
+ line-height: 1.5;
72
+ font-weight: 500;
73
+ color: var(--typeset-muted);
74
+ margin-block-start: calc(var(--typeset-flow) / 0.875);
75
+ }
76
+ &:where(h6) {
77
+ font-size: 0.8125em;
78
+ line-height: 1.5;
79
+ font-weight: 500;
80
+ letter-spacing: 0.08em;
81
+ text-transform: uppercase;
82
+ color: var(--typeset-muted);
83
+ margin-block-start: calc(var(--typeset-flow) / 0.8125);
84
+ }
85
+ &:where([id]) {
86
+ scroll-margin-block-start: var(--typeset-flow);
87
+ }
88
+ &:where(h1 + *, h2 + *, h3 + *, h4 + *, h5 + *, h6 + *) {
89
+ margin-block-start: 1em;
90
+ }
91
+ &:where(a) {
92
+ color: inherit;
93
+ font-weight: 500;
94
+ text-decoration-line: underline;
95
+ text-decoration-color: color-mix(in oklab, currentColor 30%, transparent);
96
+ }
97
+ &:where(a:hover) {
98
+ text-decoration-color: currentColor;
99
+ }
100
+ &:where(a:focus-visible) {
101
+ outline: 2px solid var(--color-ring, currentColor);
102
+ outline-offset: 2px;
103
+ border-radius: 0.125em;
104
+ }
105
+ &:where(:is(h1, h2, h3, h4, h5, h6) :is(a)) {
106
+ font-weight: inherit;
107
+ }
108
+
109
+ &:where(strong, b) {
110
+ font-weight: 600;
111
+ }
112
+ &:where(mark) {
113
+ background-color: color-mix(in oklab, oklch(0.86 0.17 95) 40%, transparent);
114
+ color: inherit;
115
+ padding: 0.05em 0.15em;
116
+ border-radius: 0.2em;
117
+ }
118
+ &:where(abbr[title]) {
119
+ text-decoration-line: underline;
120
+ text-decoration-style: dotted;
121
+ text-underline-offset: 0.2em;
122
+ cursor: help;
123
+ }
124
+ &:where(del, s) {
125
+ color: var(--typeset-muted);
126
+ text-decoration-line: line-through;
127
+ }
128
+ &:where(sup, sub) {
129
+ font-size: 0.75em;
130
+ line-height: 0;
131
+ position: relative;
132
+ vertical-align: baseline;
133
+ }
134
+ &:where(sup) {
135
+ top: -0.5em;
136
+ }
137
+ &:where(sub) {
138
+ bottom: -0.25em;
139
+ }
140
+ &:where(sup a) {
141
+ text-decoration-line: none;
142
+ font-weight: 500;
143
+ }
144
+
145
+ &:where(ul) {
146
+ list-style-type: disc;
147
+ }
148
+ &:where(ol) {
149
+ list-style-type: decimal;
150
+ }
151
+ &:where(ul ul) {
152
+ list-style-type: circle;
153
+ }
154
+ &:where(ul ul ul) {
155
+ list-style-type: square;
156
+ }
157
+ &:where(ol[type='a' i]) {
158
+ list-style-type: lower-alpha;
159
+ }
160
+ &:where(ol[type='i' i]) {
161
+ list-style-type: lower-roman;
162
+ }
163
+ &:where(ol[type='A' s]) {
164
+ list-style-type: upper-alpha;
165
+ }
166
+ &:where(ol[type='I' s]) {
167
+ list-style-type: upper-roman;
168
+ }
169
+ &:where(ul, ol) {
170
+ margin-block-start: var(--typeset-flow);
171
+ margin-block-end: 0;
172
+ padding-inline-start: 1.5em;
173
+ }
174
+ &:where(li) {
175
+ margin-block-start: 0.5em;
176
+ padding-inline-start: 0.4em;
177
+ }
178
+ &:where(li > p, li > ul, li > ol) {
179
+ margin-block-start: 0.5em;
180
+ }
181
+ &:where(ul > li)::marker,
182
+ &:where(ol > li)::marker {
183
+ color: var(--typeset-muted);
184
+ }
185
+
186
+ &:where(ul.contains-task-list) {
187
+ list-style-type: none;
188
+ padding-inline-start: 0.25em;
189
+ }
190
+ &:where(li.task-list-item > input[type='checkbox']) {
191
+ margin-inline-end: 0.5em;
192
+ vertical-align: -0.1em;
193
+ accent-color: var(--color-primary, currentColor);
194
+ }
195
+
196
+ &:where(details) {
197
+ margin-block-start: var(--typeset-flow);
198
+ margin-block-end: 0;
199
+ }
200
+ &:where(summary) {
201
+ cursor: pointer;
202
+ font-weight: 500;
203
+ }
204
+ &:where(summary)::marker {
205
+ color: var(--typeset-muted);
206
+ }
207
+
208
+ &:where(kbd) {
209
+ font-family: inherit;
210
+ font-size: 0.85em;
211
+ font-weight: 500;
212
+ border: 1px solid var(--typeset-rule);
213
+ border-block-end-width: 2px;
214
+ border-radius: min(calc(var(--radius, 0.5em) * 0.6), 0.35em);
215
+ padding: 0.0625em 0.35em;
216
+ }
217
+
218
+ &:where(dl) {
219
+ margin-block-start: var(--typeset-flow);
220
+ margin-block-end: 0;
221
+ }
222
+ &:where(dt) {
223
+ font-weight: 500;
224
+ margin-block-start: 1em;
225
+ }
226
+ &:where(dt + dt) {
227
+ margin-block-start: 0.25em;
228
+ }
229
+ &:where(dd) {
230
+ margin-block-start: 0.25em;
231
+ margin-inline-start: 0;
232
+ padding-inline-start: 1em;
233
+ color: var(--typeset-muted);
234
+ }
235
+
236
+ &:where(:not(pre) > code) {
237
+ background-color: var(--color-muted, color-mix(in oklab, currentColor 8%, transparent));
238
+ font-family: var(--typeset-font-mono);
239
+ font-size: 0.85em;
240
+ border-radius: min(calc(var(--radius, 0.5em) * 0.6), 0.35em);
241
+ padding: 0.125em 0.3em;
242
+ }
243
+ &:where(pre) {
244
+ background-color: var(--color-muted, color-mix(in oklab, currentColor 8%, transparent));
245
+ font-family: var(--typeset-font-mono);
246
+ font-size: 0.875em;
247
+ line-height: 1.5;
248
+ tab-size: 2;
249
+ direction: ltr;
250
+ border-radius: var(--radius, 0.5em);
251
+ padding: 0.75em 1em;
252
+ overflow-x: auto;
253
+ margin-block-start: calc(var(--typeset-flow) / 0.875);
254
+ margin-block-end: 0;
255
+ }
256
+ &:where(pre code) {
257
+ background-color: transparent;
258
+ font-family: inherit;
259
+ font-size: inherit;
260
+ padding: 0;
261
+ border-radius: 0;
262
+ }
263
+ &:where(:is(h1, h2, h3, h4) :is(code)) {
264
+ font-size: 0.9em;
265
+ }
266
+
267
+ &:where(blockquote) {
268
+ border-inline-start: 2px solid var(--typeset-rule);
269
+ padding-inline-start: 1em;
270
+ margin-block-start: var(--typeset-flow);
271
+ margin-block-end: 0;
272
+ margin-inline: 0;
273
+ }
274
+ &:where(hr) {
275
+ border: 0;
276
+ border-block-start: 1px solid var(--typeset-rule);
277
+ margin-block-start: calc(var(--typeset-flow) * 2.4);
278
+ margin-block-end: 0;
279
+ }
280
+ &:where(hr + h1, hr + h2, hr + h3, hr + h4) {
281
+ margin-block-start: var(--typeset-flow);
282
+ }
283
+
284
+ &:where(.footnotes, [data-footnotes]) {
285
+ margin-block-start: calc(var(--typeset-flow) * 2);
286
+ border-block-start: 1px solid var(--typeset-rule);
287
+ padding-block-start: var(--typeset-flow);
288
+ font-size: 0.875em;
289
+ color: var(--typeset-muted);
290
+ }
291
+ &:where(math[display='block']) {
292
+ margin-block-start: var(--typeset-flow);
293
+ margin-block-end: 0;
294
+ overflow-x: auto;
295
+ overflow-y: hidden;
296
+ padding-block: 0.25em;
297
+ }
298
+
299
+ &:where(img, video) {
300
+ border-radius: var(--radius, 0.5em);
301
+ max-width: 100%;
302
+ height: auto;
303
+ margin-block-start: var(--typeset-flow);
304
+ margin-block-end: 0;
305
+ }
306
+ &:where(p img) {
307
+ margin-block-start: 0;
308
+ }
309
+ &:where(figure) {
310
+ margin-block-start: var(--typeset-flow);
311
+ margin-block-end: 0;
312
+ margin-inline: 0;
313
+ }
314
+ &:where(figcaption, caption) {
315
+ color: var(--typeset-muted);
316
+ font-size: 0.875em;
317
+ text-align: center;
318
+ margin-block-start: calc(0.75em / 0.875);
319
+ }
320
+ &:where(caption) {
321
+ caption-side: bottom;
322
+ }
323
+
324
+ &:where(table) {
325
+ max-width: 100%;
326
+ font-size: 1em;
327
+ line-height: 1.5;
328
+ font-variant-numeric: tabular-nums;
329
+ border-collapse: separate;
330
+ border-spacing: 0;
331
+ border-block-end: 1px solid var(--typeset-rule);
332
+ margin-block-start: var(--typeset-flow);
333
+ margin-block-end: 0;
334
+ }
335
+ &:where(.typeset-scroll) {
336
+ overflow-x: auto;
337
+ margin-block-start: var(--typeset-flow);
338
+ }
339
+ &:where(.typeset-scroll > *) {
340
+ margin-block-start: 0;
341
+ }
342
+ &:where(.typeset-scroll table) {
343
+ width: max-content;
344
+ max-width: none;
345
+ }
346
+ &:where(thead th) {
347
+ font-weight: 500;
348
+ text-align: start;
349
+ white-space: nowrap;
350
+ padding: 0.65em 1em;
351
+ }
352
+ &:where(:is(tbody, tfoot) :is(td, th)) {
353
+ padding: 0.75em 1em;
354
+ text-align: start;
355
+ vertical-align: top;
356
+ border-block-start: 1px solid var(--typeset-rule);
357
+ }
358
+ &:where(tbody th, tfoot th) {
359
+ font-weight: 500;
360
+ }
361
+ &:where(th:first-child, td:first-child) {
362
+ padding-inline-start: 0;
363
+ }
364
+ &:where(th[align='center'], td[align='center']) {
365
+ text-align: center;
366
+ }
367
+ &:where(th[align='right'], td[align='right']) {
368
+ text-align: right;
369
+ }
370
+ &:where(th[align='left'], td[align='left']) {
371
+ text-align: left;
372
+ }
373
+
374
+ &:where(li > blockquote, li > table, li > figure) {
375
+ margin-block-start: 0.5em;
376
+ }
377
+ &:where(li > pre) {
378
+ margin-block-start: calc(0.5em / 0.875);
379
+ }
380
+
381
+ @media print {
382
+ &:where(pre, table, blockquote, figure) {
383
+ break-inside: avoid;
384
+ }
385
+ &:where(h1, h2, h3, h4) {
386
+ break-after: avoid;
387
+ }
388
+ }
389
+
390
+ @media (forced-colors: active) {
391
+ &:where(:not(pre) > code) {
392
+ border: 1px solid;
393
+ }
394
+ }
395
+ }
396
+
397
+ .typeset
398
+ > :where(:first-child):not(
399
+ :where(
400
+ .not-typeset,
401
+ [data-not-typeset],
402
+ .not-typeset *,
403
+ [data-not-typeset] *
404
+ )
405
+ ),
406
+ .typeset
407
+ > :where(:first-child)
408
+ > :where(:first-child):not(
409
+ :where(
410
+ .not-typeset,
411
+ [data-not-typeset],
412
+ .not-typeset *,
413
+ [data-not-typeset] *
414
+ )
415
+ ),
416
+ .typeset
417
+ :where(
418
+ li > :first-child,
419
+ blockquote > :first-child,
420
+ td > :first-child,
421
+ th > :first-child,
422
+ dd > :first-child,
423
+ figure > :first-child,
424
+ figure > picture > img
425
+ ):not(
426
+ :where(
427
+ .not-typeset,
428
+ [data-not-typeset],
429
+ .not-typeset *,
430
+ [data-not-typeset] *
431
+ )
432
+ ) {
433
+ margin-block-start: 0;
434
+ }
435
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "basecoat-css",
3
- "version": "1.0.2",
3
+ "version": "1.2.0",
4
4
  "description": "Tailwind CSS for Basecoat components",
5
5
  "author": {
6
6
  "name": "hunvreus",
@@ -46,6 +46,8 @@
46
46
  "./all.min": "./dist/js/all.min.js",
47
47
  "./accordion": "./dist/js/accordion.js",
48
48
  "./accordion.min": "./dist/js/accordion.min.js",
49
+ "./carousel": "./dist/js/carousel.js",
50
+ "./carousel.min": "./dist/js/carousel.min.js",
49
51
  "./chart": "./dist/js/chart.js",
50
52
  "./chart.min": "./dist/js/chart.min.js",
51
53
  "./combobox": "./dist/js/combobox.js",
@@ -75,6 +77,9 @@
75
77
  "./compat": "./dist/basecoat-compat.css",
76
78
  "./compat.css": "./dist/basecoat-compat.css",
77
79
  "./compat.cdn.css": "./dist/basecoat-compat.cdn.css",
80
+ "./typeset": "./dist/typeset.css",
81
+ "./typeset.css": "./dist/typeset.css",
82
+ "./typeset.cdn.css": "./dist/typeset.cdn.css",
78
83
  "./compat/legacy.css": "./dist/compat/legacy.css",
79
84
  "./components": "./dist/basecoat-components.css",
80
85
  "./components.css": "./dist/basecoat-components.css",
@@ -118,11 +123,17 @@
118
123
  "./styles/style-rhea.css": "./dist/styles/rhea.css",
119
124
  "./styles/style-*.css": "./dist/styles/*.css",
120
125
  "./templates/nunjucks/*": "./templates/nunjucks/*",
121
- "./templates/jinja/*": "./templates/jinja/*"
126
+ "./templates/jinja/*": "./templates/jinja/*",
127
+ "./code-block": "./dist/js/code-block.js",
128
+ "./code-block.min": "./dist/js/code-block.min.js",
129
+ "./input-otp": "./dist/js/input-otp.js",
130
+ "./input-otp.min": "./dist/js/input-otp.min.js"
122
131
  },
123
132
  "scripts": {
124
133
  "build": "node ./scripts/build.js",
125
134
  "prepack": "node ./scripts/build.js",
135
+ "check": "node --test scripts/tests/*.test.js && npm run build && node ./scripts/check.js && npm pack --dry-run --ignore-scripts",
136
+ "check:site": "npm run docs:build && node ./scripts/check.js site",
126
137
  "docs:build": "npm run build && npm --prefix site clean-install --progress=false && npm --prefix site run build",
127
138
  "docs:dev": "npm --prefix site run dev",
128
139
  "docs:preview": "npm run docs:build && npm --prefix site run preview",
@@ -131,9 +142,10 @@
131
142
  "workers:preview": "npm run build && npm --prefix site clean-install --progress=false && npm --prefix site run workers:preview"
132
143
  },
133
144
  "devDependencies": {
134
- "@tailwindcss/cli": "^4.1.17",
135
- "prettier": "^3.5.3",
136
- "tailwindcss": "^4.1.17",
137
- "terser": "^5.42.0"
145
+ "@tailwindcss/cli": "^4.3.5",
146
+ "esbuild": "0.28.2",
147
+ "prettier": "^3.10.1",
148
+ "tailwindcss": "^4.3.5",
149
+ "terser": "^5.51.4"
138
150
  }
139
151
  }
@@ -98,7 +98,7 @@
98
98
  class="command-dialog {{ dialog_attrs.class | default('') }}"
99
99
  aria-label="Command menu"
100
100
  {% if open %}open{% endif %}
101
- onclick="if (event.target === this) this.close()"
101
+ onpointerdown="this.dataset.backdropPress = event.target === this" onclick="if (event.target === this && this.dataset.backdropPress === 'true') this.close()"
102
102
  {% for key, value in dialog_attrs.items() %}
103
103
  {% if key != 'class' %}{{ key }}="{{ value }}"{% endif %}
104
104
  {% endfor %}
@@ -53,7 +53,7 @@
53
53
  {% if title %}aria-labelledby="{{ id }}-title"{% endif %}
54
54
  {% if description %}aria-describedby="{{ id }}-description"{% endif %}
55
55
  {% if open %}open{% endif %}
56
- {% if close_on_overlay_click %}onclick="if (event.target === this) this.close()"{% endif %}
56
+ {% if close_on_overlay_click %}onpointerdown="this.dataset.backdropPress = event.target === this" onclick="if (event.target === this && this.dataset.backdropPress === 'true') this.close()"{% endif %}
57
57
  {% for key, value in dialog_attrs.items() %}
58
58
  {% if key != 'class' %}{{ key }}="{{ value }}"{% endif %}
59
59
  {% endfor %}
@@ -66,7 +66,6 @@
66
66
  id="{{ id }}-panel-{{ loop.index }}"
67
67
  aria-labelledby="{{ id }}-tab-{{ loop.index }}"
68
68
  tabindex="-1"
69
- aria-selected="{{ 'true' if loop.index == default_tab_index else 'false' }}"
70
69
  {% if loop.index != default_tab_index %}hidden{% endif %}
71
70
  {% if tabset.panel_attrs is defined and tabset.panel_attrs %}
72
71
  {% for key, value in tabset.panel_attrs.items() %}
@@ -2,9 +2,9 @@
2
2
  Renders a toaster container and individual toast messages.
3
3
  Can render the initial container or be used with htmx OOB swaps to add toasts dynamically.
4
4
 
5
- @param id {string} [optional] [default="toaster"] - Unique identifier for the toaster container.
5
+ @param id {string} [optional] [default="toaster"] - Unique identifier for the toaster list.
6
6
  @param toasts {array} [optional] - An array of toast objects to render initially. See the <code>toast()</code> macro for more details.
7
- @param attrs {object} [optional] - Additional HTML attributes for the main toaster container div.
7
+ @param attrs {object} [optional] - Additional HTML attributes for the main toaster list.
8
8
 
9
9
  Supports caller() for custom toast markup.
10
10
  #}
@@ -14,11 +14,13 @@
14
14
  attrs={}
15
15
  ) %}
16
16
  {% set attrs = attrs or {} %}
17
- <div
17
+ <ol
18
18
  id="{{ id }}"
19
19
  class="toaster {{ attrs.class | default('') }}"
20
+ role="list"
21
+ aria-label="{{ attrs.get('aria-label', 'Notifications') }}"
20
22
  {% for key, value in attrs.items() %}
21
- {% if key != 'class' %}{{ key }}="{{ value }}"{% endif %}
23
+ {% if key != 'class' and key != 'role' and key != 'aria-label' %}{{ key }}="{{ value }}"{% endif %}
22
24
  {% endfor %}
23
25
  >
24
26
  {% for item in toasts %}
@@ -30,17 +32,18 @@
30
32
  cancel=item.cancel | default(None),
31
33
  duration=item.duration | default(None),
32
34
  icon=item.icon | default(None),
35
+ close_button=item.close_button | default(true),
33
36
  attrs=item.attrs | default({})
34
37
  ) }}
35
38
  {% endfor %}
36
39
  {{ caller() if caller is defined }}
37
- </div>
40
+ </ol>
38
41
  {% endmacro %}
39
42
 
40
43
  {#
41
44
  Renders a single toast message.
42
45
 
43
- @param category {string} [optional] [default="success"] - Type of toast ('success', 'error', 'info', 'warning'). Determines icon and ARIA role.
46
+ @param category {string} [optional] [default="success"] - Type of toast ('success', 'error', 'info', 'warning', 'loading'). Determines icon and ARIA role.
44
47
  @param title {string} [optional] - The main title text of the toast.
45
48
  @param description {string} [optional] - The secondary description text.
46
49
  @param duration {number} [optional] - Timeout in milliseconds. Use -1 to keep the toast open.
@@ -53,7 +56,8 @@
53
56
  - label {string}: Button text.
54
57
  - onclick {string}: JavaScript code to execute on click.
55
58
  - href {string}: URL for an anchor link button.
56
- @param attrs {object} [optional] - Additional HTML attributes for the toast div.
59
+ @param attrs {object} [optional] - Additional HTML attributes for the toast list item.
60
+ @param close_button {boolean} [optional] [default=true] - Render the close icon button.
57
61
  #}
58
62
  {% macro toast(
59
63
  category="success",
@@ -63,32 +67,32 @@
63
67
  cancel=None,
64
68
  duration=None,
65
69
  icon=None,
66
- attrs={}
70
+ attrs={},
71
+ close_button=true
67
72
  ) %}
68
73
  {% set attrs = attrs or {} %}
69
74
  {% set action_href = action.href if action and action.href is defined and action.href else (action.url if action and action.url is defined and action.url else None) %}
70
75
  {% set cancel_href = cancel.href if cancel and cancel.href is defined and cancel.href else (cancel.url if cancel and cancel.url is defined and cancel.url else None) %}
71
- <div
76
+ <li
72
77
  class="toast {{ attrs.class | default('') }}"
73
- role="{{ 'alert' if category == 'error' else 'status' }}"
74
- aria-atomic="true"
75
- aria-hidden="false"
76
78
  {% if category %}data-category="{{ category }}"{% endif %}
77
79
  {% if duration is not none %}data-duration="{{ duration }}"{% endif %}
78
80
  {% for key, value in attrs.items() %}
79
81
  {% if key != 'class' %}{{ key }}="{{ value }}"{% endif %}
80
82
  {% endfor %}
81
83
  >
82
- <div class="toast-content">
84
+ <div class="toast-content" role="{{ 'alert' if category == 'error' else 'status' }}" aria-atomic="true">
83
85
  {% if icon %}
84
86
  {{ icon | safe }}
85
- {% elif category in ["error", "success", "info", "warning"] %}
87
+ {% elif category in ["error", "success", "info", "warning", "loading"] %}
86
88
  {% if category == "success" %}
87
89
  <svg aria-hidden="true" xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><circle cx="12" cy="12" r="10"/><path d="m9 12 2 2 4-4"/></svg>
88
90
  {% elif category == "error" %}
89
- <svg aria-hidden="true" xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><circle cx="12" cy="12" r="10"/><path d="m15 9-6 6"/><path d="m9 9 6 6"/></svg>
91
+ <svg aria-hidden="true" xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M15.312 2a2 2 0 0 1 1.414.586l4.688 4.688A2 2 0 0 1 22 8.688v6.624a2 2 0 0 1-.586 1.414l-4.688 4.688a2 2 0 0 1-1.414.586H8.688a2 2 0 0 1-1.414-.586l-4.688-4.688A2 2 0 0 1 2 15.312V8.688a2 2 0 0 1 .586-1.414l4.688-4.688A2 2 0 0 1 8.688 2z"/><path d="m15 9-6 6"/><path d="m9 9 6 6"/></svg>
90
92
  {% elif category == "info" %}
91
93
  <svg aria-hidden="true" xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><circle cx="12" cy="12" r="10"/><path d="M12 16v-4"/><path d="M12 8h.01"/></svg>
94
+ {% elif category == "loading" %}
95
+ <svg aria-hidden="true" xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M21 12a9 9 0 1 1-6.219-8.56"/></svg>
92
96
  {% elif category == "warning" %}
93
97
  <svg aria-hidden="true" xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3"/><path d="M12 9v4"/><path d="M12 17h.01"/></svg>
94
98
  {% endif %}
@@ -97,21 +101,19 @@
97
101
  {% if title %}<h2>{{ title }}</h2>{% endif %}
98
102
  {% if description %}<p>{{ description }}</p>{% endif %}
99
103
  </section>
100
- {% if action or cancel %}
104
+ {% if action or cancel or close_button %}
101
105
  <footer>
102
106
  {% if action %}
103
107
  {% if action_href %}
104
108
  <a
105
109
  href="{{ action_href }}"
106
- class="btn" data-size="sm"
107
- data-toast-action
110
+ class="btn" data-variant="outline" data-size="sm" data-toast-action
108
111
  >{{ action.label | default('') }}</a>
109
112
  {% else %}
110
113
  <button
111
114
  type="button"
112
- class="btn"
113
- data-size="sm"
114
- data-toast-action
115
+ class="btn" data-variant="outline"
116
+ data-size="sm" data-toast-action
115
117
  {% if action.onclick is defined and action.onclick %}onclick="{{ action.onclick }}"{% endif %}
116
118
  >{{ action.label | default('') }}</button>
117
119
  {% endif %}
@@ -120,20 +122,21 @@
120
122
  {% if cancel_href %}
121
123
  <a
122
124
  href="{{ cancel_href }}"
123
- class="btn" data-variant="outline" data-size="sm"
124
- data-toast-cancel
125
+ class="btn" data-variant="outline" data-size="sm" data-toast-cancel
125
126
  >{{ cancel.label | default('') }}</a>
126
127
  {% else %}
127
128
  <button
128
129
  type="button"
129
- class="btn" data-variant="outline" data-size="sm"
130
- data-toast-cancel
130
+ class="btn" data-variant="outline" data-size="sm" data-toast-cancel
131
131
  {% if cancel.onclick is defined and cancel.onclick %}onclick="{{ cancel.onclick }}"{% endif %}
132
132
  >{{ cancel.label | default('') }}</button>
133
133
  {% endif %}
134
134
  {% endif %}
135
+ {% if close_button %}
136
+ <button type="button" class="btn" data-variant="ghost" data-size="icon-sm" aria-label="Close toast"><svg aria-hidden="true" xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M18 6 6 18"/><path d="m6 6 12 12"/></svg></button>
137
+ {% endif %}
135
138
  </footer>
136
139
  {% endif %}
137
140
  </div>
138
- </div>
141
+ </li>
139
142
  {% endmacro %}
@@ -92,7 +92,7 @@
92
92
  class="command-dialog {{ dialog_attrs.class }}"
93
93
  aria-label="Command menu"
94
94
  {% if open %}open{% endif %}
95
- onclick="if (event.target === this) this.close()"
95
+ onpointerdown="this.dataset.backdropPress = event.target === this" onclick="if (event.target === this && this.dataset.backdropPress === 'true') this.close()"
96
96
  {% for key, value in dialog_attrs %}
97
97
  {% if key != 'class' %}{{ key }}="{{ value }}"{% endif %}
98
98
  {% endfor %}