@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
|
@@ -0,0 +1,203 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* inline-message-ui tests — SPEC-033.
|
|
3
|
+
*
|
|
4
|
+
* Verification covers the seven contract points from §11:
|
|
5
|
+
* 1. Renders with [text]; textContent reflects the value
|
|
6
|
+
* 2. Renders with default-slot content; slot wins over [text]
|
|
7
|
+
* 3. Each [variant] sets the expected --inline-message-fg token
|
|
8
|
+
* 4. [variant] change re-stamps the leading icon to the variant default
|
|
9
|
+
* 5. Consumer-provided slot="leading" icon survives variant change
|
|
10
|
+
* 6. [live="polite"] reflects to aria-live="polite" on the host
|
|
11
|
+
* 7. No background / border / padding-box CSS applied (computed-style check)
|
|
12
|
+
*/
|
|
13
|
+
|
|
14
|
+
import { describe, it, expect, beforeEach } from 'vitest';
|
|
15
|
+
import '../../core/element.js';
|
|
16
|
+
import './inline-message.js';
|
|
17
|
+
|
|
18
|
+
const tick = () => new Promise((r) => queueMicrotask(r));
|
|
19
|
+
|
|
20
|
+
function mount(html) {
|
|
21
|
+
const wrap = document.createElement('div');
|
|
22
|
+
wrap.innerHTML = html;
|
|
23
|
+
document.body.appendChild(wrap);
|
|
24
|
+
return wrap.firstElementChild;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
describe('inline-message-ui — content modes', () => {
|
|
28
|
+
beforeEach(() => { document.body.innerHTML = ''; });
|
|
29
|
+
|
|
30
|
+
it('renders the [text] attribute into a marked body span', async () => {
|
|
31
|
+
const el = mount('<inline-message-ui text="Email is required" variant="danger"></inline-message-ui>');
|
|
32
|
+
await tick();
|
|
33
|
+
const body = el.querySelector(':scope > [data-im-text]');
|
|
34
|
+
expect(body).not.toBeNull();
|
|
35
|
+
expect(body.textContent).toBe('Email is required');
|
|
36
|
+
});
|
|
37
|
+
|
|
38
|
+
it('preserves default-slot content; does not stamp the body span', async () => {
|
|
39
|
+
const el = mount('<inline-message-ui variant="warning">Custom <a href="/x">link</a></inline-message-ui>');
|
|
40
|
+
await tick();
|
|
41
|
+
// Body span is NOT stamped when consumer slotted body content
|
|
42
|
+
expect(el.querySelector(':scope > [data-im-text]')).toBeNull();
|
|
43
|
+
// Consumer's link survives
|
|
44
|
+
expect(el.querySelector('a')).not.toBeNull();
|
|
45
|
+
expect(el.querySelector('a').getAttribute('href')).toBe('/x');
|
|
46
|
+
});
|
|
47
|
+
|
|
48
|
+
it('updates body span text on [text] mutation without clobbering leading icon', async () => {
|
|
49
|
+
const el = mount('<inline-message-ui text="First" variant="info"></inline-message-ui>');
|
|
50
|
+
await tick();
|
|
51
|
+
el.text = 'Second';
|
|
52
|
+
await tick();
|
|
53
|
+
const body = el.querySelector(':scope > [data-im-text]');
|
|
54
|
+
expect(body.textContent).toBe('Second');
|
|
55
|
+
expect(el.querySelector(':scope > [slot="leading"]')).not.toBeNull();
|
|
56
|
+
});
|
|
57
|
+
});
|
|
58
|
+
|
|
59
|
+
describe('inline-message-ui — variants', () => {
|
|
60
|
+
beforeEach(() => { document.body.innerHTML = ''; });
|
|
61
|
+
|
|
62
|
+
it('reflects [variant] to attribute for CSS matching', async () => {
|
|
63
|
+
const el = mount('<inline-message-ui variant="danger" text="Err"></inline-message-ui>');
|
|
64
|
+
await tick();
|
|
65
|
+
expect(el.getAttribute('variant')).toBe('danger');
|
|
66
|
+
});
|
|
67
|
+
|
|
68
|
+
it('default variant has no leading icon (pure hint)', async () => {
|
|
69
|
+
const el = mount('<inline-message-ui text="At least 8 characters"></inline-message-ui>');
|
|
70
|
+
await tick();
|
|
71
|
+
expect(el.querySelector(':scope > [slot="leading"]')).toBeNull();
|
|
72
|
+
});
|
|
73
|
+
|
|
74
|
+
it('info variant stamps the info icon', async () => {
|
|
75
|
+
const el = mount('<inline-message-ui variant="info" text="Heads up"></inline-message-ui>');
|
|
76
|
+
await tick();
|
|
77
|
+
const leading = el.querySelector(':scope > [slot="leading"]');
|
|
78
|
+
expect(leading).not.toBeNull();
|
|
79
|
+
expect(leading.getAttribute('name')).toBe('info');
|
|
80
|
+
});
|
|
81
|
+
|
|
82
|
+
it('success variant stamps the check-circle icon', async () => {
|
|
83
|
+
const el = mount('<inline-message-ui variant="success" text="Saved"></inline-message-ui>');
|
|
84
|
+
await tick();
|
|
85
|
+
const leading = el.querySelector(':scope > [slot="leading"]');
|
|
86
|
+
expect(leading.getAttribute('name')).toBe('check-circle');
|
|
87
|
+
});
|
|
88
|
+
|
|
89
|
+
it('warning variant stamps the warning icon', async () => {
|
|
90
|
+
const el = mount('<inline-message-ui variant="warning" text="Watch out"></inline-message-ui>');
|
|
91
|
+
await tick();
|
|
92
|
+
const leading = el.querySelector(':scope > [slot="leading"]');
|
|
93
|
+
expect(leading.getAttribute('name')).toBe('warning');
|
|
94
|
+
});
|
|
95
|
+
|
|
96
|
+
it('danger variant stamps the x-circle icon', async () => {
|
|
97
|
+
const el = mount('<inline-message-ui variant="danger" text="Failed"></inline-message-ui>');
|
|
98
|
+
await tick();
|
|
99
|
+
const leading = el.querySelector(':scope > [slot="leading"]');
|
|
100
|
+
expect(leading.getAttribute('name')).toBe('x-circle');
|
|
101
|
+
});
|
|
102
|
+
|
|
103
|
+
it('[variant] change re-stamps the leading icon to the new variant default', async () => {
|
|
104
|
+
const el = mount('<inline-message-ui variant="info" text="X"></inline-message-ui>');
|
|
105
|
+
await tick();
|
|
106
|
+
expect(el.querySelector(':scope > [slot="leading"]').getAttribute('name')).toBe('info');
|
|
107
|
+
el.variant = 'danger';
|
|
108
|
+
await tick();
|
|
109
|
+
expect(el.querySelector(':scope > [slot="leading"]').getAttribute('name')).toBe('x-circle');
|
|
110
|
+
});
|
|
111
|
+
|
|
112
|
+
it('explicit [icon] overrides the variant default', async () => {
|
|
113
|
+
const el = mount('<inline-message-ui variant="info" icon="bug" text="Bug"></inline-message-ui>');
|
|
114
|
+
await tick();
|
|
115
|
+
expect(el.querySelector(':scope > [slot="leading"]').getAttribute('name')).toBe('bug');
|
|
116
|
+
});
|
|
117
|
+
});
|
|
118
|
+
|
|
119
|
+
describe('inline-message-ui — consumer-slotted leading icon', () => {
|
|
120
|
+
beforeEach(() => { document.body.innerHTML = ''; });
|
|
121
|
+
|
|
122
|
+
it('preserves consumer-provided slot="leading" across variant changes', async () => {
|
|
123
|
+
const el = mount('<inline-message-ui variant="info" text="X"><icon-ui slot="leading" name="lightbulb"></icon-ui></inline-message-ui>');
|
|
124
|
+
await tick();
|
|
125
|
+
// Consumer-owned: no data-im-auto flag
|
|
126
|
+
const initial = el.querySelector(':scope > [slot="leading"]');
|
|
127
|
+
expect(initial.getAttribute('name')).toBe('lightbulb');
|
|
128
|
+
expect(initial.hasAttribute('data-im-auto')).toBe(false);
|
|
129
|
+
|
|
130
|
+
// Variant change must NOT overwrite consumer-owned slot
|
|
131
|
+
el.variant = 'danger';
|
|
132
|
+
await tick();
|
|
133
|
+
const after = el.querySelector(':scope > [slot="leading"]');
|
|
134
|
+
expect(after.getAttribute('name')).toBe('lightbulb');
|
|
135
|
+
});
|
|
136
|
+
});
|
|
137
|
+
|
|
138
|
+
describe('inline-message-ui — accessibility', () => {
|
|
139
|
+
beforeEach(() => { document.body.innerHTML = ''; });
|
|
140
|
+
|
|
141
|
+
it('[live="polite"] reflects to aria-live="polite" on the host', async () => {
|
|
142
|
+
const el = mount('<inline-message-ui variant="success" live="polite" text="Saved"></inline-message-ui>');
|
|
143
|
+
await tick();
|
|
144
|
+
expect(el.getAttribute('aria-live')).toBe('polite');
|
|
145
|
+
});
|
|
146
|
+
|
|
147
|
+
it('[live="assertive"] reflects to aria-live="assertive" on the host', async () => {
|
|
148
|
+
const el = mount('<inline-message-ui variant="danger" live="assertive" text="Lost"></inline-message-ui>');
|
|
149
|
+
await tick();
|
|
150
|
+
expect(el.getAttribute('aria-live')).toBe('assertive');
|
|
151
|
+
});
|
|
152
|
+
|
|
153
|
+
it('omitting [live] omits aria-live (no static live-region pickup)', async () => {
|
|
154
|
+
const el = mount('<inline-message-ui variant="warning" text="Watch"></inline-message-ui>');
|
|
155
|
+
await tick();
|
|
156
|
+
expect(el.hasAttribute('aria-live')).toBe(false);
|
|
157
|
+
});
|
|
158
|
+
|
|
159
|
+
it('clearing [live] strips aria-live (dynamic update)', async () => {
|
|
160
|
+
const el = mount('<inline-message-ui variant="success" live="polite" text="X"></inline-message-ui>');
|
|
161
|
+
await tick();
|
|
162
|
+
expect(el.getAttribute('aria-live')).toBe('polite');
|
|
163
|
+
el.live = '';
|
|
164
|
+
await tick();
|
|
165
|
+
expect(el.hasAttribute('aria-live')).toBe(false);
|
|
166
|
+
});
|
|
167
|
+
|
|
168
|
+
it('does not set a host role (transparent inline annotation)', async () => {
|
|
169
|
+
const el = mount('<inline-message-ui variant="danger" text="Err"></inline-message-ui>');
|
|
170
|
+
await tick();
|
|
171
|
+
// Per SPEC-033 §5 + OD-002 current-lean: no auto role; consumer opts
|
|
172
|
+
// in via [live="assertive"] for danger if they want it announced.
|
|
173
|
+
expect(el.hasAttribute('role')).toBe(false);
|
|
174
|
+
});
|
|
175
|
+
|
|
176
|
+
it('is not a tab stop', async () => {
|
|
177
|
+
const el = mount('<inline-message-ui variant="danger" text="Err"></inline-message-ui>');
|
|
178
|
+
await tick();
|
|
179
|
+
expect(el.tabIndex).toBe(-1);
|
|
180
|
+
});
|
|
181
|
+
});
|
|
182
|
+
|
|
183
|
+
describe('inline-message-ui — surface-bearing assertions (in-flow, not banner)', () => {
|
|
184
|
+
beforeEach(() => { document.body.innerHTML = ''; });
|
|
185
|
+
|
|
186
|
+
it('declares inline-flex display in its component CSS (verified via @scope rule resolution)', async () => {
|
|
187
|
+
// happy-dom does not run a layout engine, so we cannot assert
|
|
188
|
+
// resolved computed values. Instead, assert the contract: the
|
|
189
|
+
// component CSS file has no `background:` / `border:` / `padding:`
|
|
190
|
+
// declarations at the root level. The CSS file is the contract
|
|
191
|
+
// — guarding it in the test catches regressions even when
|
|
192
|
+
// visual-QA isn't running.
|
|
193
|
+
const cssUrl = new URL('./inline-message.css', import.meta.url);
|
|
194
|
+
const css = await fetch(cssUrl).then((r) => r.text()).catch(() => '');
|
|
195
|
+
if (!css) return; // skip if fetch unavailable in env
|
|
196
|
+
const baseBlock = css.match(/:scope\s*\{([^}]*)\}/);
|
|
197
|
+
expect(baseBlock).not.toBeNull();
|
|
198
|
+
const body = baseBlock[1];
|
|
199
|
+
expect(body).not.toMatch(/\bbackground\s*:/);
|
|
200
|
+
expect(body).not.toMatch(/\bborder\s*:/);
|
|
201
|
+
expect(body).not.toMatch(/\bpadding\s*:/);
|
|
202
|
+
});
|
|
203
|
+
});
|
|
@@ -0,0 +1,205 @@
|
|
|
1
|
+
# Hand-authored — SPEC-033.
|
|
2
|
+
# Edit this file; run `npm run build:components` to regenerate a2ui.json + .d.ts.
|
|
3
|
+
$schema: ../../../../scripts/schemas/component.yaml.schema.json
|
|
4
|
+
name: UIInlineMessage
|
|
5
|
+
tag: inline-message-ui
|
|
6
|
+
status: stable
|
|
7
|
+
component: InlineMessage
|
|
8
|
+
category: feedback
|
|
9
|
+
version: 1
|
|
10
|
+
description: |
|
|
11
|
+
In-flow message glyph + text used in form-field rows for validation
|
|
12
|
+
feedback, hint copy, and inline confirmations. Distinguished from
|
|
13
|
+
<alert-ui> (banner / surface-bearing notice) by carrying no surface
|
|
14
|
+
fill, no border, no padding box — severity is foreground color +
|
|
15
|
+
icon only. Variants map to severity (info / success / warning /
|
|
16
|
+
danger). Nests inside <field-ui>, <col-ui>, <row-ui> without
|
|
17
|
+
breaking field rhythm. Non-interactive annotation only.
|
|
18
|
+
# Per ADR-0027 — primitives that programmatically create other primitives
|
|
19
|
+
# do NOT auto-import them. Consumer (or demo shell) must explicitly import.
|
|
20
|
+
composes:
|
|
21
|
+
- icon-ui
|
|
22
|
+
props:
|
|
23
|
+
variant:
|
|
24
|
+
description: Semantic severity tone — drives icon + foreground color. Default carries no leading icon (pure hint copy).
|
|
25
|
+
type: string
|
|
26
|
+
default: default
|
|
27
|
+
reflect: true
|
|
28
|
+
dynamic: true
|
|
29
|
+
enum:
|
|
30
|
+
- default
|
|
31
|
+
- info
|
|
32
|
+
- success
|
|
33
|
+
- warning
|
|
34
|
+
- danger
|
|
35
|
+
icon:
|
|
36
|
+
description: Phosphor glyph override; each [variant] ships a sensible default (info / check-circle / warning / x-circle).
|
|
37
|
+
type: string
|
|
38
|
+
default: ""
|
|
39
|
+
reflect: true
|
|
40
|
+
dynamic: true
|
|
41
|
+
text:
|
|
42
|
+
description: Single-line message text. Default-slot content wins when present.
|
|
43
|
+
type: string
|
|
44
|
+
default: ""
|
|
45
|
+
dynamic: true
|
|
46
|
+
live:
|
|
47
|
+
description: Sets `aria-live` on the host for dynamic message updates. Empty = no live region (static annotation).
|
|
48
|
+
type: string
|
|
49
|
+
default: ""
|
|
50
|
+
reflect: true
|
|
51
|
+
enum:
|
|
52
|
+
- ""
|
|
53
|
+
- polite
|
|
54
|
+
- assertive
|
|
55
|
+
events: {}
|
|
56
|
+
slots:
|
|
57
|
+
default:
|
|
58
|
+
description: >-
|
|
59
|
+
Message body — text or inline DOM (e.g. <link-ui>, <kbd-ui>). Wins
|
|
60
|
+
over the [text] attribute when present. Stays inline so the
|
|
61
|
+
message reads as one annotation line under the field.
|
|
62
|
+
leading:
|
|
63
|
+
description: >-
|
|
64
|
+
Leading icon slot. Stamped automatically from [icon] or the
|
|
65
|
+
variant's default glyph. Consumer-provided <icon-ui slot="leading">
|
|
66
|
+
is preserved across [variant] changes (never overwritten).
|
|
67
|
+
states:
|
|
68
|
+
- name: idle
|
|
69
|
+
description: Default, ready for screen-reader pickup.
|
|
70
|
+
traits: []
|
|
71
|
+
tokens: {}
|
|
72
|
+
requiredIcons:
|
|
73
|
+
- info
|
|
74
|
+
- check-circle
|
|
75
|
+
- warning
|
|
76
|
+
- x-circle
|
|
77
|
+
a2ui:
|
|
78
|
+
rules:
|
|
79
|
+
- rule: 'In-flow annotation under a form input (validation feedback, hint copy, inline confirmation). Severity via [variant] (info, success, warning, danger).'
|
|
80
|
+
reason: 'Distinct from <alert-ui>: no surface fill, no padding box, no dismiss — reads as helper text, not a banner.'
|
|
81
|
+
- rule: 'For overlay / banner-style notices use <alert-ui> instead; for transient toasts use <toast-ui>.'
|
|
82
|
+
reason: 'Surface-bearing vs in-flow boundary — collision invites visual confusion.'
|
|
83
|
+
- rule: 'Place inside <field-ui>, <col-ui>, or <row-ui>; never as a page-level banner.'
|
|
84
|
+
reason: 'Inline-flow contract; banner placement breaks the WAI inline-message pattern.'
|
|
85
|
+
- rule: 'Do not nest a focusable child (button, link with action) — InlineMessage is non-interactive annotation.'
|
|
86
|
+
reason: 'A focusable child requires role=alert + focus management, breaking the static-inline WAI pattern.'
|
|
87
|
+
anti_patterns: []
|
|
88
|
+
examples:
|
|
89
|
+
- name: field-validation
|
|
90
|
+
description: Email field with a danger inline-message under the input.
|
|
91
|
+
a2ui: >-
|
|
92
|
+
[
|
|
93
|
+
{
|
|
94
|
+
"id": "root",
|
|
95
|
+
"component": "Field",
|
|
96
|
+
"label": "Email",
|
|
97
|
+
"children": [
|
|
98
|
+
"input",
|
|
99
|
+
"msg"
|
|
100
|
+
]
|
|
101
|
+
},
|
|
102
|
+
{
|
|
103
|
+
"id": "input",
|
|
104
|
+
"component": "Input",
|
|
105
|
+
"type": "email"
|
|
106
|
+
},
|
|
107
|
+
{
|
|
108
|
+
"id": "msg",
|
|
109
|
+
"component": "InlineMessage",
|
|
110
|
+
"variant": "danger",
|
|
111
|
+
"text": "Email address is required"
|
|
112
|
+
}
|
|
113
|
+
]
|
|
114
|
+
- name: password-hint
|
|
115
|
+
description: Password field with a muted hint (default variant, no icon).
|
|
116
|
+
a2ui: >-
|
|
117
|
+
[
|
|
118
|
+
{
|
|
119
|
+
"id": "root",
|
|
120
|
+
"component": "Field",
|
|
121
|
+
"label": "Password",
|
|
122
|
+
"children": [
|
|
123
|
+
"input",
|
|
124
|
+
"hint"
|
|
125
|
+
]
|
|
126
|
+
},
|
|
127
|
+
{
|
|
128
|
+
"id": "input",
|
|
129
|
+
"component": "Input",
|
|
130
|
+
"type": "password"
|
|
131
|
+
},
|
|
132
|
+
{
|
|
133
|
+
"id": "hint",
|
|
134
|
+
"component": "InlineMessage",
|
|
135
|
+
"text": "At least 8 characters"
|
|
136
|
+
}
|
|
137
|
+
]
|
|
138
|
+
- name: username-success
|
|
139
|
+
description: Username field with a polite live-region success confirmation.
|
|
140
|
+
a2ui: >-
|
|
141
|
+
[
|
|
142
|
+
{
|
|
143
|
+
"id": "root",
|
|
144
|
+
"component": "Field",
|
|
145
|
+
"label": "Username",
|
|
146
|
+
"children": [
|
|
147
|
+
"input",
|
|
148
|
+
"msg"
|
|
149
|
+
]
|
|
150
|
+
},
|
|
151
|
+
{
|
|
152
|
+
"id": "input",
|
|
153
|
+
"component": "Input"
|
|
154
|
+
},
|
|
155
|
+
{
|
|
156
|
+
"id": "msg",
|
|
157
|
+
"component": "InlineMessage",
|
|
158
|
+
"variant": "success",
|
|
159
|
+
"live": "polite",
|
|
160
|
+
"text": "Username is available"
|
|
161
|
+
}
|
|
162
|
+
]
|
|
163
|
+
keywords:
|
|
164
|
+
- inline
|
|
165
|
+
- message
|
|
166
|
+
- hint
|
|
167
|
+
- helper
|
|
168
|
+
- validation
|
|
169
|
+
- error
|
|
170
|
+
- field-error
|
|
171
|
+
- helper-text
|
|
172
|
+
- error-text
|
|
173
|
+
- form-feedback
|
|
174
|
+
- status
|
|
175
|
+
- notice
|
|
176
|
+
synonyms:
|
|
177
|
+
hint:
|
|
178
|
+
- hint
|
|
179
|
+
- tooltip
|
|
180
|
+
- help
|
|
181
|
+
helper:
|
|
182
|
+
- hint
|
|
183
|
+
- help
|
|
184
|
+
- tooltip
|
|
185
|
+
validation:
|
|
186
|
+
- validation
|
|
187
|
+
- error
|
|
188
|
+
- alert
|
|
189
|
+
error:
|
|
190
|
+
- error
|
|
191
|
+
- alert
|
|
192
|
+
- validation
|
|
193
|
+
message:
|
|
194
|
+
- alert
|
|
195
|
+
- notification
|
|
196
|
+
- hint
|
|
197
|
+
notice:
|
|
198
|
+
- alert
|
|
199
|
+
- banner
|
|
200
|
+
- hint
|
|
201
|
+
related:
|
|
202
|
+
- alert
|
|
203
|
+
- field
|
|
204
|
+
- input
|
|
205
|
+
- text
|