@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.
Files changed (253) hide show
  1. package/dist/{BaseField-BMumJpkW.js → BaseField-D8ByB0l3.js} +40 -4
  2. package/dist/BaseField-D8ByB0l3.js.map +1 -0
  3. package/dist/{BaseInput-mWdyYv27.js → BaseInput-xCHvT4AN.js} +3 -3
  4. package/dist/BaseInput-xCHvT4AN.js.map +1 -0
  5. package/dist/ai-badge.js +32 -6
  6. package/dist/ai-badge.js.map +1 -1
  7. package/dist/ai-summary.js +2 -2
  8. package/dist/alert.js +2 -2
  9. package/dist/anchor-nav.js +2 -2
  10. package/dist/app-shell.js +2 -2
  11. package/dist/assistant-panel.js +2 -2
  12. package/dist/assistant-step.js +2 -2
  13. package/dist/assistant-steps.js +2 -2
  14. package/dist/avatar-group.js +2 -2
  15. package/dist/banner.js +2 -2
  16. package/dist/{base-progress-CvLVSjuy.js → base-progress-DxNgAQtw.js} +2 -2
  17. package/dist/{base-progress-CvLVSjuy.js.map → base-progress-DxNgAQtw.js.map} +1 -1
  18. package/dist/bottom-sheet.js +2 -2
  19. package/dist/breadcrumb.js +2 -2
  20. package/dist/button.js +11 -5
  21. package/dist/button.js.map +1 -1
  22. package/dist/calendar.js +2 -2
  23. package/dist/{canvas-base-BTQMEVn_.js → canvas-base-DHKf2CmA.js} +2 -2
  24. package/dist/{canvas-base-BTQMEVn_.js.map → canvas-base-DHKf2CmA.js.map} +1 -1
  25. package/dist/{cartesian-chart-DM1FC_XT.js → cartesian-chart-G6VX1aKk.js} +2 -2
  26. package/dist/{cartesian-chart-DM1FC_XT.js.map → cartesian-chart-G6VX1aKk.js.map} +1 -1
  27. package/dist/{cb-group-base-B6fa4Lll.js → cb-group-base-CZLzCnXK.js} +2 -2
  28. package/dist/{cb-group-base-B6fa4Lll.js.map → cb-group-base-CZLzCnXK.js.map} +1 -1
  29. package/dist/cb-group.js +3 -3
  30. package/dist/cb-rule.js +3 -3
  31. package/dist/chart-area.js +4 -4
  32. package/dist/chart-bar.js +4 -4
  33. package/dist/{chart-base-Dhxuw_Mw.js → chart-base-DREru2P0.js} +2 -2
  34. package/dist/{chart-base-Dhxuw_Mw.js.map → chart-base-DREru2P0.js.map} +1 -1
  35. package/dist/chart-doughnut.js +3 -3
  36. package/dist/chart-line.js +4 -4
  37. package/dist/chart-pie.js +3 -3
  38. package/dist/chat-event.js +152 -0
  39. package/dist/chat-event.js.map +1 -0
  40. package/dist/chat-message.js +195 -19
  41. package/dist/chat-message.js.map +1 -1
  42. package/dist/chat-thread.js +26 -9
  43. package/dist/chat-thread.js.map +1 -1
  44. package/dist/checkbox-group.js +4 -4
  45. package/dist/checkbox.js +4 -4
  46. package/dist/chip-set.js +3 -3
  47. package/dist/chip.js +2 -2
  48. package/dist/circular-progress.js +3 -3
  49. package/dist/citation.js +2 -2
  50. package/dist/code-editor.js +4 -4
  51. package/dist/code-highlighter.js +2 -2
  52. package/dist/color-field.js +5 -5
  53. package/dist/color-picker.js +2 -2
  54. package/dist/command-palette.js +2 -2
  55. package/dist/comment-composer.js +25 -13
  56. package/dist/comment-composer.js.map +1 -1
  57. package/dist/condition-builder.js +3 -3
  58. package/dist/confirm-dialog.js +2 -2
  59. package/dist/copy-button.js +2 -2
  60. package/dist/currency-field.js +5 -5
  61. package/dist/custom-elements-jsdocs.json +228 -22
  62. package/dist/custom-elements.json +1255 -110
  63. package/dist/date-field.js +6 -6
  64. package/dist/date-picker.js +2 -2
  65. package/dist/date-range-field.js +6 -6
  66. package/dist/datetime-field.js +6 -6
  67. package/dist/dependency-map.js +3 -3
  68. package/dist/description-item.js +2 -2
  69. package/dist/description-list.js +2 -2
  70. package/dist/{diagram-2r11KySs.js → diagram-CHF70xTL.js} +2 -2
  71. package/dist/{diagram-2r11KySs.js.map → diagram-CHF70xTL.js.map} +1 -1
  72. package/dist/diagram-controls.js +2 -2
  73. package/dist/diagram-minimap.js +2 -2
  74. package/dist/diagram.js +4 -4
  75. package/dist/diff-viewer.js +2 -2
  76. package/dist/discussion-activity.js +4 -4
  77. package/dist/discussion-comment.js +4 -4
  78. package/dist/{discussion-time-BegaYfhf.js → discussion-time-DqykqvNy.js} +2 -2
  79. package/dist/{discussion-time-BegaYfhf.js.map → discussion-time-DqykqvNy.js.map} +1 -1
  80. package/dist/discussion.js +7 -7
  81. package/dist/{document-editor-BnEugM3E.js → document-editor-Cb9fCxvA.js} +22 -10
  82. package/dist/{document-editor-BnEugM3E.js.map → document-editor-Cb9fCxvA.js.map} +1 -1
  83. package/dist/document-editor.js +3 -3
  84. package/dist/draft-card.js +14 -4
  85. package/dist/draft-card.js.map +1 -1
  86. package/dist/dropdown-button.js +3 -2
  87. package/dist/dropdown-button.js.map +1 -1
  88. package/dist/erd.js +3 -3
  89. package/dist/file-upload.js +4 -4
  90. package/dist/filter-bar.js +2 -2
  91. package/dist/flow.js +4 -4
  92. package/dist/form.js +3 -3
  93. package/dist/{generative-view-BgOcLRXr.js → generative-view-C4fJ2zI7.js} +2 -2
  94. package/dist/{generative-view-BgOcLRXr.js.map → generative-view-C4fJ2zI7.js.map} +1 -1
  95. package/dist/generative-view.js +3 -3
  96. package/dist/html-editor.js +30 -13
  97. package/dist/html-editor.js.map +1 -1
  98. package/dist/{i18n-controller-Cp43HjJl.js → i18n-controller-CH4e9sju.js} +2 -2
  99. package/dist/{i18n-controller-Cp43HjJl.js.map → i18n-controller-CH4e9sju.js.map} +1 -1
  100. package/dist/icon-button.js +7 -5
  101. package/dist/icon-button.js.map +1 -1
  102. package/dist/image.js +2 -2
  103. package/dist/index.js +21 -20
  104. package/dist/index.js.map +1 -1
  105. package/dist/inline-edit.js +2 -2
  106. package/dist/input.js +4 -4
  107. package/dist/json-viewer.js +2 -2
  108. package/dist/kanban.js +2 -2
  109. package/dist/kbd.js +2 -2
  110. package/dist/linear-progress.js +3 -3
  111. package/dist/link-button.js +7 -5
  112. package/dist/link-button.js.map +1 -1
  113. package/dist/listbox.js +3 -3
  114. package/dist/loader-full.js +13 -12
  115. package/dist/loader-full.js.map +1 -1
  116. package/dist/loader.js +16 -12
  117. package/dist/loader.js.map +1 -1
  118. package/dist/markdown-editor.js +30 -13
  119. package/dist/markdown-editor.js.map +1 -1
  120. package/dist/mention-input.js +5 -5
  121. package/dist/{menu-trigger-controller-DyLpTxM7.js → menu-trigger-controller-CEJq1ugC.js} +11 -14
  122. package/dist/menu-trigger-controller-CEJq1ugC.js.map +1 -0
  123. package/dist/modal.js +2 -2
  124. package/dist/navigation-bar.js +2 -2
  125. package/dist/navigation-drawer.js +2 -2
  126. package/dist/navigation-rail.js +2 -2
  127. package/dist/notification-center.js +3 -3
  128. package/dist/number-field.js +5 -5
  129. package/dist/page-header.js +2 -2
  130. package/dist/pagination.js +2 -2
  131. package/dist/password-field.js +5 -5
  132. package/dist/password-rules.js +2 -2
  133. package/dist/phone-field.js +5 -5
  134. package/dist/{picker-field-dTlIMAQn.js → picker-field-loXW-xrW.js} +3 -3
  135. package/dist/{picker-field-dTlIMAQn.js.map → picker-field-loXW-xrW.js.map} +1 -1
  136. package/dist/pin-input.js +5 -5
  137. package/dist/presence-indicator.js +2 -2
  138. package/dist/prompt-input.js +25 -13
  139. package/dist/prompt-input.js.map +1 -1
  140. package/dist/radio-group.js +1 -1
  141. package/dist/radio.js +4 -4
  142. package/dist/rating.js +4 -4
  143. package/dist/redvars-loader.js +2 -2
  144. package/dist/{relative-time-BVQXLuHm.js → relative-time-BNxqvEbg.js} +13 -2
  145. package/dist/relative-time-BNxqvEbg.js.map +1 -0
  146. package/dist/relative-time.js +3 -3
  147. package/dist/resizable-panels.js +2 -2
  148. package/dist/{rich-text-input-DM_BOzgk.js → rich-text-input-B5j0eqCJ.js} +21 -18
  149. package/dist/rich-text-input-B5j0eqCJ.js.map +1 -0
  150. package/dist/{schema-B8g30A_n.js → schema-BJzlGRP1.js} +2 -2
  151. package/dist/{schema-B8g30A_n.js.map → schema-BJzlGRP1.js.map} +1 -1
  152. package/dist/search.js +4 -4
  153. package/dist/select.js +5 -5
  154. package/dist/side-sheet.js +2 -2
  155. package/dist/signature-pad.js +4 -4
  156. package/dist/slider.js +4 -4
  157. package/dist/snackbar.js +2 -2
  158. package/dist/sparkline.js +2 -2
  159. package/dist/split-button.js +109 -21
  160. package/dist/split-button.js.map +1 -1
  161. package/dist/src/__internal/ai/suggestion-controller.d.ts +2 -0
  162. package/dist/src/__internal/i18n/strings.d.ts +6 -1
  163. package/dist/src/__internal/menu-trigger-controller.d.ts +11 -8
  164. package/dist/src/__internal/rich-text/rich-text-input.d.ts +6 -1
  165. package/dist/src/__internal/utils/relative-time.d.ts +5 -0
  166. package/dist/src/ai-badge/ai-badge.d.ts +8 -0
  167. package/dist/src/button/button/button.d.ts +4 -0
  168. package/dist/src/chat-message/chat-message.d.ts +51 -10
  169. package/dist/src/chat-message/index.d.ts +1 -1
  170. package/dist/src/chat-thread/chat-event.d.ts +37 -0
  171. package/dist/src/chat-thread/chat-thread.d.ts +7 -4
  172. package/dist/src/chat-thread/index.d.ts +1 -0
  173. package/dist/src/html-editor/html-editor.d.ts +5 -0
  174. package/dist/src/index.d.ts +2 -2
  175. package/dist/src/input/BaseField.d.ts +12 -1
  176. package/dist/src/input/BaseInput.d.ts +1 -0
  177. package/dist/src/markdown-editor/markdown-editor.d.ts +5 -0
  178. package/dist/src/split-button/split-button.d.ts +7 -2
  179. package/dist/src/textarea/textarea.d.ts +2 -0
  180. package/dist/stat.js +2 -2
  181. package/dist/status-indicator.js +2 -2
  182. package/dist/step.js +2 -2
  183. package/dist/stepper.js +2 -2
  184. package/dist/{strings-BJPuhKJk.js → strings-o6v6Hrmn.js} +7 -2
  185. package/dist/strings-o6v6Hrmn.js.map +1 -0
  186. package/dist/{suggestion-controller-CW17adxd.js → suggestion-controller-7YRQqkaI.js} +3 -1
  187. package/dist/{suggestion-controller-CW17adxd.js.map → suggestion-controller-7YRQqkaI.js.map} +1 -1
  188. package/dist/svg.js +2 -2
  189. package/dist/switch.js +4 -4
  190. package/dist/table.js +50 -11
  191. package/dist/table.js.map +1 -1
  192. package/dist/textarea.js +10 -5
  193. package/dist/textarea.js.map +1 -1
  194. package/dist/time-field.js +6 -6
  195. package/dist/time-picker.js +2 -2
  196. package/dist/timeline-item.js +2 -2
  197. package/dist/timeline.js +2 -2
  198. package/dist/{toggle-base-BlaHalfS.js → toggle-base-BSzBnLZN.js} +2 -2
  199. package/dist/{toggle-base-BlaHalfS.js.map → toggle-base-BSzBnLZN.js.map} +1 -1
  200. package/dist/tour.js +2 -2
  201. package/dist/transfer-list.js +4 -4
  202. package/dist/tree-chart.js +3 -3
  203. package/dist/tree-item.js +2 -2
  204. package/dist/tree.js +2 -2
  205. package/dist/tsconfig.tsbuildinfo +1 -1
  206. package/dist/typing-indicator.js +2 -2
  207. package/dist/url-field.js +5 -5
  208. package/dist/user-menu.js +3 -3
  209. package/dist/virtual-list.js +2 -2
  210. package/dist/workflow-timeline.js +2 -2
  211. package/dist/workflow.js +3 -3
  212. package/dist/workspace-switcher.js +3 -3
  213. package/package.json +1 -1
  214. package/src/__internal/ai/suggestion-controller.ts +3 -1
  215. package/src/__internal/i18n/strings.ts +6 -1
  216. package/src/__internal/menu-trigger-controller.ts +11 -15
  217. package/src/__internal/rich-text/editor-chrome.scss +27 -10
  218. package/src/__internal/rich-text/rich-text-input.ts +17 -16
  219. package/src/__internal/utils/relative-time.ts +20 -0
  220. package/src/ai-badge/ai-badge.scss +8 -0
  221. package/src/ai-badge/ai-badge.ts +21 -4
  222. package/src/button/button/button-base.scss +9 -2
  223. package/src/button/button/button-layers.scss +3 -1
  224. package/src/button/button/button.ts +4 -0
  225. package/src/chat-message/chat-message.scss +72 -0
  226. package/src/chat-message/chat-message.ts +137 -18
  227. package/src/chat-message/index.ts +1 -0
  228. package/src/chat-thread/chat-event.scss +36 -0
  229. package/src/chat-thread/chat-event.ts +79 -0
  230. package/src/chat-thread/chat-thread.scss +4 -1
  231. package/src/chat-thread/chat-thread.ts +22 -6
  232. package/src/chat-thread/index.ts +1 -0
  233. package/src/draft-card/draft-card.scss +16 -2
  234. package/src/dropdown-button/dropdown-button.ts +2 -1
  235. package/src/html-editor/html-editor.ts +5 -0
  236. package/src/index.ts +2 -1
  237. package/src/input/BaseField.ts +42 -2
  238. package/src/input/BaseInput.ts +1 -1
  239. package/src/loader.ts +4 -0
  240. package/src/markdown-editor/markdown-editor.ts +5 -0
  241. package/src/split-button/split-button-colors.scss +9 -0
  242. package/src/split-button/split-button-sizes.scss +32 -5
  243. package/src/split-button/split-button.scss +61 -8
  244. package/src/split-button/split-button.ts +15 -8
  245. package/src/table/table.scss +57 -9
  246. package/src/table/table.ts +3 -1
  247. package/src/textarea/textarea.ts +7 -0
  248. package/dist/BaseField-BMumJpkW.js.map +0 -1
  249. package/dist/BaseInput-mWdyYv27.js.map +0 -1
  250. package/dist/menu-trigger-controller-DyLpTxM7.js.map +0 -1
  251. package/dist/relative-time-BVQXLuHm.js.map +0 -1
  252. package/dist/rich-text-input-DM_BOzgk.js.map +0 -1
  253. package/dist/strings-BJPuhKJk.js.map +0 -1
