@redvars/peacock 4.1.0 → 4.2.1
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/dist/{BaseField-BMumJpkW.js → BaseField-D8ByB0l3.js} +40 -4
- package/dist/BaseField-D8ByB0l3.js.map +1 -0
- package/dist/{BaseInput-mWdyYv27.js → BaseInput-xCHvT4AN.js} +3 -3
- package/dist/BaseInput-xCHvT4AN.js.map +1 -0
- package/dist/ai-badge.js +32 -6
- package/dist/ai-badge.js.map +1 -1
- package/dist/ai-summary.js +2 -2
- package/dist/alert.js +2 -2
- package/dist/anchor-nav.js +2 -2
- package/dist/app-shell.js +2 -2
- package/dist/assistant-panel.js +2 -2
- package/dist/assistant-step.js +2 -2
- package/dist/assistant-steps.js +2 -2
- package/dist/avatar-group.js +2 -2
- package/dist/banner.js +2 -2
- package/dist/{base-progress-CvLVSjuy.js → base-progress-DxNgAQtw.js} +2 -2
- package/dist/{base-progress-CvLVSjuy.js.map → base-progress-DxNgAQtw.js.map} +1 -1
- package/dist/bottom-sheet.js +2 -2
- package/dist/breadcrumb.js +2 -2
- package/dist/button.js +11 -5
- package/dist/button.js.map +1 -1
- package/dist/calendar.js +2 -2
- package/dist/{canvas-base-BTQMEVn_.js → canvas-base-DHKf2CmA.js} +2 -2
- package/dist/{canvas-base-BTQMEVn_.js.map → canvas-base-DHKf2CmA.js.map} +1 -1
- package/dist/{cartesian-chart-DM1FC_XT.js → cartesian-chart-G6VX1aKk.js} +2 -2
- package/dist/{cartesian-chart-DM1FC_XT.js.map → cartesian-chart-G6VX1aKk.js.map} +1 -1
- package/dist/{cb-group-base-B6fa4Lll.js → cb-group-base-CZLzCnXK.js} +2 -2
- package/dist/{cb-group-base-B6fa4Lll.js.map → cb-group-base-CZLzCnXK.js.map} +1 -1
- package/dist/cb-group.js +3 -3
- package/dist/cb-rule.js +3 -3
- package/dist/chart-area.js +4 -4
- package/dist/chart-bar.js +4 -4
- package/dist/{chart-base-Dhxuw_Mw.js → chart-base-DREru2P0.js} +2 -2
- package/dist/{chart-base-Dhxuw_Mw.js.map → chart-base-DREru2P0.js.map} +1 -1
- package/dist/chart-doughnut.js +3 -3
- package/dist/chart-line.js +4 -4
- package/dist/chart-pie.js +3 -3
- package/dist/chat-event.js +152 -0
- package/dist/chat-event.js.map +1 -0
- package/dist/chat-message.js +195 -19
- package/dist/chat-message.js.map +1 -1
- package/dist/chat-thread.js +26 -9
- package/dist/chat-thread.js.map +1 -1
- package/dist/checkbox-group.js +4 -4
- package/dist/checkbox.js +4 -4
- package/dist/chip-set.js +3 -3
- package/dist/chip.js +2 -2
- package/dist/circular-progress.js +3 -3
- package/dist/citation.js +2 -2
- package/dist/code-editor.js +4 -4
- package/dist/code-highlighter.js +2 -2
- package/dist/color-field.js +5 -5
- package/dist/color-picker.js +2 -2
- package/dist/command-palette.js +2 -2
- package/dist/comment-composer.js +25 -13
- package/dist/comment-composer.js.map +1 -1
- package/dist/condition-builder.js +3 -3
- package/dist/confirm-dialog.js +2 -2
- package/dist/copy-button.js +2 -2
- package/dist/currency-field.js +5 -5
- package/dist/custom-elements-jsdocs.json +228 -22
- package/dist/custom-elements.json +1255 -110
- package/dist/date-field.js +6 -6
- package/dist/date-picker.js +2 -2
- package/dist/date-range-field.js +6 -6
- package/dist/datetime-field.js +6 -6
- package/dist/dependency-map.js +3 -3
- package/dist/description-item.js +2 -2
- package/dist/description-list.js +2 -2
- package/dist/{diagram-2r11KySs.js → diagram-CHF70xTL.js} +2 -2
- package/dist/{diagram-2r11KySs.js.map → diagram-CHF70xTL.js.map} +1 -1
- package/dist/diagram-controls.js +2 -2
- package/dist/diagram-minimap.js +2 -2
- package/dist/diagram.js +4 -4
- package/dist/diff-viewer.js +2 -2
- package/dist/discussion-activity.js +4 -4
- package/dist/discussion-comment.js +4 -4
- package/dist/{discussion-time-BegaYfhf.js → discussion-time-DqykqvNy.js} +2 -2
- package/dist/{discussion-time-BegaYfhf.js.map → discussion-time-DqykqvNy.js.map} +1 -1
- package/dist/discussion.js +7 -7
- package/dist/{document-editor-BnEugM3E.js → document-editor-Cb9fCxvA.js} +22 -10
- package/dist/{document-editor-BnEugM3E.js.map → document-editor-Cb9fCxvA.js.map} +1 -1
- package/dist/document-editor.js +3 -3
- package/dist/draft-card.js +14 -4
- package/dist/draft-card.js.map +1 -1
- package/dist/dropdown-button.js +3 -2
- package/dist/dropdown-button.js.map +1 -1
- package/dist/erd.js +3 -3
- package/dist/file-upload.js +4 -4
- package/dist/filter-bar.js +2 -2
- package/dist/flow.js +4 -4
- package/dist/form.js +3 -3
- package/dist/{generative-view-BgOcLRXr.js → generative-view-C4fJ2zI7.js} +2 -2
- package/dist/{generative-view-BgOcLRXr.js.map → generative-view-C4fJ2zI7.js.map} +1 -1
- package/dist/generative-view.js +3 -3
- package/dist/html-editor.js +30 -13
- package/dist/html-editor.js.map +1 -1
- package/dist/{i18n-controller-Cp43HjJl.js → i18n-controller-CH4e9sju.js} +2 -2
- package/dist/{i18n-controller-Cp43HjJl.js.map → i18n-controller-CH4e9sju.js.map} +1 -1
- package/dist/icon-button.js +7 -5
- package/dist/icon-button.js.map +1 -1
- package/dist/image.js +2 -2
- package/dist/index.js +21 -20
- package/dist/index.js.map +1 -1
- package/dist/inline-edit.js +2 -2
- package/dist/input.js +4 -4
- package/dist/json-viewer.js +2 -2
- package/dist/kanban.js +2 -2
- package/dist/kbd.js +2 -2
- package/dist/linear-progress.js +3 -3
- package/dist/link-button.js +7 -5
- package/dist/link-button.js.map +1 -1
- package/dist/listbox.js +3 -3
- package/dist/loader-full.js +13 -12
- package/dist/loader-full.js.map +1 -1
- package/dist/loader.js +16 -12
- package/dist/loader.js.map +1 -1
- package/dist/markdown-editor.js +30 -13
- package/dist/markdown-editor.js.map +1 -1
- package/dist/mention-input.js +5 -5
- package/dist/{menu-trigger-controller-DyLpTxM7.js → menu-trigger-controller-CEJq1ugC.js} +11 -14
- package/dist/menu-trigger-controller-CEJq1ugC.js.map +1 -0
- package/dist/modal.js +2 -2
- package/dist/navigation-bar.js +2 -2
- package/dist/navigation-drawer.js +2 -2
- package/dist/navigation-rail.js +2 -2
- package/dist/notification-center.js +3 -3
- package/dist/number-field.js +5 -5
- package/dist/page-header.js +2 -2
- package/dist/pagination.js +2 -2
- package/dist/password-field.js +5 -5
- package/dist/password-rules.js +2 -2
- package/dist/phone-field.js +5 -5
- package/dist/{picker-field-dTlIMAQn.js → picker-field-loXW-xrW.js} +3 -3
- package/dist/{picker-field-dTlIMAQn.js.map → picker-field-loXW-xrW.js.map} +1 -1
- package/dist/pin-input.js +5 -5
- package/dist/presence-indicator.js +2 -2
- package/dist/prompt-input.js +25 -13
- package/dist/prompt-input.js.map +1 -1
- package/dist/radio-group.js +1 -1
- package/dist/radio.js +4 -4
- package/dist/rating.js +4 -4
- package/dist/redvars-loader.js +2 -2
- package/dist/{relative-time-BVQXLuHm.js → relative-time-BNxqvEbg.js} +13 -2
- package/dist/relative-time-BNxqvEbg.js.map +1 -0
- package/dist/relative-time.js +3 -3
- package/dist/resizable-panels.js +2 -2
- package/dist/{rich-text-input-DM_BOzgk.js → rich-text-input-B5j0eqCJ.js} +21 -18
- package/dist/rich-text-input-B5j0eqCJ.js.map +1 -0
- package/dist/{schema-B8g30A_n.js → schema-BJzlGRP1.js} +2 -2
- package/dist/{schema-B8g30A_n.js.map → schema-BJzlGRP1.js.map} +1 -1
- package/dist/search.js +4 -4
- package/dist/select.js +5 -5
- package/dist/side-sheet.js +2 -2
- package/dist/signature-pad.js +4 -4
- package/dist/slider.js +4 -4
- package/dist/snackbar.js +2 -2
- package/dist/sparkline.js +2 -2
- package/dist/split-button.js +109 -21
- package/dist/split-button.js.map +1 -1
- package/dist/src/__internal/ai/suggestion-controller.d.ts +2 -0
- package/dist/src/__internal/i18n/strings.d.ts +6 -1
- package/dist/src/__internal/menu-trigger-controller.d.ts +11 -8
- package/dist/src/__internal/rich-text/rich-text-input.d.ts +6 -1
- package/dist/src/__internal/utils/relative-time.d.ts +5 -0
- package/dist/src/ai-badge/ai-badge.d.ts +8 -0
- package/dist/src/button/button/button.d.ts +4 -0
- package/dist/src/chat-message/chat-message.d.ts +51 -10
- package/dist/src/chat-message/index.d.ts +1 -1
- package/dist/src/chat-thread/chat-event.d.ts +37 -0
- package/dist/src/chat-thread/chat-thread.d.ts +7 -4
- package/dist/src/chat-thread/index.d.ts +1 -0
- package/dist/src/html-editor/html-editor.d.ts +5 -0
- package/dist/src/index.d.ts +2 -2
- package/dist/src/input/BaseField.d.ts +12 -1
- package/dist/src/input/BaseInput.d.ts +1 -0
- package/dist/src/markdown-editor/markdown-editor.d.ts +5 -0
- package/dist/src/split-button/split-button.d.ts +7 -2
- package/dist/src/textarea/textarea.d.ts +2 -0
- package/dist/stat.js +2 -2
- package/dist/status-indicator.js +2 -2
- package/dist/step.js +2 -2
- package/dist/stepper.js +2 -2
- package/dist/{strings-BJPuhKJk.js → strings-o6v6Hrmn.js} +7 -2
- package/dist/strings-o6v6Hrmn.js.map +1 -0
- package/dist/{suggestion-controller-CW17adxd.js → suggestion-controller-7YRQqkaI.js} +3 -1
- package/dist/{suggestion-controller-CW17adxd.js.map → suggestion-controller-7YRQqkaI.js.map} +1 -1
- package/dist/svg.js +2 -2
- package/dist/switch.js +4 -4
- package/dist/table.js +50 -11
- package/dist/table.js.map +1 -1
- package/dist/textarea.js +10 -5
- package/dist/textarea.js.map +1 -1
- package/dist/time-field.js +6 -6
- package/dist/time-picker.js +2 -2
- package/dist/timeline-item.js +2 -2
- package/dist/timeline.js +2 -2
- package/dist/{toggle-base-BlaHalfS.js → toggle-base-BSzBnLZN.js} +2 -2
- package/dist/{toggle-base-BlaHalfS.js.map → toggle-base-BSzBnLZN.js.map} +1 -1
- package/dist/tour.js +2 -2
- package/dist/transfer-list.js +4 -4
- package/dist/tree-chart.js +3 -3
- package/dist/tree-item.js +2 -2
- package/dist/tree.js +2 -2
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/dist/typing-indicator.js +2 -2
- package/dist/url-field.js +5 -5
- package/dist/user-menu.js +3 -3
- package/dist/virtual-list.js +2 -2
- package/dist/workflow-timeline.js +2 -2
- package/dist/workflow.js +3 -3
- package/dist/workspace-switcher.js +3 -3
- package/package.json +1 -1
- package/src/__internal/ai/suggestion-controller.ts +3 -1
- package/src/__internal/i18n/strings.ts +6 -1
- package/src/__internal/menu-trigger-controller.ts +11 -15
- package/src/__internal/rich-text/editor-chrome.scss +27 -10
- package/src/__internal/rich-text/rich-text-input.ts +17 -16
- package/src/__internal/utils/relative-time.ts +20 -0
- package/src/ai-badge/ai-badge.scss +8 -0
- package/src/ai-badge/ai-badge.ts +21 -4
- package/src/button/button/button-base.scss +9 -2
- package/src/button/button/button-layers.scss +3 -1
- package/src/button/button/button.ts +4 -0
- package/src/chat-message/chat-message.scss +72 -0
- package/src/chat-message/chat-message.ts +137 -18
- package/src/chat-message/index.ts +1 -0
- package/src/chat-thread/chat-event.scss +36 -0
- package/src/chat-thread/chat-event.ts +79 -0
- package/src/chat-thread/chat-thread.scss +4 -1
- package/src/chat-thread/chat-thread.ts +22 -6
- package/src/chat-thread/index.ts +1 -0
- package/src/draft-card/draft-card.scss +16 -2
- package/src/dropdown-button/dropdown-button.ts +2 -1
- package/src/html-editor/html-editor.ts +5 -0
- package/src/index.ts +2 -1
- package/src/input/BaseField.ts +42 -2
- package/src/input/BaseInput.ts +1 -1
- package/src/loader.ts +4 -0
- package/src/markdown-editor/markdown-editor.ts +5 -0
- package/src/split-button/split-button-colors.scss +9 -0
- package/src/split-button/split-button-sizes.scss +32 -5
- package/src/split-button/split-button.scss +61 -8
- package/src/split-button/split-button.ts +15 -8
- package/src/table/table.scss +57 -9
- package/src/table/table.ts +3 -1
- package/src/textarea/textarea.ts +7 -0
- package/dist/BaseField-BMumJpkW.js.map +0 -1
- package/dist/BaseInput-mWdyYv27.js.map +0 -1
- package/dist/menu-trigger-controller-DyLpTxM7.js.map +0 -1
- package/dist/relative-time-BVQXLuHm.js.map +0 -1
- package/dist/rich-text-input-DM_BOzgk.js.map +0 -1
- package/dist/strings-BJPuhKJk.js.map +0 -1
package/dist/split-button.js
CHANGED
|
@@ -2,11 +2,11 @@ import { i, _ as __decorate, I as IndividualComponent, a as i$1, b } from './Ind
|
|
|
2
2
|
import { n } from './property-B2TG3KEE.js';
|
|
3
3
|
import { e } from './query-CHb9Ft_d.js';
|
|
4
4
|
import { e as e$1 } from './class-map-NDIkZErE.js';
|
|
5
|
-
import { I as I18nController } from './i18n-controller-
|
|
6
|
-
import { M as MenuTriggerController } from './menu-trigger-controller-
|
|
5
|
+
import { I as I18nController } from './i18n-controller-CH4e9sju.js';
|
|
6
|
+
import { M as MenuTriggerController } from './menu-trigger-controller-CEJq1ugC.js';
|
|
7
7
|
import './base-Cl6v8-BZ.js';
|
|
8
8
|
import './directive-ZPhl09Yt.js';
|
|
9
|
-
import './strings-
|
|
9
|
+
import './strings-o6v6Hrmn.js';
|
|
10
10
|
import './locale-DEsJZCQG.js';
|
|
11
11
|
|
|
12
12
|
var css_248z$2 = i`@charset "UTF-8";
|
|
@@ -48,9 +48,7 @@ var css_248z$2 = i`@charset "UTF-8";
|
|
|
48
48
|
:host {
|
|
49
49
|
display: inline-flex;
|
|
50
50
|
position: relative;
|
|
51
|
-
--split-button-
|
|
52
|
-
--split-button-gap: 0.125rem;
|
|
53
|
-
--split-button-icon-size: 1.125rem;
|
|
51
|
+
--split-button-gap: var(--spacing-025);
|
|
54
52
|
}
|
|
55
53
|
|
|
56
54
|
.split-button {
|
|
@@ -59,17 +57,55 @@ var css_248z$2 = i`@charset "UTF-8";
|
|
|
59
57
|
gap: var(--split-button-gap);
|
|
60
58
|
}
|
|
61
59
|
|
|
60
|
+
.action-button,
|
|
61
|
+
.dropdown-trigger {
|
|
62
|
+
--_outer-corner: var(
|
|
63
|
+
--split-button-container-shape,
|
|
64
|
+
calc(var(--button-height) / 2)
|
|
65
|
+
);
|
|
66
|
+
--_inner: var(--_inner-corner);
|
|
67
|
+
--button-container-shape-variant: round;
|
|
68
|
+
}
|
|
69
|
+
|
|
62
70
|
.action-button {
|
|
63
|
-
--button-container-shape: var(--
|
|
71
|
+
--button-container-shape-start-start: var(--_outer-corner);
|
|
72
|
+
--button-container-shape-end-start: var(--_outer-corner);
|
|
73
|
+
--button-container-shape-start-end: var(--_inner);
|
|
74
|
+
--button-container-shape-end-end: var(--_inner);
|
|
75
|
+
--button-container-padding-start: var(--_leading-padding-start);
|
|
76
|
+
--button-container-padding-end: var(--_leading-padding-end);
|
|
64
77
|
}
|
|
65
78
|
|
|
66
79
|
.dropdown-trigger {
|
|
67
|
-
--button-container-shape: var(--
|
|
68
|
-
--button-
|
|
80
|
+
--button-container-shape-start-start: var(--_inner);
|
|
81
|
+
--button-container-shape-end-start: var(--_inner);
|
|
82
|
+
--button-container-shape-start-end: var(--_outer-corner);
|
|
83
|
+
--button-container-shape-end-end: var(--_outer-corner);
|
|
84
|
+
--button-width: var(--_trailing-width);
|
|
85
|
+
--button-icon-size: var(--_trailing-icon-size);
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
.action-button:not(.disabled):hover,
|
|
89
|
+
.action-button:not(.disabled):active,
|
|
90
|
+
.dropdown-trigger:not(.disabled):hover,
|
|
91
|
+
.dropdown-trigger:not(.disabled):active {
|
|
92
|
+
--_inner: var(--_inner-corner-active);
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
.dropdown-trigger.active:not(:active) {
|
|
96
|
+
--_inner: var(--_outer-corner);
|
|
69
97
|
}
|
|
70
98
|
|
|
71
99
|
.dropdown-icon {
|
|
72
|
-
|
|
100
|
+
--_optical-offset: calc(
|
|
101
|
+
(var(--_inner) - var(--_outer-corner)) * 0.11
|
|
102
|
+
);
|
|
103
|
+
translate: var(--_optical-offset) 0;
|
|
104
|
+
transition: transform 200ms var(--easing-standard), translate 200ms var(--easing-standard);
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
:host(:dir(rtl)) .dropdown-icon {
|
|
108
|
+
translate: calc(var(--_optical-offset) * -1) 0;
|
|
73
109
|
}
|
|
74
110
|
|
|
75
111
|
.dropdown-trigger.active .dropdown-icon {
|
|
@@ -90,6 +126,13 @@ var css_248z$2 = i`@charset "UTF-8";
|
|
|
90
126
|
--tonal-button-label-text-color: var(--tonal-split-button-label-text-color);
|
|
91
127
|
}
|
|
92
128
|
|
|
129
|
+
/* ── Variant: Elevated ──────────────────────────────────── */
|
|
130
|
+
.split-button.variant-elevated .action-button,
|
|
131
|
+
.split-button.variant-elevated .dropdown-trigger {
|
|
132
|
+
--elevated-button-container-color: var(--elevated-split-button-container-color);
|
|
133
|
+
--elevated-button-label-text-color: var(--elevated-split-button-label-text-color);
|
|
134
|
+
}
|
|
135
|
+
|
|
93
136
|
/* ── Variant: Outlined ──────────────────────────────────── */
|
|
94
137
|
.split-button.variant-outlined .action-button,
|
|
95
138
|
.split-button.variant-outlined .dropdown-trigger {
|
|
@@ -112,6 +155,8 @@ var css_248z$1 = i`:host([color=primary]) {
|
|
|
112
155
|
--filled-split-button-label-text-color: var(--color-on-primary);
|
|
113
156
|
--tonal-split-button-container-color: var(--color-primary-container);
|
|
114
157
|
--tonal-split-button-label-text-color: var(--color-on-primary-container);
|
|
158
|
+
--elevated-split-button-container-color: var(--color-surface-container-low);
|
|
159
|
+
--elevated-split-button-label-text-color: var(--color-primary);
|
|
115
160
|
--outlined-split-button-outline-color: var(--color-primary);
|
|
116
161
|
--outlined-split-button-label-text-color: var(--color-primary);
|
|
117
162
|
}
|
|
@@ -121,6 +166,8 @@ var css_248z$1 = i`:host([color=primary]) {
|
|
|
121
166
|
--filled-split-button-label-text-color: var(--color-on-secondary);
|
|
122
167
|
--tonal-split-button-container-color: var(--color-secondary-container);
|
|
123
168
|
--tonal-split-button-label-text-color: var(--color-on-secondary-container);
|
|
169
|
+
--elevated-split-button-container-color: var(--color-surface-container-low);
|
|
170
|
+
--elevated-split-button-label-text-color: var(--color-secondary);
|
|
124
171
|
--outlined-split-button-outline-color: var(--color-secondary);
|
|
125
172
|
--outlined-split-button-label-text-color: var(--color-secondary);
|
|
126
173
|
}
|
|
@@ -130,6 +177,8 @@ var css_248z$1 = i`:host([color=primary]) {
|
|
|
130
177
|
--filled-split-button-label-text-color: var(--color-on-tertiary);
|
|
131
178
|
--tonal-split-button-container-color: var(--color-tertiary-container);
|
|
132
179
|
--tonal-split-button-label-text-color: var(--color-on-tertiary-container);
|
|
180
|
+
--elevated-split-button-container-color: var(--color-surface-container-low);
|
|
181
|
+
--elevated-split-button-label-text-color: var(--color-tertiary);
|
|
133
182
|
--outlined-split-button-outline-color: var(--color-tertiary);
|
|
134
183
|
--outlined-split-button-label-text-color: var(--color-tertiary);
|
|
135
184
|
}
|
|
@@ -139,6 +188,8 @@ var css_248z$1 = i`:host([color=primary]) {
|
|
|
139
188
|
--filled-split-button-label-text-color: var(--color-on-success);
|
|
140
189
|
--tonal-split-button-container-color: var(--color-success-container);
|
|
141
190
|
--tonal-split-button-label-text-color: var(--color-on-success-container);
|
|
191
|
+
--elevated-split-button-container-color: var(--color-surface-container-low);
|
|
192
|
+
--elevated-split-button-label-text-color: var(--color-success);
|
|
142
193
|
--outlined-split-button-outline-color: var(--color-success);
|
|
143
194
|
--outlined-split-button-label-text-color: var(--color-success);
|
|
144
195
|
}
|
|
@@ -148,6 +199,8 @@ var css_248z$1 = i`:host([color=primary]) {
|
|
|
148
199
|
--filled-split-button-label-text-color: var(--color-on-error);
|
|
149
200
|
--tonal-split-button-container-color: var(--color-error-container);
|
|
150
201
|
--tonal-split-button-label-text-color: var(--color-on-error-container);
|
|
202
|
+
--elevated-split-button-container-color: var(--color-surface-container-low);
|
|
203
|
+
--elevated-split-button-label-text-color: var(--color-error);
|
|
151
204
|
--outlined-split-button-outline-color: var(--color-error);
|
|
152
205
|
--outlined-split-button-label-text-color: var(--color-error);
|
|
153
206
|
}
|
|
@@ -157,6 +210,8 @@ var css_248z$1 = i`:host([color=primary]) {
|
|
|
157
210
|
--filled-split-button-label-text-color: var(--color-on-warning);
|
|
158
211
|
--tonal-split-button-container-color: var(--color-warning-container);
|
|
159
212
|
--tonal-split-button-label-text-color: var(--color-on-warning-container);
|
|
213
|
+
--elevated-split-button-container-color: var(--color-surface-container-low);
|
|
214
|
+
--elevated-split-button-label-text-color: var(--color-warning);
|
|
160
215
|
--outlined-split-button-outline-color: var(--color-warning);
|
|
161
216
|
--outlined-split-button-label-text-color: var(--color-warning);
|
|
162
217
|
}
|
|
@@ -166,6 +221,8 @@ var css_248z$1 = i`:host([color=primary]) {
|
|
|
166
221
|
--filled-split-button-label-text-color: var(--color-surface);
|
|
167
222
|
--tonal-split-button-container-color: var(--color-on-surface-variant);
|
|
168
223
|
--tonal-split-button-label-text-color: var(--color-surface-container-high);
|
|
224
|
+
--elevated-split-button-container-color: var(--color-on-surface);
|
|
225
|
+
--elevated-split-button-label-text-color: var(--color-surface);
|
|
169
226
|
--outlined-split-button-outline-color: var(--color-on-surface);
|
|
170
227
|
--outlined-split-button-label-text-color: var(--color-on-surface);
|
|
171
228
|
}
|
|
@@ -175,28 +232,55 @@ var css_248z$1 = i`:host([color=primary]) {
|
|
|
175
232
|
--filled-split-button-label-text-color: var(--color-on-surface);
|
|
176
233
|
--tonal-split-button-container-color: var(--color-surface-container-high);
|
|
177
234
|
--tonal-split-button-label-text-color: var(--color-on-surface);
|
|
235
|
+
--elevated-split-button-container-color: var(--color-surface);
|
|
236
|
+
--elevated-split-button-label-text-color: var(--color-on-surface);
|
|
178
237
|
--outlined-split-button-outline-color: var(--color-on-surface);
|
|
179
238
|
--outlined-split-button-label-text-color: var(--color-on-surface);
|
|
180
239
|
}`;
|
|
181
240
|
|
|
182
241
|
var css_248z = i`:host([size=xs]) {
|
|
183
|
-
--
|
|
242
|
+
--_inner-corner: var(--shape-corner-extra-small);
|
|
243
|
+
--_inner-corner-active: var(--shape-corner-small);
|
|
244
|
+
--_leading-padding-start: 0.75rem;
|
|
245
|
+
--_leading-padding-end: 0.625rem;
|
|
246
|
+
--_trailing-width: 3rem;
|
|
247
|
+
--_trailing-icon-size: 1.375rem;
|
|
184
248
|
}
|
|
185
249
|
|
|
186
250
|
:host([size=sm]) {
|
|
187
|
-
--
|
|
251
|
+
--_inner-corner: var(--shape-corner-extra-small);
|
|
252
|
+
--_inner-corner-active: var(--shape-corner-medium);
|
|
253
|
+
--_leading-padding-start: 1rem;
|
|
254
|
+
--_leading-padding-end: 0.75rem;
|
|
255
|
+
--_trailing-width: 3rem;
|
|
256
|
+
--_trailing-icon-size: 1.375rem;
|
|
188
257
|
}
|
|
189
258
|
|
|
190
259
|
:host([size=md]) {
|
|
191
|
-
--
|
|
260
|
+
--_inner-corner: var(--shape-corner-extra-small);
|
|
261
|
+
--_inner-corner-active: var(--shape-corner-medium);
|
|
262
|
+
--_leading-padding-start: 1.5rem;
|
|
263
|
+
--_leading-padding-end: 1.5rem;
|
|
264
|
+
--_trailing-width: 3.5rem;
|
|
265
|
+
--_trailing-icon-size: 1.625rem;
|
|
192
266
|
}
|
|
193
267
|
|
|
194
268
|
:host([size=lg]) {
|
|
195
|
-
--
|
|
269
|
+
--_inner-corner: var(--shape-corner-small);
|
|
270
|
+
--_inner-corner-active: var(--shape-corner-large-increased);
|
|
271
|
+
--_leading-padding-start: 3rem;
|
|
272
|
+
--_leading-padding-end: 3rem;
|
|
273
|
+
--_trailing-width: 6rem;
|
|
274
|
+
--_trailing-icon-size: 2.375rem;
|
|
196
275
|
}
|
|
197
276
|
|
|
198
277
|
:host([size=xl]) {
|
|
199
|
-
--
|
|
278
|
+
--_inner-corner: var(--shape-corner-medium);
|
|
279
|
+
--_inner-corner-active: var(--shape-corner-large-increased);
|
|
280
|
+
--_leading-padding-start: 4rem;
|
|
281
|
+
--_leading-padding-end: 4rem;
|
|
282
|
+
--_trailing-width: 8.5rem;
|
|
283
|
+
--_trailing-icon-size: 3.125rem;
|
|
200
284
|
}`;
|
|
201
285
|
|
|
202
286
|
/**
|
|
@@ -208,7 +292,8 @@ var css_248z = i`:host([size=xs]) {
|
|
|
208
292
|
* @overview
|
|
209
293
|
* <p>The main button runs the default action; the arrow beside it opens a menu of related actions.</p>
|
|
210
294
|
*
|
|
211
|
-
* @cssprop --split-button-container-shape:
|
|
295
|
+
* @cssprop --split-button-container-shape: Radius of the split button's outer corners. Defaults to fully round; the inner corners follow the M3 size tokens.
|
|
296
|
+
* @cssprop --split-button-gap: Space between the main button and the menu button. Defaults to 2px.
|
|
212
297
|
*
|
|
213
298
|
* @cssprop --filled-split-button-container-color: Color of the filled split button container.
|
|
214
299
|
* @cssprop --filled-split-button-label-text-color: Text color of the filled split button label.
|
|
@@ -219,6 +304,9 @@ var css_248z = i`:host([size=xs]) {
|
|
|
219
304
|
* @cssprop --tonal-split-button-container-color: Color of the tonal split button container.
|
|
220
305
|
* @cssprop --tonal-split-button-label-text-color: Text color of the tonal split button label.
|
|
221
306
|
*
|
|
307
|
+
* @cssprop --elevated-split-button-container-color: Color of the elevated split button container.
|
|
308
|
+
* @cssprop --elevated-split-button-label-text-color: Text color of the elevated split button label.
|
|
309
|
+
*
|
|
222
310
|
* @fires {MouseEvent} click - Dispatched when the primary action button is clicked.
|
|
223
311
|
* @fires {CustomEvent} open - Dispatched after the menu opens.
|
|
224
312
|
* @fires {CustomEvent<{reason: 'escape' | 'light-dismiss' | 'action' | 'api'}>} close - Dispatched after the menu closes: an item pick is `action`, Escape `escape`, a press outside or Tab `light-dismiss`, `close()` or the primary action `api`.
|
|
@@ -248,6 +336,7 @@ let SplitButton = class SplitButton extends i$1 {
|
|
|
248
336
|
* `"filled"` is a filled button.
|
|
249
337
|
* `"outlined"` is an outlined button.
|
|
250
338
|
* `"tonal"` is a light color button.
|
|
339
|
+
* `"elevated"` is a raised button on a low surface.
|
|
251
340
|
*/
|
|
252
341
|
this.variant = 'filled';
|
|
253
342
|
/**
|
|
@@ -330,16 +419,15 @@ let SplitButton = class SplitButton extends i$1 {
|
|
|
330
419
|
size=${this.size}
|
|
331
420
|
variant=${this.variant}
|
|
332
421
|
?disabled=${this.disabled}
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
}}
|
|
422
|
+
aria-label=${this.i18n.t('openSplitButtonMenu')}
|
|
423
|
+
aria-haspopup="menu"
|
|
424
|
+
aria-expanded=${String(this._trigger.open)}
|
|
337
425
|
@click=${this._trigger.handleTriggerClick}
|
|
338
426
|
@keydown=${this._trigger.handleTriggerKeyDown}
|
|
339
427
|
>
|
|
340
428
|
<wc-icon
|
|
341
429
|
class="dropdown-icon"
|
|
342
|
-
name="
|
|
430
|
+
name="keyboard_arrow_down"
|
|
343
431
|
aria-hidden="true"
|
|
344
432
|
></wc-icon>
|
|
345
433
|
</wc-icon-button>
|
package/dist/split-button.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"split-button.js","sources":["../../src/split-button/split-button.ts"],"sourcesContent":["import { html, LitElement } from 'lit';\nimport { property, query } from 'lit/decorators.js';\nimport { classMap } from 'lit/directives/class-map.js';\nimport IndividualComponent from '@/IndividualComponent.js';\nimport { I18nController } from '@/__internal/i18n/i18n-controller.js';\nimport { MenuTriggerController } from '@/__internal/menu-trigger-controller.js';\nimport type { OverlayPlacement } from '@/__internal/utils/placement.js';\nimport styles from './split-button.scss';\nimport colorStyles from './split-button-colors.scss';\nimport sizeStyles from './split-button-sizes.scss';\nimport type { Menu, MenuFocusTarget } from '../menu/menu/menu.js';\n\n/**\n * @label Split Button\n * @tag wc-split-button\n * @rawTag split-button\n *\n * @summary A button for a default action joined to an arrow that opens a menu of related actions.\n * @overview\n * <p>The main button runs the default action; the arrow beside it opens a menu of related actions.</p>\n *\n * @cssprop --split-button-container-shape: Defines the border radius of the split button container shape.\n *\n * @cssprop --filled-split-button-container-color: Color of the filled split button container.\n * @cssprop --filled-split-button-label-text-color: Text color of the filled split button label.\n *\n * @cssprop --outlined-split-button-container-color: Color of the outlined split button container.\n * @cssprop --outlined-split-button-label-text-color: Text color of the outlined split button label.\n *\n * @cssprop --tonal-split-button-container-color: Color of the tonal split button container.\n * @cssprop --tonal-split-button-label-text-color: Text color of the tonal split button label.\n *\n * @fires {MouseEvent} click - Dispatched when the primary action button is clicked.\n * @fires {CustomEvent} open - Dispatched after the menu opens.\n * @fires {CustomEvent<{reason: 'escape' | 'light-dismiss' | 'action' | 'api'}>} close - Dispatched after the menu closes: an item pick is `action`, Escape `escape`, a press outside or Tab `light-dismiss`, `close()` or the primary action `api`.\n *\n * @example\n * ```html\n * <wc-split-button>\n * Save\n * <wc-menu-item slot=\"menu\">Save as draft</wc-menu-item>\n * <wc-menu-item slot=\"menu\">Save and publish</wc-menu-item>\n * </wc-split-button>\n * ```\n * @tags controls\n */\n@IndividualComponent\nexport class SplitButton extends LitElement {\n static override styles = [styles, colorStyles, sizeStyles];\n\n /**\n * Button size.\n * Possible values are `\"xs\"`, `\"sm\"`, `\"md\"`, `\"lg\"`, `\"xl\"`. Defaults to `\"sm\"`.\n */\n @property({ reflect: true }) size: 'xs' | 'sm' | 'md' | 'lg' | 'xl' = 'sm';\n\n /**\n * The visual style of the split button.\n *\n * Possible variant values:\n * `\"filled\"` is a filled button.\n * `\"outlined\"` is an outlined button.\n * `\"tonal\"` is a light color button.\n */\n @property({ reflect: true }) variant: 'filled' | 'tonal' | 'outlined' =\n 'filled';\n\n /**\n * Defines the primary color of the split button.\n */\n @property({ reflect: true }) color:\n | 'primary'\n | 'secondary'\n | 'tertiary'\n | 'success'\n | 'danger'\n | 'warning'\n | 'surface'\n | 'on-surface' = 'primary';\n\n /**\n * Whether the split button is disabled.\n */\n @property({ type: Boolean, reflect: true }) disabled = false;\n\n /** Visual variant of the menu: one surface (`\"standard\"`) or segmented groups (`\"expressive\"`). */\n @property({ attribute: 'menu-variant' }) menuVariant:\n | 'standard'\n | 'expressive' = 'standard';\n\n /**\n * Where the menu opens relative to the button: `top`, `bottom`, `start` or `end`, optionally\n * followed by `-start` or `-end` (ADR-030001). `start` and `end` follow the writing direction.\n * Defaults to `\"bottom-end\"`.\n */\n @property({ reflect: true }) placement: OverlayPlacement = 'bottom-end';\n\n @query('wc-menu') private readonly _menu?: Menu;\n\n /** Peacock's strings for the menu trigger label. */\n private readonly i18n = new I18nController(this);\n\n /** Opens and closes the menu and fires `open` / `close`. */\n private readonly _trigger = new MenuTriggerController(this, {\n menu: () => this._menu,\n disabled: () => this.disabled,\n idPrefix: 'split-menu',\n });\n\n override focus() {\n const btn = this.shadowRoot?.querySelector<HTMLElement>('.action-button');\n btn?.focus();\n }\n\n /** Opens the menu and focuses its first (or last) item. */\n show(focusTarget: MenuFocusTarget = 'first') {\n this._trigger.show(focusTarget);\n }\n\n /** Closes the menu. */\n close() {\n this._trigger.close();\n }\n\n private _onActionClick(event: MouseEvent) {\n if (this.disabled) {\n event.stopImmediatePropagation();\n event.preventDefault();\n return;\n }\n\n // The primary action closes the menu if it is open.\n if (this._menu?.open) {\n this._trigger.close();\n }\n }\n\n override render() {\n const actionClasses = {\n 'action-button': true,\n disabled: this.disabled,\n };\n\n const dropdownClasses = {\n 'dropdown-trigger': true,\n active: this._trigger.open,\n disabled: this.disabled,\n };\n\n const containerClasses = {\n 'split-button': true,\n [`variant-${this.variant}`]: true,\n disabled: this.disabled,\n };\n\n return html`\n <div class=${classMap(containerClasses)}>\n <wc-button\n class=${classMap(actionClasses)}\n size=${this.size}\n variant=${this.variant}\n ?disabled=${this.disabled}\n @click=${this._onActionClick}\n >\n <slot></slot>\n </wc-button>\n\n <wc-icon-button\n class=${classMap(dropdownClasses)}\n size=${this.size}\n variant=${this.variant}\n ?disabled=${this.disabled}\n .configAria=${{\n ...this._trigger.triggerAria,\n 'aria-label': this.i18n.t('openSplitButtonMenu'),\n }}\n @click=${this._trigger.handleTriggerClick}\n @keydown=${this._trigger.handleTriggerKeyDown}\n >\n <wc-icon\n class=\"dropdown-icon\"\n name=\"arrow_drop_down\"\n aria-hidden=\"true\"\n ></wc-icon>\n </wc-icon-button>\n </div>\n\n <wc-menu\n id=${this._trigger.menuId}\n .placement=${this.placement}\n variant=${this.menuVariant}\n @open=${this._trigger.handleMenuOpen}\n @close=${this._trigger.handleMenuClose}\n >\n <slot name=\"menu\"></slot>\n </wc-menu>\n `;\n }\n}\n"],"names":["LitElement","html","classMap","styles","colorStyles","sizeStyles","property","query"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAYA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAiCG;AAEI,IAAM,WAAW,GAAjB,MAAM,WAAY,SAAQA,GAAU,CAAA;AAApC,IAAA,WAAA,GAAA;;AAGL;;;AAGG;QAC0B,IAAA,CAAA,IAAI,GAAqC,IAAI;AAE1E;;;;;;;AAOG;QAC0B,IAAA,CAAA,OAAO,GAClC,QAAQ;AAEV;;AAEG;QAC0B,IAAA,CAAA,KAAK,GAQf,SAAS;AAE5B;;AAEG;QACyC,IAAA,CAAA,QAAQ,GAAG,KAAK;;QAGnB,IAAA,CAAA,WAAW,GAEjC,UAAU;AAE7B;;;;AAIG;QAC0B,IAAA,CAAA,SAAS,GAAqB,YAAY;;AAKtD,QAAA,IAAA,CAAA,IAAI,GAAG,IAAI,cAAc,CAAC,IAAI,CAAC;;AAG/B,QAAA,IAAA,CAAA,QAAQ,GAAG,IAAI,qBAAqB,CAAC,IAAI,EAAE;AAC1D,YAAA,IAAI,EAAE,MAAM,IAAI,CAAC,KAAK;AACtB,YAAA,QAAQ,EAAE,MAAM,IAAI,CAAC,QAAQ;AAC7B,YAAA,QAAQ,EAAE,YAAY;AACvB,SAAA,CAAC;IA2FJ;IAzFW,KAAK,GAAA;QACZ,MAAM,GAAG,GAAG,IAAI,CAAC,UAAU,EAAE,aAAa,CAAc,gBAAgB,CAAC;QACz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GpB,UAAA,CAAA;AAAxC,IAAAA,CAAQ,CAAC,EAAE,SAAS,EAAE,cAAc,EAAE;AAET,CAAA,EAAA,WAAA,CAAA,SAAA,EAAA,aAAA,EAAA,MAAA,CAAA;AAOD,UAAA,CAAA;AAA5B,IAAAA,CAAQ,CAAC,EAAE,OAAO,EAAE,IAAI,EAAE;AAA6C,CAAA,EAAA,WAAA,CAAA,SAAA,EAAA,WAAA,EAAA,MAAA,CAAA;AAErC,UAAA,CAAA;IAAlCC,CAAK,CAAC,SAAS;AAAgC,CAAA,EAAA,WAAA,CAAA,SAAA,EAAA,OAAA,EAAA,MAAA,CAAA;AAlDrC,WAAW,GAAA,UAAA,CAAA;IADvB;AACY,CAAA,EAAA,WAAW,CAuJvB;;;;"}
|
|
1
|
+
{"version":3,"file":"split-button.js","sources":["../../src/split-button/split-button.ts"],"sourcesContent":["import { html, LitElement } from 'lit';\nimport { property, query } from 'lit/decorators.js';\nimport { classMap } from 'lit/directives/class-map.js';\nimport IndividualComponent from '@/IndividualComponent.js';\nimport { I18nController } from '@/__internal/i18n/i18n-controller.js';\nimport { MenuTriggerController } from '@/__internal/menu-trigger-controller.js';\nimport type { OverlayPlacement } from '@/__internal/utils/placement.js';\nimport styles from './split-button.scss';\nimport colorStyles from './split-button-colors.scss';\nimport sizeStyles from './split-button-sizes.scss';\nimport type { Menu, MenuFocusTarget } from '../menu/menu/menu.js';\n\n/**\n * @label Split Button\n * @tag wc-split-button\n * @rawTag split-button\n *\n * @summary A button for a default action joined to an arrow that opens a menu of related actions.\n * @overview\n * <p>The main button runs the default action; the arrow beside it opens a menu of related actions.</p>\n *\n * @cssprop --split-button-container-shape: Radius of the split button's outer corners. Defaults to fully round; the inner corners follow the M3 size tokens.\n * @cssprop --split-button-gap: Space between the main button and the menu button. Defaults to 2px.\n *\n * @cssprop --filled-split-button-container-color: Color of the filled split button container.\n * @cssprop --filled-split-button-label-text-color: Text color of the filled split button label.\n *\n * @cssprop --outlined-split-button-container-color: Color of the outlined split button container.\n * @cssprop --outlined-split-button-label-text-color: Text color of the outlined split button label.\n *\n * @cssprop --tonal-split-button-container-color: Color of the tonal split button container.\n * @cssprop --tonal-split-button-label-text-color: Text color of the tonal split button label.\n *\n * @cssprop --elevated-split-button-container-color: Color of the elevated split button container.\n * @cssprop --elevated-split-button-label-text-color: Text color of the elevated split button label.\n *\n * @fires {MouseEvent} click - Dispatched when the primary action button is clicked.\n * @fires {CustomEvent} open - Dispatched after the menu opens.\n * @fires {CustomEvent<{reason: 'escape' | 'light-dismiss' | 'action' | 'api'}>} close - Dispatched after the menu closes: an item pick is `action`, Escape `escape`, a press outside or Tab `light-dismiss`, `close()` or the primary action `api`.\n *\n * @example\n * ```html\n * <wc-split-button>\n * Save\n * <wc-menu-item slot=\"menu\">Save as draft</wc-menu-item>\n * <wc-menu-item slot=\"menu\">Save and publish</wc-menu-item>\n * </wc-split-button>\n * ```\n * @tags controls\n */\n@IndividualComponent\nexport class SplitButton extends LitElement {\n static override styles = [styles, colorStyles, sizeStyles];\n\n /**\n * Button size.\n * Possible values are `\"xs\"`, `\"sm\"`, `\"md\"`, `\"lg\"`, `\"xl\"`. Defaults to `\"sm\"`.\n */\n @property({ reflect: true }) size: 'xs' | 'sm' | 'md' | 'lg' | 'xl' = 'sm';\n\n /**\n * The visual style of the split button.\n *\n * Possible variant values:\n * `\"filled\"` is a filled button.\n * `\"outlined\"` is an outlined button.\n * `\"tonal\"` is a light color button.\n * `\"elevated\"` is a raised button on a low surface.\n */\n @property({ reflect: true }) variant:\n | 'filled'\n | 'tonal'\n | 'elevated'\n | 'outlined' = 'filled';\n\n /**\n * Defines the primary color of the split button.\n */\n @property({ reflect: true }) color:\n | 'primary'\n | 'secondary'\n | 'tertiary'\n | 'success'\n | 'danger'\n | 'warning'\n | 'surface'\n | 'on-surface' = 'primary';\n\n /**\n * Whether the split button is disabled.\n */\n @property({ type: Boolean, reflect: true }) disabled = false;\n\n /** Visual variant of the menu: one surface (`\"standard\"`) or segmented groups (`\"expressive\"`). */\n @property({ attribute: 'menu-variant' }) menuVariant:\n | 'standard'\n | 'expressive' = 'standard';\n\n /**\n * Where the menu opens relative to the button: `top`, `bottom`, `start` or `end`, optionally\n * followed by `-start` or `-end` (ADR-030001). `start` and `end` follow the writing direction.\n * Defaults to `\"bottom-end\"`.\n */\n @property({ reflect: true }) placement: OverlayPlacement = 'bottom-end';\n\n @query('wc-menu') private readonly _menu?: Menu;\n\n /** Peacock's strings for the menu trigger label. */\n private readonly i18n = new I18nController(this);\n\n /** Opens and closes the menu and fires `open` / `close`. */\n private readonly _trigger = new MenuTriggerController(this, {\n menu: () => this._menu,\n disabled: () => this.disabled,\n idPrefix: 'split-menu',\n });\n\n override focus() {\n const btn = this.shadowRoot?.querySelector<HTMLElement>('.action-button');\n btn?.focus();\n }\n\n /** Opens the menu and focuses its first (or last) item. */\n show(focusTarget: MenuFocusTarget = 'first') {\n this._trigger.show(focusTarget);\n }\n\n /** Closes the menu. */\n close() {\n this._trigger.close();\n }\n\n private _onActionClick(event: MouseEvent) {\n if (this.disabled) {\n event.stopImmediatePropagation();\n event.preventDefault();\n return;\n }\n\n // The primary action closes the menu if it is open.\n if (this._menu?.open) {\n this._trigger.close();\n }\n }\n\n override render() {\n const actionClasses = {\n 'action-button': true,\n disabled: this.disabled,\n };\n\n const dropdownClasses = {\n 'dropdown-trigger': true,\n active: this._trigger.open,\n disabled: this.disabled,\n };\n\n const containerClasses = {\n 'split-button': true,\n [`variant-${this.variant}`]: true,\n disabled: this.disabled,\n };\n\n return html`\n <div class=${classMap(containerClasses)}>\n <wc-button\n class=${classMap(actionClasses)}\n size=${this.size}\n variant=${this.variant}\n ?disabled=${this.disabled}\n @click=${this._onActionClick}\n >\n <slot></slot>\n </wc-button>\n\n <wc-icon-button\n class=${classMap(dropdownClasses)}\n size=${this.size}\n variant=${this.variant}\n ?disabled=${this.disabled}\n aria-label=${this.i18n.t('openSplitButtonMenu')}\n aria-haspopup=\"menu\"\n aria-expanded=${String(this._trigger.open)}\n @click=${this._trigger.handleTriggerClick}\n @keydown=${this._trigger.handleTriggerKeyDown}\n >\n <wc-icon\n class=\"dropdown-icon\"\n name=\"keyboard_arrow_down\"\n aria-hidden=\"true\"\n ></wc-icon>\n </wc-icon-button>\n </div>\n\n <wc-menu\n id=${this._trigger.menuId}\n .placement=${this.placement}\n variant=${this.menuVariant}\n @open=${this._trigger.handleMenuOpen}\n @close=${this._trigger.handleMenuClose}\n >\n <slot name=\"menu\"></slot>\n </wc-menu>\n `;\n }\n}\n"],"names":["LitElement","html","classMap","styles","colorStyles","sizeStyles","property","query"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAYA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAqCG;AAEI,IAAM,WAAW,GAAjB,MAAM,WAAY,SAAQA,GAAU,CAAA;AAApC,IAAA,WAAA,GAAA;;AAGL;;;AAGG;QAC0B,IAAA,CAAA,IAAI,GAAqC,IAAI;AAE1E;;;;;;;;AAQG;QAC0B,IAAA,CAAA,OAAO,GAInB,QAAQ;AAEzB;;AAEG;QAC0B,IAAA,CAAA,KAAK,GAQf,SAAS;AAE5B;;AAEG;QACyC,IAAA,CAAA,QAAQ,GAAG,KAAK;;QAGnB,IAAA,CAAA,WAAW,GAEjC,UAAU;AAE7B;;;;AAIG;QAC0B,IAAA,CAAA,SAAS,GAAqB,YAAY;;AAKtD,QAAA,IAAA,CAAA,IAAI,GAAG,IAAI,cAAc,CAAC,IAAI,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,EAAA,MAAA,CAAA;AAKG,UAAA,CAAA;AAA5B,IAAAA,CAAQ,CAAC,EAAE,OAAO,EAAE,IAAI,EAAE;AAQE,CAAA,EAAA,WAAA,CAAA,SAAA,EAAA,OAAA,EAAA,MAAA,CAAA;AAKe,UAAA,CAAA;IAA3CA,CAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE;AAAmB,CAAA,EAAA,WAAA,CAAA,SAAA,EAAA,UAAA,EAAA,MAAA,CAAA;AAGpB,UAAA,CAAA;AAAxC,IAAAA,CAAQ,CAAC,EAAE,SAAS,EAAE,cAAc,EAAE;AAET,CAAA,EAAA,WAAA,CAAA,SAAA,EAAA,aAAA,EAAA,MAAA,CAAA;AAOD,UAAA,CAAA;AAA5B,IAAAA,CAAQ,CAAC,EAAE,OAAO,EAAE,IAAI,EAAE;AAA6C,CAAA,EAAA,WAAA,CAAA,SAAA,EAAA,WAAA,EAAA,MAAA,CAAA;AAErC,UAAA,CAAA;IAAlCC,CAAK,CAAC,SAAS;AAAgC,CAAA,EAAA,WAAA,CAAA,SAAA,EAAA,OAAA,EAAA,MAAA,CAAA;AAtDrC,WAAW,GAAA,UAAA,CAAA;IADvB;AACY,CAAA,EAAA,WAAW,CA0JvB;;;;"}
|
|
@@ -67,10 +67,12 @@ export declare class SuggestionController implements ReactiveController {
|
|
|
67
67
|
/**
|
|
68
68
|
* The Suggested badge with its clear button, while the suggestion shows. With `withReason` the
|
|
69
69
|
* badge carries the reason in its tooltip, for controls that have no helper text to show it in.
|
|
70
|
+
* With `iconOnly` it shows just the sparkle, for a field too narrow for the label.
|
|
70
71
|
*/
|
|
71
72
|
badge(options?: {
|
|
72
73
|
slot?: string;
|
|
73
74
|
withReason?: boolean;
|
|
75
|
+
iconOnly?: boolean;
|
|
74
76
|
}): TemplateResult | typeof nothing;
|
|
75
77
|
private write;
|
|
76
78
|
private changed;
|
|
@@ -14,7 +14,6 @@ export declare const defaultStrings: {
|
|
|
14
14
|
disabled: string;
|
|
15
15
|
readOnly: string;
|
|
16
16
|
dragToReorder: string;
|
|
17
|
-
readOnlyTag: string;
|
|
18
17
|
intentNote: string;
|
|
19
18
|
intentInfo: string;
|
|
20
19
|
intentSuccess: string;
|
|
@@ -920,6 +919,12 @@ export declare const defaultStrings: {
|
|
|
920
919
|
/** Who wrote a message, read before it. */
|
|
921
920
|
chatYou: string;
|
|
922
921
|
chatAssistant: string;
|
|
922
|
+
/** Who wrote a message from another person, when it has no `author`. */
|
|
923
|
+
chatParticipant: string;
|
|
924
|
+
/** Where a message came from, for example "via Teams". */
|
|
925
|
+
chatVia: (channel: string) => string;
|
|
926
|
+
/** Accessible name of the quick replies under a message. */
|
|
927
|
+
chatQuickReplies: string;
|
|
923
928
|
chatCopy: string;
|
|
924
929
|
chatRegenerate: string;
|
|
925
930
|
chatGoodAnswer: string;
|
|
@@ -10,17 +10,22 @@ export interface MenuTriggerOptions {
|
|
|
10
10
|
}
|
|
11
11
|
/**
|
|
12
12
|
* The menu wiring shared by buttons that open a `wc-menu` (dropdown button, split button):
|
|
13
|
-
* show / close / toggle, Arrow Up / Down on the trigger, the trigger's
|
|
14
|
-
* `aria-expanded
|
|
13
|
+
* show / close / toggle, Arrow Up / Down on the trigger, the open state behind the trigger's
|
|
14
|
+
* `aria-expanded`, and the host's `open` / `close` events (ADR-030001).
|
|
15
15
|
*
|
|
16
16
|
* The menu's own `open` / `close` events are stopped inside the host, which fires its own `open`
|
|
17
|
-
* and `close` instead; `close` carries `detail.reason` from the menu's close event. The host
|
|
18
|
-
*
|
|
19
|
-
*
|
|
17
|
+
* and `close` instead; `close` carries `detail.reason` from the menu's close event. The host
|
|
18
|
+
* renders the menu with `id=${trigger.menuId}`, `@open=${trigger.handleMenuOpen}` and
|
|
19
|
+
* `@close=${trigger.handleMenuClose}`, and the trigger button with `aria-haspopup="menu"`,
|
|
20
|
+
* `aria-expanded=${String(trigger.open)}`, `@click=${trigger.handleTriggerClick}` and
|
|
20
21
|
* `@keydown=${trigger.handleTriggerKeyDown}`.
|
|
22
|
+
*
|
|
23
|
+
* Add `aria-controls=${trigger.menuId}` only when the trigger is a native `<button>` in the same
|
|
24
|
+
* shadow root as the menu. A `wc-button` or `wc-icon-button` renders its `<button>` in its own
|
|
25
|
+
* shadow root, where an ID reference to the menu cannot resolve, so leave `aria-controls` off it.
|
|
21
26
|
*/
|
|
22
27
|
export declare class MenuTriggerController {
|
|
23
|
-
/** Id for the menu,
|
|
28
|
+
/** Id for the menu, for the `aria-controls` of a native trigger in the same shadow root. */
|
|
24
29
|
readonly menuId: string;
|
|
25
30
|
private readonly host;
|
|
26
31
|
private readonly options;
|
|
@@ -28,8 +33,6 @@ export declare class MenuTriggerController {
|
|
|
28
33
|
constructor(host: ReactiveControllerHost & HTMLElement, options: MenuTriggerOptions);
|
|
29
34
|
/** Whether the menu is open, as last reported by its `open` / `close` events. */
|
|
30
35
|
get open(): boolean;
|
|
31
|
-
/** ARIA for the trigger button. */
|
|
32
|
-
get triggerAria(): Record<string, string>;
|
|
33
36
|
/** Opens the menu, anchored to the host, and focuses its first (or last) item. */
|
|
34
37
|
show(focusTarget?: MenuFocusTarget): void;
|
|
35
38
|
/** Closes the menu. */
|
|
@@ -53,6 +53,8 @@ export default abstract class RichTextInput extends BaseInput implements RichTex
|
|
|
53
53
|
debounce: number;
|
|
54
54
|
/** Hides the fixed toolbar; formatting stays available from the selection bubble, `/` and shortcuts. */
|
|
55
55
|
hideToolbar: boolean;
|
|
56
|
+
/** Shows a "Read only" badge in the toolbar while the editor is read-only or disabled. Not shown with `hide-toolbar`. */
|
|
57
|
+
showReadonlyBadge: boolean;
|
|
56
58
|
/** Maximum number of characters of text. Typing stops there, and a count shows below. */
|
|
57
59
|
maxlength?: number;
|
|
58
60
|
/** Height of the empty editor, in lines. */
|
|
@@ -151,8 +153,11 @@ export default abstract class RichTextInput extends BaseInput implements RichTex
|
|
|
151
153
|
protected renderTools(editor: Editor): TemplateResult;
|
|
152
154
|
/** Keeps the editor's selection when a tool is pressed. */
|
|
153
155
|
protected keepSelection: (event: MouseEvent) => void;
|
|
156
|
+
/**
|
|
157
|
+
* The toolbar. A read-only or disabled editor shows no formatting tools, which could do
|
|
158
|
+
* nothing: only View source, and the "Read only" badge with `show-readonly-badge`.
|
|
159
|
+
*/
|
|
154
160
|
private renderToolbar;
|
|
155
|
-
protected renderStateTag(): typeof nothing | TemplateResult<1>;
|
|
156
161
|
/** The count below the field, with `maxlength`. */
|
|
157
162
|
private textCount;
|
|
158
163
|
/**
|
|
@@ -51,6 +51,11 @@ export declare function formatRelativeTime(date: Date | number, locale: string,
|
|
|
51
51
|
export declare function formatAbsoluteTime(date: Date | number, locale: string): string;
|
|
52
52
|
/** `date` as a short date in `locale`: "Nov 2" in the current year, else "Nov 2, 2025". */
|
|
53
53
|
export declare function formatAbsoluteDate(date: Date | number, locale: string, now?: number): string;
|
|
54
|
+
/**
|
|
55
|
+
* `date` as a clock time in `locale` ("9:41 AM"), with the date before it when it is not today
|
|
56
|
+
* ("Nov 2, 9:41 AM"), for timestamps in a conversation.
|
|
57
|
+
*/
|
|
58
|
+
export declare function formatClockTime(date: Date | number, locale: string, now?: number): string;
|
|
54
59
|
/**
|
|
55
60
|
* `date` relative to now ("5 minutes ago"), or, when `absoluteAfter` is set and the date is
|
|
56
61
|
* farther from now than that, an absolute date ("Nov 2").
|
|
@@ -22,6 +22,9 @@ export type AiBadgeKind = 'suggested' | 'draft' | 'generated';
|
|
|
22
22
|
* and is read as the badge's description. <code>dismissible</code> adds a clear button that fires
|
|
23
23
|
* <code>dismiss</code>; the app then removes the suggestion, discards the draft or hides the
|
|
24
24
|
* summary.</p>
|
|
25
|
+
* <p><code>icon-only</code> keeps just the sparkle where there is no room for the label, such as a
|
|
26
|
+
* narrow field: the label is still read and shows in the tooltip. Fields switch to it on their
|
|
27
|
+
* own when they are narrow.</p>
|
|
25
28
|
* <p>When AI is off for the page (<code>setPeacockAi({ enabled: false })</code>) the badge renders
|
|
26
29
|
* nothing, so a page that still passes AI state in never shows a stale marker.</p>
|
|
27
30
|
* <p>The label is always text, never only the color or the sparkle. Replace it with the default
|
|
@@ -56,6 +59,11 @@ export declare class AiBadge extends LitElement {
|
|
|
56
59
|
reason: string;
|
|
57
60
|
/** Adds a button that clears the output in one action. */
|
|
58
61
|
dismissible: boolean;
|
|
62
|
+
/**
|
|
63
|
+
* Shows only the sparkle, for tight spaces such as a narrow field. The label stays the
|
|
64
|
+
* accessible name and shows in the tooltip.
|
|
65
|
+
*/
|
|
66
|
+
iconOnly: boolean;
|
|
59
67
|
/** Per-instance string overrides. */
|
|
60
68
|
strings?: Partial<PeacockStrings>;
|
|
61
69
|
private readonly _ai;
|
|
@@ -20,6 +20,10 @@ declare const Button_base: import("../../__internal/mixins/mixin.js").MixinRetur
|
|
|
20
20
|
* @cssprop --button-container-shape-end-start - Defines the start position of the button container shape.
|
|
21
21
|
* @cssprop --button-container-shape-end-end - Defines the end position of the button container shape.
|
|
22
22
|
*
|
|
23
|
+
* @cssprop --button-container-padding - Inline padding of the button container, on both sides.
|
|
24
|
+
* @cssprop --button-container-padding-start - Inline-start padding of the button container; overrides `--button-container-padding`.
|
|
25
|
+
* @cssprop --button-container-padding-end - Inline-end padding of the button container; overrides `--button-container-padding`.
|
|
26
|
+
*
|
|
23
27
|
*
|
|
24
28
|
* @cssprop --filled-button-container-color - Color of the filled button container.
|
|
25
29
|
* @cssprop --filled-button-label-text-color - Text color of the filled button label.
|
|
@@ -1,25 +1,38 @@
|
|
|
1
1
|
import { LitElement } from 'lit';
|
|
2
2
|
import type { AiCitation } from '../__internal/ai/types.js';
|
|
3
3
|
import type { PeacockStrings } from '../__internal/i18n/strings.js';
|
|
4
|
-
/**
|
|
5
|
-
|
|
4
|
+
/**
|
|
5
|
+
* Who wrote a message: the person using the page (`user`), the assistant, or another person in
|
|
6
|
+
* the conversation (`participant`), such as a caller or a teammate.
|
|
7
|
+
*/
|
|
8
|
+
export type ChatMessageFrom = 'user' | 'assistant' | 'participant';
|
|
6
9
|
/** What the person thought of an answer; `''` for nothing. */
|
|
7
10
|
export type ChatMessageFeedback = 'up' | 'down' | '';
|
|
8
11
|
/** `detail` of `feedback`. */
|
|
9
12
|
export interface ChatMessageFeedbackDetail {
|
|
10
13
|
value: ChatMessageFeedback;
|
|
11
14
|
}
|
|
15
|
+
/** `detail` of `suggestion-select`. */
|
|
16
|
+
export interface ChatMessageSuggestionDetail {
|
|
17
|
+
value: string;
|
|
18
|
+
}
|
|
12
19
|
/**
|
|
13
20
|
* @label Chat Message
|
|
14
21
|
* @tag wc-chat-message
|
|
15
22
|
* @rawTag chat-message
|
|
16
|
-
* @summary One turn of a conversation: what the person asked, or the assistant's answer with its steps, drafts and sources.
|
|
23
|
+
* @summary One turn of a conversation: what the person asked, another person's message, or the assistant's answer with its steps, drafts and sources.
|
|
17
24
|
* @overview
|
|
18
25
|
* <p>Put messages in <code>wc-chat-thread</code>. <code>from="user"</code> shows the person's text in
|
|
19
26
|
* a bubble at the end of the line; <code>from="assistant"</code> (default) shows the answer as
|
|
20
|
-
* formatted text
|
|
21
|
-
*
|
|
22
|
-
* <code>
|
|
27
|
+
* formatted text; <code>from="participant"</code> shows another person's text, such as a caller's
|
|
28
|
+
* or a teammate's, in a quiet bubble at the start of the line, with their name above it. All take
|
|
29
|
+
* Markdown in <code>value</code>, rendered by <code>wc-markdown</code>, so mentions and
|
|
30
|
+
* <code>[1](cite:id)</code> citations work; give the sources in <code>citations</code>.</p>
|
|
31
|
+
* <p><strong>Who and when.</strong> A line above the message names <code>author</code> and adds
|
|
32
|
+
* <code>channel</code> ("via Teams") and the time of <code>datetime</code>. It shows for a
|
|
33
|
+
* participant, whenever <code>datetime</code> or <code>channel</code> is set, and when the
|
|
34
|
+
* <code>meta</code> slot has content, such as a "Work note" tag. In a one-to-one conversation with
|
|
35
|
+
* the assistant, leave them out and the messages stay bare.</p>
|
|
23
36
|
* <p>While an answer arrives, set <code>streaming</code> and keep replacing <code>value</code>. Before
|
|
24
37
|
* the first words, a typing indicator shows <code>status</code>, such as "Looking up your laptop…".
|
|
25
38
|
* Put <code>wc-assistant-steps</code> in the <code>steps</code> slot, above the text, and
|
|
@@ -27,35 +40,53 @@ export interface ChatMessageFeedbackDetail {
|
|
|
27
40
|
* <p>A finished answer has actions: copy, <strong>Try again</strong> (<code>regenerate</code>) and
|
|
28
41
|
* good or bad (<code>feedback</code>, which toggles <code>feedback</code>). <code>hide-actions</code>
|
|
29
42
|
* removes them. With <code>error</code> the message says the answer failed, with Try again.</p>
|
|
43
|
+
* <p><strong>Quick replies.</strong> <code>suggestions</code> shows the likely next moves as chips
|
|
44
|
+
* under the message ("Promote to major incident", "Why P2?"). Picking one fires
|
|
45
|
+
* <code>suggestion-select</code>; the app sends it and usually clears the list.</p>
|
|
30
46
|
* @tags display, ai
|
|
31
47
|
*
|
|
32
48
|
* @slot - Below the text, such as `wc-draft-card`s.
|
|
33
49
|
* @slot steps - Above the text, such as `wc-assistant-steps`.
|
|
34
50
|
* @slot avatar - Beside the message, such as a `wc-avatar`.
|
|
35
|
-
* @slot
|
|
51
|
+
* @slot meta - At the end of the line above the message, such as a "Work note" `wc-tag`.
|
|
52
|
+
* @slot footer - Below everything.
|
|
36
53
|
*
|
|
37
|
-
* @csspart
|
|
54
|
+
* @csspart header - The line above the message with the author, channel and time.
|
|
55
|
+
* @csspart bubble - The text bubble of the person or a participant.
|
|
38
56
|
* @csspart content - The answer's text.
|
|
39
57
|
* @csspart actions - The answer's actions.
|
|
58
|
+
* @csspart suggestions - The quick replies.
|
|
40
59
|
*
|
|
41
60
|
* @cssprop --chat-message-bubble-background - Background of the person's bubble.
|
|
42
61
|
* @cssprop --chat-message-bubble-color - Text color of the person's bubble.
|
|
62
|
+
* @cssprop --chat-message-participant-background - Background of a participant's bubble.
|
|
63
|
+
* @cssprop --chat-message-participant-color - Text color of a participant's bubble.
|
|
43
64
|
*
|
|
44
65
|
* @fires {CustomEvent<void>} regenerate - The person asked for the answer again.
|
|
45
66
|
* @fires {CustomEvent<ChatMessageFeedbackDetail>} feedback - The person rated the answer, or took the rating back (`value: ''`).
|
|
67
|
+
* @fires {CustomEvent<ChatMessageSuggestionDetail>} suggestion-select - The person picked a quick reply.
|
|
46
68
|
*
|
|
47
69
|
* @example
|
|
48
70
|
* ```html
|
|
49
71
|
* <wc-chat-message from="user" value="Will I get a loaner before Friday?"></wc-chat-message>
|
|
50
72
|
* <wc-chat-message value="Desk support has **2 loaners** free."></wc-chat-message>
|
|
51
73
|
* ```
|
|
74
|
+
* @example
|
|
75
|
+
* ```html
|
|
76
|
+
* <wc-chat-message from="participant" author="Priya Shah" channel="Teams"
|
|
77
|
+
* datetime="2026-11-08T09:41:00" value="VPN keeps dropping every ten minutes."></wc-chat-message>
|
|
78
|
+
* ```
|
|
52
79
|
*/
|
|
53
80
|
export declare class ChatMessage extends LitElement {
|
|
54
81
|
static styles: import("lit").CSSResultGroup[];
|
|
55
|
-
/** Who wrote it: the person (`user`)
|
|
82
|
+
/** Who wrote it: the person (`user`), the assistant (`assistant`, default) or another person (`participant`). */
|
|
56
83
|
from: ChatMessageFrom;
|
|
57
|
-
/** Name read before
|
|
84
|
+
/** Name shown above a participant's message and read before every message; defaults to "You", "Assistant" or "Participant". */
|
|
58
85
|
author: string;
|
|
86
|
+
/** When it was written, as an ISO 8601 date-time; shown as a time above the message. */
|
|
87
|
+
datetime: string;
|
|
88
|
+
/** Where it came from, such as "Teams"; shown as "via Teams" above the message. */
|
|
89
|
+
channel: string;
|
|
59
90
|
/** The text, as Markdown. */
|
|
60
91
|
value: string;
|
|
61
92
|
/** The answer is still arriving. Reflected, so `wc-chat-thread` can announce it once complete. */
|
|
@@ -74,15 +105,25 @@ export declare class ChatMessage extends LitElement {
|
|
|
74
105
|
feedback: ChatMessageFeedback;
|
|
75
106
|
/** Removes copy, Try again and the rating from an answer. */
|
|
76
107
|
hideActions: boolean;
|
|
108
|
+
/** Quick replies shown as chips under the message once it is complete. */
|
|
109
|
+
suggestions: string[];
|
|
110
|
+
/** Locale for the time; defaults to the nearest `lang`, else the browser's. */
|
|
111
|
+
locale?: string;
|
|
77
112
|
/** Per-instance string overrides. */
|
|
78
113
|
strings?: Partial<PeacockStrings>;
|
|
114
|
+
/** The `meta` slot has content. */
|
|
115
|
+
private _hasMeta;
|
|
79
116
|
private readonly i18n;
|
|
80
117
|
/** The name read before the message. */
|
|
81
118
|
get authorName(): string;
|
|
119
|
+
private _onMetaChange;
|
|
120
|
+
private _pick;
|
|
82
121
|
private regenerate;
|
|
83
122
|
private rate;
|
|
84
123
|
private renderText;
|
|
85
124
|
private renderError;
|
|
86
125
|
private renderActions;
|
|
126
|
+
private renderHeader;
|
|
127
|
+
private renderSuggestions;
|
|
87
128
|
render(): import("lit-html").TemplateResult<1>;
|
|
88
129
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export { ChatMessage, type ChatMessageFrom, type ChatMessageFeedback, type ChatMessageFeedbackDetail, } from './chat-message.js';
|
|
1
|
+
export { ChatMessage, type ChatMessageFrom, type ChatMessageFeedback, type ChatMessageFeedbackDetail, type ChatMessageSuggestionDetail, } from './chat-message.js';
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { LitElement } from 'lit';
|
|
2
|
+
/**
|
|
3
|
+
* @label Chat Event
|
|
4
|
+
* @tag wc-chat-event
|
|
5
|
+
* @rawTag chat-event
|
|
6
|
+
* @summary A line in a conversation for something that happened rather than something said, such as "Alan Kay confirmed the rollback".
|
|
7
|
+
* @overview
|
|
8
|
+
* <p>Goes in <code>wc-chat-thread</code> between <code>wc-chat-message</code>s. It records what
|
|
9
|
+
* happened to the conversation's subject: a person confirmed a draft, a record changed state,
|
|
10
|
+
* someone joined. The content is the sentence; <code>icon</code> sets the glyph before it, and
|
|
11
|
+
* <code>datetime</code> adds the time after it.</p>
|
|
12
|
+
* <p>Use a message for anything someone wrote, and an event for anything the platform recorded.
|
|
13
|
+
* Events are not announced as they arrive; the record they describe is what changed.</p>
|
|
14
|
+
* @tags display, ai
|
|
15
|
+
*
|
|
16
|
+
* @slot - What happened. Bold the name of who did it with `<strong>`.
|
|
17
|
+
*
|
|
18
|
+
* @csspart event - The line.
|
|
19
|
+
*
|
|
20
|
+
* @example
|
|
21
|
+
* ```html
|
|
22
|
+
* <wc-chat-event icon="verified" datetime="2026-11-08T10:07:00">
|
|
23
|
+
* <strong>Alan Kay</strong> confirmed the rollback · policy NET-04
|
|
24
|
+
* </wc-chat-event>
|
|
25
|
+
* ```
|
|
26
|
+
*/
|
|
27
|
+
export declare class ChatEvent extends LitElement {
|
|
28
|
+
static styles: import("lit").CSSResultGroup[];
|
|
29
|
+
/** Material Symbols name of the glyph before the text, such as `verified`. */
|
|
30
|
+
icon: string;
|
|
31
|
+
/** When it happened, as an ISO 8601 date-time; shown as a time after the text. */
|
|
32
|
+
datetime: string;
|
|
33
|
+
/** Locale for the time; defaults to the nearest `lang`, else the browser's. */
|
|
34
|
+
locale?: string;
|
|
35
|
+
private readonly i18n;
|
|
36
|
+
render(): import("lit-html").TemplateResult<1>;
|
|
37
|
+
}
|