basecoat-css 1.1.0 → 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 (92) hide show
  1. package/README.md +1 -1
  2. package/dist/base/base.css +1 -0
  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 +767 -119
  6. package/dist/basecoat-base.cdn.css +1924 -673
  7. package/dist/basecoat-base.cdn.min.css +1 -1
  8. package/dist/basecoat-compat.cdn.css +250 -75
  9. package/dist/basecoat-compat.cdn.min.css +1 -1
  10. package/dist/basecoat-components.css +10 -0
  11. package/dist/basecoat-luma.bundle.css +1115 -125
  12. package/dist/basecoat-luma.cdn.css +4649 -2558
  13. package/dist/basecoat-luma.cdn.min.css +1 -1
  14. package/dist/basecoat-lyra.bundle.css +1110 -125
  15. package/dist/basecoat-lyra.cdn.css +5118 -3079
  16. package/dist/basecoat-lyra.cdn.min.css +1 -1
  17. package/dist/basecoat-maia.bundle.css +1113 -125
  18. package/dist/basecoat-maia.cdn.css +5244 -3202
  19. package/dist/basecoat-maia.cdn.min.css +1 -1
  20. package/dist/basecoat-mira.bundle.css +1113 -125
  21. package/dist/basecoat-mira.cdn.css +3623 -1583
  22. package/dist/basecoat-mira.cdn.min.css +1 -1
  23. package/dist/basecoat-nova.bundle.css +1115 -129
  24. package/dist/basecoat-nova.cdn.css +5271 -3229
  25. package/dist/basecoat-nova.cdn.min.css +1 -1
  26. package/dist/basecoat-rhea.bundle.css +1117 -127
  27. package/dist/basecoat-rhea.cdn.css +5286 -3192
  28. package/dist/basecoat-rhea.cdn.min.css +1 -1
  29. package/dist/basecoat-sera.bundle.css +1111 -128
  30. package/dist/basecoat-sera.cdn.css +3280 -1254
  31. package/dist/basecoat-sera.cdn.min.css +1 -1
  32. package/dist/basecoat-vega.bundle.css +1113 -125
  33. package/dist/basecoat-vega.cdn.css +5225 -3180
  34. package/dist/basecoat-vega.cdn.min.css +1 -1
  35. package/dist/basecoat.bundle.css +1113 -125
  36. package/dist/basecoat.cdn.css +5225 -3180
  37. package/dist/basecoat.cdn.min.css +1 -1
  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 +2 -4
  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 +9 -1
  61. package/dist/components/toast.css +59 -44
  62. package/dist/components/trace.css +34 -0
  63. package/dist/js/all.js +488 -112
  64. package/dist/js/all.min.js +1 -1
  65. package/dist/js/carousel.js +105 -0
  66. package/dist/js/carousel.min.js +1 -0
  67. package/dist/js/code-block.js +47 -0
  68. package/dist/js/code-block.min.js +1 -0
  69. package/dist/js/drawer.js +6 -2
  70. package/dist/js/drawer.min.js +1 -1
  71. package/dist/js/input-otp.js +76 -0
  72. package/dist/js/input-otp.min.js +1 -0
  73. package/dist/js/tabs.js +31 -58
  74. package/dist/js/tabs.min.js +1 -1
  75. package/dist/js/toast.js +221 -53
  76. package/dist/js/toast.min.js +1 -1
  77. package/dist/styles/luma.css +348 -6
  78. package/dist/styles/lyra.css +343 -6
  79. package/dist/styles/maia.css +346 -6
  80. package/dist/styles/mira.css +346 -6
  81. package/dist/styles/nova.css +348 -10
  82. package/dist/styles/rhea.css +350 -8
  83. package/dist/styles/sera.css +344 -9
  84. package/dist/styles/vega.css +346 -6
  85. package/dist/typeset.cdn.css +381 -0
  86. package/dist/typeset.cdn.min.css +1 -0
  87. package/dist/typeset.css +435 -0
  88. package/package.json +16 -7
  89. package/templates/jinja/tabs.html.jinja +0 -1
  90. package/templates/jinja/toast.html.jinja +29 -26
  91. package/templates/nunjucks/tabs.njk +1 -1
  92. 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.1.0",
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,12 +123,16 @@
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",
126
- "check": "npm run build && node ./scripts/check.js && npm pack --dry-run --ignore-scripts",
135
+ "check": "node --test scripts/tests/*.test.js && npm run build && node ./scripts/check.js && npm pack --dry-run --ignore-scripts",
127
136
  "check:site": "npm run docs:build && node ./scripts/check.js site",
128
137
  "docs:build": "npm run build && npm --prefix site clean-install --progress=false && npm --prefix site run build",
129
138
  "docs:dev": "npm --prefix site run dev",
@@ -133,10 +142,10 @@
133
142
  "workers:preview": "npm run build && npm --prefix site clean-install --progress=false && npm --prefix site run workers:preview"
134
143
  },
135
144
  "devDependencies": {
136
- "@tailwindcss/cli": "^4.1.17",
145
+ "@tailwindcss/cli": "^4.3.5",
137
146
  "esbuild": "0.28.2",
138
- "prettier": "^3.5.3",
139
- "tailwindcss": "^4.1.17",
140
- "terser": "^5.42.0"
147
+ "prettier": "^3.10.1",
148
+ "tailwindcss": "^4.3.5",
149
+ "terser": "^5.51.4"
141
150
  }
142
151
  }
@@ -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 %}
@@ -32,7 +32,7 @@
32
32
  </nav>
33
33
  {% for tabset in tabsets %}
34
34
  {% if tabset.panel %}
35
- <div role="tabpanel" id="{{ id }}-panel-{{ loop.index }}" aria-labelledby="{{ id }}-tab-{{ loop.index }}" tabindex="-1" aria-selected="{{ 'true' if loop.index == default_tab_index else 'false' }}"{% if loop.index != default_tab_index %} hidden{% endif %}{% if tabset.panel_attrs %}{% for key, value in tabset.panel_attrs %} {{ key }}="{{ value }}"{% endfor %}{% endif %}>{{ tabset.panel | safe }}</div>
35
+ <div role="tabpanel" id="{{ id }}-panel-{{ loop.index }}" aria-labelledby="{{ id }}-tab-{{ loop.index }}" tabindex="-1"{% if loop.index != default_tab_index %} hidden{% endif %}{% if tabset.panel_attrs %}{% for key, value in tabset.panel_attrs %} {{ key }}="{{ value }}"{% endfor %}{% endif %}>{{ tabset.panel | safe }}</div>
36
36
  {% endif %}
37
37
  {% endfor %}
38
38
  </div>