@@ -1,7 +1,7 @@
1
1
  import { i, _ as __decorate, I as IndividualComponent, a as i$1, b } from './IndividualComponent-BK7XZjE2.js';
2
2
  import { n } from './property-B2TG3KEE.js';
3
- import { I as I18nController } from './i18n-controller-Cp43HjJl.js';
4
- import './strings-BJPuhKJk.js';
3
+ import { I as I18nController } from './i18n-controller-CH4e9sju.js';
4
+ import './strings-o6v6Hrmn.js';
5
5
  import './locale-DEsJZCQG.js';
6
6
 
7
7
  var css_248z = i`* {
package/dist/url-field.js CHANGED
@@ -3,16 +3,16 @@ import { n } from './property-B2TG3KEE.js';
3
3
  import { r } from './state-BCeDVCI9.js';
4
4
  import { e } from './query-CHb9Ft_d.js';
5
5
  import { s as spread } from './spread-B5cgadZl.js';
6
- import { I as I18nController } from './i18n-controller-Cp43HjJl.js';
7
- import { B as BaseField } from './BaseField-BMumJpkW.js';
8
- import { n as nativeValidity } from './BaseInput-mWdyYv27.js';
6
+ import { I as I18nController } from './i18n-controller-CH4e9sju.js';
7
+ import { B as BaseField } from './BaseField-D8ByB0l3.js';
8
+ import { n as nativeValidity } from './BaseInput-xCHvT4AN.js';
9
9
  import './base-Cl6v8-BZ.js';
10
10
  import './directive-ZPhl09Yt.js';
11
- import './strings-BJPuhKJk.js';
11
+ import './strings-o6v6Hrmn.js';
12
12
  import './locale-DEsJZCQG.js';
13
13
  import './element-internals-QME0yEz4.js';
14
14
  import './form-associated-BHbg72PG.js';
15
- import './suggestion-controller-CW17adxd.js';
15
+ import './suggestion-controller-7YRQqkaI.js';
16
16
  import './ai-controller-DR_Tg0sN.js';
17
17
 
18
18
  var css_248z = i`* {
package/dist/user-menu.js CHANGED
@@ -2,10 +2,10 @@ import { i, _ as __decorate, I as IndividualComponent, a as i$1, A, b } from './
2
2
  import { n } from './property-B2TG3KEE.js';
3
3
  import { r } from './state-BCeDVCI9.js';
4
4
  import { e } from './query-CHb9Ft_d.js';
5
- import { I as I18nController } from './i18n-controller-Cp43HjJl.js';
6
- import { M as MenuTriggerController } from './menu-trigger-controller-DyLpTxM7.js';
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
- import './strings-BJPuhKJk.js';
8
+ import './strings-o6v6Hrmn.js';
9
9
  import './locale-DEsJZCQG.js';
10
10
 
11
11
  var css_248z = i`* {
@@ -2,11 +2,11 @@ import { i, _ as __decorate, I as IndividualComponent, a as i$1, D, A, b } from
2
2
  import { n } from './property-B2TG3KEE.js';
3
3
  import { r } from './state-BCeDVCI9.js';
4
4
  import { c } from './repeat-D_ERDRYT.js';
5
- import { I as I18nController } from './i18n-controller-Cp43HjJl.js';
5
+ import { I as I18nController } from './i18n-controller-CH4e9sju.js';
6
6
  import { v as virtualWindow } from './virtual-window-5OYyIqZh.js';
7
7
  import './directive-ZPhl09Yt.js';
8
8
  import './directive-helpers-Bx3mu42O.js';
9
- import './strings-BJPuhKJk.js';
9
+ import './strings-o6v6Hrmn.js';
10
10
  import './locale-DEsJZCQG.js';
11
11
 
12
12
  var css_248z = i`* {
@@ -1,12 +1,12 @@
1
1
  import { i, _ as __decorate, I as IndividualComponent, a as i$1, A, b } from './IndividualComponent-BK7XZjE2.js';
2
2
  import { n } from './property-B2TG3KEE.js';
3
3
  import { e } from './class-map-NDIkZErE.js';
4
- import { I as I18nController } from './i18n-controller-Cp43HjJl.js';
4
+ import { I as I18nController } from './i18n-controller-CH4e9sju.js';
5
5
  import { D as DiagramCanvasLink } from './canvas-link-CtgsALq4.js';
6
6
  import { w as walk } from './workflow-model-CauduOG2.js';
7
7
  import { f as formatDuration } from './workflow-format-BsyveyeC.js';
8
8
  import './directive-ZPhl09Yt.js';
9
- import './strings-BJPuhKJk.js';
9
+ import './strings-o6v6Hrmn.js';
10
10
  import './locale-DEsJZCQG.js';
11
11
  import './host-CZK7xhzh.js';
12
12
 
package/dist/workflow.js CHANGED
@@ -3,15 +3,15 @@ import { n } from './property-B2TG3KEE.js';
3
3
  import { r } from './state-BCeDVCI9.js';
4
4
  import { e } from './query-CHb9Ft_d.js';
5
5
  import { e as e$1 } from './class-map-NDIkZErE.js';
6
- import { D as DiagramCanvasElement, p as prefersReducedMotion, a as animateOut } from './canvas-base-BTQMEVn_.js';
6
+ import { D as DiagramCanvasElement, p as prefersReducedMotion, a as animateOut } from './canvas-base-DHKf2CmA.js';
7
7
  import { r as roundedPath } from './geometry-INg82Lxq.js';
8
8
  import { H as History } from './history-YbTSQZHj.js';
9
9
  import { W as WORKFLOW_LOGIC_STEPS, f as findStep, w as walk, i as isReached, r as replaceStep, a as removeStep, g as getList, c as createStep, b as allIds, d as insertStep, m as moveStep, l as listKey, e as cloneWithNewIds, h as contains, j as countInside, k as listTerminates, s as stepTerminates } from './workflow-model-CauduOG2.js';
10
10
  import { f as formatDuration } from './workflow-format-BsyveyeC.js';
11
11
  import './base-Cl6v8-BZ.js';
12
12
  import './directive-ZPhl09Yt.js';
13
- import './i18n-controller-Cp43HjJl.js';
14
- import './strings-BJPuhKJk.js';
13
+ import './i18n-controller-CH4e9sju.js';
14
+ import './strings-o6v6Hrmn.js';
15
15
  import './locale-DEsJZCQG.js';
16
16
  import './host-CZK7xhzh.js';
17
17
 
@@ -3,11 +3,11 @@ import { n } from './property-B2TG3KEE.js';
3
3
  import { r } from './state-BCeDVCI9.js';
4
4
  import { e } from './query-CHb9Ft_d.js';
5
5
  import { e as e$1 } from './class-map-NDIkZErE.js';
6
- import { I as I18nController } from './i18n-controller-Cp43HjJl.js';
7
- import { M as MenuTriggerController } from './menu-trigger-controller-DyLpTxM7.js';
6
+ import { I as I18nController } from './i18n-controller-CH4e9sju.js';
7
+ import { M as MenuTriggerController } from './menu-trigger-controller-CEJq1ugC.js';
8
8
  import './base-Cl6v8-BZ.js';
9
9
  import './directive-ZPhl09Yt.js';
10
- import './strings-BJPuhKJk.js';
10
+ import './strings-o6v6Hrmn.js';
11
11
  import './locale-DEsJZCQG.js';
12
12
 
13
13
  var css_248z = i`* {
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@redvars/peacock",
3
3
  "description": "The foundation for beautiful user interfaces",
4
4
  "license": "Apache-2.0",
5
- "version": "4.1.0",
5
+ "version": "4.2.1",
6
6
  "type": "module",
7
7
  "main": "dist/index.js",
8
8
  "module": "dist/index.js",
@@ -156,9 +156,10 @@ export class SuggestionController implements ReactiveController {
156
156
  /**
157
157
  * The Suggested badge with its clear button, while the suggestion shows. With `withReason` the
158
158
  * badge carries the reason in its tooltip, for controls that have no helper text to show it in.
159
+ * With `iconOnly` it shows just the sparkle, for a field too narrow for the label.
159
160
  */
160
161
  badge(
161
- options: { slot?: string; withReason?: boolean } = {},
162
+ options: { slot?: string; withReason?: boolean; iconOnly?: boolean } = {},
162
163
  ): TemplateResult | typeof nothing {
163
164
  if (!this.visible) return nothing;
164
165
  return html`<wc-ai-badge
@@ -166,6 +167,7 @@ export class SuggestionController implements ReactiveController {
166
167
  part="suggestion-badge"
167
168
  slot=${options.slot ?? nothing}
168
169
  reason=${options.withReason ? this.reason : ''}
170
+ ?icon-only=${options.iconOnly}
169
171
  dismissible
170
172
  @click=${this.onBadgeClick}
171
173
  @dismiss=${this.onBadgeDismiss}
@@ -15,7 +15,6 @@ export const defaultStrings = {
15
15
  disabled: 'Disabled',
16
16
  readOnly: 'Read only',
17
17
  dragToReorder: 'Drag to reorder',
18
- readOnlyTag: 'Read Only',
19
18
 
20
19
  // ── Intents (alert, notification) ────────────────────────────────────────
21
20
  intentNote: 'Note',
@@ -1175,6 +1174,12 @@ export const defaultStrings = {
1175
1174
  /** Who wrote a message, read before it. */
1176
1175
  chatYou: 'You',
1177
1176
  chatAssistant: 'Assistant',
1177
+ /** Who wrote a message from another person, when it has no `author`. */
1178
+ chatParticipant: 'Participant',
1179
+ /** Where a message came from, for example "via Teams". */
1180
+ chatVia: (channel: string): string => `via ${channel}`,
1181
+ /** Accessible name of the quick replies under a message. */
1182
+ chatQuickReplies: 'Suggested replies',
1178
1183
  chatCopy: 'Copy',
1179
1184
  chatRegenerate: 'Try again',
1180
1185
  chatGoodAnswer: 'Good answer',
@@ -17,17 +17,22 @@ export interface MenuTriggerOptions {
17
17
 
18
18
  /**
19
19
  * The menu wiring shared by buttons that open a `wc-menu` (dropdown button, split button):
20
- * show / close / toggle, Arrow Up / Down on the trigger, the trigger's `aria-haspopup`,
21
- * `aria-expanded` and `aria-controls`, and the host's `open` / `close` events (ADR-030001).
20
+ * show / close / toggle, Arrow Up / Down on the trigger, the open state behind the trigger's
21
+ * `aria-expanded`, and the host's `open` / `close` events (ADR-030001).
22
22
  *
23
23
  * The menu's own `open` / `close` events are stopped inside the host, which fires its own `open`
24
- * and `close` instead; `close` carries `detail.reason` from the menu's close event. The host renders the menu with `id=${trigger.menuId}`, `@open=${trigger.handleMenuOpen}`
25
- * and `@close=${trigger.handleMenuClose}`, and the trigger button with
26
- * `.configAria=${trigger.triggerAria}`, `@click=${trigger.handleTriggerClick}` and
24
+ * and `close` instead; `close` carries `detail.reason` from the menu's close event. The host
25
+ * renders the menu with `id=${trigger.menuId}`, `@open=${trigger.handleMenuOpen}` and
26
+ * `@close=${trigger.handleMenuClose}`, and the trigger button with `aria-haspopup="menu"`,
27
+ * `aria-expanded=${String(trigger.open)}`, `@click=${trigger.handleTriggerClick}` and
27
28
  * `@keydown=${trigger.handleTriggerKeyDown}`.
29
+ *
30
+ * Add `aria-controls=${trigger.menuId}` only when the trigger is a native `<button>` in the same
31
+ * shadow root as the menu. A `wc-button` or `wc-icon-button` renders its `<button>` in its own
32
+ * shadow root, where an ID reference to the menu cannot resolve, so leave `aria-controls` off it.
28
33
  */
29
34
  export class MenuTriggerController {
30
- /** Id for the menu, referenced by the trigger's `aria-controls`. */
35
+ /** Id for the menu, for the `aria-controls` of a native trigger in the same shadow root. */
31
36
  readonly menuId: string;
32
37
 
33
38
  private readonly host: ReactiveControllerHost & HTMLElement;
@@ -50,15 +55,6 @@ export class MenuTriggerController {
50
55
  return this._open;
51
56
  }
52
57
 
53
- /** ARIA for the trigger button. */
54
- get triggerAria(): Record<string, string> {
55
- return {
56
- 'aria-haspopup': 'menu',
57
- 'aria-expanded': String(this._open),
58
- 'aria-controls': this.menuId,
59
- };
60
- }
61
-
62
58
  /** Opens the menu, anchored to the host, and focuses its first (or last) item. */
63
59
  show(focusTarget: MenuFocusTarget = 'first') {
64
60
  const menu = this.options.menu();
@@ -85,6 +85,22 @@
85
85
  flex: 1;
86
86
  }
87
87
 
88
+ // Shown with `show-readonly-badge` while the editor is read-only or disabled, as on
89
+ // wc-code-editor.
90
+ .read-only-badge {
91
+ display: inline-flex;
92
+ align-items: center;
93
+ gap: var(--spacing-050, 0.25rem);
94
+ padding: 0 var(--spacing-100, 0.5rem);
95
+ color: var(--color-on-surface-variant);
96
+
97
+ @include mixin.get-typography(label-small);
98
+
99
+ wc-icon {
100
+ --icon-size: 0.875rem;
101
+ }
102
+ }
103
+
88
104
  // ── Editing area ──────────────────────────────────────────────────────────
89
105
 
90
106
  .editor-area {
@@ -192,9 +208,17 @@
192
208
  border-radius: 0;
193
209
  }
194
210
 
195
- :host([disabled]) .editor-area {
196
- cursor: not-allowed;
197
- opacity: 0.6;
211
+ // Disabled dims the toolbar and the text, as on wc-code-editor. Read-only keeps full contrast:
212
+ // the text is still meant to be read.
213
+ :host([disabled]) {
214
+ .toolbar,
215
+ .editor-area {
216
+ opacity: var(--state-disabled-content-opacity, 0.38);
217
+ }
218
+
219
+ .editor-area {
220
+ cursor: not-allowed;
221
+ }
198
222
  }
199
223
 
200
224
  :host([readonly]) .editor-area {
@@ -211,13 +235,6 @@
211
235
  padding-block: var(--spacing-100, 0.5rem);
212
236
  }
213
237
 
214
- .state-tag {
215
- position: absolute;
216
- inset-block-start: var(--spacing-050, 0.25rem);
217
- inset-inline-end: var(--spacing-050, 0.25rem);
218
- z-index: 1;
219
- }
220
-
221
238
  // ── Anchors for popups ────────────────────────────────────────────────────
222
239
 
223
240
  .slash-anchor,
@@ -108,6 +108,10 @@ export default abstract class RichTextInput
108
108
  @property({ type: Boolean, attribute: 'hide-toolbar' })
109
109
  hideToolbar = false;
110
110
 
111
+ /** Shows a "Read only" badge in the toolbar while the editor is read-only or disabled. Not shown with `hide-toolbar`. */
112
+ @property({ type: Boolean, attribute: 'show-readonly-badge' })
113
+ showReadonlyBadge = false;
114
+
111
115
  /** Maximum number of characters of text. Typing stops there, and a count shows below. */
112
116
  @property({ type: Number, attribute: 'maxlength' })
113
117
  maxlength?: number;
@@ -638,17 +642,29 @@ export default abstract class RichTextInput
638
642
  if (!this.sourceView) event.preventDefault();
639
643
  };
640
644
 
645
+ /**
646
+ * The toolbar. A read-only or disabled editor shows no formatting tools, which could do
647
+ * nothing: only View source, and the "Read only" badge with `show-readonly-badge`.
648
+ */
641
649
  private renderToolbar() {
642
650
  if (this.hideToolbar) return nothing;
643
651
  const { editor, i18n } = this;
652
+ const locked = this.disabled || this.readonly;
644
653
  return html`<wc-toolbar
645
654
  class="toolbar"
646
655
  variant="flat"
647
656
  aria-label=${i18n.t('formattingToolbar')}
648
657
  @mousedown=${this.keepSelection}
649
658
  >
650
- ${editor && !this.sourceView ? this.renderTools(editor) : nothing}
659
+ ${editor && !this.sourceView && !locked
660
+ ? this.renderTools(editor)
661
+ : nothing}
651
662
  <span class="toolbar-spacer" aria-hidden="true"></span>
663
+ ${locked && this.showReadonlyBadge
664
+ ? html`<span class="read-only-badge">
665
+ <wc-icon name="lock"></wc-icon>${i18n.t('readOnly')}
666
+ </span>`
667
+ : nothing}
652
668
  <wc-icon-button
653
669
  class="tool source-toggle"
654
670
  variant="text"
@@ -666,20 +682,6 @@ export default abstract class RichTextInput
666
682
  </wc-toolbar>`;
667
683
  }
668
684
 
669
- protected renderStateTag() {
670
- if (this.disabled) {
671
- return html`<wc-tag class="state-tag" intent="danger"
672
- >${this.i18n.t('disabled')}</wc-tag
673
- >`;
674
- }
675
- if (this.readonly) {
676
- return html`<wc-tag class="state-tag" intent="danger"
677
- >${this.i18n.t('readOnlyTag')}</wc-tag
678
- >`;
679
- }
680
- return nothing;
681
- }
682
-
683
685
  /** The count below the field, with `maxlength`. */
684
686
  private textCount(): string {
685
687
  const max = this.maxlength;
@@ -773,7 +775,6 @@ export default abstract class RichTextInput
773
775
  ></wc-code-editor>
774
776
  </div>`
775
777
  : nothing}
776
- ${this.renderStateTag()}
777
778
  </div>
778
779
  </wc-field>
779
780
  ${this.renderPopups()}
@@ -149,6 +149,26 @@ export function formatAbsoluteDate(
149
149
  ).format(time);
150
150
  }
151
151
 
152
+ /**
153
+ * `date` as a clock time in `locale` ("9:41 AM"), with the date before it when it is not today
154
+ * ("Nov 2, 9:41 AM"), for timestamps in a conversation.
155
+ */
156
+ export function formatClockTime(
157
+ date: Date | number,
158
+ locale: string,
159
+ now: number = Date.now(),
160
+ ): string {
161
+ const time = toTime(date);
162
+ const sameDay =
163
+ new Date(time).toDateString() === new Date(now).toDateString();
164
+ return dateFormat(
165
+ locale,
166
+ sameDay
167
+ ? { hour: 'numeric', minute: '2-digit' }
168
+ : { month: 'short', day: 'numeric', hour: 'numeric', minute: '2-digit' },
169
+ ).format(time);
170
+ }
171
+
152
172
  /**
153
173
  * `date` relative to now ("5 minutes ago"), or, when `absoluteAfter` is set and the date is
154
174
  * farther from now than that, an absolute date ("Nov 2").
@@ -48,6 +48,14 @@
48
48
  padding-inline-end: var(--spacing-025, 0.125rem);
49
49
  }
50
50
 
51
+ :host([icon-only]) .badge {
52
+ padding-inline-start: var(--spacing-050, 0.25rem);
53
+ }
54
+
55
+ :host([icon-only]:not([dismissible])) .badge {
56
+ padding-inline-end: var(--spacing-050, 0.25rem);
57
+ }
58
+
51
59
  .label {
52
60
  display: inline-flex;
53
61
  align-items: center;
@@ -31,6 +31,9 @@ export type AiBadgeKind = 'suggested' | 'draft' | 'generated';
31
31
  * and is read as the badge's description. <code>dismissible</code> adds a clear button that fires
32
32
  * <code>dismiss</code>; the app then removes the suggestion, discards the draft or hides the
33
33
  * summary.</p>
34
+ * <p><code>icon-only</code> keeps just the sparkle where there is no room for the label, such as a
35
+ * narrow field: the label is still read and shows in the tooltip. Fields switch to it on their
36
+ * own when they are narrow.</p>
34
37
  * <p>When AI is off for the page (<code>setPeacockAi({ enabled: false })</code>) the badge renders
35
38
  * nothing, so a page that still passes AI state in never shows a stale marker.</p>
36
39
  * <p>The label is always text, never only the color or the sparkle. Replace it with the default
@@ -74,6 +77,13 @@ export class AiBadge extends LitElement {
74
77
  /** Adds a button that clears the output in one action. */
75
78
  @property({ type: Boolean, reflect: true }) dismissible = false;
76
79
 
80
+ /**
81
+ * Shows only the sparkle, for tight spaces such as a narrow field. The label stays the
82
+ * accessible name and shows in the tooltip.
83
+ */
84
+ @property({ type: Boolean, reflect: true, attribute: 'icon-only' })
85
+ iconOnly = false;
86
+
77
87
  /** Per-instance string overrides. */
78
88
  @property({ attribute: false }) strings?: Partial<PeacockStrings>;
79
89
 
@@ -109,10 +119,17 @@ export class AiBadge extends LitElement {
109
119
  render() {
110
120
  if (!this._ai.available) return nothing;
111
121
  const reason = this.reason.trim();
122
+ const { iconOnly } = this;
123
+ // Icon-only, the tooltip says what the sparkle stands for, then why.
124
+ const tooltip = iconOnly
125
+ ? [this._label(), reason].filter(Boolean).join('. ')
126
+ : reason;
112
127
  // The tooltip sits outside the badge so it doesn't inherit the badge's one-line label styles.
113
128
  return html`<span class="badge" part="badge"
114
- ><span class="label" id="label" tabindex=${reason ? 0 : nothing}
115
- >${sparkle}<slot>${this._label()}</slot></span
129
+ ><span class="label" id="label" tabindex=${tooltip ? 0 : nothing}
130
+ >${sparkle}<span class=${iconOnly ? 'screen-reader-only' : 'text'}
131
+ ><slot>${this._label()}</slot></span
132
+ ></span
116
133
  >${this.dismissible
117
134
  ? html`<button
118
135
  class="dismiss"
@@ -124,9 +141,9 @@ export class AiBadge extends LitElement {
124
141
  <wc-icon name="close"></wc-icon>
125
142
  </button>`
126
143
  : nothing}</span
127
- >${reason
144
+ >${tooltip
128
145
  ? html`<wc-tooltip for="label" placement="bottom-start"
129
- >${reason}</wc-tooltip
146
+ >${tooltip}</wc-tooltip
130
147
  >`
131
148
  : nothing}`;
132
149
  }
@@ -48,8 +48,15 @@
48
48
  align-items: center;
49
49
  justify-content: center;
50
50
  height: var(--button-height);
51
- padding: 0
52
- var(--button-container-padding, var(--_button-container-padding));
51
+ padding-block: 0;
52
+ padding-inline-start: var(
53
+ --button-container-padding-start,
54
+ var(--button-container-padding, var(--_button-container-padding))
55
+ );
56
+ padding-inline-end: var(
57
+ --button-container-padding-end,
58
+ var(--button-container-padding, var(--_button-container-padding))
59
+ );
53
60
  width: 100%;
54
61
 
55
62
  .label {
@@ -2,7 +2,9 @@
2
2
 
3
3
  // Mixin for the shared transition logic
4
4
  @mixin button-transition {
5
- transition-property: inset, width, height, transform, opacity;
5
+ transition-property:
6
+ inset, width, height, transform, opacity, border-start-start-radius,
7
+ border-start-end-radius, border-end-start-radius, border-end-end-radius;
6
8
  transition-duration: 200ms;
7
9
  transition-timing-function: var(--easing-standard);
8
10
  will-change: inset, transform, opacity;
@@ -50,6 +50,10 @@ export type {
50
50
  * @cssprop --button-container-shape-end-start - Defines the start position of the button container shape.
51
51
  * @cssprop --button-container-shape-end-end - Defines the end position of the button container shape.
52
52
  *
53
+ * @cssprop --button-container-padding - Inline padding of the button container, on both sides.
54
+ * @cssprop --button-container-padding-start - Inline-start padding of the button container; overrides `--button-container-padding`.
55
+ * @cssprop --button-container-padding-end - Inline-end padding of the button container; overrides `--button-container-padding`.
56
+ *
53
57
  *
54
58
  * @cssprop --filled-button-container-color - Color of the filled button container.
55
59
  * @cssprop --filled-button-label-text-color - Text color of the filled button label.
@@ -14,6 +14,16 @@
14
14
  * @prop --chat-message-bubble-color: Text color of the person's bubble
15
15
  */
16
16
  --chat-message-bubble-color: var(--color-on-secondary-container);
17
+
18
+ /**
19
+ * @prop --chat-message-participant-background: Background of a participant's bubble
20
+ */
21
+ --chat-message-participant-background: var(--color-surface-container-high);
22
+
23
+ /**
24
+ * @prop --chat-message-participant-color: Text color of a participant's bubble
25
+ */
26
+ --chat-message-participant-color: var(--color-on-surface);
17
27
  }
18
28
 
19
29
  .message {
@@ -57,6 +67,68 @@
57
67
  var(--shape-corner-large) var(--shape-corner-extra-small);
58
68
  }
59
69
 
70
+ // A participant's bubble starts the line, so its square corner is at the start.
71
+ .participant .bubble {
72
+ color: var(--chat-message-participant-color);
73
+ background: var(--chat-message-participant-background);
74
+ border-radius: var(--shape-corner-extra-small) var(--shape-corner-large)
75
+ var(--shape-corner-large) var(--shape-corner-large);
76
+ }
77
+
78
+ :host(:dir(rtl)) .participant .bubble {
79
+ border-radius: var(--shape-corner-large) var(--shape-corner-extra-small)
80
+ var(--shape-corner-large) var(--shape-corner-large);
81
+ }
82
+
83
+ .header {
84
+ display: flex;
85
+ flex-wrap: wrap;
86
+ align-items: center;
87
+ gap: var(--spacing-050, 0.25rem) var(--spacing-100, 0.5rem);
88
+ min-block-size: 1.25rem;
89
+ color: var(--color-on-surface-variant);
90
+ @include mixin.get-typography-not-important(label-medium);
91
+
92
+ &[hidden] {
93
+ display: none;
94
+ }
95
+ }
96
+
97
+ .user .header {
98
+ justify-content: flex-end;
99
+ }
100
+
101
+ // The gap after the header is the body's; pull the bubble closer to its own name.
102
+ .header:not([hidden]) + slot + .bubble,
103
+ .header:not([hidden]) + slot + .content {
104
+ margin-block-start: calc(-1 * var(--spacing-100, 0.5rem));
105
+ }
106
+
107
+ .author {
108
+ color: var(--color-on-surface);
109
+ font-weight: 600;
110
+ }
111
+
112
+ .channel::before,
113
+ .time::before {
114
+ margin-inline-end: var(--spacing-100, 0.5rem);
115
+ content: '·';
116
+ }
117
+
118
+ ::slotted([slot='meta']) {
119
+ flex: none;
120
+ }
121
+
122
+ .suggestions {
123
+ display: flex;
124
+ flex-wrap: wrap;
125
+ gap: var(--spacing-100, 0.5rem);
126
+ }
127
+
128
+ .user .suggestions {
129
+ justify-content: flex-end;
130
+ }
131
+
60
132
  .content {
61
133
  min-inline-size: 0;
62
134
  }