@adia-ai/web-components 0.6.34 → 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 +42 -0
- package/color/index.js +1 -1
- package/components/accordion/accordion-item.yaml +2 -2
- package/components/accordion/accordion.js +1 -1
- package/components/action-list/action-item.yaml +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.js +1 -1
- package/components/agent-feedback-bar/agent-feedback-bar.js +1 -1
- package/components/agent-questions/agent-questions.js +1 -1
- package/components/agent-reasoning/agent-reasoning.js +1 -1
- package/components/agent-suggestions/agent-suggestions.js +1 -1
- package/components/alert/alert.a2ui.json +64 -1
- package/components/alert/{class.js → alert.class.js} +189 -2
- package/components/alert/alert.css +78 -0
- 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.js +1 -1
- package/components/badge/badge.js +1 -1
- package/components/block/block.js +1 -1
- package/components/breadcrumb/breadcrumb.js +1 -1
- package/components/button/button.js +1 -1
- package/components/calendar-grid/calendar-grid.a2ui.json +10 -0
- package/components/calendar-grid/{class.js → calendar-grid.class.js} +30 -4
- package/components/calendar-grid/calendar-grid.css +20 -0
- package/components/calendar-grid/calendar-grid.d.ts +4 -0
- package/components/calendar-grid/calendar-grid.js +1 -1
- package/components/calendar-grid/calendar-grid.yaml +20 -0
- package/components/calendar-picker/calendar-picker.js +1 -1
- package/components/card/card.js +1 -1
- package/components/chart/chart.js +1 -1
- 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.js +1 -1
- package/components/code/code.js +1 -1
- package/components/col/col.js +1 -1
- package/components/color-input/color-input.js +1 -1
- package/components/color-picker/color-picker.js +1 -1
- package/components/combobox/combobox.js +1 -1
- package/components/command/command.js +1 -1
- package/components/date-range-picker/{class.js → date-range-picker.class.js} +18 -2
- package/components/date-range-picker/date-range-picker.css +51 -5
- package/components/date-range-picker/date-range-picker.js +1 -1
- package/components/datetime-picker/{class.js → datetime-picker.class.js} +1 -1
- package/components/datetime-picker/datetime-picker.js +1 -1
- package/components/demo-toggle/demo-toggle.js +1 -1
- package/components/description-list/description-list.js +1 -1
- package/components/divider/divider.js +1 -1
- package/components/drawer/drawer.js +1 -1
- package/components/embed/embed.js +1 -1
- package/components/empty-state/empty-state.js +1 -1
- package/components/feed/feed.js +1 -1
- package/components/field/field.js +1 -1
- package/components/field/field.test.js +1 -1
- package/components/fields/fields.js +1 -1
- package/components/grid/grid.js +1 -1
- package/components/heatmap/heatmap.js +1 -1
- package/components/icon/icon.js +1 -1
- package/components/image/image.js +1 -1
- package/components/index.js +3 -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 +1 -1
- package/components/input/input.js +1 -1
- package/components/input/input.yaml +5 -4
- package/components/inspector/inspector.js +1 -1
- package/components/integration-card/integration-card.js +1 -1
- package/components/kbd/kbd.js +1 -1
- package/components/link/link.js +1 -1
- package/components/list/list-item.yaml +2 -2
- package/components/list/list.js +1 -1
- package/components/list-window/list-window.js +1 -1
- 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.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 +11 -1
- package/components/modal/modal.js +1 -1
- package/components/nav/nav.js +1 -1
- package/components/nav-group/nav-group.js +1 -1
- package/components/nav-item/nav-item.js +1 -1
- package/components/noodles/noodles.js +1 -1
- package/components/option-card/option-card.js +1 -1
- package/components/otp-input/otp-input.js +1 -1
- package/components/page/page.js +1 -1
- package/components/pagination/pagination.js +1 -1
- package/components/pane/pane.js +1 -1
- package/components/pipeline-status/pipeline-status.js +1 -1
- package/components/popover/popover.a2ui.json +8 -1
- package/components/popover/popover.js +1 -1
- package/components/popover/popover.yaml +14 -1
- package/components/progress/progress.js +1 -1
- package/components/progress-row/progress-row.js +1 -1
- package/components/radio/radio.js +1 -1
- package/components/range/range.js +1 -1
- package/components/rating/rating.js +1 -1
- package/components/richtext/richtext.js +1 -1
- package/components/row/row.js +1 -1
- package/components/search/search.js +1 -1
- package/components/segment/segment.js +1 -1
- 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 +158 -0
- 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.js +1 -1
- package/components/slider/slider.js +1 -1
- package/components/spinner/spinner.a2ui.json +3 -2
- package/components/spinner/{class.js → spinner.class.js} +33 -3
- package/components/spinner/spinner.css +91 -35
- package/components/spinner/spinner.d.ts +2 -2
- package/components/spinner/spinner.js +1 -1
- package/components/spinner/spinner.test.js +49 -11
- package/components/spinner/spinner.yaml +9 -1
- package/components/stack/stack.js +1 -1
- package/components/step-progress/step-progress.js +1 -1
- package/components/stepper/stepper-item.yaml +1 -1
- package/components/stepper/stepper.js +1 -1
- package/components/stream/stream.js +1 -1
- package/components/swatch/swatch.js +1 -1
- package/components/swiper/swiper.js +1 -1
- package/components/switch/switch.js +1 -1
- package/components/table/table.css +1 -1
- 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.js +1 -1
- package/components/tabs/tab.yaml +2 -2
- package/components/tabs/tabs.js +1 -1
- 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.js +1 -1
- package/components/textarea/textarea.a2ui.json +1 -1
- package/components/textarea/textarea.js +1 -1
- package/components/textarea/textarea.yaml +11 -8
- package/components/time-picker/time-picker.js +1 -1
- package/components/timeline/timeline-item.yaml +2 -2
- package/components/timeline/{class.js → timeline.class.js} +1 -1
- package/components/timeline/timeline.js +1 -1
- package/components/toast/toast.js +1 -1
- package/components/toggle-group/toggle-group.js +1 -1
- package/components/toggle-group/toggle-option.yaml +1 -1
- package/components/toggle-scheme/toggle-scheme.js +1 -1
- package/components/toolbar/toolbar-group.yaml +1 -1
- package/components/toolbar/toolbar.js +1 -1
- package/components/tooltip/tooltip.js +1 -1
- package/components/tree/tree-item.yaml +1 -1
- package/components/tree/tree.js +1 -1
- package/components/upload/upload.js +1 -1
- package/dist/web-components.min.css +1 -1
- package/dist/web-components.min.js +111 -90
- package/package.json +3 -3
- package/styles/components.css +3 -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/combobox/{class.js → combobox.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/integration-card/{class.js → integration-card.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/list-window/{class.js → list-window.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/time-picker/{class.js → time-picker.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,201 @@
|
|
|
1
|
+
@scope (tags-input-ui) {
|
|
2
|
+
:where(:scope) {
|
|
3
|
+
/* ── Layout ── */
|
|
4
|
+
--tags-input-min-h-default: var(--a-size);
|
|
5
|
+
--tags-input-px-default: var(--a-ui-px);
|
|
6
|
+
--tags-input-py-default: calc(var(--a-space-1) / 2);
|
|
7
|
+
--tags-input-gap-default: var(--a-space-1);
|
|
8
|
+
--tags-input-radius-default: var(--a-radius);
|
|
9
|
+
|
|
10
|
+
/* ── Typography ── */
|
|
11
|
+
--tags-input-font-size-default: var(--a-ui-size);
|
|
12
|
+
|
|
13
|
+
/* ── Colors — host ── */
|
|
14
|
+
--tags-input-bg-default: var(--a-ui-bg);
|
|
15
|
+
--tags-input-bg-hover-default: var(--a-ui-bg-hover);
|
|
16
|
+
--tags-input-fg-default: var(--a-ui-text);
|
|
17
|
+
--tags-input-placeholder-fg-default: var(--a-ui-text-placeholder);
|
|
18
|
+
--tags-input-border-default: var(--a-ui-border);
|
|
19
|
+
--tags-input-border-hover-default: var(--a-ui-border-hover);
|
|
20
|
+
--tags-input-focus-ring-default: var(--a-focus-ring);
|
|
21
|
+
--tags-input-focus-ring-invalid-default: var(--a-focus-ring-invalid);
|
|
22
|
+
|
|
23
|
+
/* ── Transition ── */
|
|
24
|
+
--tags-input-duration-default: var(--a-duration-fast);
|
|
25
|
+
--tags-input-easing-default: var(--a-easing);
|
|
26
|
+
|
|
27
|
+
/* ── Chip overrides — cascaded into nested <tag-ui> ── */
|
|
28
|
+
--tags-input-chip-bg-invalid-default: var(--a-danger-muted);
|
|
29
|
+
|
|
30
|
+
/* ── Suggestions popover ── */
|
|
31
|
+
--tags-input-suggestions-bg-default: var(--a-canvas-bright);
|
|
32
|
+
--tags-input-suggestions-border-default: var(--a-ui-border);
|
|
33
|
+
--tags-input-suggestions-radius-default: var(--a-radius);
|
|
34
|
+
--tags-input-suggestions-shadow-default: var(--a-shadow-lg);
|
|
35
|
+
--tags-input-suggestion-bg-focus-default: var(--a-ui-bg-hover);
|
|
36
|
+
--tags-input-suggestion-fg-focus-default: var(--a-ui-text-hover);
|
|
37
|
+
|
|
38
|
+
text-align: start; /* §text-align-reset — block ancestor centering */
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
:scope {
|
|
42
|
+
/* ── Base ── */
|
|
43
|
+
box-sizing: border-box;
|
|
44
|
+
display: flex;
|
|
45
|
+
align-items: center;
|
|
46
|
+
flex-wrap: wrap;
|
|
47
|
+
gap: var(--tags-input-gap, var(--tags-input-gap-default));
|
|
48
|
+
min-height: var(--tags-input-min-h, var(--tags-input-min-h-default));
|
|
49
|
+
padding: var(--tags-input-py, var(--tags-input-py-default))
|
|
50
|
+
var(--tags-input-px, var(--tags-input-px-default));
|
|
51
|
+
border: 1px solid var(--tags-input-border, var(--tags-input-border-default));
|
|
52
|
+
border-radius: var(--tags-input-radius, var(--tags-input-radius-default));
|
|
53
|
+
background: var(--tags-input-bg, var(--tags-input-bg-default));
|
|
54
|
+
color: var(--tags-input-fg, var(--tags-input-fg-default));
|
|
55
|
+
font-size: var(--tags-input-font-size, var(--tags-input-font-size-default));
|
|
56
|
+
cursor: text;
|
|
57
|
+
transition:
|
|
58
|
+
background var(--tags-input-duration, var(--tags-input-duration-default)) var(--tags-input-easing, var(--tags-input-easing-default)),
|
|
59
|
+
border-color var(--tags-input-duration, var(--tags-input-duration-default)) var(--tags-input-easing, var(--tags-input-easing-default)),
|
|
60
|
+
box-shadow var(--tags-input-duration, var(--tags-input-duration-default)) var(--tags-input-easing, var(--tags-input-easing-default));
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
:scope:not([disabled]):hover {
|
|
64
|
+
background: var(--tags-input-bg-hover, var(--tags-input-bg-hover-default));
|
|
65
|
+
border-color: var(--tags-input-border-hover, var(--tags-input-border-hover-default));
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
:scope:focus-within {
|
|
69
|
+
box-shadow: var(--tags-input-focus-ring, var(--tags-input-focus-ring-default));
|
|
70
|
+
border-color: transparent;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
:scope[aria-invalid="true"]:focus-within,
|
|
74
|
+
:scope[error]:focus-within {
|
|
75
|
+
box-shadow: var(--tags-input-focus-ring-invalid, var(--tags-input-focus-ring-invalid-default));
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
:scope[disabled] {
|
|
79
|
+
opacity: 0.5;
|
|
80
|
+
pointer-events: none;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
/* ── Chip list ── */
|
|
84
|
+
[data-chip-list] {
|
|
85
|
+
display: contents; /* chips become direct flex children of the host */
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
/* Chip styling — cascade host-scoped overrides into <tag-ui> internals. */
|
|
89
|
+
:scope tag-ui {
|
|
90
|
+
/* keep the chip subtle by default; consumer tokens can override. */
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
:scope tag-ui[data-invalid] {
|
|
94
|
+
--tag-bg-default: var(--tags-input-chip-bg-invalid, var(--tags-input-chip-bg-invalid-default));
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
/* ── Inline input ── */
|
|
98
|
+
[data-inline-input] {
|
|
99
|
+
flex: 1 1 8em;
|
|
100
|
+
min-width: 8em;
|
|
101
|
+
align-self: stretch;
|
|
102
|
+
display: inline-flex;
|
|
103
|
+
align-items: center;
|
|
104
|
+
outline: none;
|
|
105
|
+
background: transparent;
|
|
106
|
+
color: var(--tags-input-fg, var(--tags-input-fg-default));
|
|
107
|
+
font: inherit;
|
|
108
|
+
font-size: var(--tags-input-font-size, var(--tags-input-font-size-default));
|
|
109
|
+
line-height: 1.4;
|
|
110
|
+
white-space: pre-wrap;
|
|
111
|
+
overflow-wrap: anywhere;
|
|
112
|
+
cursor: text;
|
|
113
|
+
}
|
|
114
|
+
/* Empty-state placeholder via ::before pseudo so the contenteditable
|
|
115
|
+
surface participates in inline layout (the same pattern the input-ui
|
|
116
|
+
+ combobox-ui editable surfaces use). */
|
|
117
|
+
[data-inline-input][data-empty]::before {
|
|
118
|
+
content: attr(data-placeholder);
|
|
119
|
+
color: var(--tags-input-placeholder-fg, var(--tags-input-placeholder-fg-default));
|
|
120
|
+
pointer-events: none;
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
/* ── Spinner (async validator) ── */
|
|
124
|
+
[data-spinner] {
|
|
125
|
+
display: inline-flex;
|
|
126
|
+
align-items: center;
|
|
127
|
+
justify-content: center;
|
|
128
|
+
--a-icon-size: 1em;
|
|
129
|
+
animation: tags-input-spin 800ms linear infinite;
|
|
130
|
+
}
|
|
131
|
+
[data-spinner][hidden] { display: none; }
|
|
132
|
+
|
|
133
|
+
/* ── Sizing — leverages universal [size] attribute ── */
|
|
134
|
+
:scope[size="sm"] {
|
|
135
|
+
--tags-input-font-size-default: var(--a-ui-sm);
|
|
136
|
+
--tags-input-min-h-default: var(--a-size-sm);
|
|
137
|
+
--tags-input-gap-default: calc(var(--a-space-1) / 1.25);
|
|
138
|
+
}
|
|
139
|
+
:scope[size="lg"] {
|
|
140
|
+
--tags-input-font-size-default: var(--a-ui-lg);
|
|
141
|
+
--tags-input-min-h-default: var(--a-size-lg);
|
|
142
|
+
--tags-input-gap-default: var(--a-space-2);
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
/* ── Suggestions popover ── */
|
|
147
|
+
/* Host-scoped (not inside @scope) so the popover can render outside the
|
|
148
|
+
normal flow if a future revision opts into top-layer. Currently inlined. */
|
|
149
|
+
|
|
150
|
+
tags-input-ui [data-suggestions] {
|
|
151
|
+
position: absolute;
|
|
152
|
+
left: 0;
|
|
153
|
+
top: calc(100% + var(--a-space-1));
|
|
154
|
+
width: 100%;
|
|
155
|
+
min-width: 12em;
|
|
156
|
+
max-height: 18rem;
|
|
157
|
+
margin: 0;
|
|
158
|
+
padding: var(--a-space-1);
|
|
159
|
+
border: 1px solid var(--a-ui-border);
|
|
160
|
+
border-radius: var(--a-radius);
|
|
161
|
+
background: var(--a-canvas-bright);
|
|
162
|
+
box-shadow: var(--a-shadow-lg);
|
|
163
|
+
font-family: inherit;
|
|
164
|
+
font-size: var(--a-ui-size);
|
|
165
|
+
color: var(--a-ui-text);
|
|
166
|
+
overflow-y: auto;
|
|
167
|
+
z-index: 10;
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
tags-input-ui {
|
|
171
|
+
position: relative;
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
tags-input-ui [data-suggestions][hidden] { display: none; }
|
|
175
|
+
|
|
176
|
+
tags-input-ui [data-suggestions] [role="option"] {
|
|
177
|
+
display: flex;
|
|
178
|
+
align-items: center;
|
|
179
|
+
padding: var(--a-space-1) var(--a-ui-px);
|
|
180
|
+
border-radius: var(--a-radius-sm);
|
|
181
|
+
white-space: nowrap;
|
|
182
|
+
color: var(--a-ui-text-subtle);
|
|
183
|
+
cursor: pointer;
|
|
184
|
+
transition:
|
|
185
|
+
background var(--a-duration-fast) var(--a-easing),
|
|
186
|
+
color var(--a-duration-fast) var(--a-easing);
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
tags-input-ui [data-suggestions] [role="option"][data-active],
|
|
190
|
+
tags-input-ui [data-suggestions] [role="option"]:hover {
|
|
191
|
+
background: var(--a-ui-bg-hover);
|
|
192
|
+
color: var(--a-ui-text-hover);
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
@keyframes tags-input-spin {
|
|
196
|
+
to { transform: rotate(360deg); }
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
@media (prefers-reduced-motion: reduce) {
|
|
200
|
+
tags-input-ui [data-spinner] { animation: none; }
|
|
201
|
+
}
|
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `<tags-input-ui>` — Free-form token input — type a value, press Enter (or the configured
|
|
3
|
+
delimiter) to commit it as a chip; Backspace from the empty inline
|
|
4
|
+
input removes the last chip. Distinct from <select-ui multiple>
|
|
5
|
+
(SPEC-040), which is constrained to a fixed option list — tags-input
|
|
6
|
+
is for OPEN sets (labels, email recipients, keyword inputs). Per
|
|
7
|
+
ADR-0025 the inline editor is a contenteditable surface (NO native
|
|
8
|
+
`<input>` wrap). Form-bearing via UIFormElement + ElementInternals:
|
|
9
|
+
the form value is a JSON-serialized string array under `[name]`.
|
|
10
|
+
Each rendered chip is a `<tag-ui removable>`; the `remove` event
|
|
11
|
+
delegates back to the host. Optional autocompletion: when
|
|
12
|
+
`.suggestions` is non-empty, a popover renders below the field and
|
|
13
|
+
the host announces as a combobox per WAI-APG.
|
|
14
|
+
|
|
15
|
+
*
|
|
16
|
+
* @see https://ui-kit.exe.xyz/site/components/tags-input
|
|
17
|
+
*
|
|
18
|
+
* Type declarations generated by scripts/build/dts-codegen.mjs from
|
|
19
|
+
* the component's `.a2ui.json` sidecar(s). Edit the source `.yaml`,
|
|
20
|
+
* run `npm run build:components`, then `npm run codegen:dts` to
|
|
21
|
+
* regenerate; or hand-author this file fully if rich event types are
|
|
22
|
+
* needed beyond what the yaml `events:` block can express.
|
|
23
|
+
*/
|
|
24
|
+
|
|
25
|
+
import { UIElement } from '../../core/element.js';
|
|
26
|
+
|
|
27
|
+
export interface TagsInputChangeEventDetail {
|
|
28
|
+
/** Tokens added by this change (`[]` when only removals occurred). */
|
|
29
|
+
added: unknown[];
|
|
30
|
+
/** Tokens removed by this change (`[]` when only additions occurred). */
|
|
31
|
+
removed: unknown[];
|
|
32
|
+
/** Current token list (string array). */
|
|
33
|
+
value: unknown[];
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
export type TagsInputChangeEvent = CustomEvent<TagsInputChangeEventDetail>;
|
|
37
|
+
export interface TagsInputCommitEventDetail {
|
|
38
|
+
/** True unless the consumer calls `preventDefault()`. */
|
|
39
|
+
accepted: boolean;
|
|
40
|
+
/** Candidate token text (post-transform). */
|
|
41
|
+
value: string;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
export type TagsInputCommitEvent = CustomEvent<TagsInputCommitEventDetail>;
|
|
45
|
+
export interface TagsInputInputEventDetail {
|
|
46
|
+
/** Current typed text in the inline input. */
|
|
47
|
+
query: string;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
export type TagsInputInputEvent = CustomEvent<TagsInputInputEventDetail>;
|
|
51
|
+
export interface TagsInputInvalidEventDetail {
|
|
52
|
+
/** One of `duplicate` / `too-short` / `too-long` / `validator` / `max`. */
|
|
53
|
+
reason: string;
|
|
54
|
+
/** Rejected token text. */
|
|
55
|
+
value: string;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
export type TagsInputInvalidEvent = CustomEvent<TagsInputInvalidEventDetail>;
|
|
59
|
+
|
|
60
|
+
export class UITagsInput extends UIElement {
|
|
61
|
+
/** Required for form validation. Empty array fails `:invalid`. */
|
|
62
|
+
required: boolean;
|
|
63
|
+
/** Inline character that commits the typed value as a chip. The
|
|
64
|
+
sentinel `enter` disables in-line commit — only the Enter key
|
|
65
|
+
(or programmatic `addToken`) commits. Default is `,`. */
|
|
66
|
+
delimiter: string;
|
|
67
|
+
/** Block all interaction; dim the field. */
|
|
68
|
+
disabled: boolean;
|
|
69
|
+
/** Maximum number of tokens. `0` (default) means unlimited. */
|
|
70
|
+
max: number;
|
|
71
|
+
/** Maximum per-token character count. `0` (default) means unlimited. */
|
|
72
|
+
maxLength: number;
|
|
73
|
+
/** Minimum required tokens for form validity. */
|
|
74
|
+
min: number;
|
|
75
|
+
/** Minimum per-token character count after `transform` is applied. */
|
|
76
|
+
minLength: number;
|
|
77
|
+
/** Form field name. Serializes the token list as JSON under this key. */
|
|
78
|
+
name: string;
|
|
79
|
+
/** Regex character-class fragment matched against pasted text to
|
|
80
|
+
split it into multiple tokens. Default `,\n` splits on commas
|
|
81
|
+
and newlines. Use `""` to disable paste-splitting entirely. */
|
|
82
|
+
pasteSplit: string;
|
|
83
|
+
/** Placeholder text for the inline input when no chips are committed. */
|
|
84
|
+
placeholder: string;
|
|
85
|
+
/** Block edits; allow inspection (chips render without remove buttons). */
|
|
86
|
+
readonly: boolean;
|
|
87
|
+
/** Sizing scale via universal `[size]` attribute system. Matches
|
|
88
|
+
Input + Combobox sizing tokens so a TagsInput rendered alongside
|
|
89
|
+
either feels coherent in a form row. */
|
|
90
|
+
size: 'sm' | 'md' | 'lg';
|
|
91
|
+
/** Optional autocomplete strings rendered in a popover below the
|
|
92
|
+
field. Suggestions are hints, not gates — the typed value still
|
|
93
|
+
wins on commit. JS property only (array reflection skipped). */
|
|
94
|
+
suggestions: string;
|
|
95
|
+
/** Normalize tokens on commit. `lowercase` lowercases, `trim` strips
|
|
96
|
+
leading + trailing whitespace, `strip-spaces` removes all
|
|
97
|
+
whitespace, `""` (default) preserves the typed value. */
|
|
98
|
+
transform: '' | 'lowercase' | 'trim' | 'strip-spaces';
|
|
99
|
+
/** Reject duplicate tokens silently (no `invalid` event for accidental dups). */
|
|
100
|
+
unique: boolean;
|
|
101
|
+
/** Per-token validator. Sync `(value, index) => boolean` rejects
|
|
102
|
+
false synchronously; async `(value, index) => Promise<boolean>`
|
|
103
|
+
flips the host into `[validating]` while pending. JS property
|
|
104
|
+
only — not serializable in A2UI JSON; wire post-mount. */
|
|
105
|
+
validateFn: Record<string, unknown>;
|
|
106
|
+
/** Current token list (string array). Setting `.value = ['a','b']`
|
|
107
|
+
replaces the rendered chips. Reflection skipped — array values
|
|
108
|
+
do not round-trip through attribute strings. */
|
|
109
|
+
value: string;
|
|
110
|
+
|
|
111
|
+
addEventListener<K extends keyof HTMLElementEventMap>(
|
|
112
|
+
type: K,
|
|
113
|
+
listener: (this: UITagsInput, ev: HTMLElementEventMap[K]) => unknown,
|
|
114
|
+
options?: boolean | AddEventListenerOptions,
|
|
115
|
+
): void;
|
|
116
|
+
addEventListener(type: 'change', listener: (ev: TagsInputChangeEvent) => unknown, options?: boolean | AddEventListenerOptions): void;
|
|
117
|
+
addEventListener(type: 'commit', listener: (ev: TagsInputCommitEvent) => unknown, options?: boolean | AddEventListenerOptions): void;
|
|
118
|
+
addEventListener(type: 'input', listener: (ev: TagsInputInputEvent) => unknown, options?: boolean | AddEventListenerOptions): void;
|
|
119
|
+
addEventListener(type: 'invalid', listener: (ev: TagsInputInvalidEvent) => unknown, options?: boolean | AddEventListenerOptions): void;
|
|
120
|
+
}
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
# tags-input — Examples
|
|
2
|
+
|
|
3
|
+
## basic
|
|
4
|
+
|
|
5
|
+
```html
|
|
6
|
+
<field-ui label="Labels">
|
|
7
|
+
<tags-input-ui name="labels" placeholder="Add a label, press Enter"></tags-input-ui>
|
|
8
|
+
</field-ui>
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
Type a value + press Enter (or comma) to commit a chip. Backspace from the
|
|
12
|
+
empty inline input removes the last chip.
|
|
13
|
+
|
|
14
|
+
## pre-populated
|
|
15
|
+
|
|
16
|
+
```html
|
|
17
|
+
<tags-input-ui name="tags" value='["bug","high-priority","needs-triage"]'></tags-input-ui>
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
The `value` attribute accepts JSON — `["a","b","c"]`. The form value
|
|
21
|
+
under `name` serializes back to the same JSON string.
|
|
22
|
+
|
|
23
|
+
## transform="lowercase"
|
|
24
|
+
|
|
25
|
+
```html
|
|
26
|
+
<tags-input-ui transform="lowercase"></tags-input-ui>
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
Tokens are lowercased on commit. Available values:
|
|
30
|
+
`""` (preserve), `"lowercase"`, `"trim"`, `"strip-spaces"`.
|
|
31
|
+
|
|
32
|
+
## max — count cap
|
|
33
|
+
|
|
34
|
+
```html
|
|
35
|
+
<tags-input-ui name="tags" max="3"></tags-input-ui>
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
Once 3 tokens have been added, further commits fire
|
|
39
|
+
`invalid` with `detail.reason === "max"`.
|
|
40
|
+
|
|
41
|
+
## delimiter="enter"
|
|
42
|
+
|
|
43
|
+
```html
|
|
44
|
+
<tags-input-ui delimiter="enter"></tags-input-ui>
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
Disables in-line character commits when the token grammar legitimately
|
|
48
|
+
contains the default `,` (e.g. display names like "Doe, Jane"). Only
|
|
49
|
+
Enter (or programmatic `addToken`) commits.
|
|
50
|
+
|
|
51
|
+
## validateFn — email-format gate
|
|
52
|
+
|
|
53
|
+
```html
|
|
54
|
+
<tags-input-ui id="to" name="to" placeholder="Email…"></tags-input-ui>
|
|
55
|
+
<script>
|
|
56
|
+
const EMAIL_RE = /^[^\s@]+@[^\s@]+\.[^\s@]+$/;
|
|
57
|
+
document.getElementById('to').validateFn = (value) => EMAIL_RE.test(value);
|
|
58
|
+
</script>
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
`validateFn` may return a `Promise<boolean>` — the host flips into
|
|
62
|
+
`[validating]` until the promise settles.
|
|
63
|
+
|
|
64
|
+
## paste-split — bulk entry
|
|
65
|
+
|
|
66
|
+
```html
|
|
67
|
+
<tags-input-ui name="domains" paste-split=",\n"></tags-input-ui>
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
Pasting `"example.com, foo.com\nbar.com"` commits three chips.
|
|
71
|
+
|
|
72
|
+
## suggestions — autocomplete hints
|
|
73
|
+
|
|
74
|
+
```html
|
|
75
|
+
<tags-input-ui id="tags" name="tags"></tags-input-ui>
|
|
76
|
+
<script>
|
|
77
|
+
document.getElementById('tags').suggestions = ['bug', 'feature', 'chore'];
|
|
78
|
+
</script>
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
Suggestions are hints, not gates — the typed value still wins. When
|
|
82
|
+
non-empty, the host announces as `role="combobox"` with the popover
|
|
83
|
+
listed below the field.
|
|
84
|
+
|
|
85
|
+
## readonly chip display
|
|
86
|
+
|
|
87
|
+
```html
|
|
88
|
+
<tags-input-ui readonly value='["bug","urgent"]'></tags-input-ui>
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
Readonly hides the remove affordance on each chip + blocks the inline
|
|
92
|
+
input.
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `<tags-input-ui>` — auto-registers the tag on import.
|
|
3
|
+
*
|
|
4
|
+
* For non-side-effect class import (test isolation, tag override), use
|
|
5
|
+
* the `class` subpath:
|
|
6
|
+
*
|
|
7
|
+
* import { UITagsInput } from '@adia-ai/web-components/components/tags-input/class';
|
|
8
|
+
*
|
|
9
|
+
* @see ../../USAGE.md#registration--auto-vs-explicit
|
|
10
|
+
*/
|
|
11
|
+
|
|
12
|
+
import { defineIfFree } from '../../core/register.js';
|
|
13
|
+
import { UITagsInput } from './tags-input.class.js';
|
|
14
|
+
|
|
15
|
+
defineIfFree('tags-input-ui', UITagsInput);
|
|
16
|
+
|
|
17
|
+
export { UITagsInput };
|