@adia-ai/web-components 0.6.33 → 0.6.35
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +64 -0
- package/color/index.js +1 -1
- package/components/accordion/accordion-item.yaml +2 -2
- package/components/accordion/accordion.css +2 -2
- package/components/accordion/accordion.js +1 -1
- package/components/action-list/action-item.yaml +2 -2
- package/components/action-list/action-list.css +2 -2
- package/components/action-list/action-list.js +1 -1
- package/components/agent-artifact/{class.js → agent-artifact.class.js} +1 -1
- package/components/agent-artifact/agent-artifact.css +31 -31
- package/components/agent-artifact/agent-artifact.js +1 -1
- package/components/agent-feedback-bar/agent-feedback-bar.css +10 -10
- package/components/agent-feedback-bar/agent-feedback-bar.js +1 -1
- package/components/agent-questions/agent-questions.css +57 -57
- package/components/agent-questions/agent-questions.js +1 -1
- package/components/agent-reasoning/agent-reasoning.css +62 -62
- package/components/agent-reasoning/agent-reasoning.js +1 -1
- package/components/agent-suggestions/agent-suggestions.css +4 -4
- package/components/agent-suggestions/agent-suggestions.js +1 -1
- package/components/agent-trace/agent-trace.css +53 -53
- package/components/alert/alert.a2ui.json +64 -1
- package/components/alert/{class.js → alert.class.js} +189 -2
- package/components/alert/alert.css +119 -41
- package/components/alert/alert.d.ts +14 -0
- package/components/alert/alert.js +1 -1
- package/components/alert/alert.test.js +184 -0
- package/components/alert/alert.yaml +114 -1
- package/components/avatar/avatar-group.yaml +2 -2
- package/components/avatar/avatar.css +27 -27
- package/components/avatar/avatar.js +1 -1
- package/components/badge/badge.css +27 -27
- package/components/badge/badge.js +1 -1
- package/components/block/block.css +16 -16
- package/components/block/block.js +1 -1
- package/components/breadcrumb/breadcrumb.css +23 -23
- package/components/breadcrumb/breadcrumb.js +1 -1
- package/components/button/button.css +101 -91
- package/components/button/button.js +1 -1
- package/components/calendar-grid/calendar-grid.a2ui.json +146 -0
- package/components/calendar-grid/calendar-grid.class.js +326 -0
- package/components/calendar-grid/calendar-grid.css +246 -0
- package/components/calendar-grid/calendar-grid.d.ts +41 -0
- package/components/calendar-grid/calendar-grid.js +17 -0
- package/components/calendar-grid/calendar-grid.yaml +136 -0
- package/components/calendar-picker/calendar-picker.css +139 -139
- package/components/calendar-picker/calendar-picker.js +1 -1
- package/components/canvas/canvas.css +12 -12
- package/components/card/card.css +83 -83
- package/components/card/card.js +1 -1
- package/components/chart/chart.css +224 -224
- package/components/chart/chart.js +1 -1
- package/components/chart-legend/chart-legend.css +26 -26
- package/components/chart-legend/chart-legend.js +1 -1
- package/components/chat-thread/chat-input.a2ui.json +1 -1
- package/components/chat-thread/chat-input.js +6 -1
- package/components/chat-thread/chat-input.yaml +4 -1
- package/components/chat-thread/chat-thread.js +1 -1
- package/components/check/check.css +40 -40
- package/components/check/check.js +1 -1
- package/components/code/code.css +125 -125
- package/components/code/code.js +1 -1
- package/components/col/col.css +15 -15
- package/components/col/col.js +1 -1
- package/components/color-input/color-input.js +1 -1
- package/components/color-picker/color-picker.css +55 -55
- package/components/color-picker/color-picker.js +1 -1
- package/components/combobox/combobox.a2ui.json +363 -0
- package/components/combobox/combobox.class.js +861 -0
- package/components/combobox/combobox.css +244 -0
- package/components/combobox/combobox.d.ts +113 -0
- package/components/combobox/combobox.examples.md +59 -0
- package/components/combobox/combobox.js +17 -0
- package/components/combobox/combobox.test.js +181 -0
- package/components/combobox/combobox.yaml +369 -0
- package/components/command/command.css +90 -90
- package/components/command/command.js +1 -1
- package/components/date-range-picker/date-range-picker.a2ui.json +300 -0
- package/components/date-range-picker/date-range-picker.class.js +791 -0
- package/components/date-range-picker/date-range-picker.css +224 -0
- package/components/date-range-picker/date-range-picker.d.ts +82 -0
- package/components/date-range-picker/date-range-picker.examples.md +37 -0
- package/components/date-range-picker/date-range-picker.js +17 -0
- package/components/date-range-picker/date-range-picker.test.js +387 -0
- package/components/date-range-picker/date-range-picker.yaml +285 -0
- package/components/datetime-picker/datetime-picker.a2ui.json +334 -0
- package/components/datetime-picker/datetime-picker.class.js +706 -0
- package/components/datetime-picker/datetime-picker.css +150 -0
- package/components/datetime-picker/datetime-picker.d.ts +86 -0
- package/components/datetime-picker/datetime-picker.examples.md +46 -0
- package/components/datetime-picker/datetime-picker.js +17 -0
- package/components/datetime-picker/datetime-picker.test.js +454 -0
- package/components/datetime-picker/datetime-picker.yaml +332 -0
- package/components/demo-toggle/demo-toggle.css +27 -27
- package/components/demo-toggle/demo-toggle.js +1 -1
- package/components/description-list/description-list.css +18 -18
- package/components/description-list/description-list.js +1 -1
- package/components/divider/divider.css +24 -24
- package/components/divider/divider.js +1 -1
- package/components/drawer/drawer.js +1 -1
- package/components/embed/embed.css +6 -6
- package/components/embed/embed.js +1 -1
- package/components/empty-state/empty-state.css +27 -27
- package/components/empty-state/empty-state.js +1 -1
- package/components/feed/feed.css +12 -12
- package/components/feed/feed.js +1 -1
- package/components/field/field.css +28 -28
- package/components/field/field.js +1 -1
- package/components/field/field.test.js +1 -1
- package/components/fields/fields.css +5 -5
- package/components/fields/fields.js +1 -1
- package/components/grid/grid.css +5 -5
- package/components/grid/grid.js +1 -1
- package/components/heatmap/heatmap.css +63 -63
- package/components/heatmap/heatmap.js +1 -1
- package/components/icon/icon.css +12 -12
- package/components/icon/icon.js +1 -1
- package/components/image/image.css +14 -14
- package/components/image/image.js +1 -1
- package/components/index.js +11 -0
- package/components/inline-message/inline-message.a2ui.json +143 -0
- package/components/inline-message/inline-message.class.js +169 -0
- package/components/inline-message/inline-message.css +75 -0
- package/components/inline-message/inline-message.d.ts +31 -0
- package/components/inline-message/inline-message.examples.md +19 -0
- package/components/inline-message/inline-message.js +17 -0
- package/components/inline-message/inline-message.test.js +203 -0
- package/components/inline-message/inline-message.yaml +205 -0
- package/components/input/input.css +67 -67
- package/components/input/input.js +1 -1
- package/components/input/input.yaml +5 -4
- package/components/inspector/inspector.css +6 -6
- package/components/inspector/inspector.js +1 -1
- package/components/integration-card/integration-card.a2ui.json +268 -0
- package/components/integration-card/integration-card.class.js +410 -0
- package/components/integration-card/integration-card.css +169 -0
- package/components/integration-card/integration-card.d.ts +63 -0
- package/components/integration-card/integration-card.examples.md +41 -0
- package/components/integration-card/integration-card.js +17 -0
- package/components/integration-card/integration-card.test.js +306 -0
- package/components/integration-card/integration-card.yaml +280 -0
- package/components/kbd/kbd.css +32 -32
- package/components/kbd/kbd.js +1 -1
- package/components/link/link.css +12 -12
- package/components/link/link.js +1 -1
- package/components/list/list-item.yaml +2 -2
- package/components/list/list.css +8 -8
- package/components/list/list.js +1 -1
- package/components/list-window/list-window.a2ui.json +277 -0
- package/components/list-window/list-window.class.js +688 -0
- package/components/list-window/list-window.css +124 -0
- package/components/list-window/list-window.d.ts +84 -0
- package/components/list-window/list-window.examples.md +73 -0
- package/components/list-window/list-window.js +17 -0
- package/components/list-window/list-window.test.js +303 -0
- package/components/list-window/list-window.yaml +270 -0
- package/components/loading-overlay/loading-overlay.a2ui.json +176 -0
- package/components/loading-overlay/loading-overlay.class.js +203 -0
- package/components/loading-overlay/loading-overlay.css +81 -0
- package/components/loading-overlay/loading-overlay.d.ts +24 -0
- package/components/loading-overlay/loading-overlay.examples.md +50 -0
- package/components/loading-overlay/loading-overlay.js +17 -0
- package/components/loading-overlay/loading-overlay.test.js +257 -0
- package/components/loading-overlay/loading-overlay.yaml +260 -0
- package/components/menu/menu-divider.yaml +1 -1
- package/components/menu/menu-item.yaml +1 -1
- package/components/menu/menu.a2ui.json +3 -0
- package/components/menu/menu.css +8 -8
- package/components/menu/menu.js +1 -1
- package/components/menu/menu.yaml +7 -0
- package/components/modal/{class.js → modal.class.js} +12 -1
- package/components/modal/modal.css +54 -44
- package/components/modal/modal.js +1 -1
- package/components/nav/nav.css +40 -40
- package/components/nav/nav.js +1 -1
- package/components/nav-group/nav-group.css +52 -52
- package/components/nav-group/nav-group.js +1 -1
- package/components/nav-item/nav-item.css +44 -44
- package/components/nav-item/nav-item.js +1 -1
- package/components/noodles/noodles.css +31 -31
- package/components/noodles/noodles.js +1 -1
- package/components/option-card/option-card.css +69 -69
- package/components/option-card/option-card.js +1 -1
- package/components/otp-input/otp-input.css +30 -30
- package/components/otp-input/otp-input.js +1 -1
- package/components/page/page.css +18 -18
- package/components/page/page.js +1 -1
- package/components/pagination/pagination.css +61 -61
- package/components/pagination/pagination.js +1 -1
- package/components/pane/pane.css +57 -57
- package/components/pane/pane.js +1 -1
- package/components/pipeline-status/pipeline-status.css +65 -65
- package/components/pipeline-status/pipeline-status.js +1 -1
- package/components/popover/popover.a2ui.json +8 -1
- package/components/popover/popover.css +17 -17
- package/components/popover/popover.js +1 -1
- package/components/popover/popover.yaml +14 -1
- package/components/progress/progress.css +23 -23
- package/components/progress/progress.js +1 -1
- package/components/progress-row/progress-row.css +17 -17
- package/components/progress-row/progress-row.js +1 -1
- package/components/radio/radio.css +39 -39
- package/components/radio/radio.js +1 -1
- package/components/range/range.css +55 -55
- package/components/range/range.js +1 -1
- package/components/rating/rating.css +28 -28
- package/components/rating/rating.js +1 -1
- package/components/richtext/richtext.css +133 -133
- package/components/richtext/richtext.js +1 -1
- package/components/row/row.css +19 -19
- package/components/row/row.js +1 -1
- package/components/search/search.css +5 -5
- package/components/search/search.js +1 -1
- package/components/segment/segment.css +24 -24
- package/components/segment/segment.js +1 -1
- package/components/segmented/segmented.css +25 -25
- package/components/segmented/segmented.js +1 -1
- package/components/select/select.a2ui.json +58 -4
- package/components/select/{class.js → select.class.js} +415 -6
- package/components/select/select.css +242 -84
- package/components/select/select.d.ts +31 -1
- package/components/select/select.js +1 -1
- package/components/select/select.test.js +202 -0
- package/components/select/select.yaml +126 -5
- package/components/skeleton/skeleton.css +14 -14
- package/components/skeleton/skeleton.js +1 -1
- package/components/slider/slider.css +46 -46
- package/components/slider/slider.js +1 -1
- package/components/spinner/spinner.a2ui.json +198 -0
- package/components/spinner/spinner.class.js +99 -0
- package/components/spinner/spinner.css +221 -0
- package/components/spinner/spinner.d.ts +26 -0
- package/components/spinner/spinner.examples.md +26 -0
- package/components/spinner/spinner.js +17 -0
- package/components/spinner/spinner.test.js +272 -0
- package/components/spinner/spinner.yaml +238 -0
- package/components/stack/stack.css +11 -11
- package/components/stack/stack.js +1 -1
- package/components/stat/stat.css +25 -25
- package/components/step-progress/step-progress.css +20 -20
- package/components/step-progress/step-progress.js +1 -1
- package/components/stepper/stepper-item.yaml +1 -1
- package/components/stepper/stepper.css +29 -29
- package/components/stepper/stepper.js +1 -1
- package/components/stream/stream.css +12 -12
- package/components/stream/stream.js +1 -1
- package/components/swatch/swatch.css +68 -68
- package/components/swatch/swatch.js +1 -1
- package/components/swiper/swiper.css +57 -57
- package/components/swiper/swiper.js +1 -1
- package/components/switch/switch.css +52 -52
- package/components/switch/switch.js +1 -1
- package/components/table/table.css +163 -163
- package/components/table/table.js +1 -1
- package/components/table-toolbar/{class.js → table-toolbar.class.js} +1 -1
- package/components/table-toolbar/table-toolbar.css +32 -32
- package/components/table-toolbar/table-toolbar.js +1 -1
- package/components/tabs/tab.yaml +2 -2
- package/components/tabs/tabs.css +51 -51
- package/components/tabs/tabs.js +1 -1
- package/components/tag/tag.css +48 -48
- package/components/tag/tag.js +1 -1
- package/components/tags-input/tags-input.a2ui.json +337 -0
- package/components/tags-input/tags-input.class.js +776 -0
- package/components/tags-input/tags-input.css +201 -0
- package/components/tags-input/tags-input.d.ts +120 -0
- package/components/tags-input/tags-input.examples.md +92 -0
- package/components/tags-input/tags-input.js +17 -0
- package/components/tags-input/tags-input.test.js +368 -0
- package/components/tags-input/tags-input.yaml +367 -0
- package/components/text/text.css +44 -44
- package/components/text/text.js +1 -1
- package/components/textarea/textarea.a2ui.json +1 -1
- package/components/textarea/textarea.css +46 -46
- package/components/textarea/textarea.js +1 -1
- package/components/textarea/textarea.yaml +11 -8
- package/components/time-picker/time-picker.a2ui.json +267 -0
- package/components/time-picker/time-picker.class.js +693 -0
- package/components/time-picker/time-picker.css +122 -0
- package/components/time-picker/time-picker.d.ts +75 -0
- package/components/time-picker/time-picker.examples.md +35 -0
- package/components/time-picker/time-picker.js +17 -0
- package/components/time-picker/time-picker.test.js +287 -0
- package/components/time-picker/time-picker.yaml +256 -0
- package/components/timeline/timeline-item.yaml +2 -2
- package/components/timeline/{class.js → timeline.class.js} +1 -1
- package/components/timeline/timeline.css +50 -50
- package/components/timeline/timeline.js +1 -1
- package/components/toast/toast.css +58 -58
- package/components/toast/toast.js +1 -1
- package/components/toggle-group/toggle-group.css +6 -6
- package/components/toggle-group/toggle-group.js +1 -1
- package/components/toggle-group/toggle-option.yaml +1 -1
- package/components/toggle-scheme/toggle-scheme.css +2 -2
- package/components/toggle-scheme/toggle-scheme.js +1 -1
- package/components/toolbar/toolbar-group.yaml +1 -1
- package/components/toolbar/toolbar.css +17 -17
- package/components/toolbar/toolbar.js +1 -1
- package/components/tooltip/tooltip.css +2 -2
- package/components/tooltip/tooltip.js +1 -1
- package/components/tree/tree-item.yaml +1 -1
- package/components/tree/tree.css +37 -37
- package/components/tree/tree.js +1 -1
- package/components/upload/upload.css +49 -49
- package/components/upload/upload.js +1 -1
- package/dist/web-components.min.css +1 -1
- package/dist/web-components.min.js +146 -87
- package/package.json +3 -3
- package/styles/components.css +11 -0
- /package/components/accordion/{class.js → accordion.class.js} +0 -0
- /package/components/action-list/{class.js → action-list.class.js} +0 -0
- /package/components/agent-feedback-bar/{class.js → agent-feedback-bar.class.js} +0 -0
- /package/components/agent-questions/{class.js → agent-questions.class.js} +0 -0
- /package/components/agent-reasoning/{class.js → agent-reasoning.class.js} +0 -0
- /package/components/agent-suggestions/{class.js → agent-suggestions.class.js} +0 -0
- /package/components/avatar/{class.js → avatar.class.js} +0 -0
- /package/components/badge/{class.js → badge.class.js} +0 -0
- /package/components/block/{class.js → block.class.js} +0 -0
- /package/components/breadcrumb/{class.js → breadcrumb.class.js} +0 -0
- /package/components/button/{class.js → button.class.js} +0 -0
- /package/components/calendar-picker/{class.js → calendar-picker.class.js} +0 -0
- /package/components/card/{class.js → card.class.js} +0 -0
- /package/components/chart/{class.js → chart.class.js} +0 -0
- /package/components/chart-legend/{class.js → chart-legend.class.js} +0 -0
- /package/components/chat-thread/{class.js → chat-thread.class.js} +0 -0
- /package/components/check/{class.js → check.class.js} +0 -0
- /package/components/code/{class.js → code.class.js} +0 -0
- /package/components/col/{class.js → col.class.js} +0 -0
- /package/components/color-input/{class.js → color-input.class.js} +0 -0
- /package/components/color-picker/{class.js → color-picker.class.js} +0 -0
- /package/components/command/{class.js → command.class.js} +0 -0
- /package/components/demo-toggle/{class.js → demo-toggle.class.js} +0 -0
- /package/components/description-list/{class.js → description-list.class.js} +0 -0
- /package/components/divider/{class.js → divider.class.js} +0 -0
- /package/components/drawer/{class.js → drawer.class.js} +0 -0
- /package/components/embed/{class.js → embed.class.js} +0 -0
- /package/components/empty-state/{class.js → empty-state.class.js} +0 -0
- /package/components/feed/{class.js → feed.class.js} +0 -0
- /package/components/field/{class.js → field.class.js} +0 -0
- /package/components/fields/{class.js → fields.class.js} +0 -0
- /package/components/grid/{class.js → grid.class.js} +0 -0
- /package/components/heatmap/{class.js → heatmap.class.js} +0 -0
- /package/components/icon/{class.js → icon.class.js} +0 -0
- /package/components/image/{class.js → image.class.js} +0 -0
- /package/components/input/{class.js → input.class.js} +0 -0
- /package/components/inspector/{class.js → inspector.class.js} +0 -0
- /package/components/kbd/{class.js → kbd.class.js} +0 -0
- /package/components/link/{class.js → link.class.js} +0 -0
- /package/components/list/{class.js → list.class.js} +0 -0
- /package/components/menu/{class.js → menu.class.js} +0 -0
- /package/components/nav/{class.js → nav.class.js} +0 -0
- /package/components/nav-group/{class.js → nav-group.class.js} +0 -0
- /package/components/nav-item/{class.js → nav-item.class.js} +0 -0
- /package/components/noodles/{class.js → noodles.class.js} +0 -0
- /package/components/option-card/{class.js → option-card.class.js} +0 -0
- /package/components/otp-input/{class.js → otp-input.class.js} +0 -0
- /package/components/page/{class.js → page.class.js} +0 -0
- /package/components/pagination/{class.js → pagination.class.js} +0 -0
- /package/components/pane/{class.js → pane.class.js} +0 -0
- /package/components/pipeline-status/{class.js → pipeline-status.class.js} +0 -0
- /package/components/popover/{class.js → popover.class.js} +0 -0
- /package/components/progress/{class.js → progress.class.js} +0 -0
- /package/components/progress-row/{class.js → progress-row.class.js} +0 -0
- /package/components/radio/{class.js → radio.class.js} +0 -0
- /package/components/range/{class.js → range.class.js} +0 -0
- /package/components/rating/{class.js → rating.class.js} +0 -0
- /package/components/richtext/{class.js → richtext.class.js} +0 -0
- /package/components/row/{class.js → row.class.js} +0 -0
- /package/components/search/{class.js → search.class.js} +0 -0
- /package/components/segment/{class.js → segment.class.js} +0 -0
- /package/components/segmented/{class.js → segmented.class.js} +0 -0
- /package/components/skeleton/{class.js → skeleton.class.js} +0 -0
- /package/components/slider/{class.js → slider.class.js} +0 -0
- /package/components/stack/{class.js → stack.class.js} +0 -0
- /package/components/step-progress/{class.js → step-progress.class.js} +0 -0
- /package/components/stepper/{class.js → stepper.class.js} +0 -0
- /package/components/stream/{class.js → stream.class.js} +0 -0
- /package/components/swatch/{class.js → swatch.class.js} +0 -0
- /package/components/swiper/{class.js → swiper.class.js} +0 -0
- /package/components/switch/{class.js → switch.class.js} +0 -0
- /package/components/table/{class.js → table.class.js} +0 -0
- /package/components/tabs/{class.js → tabs.class.js} +0 -0
- /package/components/tag/{class.js → tag.class.js} +0 -0
- /package/components/text/{class.js → text.class.js} +0 -0
- /package/components/textarea/{class.js → textarea.class.js} +0 -0
- /package/components/toast/{class.js → toast.class.js} +0 -0
- /package/components/toggle-group/{class.js → toggle-group.class.js} +0 -0
- /package/components/toggle-scheme/{class.js → toggle-scheme.class.js} +0 -0
- /package/components/toolbar/{class.js → toolbar.class.js} +0 -0
- /package/components/tooltip/{class.js → tooltip.class.js} +0 -0
- /package/components/tree/{class.js → tree.class.js} +0 -0
- /package/components/upload/{class.js → upload.class.js} +0 -0
|
@@ -178,3 +178,187 @@ describe('alert-ui — full corpus shape (the §34 scenario)', () => {
|
|
|
178
178
|
expect(content.querySelector('a').getAttribute('href')).toBe('/foo');
|
|
179
179
|
});
|
|
180
180
|
});
|
|
181
|
+
|
|
182
|
+
describe('alert-ui — SPEC-006 dunning pattern', () => {
|
|
183
|
+
beforeEach(() => { document.body.innerHTML = ''; });
|
|
184
|
+
|
|
185
|
+
it('formats amount via Intl.NumberFormat with currency', async () => {
|
|
186
|
+
const a = mount(`<alert-ui pattern="dunning" amount="24.50" currency="USD"
|
|
187
|
+
due-at="2026-05-20" card-last4="4242"
|
|
188
|
+
reason="declined" variant="danger"></alert-ui>`);
|
|
189
|
+
await tick();
|
|
190
|
+
const amt = a.querySelector('[data-dunning-amount]');
|
|
191
|
+
expect(amt).not.toBeNull();
|
|
192
|
+
// en-US default formatting (jsdom): "$24.50"
|
|
193
|
+
expect(amt.textContent).toMatch(/\$24\.50|USD\s*24\.50/);
|
|
194
|
+
});
|
|
195
|
+
|
|
196
|
+
it('formats due date via Intl.DateTimeFormat', async () => {
|
|
197
|
+
const a = mount(`<alert-ui pattern="dunning" amount="24.50" currency="USD"
|
|
198
|
+
due-at="2026-05-20T00:00:00Z"
|
|
199
|
+
reason="declined" variant="danger"></alert-ui>`);
|
|
200
|
+
await tick();
|
|
201
|
+
const meta = a.querySelector('[data-dunning-meta]');
|
|
202
|
+
expect(meta).not.toBeNull();
|
|
203
|
+
// Expect month name + day + year somewhere in the meta
|
|
204
|
+
expect(meta.textContent).toMatch(/May/);
|
|
205
|
+
expect(meta.textContent).toMatch(/2026/);
|
|
206
|
+
});
|
|
207
|
+
|
|
208
|
+
it('stamps the cardLast4 metadata', async () => {
|
|
209
|
+
const a = mount(`<alert-ui pattern="dunning" amount="24.50" currency="USD"
|
|
210
|
+
due-at="2026-05-20" card-last4="4242"
|
|
211
|
+
reason="declined" variant="danger"></alert-ui>`);
|
|
212
|
+
await tick();
|
|
213
|
+
const meta = a.querySelector('[data-dunning-meta]');
|
|
214
|
+
expect(meta.textContent).toContain('ending 4242');
|
|
215
|
+
});
|
|
216
|
+
|
|
217
|
+
it('stamps x-circle icon for reason="declined"', async () => {
|
|
218
|
+
const a = mount(`<alert-ui pattern="dunning" reason="declined" variant="danger"
|
|
219
|
+
amount="10" currency="USD"></alert-ui>`);
|
|
220
|
+
await tick();
|
|
221
|
+
const icon = a.querySelector('[slot="leading"]');
|
|
222
|
+
expect(icon).not.toBeNull();
|
|
223
|
+
expect(icon.getAttribute('name')).toBe('x-circle');
|
|
224
|
+
});
|
|
225
|
+
|
|
226
|
+
it('stamps clock icon for reason="expired"', async () => {
|
|
227
|
+
const a = mount(`<alert-ui pattern="dunning" reason="expired" variant="danger"
|
|
228
|
+
amount="10" currency="USD"></alert-ui>`);
|
|
229
|
+
await tick();
|
|
230
|
+
const icon = a.querySelector('[slot="leading"]');
|
|
231
|
+
expect(icon.getAttribute('name')).toBe('clock');
|
|
232
|
+
});
|
|
233
|
+
|
|
234
|
+
it('dispatches dunning-action event on descendant [data-dunning-action] click', async () => {
|
|
235
|
+
const a = mount(`<alert-ui pattern="dunning" amount="24.50" currency="USD"
|
|
236
|
+
due-at="2026-05-20" reason="declined" variant="danger">
|
|
237
|
+
<button-ui slot="actions" data-dunning-action="update" text="Update"></button-ui>
|
|
238
|
+
<button-ui slot="actions" data-dunning-action="retry" text="Retry"></button-ui>
|
|
239
|
+
</alert-ui>`);
|
|
240
|
+
await tick();
|
|
241
|
+
|
|
242
|
+
const received = [];
|
|
243
|
+
a.addEventListener('dunning-action', (e) => received.push(e.detail));
|
|
244
|
+
|
|
245
|
+
const updateBtn = a.querySelector('[data-dunning-action="update"]');
|
|
246
|
+
updateBtn.dispatchEvent(new Event('press', { bubbles: true }));
|
|
247
|
+
await tick();
|
|
248
|
+
|
|
249
|
+
expect(received.length).toBe(1);
|
|
250
|
+
expect(received[0].action).toBe('update');
|
|
251
|
+
expect(received[0].amount).toBe(24.5);
|
|
252
|
+
expect(received[0].currency).toBe('USD');
|
|
253
|
+
expect(received[0].dueAt).toBe('2026-05-20');
|
|
254
|
+
});
|
|
255
|
+
|
|
256
|
+
it('dispatches dunning-action with action="retry" when retry button is pressed', async () => {
|
|
257
|
+
const a = mount(`<alert-ui pattern="dunning" amount="10" currency="USD"
|
|
258
|
+
due-at="2026-05-20" reason="declined" variant="danger">
|
|
259
|
+
<button-ui slot="actions" data-dunning-action="retry" text="Retry"></button-ui>
|
|
260
|
+
</alert-ui>`);
|
|
261
|
+
await tick();
|
|
262
|
+
|
|
263
|
+
const received = [];
|
|
264
|
+
a.addEventListener('dunning-action', (e) => received.push(e.detail));
|
|
265
|
+
|
|
266
|
+
const retryBtn = a.querySelector('[data-dunning-action="retry"]');
|
|
267
|
+
retryBtn.dispatchEvent(new Event('press', { bubbles: true }));
|
|
268
|
+
await tick();
|
|
269
|
+
|
|
270
|
+
expect(received.length).toBe(1);
|
|
271
|
+
expect(received[0].action).toBe('retry');
|
|
272
|
+
});
|
|
273
|
+
|
|
274
|
+
it('re-formats amount when the [amount] attribute changes', async () => {
|
|
275
|
+
const a = mount(`<alert-ui pattern="dunning" amount="10" currency="USD"
|
|
276
|
+
due-at="2026-05-20" reason="declined" variant="danger"></alert-ui>`);
|
|
277
|
+
await tick();
|
|
278
|
+
let amt = a.querySelector('[data-dunning-amount]');
|
|
279
|
+
expect(amt.textContent).toMatch(/10/);
|
|
280
|
+
|
|
281
|
+
a.amount = 99.99;
|
|
282
|
+
await tick();
|
|
283
|
+
amt = a.querySelector('[data-dunning-amount]');
|
|
284
|
+
expect(amt.textContent).toMatch(/99\.99/);
|
|
285
|
+
});
|
|
286
|
+
|
|
287
|
+
it('inherits role="alert" for variant="danger" in dunning mode', async () => {
|
|
288
|
+
const a = mount(`<alert-ui pattern="dunning" variant="danger" amount="10" currency="USD"
|
|
289
|
+
due-at="2026-05-20" reason="declined"></alert-ui>`);
|
|
290
|
+
await tick();
|
|
291
|
+
expect(a.getAttribute('role')).toBe('alert');
|
|
292
|
+
});
|
|
293
|
+
|
|
294
|
+
it('inherits role="alert" for variant="warning" (grace period)', async () => {
|
|
295
|
+
const a = mount(`<alert-ui pattern="dunning" variant="warning" amount="10" currency="USD"
|
|
296
|
+
due-at="2026-06-01"></alert-ui>`);
|
|
297
|
+
await tick();
|
|
298
|
+
// warning maps to role=alert (same as danger via #updateRole)
|
|
299
|
+
expect(a.getAttribute('role')).toBe('alert');
|
|
300
|
+
});
|
|
301
|
+
|
|
302
|
+
it('grace-period (warning) uses "due" prefix in date meta, not "failed"', async () => {
|
|
303
|
+
const a = mount(`<alert-ui pattern="dunning" variant="warning" amount="10" currency="USD"
|
|
304
|
+
due-at="2026-06-01"></alert-ui>`);
|
|
305
|
+
await tick();
|
|
306
|
+
const meta = a.querySelector('[data-dunning-meta]');
|
|
307
|
+
expect(meta.textContent).toContain('due');
|
|
308
|
+
});
|
|
309
|
+
|
|
310
|
+
it('default title for declined is "Payment failed"', async () => {
|
|
311
|
+
const a = mount(`<alert-ui pattern="dunning" reason="declined" variant="danger"
|
|
312
|
+
amount="10" currency="USD"></alert-ui>`);
|
|
313
|
+
await tick();
|
|
314
|
+
const titleEl = a.querySelector('[data-dunning-title]');
|
|
315
|
+
expect(titleEl.textContent).toBe('Payment failed');
|
|
316
|
+
});
|
|
317
|
+
|
|
318
|
+
it('default title for expired is "Card expired"', async () => {
|
|
319
|
+
const a = mount(`<alert-ui pattern="dunning" reason="expired" variant="danger"
|
|
320
|
+
amount="10" currency="USD"></alert-ui>`);
|
|
321
|
+
await tick();
|
|
322
|
+
const titleEl = a.querySelector('[data-dunning-title]');
|
|
323
|
+
expect(titleEl.textContent).toBe('Card expired');
|
|
324
|
+
});
|
|
325
|
+
|
|
326
|
+
it('explicit [title] overrides the per-reason default', async () => {
|
|
327
|
+
const a = mount(`<alert-ui pattern="dunning" reason="declined" title="Custom message"
|
|
328
|
+
amount="10" currency="USD" variant="danger"></alert-ui>`);
|
|
329
|
+
await tick();
|
|
330
|
+
const titleEl = a.querySelector('[data-dunning-title]');
|
|
331
|
+
expect(titleEl.textContent).toBe('Custom message');
|
|
332
|
+
});
|
|
333
|
+
|
|
334
|
+
it('explicit [icon] overrides the per-reason icon map', async () => {
|
|
335
|
+
const a = mount(`<alert-ui pattern="dunning" reason="declined" icon="credit-card"
|
|
336
|
+
amount="10" currency="USD" variant="danger"></alert-ui>`);
|
|
337
|
+
await tick();
|
|
338
|
+
const icon = a.querySelector('[slot="leading"]');
|
|
339
|
+
expect(icon.getAttribute('name')).toBe('credit-card');
|
|
340
|
+
});
|
|
341
|
+
|
|
342
|
+
it('composes aria-label from title + amount + meta', async () => {
|
|
343
|
+
const a = mount(`<alert-ui pattern="dunning" reason="declined" amount="24.50"
|
|
344
|
+
currency="USD" due-at="2026-05-20" card-last4="4242"
|
|
345
|
+
variant="danger"></alert-ui>`);
|
|
346
|
+
await tick();
|
|
347
|
+
const aria = a.getAttribute('aria-label');
|
|
348
|
+
expect(aria).toContain('Payment failed');
|
|
349
|
+
expect(aria).toMatch(/24\.50/);
|
|
350
|
+
expect(aria).toMatch(/4242/);
|
|
351
|
+
});
|
|
352
|
+
|
|
353
|
+
it('does not stamp dunning content when pattern is empty (standard mode)', async () => {
|
|
354
|
+
const a = mount(`<alert-ui variant="danger" amount="24.50" currency="USD"
|
|
355
|
+
due-at="2026-05-20" reason="declined"
|
|
356
|
+
text="standard message"></alert-ui>`);
|
|
357
|
+
await tick();
|
|
358
|
+
// No dunning markers — uses the standard text-only render path
|
|
359
|
+
expect(a.querySelector('[data-dunning-amount]')).toBeNull();
|
|
360
|
+
expect(a.querySelector('[data-dunning-title]')).toBeNull();
|
|
361
|
+
const content = a.querySelector(':scope > [slot="content"]');
|
|
362
|
+
expect(content.textContent.trim()).toBe('standard message');
|
|
363
|
+
});
|
|
364
|
+
});
|
|
@@ -69,9 +69,73 @@ props:
|
|
|
69
69
|
- danger
|
|
70
70
|
- muted
|
|
71
71
|
- neutral
|
|
72
|
+
pattern:
|
|
73
|
+
description: >-
|
|
74
|
+
Domain pattern mode. Default is empty (standard alert). Setting
|
|
75
|
+
`pattern="dunning"` switches to billing dunning render mode —
|
|
76
|
+
stamps a formatted amount + due-date + decline-reason from props
|
|
77
|
+
and re-dispatches descendant `[data-dunning-action]` button
|
|
78
|
+
clicks as a unified `dunning-action` event. Spec: SPEC-006.
|
|
79
|
+
type: string
|
|
80
|
+
default: ""
|
|
81
|
+
enum:
|
|
82
|
+
- ""
|
|
83
|
+
- dunning
|
|
84
|
+
amount:
|
|
85
|
+
description: >-
|
|
86
|
+
Dunning mode only — the unpaid amount as a decimal major-unit
|
|
87
|
+
number (`24.50`, not minor units like `2450`). Formatted via
|
|
88
|
+
`Intl.NumberFormat` using [currency] and [lang]. Ignored when
|
|
89
|
+
[pattern] is not `dunning`.
|
|
90
|
+
type: number
|
|
91
|
+
default: 0
|
|
92
|
+
currency:
|
|
93
|
+
description: >-
|
|
94
|
+
Dunning mode only — ISO 4217 currency code driving the
|
|
95
|
+
`Intl.NumberFormat` style="currency" rendering. Defaults to
|
|
96
|
+
`USD`.
|
|
97
|
+
type: string
|
|
98
|
+
default: USD
|
|
99
|
+
dueAt:
|
|
100
|
+
description: >-
|
|
101
|
+
Dunning mode only — ISO 8601 due / failed-at timestamp.
|
|
102
|
+
Formatted via `Intl.DateTimeFormat`. Ignored when [pattern] is
|
|
103
|
+
not `dunning`. Attribute spelling: `due-at`.
|
|
104
|
+
type: string
|
|
105
|
+
default: ""
|
|
106
|
+
attribute: due-at
|
|
107
|
+
cardLast4:
|
|
108
|
+
description: >-
|
|
109
|
+
Dunning mode only — last 4 digits of the declined card.
|
|
110
|
+
Rendered as "ending 4242". Ignored when [pattern] is not
|
|
111
|
+
`dunning`. Attribute spelling: `card-last4`.
|
|
112
|
+
type: string
|
|
113
|
+
default: ""
|
|
114
|
+
attribute: card-last4
|
|
115
|
+
reason:
|
|
116
|
+
description: >-
|
|
117
|
+
Dunning mode only — decline reason. Drives the leading icon
|
|
118
|
+
(declined → `x-circle`, expired → `clock`, insufficient →
|
|
119
|
+
`wallet`, network → `wifi-slash`). One of: `declined`,
|
|
120
|
+
`expired`, `insufficient`, `network`, or empty.
|
|
121
|
+
type: string
|
|
122
|
+
default: ""
|
|
123
|
+
enum:
|
|
124
|
+
- ""
|
|
125
|
+
- declined
|
|
126
|
+
- expired
|
|
127
|
+
- insufficient
|
|
128
|
+
- network
|
|
72
129
|
events:
|
|
73
130
|
close:
|
|
74
131
|
description: Fired when the close button is clicked
|
|
132
|
+
dunning-action:
|
|
133
|
+
description: >-
|
|
134
|
+
Dunning pattern only — fired when a descendant button with
|
|
135
|
+
`[data-dunning-action]` is clicked. Detail shape `{ action,
|
|
136
|
+
amount, currency, dueAt }`; the action string is the value of
|
|
137
|
+
the `data-dunning-action` attribute (typically `"update"` or
|
|
138
|
+
`"retry"`).
|
|
75
139
|
slots:
|
|
76
140
|
content:
|
|
77
141
|
description: >-
|
|
@@ -94,6 +158,12 @@ slots:
|
|
|
94
158
|
Optional trailing action button (e.g. "Refresh", "Status page").
|
|
95
159
|
Right-aligned in the flex layout. See system-banners pattern for
|
|
96
160
|
examples.
|
|
161
|
+
actions:
|
|
162
|
+
description: >-
|
|
163
|
+
Dunning pattern only — action button stack (typically two
|
|
164
|
+
`<button-ui>` with `data-dunning-action="update"` and
|
|
165
|
+
`data-dunning-action="retry"`). Sits below the formatted message
|
|
166
|
+
in the col layout when `pattern="dunning"`.
|
|
97
167
|
states:
|
|
98
168
|
- name: idle
|
|
99
169
|
description: Default, ready for interaction.
|
|
@@ -107,7 +177,19 @@ a2ui:
|
|
|
107
177
|
reason: 'Ephemeral vs persistent boundary.'
|
|
108
178
|
- rule: 'For modal-style critical alerts use <modal-ui> with alert content.'
|
|
109
179
|
reason: 'Inline vs modal.'
|
|
110
|
-
|
|
180
|
+
- rule: 'Billing dunning / payment-failed notices use pattern="dunning" + amount + currency + dueAt props, NOT inlined into title/description strings.'
|
|
181
|
+
reason: 'Intl-formatting + unified telemetry via dunning-action event.'
|
|
182
|
+
- rule: 'pattern="dunning" SHOULD use variant="danger" (default) or variant="warning" (grace period); never variant="info" or "success".'
|
|
183
|
+
reason: 'Dunning is always a failure surface.'
|
|
184
|
+
- rule: 'When pattern="dunning", slot at least one button-ui in slot="actions" with data-dunning-action ("update" or "retry").'
|
|
185
|
+
reason: 'No actions = no resolution path.'
|
|
186
|
+
anti_patterns:
|
|
187
|
+
- wrong: '<alert-ui pattern="dunning" variant="info">'
|
|
188
|
+
why: 'Dunning is always a failure surface; info mis-signals severity.'
|
|
189
|
+
fix: '<alert-ui pattern="dunning" variant="danger">'
|
|
190
|
+
- wrong: '<alert-ui pattern="dunning" title="Payment failed $24.50">'
|
|
191
|
+
why: 'Amount baked into title defeats Intl formatting + telemetry.'
|
|
192
|
+
fix: '<alert-ui pattern="dunning" amount="24.50" currency="USD" due-at="2026-05-20">'
|
|
111
193
|
examples:
|
|
112
194
|
- name: alert-banner
|
|
113
195
|
description: Single alert component with icon and dismiss action.
|
|
@@ -164,6 +246,37 @@ examples:
|
|
|
164
246
|
"variant": "primary"
|
|
165
247
|
}
|
|
166
248
|
]
|
|
249
|
+
- name: dunning-payment-failed
|
|
250
|
+
description: Billing dunning banner — declined card with retry + update-card actions (SPEC-006).
|
|
251
|
+
a2ui: >-
|
|
252
|
+
[
|
|
253
|
+
{
|
|
254
|
+
"id": "root",
|
|
255
|
+
"component": "Alert",
|
|
256
|
+
"pattern": "dunning",
|
|
257
|
+
"variant": "danger",
|
|
258
|
+
"amount": 24.5,
|
|
259
|
+
"currency": "USD",
|
|
260
|
+
"dueAt": "2026-05-20T00:00:00Z",
|
|
261
|
+
"cardLast4": "4242",
|
|
262
|
+
"reason": "declined",
|
|
263
|
+
"children": ["btn-update", "btn-retry"]
|
|
264
|
+
},
|
|
265
|
+
{
|
|
266
|
+
"id": "btn-update",
|
|
267
|
+
"component": "Button",
|
|
268
|
+
"text": "Update payment method",
|
|
269
|
+
"variant": "primary",
|
|
270
|
+
"slot": "actions"
|
|
271
|
+
},
|
|
272
|
+
{
|
|
273
|
+
"id": "btn-retry",
|
|
274
|
+
"component": "Button",
|
|
275
|
+
"text": "Retry charge",
|
|
276
|
+
"variant": "outline",
|
|
277
|
+
"slot": "actions"
|
|
278
|
+
}
|
|
279
|
+
]
|
|
167
280
|
keywords:
|
|
168
281
|
- alert
|
|
169
282
|
- inbox
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
# Edit this file; run `npm run build:components` to regenerate a2ui.json.
|
|
2
2
|
#
|
|
3
3
|
# §176 (v0.5.5): authored to close the §175 baseline-orphan class. The
|
|
4
|
-
# component already existed as a sibling class in the parent's class.js
|
|
4
|
+
# component already existed as a sibling class in the parent's avatar.class.js
|
|
5
5
|
# + was registered alongside the parent (e.g. UIList + UIListItem both
|
|
6
|
-
# from list/class.js). The catalog just lacked its own entry. With the
|
|
6
|
+
# from list/list.class.js). The catalog just lacked its own entry. With the
|
|
7
7
|
# §172 sibling-yaml scanner, this file gets picked up next to the parent
|
|
8
8
|
# yaml.
|
|
9
9
|
|
|
@@ -4,19 +4,19 @@
|
|
|
4
4
|
|
|
5
5
|
@scope (avatar-ui) {
|
|
6
6
|
:where(:scope) {
|
|
7
|
-
--avatar-size: var(--a-size);
|
|
8
|
-
--avatar-bg: var(--a-bg-muted);
|
|
9
|
-
--avatar-fg: var(--a-fg-subtle);
|
|
10
|
-
--avatar-radius: var(--a-radius-full);
|
|
11
|
-
--avatar-font-size: var(--a-ui-sm);
|
|
12
|
-
--avatar-font-weight: var(--a-weight-medium);
|
|
7
|
+
--avatar-size-default: var(--a-size);
|
|
8
|
+
--avatar-bg-default: var(--a-bg-muted);
|
|
9
|
+
--avatar-fg-default: var(--a-fg-subtle);
|
|
10
|
+
--avatar-radius-default: var(--a-radius-full);
|
|
11
|
+
--avatar-font-size-default: var(--a-ui-sm);
|
|
12
|
+
--avatar-font-weight-default: var(--a-weight-medium);
|
|
13
13
|
|
|
14
14
|
/* Sizes */
|
|
15
|
-
--avatar-size-xs: 1.25rem;
|
|
16
|
-
--avatar-size-sm: 1.75rem;
|
|
17
|
-
--avatar-size-md: 2.5rem;
|
|
18
|
-
--avatar-size-lg: 3.5rem;
|
|
19
|
-
--avatar-size-xl: 4.5rem;
|
|
15
|
+
--avatar-size-xs-default: 1.25rem;
|
|
16
|
+
--avatar-size-sm-default: 1.75rem;
|
|
17
|
+
--avatar-size-md-default: 2.5rem;
|
|
18
|
+
--avatar-size-lg-default: 3.5rem;
|
|
19
|
+
--avatar-size-xl-default: 4.5rem;
|
|
20
20
|
}
|
|
21
21
|
|
|
22
22
|
:scope {
|
|
@@ -24,13 +24,13 @@
|
|
|
24
24
|
display: inline-flex;
|
|
25
25
|
align-items: center;
|
|
26
26
|
justify-content: center;
|
|
27
|
-
width: var(--avatar-size);
|
|
28
|
-
height: var(--avatar-size);
|
|
29
|
-
background: var(--avatar-bg);
|
|
30
|
-
color: var(--avatar-fg);
|
|
31
|
-
border-radius: var(--avatar-radius);
|
|
32
|
-
font-size: var(--avatar-font-size);
|
|
33
|
-
font-weight: var(--avatar-font-weight);
|
|
27
|
+
width: var(--avatar-size, var(--avatar-size-default));
|
|
28
|
+
height: var(--avatar-size, var(--avatar-size-default));
|
|
29
|
+
background: var(--avatar-bg, var(--avatar-bg-default));
|
|
30
|
+
color: var(--avatar-fg, var(--avatar-fg-default));
|
|
31
|
+
border-radius: var(--avatar-radius, var(--avatar-radius-default));
|
|
32
|
+
font-size: var(--avatar-font-size, var(--avatar-font-size-default));
|
|
33
|
+
font-weight: var(--avatar-font-weight, var(--avatar-font-weight-default));
|
|
34
34
|
overflow: hidden;
|
|
35
35
|
flex-shrink: 0;
|
|
36
36
|
}
|
|
@@ -51,23 +51,23 @@
|
|
|
51
51
|
|
|
52
52
|
/* ── Icon (non-person avatar) ── */
|
|
53
53
|
[slot="icon"] {
|
|
54
|
-
color: var(--avatar-fg);
|
|
55
|
-
--a-icon-size: calc(var(--avatar-size) * 0.55);
|
|
54
|
+
color: var(--avatar-fg, var(--avatar-fg-default));
|
|
55
|
+
--a-icon-size: calc(var(--avatar-size, var(--avatar-size-default)) * 0.55);
|
|
56
56
|
display: inline-flex;
|
|
57
57
|
align-items: center;
|
|
58
58
|
justify-content: center;
|
|
59
59
|
}
|
|
60
60
|
|
|
61
61
|
/* ── Sizes ── */
|
|
62
|
-
:scope[size="xs"] { --avatar-size: var(--avatar-size-xs); --avatar-font-size: var(--a-ui-sm); }
|
|
63
|
-
:scope[size="sm"] { --avatar-size: var(--avatar-size-sm); --avatar-font-size: var(--a-ui-sm); }
|
|
64
|
-
:scope[size="md"] { --avatar-size: var(--avatar-size-md); --avatar-font-size: var(--a-ui-sm); }
|
|
65
|
-
:scope[size="lg"] { --avatar-size: var(--avatar-size-lg); --avatar-font-size: var(--a-ui-md); }
|
|
66
|
-
:scope[size="xl"] { --avatar-size: var(--avatar-size-xl); --avatar-font-size: var(--a-ui-lg); }
|
|
62
|
+
:scope[size="xs"] { --avatar-size-default: var(--avatar-size-xs, var(--avatar-size-xs-default)); --avatar-font-size-default: var(--a-ui-sm); }
|
|
63
|
+
:scope[size="sm"] { --avatar-size-default: var(--avatar-size-sm, var(--avatar-size-sm-default)); --avatar-font-size-default: var(--a-ui-sm); }
|
|
64
|
+
:scope[size="md"] { --avatar-size-default: var(--avatar-size-md, var(--avatar-size-md-default)); --avatar-font-size-default: var(--a-ui-sm); }
|
|
65
|
+
:scope[size="lg"] { --avatar-size-default: var(--avatar-size-lg, var(--avatar-size-lg-default)); --avatar-font-size-default: var(--a-ui-md); }
|
|
66
|
+
:scope[size="xl"] { --avatar-size-default: var(--avatar-size-xl, var(--avatar-size-xl-default)); --avatar-font-size-default: var(--a-ui-lg); }
|
|
67
67
|
|
|
68
68
|
/* ── Shape ── */
|
|
69
|
-
:scope[shape="circle"] { --avatar-radius: var(--a-radius-full); }
|
|
70
|
-
:scope[shape="square"] { --avatar-radius: var(--a-radius-md); }
|
|
69
|
+
:scope[shape="circle"] { --avatar-radius-default: var(--a-radius-full); }
|
|
70
|
+
:scope[shape="square"] { --avatar-radius-default: var(--a-radius-md); }
|
|
71
71
|
}
|
|
72
72
|
|
|
73
73
|
/* ═══════════════════════════════════════════════════════════════
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
*/
|
|
11
11
|
|
|
12
12
|
import { defineIfFree } from '../../core/register.js';
|
|
13
|
-
import { UIAvatar, UIAvatarGroup } from './class.js';
|
|
13
|
+
import { UIAvatar, UIAvatarGroup } from './avatar.class.js';
|
|
14
14
|
|
|
15
15
|
defineIfFree('avatar-ui', UIAvatar);
|
|
16
16
|
defineIfFree('avatar-group-ui', UIAvatarGroup);
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
@scope (badge-ui) {
|
|
2
2
|
:where(:scope) {
|
|
3
3
|
/* ── Tokens ── */
|
|
4
|
-
--badge-bg: var(--a-bg-muted);
|
|
5
|
-
--badge-fg: var(--a-fg);
|
|
6
|
-
--badge-radius: var(--a-radius-md);
|
|
7
|
-
--badge-px: var(--a-space-2);
|
|
8
|
-
--badge-py: 2px;
|
|
9
|
-
--badge-gap: var(--a-space-1);
|
|
10
|
-
--badge-font-size: var(--a-ui-sm);
|
|
4
|
+
--badge-bg-default: var(--a-bg-muted);
|
|
5
|
+
--badge-fg-default: var(--a-fg);
|
|
6
|
+
--badge-radius-default: var(--a-radius-md);
|
|
7
|
+
--badge-px-default: var(--a-space-2);
|
|
8
|
+
--badge-py-default: 2px;
|
|
9
|
+
--badge-gap-default: var(--a-space-1);
|
|
10
|
+
--badge-font-size-default: var(--a-ui-sm);
|
|
11
11
|
text-align: start; /* §text-align-reset — blocks inheritance from centered ancestors */
|
|
12
12
|
}
|
|
13
13
|
|
|
@@ -17,16 +17,16 @@
|
|
|
17
17
|
display: inline-flex;
|
|
18
18
|
align-items: center;
|
|
19
19
|
justify-content: center;
|
|
20
|
-
gap: var(--badge-gap);
|
|
20
|
+
gap: var(--badge-gap, var(--badge-gap-default));
|
|
21
21
|
width: fit-content;
|
|
22
|
-
padding: var(--badge-py) var(--badge-px);
|
|
23
|
-
background: var(--badge-bg);
|
|
24
|
-
color: var(--badge-fg);
|
|
22
|
+
padding: var(--badge-py, var(--badge-py-default)) var(--badge-px, var(--badge-px-default));
|
|
23
|
+
background: var(--badge-bg, var(--badge-bg-default));
|
|
24
|
+
color: var(--badge-fg, var(--badge-fg-default));
|
|
25
25
|
font: inherit;
|
|
26
|
-
font-size: var(--badge-font-size);
|
|
26
|
+
font-size: var(--badge-font-size, var(--badge-font-size-default));
|
|
27
27
|
font-weight: 500;
|
|
28
28
|
line-height: 1;
|
|
29
|
-
border-radius: var(--badge-radius);
|
|
29
|
+
border-radius: var(--badge-radius, var(--badge-radius-default));
|
|
30
30
|
white-space: nowrap;
|
|
31
31
|
vertical-align: middle;
|
|
32
32
|
}
|
|
@@ -56,28 +56,28 @@
|
|
|
56
56
|
collapse contrast on muted: warning fails in dark, danger fails in light.
|
|
57
57
|
Accent keeps the saturated-text-on-tint look (intentional brand emphasis). */
|
|
58
58
|
:scope[variant="accent"] {
|
|
59
|
-
--badge-bg: var(--a-accent-muted);
|
|
60
|
-
--badge-fg: var(--a-accent-text);
|
|
59
|
+
--badge-bg-default: var(--a-accent-muted);
|
|
60
|
+
--badge-fg-default: var(--a-accent-text);
|
|
61
61
|
}
|
|
62
62
|
|
|
63
63
|
:scope[variant="info"] {
|
|
64
|
-
--badge-bg: var(--a-info-muted);
|
|
65
|
-
--badge-fg: var(--a-info-text);
|
|
64
|
+
--badge-bg-default: var(--a-info-muted);
|
|
65
|
+
--badge-fg-default: var(--a-info-text);
|
|
66
66
|
}
|
|
67
67
|
|
|
68
68
|
:scope[variant="success"] {
|
|
69
|
-
--badge-bg: var(--a-success-muted);
|
|
70
|
-
--badge-fg: var(--a-success-text);
|
|
69
|
+
--badge-bg-default: var(--a-success-muted);
|
|
70
|
+
--badge-fg-default: var(--a-success-text);
|
|
71
71
|
}
|
|
72
72
|
|
|
73
73
|
:scope[variant="warning"] {
|
|
74
|
-
--badge-bg: var(--a-warning-muted);
|
|
75
|
-
--badge-fg: var(--a-warning-text);
|
|
74
|
+
--badge-bg-default: var(--a-warning-muted);
|
|
75
|
+
--badge-fg-default: var(--a-warning-text);
|
|
76
76
|
}
|
|
77
77
|
|
|
78
78
|
:scope[variant="danger"] {
|
|
79
|
-
--badge-bg: var(--a-danger-muted);
|
|
80
|
-
--badge-fg: var(--a-danger-text);
|
|
79
|
+
--badge-bg-default: var(--a-danger-muted);
|
|
80
|
+
--badge-fg-default: var(--a-danger-text);
|
|
81
81
|
}
|
|
82
82
|
|
|
83
83
|
/* `primary` is the accent-filled variant — solid bg + on-accent text,
|
|
@@ -86,8 +86,8 @@
|
|
|
86
86
|
matrix so it tracks the same accent-strong source as button-ui's
|
|
87
87
|
primary variant. */
|
|
88
88
|
:scope[variant="primary"] {
|
|
89
|
-
--badge-bg: var(--a-primary-bg);
|
|
90
|
-
--badge-fg: var(--a-primary-fg);
|
|
89
|
+
--badge-bg-default: var(--a-primary-bg);
|
|
90
|
+
--badge-fg-default: var(--a-primary-fg);
|
|
91
91
|
}
|
|
92
92
|
|
|
93
93
|
/* `muted` and `neutral` are semantic aliases of the base — same tokens
|
|
@@ -96,8 +96,8 @@
|
|
|
96
96
|
"Not set" states) where the badge should read as quiet chrome. */
|
|
97
97
|
:scope[variant="muted"],
|
|
98
98
|
:scope[variant="neutral"] {
|
|
99
|
-
--badge-bg: var(--a-bg-muted);
|
|
100
|
-
--badge-fg: var(--a-fg);
|
|
99
|
+
--badge-bg-default: var(--a-bg-muted);
|
|
100
|
+
--badge-fg-default: var(--a-fg);
|
|
101
101
|
}
|
|
102
102
|
|
|
103
103
|
/* Size handled by universal [size] attribute system. */
|
|
@@ -1,29 +1,29 @@
|
|
|
1
1
|
@scope (block-ui) {
|
|
2
2
|
:where(:scope) {
|
|
3
|
-
--block-padding: var(--a-space-4);
|
|
4
|
-
--block-margin: 0;
|
|
3
|
+
--block-padding-default: var(--a-space-4);
|
|
4
|
+
--block-margin-default: 0;
|
|
5
5
|
}
|
|
6
6
|
|
|
7
7
|
:scope {
|
|
8
8
|
box-sizing: border-box;
|
|
9
9
|
display: block;
|
|
10
|
-
padding: var(--block-padding);
|
|
11
|
-
margin: var(--block-margin);
|
|
10
|
+
padding: var(--block-padding, var(--block-padding-default));
|
|
11
|
+
margin: var(--block-margin, var(--block-margin-default));
|
|
12
12
|
}
|
|
13
13
|
|
|
14
14
|
/* ── Padding variants ── */
|
|
15
|
-
:scope[padding="none"] { --block-padding: 0; }
|
|
16
|
-
:scope[padding="xs"] { --block-padding: var(--a-space-1); }
|
|
17
|
-
:scope[padding="sm"] { --block-padding: var(--a-space-2); }
|
|
18
|
-
:scope[padding="md"] { --block-padding: var(--a-space-4); }
|
|
19
|
-
:scope[padding="lg"] { --block-padding: var(--a-space-6); }
|
|
20
|
-
:scope[padding="xl"] { --block-padding: var(--a-space-10); }
|
|
15
|
+
:scope[padding="none"] { --block-padding-default: 0; }
|
|
16
|
+
:scope[padding="xs"] { --block-padding-default: var(--a-space-1); }
|
|
17
|
+
:scope[padding="sm"] { --block-padding-default: var(--a-space-2); }
|
|
18
|
+
:scope[padding="md"] { --block-padding-default: var(--a-space-4); }
|
|
19
|
+
:scope[padding="lg"] { --block-padding-default: var(--a-space-6); }
|
|
20
|
+
:scope[padding="xl"] { --block-padding-default: var(--a-space-10); }
|
|
21
21
|
|
|
22
22
|
/* ── Margin variants ── */
|
|
23
|
-
:scope[margin="none"] { --block-margin: 0; }
|
|
24
|
-
:scope[margin="xs"] { --block-margin: var(--a-space-1); }
|
|
25
|
-
:scope[margin="sm"] { --block-margin: var(--a-space-2); }
|
|
26
|
-
:scope[margin="md"] { --block-margin: var(--a-space-4); }
|
|
27
|
-
:scope[margin="lg"] { --block-margin: var(--a-space-6); }
|
|
28
|
-
:scope[margin="xl"] { --block-margin: var(--a-space-10); }
|
|
23
|
+
:scope[margin="none"] { --block-margin-default: 0; }
|
|
24
|
+
:scope[margin="xs"] { --block-margin-default: var(--a-space-1); }
|
|
25
|
+
:scope[margin="sm"] { --block-margin-default: var(--a-space-2); }
|
|
26
|
+
:scope[margin="md"] { --block-margin-default: var(--a-space-4); }
|
|
27
|
+
:scope[margin="lg"] { --block-margin-default: var(--a-space-6); }
|
|
28
|
+
:scope[margin="xl"] { --block-margin-default: var(--a-space-10); }
|
|
29
29
|
}
|